cola Report for GDS2827

Date: 2019-12-25 20:17:21 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 10612 rows and 88 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] 10612    88

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
CV:skmeans 2 1.000 0.959 0.983 **
MAD:skmeans 2 1.000 0.964 0.985 **
MAD:NMF 2 0.999 0.965 0.985 **
SD:NMF 2 0.999 0.967 0.986 **
SD:skmeans 3 0.925 0.882 0.954 * 2
ATC:skmeans 3 0.924 0.890 0.959 *
ATC:pam 4 0.902 0.878 0.951 *
ATC:NMF 2 0.860 0.919 0.965
ATC:mclust 5 0.850 0.867 0.909
MAD:pam 2 0.837 0.907 0.958
MAD:kmeans 2 0.818 0.901 0.949
SD:pam 2 0.813 0.901 0.953
SD:mclust 3 0.784 0.923 0.947
MAD:mclust 2 0.730 0.938 0.954
SD:kmeans 2 0.716 0.908 0.934
CV:pam 4 0.710 0.836 0.894
CV:NMF 2 0.700 0.831 0.930
CV:mclust 5 0.647 0.708 0.817
ATC:kmeans 2 0.599 0.808 0.900
CV:kmeans 3 0.525 0.637 0.811
ATC:hclust 2 0.287 0.581 0.816
CV:hclust 3 0.240 0.455 0.721
MAD:hclust 3 0.225 0.529 0.743
SD:hclust 3 0.202 0.516 0.726

**: 1-PAC > 0.95, *: 1-PAC > 0.9

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

Consensus heatmaps for all methods. (What is a consensus heatmap?)

collect_plots(res_list, k = 2, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-1

collect_plots(res_list, k = 3, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-2

collect_plots(res_list, k = 4, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-3

collect_plots(res_list, k = 5, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-4

collect_plots(res_list, k = 6, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-5

Membership heatmap

Membership heatmaps for all methods. (What is a membership heatmap?)

collect_plots(res_list, k = 2, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-1

collect_plots(res_list, k = 3, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-2

collect_plots(res_list, k = 4, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-3

collect_plots(res_list, k = 5, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-4

collect_plots(res_list, k = 6, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-5

Signature heatmap

Signature heatmaps for all methods. (What is a signature heatmap?)

Note in following heatmaps, rows are scaled.

collect_plots(res_list, k = 2, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-1

collect_plots(res_list, k = 3, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-2

collect_plots(res_list, k = 4, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-3

collect_plots(res_list, k = 5, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-4

collect_plots(res_list, k = 6, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-5

Statistics table

The statistics used for measuring the stability of consensus partitioning. (How are they defined?)

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 0.999           0.967       0.986          0.496 0.504   0.504
#> CV:NMF      2 0.700           0.831       0.930          0.487 0.515   0.515
#> MAD:NMF     2 0.999           0.965       0.985          0.496 0.504   0.504
#> ATC:NMF     2 0.860           0.919       0.965          0.500 0.498   0.498
#> SD:skmeans  2 0.952           0.921       0.972          0.505 0.494   0.494
#> CV:skmeans  2 1.000           0.959       0.983          0.505 0.495   0.495
#> MAD:skmeans 2 1.000           0.964       0.985          0.506 0.495   0.495
#> ATC:skmeans 2 0.482           0.767       0.896          0.503 0.504   0.504
#> SD:mclust   2 0.448           0.842       0.866          0.444 0.504   0.504
#> CV:mclust   2 0.441           0.771       0.870          0.283 0.796   0.796
#> MAD:mclust  2 0.730           0.938       0.954          0.485 0.504   0.504
#> ATC:mclust  2 0.522           0.844       0.910          0.290 0.762   0.762
#> SD:kmeans   2 0.716           0.908       0.934          0.494 0.501   0.501
#> CV:kmeans   2 0.231           0.546       0.778          0.469 0.520   0.520
#> MAD:kmeans  2 0.818           0.901       0.949          0.500 0.501   0.501
#> ATC:kmeans  2 0.599           0.808       0.900          0.479 0.538   0.538
#> SD:pam      2 0.813           0.901       0.953          0.482 0.511   0.511
#> CV:pam      2 0.469           0.569       0.816          0.493 0.495   0.495
#> MAD:pam     2 0.837           0.907       0.958          0.480 0.520   0.520
#> ATC:pam     2 0.562           0.818       0.919          0.500 0.495   0.495
#> SD:hclust   2 0.148           0.492       0.782          0.388 0.645   0.645
#> CV:hclust   2 0.308           0.763       0.865          0.335 0.671   0.671
#> MAD:hclust  2 0.151           0.620       0.807          0.378 0.632   0.632
#> ATC:hclust  2 0.287           0.581       0.816          0.428 0.589   0.589
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.597           0.623       0.794          0.313 0.760   0.565
#> CV:NMF      3 0.450           0.599       0.785          0.352 0.742   0.544
#> MAD:NMF     3 0.589           0.581       0.777          0.314 0.752   0.551
#> ATC:NMF     3 0.469           0.440       0.719          0.330 0.639   0.393
#> SD:skmeans  3 0.925           0.882       0.954          0.317 0.782   0.584
#> CV:skmeans  3 0.746           0.851       0.920          0.318 0.742   0.524
#> MAD:skmeans 3 0.847           0.866       0.945          0.316 0.789   0.596
#> ATC:skmeans 3 0.924           0.890       0.959          0.335 0.710   0.482
#> SD:mclust   3 0.784           0.923       0.947          0.421 0.839   0.687
#> CV:mclust   3 0.260           0.579       0.805          1.056 0.460   0.371
#> MAD:mclust  3 0.689           0.761       0.893          0.306 0.828   0.666
#> ATC:mclust  3 0.437           0.744       0.787          1.117 0.526   0.405
#> SD:kmeans   3 0.564           0.741       0.848          0.320 0.762   0.557
#> CV:kmeans   3 0.525           0.637       0.811          0.384 0.732   0.522
#> MAD:kmeans  3 0.538           0.732       0.851          0.311 0.762   0.557
#> ATC:kmeans  3 0.668           0.759       0.872          0.373 0.736   0.535
#> SD:pam      3 0.577           0.761       0.885          0.334 0.826   0.666
#> CV:pam      3 0.438           0.568       0.812          0.266 0.581   0.348
#> MAD:pam     3 0.613           0.793       0.895          0.354 0.809   0.638
#> ATC:pam     3 0.590           0.770       0.857          0.293 0.773   0.577
#> SD:hclust   3 0.202           0.516       0.726          0.488 0.708   0.569
#> CV:hclust   3 0.240           0.455       0.721          0.719 0.737   0.616
#> MAD:hclust  3 0.225           0.529       0.743          0.512 0.769   0.639
#> ATC:hclust  3 0.302           0.417       0.655          0.374 0.714   0.549
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.561           0.630       0.798         0.1034 0.838   0.606
#> CV:NMF      4 0.537           0.623       0.804         0.1249 0.797   0.508
#> MAD:NMF     4 0.528           0.471       0.711         0.1190 0.866   0.650
#> ATC:NMF     4 0.649           0.725       0.859         0.1193 0.721   0.357
#> SD:skmeans  4 0.745           0.855       0.892         0.1153 0.870   0.642
#> CV:skmeans  4 0.647           0.744       0.849         0.1161 0.878   0.659
#> MAD:skmeans 4 0.690           0.784       0.836         0.1173 0.861   0.624
#> ATC:skmeans 4 0.768           0.855       0.913         0.1197 0.853   0.592
#> SD:mclust   4 0.779           0.594       0.837         0.0943 0.952   0.871
#> CV:mclust   4 0.583           0.629       0.734         0.1668 0.820   0.588
#> MAD:mclust  4 0.593           0.588       0.721         0.0824 0.882   0.695
#> ATC:mclust  4 0.415           0.594       0.767         0.1051 0.649   0.318
#> SD:kmeans   4 0.584           0.752       0.809         0.1278 0.906   0.735
#> CV:kmeans   4 0.569           0.707       0.799         0.1217 0.903   0.728
#> MAD:kmeans  4 0.566           0.683       0.771         0.1252 0.906   0.735
#> ATC:kmeans  4 0.541           0.418       0.653         0.1279 0.836   0.562
#> SD:pam      4 0.716           0.720       0.881         0.1290 0.862   0.636
#> CV:pam      4 0.710           0.836       0.894         0.1536 0.862   0.650
#> MAD:pam     4 0.714           0.745       0.890         0.1276 0.851   0.609
#> ATC:pam     4 0.902           0.878       0.951         0.1379 0.686   0.323
#> SD:hclust   4 0.322           0.479       0.670         0.1540 0.870   0.704
#> CV:hclust   4 0.342           0.355       0.683         0.1221 0.880   0.738
#> MAD:hclust  4 0.325           0.454       0.675         0.1612 0.881   0.734
#> ATC:hclust  4 0.453           0.541       0.748         0.1943 0.767   0.477
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.713           0.740       0.862         0.1019 0.852   0.542
#> CV:NMF      5 0.607           0.616       0.792         0.0679 0.899   0.652
#> MAD:NMF     5 0.675           0.699       0.839         0.0894 0.846   0.510
#> ATC:NMF     5 0.590           0.595       0.776         0.0581 0.912   0.686
#> SD:skmeans  5 0.785           0.727       0.859         0.0842 0.883   0.590
#> CV:skmeans  5 0.690           0.590       0.766         0.0795 0.857   0.525
#> MAD:skmeans 5 0.775           0.769       0.872         0.0833 0.859   0.527
#> ATC:skmeans 5 0.782           0.745       0.858         0.0667 0.926   0.713
#> SD:mclust   5 0.590           0.563       0.732         0.1276 0.846   0.550
#> CV:mclust   5 0.647           0.708       0.817         0.0842 0.713   0.327
#> MAD:mclust  5 0.610           0.614       0.768         0.1263 0.757   0.371
#> ATC:mclust  5 0.850           0.867       0.909         0.0976 0.851   0.582
#> SD:kmeans   5 0.668           0.599       0.739         0.0741 0.881   0.599
#> CV:kmeans   5 0.597           0.584       0.747         0.0697 0.937   0.783
#> MAD:kmeans  5 0.639           0.688       0.772         0.0729 0.839   0.495
#> ATC:kmeans  5 0.640           0.685       0.798         0.0681 0.856   0.515
#> SD:pam      5 0.684           0.581       0.791         0.0813 0.895   0.630
#> CV:pam      5 0.656           0.550       0.742         0.0765 0.910   0.708
#> MAD:pam     5 0.655           0.499       0.760         0.0779 0.926   0.737
#> ATC:pam     5 0.822           0.851       0.899         0.0831 0.895   0.626
#> SD:hclust   5 0.450           0.509       0.700         0.1015 0.850   0.579
#> CV:hclust   5 0.440           0.323       0.640         0.1428 0.843   0.629
#> MAD:hclust  5 0.446           0.474       0.638         0.1066 0.807   0.524
#> ATC:hclust  5 0.508           0.562       0.733         0.0668 0.909   0.693
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.726           0.707       0.845         0.0439 0.911   0.612
#> CV:NMF      6 0.733           0.645       0.824         0.0403 0.868   0.485
#> MAD:NMF     6 0.703           0.670       0.822         0.0446 0.913   0.614
#> ATC:NMF     6 0.614           0.592       0.750         0.0393 0.954   0.796
#> SD:skmeans  6 0.768           0.626       0.783         0.0391 0.932   0.678
#> CV:skmeans  6 0.715           0.603       0.768         0.0404 0.920   0.633
#> MAD:skmeans 6 0.764           0.642       0.806         0.0393 0.948   0.743
#> ATC:skmeans 6 0.820           0.775       0.862         0.0393 0.946   0.746
#> SD:mclust   6 0.598           0.448       0.669         0.0369 0.899   0.570
#> CV:mclust   6 0.572           0.530       0.682         0.0573 0.953   0.823
#> MAD:mclust  6 0.599           0.492       0.655         0.0442 0.904   0.623
#> ATC:mclust  6 0.666           0.542       0.793         0.0516 0.859   0.544
#> SD:kmeans   6 0.691           0.576       0.749         0.0423 0.952   0.774
#> CV:kmeans   6 0.646           0.496       0.668         0.0466 0.899   0.603
#> MAD:kmeans  6 0.678           0.562       0.724         0.0429 0.976   0.881
#> ATC:kmeans  6 0.694           0.647       0.771         0.0411 0.946   0.745
#> SD:pam      6 0.663           0.514       0.744         0.0321 0.898   0.577
#> CV:pam      6 0.782           0.802       0.868         0.0592 0.844   0.457
#> MAD:pam     6 0.705           0.467       0.706         0.0340 0.900   0.610
#> ATC:pam     6 0.796           0.718       0.835         0.0363 0.956   0.781
#> SD:hclust   6 0.511           0.541       0.666         0.0514 0.974   0.893
#> CV:hclust   6 0.502           0.411       0.670         0.0450 0.874   0.642
#> MAD:hclust  6 0.511           0.349       0.608         0.0677 0.818   0.448
#> ATC:hclust  6 0.586           0.530       0.718         0.0379 0.972   0.886

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 specimen(p) k
#> SD:NMF      87    3.20e-08 2
#> CV:NMF      79    3.12e-08 2
#> MAD:NMF     87    3.20e-08 2
#> ATC:NMF     85    4.10e-06 2
#> SD:skmeans  83    3.75e-10 2
#> CV:skmeans  86    5.07e-10 2
#> MAD:skmeans 86    9.27e-09 2
#> ATC:skmeans 76    4.23e-08 2
#> SD:mclust   87    4.07e-10 2
#> CV:mclust   82    1.79e-01 2
#> MAD:mclust  87    4.07e-10 2
#> ATC:mclust  87    2.32e-01 2
#> SD:kmeans   88    5.90e-09 2
#> CV:kmeans   66    1.08e-08 2
#> MAD:kmeans  83    5.43e-09 2
#> ATC:kmeans  85    9.69e-06 2
#> SD:pam      85    5.29e-05 2
#> CV:pam      57    7.39e-05 2
#> MAD:pam     85    4.08e-05 2
#> ATC:pam     80    2.20e-05 2
#> SD:hclust   61    4.64e-04 2
#> CV:hclust   80    1.95e-03 2
#> MAD:hclust  70    5.27e-03 2
#> ATC:hclust  63    5.21e-03 2
test_to_known_factors(res_list, k = 3)
#>              n specimen(p) k
#> SD:NMF      65    2.79e-05 3
#> CV:NMF      72    5.84e-08 3
#> MAD:NMF     62    3.93e-05 3
#> ATC:NMF     49    1.74e-03 3
#> SD:skmeans  81    8.29e-07 3
#> CV:skmeans  86    9.26e-07 3
#> MAD:skmeans 83    3.28e-07 3
#> ATC:skmeans 82    8.61e-05 3
#> SD:mclust   87    1.26e-07 3
#> CV:mclust   60    3.00e-06 3
#> MAD:mclust  80    1.04e-07 3
#> ATC:mclust  83    1.74e-04 3
#> SD:kmeans   80    2.23e-06 3
#> CV:kmeans   67    5.25e-05 3
#> MAD:kmeans  79    1.28e-06 3
#> ATC:kmeans  82    3.40e-06 3
#> SD:pam      80    1.04e-04 3
#> CV:pam      60    2.61e-04 3
#> MAD:pam     83    4.06e-05 3
#> ATC:pam     84    3.19e-04 3
#> SD:hclust   66    3.01e-07 3
#> CV:hclust   52    4.01e-07 3
#> MAD:hclust  58    8.84e-06 3
#> ATC:hclust  32    1.30e-01 3
test_to_known_factors(res_list, k = 4)
#>              n specimen(p) k
#> SD:NMF      72    3.90e-05 4
#> CV:NMF      71    5.06e-05 4
#> MAD:NMF     51    3.25e-06 4
#> ATC:NMF     76    1.92e-04 4
#> SD:skmeans  86    3.60e-05 4
#> CV:skmeans  83    7.32e-06 4
#> MAD:skmeans 84    6.30e-05 4
#> ATC:skmeans 86    7.87e-05 4
#> SD:mclust   57    5.77e-07 4
#> CV:mclust   52    2.28e-06 4
#> MAD:mclust  59    2.34e-06 4
#> ATC:mclust  65    2.87e-04 4
#> SD:kmeans   83    2.02e-05 4
#> CV:kmeans   79    2.94e-06 4
#> MAD:kmeans  76    2.22e-05 4
#> ATC:kmeans  38    5.08e-04 4
#> SD:pam      75    3.25e-05 4
#> CV:pam      84    8.83e-04 4
#> MAD:pam     76    4.47e-05 4
#> ATC:pam     80    1.27e-03 4
#> SD:hclust   47    8.68e-06 4
#> CV:hclust   33    4.12e-05 4
#> MAD:hclust  43    9.54e-04 4
#> ATC:hclust  54    3.35e-03 4
test_to_known_factors(res_list, k = 5)
#>              n specimen(p) k
#> SD:NMF      78    1.02e-03 5
#> CV:NMF      73    1.26e-05 5
#> MAD:NMF     76    3.49e-04 5
#> ATC:NMF     67    1.50e-04 5
#> SD:skmeans  76    4.17e-04 5
#> CV:skmeans  64    8.16e-04 5
#> MAD:skmeans 79    2.88e-04 5
#> ATC:skmeans 76    9.13e-05 5
#> SD:mclust   59    1.81e-04 5
#> CV:mclust   82    4.30e-03 5
#> MAD:mclust  73    2.27e-08 5
#> ATC:mclust  84    2.41e-03 5
#> SD:kmeans   62    1.44e-03 5
#> CV:kmeans   64    1.32e-06 5
#> MAD:kmeans  78    1.09e-03 5
#> ATC:kmeans  74    1.42e-04 5
#> SD:pam      67    1.02e-04 5
#> CV:pam      53    2.86e-03 5
#> MAD:pam     52    9.84e-02 5
#> ATC:pam     85    9.13e-04 5
#> SD:hclust   50    5.36e-03 5
#> CV:hclust   34    4.15e-03 5
#> MAD:hclust  48    2.00e-02 5
#> ATC:hclust  60    1.91e-03 5
test_to_known_factors(res_list, k = 6)
#>              n specimen(p) k
#> SD:NMF      76    8.28e-05 6
#> CV:NMF      70    1.07e-02 6
#> MAD:NMF     69    1.72e-03 6
#> ATC:NMF     67    2.34e-03 6
#> SD:skmeans  61    2.08e-02 6
#> CV:skmeans  60    2.60e-03 6
#> MAD:skmeans 65    1.49e-02 6
#> ATC:skmeans 80    1.74e-03 6
#> SD:mclust   39    6.52e-04 6
#> CV:mclust   48    4.97e-04 6
#> MAD:mclust  48    2.37e-05 6
#> ATC:mclust  52    1.36e-02 6
#> SD:kmeans   64    1.99e-02 6
#> CV:kmeans   46    1.40e-03 6
#> MAD:kmeans  66    4.54e-02 6
#> ATC:kmeans  68    2.25e-06 6
#> SD:pam      49    6.33e-04 6
#> CV:pam      86    1.32e-02 6
#> MAD:pam     35    3.46e-02 6
#> ATC:pam     75    1.33e-02 6
#> SD:hclust   68    7.71e-04 6
#> CV:hclust   45    1.41e-02 6
#> MAD:hclust  27    7.53e-02 6
#> ATC:hclust  56    5.65e-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 10612 rows and 88 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 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-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.148           0.492       0.782         0.3880 0.645   0.645
#> 3 3 0.202           0.516       0.726         0.4876 0.708   0.569
#> 4 4 0.322           0.479       0.670         0.1540 0.870   0.704
#> 5 5 0.450           0.509       0.700         0.1015 0.850   0.579
#> 6 6 0.511           0.541       0.666         0.0514 0.974   0.893

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
#> GSM152032     1  0.9129     0.2931 0.672 0.328
#> GSM152033     1  0.2603     0.6611 0.956 0.044
#> GSM152063     2  0.9209     0.5703 0.336 0.664
#> GSM152074     1  0.9460     0.2117 0.636 0.364
#> GSM152080     1  0.9983    -0.0879 0.524 0.476
#> GSM152081     2  0.9866     0.3906 0.432 0.568
#> GSM152083     1  0.9850     0.0512 0.572 0.428
#> GSM152091     1  0.9983    -0.0879 0.524 0.476
#> GSM152108     1  0.7528     0.5020 0.784 0.216
#> GSM152114     1  0.9944    -0.0789 0.544 0.456
#> GSM152035     1  0.9552     0.2231 0.624 0.376
#> GSM152039     2  0.6438     0.6327 0.164 0.836
#> GSM152041     1  0.9209     0.4282 0.664 0.336
#> GSM152044     2  0.8386     0.6292 0.268 0.732
#> GSM152045     1  0.1184     0.6726 0.984 0.016
#> GSM152051     2  0.8386     0.6292 0.268 0.732
#> GSM152054     1  0.7745     0.5202 0.772 0.228
#> GSM152057     2  0.8443     0.6300 0.272 0.728
#> GSM152058     1  0.7219     0.5999 0.800 0.200
#> GSM152067     1  0.9358     0.2396 0.648 0.352
#> GSM152068     2  0.8443     0.6300 0.272 0.728
#> GSM152075     2  0.9933     0.2516 0.452 0.548
#> GSM152076     2  0.6438     0.6327 0.164 0.836
#> GSM152079     2  0.8443     0.6300 0.272 0.728
#> GSM152084     1  0.6887     0.5384 0.816 0.184
#> GSM152089     1  0.9427     0.3816 0.640 0.360
#> GSM152095     2  0.6438     0.6327 0.164 0.836
#> GSM152096     1  0.7219     0.5202 0.800 0.200
#> GSM152097     2  0.0000     0.5930 0.000 1.000
#> GSM152099     2  0.9460     0.4631 0.364 0.636
#> GSM152106     2  0.0000     0.5930 0.000 1.000
#> GSM152107     1  0.9522     0.2248 0.628 0.372
#> GSM152109     1  0.9427     0.2206 0.640 0.360
#> GSM152111     1  0.7299     0.5908 0.796 0.204
#> GSM152112     1  0.9909    -0.0742 0.556 0.444
#> GSM152113     1  0.5946     0.5829 0.856 0.144
#> GSM152115     1  0.9522     0.2248 0.628 0.372
#> GSM152030     2  0.9993     0.2628 0.484 0.516
#> GSM152038     1  0.2043     0.6725 0.968 0.032
#> GSM152042     2  0.9996     0.2462 0.488 0.512
#> GSM152062     1  0.7376     0.5060 0.792 0.208
#> GSM152077     1  0.1414     0.6683 0.980 0.020
#> GSM152088     1  0.9983    -0.0885 0.524 0.476
#> GSM152100     2  0.9933     0.2516 0.452 0.548
#> GSM152102     1  0.9661     0.1961 0.608 0.392
#> GSM152104     2  0.0000     0.5930 0.000 1.000
#> GSM152028     1  0.0000     0.6695 1.000 0.000
#> GSM152029     1  0.1843     0.6738 0.972 0.028
#> GSM152049     1  0.7139     0.5968 0.804 0.196
#> GSM152053     2  0.9996     0.2462 0.488 0.512
#> GSM152059     1  0.2423     0.6720 0.960 0.040
#> GSM152085     1  0.7139     0.5968 0.804 0.196
#> GSM152101     1  0.9522     0.2248 0.628 0.372
#> GSM152105     1  0.1184     0.6724 0.984 0.016
#> GSM152034     1  0.7376     0.5852 0.792 0.208
#> GSM152036     2  0.6531     0.6299 0.168 0.832
#> GSM152040     1  0.2603     0.6736 0.956 0.044
#> GSM152043     1  0.0376     0.6699 0.996 0.004
#> GSM152046     1  0.7950     0.5493 0.760 0.240
#> GSM152047     1  0.0938     0.6720 0.988 0.012
#> GSM152048     1  0.7219     0.5999 0.800 0.200
#> GSM152050     1  0.7219     0.5929 0.800 0.200
#> GSM152052     1  0.2603     0.6741 0.956 0.044
#> GSM152056     1  0.7299     0.5970 0.796 0.204
#> GSM152060     1  0.7950     0.5493 0.760 0.240
#> GSM152065     1  0.0000     0.6695 1.000 0.000
#> GSM152066     1  0.7299     0.5970 0.796 0.204
#> GSM152069     1  0.9427     0.2206 0.640 0.360
#> GSM152070     1  0.0938     0.6720 0.988 0.012
#> GSM152071     1  0.9427     0.2206 0.640 0.360
#> GSM152072     1  0.0938     0.6717 0.988 0.012
#> GSM152073     1  0.6148     0.6263 0.848 0.152
#> GSM152078     1  0.2236     0.6736 0.964 0.036
#> GSM152082     1  0.0000     0.6695 1.000 0.000
#> GSM152086     1  0.7056     0.5998 0.808 0.192
#> GSM152090     1  0.5629     0.6502 0.868 0.132
#> GSM152092     1  0.0000     0.6695 1.000 0.000
#> GSM152093     1  0.5178     0.6597 0.884 0.116
#> GSM152094     1  0.6247     0.6246 0.844 0.156
#> GSM152098     1  0.0376     0.6699 0.996 0.004
#> GSM152110     1  0.7299     0.5970 0.796 0.204
#> GSM152031     1  0.1184     0.6724 0.984 0.016
#> GSM152037     1  0.7299     0.5970 0.796 0.204
#> GSM152055     1  0.7950     0.5493 0.760 0.240
#> GSM152061     1  0.7950     0.5493 0.760 0.240
#> GSM152064     1  0.9129     0.4458 0.672 0.328
#> GSM152087     1  0.6343     0.6229 0.840 0.160
#> GSM152103     1  0.5294     0.6564 0.880 0.120

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.6955     0.5453 0.332 0.032 0.636
#> GSM152033     1  0.5785     0.4644 0.696 0.004 0.300
#> GSM152063     3  0.8521     0.0877 0.092 0.440 0.468
#> GSM152074     3  0.4974     0.6301 0.236 0.000 0.764
#> GSM152080     3  0.0592     0.5555 0.000 0.012 0.988
#> GSM152081     2  0.8396     0.4908 0.196 0.624 0.180
#> GSM152083     3  0.4353     0.6259 0.156 0.008 0.836
#> GSM152091     3  0.0592     0.5555 0.000 0.012 0.988
#> GSM152108     1  0.8454    -0.1240 0.480 0.088 0.432
#> GSM152114     2  0.9108     0.4644 0.316 0.520 0.164
#> GSM152035     3  0.8622     0.4692 0.296 0.132 0.572
#> GSM152039     2  0.0747     0.6135 0.016 0.984 0.000
#> GSM152041     1  0.7263     0.2922 0.568 0.400 0.032
#> GSM152044     3  0.7004     0.2340 0.020 0.428 0.552
#> GSM152045     1  0.2229     0.6871 0.944 0.012 0.044
#> GSM152051     3  0.7004     0.2340 0.020 0.428 0.552
#> GSM152054     1  0.9046     0.1601 0.528 0.160 0.312
#> GSM152057     3  0.7013     0.2285 0.020 0.432 0.548
#> GSM152058     1  0.5470     0.6513 0.796 0.168 0.036
#> GSM152067     3  0.5327     0.6145 0.272 0.000 0.728
#> GSM152068     3  0.7013     0.2285 0.020 0.432 0.548
#> GSM152075     2  0.8109     0.5402 0.272 0.620 0.108
#> GSM152076     2  0.0747     0.6135 0.016 0.984 0.000
#> GSM152079     3  0.7013     0.2285 0.020 0.432 0.548
#> GSM152084     1  0.7831     0.0580 0.540 0.056 0.404
#> GSM152089     1  0.7337     0.2218 0.540 0.428 0.032
#> GSM152095     2  0.0747     0.6135 0.016 0.984 0.000
#> GSM152096     1  0.7956    -0.0252 0.516 0.060 0.424
#> GSM152097     2  0.4121     0.5088 0.000 0.832 0.168
#> GSM152099     3  0.6402     0.4910 0.040 0.236 0.724
#> GSM152106     2  0.4121     0.5088 0.000 0.832 0.168
#> GSM152107     3  0.7588     0.5732 0.312 0.064 0.624
#> GSM152109     3  0.4887     0.6315 0.228 0.000 0.772
#> GSM152111     1  0.5318     0.6279 0.780 0.204 0.016
#> GSM152112     2  0.8924     0.4386 0.336 0.524 0.140
#> GSM152113     1  0.7207     0.1931 0.584 0.032 0.384
#> GSM152115     3  0.7588     0.5732 0.312 0.064 0.624
#> GSM152030     2  0.8743     0.5246 0.268 0.576 0.156
#> GSM152038     1  0.4750     0.5896 0.784 0.000 0.216
#> GSM152042     2  0.8722     0.5307 0.272 0.576 0.152
#> GSM152062     1  0.7890    -0.0492 0.512 0.056 0.432
#> GSM152077     1  0.5327     0.5005 0.728 0.000 0.272
#> GSM152088     3  0.0983     0.5594 0.004 0.016 0.980
#> GSM152100     2  0.8109     0.5402 0.272 0.620 0.108
#> GSM152102     3  0.8430     0.4900 0.292 0.120 0.588
#> GSM152104     2  0.4121     0.5088 0.000 0.832 0.168
#> GSM152028     1  0.5138     0.5346 0.748 0.000 0.252
#> GSM152029     1  0.1989     0.6869 0.948 0.004 0.048
#> GSM152049     1  0.4912     0.6304 0.796 0.196 0.008
#> GSM152053     2  0.8722     0.5307 0.272 0.576 0.152
#> GSM152059     1  0.2625     0.6795 0.916 0.000 0.084
#> GSM152085     1  0.4808     0.6360 0.804 0.188 0.008
#> GSM152101     3  0.7588     0.5732 0.312 0.064 0.624
#> GSM152105     1  0.4750     0.5885 0.784 0.000 0.216
#> GSM152034     1  0.5201     0.5885 0.760 0.236 0.004
#> GSM152036     2  0.0892     0.6143 0.020 0.980 0.000
#> GSM152040     1  0.4087     0.6861 0.880 0.052 0.068
#> GSM152043     1  0.1643     0.6859 0.956 0.000 0.044
#> GSM152046     1  0.5529     0.5218 0.704 0.296 0.000
#> GSM152047     1  0.2116     0.6869 0.948 0.012 0.040
#> GSM152048     1  0.5470     0.6513 0.796 0.168 0.036
#> GSM152050     1  0.5269     0.6295 0.784 0.200 0.016
#> GSM152052     1  0.5291     0.5310 0.732 0.000 0.268
#> GSM152056     1  0.5635     0.6454 0.784 0.180 0.036
#> GSM152060     1  0.5529     0.5218 0.704 0.296 0.000
#> GSM152065     1  0.5138     0.5346 0.748 0.000 0.252
#> GSM152066     1  0.5635     0.6454 0.784 0.180 0.036
#> GSM152069     3  0.4887     0.6315 0.228 0.000 0.772
#> GSM152070     1  0.1765     0.6866 0.956 0.004 0.040
#> GSM152071     3  0.4887     0.6315 0.228 0.000 0.772
#> GSM152072     1  0.1989     0.6864 0.948 0.004 0.048
#> GSM152073     1  0.4453     0.6582 0.836 0.152 0.012
#> GSM152078     1  0.4654     0.5979 0.792 0.000 0.208
#> GSM152082     1  0.1643     0.6864 0.956 0.000 0.044
#> GSM152086     1  0.5167     0.6367 0.792 0.192 0.016
#> GSM152090     1  0.6613     0.5859 0.740 0.072 0.188
#> GSM152092     1  0.2796     0.6725 0.908 0.000 0.092
#> GSM152093     1  0.6435     0.6123 0.756 0.076 0.168
#> GSM152094     1  0.4228     0.6579 0.844 0.148 0.008
#> GSM152098     1  0.1643     0.6859 0.956 0.000 0.044
#> GSM152110     1  0.5635     0.6454 0.784 0.180 0.036
#> GSM152031     1  0.4654     0.5971 0.792 0.000 0.208
#> GSM152037     1  0.5955     0.6445 0.772 0.180 0.048
#> GSM152055     1  0.5497     0.5269 0.708 0.292 0.000
#> GSM152061     1  0.5529     0.5218 0.704 0.296 0.000
#> GSM152064     1  0.7222     0.3202 0.580 0.388 0.032
#> GSM152087     1  0.4291     0.6562 0.840 0.152 0.008
#> GSM152103     1  0.6458     0.6011 0.752 0.072 0.176

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3   0.479    0.55142 0.104 0.108 0.788 0.000
#> GSM152033     3   0.549   -0.03392 0.456 0.016 0.528 0.000
#> GSM152063     2   0.775    0.46793 0.012 0.444 0.160 0.384
#> GSM152074     3   0.519    0.46108 0.012 0.268 0.704 0.016
#> GSM152080     2   0.158    0.54322 0.000 0.948 0.048 0.004
#> GSM152081     4   0.695    0.48523 0.132 0.004 0.284 0.580
#> GSM152083     3   0.529    0.00921 0.000 0.484 0.508 0.008
#> GSM152091     2   0.158    0.54322 0.000 0.948 0.048 0.004
#> GSM152108     3   0.802    0.40609 0.244 0.152 0.552 0.052
#> GSM152114     4   0.769    0.42682 0.228 0.000 0.336 0.436
#> GSM152035     2   0.874    0.22331 0.228 0.480 0.220 0.072
#> GSM152039     4   0.128    0.47301 0.024 0.000 0.012 0.964
#> GSM152041     1   0.732    0.29960 0.560 0.016 0.128 0.296
#> GSM152044     2   0.678    0.59507 0.004 0.532 0.088 0.376
#> GSM152045     1   0.376    0.63456 0.828 0.004 0.156 0.012
#> GSM152051     2   0.678    0.59507 0.004 0.532 0.088 0.376
#> GSM152054     1   0.926   -0.18328 0.368 0.196 0.336 0.100
#> GSM152057     2   0.679    0.59379 0.004 0.528 0.088 0.380
#> GSM152058     1   0.404    0.69304 0.836 0.000 0.080 0.084
#> GSM152067     3   0.584    0.48298 0.048 0.276 0.668 0.008
#> GSM152068     2   0.679    0.59379 0.004 0.528 0.088 0.380
#> GSM152075     4   0.752    0.50046 0.252 0.000 0.252 0.496
#> GSM152076     4   0.128    0.47301 0.024 0.000 0.012 0.964
#> GSM152079     2   0.679    0.59379 0.004 0.528 0.088 0.380
#> GSM152084     3   0.521    0.45835 0.288 0.012 0.688 0.012
#> GSM152089     1   0.759    0.21132 0.516 0.016 0.144 0.324
#> GSM152095     4   0.128    0.47301 0.024 0.000 0.012 0.964
#> GSM152096     3   0.541    0.48836 0.268 0.020 0.696 0.016
#> GSM152097     4   0.481    0.22169 0.008 0.200 0.028 0.764
#> GSM152099     2   0.768    0.45425 0.004 0.492 0.272 0.232
#> GSM152106     4   0.481    0.22169 0.008 0.200 0.028 0.764
#> GSM152107     3   0.675    0.53258 0.156 0.184 0.648 0.012
#> GSM152109     3   0.532    0.44290 0.012 0.288 0.684 0.016
#> GSM152111     1   0.324    0.68997 0.872 0.000 0.028 0.100
#> GSM152112     4   0.772    0.41287 0.240 0.000 0.328 0.432
#> GSM152113     3   0.502    0.37333 0.332 0.012 0.656 0.000
#> GSM152115     3   0.675    0.53258 0.156 0.184 0.648 0.012
#> GSM152030     4   0.734    0.51514 0.176 0.000 0.324 0.500
#> GSM152038     1   0.568    0.32117 0.532 0.012 0.448 0.008
#> GSM152042     4   0.739    0.51804 0.184 0.000 0.320 0.496
#> GSM152062     3   0.516    0.49764 0.264 0.016 0.708 0.012
#> GSM152077     3   0.517   -0.12127 0.492 0.004 0.504 0.000
#> GSM152088     2   0.158    0.54554 0.000 0.948 0.048 0.004
#> GSM152100     4   0.752    0.50046 0.252 0.000 0.252 0.496
#> GSM152102     2   0.843    0.22981 0.228 0.508 0.208 0.056
#> GSM152104     4   0.481    0.22169 0.008 0.200 0.028 0.764
#> GSM152028     1   0.526    0.18699 0.544 0.008 0.448 0.000
#> GSM152029     1   0.382    0.63865 0.824 0.008 0.160 0.008
#> GSM152049     1   0.304    0.69166 0.880 0.000 0.020 0.100
#> GSM152053     4   0.739    0.51804 0.184 0.000 0.320 0.496
#> GSM152059     1   0.503    0.59321 0.736 0.016 0.232 0.016
#> GSM152085     1   0.280    0.69472 0.892 0.000 0.016 0.092
#> GSM152101     3   0.675    0.53258 0.156 0.184 0.648 0.012
#> GSM152105     1   0.567    0.31776 0.536 0.012 0.444 0.008
#> GSM152034     1   0.332    0.66848 0.852 0.000 0.012 0.136
#> GSM152036     4   0.139    0.47352 0.028 0.000 0.012 0.960
#> GSM152040     1   0.463    0.62450 0.784 0.012 0.180 0.024
#> GSM152043     1   0.335    0.62898 0.836 0.000 0.160 0.004
#> GSM152046     1   0.398    0.61816 0.796 0.000 0.012 0.192
#> GSM152047     1   0.378    0.63797 0.832 0.004 0.148 0.016
#> GSM152048     1   0.404    0.69304 0.836 0.000 0.080 0.084
#> GSM152050     1   0.314    0.69085 0.876 0.000 0.024 0.100
#> GSM152052     1   0.601    0.19795 0.492 0.020 0.476 0.012
#> GSM152056     1   0.396    0.69267 0.840 0.000 0.068 0.092
#> GSM152060     1   0.398    0.61816 0.796 0.000 0.012 0.192
#> GSM152065     1   0.527    0.18070 0.540 0.008 0.452 0.000
#> GSM152066     1   0.396    0.69267 0.840 0.000 0.068 0.092
#> GSM152069     3   0.532    0.44290 0.012 0.288 0.684 0.016
#> GSM152070     1   0.353    0.63556 0.840 0.004 0.148 0.008
#> GSM152071     3   0.532    0.44290 0.012 0.288 0.684 0.016
#> GSM152072     1   0.373    0.63221 0.832 0.008 0.152 0.008
#> GSM152073     1   0.323    0.69877 0.880 0.000 0.048 0.072
#> GSM152078     1   0.566    0.34489 0.544 0.012 0.436 0.008
#> GSM152082     1   0.331    0.63096 0.840 0.000 0.156 0.004
#> GSM152086     1   0.312    0.69532 0.880 0.000 0.028 0.092
#> GSM152090     1   0.588    0.29438 0.572 0.008 0.396 0.024
#> GSM152092     1   0.409    0.57922 0.764 0.000 0.232 0.004
#> GSM152093     1   0.554    0.34369 0.592 0.000 0.384 0.024
#> GSM152094     1   0.298    0.69743 0.892 0.000 0.040 0.068
#> GSM152098     1   0.335    0.62898 0.836 0.000 0.160 0.004
#> GSM152110     1   0.396    0.69267 0.840 0.000 0.068 0.092
#> GSM152031     1   0.566    0.34002 0.544 0.012 0.436 0.008
#> GSM152037     1   0.430    0.69018 0.820 0.000 0.088 0.092
#> GSM152055     1   0.394    0.62144 0.800 0.000 0.012 0.188
#> GSM152061     1   0.398    0.61816 0.796 0.000 0.012 0.192
#> GSM152064     1   0.722    0.32815 0.576 0.016 0.124 0.284
#> GSM152087     1   0.306    0.69783 0.888 0.000 0.040 0.072
#> GSM152103     1   0.572    0.32916 0.584 0.004 0.388 0.024

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     5  0.5306    -0.0342 0.012 0.020 0.444 0.004 0.520
#> GSM152033     5  0.3653     0.5997 0.164 0.016 0.012 0.000 0.808
#> GSM152063     2  0.6513     0.5066 0.008 0.468 0.000 0.372 0.152
#> GSM152074     3  0.1525     0.7477 0.000 0.012 0.948 0.004 0.036
#> GSM152080     2  0.1408     0.5065 0.000 0.948 0.044 0.000 0.008
#> GSM152081     4  0.7836     0.4788 0.168 0.008 0.184 0.508 0.132
#> GSM152083     3  0.4346     0.4787 0.000 0.304 0.680 0.004 0.012
#> GSM152091     2  0.1408     0.5065 0.000 0.948 0.044 0.000 0.008
#> GSM152108     5  0.4754     0.3814 0.036 0.164 0.000 0.044 0.756
#> GSM152114     5  0.7622    -0.3573 0.208 0.016 0.028 0.348 0.400
#> GSM152035     2  0.7105     0.3467 0.104 0.524 0.008 0.060 0.304
#> GSM152039     4  0.1670     0.4940 0.052 0.000 0.000 0.936 0.012
#> GSM152041     1  0.6251     0.2665 0.600 0.016 0.000 0.200 0.184
#> GSM152044     2  0.5429     0.6190 0.000 0.564 0.000 0.368 0.068
#> GSM152045     1  0.4467     0.5293 0.696 0.004 0.016 0.004 0.280
#> GSM152051     2  0.5429     0.6190 0.000 0.564 0.000 0.368 0.068
#> GSM152054     5  0.7995     0.2411 0.204 0.232 0.016 0.080 0.468
#> GSM152057     2  0.5439     0.6177 0.000 0.560 0.000 0.372 0.068
#> GSM152058     1  0.3081     0.6574 0.832 0.000 0.000 0.012 0.156
#> GSM152067     3  0.2861     0.7486 0.024 0.024 0.888 0.000 0.064
#> GSM152068     2  0.5439     0.6177 0.000 0.560 0.000 0.372 0.068
#> GSM152075     4  0.7308     0.4118 0.292 0.012 0.008 0.400 0.288
#> GSM152076     4  0.1670     0.4940 0.052 0.000 0.000 0.936 0.012
#> GSM152079     2  0.5439     0.6177 0.000 0.560 0.000 0.372 0.068
#> GSM152084     5  0.5011     0.5124 0.088 0.012 0.176 0.000 0.724
#> GSM152089     1  0.6533     0.1969 0.556 0.016 0.000 0.228 0.200
#> GSM152095     4  0.1670     0.4940 0.052 0.000 0.000 0.936 0.012
#> GSM152096     5  0.5258     0.4944 0.072 0.024 0.180 0.004 0.720
#> GSM152097     4  0.4213     0.2716 0.000 0.124 0.008 0.792 0.076
#> GSM152099     3  0.6902    -0.1224 0.000 0.352 0.408 0.232 0.008
#> GSM152106     4  0.4213     0.2716 0.000 0.124 0.008 0.792 0.076
#> GSM152107     3  0.5304     0.6399 0.056 0.016 0.696 0.008 0.224
#> GSM152109     3  0.0992     0.7528 0.000 0.024 0.968 0.000 0.008
#> GSM152111     1  0.1153     0.7022 0.964 0.000 0.004 0.008 0.024
#> GSM152112     4  0.7829     0.3785 0.156 0.012 0.068 0.400 0.364
#> GSM152113     5  0.4937     0.5700 0.112 0.016 0.128 0.000 0.744
#> GSM152115     3  0.5304     0.6399 0.056 0.016 0.696 0.008 0.224
#> GSM152030     4  0.8445     0.4880 0.184 0.024 0.108 0.416 0.268
#> GSM152038     5  0.6529     0.4294 0.368 0.012 0.124 0.004 0.492
#> GSM152042     4  0.8426     0.4873 0.192 0.024 0.100 0.412 0.272
#> GSM152062     5  0.4876     0.4750 0.064 0.012 0.200 0.000 0.724
#> GSM152077     5  0.3109     0.5925 0.200 0.000 0.000 0.000 0.800
#> GSM152088     2  0.1408     0.5077 0.000 0.948 0.044 0.000 0.008
#> GSM152100     4  0.7308     0.4118 0.292 0.012 0.008 0.400 0.288
#> GSM152102     2  0.6943     0.3516 0.104 0.544 0.012 0.044 0.296
#> GSM152104     4  0.4213     0.2716 0.000 0.124 0.008 0.792 0.076
#> GSM152028     5  0.4217     0.5301 0.272 0.004 0.008 0.004 0.712
#> GSM152029     1  0.4946     0.5405 0.700 0.004 0.056 0.004 0.236
#> GSM152049     1  0.1168     0.7021 0.960 0.000 0.000 0.008 0.032
#> GSM152053     4  0.8426     0.4873 0.192 0.024 0.100 0.412 0.272
#> GSM152059     1  0.5707     0.4755 0.676 0.012 0.192 0.008 0.112
#> GSM152085     1  0.1408     0.7046 0.948 0.000 0.000 0.008 0.044
#> GSM152101     3  0.5304     0.6399 0.056 0.016 0.696 0.008 0.224
#> GSM152105     5  0.6434     0.4290 0.356 0.012 0.116 0.004 0.512
#> GSM152034     1  0.1960     0.6923 0.928 0.000 0.004 0.048 0.020
#> GSM152036     4  0.1740     0.4942 0.056 0.000 0.000 0.932 0.012
#> GSM152040     1  0.4540     0.4673 0.676 0.016 0.000 0.008 0.300
#> GSM152043     1  0.4550     0.5258 0.692 0.000 0.028 0.004 0.276
#> GSM152046     1  0.2358     0.6568 0.888 0.000 0.000 0.104 0.008
#> GSM152047     1  0.4516     0.5374 0.704 0.004 0.016 0.008 0.268
#> GSM152048     1  0.3081     0.6574 0.832 0.000 0.000 0.012 0.156
#> GSM152050     1  0.0932     0.7032 0.972 0.000 0.004 0.004 0.020
#> GSM152052     5  0.6752     0.4523 0.320 0.012 0.152 0.008 0.508
#> GSM152056     1  0.2771     0.6686 0.860 0.000 0.000 0.012 0.128
#> GSM152060     1  0.2358     0.6568 0.888 0.000 0.000 0.104 0.008
#> GSM152065     5  0.4143     0.5414 0.260 0.004 0.008 0.004 0.724
#> GSM152066     1  0.2771     0.6686 0.860 0.000 0.000 0.012 0.128
#> GSM152069     3  0.0992     0.7528 0.000 0.024 0.968 0.000 0.008
#> GSM152070     1  0.4445     0.5310 0.700 0.004 0.016 0.004 0.276
#> GSM152071     3  0.0992     0.7528 0.000 0.024 0.968 0.000 0.008
#> GSM152072     1  0.4428     0.5229 0.692 0.004 0.020 0.000 0.284
#> GSM152073     1  0.1768     0.6971 0.924 0.000 0.004 0.000 0.072
#> GSM152078     5  0.6728     0.3973 0.384 0.012 0.132 0.008 0.464
#> GSM152082     1  0.4491     0.5253 0.692 0.000 0.024 0.004 0.280
#> GSM152086     1  0.1365     0.7060 0.952 0.000 0.004 0.004 0.040
#> GSM152090     5  0.5590     0.4028 0.396 0.008 0.056 0.000 0.540
#> GSM152092     1  0.4973     0.3078 0.564 0.000 0.024 0.004 0.408
#> GSM152093     5  0.5170     0.3761 0.412 0.008 0.028 0.000 0.552
#> GSM152094     1  0.1831     0.6946 0.920 0.000 0.004 0.000 0.076
#> GSM152098     1  0.4550     0.5258 0.692 0.000 0.028 0.004 0.276
#> GSM152110     1  0.2771     0.6686 0.860 0.000 0.000 0.012 0.128
#> GSM152031     5  0.6487     0.4134 0.364 0.012 0.120 0.004 0.500
#> GSM152037     1  0.2997     0.6565 0.840 0.000 0.000 0.012 0.148
#> GSM152055     1  0.2304     0.6591 0.892 0.000 0.000 0.100 0.008
#> GSM152061     1  0.2358     0.6568 0.888 0.000 0.000 0.104 0.008
#> GSM152064     1  0.6073     0.3036 0.624 0.016 0.000 0.188 0.172
#> GSM152087     1  0.1768     0.6965 0.924 0.000 0.004 0.000 0.072
#> GSM152103     5  0.5363     0.3901 0.404 0.008 0.040 0.000 0.548

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     1  0.5387     0.0306 0.464 0.004 0.436 0.000 0.096 0.000
#> GSM152033     1  0.2395     0.6093 0.896 0.012 0.004 0.000 0.016 0.072
#> GSM152063     2  0.6955     0.5211 0.076 0.392 0.000 0.368 0.160 0.004
#> GSM152074     3  0.2526     0.7337 0.024 0.004 0.876 0.000 0.096 0.000
#> GSM152080     2  0.0260     0.5264 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM152081     5  0.7817     0.3450 0.080 0.000 0.096 0.208 0.460 0.156
#> GSM152083     3  0.4788     0.4823 0.004 0.288 0.636 0.000 0.072 0.000
#> GSM152091     2  0.0260     0.5264 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM152108     1  0.4897     0.3466 0.700 0.128 0.000 0.000 0.152 0.020
#> GSM152114     5  0.6326     0.6280 0.272 0.000 0.004 0.032 0.516 0.176
#> GSM152035     2  0.6848     0.3111 0.216 0.464 0.000 0.004 0.256 0.060
#> GSM152039     4  0.4791     0.6209 0.004 0.000 0.000 0.564 0.384 0.048
#> GSM152041     6  0.5947     0.0902 0.136 0.000 0.000 0.036 0.264 0.564
#> GSM152044     2  0.5744     0.6099 0.020 0.496 0.000 0.380 0.104 0.000
#> GSM152045     6  0.5330     0.5296 0.220 0.004 0.020 0.000 0.108 0.648
#> GSM152051     2  0.5744     0.6099 0.020 0.496 0.000 0.380 0.104 0.000
#> GSM152054     5  0.7255     0.0156 0.332 0.172 0.000 0.000 0.368 0.128
#> GSM152057     2  0.5778     0.6091 0.020 0.492 0.000 0.380 0.108 0.000
#> GSM152058     6  0.3726     0.5981 0.216 0.000 0.000 0.004 0.028 0.752
#> GSM152067     3  0.1644     0.7436 0.004 0.000 0.920 0.000 0.076 0.000
#> GSM152068     2  0.5778     0.6091 0.020 0.492 0.000 0.380 0.108 0.000
#> GSM152075     5  0.6632     0.6218 0.132 0.000 0.004 0.080 0.512 0.272
#> GSM152076     4  0.4791     0.6209 0.004 0.000 0.000 0.564 0.384 0.048
#> GSM152079     2  0.5778     0.6091 0.020 0.492 0.000 0.380 0.108 0.000
#> GSM152084     1  0.5456     0.4935 0.656 0.000 0.160 0.000 0.144 0.040
#> GSM152089     6  0.6408    -0.0551 0.144 0.000 0.000 0.060 0.284 0.512
#> GSM152095     4  0.4791     0.6209 0.004 0.000 0.000 0.564 0.384 0.048
#> GSM152096     1  0.5724     0.4850 0.648 0.012 0.164 0.000 0.140 0.036
#> GSM152097     4  0.0146     0.5611 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM152099     3  0.6345    -0.0757 0.000 0.328 0.420 0.236 0.016 0.000
#> GSM152106     4  0.0146     0.5611 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM152107     3  0.5146     0.6402 0.104 0.000 0.636 0.000 0.248 0.012
#> GSM152109     3  0.0000     0.7473 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM152111     6  0.1565     0.6862 0.028 0.000 0.004 0.000 0.028 0.940
#> GSM152112     5  0.6323     0.6101 0.196 0.000 0.012 0.080 0.596 0.116
#> GSM152113     1  0.5099     0.5467 0.720 0.008 0.120 0.000 0.100 0.052
#> GSM152115     3  0.5146     0.6402 0.104 0.000 0.636 0.000 0.248 0.012
#> GSM152030     5  0.6553     0.6697 0.132 0.000 0.020 0.096 0.592 0.160
#> GSM152038     1  0.6118     0.5403 0.564 0.000 0.080 0.000 0.092 0.264
#> GSM152042     5  0.6565     0.6764 0.136 0.000 0.016 0.096 0.584 0.168
#> GSM152062     1  0.5296     0.4734 0.656 0.000 0.184 0.000 0.136 0.024
#> GSM152077     1  0.2609     0.6178 0.868 0.000 0.000 0.000 0.036 0.096
#> GSM152088     2  0.0405     0.5282 0.000 0.988 0.008 0.004 0.000 0.000
#> GSM152100     5  0.6632     0.6218 0.132 0.000 0.004 0.080 0.512 0.272
#> GSM152102     2  0.6742     0.3284 0.216 0.492 0.000 0.004 0.228 0.060
#> GSM152104     4  0.0146     0.5611 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM152028     1  0.3168     0.6149 0.792 0.000 0.000 0.000 0.016 0.192
#> GSM152029     6  0.5515     0.5396 0.200 0.004 0.052 0.000 0.088 0.656
#> GSM152049     6  0.1176     0.6856 0.024 0.000 0.000 0.000 0.020 0.956
#> GSM152053     5  0.6565     0.6764 0.136 0.000 0.016 0.096 0.584 0.168
#> GSM152059     6  0.6485     0.3990 0.116 0.004 0.144 0.000 0.160 0.576
#> GSM152085     6  0.1245     0.6879 0.032 0.000 0.000 0.000 0.016 0.952
#> GSM152101     3  0.5146     0.6402 0.104 0.000 0.636 0.000 0.248 0.012
#> GSM152105     1  0.5825     0.5427 0.600 0.000 0.072 0.000 0.080 0.248
#> GSM152034     6  0.2033     0.6796 0.020 0.004 0.004 0.000 0.056 0.916
#> GSM152036     4  0.4845     0.6165 0.004 0.000 0.000 0.560 0.384 0.052
#> GSM152040     6  0.5302     0.4912 0.208 0.004 0.000 0.000 0.172 0.616
#> GSM152043     6  0.5422     0.5278 0.220 0.004 0.032 0.000 0.096 0.648
#> GSM152046     6  0.2313     0.6335 0.012 0.000 0.000 0.004 0.100 0.884
#> GSM152047     6  0.5117     0.5469 0.212 0.004 0.016 0.000 0.100 0.668
#> GSM152048     6  0.3726     0.5981 0.216 0.000 0.000 0.004 0.028 0.752
#> GSM152050     6  0.1405     0.6865 0.024 0.000 0.004 0.000 0.024 0.948
#> GSM152052     1  0.6067     0.5344 0.612 0.000 0.100 0.000 0.128 0.160
#> GSM152056     6  0.3419     0.6227 0.176 0.000 0.000 0.004 0.028 0.792
#> GSM152060     6  0.2313     0.6335 0.012 0.000 0.000 0.004 0.100 0.884
#> GSM152065     1  0.3071     0.6239 0.804 0.000 0.000 0.000 0.016 0.180
#> GSM152066     6  0.3419     0.6227 0.176 0.000 0.000 0.004 0.028 0.792
#> GSM152069     3  0.0000     0.7473 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM152070     6  0.5149     0.5377 0.224 0.004 0.016 0.000 0.096 0.660
#> GSM152071     3  0.0000     0.7473 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM152072     6  0.5389     0.5247 0.224 0.004 0.024 0.000 0.104 0.644
#> GSM152073     6  0.2796     0.6775 0.056 0.004 0.004 0.000 0.064 0.872
#> GSM152078     1  0.6370     0.5216 0.536 0.000 0.088 0.000 0.108 0.268
#> GSM152082     6  0.5374     0.5212 0.236 0.004 0.024 0.000 0.096 0.640
#> GSM152086     6  0.1867     0.6886 0.036 0.000 0.004 0.000 0.036 0.924
#> GSM152090     1  0.6120     0.4391 0.508 0.000 0.048 0.000 0.108 0.336
#> GSM152092     6  0.5738     0.2434 0.408 0.000 0.024 0.000 0.092 0.476
#> GSM152093     1  0.5787     0.4120 0.516 0.000 0.020 0.000 0.116 0.348
#> GSM152094     6  0.2737     0.6755 0.056 0.004 0.004 0.000 0.060 0.876
#> GSM152098     6  0.5422     0.5278 0.220 0.004 0.032 0.000 0.096 0.648
#> GSM152110     6  0.3419     0.6227 0.176 0.000 0.000 0.004 0.028 0.792
#> GSM152031     1  0.5891     0.5378 0.592 0.000 0.076 0.000 0.080 0.252
#> GSM152037     6  0.3610     0.6050 0.200 0.000 0.000 0.004 0.028 0.768
#> GSM152055     6  0.2264     0.6363 0.012 0.000 0.000 0.004 0.096 0.888
#> GSM152061     6  0.2313     0.6335 0.012 0.000 0.000 0.004 0.100 0.884
#> GSM152064     6  0.5760     0.1598 0.132 0.000 0.000 0.032 0.244 0.592
#> GSM152087     6  0.2614     0.6782 0.056 0.004 0.004 0.000 0.052 0.884
#> GSM152103     1  0.5969     0.4266 0.512 0.000 0.032 0.000 0.116 0.340

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 specimen(p) k
#> SD:hclust 61    4.64e-04 2
#> SD:hclust 66    3.01e-07 3
#> SD:hclust 47    8.68e-06 4
#> SD:hclust 50    5.36e-03 5
#> SD:hclust 68    7.71e-04 6

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


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

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.716           0.908       0.934         0.4940 0.501   0.501
#> 3 3 0.564           0.741       0.848         0.3200 0.762   0.557
#> 4 4 0.584           0.752       0.809         0.1278 0.906   0.735
#> 5 5 0.668           0.599       0.739         0.0741 0.881   0.599
#> 6 6 0.691           0.576       0.749         0.0423 0.952   0.774

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
#> GSM152032     2  0.7056      0.846 0.192 0.808
#> GSM152033     1  0.1184      0.930 0.984 0.016
#> GSM152063     2  0.0938      0.932 0.012 0.988
#> GSM152074     2  0.5519      0.893 0.128 0.872
#> GSM152080     2  0.4022      0.913 0.080 0.920
#> GSM152081     2  0.2603      0.935 0.044 0.956
#> GSM152083     2  0.4022      0.913 0.080 0.920
#> GSM152091     2  0.1843      0.934 0.028 0.972
#> GSM152108     2  0.2043      0.934 0.032 0.968
#> GSM152114     1  0.7674      0.781 0.776 0.224
#> GSM152035     2  0.1843      0.934 0.028 0.972
#> GSM152039     2  0.2603      0.935 0.044 0.956
#> GSM152041     2  0.4939      0.890 0.108 0.892
#> GSM152044     2  0.0938      0.932 0.012 0.988
#> GSM152045     1  0.0938      0.932 0.988 0.012
#> GSM152051     2  0.1843      0.934 0.028 0.972
#> GSM152054     2  0.7299      0.833 0.204 0.796
#> GSM152057     2  0.1843      0.934 0.028 0.972
#> GSM152058     1  0.3584      0.923 0.932 0.068
#> GSM152067     2  0.7056      0.846 0.192 0.808
#> GSM152068     2  0.0376      0.935 0.004 0.996
#> GSM152075     2  0.2603      0.935 0.044 0.956
#> GSM152076     2  0.2603      0.935 0.044 0.956
#> GSM152079     2  0.1843      0.934 0.028 0.972
#> GSM152084     1  0.8499      0.619 0.724 0.276
#> GSM152089     2  0.4562      0.905 0.096 0.904
#> GSM152095     2  0.2423      0.935 0.040 0.960
#> GSM152096     2  0.6438      0.867 0.164 0.836
#> GSM152097     2  0.1184      0.931 0.016 0.984
#> GSM152099     2  0.1843      0.934 0.028 0.972
#> GSM152106     2  0.1184      0.931 0.016 0.984
#> GSM152107     2  0.3114      0.935 0.056 0.944
#> GSM152109     2  0.7219      0.837 0.200 0.800
#> GSM152111     1  0.3733      0.922 0.928 0.072
#> GSM152112     2  0.2423      0.938 0.040 0.960
#> GSM152113     1  0.6247      0.814 0.844 0.156
#> GSM152115     2  0.7056      0.846 0.192 0.808
#> GSM152030     2  0.2603      0.935 0.044 0.956
#> GSM152038     1  0.1184      0.930 0.984 0.016
#> GSM152042     2  0.2603      0.935 0.044 0.956
#> GSM152062     1  0.8207      0.659 0.744 0.256
#> GSM152077     1  0.3584      0.923 0.932 0.068
#> GSM152088     2  0.1843      0.934 0.028 0.972
#> GSM152100     2  0.2603      0.935 0.044 0.956
#> GSM152102     2  0.4022      0.913 0.080 0.920
#> GSM152104     2  0.1184      0.931 0.016 0.984
#> GSM152028     1  0.1184      0.930 0.984 0.016
#> GSM152029     1  0.1184      0.930 0.984 0.016
#> GSM152049     1  0.3733      0.922 0.928 0.072
#> GSM152053     2  0.2603      0.935 0.044 0.956
#> GSM152059     1  0.1184      0.930 0.984 0.016
#> GSM152085     1  0.3733      0.922 0.928 0.072
#> GSM152101     2  0.4939      0.911 0.108 0.892
#> GSM152105     1  0.1184      0.930 0.984 0.016
#> GSM152034     1  0.4022      0.917 0.920 0.080
#> GSM152036     2  0.2603      0.935 0.044 0.956
#> GSM152040     1  0.1843      0.930 0.972 0.028
#> GSM152043     1  0.0376      0.931 0.996 0.004
#> GSM152046     1  0.4022      0.917 0.920 0.080
#> GSM152047     1  0.1843      0.930 0.972 0.028
#> GSM152048     1  0.3584      0.923 0.932 0.068
#> GSM152050     1  0.3733      0.922 0.928 0.072
#> GSM152052     1  0.1184      0.930 0.984 0.016
#> GSM152056     1  0.3733      0.922 0.928 0.072
#> GSM152060     1  0.4022      0.917 0.920 0.080
#> GSM152065     1  0.1184      0.930 0.984 0.016
#> GSM152066     1  0.1633      0.931 0.976 0.024
#> GSM152069     1  0.6623      0.794 0.828 0.172
#> GSM152070     1  0.1184      0.930 0.984 0.016
#> GSM152071     1  0.6531      0.800 0.832 0.168
#> GSM152072     1  0.1184      0.930 0.984 0.016
#> GSM152073     1  0.0672      0.931 0.992 0.008
#> GSM152078     1  0.1184      0.930 0.984 0.016
#> GSM152082     1  0.1184      0.930 0.984 0.016
#> GSM152086     1  0.1633      0.931 0.976 0.024
#> GSM152090     1  0.6438      0.805 0.836 0.164
#> GSM152092     1  0.1184      0.930 0.984 0.016
#> GSM152093     1  0.3733      0.922 0.928 0.072
#> GSM152094     1  0.1633      0.931 0.976 0.024
#> GSM152098     1  0.1184      0.930 0.984 0.016
#> GSM152110     1  0.3733      0.922 0.928 0.072
#> GSM152031     1  0.1184      0.930 0.984 0.016
#> GSM152037     1  0.1633      0.931 0.976 0.024
#> GSM152055     1  0.4022      0.917 0.920 0.080
#> GSM152061     1  0.4022      0.917 0.920 0.080
#> GSM152064     1  0.4022      0.917 0.920 0.080
#> GSM152087     1  0.1843      0.930 0.972 0.028
#> GSM152103     1  0.2423      0.920 0.960 0.040

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.1482      0.784 0.020 0.012 0.968
#> GSM152033     3  0.3551      0.756 0.132 0.000 0.868
#> GSM152063     2  0.2066      0.723 0.000 0.940 0.060
#> GSM152074     3  0.1453      0.776 0.008 0.024 0.968
#> GSM152080     3  0.6111      0.331 0.000 0.396 0.604
#> GSM152081     2  0.7703      0.696 0.104 0.664 0.232
#> GSM152083     3  0.5591      0.480 0.000 0.304 0.696
#> GSM152091     2  0.5431      0.519 0.000 0.716 0.284
#> GSM152108     2  0.5216      0.567 0.000 0.740 0.260
#> GSM152114     1  0.6217      0.524 0.712 0.024 0.264
#> GSM152035     2  0.4702      0.627 0.000 0.788 0.212
#> GSM152039     2  0.7179      0.724 0.104 0.712 0.184
#> GSM152041     2  0.7462      0.714 0.124 0.696 0.180
#> GSM152044     2  0.1031      0.727 0.000 0.976 0.024
#> GSM152045     1  0.5926      0.465 0.644 0.000 0.356
#> GSM152051     2  0.3686      0.692 0.000 0.860 0.140
#> GSM152054     3  0.5223      0.574 0.024 0.176 0.800
#> GSM152057     2  0.3686      0.692 0.000 0.860 0.140
#> GSM152058     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152067     3  0.1182      0.779 0.012 0.012 0.976
#> GSM152068     2  0.2625      0.717 0.000 0.916 0.084
#> GSM152075     2  0.7368      0.717 0.104 0.696 0.200
#> GSM152076     2  0.7179      0.724 0.104 0.712 0.184
#> GSM152079     2  0.3686      0.692 0.000 0.860 0.140
#> GSM152084     3  0.1860      0.787 0.052 0.000 0.948
#> GSM152089     2  0.8318      0.651 0.116 0.600 0.284
#> GSM152095     2  0.7179      0.724 0.104 0.712 0.184
#> GSM152096     3  0.1877      0.776 0.012 0.032 0.956
#> GSM152097     2  0.0592      0.729 0.000 0.988 0.012
#> GSM152099     2  0.3686      0.692 0.000 0.860 0.140
#> GSM152106     2  0.0592      0.729 0.000 0.988 0.012
#> GSM152107     3  0.3528      0.667 0.016 0.092 0.892
#> GSM152109     3  0.1482      0.784 0.020 0.012 0.968
#> GSM152111     1  0.0424      0.900 0.992 0.000 0.008
#> GSM152112     2  0.8179      0.586 0.084 0.564 0.352
#> GSM152113     3  0.2448      0.787 0.076 0.000 0.924
#> GSM152115     3  0.0661      0.773 0.008 0.004 0.988
#> GSM152030     2  0.7778      0.689 0.104 0.656 0.240
#> GSM152038     3  0.2448      0.787 0.076 0.000 0.924
#> GSM152042     2  0.8014      0.662 0.104 0.628 0.268
#> GSM152062     3  0.1860      0.787 0.052 0.000 0.948
#> GSM152077     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152088     2  0.5098      0.575 0.000 0.752 0.248
#> GSM152100     2  0.7276      0.721 0.104 0.704 0.192
#> GSM152102     3  0.6305      0.105 0.000 0.484 0.516
#> GSM152104     2  0.0747      0.728 0.000 0.984 0.016
#> GSM152028     1  0.3192      0.869 0.888 0.000 0.112
#> GSM152029     3  0.6252      0.191 0.444 0.000 0.556
#> GSM152049     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152053     2  0.8075      0.654 0.104 0.620 0.276
#> GSM152059     1  0.3267      0.867 0.884 0.000 0.116
#> GSM152085     1  0.0237      0.902 0.996 0.000 0.004
#> GSM152101     3  0.3528      0.667 0.016 0.092 0.892
#> GSM152105     1  0.3752      0.843 0.856 0.000 0.144
#> GSM152034     1  0.1774      0.881 0.960 0.024 0.016
#> GSM152036     2  0.7179      0.724 0.104 0.712 0.184
#> GSM152040     1  0.1031      0.908 0.976 0.000 0.024
#> GSM152043     1  0.3267      0.867 0.884 0.000 0.116
#> GSM152046     1  0.1620      0.884 0.964 0.024 0.012
#> GSM152047     1  0.0424      0.904 0.992 0.000 0.008
#> GSM152048     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152050     1  0.0424      0.900 0.992 0.000 0.008
#> GSM152052     1  0.4346      0.800 0.816 0.000 0.184
#> GSM152056     1  0.0000      0.904 1.000 0.000 0.000
#> GSM152060     1  0.1774      0.881 0.960 0.024 0.016
#> GSM152065     1  0.6095      0.382 0.608 0.000 0.392
#> GSM152066     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152069     3  0.2200      0.791 0.056 0.004 0.940
#> GSM152070     1  0.3267      0.867 0.884 0.000 0.116
#> GSM152071     3  0.2066      0.791 0.060 0.000 0.940
#> GSM152072     3  0.6045      0.369 0.380 0.000 0.620
#> GSM152073     1  0.2959      0.875 0.900 0.000 0.100
#> GSM152078     3  0.6215      0.242 0.428 0.000 0.572
#> GSM152082     1  0.3267      0.867 0.884 0.000 0.116
#> GSM152086     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152090     3  0.3686      0.749 0.140 0.000 0.860
#> GSM152092     1  0.3267      0.867 0.884 0.000 0.116
#> GSM152093     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152094     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152098     1  0.3267      0.867 0.884 0.000 0.116
#> GSM152110     1  0.0000      0.904 1.000 0.000 0.000
#> GSM152031     1  0.3267      0.867 0.884 0.000 0.116
#> GSM152037     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152055     1  0.1774      0.881 0.960 0.024 0.016
#> GSM152061     1  0.1774      0.881 0.960 0.024 0.016
#> GSM152064     1  0.1337      0.889 0.972 0.012 0.016
#> GSM152087     1  0.0892      0.909 0.980 0.000 0.020
#> GSM152103     3  0.3941      0.736 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
#> GSM152032     3  0.2593      0.766 0.000 0.080 0.904 0.016
#> GSM152033     3  0.4604      0.705 0.036 0.004 0.784 0.176
#> GSM152063     2  0.1389      0.861 0.000 0.952 0.000 0.048
#> GSM152074     3  0.2662      0.765 0.000 0.084 0.900 0.016
#> GSM152080     2  0.4244      0.748 0.000 0.804 0.160 0.036
#> GSM152081     4  0.5315      0.867 0.016 0.200 0.040 0.744
#> GSM152083     3  0.5352      0.317 0.000 0.388 0.596 0.016
#> GSM152091     2  0.3342      0.814 0.000 0.868 0.100 0.032
#> GSM152108     2  0.4793      0.735 0.008 0.800 0.080 0.112
#> GSM152114     4  0.5459      0.524 0.128 0.004 0.120 0.748
#> GSM152035     2  0.1398      0.865 0.000 0.956 0.040 0.004
#> GSM152039     4  0.4920      0.856 0.028 0.228 0.004 0.740
#> GSM152041     4  0.5512      0.806 0.124 0.128 0.004 0.744
#> GSM152044     2  0.2011      0.836 0.000 0.920 0.000 0.080
#> GSM152045     1  0.6319      0.336 0.604 0.000 0.312 0.084
#> GSM152051     2  0.0376      0.878 0.000 0.992 0.004 0.004
#> GSM152054     3  0.8564      0.501 0.184 0.076 0.512 0.228
#> GSM152057     2  0.0657      0.876 0.000 0.984 0.004 0.012
#> GSM152058     1  0.4937      0.795 0.764 0.000 0.064 0.172
#> GSM152067     3  0.3555      0.764 0.004 0.080 0.868 0.048
#> GSM152068     2  0.0707      0.875 0.000 0.980 0.000 0.020
#> GSM152075     4  0.5057      0.868 0.024 0.200 0.020 0.756
#> GSM152076     4  0.4879      0.861 0.016 0.228 0.012 0.744
#> GSM152079     2  0.0376      0.878 0.000 0.992 0.004 0.004
#> GSM152084     3  0.2984      0.762 0.000 0.028 0.888 0.084
#> GSM152089     4  0.5516      0.708 0.200 0.056 0.012 0.732
#> GSM152095     4  0.4879      0.861 0.016 0.228 0.012 0.744
#> GSM152096     3  0.2706      0.767 0.000 0.080 0.900 0.020
#> GSM152097     2  0.2408      0.814 0.000 0.896 0.000 0.104
#> GSM152099     2  0.0376      0.878 0.000 0.992 0.004 0.004
#> GSM152106     2  0.2408      0.814 0.000 0.896 0.000 0.104
#> GSM152107     3  0.6393      0.466 0.000 0.100 0.616 0.284
#> GSM152109     3  0.3360      0.765 0.004 0.084 0.876 0.036
#> GSM152111     1  0.1474      0.812 0.948 0.000 0.000 0.052
#> GSM152112     4  0.6458      0.748 0.004 0.160 0.176 0.660
#> GSM152113     3  0.3940      0.726 0.020 0.004 0.824 0.152
#> GSM152115     3  0.4036      0.742 0.000 0.076 0.836 0.088
#> GSM152030     4  0.5797      0.853 0.016 0.188 0.072 0.724
#> GSM152038     3  0.2654      0.751 0.000 0.004 0.888 0.108
#> GSM152042     4  0.6231      0.828 0.016 0.172 0.112 0.700
#> GSM152062     3  0.2984      0.762 0.000 0.028 0.888 0.084
#> GSM152077     1  0.5944      0.759 0.700 0.004 0.104 0.192
#> GSM152088     2  0.3307      0.813 0.000 0.868 0.104 0.028
#> GSM152100     4  0.4809      0.865 0.016 0.220 0.012 0.752
#> GSM152102     2  0.4511      0.734 0.000 0.784 0.176 0.040
#> GSM152104     2  0.2149      0.828 0.000 0.912 0.000 0.088
#> GSM152028     1  0.6001      0.747 0.688 0.000 0.128 0.184
#> GSM152029     3  0.6524      0.532 0.316 0.012 0.604 0.068
#> GSM152049     1  0.3552      0.818 0.848 0.000 0.024 0.128
#> GSM152053     4  0.6294      0.823 0.016 0.168 0.120 0.696
#> GSM152059     1  0.2670      0.801 0.908 0.000 0.052 0.040
#> GSM152085     1  0.1118      0.813 0.964 0.000 0.000 0.036
#> GSM152101     3  0.5809      0.587 0.000 0.092 0.692 0.216
#> GSM152105     1  0.7352      0.430 0.496 0.000 0.328 0.176
#> GSM152034     1  0.2868      0.751 0.864 0.000 0.000 0.136
#> GSM152036     4  0.5033      0.858 0.036 0.220 0.004 0.740
#> GSM152040     1  0.2089      0.805 0.932 0.000 0.020 0.048
#> GSM152043     1  0.4621      0.797 0.796 0.000 0.076 0.128
#> GSM152046     1  0.2704      0.762 0.876 0.000 0.000 0.124
#> GSM152047     1  0.2142      0.806 0.928 0.000 0.016 0.056
#> GSM152048     1  0.4937      0.795 0.764 0.000 0.064 0.172
#> GSM152050     1  0.1474      0.812 0.948 0.000 0.000 0.052
#> GSM152052     1  0.7355      0.510 0.536 0.004 0.284 0.176
#> GSM152056     1  0.4746      0.798 0.776 0.000 0.056 0.168
#> GSM152060     1  0.2868      0.751 0.864 0.000 0.000 0.136
#> GSM152065     3  0.7035      0.344 0.244 0.000 0.572 0.184
#> GSM152066     1  0.4663      0.796 0.788 0.000 0.064 0.148
#> GSM152069     3  0.3266      0.766 0.004 0.084 0.880 0.032
#> GSM152070     1  0.3400      0.784 0.872 0.000 0.064 0.064
#> GSM152071     3  0.3266      0.766 0.004 0.084 0.880 0.032
#> GSM152072     3  0.5632      0.695 0.176 0.008 0.732 0.084
#> GSM152073     1  0.2385      0.809 0.920 0.000 0.028 0.052
#> GSM152078     3  0.6699      0.543 0.192 0.008 0.644 0.156
#> GSM152082     1  0.5080      0.781 0.764 0.000 0.092 0.144
#> GSM152086     1  0.2813      0.824 0.896 0.000 0.024 0.080
#> GSM152090     3  0.5235      0.722 0.124 0.028 0.784 0.064
#> GSM152092     1  0.5962      0.749 0.692 0.000 0.128 0.180
#> GSM152093     1  0.4949      0.794 0.760 0.000 0.060 0.180
#> GSM152094     1  0.0336      0.815 0.992 0.000 0.000 0.008
#> GSM152098     1  0.3398      0.784 0.872 0.000 0.068 0.060
#> GSM152110     1  0.4378      0.806 0.796 0.000 0.040 0.164
#> GSM152031     1  0.6678      0.661 0.620 0.000 0.208 0.172
#> GSM152037     1  0.4758      0.794 0.780 0.000 0.064 0.156
#> GSM152055     1  0.2973      0.753 0.856 0.000 0.000 0.144
#> GSM152061     1  0.2868      0.751 0.864 0.000 0.000 0.136
#> GSM152064     1  0.2760      0.763 0.872 0.000 0.000 0.128
#> GSM152087     1  0.0336      0.815 0.992 0.000 0.000 0.008
#> GSM152103     3  0.5390      0.717 0.136 0.028 0.772 0.064

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.2585    0.76635 0.000 0.024 0.904 0.024 0.048
#> GSM152033     5  0.4531    0.31632 0.008 0.008 0.308 0.004 0.672
#> GSM152063     2  0.1608    0.90442 0.000 0.928 0.000 0.072 0.000
#> GSM152074     3  0.2815    0.76637 0.000 0.028 0.892 0.024 0.056
#> GSM152080     2  0.2927    0.85340 0.000 0.872 0.060 0.000 0.068
#> GSM152081     4  0.1716    0.90090 0.000 0.024 0.016 0.944 0.016
#> GSM152083     3  0.4957    0.48315 0.000 0.296 0.660 0.012 0.032
#> GSM152091     2  0.2790    0.85664 0.000 0.880 0.052 0.000 0.068
#> GSM152108     2  0.5615    0.44801 0.004 0.608 0.056 0.012 0.320
#> GSM152114     5  0.7738    0.22420 0.164 0.016 0.052 0.336 0.432
#> GSM152035     2  0.1799    0.89180 0.000 0.940 0.012 0.020 0.028
#> GSM152039     4  0.1202    0.90343 0.004 0.032 0.000 0.960 0.004
#> GSM152041     4  0.2462    0.87988 0.048 0.020 0.004 0.912 0.016
#> GSM152044     2  0.2189    0.89695 0.000 0.904 0.000 0.084 0.012
#> GSM152045     1  0.6166    0.35992 0.576 0.012 0.092 0.008 0.312
#> GSM152051     2  0.1845    0.90530 0.000 0.928 0.000 0.056 0.016
#> GSM152054     5  0.8770   -0.11091 0.296 0.024 0.240 0.120 0.320
#> GSM152057     2  0.1341    0.90547 0.000 0.944 0.000 0.056 0.000
#> GSM152058     5  0.4560    0.33745 0.484 0.008 0.000 0.000 0.508
#> GSM152067     3  0.2595    0.75365 0.000 0.032 0.888 0.000 0.080
#> GSM152068     2  0.1478    0.90491 0.000 0.936 0.000 0.064 0.000
#> GSM152075     4  0.1554    0.90486 0.004 0.024 0.008 0.952 0.012
#> GSM152076     4  0.1202    0.90343 0.004 0.032 0.000 0.960 0.004
#> GSM152079     2  0.1502    0.90572 0.000 0.940 0.000 0.056 0.004
#> GSM152084     3  0.4074    0.71644 0.000 0.012 0.780 0.028 0.180
#> GSM152089     4  0.6356    0.44722 0.312 0.020 0.024 0.580 0.064
#> GSM152095     4  0.1202    0.90343 0.004 0.032 0.000 0.960 0.004
#> GSM152096     3  0.3556    0.74710 0.000 0.032 0.828 0.008 0.132
#> GSM152097     2  0.2969    0.86889 0.000 0.852 0.000 0.128 0.020
#> GSM152099     2  0.1877    0.90424 0.000 0.924 0.000 0.064 0.012
#> GSM152106     2  0.2969    0.86889 0.000 0.852 0.000 0.128 0.020
#> GSM152107     3  0.5344    0.62058 0.004 0.032 0.708 0.200 0.056
#> GSM152109     3  0.1915    0.76161 0.000 0.032 0.928 0.000 0.040
#> GSM152111     1  0.1485    0.64442 0.948 0.000 0.000 0.032 0.020
#> GSM152112     4  0.4035    0.81783 0.004 0.028 0.080 0.828 0.060
#> GSM152113     5  0.4944   -0.00883 0.000 0.012 0.416 0.012 0.560
#> GSM152115     3  0.4181    0.74128 0.004 0.024 0.816 0.064 0.092
#> GSM152030     4  0.2599    0.88270 0.000 0.024 0.044 0.904 0.028
#> GSM152038     3  0.4462    0.59208 0.000 0.004 0.672 0.016 0.308
#> GSM152042     4  0.2857    0.86942 0.000 0.020 0.064 0.888 0.028
#> GSM152062     3  0.3881    0.71683 0.000 0.008 0.788 0.024 0.180
#> GSM152077     5  0.5564    0.48702 0.328 0.016 0.032 0.012 0.612
#> GSM152088     2  0.2592    0.86125 0.000 0.892 0.056 0.000 0.052
#> GSM152100     4  0.1554    0.90555 0.004 0.024 0.008 0.952 0.012
#> GSM152102     2  0.4005    0.80710 0.004 0.804 0.052 0.004 0.136
#> GSM152104     2  0.2573    0.88750 0.000 0.880 0.000 0.104 0.016
#> GSM152028     5  0.3817    0.53008 0.252 0.004 0.004 0.000 0.740
#> GSM152029     3  0.6957    0.03729 0.360 0.008 0.384 0.000 0.248
#> GSM152049     1  0.4165    0.09245 0.672 0.008 0.000 0.000 0.320
#> GSM152053     4  0.2984    0.86380 0.000 0.020 0.072 0.880 0.028
#> GSM152059     1  0.4040    0.49553 0.712 0.000 0.012 0.000 0.276
#> GSM152085     1  0.0693    0.64629 0.980 0.000 0.000 0.008 0.012
#> GSM152101     3  0.4849    0.69253 0.004 0.024 0.764 0.132 0.076
#> GSM152105     5  0.4404    0.56913 0.152 0.000 0.088 0.000 0.760
#> GSM152034     1  0.2248    0.65120 0.900 0.000 0.000 0.088 0.012
#> GSM152036     4  0.1202    0.90343 0.004 0.032 0.000 0.960 0.004
#> GSM152040     1  0.3421    0.57118 0.788 0.000 0.008 0.000 0.204
#> GSM152043     5  0.4430    0.16850 0.456 0.000 0.004 0.000 0.540
#> GSM152046     1  0.2112    0.65236 0.908 0.000 0.004 0.084 0.004
#> GSM152047     1  0.3132    0.59804 0.820 0.000 0.008 0.000 0.172
#> GSM152048     5  0.4560    0.33745 0.484 0.008 0.000 0.000 0.508
#> GSM152050     1  0.1568    0.64513 0.944 0.000 0.000 0.036 0.020
#> GSM152052     5  0.5150    0.56333 0.228 0.008 0.076 0.000 0.688
#> GSM152056     1  0.4561   -0.36172 0.504 0.008 0.000 0.000 0.488
#> GSM152060     1  0.2011    0.65035 0.908 0.000 0.004 0.088 0.000
#> GSM152065     5  0.3992    0.53669 0.080 0.000 0.124 0.000 0.796
#> GSM152066     5  0.4561    0.32566 0.488 0.008 0.000 0.000 0.504
#> GSM152069     3  0.1915    0.76161 0.000 0.032 0.928 0.000 0.040
#> GSM152070     1  0.4540    0.43541 0.640 0.000 0.020 0.000 0.340
#> GSM152071     3  0.1915    0.76161 0.000 0.032 0.928 0.000 0.040
#> GSM152072     3  0.6547    0.36633 0.140 0.012 0.524 0.004 0.320
#> GSM152073     1  0.3671    0.53859 0.756 0.000 0.008 0.000 0.236
#> GSM152078     5  0.5255    0.34170 0.068 0.004 0.284 0.000 0.644
#> GSM152082     5  0.4348    0.37109 0.316 0.000 0.016 0.000 0.668
#> GSM152086     1  0.4029    0.16508 0.680 0.004 0.000 0.000 0.316
#> GSM152090     3  0.5117    0.65829 0.064 0.012 0.720 0.008 0.196
#> GSM152092     5  0.3612    0.51114 0.268 0.000 0.000 0.000 0.732
#> GSM152093     1  0.4702   -0.33294 0.512 0.008 0.004 0.000 0.476
#> GSM152094     1  0.2233    0.63033 0.892 0.000 0.004 0.000 0.104
#> GSM152098     1  0.4540    0.43436 0.640 0.000 0.020 0.000 0.340
#> GSM152110     1  0.4473   -0.19391 0.580 0.008 0.000 0.000 0.412
#> GSM152031     5  0.3988    0.55621 0.196 0.000 0.036 0.000 0.768
#> GSM152037     5  0.4549    0.36744 0.464 0.008 0.000 0.000 0.528
#> GSM152055     1  0.1851    0.64956 0.912 0.000 0.000 0.088 0.000
#> GSM152061     1  0.2011    0.65035 0.908 0.000 0.004 0.088 0.000
#> GSM152064     1  0.2011    0.64654 0.908 0.000 0.000 0.088 0.004
#> GSM152087     1  0.1704    0.64247 0.928 0.000 0.004 0.000 0.068
#> GSM152103     3  0.5008    0.64580 0.072 0.008 0.720 0.004 0.196

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.1534     0.7460 0.032 0.004 0.944 0.004 0.016 0.000
#> GSM152033     1  0.4324     0.4788 0.724 0.004 0.192 0.000 0.080 0.000
#> GSM152063     2  0.1049     0.8593 0.000 0.960 0.000 0.032 0.008 0.000
#> GSM152074     3  0.2350     0.7377 0.024 0.004 0.900 0.008 0.064 0.000
#> GSM152080     2  0.3583     0.7469 0.008 0.728 0.004 0.000 0.260 0.000
#> GSM152081     4  0.2765     0.8576 0.000 0.008 0.028 0.876 0.080 0.008
#> GSM152083     3  0.4516     0.5388 0.016 0.240 0.700 0.004 0.040 0.000
#> GSM152091     2  0.3560     0.7495 0.008 0.732 0.004 0.000 0.256 0.000
#> GSM152108     2  0.6630     0.2601 0.344 0.492 0.072 0.040 0.052 0.000
#> GSM152114     1  0.6779     0.4701 0.560 0.004 0.056 0.220 0.032 0.128
#> GSM152035     2  0.2873     0.8279 0.012 0.868 0.016 0.012 0.092 0.000
#> GSM152039     4  0.1982     0.8618 0.004 0.012 0.000 0.924 0.040 0.020
#> GSM152041     4  0.3262     0.7507 0.000 0.004 0.004 0.800 0.012 0.180
#> GSM152044     2  0.1564     0.8542 0.000 0.936 0.000 0.040 0.024 0.000
#> GSM152045     5  0.5835     0.2172 0.132 0.000 0.012 0.000 0.452 0.404
#> GSM152051     2  0.1418     0.8583 0.000 0.944 0.000 0.032 0.024 0.000
#> GSM152054     5  0.7340     0.4949 0.104 0.008 0.156 0.060 0.552 0.120
#> GSM152057     2  0.0790     0.8598 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM152058     1  0.3584     0.5795 0.688 0.000 0.000 0.004 0.000 0.308
#> GSM152067     3  0.3574     0.6927 0.020 0.020 0.804 0.000 0.152 0.004
#> GSM152068     2  0.0790     0.8598 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM152075     4  0.0881     0.8668 0.000 0.008 0.000 0.972 0.008 0.012
#> GSM152076     4  0.1982     0.8618 0.004 0.012 0.000 0.924 0.040 0.020
#> GSM152079     2  0.0790     0.8598 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM152084     3  0.4547     0.7172 0.148 0.008 0.752 0.060 0.032 0.000
#> GSM152089     4  0.6229     0.1872 0.008 0.004 0.012 0.468 0.144 0.364
#> GSM152095     4  0.1982     0.8618 0.004 0.012 0.000 0.924 0.040 0.020
#> GSM152096     3  0.4255     0.7230 0.144 0.016 0.776 0.032 0.032 0.000
#> GSM152097     2  0.3479     0.8028 0.008 0.820 0.000 0.088 0.084 0.000
#> GSM152099     2  0.0935     0.8600 0.000 0.964 0.000 0.032 0.004 0.000
#> GSM152106     2  0.3479     0.8028 0.008 0.820 0.000 0.088 0.084 0.000
#> GSM152107     3  0.4740     0.6469 0.012 0.004 0.724 0.160 0.096 0.004
#> GSM152109     3  0.3019     0.7147 0.032 0.020 0.856 0.000 0.092 0.000
#> GSM152111     6  0.1897     0.5826 0.084 0.000 0.000 0.004 0.004 0.908
#> GSM152112     4  0.3447     0.8047 0.008 0.008 0.064 0.840 0.076 0.004
#> GSM152113     1  0.5677     0.2649 0.588 0.008 0.296 0.032 0.076 0.000
#> GSM152115     3  0.3963     0.6999 0.032 0.000 0.796 0.044 0.124 0.004
#> GSM152030     4  0.2257     0.8518 0.000 0.008 0.040 0.904 0.048 0.000
#> GSM152038     3  0.5063     0.4894 0.324 0.004 0.596 0.004 0.072 0.000
#> GSM152042     4  0.2392     0.8481 0.000 0.008 0.048 0.896 0.048 0.000
#> GSM152062     3  0.4370     0.7191 0.148 0.008 0.764 0.048 0.032 0.000
#> GSM152077     1  0.4133     0.6169 0.808 0.004 0.040 0.036 0.020 0.092
#> GSM152088     2  0.3121     0.7811 0.008 0.796 0.004 0.000 0.192 0.000
#> GSM152100     4  0.0881     0.8667 0.000 0.008 0.000 0.972 0.008 0.012
#> GSM152102     2  0.4874     0.6454 0.024 0.600 0.032 0.000 0.344 0.000
#> GSM152104     2  0.2884     0.8278 0.008 0.864 0.000 0.064 0.064 0.000
#> GSM152028     1  0.3210     0.5971 0.836 0.004 0.000 0.000 0.072 0.088
#> GSM152029     5  0.7386     0.5084 0.124 0.008 0.180 0.000 0.420 0.268
#> GSM152049     6  0.3737     0.0432 0.392 0.000 0.000 0.000 0.000 0.608
#> GSM152053     4  0.2519     0.8435 0.000 0.008 0.056 0.888 0.048 0.000
#> GSM152059     6  0.5830    -0.0459 0.156 0.000 0.008 0.000 0.344 0.492
#> GSM152085     6  0.1285     0.5953 0.052 0.000 0.000 0.000 0.004 0.944
#> GSM152101     3  0.4319     0.6771 0.012 0.004 0.768 0.092 0.120 0.004
#> GSM152105     1  0.3327     0.5837 0.848 0.004 0.064 0.000 0.060 0.024
#> GSM152034     6  0.1889     0.5799 0.004 0.000 0.000 0.020 0.056 0.920
#> GSM152036     4  0.1982     0.8618 0.004 0.012 0.000 0.924 0.040 0.020
#> GSM152040     6  0.5135     0.1436 0.104 0.000 0.000 0.000 0.324 0.572
#> GSM152043     1  0.6078    -0.2335 0.396 0.000 0.000 0.000 0.320 0.284
#> GSM152046     6  0.1983     0.5807 0.000 0.000 0.000 0.020 0.072 0.908
#> GSM152047     6  0.4617     0.2968 0.056 0.000 0.000 0.004 0.296 0.644
#> GSM152048     1  0.3584     0.5795 0.688 0.000 0.000 0.004 0.000 0.308
#> GSM152050     6  0.1908     0.5781 0.096 0.000 0.000 0.004 0.000 0.900
#> GSM152052     1  0.3050     0.6120 0.864 0.000 0.048 0.000 0.040 0.048
#> GSM152056     1  0.3728     0.5422 0.652 0.000 0.000 0.004 0.000 0.344
#> GSM152060     6  0.2123     0.5865 0.008 0.000 0.000 0.020 0.064 0.908
#> GSM152065     1  0.4065     0.4628 0.764 0.004 0.040 0.000 0.176 0.016
#> GSM152066     1  0.3601     0.5759 0.684 0.000 0.000 0.004 0.000 0.312
#> GSM152069     3  0.3140     0.7138 0.036 0.020 0.848 0.000 0.096 0.000
#> GSM152070     6  0.5890    -0.2281 0.172 0.000 0.004 0.000 0.404 0.420
#> GSM152071     3  0.3140     0.7138 0.036 0.020 0.848 0.000 0.096 0.000
#> GSM152072     5  0.6597     0.5564 0.156 0.000 0.252 0.000 0.512 0.080
#> GSM152073     6  0.5683     0.1231 0.184 0.000 0.000 0.000 0.308 0.508
#> GSM152078     1  0.5745     0.2857 0.612 0.004 0.184 0.000 0.176 0.024
#> GSM152082     1  0.5878    -0.0560 0.492 0.004 0.004 0.000 0.340 0.160
#> GSM152086     6  0.4084     0.0507 0.400 0.000 0.000 0.000 0.012 0.588
#> GSM152090     3  0.5301     0.6402 0.232 0.008 0.672 0.032 0.040 0.016
#> GSM152092     1  0.4338     0.4952 0.732 0.004 0.000 0.000 0.164 0.100
#> GSM152093     1  0.5167     0.5507 0.620 0.000 0.020 0.032 0.020 0.308
#> GSM152094     6  0.4198     0.4135 0.060 0.000 0.000 0.000 0.232 0.708
#> GSM152098     6  0.5887    -0.2122 0.172 0.000 0.004 0.000 0.396 0.428
#> GSM152110     1  0.3881     0.4701 0.600 0.000 0.000 0.004 0.000 0.396
#> GSM152031     1  0.4021     0.5565 0.796 0.004 0.032 0.000 0.112 0.056
#> GSM152037     1  0.3489     0.5925 0.708 0.000 0.000 0.004 0.000 0.288
#> GSM152055     6  0.1882     0.5804 0.028 0.000 0.000 0.020 0.024 0.928
#> GSM152061     6  0.2123     0.5865 0.008 0.000 0.000 0.020 0.064 0.908
#> GSM152064     6  0.1390     0.5920 0.032 0.000 0.000 0.016 0.004 0.948
#> GSM152087     6  0.3794     0.4597 0.040 0.000 0.000 0.000 0.216 0.744
#> GSM152103     3  0.5193     0.6252 0.240 0.004 0.672 0.024 0.036 0.024

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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 specimen(p) k
#> SD:kmeans 88    5.90e-09 2
#> SD:kmeans 80    2.23e-06 3
#> SD:kmeans 83    2.02e-05 4
#> SD:kmeans 62    1.44e-03 5
#> SD:kmeans 64    1.99e-02 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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.952           0.921       0.972         0.5052 0.494   0.494
#> 3 3 0.925           0.882       0.954         0.3174 0.782   0.584
#> 4 4 0.745           0.855       0.892         0.1153 0.870   0.642
#> 5 5 0.785           0.727       0.859         0.0842 0.883   0.590
#> 6 6 0.768           0.626       0.783         0.0391 0.932   0.678

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
#> GSM152032     2  0.0000    0.96335 0.000 1.000
#> GSM152033     1  0.0000    0.97590 1.000 0.000
#> GSM152063     2  0.0000    0.96335 0.000 1.000
#> GSM152074     2  0.0000    0.96335 0.000 1.000
#> GSM152080     2  0.0000    0.96335 0.000 1.000
#> GSM152081     2  0.0000    0.96335 0.000 1.000
#> GSM152083     2  0.0000    0.96335 0.000 1.000
#> GSM152091     2  0.0000    0.96335 0.000 1.000
#> GSM152108     2  0.0000    0.96335 0.000 1.000
#> GSM152114     2  0.9286    0.48876 0.344 0.656
#> GSM152035     2  0.0000    0.96335 0.000 1.000
#> GSM152039     2  0.0000    0.96335 0.000 1.000
#> GSM152041     2  0.5178    0.85144 0.116 0.884
#> GSM152044     2  0.0000    0.96335 0.000 1.000
#> GSM152045     1  0.0000    0.97590 1.000 0.000
#> GSM152051     2  0.0000    0.96335 0.000 1.000
#> GSM152054     2  0.3584    0.90288 0.068 0.932
#> GSM152057     2  0.0000    0.96335 0.000 1.000
#> GSM152058     1  0.0000    0.97590 1.000 0.000
#> GSM152067     2  0.0000    0.96335 0.000 1.000
#> GSM152068     2  0.0000    0.96335 0.000 1.000
#> GSM152075     2  0.0000    0.96335 0.000 1.000
#> GSM152076     2  0.0000    0.96335 0.000 1.000
#> GSM152079     2  0.0000    0.96335 0.000 1.000
#> GSM152084     2  0.0000    0.96335 0.000 1.000
#> GSM152089     2  0.0000    0.96335 0.000 1.000
#> GSM152095     2  0.0000    0.96335 0.000 1.000
#> GSM152096     2  0.0000    0.96335 0.000 1.000
#> GSM152097     2  0.0000    0.96335 0.000 1.000
#> GSM152099     2  0.0000    0.96335 0.000 1.000
#> GSM152106     2  0.0000    0.96335 0.000 1.000
#> GSM152107     2  0.0000    0.96335 0.000 1.000
#> GSM152109     2  0.0000    0.96335 0.000 1.000
#> GSM152111     1  0.0000    0.97590 1.000 0.000
#> GSM152112     2  0.0000    0.96335 0.000 1.000
#> GSM152113     2  0.9815    0.29366 0.420 0.580
#> GSM152115     2  0.0000    0.96335 0.000 1.000
#> GSM152030     2  0.0000    0.96335 0.000 1.000
#> GSM152038     1  0.0000    0.97590 1.000 0.000
#> GSM152042     2  0.0000    0.96335 0.000 1.000
#> GSM152062     2  0.4690    0.86815 0.100 0.900
#> GSM152077     1  0.0000    0.97590 1.000 0.000
#> GSM152088     2  0.0000    0.96335 0.000 1.000
#> GSM152100     2  0.0000    0.96335 0.000 1.000
#> GSM152102     2  0.0000    0.96335 0.000 1.000
#> GSM152104     2  0.0000    0.96335 0.000 1.000
#> GSM152028     1  0.0000    0.97590 1.000 0.000
#> GSM152029     1  0.0000    0.97590 1.000 0.000
#> GSM152049     1  0.0000    0.97590 1.000 0.000
#> GSM152053     2  0.0000    0.96335 0.000 1.000
#> GSM152059     1  0.0000    0.97590 1.000 0.000
#> GSM152085     1  0.0000    0.97590 1.000 0.000
#> GSM152101     2  0.0000    0.96335 0.000 1.000
#> GSM152105     1  0.0000    0.97590 1.000 0.000
#> GSM152034     1  0.0000    0.97590 1.000 0.000
#> GSM152036     2  0.0000    0.96335 0.000 1.000
#> GSM152040     1  0.0000    0.97590 1.000 0.000
#> GSM152043     1  0.0000    0.97590 1.000 0.000
#> GSM152046     1  0.0000    0.97590 1.000 0.000
#> GSM152047     1  0.0000    0.97590 1.000 0.000
#> GSM152048     1  0.0000    0.97590 1.000 0.000
#> GSM152050     1  0.0000    0.97590 1.000 0.000
#> GSM152052     1  0.0000    0.97590 1.000 0.000
#> GSM152056     1  0.0000    0.97590 1.000 0.000
#> GSM152060     1  0.0000    0.97590 1.000 0.000
#> GSM152065     1  0.0000    0.97590 1.000 0.000
#> GSM152066     1  0.0000    0.97590 1.000 0.000
#> GSM152069     2  0.9983    0.09020 0.476 0.524
#> GSM152070     1  0.0000    0.97590 1.000 0.000
#> GSM152071     1  0.9998   -0.00942 0.508 0.492
#> GSM152072     1  0.0000    0.97590 1.000 0.000
#> GSM152073     1  0.0000    0.97590 1.000 0.000
#> GSM152078     1  0.0000    0.97590 1.000 0.000
#> GSM152082     1  0.0000    0.97590 1.000 0.000
#> GSM152086     1  0.0000    0.97590 1.000 0.000
#> GSM152090     1  0.9996    0.00640 0.512 0.488
#> GSM152092     1  0.0000    0.97590 1.000 0.000
#> GSM152093     1  0.0000    0.97590 1.000 0.000
#> GSM152094     1  0.0000    0.97590 1.000 0.000
#> GSM152098     1  0.0000    0.97590 1.000 0.000
#> GSM152110     1  0.0000    0.97590 1.000 0.000
#> GSM152031     1  0.0000    0.97590 1.000 0.000
#> GSM152037     1  0.0000    0.97590 1.000 0.000
#> GSM152055     1  0.0000    0.97590 1.000 0.000
#> GSM152061     1  0.0000    0.97590 1.000 0.000
#> GSM152064     1  0.0000    0.97590 1.000 0.000
#> GSM152087     1  0.0000    0.97590 1.000 0.000
#> GSM152103     1  0.0376    0.97198 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
#> GSM152032     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152033     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152063     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152074     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152080     3  0.3038      0.859 0.000 0.104 0.896
#> GSM152081     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152083     3  0.1529      0.917 0.000 0.040 0.960
#> GSM152091     2  0.0424      0.928 0.000 0.992 0.008
#> GSM152108     2  0.0237      0.930 0.000 0.996 0.004
#> GSM152114     2  0.9086      0.232 0.356 0.496 0.148
#> GSM152035     2  0.0237      0.930 0.000 0.996 0.004
#> GSM152039     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152041     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152044     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152045     1  0.6180      0.235 0.584 0.000 0.416
#> GSM152051     2  0.0237      0.930 0.000 0.996 0.004
#> GSM152054     2  0.6252      0.187 0.000 0.556 0.444
#> GSM152057     2  0.0237      0.930 0.000 0.996 0.004
#> GSM152058     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152067     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152068     2  0.0237      0.930 0.000 0.996 0.004
#> GSM152075     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152076     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152079     2  0.0237      0.930 0.000 0.996 0.004
#> GSM152084     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152089     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152095     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152096     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152097     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152099     2  0.0237      0.930 0.000 0.996 0.004
#> GSM152106     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152107     2  0.6126      0.350 0.000 0.600 0.400
#> GSM152109     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152111     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152112     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152113     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152115     3  0.0592      0.940 0.000 0.012 0.988
#> GSM152030     2  0.0237      0.929 0.000 0.996 0.004
#> GSM152038     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152042     2  0.1411      0.905 0.000 0.964 0.036
#> GSM152062     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152077     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152088     2  0.0237      0.930 0.000 0.996 0.004
#> GSM152100     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152102     2  0.6274      0.148 0.000 0.544 0.456
#> GSM152104     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152028     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152029     3  0.2165      0.900 0.064 0.000 0.936
#> GSM152049     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152053     2  0.1964      0.888 0.000 0.944 0.056
#> GSM152059     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152085     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152101     3  0.6140      0.248 0.000 0.404 0.596
#> GSM152105     1  0.5178      0.656 0.744 0.000 0.256
#> GSM152034     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152036     2  0.0000      0.931 0.000 1.000 0.000
#> GSM152040     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152043     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152046     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152047     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152048     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152050     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152052     1  0.5988      0.436 0.632 0.000 0.368
#> GSM152056     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152060     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152065     3  0.5560      0.552 0.300 0.000 0.700
#> GSM152066     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152069     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152070     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152071     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152072     3  0.1289      0.927 0.032 0.000 0.968
#> GSM152073     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152078     3  0.1529      0.921 0.040 0.000 0.960
#> GSM152082     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152086     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152090     3  0.0000      0.946 0.000 0.000 1.000
#> GSM152092     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152093     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152094     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152098     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152110     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152031     1  0.2625      0.885 0.916 0.000 0.084
#> GSM152037     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152055     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152061     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152064     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152087     1  0.0000      0.965 1.000 0.000 0.000
#> GSM152103     3  0.0424      0.942 0.008 0.000 0.992

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.0469      0.864 0.000 0.012 0.988 0.000
#> GSM152033     3  0.2888      0.824 0.000 0.124 0.872 0.004
#> GSM152063     2  0.3266      0.925 0.000 0.832 0.000 0.168
#> GSM152074     3  0.0469      0.864 0.000 0.012 0.988 0.000
#> GSM152080     2  0.3597      0.834 0.000 0.836 0.148 0.016
#> GSM152081     4  0.0188      0.933 0.000 0.004 0.000 0.996
#> GSM152083     2  0.4072      0.706 0.000 0.748 0.252 0.000
#> GSM152091     2  0.3907      0.914 0.000 0.836 0.044 0.120
#> GSM152108     2  0.1557      0.849 0.000 0.944 0.000 0.056
#> GSM152114     4  0.4233      0.776 0.032 0.140 0.008 0.820
#> GSM152035     2  0.3450      0.927 0.000 0.836 0.008 0.156
#> GSM152039     4  0.0188      0.933 0.000 0.004 0.000 0.996
#> GSM152041     4  0.1297      0.915 0.020 0.016 0.000 0.964
#> GSM152044     2  0.3266      0.925 0.000 0.832 0.000 0.168
#> GSM152045     1  0.5105      0.617 0.708 0.024 0.264 0.004
#> GSM152051     2  0.3355      0.928 0.000 0.836 0.004 0.160
#> GSM152054     2  0.5346      0.791 0.060 0.780 0.124 0.036
#> GSM152057     2  0.3219      0.927 0.000 0.836 0.000 0.164
#> GSM152058     1  0.3432      0.883 0.848 0.140 0.008 0.004
#> GSM152067     3  0.0592      0.864 0.000 0.016 0.984 0.000
#> GSM152068     2  0.3219      0.927 0.000 0.836 0.000 0.164
#> GSM152075     4  0.0188      0.933 0.000 0.004 0.000 0.996
#> GSM152076     4  0.0188      0.933 0.000 0.004 0.000 0.996
#> GSM152079     2  0.3355      0.928 0.000 0.836 0.004 0.160
#> GSM152084     3  0.3638      0.779 0.000 0.032 0.848 0.120
#> GSM152089     4  0.2412      0.863 0.084 0.008 0.000 0.908
#> GSM152095     4  0.0188      0.933 0.000 0.004 0.000 0.996
#> GSM152096     3  0.4888      0.193 0.000 0.412 0.588 0.000
#> GSM152097     2  0.3444      0.914 0.000 0.816 0.000 0.184
#> GSM152099     2  0.3355      0.928 0.000 0.836 0.004 0.160
#> GSM152106     2  0.3400      0.917 0.000 0.820 0.000 0.180
#> GSM152107     4  0.3402      0.794 0.000 0.004 0.164 0.832
#> GSM152109     3  0.0469      0.864 0.000 0.012 0.988 0.000
#> GSM152111     1  0.0895      0.907 0.976 0.020 0.000 0.004
#> GSM152112     4  0.0592      0.929 0.000 0.000 0.016 0.984
#> GSM152113     3  0.2401      0.842 0.000 0.092 0.904 0.004
#> GSM152115     3  0.4212      0.646 0.000 0.012 0.772 0.216
#> GSM152030     4  0.0376      0.932 0.000 0.004 0.004 0.992
#> GSM152038     3  0.1022      0.863 0.000 0.032 0.968 0.000
#> GSM152042     4  0.0469      0.931 0.000 0.000 0.012 0.988
#> GSM152062     3  0.1356      0.863 0.000 0.032 0.960 0.008
#> GSM152077     1  0.3560      0.881 0.844 0.140 0.012 0.004
#> GSM152088     2  0.3958      0.910 0.000 0.836 0.052 0.112
#> GSM152100     4  0.0188      0.933 0.000 0.004 0.000 0.996
#> GSM152102     2  0.3821      0.858 0.000 0.840 0.120 0.040
#> GSM152104     2  0.3266      0.925 0.000 0.832 0.000 0.168
#> GSM152028     1  0.5192      0.841 0.760 0.160 0.076 0.004
#> GSM152029     3  0.2861      0.824 0.096 0.016 0.888 0.000
#> GSM152049     1  0.2654      0.896 0.888 0.108 0.000 0.004
#> GSM152053     4  0.0469      0.931 0.000 0.000 0.012 0.988
#> GSM152059     1  0.2843      0.865 0.892 0.020 0.088 0.000
#> GSM152085     1  0.0000      0.906 1.000 0.000 0.000 0.000
#> GSM152101     4  0.4795      0.600 0.000 0.012 0.292 0.696
#> GSM152105     3  0.5246      0.749 0.088 0.148 0.760 0.004
#> GSM152034     1  0.1302      0.893 0.956 0.000 0.000 0.044
#> GSM152036     4  0.0188      0.933 0.000 0.004 0.000 0.996
#> GSM152040     1  0.1004      0.903 0.972 0.024 0.004 0.000
#> GSM152043     1  0.3652      0.884 0.856 0.092 0.052 0.000
#> GSM152046     1  0.0592      0.903 0.984 0.000 0.000 0.016
#> GSM152047     1  0.1297      0.903 0.964 0.020 0.000 0.016
#> GSM152048     1  0.3432      0.883 0.848 0.140 0.008 0.004
#> GSM152050     1  0.1042      0.906 0.972 0.020 0.000 0.008
#> GSM152052     3  0.6838      0.523 0.232 0.152 0.612 0.004
#> GSM152056     1  0.3380      0.885 0.852 0.136 0.008 0.004
#> GSM152060     1  0.0817      0.901 0.976 0.000 0.000 0.024
#> GSM152065     3  0.4439      0.790 0.048 0.140 0.808 0.004
#> GSM152066     1  0.3380      0.885 0.852 0.136 0.008 0.004
#> GSM152069     3  0.0469      0.864 0.000 0.012 0.988 0.000
#> GSM152070     1  0.2882      0.864 0.892 0.024 0.084 0.000
#> GSM152071     3  0.0469      0.864 0.000 0.012 0.988 0.000
#> GSM152072     3  0.1520      0.860 0.020 0.024 0.956 0.000
#> GSM152073     1  0.1004      0.905 0.972 0.024 0.004 0.000
#> GSM152078     3  0.2019      0.858 0.024 0.032 0.940 0.004
#> GSM152082     1  0.4953      0.830 0.776 0.120 0.104 0.000
#> GSM152086     1  0.1661      0.906 0.944 0.052 0.000 0.004
#> GSM152090     3  0.1042      0.860 0.000 0.020 0.972 0.008
#> GSM152092     1  0.5136      0.838 0.768 0.144 0.084 0.004
#> GSM152093     1  0.4037      0.877 0.828 0.140 0.008 0.024
#> GSM152094     1  0.0469      0.905 0.988 0.012 0.000 0.000
#> GSM152098     1  0.3080      0.855 0.880 0.024 0.096 0.000
#> GSM152110     1  0.3052      0.888 0.860 0.136 0.000 0.004
#> GSM152031     3  0.7146      0.378 0.292 0.148 0.556 0.004
#> GSM152037     1  0.3432      0.883 0.848 0.140 0.008 0.004
#> GSM152055     1  0.1406      0.903 0.960 0.016 0.000 0.024
#> GSM152061     1  0.0817      0.901 0.976 0.000 0.000 0.024
#> GSM152064     1  0.1488      0.900 0.956 0.012 0.000 0.032
#> GSM152087     1  0.0469      0.905 0.988 0.012 0.000 0.000
#> GSM152103     3  0.0469      0.865 0.000 0.012 0.988 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
#> GSM152032     3  0.0955     0.8126 0.028 0.004 0.968 0.000 0.000
#> GSM152033     1  0.4009     0.4067 0.684 0.004 0.312 0.000 0.000
#> GSM152063     2  0.0162     0.9419 0.000 0.996 0.000 0.004 0.000
#> GSM152074     3  0.0955     0.8126 0.028 0.004 0.968 0.000 0.000
#> GSM152080     2  0.0162     0.9406 0.000 0.996 0.004 0.000 0.000
#> GSM152081     4  0.0000     0.9526 0.000 0.000 0.000 1.000 0.000
#> GSM152083     2  0.4291     0.0890 0.000 0.536 0.464 0.000 0.000
#> GSM152091     2  0.0162     0.9406 0.000 0.996 0.004 0.000 0.000
#> GSM152108     2  0.0162     0.9389 0.004 0.996 0.000 0.000 0.000
#> GSM152114     1  0.5919     0.2467 0.500 0.000 0.008 0.412 0.080
#> GSM152035     2  0.0000     0.9402 0.000 1.000 0.000 0.000 0.000
#> GSM152039     4  0.0000     0.9526 0.000 0.000 0.000 1.000 0.000
#> GSM152041     4  0.0290     0.9469 0.000 0.000 0.000 0.992 0.008
#> GSM152044     2  0.0162     0.9419 0.000 0.996 0.000 0.004 0.000
#> GSM152045     5  0.4199     0.7130 0.180 0.000 0.056 0.000 0.764
#> GSM152051     2  0.0162     0.9419 0.000 0.996 0.000 0.004 0.000
#> GSM152054     2  0.6579     0.5946 0.156 0.664 0.048 0.044 0.088
#> GSM152057     2  0.0162     0.9419 0.000 0.996 0.000 0.004 0.000
#> GSM152058     1  0.3336     0.7128 0.772 0.000 0.000 0.000 0.228
#> GSM152067     3  0.0671     0.8104 0.016 0.000 0.980 0.000 0.004
#> GSM152068     2  0.0162     0.9419 0.000 0.996 0.000 0.004 0.000
#> GSM152075     4  0.0000     0.9526 0.000 0.000 0.000 1.000 0.000
#> GSM152076     4  0.0000     0.9526 0.000 0.000 0.000 1.000 0.000
#> GSM152079     2  0.0162     0.9419 0.000 0.996 0.000 0.004 0.000
#> GSM152084     3  0.1442     0.8093 0.032 0.004 0.952 0.012 0.000
#> GSM152089     4  0.3139     0.8248 0.012 0.008 0.008 0.860 0.112
#> GSM152095     4  0.0000     0.9526 0.000 0.000 0.000 1.000 0.000
#> GSM152096     3  0.4101     0.4326 0.004 0.332 0.664 0.000 0.000
#> GSM152097     2  0.1410     0.9010 0.000 0.940 0.000 0.060 0.000
#> GSM152099     2  0.0162     0.9419 0.000 0.996 0.000 0.004 0.000
#> GSM152106     2  0.1341     0.9041 0.000 0.944 0.000 0.056 0.000
#> GSM152107     4  0.4331     0.3016 0.000 0.004 0.400 0.596 0.000
#> GSM152109     3  0.0566     0.8139 0.012 0.000 0.984 0.000 0.004
#> GSM152111     5  0.2389     0.7267 0.116 0.000 0.000 0.004 0.880
#> GSM152112     4  0.0290     0.9490 0.000 0.000 0.008 0.992 0.000
#> GSM152113     3  0.4450     0.0933 0.488 0.004 0.508 0.000 0.000
#> GSM152115     3  0.1560     0.8056 0.028 0.004 0.948 0.020 0.000
#> GSM152030     4  0.0162     0.9513 0.000 0.000 0.004 0.996 0.000
#> GSM152038     3  0.3010     0.7243 0.172 0.004 0.824 0.000 0.000
#> GSM152042     4  0.0162     0.9513 0.000 0.000 0.004 0.996 0.000
#> GSM152062     3  0.1041     0.8118 0.032 0.004 0.964 0.000 0.000
#> GSM152077     1  0.2970     0.7246 0.828 0.000 0.004 0.000 0.168
#> GSM152088     2  0.0162     0.9406 0.000 0.996 0.004 0.000 0.000
#> GSM152100     4  0.0000     0.9526 0.000 0.000 0.000 1.000 0.000
#> GSM152102     2  0.0451     0.9343 0.008 0.988 0.004 0.000 0.000
#> GSM152104     2  0.0162     0.9419 0.000 0.996 0.000 0.004 0.000
#> GSM152028     1  0.0865     0.7116 0.972 0.000 0.004 0.000 0.024
#> GSM152029     3  0.6296    -0.0401 0.152 0.000 0.440 0.000 0.408
#> GSM152049     5  0.4201     0.0947 0.408 0.000 0.000 0.000 0.592
#> GSM152053     4  0.0290     0.9490 0.000 0.000 0.008 0.992 0.000
#> GSM152059     5  0.3656     0.7284 0.196 0.000 0.020 0.000 0.784
#> GSM152085     5  0.1121     0.7779 0.044 0.000 0.000 0.000 0.956
#> GSM152101     3  0.4686     0.2284 0.012 0.004 0.588 0.396 0.000
#> GSM152105     1  0.2329     0.6654 0.876 0.000 0.124 0.000 0.000
#> GSM152034     5  0.1043     0.7842 0.000 0.000 0.000 0.040 0.960
#> GSM152036     4  0.0000     0.9526 0.000 0.000 0.000 1.000 0.000
#> GSM152040     5  0.3048     0.7500 0.176 0.000 0.004 0.000 0.820
#> GSM152043     1  0.4235     0.0481 0.576 0.000 0.000 0.000 0.424
#> GSM152046     5  0.0451     0.7880 0.004 0.000 0.000 0.008 0.988
#> GSM152047     5  0.3039     0.7601 0.152 0.000 0.012 0.000 0.836
#> GSM152048     1  0.3336     0.7128 0.772 0.000 0.000 0.000 0.228
#> GSM152050     5  0.2513     0.7249 0.116 0.000 0.000 0.008 0.876
#> GSM152052     1  0.2719     0.7212 0.884 0.000 0.068 0.000 0.048
#> GSM152056     1  0.3534     0.6957 0.744 0.000 0.000 0.000 0.256
#> GSM152060     5  0.0807     0.7858 0.012 0.000 0.000 0.012 0.976
#> GSM152065     1  0.2909     0.6193 0.848 0.000 0.140 0.000 0.012
#> GSM152066     1  0.3424     0.7071 0.760 0.000 0.000 0.000 0.240
#> GSM152069     3  0.0566     0.8139 0.012 0.000 0.984 0.000 0.004
#> GSM152070     5  0.4058     0.7032 0.236 0.000 0.024 0.000 0.740
#> GSM152071     3  0.0566     0.8139 0.012 0.000 0.984 0.000 0.004
#> GSM152072     3  0.4660     0.6322 0.192 0.000 0.728 0.000 0.080
#> GSM152073     5  0.3508     0.7074 0.252 0.000 0.000 0.000 0.748
#> GSM152078     3  0.4574     0.3642 0.412 0.000 0.576 0.000 0.012
#> GSM152082     1  0.3612     0.5271 0.764 0.000 0.008 0.000 0.228
#> GSM152086     5  0.4256     0.0123 0.436 0.000 0.000 0.000 0.564
#> GSM152090     3  0.1059     0.8120 0.020 0.008 0.968 0.000 0.004
#> GSM152092     1  0.2280     0.6607 0.880 0.000 0.000 0.000 0.120
#> GSM152093     1  0.3796     0.6483 0.700 0.000 0.000 0.000 0.300
#> GSM152094     5  0.1908     0.7844 0.092 0.000 0.000 0.000 0.908
#> GSM152098     5  0.3852     0.7110 0.220 0.000 0.020 0.000 0.760
#> GSM152110     1  0.3983     0.5939 0.660 0.000 0.000 0.000 0.340
#> GSM152031     1  0.2278     0.6889 0.908 0.000 0.060 0.000 0.032
#> GSM152037     1  0.3274     0.7167 0.780 0.000 0.000 0.000 0.220
#> GSM152055     5  0.2464     0.7372 0.096 0.000 0.000 0.016 0.888
#> GSM152061     5  0.0807     0.7858 0.012 0.000 0.000 0.012 0.976
#> GSM152064     5  0.2172     0.7520 0.076 0.000 0.000 0.016 0.908
#> GSM152087     5  0.1732     0.7876 0.080 0.000 0.000 0.000 0.920
#> GSM152103     3  0.1331     0.8060 0.040 0.000 0.952 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
#> GSM152032     3  0.0551     0.7483 0.008 0.000 0.984 0.004 0.004 0.000
#> GSM152033     1  0.5440     0.3798 0.552 0.000 0.152 0.000 0.296 0.000
#> GSM152063     2  0.0000     0.9789 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152074     3  0.1781     0.7437 0.008 0.000 0.924 0.008 0.060 0.000
#> GSM152080     2  0.0767     0.9716 0.008 0.976 0.004 0.000 0.012 0.000
#> GSM152081     4  0.1321     0.9244 0.004 0.000 0.020 0.952 0.024 0.000
#> GSM152083     3  0.4258     0.0892 0.004 0.492 0.496 0.004 0.004 0.000
#> GSM152091     2  0.0520     0.9749 0.008 0.984 0.000 0.000 0.008 0.000
#> GSM152108     2  0.1410     0.9422 0.044 0.944 0.004 0.000 0.008 0.000
#> GSM152114     1  0.6323     0.3885 0.580 0.000 0.040 0.256 0.044 0.080
#> GSM152035     2  0.0260     0.9771 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM152039     4  0.0363     0.9333 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM152041     4  0.2711     0.8434 0.012 0.000 0.000 0.860 0.012 0.116
#> GSM152044     2  0.0000     0.9789 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152045     5  0.4469     0.2336 0.012 0.000 0.016 0.000 0.584 0.388
#> GSM152051     2  0.0000     0.9789 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.7057     0.2804 0.028 0.312 0.040 0.072 0.504 0.044
#> GSM152057     2  0.0000     0.9789 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     1  0.2003     0.6250 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM152067     3  0.3053     0.7305 0.012 0.000 0.812 0.004 0.172 0.000
#> GSM152068     2  0.0000     0.9789 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     4  0.0622     0.9330 0.000 0.000 0.000 0.980 0.012 0.008
#> GSM152076     4  0.0363     0.9333 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM152079     2  0.0000     0.9789 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152084     3  0.2265     0.7360 0.024 0.000 0.900 0.008 0.068 0.000
#> GSM152089     4  0.5061     0.6612 0.008 0.012 0.004 0.688 0.088 0.200
#> GSM152095     4  0.0363     0.9333 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM152096     3  0.4568     0.5123 0.008 0.300 0.648 0.000 0.044 0.000
#> GSM152097     2  0.1387     0.9263 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM152099     2  0.0000     0.9789 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152106     2  0.1327     0.9304 0.000 0.936 0.000 0.064 0.000 0.000
#> GSM152107     3  0.5501     0.3454 0.016 0.000 0.552 0.336 0.096 0.000
#> GSM152109     3  0.2346     0.7385 0.008 0.000 0.868 0.000 0.124 0.000
#> GSM152111     6  0.2431     0.6328 0.132 0.000 0.000 0.000 0.008 0.860
#> GSM152112     4  0.2001     0.8980 0.012 0.000 0.008 0.912 0.068 0.000
#> GSM152113     1  0.5992     0.1339 0.396 0.000 0.372 0.000 0.232 0.000
#> GSM152115     3  0.3622     0.6922 0.020 0.000 0.792 0.024 0.164 0.000
#> GSM152030     4  0.1793     0.9163 0.004 0.000 0.032 0.928 0.036 0.000
#> GSM152038     3  0.5372     0.3785 0.172 0.000 0.604 0.004 0.220 0.000
#> GSM152042     4  0.1719     0.9181 0.004 0.000 0.032 0.932 0.032 0.000
#> GSM152062     3  0.1826     0.7415 0.020 0.000 0.924 0.004 0.052 0.000
#> GSM152077     1  0.1984     0.6171 0.912 0.000 0.000 0.000 0.056 0.032
#> GSM152088     2  0.0405     0.9759 0.008 0.988 0.000 0.000 0.004 0.000
#> GSM152100     4  0.0508     0.9323 0.000 0.000 0.000 0.984 0.004 0.012
#> GSM152102     2  0.1398     0.9455 0.008 0.940 0.000 0.000 0.052 0.000
#> GSM152104     2  0.0260     0.9759 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM152028     1  0.3175     0.5269 0.744 0.000 0.000 0.000 0.256 0.000
#> GSM152029     5  0.5610     0.4128 0.008 0.000 0.252 0.000 0.572 0.168
#> GSM152049     6  0.4405     0.0852 0.472 0.000 0.000 0.000 0.024 0.504
#> GSM152053     4  0.1793     0.9163 0.004 0.000 0.032 0.928 0.036 0.000
#> GSM152059     6  0.4534    -0.0997 0.032 0.000 0.000 0.000 0.476 0.492
#> GSM152085     6  0.2066     0.6564 0.052 0.000 0.000 0.000 0.040 0.908
#> GSM152101     3  0.5595     0.4782 0.016 0.000 0.588 0.256 0.140 0.000
#> GSM152105     1  0.4282     0.4754 0.656 0.000 0.040 0.000 0.304 0.000
#> GSM152034     6  0.1462     0.6340 0.000 0.000 0.000 0.008 0.056 0.936
#> GSM152036     4  0.0508     0.9336 0.000 0.000 0.000 0.984 0.004 0.012
#> GSM152040     6  0.4147     0.0763 0.012 0.000 0.000 0.000 0.436 0.552
#> GSM152043     5  0.5731     0.3366 0.288 0.000 0.000 0.000 0.508 0.204
#> GSM152046     6  0.1075     0.6438 0.000 0.000 0.000 0.000 0.048 0.952
#> GSM152047     6  0.3563     0.3321 0.000 0.000 0.000 0.000 0.336 0.664
#> GSM152048     1  0.2048     0.6242 0.880 0.000 0.000 0.000 0.000 0.120
#> GSM152050     6  0.2704     0.6289 0.140 0.000 0.000 0.000 0.016 0.844
#> GSM152052     1  0.3660     0.5627 0.772 0.000 0.036 0.000 0.188 0.004
#> GSM152056     1  0.3163     0.5258 0.764 0.000 0.000 0.000 0.004 0.232
#> GSM152060     6  0.0725     0.6543 0.012 0.000 0.000 0.000 0.012 0.976
#> GSM152065     1  0.4526     0.2750 0.512 0.000 0.032 0.000 0.456 0.000
#> GSM152066     1  0.2442     0.6128 0.852 0.000 0.000 0.000 0.004 0.144
#> GSM152069     3  0.2389     0.7377 0.008 0.000 0.864 0.000 0.128 0.000
#> GSM152070     5  0.4238     0.3507 0.028 0.000 0.000 0.000 0.628 0.344
#> GSM152071     3  0.2389     0.7377 0.008 0.000 0.864 0.000 0.128 0.000
#> GSM152072     5  0.3551     0.5165 0.000 0.000 0.168 0.000 0.784 0.048
#> GSM152073     6  0.5385    -0.1220 0.112 0.000 0.000 0.000 0.420 0.468
#> GSM152078     5  0.5507     0.2335 0.208 0.000 0.228 0.000 0.564 0.000
#> GSM152082     5  0.4977     0.2580 0.300 0.000 0.004 0.000 0.612 0.084
#> GSM152086     6  0.4852     0.1127 0.452 0.000 0.000 0.000 0.056 0.492
#> GSM152090     3  0.2909     0.7261 0.028 0.000 0.836 0.000 0.136 0.000
#> GSM152092     1  0.4394     0.3114 0.568 0.000 0.004 0.000 0.408 0.020
#> GSM152093     1  0.4634     0.4732 0.688 0.000 0.028 0.000 0.040 0.244
#> GSM152094     6  0.3023     0.5032 0.000 0.000 0.000 0.000 0.232 0.768
#> GSM152098     5  0.4193     0.3401 0.024 0.000 0.000 0.000 0.624 0.352
#> GSM152110     1  0.3508     0.4381 0.704 0.000 0.000 0.000 0.004 0.292
#> GSM152031     1  0.4433     0.3427 0.560 0.000 0.016 0.000 0.416 0.008
#> GSM152037     1  0.1765     0.6275 0.904 0.000 0.000 0.000 0.000 0.096
#> GSM152055     6  0.2442     0.6202 0.144 0.000 0.000 0.000 0.004 0.852
#> GSM152061     6  0.0717     0.6532 0.008 0.000 0.000 0.000 0.016 0.976
#> GSM152064     6  0.2261     0.6376 0.104 0.000 0.000 0.004 0.008 0.884
#> GSM152087     6  0.3110     0.5439 0.012 0.000 0.000 0.000 0.196 0.792
#> GSM152103     3  0.3249     0.7183 0.044 0.000 0.824 0.000 0.128 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-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 specimen(p) k
#> SD:skmeans 83    3.75e-10 2
#> SD:skmeans 81    8.29e-07 3
#> SD:skmeans 86    3.60e-05 4
#> SD:skmeans 76    4.17e-04 5
#> SD:skmeans 61    2.08e-02 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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.813           0.901       0.953         0.4824 0.511   0.511
#> 3 3 0.577           0.761       0.885         0.3337 0.826   0.666
#> 4 4 0.716           0.720       0.881         0.1290 0.862   0.636
#> 5 5 0.684           0.581       0.791         0.0813 0.895   0.630
#> 6 6 0.663           0.514       0.744         0.0321 0.898   0.577

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
#> GSM152032     2  0.1414     0.9608 0.020 0.980
#> GSM152033     1  0.2043     0.9149 0.968 0.032
#> GSM152063     2  0.0000     0.9601 0.000 1.000
#> GSM152074     2  0.1414     0.9608 0.020 0.980
#> GSM152080     2  0.0376     0.9602 0.004 0.996
#> GSM152081     2  0.1414     0.9609 0.020 0.980
#> GSM152083     2  0.0000     0.9601 0.000 1.000
#> GSM152091     2  0.0000     0.9601 0.000 1.000
#> GSM152108     2  0.5408     0.8531 0.124 0.876
#> GSM152114     1  0.0000     0.9332 1.000 0.000
#> GSM152035     2  0.0000     0.9601 0.000 1.000
#> GSM152039     2  0.5519     0.8578 0.128 0.872
#> GSM152041     1  0.9993     0.1040 0.516 0.484
#> GSM152044     2  0.0000     0.9601 0.000 1.000
#> GSM152045     1  0.6343     0.8027 0.840 0.160
#> GSM152051     2  0.0000     0.9601 0.000 1.000
#> GSM152054     1  0.2948     0.9040 0.948 0.052
#> GSM152057     2  0.0000     0.9601 0.000 1.000
#> GSM152058     1  0.0000     0.9332 1.000 0.000
#> GSM152067     2  0.0376     0.9607 0.004 0.996
#> GSM152068     2  0.0000     0.9601 0.000 1.000
#> GSM152075     2  0.1633     0.9600 0.024 0.976
#> GSM152076     2  0.0000     0.9601 0.000 1.000
#> GSM152079     2  0.0000     0.9601 0.000 1.000
#> GSM152084     2  0.1633     0.9600 0.024 0.976
#> GSM152089     2  0.1633     0.9600 0.024 0.976
#> GSM152095     2  0.0000     0.9601 0.000 1.000
#> GSM152096     2  0.1633     0.9598 0.024 0.976
#> GSM152097     2  0.0000     0.9601 0.000 1.000
#> GSM152099     2  0.0000     0.9601 0.000 1.000
#> GSM152106     2  0.0000     0.9601 0.000 1.000
#> GSM152107     2  0.0376     0.9607 0.004 0.996
#> GSM152109     2  0.1633     0.9600 0.024 0.976
#> GSM152111     2  0.7376     0.7671 0.208 0.792
#> GSM152112     2  0.0938     0.9612 0.012 0.988
#> GSM152113     2  0.7299     0.7728 0.204 0.796
#> GSM152115     2  0.3114     0.9403 0.056 0.944
#> GSM152030     2  0.1414     0.9608 0.020 0.980
#> GSM152038     2  0.8955     0.5684 0.312 0.688
#> GSM152042     2  0.1414     0.9608 0.020 0.980
#> GSM152062     2  0.1633     0.9600 0.024 0.976
#> GSM152077     1  0.0000     0.9332 1.000 0.000
#> GSM152088     2  0.0000     0.9601 0.000 1.000
#> GSM152100     2  0.1843     0.9591 0.028 0.972
#> GSM152102     2  0.0000     0.9601 0.000 1.000
#> GSM152104     2  0.0000     0.9601 0.000 1.000
#> GSM152028     1  0.0000     0.9332 1.000 0.000
#> GSM152029     2  0.3114     0.9443 0.056 0.944
#> GSM152049     1  0.0000     0.9332 1.000 0.000
#> GSM152053     2  0.1633     0.9600 0.024 0.976
#> GSM152059     1  0.6343     0.7905 0.840 0.160
#> GSM152085     1  0.0000     0.9332 1.000 0.000
#> GSM152101     2  0.0376     0.9607 0.004 0.996
#> GSM152105     1  0.0000     0.9332 1.000 0.000
#> GSM152034     2  0.3114     0.9443 0.056 0.944
#> GSM152036     2  0.0672     0.9612 0.008 0.992
#> GSM152040     1  0.0000     0.9332 1.000 0.000
#> GSM152043     1  0.0000     0.9332 1.000 0.000
#> GSM152046     1  0.3431     0.8905 0.936 0.064
#> GSM152047     2  0.3114     0.9443 0.056 0.944
#> GSM152048     1  0.0000     0.9332 1.000 0.000
#> GSM152050     1  0.2603     0.9059 0.956 0.044
#> GSM152052     1  0.9775     0.3075 0.588 0.412
#> GSM152056     1  0.0000     0.9332 1.000 0.000
#> GSM152060     1  0.0000     0.9332 1.000 0.000
#> GSM152065     1  0.0000     0.9332 1.000 0.000
#> GSM152066     1  0.0000     0.9332 1.000 0.000
#> GSM152069     2  0.2603     0.9514 0.044 0.956
#> GSM152070     1  0.4939     0.8478 0.892 0.108
#> GSM152071     2  0.2603     0.9514 0.044 0.956
#> GSM152072     2  0.3114     0.9443 0.056 0.944
#> GSM152073     1  0.0000     0.9332 1.000 0.000
#> GSM152078     2  0.3114     0.9443 0.056 0.944
#> GSM152082     1  0.0000     0.9332 1.000 0.000
#> GSM152086     1  0.0000     0.9332 1.000 0.000
#> GSM152090     2  0.2948     0.9467 0.052 0.948
#> GSM152092     1  0.0000     0.9332 1.000 0.000
#> GSM152093     2  0.6048     0.8526 0.148 0.852
#> GSM152094     1  0.0000     0.9332 1.000 0.000
#> GSM152098     1  0.7056     0.7528 0.808 0.192
#> GSM152110     1  0.0000     0.9332 1.000 0.000
#> GSM152031     1  0.9993     0.0186 0.516 0.484
#> GSM152037     1  0.0000     0.9332 1.000 0.000
#> GSM152055     1  0.0000     0.9332 1.000 0.000
#> GSM152061     1  0.0000     0.9332 1.000 0.000
#> GSM152064     1  0.0000     0.9332 1.000 0.000
#> GSM152087     1  0.0000     0.9332 1.000 0.000
#> GSM152103     2  0.2948     0.9467 0.052 0.948

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0000     0.7984 0.000 0.000 1.000
#> GSM152033     1  0.4974     0.6878 0.764 0.000 0.236
#> GSM152063     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152074     3  0.0237     0.7995 0.004 0.000 0.996
#> GSM152080     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152081     3  0.1964     0.7769 0.000 0.056 0.944
#> GSM152083     2  0.5363     0.6155 0.000 0.724 0.276
#> GSM152091     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152108     3  0.8703     0.5993 0.244 0.168 0.588
#> GSM152114     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152035     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152039     2  0.4605     0.7450 0.000 0.796 0.204
#> GSM152041     3  0.6308     0.1716 0.492 0.000 0.508
#> GSM152044     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152045     1  0.5650     0.5481 0.688 0.000 0.312
#> GSM152051     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152054     1  0.8020     0.4853 0.596 0.084 0.320
#> GSM152057     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152058     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152067     3  0.0000     0.7984 0.000 0.000 1.000
#> GSM152068     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152075     3  0.4605     0.7129 0.204 0.000 0.796
#> GSM152076     3  0.6302     0.0637 0.000 0.480 0.520
#> GSM152079     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152084     3  0.0592     0.8009 0.012 0.000 0.988
#> GSM152089     3  0.4750     0.7081 0.216 0.000 0.784
#> GSM152095     3  0.6252     0.1852 0.000 0.444 0.556
#> GSM152096     3  0.1905     0.7972 0.016 0.028 0.956
#> GSM152097     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152099     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152106     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152107     3  0.0000     0.7984 0.000 0.000 1.000
#> GSM152109     3  0.0000     0.7984 0.000 0.000 1.000
#> GSM152111     3  0.6244     0.4306 0.440 0.000 0.560
#> GSM152112     3  0.0237     0.7985 0.004 0.000 0.996
#> GSM152113     3  0.4291     0.7262 0.180 0.000 0.820
#> GSM152115     3  0.1411     0.7902 0.036 0.000 0.964
#> GSM152030     3  0.0000     0.7984 0.000 0.000 1.000
#> GSM152038     3  0.5621     0.5085 0.308 0.000 0.692
#> GSM152042     3  0.0000     0.7984 0.000 0.000 1.000
#> GSM152062     3  0.1411     0.7983 0.036 0.000 0.964
#> GSM152077     1  0.0237     0.8770 0.996 0.000 0.004
#> GSM152088     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152100     3  0.4605     0.7129 0.204 0.000 0.796
#> GSM152102     2  0.2878     0.8733 0.000 0.904 0.096
#> GSM152104     2  0.0000     0.9610 0.000 1.000 0.000
#> GSM152028     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152029     3  0.3941     0.7540 0.156 0.000 0.844
#> GSM152049     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152053     3  0.0000     0.7984 0.000 0.000 1.000
#> GSM152059     1  0.5926     0.5006 0.644 0.000 0.356
#> GSM152085     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152101     3  0.0000     0.7984 0.000 0.000 1.000
#> GSM152105     1  0.4605     0.7170 0.796 0.000 0.204
#> GSM152034     3  0.5835     0.6136 0.340 0.000 0.660
#> GSM152036     3  0.5756     0.6448 0.028 0.208 0.764
#> GSM152040     1  0.4605     0.7170 0.796 0.000 0.204
#> GSM152043     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152046     1  0.2165     0.8300 0.936 0.000 0.064
#> GSM152047     3  0.5835     0.6136 0.340 0.000 0.660
#> GSM152048     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152050     1  0.1643     0.8474 0.956 0.000 0.044
#> GSM152052     1  0.5968     0.2349 0.636 0.000 0.364
#> GSM152056     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152060     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152065     1  0.4605     0.7170 0.796 0.000 0.204
#> GSM152066     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152069     3  0.2878     0.7793 0.096 0.000 0.904
#> GSM152070     1  0.3551     0.7771 0.868 0.000 0.132
#> GSM152071     3  0.3340     0.7680 0.120 0.000 0.880
#> GSM152072     3  0.3619     0.7586 0.136 0.000 0.864
#> GSM152073     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152078     3  0.3619     0.7586 0.136 0.000 0.864
#> GSM152082     1  0.4555     0.7213 0.800 0.000 0.200
#> GSM152086     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152090     3  0.5706     0.6364 0.320 0.000 0.680
#> GSM152092     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152093     3  0.6252     0.4261 0.444 0.000 0.556
#> GSM152094     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152098     1  0.4002     0.7227 0.840 0.000 0.160
#> GSM152110     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152031     1  0.6274     0.1908 0.544 0.000 0.456
#> GSM152037     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152055     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152061     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152064     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152087     1  0.0000     0.8789 1.000 0.000 0.000
#> GSM152103     3  0.5785     0.6232 0.332 0.000 0.668

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.0000     0.7298 0.000 0.000 1.000 0.000
#> GSM152033     1  0.4679     0.4447 0.648 0.000 0.352 0.000
#> GSM152063     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152074     3  0.1211     0.7020 0.000 0.000 0.960 0.040
#> GSM152080     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152081     3  0.4907     0.2600 0.000 0.000 0.580 0.420
#> GSM152083     2  0.4543     0.5179 0.000 0.676 0.324 0.000
#> GSM152091     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152108     3  0.7397     0.4506 0.292 0.200 0.508 0.000
#> GSM152114     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152035     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152039     4  0.0000     0.8082 0.000 0.000 0.000 1.000
#> GSM152041     1  0.6005    -0.0732 0.500 0.000 0.040 0.460
#> GSM152044     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152045     4  0.5851     0.5727 0.272 0.000 0.068 0.660
#> GSM152051     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152054     4  0.5466     0.6435 0.040 0.000 0.292 0.668
#> GSM152057     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152058     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152067     3  0.0000     0.7298 0.000 0.000 1.000 0.000
#> GSM152068     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152075     4  0.0000     0.8082 0.000 0.000 0.000 1.000
#> GSM152076     4  0.0000     0.8082 0.000 0.000 0.000 1.000
#> GSM152079     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152084     3  0.2611     0.6756 0.008 0.000 0.896 0.096
#> GSM152089     4  0.5466     0.5238 0.292 0.000 0.040 0.668
#> GSM152095     4  0.0000     0.8082 0.000 0.000 0.000 1.000
#> GSM152096     3  0.1114     0.7249 0.008 0.004 0.972 0.016
#> GSM152097     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152099     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152106     2  0.0592     0.9546 0.000 0.984 0.000 0.016
#> GSM152107     4  0.4356     0.6735 0.000 0.000 0.292 0.708
#> GSM152109     3  0.0000     0.7298 0.000 0.000 1.000 0.000
#> GSM152111     3  0.4967     0.3339 0.452 0.000 0.548 0.000
#> GSM152112     4  0.3907     0.7234 0.000 0.000 0.232 0.768
#> GSM152113     3  0.1022     0.7229 0.032 0.000 0.968 0.000
#> GSM152115     4  0.4356     0.6735 0.000 0.000 0.292 0.708
#> GSM152030     4  0.0000     0.8082 0.000 0.000 0.000 1.000
#> GSM152038     3  0.4304     0.4741 0.284 0.000 0.716 0.000
#> GSM152042     4  0.3444     0.6838 0.000 0.000 0.184 0.816
#> GSM152062     3  0.0592     0.7235 0.000 0.000 0.984 0.016
#> GSM152077     1  0.0469     0.8508 0.988 0.000 0.012 0.000
#> GSM152088     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152100     4  0.0000     0.8082 0.000 0.000 0.000 1.000
#> GSM152102     2  0.2623     0.8789 0.000 0.908 0.064 0.028
#> GSM152104     2  0.0000     0.9663 0.000 1.000 0.000 0.000
#> GSM152028     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152029     3  0.0921     0.7288 0.028 0.000 0.972 0.000
#> GSM152049     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152053     4  0.3400     0.6759 0.000 0.000 0.180 0.820
#> GSM152059     1  0.4985     0.1968 0.532 0.000 0.468 0.000
#> GSM152085     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152101     4  0.4008     0.7156 0.000 0.000 0.244 0.756
#> GSM152105     1  0.4522     0.4942 0.680 0.000 0.320 0.000
#> GSM152034     3  0.4978     0.5504 0.324 0.000 0.664 0.012
#> GSM152036     4  0.0000     0.8082 0.000 0.000 0.000 1.000
#> GSM152040     1  0.4522     0.4942 0.680 0.000 0.320 0.000
#> GSM152043     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152046     1  0.1637     0.8081 0.940 0.000 0.060 0.000
#> GSM152047     3  0.4605     0.5386 0.336 0.000 0.664 0.000
#> GSM152048     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152050     1  0.1211     0.8264 0.960 0.000 0.040 0.000
#> GSM152052     1  0.4941    -0.0258 0.564 0.000 0.436 0.000
#> GSM152056     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152060     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152065     1  0.4522     0.4942 0.680 0.000 0.320 0.000
#> GSM152066     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152069     3  0.0000     0.7298 0.000 0.000 1.000 0.000
#> GSM152070     1  0.2921     0.7332 0.860 0.000 0.140 0.000
#> GSM152071     3  0.0000     0.7298 0.000 0.000 1.000 0.000
#> GSM152072     3  0.0000     0.7298 0.000 0.000 1.000 0.000
#> GSM152073     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152078     3  0.0000     0.7298 0.000 0.000 1.000 0.000
#> GSM152082     1  0.4431     0.5178 0.696 0.000 0.304 0.000
#> GSM152086     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152090     3  0.4891     0.5636 0.308 0.000 0.680 0.012
#> GSM152092     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152093     3  0.4961     0.3438 0.448 0.000 0.552 0.000
#> GSM152094     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152098     1  0.3123     0.6913 0.844 0.000 0.156 0.000
#> GSM152110     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152031     3  0.5000    -0.1244 0.500 0.000 0.500 0.000
#> GSM152037     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152055     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152061     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152064     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152087     1  0.0000     0.8583 1.000 0.000 0.000 0.000
#> GSM152103     3  0.4543     0.5507 0.324 0.000 0.676 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
#> GSM152032     5  0.4300    -0.3336 0.000 0.000 0.476 0.000 0.524
#> GSM152033     5  0.2520     0.5162 0.048 0.000 0.056 0.000 0.896
#> GSM152063     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152074     5  0.4807    -0.3164 0.000 0.000 0.448 0.020 0.532
#> GSM152080     2  0.0162     0.9699 0.000 0.996 0.004 0.000 0.000
#> GSM152081     3  0.4613     0.4801 0.000 0.000 0.620 0.360 0.020
#> GSM152083     2  0.4010     0.6966 0.000 0.760 0.032 0.000 0.208
#> GSM152091     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152108     3  0.7171     0.3840 0.232 0.208 0.512 0.000 0.048
#> GSM152114     1  0.4283     0.5344 0.544 0.000 0.000 0.000 0.456
#> GSM152035     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152039     4  0.0404     0.8292 0.000 0.000 0.000 0.988 0.012
#> GSM152041     1  0.4264     0.4034 0.744 0.000 0.000 0.212 0.044
#> GSM152044     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152045     4  0.4349     0.7025 0.176 0.000 0.000 0.756 0.068
#> GSM152051     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152054     4  0.4245     0.7701 0.028 0.000 0.016 0.768 0.188
#> GSM152057     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152058     1  0.4283     0.5344 0.544 0.000 0.000 0.000 0.456
#> GSM152067     3  0.3430     0.6528 0.000 0.000 0.776 0.004 0.220
#> GSM152068     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152075     4  0.0404     0.8294 0.000 0.000 0.012 0.988 0.000
#> GSM152076     4  0.0404     0.8292 0.000 0.000 0.000 0.988 0.012
#> GSM152079     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152084     3  0.2570     0.7454 0.000 0.000 0.888 0.028 0.084
#> GSM152089     4  0.3845     0.7194 0.024 0.000 0.208 0.768 0.000
#> GSM152095     4  0.0404     0.8292 0.000 0.000 0.000 0.988 0.012
#> GSM152096     3  0.0162     0.7584 0.000 0.000 0.996 0.004 0.000
#> GSM152097     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152099     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152106     2  0.0290     0.9670 0.000 0.992 0.000 0.008 0.000
#> GSM152107     4  0.3710     0.7790 0.000 0.000 0.024 0.784 0.192
#> GSM152109     3  0.0880     0.7572 0.000 0.000 0.968 0.000 0.032
#> GSM152111     1  0.5039    -0.2142 0.512 0.000 0.456 0.000 0.032
#> GSM152112     4  0.3282     0.7887 0.000 0.000 0.008 0.804 0.188
#> GSM152113     3  0.4449     0.2949 0.004 0.000 0.512 0.000 0.484
#> GSM152115     4  0.3710     0.7790 0.000 0.000 0.024 0.784 0.192
#> GSM152030     4  0.0162     0.8304 0.000 0.000 0.000 0.996 0.004
#> GSM152038     5  0.4197     0.3074 0.028 0.000 0.244 0.000 0.728
#> GSM152042     4  0.4367     0.3786 0.000 0.000 0.416 0.580 0.004
#> GSM152062     3  0.4658     0.4319 0.000 0.000 0.576 0.016 0.408
#> GSM152077     5  0.3857     0.0144 0.312 0.000 0.000 0.000 0.688
#> GSM152088     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152100     4  0.0000     0.8301 0.000 0.000 0.000 1.000 0.000
#> GSM152102     2  0.3530     0.8433 0.040 0.856 0.000 0.044 0.060
#> GSM152104     2  0.0000     0.9724 0.000 1.000 0.000 0.000 0.000
#> GSM152028     5  0.4302    -0.4730 0.480 0.000 0.000 0.000 0.520
#> GSM152029     3  0.0963     0.7572 0.036 0.000 0.964 0.000 0.000
#> GSM152049     1  0.3143     0.5853 0.796 0.000 0.000 0.000 0.204
#> GSM152053     4  0.4211     0.5074 0.000 0.000 0.360 0.636 0.004
#> GSM152059     5  0.4060     0.2998 0.360 0.000 0.000 0.000 0.640
#> GSM152085     1  0.2732     0.5864 0.840 0.000 0.000 0.000 0.160
#> GSM152101     4  0.3318     0.7881 0.000 0.000 0.008 0.800 0.192
#> GSM152105     5  0.1965     0.5131 0.052 0.000 0.024 0.000 0.924
#> GSM152034     3  0.4327     0.5014 0.360 0.000 0.632 0.000 0.008
#> GSM152036     4  0.0510     0.8290 0.000 0.000 0.000 0.984 0.016
#> GSM152040     5  0.4201    -0.0816 0.408 0.000 0.000 0.000 0.592
#> GSM152043     1  0.4552     0.4228 0.524 0.000 0.008 0.000 0.468
#> GSM152046     1  0.0000     0.5149 1.000 0.000 0.000 0.000 0.000
#> GSM152047     3  0.3039     0.7114 0.152 0.000 0.836 0.000 0.012
#> GSM152048     1  0.4283     0.5344 0.544 0.000 0.000 0.000 0.456
#> GSM152050     1  0.3399     0.5845 0.812 0.000 0.020 0.000 0.168
#> GSM152052     1  0.5867     0.1700 0.496 0.000 0.404 0.000 0.100
#> GSM152056     1  0.4283     0.5344 0.544 0.000 0.000 0.000 0.456
#> GSM152060     1  0.0290     0.5190 0.992 0.000 0.000 0.000 0.008
#> GSM152065     5  0.2300     0.5129 0.072 0.000 0.024 0.000 0.904
#> GSM152066     1  0.4283     0.5344 0.544 0.000 0.000 0.000 0.456
#> GSM152069     3  0.0880     0.7572 0.000 0.000 0.968 0.000 0.032
#> GSM152070     5  0.6274    -0.2921 0.424 0.000 0.148 0.000 0.428
#> GSM152071     3  0.0880     0.7572 0.000 0.000 0.968 0.000 0.032
#> GSM152072     3  0.3940     0.6487 0.024 0.000 0.756 0.000 0.220
#> GSM152073     1  0.4182     0.5263 0.600 0.000 0.000 0.000 0.400
#> GSM152078     3  0.4851     0.6383 0.092 0.000 0.712 0.000 0.196
#> GSM152082     5  0.2074     0.4965 0.104 0.000 0.000 0.000 0.896
#> GSM152086     1  0.4273     0.5341 0.552 0.000 0.000 0.000 0.448
#> GSM152090     3  0.2206     0.7484 0.068 0.000 0.912 0.016 0.004
#> GSM152092     1  0.4300     0.4173 0.524 0.000 0.000 0.000 0.476
#> GSM152093     3  0.4351     0.6107 0.100 0.000 0.768 0.000 0.132
#> GSM152094     1  0.4182     0.5263 0.600 0.000 0.000 0.000 0.400
#> GSM152098     5  0.5620     0.2972 0.272 0.000 0.116 0.000 0.612
#> GSM152110     1  0.4283     0.5344 0.544 0.000 0.000 0.000 0.456
#> GSM152031     5  0.1893     0.5141 0.048 0.000 0.024 0.000 0.928
#> GSM152037     5  0.4268    -0.3967 0.444 0.000 0.000 0.000 0.556
#> GSM152055     1  0.1341     0.5184 0.944 0.000 0.000 0.000 0.056
#> GSM152061     1  0.0000     0.5149 1.000 0.000 0.000 0.000 0.000
#> GSM152064     1  0.2648     0.5851 0.848 0.000 0.000 0.000 0.152
#> GSM152087     1  0.2648     0.5851 0.848 0.000 0.000 0.000 0.152
#> GSM152103     3  0.2193     0.7414 0.092 0.000 0.900 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
#> GSM152032     1  0.3563     0.1597 0.664 0.000 0.336 0.000 0.000 0.000
#> GSM152033     1  0.4544     0.4973 0.548 0.000 0.036 0.000 0.000 0.416
#> GSM152063     2  0.0000     0.9516 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152074     1  0.3629     0.1956 0.712 0.000 0.276 0.000 0.012 0.000
#> GSM152080     2  0.0922     0.9408 0.024 0.968 0.004 0.004 0.000 0.000
#> GSM152081     4  0.5655     0.2504 0.016 0.000 0.176 0.592 0.216 0.000
#> GSM152083     2  0.4008     0.5926 0.308 0.672 0.016 0.004 0.000 0.000
#> GSM152091     2  0.0508     0.9477 0.012 0.984 0.000 0.004 0.000 0.000
#> GSM152108     3  0.5721     0.3520 0.000 0.176 0.480 0.000 0.000 0.344
#> GSM152114     6  0.0000     0.6253 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152035     2  0.0000     0.9516 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152039     4  0.3737     0.3030 0.000 0.000 0.000 0.608 0.392 0.000
#> GSM152041     6  0.6284     0.1232 0.244 0.000 0.000 0.032 0.212 0.512
#> GSM152044     2  0.0000     0.9516 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152045     5  0.3546     0.5873 0.016 0.000 0.000 0.196 0.776 0.012
#> GSM152051     2  0.0000     0.9516 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.3678     0.7117 0.128 0.000 0.000 0.084 0.788 0.000
#> GSM152057     2  0.0000     0.9516 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     6  0.0000     0.6253 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152067     3  0.3769     0.4339 0.356 0.000 0.640 0.000 0.004 0.000
#> GSM152068     2  0.0000     0.9516 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     5  0.0260     0.6802 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM152076     4  0.3737     0.3030 0.000 0.000 0.000 0.608 0.392 0.000
#> GSM152079     2  0.0291     0.9502 0.004 0.992 0.000 0.004 0.000 0.000
#> GSM152084     3  0.2257     0.6010 0.116 0.000 0.876 0.000 0.008 0.000
#> GSM152089     5  0.3141     0.6723 0.000 0.000 0.200 0.012 0.788 0.000
#> GSM152095     4  0.3737     0.3030 0.000 0.000 0.000 0.608 0.392 0.000
#> GSM152096     3  0.0146     0.6437 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM152097     2  0.0146     0.9504 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152099     2  0.0363     0.9482 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM152106     2  0.0725     0.9379 0.000 0.976 0.000 0.012 0.012 0.000
#> GSM152107     5  0.3183     0.7369 0.200 0.000 0.004 0.008 0.788 0.000
#> GSM152109     3  0.2340     0.6200 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM152111     3  0.7698    -0.0922 0.260 0.000 0.292 0.212 0.000 0.236
#> GSM152112     5  0.2762     0.7391 0.196 0.000 0.000 0.000 0.804 0.000
#> GSM152113     1  0.4095     0.0133 0.512 0.000 0.480 0.000 0.000 0.008
#> GSM152115     5  0.2964     0.7355 0.204 0.000 0.004 0.000 0.792 0.000
#> GSM152030     5  0.2902     0.4552 0.004 0.000 0.000 0.196 0.800 0.000
#> GSM152038     1  0.5570     0.5002 0.552 0.000 0.216 0.000 0.000 0.232
#> GSM152042     5  0.3930     0.3948 0.004 0.000 0.420 0.000 0.576 0.000
#> GSM152062     3  0.3975     0.0430 0.452 0.000 0.544 0.000 0.004 0.000
#> GSM152077     6  0.3175     0.1611 0.256 0.000 0.000 0.000 0.000 0.744
#> GSM152088     2  0.0508     0.9477 0.012 0.984 0.000 0.004 0.000 0.000
#> GSM152100     5  0.0458     0.6703 0.000 0.000 0.000 0.016 0.984 0.000
#> GSM152102     2  0.4749     0.6390 0.028 0.708 0.000 0.192 0.072 0.000
#> GSM152104     2  0.0000     0.9516 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152028     6  0.1267     0.5836 0.060 0.000 0.000 0.000 0.000 0.940
#> GSM152029     3  0.0717     0.6503 0.008 0.000 0.976 0.000 0.000 0.016
#> GSM152049     6  0.3534     0.4880 0.244 0.000 0.000 0.016 0.000 0.740
#> GSM152053     5  0.3819     0.4999 0.004 0.000 0.372 0.000 0.624 0.000
#> GSM152059     1  0.5246    -0.0048 0.608 0.000 0.000 0.212 0.000 0.180
#> GSM152085     6  0.5622     0.4325 0.248 0.000 0.000 0.212 0.000 0.540
#> GSM152101     5  0.2793     0.7389 0.200 0.000 0.000 0.000 0.800 0.000
#> GSM152105     1  0.3986     0.4517 0.532 0.000 0.004 0.000 0.000 0.464
#> GSM152034     3  0.5371     0.4354 0.252 0.000 0.620 0.020 0.000 0.108
#> GSM152036     4  0.3862     0.3008 0.004 0.000 0.000 0.608 0.388 0.000
#> GSM152040     6  0.3512     0.5904 0.032 0.000 0.000 0.196 0.000 0.772
#> GSM152043     6  0.4367     0.5631 0.056 0.000 0.024 0.180 0.000 0.740
#> GSM152046     4  0.6078    -0.1784 0.276 0.000 0.000 0.388 0.000 0.336
#> GSM152047     3  0.5159     0.4824 0.020 0.000 0.660 0.208 0.000 0.112
#> GSM152048     6  0.0000     0.6253 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152050     6  0.6026     0.3635 0.256 0.000 0.192 0.020 0.000 0.532
#> GSM152052     6  0.4379     0.0317 0.028 0.000 0.396 0.000 0.000 0.576
#> GSM152056     6  0.0000     0.6253 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152060     4  0.6084    -0.1909 0.276 0.000 0.000 0.380 0.000 0.344
#> GSM152065     1  0.3986     0.4517 0.532 0.000 0.004 0.000 0.000 0.464
#> GSM152066     6  0.0000     0.6253 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152069     3  0.2340     0.6200 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM152070     6  0.5257     0.4757 0.016 0.000 0.140 0.196 0.000 0.648
#> GSM152071     3  0.2340     0.6200 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM152072     3  0.4652     0.4821 0.288 0.000 0.640 0.072 0.000 0.000
#> GSM152073     6  0.3200     0.5976 0.016 0.000 0.000 0.196 0.000 0.788
#> GSM152078     3  0.4681     0.4775 0.232 0.000 0.668 0.000 0.000 0.100
#> GSM152082     6  0.5811    -0.0851 0.336 0.000 0.000 0.196 0.000 0.468
#> GSM152086     6  0.1204     0.6303 0.000 0.000 0.000 0.056 0.000 0.944
#> GSM152090     3  0.2213     0.6415 0.004 0.000 0.888 0.000 0.008 0.100
#> GSM152092     6  0.4008     0.5593 0.064 0.000 0.000 0.196 0.000 0.740
#> GSM152093     3  0.3076     0.5425 0.000 0.000 0.760 0.000 0.000 0.240
#> GSM152094     6  0.3200     0.5976 0.016 0.000 0.000 0.196 0.000 0.788
#> GSM152098     6  0.7195    -0.2229 0.336 0.000 0.104 0.196 0.000 0.364
#> GSM152110     6  0.0000     0.6253 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152031     1  0.3971     0.4709 0.548 0.000 0.004 0.000 0.000 0.448
#> GSM152037     6  0.1765     0.5447 0.096 0.000 0.000 0.000 0.000 0.904
#> GSM152055     6  0.5563     0.2224 0.260 0.000 0.000 0.192 0.000 0.548
#> GSM152061     4  0.6078    -0.1784 0.276 0.000 0.000 0.388 0.000 0.336
#> GSM152064     6  0.5656     0.4242 0.256 0.000 0.000 0.212 0.000 0.532
#> GSM152087     6  0.5635     0.4302 0.256 0.000 0.000 0.208 0.000 0.536
#> GSM152103     3  0.2350     0.6389 0.020 0.000 0.880 0.000 0.000 0.100

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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 specimen(p) k
#> SD:pam 85    5.29e-05 2
#> SD:pam 80    1.04e-04 3
#> SD:pam 75    3.25e-05 4
#> SD:pam 67    1.02e-04 5
#> SD:pam 49    6.33e-04 6

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


SD:mclust

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

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

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

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

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.448           0.842       0.866         0.4441 0.504   0.504
#> 3 3 0.784           0.923       0.947         0.4209 0.839   0.687
#> 4 4 0.779           0.594       0.837         0.0943 0.952   0.871
#> 5 5 0.590           0.563       0.732         0.1276 0.846   0.550
#> 6 6 0.598           0.448       0.669         0.0369 0.899   0.570

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
#> GSM152032     2   0.952      0.753 0.372 0.628
#> GSM152033     2   0.963      0.739 0.388 0.612
#> GSM152063     2   0.000      0.732 0.000 1.000
#> GSM152074     2   0.936      0.766 0.352 0.648
#> GSM152080     2   0.563      0.771 0.132 0.868
#> GSM152081     2   0.886      0.782 0.304 0.696
#> GSM152083     2   0.443      0.763 0.092 0.908
#> GSM152091     2   0.000      0.732 0.000 1.000
#> GSM152108     2   0.788      0.774 0.236 0.764
#> GSM152114     2   0.963      0.739 0.388 0.612
#> GSM152035     2   0.224      0.745 0.036 0.964
#> GSM152039     2   0.595      0.767 0.144 0.856
#> GSM152041     2   0.949      0.755 0.368 0.632
#> GSM152044     2   0.000      0.732 0.000 1.000
#> GSM152045     1   0.000      0.987 1.000 0.000
#> GSM152051     2   0.000      0.732 0.000 1.000
#> GSM152054     2   0.992      0.636 0.448 0.552
#> GSM152057     2   0.000      0.732 0.000 1.000
#> GSM152058     1   0.000      0.987 1.000 0.000
#> GSM152067     2   0.936      0.765 0.352 0.648
#> GSM152068     2   0.000      0.732 0.000 1.000
#> GSM152075     2   0.895      0.782 0.312 0.688
#> GSM152076     2   0.518      0.767 0.116 0.884
#> GSM152079     2   0.000      0.732 0.000 1.000
#> GSM152084     2   0.963      0.739 0.388 0.612
#> GSM152089     2   0.994      0.629 0.456 0.544
#> GSM152095     2   0.518      0.767 0.116 0.884
#> GSM152096     2   0.821      0.774 0.256 0.744
#> GSM152097     2   0.000      0.732 0.000 1.000
#> GSM152099     2   0.000      0.732 0.000 1.000
#> GSM152106     2   0.000      0.732 0.000 1.000
#> GSM152107     2   0.917      0.776 0.332 0.668
#> GSM152109     2   0.946      0.758 0.364 0.636
#> GSM152111     1   0.000      0.987 1.000 0.000
#> GSM152112     2   0.909      0.779 0.324 0.676
#> GSM152113     2   0.963      0.739 0.388 0.612
#> GSM152115     2   0.943      0.761 0.360 0.640
#> GSM152030     2   0.518      0.767 0.116 0.884
#> GSM152038     2   0.963      0.739 0.388 0.612
#> GSM152042     2   0.886      0.784 0.304 0.696
#> GSM152062     2   0.955      0.750 0.376 0.624
#> GSM152077     2   0.990      0.660 0.440 0.560
#> GSM152088     2   0.000      0.732 0.000 1.000
#> GSM152100     2   0.839      0.786 0.268 0.732
#> GSM152102     2   0.767      0.776 0.224 0.776
#> GSM152104     2   0.000      0.732 0.000 1.000
#> GSM152028     1   0.000      0.987 1.000 0.000
#> GSM152029     1   0.000      0.987 1.000 0.000
#> GSM152049     1   0.000      0.987 1.000 0.000
#> GSM152053     2   0.891      0.784 0.308 0.692
#> GSM152059     1   0.000      0.987 1.000 0.000
#> GSM152085     1   0.000      0.987 1.000 0.000
#> GSM152101     2   0.917      0.776 0.332 0.668
#> GSM152105     1   0.141      0.959 0.980 0.020
#> GSM152034     1   0.000      0.987 1.000 0.000
#> GSM152036     2   0.595      0.767 0.144 0.856
#> GSM152040     1   0.000      0.987 1.000 0.000
#> GSM152043     1   0.000      0.987 1.000 0.000
#> GSM152046     1   0.000      0.987 1.000 0.000
#> GSM152047     1   0.000      0.987 1.000 0.000
#> GSM152048     1   0.000      0.987 1.000 0.000
#> GSM152050     1   0.000      0.987 1.000 0.000
#> GSM152052     1   0.000      0.987 1.000 0.000
#> GSM152056     1   0.000      0.987 1.000 0.000
#> GSM152060     1   0.000      0.987 1.000 0.000
#> GSM152065     1   0.000      0.987 1.000 0.000
#> GSM152066     1   0.000      0.987 1.000 0.000
#> GSM152069     2   0.963      0.739 0.388 0.612
#> GSM152070     1   0.000      0.987 1.000 0.000
#> GSM152071     2   0.963      0.739 0.388 0.612
#> GSM152072     1   0.000      0.987 1.000 0.000
#> GSM152073     1   0.000      0.987 1.000 0.000
#> GSM152078     1   0.000      0.987 1.000 0.000
#> GSM152082     1   0.000      0.987 1.000 0.000
#> GSM152086     1   0.000      0.987 1.000 0.000
#> GSM152090     2   0.963      0.739 0.388 0.612
#> GSM152092     1   0.000      0.987 1.000 0.000
#> GSM152093     1   0.881      0.264 0.700 0.300
#> GSM152094     1   0.000      0.987 1.000 0.000
#> GSM152098     1   0.000      0.987 1.000 0.000
#> GSM152110     1   0.000      0.987 1.000 0.000
#> GSM152031     1   0.000      0.987 1.000 0.000
#> GSM152037     1   0.000      0.987 1.000 0.000
#> GSM152055     1   0.000      0.987 1.000 0.000
#> GSM152061     1   0.000      0.987 1.000 0.000
#> GSM152064     1   0.000      0.987 1.000 0.000
#> GSM152087     1   0.000      0.987 1.000 0.000
#> GSM152103     2   0.975      0.713 0.408 0.592

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152033     3  0.1529      0.885 0.040 0.000 0.960
#> GSM152063     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152074     3  0.1031      0.878 0.000 0.024 0.976
#> GSM152080     2  0.3619      0.865 0.000 0.864 0.136
#> GSM152081     3  0.3551      0.879 0.000 0.132 0.868
#> GSM152083     2  0.3816      0.860 0.000 0.852 0.148
#> GSM152091     2  0.3551      0.868 0.000 0.868 0.132
#> GSM152108     3  0.5740      0.828 0.100 0.096 0.804
#> GSM152114     3  0.3551      0.863 0.132 0.000 0.868
#> GSM152035     2  0.4555      0.745 0.000 0.800 0.200
#> GSM152039     3  0.4062      0.863 0.000 0.164 0.836
#> GSM152041     3  0.4172      0.842 0.156 0.004 0.840
#> GSM152044     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152045     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152051     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152054     3  0.3752      0.855 0.144 0.000 0.856
#> GSM152057     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152058     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152067     3  0.1643      0.866 0.000 0.044 0.956
#> GSM152068     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152075     3  0.3551      0.879 0.000 0.132 0.868
#> GSM152076     3  0.4062      0.863 0.000 0.164 0.836
#> GSM152079     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152084     3  0.3482      0.865 0.128 0.000 0.872
#> GSM152089     3  0.3551      0.863 0.132 0.000 0.868
#> GSM152095     3  0.4062      0.863 0.000 0.164 0.836
#> GSM152096     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152097     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152099     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152106     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152107     3  0.0892      0.889 0.000 0.020 0.980
#> GSM152109     3  0.0747      0.881 0.000 0.016 0.984
#> GSM152111     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152112     3  0.3715      0.881 0.004 0.128 0.868
#> GSM152113     3  0.3752      0.855 0.144 0.000 0.856
#> GSM152115     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152030     3  0.3551      0.879 0.000 0.132 0.868
#> GSM152038     3  0.3116      0.874 0.108 0.000 0.892
#> GSM152042     3  0.3551      0.879 0.000 0.132 0.868
#> GSM152062     3  0.1643      0.892 0.044 0.000 0.956
#> GSM152077     1  0.2261      0.921 0.932 0.000 0.068
#> GSM152088     2  0.2448      0.899 0.000 0.924 0.076
#> GSM152100     3  0.3551      0.879 0.000 0.132 0.868
#> GSM152102     2  0.6225      0.426 0.000 0.568 0.432
#> GSM152104     2  0.0237      0.928 0.000 0.996 0.004
#> GSM152028     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152029     1  0.1753      0.942 0.952 0.000 0.048
#> GSM152049     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152053     3  0.3715      0.881 0.004 0.128 0.868
#> GSM152059     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152085     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152101     3  0.0237      0.884 0.000 0.004 0.996
#> GSM152105     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152034     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152036     3  0.4002      0.865 0.000 0.160 0.840
#> GSM152040     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152043     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152046     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152047     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152048     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152050     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152052     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152056     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152060     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152065     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152066     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152069     3  0.0892      0.887 0.020 0.000 0.980
#> GSM152070     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152071     3  0.1031      0.886 0.024 0.000 0.976
#> GSM152072     1  0.2165      0.927 0.936 0.000 0.064
#> GSM152073     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152078     1  0.0424      0.986 0.992 0.000 0.008
#> GSM152082     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152086     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152090     3  0.3686      0.858 0.140 0.000 0.860
#> GSM152092     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152093     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152094     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152098     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152110     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152031     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152037     1  0.0000      0.993 1.000 0.000 0.000
#> GSM152055     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152061     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152064     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152087     1  0.0237      0.993 0.996 0.004 0.000
#> GSM152103     3  0.4121      0.833 0.168 0.000 0.832

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.2125    0.40191 0.000 0.004 0.920 0.076
#> GSM152033     3  0.0592    0.45503 0.016 0.000 0.984 0.000
#> GSM152063     2  0.0524    0.88770 0.000 0.988 0.004 0.008
#> GSM152074     3  0.2845    0.40597 0.000 0.028 0.896 0.076
#> GSM152080     2  0.4955    0.65787 0.000 0.556 0.000 0.444
#> GSM152081     3  0.5856   -0.83241 0.000 0.032 0.504 0.464
#> GSM152083     2  0.2089    0.86018 0.000 0.932 0.048 0.020
#> GSM152091     2  0.4955    0.65787 0.000 0.556 0.000 0.444
#> GSM152108     3  0.3899    0.32528 0.000 0.108 0.840 0.052
#> GSM152114     3  0.1811    0.43240 0.020 0.004 0.948 0.028
#> GSM152035     2  0.4452    0.52232 0.000 0.732 0.260 0.008
#> GSM152039     4  0.6660    1.00000 0.000 0.084 0.452 0.464
#> GSM152041     3  0.6351   -0.66624 0.032 0.020 0.560 0.388
#> GSM152044     2  0.0336    0.88914 0.000 0.992 0.000 0.008
#> GSM152045     1  0.1584    0.94239 0.952 0.000 0.036 0.012
#> GSM152051     2  0.0000    0.88889 0.000 1.000 0.000 0.000
#> GSM152054     3  0.6087    0.29218 0.236 0.004 0.672 0.088
#> GSM152057     2  0.0336    0.88914 0.000 0.992 0.000 0.008
#> GSM152058     1  0.2521    0.94042 0.912 0.000 0.024 0.064
#> GSM152067     3  0.5070    0.31524 0.000 0.008 0.620 0.372
#> GSM152068     2  0.0188    0.88920 0.000 0.996 0.000 0.004
#> GSM152075     3  0.5856   -0.83241 0.000 0.032 0.504 0.464
#> GSM152076     4  0.6660    1.00000 0.000 0.084 0.452 0.464
#> GSM152079     2  0.0000    0.88889 0.000 1.000 0.000 0.000
#> GSM152084     3  0.0376    0.44925 0.000 0.004 0.992 0.004
#> GSM152089     3  0.7857   -0.00906 0.268 0.004 0.452 0.276
#> GSM152095     4  0.6660    1.00000 0.000 0.084 0.452 0.464
#> GSM152096     3  0.1209    0.43671 0.000 0.004 0.964 0.032
#> GSM152097     2  0.0469    0.88755 0.000 0.988 0.000 0.012
#> GSM152099     2  0.0000    0.88889 0.000 1.000 0.000 0.000
#> GSM152106     2  0.0336    0.88914 0.000 0.992 0.000 0.008
#> GSM152107     3  0.4699   -0.29478 0.000 0.004 0.676 0.320
#> GSM152109     3  0.4699    0.33068 0.000 0.004 0.676 0.320
#> GSM152111     1  0.0469    0.95339 0.988 0.000 0.000 0.012
#> GSM152112     3  0.5774   -0.82238 0.000 0.028 0.508 0.464
#> GSM152113     3  0.0336    0.45503 0.008 0.000 0.992 0.000
#> GSM152115     3  0.2530    0.37280 0.000 0.004 0.896 0.100
#> GSM152030     3  0.5856   -0.83241 0.000 0.032 0.504 0.464
#> GSM152038     3  0.0657    0.45512 0.012 0.000 0.984 0.004
#> GSM152042     3  0.5856   -0.83241 0.000 0.032 0.504 0.464
#> GSM152062     3  0.0336    0.45013 0.000 0.000 0.992 0.008
#> GSM152077     3  0.6371    0.05651 0.428 0.000 0.508 0.064
#> GSM152088     2  0.2704    0.84330 0.000 0.876 0.000 0.124
#> GSM152100     3  0.6147   -0.88385 0.000 0.048 0.488 0.464
#> GSM152102     2  0.7006    0.54651 0.000 0.528 0.132 0.340
#> GSM152104     2  0.0336    0.88914 0.000 0.992 0.000 0.008
#> GSM152028     1  0.2722    0.93656 0.904 0.000 0.032 0.064
#> GSM152029     1  0.2179    0.91746 0.924 0.000 0.064 0.012
#> GSM152049     1  0.1059    0.95495 0.972 0.000 0.016 0.012
#> GSM152053     3  0.5597   -0.80132 0.000 0.020 0.516 0.464
#> GSM152059     1  0.0469    0.95399 0.988 0.000 0.000 0.012
#> GSM152085     1  0.0000    0.95482 1.000 0.000 0.000 0.000
#> GSM152101     3  0.5057   -0.34420 0.000 0.012 0.648 0.340
#> GSM152105     1  0.3071    0.92706 0.888 0.000 0.044 0.068
#> GSM152034     1  0.0336    0.95371 0.992 0.000 0.000 0.008
#> GSM152036     4  0.6660    1.00000 0.000 0.084 0.452 0.464
#> GSM152040     1  0.0469    0.95339 0.988 0.000 0.000 0.012
#> GSM152043     1  0.2021    0.94987 0.936 0.000 0.024 0.040
#> GSM152046     1  0.0188    0.95444 0.996 0.000 0.000 0.004
#> GSM152047     1  0.0657    0.95263 0.984 0.000 0.004 0.012
#> GSM152048     1  0.2142    0.94537 0.928 0.000 0.016 0.056
#> GSM152050     1  0.1059    0.95505 0.972 0.000 0.016 0.012
#> GSM152052     1  0.2131    0.94993 0.932 0.000 0.036 0.032
#> GSM152056     1  0.1888    0.94942 0.940 0.000 0.016 0.044
#> GSM152060     1  0.0000    0.95482 1.000 0.000 0.000 0.000
#> GSM152065     1  0.3056    0.92913 0.888 0.000 0.040 0.072
#> GSM152066     1  0.2060    0.94698 0.932 0.000 0.016 0.052
#> GSM152069     3  0.5026    0.33308 0.016 0.000 0.672 0.312
#> GSM152070     1  0.0592    0.95478 0.984 0.000 0.000 0.016
#> GSM152071     3  0.5496    0.32548 0.036 0.000 0.652 0.312
#> GSM152072     1  0.1284    0.95023 0.964 0.000 0.012 0.024
#> GSM152073     1  0.0524    0.95433 0.988 0.000 0.004 0.008
#> GSM152078     1  0.2089    0.94007 0.932 0.000 0.048 0.020
#> GSM152082     1  0.2101    0.94613 0.928 0.000 0.012 0.060
#> GSM152086     1  0.0927    0.95608 0.976 0.000 0.008 0.016
#> GSM152090     3  0.0469    0.45441 0.012 0.000 0.988 0.000
#> GSM152092     1  0.2021    0.95086 0.936 0.000 0.024 0.040
#> GSM152093     1  0.5873    0.20167 0.548 0.000 0.416 0.036
#> GSM152094     1  0.0336    0.95371 0.992 0.000 0.000 0.008
#> GSM152098     1  0.0672    0.95613 0.984 0.000 0.008 0.008
#> GSM152110     1  0.1406    0.95468 0.960 0.000 0.016 0.024
#> GSM152031     1  0.2660    0.93836 0.908 0.000 0.036 0.056
#> GSM152037     1  0.2521    0.94042 0.912 0.000 0.024 0.064
#> GSM152055     1  0.1297    0.95470 0.964 0.000 0.016 0.020
#> GSM152061     1  0.0188    0.95444 0.996 0.000 0.000 0.004
#> GSM152064     1  0.0469    0.95339 0.988 0.000 0.000 0.012
#> GSM152087     1  0.0188    0.95494 0.996 0.000 0.000 0.004
#> GSM152103     3  0.1118    0.44590 0.036 0.000 0.964 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
#> GSM152032     3  0.0290     0.4793 0.000 0.000 0.992 0.008 0.000
#> GSM152033     3  0.5470     0.4329 0.296 0.000 0.612 0.000 0.092
#> GSM152063     2  0.0162     0.8354 0.000 0.996 0.000 0.004 0.000
#> GSM152074     3  0.0451     0.4777 0.000 0.004 0.988 0.008 0.000
#> GSM152080     2  0.5009     0.5628 0.000 0.496 0.012 0.480 0.012
#> GSM152081     4  0.5439     0.6811 0.000 0.060 0.432 0.508 0.000
#> GSM152083     2  0.3796     0.4948 0.000 0.700 0.300 0.000 0.000
#> GSM152091     2  0.5009     0.5628 0.000 0.496 0.012 0.480 0.012
#> GSM152108     3  0.3617     0.3383 0.012 0.088 0.840 0.060 0.000
#> GSM152114     3  0.3282     0.4660 0.012 0.000 0.860 0.044 0.084
#> GSM152035     2  0.1628     0.7864 0.000 0.936 0.056 0.008 0.000
#> GSM152039     4  0.6140     0.6566 0.000 0.356 0.140 0.504 0.000
#> GSM152041     4  0.8106     0.6081 0.008 0.204 0.256 0.432 0.100
#> GSM152044     2  0.0000     0.8376 0.000 1.000 0.000 0.000 0.000
#> GSM152045     5  0.1965     0.6857 0.096 0.000 0.000 0.000 0.904
#> GSM152051     2  0.0000     0.8376 0.000 1.000 0.000 0.000 0.000
#> GSM152054     3  0.6402     0.2195 0.020 0.000 0.456 0.100 0.424
#> GSM152057     2  0.0000     0.8376 0.000 1.000 0.000 0.000 0.000
#> GSM152058     1  0.2848     0.7368 0.868 0.000 0.028 0.000 0.104
#> GSM152067     3  0.6250     0.3561 0.000 0.004 0.540 0.156 0.300
#> GSM152068     2  0.0000     0.8376 0.000 1.000 0.000 0.000 0.000
#> GSM152075     4  0.4744     0.6487 0.000 0.016 0.476 0.508 0.000
#> GSM152076     4  0.6163     0.6607 0.000 0.352 0.144 0.504 0.000
#> GSM152079     2  0.0000     0.8376 0.000 1.000 0.000 0.000 0.000
#> GSM152084     3  0.2407     0.4951 0.012 0.000 0.896 0.004 0.088
#> GSM152089     5  0.6129     0.1178 0.012 0.008 0.068 0.412 0.500
#> GSM152095     4  0.6140     0.6566 0.000 0.356 0.140 0.504 0.000
#> GSM152096     3  0.1329     0.4912 0.032 0.000 0.956 0.008 0.004
#> GSM152097     2  0.0290     0.8324 0.000 0.992 0.000 0.008 0.000
#> GSM152099     2  0.0162     0.8360 0.000 0.996 0.004 0.000 0.000
#> GSM152106     2  0.0000     0.8376 0.000 1.000 0.000 0.000 0.000
#> GSM152107     3  0.4735    -0.2898 0.004 0.032 0.668 0.296 0.000
#> GSM152109     3  0.6186     0.3609 0.004 0.000 0.548 0.148 0.300
#> GSM152111     5  0.3707     0.4900 0.284 0.000 0.000 0.000 0.716
#> GSM152112     4  0.5315     0.6612 0.004 0.040 0.456 0.500 0.000
#> GSM152113     3  0.4247     0.5029 0.132 0.000 0.776 0.000 0.092
#> GSM152115     3  0.1918     0.4781 0.036 0.000 0.928 0.036 0.000
#> GSM152030     4  0.4744     0.6487 0.000 0.016 0.476 0.508 0.000
#> GSM152038     3  0.5584     0.4251 0.324 0.000 0.584 0.000 0.092
#> GSM152042     4  0.4746     0.6437 0.000 0.016 0.480 0.504 0.000
#> GSM152062     3  0.2349     0.4953 0.012 0.000 0.900 0.004 0.084
#> GSM152077     3  0.5779     0.2543 0.220 0.000 0.628 0.004 0.148
#> GSM152088     2  0.4538     0.6467 0.000 0.636 0.012 0.348 0.004
#> GSM152100     4  0.5849     0.6921 0.000 0.100 0.392 0.508 0.000
#> GSM152102     2  0.7061     0.4338 0.000 0.500 0.032 0.236 0.232
#> GSM152104     2  0.0000     0.8376 0.000 1.000 0.000 0.000 0.000
#> GSM152028     1  0.0000     0.7455 1.000 0.000 0.000 0.000 0.000
#> GSM152029     5  0.3760     0.6532 0.188 0.000 0.028 0.000 0.784
#> GSM152049     1  0.4182     0.4926 0.600 0.000 0.000 0.000 0.400
#> GSM152053     3  0.4803    -0.6610 0.004 0.012 0.496 0.488 0.000
#> GSM152059     5  0.4565     0.5524 0.408 0.000 0.000 0.012 0.580
#> GSM152085     5  0.2377     0.7136 0.128 0.000 0.000 0.000 0.872
#> GSM152101     3  0.5888    -0.3976 0.000 0.136 0.576 0.288 0.000
#> GSM152105     1  0.0955     0.7345 0.968 0.000 0.028 0.000 0.004
#> GSM152034     5  0.2329     0.7120 0.124 0.000 0.000 0.000 0.876
#> GSM152036     4  0.6140     0.6566 0.000 0.356 0.140 0.504 0.000
#> GSM152040     5  0.2424     0.7133 0.132 0.000 0.000 0.000 0.868
#> GSM152043     1  0.0609     0.7529 0.980 0.000 0.000 0.000 0.020
#> GSM152046     5  0.2127     0.7112 0.108 0.000 0.000 0.000 0.892
#> GSM152047     5  0.2127     0.7132 0.108 0.000 0.000 0.000 0.892
#> GSM152048     1  0.3366     0.6784 0.768 0.000 0.000 0.000 0.232
#> GSM152050     1  0.4242     0.4798 0.572 0.000 0.000 0.000 0.428
#> GSM152052     1  0.3274     0.5718 0.780 0.000 0.000 0.000 0.220
#> GSM152056     1  0.4150     0.5373 0.612 0.000 0.000 0.000 0.388
#> GSM152060     5  0.2127     0.7112 0.108 0.000 0.000 0.000 0.892
#> GSM152065     1  0.0162     0.7478 0.996 0.000 0.000 0.000 0.004
#> GSM152066     1  0.2280     0.7409 0.880 0.000 0.000 0.000 0.120
#> GSM152069     3  0.6743     0.3278 0.020 0.000 0.464 0.148 0.368
#> GSM152070     5  0.4505     0.5791 0.384 0.000 0.000 0.012 0.604
#> GSM152071     3  0.6765     0.3080 0.020 0.000 0.444 0.148 0.388
#> GSM152072     5  0.4109     0.5791 0.288 0.000 0.012 0.000 0.700
#> GSM152073     5  0.3949     0.6316 0.332 0.000 0.000 0.000 0.668
#> GSM152078     5  0.4360     0.5651 0.300 0.000 0.020 0.000 0.680
#> GSM152082     1  0.2561     0.5990 0.856 0.000 0.000 0.000 0.144
#> GSM152086     1  0.3366     0.6544 0.768 0.000 0.000 0.000 0.232
#> GSM152090     3  0.5250     0.5182 0.108 0.000 0.668 0.000 0.224
#> GSM152092     1  0.0609     0.7529 0.980 0.000 0.000 0.000 0.020
#> GSM152093     5  0.6602    -0.0248 0.216 0.000 0.360 0.000 0.424
#> GSM152094     5  0.3242     0.6970 0.216 0.000 0.000 0.000 0.784
#> GSM152098     5  0.4632     0.4809 0.448 0.000 0.000 0.012 0.540
#> GSM152110     1  0.4210     0.5070 0.588 0.000 0.000 0.000 0.412
#> GSM152031     1  0.0290     0.7497 0.992 0.000 0.000 0.000 0.008
#> GSM152037     1  0.0510     0.7531 0.984 0.000 0.000 0.000 0.016
#> GSM152055     1  0.4242     0.4895 0.572 0.000 0.000 0.000 0.428
#> GSM152061     5  0.2127     0.7112 0.108 0.000 0.000 0.000 0.892
#> GSM152064     5  0.3534     0.5364 0.256 0.000 0.000 0.000 0.744
#> GSM152087     5  0.3424     0.6867 0.240 0.000 0.000 0.000 0.760
#> GSM152103     3  0.5672     0.4320 0.088 0.000 0.544 0.000 0.368

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.5273     0.4020 0.000 0.032 0.568 0.352 0.048 0.000
#> GSM152033     5  0.7157     0.3136 0.140 0.000 0.212 0.196 0.452 0.000
#> GSM152063     2  0.2030     0.8004 0.000 0.908 0.064 0.028 0.000 0.000
#> GSM152074     3  0.5329     0.4051 0.000 0.040 0.568 0.348 0.044 0.000
#> GSM152080     2  0.5937     0.4533 0.000 0.480 0.308 0.000 0.208 0.004
#> GSM152081     4  0.1461     0.5600 0.000 0.044 0.016 0.940 0.000 0.000
#> GSM152083     2  0.3977     0.6485 0.000 0.760 0.096 0.144 0.000 0.000
#> GSM152091     2  0.5937     0.4533 0.000 0.480 0.308 0.000 0.208 0.004
#> GSM152108     4  0.5817     0.0977 0.008 0.084 0.252 0.608 0.048 0.000
#> GSM152114     4  0.5838     0.0109 0.008 0.000 0.120 0.500 0.364 0.008
#> GSM152035     2  0.4200     0.6518 0.000 0.760 0.136 0.092 0.012 0.000
#> GSM152039     4  0.3938     0.4828 0.000 0.228 0.000 0.728 0.044 0.000
#> GSM152041     4  0.7779     0.1561 0.004 0.128 0.044 0.432 0.272 0.120
#> GSM152044     2  0.0713     0.8333 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM152045     6  0.6377    -0.1744 0.152 0.000 0.040 0.000 0.360 0.448
#> GSM152051     2  0.0725     0.8372 0.000 0.976 0.012 0.012 0.000 0.000
#> GSM152054     5  0.7674     0.4018 0.064 0.012 0.236 0.032 0.436 0.220
#> GSM152057     2  0.0891     0.8358 0.000 0.968 0.024 0.008 0.000 0.000
#> GSM152058     1  0.2936     0.6328 0.836 0.000 0.004 0.004 0.012 0.144
#> GSM152067     3  0.1956     0.4376 0.000 0.000 0.908 0.008 0.004 0.080
#> GSM152068     2  0.0520     0.8362 0.000 0.984 0.008 0.000 0.008 0.000
#> GSM152075     4  0.0779     0.5579 0.000 0.008 0.008 0.976 0.008 0.000
#> GSM152076     4  0.4132     0.4881 0.000 0.212 0.016 0.736 0.036 0.000
#> GSM152079     2  0.0891     0.8358 0.000 0.968 0.024 0.008 0.000 0.000
#> GSM152084     4  0.6124    -0.1245 0.008 0.000 0.156 0.416 0.412 0.008
#> GSM152089     5  0.7324     0.3380 0.012 0.004 0.064 0.232 0.408 0.280
#> GSM152095     4  0.3860     0.4848 0.000 0.236 0.000 0.728 0.036 0.000
#> GSM152096     3  0.5586     0.3487 0.012 0.012 0.544 0.356 0.076 0.000
#> GSM152097     2  0.1141     0.8282 0.000 0.948 0.000 0.000 0.052 0.000
#> GSM152099     2  0.0806     0.8366 0.000 0.972 0.020 0.008 0.000 0.000
#> GSM152106     2  0.1141     0.8282 0.000 0.948 0.000 0.000 0.052 0.000
#> GSM152107     4  0.5485    -0.1976 0.000 0.032 0.436 0.484 0.044 0.004
#> GSM152109     3  0.1956     0.4375 0.000 0.000 0.908 0.008 0.004 0.080
#> GSM152111     6  0.3807     0.3489 0.368 0.000 0.000 0.000 0.004 0.628
#> GSM152112     4  0.1718     0.5545 0.000 0.024 0.020 0.936 0.020 0.000
#> GSM152113     5  0.7093     0.2547 0.108 0.000 0.176 0.296 0.420 0.000
#> GSM152115     3  0.5310     0.2739 0.016 0.000 0.500 0.432 0.044 0.008
#> GSM152030     4  0.1026     0.5568 0.000 0.008 0.012 0.968 0.008 0.004
#> GSM152038     5  0.7340     0.3239 0.168 0.000 0.204 0.180 0.444 0.004
#> GSM152042     4  0.0779     0.5568 0.000 0.008 0.008 0.976 0.000 0.008
#> GSM152062     4  0.6394    -0.1320 0.008 0.000 0.220 0.384 0.380 0.008
#> GSM152077     4  0.7789    -0.0219 0.080 0.000 0.080 0.456 0.200 0.184
#> GSM152088     2  0.5330     0.5975 0.000 0.612 0.176 0.000 0.208 0.004
#> GSM152100     4  0.1951     0.5552 0.000 0.076 0.016 0.908 0.000 0.000
#> GSM152102     3  0.6534    -0.2049 0.000 0.360 0.468 0.008 0.092 0.072
#> GSM152104     2  0.1141     0.8282 0.000 0.948 0.000 0.000 0.052 0.000
#> GSM152028     1  0.1649     0.6263 0.932 0.000 0.000 0.000 0.032 0.036
#> GSM152029     5  0.6814     0.2280 0.208 0.000 0.056 0.000 0.400 0.336
#> GSM152049     1  0.3984     0.3924 0.596 0.000 0.000 0.000 0.008 0.396
#> GSM152053     4  0.1780     0.5434 0.000 0.008 0.044 0.932 0.008 0.008
#> GSM152059     6  0.5371     0.4934 0.316 0.000 0.032 0.000 0.064 0.588
#> GSM152085     6  0.3163     0.5986 0.232 0.000 0.000 0.000 0.004 0.764
#> GSM152101     3  0.5938     0.2188 0.000 0.092 0.496 0.372 0.040 0.000
#> GSM152105     1  0.2032     0.6438 0.920 0.000 0.020 0.000 0.036 0.024
#> GSM152034     6  0.3547     0.4789 0.300 0.000 0.000 0.000 0.004 0.696
#> GSM152036     4  0.4124     0.4875 0.000 0.224 0.012 0.728 0.036 0.000
#> GSM152040     6  0.2823     0.6147 0.204 0.000 0.000 0.000 0.000 0.796
#> GSM152043     1  0.1141     0.6573 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM152046     6  0.3819     0.6021 0.172 0.000 0.000 0.000 0.064 0.764
#> GSM152047     6  0.4866     0.4009 0.116 0.000 0.000 0.000 0.236 0.648
#> GSM152048     1  0.3314     0.5730 0.740 0.000 0.000 0.000 0.004 0.256
#> GSM152050     1  0.3915     0.3448 0.584 0.000 0.000 0.000 0.004 0.412
#> GSM152052     1  0.5336     0.2780 0.584 0.000 0.000 0.000 0.160 0.256
#> GSM152056     1  0.3819     0.4276 0.624 0.000 0.000 0.000 0.004 0.372
#> GSM152060     6  0.3819     0.5984 0.172 0.000 0.000 0.000 0.064 0.764
#> GSM152065     1  0.1921     0.6250 0.916 0.000 0.000 0.000 0.032 0.052
#> GSM152066     1  0.2668     0.6310 0.828 0.000 0.000 0.000 0.004 0.168
#> GSM152069     3  0.4176     0.3464 0.000 0.000 0.752 0.008 0.160 0.080
#> GSM152070     6  0.5385     0.4946 0.320 0.000 0.032 0.000 0.064 0.584
#> GSM152071     3  0.4768     0.2109 0.000 0.000 0.668 0.008 0.244 0.080
#> GSM152072     5  0.6791     0.2191 0.212 0.000 0.052 0.000 0.392 0.344
#> GSM152073     6  0.4166     0.5321 0.324 0.000 0.028 0.000 0.000 0.648
#> GSM152078     5  0.6791     0.3049 0.204 0.000 0.048 0.004 0.436 0.308
#> GSM152082     1  0.3602     0.4025 0.760 0.000 0.000 0.000 0.032 0.208
#> GSM152086     1  0.3245     0.5900 0.764 0.000 0.000 0.000 0.008 0.228
#> GSM152090     5  0.7431     0.3145 0.124 0.000 0.172 0.268 0.424 0.012
#> GSM152092     1  0.1950     0.6403 0.912 0.000 0.000 0.000 0.024 0.064
#> GSM152093     4  0.8176    -0.2803 0.184 0.000 0.032 0.296 0.280 0.208
#> GSM152094     6  0.2902     0.6252 0.196 0.000 0.000 0.000 0.004 0.800
#> GSM152098     6  0.5255     0.4058 0.396 0.000 0.032 0.000 0.040 0.532
#> GSM152110     1  0.3937     0.3592 0.572 0.000 0.000 0.000 0.004 0.424
#> GSM152031     1  0.2106     0.6361 0.904 0.000 0.000 0.000 0.032 0.064
#> GSM152037     1  0.1464     0.6579 0.944 0.000 0.000 0.004 0.016 0.036
#> GSM152055     1  0.4584     0.2978 0.556 0.000 0.000 0.000 0.040 0.404
#> GSM152061     6  0.3786     0.6008 0.168 0.000 0.000 0.000 0.064 0.768
#> GSM152064     6  0.4098     0.4003 0.292 0.000 0.000 0.000 0.032 0.676
#> GSM152087     6  0.3601     0.5659 0.312 0.000 0.000 0.000 0.004 0.684
#> GSM152103     5  0.7703     0.4218 0.132 0.000 0.180 0.100 0.492 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-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 specimen(p) k
#> SD:mclust 87    4.07e-10 2
#> SD:mclust 87    1.26e-07 3
#> SD:mclust 57    5.77e-07 4
#> SD:mclust 59    1.81e-04 5
#> SD:mclust 39    6.52e-04 6

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


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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.999           0.967       0.986         0.4957 0.504   0.504
#> 3 3 0.597           0.623       0.794         0.3127 0.760   0.565
#> 4 4 0.561           0.630       0.798         0.1034 0.838   0.606
#> 5 5 0.713           0.740       0.862         0.1019 0.852   0.542
#> 6 6 0.726           0.707       0.845         0.0439 0.911   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
#> GSM152032     2  0.3431      0.924 0.064 0.936
#> GSM152033     1  0.0000      0.989 1.000 0.000
#> GSM152063     2  0.0000      0.980 0.000 1.000
#> GSM152074     2  0.0000      0.980 0.000 1.000
#> GSM152080     2  0.0000      0.980 0.000 1.000
#> GSM152081     2  0.0000      0.980 0.000 1.000
#> GSM152083     2  0.0000      0.980 0.000 1.000
#> GSM152091     2  0.0000      0.980 0.000 1.000
#> GSM152108     2  0.0000      0.980 0.000 1.000
#> GSM152114     1  0.0000      0.989 1.000 0.000
#> GSM152035     2  0.0000      0.980 0.000 1.000
#> GSM152039     2  0.0000      0.980 0.000 1.000
#> GSM152041     2  0.9393      0.450 0.356 0.644
#> GSM152044     2  0.0000      0.980 0.000 1.000
#> GSM152045     1  0.0000      0.989 1.000 0.000
#> GSM152051     2  0.0000      0.980 0.000 1.000
#> GSM152054     1  0.8861      0.558 0.696 0.304
#> GSM152057     2  0.0000      0.980 0.000 1.000
#> GSM152058     1  0.0000      0.989 1.000 0.000
#> GSM152067     2  0.0000      0.980 0.000 1.000
#> GSM152068     2  0.0000      0.980 0.000 1.000
#> GSM152075     2  0.0000      0.980 0.000 1.000
#> GSM152076     2  0.0000      0.980 0.000 1.000
#> GSM152079     2  0.0000      0.980 0.000 1.000
#> GSM152084     1  0.4298      0.901 0.912 0.088
#> GSM152089     2  0.4690      0.886 0.100 0.900
#> GSM152095     2  0.0000      0.980 0.000 1.000
#> GSM152096     2  0.0000      0.980 0.000 1.000
#> GSM152097     2  0.0000      0.980 0.000 1.000
#> GSM152099     2  0.0000      0.980 0.000 1.000
#> GSM152106     2  0.0000      0.980 0.000 1.000
#> GSM152107     2  0.0000      0.980 0.000 1.000
#> GSM152109     2  0.2043      0.954 0.032 0.968
#> GSM152111     1  0.0000      0.989 1.000 0.000
#> GSM152112     2  0.0000      0.980 0.000 1.000
#> GSM152113     1  0.0376      0.985 0.996 0.004
#> GSM152115     2  0.6887      0.777 0.184 0.816
#> GSM152030     2  0.0000      0.980 0.000 1.000
#> GSM152038     1  0.0000      0.989 1.000 0.000
#> GSM152042     2  0.0000      0.980 0.000 1.000
#> GSM152062     1  0.3733      0.919 0.928 0.072
#> GSM152077     1  0.0000      0.989 1.000 0.000
#> GSM152088     2  0.0000      0.980 0.000 1.000
#> GSM152100     2  0.0000      0.980 0.000 1.000
#> GSM152102     2  0.0000      0.980 0.000 1.000
#> GSM152104     2  0.0000      0.980 0.000 1.000
#> GSM152028     1  0.0000      0.989 1.000 0.000
#> GSM152029     1  0.0000      0.989 1.000 0.000
#> GSM152049     1  0.0000      0.989 1.000 0.000
#> GSM152053     2  0.0000      0.980 0.000 1.000
#> GSM152059     1  0.0000      0.989 1.000 0.000
#> GSM152085     1  0.0000      0.989 1.000 0.000
#> GSM152101     2  0.0000      0.980 0.000 1.000
#> GSM152105     1  0.0000      0.989 1.000 0.000
#> GSM152034     1  0.0000      0.989 1.000 0.000
#> GSM152036     2  0.0000      0.980 0.000 1.000
#> GSM152040     1  0.0000      0.989 1.000 0.000
#> GSM152043     1  0.0000      0.989 1.000 0.000
#> GSM152046     1  0.0000      0.989 1.000 0.000
#> GSM152047     1  0.0000      0.989 1.000 0.000
#> GSM152048     1  0.0000      0.989 1.000 0.000
#> GSM152050     1  0.0000      0.989 1.000 0.000
#> GSM152052     1  0.0000      0.989 1.000 0.000
#> GSM152056     1  0.0000      0.989 1.000 0.000
#> GSM152060     1  0.0000      0.989 1.000 0.000
#> GSM152065     1  0.0000      0.989 1.000 0.000
#> GSM152066     1  0.0000      0.989 1.000 0.000
#> GSM152069     1  0.0376      0.985 0.996 0.004
#> GSM152070     1  0.0000      0.989 1.000 0.000
#> GSM152071     1  0.0000      0.989 1.000 0.000
#> GSM152072     1  0.0000      0.989 1.000 0.000
#> GSM152073     1  0.0000      0.989 1.000 0.000
#> GSM152078     1  0.0000      0.989 1.000 0.000
#> GSM152082     1  0.0000      0.989 1.000 0.000
#> GSM152086     1  0.0000      0.989 1.000 0.000
#> GSM152090     1  0.3431      0.927 0.936 0.064
#> GSM152092     1  0.0000      0.989 1.000 0.000
#> GSM152093     1  0.0000      0.989 1.000 0.000
#> GSM152094     1  0.0000      0.989 1.000 0.000
#> GSM152098     1  0.0000      0.989 1.000 0.000
#> GSM152110     1  0.0000      0.989 1.000 0.000
#> GSM152031     1  0.0000      0.989 1.000 0.000
#> GSM152037     1  0.0000      0.989 1.000 0.000
#> GSM152055     1  0.0000      0.989 1.000 0.000
#> GSM152061     1  0.0000      0.989 1.000 0.000
#> GSM152064     1  0.0000      0.989 1.000 0.000
#> GSM152087     1  0.0000      0.989 1.000 0.000
#> GSM152103     1  0.0000      0.989 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0000     0.7160 0.000 0.000 1.000
#> GSM152033     3  0.6215     0.2646 0.428 0.000 0.572
#> GSM152063     2  0.6252     0.3217 0.000 0.556 0.444
#> GSM152074     3  0.0000     0.7160 0.000 0.000 1.000
#> GSM152080     3  0.0237     0.7154 0.000 0.004 0.996
#> GSM152081     2  0.0000     0.7608 0.000 1.000 0.000
#> GSM152083     3  0.0237     0.7154 0.000 0.004 0.996
#> GSM152091     3  0.6045     0.1790 0.000 0.380 0.620
#> GSM152108     3  0.0592     0.7137 0.000 0.012 0.988
#> GSM152114     1  0.3623     0.8146 0.896 0.072 0.032
#> GSM152035     3  0.5785     0.3052 0.000 0.332 0.668
#> GSM152039     2  0.0237     0.7592 0.004 0.996 0.000
#> GSM152041     2  0.1643     0.7277 0.044 0.956 0.000
#> GSM152044     2  0.6180     0.3775 0.000 0.584 0.416
#> GSM152045     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152051     3  0.6008     0.2044 0.000 0.372 0.628
#> GSM152054     2  0.8387    -0.0441 0.428 0.488 0.084
#> GSM152057     3  0.4504     0.5627 0.000 0.196 0.804
#> GSM152058     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152067     3  0.0000     0.7160 0.000 0.000 1.000
#> GSM152068     2  0.6307     0.2085 0.000 0.512 0.488
#> GSM152075     2  0.0000     0.7608 0.000 1.000 0.000
#> GSM152076     2  0.0000     0.7608 0.000 1.000 0.000
#> GSM152079     3  0.4605     0.5525 0.000 0.204 0.796
#> GSM152084     3  0.5098     0.5718 0.248 0.000 0.752
#> GSM152089     2  0.0892     0.7485 0.020 0.980 0.000
#> GSM152095     2  0.0000     0.7608 0.000 1.000 0.000
#> GSM152096     3  0.0000     0.7160 0.000 0.000 1.000
#> GSM152097     2  0.5529     0.5591 0.000 0.704 0.296
#> GSM152099     3  0.4062     0.5998 0.000 0.164 0.836
#> GSM152106     2  0.0592     0.7577 0.000 0.988 0.012
#> GSM152107     3  0.1411     0.7034 0.000 0.036 0.964
#> GSM152109     3  0.0000     0.7160 0.000 0.000 1.000
#> GSM152111     1  0.5327     0.6408 0.728 0.272 0.000
#> GSM152112     3  0.6286    -0.1215 0.000 0.464 0.536
#> GSM152113     3  0.6225     0.2536 0.432 0.000 0.568
#> GSM152115     3  0.0237     0.7150 0.004 0.000 0.996
#> GSM152030     2  0.5621     0.5456 0.000 0.692 0.308
#> GSM152038     3  0.6244     0.2319 0.440 0.000 0.560
#> GSM152042     2  0.6286     0.2740 0.000 0.536 0.464
#> GSM152062     3  0.5678     0.4913 0.316 0.000 0.684
#> GSM152077     1  0.0747     0.8445 0.984 0.000 0.016
#> GSM152088     3  0.3192     0.6495 0.000 0.112 0.888
#> GSM152100     2  0.0000     0.7608 0.000 1.000 0.000
#> GSM152102     3  0.1031     0.7091 0.000 0.024 0.976
#> GSM152104     2  0.4399     0.6606 0.000 0.812 0.188
#> GSM152028     1  0.0592     0.8462 0.988 0.000 0.012
#> GSM152029     1  0.4452     0.6728 0.808 0.000 0.192
#> GSM152049     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152053     3  0.5591     0.3802 0.000 0.304 0.696
#> GSM152059     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152085     1  0.3267     0.7879 0.884 0.116 0.000
#> GSM152101     3  0.1031     0.7091 0.000 0.024 0.976
#> GSM152105     1  0.1860     0.8226 0.948 0.000 0.052
#> GSM152034     1  0.5926     0.5300 0.644 0.356 0.000
#> GSM152036     2  0.0237     0.7592 0.004 0.996 0.000
#> GSM152040     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152043     1  0.0237     0.8487 0.996 0.000 0.004
#> GSM152046     1  0.6215     0.4116 0.572 0.428 0.000
#> GSM152047     1  0.5497     0.6168 0.708 0.292 0.000
#> GSM152048     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152050     1  0.3879     0.7601 0.848 0.152 0.000
#> GSM152052     1  0.3116     0.7753 0.892 0.000 0.108
#> GSM152056     1  0.0892     0.8442 0.980 0.020 0.000
#> GSM152060     1  0.6180     0.4344 0.584 0.416 0.000
#> GSM152065     1  0.2711     0.7944 0.912 0.000 0.088
#> GSM152066     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152069     3  0.2796     0.6725 0.092 0.000 0.908
#> GSM152070     1  0.0237     0.8487 0.996 0.000 0.004
#> GSM152071     3  0.5621     0.5019 0.308 0.000 0.692
#> GSM152072     1  0.6079     0.2841 0.612 0.000 0.388
#> GSM152073     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152078     1  0.6225     0.1515 0.568 0.000 0.432
#> GSM152082     1  0.0747     0.8446 0.984 0.000 0.016
#> GSM152086     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152090     3  0.6111     0.3346 0.396 0.000 0.604
#> GSM152092     1  0.0592     0.8462 0.988 0.000 0.012
#> GSM152093     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152094     1  0.0424     0.8476 0.992 0.008 0.000
#> GSM152098     1  0.0237     0.8487 0.996 0.000 0.004
#> GSM152110     1  0.1643     0.8335 0.956 0.044 0.000
#> GSM152031     1  0.1031     0.8404 0.976 0.000 0.024
#> GSM152037     1  0.0237     0.8487 0.996 0.000 0.004
#> GSM152055     1  0.6180     0.4344 0.584 0.416 0.000
#> GSM152061     1  0.6235     0.3952 0.564 0.436 0.000
#> GSM152064     1  0.6180     0.4344 0.584 0.416 0.000
#> GSM152087     1  0.0000     0.8494 1.000 0.000 0.000
#> GSM152103     1  0.6308    -0.0576 0.508 0.000 0.492

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.2704     0.6645 0.000 0.124 0.876 0.000
#> GSM152033     3  0.7313    -0.2549 0.380 0.156 0.464 0.000
#> GSM152063     2  0.2928     0.7804 0.000 0.880 0.012 0.108
#> GSM152074     3  0.2345     0.6483 0.000 0.100 0.900 0.000
#> GSM152080     2  0.1722     0.7621 0.000 0.944 0.048 0.008
#> GSM152081     4  0.2589     0.7281 0.000 0.000 0.116 0.884
#> GSM152083     3  0.4994     0.2898 0.000 0.480 0.520 0.000
#> GSM152091     2  0.2021     0.7896 0.000 0.932 0.012 0.056
#> GSM152108     2  0.4655     0.4509 0.004 0.684 0.312 0.000
#> GSM152114     3  0.8356    -0.1118 0.312 0.080 0.496 0.112
#> GSM152035     2  0.3899     0.7295 0.000 0.840 0.108 0.052
#> GSM152039     4  0.0000     0.8148 0.000 0.000 0.000 1.000
#> GSM152041     4  0.0188     0.8129 0.004 0.000 0.000 0.996
#> GSM152044     2  0.5548     0.4490 0.000 0.588 0.024 0.388
#> GSM152045     1  0.2465     0.7649 0.924 0.012 0.044 0.020
#> GSM152051     2  0.3013     0.7870 0.000 0.888 0.032 0.080
#> GSM152054     2  0.8958     0.0901 0.316 0.404 0.068 0.212
#> GSM152057     2  0.3367     0.7794 0.000 0.864 0.028 0.108
#> GSM152058     1  0.5478     0.7265 0.696 0.056 0.248 0.000
#> GSM152067     3  0.4483     0.6275 0.004 0.284 0.712 0.000
#> GSM152068     2  0.3149     0.7858 0.000 0.880 0.032 0.088
#> GSM152075     4  0.0000     0.8148 0.000 0.000 0.000 1.000
#> GSM152076     4  0.0000     0.8148 0.000 0.000 0.000 1.000
#> GSM152079     2  0.2773     0.7888 0.000 0.900 0.028 0.072
#> GSM152084     3  0.2363     0.6388 0.024 0.056 0.920 0.000
#> GSM152089     4  0.3774     0.6868 0.168 0.008 0.004 0.820
#> GSM152095     4  0.0000     0.8148 0.000 0.000 0.000 1.000
#> GSM152096     2  0.2149     0.7209 0.000 0.912 0.088 0.000
#> GSM152097     4  0.2647     0.7189 0.000 0.120 0.000 0.880
#> GSM152099     2  0.5464     0.5480 0.000 0.716 0.212 0.072
#> GSM152106     4  0.1792     0.7678 0.000 0.068 0.000 0.932
#> GSM152107     3  0.4252     0.6474 0.000 0.252 0.744 0.004
#> GSM152109     3  0.4164     0.6432 0.000 0.264 0.736 0.000
#> GSM152111     1  0.3539     0.7107 0.820 0.000 0.004 0.176
#> GSM152112     3  0.6171     0.6020 0.004 0.232 0.668 0.096
#> GSM152113     1  0.7221     0.3423 0.436 0.140 0.424 0.000
#> GSM152115     3  0.4262     0.6549 0.008 0.236 0.756 0.000
#> GSM152030     3  0.5550     0.1862 0.000 0.020 0.552 0.428
#> GSM152038     3  0.4633     0.4449 0.172 0.048 0.780 0.000
#> GSM152042     3  0.5747     0.6232 0.000 0.196 0.704 0.100
#> GSM152062     3  0.1059     0.6089 0.012 0.016 0.972 0.000
#> GSM152077     1  0.6483     0.6153 0.584 0.092 0.324 0.000
#> GSM152088     2  0.2830     0.7823 0.000 0.900 0.040 0.060
#> GSM152100     4  0.0000     0.8148 0.000 0.000 0.000 1.000
#> GSM152102     2  0.1985     0.7600 0.004 0.940 0.040 0.016
#> GSM152104     4  0.4008     0.5214 0.000 0.244 0.000 0.756
#> GSM152028     1  0.5757     0.7198 0.684 0.076 0.240 0.000
#> GSM152029     1  0.3621     0.7262 0.860 0.072 0.068 0.000
#> GSM152049     1  0.2081     0.7904 0.916 0.000 0.084 0.000
#> GSM152053     3  0.3856     0.6623 0.000 0.136 0.832 0.032
#> GSM152059     1  0.0188     0.7830 0.996 0.004 0.000 0.000
#> GSM152085     1  0.1109     0.7749 0.968 0.004 0.000 0.028
#> GSM152101     3  0.4252     0.6486 0.004 0.252 0.744 0.000
#> GSM152105     1  0.5344     0.6986 0.668 0.032 0.300 0.000
#> GSM152034     1  0.4401     0.4987 0.724 0.004 0.000 0.272
#> GSM152036     4  0.0000     0.8148 0.000 0.000 0.000 1.000
#> GSM152040     1  0.0844     0.7788 0.980 0.004 0.004 0.012
#> GSM152043     1  0.0336     0.7844 0.992 0.000 0.008 0.000
#> GSM152046     1  0.5119     0.1912 0.556 0.004 0.000 0.440
#> GSM152047     1  0.3289     0.6835 0.852 0.004 0.004 0.140
#> GSM152048     1  0.5343     0.7335 0.708 0.052 0.240 0.000
#> GSM152050     1  0.3545     0.7197 0.828 0.000 0.008 0.164
#> GSM152052     1  0.6167     0.6934 0.648 0.096 0.256 0.000
#> GSM152056     1  0.4867     0.7468 0.736 0.032 0.232 0.000
#> GSM152060     1  0.5147     0.1404 0.536 0.004 0.000 0.460
#> GSM152065     1  0.5727     0.7266 0.692 0.080 0.228 0.000
#> GSM152066     1  0.4468     0.7531 0.752 0.016 0.232 0.000
#> GSM152069     3  0.6219     0.5331 0.068 0.344 0.588 0.000
#> GSM152070     1  0.0376     0.7822 0.992 0.004 0.004 0.000
#> GSM152071     3  0.6439     0.5750 0.180 0.172 0.648 0.000
#> GSM152072     1  0.3266     0.7236 0.868 0.024 0.108 0.000
#> GSM152073     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> GSM152078     1  0.4171     0.7761 0.828 0.084 0.088 0.000
#> GSM152082     1  0.0524     0.7852 0.988 0.004 0.008 0.000
#> GSM152086     1  0.1389     0.7902 0.952 0.000 0.048 0.000
#> GSM152090     1  0.7325     0.1649 0.528 0.208 0.264 0.000
#> GSM152092     1  0.3324     0.7846 0.852 0.012 0.136 0.000
#> GSM152093     1  0.4212     0.7640 0.772 0.000 0.216 0.012
#> GSM152094     1  0.0188     0.7830 0.996 0.004 0.000 0.000
#> GSM152098     1  0.0376     0.7822 0.992 0.004 0.004 0.000
#> GSM152110     1  0.5340     0.7539 0.736 0.016 0.212 0.036
#> GSM152031     1  0.3831     0.7669 0.792 0.004 0.204 0.000
#> GSM152037     1  0.4567     0.7479 0.740 0.016 0.244 0.000
#> GSM152055     4  0.5325    -0.0785 0.468 0.004 0.004 0.524
#> GSM152061     4  0.5151    -0.0190 0.464 0.004 0.000 0.532
#> GSM152064     1  0.4948     0.2781 0.560 0.000 0.000 0.440
#> GSM152087     1  0.0188     0.7830 0.996 0.004 0.000 0.000
#> GSM152103     1  0.4467     0.6964 0.788 0.040 0.172 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
#> GSM152032     3  0.1124     0.8420 0.036 0.004 0.960 0.000 0.000
#> GSM152033     1  0.0865     0.8753 0.972 0.000 0.024 0.000 0.004
#> GSM152063     2  0.0510     0.8501 0.000 0.984 0.000 0.016 0.000
#> GSM152074     3  0.2011     0.8267 0.088 0.004 0.908 0.000 0.000
#> GSM152080     2  0.0162     0.8507 0.004 0.996 0.000 0.000 0.000
#> GSM152081     4  0.4213     0.4411 0.000 0.000 0.308 0.680 0.012
#> GSM152083     2  0.4538     0.3960 0.016 0.620 0.364 0.000 0.000
#> GSM152091     2  0.0324     0.8515 0.000 0.992 0.004 0.004 0.000
#> GSM152108     1  0.1756     0.8553 0.940 0.036 0.008 0.016 0.000
#> GSM152114     1  0.0854     0.8834 0.976 0.000 0.008 0.012 0.004
#> GSM152035     2  0.1518     0.8423 0.016 0.952 0.020 0.012 0.000
#> GSM152039     4  0.0404     0.7801 0.000 0.000 0.000 0.988 0.012
#> GSM152041     4  0.0510     0.7803 0.000 0.000 0.000 0.984 0.016
#> GSM152044     2  0.2020     0.7939 0.000 0.900 0.000 0.100 0.000
#> GSM152045     5  0.1662     0.8152 0.004 0.004 0.056 0.000 0.936
#> GSM152051     2  0.0290     0.8515 0.000 0.992 0.000 0.008 0.000
#> GSM152054     2  0.8741     0.0431 0.324 0.324 0.044 0.080 0.228
#> GSM152057     2  0.1743     0.8364 0.028 0.940 0.004 0.028 0.000
#> GSM152058     1  0.0794     0.8962 0.972 0.000 0.000 0.000 0.028
#> GSM152067     3  0.2450     0.8293 0.000 0.028 0.896 0.000 0.076
#> GSM152068     2  0.0404     0.8511 0.000 0.988 0.000 0.012 0.000
#> GSM152075     4  0.0451     0.7778 0.008 0.000 0.004 0.988 0.000
#> GSM152076     4  0.0324     0.7788 0.000 0.000 0.004 0.992 0.004
#> GSM152079     2  0.0290     0.8515 0.000 0.992 0.000 0.008 0.000
#> GSM152084     3  0.2233     0.8147 0.104 0.000 0.892 0.000 0.004
#> GSM152089     4  0.5205     0.4901 0.000 0.012 0.036 0.616 0.336
#> GSM152095     4  0.0613     0.7784 0.000 0.004 0.008 0.984 0.004
#> GSM152096     2  0.4066     0.5285 0.324 0.672 0.004 0.000 0.000
#> GSM152097     4  0.2966     0.6426 0.000 0.184 0.000 0.816 0.000
#> GSM152099     2  0.3861     0.5958 0.000 0.728 0.264 0.008 0.000
#> GSM152106     4  0.1410     0.7503 0.000 0.060 0.000 0.940 0.000
#> GSM152107     3  0.0771     0.8428 0.000 0.020 0.976 0.000 0.004
#> GSM152109     3  0.1195     0.8411 0.000 0.028 0.960 0.000 0.012
#> GSM152111     5  0.4221     0.7859 0.112 0.000 0.000 0.108 0.780
#> GSM152112     3  0.2200     0.8293 0.008 0.004 0.924 0.032 0.032
#> GSM152113     1  0.0693     0.8814 0.980 0.000 0.012 0.000 0.008
#> GSM152115     3  0.1278     0.8431 0.016 0.004 0.960 0.000 0.020
#> GSM152030     3  0.4728     0.5208 0.040 0.000 0.664 0.296 0.000
#> GSM152038     1  0.3074     0.7051 0.804 0.000 0.196 0.000 0.000
#> GSM152042     3  0.1568     0.8364 0.000 0.020 0.944 0.036 0.000
#> GSM152062     3  0.4276     0.3916 0.380 0.000 0.616 0.000 0.004
#> GSM152077     1  0.0290     0.8858 0.992 0.000 0.008 0.000 0.000
#> GSM152088     2  0.0162     0.8513 0.000 0.996 0.000 0.004 0.000
#> GSM152100     4  0.0740     0.7772 0.008 0.004 0.008 0.980 0.000
#> GSM152102     2  0.1646     0.8287 0.004 0.944 0.032 0.000 0.020
#> GSM152104     4  0.4304    -0.0202 0.000 0.484 0.000 0.516 0.000
#> GSM152028     1  0.1197     0.8994 0.952 0.000 0.000 0.000 0.048
#> GSM152029     5  0.1690     0.8472 0.024 0.024 0.008 0.000 0.944
#> GSM152049     5  0.3885     0.6878 0.268 0.000 0.000 0.008 0.724
#> GSM152053     3  0.1728     0.8415 0.036 0.004 0.940 0.020 0.000
#> GSM152059     5  0.1270     0.8530 0.052 0.000 0.000 0.000 0.948
#> GSM152085     5  0.2171     0.8496 0.064 0.000 0.000 0.024 0.912
#> GSM152101     3  0.1285     0.8373 0.004 0.004 0.956 0.000 0.036
#> GSM152105     1  0.0671     0.8939 0.980 0.000 0.004 0.000 0.016
#> GSM152034     5  0.1768     0.8269 0.004 0.000 0.000 0.072 0.924
#> GSM152036     4  0.0510     0.7798 0.000 0.000 0.000 0.984 0.016
#> GSM152040     5  0.1900     0.8355 0.024 0.004 0.032 0.004 0.936
#> GSM152043     5  0.1544     0.8525 0.068 0.000 0.000 0.000 0.932
#> GSM152046     5  0.3280     0.7328 0.012 0.000 0.000 0.176 0.812
#> GSM152047     5  0.0960     0.8388 0.004 0.000 0.016 0.008 0.972
#> GSM152048     1  0.1197     0.8994 0.952 0.000 0.000 0.000 0.048
#> GSM152050     5  0.4364     0.7632 0.088 0.000 0.000 0.148 0.764
#> GSM152052     1  0.1341     0.8984 0.944 0.000 0.000 0.000 0.056
#> GSM152056     1  0.2233     0.8754 0.892 0.000 0.000 0.004 0.104
#> GSM152060     5  0.4384     0.4730 0.016 0.000 0.000 0.324 0.660
#> GSM152065     1  0.3193     0.8442 0.852 0.004 0.032 0.000 0.112
#> GSM152066     1  0.2516     0.8482 0.860 0.000 0.000 0.000 0.140
#> GSM152069     3  0.4965     0.5347 0.000 0.052 0.644 0.000 0.304
#> GSM152070     5  0.1547     0.8362 0.016 0.004 0.032 0.000 0.948
#> GSM152071     3  0.4518     0.5177 0.004 0.016 0.660 0.000 0.320
#> GSM152072     5  0.1983     0.8172 0.008 0.008 0.060 0.000 0.924
#> GSM152073     5  0.1544     0.8520 0.068 0.000 0.000 0.000 0.932
#> GSM152078     5  0.4517     0.4635 0.372 0.008 0.004 0.000 0.616
#> GSM152082     5  0.2470     0.8422 0.104 0.000 0.012 0.000 0.884
#> GSM152086     5  0.3455     0.7641 0.208 0.000 0.000 0.008 0.784
#> GSM152090     5  0.6269     0.5183 0.124 0.024 0.260 0.000 0.592
#> GSM152092     1  0.3551     0.7495 0.772 0.000 0.008 0.000 0.220
#> GSM152093     1  0.2873     0.8450 0.856 0.000 0.000 0.016 0.128
#> GSM152094     5  0.1121     0.8525 0.044 0.000 0.000 0.000 0.956
#> GSM152098     5  0.0486     0.8422 0.004 0.004 0.004 0.000 0.988
#> GSM152110     1  0.3016     0.8486 0.848 0.000 0.000 0.020 0.132
#> GSM152031     1  0.3774     0.5961 0.704 0.000 0.000 0.000 0.296
#> GSM152037     1  0.1410     0.8972 0.940 0.000 0.000 0.000 0.060
#> GSM152055     4  0.3910     0.6187 0.032 0.000 0.000 0.772 0.196
#> GSM152061     4  0.4658     0.2669 0.016 0.000 0.000 0.576 0.408
#> GSM152064     4  0.4803    -0.0430 0.012 0.004 0.000 0.496 0.488
#> GSM152087     5  0.1430     0.8529 0.052 0.000 0.000 0.004 0.944
#> GSM152103     5  0.5087     0.6539 0.264 0.008 0.056 0.000 0.672

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.0508     0.8356 0.012 0.000 0.984 0.000 0.004 0.000
#> GSM152033     1  0.1152     0.8293 0.952 0.004 0.000 0.000 0.044 0.000
#> GSM152063     2  0.0146     0.8781 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152074     3  0.2060     0.7863 0.084 0.000 0.900 0.000 0.016 0.000
#> GSM152080     2  0.0000     0.8777 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152081     4  0.4110     0.4915 0.004 0.000 0.296 0.680 0.008 0.012
#> GSM152083     2  0.3296     0.7257 0.008 0.792 0.188 0.000 0.012 0.000
#> GSM152091     2  0.0000     0.8777 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152108     1  0.1682     0.8183 0.928 0.052 0.000 0.000 0.020 0.000
#> GSM152114     1  0.1628     0.8449 0.940 0.000 0.004 0.008 0.036 0.012
#> GSM152035     2  0.1666     0.8614 0.008 0.936 0.000 0.020 0.036 0.000
#> GSM152039     4  0.1267     0.7933 0.000 0.000 0.000 0.940 0.060 0.000
#> GSM152041     4  0.2933     0.7511 0.004 0.000 0.000 0.796 0.200 0.000
#> GSM152044     2  0.1010     0.8696 0.000 0.960 0.000 0.036 0.004 0.000
#> GSM152045     5  0.1340     0.6834 0.000 0.000 0.008 0.004 0.948 0.040
#> GSM152051     2  0.0146     0.8780 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152054     5  0.2239     0.6717 0.072 0.000 0.000 0.020 0.900 0.008
#> GSM152057     2  0.1296     0.8671 0.000 0.948 0.004 0.044 0.004 0.000
#> GSM152058     1  0.0790     0.8494 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM152067     3  0.2915     0.7779 0.000 0.000 0.808 0.000 0.184 0.008
#> GSM152068     2  0.0405     0.8775 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM152075     4  0.2595     0.7704 0.004 0.000 0.000 0.836 0.160 0.000
#> GSM152076     4  0.1267     0.7933 0.000 0.000 0.000 0.940 0.060 0.000
#> GSM152079     2  0.0260     0.8779 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM152084     3  0.4606     0.7045 0.112 0.000 0.712 0.000 0.168 0.008
#> GSM152089     5  0.1477     0.6749 0.000 0.000 0.004 0.048 0.940 0.008
#> GSM152095     4  0.1814     0.7896 0.000 0.000 0.000 0.900 0.100 0.000
#> GSM152096     2  0.2362     0.7778 0.136 0.860 0.000 0.000 0.004 0.000
#> GSM152097     4  0.1908     0.7304 0.000 0.096 0.000 0.900 0.004 0.000
#> GSM152099     2  0.3448     0.6062 0.000 0.716 0.280 0.004 0.000 0.000
#> GSM152106     4  0.0603     0.7744 0.000 0.016 0.000 0.980 0.004 0.000
#> GSM152107     3  0.2703     0.7842 0.000 0.000 0.824 0.004 0.172 0.000
#> GSM152109     3  0.2454     0.8136 0.000 0.004 0.876 0.000 0.104 0.016
#> GSM152111     6  0.2507     0.8087 0.016 0.000 0.000 0.056 0.036 0.892
#> GSM152112     5  0.2511     0.6538 0.000 0.000 0.056 0.064 0.880 0.000
#> GSM152113     1  0.1908     0.8032 0.900 0.004 0.000 0.000 0.096 0.000
#> GSM152115     5  0.3103     0.5720 0.008 0.000 0.208 0.000 0.784 0.000
#> GSM152030     3  0.3779     0.5367 0.008 0.000 0.708 0.276 0.008 0.000
#> GSM152038     1  0.2404     0.8054 0.884 0.000 0.080 0.000 0.036 0.000
#> GSM152042     3  0.0520     0.8359 0.000 0.000 0.984 0.008 0.008 0.000
#> GSM152062     1  0.5400     0.1198 0.504 0.000 0.376 0.000 0.120 0.000
#> GSM152077     1  0.0520     0.8431 0.984 0.000 0.000 0.000 0.008 0.008
#> GSM152088     2  0.0000     0.8777 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152100     4  0.3330     0.6709 0.000 0.000 0.000 0.716 0.284 0.000
#> GSM152102     2  0.4080     0.1544 0.008 0.536 0.000 0.000 0.456 0.000
#> GSM152104     2  0.3807     0.4842 0.000 0.628 0.000 0.368 0.004 0.000
#> GSM152028     1  0.0622     0.8443 0.980 0.000 0.000 0.000 0.008 0.012
#> GSM152029     6  0.2122     0.8039 0.000 0.008 0.008 0.000 0.084 0.900
#> GSM152049     6  0.2668     0.7341 0.168 0.000 0.000 0.004 0.000 0.828
#> GSM152053     3  0.0779     0.8298 0.008 0.000 0.976 0.008 0.008 0.000
#> GSM152059     6  0.0291     0.8300 0.004 0.000 0.000 0.000 0.004 0.992
#> GSM152085     6  0.0806     0.8290 0.008 0.000 0.000 0.020 0.000 0.972
#> GSM152101     5  0.3482     0.3670 0.000 0.000 0.316 0.000 0.684 0.000
#> GSM152105     1  0.1845     0.8465 0.916 0.000 0.004 0.000 0.008 0.072
#> GSM152034     6  0.1426     0.8314 0.000 0.000 0.008 0.016 0.028 0.948
#> GSM152036     4  0.0146     0.7818 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM152040     5  0.2742     0.6685 0.012 0.000 0.000 0.008 0.852 0.128
#> GSM152043     6  0.1643     0.8245 0.008 0.000 0.000 0.000 0.068 0.924
#> GSM152046     6  0.3658     0.6187 0.000 0.000 0.000 0.216 0.032 0.752
#> GSM152047     6  0.2048     0.7770 0.000 0.000 0.000 0.000 0.120 0.880
#> GSM152048     1  0.1398     0.8502 0.940 0.000 0.000 0.000 0.008 0.052
#> GSM152050     6  0.2446     0.7781 0.012 0.000 0.000 0.124 0.000 0.864
#> GSM152052     1  0.2340     0.8005 0.852 0.000 0.000 0.000 0.000 0.148
#> GSM152056     1  0.2118     0.8321 0.888 0.000 0.000 0.008 0.000 0.104
#> GSM152060     4  0.5114     0.1963 0.000 0.000 0.000 0.468 0.080 0.452
#> GSM152065     5  0.4097    -0.0234 0.492 0.000 0.000 0.000 0.500 0.008
#> GSM152066     1  0.2744     0.8018 0.840 0.000 0.000 0.000 0.016 0.144
#> GSM152069     6  0.5758     0.2274 0.000 0.012 0.348 0.000 0.132 0.508
#> GSM152070     5  0.3864     0.1075 0.000 0.000 0.000 0.000 0.520 0.480
#> GSM152071     6  0.5541     0.3379 0.000 0.004 0.304 0.000 0.144 0.548
#> GSM152072     5  0.3850     0.4088 0.000 0.004 0.004 0.000 0.652 0.340
#> GSM152073     6  0.0405     0.8299 0.004 0.000 0.000 0.000 0.008 0.988
#> GSM152078     6  0.2805     0.7079 0.184 0.000 0.000 0.000 0.004 0.812
#> GSM152082     6  0.4007     0.6228 0.052 0.000 0.000 0.000 0.220 0.728
#> GSM152086     6  0.1501     0.8112 0.076 0.000 0.000 0.000 0.000 0.924
#> GSM152090     6  0.3190     0.7916 0.016 0.012 0.052 0.000 0.060 0.860
#> GSM152092     1  0.4716     0.6063 0.668 0.000 0.000 0.000 0.224 0.108
#> GSM152093     1  0.3956     0.7810 0.792 0.000 0.000 0.024 0.072 0.112
#> GSM152094     6  0.0692     0.8314 0.004 0.000 0.000 0.000 0.020 0.976
#> GSM152098     6  0.1765     0.8089 0.000 0.000 0.000 0.000 0.096 0.904
#> GSM152110     1  0.2594     0.8416 0.888 0.000 0.000 0.036 0.020 0.056
#> GSM152031     1  0.3996     0.1325 0.512 0.000 0.000 0.000 0.004 0.484
#> GSM152037     1  0.1196     0.8504 0.952 0.000 0.000 0.000 0.008 0.040
#> GSM152055     4  0.3462     0.7560 0.004 0.000 0.000 0.816 0.080 0.100
#> GSM152061     4  0.4621     0.5741 0.000 0.000 0.000 0.632 0.064 0.304
#> GSM152064     4  0.4503     0.6543 0.000 0.000 0.000 0.696 0.100 0.204
#> GSM152087     6  0.0603     0.8310 0.004 0.000 0.000 0.000 0.016 0.980
#> GSM152103     6  0.3330     0.7623 0.116 0.000 0.012 0.000 0.044 0.828

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 specimen(p) k
#> SD:NMF 87    3.20e-08 2
#> SD:NMF 65    2.79e-05 3
#> SD:NMF 72    3.90e-05 4
#> SD:NMF 78    1.02e-03 5
#> SD:NMF 76    8.28e-05 6

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


CV:hclust

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 10612 rows and 88 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.308           0.763       0.865          0.335 0.671   0.671
#> 3 3 0.240           0.455       0.721          0.719 0.737   0.616
#> 4 4 0.342           0.355       0.683          0.122 0.880   0.738
#> 5 5 0.440           0.323       0.640          0.143 0.843   0.629
#> 6 6 0.502           0.411       0.670          0.045 0.874   0.642

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
#> GSM152032     1   0.242     0.8514 0.960 0.040
#> GSM152033     1   0.163     0.8561 0.976 0.024
#> GSM152063     2   0.795     0.7574 0.240 0.760
#> GSM152074     1   0.260     0.8465 0.956 0.044
#> GSM152080     1   0.653     0.7724 0.832 0.168
#> GSM152081     1   0.975     0.2449 0.592 0.408
#> GSM152083     1   0.469     0.8015 0.900 0.100
#> GSM152091     1   0.653     0.7724 0.832 0.168
#> GSM152108     1   0.278     0.8602 0.952 0.048
#> GSM152114     1   0.671     0.7873 0.824 0.176
#> GSM152035     1   0.184     0.8637 0.972 0.028
#> GSM152039     2   0.430     0.7382 0.088 0.912
#> GSM152041     2   0.999     0.1756 0.484 0.516
#> GSM152044     2   0.802     0.7570 0.244 0.756
#> GSM152045     1   0.141     0.8586 0.980 0.020
#> GSM152051     2   0.802     0.7570 0.244 0.756
#> GSM152054     1   0.141     0.8574 0.980 0.020
#> GSM152057     2   0.802     0.7570 0.244 0.756
#> GSM152058     1   0.634     0.8122 0.840 0.160
#> GSM152067     1   0.204     0.8581 0.968 0.032
#> GSM152068     2   0.802     0.7570 0.244 0.756
#> GSM152075     2   0.991     0.3128 0.444 0.556
#> GSM152076     2   0.430     0.7382 0.088 0.912
#> GSM152079     2   0.802     0.7570 0.244 0.756
#> GSM152084     1   0.541     0.8348 0.876 0.124
#> GSM152089     1   0.913     0.5324 0.672 0.328
#> GSM152095     2   0.443     0.7397 0.092 0.908
#> GSM152096     1   0.689     0.7760 0.816 0.184
#> GSM152097     2   0.563     0.7529 0.132 0.868
#> GSM152099     2   0.802     0.7570 0.244 0.756
#> GSM152106     2   0.141     0.7155 0.020 0.980
#> GSM152107     1   0.518     0.8288 0.884 0.116
#> GSM152109     1   0.204     0.8559 0.968 0.032
#> GSM152111     1   0.584     0.8319 0.860 0.140
#> GSM152112     1   0.584     0.7991 0.860 0.140
#> GSM152113     1   0.204     0.8666 0.968 0.032
#> GSM152115     1   0.184     0.8605 0.972 0.028
#> GSM152030     1   0.978     0.1943 0.588 0.412
#> GSM152038     1   0.141     0.8638 0.980 0.020
#> GSM152042     1   0.990     0.0789 0.560 0.440
#> GSM152062     1   0.506     0.8431 0.888 0.112
#> GSM152077     1   0.295     0.8593 0.948 0.052
#> GSM152088     2   0.996     0.3302 0.464 0.536
#> GSM152100     2   0.988     0.3272 0.436 0.564
#> GSM152102     1   0.184     0.8637 0.972 0.028
#> GSM152104     2   0.163     0.7185 0.024 0.976
#> GSM152028     1   0.141     0.8629 0.980 0.020
#> GSM152029     1   0.278     0.8651 0.952 0.048
#> GSM152049     1   0.644     0.8054 0.836 0.164
#> GSM152053     1   0.988     0.1341 0.564 0.436
#> GSM152059     1   0.295     0.8643 0.948 0.052
#> GSM152085     1   0.653     0.8038 0.832 0.168
#> GSM152101     1   0.184     0.8605 0.972 0.028
#> GSM152105     1   0.204     0.8656 0.968 0.032
#> GSM152034     1   0.730     0.7687 0.796 0.204
#> GSM152036     2   0.443     0.7382 0.092 0.908
#> GSM152040     1   0.141     0.8586 0.980 0.020
#> GSM152043     1   0.118     0.8593 0.984 0.016
#> GSM152046     1   0.730     0.7687 0.796 0.204
#> GSM152047     1   0.141     0.8608 0.980 0.020
#> GSM152048     1   0.634     0.8122 0.840 0.160
#> GSM152050     1   0.563     0.8345 0.868 0.132
#> GSM152052     1   0.242     0.8663 0.960 0.040
#> GSM152056     1   0.634     0.8122 0.840 0.160
#> GSM152060     1   0.730     0.7687 0.796 0.204
#> GSM152065     1   0.141     0.8562 0.980 0.020
#> GSM152066     1   0.574     0.8309 0.864 0.136
#> GSM152069     1   0.204     0.8559 0.968 0.032
#> GSM152070     1   0.118     0.8593 0.984 0.016
#> GSM152071     1   0.204     0.8559 0.968 0.032
#> GSM152072     1   0.141     0.8586 0.980 0.020
#> GSM152073     1   0.518     0.8476 0.884 0.116
#> GSM152078     1   0.242     0.8663 0.960 0.040
#> GSM152082     1   0.118     0.8593 0.984 0.016
#> GSM152086     1   0.584     0.8319 0.860 0.140
#> GSM152090     1   0.402     0.8611 0.920 0.080
#> GSM152092     1   0.118     0.8593 0.984 0.016
#> GSM152093     1   0.469     0.8550 0.900 0.100
#> GSM152094     1   0.541     0.8421 0.876 0.124
#> GSM152098     1   0.118     0.8593 0.984 0.016
#> GSM152110     1   0.634     0.8122 0.840 0.160
#> GSM152031     1   0.204     0.8656 0.968 0.032
#> GSM152037     1   0.574     0.8309 0.864 0.136
#> GSM152055     1   0.730     0.7687 0.796 0.204
#> GSM152061     1   0.730     0.7687 0.796 0.204
#> GSM152064     1   0.722     0.7743 0.800 0.200
#> GSM152087     1   0.506     0.8460 0.888 0.112
#> GSM152103     1   0.388     0.8615 0.924 0.076

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.3851     0.6483 0.136 0.004 0.860
#> GSM152033     3  0.6045     0.3817 0.380 0.000 0.620
#> GSM152063     2  0.5201     0.7205 0.004 0.760 0.236
#> GSM152074     3  0.3340     0.6427 0.120 0.000 0.880
#> GSM152080     3  0.4634     0.4133 0.012 0.164 0.824
#> GSM152081     1  0.9912    -0.0471 0.396 0.284 0.320
#> GSM152083     3  0.4745     0.5967 0.080 0.068 0.852
#> GSM152091     3  0.4634     0.4133 0.012 0.164 0.824
#> GSM152108     3  0.6659     0.5409 0.304 0.028 0.668
#> GSM152114     3  0.8793     0.1336 0.436 0.112 0.452
#> GSM152035     3  0.7184     0.1575 0.472 0.024 0.504
#> GSM152039     2  0.5276     0.6648 0.128 0.820 0.052
#> GSM152041     1  0.8328     0.1059 0.520 0.396 0.084
#> GSM152044     2  0.5244     0.7201 0.004 0.756 0.240
#> GSM152045     1  0.5810     0.3724 0.664 0.000 0.336
#> GSM152051     2  0.5244     0.7201 0.004 0.756 0.240
#> GSM152054     1  0.6079     0.2718 0.612 0.000 0.388
#> GSM152057     2  0.5244     0.7201 0.004 0.756 0.240
#> GSM152058     1  0.3947     0.6140 0.884 0.040 0.076
#> GSM152067     3  0.5588     0.5580 0.276 0.004 0.720
#> GSM152068     2  0.5244     0.7201 0.004 0.756 0.240
#> GSM152075     2  0.9111     0.0585 0.424 0.436 0.140
#> GSM152076     2  0.5276     0.6648 0.128 0.820 0.052
#> GSM152079     2  0.5420     0.7182 0.008 0.752 0.240
#> GSM152084     3  0.8000     0.2971 0.408 0.064 0.528
#> GSM152089     1  0.7676     0.4416 0.672 0.216 0.112
#> GSM152095     2  0.5343     0.6634 0.132 0.816 0.052
#> GSM152096     3  0.8712     0.4703 0.312 0.132 0.556
#> GSM152097     2  0.3412     0.7198 0.000 0.876 0.124
#> GSM152099     2  0.5244     0.7201 0.004 0.756 0.240
#> GSM152106     2  0.0237     0.6965 0.000 0.996 0.004
#> GSM152107     1  0.8211     0.0596 0.520 0.076 0.404
#> GSM152109     3  0.3918     0.6477 0.140 0.004 0.856
#> GSM152111     1  0.3832     0.6239 0.888 0.036 0.076
#> GSM152112     1  0.8604     0.1792 0.540 0.112 0.348
#> GSM152113     1  0.6819    -0.0621 0.512 0.012 0.476
#> GSM152115     1  0.6483     0.0791 0.544 0.004 0.452
#> GSM152030     1  0.9901    -0.0386 0.404 0.300 0.296
#> GSM152038     1  0.6274     0.0746 0.544 0.000 0.456
#> GSM152042     1  0.9926    -0.0334 0.388 0.328 0.284
#> GSM152062     3  0.7868     0.2773 0.420 0.056 0.524
#> GSM152077     3  0.6659     0.5392 0.304 0.028 0.668
#> GSM152088     2  0.6495     0.4212 0.004 0.536 0.460
#> GSM152100     2  0.9068     0.0639 0.420 0.444 0.136
#> GSM152102     3  0.7184     0.1575 0.472 0.024 0.504
#> GSM152104     2  0.0424     0.6985 0.000 0.992 0.008
#> GSM152028     1  0.6168     0.1944 0.588 0.000 0.412
#> GSM152029     1  0.5517     0.5339 0.728 0.004 0.268
#> GSM152049     1  0.2806     0.6156 0.928 0.040 0.032
#> GSM152053     1  0.9948    -0.0491 0.384 0.312 0.304
#> GSM152059     1  0.4293     0.5924 0.832 0.004 0.164
#> GSM152085     1  0.2681     0.6150 0.932 0.040 0.028
#> GSM152101     1  0.6483     0.0791 0.544 0.004 0.452
#> GSM152105     1  0.5678     0.4367 0.684 0.000 0.316
#> GSM152034     1  0.3589     0.5852 0.900 0.048 0.052
#> GSM152036     2  0.5343     0.6631 0.132 0.816 0.052
#> GSM152040     1  0.4931     0.5213 0.768 0.000 0.232
#> GSM152043     1  0.4235     0.5643 0.824 0.000 0.176
#> GSM152046     1  0.3484     0.5876 0.904 0.048 0.048
#> GSM152047     1  0.4291     0.5605 0.820 0.000 0.180
#> GSM152048     1  0.3947     0.6140 0.884 0.040 0.076
#> GSM152050     1  0.4092     0.6241 0.876 0.036 0.088
#> GSM152052     1  0.6260     0.1750 0.552 0.000 0.448
#> GSM152056     1  0.3947     0.6140 0.884 0.040 0.076
#> GSM152060     1  0.3589     0.5852 0.900 0.048 0.052
#> GSM152065     1  0.6291     0.0673 0.532 0.000 0.468
#> GSM152066     1  0.4094     0.6129 0.872 0.028 0.100
#> GSM152069     3  0.3851     0.6485 0.136 0.004 0.860
#> GSM152070     1  0.4399     0.5532 0.812 0.000 0.188
#> GSM152071     3  0.3851     0.6485 0.136 0.004 0.860
#> GSM152072     1  0.5810     0.3733 0.664 0.000 0.336
#> GSM152073     1  0.3587     0.6214 0.892 0.020 0.088
#> GSM152078     1  0.6252     0.1779 0.556 0.000 0.444
#> GSM152082     1  0.4291     0.5613 0.820 0.000 0.180
#> GSM152086     1  0.3832     0.6239 0.888 0.036 0.076
#> GSM152090     1  0.6717     0.3461 0.628 0.020 0.352
#> GSM152092     1  0.4750     0.5479 0.784 0.000 0.216
#> GSM152093     1  0.7262     0.3410 0.624 0.044 0.332
#> GSM152094     1  0.3805     0.6221 0.884 0.024 0.092
#> GSM152098     1  0.4291     0.5613 0.820 0.000 0.180
#> GSM152110     1  0.3856     0.6144 0.888 0.040 0.072
#> GSM152031     1  0.5678     0.4367 0.684 0.000 0.316
#> GSM152037     1  0.4172     0.6114 0.868 0.028 0.104
#> GSM152055     1  0.3589     0.5852 0.900 0.048 0.052
#> GSM152061     1  0.3589     0.5852 0.900 0.048 0.052
#> GSM152064     1  0.3998     0.5954 0.884 0.060 0.056
#> GSM152087     1  0.3502     0.6222 0.896 0.020 0.084
#> GSM152103     1  0.6777     0.3247 0.616 0.020 0.364

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3   0.305     0.2371 0.028 0.056 0.900 0.016
#> GSM152033     3   0.475     0.4378 0.304 0.008 0.688 0.000
#> GSM152063     4   0.520     0.5018 0.004 0.360 0.008 0.628
#> GSM152074     3   0.183     0.2710 0.024 0.032 0.944 0.000
#> GSM152080     2   0.211     0.4259 0.000 0.932 0.024 0.044
#> GSM152081     1   0.807    -0.1633 0.356 0.004 0.304 0.336
#> GSM152083     3   0.474    -0.0360 0.012 0.240 0.740 0.008
#> GSM152091     2   0.211     0.4259 0.000 0.932 0.024 0.044
#> GSM152108     3   0.495     0.5042 0.232 0.004 0.736 0.028
#> GSM152114     3   0.834     0.2503 0.388 0.044 0.416 0.152
#> GSM152035     3   0.753     0.2923 0.396 0.144 0.452 0.008
#> GSM152039     4   0.194     0.4962 0.076 0.000 0.000 0.924
#> GSM152041     1   0.624     0.0693 0.504 0.004 0.044 0.448
#> GSM152044     4   0.521     0.5001 0.004 0.364 0.008 0.624
#> GSM152045     1   0.530     0.1541 0.600 0.008 0.388 0.004
#> GSM152051     4   0.521     0.5001 0.004 0.364 0.008 0.624
#> GSM152054     1   0.557    -0.0236 0.540 0.020 0.440 0.000
#> GSM152057     4   0.521     0.5001 0.004 0.364 0.008 0.624
#> GSM152058     1   0.292     0.5977 0.896 0.008 0.080 0.016
#> GSM152067     3   0.822    -0.1045 0.208 0.372 0.400 0.020
#> GSM152068     4   0.521     0.5001 0.004 0.364 0.008 0.624
#> GSM152075     4   0.699     0.0887 0.384 0.004 0.104 0.508
#> GSM152076     4   0.194     0.4962 0.076 0.000 0.000 0.924
#> GSM152079     4   0.535     0.4983 0.008 0.364 0.008 0.620
#> GSM152084     3   0.788     0.3436 0.340 0.048 0.508 0.104
#> GSM152089     1   0.618     0.3030 0.660 0.028 0.040 0.272
#> GSM152095     4   0.201     0.4957 0.080 0.000 0.000 0.920
#> GSM152096     3   0.928     0.3588 0.260 0.208 0.420 0.112
#> GSM152097     4   0.436     0.5112 0.000 0.248 0.008 0.744
#> GSM152099     4   0.521     0.5001 0.004 0.364 0.008 0.624
#> GSM152106     4   0.281     0.5115 0.000 0.132 0.000 0.868
#> GSM152107     1   0.734    -0.2061 0.444 0.016 0.440 0.100
#> GSM152109     2   0.722     0.4297 0.068 0.464 0.440 0.028
#> GSM152111     1   0.259     0.6091 0.920 0.036 0.032 0.012
#> GSM152112     1   0.755    -0.1450 0.472 0.012 0.380 0.136
#> GSM152113     3   0.678     0.1147 0.452 0.056 0.476 0.016
#> GSM152115     3   0.590     0.1890 0.452 0.012 0.520 0.016
#> GSM152030     1   0.804    -0.1684 0.368 0.004 0.288 0.340
#> GSM152038     1   0.649    -0.0445 0.496 0.060 0.440 0.004
#> GSM152042     4   0.800    -0.1225 0.352 0.004 0.264 0.380
#> GSM152062     3   0.785     0.3440 0.348 0.048 0.504 0.100
#> GSM152077     3   0.492     0.5030 0.228 0.004 0.740 0.028
#> GSM152088     2   0.505    -0.2738 0.000 0.588 0.004 0.408
#> GSM152100     4   0.686     0.0939 0.388 0.004 0.092 0.516
#> GSM152102     3   0.753     0.2923 0.396 0.144 0.452 0.008
#> GSM152104     4   0.287     0.5121 0.000 0.136 0.000 0.864
#> GSM152028     1   0.616     0.0731 0.536 0.052 0.412 0.000
#> GSM152029     1   0.571     0.4713 0.716 0.156 0.128 0.000
#> GSM152049     1   0.185     0.6085 0.948 0.008 0.024 0.020
#> GSM152053     4   0.805    -0.1308 0.344 0.004 0.292 0.360
#> GSM152059     1   0.409     0.5593 0.828 0.116 0.056 0.000
#> GSM152085     1   0.196     0.6079 0.944 0.008 0.024 0.024
#> GSM152101     3   0.591     0.1805 0.456 0.012 0.516 0.016
#> GSM152105     1   0.595     0.3852 0.656 0.076 0.268 0.000
#> GSM152034     1   0.220     0.5850 0.920 0.000 0.008 0.072
#> GSM152036     4   0.220     0.4953 0.080 0.000 0.004 0.916
#> GSM152040     1   0.448     0.4039 0.712 0.004 0.284 0.000
#> GSM152043     1   0.418     0.5025 0.784 0.016 0.200 0.000
#> GSM152046     1   0.212     0.5864 0.924 0.000 0.008 0.068
#> GSM152047     1   0.412     0.4829 0.772 0.008 0.220 0.000
#> GSM152048     1   0.292     0.5977 0.896 0.008 0.080 0.016
#> GSM152050     1   0.257     0.6096 0.916 0.028 0.052 0.004
#> GSM152052     1   0.691     0.1049 0.520 0.116 0.364 0.000
#> GSM152056     1   0.292     0.5977 0.896 0.008 0.080 0.016
#> GSM152060     1   0.220     0.5850 0.920 0.000 0.008 0.072
#> GSM152065     3   0.515     0.1656 0.460 0.004 0.536 0.000
#> GSM152066     1   0.349     0.5901 0.860 0.008 0.116 0.016
#> GSM152069     2   0.713     0.4297 0.068 0.464 0.444 0.024
#> GSM152070     1   0.419     0.4718 0.764 0.008 0.228 0.000
#> GSM152071     2   0.713     0.4297 0.068 0.464 0.444 0.024
#> GSM152072     1   0.514     0.1565 0.600 0.008 0.392 0.000
#> GSM152073     1   0.267     0.6043 0.908 0.048 0.044 0.000
#> GSM152078     1   0.687     0.1144 0.524 0.112 0.364 0.000
#> GSM152082     1   0.421     0.4978 0.780 0.016 0.204 0.000
#> GSM152086     1   0.259     0.6091 0.920 0.036 0.032 0.012
#> GSM152090     1   0.702     0.2575 0.592 0.080 0.300 0.028
#> GSM152092     1   0.473     0.4855 0.752 0.032 0.216 0.000
#> GSM152093     1   0.696     0.2503 0.612 0.060 0.284 0.044
#> GSM152094     1   0.305     0.6050 0.900 0.048 0.040 0.012
#> GSM152098     1   0.421     0.4978 0.780 0.016 0.204 0.000
#> GSM152110     1   0.285     0.5989 0.900 0.008 0.076 0.016
#> GSM152031     1   0.595     0.3852 0.656 0.076 0.268 0.000
#> GSM152037     1   0.355     0.5877 0.856 0.008 0.120 0.016
#> GSM152055     1   0.220     0.5850 0.920 0.000 0.008 0.072
#> GSM152061     1   0.220     0.5850 0.920 0.000 0.008 0.072
#> GSM152064     1   0.291     0.5850 0.900 0.004 0.032 0.064
#> GSM152087     1   0.259     0.6072 0.912 0.040 0.048 0.000
#> GSM152103     1   0.729     0.2255 0.572 0.084 0.308 0.036

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.4941     0.0911 0.012 0.004 0.636 0.016 0.332
#> GSM152033     3  0.3599     0.3375 0.020 0.000 0.824 0.140 0.016
#> GSM152063     2  0.0833     0.7540 0.004 0.976 0.000 0.004 0.016
#> GSM152074     3  0.4477     0.1286 0.008 0.000 0.688 0.016 0.288
#> GSM152080     5  0.6913     0.3300 0.000 0.348 0.004 0.276 0.372
#> GSM152081     1  0.9771    -0.3851 0.312 0.184 0.152 0.172 0.180
#> GSM152083     3  0.6488    -0.0453 0.000 0.200 0.564 0.016 0.220
#> GSM152091     5  0.6913     0.3300 0.000 0.348 0.004 0.276 0.372
#> GSM152108     3  0.3759     0.3081 0.100 0.024 0.840 0.008 0.028
#> GSM152114     3  0.8851    -0.0880 0.284 0.044 0.380 0.148 0.144
#> GSM152035     3  0.7017     0.2703 0.024 0.044 0.520 0.336 0.076
#> GSM152039     2  0.5792     0.4821 0.084 0.536 0.000 0.376 0.004
#> GSM152041     1  0.8070    -0.3507 0.444 0.224 0.032 0.252 0.048
#> GSM152044     2  0.0771     0.7544 0.004 0.976 0.000 0.000 0.020
#> GSM152045     3  0.7415     0.1741 0.224 0.000 0.416 0.320 0.040
#> GSM152051     2  0.0771     0.7544 0.004 0.976 0.000 0.000 0.020
#> GSM152054     3  0.7042     0.2501 0.096 0.004 0.520 0.312 0.068
#> GSM152057     2  0.0771     0.7544 0.004 0.976 0.000 0.000 0.020
#> GSM152058     1  0.2890     0.5581 0.872 0.004 0.104 0.004 0.016
#> GSM152067     5  0.5730     0.3766 0.072 0.012 0.132 0.064 0.720
#> GSM152068     2  0.0771     0.7544 0.004 0.976 0.000 0.000 0.020
#> GSM152075     1  0.8917    -0.5522 0.316 0.252 0.080 0.296 0.056
#> GSM152076     2  0.5792     0.4821 0.084 0.536 0.000 0.376 0.004
#> GSM152079     2  0.0898     0.7519 0.008 0.972 0.000 0.000 0.020
#> GSM152084     3  0.8511     0.0413 0.240 0.020 0.408 0.120 0.212
#> GSM152089     1  0.8045    -0.3115 0.412 0.068 0.072 0.376 0.072
#> GSM152095     2  0.5829     0.4765 0.088 0.536 0.000 0.372 0.004
#> GSM152096     3  0.9275     0.0564 0.180 0.196 0.392 0.100 0.132
#> GSM152097     2  0.2068     0.7394 0.000 0.904 0.000 0.092 0.004
#> GSM152099     2  0.0771     0.7544 0.004 0.976 0.000 0.000 0.020
#> GSM152106     2  0.3612     0.6997 0.000 0.764 0.000 0.228 0.008
#> GSM152107     3  0.9036    -0.1307 0.124 0.040 0.296 0.284 0.256
#> GSM152109     5  0.3084     0.6142 0.036 0.016 0.064 0.004 0.880
#> GSM152111     1  0.2006     0.5722 0.916 0.000 0.000 0.012 0.072
#> GSM152112     4  0.8912    -0.2616 0.172 0.036 0.272 0.364 0.156
#> GSM152113     3  0.7358     0.2427 0.248 0.004 0.532 0.112 0.104
#> GSM152115     3  0.7926     0.1951 0.084 0.004 0.416 0.300 0.196
#> GSM152030     1  0.9679    -0.3736 0.308 0.204 0.216 0.156 0.116
#> GSM152038     3  0.7231     0.2080 0.304 0.000 0.500 0.096 0.100
#> GSM152042     1  0.9721    -0.4133 0.312 0.208 0.152 0.192 0.136
#> GSM152062     3  0.8281     0.0650 0.220 0.016 0.452 0.128 0.184
#> GSM152077     3  0.3641     0.3053 0.112 0.024 0.840 0.008 0.016
#> GSM152088     2  0.4772     0.4751 0.000 0.740 0.004 0.108 0.148
#> GSM152100     4  0.8913     0.1443 0.304 0.240 0.072 0.320 0.064
#> GSM152102     3  0.7017     0.2703 0.024 0.044 0.520 0.336 0.076
#> GSM152104     2  0.3582     0.7017 0.000 0.768 0.000 0.224 0.008
#> GSM152028     3  0.7069     0.1443 0.336 0.000 0.488 0.112 0.064
#> GSM152029     1  0.4995     0.4725 0.688 0.008 0.020 0.020 0.264
#> GSM152049     1  0.1200     0.5700 0.964 0.000 0.012 0.008 0.016
#> GSM152053     1  0.9792    -0.4143 0.300 0.208 0.152 0.180 0.160
#> GSM152059     1  0.3443     0.5373 0.816 0.000 0.012 0.008 0.164
#> GSM152085     1  0.1314     0.5690 0.960 0.000 0.012 0.012 0.016
#> GSM152101     3  0.7944     0.1910 0.084 0.004 0.412 0.300 0.200
#> GSM152105     1  0.6321     0.3911 0.592 0.000 0.264 0.032 0.112
#> GSM152034     1  0.1768     0.5426 0.924 0.000 0.000 0.072 0.004
#> GSM152036     2  0.5932     0.4763 0.088 0.536 0.000 0.368 0.008
#> GSM152040     1  0.7549    -0.1891 0.376 0.000 0.304 0.280 0.040
#> GSM152043     1  0.6706     0.2035 0.564 0.000 0.204 0.200 0.032
#> GSM152046     1  0.1704     0.5441 0.928 0.000 0.000 0.068 0.004
#> GSM152047     1  0.6819     0.1051 0.516 0.000 0.228 0.236 0.020
#> GSM152048     1  0.2994     0.5558 0.864 0.004 0.112 0.004 0.016
#> GSM152050     1  0.2585     0.5755 0.896 0.000 0.036 0.004 0.064
#> GSM152052     1  0.6473     0.2270 0.468 0.000 0.364 0.004 0.164
#> GSM152056     1  0.2890     0.5581 0.872 0.004 0.104 0.004 0.016
#> GSM152060     1  0.1768     0.5426 0.924 0.000 0.000 0.072 0.004
#> GSM152065     3  0.5780     0.2939 0.068 0.000 0.616 0.292 0.024
#> GSM152066     1  0.3666     0.5508 0.828 0.004 0.132 0.020 0.016
#> GSM152069     5  0.2971     0.6162 0.032 0.016 0.072 0.000 0.880
#> GSM152070     1  0.6858     0.0867 0.508 0.000 0.236 0.236 0.020
#> GSM152071     5  0.2971     0.6162 0.032 0.016 0.072 0.000 0.880
#> GSM152072     3  0.7425     0.1905 0.216 0.000 0.428 0.312 0.044
#> GSM152073     1  0.2362     0.5700 0.900 0.000 0.008 0.008 0.084
#> GSM152078     1  0.6447     0.2319 0.472 0.000 0.364 0.004 0.160
#> GSM152082     1  0.6756     0.1887 0.556 0.000 0.204 0.208 0.032
#> GSM152086     1  0.2006     0.5722 0.916 0.000 0.000 0.012 0.072
#> GSM152090     1  0.6998     0.3621 0.556 0.004 0.212 0.044 0.184
#> GSM152092     1  0.6963     0.1784 0.540 0.000 0.232 0.184 0.044
#> GSM152093     1  0.7120     0.2995 0.540 0.008 0.280 0.068 0.104
#> GSM152094     1  0.2305     0.5707 0.896 0.000 0.000 0.012 0.092
#> GSM152098     1  0.6756     0.1887 0.556 0.000 0.204 0.208 0.032
#> GSM152110     1  0.2837     0.5590 0.876 0.004 0.100 0.004 0.016
#> GSM152031     1  0.6321     0.3911 0.592 0.000 0.264 0.032 0.112
#> GSM152037     1  0.3711     0.5488 0.824 0.004 0.136 0.020 0.016
#> GSM152055     1  0.1768     0.5426 0.924 0.000 0.000 0.072 0.004
#> GSM152061     1  0.1768     0.5426 0.924 0.000 0.000 0.072 0.004
#> GSM152064     1  0.2744     0.5288 0.896 0.008 0.004 0.052 0.040
#> GSM152087     1  0.2017     0.5734 0.912 0.000 0.008 0.000 0.080
#> GSM152103     1  0.7067     0.3509 0.544 0.004 0.184 0.044 0.224

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     1  0.4576   -0.03698 0.616 0.000 0.344 0.004 0.032 0.004
#> GSM152033     1  0.4209   -0.12536 0.560 0.000 0.004 0.004 0.428 0.004
#> GSM152063     2  0.0458    0.69772 0.016 0.984 0.000 0.000 0.000 0.000
#> GSM152074     1  0.4308    0.02128 0.676 0.000 0.280 0.004 0.040 0.000
#> GSM152080     4  0.5404    0.36896 0.016 0.292 0.064 0.612 0.016 0.000
#> GSM152081     1  0.8861    0.19713 0.268 0.156 0.212 0.116 0.004 0.244
#> GSM152083     1  0.6044   -0.00262 0.572 0.200 0.196 0.004 0.028 0.000
#> GSM152091     4  0.5404    0.36896 0.016 0.292 0.064 0.612 0.016 0.000
#> GSM152108     1  0.3692    0.32066 0.800 0.012 0.004 0.000 0.144 0.040
#> GSM152114     1  0.7886    0.36488 0.472 0.032 0.180 0.076 0.036 0.204
#> GSM152035     5  0.4427    0.52961 0.096 0.028 0.004 0.108 0.764 0.000
#> GSM152039     2  0.6332    0.45850 0.052 0.500 0.012 0.348 0.000 0.088
#> GSM152041     6  0.8554   -0.11025 0.080 0.204 0.072 0.200 0.040 0.404
#> GSM152044     2  0.0363    0.69845 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM152045     5  0.2631    0.62545 0.012 0.000 0.000 0.004 0.856 0.128
#> GSM152051     2  0.0363    0.69845 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM152054     5  0.1586    0.60528 0.040 0.004 0.004 0.000 0.940 0.012
#> GSM152057     2  0.0363    0.69845 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM152058     6  0.2794    0.61377 0.144 0.000 0.012 0.004 0.000 0.840
#> GSM152067     3  0.3766    0.62157 0.000 0.000 0.720 0.000 0.256 0.024
#> GSM152068     2  0.0363    0.69845 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM152075     6  0.9326   -0.33631 0.164 0.224 0.092 0.224 0.044 0.252
#> GSM152076     2  0.6332    0.45850 0.052 0.500 0.012 0.348 0.000 0.088
#> GSM152079     2  0.0508    0.69522 0.012 0.984 0.000 0.000 0.000 0.004
#> GSM152084     1  0.7665    0.30990 0.444 0.008 0.268 0.048 0.064 0.168
#> GSM152089     6  0.8947   -0.15953 0.096 0.056 0.072 0.176 0.284 0.316
#> GSM152095     2  0.6374    0.45580 0.056 0.500 0.012 0.344 0.000 0.088
#> GSM152096     1  0.8430    0.27172 0.452 0.188 0.132 0.044 0.068 0.116
#> GSM152097     2  0.2092    0.67487 0.000 0.876 0.000 0.124 0.000 0.000
#> GSM152099     2  0.0363    0.69845 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM152106     2  0.4369    0.61017 0.012 0.700 0.020 0.256 0.012 0.000
#> GSM152107     5  0.7217    0.26362 0.072 0.032 0.280 0.036 0.516 0.064
#> GSM152109     3  0.1232    0.86648 0.016 0.000 0.956 0.004 0.000 0.024
#> GSM152111     6  0.2237    0.63757 0.036 0.000 0.068 0.000 0.000 0.896
#> GSM152112     5  0.7572    0.35964 0.132 0.020 0.160 0.076 0.540 0.072
#> GSM152113     1  0.7613    0.26078 0.428 0.004 0.116 0.016 0.236 0.200
#> GSM152115     5  0.3851    0.53019 0.032 0.000 0.176 0.008 0.776 0.008
#> GSM152030     1  0.8627    0.22255 0.340 0.180 0.144 0.100 0.004 0.232
#> GSM152038     1  0.7349    0.22082 0.400 0.000 0.108 0.004 0.232 0.256
#> GSM152042     1  0.9023    0.16560 0.264 0.180 0.176 0.136 0.008 0.236
#> GSM152062     1  0.7796    0.32653 0.460 0.008 0.236 0.048 0.104 0.144
#> GSM152077     1  0.3766    0.33277 0.800 0.012 0.004 0.000 0.132 0.052
#> GSM152088     2  0.4057    0.36189 0.008 0.740 0.016 0.220 0.016 0.000
#> GSM152100     4  0.9464   -0.26014 0.152 0.212 0.092 0.240 0.064 0.240
#> GSM152102     5  0.4380    0.53287 0.092 0.028 0.004 0.108 0.768 0.000
#> GSM152104     2  0.4347    0.61175 0.012 0.704 0.020 0.252 0.012 0.000
#> GSM152028     1  0.7063    0.13188 0.364 0.000 0.068 0.000 0.280 0.288
#> GSM152029     6  0.4924    0.50546 0.048 0.000 0.276 0.000 0.028 0.648
#> GSM152049     6  0.1553    0.63991 0.032 0.000 0.012 0.008 0.004 0.944
#> GSM152053     1  0.8975    0.17548 0.272 0.180 0.184 0.120 0.008 0.236
#> GSM152059     6  0.3851    0.58336 0.032 0.000 0.164 0.000 0.024 0.780
#> GSM152085     6  0.1396    0.63932 0.024 0.000 0.012 0.008 0.004 0.952
#> GSM152101     5  0.3884    0.52785 0.032 0.000 0.180 0.008 0.772 0.008
#> GSM152105     6  0.6365    0.38696 0.268 0.000 0.112 0.000 0.084 0.536
#> GSM152034     6  0.2596    0.61007 0.032 0.000 0.016 0.044 0.012 0.896
#> GSM152036     2  0.6404    0.45405 0.056 0.500 0.012 0.340 0.000 0.092
#> GSM152040     5  0.3954    0.51417 0.012 0.000 0.008 0.000 0.688 0.292
#> GSM152043     6  0.4962   -0.07249 0.016 0.000 0.036 0.000 0.428 0.520
#> GSM152046     6  0.2528    0.61164 0.032 0.000 0.016 0.040 0.012 0.900
#> GSM152047     5  0.4954    0.18745 0.016 0.000 0.020 0.008 0.500 0.456
#> GSM152048     6  0.2975    0.61039 0.148 0.000 0.012 0.004 0.004 0.832
#> GSM152050     6  0.2794    0.63622 0.080 0.000 0.060 0.000 0.000 0.860
#> GSM152052     6  0.6008    0.15823 0.408 0.000 0.160 0.000 0.012 0.420
#> GSM152056     6  0.2794    0.61377 0.144 0.000 0.012 0.004 0.000 0.840
#> GSM152060     6  0.2596    0.61007 0.032 0.000 0.016 0.044 0.012 0.896
#> GSM152065     5  0.3514    0.54000 0.208 0.000 0.004 0.000 0.768 0.020
#> GSM152066     6  0.3587    0.60226 0.164 0.000 0.012 0.004 0.024 0.796
#> GSM152069     3  0.1629    0.87046 0.028 0.000 0.940 0.004 0.004 0.024
#> GSM152070     5  0.4719    0.21360 0.016 0.000 0.020 0.000 0.516 0.448
#> GSM152071     3  0.1549    0.87199 0.024 0.000 0.944 0.004 0.004 0.024
#> GSM152072     5  0.2581    0.62854 0.020 0.000 0.000 0.000 0.860 0.120
#> GSM152073     6  0.2973    0.63176 0.040 0.000 0.084 0.000 0.016 0.860
#> GSM152078     6  0.5986    0.16391 0.408 0.000 0.156 0.000 0.012 0.424
#> GSM152082     6  0.4893   -0.10455 0.012 0.000 0.036 0.000 0.440 0.512
#> GSM152086     6  0.2237    0.63757 0.036 0.000 0.068 0.000 0.000 0.896
#> GSM152090     6  0.6445    0.29230 0.260 0.000 0.208 0.020 0.012 0.500
#> GSM152092     6  0.5696   -0.05695 0.056 0.000 0.048 0.000 0.396 0.500
#> GSM152093     6  0.6613    0.11225 0.364 0.000 0.108 0.032 0.032 0.464
#> GSM152094     6  0.2509    0.63356 0.036 0.000 0.088 0.000 0.000 0.876
#> GSM152098     6  0.4893   -0.10455 0.012 0.000 0.036 0.000 0.440 0.512
#> GSM152110     6  0.2755    0.61528 0.140 0.000 0.012 0.004 0.000 0.844
#> GSM152031     6  0.6365    0.38696 0.268 0.000 0.112 0.000 0.084 0.536
#> GSM152037     6  0.3622    0.59929 0.168 0.000 0.012 0.004 0.024 0.792
#> GSM152055     6  0.2569    0.61010 0.036 0.000 0.016 0.044 0.008 0.896
#> GSM152061     6  0.2596    0.61007 0.032 0.000 0.016 0.044 0.012 0.896
#> GSM152064     6  0.3018    0.60137 0.040 0.004 0.048 0.024 0.008 0.876
#> GSM152087     6  0.2685    0.63553 0.044 0.000 0.080 0.000 0.004 0.872
#> GSM152103     6  0.6497    0.26508 0.216 0.000 0.264 0.020 0.012 0.488

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 specimen(p) k
#> CV:hclust 80    1.95e-03 2
#> CV:hclust 52    4.01e-07 3
#> CV:hclust 33    4.12e-05 4
#> CV:hclust 34    4.15e-03 5
#> CV:hclust 45    1.41e-02 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 10612 rows and 88 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 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-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.231           0.546       0.778         0.4694 0.520   0.520
#> 3 3 0.525           0.637       0.811         0.3843 0.732   0.522
#> 4 4 0.569           0.707       0.799         0.1217 0.903   0.728
#> 5 5 0.597           0.584       0.747         0.0697 0.937   0.783
#> 6 6 0.646           0.496       0.668         0.0466 0.899   0.603

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM152032     1  0.9775    0.02574 0.588 0.412
#> GSM152033     1  0.9710    0.06083 0.600 0.400
#> GSM152063     2  0.0000    0.71460 0.000 1.000
#> GSM152074     1  0.9775    0.02574 0.588 0.412
#> GSM152080     2  0.8207    0.56608 0.256 0.744
#> GSM152081     2  0.9170    0.41660 0.332 0.668
#> GSM152083     2  0.8207    0.56608 0.256 0.744
#> GSM152091     2  0.7674    0.59288 0.224 0.776
#> GSM152108     2  0.3274    0.70391 0.060 0.940
#> GSM152114     1  0.9896    0.33007 0.560 0.440
#> GSM152035     2  0.7674    0.59288 0.224 0.776
#> GSM152039     2  0.7376    0.59907 0.208 0.792
#> GSM152041     2  0.9209    0.39761 0.336 0.664
#> GSM152044     2  0.0672    0.71505 0.008 0.992
#> GSM152045     1  0.6148    0.54546 0.848 0.152
#> GSM152051     2  0.0672    0.71648 0.008 0.992
#> GSM152054     2  0.9970    0.35423 0.468 0.532
#> GSM152057     2  0.0672    0.71648 0.008 0.992
#> GSM152058     1  0.7883    0.65931 0.764 0.236
#> GSM152067     1  0.9815   -0.00889 0.580 0.420
#> GSM152068     2  0.0672    0.71648 0.008 0.992
#> GSM152075     2  0.8661    0.50640 0.288 0.712
#> GSM152076     2  0.7745    0.58310 0.228 0.772
#> GSM152079     2  0.0672    0.71648 0.008 0.992
#> GSM152084     1  0.9775    0.19300 0.588 0.412
#> GSM152089     2  0.7950    0.55439 0.240 0.760
#> GSM152095     2  0.7745    0.58310 0.228 0.772
#> GSM152096     2  0.8861    0.54047 0.304 0.696
#> GSM152097     2  0.0376    0.71375 0.004 0.996
#> GSM152099     2  0.0672    0.71648 0.008 0.992
#> GSM152106     2  0.0376    0.71375 0.004 0.996
#> GSM152107     2  0.9686    0.44563 0.396 0.604
#> GSM152109     1  0.9754    0.03945 0.592 0.408
#> GSM152111     1  0.8207    0.64911 0.744 0.256
#> GSM152112     2  0.9661    0.47948 0.392 0.608
#> GSM152113     1  0.9393    0.15251 0.644 0.356
#> GSM152115     1  0.9754    0.00409 0.592 0.408
#> GSM152030     2  0.8909    0.48332 0.308 0.692
#> GSM152038     1  0.1633    0.65315 0.976 0.024
#> GSM152042     2  0.9170    0.41660 0.332 0.668
#> GSM152062     1  0.9358    0.16073 0.648 0.352
#> GSM152077     1  0.7950    0.65730 0.760 0.240
#> GSM152088     2  0.0672    0.71648 0.008 0.992
#> GSM152100     2  0.5059    0.67881 0.112 0.888
#> GSM152102     2  0.8386    0.56056 0.268 0.732
#> GSM152104     2  0.0376    0.71375 0.004 0.996
#> GSM152028     1  0.0376    0.66538 0.996 0.004
#> GSM152029     1  0.0376    0.66538 0.996 0.004
#> GSM152049     1  0.7883    0.65931 0.764 0.236
#> GSM152053     2  0.9170    0.43033 0.332 0.668
#> GSM152059     1  0.0000    0.66622 1.000 0.000
#> GSM152085     1  0.8016    0.65680 0.756 0.244
#> GSM152101     2  0.9996    0.30967 0.488 0.512
#> GSM152105     1  0.0376    0.66538 0.996 0.004
#> GSM152034     1  0.8207    0.64911 0.744 0.256
#> GSM152036     2  0.8016    0.56499 0.244 0.756
#> GSM152040     1  0.0672    0.66565 0.992 0.008
#> GSM152043     1  0.0672    0.66565 0.992 0.008
#> GSM152046     1  0.8207    0.64911 0.744 0.256
#> GSM152047     1  0.5737    0.66978 0.864 0.136
#> GSM152048     1  0.7883    0.65931 0.764 0.236
#> GSM152050     1  0.8207    0.64911 0.744 0.256
#> GSM152052     1  0.1414    0.66865 0.980 0.020
#> GSM152056     1  0.8144    0.65071 0.748 0.252
#> GSM152060     1  0.8207    0.64911 0.744 0.256
#> GSM152065     1  0.4298    0.59795 0.912 0.088
#> GSM152066     1  0.7883    0.65931 0.764 0.236
#> GSM152069     1  0.9754    0.03945 0.592 0.408
#> GSM152070     1  0.0376    0.66538 0.996 0.004
#> GSM152071     1  0.9710    0.06099 0.600 0.400
#> GSM152072     1  0.5519    0.56038 0.872 0.128
#> GSM152073     1  0.0000    0.66622 1.000 0.000
#> GSM152078     1  0.0376    0.66538 0.996 0.004
#> GSM152082     1  0.0376    0.66538 0.996 0.004
#> GSM152086     1  0.7950    0.65844 0.760 0.240
#> GSM152090     1  0.9710    0.42642 0.600 0.400
#> GSM152092     1  0.0376    0.66538 0.996 0.004
#> GSM152093     1  0.8081    0.65174 0.752 0.248
#> GSM152094     1  0.7950    0.65885 0.760 0.240
#> GSM152098     1  0.0376    0.66538 0.996 0.004
#> GSM152110     1  0.8207    0.64911 0.744 0.256
#> GSM152031     1  0.0376    0.66538 0.996 0.004
#> GSM152037     1  0.7815    0.66051 0.768 0.232
#> GSM152055     1  0.8207    0.64911 0.744 0.256
#> GSM152061     1  0.8207    0.64911 0.744 0.256
#> GSM152064     1  0.8207    0.64911 0.744 0.256
#> GSM152087     1  0.7883    0.66018 0.764 0.236
#> GSM152103     1  0.8386    0.62906 0.732 0.268

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.1525     0.7843 0.032 0.004 0.964
#> GSM152033     3  0.1647     0.7846 0.036 0.004 0.960
#> GSM152063     2  0.1647     0.6635 0.004 0.960 0.036
#> GSM152074     3  0.1289     0.7844 0.032 0.000 0.968
#> GSM152080     2  0.6359     0.1104 0.004 0.592 0.404
#> GSM152081     2  0.9574     0.4256 0.392 0.412 0.196
#> GSM152083     3  0.6291     0.1382 0.000 0.468 0.532
#> GSM152091     2  0.4682     0.5248 0.004 0.804 0.192
#> GSM152108     2  0.7014     0.4985 0.080 0.712 0.208
#> GSM152114     1  0.4465     0.6786 0.820 0.004 0.176
#> GSM152035     2  0.4733     0.5198 0.004 0.800 0.196
#> GSM152039     2  0.8803     0.5463 0.320 0.544 0.136
#> GSM152041     2  0.9062     0.4250 0.412 0.452 0.136
#> GSM152044     2  0.1765     0.6632 0.004 0.956 0.040
#> GSM152045     3  0.3832     0.7419 0.100 0.020 0.880
#> GSM152051     2  0.2063     0.6628 0.008 0.948 0.044
#> GSM152054     3  0.2527     0.7505 0.020 0.044 0.936
#> GSM152057     2  0.2063     0.6628 0.008 0.948 0.044
#> GSM152058     1  0.0424     0.8452 0.992 0.000 0.008
#> GSM152067     3  0.1170     0.7779 0.016 0.008 0.976
#> GSM152068     2  0.2063     0.6628 0.008 0.948 0.044
#> GSM152075     2  0.9172     0.4463 0.396 0.456 0.148
#> GSM152076     2  0.8902     0.5443 0.320 0.536 0.144
#> GSM152079     2  0.2063     0.6628 0.008 0.948 0.044
#> GSM152084     3  0.2400     0.7726 0.064 0.004 0.932
#> GSM152089     3  0.9331    -0.0483 0.344 0.176 0.480
#> GSM152095     2  0.8902     0.5443 0.320 0.536 0.144
#> GSM152096     3  0.6451     0.2183 0.004 0.436 0.560
#> GSM152097     2  0.0983     0.6636 0.004 0.980 0.016
#> GSM152099     2  0.1878     0.6628 0.004 0.952 0.044
#> GSM152106     2  0.0237     0.6601 0.004 0.996 0.000
#> GSM152107     3  0.0829     0.7676 0.004 0.012 0.984
#> GSM152109     3  0.1525     0.7843 0.032 0.004 0.964
#> GSM152111     1  0.0000     0.8443 1.000 0.000 0.000
#> GSM152112     3  0.3752     0.7095 0.020 0.096 0.884
#> GSM152113     3  0.1411     0.7842 0.036 0.000 0.964
#> GSM152115     3  0.0848     0.7732 0.008 0.008 0.984
#> GSM152030     2  0.9625     0.4377 0.388 0.408 0.204
#> GSM152038     3  0.2356     0.7722 0.072 0.000 0.928
#> GSM152042     2  0.9625     0.4377 0.388 0.408 0.204
#> GSM152062     3  0.1647     0.7845 0.036 0.004 0.960
#> GSM152077     1  0.1643     0.8283 0.956 0.000 0.044
#> GSM152088     2  0.2063     0.6628 0.008 0.948 0.044
#> GSM152100     2  0.8902     0.5443 0.320 0.536 0.144
#> GSM152102     3  0.6111     0.3311 0.000 0.396 0.604
#> GSM152104     2  0.1129     0.6637 0.004 0.976 0.020
#> GSM152028     1  0.5835     0.4708 0.660 0.000 0.340
#> GSM152029     3  0.6302     0.0801 0.480 0.000 0.520
#> GSM152049     1  0.0747     0.8431 0.984 0.000 0.016
#> GSM152053     2  0.9673     0.4313 0.388 0.400 0.212
#> GSM152059     1  0.4702     0.6695 0.788 0.000 0.212
#> GSM152085     1  0.0000     0.8443 1.000 0.000 0.000
#> GSM152101     3  0.0848     0.7732 0.008 0.008 0.984
#> GSM152105     1  0.5926     0.4642 0.644 0.000 0.356
#> GSM152034     1  0.2187     0.8175 0.948 0.028 0.024
#> GSM152036     2  0.8971     0.5286 0.336 0.520 0.144
#> GSM152040     1  0.6057     0.4834 0.656 0.004 0.340
#> GSM152043     1  0.5560     0.5369 0.700 0.000 0.300
#> GSM152046     1  0.2187     0.8175 0.948 0.028 0.024
#> GSM152047     1  0.1163     0.8368 0.972 0.000 0.028
#> GSM152048     1  0.0592     0.8448 0.988 0.000 0.012
#> GSM152050     1  0.0000     0.8443 1.000 0.000 0.000
#> GSM152052     1  0.1289     0.8387 0.968 0.000 0.032
#> GSM152056     1  0.0424     0.8452 0.992 0.000 0.008
#> GSM152060     1  0.2187     0.8175 0.948 0.028 0.024
#> GSM152065     3  0.4682     0.6884 0.192 0.004 0.804
#> GSM152066     1  0.0424     0.8452 0.992 0.000 0.008
#> GSM152069     3  0.1525     0.7843 0.032 0.004 0.964
#> GSM152070     3  0.6330     0.3432 0.396 0.004 0.600
#> GSM152071     3  0.1525     0.7843 0.032 0.004 0.964
#> GSM152072     3  0.4682     0.6919 0.192 0.004 0.804
#> GSM152073     1  0.5397     0.5728 0.720 0.000 0.280
#> GSM152078     1  0.6204     0.2590 0.576 0.000 0.424
#> GSM152082     3  0.6204     0.2664 0.424 0.000 0.576
#> GSM152086     1  0.0424     0.8452 0.992 0.000 0.008
#> GSM152090     1  0.4465     0.7010 0.820 0.004 0.176
#> GSM152092     1  0.5835     0.4708 0.660 0.000 0.340
#> GSM152093     1  0.0424     0.8452 0.992 0.000 0.008
#> GSM152094     1  0.0000     0.8443 1.000 0.000 0.000
#> GSM152098     3  0.6274     0.1660 0.456 0.000 0.544
#> GSM152110     1  0.0237     0.8444 0.996 0.000 0.004
#> GSM152031     1  0.5706     0.5100 0.680 0.000 0.320
#> GSM152037     1  0.0424     0.8452 0.992 0.000 0.008
#> GSM152055     1  0.2318     0.8137 0.944 0.028 0.028
#> GSM152061     1  0.2187     0.8175 0.948 0.028 0.024
#> GSM152064     1  0.2187     0.8159 0.948 0.024 0.028
#> GSM152087     1  0.0237     0.8449 0.996 0.000 0.004
#> GSM152103     1  0.3482     0.7684 0.872 0.000 0.128

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.2803     0.6907 0.008 0.012 0.900 0.080
#> GSM152033     3  0.3326     0.7161 0.008 0.004 0.856 0.132
#> GSM152063     2  0.0336     0.8684 0.000 0.992 0.000 0.008
#> GSM152074     3  0.2660     0.6926 0.008 0.012 0.908 0.072
#> GSM152080     2  0.4907     0.7417 0.000 0.764 0.176 0.060
#> GSM152081     4  0.8285     0.7888 0.128 0.172 0.128 0.572
#> GSM152083     2  0.6100     0.5610 0.000 0.624 0.304 0.072
#> GSM152091     2  0.3239     0.8288 0.000 0.880 0.068 0.052
#> GSM152108     2  0.6157     0.6852 0.084 0.732 0.136 0.048
#> GSM152114     1  0.7362    -0.2103 0.444 0.000 0.160 0.396
#> GSM152035     2  0.2983     0.8343 0.000 0.892 0.068 0.040
#> GSM152039     4  0.5935     0.8078 0.080 0.256 0.000 0.664
#> GSM152041     4  0.6363     0.7956 0.172 0.172 0.000 0.656
#> GSM152044     2  0.0336     0.8684 0.000 0.992 0.000 0.008
#> GSM152045     3  0.5839     0.6135 0.044 0.000 0.604 0.352
#> GSM152051     2  0.0188     0.8737 0.000 0.996 0.004 0.000
#> GSM152054     3  0.5468     0.6182 0.012 0.008 0.616 0.364
#> GSM152057     2  0.0188     0.8737 0.000 0.996 0.004 0.000
#> GSM152058     1  0.1398     0.8310 0.956 0.000 0.040 0.004
#> GSM152067     3  0.4303     0.6973 0.008 0.004 0.768 0.220
#> GSM152068     2  0.0188     0.8737 0.000 0.996 0.004 0.000
#> GSM152075     4  0.6315     0.8194 0.128 0.184 0.008 0.680
#> GSM152076     4  0.5873     0.8093 0.076 0.256 0.000 0.668
#> GSM152079     2  0.0188     0.8737 0.000 0.996 0.004 0.000
#> GSM152084     3  0.7391     0.1977 0.156 0.012 0.556 0.276
#> GSM152089     4  0.4824     0.6032 0.084 0.024 0.080 0.812
#> GSM152095     4  0.5873     0.8093 0.076 0.256 0.000 0.668
#> GSM152096     2  0.6089     0.5284 0.000 0.608 0.328 0.064
#> GSM152097     2  0.1302     0.8428 0.000 0.956 0.000 0.044
#> GSM152099     2  0.0188     0.8737 0.000 0.996 0.004 0.000
#> GSM152106     2  0.1302     0.8428 0.000 0.956 0.000 0.044
#> GSM152107     3  0.6380     0.1759 0.012 0.048 0.576 0.364
#> GSM152109     3  0.2473     0.7030 0.000 0.012 0.908 0.080
#> GSM152111     1  0.0672     0.8323 0.984 0.000 0.008 0.008
#> GSM152112     4  0.4690     0.0791 0.000 0.012 0.276 0.712
#> GSM152113     3  0.2983     0.7128 0.016 0.012 0.896 0.076
#> GSM152115     3  0.4718     0.6836 0.008 0.004 0.716 0.272
#> GSM152030     4  0.8274     0.7854 0.120 0.176 0.132 0.572
#> GSM152038     3  0.2271     0.7164 0.008 0.000 0.916 0.076
#> GSM152042     4  0.8281     0.7830 0.120 0.172 0.136 0.572
#> GSM152062     3  0.2438     0.6997 0.016 0.012 0.924 0.048
#> GSM152077     1  0.4008     0.7713 0.820 0.000 0.148 0.032
#> GSM152088     2  0.1724     0.8596 0.000 0.948 0.032 0.020
#> GSM152100     4  0.5753     0.8120 0.072 0.248 0.000 0.680
#> GSM152102     3  0.7686     0.2958 0.000 0.336 0.436 0.228
#> GSM152104     2  0.0469     0.8657 0.000 0.988 0.000 0.012
#> GSM152028     1  0.4552     0.7570 0.800 0.000 0.128 0.072
#> GSM152029     1  0.5966     0.5572 0.648 0.000 0.280 0.072
#> GSM152049     1  0.0469     0.8320 0.988 0.000 0.000 0.012
#> GSM152053     4  0.8275     0.7755 0.112 0.168 0.148 0.572
#> GSM152059     1  0.3071     0.8178 0.888 0.000 0.068 0.044
#> GSM152085     1  0.1389     0.8259 0.952 0.000 0.000 0.048
#> GSM152101     3  0.4718     0.6854 0.008 0.004 0.716 0.272
#> GSM152105     1  0.4535     0.7146 0.744 0.000 0.240 0.016
#> GSM152034     1  0.4053     0.7013 0.768 0.000 0.004 0.228
#> GSM152036     4  0.5880     0.8132 0.088 0.232 0.000 0.680
#> GSM152040     1  0.6594     0.4927 0.620 0.000 0.140 0.240
#> GSM152043     1  0.2919     0.8193 0.896 0.000 0.060 0.044
#> GSM152046     1  0.3982     0.7102 0.776 0.000 0.004 0.220
#> GSM152047     1  0.3278     0.7985 0.864 0.000 0.020 0.116
#> GSM152048     1  0.1489     0.8308 0.952 0.000 0.044 0.004
#> GSM152050     1  0.0657     0.8320 0.984 0.000 0.004 0.012
#> GSM152052     1  0.3249     0.7955 0.852 0.000 0.140 0.008
#> GSM152056     1  0.1109     0.8326 0.968 0.000 0.028 0.004
#> GSM152060     1  0.4053     0.7013 0.768 0.000 0.004 0.228
#> GSM152065     3  0.5593     0.6796 0.080 0.000 0.708 0.212
#> GSM152066     1  0.1004     0.8330 0.972 0.000 0.024 0.004
#> GSM152069     3  0.2402     0.7045 0.000 0.012 0.912 0.076
#> GSM152070     3  0.7756     0.3768 0.328 0.000 0.424 0.248
#> GSM152071     3  0.2402     0.7045 0.000 0.012 0.912 0.076
#> GSM152072     3  0.5889     0.6724 0.100 0.000 0.688 0.212
#> GSM152073     1  0.3090     0.8159 0.888 0.000 0.056 0.056
#> GSM152078     1  0.5300     0.5981 0.664 0.000 0.308 0.028
#> GSM152082     3  0.7561     0.3199 0.348 0.000 0.452 0.200
#> GSM152086     1  0.0657     0.8330 0.984 0.000 0.012 0.004
#> GSM152090     1  0.5082     0.6627 0.720 0.004 0.248 0.028
#> GSM152092     1  0.4599     0.7580 0.800 0.000 0.112 0.088
#> GSM152093     1  0.1975     0.8271 0.936 0.000 0.048 0.016
#> GSM152094     1  0.1211     0.8271 0.960 0.000 0.000 0.040
#> GSM152098     3  0.7745     0.2725 0.372 0.000 0.396 0.232
#> GSM152110     1  0.0927     0.8325 0.976 0.000 0.016 0.008
#> GSM152031     1  0.3647     0.7890 0.832 0.000 0.152 0.016
#> GSM152037     1  0.1305     0.8326 0.960 0.000 0.036 0.004
#> GSM152055     1  0.4040     0.6662 0.752 0.000 0.000 0.248
#> GSM152061     1  0.4053     0.7013 0.768 0.000 0.004 0.228
#> GSM152064     1  0.3942     0.6905 0.764 0.000 0.000 0.236
#> GSM152087     1  0.1489     0.8276 0.952 0.000 0.004 0.044
#> GSM152103     1  0.4885     0.6731 0.728 0.004 0.248 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
#> GSM152032     3  0.1739     0.5976 0.000 0.024 0.940 0.004 0.032
#> GSM152033     3  0.5156     0.2050 0.016 0.008 0.572 0.008 0.396
#> GSM152063     2  0.1478     0.8577 0.000 0.936 0.000 0.064 0.000
#> GSM152074     3  0.2544     0.5899 0.000 0.028 0.900 0.008 0.064
#> GSM152080     2  0.4447     0.7073 0.000 0.800 0.080 0.048 0.072
#> GSM152081     4  0.5090     0.6745 0.036 0.040 0.212 0.712 0.000
#> GSM152083     2  0.5893     0.0471 0.000 0.468 0.456 0.016 0.060
#> GSM152091     2  0.3003     0.7757 0.000 0.880 0.016 0.040 0.064
#> GSM152108     2  0.8057     0.0189 0.068 0.396 0.356 0.024 0.156
#> GSM152114     4  0.7781     0.1016 0.332 0.004 0.240 0.372 0.052
#> GSM152035     2  0.4943     0.7192 0.000 0.764 0.100 0.048 0.088
#> GSM152039     4  0.2692     0.7603 0.016 0.092 0.000 0.884 0.008
#> GSM152041     4  0.2464     0.7579 0.048 0.044 0.004 0.904 0.000
#> GSM152044     2  0.1638     0.8571 0.000 0.932 0.000 0.064 0.004
#> GSM152045     5  0.5677     0.5549 0.068 0.000 0.172 0.064 0.696
#> GSM152051     2  0.1410     0.8589 0.000 0.940 0.000 0.060 0.000
#> GSM152054     5  0.5715     0.4465 0.004 0.016 0.208 0.104 0.668
#> GSM152057     2  0.1410     0.8589 0.000 0.940 0.000 0.060 0.000
#> GSM152058     1  0.4160     0.7187 0.816 0.000 0.084 0.036 0.064
#> GSM152067     5  0.5170     0.1949 0.004 0.000 0.440 0.032 0.524
#> GSM152068     2  0.1410     0.8589 0.000 0.940 0.000 0.060 0.000
#> GSM152075     4  0.2627     0.7598 0.044 0.044 0.012 0.900 0.000
#> GSM152076     4  0.2727     0.7619 0.016 0.092 0.004 0.884 0.004
#> GSM152079     2  0.1410     0.8589 0.000 0.940 0.000 0.060 0.000
#> GSM152084     3  0.4874     0.4699 0.072 0.008 0.736 0.180 0.004
#> GSM152089     4  0.4915     0.6066 0.052 0.004 0.024 0.744 0.176
#> GSM152095     4  0.2727     0.7619 0.016 0.092 0.004 0.884 0.004
#> GSM152096     3  0.5639     0.0634 0.000 0.400 0.536 0.012 0.052
#> GSM152097     2  0.2616     0.8328 0.000 0.880 0.000 0.100 0.020
#> GSM152099     2  0.1410     0.8589 0.000 0.940 0.000 0.060 0.000
#> GSM152106     2  0.2761     0.8291 0.000 0.872 0.000 0.104 0.024
#> GSM152107     3  0.5267    -0.1571 0.000 0.016 0.492 0.472 0.020
#> GSM152109     3  0.5149     0.4463 0.000 0.044 0.696 0.028 0.232
#> GSM152111     1  0.1153     0.7273 0.964 0.000 0.004 0.024 0.008
#> GSM152112     4  0.6225     0.1350 0.000 0.004 0.136 0.516 0.344
#> GSM152113     3  0.4484     0.4575 0.044 0.000 0.752 0.012 0.192
#> GSM152115     5  0.4988     0.3346 0.004 0.000 0.416 0.024 0.556
#> GSM152030     4  0.5374     0.6518 0.044 0.040 0.232 0.684 0.000
#> GSM152038     3  0.3320     0.5512 0.008 0.000 0.828 0.012 0.152
#> GSM152042     4  0.5385     0.6549 0.036 0.040 0.232 0.688 0.004
#> GSM152062     3  0.2157     0.5907 0.016 0.004 0.928 0.028 0.024
#> GSM152077     1  0.6530     0.4375 0.524 0.000 0.340 0.032 0.104
#> GSM152088     2  0.0968     0.8273 0.000 0.972 0.004 0.012 0.012
#> GSM152100     4  0.2645     0.7605 0.008 0.096 0.012 0.884 0.000
#> GSM152102     5  0.6424     0.3031 0.000 0.200 0.156 0.036 0.608
#> GSM152104     2  0.2362     0.8472 0.000 0.900 0.000 0.076 0.024
#> GSM152028     1  0.6307     0.5681 0.596 0.000 0.160 0.020 0.224
#> GSM152029     1  0.6509     0.3835 0.592 0.008 0.176 0.016 0.208
#> GSM152049     1  0.1686     0.7272 0.944 0.000 0.008 0.020 0.028
#> GSM152053     4  0.5159     0.6484 0.028 0.040 0.244 0.688 0.000
#> GSM152059     1  0.2621     0.6914 0.876 0.000 0.008 0.004 0.112
#> GSM152085     1  0.2540     0.7000 0.888 0.000 0.000 0.024 0.088
#> GSM152101     5  0.4813     0.3759 0.004 0.000 0.376 0.020 0.600
#> GSM152105     1  0.6375     0.5405 0.568 0.000 0.292 0.028 0.112
#> GSM152034     1  0.5082     0.5597 0.684 0.000 0.000 0.220 0.096
#> GSM152036     4  0.2518     0.7585 0.016 0.080 0.000 0.896 0.008
#> GSM152040     5  0.4872     0.1374 0.436 0.000 0.000 0.024 0.540
#> GSM152043     1  0.3124     0.6783 0.844 0.000 0.016 0.004 0.136
#> GSM152046     1  0.5073     0.5695 0.688 0.000 0.000 0.212 0.100
#> GSM152047     1  0.4069     0.6464 0.788 0.000 0.000 0.076 0.136
#> GSM152048     1  0.4160     0.7187 0.816 0.000 0.084 0.036 0.064
#> GSM152050     1  0.1243     0.7271 0.960 0.000 0.004 0.028 0.008
#> GSM152052     1  0.5508     0.6440 0.688 0.004 0.216 0.028 0.064
#> GSM152056     1  0.4039     0.7208 0.824 0.000 0.080 0.036 0.060
#> GSM152060     1  0.5130     0.5590 0.680 0.000 0.000 0.220 0.100
#> GSM152065     5  0.3988     0.5271 0.036 0.000 0.196 0.000 0.768
#> GSM152066     1  0.3973     0.7208 0.828 0.000 0.080 0.036 0.056
#> GSM152069     3  0.5302     0.4459 0.004 0.044 0.692 0.028 0.232
#> GSM152070     5  0.4860     0.5379 0.228 0.000 0.064 0.004 0.704
#> GSM152071     3  0.5302     0.4459 0.004 0.044 0.692 0.028 0.232
#> GSM152072     5  0.5077     0.5572 0.088 0.000 0.212 0.004 0.696
#> GSM152073     1  0.2439     0.6910 0.876 0.000 0.000 0.004 0.120
#> GSM152078     1  0.6695     0.5374 0.560 0.004 0.264 0.028 0.144
#> GSM152082     5  0.5405     0.4994 0.272 0.000 0.084 0.004 0.640
#> GSM152086     1  0.1507     0.7306 0.952 0.000 0.012 0.024 0.012
#> GSM152090     1  0.5123     0.4922 0.600 0.008 0.364 0.024 0.004
#> GSM152092     1  0.6299     0.5647 0.588 0.000 0.164 0.016 0.232
#> GSM152093     1  0.4204     0.7165 0.812 0.000 0.096 0.040 0.052
#> GSM152094     1  0.2006     0.7073 0.916 0.000 0.000 0.012 0.072
#> GSM152098     5  0.5333     0.4922 0.300 0.000 0.068 0.004 0.628
#> GSM152110     1  0.3947     0.7252 0.832 0.000 0.064 0.044 0.060
#> GSM152031     1  0.5982     0.6199 0.640 0.000 0.212 0.024 0.124
#> GSM152037     1  0.4103     0.7199 0.820 0.000 0.080 0.036 0.064
#> GSM152055     1  0.5254     0.5232 0.644 0.000 0.000 0.272 0.084
#> GSM152061     1  0.5130     0.5590 0.680 0.000 0.000 0.220 0.100
#> GSM152064     1  0.5110     0.5677 0.680 0.000 0.000 0.224 0.096
#> GSM152087     1  0.1956     0.7050 0.916 0.000 0.000 0.008 0.076
#> GSM152103     1  0.5313     0.4508 0.568 0.008 0.392 0.024 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
#> GSM152032     3  0.0665     0.5614 0.000 0.000 0.980 0.004 0.008 0.008
#> GSM152033     3  0.6545     0.2592 0.092 0.000 0.484 0.004 0.332 0.088
#> GSM152063     2  0.1007     0.9014 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM152074     3  0.2942     0.5444 0.004 0.000 0.856 0.004 0.036 0.100
#> GSM152080     2  0.5779     0.6092 0.000 0.668 0.100 0.028 0.048 0.156
#> GSM152081     4  0.4956     0.6844 0.052 0.000 0.236 0.680 0.012 0.020
#> GSM152083     3  0.5812     0.3017 0.000 0.308 0.572 0.012 0.032 0.076
#> GSM152091     2  0.3688     0.7821 0.000 0.820 0.008 0.020 0.048 0.104
#> GSM152108     3  0.8859     0.3532 0.288 0.168 0.312 0.028 0.100 0.104
#> GSM152114     1  0.5496     0.2004 0.592 0.000 0.160 0.240 0.000 0.008
#> GSM152035     2  0.5639     0.6355 0.000 0.680 0.076 0.012 0.108 0.124
#> GSM152039     4  0.2001     0.7844 0.012 0.028 0.000 0.924 0.004 0.032
#> GSM152041     4  0.1554     0.7848 0.044 0.004 0.004 0.940 0.000 0.008
#> GSM152044     2  0.1007     0.9014 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM152045     5  0.3306     0.6215 0.000 0.000 0.052 0.020 0.840 0.088
#> GSM152051     2  0.1010     0.9010 0.000 0.960 0.004 0.036 0.000 0.000
#> GSM152054     5  0.3744     0.5447 0.004 0.004 0.076 0.040 0.828 0.048
#> GSM152057     2  0.1226     0.9014 0.000 0.952 0.004 0.040 0.000 0.004
#> GSM152058     1  0.0405     0.5037 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM152067     5  0.5518     0.2807 0.000 0.000 0.308 0.012 0.564 0.116
#> GSM152068     2  0.1082     0.9018 0.000 0.956 0.004 0.040 0.000 0.000
#> GSM152075     4  0.1608     0.7864 0.036 0.004 0.016 0.940 0.004 0.000
#> GSM152076     4  0.2001     0.7844 0.012 0.028 0.000 0.924 0.004 0.032
#> GSM152079     2  0.1082     0.9018 0.000 0.956 0.004 0.040 0.000 0.000
#> GSM152084     3  0.5046     0.4838 0.200 0.000 0.676 0.108 0.008 0.008
#> GSM152089     4  0.4934     0.5762 0.008 0.004 0.004 0.696 0.180 0.108
#> GSM152095     4  0.1857     0.7855 0.012 0.028 0.000 0.928 0.000 0.032
#> GSM152096     3  0.5786     0.3354 0.020 0.320 0.580 0.008 0.036 0.036
#> GSM152097     2  0.3117     0.8431 0.000 0.848 0.000 0.100 0.020 0.032
#> GSM152099     2  0.1082     0.9018 0.000 0.956 0.004 0.040 0.000 0.000
#> GSM152106     2  0.3483     0.8256 0.000 0.820 0.000 0.120 0.020 0.040
#> GSM152107     4  0.5526     0.2767 0.008 0.000 0.440 0.472 0.068 0.012
#> GSM152109     3  0.5930     0.3903 0.004 0.024 0.628 0.016 0.172 0.156
#> GSM152111     1  0.3619    -0.1461 0.680 0.000 0.000 0.004 0.000 0.316
#> GSM152112     5  0.5241     0.1022 0.000 0.000 0.072 0.420 0.500 0.008
#> GSM152113     3  0.6591     0.4467 0.288 0.000 0.536 0.032 0.080 0.064
#> GSM152115     5  0.3702     0.4916 0.000 0.000 0.264 0.004 0.720 0.012
#> GSM152030     4  0.5363     0.6488 0.080 0.000 0.244 0.644 0.012 0.020
#> GSM152038     3  0.5091     0.5375 0.128 0.004 0.728 0.008 0.056 0.076
#> GSM152042     4  0.4895     0.6759 0.048 0.000 0.252 0.672 0.008 0.020
#> GSM152062     3  0.3851     0.5608 0.120 0.000 0.808 0.032 0.012 0.028
#> GSM152077     1  0.6109     0.0788 0.576 0.000 0.284 0.032 0.036 0.072
#> GSM152088     2  0.1457     0.8639 0.000 0.948 0.004 0.016 0.004 0.028
#> GSM152100     4  0.1363     0.7868 0.004 0.028 0.004 0.952 0.012 0.000
#> GSM152102     5  0.5551     0.4067 0.000 0.120 0.072 0.012 0.688 0.108
#> GSM152104     2  0.2283     0.8869 0.000 0.904 0.000 0.056 0.020 0.020
#> GSM152028     1  0.5626     0.3927 0.660 0.004 0.072 0.000 0.092 0.172
#> GSM152029     6  0.6483     0.2152 0.208 0.004 0.120 0.000 0.104 0.564
#> GSM152049     1  0.3584    -0.1188 0.688 0.000 0.000 0.004 0.000 0.308
#> GSM152053     4  0.4967     0.6766 0.048 0.000 0.248 0.672 0.012 0.020
#> GSM152059     6  0.4594     0.4018 0.468 0.004 0.004 0.000 0.020 0.504
#> GSM152085     1  0.4184    -0.4390 0.556 0.000 0.000 0.004 0.008 0.432
#> GSM152101     5  0.3314     0.5162 0.000 0.000 0.224 0.000 0.764 0.012
#> GSM152105     1  0.4663     0.3877 0.672 0.000 0.244 0.004 0.000 0.080
#> GSM152034     6  0.6066     0.6638 0.376 0.000 0.000 0.148 0.020 0.456
#> GSM152036     4  0.2014     0.7855 0.016 0.024 0.000 0.924 0.004 0.032
#> GSM152040     5  0.5329     0.3622 0.096 0.004 0.000 0.000 0.520 0.380
#> GSM152043     6  0.4836     0.3937 0.440 0.004 0.004 0.000 0.036 0.516
#> GSM152046     6  0.6014     0.6634 0.376 0.000 0.000 0.140 0.020 0.464
#> GSM152047     6  0.5095     0.5367 0.352 0.000 0.000 0.016 0.056 0.576
#> GSM152048     1  0.0405     0.5037 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM152050     1  0.3636    -0.1580 0.676 0.000 0.000 0.004 0.000 0.320
#> GSM152052     1  0.3088     0.4985 0.832 0.000 0.120 0.000 0.000 0.048
#> GSM152056     1  0.0692     0.4971 0.976 0.000 0.000 0.004 0.000 0.020
#> GSM152060     6  0.6095     0.6619 0.380 0.000 0.000 0.152 0.020 0.448
#> GSM152065     5  0.4836     0.5619 0.088 0.000 0.080 0.000 0.736 0.096
#> GSM152066     1  0.0790     0.4917 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM152069     3  0.5930     0.3903 0.004 0.024 0.628 0.016 0.172 0.156
#> GSM152070     5  0.4556     0.5708 0.036 0.004 0.004 0.000 0.636 0.320
#> GSM152071     3  0.5930     0.3903 0.004 0.024 0.628 0.016 0.172 0.156
#> GSM152072     5  0.3840     0.6107 0.008 0.000 0.076 0.004 0.796 0.116
#> GSM152073     6  0.4466     0.4056 0.476 0.004 0.000 0.000 0.020 0.500
#> GSM152078     1  0.5303     0.4285 0.664 0.004 0.140 0.000 0.020 0.172
#> GSM152082     5  0.5563     0.4951 0.080 0.004 0.016 0.000 0.524 0.376
#> GSM152086     1  0.3052     0.1516 0.780 0.000 0.000 0.004 0.000 0.216
#> GSM152090     1  0.4892     0.3786 0.644 0.000 0.280 0.004 0.008 0.064
#> GSM152092     1  0.6227     0.2798 0.560 0.004 0.060 0.000 0.116 0.260
#> GSM152093     1  0.2112     0.4970 0.916 0.000 0.036 0.020 0.000 0.028
#> GSM152094     1  0.3966    -0.4006 0.552 0.000 0.000 0.000 0.004 0.444
#> GSM152098     5  0.5232     0.4943 0.076 0.004 0.004 0.000 0.548 0.368
#> GSM152110     1  0.1320     0.4875 0.948 0.000 0.000 0.016 0.000 0.036
#> GSM152031     1  0.4553     0.4507 0.720 0.004 0.104 0.000 0.004 0.168
#> GSM152037     1  0.0146     0.5066 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM152055     6  0.6250     0.6098 0.396 0.000 0.000 0.180 0.020 0.404
#> GSM152061     6  0.6095     0.6619 0.380 0.000 0.000 0.152 0.020 0.448
#> GSM152064     6  0.6103     0.6296 0.400 0.000 0.000 0.164 0.016 0.420
#> GSM152087     1  0.4253    -0.4365 0.524 0.000 0.000 0.000 0.016 0.460
#> GSM152103     1  0.5109     0.3850 0.608 0.000 0.308 0.004 0.008 0.072

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 specimen(p) k
#> CV:kmeans 66    1.08e-08 2
#> CV:kmeans 67    5.25e-05 3
#> CV:kmeans 79    2.94e-06 4
#> CV:kmeans 64    1.32e-06 5
#> CV:kmeans 46    1.40e-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.


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 10612 rows and 88 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 1.000           0.959       0.983         0.5053 0.495   0.495
#> 3 3 0.746           0.851       0.920         0.3182 0.742   0.524
#> 4 4 0.647           0.744       0.849         0.1161 0.878   0.659
#> 5 5 0.690           0.590       0.766         0.0795 0.857   0.525
#> 6 6 0.715           0.603       0.768         0.0404 0.920   0.633

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
#> GSM152032     2  0.0000      0.991 0.000 1.000
#> GSM152033     2  0.1633      0.968 0.024 0.976
#> GSM152063     2  0.0000      0.991 0.000 1.000
#> GSM152074     2  0.0000      0.991 0.000 1.000
#> GSM152080     2  0.0000      0.991 0.000 1.000
#> GSM152081     2  0.0000      0.991 0.000 1.000
#> GSM152083     2  0.0000      0.991 0.000 1.000
#> GSM152091     2  0.0000      0.991 0.000 1.000
#> GSM152108     2  0.0000      0.991 0.000 1.000
#> GSM152114     1  0.8763      0.595 0.704 0.296
#> GSM152035     2  0.0000      0.991 0.000 1.000
#> GSM152039     2  0.0000      0.991 0.000 1.000
#> GSM152041     1  0.9491      0.438 0.632 0.368
#> GSM152044     2  0.0000      0.991 0.000 1.000
#> GSM152045     2  0.9286      0.461 0.344 0.656
#> GSM152051     2  0.0000      0.991 0.000 1.000
#> GSM152054     2  0.0000      0.991 0.000 1.000
#> GSM152057     2  0.0000      0.991 0.000 1.000
#> GSM152058     1  0.0000      0.973 1.000 0.000
#> GSM152067     2  0.0000      0.991 0.000 1.000
#> GSM152068     2  0.0000      0.991 0.000 1.000
#> GSM152075     2  0.0000      0.991 0.000 1.000
#> GSM152076     2  0.0000      0.991 0.000 1.000
#> GSM152079     2  0.0000      0.991 0.000 1.000
#> GSM152084     2  0.0000      0.991 0.000 1.000
#> GSM152089     2  0.0000      0.991 0.000 1.000
#> GSM152095     2  0.0000      0.991 0.000 1.000
#> GSM152096     2  0.0000      0.991 0.000 1.000
#> GSM152097     2  0.0000      0.991 0.000 1.000
#> GSM152099     2  0.0000      0.991 0.000 1.000
#> GSM152106     2  0.0000      0.991 0.000 1.000
#> GSM152107     2  0.0000      0.991 0.000 1.000
#> GSM152109     2  0.0000      0.991 0.000 1.000
#> GSM152111     1  0.0000      0.973 1.000 0.000
#> GSM152112     2  0.0000      0.991 0.000 1.000
#> GSM152113     2  0.0000      0.991 0.000 1.000
#> GSM152115     2  0.0000      0.991 0.000 1.000
#> GSM152030     2  0.0000      0.991 0.000 1.000
#> GSM152038     1  0.0000      0.973 1.000 0.000
#> GSM152042     2  0.0000      0.991 0.000 1.000
#> GSM152062     2  0.0000      0.991 0.000 1.000
#> GSM152077     1  0.0000      0.973 1.000 0.000
#> GSM152088     2  0.0000      0.991 0.000 1.000
#> GSM152100     2  0.0000      0.991 0.000 1.000
#> GSM152102     2  0.0000      0.991 0.000 1.000
#> GSM152104     2  0.0000      0.991 0.000 1.000
#> GSM152028     1  0.0000      0.973 1.000 0.000
#> GSM152029     1  0.0000      0.973 1.000 0.000
#> GSM152049     1  0.0000      0.973 1.000 0.000
#> GSM152053     2  0.0000      0.991 0.000 1.000
#> GSM152059     1  0.0000      0.973 1.000 0.000
#> GSM152085     1  0.0000      0.973 1.000 0.000
#> GSM152101     2  0.0000      0.991 0.000 1.000
#> GSM152105     1  0.0000      0.973 1.000 0.000
#> GSM152034     1  0.0000      0.973 1.000 0.000
#> GSM152036     2  0.0000      0.991 0.000 1.000
#> GSM152040     1  0.0000      0.973 1.000 0.000
#> GSM152043     1  0.0000      0.973 1.000 0.000
#> GSM152046     1  0.0000      0.973 1.000 0.000
#> GSM152047     1  0.0000      0.973 1.000 0.000
#> GSM152048     1  0.0000      0.973 1.000 0.000
#> GSM152050     1  0.0000      0.973 1.000 0.000
#> GSM152052     1  0.0000      0.973 1.000 0.000
#> GSM152056     1  0.0000      0.973 1.000 0.000
#> GSM152060     1  0.0000      0.973 1.000 0.000
#> GSM152065     1  0.0000      0.973 1.000 0.000
#> GSM152066     1  0.0000      0.973 1.000 0.000
#> GSM152069     2  0.0000      0.991 0.000 1.000
#> GSM152070     1  0.0000      0.973 1.000 0.000
#> GSM152071     2  0.1843      0.963 0.028 0.972
#> GSM152072     1  0.8661      0.599 0.712 0.288
#> GSM152073     1  0.0000      0.973 1.000 0.000
#> GSM152078     1  0.0000      0.973 1.000 0.000
#> GSM152082     1  0.0000      0.973 1.000 0.000
#> GSM152086     1  0.0000      0.973 1.000 0.000
#> GSM152090     1  0.6623      0.789 0.828 0.172
#> GSM152092     1  0.0000      0.973 1.000 0.000
#> GSM152093     1  0.0000      0.973 1.000 0.000
#> GSM152094     1  0.0000      0.973 1.000 0.000
#> GSM152098     1  0.0000      0.973 1.000 0.000
#> GSM152110     1  0.0000      0.973 1.000 0.000
#> GSM152031     1  0.0000      0.973 1.000 0.000
#> GSM152037     1  0.0000      0.973 1.000 0.000
#> GSM152055     1  0.0000      0.973 1.000 0.000
#> GSM152061     1  0.0000      0.973 1.000 0.000
#> GSM152064     1  0.0000      0.973 1.000 0.000
#> GSM152087     1  0.0000      0.973 1.000 0.000
#> GSM152103     1  0.0376      0.969 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
#> GSM152032     3  0.0892      0.827 0.000 0.020 0.980
#> GSM152033     3  0.1529      0.825 0.000 0.040 0.960
#> GSM152063     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152074     3  0.0892      0.827 0.000 0.020 0.980
#> GSM152080     3  0.5363      0.649 0.000 0.276 0.724
#> GSM152081     2  0.4682      0.811 0.004 0.804 0.192
#> GSM152083     3  0.2261      0.814 0.000 0.068 0.932
#> GSM152091     2  0.2066      0.904 0.000 0.940 0.060
#> GSM152108     2  0.1643      0.916 0.000 0.956 0.044
#> GSM152114     1  0.7772      0.573 0.672 0.132 0.196
#> GSM152035     2  0.1964      0.907 0.000 0.944 0.056
#> GSM152039     2  0.1529      0.927 0.000 0.960 0.040
#> GSM152041     2  0.2269      0.922 0.016 0.944 0.040
#> GSM152044     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152045     3  0.4062      0.773 0.164 0.000 0.836
#> GSM152051     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152054     3  0.4178      0.743 0.000 0.172 0.828
#> GSM152057     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152058     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152067     3  0.0237      0.823 0.000 0.004 0.996
#> GSM152068     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152075     2  0.1765      0.926 0.004 0.956 0.040
#> GSM152076     2  0.1529      0.927 0.000 0.960 0.040
#> GSM152079     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152084     3  0.1411      0.809 0.000 0.036 0.964
#> GSM152089     2  0.2959      0.896 0.000 0.900 0.100
#> GSM152095     2  0.1529      0.927 0.000 0.960 0.040
#> GSM152096     3  0.4842      0.710 0.000 0.224 0.776
#> GSM152097     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152099     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152106     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152107     3  0.6008      0.202 0.000 0.372 0.628
#> GSM152109     3  0.1031      0.827 0.000 0.024 0.976
#> GSM152111     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152112     2  0.5678      0.573 0.000 0.684 0.316
#> GSM152113     3  0.1411      0.826 0.000 0.036 0.964
#> GSM152115     3  0.0237      0.823 0.000 0.004 0.996
#> GSM152030     2  0.4733      0.808 0.004 0.800 0.196
#> GSM152038     3  0.0424      0.826 0.008 0.000 0.992
#> GSM152042     2  0.4682      0.811 0.004 0.804 0.192
#> GSM152062     3  0.0237      0.823 0.000 0.004 0.996
#> GSM152077     1  0.2165      0.904 0.936 0.000 0.064
#> GSM152088     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152100     2  0.1529      0.927 0.000 0.960 0.040
#> GSM152102     3  0.4504      0.735 0.000 0.196 0.804
#> GSM152104     2  0.0237      0.934 0.000 0.996 0.004
#> GSM152028     1  0.1289      0.933 0.968 0.000 0.032
#> GSM152029     3  0.6111      0.490 0.396 0.000 0.604
#> GSM152049     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152053     2  0.4733      0.808 0.004 0.800 0.196
#> GSM152059     1  0.0237      0.955 0.996 0.000 0.004
#> GSM152085     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152101     3  0.0237      0.823 0.000 0.004 0.996
#> GSM152105     1  0.2959      0.877 0.900 0.000 0.100
#> GSM152034     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152036     2  0.1765      0.926 0.004 0.956 0.040
#> GSM152040     1  0.4555      0.707 0.800 0.000 0.200
#> GSM152043     1  0.0592      0.950 0.988 0.000 0.012
#> GSM152046     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152047     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152048     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152050     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152052     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152056     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152060     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152065     3  0.4399      0.757 0.188 0.000 0.812
#> GSM152066     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152069     3  0.1529      0.825 0.000 0.040 0.960
#> GSM152070     3  0.5926      0.558 0.356 0.000 0.644
#> GSM152071     3  0.1289      0.827 0.000 0.032 0.968
#> GSM152072     3  0.4452      0.754 0.192 0.000 0.808
#> GSM152073     1  0.0237      0.955 0.996 0.000 0.004
#> GSM152078     3  0.6079      0.502 0.388 0.000 0.612
#> GSM152082     3  0.6062      0.511 0.384 0.000 0.616
#> GSM152086     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152090     1  0.5618      0.746 0.796 0.048 0.156
#> GSM152092     1  0.2959      0.861 0.900 0.000 0.100
#> GSM152093     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152094     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152098     3  0.6062      0.511 0.384 0.000 0.616
#> GSM152110     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152031     1  0.0237      0.955 0.996 0.000 0.004
#> GSM152037     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152055     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152061     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152064     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152087     1  0.0000      0.957 1.000 0.000 0.000
#> GSM152103     1  0.4921      0.767 0.816 0.020 0.164

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.1042     0.7735 0.000 0.020 0.972 0.008
#> GSM152033     3  0.3768     0.7395 0.008 0.120 0.848 0.024
#> GSM152063     2  0.0817     0.9399 0.000 0.976 0.000 0.024
#> GSM152074     3  0.0927     0.7746 0.000 0.016 0.976 0.008
#> GSM152080     2  0.2334     0.8833 0.000 0.908 0.088 0.004
#> GSM152081     4  0.5339     0.8198 0.000 0.100 0.156 0.744
#> GSM152083     2  0.2737     0.8703 0.000 0.888 0.104 0.008
#> GSM152091     2  0.1635     0.9181 0.000 0.948 0.044 0.008
#> GSM152108     2  0.2616     0.9136 0.036 0.920 0.016 0.028
#> GSM152114     4  0.6992     0.5684 0.248 0.000 0.176 0.576
#> GSM152035     2  0.1820     0.9292 0.000 0.944 0.036 0.020
#> GSM152039     4  0.2469     0.8615 0.000 0.108 0.000 0.892
#> GSM152041     4  0.2408     0.8608 0.000 0.104 0.000 0.896
#> GSM152044     2  0.0817     0.9399 0.000 0.976 0.000 0.024
#> GSM152045     3  0.3873     0.6745 0.000 0.000 0.772 0.228
#> GSM152051     2  0.0707     0.9415 0.000 0.980 0.000 0.020
#> GSM152054     3  0.5228     0.6902 0.000 0.120 0.756 0.124
#> GSM152057     2  0.0707     0.9415 0.000 0.980 0.000 0.020
#> GSM152058     1  0.0188     0.8195 0.996 0.000 0.000 0.004
#> GSM152067     3  0.1488     0.7731 0.000 0.012 0.956 0.032
#> GSM152068     2  0.0707     0.9415 0.000 0.980 0.000 0.020
#> GSM152075     4  0.2469     0.8615 0.000 0.108 0.000 0.892
#> GSM152076     4  0.2469     0.8615 0.000 0.108 0.000 0.892
#> GSM152079     2  0.0592     0.9412 0.000 0.984 0.000 0.016
#> GSM152084     3  0.6102    -0.3262 0.012 0.024 0.492 0.472
#> GSM152089     4  0.2282     0.8151 0.000 0.052 0.024 0.924
#> GSM152095     4  0.2469     0.8615 0.000 0.108 0.000 0.892
#> GSM152096     2  0.2466     0.8763 0.000 0.900 0.096 0.004
#> GSM152097     2  0.0817     0.9399 0.000 0.976 0.000 0.024
#> GSM152099     2  0.0707     0.9415 0.000 0.980 0.000 0.020
#> GSM152106     2  0.0817     0.9399 0.000 0.976 0.000 0.024
#> GSM152107     4  0.5793     0.5309 0.000 0.036 0.384 0.580
#> GSM152109     3  0.1004     0.7746 0.000 0.024 0.972 0.004
#> GSM152111     1  0.0469     0.8204 0.988 0.000 0.000 0.012
#> GSM152112     4  0.4104     0.7332 0.000 0.028 0.164 0.808
#> GSM152113     3  0.2861     0.7561 0.004 0.092 0.892 0.012
#> GSM152115     3  0.1576     0.7683 0.000 0.004 0.948 0.048
#> GSM152030     4  0.5369     0.8145 0.000 0.096 0.164 0.740
#> GSM152038     3  0.0469     0.7775 0.000 0.000 0.988 0.012
#> GSM152042     4  0.5427     0.8150 0.000 0.100 0.164 0.736
#> GSM152062     3  0.1174     0.7720 0.000 0.020 0.968 0.012
#> GSM152077     1  0.2131     0.8028 0.932 0.000 0.036 0.032
#> GSM152088     2  0.0000     0.9370 0.000 1.000 0.000 0.000
#> GSM152100     4  0.2469     0.8615 0.000 0.108 0.000 0.892
#> GSM152102     2  0.4574     0.7140 0.000 0.756 0.220 0.024
#> GSM152104     2  0.0817     0.9399 0.000 0.976 0.000 0.024
#> GSM152028     1  0.5543     0.2456 0.612 0.000 0.360 0.028
#> GSM152029     3  0.6521     0.6021 0.256 0.020 0.648 0.076
#> GSM152049     1  0.0469     0.8204 0.988 0.000 0.000 0.012
#> GSM152053     4  0.5412     0.8133 0.000 0.096 0.168 0.736
#> GSM152059     1  0.2053     0.8098 0.924 0.000 0.004 0.072
#> GSM152085     1  0.1867     0.8127 0.928 0.000 0.000 0.072
#> GSM152101     3  0.1489     0.7700 0.000 0.004 0.952 0.044
#> GSM152105     1  0.5355     0.3097 0.620 0.000 0.360 0.020
#> GSM152034     1  0.4454     0.6642 0.692 0.000 0.000 0.308
#> GSM152036     4  0.2408     0.8608 0.000 0.104 0.000 0.896
#> GSM152040     3  0.6875     0.2917 0.388 0.000 0.504 0.108
#> GSM152043     1  0.5850     0.5239 0.676 0.000 0.244 0.080
#> GSM152046     1  0.4406     0.6728 0.700 0.000 0.000 0.300
#> GSM152047     1  0.5489     0.7071 0.700 0.000 0.060 0.240
#> GSM152048     1  0.0188     0.8195 0.996 0.000 0.000 0.004
#> GSM152050     1  0.1118     0.8214 0.964 0.000 0.000 0.036
#> GSM152052     1  0.1396     0.8099 0.960 0.004 0.032 0.004
#> GSM152056     1  0.0188     0.8195 0.996 0.000 0.000 0.004
#> GSM152060     1  0.4454     0.6642 0.692 0.000 0.000 0.308
#> GSM152065     3  0.4290     0.7355 0.164 0.000 0.800 0.036
#> GSM152066     1  0.0188     0.8195 0.996 0.000 0.000 0.004
#> GSM152069     3  0.1109     0.7746 0.000 0.028 0.968 0.004
#> GSM152070     3  0.6167     0.6060 0.256 0.000 0.648 0.096
#> GSM152071     3  0.1004     0.7746 0.000 0.024 0.972 0.004
#> GSM152072     3  0.4152     0.7386 0.160 0.000 0.808 0.032
#> GSM152073     1  0.2329     0.8074 0.916 0.000 0.012 0.072
#> GSM152078     3  0.5751     0.5053 0.352 0.012 0.616 0.020
#> GSM152082     3  0.6167     0.6060 0.256 0.000 0.648 0.096
#> GSM152086     1  0.0000     0.8195 1.000 0.000 0.000 0.000
#> GSM152090     1  0.6094     0.5929 0.692 0.084 0.212 0.012
#> GSM152092     1  0.6537    -0.0611 0.500 0.000 0.424 0.076
#> GSM152093     1  0.1174     0.8151 0.968 0.000 0.012 0.020
#> GSM152094     1  0.1637     0.8135 0.940 0.000 0.000 0.060
#> GSM152098     3  0.6219     0.5938 0.264 0.000 0.640 0.096
#> GSM152110     1  0.1211     0.8181 0.960 0.000 0.000 0.040
#> GSM152031     1  0.4406     0.6420 0.780 0.000 0.192 0.028
#> GSM152037     1  0.0188     0.8195 0.996 0.000 0.000 0.004
#> GSM152055     1  0.4356     0.6559 0.708 0.000 0.000 0.292
#> GSM152061     1  0.4477     0.6597 0.688 0.000 0.000 0.312
#> GSM152064     1  0.4776     0.5611 0.624 0.000 0.000 0.376
#> GSM152087     1  0.1637     0.8135 0.940 0.000 0.000 0.060
#> GSM152103     1  0.4822     0.6529 0.756 0.024 0.212 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
#> GSM152032     3  0.1697    0.66990 0.060 0.008 0.932 0.000 0.000
#> GSM152033     3  0.4645    0.60366 0.376 0.008 0.608 0.008 0.000
#> GSM152063     2  0.0404    0.95586 0.000 0.988 0.000 0.012 0.000
#> GSM152074     3  0.2286    0.67982 0.108 0.004 0.888 0.000 0.000
#> GSM152080     2  0.0609    0.94164 0.000 0.980 0.020 0.000 0.000
#> GSM152081     4  0.2894    0.83014 0.008 0.008 0.124 0.860 0.000
#> GSM152083     2  0.1851    0.89113 0.000 0.912 0.088 0.000 0.000
#> GSM152091     2  0.0000    0.95184 0.000 1.000 0.000 0.000 0.000
#> GSM152108     2  0.1732    0.90233 0.080 0.920 0.000 0.000 0.000
#> GSM152114     1  0.7047    0.38673 0.508 0.000 0.052 0.300 0.140
#> GSM152035     2  0.0290    0.95474 0.000 0.992 0.000 0.008 0.000
#> GSM152039     4  0.0290    0.87423 0.000 0.008 0.000 0.992 0.000
#> GSM152041     4  0.0290    0.87423 0.000 0.008 0.000 0.992 0.000
#> GSM152044     2  0.0404    0.95586 0.000 0.988 0.000 0.012 0.000
#> GSM152045     3  0.7419    0.50028 0.296 0.004 0.496 0.116 0.088
#> GSM152051     2  0.0404    0.95586 0.000 0.988 0.000 0.012 0.000
#> GSM152054     3  0.7338    0.56400 0.288 0.080 0.516 0.108 0.008
#> GSM152057     2  0.0404    0.95586 0.000 0.988 0.000 0.012 0.000
#> GSM152058     1  0.4242    0.59158 0.572 0.000 0.000 0.000 0.428
#> GSM152067     3  0.3205    0.67509 0.176 0.004 0.816 0.004 0.000
#> GSM152068     2  0.0404    0.95586 0.000 0.988 0.000 0.012 0.000
#> GSM152075     4  0.0290    0.87423 0.000 0.008 0.000 0.992 0.000
#> GSM152076     4  0.0290    0.87423 0.000 0.008 0.000 0.992 0.000
#> GSM152079     2  0.0404    0.95586 0.000 0.988 0.000 0.012 0.000
#> GSM152084     3  0.5592    0.20145 0.084 0.004 0.600 0.312 0.000
#> GSM152089     4  0.4237    0.74669 0.076 0.012 0.052 0.824 0.036
#> GSM152095     4  0.0290    0.87423 0.000 0.008 0.000 0.992 0.000
#> GSM152096     2  0.1478    0.91371 0.000 0.936 0.064 0.000 0.000
#> GSM152097     2  0.0703    0.95037 0.000 0.976 0.000 0.024 0.000
#> GSM152099     2  0.0404    0.95586 0.000 0.988 0.000 0.012 0.000
#> GSM152106     2  0.0963    0.94290 0.000 0.964 0.000 0.036 0.000
#> GSM152107     4  0.4640    0.42661 0.016 0.000 0.400 0.584 0.000
#> GSM152109     3  0.0451    0.68298 0.004 0.008 0.988 0.000 0.000
#> GSM152111     5  0.3607    0.16622 0.244 0.000 0.000 0.004 0.752
#> GSM152112     4  0.5070    0.58430 0.124 0.004 0.160 0.712 0.000
#> GSM152113     3  0.4462    0.60876 0.308 0.016 0.672 0.004 0.000
#> GSM152115     3  0.4527    0.65261 0.272 0.004 0.696 0.028 0.000
#> GSM152030     4  0.3556    0.81283 0.032 0.008 0.132 0.828 0.000
#> GSM152038     3  0.3231    0.66847 0.196 0.000 0.800 0.004 0.000
#> GSM152042     4  0.3053    0.82646 0.012 0.008 0.128 0.852 0.000
#> GSM152062     3  0.1831    0.66835 0.076 0.004 0.920 0.000 0.000
#> GSM152077     1  0.4506    0.59617 0.676 0.000 0.028 0.000 0.296
#> GSM152088     2  0.0162    0.95332 0.000 0.996 0.000 0.004 0.000
#> GSM152100     4  0.0290    0.87423 0.000 0.008 0.000 0.992 0.000
#> GSM152102     2  0.6028    0.40325 0.192 0.612 0.188 0.008 0.000
#> GSM152104     2  0.0510    0.95435 0.000 0.984 0.000 0.016 0.000
#> GSM152028     1  0.3622    0.43990 0.820 0.000 0.056 0.000 0.124
#> GSM152029     5  0.6149    0.29796 0.116 0.008 0.340 0.000 0.536
#> GSM152049     5  0.3837   -0.02404 0.308 0.000 0.000 0.000 0.692
#> GSM152053     4  0.3336    0.81372 0.016 0.008 0.144 0.832 0.000
#> GSM152059     5  0.2540    0.54837 0.088 0.000 0.024 0.000 0.888
#> GSM152085     5  0.0510    0.54107 0.016 0.000 0.000 0.000 0.984
#> GSM152101     3  0.4244    0.65638 0.268 0.004 0.712 0.016 0.000
#> GSM152105     1  0.4618    0.46817 0.724 0.000 0.208 0.000 0.068
#> GSM152034     5  0.2127    0.55587 0.000 0.000 0.000 0.108 0.892
#> GSM152036     4  0.0290    0.87423 0.000 0.008 0.000 0.992 0.000
#> GSM152040     5  0.5855    0.38809 0.356 0.000 0.084 0.008 0.552
#> GSM152043     5  0.4820    0.48490 0.240 0.000 0.056 0.004 0.700
#> GSM152046     5  0.2068    0.55802 0.004 0.000 0.000 0.092 0.904
#> GSM152047     5  0.4805    0.49525 0.268 0.000 0.032 0.012 0.688
#> GSM152048     1  0.4242    0.59158 0.572 0.000 0.000 0.000 0.428
#> GSM152050     5  0.3455    0.26145 0.208 0.000 0.000 0.008 0.784
#> GSM152052     1  0.5831    0.57768 0.604 0.000 0.160 0.000 0.236
#> GSM152056     1  0.4249    0.58778 0.568 0.000 0.000 0.000 0.432
#> GSM152060     5  0.2513    0.54916 0.008 0.000 0.000 0.116 0.876
#> GSM152065     3  0.5159    0.54329 0.472 0.000 0.496 0.008 0.024
#> GSM152066     1  0.4287    0.55718 0.540 0.000 0.000 0.000 0.460
#> GSM152069     3  0.0451    0.68298 0.004 0.008 0.988 0.000 0.000
#> GSM152070     5  0.6884    0.13542 0.348 0.000 0.228 0.008 0.416
#> GSM152071     3  0.0693    0.68225 0.012 0.008 0.980 0.000 0.000
#> GSM152072     3  0.6158    0.53850 0.348 0.004 0.540 0.008 0.100
#> GSM152073     5  0.2674    0.54633 0.140 0.000 0.004 0.000 0.856
#> GSM152078     1  0.6264   -0.01400 0.460 0.004 0.408 0.000 0.128
#> GSM152082     5  0.7017   -0.00476 0.352 0.000 0.276 0.008 0.364
#> GSM152086     5  0.4171   -0.31434 0.396 0.000 0.000 0.000 0.604
#> GSM152090     3  0.7186   -0.37775 0.344 0.020 0.392 0.000 0.244
#> GSM152092     1  0.6017   -0.04709 0.572 0.000 0.132 0.004 0.292
#> GSM152093     1  0.5075    0.53971 0.512 0.000 0.020 0.008 0.460
#> GSM152094     5  0.0703    0.54694 0.024 0.000 0.000 0.000 0.976
#> GSM152098     5  0.6630    0.25418 0.336 0.000 0.180 0.008 0.476
#> GSM152110     1  0.4656    0.50622 0.508 0.000 0.000 0.012 0.480
#> GSM152031     1  0.5610    0.46025 0.640 0.000 0.180 0.000 0.180
#> GSM152037     1  0.4242    0.59158 0.572 0.000 0.000 0.000 0.428
#> GSM152055     5  0.5237    0.33350 0.160 0.000 0.000 0.156 0.684
#> GSM152061     5  0.2513    0.54916 0.008 0.000 0.000 0.116 0.876
#> GSM152064     5  0.4170    0.46168 0.048 0.000 0.000 0.192 0.760
#> GSM152087     5  0.0609    0.55392 0.020 0.000 0.000 0.000 0.980
#> GSM152103     3  0.6772   -0.32274 0.404 0.016 0.420 0.000 0.160

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.3073   0.582358 0.080 0.000 0.840 0.000 0.080 0.000
#> GSM152033     5  0.6481   0.000908 0.272 0.008 0.312 0.000 0.400 0.008
#> GSM152063     2  0.0000   0.947720 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152074     3  0.4965   0.489954 0.156 0.000 0.664 0.004 0.176 0.000
#> GSM152080     2  0.1610   0.895450 0.000 0.916 0.084 0.000 0.000 0.000
#> GSM152081     4  0.3601   0.767874 0.016 0.004 0.084 0.824 0.072 0.000
#> GSM152083     2  0.3534   0.698133 0.016 0.740 0.244 0.000 0.000 0.000
#> GSM152091     2  0.0260   0.945342 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM152108     2  0.3989   0.770913 0.128 0.788 0.052 0.000 0.032 0.000
#> GSM152114     1  0.5313   0.405275 0.640 0.000 0.048 0.268 0.020 0.024
#> GSM152035     2  0.0653   0.939905 0.004 0.980 0.012 0.000 0.004 0.000
#> GSM152039     4  0.0291   0.824956 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM152041     4  0.0291   0.824956 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM152044     2  0.0000   0.947720 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152045     5  0.4486   0.533124 0.000 0.000 0.068 0.092 0.764 0.076
#> GSM152051     2  0.0000   0.947720 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.4357   0.508259 0.000 0.040 0.088 0.104 0.768 0.000
#> GSM152057     2  0.0000   0.947720 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     1  0.3023   0.647811 0.768 0.000 0.000 0.000 0.000 0.232
#> GSM152067     5  0.4083   0.103140 0.000 0.000 0.460 0.008 0.532 0.000
#> GSM152068     2  0.0000   0.947720 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     4  0.0582   0.824008 0.004 0.004 0.004 0.984 0.000 0.004
#> GSM152076     4  0.0291   0.824956 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM152079     2  0.0000   0.947720 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152084     3  0.5666   0.460390 0.084 0.000 0.640 0.196 0.080 0.000
#> GSM152089     4  0.5326   0.328243 0.000 0.008 0.012 0.572 0.344 0.064
#> GSM152095     4  0.0291   0.824956 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM152096     2  0.3110   0.774363 0.012 0.792 0.196 0.000 0.000 0.000
#> GSM152097     2  0.0547   0.937802 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM152099     2  0.0000   0.947720 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152106     2  0.0547   0.937324 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM152107     4  0.5961   0.361779 0.016 0.000 0.284 0.524 0.176 0.000
#> GSM152109     3  0.1957   0.562263 0.000 0.000 0.888 0.000 0.112 0.000
#> GSM152111     6  0.3714   0.532627 0.264 0.000 0.008 0.000 0.008 0.720
#> GSM152112     4  0.4508   0.305663 0.000 0.000 0.036 0.568 0.396 0.000
#> GSM152113     3  0.6282   0.214820 0.272 0.012 0.436 0.000 0.280 0.000
#> GSM152115     5  0.3450   0.418536 0.008 0.000 0.208 0.012 0.772 0.000
#> GSM152030     4  0.4122   0.748709 0.032 0.004 0.092 0.792 0.080 0.000
#> GSM152038     3  0.5843   0.313759 0.220 0.000 0.516 0.000 0.260 0.004
#> GSM152042     4  0.3786   0.761378 0.020 0.004 0.092 0.812 0.072 0.000
#> GSM152062     3  0.3976   0.573984 0.088 0.000 0.776 0.008 0.128 0.000
#> GSM152077     1  0.2620   0.556579 0.888 0.000 0.052 0.000 0.028 0.032
#> GSM152088     2  0.0146   0.946216 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM152100     4  0.0551   0.822401 0.000 0.008 0.000 0.984 0.004 0.004
#> GSM152102     5  0.4740   0.176429 0.004 0.412 0.032 0.004 0.548 0.000
#> GSM152104     2  0.0000   0.947720 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152028     1  0.5077   0.289303 0.660 0.000 0.068 0.000 0.240 0.032
#> GSM152029     3  0.6348   0.112118 0.024 0.000 0.452 0.000 0.204 0.320
#> GSM152049     6  0.3938   0.415759 0.324 0.000 0.000 0.000 0.016 0.660
#> GSM152053     4  0.3737   0.764082 0.020 0.004 0.088 0.816 0.072 0.000
#> GSM152059     6  0.4376   0.664135 0.100 0.000 0.028 0.000 0.112 0.760
#> GSM152085     6  0.1152   0.769476 0.044 0.000 0.000 0.000 0.004 0.952
#> GSM152101     5  0.3311   0.427265 0.004 0.000 0.204 0.012 0.780 0.000
#> GSM152105     1  0.4473   0.366883 0.740 0.000 0.160 0.000 0.076 0.024
#> GSM152034     6  0.1080   0.774977 0.004 0.000 0.000 0.032 0.004 0.960
#> GSM152036     4  0.0405   0.823713 0.000 0.004 0.000 0.988 0.000 0.008
#> GSM152040     5  0.4465   0.405361 0.036 0.000 0.000 0.004 0.628 0.332
#> GSM152043     6  0.5464   0.426389 0.120 0.000 0.020 0.000 0.248 0.612
#> GSM152046     6  0.1194   0.775118 0.008 0.000 0.000 0.032 0.004 0.956
#> GSM152047     6  0.4011   0.543316 0.028 0.000 0.000 0.012 0.228 0.732
#> GSM152048     1  0.3163   0.648278 0.764 0.000 0.000 0.000 0.004 0.232
#> GSM152050     6  0.3043   0.646119 0.196 0.000 0.004 0.000 0.004 0.796
#> GSM152052     1  0.3434   0.583886 0.808 0.000 0.140 0.000 0.004 0.048
#> GSM152056     1  0.3076   0.642381 0.760 0.000 0.000 0.000 0.000 0.240
#> GSM152060     6  0.1370   0.774317 0.012 0.000 0.000 0.036 0.004 0.948
#> GSM152065     5  0.4913   0.448991 0.180 0.000 0.124 0.000 0.684 0.012
#> GSM152066     1  0.3360   0.618408 0.732 0.000 0.000 0.000 0.004 0.264
#> GSM152069     3  0.2092   0.560992 0.000 0.000 0.876 0.000 0.124 0.000
#> GSM152070     5  0.4150   0.522403 0.036 0.000 0.012 0.000 0.724 0.228
#> GSM152071     3  0.1957   0.568328 0.000 0.000 0.888 0.000 0.112 0.000
#> GSM152072     5  0.3612   0.524174 0.016 0.000 0.148 0.000 0.800 0.036
#> GSM152073     6  0.4586   0.618089 0.104 0.000 0.008 0.000 0.176 0.712
#> GSM152078     1  0.6760  -0.129160 0.380 0.000 0.320 0.000 0.260 0.040
#> GSM152082     5  0.6287   0.441770 0.188 0.000 0.052 0.000 0.548 0.212
#> GSM152086     1  0.4332   0.338117 0.564 0.000 0.004 0.000 0.016 0.416
#> GSM152090     3  0.5322   0.249123 0.308 0.004 0.604 0.004 0.016 0.064
#> GSM152092     5  0.6757   0.236208 0.380 0.000 0.064 0.000 0.388 0.168
#> GSM152093     1  0.4952   0.599558 0.672 0.000 0.036 0.028 0.012 0.252
#> GSM152094     6  0.2333   0.757812 0.060 0.000 0.004 0.000 0.040 0.896
#> GSM152098     5  0.5361   0.438376 0.072 0.000 0.032 0.000 0.608 0.288
#> GSM152110     1  0.3996   0.513456 0.636 0.000 0.000 0.008 0.004 0.352
#> GSM152031     1  0.5836   0.309821 0.624 0.000 0.188 0.000 0.120 0.068
#> GSM152037     1  0.3023   0.647525 0.768 0.000 0.000 0.000 0.000 0.232
#> GSM152055     6  0.4165   0.618721 0.160 0.000 0.000 0.100 0.000 0.740
#> GSM152061     6  0.1370   0.774317 0.012 0.000 0.000 0.036 0.004 0.948
#> GSM152064     6  0.3325   0.703957 0.084 0.000 0.000 0.096 0.000 0.820
#> GSM152087     6  0.1924   0.763020 0.028 0.000 0.004 0.000 0.048 0.920
#> GSM152103     3  0.4743   0.336124 0.292 0.000 0.648 0.000 0.024 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-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 specimen(p) k
#> CV:skmeans 86    5.07e-10 2
#> CV:skmeans 86    9.26e-07 3
#> CV:skmeans 83    7.32e-06 4
#> CV:skmeans 64    8.16e-04 5
#> CV:skmeans 60    2.60e-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.


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

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.469           0.569       0.816         0.4927 0.495   0.495
#> 3 3 0.438           0.568       0.812         0.2664 0.581   0.348
#> 4 4 0.710           0.836       0.894         0.1536 0.862   0.650
#> 5 5 0.656           0.550       0.742         0.0765 0.910   0.708
#> 6 6 0.782           0.802       0.868         0.0592 0.844   0.457

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
#> GSM152032     2  0.1843      0.716 0.028 0.972
#> GSM152033     1  0.6973      0.649 0.812 0.188
#> GSM152063     2  0.2778      0.723 0.048 0.952
#> GSM152074     2  0.9000      0.264 0.316 0.684
#> GSM152080     2  0.9686      0.444 0.396 0.604
#> GSM152081     2  0.3733      0.723 0.072 0.928
#> GSM152083     2  0.0000      0.712 0.000 1.000
#> GSM152091     2  0.9635      0.486 0.388 0.612
#> GSM152108     1  0.0672      0.769 0.992 0.008
#> GSM152114     1  0.0000      0.774 1.000 0.000
#> GSM152035     2  0.1184      0.717 0.016 0.984
#> GSM152039     2  0.4022      0.722 0.080 0.920
#> GSM152041     1  0.9993     -0.352 0.516 0.484
#> GSM152044     2  0.2778      0.723 0.048 0.952
#> GSM152045     1  0.9044      0.492 0.680 0.320
#> GSM152051     2  0.4022      0.723 0.080 0.920
#> GSM152054     1  0.3431      0.758 0.936 0.064
#> GSM152057     2  0.2778      0.723 0.048 0.952
#> GSM152058     1  0.0000      0.774 1.000 0.000
#> GSM152067     2  0.1843      0.716 0.028 0.972
#> GSM152068     2  0.2778      0.723 0.048 0.952
#> GSM152075     1  0.9795      0.295 0.584 0.416
#> GSM152076     2  0.3733      0.724 0.072 0.928
#> GSM152079     2  0.2778      0.723 0.048 0.952
#> GSM152084     1  0.9998      0.240 0.508 0.492
#> GSM152089     2  0.9998      0.371 0.492 0.508
#> GSM152095     2  0.3879      0.723 0.076 0.924
#> GSM152096     2  0.9754      0.435 0.408 0.592
#> GSM152097     2  0.2778      0.723 0.048 0.952
#> GSM152099     2  0.0000      0.712 0.000 1.000
#> GSM152106     2  0.2778      0.723 0.048 0.952
#> GSM152107     2  0.1843      0.716 0.028 0.972
#> GSM152109     2  0.1843      0.716 0.028 0.972
#> GSM152111     1  0.9881     -0.234 0.564 0.436
#> GSM152112     1  0.9988      0.263 0.520 0.480
#> GSM152113     1  0.3431      0.759 0.936 0.064
#> GSM152115     1  0.9993      0.256 0.516 0.484
#> GSM152030     1  0.9815      0.285 0.580 0.420
#> GSM152038     1  0.9970      0.280 0.532 0.468
#> GSM152042     2  0.1843      0.716 0.028 0.972
#> GSM152062     2  0.9998     -0.242 0.492 0.508
#> GSM152077     1  0.0000      0.774 1.000 0.000
#> GSM152088     2  0.9661      0.499 0.392 0.608
#> GSM152100     1  0.9795      0.302 0.584 0.416
#> GSM152102     2  0.7815      0.588 0.232 0.768
#> GSM152104     2  0.3431      0.725 0.064 0.936
#> GSM152028     1  0.2778      0.762 0.952 0.048
#> GSM152029     2  0.9833      0.419 0.424 0.576
#> GSM152049     1  0.1184      0.764 0.984 0.016
#> GSM152053     1  0.9996      0.249 0.512 0.488
#> GSM152059     2  0.9977      0.329 0.472 0.528
#> GSM152085     1  0.0000      0.774 1.000 0.000
#> GSM152101     2  0.0000      0.712 0.000 1.000
#> GSM152105     1  0.2778      0.762 0.952 0.048
#> GSM152034     2  0.9833      0.479 0.424 0.576
#> GSM152036     2  0.3879      0.723 0.076 0.924
#> GSM152040     1  0.2603      0.763 0.956 0.044
#> GSM152043     1  0.3431      0.758 0.936 0.064
#> GSM152046     1  1.0000     -0.376 0.504 0.496
#> GSM152047     2  0.9998      0.371 0.492 0.508
#> GSM152048     1  0.0000      0.774 1.000 0.000
#> GSM152050     1  0.9044      0.163 0.680 0.320
#> GSM152052     1  0.9996     -0.360 0.512 0.488
#> GSM152056     1  0.0000      0.774 1.000 0.000
#> GSM152060     1  0.0000      0.774 1.000 0.000
#> GSM152065     1  0.3879      0.752 0.924 0.076
#> GSM152066     1  0.0000      0.774 1.000 0.000
#> GSM152069     2  0.6048      0.674 0.148 0.852
#> GSM152070     1  0.3431      0.758 0.936 0.064
#> GSM152071     2  0.9522      0.490 0.372 0.628
#> GSM152072     2  0.9850      0.413 0.428 0.572
#> GSM152073     1  0.0000      0.774 1.000 0.000
#> GSM152078     2  0.9896      0.391 0.440 0.560
#> GSM152082     1  0.2778      0.762 0.952 0.048
#> GSM152086     1  0.0000      0.774 1.000 0.000
#> GSM152090     2  0.9977      0.410 0.472 0.528
#> GSM152092     1  0.2778      0.762 0.952 0.048
#> GSM152093     2  1.0000      0.356 0.500 0.500
#> GSM152094     1  0.0000      0.774 1.000 0.000
#> GSM152098     1  0.3733      0.755 0.928 0.072
#> GSM152110     1  0.0000      0.774 1.000 0.000
#> GSM152031     1  0.3114      0.761 0.944 0.056
#> GSM152037     1  0.0000      0.774 1.000 0.000
#> GSM152055     1  0.0000      0.774 1.000 0.000
#> GSM152061     1  0.0000      0.774 1.000 0.000
#> GSM152064     1  0.0000      0.774 1.000 0.000
#> GSM152087     1  0.0000      0.774 1.000 0.000
#> GSM152103     2  0.9977      0.410 0.472 0.528

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.3340    0.58372 0.000 0.120 0.880
#> GSM152033     3  0.5859    0.51271 0.344 0.000 0.656
#> GSM152063     2  0.0237    0.91399 0.000 0.996 0.004
#> GSM152074     3  0.0237    0.59262 0.000 0.004 0.996
#> GSM152080     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152081     1  0.6521    0.16875 0.504 0.004 0.492
#> GSM152083     3  0.6302    0.15040 0.000 0.480 0.520
#> GSM152091     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152108     1  0.4692    0.59770 0.820 0.012 0.168
#> GSM152114     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152035     2  0.3116    0.85250 0.000 0.892 0.108
#> GSM152039     3  0.9549    0.00365 0.276 0.240 0.484
#> GSM152041     1  0.3764    0.73872 0.892 0.068 0.040
#> GSM152044     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152045     3  0.5497    0.54981 0.292 0.000 0.708
#> GSM152051     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152054     3  0.6295    0.37537 0.472 0.000 0.528
#> GSM152057     2  0.3267    0.84462 0.000 0.884 0.116
#> GSM152058     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152067     3  0.3267    0.58447 0.000 0.116 0.884
#> GSM152068     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152075     1  0.6305    0.18863 0.516 0.000 0.484
#> GSM152076     3  0.9543    0.00913 0.280 0.236 0.484
#> GSM152079     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152084     3  0.2682    0.61889 0.076 0.004 0.920
#> GSM152089     1  0.3500    0.73218 0.880 0.116 0.004
#> GSM152095     1  0.7377    0.20491 0.516 0.032 0.452
#> GSM152096     2  0.9391    0.07322 0.284 0.504 0.212
#> GSM152097     2  0.3340    0.84243 0.000 0.880 0.120
#> GSM152099     2  0.3340    0.84242 0.000 0.880 0.120
#> GSM152106     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152107     3  0.0000    0.59235 0.000 0.000 1.000
#> GSM152109     3  0.3340    0.58372 0.000 0.120 0.880
#> GSM152111     1  0.3038    0.73969 0.896 0.104 0.000
#> GSM152112     3  0.0000    0.59235 0.000 0.000 1.000
#> GSM152113     3  0.6305    0.36105 0.484 0.000 0.516
#> GSM152115     3  0.0000    0.59235 0.000 0.000 1.000
#> GSM152030     1  0.6307    0.18256 0.512 0.000 0.488
#> GSM152038     3  0.3349    0.62177 0.108 0.004 0.888
#> GSM152042     3  0.0237    0.59262 0.000 0.004 0.996
#> GSM152062     3  0.3375    0.62195 0.100 0.008 0.892
#> GSM152077     1  0.0424    0.76739 0.992 0.000 0.008
#> GSM152088     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152100     1  0.6307    0.18255 0.512 0.000 0.488
#> GSM152102     3  0.6008    0.21460 0.000 0.372 0.628
#> GSM152104     2  0.0000    0.91629 0.000 1.000 0.000
#> GSM152028     1  0.5988    0.04305 0.632 0.000 0.368
#> GSM152029     1  0.8880   -0.19132 0.464 0.120 0.416
#> GSM152049     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152053     3  0.0237    0.59262 0.000 0.004 0.996
#> GSM152059     1  0.8139    0.28551 0.616 0.108 0.276
#> GSM152085     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152101     3  0.0000    0.59235 0.000 0.000 1.000
#> GSM152105     3  0.6305    0.36105 0.484 0.000 0.516
#> GSM152034     1  0.3340    0.73144 0.880 0.120 0.000
#> GSM152036     3  0.8561   -0.08996 0.420 0.096 0.484
#> GSM152040     1  0.6309   -0.36560 0.500 0.000 0.500
#> GSM152043     1  0.6229    0.13408 0.652 0.008 0.340
#> GSM152046     1  0.3267    0.73368 0.884 0.116 0.000
#> GSM152047     1  0.3267    0.73368 0.884 0.116 0.000
#> GSM152048     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152050     1  0.2537    0.75000 0.920 0.080 0.000
#> GSM152052     1  0.3116    0.73741 0.892 0.108 0.000
#> GSM152056     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152060     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152065     3  0.6274    0.39927 0.456 0.000 0.544
#> GSM152066     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152069     3  0.6788    0.58497 0.136 0.120 0.744
#> GSM152070     3  0.6680    0.35462 0.484 0.008 0.508
#> GSM152071     3  0.8759    0.38543 0.360 0.120 0.520
#> GSM152072     3  0.8731    0.37649 0.368 0.116 0.516
#> GSM152073     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152078     3  0.8880    0.28002 0.416 0.120 0.464
#> GSM152082     3  0.6305    0.36105 0.484 0.000 0.516
#> GSM152086     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152090     1  0.3340    0.73144 0.880 0.120 0.000
#> GSM152092     1  0.5363    0.32160 0.724 0.000 0.276
#> GSM152093     1  0.3192    0.73644 0.888 0.112 0.000
#> GSM152094     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152098     3  0.6682    0.34697 0.488 0.008 0.504
#> GSM152110     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152031     3  0.6516    0.36612 0.480 0.004 0.516
#> GSM152037     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152055     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152061     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152064     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152087     1  0.0000    0.77239 1.000 0.000 0.000
#> GSM152103     1  0.3340    0.73144 0.880 0.120 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.3024     0.7944 0.000 0.000 0.852 0.148
#> GSM152033     3  0.1637     0.8222 0.060 0.000 0.940 0.000
#> GSM152063     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152074     3  0.3486     0.7796 0.000 0.000 0.812 0.188
#> GSM152080     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152081     4  0.0469     0.9722 0.000 0.000 0.012 0.988
#> GSM152083     3  0.3975     0.6909 0.000 0.240 0.760 0.000
#> GSM152091     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152108     1  0.4972     0.2384 0.544 0.000 0.456 0.000
#> GSM152114     1  0.2149     0.8781 0.912 0.000 0.088 0.000
#> GSM152035     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152039     4  0.1807     0.9337 0.052 0.000 0.008 0.940
#> GSM152041     1  0.0336     0.8910 0.992 0.000 0.000 0.008
#> GSM152044     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152045     3  0.4050     0.8200 0.144 0.000 0.820 0.036
#> GSM152051     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152054     3  0.3074     0.8206 0.152 0.000 0.848 0.000
#> GSM152057     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152058     1  0.2081     0.8797 0.916 0.000 0.084 0.000
#> GSM152067     3  0.2814     0.7980 0.000 0.000 0.868 0.132
#> GSM152068     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152075     4  0.0336     0.9719 0.000 0.000 0.008 0.992
#> GSM152076     4  0.0000     0.9704 0.000 0.000 0.000 1.000
#> GSM152079     2  0.0336     0.9506 0.000 0.992 0.008 0.000
#> GSM152084     4  0.2924     0.9143 0.016 0.000 0.100 0.884
#> GSM152089     1  0.3803     0.8043 0.836 0.000 0.032 0.132
#> GSM152095     4  0.2021     0.9350 0.040 0.000 0.024 0.936
#> GSM152096     2  0.7714     0.0883 0.244 0.440 0.316 0.000
#> GSM152097     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152099     2  0.0188     0.9540 0.000 0.996 0.000 0.004
#> GSM152106     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152107     3  0.3400     0.7885 0.000 0.000 0.820 0.180
#> GSM152109     3  0.3311     0.7772 0.000 0.000 0.828 0.172
#> GSM152111     1  0.0817     0.8881 0.976 0.000 0.024 0.000
#> GSM152112     4  0.0469     0.9722 0.000 0.000 0.012 0.988
#> GSM152113     3  0.2814     0.8256 0.132 0.000 0.868 0.000
#> GSM152115     3  0.3444     0.7817 0.000 0.000 0.816 0.184
#> GSM152030     4  0.0469     0.9722 0.000 0.000 0.012 0.988
#> GSM152038     3  0.3157     0.8000 0.004 0.000 0.852 0.144
#> GSM152042     4  0.0469     0.9722 0.000 0.000 0.012 0.988
#> GSM152062     3  0.3219     0.7902 0.000 0.000 0.836 0.164
#> GSM152077     1  0.3123     0.8312 0.844 0.000 0.156 0.000
#> GSM152088     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152100     4  0.0000     0.9704 0.000 0.000 0.000 1.000
#> GSM152102     3  0.3942     0.6930 0.000 0.236 0.764 0.000
#> GSM152104     2  0.0000     0.9573 0.000 1.000 0.000 0.000
#> GSM152028     1  0.4697     0.5291 0.644 0.000 0.356 0.000
#> GSM152029     3  0.4916     0.3757 0.424 0.000 0.576 0.000
#> GSM152049     1  0.2081     0.8797 0.916 0.000 0.084 0.000
#> GSM152053     4  0.0469     0.9722 0.000 0.000 0.012 0.988
#> GSM152059     1  0.3172     0.7758 0.840 0.000 0.160 0.000
#> GSM152085     1  0.0000     0.8908 1.000 0.000 0.000 0.000
#> GSM152101     4  0.1474     0.9412 0.000 0.000 0.052 0.948
#> GSM152105     3  0.2469     0.8144 0.108 0.000 0.892 0.000
#> GSM152034     1  0.2830     0.8603 0.900 0.000 0.060 0.040
#> GSM152036     4  0.0707     0.9602 0.020 0.000 0.000 0.980
#> GSM152040     3  0.2760     0.8223 0.128 0.000 0.872 0.000
#> GSM152043     1  0.4916     0.1705 0.576 0.000 0.424 0.000
#> GSM152046     1  0.1118     0.8845 0.964 0.000 0.036 0.000
#> GSM152047     1  0.4285     0.7733 0.804 0.000 0.040 0.156
#> GSM152048     1  0.2081     0.8797 0.916 0.000 0.084 0.000
#> GSM152050     1  0.0000     0.8908 1.000 0.000 0.000 0.000
#> GSM152052     1  0.2081     0.8797 0.916 0.000 0.084 0.000
#> GSM152056     1  0.2081     0.8797 0.916 0.000 0.084 0.000
#> GSM152060     1  0.1211     0.8860 0.960 0.000 0.040 0.000
#> GSM152065     3  0.1474     0.8262 0.052 0.000 0.948 0.000
#> GSM152066     1  0.1211     0.8884 0.960 0.000 0.040 0.000
#> GSM152069     3  0.3144     0.8230 0.044 0.000 0.884 0.072
#> GSM152070     3  0.4406     0.6770 0.300 0.000 0.700 0.000
#> GSM152071     3  0.2840     0.8280 0.056 0.000 0.900 0.044
#> GSM152072     3  0.2530     0.8246 0.112 0.000 0.888 0.000
#> GSM152073     1  0.1557     0.8889 0.944 0.000 0.056 0.000
#> GSM152078     3  0.4661     0.5520 0.348 0.000 0.652 0.000
#> GSM152082     3  0.3219     0.8114 0.164 0.000 0.836 0.000
#> GSM152086     1  0.2081     0.8797 0.916 0.000 0.084 0.000
#> GSM152090     1  0.1807     0.8714 0.940 0.000 0.052 0.008
#> GSM152092     1  0.3311     0.7923 0.828 0.000 0.172 0.000
#> GSM152093     1  0.0336     0.8907 0.992 0.000 0.008 0.000
#> GSM152094     1  0.1118     0.8845 0.964 0.000 0.036 0.000
#> GSM152098     3  0.4605     0.6174 0.336 0.000 0.664 0.000
#> GSM152110     1  0.1637     0.8857 0.940 0.000 0.060 0.000
#> GSM152031     3  0.2281     0.8175 0.096 0.000 0.904 0.000
#> GSM152037     1  0.2081     0.8797 0.916 0.000 0.084 0.000
#> GSM152055     1  0.2081     0.8797 0.916 0.000 0.084 0.000
#> GSM152061     1  0.1118     0.8845 0.964 0.000 0.036 0.000
#> GSM152064     1  0.1118     0.8845 0.964 0.000 0.036 0.000
#> GSM152087     1  0.1118     0.8845 0.964 0.000 0.036 0.000
#> GSM152103     1  0.1118     0.8848 0.964 0.000 0.036 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
#> GSM152032     5  0.1894     0.6160 0.000 0.000 0.008 0.072 0.920
#> GSM152033     5  0.3675     0.6147 0.024 0.000 0.188 0.000 0.788
#> GSM152063     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152074     5  0.2852     0.6256 0.000 0.000 0.000 0.172 0.828
#> GSM152080     2  0.2516     0.8663 0.000 0.860 0.140 0.000 0.000
#> GSM152081     4  0.1341     0.9266 0.000 0.000 0.000 0.944 0.056
#> GSM152083     5  0.3508     0.5277 0.000 0.252 0.000 0.000 0.748
#> GSM152091     2  0.0290     0.9632 0.000 0.992 0.008 0.000 0.000
#> GSM152108     3  0.6660    -0.1976 0.288 0.000 0.444 0.000 0.268
#> GSM152114     1  0.4262     0.4969 0.560 0.000 0.440 0.000 0.000
#> GSM152035     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152039     4  0.2732     0.8540 0.088 0.000 0.020 0.884 0.008
#> GSM152041     1  0.4874     0.5074 0.632 0.000 0.328 0.040 0.000
#> GSM152044     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152045     5  0.5177     0.4142 0.468 0.000 0.020 0.012 0.500
#> GSM152051     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152054     5  0.3242     0.6065 0.216 0.000 0.000 0.000 0.784
#> GSM152057     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152058     1  0.4268     0.4949 0.556 0.000 0.444 0.000 0.000
#> GSM152067     5  0.5086     0.0243 0.000 0.000 0.396 0.040 0.564
#> GSM152068     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152075     4  0.1270     0.9266 0.000 0.000 0.000 0.948 0.052
#> GSM152076     4  0.0609     0.9127 0.000 0.000 0.020 0.980 0.000
#> GSM152079     2  0.3366     0.8144 0.000 0.828 0.140 0.000 0.032
#> GSM152084     4  0.3474     0.8345 0.004 0.000 0.008 0.796 0.192
#> GSM152089     1  0.5659     0.3647 0.704 0.000 0.148 0.056 0.092
#> GSM152095     4  0.4007     0.8119 0.076 0.000 0.072 0.824 0.028
#> GSM152096     3  0.7330     0.2535 0.072 0.148 0.492 0.000 0.288
#> GSM152097     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152099     2  0.1544     0.9163 0.000 0.932 0.000 0.068 0.000
#> GSM152106     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152107     5  0.3123     0.6302 0.000 0.000 0.004 0.184 0.812
#> GSM152109     3  0.4878     0.2211 0.000 0.000 0.536 0.024 0.440
#> GSM152111     1  0.3491     0.5433 0.768 0.000 0.228 0.000 0.004
#> GSM152112     4  0.1410     0.9262 0.000 0.000 0.000 0.940 0.060
#> GSM152113     5  0.3991     0.6087 0.048 0.000 0.172 0.000 0.780
#> GSM152115     5  0.2773     0.6278 0.000 0.000 0.000 0.164 0.836
#> GSM152030     4  0.1341     0.9266 0.000 0.000 0.000 0.944 0.056
#> GSM152038     5  0.3445     0.6382 0.000 0.000 0.036 0.140 0.824
#> GSM152042     4  0.1341     0.9266 0.000 0.000 0.000 0.944 0.056
#> GSM152062     5  0.2690     0.6300 0.000 0.000 0.000 0.156 0.844
#> GSM152077     1  0.5223     0.4441 0.512 0.000 0.444 0.000 0.044
#> GSM152088     2  0.1043     0.9418 0.000 0.960 0.040 0.000 0.000
#> GSM152100     4  0.0771     0.9121 0.000 0.000 0.020 0.976 0.004
#> GSM152102     5  0.6417     0.4224 0.280 0.216 0.000 0.000 0.504
#> GSM152104     2  0.0000     0.9669 0.000 1.000 0.000 0.000 0.000
#> GSM152028     3  0.6647    -0.2825 0.304 0.000 0.444 0.000 0.252
#> GSM152029     1  0.5798     0.2057 0.604 0.000 0.148 0.000 0.248
#> GSM152049     1  0.4268     0.4949 0.556 0.000 0.444 0.000 0.000
#> GSM152053     4  0.1341     0.9266 0.000 0.000 0.000 0.944 0.056
#> GSM152059     1  0.2561     0.4225 0.856 0.000 0.000 0.000 0.144
#> GSM152085     1  0.3774     0.5325 0.704 0.000 0.296 0.000 0.000
#> GSM152101     4  0.2648     0.8432 0.000 0.000 0.000 0.848 0.152
#> GSM152105     5  0.3795     0.6002 0.028 0.000 0.192 0.000 0.780
#> GSM152034     1  0.5390     0.3744 0.720 0.000 0.148 0.092 0.040
#> GSM152036     4  0.1648     0.8950 0.040 0.000 0.020 0.940 0.000
#> GSM152040     5  0.5697     0.4416 0.404 0.000 0.084 0.000 0.512
#> GSM152043     1  0.4300    -0.1830 0.524 0.000 0.000 0.000 0.476
#> GSM152046     1  0.0000     0.5337 1.000 0.000 0.000 0.000 0.000
#> GSM152047     1  0.2674     0.4443 0.856 0.000 0.140 0.004 0.000
#> GSM152048     1  0.4268     0.4949 0.556 0.000 0.444 0.000 0.000
#> GSM152050     1  0.3857     0.5288 0.688 0.000 0.312 0.000 0.000
#> GSM152052     3  0.4219    -0.4719 0.416 0.000 0.584 0.000 0.000
#> GSM152056     1  0.4268     0.4949 0.556 0.000 0.444 0.000 0.000
#> GSM152060     1  0.0162     0.5344 0.996 0.000 0.004 0.000 0.000
#> GSM152065     5  0.3995     0.6326 0.060 0.000 0.152 0.000 0.788
#> GSM152066     1  0.4201     0.5090 0.592 0.000 0.408 0.000 0.000
#> GSM152069     3  0.4878     0.2293 0.024 0.000 0.536 0.000 0.440
#> GSM152070     1  0.4210    -0.2307 0.588 0.000 0.000 0.000 0.412
#> GSM152071     3  0.5077     0.2256 0.036 0.000 0.536 0.000 0.428
#> GSM152072     5  0.5965     0.0261 0.112 0.000 0.392 0.000 0.496
#> GSM152073     1  0.1197     0.5351 0.952 0.000 0.048 0.000 0.000
#> GSM152078     5  0.4127     0.3777 0.312 0.000 0.008 0.000 0.680
#> GSM152082     5  0.5100     0.4335 0.448 0.000 0.036 0.000 0.516
#> GSM152086     1  0.4268     0.4949 0.556 0.000 0.444 0.000 0.000
#> GSM152090     1  0.8087     0.1461 0.416 0.000 0.216 0.240 0.128
#> GSM152092     1  0.5227     0.3792 0.676 0.000 0.116 0.000 0.208
#> GSM152093     1  0.5399     0.4007 0.496 0.000 0.448 0.000 0.056
#> GSM152094     1  0.0000     0.5337 1.000 0.000 0.000 0.000 0.000
#> GSM152098     1  0.4262    -0.2000 0.560 0.000 0.000 0.000 0.440
#> GSM152110     1  0.4235     0.5038 0.576 0.000 0.424 0.000 0.000
#> GSM152031     5  0.3929     0.5870 0.028 0.000 0.208 0.000 0.764
#> GSM152037     1  0.4268     0.4949 0.556 0.000 0.444 0.000 0.000
#> GSM152055     1  0.4268     0.4949 0.556 0.000 0.444 0.000 0.000
#> GSM152061     1  0.0000     0.5337 1.000 0.000 0.000 0.000 0.000
#> GSM152064     1  0.1568     0.5409 0.944 0.000 0.036 0.020 0.000
#> GSM152087     1  0.0000     0.5337 1.000 0.000 0.000 0.000 0.000
#> GSM152103     1  0.6553     0.1118 0.456 0.000 0.216 0.000 0.328

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     5  0.3066      0.716 0.000 0.000 0.124 0.044 0.832 0.000
#> GSM152033     5  0.2631      0.741 0.180 0.000 0.000 0.000 0.820 0.000
#> GSM152063     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152074     5  0.2300      0.733 0.000 0.000 0.000 0.144 0.856 0.000
#> GSM152080     2  0.3464      0.559 0.000 0.688 0.312 0.000 0.000 0.000
#> GSM152081     4  0.1204      0.822 0.000 0.000 0.000 0.944 0.056 0.000
#> GSM152083     5  0.3052      0.640 0.000 0.216 0.004 0.000 0.780 0.000
#> GSM152091     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152108     1  0.1444      0.840 0.928 0.000 0.000 0.000 0.072 0.000
#> GSM152114     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152035     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152039     4  0.4122      0.766 0.000 0.000 0.008 0.764 0.124 0.104
#> GSM152041     1  0.4627      0.727 0.756 0.000 0.008 0.040 0.120 0.076
#> GSM152044     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152045     6  0.1901      0.825 0.000 0.000 0.008 0.004 0.076 0.912
#> GSM152051     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.2597      0.698 0.000 0.000 0.000 0.000 0.824 0.176
#> GSM152057     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152067     3  0.2001      0.873 0.000 0.000 0.912 0.040 0.048 0.000
#> GSM152068     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     4  0.1075      0.822 0.000 0.000 0.000 0.952 0.048 0.000
#> GSM152076     4  0.3845      0.776 0.000 0.000 0.008 0.788 0.120 0.084
#> GSM152079     2  0.1204      0.918 0.000 0.944 0.056 0.000 0.000 0.000
#> GSM152084     4  0.3263      0.717 0.000 0.000 0.176 0.800 0.020 0.004
#> GSM152089     6  0.6352      0.681 0.100 0.000 0.044 0.092 0.128 0.636
#> GSM152095     4  0.4470      0.757 0.000 0.000 0.024 0.748 0.124 0.104
#> GSM152096     3  0.2948      0.820 0.000 0.060 0.848 0.000 0.092 0.000
#> GSM152097     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152099     2  0.1082      0.927 0.000 0.956 0.000 0.040 0.004 0.000
#> GSM152106     2  0.0146      0.963 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM152107     5  0.0632      0.726 0.000 0.000 0.000 0.024 0.976 0.000
#> GSM152109     3  0.0260      0.910 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM152111     1  0.4098      0.518 0.676 0.000 0.032 0.000 0.000 0.292
#> GSM152112     4  0.1267      0.821 0.000 0.000 0.000 0.940 0.060 0.000
#> GSM152113     5  0.3202      0.745 0.176 0.000 0.000 0.000 0.800 0.024
#> GSM152115     5  0.2300      0.732 0.000 0.000 0.000 0.144 0.856 0.000
#> GSM152030     4  0.1204      0.822 0.000 0.000 0.000 0.944 0.056 0.000
#> GSM152038     5  0.2822      0.751 0.040 0.000 0.000 0.108 0.852 0.000
#> GSM152042     4  0.1204      0.822 0.000 0.000 0.000 0.944 0.056 0.000
#> GSM152062     5  0.2623      0.736 0.000 0.000 0.016 0.132 0.852 0.000
#> GSM152077     1  0.0260      0.913 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM152088     2  0.0363      0.957 0.000 0.988 0.012 0.000 0.000 0.000
#> GSM152100     4  0.3111      0.789 0.000 0.000 0.008 0.836 0.124 0.032
#> GSM152102     6  0.4796      0.637 0.000 0.172 0.008 0.000 0.128 0.692
#> GSM152104     2  0.0000      0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152028     1  0.0632      0.900 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM152029     6  0.4392      0.741 0.060 0.000 0.176 0.000 0.024 0.740
#> GSM152049     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152053     4  0.1204      0.822 0.000 0.000 0.000 0.944 0.056 0.000
#> GSM152059     6  0.1610      0.862 0.084 0.000 0.000 0.000 0.000 0.916
#> GSM152085     1  0.2562      0.783 0.828 0.000 0.000 0.000 0.000 0.172
#> GSM152101     4  0.2823      0.683 0.000 0.000 0.000 0.796 0.204 0.000
#> GSM152105     5  0.3482      0.649 0.316 0.000 0.000 0.000 0.684 0.000
#> GSM152034     6  0.6109      0.614 0.100 0.000 0.148 0.144 0.000 0.608
#> GSM152036     4  0.3989      0.772 0.000 0.000 0.008 0.776 0.120 0.096
#> GSM152040     6  0.2432      0.818 0.024 0.000 0.000 0.000 0.100 0.876
#> GSM152043     5  0.4389      0.555 0.052 0.000 0.000 0.000 0.660 0.288
#> GSM152046     6  0.1814      0.859 0.100 0.000 0.000 0.000 0.000 0.900
#> GSM152047     6  0.1610      0.862 0.084 0.000 0.000 0.000 0.000 0.916
#> GSM152048     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152050     1  0.3062      0.784 0.816 0.000 0.024 0.000 0.000 0.160
#> GSM152052     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152056     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152060     6  0.1765      0.862 0.096 0.000 0.000 0.000 0.000 0.904
#> GSM152065     5  0.3204      0.751 0.144 0.000 0.004 0.000 0.820 0.032
#> GSM152066     1  0.0713      0.906 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM152069     3  0.0260      0.910 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM152070     6  0.2221      0.844 0.032 0.000 0.000 0.000 0.072 0.896
#> GSM152071     3  0.0260      0.910 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM152072     3  0.3190      0.773 0.000 0.000 0.820 0.000 0.044 0.136
#> GSM152073     6  0.1863      0.860 0.104 0.000 0.000 0.000 0.000 0.896
#> GSM152078     5  0.5998      0.558 0.072 0.000 0.124 0.000 0.604 0.200
#> GSM152082     6  0.2212      0.814 0.008 0.000 0.000 0.000 0.112 0.880
#> GSM152086     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152090     4  0.5825      0.297 0.288 0.000 0.224 0.488 0.000 0.000
#> GSM152092     6  0.5516      0.518 0.244 0.000 0.000 0.000 0.196 0.560
#> GSM152093     1  0.3229      0.777 0.816 0.000 0.140 0.000 0.000 0.044
#> GSM152094     6  0.1814      0.859 0.100 0.000 0.000 0.000 0.000 0.900
#> GSM152098     6  0.2393      0.847 0.040 0.000 0.004 0.000 0.064 0.892
#> GSM152110     1  0.0632      0.908 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM152031     5  0.3717      0.543 0.384 0.000 0.000 0.000 0.616 0.000
#> GSM152037     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152055     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152061     6  0.1610      0.862 0.084 0.000 0.000 0.000 0.000 0.916
#> GSM152064     6  0.3979      0.685 0.256 0.000 0.000 0.036 0.000 0.708
#> GSM152087     6  0.1814      0.859 0.100 0.000 0.000 0.000 0.000 0.900
#> GSM152103     5  0.6684      0.418 0.228 0.000 0.204 0.004 0.504 0.060

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 specimen(p) k
#> CV:pam 57    7.39e-05 2
#> CV:pam 60    2.61e-04 3
#> CV:pam 84    8.83e-04 4
#> CV:pam 53    2.86e-03 5
#> CV:pam 86    1.32e-02 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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.441           0.771       0.870         0.2825 0.796   0.796
#> 3 3 0.260           0.579       0.805         1.0557 0.460   0.371
#> 4 4 0.583           0.629       0.734         0.1668 0.820   0.588
#> 5 5 0.647           0.708       0.817         0.0842 0.713   0.327
#> 6 6 0.572           0.530       0.682         0.0573 0.953   0.823

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
#> GSM152032     2  0.0376     0.8611 0.004 0.996
#> GSM152033     2  0.0000     0.8614 0.000 1.000
#> GSM152063     2  0.4022     0.8242 0.080 0.920
#> GSM152074     2  0.0376     0.8611 0.004 0.996
#> GSM152080     2  0.4022     0.8239 0.080 0.920
#> GSM152081     2  0.0672     0.8615 0.008 0.992
#> GSM152083     2  0.3879     0.8266 0.076 0.924
#> GSM152091     2  0.3879     0.8267 0.076 0.924
#> GSM152108     2  0.2043     0.8510 0.032 0.968
#> GSM152114     2  0.1184     0.8600 0.016 0.984
#> GSM152035     2  0.3274     0.8364 0.060 0.940
#> GSM152039     2  0.0938     0.8615 0.012 0.988
#> GSM152041     2  0.4161     0.8314 0.084 0.916
#> GSM152044     2  0.4431     0.8150 0.092 0.908
#> GSM152045     2  0.4298     0.8298 0.088 0.912
#> GSM152051     2  0.4431     0.8150 0.092 0.908
#> GSM152054     2  0.0672     0.8606 0.008 0.992
#> GSM152057     2  0.4431     0.8150 0.092 0.908
#> GSM152058     1  0.8016     0.7718 0.756 0.244
#> GSM152067     2  0.0376     0.8611 0.004 0.996
#> GSM152068     2  0.4431     0.8150 0.092 0.908
#> GSM152075     2  0.0376     0.8611 0.004 0.996
#> GSM152076     2  0.0938     0.8615 0.012 0.988
#> GSM152079     2  0.4431     0.8150 0.092 0.908
#> GSM152084     2  0.0376     0.8611 0.004 0.996
#> GSM152089     2  0.2423     0.8513 0.040 0.960
#> GSM152095     2  0.0938     0.8615 0.012 0.988
#> GSM152096     2  0.2423     0.8472 0.040 0.960
#> GSM152097     2  0.4431     0.8150 0.092 0.908
#> GSM152099     2  0.4431     0.8150 0.092 0.908
#> GSM152106     2  0.4431     0.8150 0.092 0.908
#> GSM152107     2  0.0376     0.8611 0.004 0.996
#> GSM152109     2  0.0376     0.8611 0.004 0.996
#> GSM152111     1  0.5294     0.8494 0.880 0.120
#> GSM152112     2  0.0672     0.8615 0.008 0.992
#> GSM152113     2  0.0376     0.8611 0.004 0.996
#> GSM152115     2  0.0376     0.8611 0.004 0.996
#> GSM152030     2  0.0376     0.8611 0.004 0.996
#> GSM152038     2  0.0376     0.8611 0.004 0.996
#> GSM152042     2  0.0376     0.8611 0.004 0.996
#> GSM152062     2  0.0376     0.8611 0.004 0.996
#> GSM152077     2  0.6148     0.7793 0.152 0.848
#> GSM152088     2  0.4431     0.8150 0.092 0.908
#> GSM152100     2  0.0376     0.8611 0.004 0.996
#> GSM152102     2  0.2423     0.8472 0.040 0.960
#> GSM152104     2  0.4431     0.8150 0.092 0.908
#> GSM152028     2  0.5737     0.8021 0.136 0.864
#> GSM152029     2  0.5178     0.8135 0.116 0.884
#> GSM152049     1  0.4562     0.8561 0.904 0.096
#> GSM152053     2  0.0376     0.8611 0.004 0.996
#> GSM152059     2  0.8443     0.6333 0.272 0.728
#> GSM152085     2  0.9993    -0.0568 0.484 0.516
#> GSM152101     2  0.0376     0.8611 0.004 0.996
#> GSM152105     2  0.6712     0.7631 0.176 0.824
#> GSM152034     2  0.8713     0.5860 0.292 0.708
#> GSM152036     2  0.0672     0.8617 0.008 0.992
#> GSM152040     2  0.6531     0.7754 0.168 0.832
#> GSM152043     2  0.8909     0.5637 0.308 0.692
#> GSM152046     2  0.9552     0.3796 0.376 0.624
#> GSM152047     2  0.5842     0.7991 0.140 0.860
#> GSM152048     1  0.4431     0.8564 0.908 0.092
#> GSM152050     1  0.9170     0.6544 0.668 0.332
#> GSM152052     2  0.6048     0.7922 0.148 0.852
#> GSM152056     1  0.4431     0.8564 0.908 0.092
#> GSM152060     2  0.8661     0.6004 0.288 0.712
#> GSM152065     2  0.4939     0.8174 0.108 0.892
#> GSM152066     1  0.4431     0.8564 0.908 0.092
#> GSM152069     2  0.0672     0.8606 0.008 0.992
#> GSM152070     2  0.6531     0.7757 0.168 0.832
#> GSM152071     2  0.0000     0.8614 0.000 1.000
#> GSM152072     2  0.4939     0.8174 0.108 0.892
#> GSM152073     2  0.8608     0.6124 0.284 0.716
#> GSM152078     2  0.5178     0.8140 0.116 0.884
#> GSM152082     2  0.5294     0.8121 0.120 0.880
#> GSM152086     1  0.4431     0.8564 0.908 0.092
#> GSM152090     2  0.0376     0.8611 0.004 0.996
#> GSM152092     2  0.7139     0.7451 0.196 0.804
#> GSM152093     2  0.9881     0.1049 0.436 0.564
#> GSM152094     1  0.8861     0.6979 0.696 0.304
#> GSM152098     2  0.6801     0.7641 0.180 0.820
#> GSM152110     2  0.8661     0.5923 0.288 0.712
#> GSM152031     2  0.8327     0.6458 0.264 0.736
#> GSM152037     1  0.9754     0.4577 0.592 0.408
#> GSM152055     2  0.9491     0.4010 0.368 0.632
#> GSM152061     2  0.8555     0.6147 0.280 0.720
#> GSM152064     2  0.7453     0.7243 0.212 0.788
#> GSM152087     2  0.9580     0.3739 0.380 0.620
#> GSM152103     2  0.4161     0.8322 0.084 0.916

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152033     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152063     2  0.3482     0.9810 0.000 0.872 0.128
#> GSM152074     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152080     3  0.6154    -0.0964 0.000 0.408 0.592
#> GSM152081     3  0.6299     0.1148 0.476 0.000 0.524
#> GSM152083     3  0.6111    -0.0688 0.000 0.396 0.604
#> GSM152091     2  0.3551     0.9777 0.000 0.868 0.132
#> GSM152108     3  0.6669     0.1257 0.468 0.008 0.524
#> GSM152114     3  0.6299     0.1148 0.476 0.000 0.524
#> GSM152035     2  0.4291     0.9200 0.000 0.820 0.180
#> GSM152039     3  0.6513    -0.0925 0.004 0.476 0.520
#> GSM152041     3  0.6672     0.1177 0.472 0.008 0.520
#> GSM152044     2  0.3482     0.9810 0.000 0.872 0.128
#> GSM152045     3  0.4654     0.4885 0.208 0.000 0.792
#> GSM152051     2  0.3267     0.9755 0.000 0.884 0.116
#> GSM152054     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152057     2  0.3192     0.9741 0.000 0.888 0.112
#> GSM152058     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152067     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152068     2  0.3192     0.9741 0.000 0.888 0.112
#> GSM152075     3  0.6672     0.1177 0.472 0.008 0.520
#> GSM152076     3  0.6513    -0.0925 0.004 0.476 0.520
#> GSM152079     2  0.3192     0.9741 0.000 0.888 0.112
#> GSM152084     3  0.6295     0.1221 0.472 0.000 0.528
#> GSM152089     3  0.6295     0.1221 0.472 0.000 0.528
#> GSM152095     3  0.6672    -0.0827 0.008 0.472 0.520
#> GSM152096     3  0.1860     0.5312 0.000 0.052 0.948
#> GSM152097     2  0.3482     0.9810 0.000 0.872 0.128
#> GSM152099     2  0.3482     0.9810 0.000 0.872 0.128
#> GSM152106     2  0.3551     0.9761 0.000 0.868 0.132
#> GSM152107     3  0.5497     0.4300 0.292 0.000 0.708
#> GSM152109     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152111     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152112     3  0.0000     0.5625 0.000 0.000 1.000
#> GSM152113     3  0.3941     0.5656 0.156 0.000 0.844
#> GSM152115     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152030     3  0.6509     0.1210 0.472 0.004 0.524
#> GSM152038     3  0.4002     0.5180 0.160 0.000 0.840
#> GSM152042     3  0.6299     0.1148 0.476 0.000 0.524
#> GSM152062     3  0.2878     0.5703 0.096 0.000 0.904
#> GSM152077     1  0.6305    -0.0187 0.516 0.000 0.484
#> GSM152088     2  0.3192     0.9741 0.000 0.888 0.112
#> GSM152100     3  0.6509    -0.0897 0.004 0.472 0.524
#> GSM152102     3  0.3192     0.4758 0.000 0.112 0.888
#> GSM152104     2  0.3482     0.9810 0.000 0.872 0.128
#> GSM152028     1  0.3686     0.8486 0.860 0.000 0.140
#> GSM152029     1  0.4842     0.7322 0.776 0.000 0.224
#> GSM152049     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152053     3  0.6295     0.1221 0.472 0.000 0.528
#> GSM152059     1  0.3619     0.8504 0.864 0.000 0.136
#> GSM152085     1  0.3340     0.8517 0.880 0.000 0.120
#> GSM152101     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152105     1  0.3686     0.8486 0.860 0.000 0.140
#> GSM152034     1  0.3784     0.8511 0.864 0.004 0.132
#> GSM152036     3  0.7372    -0.0277 0.032 0.448 0.520
#> GSM152040     1  0.3686     0.8486 0.860 0.000 0.140
#> GSM152043     1  0.3619     0.8504 0.864 0.000 0.136
#> GSM152046     1  0.4196     0.8184 0.864 0.112 0.024
#> GSM152047     1  0.3686     0.8486 0.860 0.000 0.140
#> GSM152048     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152050     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152052     1  0.3816     0.8424 0.852 0.000 0.148
#> GSM152056     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152060     1  0.4196     0.8184 0.864 0.112 0.024
#> GSM152065     3  0.6045     0.2298 0.380 0.000 0.620
#> GSM152066     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152069     3  0.0237     0.5622 0.000 0.004 0.996
#> GSM152070     3  0.6079     0.2150 0.388 0.000 0.612
#> GSM152071     3  0.0000     0.5625 0.000 0.000 1.000
#> GSM152072     3  0.5098     0.4462 0.248 0.000 0.752
#> GSM152073     1  0.3619     0.8504 0.864 0.000 0.136
#> GSM152078     1  0.4346     0.8038 0.816 0.000 0.184
#> GSM152082     3  0.6079     0.2150 0.388 0.000 0.612
#> GSM152086     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152090     3  0.6295     0.1221 0.472 0.000 0.528
#> GSM152092     1  0.3686     0.8486 0.860 0.000 0.140
#> GSM152093     1  0.2796     0.8445 0.908 0.000 0.092
#> GSM152094     1  0.0000     0.8165 1.000 0.000 0.000
#> GSM152098     3  0.6140     0.1867 0.404 0.000 0.596
#> GSM152110     1  0.3619     0.8504 0.864 0.000 0.136
#> GSM152031     1  0.3686     0.8486 0.860 0.000 0.140
#> GSM152037     1  0.0237     0.8187 0.996 0.000 0.004
#> GSM152055     1  0.4196     0.8184 0.864 0.112 0.024
#> GSM152061     1  0.4443     0.8341 0.864 0.084 0.052
#> GSM152064     1  0.3784     0.8511 0.864 0.004 0.132
#> GSM152087     1  0.3619     0.8504 0.864 0.000 0.136
#> GSM152103     1  0.6309    -0.0579 0.504 0.000 0.496

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.2189     0.4089 0.004 0.020 0.932 0.044
#> GSM152033     3  0.1229     0.4217 0.004 0.008 0.968 0.020
#> GSM152063     2  0.0657     0.9119 0.004 0.984 0.000 0.012
#> GSM152074     3  0.2125     0.4091 0.004 0.012 0.932 0.052
#> GSM152080     2  0.4584     0.6125 0.004 0.696 0.300 0.000
#> GSM152081     3  0.8493     0.3572 0.296 0.028 0.412 0.264
#> GSM152083     2  0.4584     0.6125 0.004 0.696 0.300 0.000
#> GSM152091     2  0.1305     0.8868 0.004 0.960 0.036 0.000
#> GSM152108     3  0.7186     0.4542 0.260 0.044 0.612 0.084
#> GSM152114     3  0.7613     0.4135 0.340 0.000 0.448 0.212
#> GSM152035     2  0.2795     0.8244 0.004 0.896 0.088 0.012
#> GSM152039     4  0.5143     0.6425 0.000 0.256 0.036 0.708
#> GSM152041     3  0.8656     0.2782 0.276 0.036 0.400 0.288
#> GSM152044     2  0.0779     0.9108 0.004 0.980 0.000 0.016
#> GSM152045     3  0.7589     0.2153 0.196 0.000 0.404 0.400
#> GSM152051     2  0.1247     0.9013 0.004 0.968 0.016 0.012
#> GSM152054     3  0.4008     0.3999 0.000 0.000 0.756 0.244
#> GSM152057     2  0.0188     0.9130 0.004 0.996 0.000 0.000
#> GSM152058     1  0.0336     0.8647 0.992 0.000 0.000 0.008
#> GSM152067     3  0.4193     0.3962 0.000 0.000 0.732 0.268
#> GSM152068     2  0.0188     0.9130 0.004 0.996 0.000 0.000
#> GSM152075     4  0.8174     0.0959 0.256 0.040 0.188 0.516
#> GSM152076     4  0.5143     0.6425 0.000 0.256 0.036 0.708
#> GSM152079     2  0.0524     0.9117 0.004 0.988 0.000 0.008
#> GSM152084     3  0.7597     0.4309 0.308 0.000 0.468 0.224
#> GSM152089     4  0.7307    -0.2478 0.156 0.000 0.376 0.468
#> GSM152095     4  0.5143     0.6425 0.000 0.256 0.036 0.708
#> GSM152096     3  0.2441     0.3819 0.004 0.068 0.916 0.012
#> GSM152097     2  0.1489     0.8954 0.004 0.952 0.000 0.044
#> GSM152099     2  0.0376     0.9125 0.004 0.992 0.004 0.000
#> GSM152106     2  0.1576     0.8914 0.004 0.948 0.000 0.048
#> GSM152107     3  0.7232     0.4569 0.268 0.008 0.568 0.156
#> GSM152109     3  0.1822     0.4124 0.004 0.008 0.944 0.044
#> GSM152111     1  0.0524     0.8641 0.988 0.004 0.000 0.008
#> GSM152112     3  0.4955     0.1635 0.000 0.000 0.556 0.444
#> GSM152113     3  0.7634     0.4435 0.284 0.008 0.512 0.196
#> GSM152115     3  0.4193     0.3962 0.000 0.000 0.732 0.268
#> GSM152030     3  0.8635     0.3679 0.316 0.040 0.412 0.232
#> GSM152038     3  0.7651     0.3847 0.288 0.008 0.508 0.196
#> GSM152042     3  0.8050     0.4117 0.320 0.012 0.440 0.228
#> GSM152062     3  0.7830     0.4349 0.284 0.008 0.480 0.228
#> GSM152077     3  0.7485     0.3936 0.380 0.000 0.440 0.180
#> GSM152088     2  0.0188     0.9130 0.004 0.996 0.000 0.000
#> GSM152100     4  0.7387     0.5994 0.000 0.256 0.224 0.520
#> GSM152102     3  0.5590     0.3492 0.000 0.064 0.692 0.244
#> GSM152104     2  0.1305     0.9007 0.004 0.960 0.000 0.036
#> GSM152028     1  0.1792     0.8490 0.932 0.000 0.068 0.000
#> GSM152029     1  0.6944     0.1607 0.588 0.000 0.216 0.196
#> GSM152049     1  0.0524     0.8641 0.988 0.004 0.000 0.008
#> GSM152053     3  0.7626     0.4300 0.304 0.000 0.464 0.232
#> GSM152059     1  0.1118     0.8630 0.964 0.000 0.036 0.000
#> GSM152085     1  0.1004     0.8652 0.972 0.000 0.004 0.024
#> GSM152101     3  0.4193     0.3962 0.000 0.000 0.732 0.268
#> GSM152105     1  0.1940     0.8468 0.924 0.000 0.076 0.000
#> GSM152034     1  0.2335     0.8557 0.920 0.000 0.020 0.060
#> GSM152036     4  0.6970     0.6303 0.000 0.256 0.168 0.576
#> GSM152040     1  0.5947     0.6027 0.688 0.000 0.112 0.200
#> GSM152043     1  0.1722     0.8612 0.944 0.000 0.048 0.008
#> GSM152046     1  0.2334     0.8470 0.908 0.000 0.004 0.088
#> GSM152047     1  0.2179     0.8550 0.924 0.000 0.064 0.012
#> GSM152048     1  0.0712     0.8646 0.984 0.004 0.004 0.008
#> GSM152050     1  0.0376     0.8656 0.992 0.000 0.004 0.004
#> GSM152052     1  0.2197     0.8405 0.916 0.000 0.080 0.004
#> GSM152056     1  0.0524     0.8641 0.988 0.004 0.000 0.008
#> GSM152060     1  0.2593     0.8362 0.892 0.000 0.004 0.104
#> GSM152065     1  0.7264     0.3367 0.512 0.000 0.168 0.320
#> GSM152066     1  0.0524     0.8641 0.988 0.004 0.000 0.008
#> GSM152069     3  0.1339     0.4140 0.004 0.008 0.964 0.024
#> GSM152070     1  0.6626     0.5044 0.624 0.000 0.160 0.216
#> GSM152071     3  0.0859     0.4197 0.004 0.008 0.980 0.008
#> GSM152072     3  0.7613     0.2344 0.212 0.000 0.448 0.340
#> GSM152073     1  0.1474     0.8586 0.948 0.000 0.052 0.000
#> GSM152078     1  0.5962     0.4779 0.692 0.000 0.128 0.180
#> GSM152082     1  0.6862     0.4735 0.596 0.000 0.176 0.228
#> GSM152086     1  0.0524     0.8641 0.988 0.004 0.000 0.008
#> GSM152090     3  0.7559     0.4182 0.336 0.000 0.460 0.204
#> GSM152092     1  0.1867     0.8476 0.928 0.000 0.072 0.000
#> GSM152093     1  0.1452     0.8552 0.956 0.000 0.036 0.008
#> GSM152094     1  0.0188     0.8653 0.996 0.000 0.000 0.004
#> GSM152098     1  0.6586     0.5108 0.628 0.000 0.156 0.216
#> GSM152110     1  0.1452     0.8638 0.956 0.000 0.036 0.008
#> GSM152031     1  0.1302     0.8608 0.956 0.000 0.044 0.000
#> GSM152037     1  0.0524     0.8650 0.988 0.000 0.004 0.008
#> GSM152055     1  0.2675     0.8397 0.892 0.000 0.008 0.100
#> GSM152061     1  0.2593     0.8362 0.892 0.000 0.004 0.104
#> GSM152064     1  0.2596     0.8511 0.908 0.000 0.024 0.068
#> GSM152087     1  0.1109     0.8662 0.968 0.000 0.028 0.004
#> GSM152103     3  0.7584     0.4092 0.348 0.000 0.448 0.204

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.4437     0.7470 0.068 0.000 0.780 0.016 0.136
#> GSM152033     3  0.1877     0.8010 0.064 0.000 0.924 0.000 0.012
#> GSM152063     2  0.0609     0.9790 0.000 0.980 0.000 0.020 0.000
#> GSM152074     3  0.4375     0.7482 0.064 0.000 0.784 0.016 0.136
#> GSM152080     3  0.4599     0.4586 0.020 0.356 0.624 0.000 0.000
#> GSM152081     4  0.5818     0.5317 0.092 0.000 0.072 0.696 0.140
#> GSM152083     3  0.4599     0.4586 0.020 0.356 0.624 0.000 0.000
#> GSM152091     2  0.0609     0.9629 0.020 0.980 0.000 0.000 0.000
#> GSM152108     1  0.5042     0.5914 0.652 0.008 0.308 0.020 0.012
#> GSM152114     1  0.4695     0.6555 0.700 0.000 0.260 0.024 0.016
#> GSM152035     2  0.1728     0.9281 0.020 0.940 0.036 0.000 0.004
#> GSM152039     4  0.0290     0.6460 0.000 0.000 0.008 0.992 0.000
#> GSM152041     4  0.5142     0.5444 0.076 0.000 0.188 0.716 0.020
#> GSM152044     2  0.0609     0.9790 0.000 0.980 0.000 0.020 0.000
#> GSM152045     5  0.3972     0.7166 0.212 0.000 0.008 0.016 0.764
#> GSM152051     2  0.0324     0.9766 0.000 0.992 0.004 0.000 0.004
#> GSM152054     5  0.3935     0.5938 0.024 0.000 0.200 0.004 0.772
#> GSM152057     2  0.0000     0.9790 0.000 1.000 0.000 0.000 0.000
#> GSM152058     1  0.1557     0.7833 0.940 0.000 0.052 0.008 0.000
#> GSM152067     5  0.2672     0.6393 0.024 0.000 0.064 0.016 0.896
#> GSM152068     2  0.0000     0.9790 0.000 1.000 0.000 0.000 0.000
#> GSM152075     4  0.0740     0.6497 0.008 0.000 0.008 0.980 0.004
#> GSM152076     4  0.0290     0.6460 0.000 0.000 0.008 0.992 0.000
#> GSM152079     2  0.0162     0.9781 0.000 0.996 0.000 0.000 0.004
#> GSM152084     1  0.5198     0.6565 0.700 0.000 0.220 0.028 0.052
#> GSM152089     4  0.7425     0.0566 0.068 0.000 0.160 0.464 0.308
#> GSM152095     4  0.0290     0.6460 0.000 0.000 0.008 0.992 0.000
#> GSM152096     3  0.3704     0.7918 0.068 0.060 0.848 0.016 0.008
#> GSM152097     2  0.0609     0.9790 0.000 0.980 0.000 0.020 0.000
#> GSM152099     2  0.0510     0.9682 0.016 0.984 0.000 0.000 0.000
#> GSM152106     2  0.0703     0.9766 0.000 0.976 0.000 0.024 0.000
#> GSM152107     1  0.8987     0.1574 0.424 0.204 0.144 0.072 0.156
#> GSM152109     3  0.2741     0.8017 0.064 0.000 0.892 0.012 0.032
#> GSM152111     1  0.1764     0.7779 0.928 0.000 0.064 0.008 0.000
#> GSM152112     5  0.3414     0.6248 0.024 0.000 0.056 0.060 0.860
#> GSM152113     1  0.4940     0.6006 0.656 0.000 0.304 0.020 0.020
#> GSM152115     5  0.2537     0.6387 0.024 0.000 0.056 0.016 0.904
#> GSM152030     1  0.5864     0.6397 0.688 0.000 0.116 0.056 0.140
#> GSM152038     1  0.5841     0.5664 0.628 0.000 0.260 0.020 0.092
#> GSM152042     1  0.5860     0.6391 0.692 0.000 0.100 0.068 0.140
#> GSM152062     1  0.6164     0.5713 0.640 0.000 0.184 0.036 0.140
#> GSM152077     1  0.4739     0.6698 0.712 0.000 0.240 0.020 0.028
#> GSM152088     2  0.0000     0.9790 0.000 1.000 0.000 0.000 0.000
#> GSM152100     4  0.0740     0.6500 0.008 0.000 0.008 0.980 0.004
#> GSM152102     5  0.6100     0.5378 0.056 0.080 0.200 0.004 0.660
#> GSM152104     2  0.0609     0.9790 0.000 0.980 0.000 0.020 0.000
#> GSM152028     1  0.0162     0.7903 0.996 0.000 0.004 0.000 0.000
#> GSM152029     1  0.2418     0.7816 0.912 0.000 0.044 0.020 0.024
#> GSM152049     1  0.1764     0.7779 0.928 0.000 0.064 0.008 0.000
#> GSM152053     1  0.6475     0.5879 0.640 0.000 0.088 0.132 0.140
#> GSM152059     1  0.0000     0.7904 1.000 0.000 0.000 0.000 0.000
#> GSM152085     1  0.4639    -0.0578 0.612 0.000 0.020 0.368 0.000
#> GSM152101     5  0.2537     0.6387 0.024 0.000 0.056 0.016 0.904
#> GSM152105     1  0.0451     0.7912 0.988 0.000 0.004 0.000 0.008
#> GSM152034     4  0.4480     0.5845 0.400 0.000 0.004 0.592 0.004
#> GSM152036     4  0.0451     0.6463 0.000 0.000 0.008 0.988 0.004
#> GSM152040     5  0.4299     0.6457 0.388 0.000 0.000 0.004 0.608
#> GSM152043     1  0.0162     0.7903 0.996 0.000 0.004 0.000 0.000
#> GSM152046     4  0.5422     0.6199 0.348 0.000 0.000 0.580 0.072
#> GSM152047     4  0.4692     0.4983 0.460 0.000 0.004 0.528 0.008
#> GSM152048     1  0.1764     0.7779 0.928 0.000 0.064 0.008 0.000
#> GSM152050     1  0.1202     0.7885 0.960 0.000 0.032 0.004 0.004
#> GSM152052     1  0.0404     0.7916 0.988 0.000 0.012 0.000 0.000
#> GSM152056     1  0.1764     0.7779 0.928 0.000 0.064 0.008 0.000
#> GSM152060     4  0.5382     0.6266 0.336 0.000 0.000 0.592 0.072
#> GSM152065     5  0.4635     0.6969 0.320 0.000 0.008 0.016 0.656
#> GSM152066     1  0.1764     0.7779 0.928 0.000 0.064 0.008 0.000
#> GSM152069     3  0.1478     0.8005 0.064 0.000 0.936 0.000 0.000
#> GSM152070     5  0.4302     0.6879 0.344 0.000 0.004 0.004 0.648
#> GSM152071     3  0.2037     0.7953 0.064 0.000 0.920 0.012 0.004
#> GSM152072     5  0.4394     0.7185 0.256 0.000 0.012 0.016 0.716
#> GSM152073     1  0.0000     0.7904 1.000 0.000 0.000 0.000 0.000
#> GSM152078     1  0.1967     0.7856 0.932 0.000 0.036 0.020 0.012
#> GSM152082     5  0.4367     0.6625 0.372 0.000 0.008 0.000 0.620
#> GSM152086     1  0.1764     0.7779 0.928 0.000 0.064 0.008 0.000
#> GSM152090     1  0.4560     0.6540 0.700 0.000 0.268 0.020 0.012
#> GSM152092     1  0.0324     0.7906 0.992 0.000 0.004 0.004 0.000
#> GSM152093     1  0.2623     0.7841 0.884 0.000 0.096 0.004 0.016
#> GSM152094     1  0.1478     0.7779 0.936 0.000 0.064 0.000 0.000
#> GSM152098     5  0.4331     0.6332 0.400 0.000 0.004 0.000 0.596
#> GSM152110     1  0.1885     0.7892 0.932 0.000 0.044 0.004 0.020
#> GSM152031     1  0.0000     0.7904 1.000 0.000 0.000 0.000 0.000
#> GSM152037     1  0.1557     0.7833 0.940 0.000 0.052 0.008 0.000
#> GSM152055     4  0.4934     0.6115 0.364 0.000 0.000 0.600 0.036
#> GSM152061     4  0.5353     0.6292 0.328 0.000 0.000 0.600 0.072
#> GSM152064     4  0.4871     0.5919 0.384 0.000 0.012 0.592 0.012
#> GSM152087     1  0.0404     0.7898 0.988 0.000 0.012 0.000 0.000
#> GSM152103     1  0.4675     0.6604 0.704 0.000 0.256 0.020 0.020

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.3023     0.7092 0.008 0.004 0.808 0.000 0.180 0.000
#> GSM152033     3  0.0632     0.7535 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM152063     2  0.2482     0.8857 0.000 0.848 0.004 0.148 0.000 0.000
#> GSM152074     3  0.2562     0.7120 0.000 0.000 0.828 0.000 0.172 0.000
#> GSM152080     3  0.3955     0.3885 0.000 0.384 0.608 0.000 0.008 0.000
#> GSM152081     6  0.7656     0.3210 0.196 0.000 0.064 0.072 0.212 0.456
#> GSM152083     3  0.3955     0.3885 0.000 0.384 0.608 0.000 0.008 0.000
#> GSM152091     2  0.3243     0.8661 0.000 0.844 0.016 0.076 0.064 0.000
#> GSM152108     1  0.6980     0.4457 0.412 0.068 0.348 0.000 0.164 0.008
#> GSM152114     1  0.4606     0.5860 0.640 0.000 0.312 0.000 0.032 0.016
#> GSM152035     2  0.3813     0.8343 0.000 0.812 0.040 0.072 0.076 0.000
#> GSM152039     4  0.4056     0.4545 0.004 0.000 0.000 0.576 0.004 0.416
#> GSM152041     6  0.7299     0.2758 0.104 0.000 0.236 0.156 0.024 0.480
#> GSM152044     2  0.2482     0.8856 0.000 0.848 0.000 0.148 0.004 0.000
#> GSM152045     5  0.7087     0.4317 0.096 0.000 0.068 0.396 0.400 0.040
#> GSM152051     2  0.0000     0.8949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.5855     0.3914 0.000 0.000 0.192 0.396 0.412 0.000
#> GSM152057     2  0.0000     0.8949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     1  0.0748     0.6678 0.976 0.000 0.000 0.004 0.004 0.016
#> GSM152067     5  0.4569     0.4310 0.000 0.000 0.040 0.396 0.564 0.000
#> GSM152068     2  0.0000     0.8949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     6  0.5837    -0.1723 0.076 0.000 0.016 0.412 0.016 0.480
#> GSM152076     4  0.4056     0.4545 0.004 0.000 0.000 0.576 0.004 0.416
#> GSM152079     2  0.0000     0.8949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152084     1  0.6161     0.5016 0.452 0.000 0.284 0.000 0.256 0.008
#> GSM152089     6  0.7952    -0.0448 0.016 0.000 0.180 0.224 0.260 0.320
#> GSM152095     4  0.4056     0.4545 0.004 0.000 0.000 0.576 0.004 0.416
#> GSM152096     3  0.2976     0.7443 0.008 0.128 0.844 0.000 0.016 0.004
#> GSM152097     2  0.3011     0.8671 0.000 0.800 0.000 0.192 0.004 0.004
#> GSM152099     2  0.0260     0.8915 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM152106     2  0.3074     0.8616 0.000 0.792 0.000 0.200 0.004 0.004
#> GSM152107     5  0.7328    -0.3697 0.368 0.012 0.136 0.064 0.400 0.020
#> GSM152109     3  0.1267     0.7654 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM152111     1  0.1889     0.6614 0.920 0.000 0.020 0.004 0.000 0.056
#> GSM152112     5  0.4334     0.4306 0.000 0.000 0.024 0.408 0.568 0.000
#> GSM152113     1  0.6105     0.4614 0.408 0.000 0.384 0.000 0.200 0.008
#> GSM152115     5  0.4237     0.4310 0.000 0.000 0.020 0.396 0.584 0.000
#> GSM152030     1  0.5828     0.5233 0.604 0.000 0.136 0.000 0.216 0.044
#> GSM152038     5  0.7039    -0.2574 0.284 0.000 0.268 0.004 0.388 0.056
#> GSM152042     1  0.6596     0.4604 0.468 0.000 0.144 0.000 0.320 0.068
#> GSM152062     1  0.6242     0.3560 0.376 0.000 0.244 0.000 0.372 0.008
#> GSM152077     1  0.4681     0.6016 0.664 0.000 0.280 0.004 0.032 0.020
#> GSM152088     2  0.0000     0.8949 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152100     4  0.4714     0.4061 0.004 0.000 0.008 0.548 0.024 0.416
#> GSM152102     4  0.7225    -0.4332 0.004 0.124 0.148 0.404 0.320 0.000
#> GSM152104     2  0.2838     0.8717 0.000 0.808 0.000 0.188 0.004 0.000
#> GSM152028     1  0.5048     0.5537 0.604 0.000 0.068 0.000 0.316 0.012
#> GSM152029     1  0.5537     0.6269 0.620 0.000 0.140 0.000 0.216 0.024
#> GSM152049     1  0.1080     0.6608 0.960 0.000 0.000 0.004 0.004 0.032
#> GSM152053     1  0.7325     0.3652 0.408 0.000 0.084 0.048 0.364 0.096
#> GSM152059     1  0.1745     0.6853 0.920 0.000 0.012 0.000 0.068 0.000
#> GSM152085     1  0.3528     0.3490 0.700 0.000 0.000 0.000 0.004 0.296
#> GSM152101     5  0.4237     0.4310 0.000 0.000 0.020 0.396 0.584 0.000
#> GSM152105     1  0.3253     0.6838 0.832 0.000 0.068 0.000 0.096 0.004
#> GSM152034     6  0.5160     0.4709 0.324 0.000 0.068 0.000 0.016 0.592
#> GSM152036     4  0.4158     0.4520 0.004 0.000 0.000 0.572 0.008 0.416
#> GSM152040     5  0.7556     0.4379 0.188 0.000 0.040 0.168 0.480 0.124
#> GSM152043     1  0.6064     0.5501 0.580 0.000 0.068 0.000 0.240 0.112
#> GSM152046     6  0.1863     0.4480 0.104 0.000 0.000 0.000 0.000 0.896
#> GSM152047     6  0.6128     0.4249 0.316 0.000 0.068 0.000 0.088 0.528
#> GSM152048     1  0.1377     0.6736 0.952 0.000 0.016 0.004 0.004 0.024
#> GSM152050     1  0.3450     0.6064 0.820 0.000 0.056 0.004 0.004 0.116
#> GSM152052     1  0.2519     0.6851 0.884 0.000 0.068 0.000 0.044 0.004
#> GSM152056     1  0.1010     0.6610 0.960 0.000 0.000 0.004 0.000 0.036
#> GSM152060     6  0.1765     0.4465 0.096 0.000 0.000 0.000 0.000 0.904
#> GSM152065     5  0.7626     0.4450 0.144 0.000 0.076 0.168 0.500 0.112
#> GSM152066     1  0.0748     0.6684 0.976 0.000 0.000 0.004 0.004 0.016
#> GSM152069     3  0.0260     0.7581 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM152070     5  0.7243     0.4437 0.220 0.000 0.016 0.176 0.480 0.108
#> GSM152071     3  0.0146     0.7573 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM152072     4  0.7695    -0.5480 0.136 0.000 0.072 0.376 0.348 0.068
#> GSM152073     1  0.4591     0.6070 0.704 0.000 0.012 0.000 0.208 0.076
#> GSM152078     1  0.4761     0.6443 0.688 0.000 0.088 0.000 0.212 0.012
#> GSM152082     5  0.5658     0.3042 0.172 0.000 0.072 0.000 0.648 0.108
#> GSM152086     1  0.1080     0.6619 0.960 0.000 0.000 0.004 0.004 0.032
#> GSM152090     1  0.5265     0.5694 0.572 0.000 0.328 0.000 0.092 0.008
#> GSM152092     1  0.5907     0.5634 0.592 0.000 0.068 0.000 0.248 0.092
#> GSM152093     1  0.2971     0.6711 0.848 0.000 0.116 0.000 0.012 0.024
#> GSM152094     1  0.0922     0.6659 0.968 0.000 0.000 0.004 0.004 0.024
#> GSM152098     5  0.6971     0.4240 0.224 0.000 0.016 0.132 0.520 0.108
#> GSM152110     1  0.5574     0.4812 0.604 0.000 0.140 0.000 0.020 0.236
#> GSM152031     1  0.2445     0.6859 0.872 0.000 0.020 0.000 0.108 0.000
#> GSM152037     1  0.1511     0.6796 0.940 0.000 0.044 0.000 0.004 0.012
#> GSM152055     6  0.3633     0.4937 0.148 0.000 0.056 0.000 0.004 0.792
#> GSM152061     6  0.1908     0.4504 0.096 0.000 0.000 0.000 0.004 0.900
#> GSM152064     6  0.5180     0.4784 0.316 0.000 0.072 0.000 0.016 0.596
#> GSM152087     1  0.3667     0.5867 0.776 0.000 0.008 0.000 0.032 0.184
#> GSM152103     1  0.5051     0.5856 0.600 0.000 0.316 0.000 0.076 0.008

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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 specimen(p) k
#> CV:mclust 82    1.79e-01 2
#> CV:mclust 60    3.00e-06 3
#> CV:mclust 52    2.28e-06 4
#> CV:mclust 82    4.30e-03 5
#> CV:mclust 48    4.97e-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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.700           0.831       0.930         0.4869 0.515   0.515
#> 3 3 0.450           0.599       0.785         0.3521 0.742   0.544
#> 4 4 0.537           0.623       0.804         0.1249 0.797   0.508
#> 5 5 0.607           0.616       0.792         0.0679 0.899   0.652
#> 6 6 0.733           0.645       0.824         0.0403 0.868   0.485

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
#> GSM152032     2  0.9881     0.0992 0.436 0.564
#> GSM152033     1  0.8813     0.6123 0.700 0.300
#> GSM152063     2  0.0000     0.9394 0.000 1.000
#> GSM152074     1  0.9754     0.4087 0.592 0.408
#> GSM152080     2  0.0000     0.9394 0.000 1.000
#> GSM152081     2  0.0376     0.9366 0.004 0.996
#> GSM152083     2  0.0000     0.9394 0.000 1.000
#> GSM152091     2  0.0000     0.9394 0.000 1.000
#> GSM152108     2  0.0000     0.9394 0.000 1.000
#> GSM152114     2  0.9998    -0.0712 0.492 0.508
#> GSM152035     2  0.0000     0.9394 0.000 1.000
#> GSM152039     2  0.0000     0.9394 0.000 1.000
#> GSM152041     2  0.8327     0.6080 0.264 0.736
#> GSM152044     2  0.0000     0.9394 0.000 1.000
#> GSM152045     1  0.0000     0.9072 1.000 0.000
#> GSM152051     2  0.0000     0.9394 0.000 1.000
#> GSM152054     1  0.9608     0.4606 0.616 0.384
#> GSM152057     2  0.0000     0.9394 0.000 1.000
#> GSM152058     1  0.0000     0.9072 1.000 0.000
#> GSM152067     1  0.9710     0.4284 0.600 0.400
#> GSM152068     2  0.0000     0.9394 0.000 1.000
#> GSM152075     2  0.0000     0.9394 0.000 1.000
#> GSM152076     2  0.0000     0.9394 0.000 1.000
#> GSM152079     2  0.0000     0.9394 0.000 1.000
#> GSM152084     1  0.9358     0.5267 0.648 0.352
#> GSM152089     2  0.5294     0.8251 0.120 0.880
#> GSM152095     2  0.0000     0.9394 0.000 1.000
#> GSM152096     2  0.0672     0.9336 0.008 0.992
#> GSM152097     2  0.0000     0.9394 0.000 1.000
#> GSM152099     2  0.0000     0.9394 0.000 1.000
#> GSM152106     2  0.0000     0.9394 0.000 1.000
#> GSM152107     2  0.0376     0.9366 0.004 0.996
#> GSM152109     1  0.9710     0.4284 0.600 0.400
#> GSM152111     1  0.0000     0.9072 1.000 0.000
#> GSM152112     2  0.0000     0.9394 0.000 1.000
#> GSM152113     1  0.8081     0.6833 0.752 0.248
#> GSM152115     1  0.9635     0.4541 0.612 0.388
#> GSM152030     2  0.0000     0.9394 0.000 1.000
#> GSM152038     1  0.0000     0.9072 1.000 0.000
#> GSM152042     2  0.0000     0.9394 0.000 1.000
#> GSM152062     1  0.9000     0.5879 0.684 0.316
#> GSM152077     1  0.0000     0.9072 1.000 0.000
#> GSM152088     2  0.0000     0.9394 0.000 1.000
#> GSM152100     2  0.0000     0.9394 0.000 1.000
#> GSM152102     2  0.4298     0.8530 0.088 0.912
#> GSM152104     2  0.0000     0.9394 0.000 1.000
#> GSM152028     1  0.0000     0.9072 1.000 0.000
#> GSM152029     1  0.0000     0.9072 1.000 0.000
#> GSM152049     1  0.0000     0.9072 1.000 0.000
#> GSM152053     2  0.0000     0.9394 0.000 1.000
#> GSM152059     1  0.0000     0.9072 1.000 0.000
#> GSM152085     1  0.0000     0.9072 1.000 0.000
#> GSM152101     2  0.9491     0.3269 0.368 0.632
#> GSM152105     1  0.0000     0.9072 1.000 0.000
#> GSM152034     1  0.0376     0.9046 0.996 0.004
#> GSM152036     2  0.1184     0.9265 0.016 0.984
#> GSM152040     1  0.0000     0.9072 1.000 0.000
#> GSM152043     1  0.0000     0.9072 1.000 0.000
#> GSM152046     1  0.0000     0.9072 1.000 0.000
#> GSM152047     1  0.0000     0.9072 1.000 0.000
#> GSM152048     1  0.0000     0.9072 1.000 0.000
#> GSM152050     1  0.0000     0.9072 1.000 0.000
#> GSM152052     1  0.0000     0.9072 1.000 0.000
#> GSM152056     1  0.0000     0.9072 1.000 0.000
#> GSM152060     1  0.0000     0.9072 1.000 0.000
#> GSM152065     1  0.0000     0.9072 1.000 0.000
#> GSM152066     1  0.0000     0.9072 1.000 0.000
#> GSM152069     1  0.9710     0.4284 0.600 0.400
#> GSM152070     1  0.0000     0.9072 1.000 0.000
#> GSM152071     1  0.7376     0.7299 0.792 0.208
#> GSM152072     1  0.0000     0.9072 1.000 0.000
#> GSM152073     1  0.0000     0.9072 1.000 0.000
#> GSM152078     1  0.0000     0.9072 1.000 0.000
#> GSM152082     1  0.0000     0.9072 1.000 0.000
#> GSM152086     1  0.0000     0.9072 1.000 0.000
#> GSM152090     1  0.9358     0.5159 0.648 0.352
#> GSM152092     1  0.0000     0.9072 1.000 0.000
#> GSM152093     1  0.0376     0.9046 0.996 0.004
#> GSM152094     1  0.0000     0.9072 1.000 0.000
#> GSM152098     1  0.0000     0.9072 1.000 0.000
#> GSM152110     1  0.0000     0.9072 1.000 0.000
#> GSM152031     1  0.0000     0.9072 1.000 0.000
#> GSM152037     1  0.0000     0.9072 1.000 0.000
#> GSM152055     1  0.0000     0.9072 1.000 0.000
#> GSM152061     1  0.0000     0.9072 1.000 0.000
#> GSM152064     1  0.2236     0.8800 0.964 0.036
#> GSM152087     1  0.0000     0.9072 1.000 0.000
#> GSM152103     1  0.6438     0.7751 0.836 0.164

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.1411     0.6805 0.036 0.000 0.964
#> GSM152033     3  0.5497     0.5855 0.292 0.000 0.708
#> GSM152063     2  0.6180     0.3967 0.000 0.584 0.416
#> GSM152074     3  0.3267     0.6843 0.116 0.000 0.884
#> GSM152080     3  0.2537     0.6323 0.000 0.080 0.920
#> GSM152081     2  0.2152     0.7379 0.036 0.948 0.016
#> GSM152083     3  0.1163     0.6625 0.000 0.028 0.972
#> GSM152091     3  0.4346     0.5365 0.000 0.184 0.816
#> GSM152108     3  0.4291     0.5421 0.000 0.180 0.820
#> GSM152114     2  0.9083     0.3249 0.280 0.540 0.180
#> GSM152035     3  0.3340     0.6035 0.000 0.120 0.880
#> GSM152039     2  0.0424     0.7433 0.008 0.992 0.000
#> GSM152041     2  0.2959     0.6709 0.100 0.900 0.000
#> GSM152044     2  0.6180     0.4019 0.000 0.584 0.416
#> GSM152045     1  0.7265     0.5504 0.684 0.076 0.240
#> GSM152051     3  0.6274    -0.1162 0.000 0.456 0.544
#> GSM152054     3  0.4842     0.6504 0.224 0.000 0.776
#> GSM152057     3  0.6095     0.1013 0.000 0.392 0.608
#> GSM152058     1  0.3192     0.7708 0.888 0.112 0.000
#> GSM152067     3  0.3551     0.6823 0.132 0.000 0.868
#> GSM152068     2  0.6308     0.2130 0.000 0.508 0.492
#> GSM152075     2  0.1289     0.7326 0.032 0.968 0.000
#> GSM152076     2  0.0237     0.7440 0.004 0.996 0.000
#> GSM152079     3  0.6299    -0.1824 0.000 0.476 0.524
#> GSM152084     3  0.5327     0.6107 0.272 0.000 0.728
#> GSM152089     2  0.1315     0.7426 0.020 0.972 0.008
#> GSM152095     2  0.0983     0.7457 0.004 0.980 0.016
#> GSM152096     3  0.1031     0.6643 0.000 0.024 0.976
#> GSM152097     2  0.5497     0.5977 0.000 0.708 0.292
#> GSM152099     3  0.5733     0.2852 0.000 0.324 0.676
#> GSM152106     2  0.4178     0.6942 0.000 0.828 0.172
#> GSM152107     3  0.3412     0.6006 0.000 0.124 0.876
#> GSM152109     3  0.3340     0.6837 0.120 0.000 0.880
#> GSM152111     1  0.5760     0.6402 0.672 0.328 0.000
#> GSM152112     3  0.6008     0.2283 0.000 0.372 0.628
#> GSM152113     3  0.5733     0.5341 0.324 0.000 0.676
#> GSM152115     3  0.4887     0.6492 0.228 0.000 0.772
#> GSM152030     2  0.4654     0.6643 0.000 0.792 0.208
#> GSM152038     3  0.6302     0.1672 0.480 0.000 0.520
#> GSM152042     2  0.3879     0.7117 0.000 0.848 0.152
#> GSM152062     3  0.5098     0.6377 0.248 0.000 0.752
#> GSM152077     1  0.2301     0.7593 0.936 0.004 0.060
#> GSM152088     3  0.6154     0.0511 0.000 0.408 0.592
#> GSM152100     2  0.2066     0.7375 0.000 0.940 0.060
#> GSM152102     3  0.0424     0.6694 0.000 0.008 0.992
#> GSM152104     2  0.5621     0.5794 0.000 0.692 0.308
#> GSM152028     1  0.2448     0.7461 0.924 0.000 0.076
#> GSM152029     1  0.3116     0.7239 0.892 0.000 0.108
#> GSM152049     1  0.3816     0.7582 0.852 0.148 0.000
#> GSM152053     2  0.6026     0.4855 0.000 0.624 0.376
#> GSM152059     1  0.0424     0.7776 0.992 0.008 0.000
#> GSM152085     1  0.4974     0.7137 0.764 0.236 0.000
#> GSM152101     3  0.1289     0.6805 0.032 0.000 0.968
#> GSM152105     1  0.2796     0.7373 0.908 0.000 0.092
#> GSM152034     1  0.6280     0.4652 0.540 0.460 0.000
#> GSM152036     2  0.1860     0.7180 0.052 0.948 0.000
#> GSM152040     1  0.0747     0.7797 0.984 0.016 0.000
#> GSM152043     1  0.0424     0.7777 0.992 0.008 0.000
#> GSM152046     1  0.6140     0.5539 0.596 0.404 0.000
#> GSM152047     1  0.3686     0.7665 0.860 0.140 0.000
#> GSM152048     1  0.2261     0.7800 0.932 0.068 0.000
#> GSM152050     1  0.5926     0.6121 0.644 0.356 0.000
#> GSM152052     1  0.2165     0.7551 0.936 0.000 0.064
#> GSM152056     1  0.4796     0.7225 0.780 0.220 0.000
#> GSM152060     1  0.5948     0.6092 0.640 0.360 0.000
#> GSM152065     1  0.5882     0.3303 0.652 0.000 0.348
#> GSM152066     1  0.2356     0.7794 0.928 0.072 0.000
#> GSM152069     3  0.3879     0.6771 0.152 0.000 0.848
#> GSM152070     1  0.2711     0.7385 0.912 0.000 0.088
#> GSM152071     3  0.5138     0.6350 0.252 0.000 0.748
#> GSM152072     1  0.6309    -0.1490 0.504 0.000 0.496
#> GSM152073     1  0.0000     0.7753 1.000 0.000 0.000
#> GSM152078     1  0.4002     0.6738 0.840 0.000 0.160
#> GSM152082     1  0.2796     0.7359 0.908 0.000 0.092
#> GSM152086     1  0.4504     0.7350 0.804 0.196 0.000
#> GSM152090     1  0.7804     0.5334 0.664 0.120 0.216
#> GSM152092     1  0.2796     0.7364 0.908 0.000 0.092
#> GSM152093     1  0.5404     0.6944 0.740 0.256 0.004
#> GSM152094     1  0.4235     0.7521 0.824 0.176 0.000
#> GSM152098     1  0.2165     0.7520 0.936 0.000 0.064
#> GSM152110     1  0.5621     0.6614 0.692 0.308 0.000
#> GSM152031     1  0.1529     0.7637 0.960 0.000 0.040
#> GSM152037     1  0.1031     0.7805 0.976 0.024 0.000
#> GSM152055     1  0.6204     0.5252 0.576 0.424 0.000
#> GSM152061     1  0.6111     0.5647 0.604 0.396 0.000
#> GSM152064     1  0.6299     0.4351 0.524 0.476 0.000
#> GSM152087     1  0.2625     0.7778 0.916 0.084 0.000
#> GSM152103     1  0.4605     0.6233 0.796 0.000 0.204

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     2  0.6316     0.3430 0.080 0.596 0.324 0.000
#> GSM152033     3  0.4856     0.6023 0.084 0.136 0.780 0.000
#> GSM152063     2  0.4382     0.5941 0.000 0.704 0.000 0.296
#> GSM152074     3  0.6693     0.0243 0.088 0.424 0.488 0.000
#> GSM152080     2  0.1059     0.7603 0.000 0.972 0.016 0.012
#> GSM152081     4  0.2999     0.7370 0.004 0.000 0.132 0.864
#> GSM152083     2  0.1978     0.7453 0.000 0.928 0.068 0.004
#> GSM152091     2  0.1970     0.7755 0.000 0.932 0.008 0.060
#> GSM152108     2  0.5659     0.5978 0.076 0.740 0.168 0.016
#> GSM152114     1  0.6581     0.6126 0.700 0.056 0.160 0.084
#> GSM152035     2  0.3761     0.7496 0.000 0.852 0.080 0.068
#> GSM152039     4  0.0188     0.7885 0.000 0.004 0.000 0.996
#> GSM152041     4  0.0921     0.7796 0.028 0.000 0.000 0.972
#> GSM152044     2  0.4250     0.6162 0.000 0.724 0.000 0.276
#> GSM152045     3  0.4605     0.6494 0.108 0.000 0.800 0.092
#> GSM152051     2  0.2469     0.7711 0.000 0.892 0.000 0.108
#> GSM152054     3  0.3103     0.6743 0.008 0.072 0.892 0.028
#> GSM152057     2  0.2081     0.7773 0.000 0.916 0.000 0.084
#> GSM152058     1  0.1631     0.7988 0.956 0.016 0.020 0.008
#> GSM152067     3  0.2530     0.6613 0.000 0.112 0.888 0.000
#> GSM152068     2  0.2921     0.7506 0.000 0.860 0.000 0.140
#> GSM152075     4  0.0000     0.7883 0.000 0.000 0.000 1.000
#> GSM152076     4  0.0188     0.7885 0.000 0.004 0.000 0.996
#> GSM152079     2  0.2216     0.7755 0.000 0.908 0.000 0.092
#> GSM152084     2  0.7609    -0.0362 0.200 0.404 0.396 0.000
#> GSM152089     4  0.5755     0.0991 0.028 0.000 0.444 0.528
#> GSM152095     4  0.0336     0.7873 0.000 0.008 0.000 0.992
#> GSM152096     2  0.0967     0.7568 0.004 0.976 0.016 0.004
#> GSM152097     4  0.3726     0.5907 0.000 0.212 0.000 0.788
#> GSM152099     2  0.2266     0.7772 0.000 0.912 0.004 0.084
#> GSM152106     4  0.2011     0.7476 0.000 0.080 0.000 0.920
#> GSM152107     3  0.5594     0.5086 0.000 0.180 0.720 0.100
#> GSM152109     2  0.4467     0.6547 0.040 0.788 0.172 0.000
#> GSM152111     1  0.2530     0.7885 0.888 0.000 0.000 0.112
#> GSM152112     3  0.4552     0.6383 0.000 0.072 0.800 0.128
#> GSM152113     3  0.6033     0.5154 0.116 0.204 0.680 0.000
#> GSM152115     3  0.1474     0.6760 0.000 0.052 0.948 0.000
#> GSM152030     4  0.6919     0.5749 0.060 0.068 0.216 0.656
#> GSM152038     3  0.4731     0.6093 0.160 0.060 0.780 0.000
#> GSM152042     4  0.3697     0.7361 0.000 0.048 0.100 0.852
#> GSM152062     3  0.6673     0.4082 0.140 0.252 0.608 0.000
#> GSM152077     1  0.5442     0.5002 0.672 0.040 0.288 0.000
#> GSM152088     2  0.1637     0.7752 0.000 0.940 0.000 0.060
#> GSM152100     4  0.1182     0.7797 0.000 0.016 0.016 0.968
#> GSM152102     3  0.4677     0.4665 0.000 0.316 0.680 0.004
#> GSM152104     2  0.4985     0.2144 0.000 0.532 0.000 0.468
#> GSM152028     1  0.2480     0.7843 0.904 0.008 0.088 0.000
#> GSM152029     1  0.3962     0.7520 0.832 0.044 0.124 0.000
#> GSM152049     1  0.1610     0.8041 0.952 0.000 0.016 0.032
#> GSM152053     4  0.6005     0.4243 0.036 0.008 0.356 0.600
#> GSM152059     1  0.1557     0.7952 0.944 0.000 0.056 0.000
#> GSM152085     1  0.3243     0.7849 0.876 0.000 0.036 0.088
#> GSM152101     3  0.1824     0.6738 0.000 0.060 0.936 0.004
#> GSM152105     1  0.4669     0.6344 0.764 0.036 0.200 0.000
#> GSM152034     1  0.5894     0.3911 0.568 0.000 0.040 0.392
#> GSM152036     4  0.0188     0.7879 0.004 0.000 0.000 0.996
#> GSM152040     3  0.4606     0.5786 0.264 0.000 0.724 0.012
#> GSM152043     1  0.3123     0.7425 0.844 0.000 0.156 0.000
#> GSM152046     1  0.5256     0.6258 0.692 0.000 0.036 0.272
#> GSM152047     1  0.6646     0.0994 0.488 0.000 0.428 0.084
#> GSM152048     1  0.1339     0.7993 0.964 0.008 0.024 0.004
#> GSM152050     1  0.3356     0.7520 0.824 0.000 0.000 0.176
#> GSM152052     1  0.2706     0.7698 0.900 0.080 0.020 0.000
#> GSM152056     1  0.2156     0.8036 0.928 0.004 0.008 0.060
#> GSM152060     1  0.5750     0.6512 0.696 0.000 0.088 0.216
#> GSM152065     3  0.2704     0.6879 0.124 0.000 0.876 0.000
#> GSM152066     1  0.0927     0.7993 0.976 0.008 0.016 0.000
#> GSM152069     2  0.5026     0.4324 0.016 0.672 0.312 0.000
#> GSM152070     3  0.4331     0.5483 0.288 0.000 0.712 0.000
#> GSM152071     2  0.6216     0.4671 0.108 0.652 0.240 0.000
#> GSM152072     3  0.3681     0.6702 0.176 0.008 0.816 0.000
#> GSM152073     1  0.2408     0.7769 0.896 0.000 0.104 0.000
#> GSM152078     1  0.2670     0.7922 0.908 0.052 0.040 0.000
#> GSM152082     3  0.4543     0.4891 0.324 0.000 0.676 0.000
#> GSM152086     1  0.1576     0.8051 0.948 0.004 0.000 0.048
#> GSM152090     1  0.6086     0.2834 0.548 0.412 0.008 0.032
#> GSM152092     1  0.2760     0.7745 0.872 0.000 0.128 0.000
#> GSM152093     1  0.1854     0.8000 0.948 0.008 0.024 0.020
#> GSM152094     1  0.2142     0.7949 0.928 0.000 0.056 0.016
#> GSM152098     3  0.5165     0.0273 0.484 0.000 0.512 0.004
#> GSM152110     1  0.4401     0.6487 0.724 0.000 0.004 0.272
#> GSM152031     1  0.1151     0.7980 0.968 0.024 0.008 0.000
#> GSM152037     1  0.1042     0.7987 0.972 0.008 0.020 0.000
#> GSM152055     4  0.5143    -0.0850 0.456 0.000 0.004 0.540
#> GSM152061     1  0.6871     0.2313 0.480 0.000 0.104 0.416
#> GSM152064     4  0.4485     0.5242 0.248 0.000 0.012 0.740
#> GSM152087     1  0.2124     0.7911 0.924 0.000 0.068 0.008
#> GSM152103     1  0.4770     0.5602 0.700 0.288 0.012 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.2196     0.6834 0.004 0.056 0.916 0.000 0.024
#> GSM152033     3  0.4483     0.5523 0.012 0.008 0.672 0.000 0.308
#> GSM152063     2  0.3561     0.6610 0.000 0.740 0.000 0.260 0.000
#> GSM152074     3  0.2332     0.6899 0.004 0.016 0.904 0.000 0.076
#> GSM152080     2  0.0798     0.7690 0.008 0.976 0.016 0.000 0.000
#> GSM152081     4  0.3132     0.6763 0.000 0.000 0.172 0.820 0.008
#> GSM152083     2  0.4066     0.5398 0.000 0.672 0.324 0.000 0.004
#> GSM152091     2  0.0703     0.7842 0.000 0.976 0.000 0.024 0.000
#> GSM152108     3  0.5724     0.5902 0.024 0.132 0.676 0.000 0.168
#> GSM152114     3  0.5721     0.2346 0.344 0.000 0.576 0.068 0.012
#> GSM152035     2  0.7045     0.4131 0.000 0.540 0.220 0.052 0.188
#> GSM152039     4  0.0000     0.7991 0.000 0.000 0.000 1.000 0.000
#> GSM152041     4  0.0510     0.7910 0.016 0.000 0.000 0.984 0.000
#> GSM152044     2  0.3395     0.6833 0.000 0.764 0.000 0.236 0.000
#> GSM152045     5  0.1493     0.7355 0.028 0.000 0.000 0.024 0.948
#> GSM152051     2  0.1768     0.7843 0.000 0.924 0.004 0.072 0.000
#> GSM152054     5  0.1942     0.7010 0.000 0.012 0.068 0.000 0.920
#> GSM152057     2  0.4117     0.7445 0.000 0.788 0.096 0.116 0.000
#> GSM152058     1  0.4668     0.5628 0.688 0.000 0.276 0.008 0.028
#> GSM152067     5  0.4854     0.6011 0.016 0.072 0.172 0.000 0.740
#> GSM152068     2  0.2338     0.7714 0.000 0.884 0.004 0.112 0.000
#> GSM152075     4  0.0162     0.7985 0.000 0.000 0.004 0.996 0.000
#> GSM152076     4  0.0000     0.7991 0.000 0.000 0.000 1.000 0.000
#> GSM152079     2  0.1557     0.7860 0.000 0.940 0.008 0.052 0.000
#> GSM152084     3  0.1716     0.6868 0.016 0.024 0.944 0.000 0.016
#> GSM152089     5  0.3895     0.5176 0.000 0.000 0.000 0.320 0.680
#> GSM152095     4  0.0000     0.7991 0.000 0.000 0.000 1.000 0.000
#> GSM152096     2  0.0771     0.7774 0.004 0.976 0.020 0.000 0.000
#> GSM152097     4  0.4084     0.3513 0.000 0.328 0.004 0.668 0.000
#> GSM152099     2  0.2305     0.7812 0.000 0.896 0.012 0.092 0.000
#> GSM152106     4  0.2773     0.6631 0.000 0.164 0.000 0.836 0.000
#> GSM152107     3  0.6998     0.0184 0.000 0.028 0.452 0.168 0.352
#> GSM152109     2  0.5939     0.4360 0.056 0.604 0.300 0.000 0.040
#> GSM152111     1  0.1205     0.7662 0.956 0.000 0.004 0.040 0.000
#> GSM152112     5  0.5241     0.6133 0.000 0.012 0.088 0.204 0.696
#> GSM152113     3  0.4584     0.5964 0.020 0.016 0.708 0.000 0.256
#> GSM152115     5  0.3086     0.6304 0.000 0.004 0.180 0.000 0.816
#> GSM152030     3  0.4211     0.5112 0.008 0.008 0.728 0.252 0.004
#> GSM152038     3  0.3710     0.6553 0.024 0.000 0.784 0.000 0.192
#> GSM152042     4  0.4037     0.5409 0.000 0.004 0.288 0.704 0.004
#> GSM152062     3  0.2193     0.6744 0.000 0.028 0.912 0.000 0.060
#> GSM152077     3  0.4657     0.6298 0.152 0.000 0.740 0.000 0.108
#> GSM152088     2  0.0451     0.7793 0.004 0.988 0.000 0.008 0.000
#> GSM152100     4  0.2796     0.7054 0.000 0.008 0.008 0.868 0.116
#> GSM152102     5  0.4021     0.6199 0.000 0.168 0.052 0.000 0.780
#> GSM152104     2  0.3837     0.5923 0.000 0.692 0.000 0.308 0.000
#> GSM152028     1  0.6309     0.1865 0.492 0.000 0.340 0.000 0.168
#> GSM152029     1  0.5988     0.4182 0.612 0.272 0.024 0.000 0.092
#> GSM152049     1  0.1493     0.7660 0.948 0.000 0.024 0.028 0.000
#> GSM152053     3  0.3732     0.5959 0.000 0.000 0.792 0.176 0.032
#> GSM152059     1  0.0880     0.7615 0.968 0.000 0.000 0.000 0.032
#> GSM152085     1  0.1568     0.7614 0.944 0.000 0.000 0.020 0.036
#> GSM152101     5  0.2233     0.7014 0.000 0.004 0.104 0.000 0.892
#> GSM152105     3  0.5036    -0.0409 0.452 0.000 0.516 0.000 0.032
#> GSM152034     1  0.4017     0.6879 0.788 0.000 0.000 0.148 0.064
#> GSM152036     4  0.0290     0.7970 0.000 0.000 0.000 0.992 0.008
#> GSM152040     5  0.1792     0.7318 0.084 0.000 0.000 0.000 0.916
#> GSM152043     1  0.3333     0.6132 0.788 0.000 0.004 0.000 0.208
#> GSM152046     1  0.3983     0.6980 0.784 0.000 0.000 0.164 0.052
#> GSM152047     5  0.5509     0.4176 0.360 0.000 0.000 0.076 0.564
#> GSM152048     1  0.4887     0.5326 0.668 0.000 0.284 0.004 0.044
#> GSM152050     1  0.2813     0.7288 0.832 0.000 0.000 0.168 0.000
#> GSM152052     1  0.3239     0.7101 0.828 0.004 0.156 0.000 0.012
#> GSM152056     1  0.5282     0.6477 0.716 0.000 0.172 0.084 0.028
#> GSM152060     1  0.4393     0.6897 0.756 0.000 0.000 0.168 0.076
#> GSM152065     5  0.2233     0.6962 0.016 0.000 0.080 0.000 0.904
#> GSM152066     1  0.1956     0.7556 0.916 0.000 0.076 0.008 0.000
#> GSM152069     2  0.5267     0.6338 0.036 0.732 0.120 0.000 0.112
#> GSM152070     5  0.2966     0.6908 0.184 0.000 0.000 0.000 0.816
#> GSM152071     2  0.7589     0.2795 0.192 0.480 0.244 0.000 0.084
#> GSM152072     5  0.1662     0.7363 0.056 0.004 0.004 0.000 0.936
#> GSM152073     1  0.1608     0.7468 0.928 0.000 0.000 0.000 0.072
#> GSM152078     1  0.1469     0.7624 0.948 0.016 0.036 0.000 0.000
#> GSM152082     5  0.4166     0.5232 0.348 0.000 0.004 0.000 0.648
#> GSM152086     1  0.1830     0.7640 0.932 0.000 0.040 0.028 0.000
#> GSM152090     1  0.5119     0.3352 0.576 0.388 0.028 0.000 0.008
#> GSM152092     1  0.5490     0.5500 0.644 0.000 0.128 0.000 0.228
#> GSM152093     1  0.4796     0.6825 0.740 0.000 0.164 0.088 0.008
#> GSM152094     1  0.1043     0.7601 0.960 0.000 0.000 0.000 0.040
#> GSM152098     5  0.4415     0.3287 0.444 0.000 0.004 0.000 0.552
#> GSM152110     1  0.5920     0.5082 0.592 0.000 0.072 0.312 0.024
#> GSM152031     1  0.1410     0.7600 0.940 0.000 0.060 0.000 0.000
#> GSM152037     1  0.4250     0.6007 0.720 0.000 0.252 0.000 0.028
#> GSM152055     4  0.4310     0.1362 0.392 0.000 0.000 0.604 0.004
#> GSM152061     1  0.5895     0.1613 0.460 0.000 0.000 0.440 0.100
#> GSM152064     4  0.4206     0.4445 0.272 0.000 0.000 0.708 0.020
#> GSM152087     1  0.1197     0.7572 0.952 0.000 0.000 0.000 0.048
#> GSM152103     1  0.4373     0.6577 0.764 0.176 0.052 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
#> GSM152032     3  0.1958     0.8464 0.100 0.000 0.896 0.000 0.004 0.000
#> GSM152033     1  0.3915     0.2955 0.696 0.008 0.012 0.000 0.284 0.000
#> GSM152063     2  0.1152     0.9341 0.004 0.952 0.000 0.044 0.000 0.000
#> GSM152074     1  0.4408     0.1046 0.636 0.000 0.320 0.000 0.044 0.000
#> GSM152080     2  0.0603     0.9400 0.000 0.980 0.016 0.000 0.000 0.004
#> GSM152081     4  0.3163     0.5084 0.000 0.000 0.232 0.764 0.000 0.004
#> GSM152083     2  0.2706     0.8547 0.124 0.852 0.024 0.000 0.000 0.000
#> GSM152091     2  0.0000     0.9467 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152108     1  0.2579     0.5703 0.872 0.088 0.000 0.000 0.040 0.000
#> GSM152114     1  0.3590     0.6474 0.812 0.000 0.012 0.064 0.000 0.112
#> GSM152035     2  0.3852     0.7395 0.064 0.760 0.000 0.000 0.176 0.000
#> GSM152039     4  0.0260     0.7240 0.000 0.000 0.008 0.992 0.000 0.000
#> GSM152041     4  0.0260     0.7227 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM152044     2  0.1219     0.9319 0.004 0.948 0.000 0.048 0.000 0.000
#> GSM152045     5  0.0508     0.8042 0.000 0.000 0.000 0.004 0.984 0.012
#> GSM152051     2  0.0146     0.9471 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152054     5  0.0777     0.8020 0.024 0.000 0.000 0.004 0.972 0.000
#> GSM152057     2  0.0858     0.9406 0.028 0.968 0.000 0.004 0.000 0.000
#> GSM152058     1  0.3738     0.5524 0.680 0.000 0.004 0.004 0.000 0.312
#> GSM152067     3  0.3791     0.7226 0.000 0.004 0.768 0.000 0.180 0.048
#> GSM152068     2  0.0291     0.9470 0.004 0.992 0.000 0.004 0.000 0.000
#> GSM152075     4  0.0405     0.7240 0.000 0.000 0.008 0.988 0.000 0.004
#> GSM152076     4  0.0260     0.7240 0.000 0.000 0.008 0.992 0.000 0.000
#> GSM152079     2  0.0146     0.9471 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152084     3  0.1333     0.8658 0.048 0.000 0.944 0.008 0.000 0.000
#> GSM152089     5  0.4274     0.4483 0.000 0.000 0.004 0.336 0.636 0.024
#> GSM152095     4  0.0363     0.7229 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM152096     2  0.0000     0.9467 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152097     4  0.3872     0.2661 0.000 0.392 0.004 0.604 0.000 0.000
#> GSM152099     2  0.1642     0.9239 0.004 0.936 0.028 0.032 0.000 0.000
#> GSM152106     4  0.3817     0.1560 0.000 0.432 0.000 0.568 0.000 0.000
#> GSM152107     3  0.1793     0.8614 0.036 0.000 0.928 0.032 0.004 0.000
#> GSM152109     3  0.1500     0.8504 0.000 0.012 0.936 0.000 0.000 0.052
#> GSM152111     6  0.2163     0.7373 0.092 0.000 0.000 0.016 0.000 0.892
#> GSM152112     5  0.2850     0.7528 0.016 0.000 0.016 0.112 0.856 0.000
#> GSM152113     1  0.2455     0.5595 0.872 0.012 0.000 0.000 0.112 0.004
#> GSM152115     5  0.1584     0.7874 0.064 0.000 0.008 0.000 0.928 0.000
#> GSM152030     4  0.6378     0.0232 0.300 0.000 0.300 0.388 0.000 0.012
#> GSM152038     1  0.3424     0.5045 0.812 0.000 0.096 0.000 0.092 0.000
#> GSM152042     3  0.2191     0.8181 0.004 0.000 0.876 0.120 0.000 0.000
#> GSM152062     3  0.1364     0.8653 0.048 0.000 0.944 0.004 0.004 0.000
#> GSM152077     1  0.1007     0.6491 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM152088     2  0.0291     0.9449 0.000 0.992 0.004 0.000 0.000 0.004
#> GSM152100     4  0.0717     0.7181 0.000 0.000 0.008 0.976 0.016 0.000
#> GSM152102     5  0.2361     0.7529 0.028 0.088 0.000 0.000 0.884 0.000
#> GSM152104     2  0.1610     0.9035 0.000 0.916 0.000 0.084 0.000 0.000
#> GSM152028     1  0.3290     0.6300 0.776 0.000 0.000 0.000 0.016 0.208
#> GSM152029     6  0.3276     0.6715 0.000 0.028 0.100 0.000 0.032 0.840
#> GSM152049     6  0.2946     0.6923 0.160 0.000 0.004 0.012 0.000 0.824
#> GSM152053     3  0.3647     0.7619 0.052 0.000 0.788 0.156 0.004 0.000
#> GSM152059     6  0.0260     0.7541 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM152085     6  0.1511     0.7554 0.044 0.000 0.000 0.012 0.004 0.940
#> GSM152101     5  0.0964     0.8006 0.012 0.000 0.016 0.004 0.968 0.000
#> GSM152105     1  0.2527     0.6476 0.832 0.000 0.000 0.000 0.000 0.168
#> GSM152034     6  0.1675     0.7426 0.000 0.000 0.008 0.032 0.024 0.936
#> GSM152036     4  0.0291     0.7233 0.000 0.000 0.004 0.992 0.004 0.000
#> GSM152040     5  0.0458     0.8030 0.000 0.000 0.000 0.000 0.984 0.016
#> GSM152043     6  0.1588     0.7325 0.000 0.000 0.004 0.000 0.072 0.924
#> GSM152046     6  0.2264     0.7360 0.000 0.000 0.004 0.096 0.012 0.888
#> GSM152047     6  0.3937     0.1375 0.000 0.000 0.004 0.000 0.424 0.572
#> GSM152048     1  0.3721     0.5563 0.684 0.000 0.004 0.004 0.000 0.308
#> GSM152050     6  0.4075     0.6450 0.076 0.000 0.000 0.184 0.000 0.740
#> GSM152052     1  0.3854     0.2314 0.536 0.000 0.000 0.000 0.000 0.464
#> GSM152056     1  0.4275     0.4190 0.592 0.000 0.004 0.016 0.000 0.388
#> GSM152060     6  0.4102     0.6048 0.000 0.000 0.004 0.232 0.044 0.720
#> GSM152065     5  0.1349     0.7978 0.056 0.000 0.000 0.000 0.940 0.004
#> GSM152066     6  0.3819     0.3020 0.372 0.000 0.004 0.000 0.000 0.624
#> GSM152069     3  0.3987     0.7742 0.000 0.084 0.788 0.000 0.020 0.108
#> GSM152070     5  0.2854     0.6800 0.000 0.000 0.000 0.000 0.792 0.208
#> GSM152071     3  0.3020     0.7853 0.000 0.008 0.824 0.000 0.012 0.156
#> GSM152072     5  0.1010     0.7958 0.000 0.000 0.004 0.000 0.960 0.036
#> GSM152073     6  0.1633     0.7525 0.024 0.000 0.000 0.000 0.044 0.932
#> GSM152078     6  0.2773     0.7063 0.152 0.000 0.004 0.000 0.008 0.836
#> GSM152082     5  0.3756     0.4152 0.004 0.000 0.000 0.000 0.644 0.352
#> GSM152086     6  0.2902     0.6590 0.196 0.000 0.000 0.004 0.000 0.800
#> GSM152090     6  0.4358     0.6322 0.020 0.096 0.116 0.004 0.000 0.764
#> GSM152092     5  0.6025    -0.2302 0.244 0.000 0.000 0.000 0.384 0.372
#> GSM152093     6  0.5425     0.0219 0.396 0.000 0.012 0.084 0.000 0.508
#> GSM152094     6  0.0458     0.7566 0.016 0.000 0.000 0.000 0.000 0.984
#> GSM152098     6  0.3782     0.2735 0.000 0.000 0.004 0.000 0.360 0.636
#> GSM152110     1  0.5771     0.3792 0.500 0.000 0.004 0.168 0.000 0.328
#> GSM152031     6  0.3076     0.5991 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM152037     1  0.3727     0.4368 0.612 0.000 0.000 0.000 0.000 0.388
#> GSM152055     4  0.4286     0.3369 0.028 0.000 0.004 0.648 0.000 0.320
#> GSM152061     4  0.5027    -0.0601 0.000 0.000 0.004 0.488 0.060 0.448
#> GSM152064     4  0.3559     0.5211 0.000 0.000 0.004 0.744 0.012 0.240
#> GSM152087     6  0.0935     0.7560 0.032 0.000 0.000 0.000 0.004 0.964
#> GSM152103     6  0.4129     0.6822 0.144 0.012 0.080 0.000 0.000 0.764

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

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.151           0.620       0.807         0.3779 0.632   0.632
#> 3 3 0.225           0.529       0.743         0.5124 0.769   0.639
#> 4 4 0.325           0.454       0.675         0.1612 0.881   0.734
#> 5 5 0.446           0.474       0.638         0.1066 0.807   0.524
#> 6 6 0.511           0.349       0.608         0.0677 0.818   0.448

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
#> GSM152032     1  0.7376      0.640 0.792 0.208
#> GSM152033     1  0.2778      0.745 0.952 0.048
#> GSM152063     2  0.9129      0.573 0.328 0.672
#> GSM152074     1  0.7602      0.611 0.780 0.220
#> GSM152080     1  0.8763      0.488 0.704 0.296
#> GSM152081     2  0.9608      0.450 0.384 0.616
#> GSM152083     1  0.8081      0.568 0.752 0.248
#> GSM152091     1  0.8763      0.488 0.704 0.296
#> GSM152108     1  0.6712      0.688 0.824 0.176
#> GSM152114     1  0.8763      0.567 0.704 0.296
#> GSM152035     1  0.8443      0.590 0.728 0.272
#> GSM152039     2  0.2778      0.658 0.048 0.952
#> GSM152041     1  0.9881      0.257 0.564 0.436
#> GSM152044     2  0.8608      0.627 0.284 0.716
#> GSM152045     1  0.2043      0.751 0.968 0.032
#> GSM152051     2  0.8608      0.627 0.284 0.716
#> GSM152054     1  0.7602      0.672 0.780 0.220
#> GSM152057     2  0.8555      0.630 0.280 0.720
#> GSM152058     1  0.6148      0.712 0.848 0.152
#> GSM152067     1  0.7602      0.611 0.780 0.220
#> GSM152068     2  0.8555      0.630 0.280 0.720
#> GSM152075     2  0.9909      0.204 0.444 0.556
#> GSM152076     2  0.2778      0.658 0.048 0.952
#> GSM152079     2  0.8555      0.630 0.280 0.720
#> GSM152084     1  0.6712      0.686 0.824 0.176
#> GSM152089     1  0.9977      0.103 0.528 0.472
#> GSM152095     2  0.2778      0.658 0.048 0.952
#> GSM152096     1  0.6531      0.687 0.832 0.168
#> GSM152097     2  0.0000      0.640 0.000 1.000
#> GSM152099     2  0.9909      0.368 0.444 0.556
#> GSM152106     2  0.0000      0.640 0.000 1.000
#> GSM152107     1  0.7528      0.616 0.784 0.216
#> GSM152109     1  0.7602      0.611 0.780 0.220
#> GSM152111     1  0.7219      0.668 0.800 0.200
#> GSM152112     2  0.9933      0.180 0.452 0.548
#> GSM152113     1  0.5294      0.724 0.880 0.120
#> GSM152115     1  0.7528      0.616 0.784 0.216
#> GSM152030     2  0.9775      0.383 0.412 0.588
#> GSM152038     1  0.4298      0.752 0.912 0.088
#> GSM152042     2  0.9754      0.383 0.408 0.592
#> GSM152062     1  0.6531      0.687 0.832 0.168
#> GSM152077     1  0.3114      0.751 0.944 0.056
#> GSM152088     1  0.8813      0.478 0.700 0.300
#> GSM152100     2  0.9922      0.188 0.448 0.552
#> GSM152102     1  0.8443      0.590 0.728 0.272
#> GSM152104     2  0.0000      0.640 0.000 1.000
#> GSM152028     1  0.0000      0.746 1.000 0.000
#> GSM152029     1  0.3114      0.752 0.944 0.056
#> GSM152049     1  0.6438      0.701 0.836 0.164
#> GSM152053     2  0.9754      0.383 0.408 0.592
#> GSM152059     1  0.4690      0.747 0.900 0.100
#> GSM152085     1  0.5946      0.718 0.856 0.144
#> GSM152101     1  0.7528      0.616 0.784 0.216
#> GSM152105     1  0.1414      0.751 0.980 0.020
#> GSM152034     1  0.7674      0.630 0.776 0.224
#> GSM152036     2  0.2778      0.658 0.048 0.952
#> GSM152040     1  0.5519      0.746 0.872 0.128
#> GSM152043     1  0.0938      0.749 0.988 0.012
#> GSM152046     1  0.9044      0.461 0.680 0.320
#> GSM152047     1  0.2043      0.751 0.968 0.032
#> GSM152048     1  0.6148      0.712 0.848 0.152
#> GSM152050     1  0.7139      0.667 0.804 0.196
#> GSM152052     1  0.4298      0.749 0.912 0.088
#> GSM152056     1  0.6148      0.712 0.848 0.152
#> GSM152060     1  0.9044      0.461 0.680 0.320
#> GSM152065     1  0.0000      0.746 1.000 0.000
#> GSM152066     1  0.6148      0.712 0.848 0.152
#> GSM152069     1  0.7602      0.611 0.780 0.220
#> GSM152070     1  0.2043      0.751 0.968 0.032
#> GSM152071     1  0.7602      0.611 0.780 0.220
#> GSM152072     1  0.1843      0.751 0.972 0.028
#> GSM152073     1  0.5737      0.725 0.864 0.136
#> GSM152078     1  0.4022      0.748 0.920 0.080
#> GSM152082     1  0.0000      0.746 1.000 0.000
#> GSM152086     1  0.6247      0.707 0.844 0.156
#> GSM152090     1  0.7056      0.713 0.808 0.192
#> GSM152092     1  0.0000      0.746 1.000 0.000
#> GSM152093     1  0.6048      0.744 0.852 0.148
#> GSM152094     1  0.5737      0.725 0.864 0.136
#> GSM152098     1  0.1414      0.750 0.980 0.020
#> GSM152110     1  0.6343      0.706 0.840 0.160
#> GSM152031     1  0.4298      0.752 0.912 0.088
#> GSM152037     1  0.2948      0.755 0.948 0.052
#> GSM152055     1  0.9044      0.461 0.680 0.320
#> GSM152061     1  0.9044      0.461 0.680 0.320
#> GSM152064     1  0.9732      0.338 0.596 0.404
#> GSM152087     1  0.5294      0.735 0.880 0.120
#> GSM152103     1  0.6801      0.723 0.820 0.180

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.7138     0.5815 0.312 0.044 0.644
#> GSM152033     1  0.5968     0.4356 0.636 0.000 0.364
#> GSM152063     2  0.8562     0.3679 0.108 0.540 0.352
#> GSM152074     3  0.4291     0.7381 0.180 0.000 0.820
#> GSM152080     3  0.0592     0.5810 0.000 0.012 0.988
#> GSM152081     2  0.9087     0.3466 0.224 0.552 0.224
#> GSM152083     3  0.3845     0.6997 0.116 0.012 0.872
#> GSM152091     3  0.0592     0.5810 0.000 0.012 0.988
#> GSM152108     1  0.8466     0.1542 0.508 0.092 0.400
#> GSM152114     1  0.9452     0.2204 0.496 0.220 0.284
#> GSM152035     3  0.8790     0.2953 0.328 0.132 0.540
#> GSM152039     2  0.0237     0.5745 0.004 0.996 0.000
#> GSM152041     1  0.8619     0.2549 0.524 0.368 0.108
#> GSM152044     2  0.6955     0.3234 0.016 0.492 0.492
#> GSM152045     1  0.3193     0.7080 0.896 0.004 0.100
#> GSM152051     2  0.6955     0.3234 0.016 0.492 0.492
#> GSM152054     1  0.9075     0.1737 0.472 0.140 0.388
#> GSM152057     2  0.6954     0.3340 0.016 0.500 0.484
#> GSM152058     1  0.4569     0.7141 0.860 0.072 0.068
#> GSM152067     3  0.5178     0.7217 0.256 0.000 0.744
#> GSM152068     2  0.6954     0.3340 0.016 0.500 0.484
#> GSM152075     2  0.9122     0.3695 0.280 0.536 0.184
#> GSM152076     2  0.0237     0.5745 0.004 0.996 0.000
#> GSM152079     2  0.6954     0.3340 0.016 0.500 0.484
#> GSM152084     1  0.7913     0.0260 0.492 0.056 0.452
#> GSM152089     2  0.9189    -0.0639 0.416 0.436 0.148
#> GSM152095     2  0.0237     0.5745 0.004 0.996 0.000
#> GSM152096     1  0.7755     0.0207 0.492 0.048 0.460
#> GSM152097     2  0.2165     0.5685 0.000 0.936 0.064
#> GSM152099     3  0.8073     0.0892 0.080 0.344 0.576
#> GSM152106     2  0.2165     0.5685 0.000 0.936 0.064
#> GSM152107     3  0.6053     0.7132 0.260 0.020 0.720
#> GSM152109     3  0.4002     0.7385 0.160 0.000 0.840
#> GSM152111     1  0.3845     0.6873 0.872 0.116 0.012
#> GSM152112     2  0.9243     0.3555 0.288 0.520 0.192
#> GSM152113     1  0.7337     0.1901 0.540 0.032 0.428
#> GSM152115     3  0.6053     0.7132 0.260 0.020 0.720
#> GSM152030     2  0.9463     0.2860 0.256 0.500 0.244
#> GSM152038     1  0.4178     0.6791 0.828 0.000 0.172
#> GSM152042     2  0.9364     0.3044 0.268 0.512 0.220
#> GSM152062     1  0.7755     0.0207 0.492 0.048 0.460
#> GSM152077     1  0.6497     0.4663 0.648 0.016 0.336
#> GSM152088     3  0.0747     0.5791 0.000 0.016 0.984
#> GSM152100     2  0.9145     0.3609 0.284 0.532 0.184
#> GSM152102     3  0.8738     0.3006 0.328 0.128 0.544
#> GSM152104     2  0.2165     0.5685 0.000 0.936 0.064
#> GSM152028     1  0.5138     0.6135 0.748 0.000 0.252
#> GSM152029     1  0.2356     0.7174 0.928 0.000 0.072
#> GSM152049     1  0.4206     0.7093 0.872 0.088 0.040
#> GSM152053     2  0.9364     0.3044 0.268 0.512 0.220
#> GSM152059     1  0.3038     0.6982 0.896 0.000 0.104
#> GSM152085     1  0.3370     0.7122 0.904 0.072 0.024
#> GSM152101     3  0.6053     0.7132 0.260 0.020 0.720
#> GSM152105     1  0.4002     0.6931 0.840 0.000 0.160
#> GSM152034     1  0.4453     0.6540 0.836 0.152 0.012
#> GSM152036     2  0.0237     0.5745 0.004 0.996 0.000
#> GSM152040     1  0.6939     0.6231 0.712 0.072 0.216
#> GSM152043     1  0.3267     0.7101 0.884 0.000 0.116
#> GSM152046     1  0.5216     0.5062 0.740 0.260 0.000
#> GSM152047     1  0.2959     0.7084 0.900 0.000 0.100
#> GSM152048     1  0.4569     0.7141 0.860 0.072 0.068
#> GSM152050     1  0.3771     0.6878 0.876 0.112 0.012
#> GSM152052     1  0.4654     0.6520 0.792 0.000 0.208
#> GSM152056     1  0.4569     0.7141 0.860 0.072 0.068
#> GSM152060     1  0.5216     0.5062 0.740 0.260 0.000
#> GSM152065     1  0.5098     0.6171 0.752 0.000 0.248
#> GSM152066     1  0.4569     0.7141 0.860 0.072 0.068
#> GSM152069     3  0.4002     0.7385 0.160 0.000 0.840
#> GSM152070     1  0.2959     0.7084 0.900 0.000 0.100
#> GSM152071     3  0.4002     0.7385 0.160 0.000 0.840
#> GSM152072     1  0.2959     0.7074 0.900 0.000 0.100
#> GSM152073     1  0.3780     0.7165 0.892 0.064 0.044
#> GSM152078     1  0.4002     0.6861 0.840 0.000 0.160
#> GSM152082     1  0.3412     0.7048 0.876 0.000 0.124
#> GSM152086     1  0.3765     0.7074 0.888 0.084 0.028
#> GSM152090     1  0.7262     0.4326 0.624 0.044 0.332
#> GSM152092     1  0.3686     0.6987 0.860 0.000 0.140
#> GSM152093     1  0.7199     0.5693 0.676 0.064 0.260
#> GSM152094     1  0.3780     0.7165 0.892 0.064 0.044
#> GSM152098     1  0.2878     0.7118 0.904 0.000 0.096
#> GSM152110     1  0.4544     0.7121 0.860 0.084 0.056
#> GSM152031     1  0.3686     0.6970 0.860 0.000 0.140
#> GSM152037     1  0.4551     0.7167 0.844 0.024 0.132
#> GSM152055     1  0.5216     0.5062 0.740 0.260 0.000
#> GSM152061     1  0.5216     0.5062 0.740 0.260 0.000
#> GSM152064     1  0.8494     0.3339 0.556 0.336 0.108
#> GSM152087     1  0.3896     0.7235 0.888 0.052 0.060
#> GSM152103     1  0.7012     0.4918 0.652 0.040 0.308

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.6390     0.4055 0.136 0.132 0.704 0.028
#> GSM152033     1  0.7540     0.2050 0.444 0.192 0.364 0.000
#> GSM152063     4  0.7619     0.3001 0.020 0.372 0.124 0.484
#> GSM152074     3  0.2060     0.4689 0.016 0.052 0.932 0.000
#> GSM152080     2  0.4193     0.3983 0.000 0.732 0.268 0.000
#> GSM152081     4  0.7563     0.3180 0.120 0.028 0.308 0.544
#> GSM152083     3  0.4188     0.1564 0.004 0.244 0.752 0.000
#> GSM152091     2  0.4193     0.3983 0.000 0.732 0.268 0.000
#> GSM152108     3  0.8929     0.0936 0.316 0.304 0.332 0.048
#> GSM152114     1  0.9746    -0.0580 0.332 0.200 0.296 0.172
#> GSM152035     2  0.8899     0.2112 0.232 0.456 0.236 0.076
#> GSM152039     4  0.0376     0.5475 0.004 0.004 0.000 0.992
#> GSM152041     1  0.8760     0.2513 0.468 0.212 0.068 0.252
#> GSM152044     4  0.7119     0.3048 0.000 0.388 0.132 0.480
#> GSM152045     1  0.4334     0.6705 0.804 0.032 0.160 0.004
#> GSM152051     4  0.7119     0.3048 0.000 0.388 0.132 0.480
#> GSM152054     2  0.9098    -0.0536 0.344 0.356 0.228 0.072
#> GSM152057     4  0.7106     0.3136 0.000 0.380 0.132 0.488
#> GSM152058     1  0.3963     0.6926 0.860 0.056 0.060 0.024
#> GSM152067     3  0.3243     0.4864 0.088 0.036 0.876 0.000
#> GSM152068     4  0.7106     0.3136 0.000 0.380 0.132 0.488
#> GSM152075     4  0.9427     0.2140 0.204 0.188 0.176 0.432
#> GSM152076     4  0.0376     0.5475 0.004 0.004 0.000 0.992
#> GSM152079     4  0.7106     0.3136 0.000 0.380 0.132 0.488
#> GSM152084     3  0.8259     0.2725 0.288 0.180 0.492 0.040
#> GSM152089     1  0.9452     0.0101 0.328 0.244 0.104 0.324
#> GSM152095     4  0.0376     0.5475 0.004 0.004 0.000 0.992
#> GSM152096     3  0.8120     0.2765 0.284 0.184 0.500 0.032
#> GSM152097     4  0.1792     0.5404 0.000 0.068 0.000 0.932
#> GSM152099     3  0.7879    -0.2739 0.000 0.288 0.380 0.332
#> GSM152106     4  0.1792     0.5404 0.000 0.068 0.000 0.932
#> GSM152107     3  0.3036     0.4952 0.080 0.020 0.892 0.008
#> GSM152109     3  0.2450     0.4560 0.016 0.072 0.912 0.000
#> GSM152111     1  0.3432     0.6853 0.884 0.036 0.020 0.060
#> GSM152112     4  0.9503     0.2032 0.196 0.192 0.192 0.420
#> GSM152113     3  0.8063     0.0822 0.352 0.184 0.444 0.020
#> GSM152115     3  0.3036     0.4952 0.080 0.020 0.892 0.008
#> GSM152030     4  0.8044     0.2576 0.128 0.040 0.364 0.468
#> GSM152038     1  0.5582     0.6250 0.724 0.108 0.168 0.000
#> GSM152042     4  0.8136     0.2772 0.136 0.044 0.340 0.480
#> GSM152062     3  0.8104     0.2832 0.280 0.184 0.504 0.032
#> GSM152077     1  0.7846     0.2456 0.464 0.184 0.340 0.012
#> GSM152088     2  0.4372     0.3951 0.000 0.728 0.268 0.004
#> GSM152100     4  0.9454     0.2077 0.200 0.192 0.180 0.428
#> GSM152102     2  0.8846     0.2134 0.232 0.460 0.236 0.072
#> GSM152104     4  0.1792     0.5404 0.000 0.068 0.000 0.932
#> GSM152028     1  0.6708     0.5090 0.596 0.132 0.272 0.000
#> GSM152029     1  0.3542     0.6928 0.852 0.028 0.120 0.000
#> GSM152049     1  0.3398     0.7018 0.888 0.028 0.048 0.036
#> GSM152053     4  0.8136     0.2772 0.136 0.044 0.340 0.480
#> GSM152059     1  0.4205     0.6677 0.820 0.056 0.124 0.000
#> GSM152085     1  0.2715     0.7046 0.916 0.016 0.036 0.032
#> GSM152101     3  0.3036     0.4952 0.080 0.020 0.892 0.008
#> GSM152105     1  0.5147     0.6507 0.740 0.060 0.200 0.000
#> GSM152034     1  0.4212     0.6622 0.844 0.044 0.024 0.088
#> GSM152036     4  0.0376     0.5475 0.004 0.004 0.000 0.992
#> GSM152040     1  0.7610     0.4943 0.584 0.168 0.216 0.032
#> GSM152043     1  0.4194     0.6739 0.800 0.028 0.172 0.000
#> GSM152046     1  0.5076     0.5566 0.756 0.072 0.000 0.172
#> GSM152047     1  0.4244     0.6703 0.804 0.036 0.160 0.000
#> GSM152048     1  0.3963     0.6926 0.860 0.056 0.060 0.024
#> GSM152050     1  0.3353     0.6857 0.888 0.036 0.020 0.056
#> GSM152052     1  0.6075     0.5895 0.680 0.128 0.192 0.000
#> GSM152056     1  0.3963     0.6926 0.860 0.056 0.060 0.024
#> GSM152060     1  0.5118     0.5541 0.752 0.072 0.000 0.176
#> GSM152065     1  0.6685     0.5134 0.600 0.132 0.268 0.000
#> GSM152066     1  0.3963     0.6926 0.860 0.056 0.060 0.024
#> GSM152069     3  0.2450     0.4560 0.016 0.072 0.912 0.000
#> GSM152070     1  0.4244     0.6703 0.804 0.036 0.160 0.000
#> GSM152071     3  0.2450     0.4560 0.016 0.072 0.912 0.000
#> GSM152072     1  0.4152     0.6702 0.808 0.032 0.160 0.000
#> GSM152073     1  0.3852     0.7012 0.864 0.040 0.072 0.024
#> GSM152078     1  0.5496     0.6325 0.732 0.108 0.160 0.000
#> GSM152082     1  0.4281     0.6658 0.792 0.028 0.180 0.000
#> GSM152086     1  0.3410     0.6990 0.888 0.036 0.044 0.032
#> GSM152090     1  0.7926     0.2108 0.480 0.144 0.348 0.028
#> GSM152092     1  0.4720     0.6568 0.768 0.044 0.188 0.000
#> GSM152093     1  0.7996     0.4096 0.532 0.156 0.272 0.040
#> GSM152094     1  0.3852     0.7012 0.864 0.040 0.072 0.024
#> GSM152098     1  0.3862     0.6776 0.824 0.024 0.152 0.000
#> GSM152110     1  0.3943     0.6956 0.864 0.048 0.048 0.040
#> GSM152031     1  0.4919     0.6564 0.772 0.076 0.152 0.000
#> GSM152037     1  0.4807     0.6871 0.788 0.052 0.152 0.008
#> GSM152055     1  0.5118     0.5541 0.752 0.072 0.000 0.176
#> GSM152061     1  0.5118     0.5541 0.752 0.072 0.000 0.176
#> GSM152064     1  0.8566     0.3156 0.504 0.204 0.068 0.224
#> GSM152087     1  0.3684     0.7073 0.868 0.036 0.080 0.016
#> GSM152103     1  0.7700     0.3099 0.516 0.136 0.324 0.024

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     5  0.5396     0.1014 0.056 0.000 0.444 0.000 0.500
#> GSM152033     5  0.4235     0.4483 0.184 0.008 0.040 0.000 0.768
#> GSM152063     4  0.7488    -0.1788 0.024 0.276 0.008 0.412 0.280
#> GSM152074     3  0.2079     0.8326 0.000 0.020 0.916 0.000 0.064
#> GSM152080     2  0.0963     0.5048 0.000 0.964 0.036 0.000 0.000
#> GSM152081     4  0.7538     0.4112 0.080 0.012 0.244 0.524 0.140
#> GSM152083     3  0.3934     0.5189 0.000 0.276 0.716 0.000 0.008
#> GSM152091     2  0.0963     0.5048 0.000 0.964 0.036 0.000 0.000
#> GSM152108     5  0.4260     0.5377 0.068 0.100 0.020 0.004 0.808
#> GSM152114     5  0.6486     0.4463 0.204 0.000 0.068 0.108 0.620
#> GSM152035     5  0.6806     0.2250 0.100 0.388 0.016 0.020 0.476
#> GSM152039     4  0.0854     0.5736 0.008 0.000 0.004 0.976 0.012
#> GSM152041     1  0.7354     0.0277 0.496 0.060 0.012 0.116 0.316
#> GSM152044     2  0.5503     0.5627 0.000 0.484 0.024 0.468 0.024
#> GSM152045     1  0.4840     0.4567 0.640 0.000 0.040 0.000 0.320
#> GSM152051     2  0.5503     0.5627 0.000 0.484 0.024 0.468 0.024
#> GSM152054     5  0.6834     0.4154 0.184 0.200 0.032 0.008 0.576
#> GSM152057     2  0.5644     0.5611 0.000 0.476 0.024 0.468 0.032
#> GSM152058     1  0.3652     0.5804 0.784 0.000 0.004 0.012 0.200
#> GSM152067     3  0.3454     0.8484 0.036 0.016 0.848 0.000 0.100
#> GSM152068     2  0.5644     0.5611 0.000 0.476 0.024 0.468 0.032
#> GSM152075     5  0.7960     0.0614 0.224 0.024 0.040 0.304 0.408
#> GSM152076     4  0.0854     0.5736 0.008 0.000 0.004 0.976 0.012
#> GSM152079     2  0.5644     0.5611 0.000 0.476 0.024 0.468 0.032
#> GSM152084     5  0.4801     0.5293 0.084 0.000 0.184 0.004 0.728
#> GSM152089     5  0.7744     0.2456 0.308 0.060 0.008 0.188 0.436
#> GSM152095     4  0.0854     0.5736 0.008 0.000 0.004 0.976 0.012
#> GSM152096     5  0.4502     0.5304 0.076 0.000 0.180 0.000 0.744
#> GSM152097     4  0.1798     0.5172 0.000 0.064 0.004 0.928 0.004
#> GSM152099     2  0.7353     0.3401 0.000 0.352 0.300 0.324 0.024
#> GSM152106     4  0.1798     0.5172 0.000 0.064 0.004 0.928 0.004
#> GSM152107     3  0.3433     0.8410 0.032 0.004 0.832 0.000 0.132
#> GSM152109     3  0.1280     0.8505 0.008 0.024 0.960 0.000 0.008
#> GSM152111     1  0.2270     0.6275 0.908 0.000 0.004 0.016 0.072
#> GSM152112     5  0.7978     0.0817 0.216 0.024 0.044 0.300 0.416
#> GSM152113     5  0.4723     0.5240 0.136 0.000 0.128 0.000 0.736
#> GSM152115     3  0.3433     0.8410 0.032 0.004 0.832 0.000 0.132
#> GSM152030     4  0.7972     0.3944 0.092 0.004 0.240 0.436 0.228
#> GSM152038     1  0.5868     0.3659 0.580 0.020 0.056 0.004 0.340
#> GSM152042     4  0.7997     0.4003 0.100 0.004 0.216 0.440 0.240
#> GSM152062     5  0.4537     0.5268 0.076 0.000 0.184 0.000 0.740
#> GSM152077     5  0.3880     0.4372 0.204 0.004 0.020 0.000 0.772
#> GSM152088     2  0.1124     0.5059 0.000 0.960 0.036 0.004 0.000
#> GSM152100     5  0.7878     0.0800 0.220 0.024 0.036 0.300 0.420
#> GSM152102     5  0.6811     0.2215 0.100 0.392 0.016 0.020 0.472
#> GSM152104     4  0.1798     0.5172 0.000 0.064 0.004 0.928 0.004
#> GSM152028     5  0.5122     0.1179 0.352 0.004 0.032 0.004 0.608
#> GSM152029     1  0.4186     0.5887 0.768 0.000 0.044 0.004 0.184
#> GSM152049     1  0.2909     0.6212 0.848 0.000 0.000 0.012 0.140
#> GSM152053     4  0.7997     0.4003 0.100 0.004 0.216 0.440 0.240
#> GSM152059     1  0.4795     0.5791 0.780 0.040 0.096 0.004 0.080
#> GSM152085     1  0.2284     0.6407 0.896 0.000 0.004 0.004 0.096
#> GSM152101     3  0.3433     0.8410 0.032 0.004 0.832 0.000 0.132
#> GSM152105     1  0.5277     0.3415 0.548 0.004 0.032 0.004 0.412
#> GSM152034     1  0.2745     0.6064 0.892 0.004 0.004 0.036 0.064
#> GSM152036     4  0.0693     0.5734 0.008 0.000 0.000 0.980 0.012
#> GSM152040     5  0.6163     0.0322 0.424 0.044 0.036 0.004 0.492
#> GSM152043     1  0.4971     0.4712 0.628 0.000 0.036 0.004 0.332
#> GSM152046     1  0.4311     0.5038 0.808 0.012 0.012 0.076 0.092
#> GSM152047     1  0.4854     0.4595 0.648 0.000 0.044 0.000 0.308
#> GSM152048     1  0.3652     0.5804 0.784 0.000 0.004 0.012 0.200
#> GSM152050     1  0.2206     0.6285 0.912 0.000 0.004 0.016 0.068
#> GSM152052     1  0.6366     0.3007 0.532 0.044 0.056 0.004 0.364
#> GSM152056     1  0.3652     0.5804 0.784 0.000 0.004 0.012 0.200
#> GSM152060     1  0.4369     0.5004 0.804 0.012 0.012 0.080 0.092
#> GSM152065     5  0.5136     0.1094 0.356 0.004 0.032 0.004 0.604
#> GSM152066     1  0.3652     0.5804 0.784 0.000 0.004 0.012 0.200
#> GSM152069     3  0.1280     0.8505 0.008 0.024 0.960 0.000 0.008
#> GSM152070     1  0.4854     0.4595 0.648 0.000 0.044 0.000 0.308
#> GSM152071     3  0.1280     0.8505 0.008 0.024 0.960 0.000 0.008
#> GSM152072     1  0.4823     0.4584 0.644 0.000 0.040 0.000 0.316
#> GSM152073     1  0.2464     0.6287 0.888 0.000 0.016 0.000 0.096
#> GSM152078     1  0.5766     0.3840 0.588 0.024 0.044 0.004 0.340
#> GSM152082     1  0.5012     0.4369 0.600 0.000 0.032 0.004 0.364
#> GSM152086     1  0.1892     0.6359 0.916 0.000 0.004 0.000 0.080
#> GSM152090     5  0.5940     0.4048 0.284 0.000 0.144 0.000 0.572
#> GSM152092     1  0.5088     0.4005 0.572 0.000 0.032 0.004 0.392
#> GSM152093     5  0.5172     0.3110 0.332 0.000 0.048 0.004 0.616
#> GSM152094     1  0.2464     0.6287 0.888 0.000 0.016 0.000 0.096
#> GSM152098     1  0.4867     0.4847 0.652 0.000 0.036 0.004 0.308
#> GSM152110     1  0.3525     0.6031 0.816 0.000 0.004 0.024 0.156
#> GSM152031     1  0.5485     0.4561 0.640 0.020 0.044 0.004 0.292
#> GSM152037     1  0.4817     0.4576 0.608 0.000 0.016 0.008 0.368
#> GSM152055     1  0.4422     0.4986 0.800 0.012 0.012 0.080 0.096
#> GSM152061     1  0.4369     0.5004 0.804 0.012 0.012 0.080 0.092
#> GSM152064     1  0.6949     0.1109 0.540 0.060 0.004 0.104 0.292
#> GSM152087     1  0.2723     0.6322 0.864 0.000 0.012 0.000 0.124
#> GSM152103     5  0.5952     0.3370 0.324 0.000 0.128 0.000 0.548

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     1  0.5481  -0.042765 0.468 0.000 0.420 0.004 0.108 0.000
#> GSM152033     1  0.2308   0.405820 0.880 0.000 0.004 0.000 0.108 0.008
#> GSM152063     4  0.7468   0.123382 0.072 0.196 0.000 0.424 0.276 0.032
#> GSM152074     3  0.2290   0.801937 0.020 0.000 0.892 0.004 0.084 0.000
#> GSM152080     2  0.0000   0.523957 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152081     4  0.7567   0.198427 0.052 0.000 0.184 0.444 0.252 0.068
#> GSM152083     3  0.3788   0.484695 0.004 0.280 0.704 0.000 0.012 0.000
#> GSM152091     2  0.0000   0.523957 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152108     1  0.4551   0.175072 0.668 0.040 0.000 0.004 0.280 0.008
#> GSM152114     1  0.6772  -0.145142 0.448 0.000 0.028 0.028 0.344 0.152
#> GSM152035     2  0.7242   0.029061 0.308 0.324 0.000 0.020 0.308 0.040
#> GSM152039     4  0.2384   0.529783 0.000 0.000 0.000 0.888 0.064 0.048
#> GSM152041     6  0.6049  -0.293808 0.080 0.008 0.000 0.044 0.344 0.524
#> GSM152044     4  0.5162   0.231007 0.004 0.456 0.008 0.480 0.052 0.000
#> GSM152045     1  0.5355   0.118629 0.468 0.000 0.000 0.000 0.108 0.424
#> GSM152051     4  0.5162   0.231007 0.004 0.456 0.008 0.480 0.052 0.000
#> GSM152054     5  0.6780   0.046385 0.372 0.132 0.000 0.000 0.408 0.088
#> GSM152057     4  0.5255   0.235643 0.004 0.448 0.008 0.480 0.060 0.000
#> GSM152058     6  0.4264   0.431089 0.352 0.000 0.000 0.000 0.028 0.620
#> GSM152067     3  0.2886   0.834717 0.064 0.000 0.860 0.000 0.072 0.004
#> GSM152068     4  0.5255   0.235643 0.004 0.448 0.008 0.480 0.060 0.000
#> GSM152075     5  0.7194   0.678539 0.104 0.000 0.008 0.176 0.452 0.260
#> GSM152076     4  0.2384   0.529783 0.000 0.000 0.000 0.888 0.064 0.048
#> GSM152079     4  0.5255   0.235643 0.004 0.448 0.008 0.480 0.060 0.000
#> GSM152084     1  0.5425   0.261983 0.648 0.000 0.144 0.004 0.184 0.020
#> GSM152089     5  0.7311   0.580729 0.164 0.008 0.000 0.112 0.404 0.312
#> GSM152095     4  0.2384   0.529783 0.000 0.000 0.000 0.888 0.064 0.048
#> GSM152096     1  0.5171   0.268403 0.668 0.000 0.144 0.004 0.172 0.012
#> GSM152097     4  0.0405   0.533790 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM152099     2  0.6972  -0.139540 0.004 0.344 0.284 0.324 0.044 0.000
#> GSM152106     4  0.0405   0.533790 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM152107     3  0.3393   0.827919 0.068 0.000 0.820 0.000 0.108 0.004
#> GSM152109     3  0.0725   0.839473 0.012 0.000 0.976 0.000 0.012 0.000
#> GSM152111     6  0.3700   0.545435 0.152 0.000 0.000 0.000 0.068 0.780
#> GSM152112     5  0.7454   0.684218 0.120 0.000 0.016 0.176 0.436 0.252
#> GSM152113     1  0.4474   0.339388 0.740 0.000 0.088 0.004 0.156 0.012
#> GSM152115     3  0.3393   0.827919 0.068 0.000 0.820 0.000 0.108 0.004
#> GSM152030     4  0.8033   0.067560 0.088 0.000 0.168 0.364 0.304 0.076
#> GSM152038     1  0.6364  -0.046511 0.456 0.000 0.028 0.000 0.192 0.324
#> GSM152042     4  0.8031   0.040463 0.088 0.000 0.152 0.368 0.308 0.084
#> GSM152062     1  0.5205   0.263223 0.664 0.000 0.148 0.004 0.172 0.012
#> GSM152077     1  0.3381   0.407358 0.808 0.000 0.000 0.004 0.148 0.040
#> GSM152088     2  0.0146   0.522456 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152100     5  0.7275   0.687946 0.116 0.000 0.008 0.176 0.444 0.256
#> GSM152102     2  0.7239   0.036105 0.308 0.332 0.000 0.020 0.300 0.040
#> GSM152104     4  0.0405   0.533790 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM152028     1  0.2214   0.418230 0.888 0.000 0.000 0.000 0.016 0.096
#> GSM152029     6  0.5451   0.199457 0.340 0.000 0.000 0.000 0.136 0.524
#> GSM152049     6  0.3670   0.497148 0.284 0.000 0.000 0.000 0.012 0.704
#> GSM152053     4  0.8031   0.040463 0.088 0.000 0.152 0.368 0.308 0.084
#> GSM152059     6  0.6013   0.363827 0.120 0.000 0.044 0.000 0.284 0.552
#> GSM152085     6  0.4099   0.512154 0.244 0.000 0.000 0.000 0.048 0.708
#> GSM152101     3  0.3393   0.827919 0.068 0.000 0.820 0.000 0.108 0.004
#> GSM152105     1  0.5064   0.247315 0.632 0.000 0.016 0.000 0.076 0.276
#> GSM152034     6  0.3172   0.552800 0.128 0.000 0.000 0.000 0.048 0.824
#> GSM152036     4  0.2325   0.530401 0.000 0.000 0.000 0.892 0.060 0.048
#> GSM152040     1  0.6208   0.219605 0.436 0.008 0.000 0.000 0.276 0.280
#> GSM152043     1  0.5205   0.103661 0.496 0.000 0.000 0.000 0.092 0.412
#> GSM152046     6  0.2278   0.451490 0.000 0.000 0.000 0.004 0.128 0.868
#> GSM152047     1  0.5357   0.105189 0.464 0.000 0.000 0.000 0.108 0.428
#> GSM152048     6  0.4264   0.431089 0.352 0.000 0.000 0.000 0.028 0.620
#> GSM152050     6  0.3681   0.545316 0.156 0.000 0.000 0.000 0.064 0.780
#> GSM152052     1  0.6586  -0.000173 0.444 0.000 0.036 0.000 0.248 0.272
#> GSM152056     6  0.4264   0.431089 0.352 0.000 0.000 0.000 0.028 0.620
#> GSM152060     6  0.2320   0.445988 0.000 0.000 0.000 0.004 0.132 0.864
#> GSM152065     1  0.2263   0.416997 0.884 0.000 0.000 0.000 0.016 0.100
#> GSM152066     6  0.4264   0.431089 0.352 0.000 0.000 0.000 0.028 0.620
#> GSM152069     3  0.0725   0.839473 0.012 0.000 0.976 0.000 0.012 0.000
#> GSM152070     1  0.5357   0.105189 0.464 0.000 0.000 0.000 0.108 0.428
#> GSM152071     3  0.0725   0.839473 0.012 0.000 0.976 0.000 0.012 0.000
#> GSM152072     1  0.5353   0.118922 0.472 0.000 0.000 0.000 0.108 0.420
#> GSM152073     6  0.4381   0.461326 0.236 0.000 0.000 0.000 0.072 0.692
#> GSM152078     1  0.6401  -0.054225 0.448 0.000 0.028 0.000 0.200 0.324
#> GSM152082     1  0.5117   0.176710 0.548 0.000 0.000 0.000 0.092 0.360
#> GSM152086     6  0.4039   0.512494 0.208 0.000 0.000 0.000 0.060 0.732
#> GSM152090     1  0.6108   0.358973 0.608 0.000 0.100 0.000 0.140 0.152
#> GSM152092     1  0.4970   0.208981 0.580 0.000 0.000 0.000 0.084 0.336
#> GSM152093     1  0.5605   0.344526 0.604 0.000 0.020 0.000 0.152 0.224
#> GSM152094     6  0.4381   0.461326 0.236 0.000 0.000 0.000 0.072 0.692
#> GSM152098     1  0.5224   0.070506 0.468 0.000 0.000 0.000 0.092 0.440
#> GSM152110     6  0.4289   0.475269 0.304 0.000 0.000 0.004 0.032 0.660
#> GSM152031     6  0.6362   0.118447 0.376 0.000 0.024 0.000 0.192 0.408
#> GSM152037     1  0.4408   0.105740 0.608 0.000 0.000 0.000 0.036 0.356
#> GSM152055     6  0.2420   0.448560 0.004 0.000 0.000 0.004 0.128 0.864
#> GSM152061     6  0.2320   0.445988 0.000 0.000 0.000 0.004 0.132 0.864
#> GSM152064     6  0.5880  -0.195916 0.080 0.008 0.000 0.036 0.324 0.552
#> GSM152087     6  0.4557   0.448282 0.268 0.000 0.000 0.000 0.072 0.660
#> GSM152103     1  0.6152   0.377416 0.596 0.000 0.088 0.000 0.136 0.180

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 specimen(p) k
#> MAD:hclust 70    5.27e-03 2
#> MAD:hclust 58    8.84e-06 3
#> MAD:hclust 43    9.54e-04 4
#> MAD:hclust 48    2.00e-02 5
#> MAD:hclust 27    7.53e-02 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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.818           0.901       0.949         0.4996 0.501   0.501
#> 3 3 0.538           0.732       0.851         0.3110 0.762   0.557
#> 4 4 0.566           0.683       0.771         0.1252 0.906   0.735
#> 5 5 0.639           0.688       0.772         0.0729 0.839   0.495
#> 6 6 0.678           0.562       0.724         0.0429 0.976   0.881

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
#> GSM152032     2  0.5059      0.893 0.112 0.888
#> GSM152033     1  0.0938      0.931 0.988 0.012
#> GSM152063     2  0.0938      0.963 0.012 0.988
#> GSM152074     2  0.4815      0.901 0.104 0.896
#> GSM152080     2  0.2423      0.943 0.040 0.960
#> GSM152081     2  0.0938      0.963 0.012 0.988
#> GSM152083     2  0.2423      0.943 0.040 0.960
#> GSM152091     2  0.0000      0.962 0.000 1.000
#> GSM152108     2  0.0938      0.959 0.012 0.988
#> GSM152114     1  0.6623      0.799 0.828 0.172
#> GSM152035     2  0.0000      0.962 0.000 1.000
#> GSM152039     2  0.0938      0.963 0.012 0.988
#> GSM152041     2  0.7745      0.702 0.228 0.772
#> GSM152044     2  0.0938      0.963 0.012 0.988
#> GSM152045     1  0.0672      0.931 0.992 0.008
#> GSM152051     2  0.0000      0.962 0.000 1.000
#> GSM152054     2  0.5737      0.870 0.136 0.864
#> GSM152057     2  0.0000      0.962 0.000 1.000
#> GSM152058     1  0.2043      0.925 0.968 0.032
#> GSM152067     2  0.4815      0.901 0.104 0.896
#> GSM152068     2  0.0672      0.963 0.008 0.992
#> GSM152075     2  0.0938      0.963 0.012 0.988
#> GSM152076     2  0.0938      0.963 0.012 0.988
#> GSM152079     2  0.0000      0.962 0.000 1.000
#> GSM152084     1  0.9754      0.355 0.592 0.408
#> GSM152089     2  0.0938      0.963 0.012 0.988
#> GSM152095     2  0.0938      0.963 0.012 0.988
#> GSM152096     2  0.4939      0.897 0.108 0.892
#> GSM152097     2  0.0938      0.963 0.012 0.988
#> GSM152099     2  0.0000      0.962 0.000 1.000
#> GSM152106     2  0.0938      0.963 0.012 0.988
#> GSM152107     2  0.0000      0.962 0.000 1.000
#> GSM152109     2  0.5059      0.893 0.112 0.888
#> GSM152111     1  0.2043      0.925 0.968 0.032
#> GSM152112     2  0.0938      0.963 0.012 0.988
#> GSM152113     1  0.8267      0.661 0.740 0.260
#> GSM152115     2  0.4815      0.901 0.104 0.896
#> GSM152030     2  0.0938      0.963 0.012 0.988
#> GSM152038     1  0.1184      0.930 0.984 0.016
#> GSM152042     2  0.0938      0.963 0.012 0.988
#> GSM152062     1  0.9661      0.399 0.608 0.392
#> GSM152077     1  0.2043      0.925 0.968 0.032
#> GSM152088     2  0.0000      0.962 0.000 1.000
#> GSM152100     2  0.0938      0.963 0.012 0.988
#> GSM152102     2  0.2423      0.943 0.040 0.960
#> GSM152104     2  0.0938      0.963 0.012 0.988
#> GSM152028     1  0.0938      0.931 0.988 0.012
#> GSM152029     1  0.0938      0.931 0.988 0.012
#> GSM152049     1  0.2043      0.925 0.968 0.032
#> GSM152053     2  0.0938      0.963 0.012 0.988
#> GSM152059     1  0.0938      0.931 0.988 0.012
#> GSM152085     1  0.2043      0.925 0.968 0.032
#> GSM152101     2  0.2043      0.946 0.032 0.968
#> GSM152105     1  0.0938      0.931 0.988 0.012
#> GSM152034     1  0.2423      0.921 0.960 0.040
#> GSM152036     2  0.0938      0.963 0.012 0.988
#> GSM152040     1  0.0000      0.931 1.000 0.000
#> GSM152043     1  0.0672      0.931 0.992 0.008
#> GSM152046     1  0.2423      0.921 0.960 0.040
#> GSM152047     1  0.0000      0.931 1.000 0.000
#> GSM152048     1  0.2043      0.925 0.968 0.032
#> GSM152050     1  0.2043      0.925 0.968 0.032
#> GSM152052     1  0.0938      0.931 0.988 0.012
#> GSM152056     1  0.2043      0.925 0.968 0.032
#> GSM152060     1  0.2423      0.921 0.960 0.040
#> GSM152065     1  0.0938      0.931 0.988 0.012
#> GSM152066     1  0.0000      0.931 1.000 0.000
#> GSM152069     1  0.9460      0.468 0.636 0.364
#> GSM152070     1  0.0938      0.931 0.988 0.012
#> GSM152071     1  0.9460      0.468 0.636 0.364
#> GSM152072     1  0.0938      0.931 0.988 0.012
#> GSM152073     1  0.0938      0.931 0.988 0.012
#> GSM152078     1  0.0938      0.931 0.988 0.012
#> GSM152082     1  0.0938      0.931 0.988 0.012
#> GSM152086     1  0.0000      0.931 1.000 0.000
#> GSM152090     1  0.9393      0.491 0.644 0.356
#> GSM152092     1  0.0938      0.931 0.988 0.012
#> GSM152093     1  0.2043      0.925 0.968 0.032
#> GSM152094     1  0.0000      0.931 1.000 0.000
#> GSM152098     1  0.0938      0.931 0.988 0.012
#> GSM152110     1  0.2043      0.925 0.968 0.032
#> GSM152031     1  0.0938      0.931 0.988 0.012
#> GSM152037     1  0.0000      0.931 1.000 0.000
#> GSM152055     1  0.2423      0.921 0.960 0.040
#> GSM152061     1  0.2423      0.921 0.960 0.040
#> GSM152064     1  0.2423      0.921 0.960 0.040
#> GSM152087     1  0.0000      0.931 1.000 0.000
#> GSM152103     1  0.2236      0.920 0.964 0.036

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0983      0.766 0.016 0.004 0.980
#> GSM152033     3  0.4121      0.730 0.168 0.000 0.832
#> GSM152063     2  0.2796      0.758 0.000 0.908 0.092
#> GSM152074     3  0.1525      0.756 0.004 0.032 0.964
#> GSM152080     3  0.6026      0.319 0.000 0.376 0.624
#> GSM152081     2  0.6500      0.744 0.100 0.760 0.140
#> GSM152083     3  0.5178      0.529 0.000 0.256 0.744
#> GSM152091     2  0.5678      0.549 0.000 0.684 0.316
#> GSM152108     2  0.6339      0.441 0.008 0.632 0.360
#> GSM152114     1  0.6416      0.587 0.708 0.032 0.260
#> GSM152035     2  0.4974      0.664 0.000 0.764 0.236
#> GSM152039     2  0.5492      0.762 0.104 0.816 0.080
#> GSM152041     2  0.6025      0.740 0.140 0.784 0.076
#> GSM152044     2  0.1964      0.764 0.000 0.944 0.056
#> GSM152045     1  0.6451      0.392 0.608 0.008 0.384
#> GSM152051     2  0.4399      0.715 0.000 0.812 0.188
#> GSM152054     3  0.6507      0.413 0.028 0.284 0.688
#> GSM152057     2  0.4062      0.728 0.000 0.836 0.164
#> GSM152058     1  0.0892      0.892 0.980 0.000 0.020
#> GSM152067     3  0.1031      0.757 0.000 0.024 0.976
#> GSM152068     2  0.3412      0.748 0.000 0.876 0.124
#> GSM152075     2  0.6250      0.747 0.104 0.776 0.120
#> GSM152076     2  0.5492      0.762 0.104 0.816 0.080
#> GSM152079     2  0.4399      0.715 0.000 0.812 0.188
#> GSM152084     3  0.3276      0.768 0.068 0.024 0.908
#> GSM152089     2  0.6974      0.734 0.104 0.728 0.168
#> GSM152095     2  0.5505      0.766 0.096 0.816 0.088
#> GSM152096     3  0.1337      0.766 0.016 0.012 0.972
#> GSM152097     2  0.1529      0.767 0.000 0.960 0.040
#> GSM152099     2  0.4399      0.715 0.000 0.812 0.188
#> GSM152106     2  0.1643      0.766 0.000 0.956 0.044
#> GSM152107     3  0.4912      0.572 0.008 0.196 0.796
#> GSM152109     3  0.1170      0.764 0.008 0.016 0.976
#> GSM152111     1  0.0983      0.884 0.980 0.016 0.004
#> GSM152112     2  0.7039      0.605 0.040 0.648 0.312
#> GSM152113     3  0.2878      0.768 0.096 0.000 0.904
#> GSM152115     3  0.1643      0.750 0.000 0.044 0.956
#> GSM152030     2  0.7007      0.717 0.100 0.724 0.176
#> GSM152038     3  0.3038      0.764 0.104 0.000 0.896
#> GSM152042     2  0.7298      0.695 0.100 0.700 0.200
#> GSM152062     3  0.3276      0.768 0.068 0.024 0.908
#> GSM152077     1  0.1289      0.889 0.968 0.000 0.032
#> GSM152088     2  0.5497      0.588 0.000 0.708 0.292
#> GSM152100     2  0.5492      0.762 0.104 0.816 0.080
#> GSM152102     3  0.6274      0.093 0.000 0.456 0.544
#> GSM152104     2  0.1643      0.766 0.000 0.956 0.044
#> GSM152028     1  0.3482      0.843 0.872 0.000 0.128
#> GSM152029     3  0.6192      0.242 0.420 0.000 0.580
#> GSM152049     1  0.0592      0.892 0.988 0.000 0.012
#> GSM152053     2  0.7388      0.686 0.100 0.692 0.208
#> GSM152059     1  0.3482      0.846 0.872 0.000 0.128
#> GSM152085     1  0.0661      0.887 0.988 0.008 0.004
#> GSM152101     3  0.4912      0.572 0.008 0.196 0.796
#> GSM152105     1  0.4750      0.757 0.784 0.000 0.216
#> GSM152034     1  0.2599      0.858 0.932 0.052 0.016
#> GSM152036     2  0.5492      0.762 0.104 0.816 0.080
#> GSM152040     1  0.1753      0.886 0.952 0.000 0.048
#> GSM152043     1  0.3412      0.845 0.876 0.000 0.124
#> GSM152046     1  0.2599      0.858 0.932 0.052 0.016
#> GSM152047     1  0.1905      0.873 0.956 0.028 0.016
#> GSM152048     1  0.0892      0.892 0.980 0.000 0.020
#> GSM152050     1  0.0983      0.884 0.980 0.016 0.004
#> GSM152052     1  0.4702      0.762 0.788 0.000 0.212
#> GSM152056     1  0.0592      0.892 0.988 0.000 0.012
#> GSM152060     1  0.2599      0.858 0.932 0.052 0.016
#> GSM152065     1  0.6302      0.112 0.520 0.000 0.480
#> GSM152066     1  0.0747      0.892 0.984 0.000 0.016
#> GSM152069     3  0.1643      0.775 0.044 0.000 0.956
#> GSM152070     1  0.3482      0.846 0.872 0.000 0.128
#> GSM152071     3  0.1643      0.775 0.044 0.000 0.956
#> GSM152072     3  0.5948      0.393 0.360 0.000 0.640
#> GSM152073     1  0.3192      0.854 0.888 0.000 0.112
#> GSM152078     3  0.6126      0.285 0.400 0.000 0.600
#> GSM152082     1  0.3482      0.845 0.872 0.000 0.128
#> GSM152086     1  0.0592      0.892 0.988 0.000 0.012
#> GSM152090     3  0.4002      0.735 0.160 0.000 0.840
#> GSM152092     1  0.3482      0.843 0.872 0.000 0.128
#> GSM152093     1  0.0892      0.892 0.980 0.000 0.020
#> GSM152094     1  0.0892      0.891 0.980 0.000 0.020
#> GSM152098     1  0.3482      0.846 0.872 0.000 0.128
#> GSM152110     1  0.0475      0.890 0.992 0.004 0.004
#> GSM152031     1  0.4291      0.799 0.820 0.000 0.180
#> GSM152037     1  0.0892      0.892 0.980 0.000 0.020
#> GSM152055     1  0.2280      0.859 0.940 0.052 0.008
#> GSM152061     1  0.2599      0.858 0.932 0.052 0.016
#> GSM152064     1  0.1999      0.870 0.952 0.036 0.012
#> GSM152087     1  0.0892      0.891 0.980 0.000 0.020
#> GSM152103     3  0.4121      0.727 0.168 0.000 0.832

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.3399      0.716 0.000 0.092 0.868 0.040
#> GSM152033     3  0.5593      0.616 0.048 0.004 0.688 0.260
#> GSM152063     2  0.1792      0.776 0.000 0.932 0.000 0.068
#> GSM152074     3  0.3587      0.710 0.000 0.104 0.856 0.040
#> GSM152080     2  0.4840      0.642 0.000 0.732 0.240 0.028
#> GSM152081     4  0.6029      0.811 0.008 0.272 0.060 0.660
#> GSM152083     3  0.5344      0.472 0.000 0.300 0.668 0.032
#> GSM152091     2  0.4549      0.707 0.000 0.776 0.188 0.036
#> GSM152108     2  0.5833      0.566 0.000 0.692 0.096 0.212
#> GSM152114     4  0.6979      0.177 0.180 0.012 0.184 0.624
#> GSM152035     2  0.2227      0.796 0.000 0.928 0.036 0.036
#> GSM152039     4  0.5421      0.789 0.020 0.308 0.008 0.664
#> GSM152041     4  0.6557      0.714 0.152 0.196 0.004 0.648
#> GSM152044     2  0.2081      0.765 0.000 0.916 0.000 0.084
#> GSM152045     1  0.6567      0.395 0.616 0.000 0.256 0.128
#> GSM152051     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM152054     3  0.9453      0.304 0.256 0.116 0.384 0.244
#> GSM152057     2  0.0336      0.812 0.000 0.992 0.000 0.008
#> GSM152058     1  0.5132      0.752 0.748 0.000 0.068 0.184
#> GSM152067     3  0.3117      0.705 0.000 0.092 0.880 0.028
#> GSM152068     2  0.0469      0.812 0.000 0.988 0.000 0.012
#> GSM152075     4  0.5959      0.814 0.012 0.276 0.048 0.664
#> GSM152076     4  0.5701      0.803 0.008 0.308 0.032 0.652
#> GSM152079     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM152084     3  0.3791      0.711 0.008 0.032 0.852 0.108
#> GSM152089     4  0.7075      0.607 0.200 0.108 0.044 0.648
#> GSM152095     4  0.5701      0.803 0.008 0.308 0.032 0.652
#> GSM152096     3  0.3307      0.713 0.000 0.104 0.868 0.028
#> GSM152097     2  0.2345      0.747 0.000 0.900 0.000 0.100
#> GSM152099     2  0.0336      0.812 0.000 0.992 0.000 0.008
#> GSM152106     2  0.2345      0.747 0.000 0.900 0.000 0.100
#> GSM152107     3  0.7020      0.243 0.000 0.136 0.532 0.332
#> GSM152109     3  0.2546      0.710 0.000 0.092 0.900 0.008
#> GSM152111     1  0.1118      0.768 0.964 0.000 0.000 0.036
#> GSM152112     4  0.7226      0.690 0.004 0.232 0.196 0.568
#> GSM152113     3  0.5235      0.656 0.024 0.016 0.728 0.232
#> GSM152115     3  0.5292      0.646 0.000 0.088 0.744 0.168
#> GSM152030     4  0.6608      0.790 0.008 0.268 0.100 0.624
#> GSM152038     3  0.3484      0.701 0.008 0.004 0.844 0.144
#> GSM152042     4  0.6955      0.766 0.008 0.248 0.140 0.604
#> GSM152062     3  0.3791      0.711 0.008 0.032 0.852 0.108
#> GSM152077     1  0.6315      0.693 0.652 0.004 0.100 0.244
#> GSM152088     2  0.4387      0.702 0.000 0.776 0.200 0.024
#> GSM152100     4  0.5701      0.805 0.008 0.308 0.032 0.652
#> GSM152102     2  0.5664      0.612 0.000 0.696 0.228 0.076
#> GSM152104     2  0.2149      0.761 0.000 0.912 0.000 0.088
#> GSM152028     1  0.6300      0.700 0.640 0.000 0.108 0.252
#> GSM152029     3  0.6470      0.332 0.388 0.008 0.548 0.056
#> GSM152049     1  0.4508      0.765 0.780 0.000 0.036 0.184
#> GSM152053     4  0.6917      0.759 0.008 0.236 0.144 0.612
#> GSM152059     1  0.2483      0.766 0.916 0.000 0.032 0.052
#> GSM152085     1  0.1022      0.769 0.968 0.000 0.000 0.032
#> GSM152101     3  0.6273      0.483 0.000 0.100 0.636 0.264
#> GSM152105     1  0.7786      0.323 0.424 0.000 0.308 0.268
#> GSM152034     1  0.3074      0.701 0.848 0.000 0.000 0.152
#> GSM152036     4  0.5520      0.793 0.020 0.304 0.012 0.664
#> GSM152040     1  0.3143      0.751 0.876 0.000 0.024 0.100
#> GSM152043     1  0.5392      0.748 0.724 0.000 0.072 0.204
#> GSM152046     1  0.3024      0.705 0.852 0.000 0.000 0.148
#> GSM152047     1  0.3335      0.741 0.856 0.000 0.016 0.128
#> GSM152048     1  0.5132      0.752 0.748 0.000 0.068 0.184
#> GSM152050     1  0.1118      0.768 0.964 0.000 0.000 0.036
#> GSM152052     1  0.7396      0.482 0.516 0.000 0.268 0.216
#> GSM152056     1  0.4880      0.758 0.760 0.000 0.052 0.188
#> GSM152060     1  0.3074      0.701 0.848 0.000 0.000 0.152
#> GSM152065     3  0.7520      0.254 0.228 0.000 0.492 0.280
#> GSM152066     1  0.4893      0.754 0.768 0.000 0.064 0.168
#> GSM152069     3  0.2382      0.717 0.004 0.080 0.912 0.004
#> GSM152070     1  0.3587      0.743 0.860 0.000 0.052 0.088
#> GSM152071     3  0.2382      0.717 0.004 0.080 0.912 0.004
#> GSM152072     3  0.5798      0.605 0.208 0.000 0.696 0.096
#> GSM152073     1  0.2363      0.767 0.920 0.000 0.024 0.056
#> GSM152078     3  0.6967      0.354 0.244 0.000 0.580 0.176
#> GSM152082     1  0.5787      0.726 0.680 0.000 0.076 0.244
#> GSM152086     1  0.3037      0.781 0.880 0.000 0.020 0.100
#> GSM152090     3  0.4254      0.693 0.108 0.024 0.836 0.032
#> GSM152092     1  0.6192      0.709 0.652 0.000 0.104 0.244
#> GSM152093     1  0.5279      0.747 0.736 0.000 0.072 0.192
#> GSM152094     1  0.1209      0.771 0.964 0.000 0.004 0.032
#> GSM152098     1  0.3453      0.748 0.868 0.000 0.052 0.080
#> GSM152110     1  0.4801      0.759 0.764 0.000 0.048 0.188
#> GSM152031     1  0.7538      0.477 0.492 0.000 0.260 0.248
#> GSM152037     1  0.5007      0.751 0.760 0.000 0.068 0.172
#> GSM152055     1  0.3074      0.701 0.848 0.000 0.000 0.152
#> GSM152061     1  0.3074      0.701 0.848 0.000 0.000 0.152
#> GSM152064     1  0.2868      0.716 0.864 0.000 0.000 0.136
#> GSM152087     1  0.0707      0.773 0.980 0.000 0.000 0.020
#> GSM152103     3  0.5199      0.658 0.168 0.024 0.768 0.040

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3   0.339     0.7932 0.076 0.032 0.860 0.032 0.000
#> GSM152033     1   0.355     0.4506 0.776 0.004 0.216 0.004 0.000
#> GSM152063     2   0.239     0.8988 0.004 0.880 0.000 0.116 0.000
#> GSM152074     3   0.363     0.7919 0.076 0.036 0.848 0.040 0.000
#> GSM152080     2   0.375     0.7886 0.064 0.812 0.124 0.000 0.000
#> GSM152081     4   0.128     0.9188 0.004 0.020 0.016 0.960 0.000
#> GSM152083     3   0.463     0.7103 0.044 0.168 0.760 0.028 0.000
#> GSM152091     2   0.366     0.8076 0.064 0.828 0.104 0.004 0.000
#> GSM152108     1   0.597    -0.0430 0.480 0.448 0.044 0.024 0.004
#> GSM152114     1   0.637     0.5526 0.624 0.008 0.028 0.212 0.128
#> GSM152035     2   0.251     0.8693 0.020 0.908 0.028 0.044 0.000
#> GSM152039     4   0.159     0.9158 0.004 0.052 0.000 0.940 0.004
#> GSM152041     4   0.379     0.8074 0.016 0.024 0.008 0.828 0.124
#> GSM152044     2   0.281     0.8833 0.004 0.844 0.000 0.152 0.000
#> GSM152045     5   0.637     0.5892 0.188 0.056 0.124 0.000 0.632
#> GSM152051     2   0.234     0.8994 0.000 0.884 0.004 0.112 0.000
#> GSM152054     5   0.898     0.3029 0.264 0.200 0.124 0.048 0.364
#> GSM152057     2   0.223     0.8991 0.000 0.884 0.000 0.116 0.000
#> GSM152058     1   0.457     0.6477 0.596 0.004 0.000 0.008 0.392
#> GSM152067     3   0.196     0.7721 0.020 0.048 0.928 0.000 0.004
#> GSM152068     2   0.223     0.8991 0.000 0.884 0.000 0.116 0.000
#> GSM152075     4   0.127     0.9194 0.012 0.024 0.000 0.960 0.004
#> GSM152076     4   0.159     0.9158 0.004 0.052 0.000 0.940 0.004
#> GSM152079     2   0.234     0.8994 0.000 0.884 0.004 0.112 0.000
#> GSM152084     3   0.498     0.7145 0.268 0.008 0.676 0.048 0.000
#> GSM152089     5   0.791     0.0770 0.060 0.072 0.068 0.384 0.416
#> GSM152095     4   0.159     0.9158 0.004 0.052 0.000 0.940 0.004
#> GSM152096     3   0.435     0.7687 0.180 0.032 0.768 0.020 0.000
#> GSM152097     2   0.328     0.8553 0.008 0.804 0.000 0.188 0.000
#> GSM152099     2   0.249     0.8959 0.000 0.872 0.004 0.124 0.000
#> GSM152106     2   0.328     0.8553 0.008 0.804 0.000 0.188 0.000
#> GSM152107     3   0.556     0.5920 0.040 0.052 0.668 0.240 0.000
#> GSM152109     3   0.267     0.7856 0.060 0.044 0.892 0.000 0.004
#> GSM152111     5   0.228     0.6920 0.040 0.004 0.008 0.028 0.920
#> GSM152112     4   0.378     0.8225 0.040 0.032 0.092 0.836 0.000
#> GSM152113     1   0.452     0.0840 0.624 0.000 0.360 0.016 0.000
#> GSM152115     3   0.489     0.7329 0.072 0.072 0.772 0.084 0.000
#> GSM152030     4   0.167     0.9070 0.008 0.016 0.032 0.944 0.000
#> GSM152038     3   0.470     0.6822 0.304 0.004 0.664 0.028 0.000
#> GSM152042     4   0.200     0.8972 0.012 0.012 0.048 0.928 0.000
#> GSM152062     3   0.477     0.7152 0.264 0.004 0.688 0.044 0.000
#> GSM152077     1   0.451     0.6869 0.744 0.000 0.024 0.024 0.208
#> GSM152088     2   0.348     0.8126 0.056 0.840 0.100 0.004 0.000
#> GSM152100     4   0.157     0.9190 0.008 0.044 0.000 0.944 0.004
#> GSM152102     2   0.456     0.7233 0.108 0.760 0.128 0.000 0.004
#> GSM152104     2   0.297     0.8796 0.008 0.836 0.000 0.156 0.000
#> GSM152028     1   0.364     0.6689 0.776 0.004 0.008 0.000 0.212
#> GSM152029     5   0.669     0.2703 0.144 0.020 0.356 0.000 0.480
#> GSM152049     1   0.484     0.5675 0.524 0.004 0.004 0.008 0.460
#> GSM152053     4   0.207     0.8946 0.012 0.012 0.052 0.924 0.000
#> GSM152059     5   0.353     0.6951 0.152 0.012 0.016 0.000 0.820
#> GSM152085     5   0.112     0.7114 0.028 0.004 0.000 0.004 0.964
#> GSM152101     3   0.531     0.6837 0.060 0.068 0.732 0.140 0.000
#> GSM152105     1   0.332     0.6719 0.844 0.000 0.056 0.000 0.100
#> GSM152034     5   0.205     0.7303 0.000 0.008 0.004 0.072 0.916
#> GSM152036     4   0.159     0.9158 0.004 0.052 0.000 0.940 0.004
#> GSM152040     5   0.457     0.6876 0.152 0.036 0.032 0.004 0.776
#> GSM152043     1   0.509     0.4374 0.568 0.020 0.012 0.000 0.400
#> GSM152046     5   0.180     0.7315 0.000 0.004 0.004 0.064 0.928
#> GSM152047     5   0.408     0.7171 0.108 0.020 0.028 0.020 0.824
#> GSM152048     1   0.457     0.6477 0.596 0.004 0.000 0.008 0.392
#> GSM152050     5   0.215     0.6923 0.040 0.004 0.004 0.028 0.924
#> GSM152052     1   0.405     0.6877 0.780 0.000 0.056 0.000 0.164
#> GSM152056     1   0.474     0.6391 0.584 0.004 0.004 0.008 0.400
#> GSM152060     5   0.209     0.7256 0.004 0.004 0.004 0.072 0.916
#> GSM152065     1   0.378     0.5758 0.832 0.016 0.088 0.000 0.064
#> GSM152066     1   0.473     0.6425 0.588 0.004 0.004 0.008 0.396
#> GSM152069     3   0.293     0.7854 0.076 0.044 0.876 0.000 0.004
#> GSM152070     5   0.496     0.6502 0.196 0.040 0.036 0.000 0.728
#> GSM152071     3   0.293     0.7854 0.076 0.044 0.876 0.000 0.004
#> GSM152072     3   0.754     0.1204 0.232 0.056 0.444 0.000 0.268
#> GSM152073     5   0.339     0.6942 0.148 0.012 0.012 0.000 0.828
#> GSM152078     1   0.579     0.3497 0.616 0.012 0.276 0.000 0.096
#> GSM152082     1   0.457     0.5633 0.688 0.028 0.004 0.000 0.280
#> GSM152086     5   0.459    -0.0875 0.348 0.004 0.004 0.008 0.636
#> GSM152090     3   0.562     0.6660 0.232 0.016 0.676 0.016 0.060
#> GSM152092     1   0.409     0.6391 0.736 0.016 0.004 0.000 0.244
#> GSM152093     1   0.489     0.6494 0.596 0.004 0.004 0.016 0.380
#> GSM152094     5   0.229     0.7263 0.072 0.012 0.008 0.000 0.908
#> GSM152098     5   0.490     0.6527 0.188 0.040 0.036 0.000 0.736
#> GSM152110     1   0.481     0.6081 0.552 0.004 0.004 0.008 0.432
#> GSM152031     1   0.380     0.6717 0.808 0.004 0.044 0.000 0.144
#> GSM152037     1   0.448     0.6635 0.628 0.004 0.000 0.008 0.360
#> GSM152055     5   0.240     0.7169 0.008 0.008 0.004 0.076 0.904
#> GSM152061     5   0.209     0.7256 0.004 0.004 0.004 0.072 0.916
#> GSM152064     5   0.239     0.7155 0.012 0.008 0.004 0.068 0.908
#> GSM152087     5   0.197     0.7278 0.060 0.012 0.004 0.000 0.924
#> GSM152103     3   0.526     0.6564 0.240 0.012 0.684 0.004 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
#> GSM152032     3   0.127     0.7384 0.036 0.000 0.952 0.008 0.000 0.004
#> GSM152033     1   0.498     0.4896 0.700 0.000 0.144 0.012 0.136 0.008
#> GSM152063     2   0.193     0.8796 0.000 0.912 0.000 0.068 0.020 0.000
#> GSM152074     3   0.216     0.7287 0.020 0.004 0.916 0.008 0.048 0.004
#> GSM152080     2   0.335     0.7724 0.004 0.780 0.008 0.000 0.204 0.004
#> GSM152081     4   0.322     0.8542 0.000 0.012 0.036 0.848 0.096 0.008
#> GSM152083     3   0.336     0.6856 0.012 0.112 0.836 0.004 0.032 0.004
#> GSM152091     2   0.310     0.7772 0.004 0.788 0.004 0.000 0.204 0.000
#> GSM152108     1   0.738     0.0795 0.400 0.364 0.064 0.056 0.116 0.000
#> GSM152114     1   0.661     0.5238 0.600 0.004 0.032 0.156 0.064 0.144
#> GSM152035     2   0.242     0.8367 0.004 0.884 0.008 0.008 0.096 0.000
#> GSM152039     4   0.266     0.8484 0.000 0.012 0.000 0.876 0.084 0.028
#> GSM152041     4   0.448     0.5539 0.020 0.000 0.000 0.660 0.024 0.296
#> GSM152044     2   0.220     0.8764 0.004 0.900 0.000 0.080 0.012 0.004
#> GSM152045     5   0.592     0.3729 0.132 0.000 0.016 0.000 0.440 0.412
#> GSM152051     2   0.184     0.8817 0.000 0.920 0.008 0.064 0.008 0.000
#> GSM152054     5   0.680     0.3771 0.068 0.100 0.032 0.040 0.624 0.136
#> GSM152057     2   0.147     0.8813 0.000 0.932 0.004 0.064 0.000 0.000
#> GSM152058     1   0.324     0.6077 0.732 0.000 0.000 0.000 0.000 0.268
#> GSM152067     3   0.273     0.7057 0.004 0.016 0.860 0.000 0.116 0.004
#> GSM152068     2   0.139     0.8812 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM152075     4   0.149     0.8587 0.004 0.008 0.012 0.952 0.012 0.012
#> GSM152076     4   0.281     0.8505 0.000 0.012 0.004 0.872 0.084 0.028
#> GSM152079     2   0.158     0.8814 0.000 0.928 0.008 0.064 0.000 0.000
#> GSM152084     3   0.586     0.6719 0.176 0.004 0.636 0.112 0.072 0.000
#> GSM152089     6   0.625    -0.0845 0.004 0.000 0.008 0.384 0.204 0.400
#> GSM152095     4   0.281     0.8505 0.000 0.012 0.004 0.872 0.084 0.028
#> GSM152096     3   0.603     0.6783 0.176 0.020 0.640 0.080 0.084 0.000
#> GSM152097     2   0.411     0.7947 0.004 0.768 0.000 0.124 0.100 0.004
#> GSM152099     2   0.184     0.8813 0.000 0.920 0.008 0.064 0.008 0.000
#> GSM152106     2   0.411     0.7947 0.004 0.768 0.000 0.124 0.100 0.004
#> GSM152107     3   0.499     0.5901 0.004 0.004 0.660 0.224 0.108 0.000
#> GSM152109     3   0.274     0.7131 0.016 0.020 0.876 0.000 0.084 0.004
#> GSM152111     6   0.228     0.5547 0.096 0.000 0.000 0.008 0.008 0.888
#> GSM152112     4   0.371     0.7652 0.000 0.008 0.084 0.800 0.108 0.000
#> GSM152113     1   0.636     0.0725 0.516 0.000 0.288 0.060 0.136 0.000
#> GSM152115     3   0.414     0.6836 0.008 0.000 0.756 0.080 0.156 0.000
#> GSM152030     4   0.244     0.8409 0.004 0.008 0.060 0.896 0.032 0.000
#> GSM152038     3   0.573     0.5092 0.312 0.000 0.552 0.024 0.112 0.000
#> GSM152042     4   0.269     0.8310 0.004 0.008 0.072 0.880 0.036 0.000
#> GSM152062     3   0.568     0.6746 0.180 0.004 0.652 0.096 0.068 0.000
#> GSM152077     1   0.438     0.6182 0.796 0.004 0.024 0.048 0.044 0.084
#> GSM152088     2   0.270     0.8006 0.004 0.836 0.004 0.000 0.156 0.000
#> GSM152100     4   0.127     0.8599 0.004 0.008 0.004 0.960 0.012 0.012
#> GSM152102     2   0.441     0.6170 0.008 0.620 0.016 0.004 0.352 0.000
#> GSM152104     2   0.286     0.8622 0.004 0.864 0.000 0.088 0.040 0.004
#> GSM152028     1   0.302     0.5705 0.848 0.000 0.004 0.000 0.096 0.052
#> GSM152029     5   0.737     0.4775 0.136 0.004 0.176 0.000 0.408 0.276
#> GSM152049     1   0.411     0.3412 0.540 0.000 0.000 0.004 0.004 0.452
#> GSM152053     4   0.280     0.8248 0.004 0.008 0.080 0.872 0.036 0.000
#> GSM152059     6   0.574    -0.1976 0.196 0.000 0.000 0.000 0.304 0.500
#> GSM152085     6   0.162     0.5681 0.064 0.000 0.000 0.004 0.004 0.928
#> GSM152101     3   0.445     0.6579 0.000 0.004 0.724 0.124 0.148 0.000
#> GSM152105     1   0.229     0.5892 0.904 0.000 0.040 0.000 0.044 0.012
#> GSM152034     6   0.184     0.5661 0.000 0.000 0.000 0.028 0.052 0.920
#> GSM152036     4   0.278     0.8503 0.000 0.008 0.004 0.872 0.084 0.032
#> GSM152040     6   0.553    -0.2659 0.124 0.000 0.000 0.004 0.360 0.512
#> GSM152043     1   0.551     0.0952 0.560 0.000 0.000 0.000 0.248 0.192
#> GSM152046     6   0.191     0.5677 0.000 0.000 0.000 0.028 0.056 0.916
#> GSM152047     6   0.487     0.1272 0.084 0.000 0.000 0.004 0.276 0.636
#> GSM152048     1   0.324     0.6077 0.732 0.000 0.000 0.000 0.000 0.268
#> GSM152050     6   0.242     0.5482 0.108 0.000 0.000 0.008 0.008 0.876
#> GSM152052     1   0.332     0.6158 0.844 0.000 0.028 0.000 0.068 0.060
#> GSM152056     1   0.360     0.5718 0.684 0.000 0.000 0.004 0.000 0.312
#> GSM152060     6   0.199     0.5709 0.004 0.000 0.000 0.028 0.052 0.916
#> GSM152065     1   0.390     0.4757 0.764 0.000 0.040 0.000 0.184 0.012
#> GSM152066     1   0.345     0.5996 0.716 0.000 0.000 0.000 0.004 0.280
#> GSM152069     3   0.284     0.7137 0.016 0.020 0.868 0.000 0.092 0.004
#> GSM152070     5   0.604     0.3479 0.184 0.000 0.008 0.000 0.408 0.400
#> GSM152071     3   0.284     0.7137 0.016 0.020 0.868 0.000 0.092 0.004
#> GSM152072     5   0.667     0.5368 0.168 0.000 0.172 0.000 0.536 0.124
#> GSM152073     6   0.578    -0.2121 0.200 0.000 0.000 0.000 0.312 0.488
#> GSM152078     1   0.588     0.1453 0.548 0.000 0.156 0.000 0.276 0.020
#> GSM152082     1   0.520     0.1139 0.584 0.000 0.008 0.000 0.320 0.088
#> GSM152086     6   0.447    -0.0519 0.412 0.000 0.000 0.004 0.024 0.560
#> GSM152090     3   0.697     0.5831 0.236 0.008 0.540 0.068 0.120 0.028
#> GSM152092     1   0.393     0.4675 0.756 0.000 0.000 0.000 0.172 0.072
#> GSM152093     1   0.519     0.5864 0.652 0.000 0.004 0.052 0.040 0.252
#> GSM152094     6   0.423     0.3806 0.084 0.000 0.000 0.000 0.192 0.724
#> GSM152098     6   0.606    -0.4823 0.188 0.000 0.008 0.000 0.400 0.404
#> GSM152110     1   0.365     0.5607 0.672 0.000 0.000 0.004 0.000 0.324
#> GSM152031     1   0.355     0.5354 0.812 0.000 0.028 0.000 0.132 0.028
#> GSM152037     1   0.317     0.6147 0.744 0.000 0.000 0.000 0.000 0.256
#> GSM152055     6   0.205     0.5615 0.044 0.000 0.000 0.032 0.008 0.916
#> GSM152061     6   0.199     0.5709 0.004 0.000 0.000 0.028 0.052 0.916
#> GSM152064     6   0.168     0.5669 0.028 0.000 0.000 0.028 0.008 0.936
#> GSM152087     6   0.417     0.4131 0.092 0.000 0.000 0.000 0.172 0.736
#> GSM152103     3   0.673     0.5259 0.288 0.008 0.524 0.036 0.116 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 specimen(p) k
#> MAD:kmeans 83    5.43e-09 2
#> MAD:kmeans 79    1.28e-06 3
#> MAD:kmeans 76    2.22e-05 4
#> MAD:kmeans 78    1.09e-03 5
#> MAD:kmeans 66    4.54e-02 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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.964       0.985         0.5056 0.495   0.495
#> 3 3 0.847           0.866       0.945         0.3157 0.789   0.596
#> 4 4 0.690           0.784       0.836         0.1173 0.861   0.624
#> 5 5 0.775           0.769       0.872         0.0833 0.859   0.527
#> 6 6 0.764           0.642       0.806         0.0393 0.948   0.743

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
#> GSM152032     2   0.000      0.978 0.000 1.000
#> GSM152033     1   0.000      0.991 1.000 0.000
#> GSM152063     2   0.000      0.978 0.000 1.000
#> GSM152074     2   0.000      0.978 0.000 1.000
#> GSM152080     2   0.000      0.978 0.000 1.000
#> GSM152081     2   0.000      0.978 0.000 1.000
#> GSM152083     2   0.000      0.978 0.000 1.000
#> GSM152091     2   0.000      0.978 0.000 1.000
#> GSM152108     2   0.000      0.978 0.000 1.000
#> GSM152114     1   0.958      0.356 0.620 0.380
#> GSM152035     2   0.000      0.978 0.000 1.000
#> GSM152039     2   0.000      0.978 0.000 1.000
#> GSM152041     2   0.929      0.478 0.344 0.656
#> GSM152044     2   0.000      0.978 0.000 1.000
#> GSM152045     1   0.000      0.991 1.000 0.000
#> GSM152051     2   0.000      0.978 0.000 1.000
#> GSM152054     2   0.163      0.959 0.024 0.976
#> GSM152057     2   0.000      0.978 0.000 1.000
#> GSM152058     1   0.000      0.991 1.000 0.000
#> GSM152067     2   0.000      0.978 0.000 1.000
#> GSM152068     2   0.000      0.978 0.000 1.000
#> GSM152075     2   0.000      0.978 0.000 1.000
#> GSM152076     2   0.000      0.978 0.000 1.000
#> GSM152079     2   0.000      0.978 0.000 1.000
#> GSM152084     2   0.000      0.978 0.000 1.000
#> GSM152089     2   0.000      0.978 0.000 1.000
#> GSM152095     2   0.000      0.978 0.000 1.000
#> GSM152096     2   0.000      0.978 0.000 1.000
#> GSM152097     2   0.000      0.978 0.000 1.000
#> GSM152099     2   0.000      0.978 0.000 1.000
#> GSM152106     2   0.000      0.978 0.000 1.000
#> GSM152107     2   0.000      0.978 0.000 1.000
#> GSM152109     2   0.000      0.978 0.000 1.000
#> GSM152111     1   0.000      0.991 1.000 0.000
#> GSM152112     2   0.000      0.978 0.000 1.000
#> GSM152113     2   0.827      0.663 0.260 0.740
#> GSM152115     2   0.000      0.978 0.000 1.000
#> GSM152030     2   0.000      0.978 0.000 1.000
#> GSM152038     1   0.000      0.991 1.000 0.000
#> GSM152042     2   0.000      0.978 0.000 1.000
#> GSM152062     2   0.295      0.935 0.052 0.948
#> GSM152077     1   0.000      0.991 1.000 0.000
#> GSM152088     2   0.000      0.978 0.000 1.000
#> GSM152100     2   0.000      0.978 0.000 1.000
#> GSM152102     2   0.000      0.978 0.000 1.000
#> GSM152104     2   0.000      0.978 0.000 1.000
#> GSM152028     1   0.000      0.991 1.000 0.000
#> GSM152029     1   0.000      0.991 1.000 0.000
#> GSM152049     1   0.000      0.991 1.000 0.000
#> GSM152053     2   0.000      0.978 0.000 1.000
#> GSM152059     1   0.000      0.991 1.000 0.000
#> GSM152085     1   0.000      0.991 1.000 0.000
#> GSM152101     2   0.000      0.978 0.000 1.000
#> GSM152105     1   0.000      0.991 1.000 0.000
#> GSM152034     1   0.000      0.991 1.000 0.000
#> GSM152036     2   0.000      0.978 0.000 1.000
#> GSM152040     1   0.000      0.991 1.000 0.000
#> GSM152043     1   0.000      0.991 1.000 0.000
#> GSM152046     1   0.000      0.991 1.000 0.000
#> GSM152047     1   0.000      0.991 1.000 0.000
#> GSM152048     1   0.000      0.991 1.000 0.000
#> GSM152050     1   0.000      0.991 1.000 0.000
#> GSM152052     1   0.000      0.991 1.000 0.000
#> GSM152056     1   0.000      0.991 1.000 0.000
#> GSM152060     1   0.000      0.991 1.000 0.000
#> GSM152065     1   0.000      0.991 1.000 0.000
#> GSM152066     1   0.000      0.991 1.000 0.000
#> GSM152069     2   0.416      0.905 0.084 0.916
#> GSM152070     1   0.000      0.991 1.000 0.000
#> GSM152071     2   0.443      0.897 0.092 0.908
#> GSM152072     1   0.000      0.991 1.000 0.000
#> GSM152073     1   0.000      0.991 1.000 0.000
#> GSM152078     1   0.000      0.991 1.000 0.000
#> GSM152082     1   0.000      0.991 1.000 0.000
#> GSM152086     1   0.000      0.991 1.000 0.000
#> GSM152090     2   0.469      0.889 0.100 0.900
#> GSM152092     1   0.000      0.991 1.000 0.000
#> GSM152093     1   0.000      0.991 1.000 0.000
#> GSM152094     1   0.000      0.991 1.000 0.000
#> GSM152098     1   0.000      0.991 1.000 0.000
#> GSM152110     1   0.000      0.991 1.000 0.000
#> GSM152031     1   0.000      0.991 1.000 0.000
#> GSM152037     1   0.000      0.991 1.000 0.000
#> GSM152055     1   0.000      0.991 1.000 0.000
#> GSM152061     1   0.000      0.991 1.000 0.000
#> GSM152064     1   0.000      0.991 1.000 0.000
#> GSM152087     1   0.000      0.991 1.000 0.000
#> GSM152103     1   0.000      0.991 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
#> GSM152032     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152033     3  0.0237     0.9230 0.004 0.000 0.996
#> GSM152063     2  0.0237     0.9444 0.000 0.996 0.004
#> GSM152074     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152080     3  0.4504     0.7486 0.000 0.196 0.804
#> GSM152081     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152083     3  0.2261     0.8765 0.000 0.068 0.932
#> GSM152091     2  0.0592     0.9428 0.000 0.988 0.012
#> GSM152108     2  0.0592     0.9428 0.000 0.988 0.012
#> GSM152114     1  0.9789     0.0141 0.396 0.368 0.236
#> GSM152035     2  0.0237     0.9444 0.000 0.996 0.004
#> GSM152039     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152041     2  0.1163     0.9214 0.028 0.972 0.000
#> GSM152044     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152045     1  0.6192     0.2018 0.580 0.000 0.420
#> GSM152051     2  0.0592     0.9428 0.000 0.988 0.012
#> GSM152054     2  0.6180     0.2447 0.000 0.584 0.416
#> GSM152057     2  0.0592     0.9428 0.000 0.988 0.012
#> GSM152058     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152067     3  0.0424     0.9205 0.000 0.008 0.992
#> GSM152068     2  0.0237     0.9444 0.000 0.996 0.004
#> GSM152075     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152076     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152079     2  0.0592     0.9428 0.000 0.988 0.012
#> GSM152084     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152089     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152095     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152096     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152097     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152099     2  0.0592     0.9428 0.000 0.988 0.012
#> GSM152106     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152107     2  0.5178     0.6781 0.000 0.744 0.256
#> GSM152109     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152111     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152112     2  0.0424     0.9423 0.000 0.992 0.008
#> GSM152113     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152115     3  0.2165     0.8801 0.000 0.064 0.936
#> GSM152030     2  0.1163     0.9293 0.000 0.972 0.028
#> GSM152038     3  0.0237     0.9230 0.004 0.000 0.996
#> GSM152042     2  0.3192     0.8539 0.000 0.888 0.112
#> GSM152062     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152077     1  0.0592     0.9313 0.988 0.000 0.012
#> GSM152088     2  0.0592     0.9428 0.000 0.988 0.012
#> GSM152100     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152102     2  0.6192     0.2414 0.000 0.580 0.420
#> GSM152104     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152028     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152029     3  0.3619     0.8235 0.136 0.000 0.864
#> GSM152049     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152053     2  0.3192     0.8539 0.000 0.888 0.112
#> GSM152059     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152085     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152101     3  0.6235     0.1371 0.000 0.436 0.564
#> GSM152105     1  0.5760     0.5183 0.672 0.000 0.328
#> GSM152034     1  0.0237     0.9383 0.996 0.004 0.000
#> GSM152036     2  0.0000     0.9447 0.000 1.000 0.000
#> GSM152040     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152043     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152046     1  0.0237     0.9383 0.996 0.004 0.000
#> GSM152047     1  0.0237     0.9383 0.996 0.004 0.000
#> GSM152048     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152050     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152052     1  0.5621     0.5572 0.692 0.000 0.308
#> GSM152056     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152060     1  0.0237     0.9383 0.996 0.004 0.000
#> GSM152065     3  0.5058     0.6650 0.244 0.000 0.756
#> GSM152066     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152069     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152070     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152071     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152072     3  0.3412     0.8336 0.124 0.000 0.876
#> GSM152073     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152078     3  0.3340     0.8376 0.120 0.000 0.880
#> GSM152082     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152086     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152090     3  0.0000     0.9244 0.000 0.000 1.000
#> GSM152092     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152093     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152094     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152098     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152110     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152031     1  0.5397     0.6067 0.720 0.000 0.280
#> GSM152037     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152055     1  0.0237     0.9383 0.996 0.004 0.000
#> GSM152061     1  0.0237     0.9383 0.996 0.004 0.000
#> GSM152064     1  0.0237     0.9383 0.996 0.004 0.000
#> GSM152087     1  0.0000     0.9402 1.000 0.000 0.000
#> GSM152103     3  0.0237     0.9231 0.004 0.000 0.996

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.1118      0.805 0.000 0.036 0.964 0.000
#> GSM152033     3  0.4155      0.731 0.004 0.240 0.756 0.000
#> GSM152063     2  0.4431      0.865 0.000 0.696 0.000 0.304
#> GSM152074     3  0.1302      0.802 0.000 0.044 0.956 0.000
#> GSM152080     2  0.5530      0.714 0.000 0.712 0.212 0.076
#> GSM152081     4  0.0524      0.864 0.000 0.004 0.008 0.988
#> GSM152083     2  0.4961      0.270 0.000 0.552 0.448 0.000
#> GSM152091     2  0.5394      0.850 0.000 0.712 0.060 0.228
#> GSM152108     2  0.3278      0.713 0.000 0.864 0.020 0.116
#> GSM152114     4  0.6675      0.534 0.060 0.240 0.044 0.656
#> GSM152035     2  0.4483      0.873 0.000 0.712 0.004 0.284
#> GSM152039     4  0.0000      0.864 0.000 0.000 0.000 1.000
#> GSM152041     4  0.1211      0.847 0.040 0.000 0.000 0.960
#> GSM152044     2  0.4454      0.862 0.000 0.692 0.000 0.308
#> GSM152045     1  0.5281      0.667 0.756 0.048 0.180 0.016
#> GSM152051     2  0.4331      0.873 0.000 0.712 0.000 0.288
#> GSM152054     2  0.6495      0.716 0.088 0.720 0.096 0.096
#> GSM152057     2  0.4331      0.873 0.000 0.712 0.000 0.288
#> GSM152058     1  0.4932      0.789 0.728 0.240 0.032 0.000
#> GSM152067     3  0.1637      0.798 0.000 0.060 0.940 0.000
#> GSM152068     2  0.4331      0.873 0.000 0.712 0.000 0.288
#> GSM152075     4  0.0188      0.864 0.004 0.000 0.000 0.996
#> GSM152076     4  0.0000      0.864 0.000 0.000 0.000 1.000
#> GSM152079     2  0.4331      0.873 0.000 0.712 0.000 0.288
#> GSM152084     3  0.3453      0.770 0.000 0.052 0.868 0.080
#> GSM152089     4  0.4083      0.739 0.100 0.068 0.000 0.832
#> GSM152095     4  0.0000      0.864 0.000 0.000 0.000 1.000
#> GSM152096     3  0.3172      0.702 0.000 0.160 0.840 0.000
#> GSM152097     2  0.4543      0.847 0.000 0.676 0.000 0.324
#> GSM152099     2  0.4331      0.873 0.000 0.712 0.000 0.288
#> GSM152106     2  0.4522      0.851 0.000 0.680 0.000 0.320
#> GSM152107     4  0.4546      0.653 0.000 0.012 0.256 0.732
#> GSM152109     3  0.1211      0.803 0.000 0.040 0.960 0.000
#> GSM152111     1  0.0937      0.856 0.976 0.012 0.000 0.012
#> GSM152112     4  0.1398      0.858 0.000 0.004 0.040 0.956
#> GSM152113     3  0.3311      0.774 0.000 0.172 0.828 0.000
#> GSM152115     3  0.4867      0.553 0.000 0.032 0.736 0.232
#> GSM152030     4  0.0895      0.862 0.000 0.004 0.020 0.976
#> GSM152038     3  0.1389      0.811 0.000 0.048 0.952 0.000
#> GSM152042     4  0.2125      0.838 0.000 0.004 0.076 0.920
#> GSM152062     3  0.1635      0.809 0.000 0.044 0.948 0.008
#> GSM152077     1  0.5137      0.782 0.716 0.244 0.040 0.000
#> GSM152088     2  0.5466      0.845 0.000 0.712 0.068 0.220
#> GSM152100     4  0.0000      0.864 0.000 0.000 0.000 1.000
#> GSM152102     2  0.5581      0.784 0.000 0.728 0.132 0.140
#> GSM152104     2  0.4477      0.859 0.000 0.688 0.000 0.312
#> GSM152028     1  0.6052      0.745 0.640 0.284 0.076 0.000
#> GSM152029     3  0.4035      0.739 0.176 0.020 0.804 0.000
#> GSM152049     1  0.4011      0.816 0.784 0.208 0.008 0.000
#> GSM152053     4  0.2197      0.835 0.000 0.004 0.080 0.916
#> GSM152059     1  0.1545      0.849 0.952 0.040 0.008 0.000
#> GSM152085     1  0.0188      0.855 0.996 0.000 0.000 0.004
#> GSM152101     4  0.5699      0.397 0.000 0.032 0.380 0.588
#> GSM152105     3  0.6262      0.622 0.092 0.280 0.628 0.000
#> GSM152034     1  0.0921      0.850 0.972 0.000 0.000 0.028
#> GSM152036     4  0.0000      0.864 0.000 0.000 0.000 1.000
#> GSM152040     1  0.2099      0.845 0.936 0.044 0.012 0.008
#> GSM152043     1  0.4149      0.831 0.804 0.168 0.028 0.000
#> GSM152046     1  0.0707      0.852 0.980 0.000 0.000 0.020
#> GSM152047     1  0.2075      0.845 0.936 0.044 0.004 0.016
#> GSM152048     1  0.4932      0.789 0.728 0.240 0.032 0.000
#> GSM152050     1  0.0937      0.856 0.976 0.012 0.000 0.012
#> GSM152052     3  0.7644      0.292 0.272 0.260 0.468 0.000
#> GSM152056     1  0.4808      0.794 0.736 0.236 0.028 0.000
#> GSM152060     1  0.0817      0.851 0.976 0.000 0.000 0.024
#> GSM152065     3  0.5864      0.668 0.072 0.264 0.664 0.000
#> GSM152066     1  0.4932      0.789 0.728 0.240 0.032 0.000
#> GSM152069     3  0.1022      0.806 0.000 0.032 0.968 0.000
#> GSM152070     1  0.2761      0.826 0.904 0.048 0.048 0.000
#> GSM152071     3  0.1022      0.806 0.000 0.032 0.968 0.000
#> GSM152072     3  0.4153      0.760 0.132 0.048 0.820 0.000
#> GSM152073     1  0.1722      0.849 0.944 0.048 0.008 0.000
#> GSM152078     3  0.3694      0.785 0.032 0.124 0.844 0.000
#> GSM152082     1  0.5394      0.788 0.712 0.228 0.060 0.000
#> GSM152086     1  0.2408      0.849 0.896 0.104 0.000 0.000
#> GSM152090     3  0.1909      0.809 0.008 0.048 0.940 0.004
#> GSM152092     1  0.5864      0.762 0.664 0.264 0.072 0.000
#> GSM152093     1  0.4900      0.791 0.732 0.236 0.032 0.000
#> GSM152094     1  0.0469      0.856 0.988 0.012 0.000 0.000
#> GSM152098     1  0.2761      0.826 0.904 0.048 0.048 0.000
#> GSM152110     1  0.4678      0.798 0.744 0.232 0.024 0.000
#> GSM152031     3  0.7606      0.311 0.248 0.276 0.476 0.000
#> GSM152037     1  0.4964      0.788 0.724 0.244 0.032 0.000
#> GSM152055     1  0.1151      0.853 0.968 0.008 0.000 0.024
#> GSM152061     1  0.0817      0.851 0.976 0.000 0.000 0.024
#> GSM152064     1  0.1004      0.852 0.972 0.004 0.000 0.024
#> GSM152087     1  0.0469      0.856 0.988 0.012 0.000 0.000
#> GSM152103     3  0.2256      0.813 0.020 0.056 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
#> GSM152032     3  0.0613     0.8328 0.008 0.004 0.984 0.004 0.000
#> GSM152033     1  0.4768     0.4763 0.656 0.000 0.304 0.000 0.040
#> GSM152063     2  0.0794     0.9649 0.000 0.972 0.000 0.028 0.000
#> GSM152074     3  0.0613     0.8328 0.008 0.004 0.984 0.004 0.000
#> GSM152080     2  0.0290     0.9539 0.000 0.992 0.008 0.000 0.000
#> GSM152081     4  0.0000     0.9305 0.000 0.000 0.000 1.000 0.000
#> GSM152083     3  0.3990     0.5391 0.000 0.308 0.688 0.004 0.000
#> GSM152091     2  0.0324     0.9564 0.000 0.992 0.004 0.004 0.000
#> GSM152108     2  0.1485     0.9357 0.032 0.948 0.020 0.000 0.000
#> GSM152114     1  0.3675     0.6377 0.772 0.000 0.004 0.216 0.008
#> GSM152035     2  0.0898     0.9629 0.000 0.972 0.008 0.020 0.000
#> GSM152039     4  0.0162     0.9309 0.000 0.004 0.000 0.996 0.000
#> GSM152041     4  0.1653     0.8948 0.028 0.004 0.000 0.944 0.024
#> GSM152044     2  0.0880     0.9634 0.000 0.968 0.000 0.032 0.000
#> GSM152045     5  0.2053     0.7845 0.024 0.012 0.028 0.004 0.932
#> GSM152051     2  0.0794     0.9649 0.000 0.972 0.000 0.028 0.000
#> GSM152054     2  0.4187     0.7240 0.008 0.764 0.032 0.000 0.196
#> GSM152057     2  0.0794     0.9649 0.000 0.972 0.000 0.028 0.000
#> GSM152058     1  0.1043     0.7697 0.960 0.000 0.000 0.000 0.040
#> GSM152067     3  0.0932     0.8325 0.004 0.020 0.972 0.000 0.004
#> GSM152068     2  0.0794     0.9649 0.000 0.972 0.000 0.028 0.000
#> GSM152075     4  0.0000     0.9305 0.000 0.000 0.000 1.000 0.000
#> GSM152076     4  0.0162     0.9309 0.000 0.004 0.000 0.996 0.000
#> GSM152079     2  0.0794     0.9649 0.000 0.972 0.000 0.028 0.000
#> GSM152084     3  0.0798     0.8317 0.016 0.000 0.976 0.008 0.000
#> GSM152089     4  0.5083     0.6823 0.000 0.148 0.004 0.712 0.136
#> GSM152095     4  0.0162     0.9309 0.000 0.004 0.000 0.996 0.000
#> GSM152096     3  0.2865     0.7742 0.008 0.132 0.856 0.004 0.000
#> GSM152097     2  0.2179     0.8957 0.000 0.888 0.000 0.112 0.000
#> GSM152099     2  0.0794     0.9649 0.000 0.972 0.000 0.028 0.000
#> GSM152106     2  0.1608     0.9352 0.000 0.928 0.000 0.072 0.000
#> GSM152107     4  0.4182     0.2981 0.000 0.000 0.400 0.600 0.000
#> GSM152109     3  0.0671     0.8331 0.004 0.016 0.980 0.000 0.000
#> GSM152111     5  0.3835     0.7384 0.260 0.000 0.000 0.008 0.732
#> GSM152112     4  0.0880     0.9163 0.000 0.000 0.032 0.968 0.000
#> GSM152113     3  0.4789     0.2802 0.392 0.000 0.584 0.000 0.024
#> GSM152115     3  0.3168     0.7547 0.016 0.004 0.856 0.116 0.008
#> GSM152030     4  0.0404     0.9273 0.000 0.000 0.012 0.988 0.000
#> GSM152038     3  0.2172     0.7987 0.076 0.000 0.908 0.000 0.016
#> GSM152042     4  0.0703     0.9214 0.000 0.000 0.024 0.976 0.000
#> GSM152062     3  0.0671     0.8315 0.016 0.000 0.980 0.004 0.000
#> GSM152077     1  0.0510     0.7728 0.984 0.000 0.016 0.000 0.000
#> GSM152088     2  0.0451     0.9559 0.000 0.988 0.008 0.004 0.000
#> GSM152100     4  0.0162     0.9309 0.000 0.004 0.000 0.996 0.000
#> GSM152102     2  0.0404     0.9539 0.000 0.988 0.012 0.000 0.000
#> GSM152104     2  0.0880     0.9634 0.000 0.968 0.000 0.032 0.000
#> GSM152028     1  0.3093     0.7403 0.824 0.000 0.008 0.000 0.168
#> GSM152029     5  0.5015     0.3960 0.016 0.028 0.304 0.000 0.652
#> GSM152049     1  0.3210     0.6095 0.788 0.000 0.000 0.000 0.212
#> GSM152053     4  0.0703     0.9214 0.000 0.000 0.024 0.976 0.000
#> GSM152059     5  0.1731     0.7889 0.040 0.008 0.012 0.000 0.940
#> GSM152085     5  0.3246     0.8014 0.184 0.000 0.000 0.008 0.808
#> GSM152101     3  0.4596    -0.0588 0.000 0.004 0.500 0.492 0.004
#> GSM152105     1  0.4487     0.7020 0.756 0.000 0.104 0.000 0.140
#> GSM152034     5  0.3459     0.8125 0.116 0.000 0.000 0.052 0.832
#> GSM152036     4  0.0162     0.9309 0.000 0.004 0.000 0.996 0.000
#> GSM152040     5  0.1517     0.7960 0.028 0.012 0.004 0.004 0.952
#> GSM152043     1  0.4434     0.3694 0.536 0.004 0.000 0.000 0.460
#> GSM152046     5  0.3370     0.8120 0.148 0.000 0.000 0.028 0.824
#> GSM152047     5  0.0902     0.8062 0.004 0.008 0.004 0.008 0.976
#> GSM152048     1  0.1121     0.7695 0.956 0.000 0.000 0.000 0.044
#> GSM152050     5  0.3992     0.7270 0.268 0.000 0.000 0.012 0.720
#> GSM152052     1  0.2694     0.7655 0.884 0.000 0.040 0.000 0.076
#> GSM152056     1  0.1478     0.7639 0.936 0.000 0.000 0.000 0.064
#> GSM152060     5  0.3454     0.8095 0.156 0.000 0.000 0.028 0.816
#> GSM152065     1  0.5461     0.6376 0.680 0.008 0.140 0.000 0.172
#> GSM152066     1  0.1410     0.7654 0.940 0.000 0.000 0.000 0.060
#> GSM152069     3  0.0671     0.8331 0.004 0.016 0.980 0.000 0.000
#> GSM152070     5  0.1830     0.7760 0.052 0.012 0.004 0.000 0.932
#> GSM152071     3  0.0671     0.8331 0.004 0.016 0.980 0.000 0.000
#> GSM152072     3  0.5579     0.4307 0.040 0.024 0.588 0.000 0.348
#> GSM152073     5  0.2136     0.7580 0.088 0.008 0.000 0.000 0.904
#> GSM152078     3  0.6624     0.2174 0.304 0.016 0.516 0.000 0.164
#> GSM152082     1  0.4536     0.6000 0.640 0.008 0.008 0.000 0.344
#> GSM152086     1  0.4256    -0.0342 0.564 0.000 0.000 0.000 0.436
#> GSM152090     3  0.1356     0.8306 0.012 0.028 0.956 0.004 0.000
#> GSM152092     1  0.3689     0.6898 0.740 0.004 0.000 0.000 0.256
#> GSM152093     1  0.1671     0.7578 0.924 0.000 0.000 0.000 0.076
#> GSM152094     5  0.1410     0.8199 0.060 0.000 0.000 0.000 0.940
#> GSM152098     5  0.1956     0.7744 0.052 0.012 0.008 0.000 0.928
#> GSM152110     1  0.1908     0.7479 0.908 0.000 0.000 0.000 0.092
#> GSM152031     1  0.4409     0.7106 0.752 0.000 0.072 0.000 0.176
#> GSM152037     1  0.0703     0.7727 0.976 0.000 0.000 0.000 0.024
#> GSM152055     5  0.4223     0.7421 0.248 0.000 0.000 0.028 0.724
#> GSM152061     5  0.3454     0.8095 0.156 0.000 0.000 0.028 0.816
#> GSM152064     5  0.3929     0.7777 0.208 0.000 0.000 0.028 0.764
#> GSM152087     5  0.1792     0.8215 0.084 0.000 0.000 0.000 0.916
#> GSM152103     3  0.2228     0.8153 0.044 0.020 0.920 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.0551     0.7841 0.004 0.000 0.984 0.004 0.008 0.000
#> GSM152033     1  0.5990     0.3203 0.500 0.000 0.224 0.008 0.268 0.000
#> GSM152063     2  0.0000     0.9686 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152074     3  0.1820     0.7826 0.016 0.000 0.928 0.012 0.044 0.000
#> GSM152080     2  0.0291     0.9650 0.000 0.992 0.004 0.000 0.004 0.000
#> GSM152081     4  0.1241     0.8781 0.004 0.004 0.004 0.960 0.020 0.008
#> GSM152083     3  0.4075     0.5377 0.004 0.312 0.668 0.004 0.012 0.000
#> GSM152091     2  0.0146     0.9667 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM152108     2  0.3069     0.8390 0.096 0.852 0.032 0.000 0.020 0.000
#> GSM152114     1  0.5012     0.5477 0.724 0.000 0.040 0.164 0.040 0.032
#> GSM152035     2  0.0260     0.9655 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM152039     4  0.0603     0.8803 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM152041     4  0.4326     0.6613 0.028 0.000 0.000 0.724 0.032 0.216
#> GSM152044     2  0.0000     0.9686 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152045     5  0.4311     0.2469 0.008 0.000 0.004 0.004 0.556 0.428
#> GSM152051     2  0.0000     0.9686 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.6182     0.0852 0.012 0.404 0.012 0.016 0.468 0.088
#> GSM152057     2  0.0000     0.9686 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     1  0.1501     0.6715 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM152067     3  0.3030     0.7709 0.008 0.000 0.816 0.000 0.168 0.008
#> GSM152068     2  0.0000     0.9686 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     4  0.0870     0.8803 0.000 0.004 0.000 0.972 0.012 0.012
#> GSM152076     4  0.0603     0.8803 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM152079     2  0.0000     0.9686 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152084     3  0.1913     0.7793 0.016 0.000 0.924 0.016 0.044 0.000
#> GSM152089     4  0.6534     0.3416 0.000 0.092 0.000 0.484 0.104 0.320
#> GSM152095     4  0.0603     0.8803 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM152096     3  0.3527     0.7255 0.008 0.132 0.808 0.000 0.052 0.000
#> GSM152097     2  0.2260     0.8390 0.000 0.860 0.000 0.140 0.000 0.000
#> GSM152099     2  0.0000     0.9686 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152106     2  0.1610     0.9001 0.000 0.916 0.000 0.084 0.000 0.000
#> GSM152107     4  0.5157    -0.0241 0.004 0.000 0.440 0.484 0.072 0.000
#> GSM152109     3  0.2320     0.7781 0.004 0.000 0.864 0.000 0.132 0.000
#> GSM152111     6  0.2882     0.6813 0.180 0.000 0.000 0.000 0.008 0.812
#> GSM152112     4  0.1851     0.8527 0.004 0.000 0.012 0.924 0.056 0.004
#> GSM152113     3  0.5927     0.2441 0.284 0.000 0.508 0.008 0.200 0.000
#> GSM152115     3  0.4516     0.6931 0.016 0.000 0.748 0.084 0.144 0.008
#> GSM152030     4  0.1147     0.8745 0.004 0.004 0.004 0.960 0.028 0.000
#> GSM152038     3  0.4700     0.5959 0.112 0.000 0.700 0.008 0.180 0.000
#> GSM152042     4  0.1067     0.8755 0.004 0.004 0.004 0.964 0.024 0.000
#> GSM152062     3  0.1332     0.7835 0.012 0.000 0.952 0.008 0.028 0.000
#> GSM152077     1  0.2201     0.6406 0.904 0.000 0.036 0.000 0.056 0.004
#> GSM152088     2  0.0146     0.9667 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM152100     4  0.0748     0.8797 0.000 0.004 0.000 0.976 0.004 0.016
#> GSM152102     2  0.1296     0.9377 0.000 0.952 0.000 0.004 0.032 0.012
#> GSM152104     2  0.0000     0.9686 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152028     1  0.3778     0.5020 0.696 0.000 0.016 0.000 0.288 0.000
#> GSM152029     5  0.5089     0.4662 0.004 0.000 0.176 0.000 0.648 0.172
#> GSM152049     1  0.3647     0.3811 0.640 0.000 0.000 0.000 0.000 0.360
#> GSM152053     4  0.1147     0.8745 0.004 0.004 0.004 0.960 0.028 0.000
#> GSM152059     5  0.4524     0.2736 0.024 0.000 0.004 0.000 0.520 0.452
#> GSM152085     6  0.2309     0.7369 0.084 0.000 0.000 0.000 0.028 0.888
#> GSM152101     3  0.5778     0.2097 0.004 0.000 0.496 0.368 0.124 0.008
#> GSM152105     1  0.4352     0.4941 0.668 0.000 0.052 0.000 0.280 0.000
#> GSM152034     6  0.1296     0.7290 0.004 0.000 0.000 0.012 0.032 0.952
#> GSM152036     4  0.0547     0.8794 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM152040     6  0.4089    -0.1749 0.008 0.000 0.000 0.000 0.468 0.524
#> GSM152043     5  0.5705     0.1710 0.380 0.000 0.000 0.000 0.456 0.164
#> GSM152046     6  0.0993     0.7371 0.012 0.000 0.000 0.000 0.024 0.964
#> GSM152047     6  0.3684     0.1773 0.000 0.000 0.000 0.000 0.372 0.628
#> GSM152048     1  0.1700     0.6717 0.916 0.000 0.000 0.000 0.004 0.080
#> GSM152050     6  0.3190     0.6460 0.220 0.000 0.000 0.000 0.008 0.772
#> GSM152052     1  0.3758     0.5579 0.740 0.000 0.024 0.000 0.232 0.004
#> GSM152056     1  0.2491     0.6435 0.836 0.000 0.000 0.000 0.000 0.164
#> GSM152060     6  0.1088     0.7442 0.024 0.000 0.000 0.000 0.016 0.960
#> GSM152065     1  0.4979     0.2376 0.492 0.000 0.056 0.004 0.448 0.000
#> GSM152066     1  0.1910     0.6650 0.892 0.000 0.000 0.000 0.000 0.108
#> GSM152069     3  0.2362     0.7770 0.004 0.000 0.860 0.000 0.136 0.000
#> GSM152070     5  0.4482     0.4718 0.048 0.000 0.000 0.000 0.628 0.324
#> GSM152071     3  0.2362     0.7770 0.004 0.000 0.860 0.000 0.136 0.000
#> GSM152072     5  0.3661     0.5209 0.016 0.000 0.108 0.004 0.816 0.056
#> GSM152073     5  0.5224     0.2549 0.092 0.000 0.000 0.000 0.468 0.440
#> GSM152078     5  0.5096     0.3193 0.152 0.000 0.184 0.000 0.656 0.008
#> GSM152082     5  0.4908     0.1776 0.348 0.000 0.004 0.000 0.584 0.064
#> GSM152086     1  0.4569     0.1942 0.564 0.000 0.000 0.000 0.040 0.396
#> GSM152090     3  0.3053     0.7658 0.024 0.000 0.828 0.004 0.144 0.000
#> GSM152092     1  0.4594     0.2639 0.544 0.000 0.008 0.000 0.424 0.024
#> GSM152093     1  0.3411     0.6379 0.804 0.000 0.012 0.000 0.024 0.160
#> GSM152094     6  0.3314     0.5289 0.012 0.000 0.000 0.000 0.224 0.764
#> GSM152098     5  0.4406     0.4623 0.040 0.000 0.000 0.000 0.624 0.336
#> GSM152110     1  0.2793     0.6212 0.800 0.000 0.000 0.000 0.000 0.200
#> GSM152031     1  0.4676     0.2927 0.528 0.000 0.028 0.000 0.436 0.008
#> GSM152037     1  0.1219     0.6693 0.948 0.000 0.000 0.000 0.004 0.048
#> GSM152055     6  0.2772     0.6744 0.180 0.000 0.000 0.000 0.004 0.816
#> GSM152061     6  0.1088     0.7442 0.024 0.000 0.000 0.000 0.016 0.960
#> GSM152064     6  0.2501     0.7140 0.108 0.000 0.000 0.004 0.016 0.872
#> GSM152087     6  0.3176     0.6250 0.032 0.000 0.000 0.000 0.156 0.812
#> GSM152103     3  0.3521     0.7498 0.044 0.000 0.796 0.000 0.156 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-skmeans-collect-classes

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

test_to_known_factors(res)
#>              n specimen(p) k
#> MAD:skmeans 86    9.27e-09 2
#> MAD:skmeans 83    3.28e-07 3
#> MAD:skmeans 84    6.30e-05 4
#> MAD:skmeans 79    2.88e-04 5
#> MAD:skmeans 65    1.49e-02 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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.837           0.907       0.958         0.4800 0.520   0.520
#> 3 3 0.613           0.793       0.895         0.3542 0.809   0.638
#> 4 4 0.714           0.745       0.890         0.1276 0.851   0.609
#> 5 5 0.655           0.499       0.760         0.0779 0.926   0.737
#> 6 6 0.705           0.467       0.706         0.0340 0.900   0.610

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
#> GSM152032     2  0.0672      0.957 0.008 0.992
#> GSM152033     1  0.0000      0.949 1.000 0.000
#> GSM152063     2  0.0000      0.959 0.000 1.000
#> GSM152074     2  0.0000      0.959 0.000 1.000
#> GSM152080     2  0.1184      0.953 0.016 0.984
#> GSM152081     2  0.0000      0.959 0.000 1.000
#> GSM152083     2  0.0000      0.959 0.000 1.000
#> GSM152091     2  0.0000      0.959 0.000 1.000
#> GSM152108     2  0.5946      0.823 0.144 0.856
#> GSM152114     1  0.0000      0.949 1.000 0.000
#> GSM152035     2  0.0000      0.959 0.000 1.000
#> GSM152039     2  0.0000      0.959 0.000 1.000
#> GSM152041     2  0.9323      0.465 0.348 0.652
#> GSM152044     2  0.0000      0.959 0.000 1.000
#> GSM152045     1  0.6801      0.779 0.820 0.180
#> GSM152051     2  0.0000      0.959 0.000 1.000
#> GSM152054     1  0.6801      0.783 0.820 0.180
#> GSM152057     2  0.0000      0.959 0.000 1.000
#> GSM152058     1  0.0000      0.949 1.000 0.000
#> GSM152067     2  0.0000      0.959 0.000 1.000
#> GSM152068     2  0.0000      0.959 0.000 1.000
#> GSM152075     2  0.0672      0.957 0.008 0.992
#> GSM152076     2  0.0000      0.959 0.000 1.000
#> GSM152079     2  0.0000      0.959 0.000 1.000
#> GSM152084     2  0.0672      0.957 0.008 0.992
#> GSM152089     2  0.0000      0.959 0.000 1.000
#> GSM152095     2  0.0000      0.959 0.000 1.000
#> GSM152096     2  0.0672      0.957 0.008 0.992
#> GSM152097     2  0.0000      0.959 0.000 1.000
#> GSM152099     2  0.0000      0.959 0.000 1.000
#> GSM152106     2  0.0000      0.959 0.000 1.000
#> GSM152107     2  0.0000      0.959 0.000 1.000
#> GSM152109     2  0.0672      0.957 0.008 0.992
#> GSM152111     2  0.2778      0.934 0.048 0.952
#> GSM152112     2  0.0000      0.959 0.000 1.000
#> GSM152113     2  0.5629      0.853 0.132 0.868
#> GSM152115     2  0.4161      0.893 0.084 0.916
#> GSM152030     2  0.0000      0.959 0.000 1.000
#> GSM152038     2  0.8813      0.568 0.300 0.700
#> GSM152042     2  0.0000      0.959 0.000 1.000
#> GSM152062     2  0.0672      0.957 0.008 0.992
#> GSM152077     1  0.0000      0.949 1.000 0.000
#> GSM152088     2  0.0000      0.959 0.000 1.000
#> GSM152100     2  0.0000      0.959 0.000 1.000
#> GSM152102     2  0.0000      0.959 0.000 1.000
#> GSM152104     2  0.0000      0.959 0.000 1.000
#> GSM152028     1  0.0000      0.949 1.000 0.000
#> GSM152029     2  0.2236      0.943 0.036 0.964
#> GSM152049     1  0.0000      0.949 1.000 0.000
#> GSM152053     2  0.0672      0.957 0.008 0.992
#> GSM152059     1  0.9686      0.342 0.604 0.396
#> GSM152085     1  0.0000      0.949 1.000 0.000
#> GSM152101     2  0.0000      0.959 0.000 1.000
#> GSM152105     1  0.0000      0.949 1.000 0.000
#> GSM152034     2  0.2236      0.943 0.036 0.964
#> GSM152036     2  0.0000      0.959 0.000 1.000
#> GSM152040     1  0.0000      0.949 1.000 0.000
#> GSM152043     1  0.0000      0.949 1.000 0.000
#> GSM152046     1  0.7883      0.689 0.764 0.236
#> GSM152047     2  0.2236      0.943 0.036 0.964
#> GSM152048     1  0.0000      0.949 1.000 0.000
#> GSM152050     1  0.7745      0.701 0.772 0.228
#> GSM152052     2  0.9608      0.379 0.384 0.616
#> GSM152056     1  0.0000      0.949 1.000 0.000
#> GSM152060     1  0.0000      0.949 1.000 0.000
#> GSM152065     1  0.0000      0.949 1.000 0.000
#> GSM152066     1  0.0000      0.949 1.000 0.000
#> GSM152069     2  0.1184      0.954 0.016 0.984
#> GSM152070     1  0.0000      0.949 1.000 0.000
#> GSM152071     2  0.1633      0.950 0.024 0.976
#> GSM152072     2  0.2236      0.943 0.036 0.964
#> GSM152073     1  0.0000      0.949 1.000 0.000
#> GSM152078     2  0.2236      0.943 0.036 0.964
#> GSM152082     1  0.0000      0.949 1.000 0.000
#> GSM152086     1  0.0000      0.949 1.000 0.000
#> GSM152090     2  0.2236      0.943 0.036 0.964
#> GSM152092     1  0.0000      0.949 1.000 0.000
#> GSM152093     2  0.8443      0.636 0.272 0.728
#> GSM152094     1  0.0000      0.949 1.000 0.000
#> GSM152098     1  0.2423      0.918 0.960 0.040
#> GSM152110     1  0.0000      0.949 1.000 0.000
#> GSM152031     1  0.9044      0.517 0.680 0.320
#> GSM152037     1  0.0000      0.949 1.000 0.000
#> GSM152055     1  0.0000      0.949 1.000 0.000
#> GSM152061     1  0.0000      0.949 1.000 0.000
#> GSM152064     1  0.0000      0.949 1.000 0.000
#> GSM152087     1  0.0000      0.949 1.000 0.000
#> GSM152103     2  0.2236      0.943 0.036 0.964

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0000      0.832 0.000 0.000 1.000
#> GSM152033     1  0.4062      0.792 0.836 0.000 0.164
#> GSM152063     2  0.0000      0.908 0.000 1.000 0.000
#> GSM152074     3  0.0000      0.832 0.000 0.000 1.000
#> GSM152080     2  0.1643      0.910 0.000 0.956 0.044
#> GSM152081     3  0.3038      0.786 0.000 0.104 0.896
#> GSM152083     2  0.5678      0.598 0.000 0.684 0.316
#> GSM152091     2  0.1289      0.916 0.000 0.968 0.032
#> GSM152108     3  0.6001      0.773 0.176 0.052 0.772
#> GSM152114     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152035     2  0.0000      0.908 0.000 1.000 0.000
#> GSM152039     2  0.2261      0.871 0.000 0.932 0.068
#> GSM152041     3  0.6057      0.627 0.340 0.004 0.656
#> GSM152044     2  0.1031      0.916 0.000 0.976 0.024
#> GSM152045     1  0.6931      0.504 0.640 0.032 0.328
#> GSM152051     2  0.1031      0.916 0.000 0.976 0.024
#> GSM152054     1  0.9756      0.139 0.428 0.332 0.240
#> GSM152057     2  0.1289      0.916 0.000 0.968 0.032
#> GSM152058     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152067     3  0.0000      0.832 0.000 0.000 1.000
#> GSM152068     2  0.1289      0.916 0.000 0.968 0.032
#> GSM152075     3  0.5298      0.782 0.164 0.032 0.804
#> GSM152076     2  0.5621      0.551 0.000 0.692 0.308
#> GSM152079     2  0.1289      0.916 0.000 0.968 0.032
#> GSM152084     3  0.0000      0.832 0.000 0.000 1.000
#> GSM152089     3  0.5298      0.782 0.164 0.032 0.804
#> GSM152095     2  0.6045      0.381 0.000 0.620 0.380
#> GSM152096     3  0.0000      0.832 0.000 0.000 1.000
#> GSM152097     2  0.0000      0.908 0.000 1.000 0.000
#> GSM152099     2  0.0000      0.908 0.000 1.000 0.000
#> GSM152106     2  0.0892      0.915 0.000 0.980 0.020
#> GSM152107     3  0.1289      0.826 0.000 0.032 0.968
#> GSM152109     3  0.0000      0.832 0.000 0.000 1.000
#> GSM152111     3  0.5098      0.742 0.248 0.000 0.752
#> GSM152112     3  0.1289      0.826 0.000 0.032 0.968
#> GSM152113     3  0.2448      0.824 0.076 0.000 0.924
#> GSM152115     3  0.3713      0.795 0.076 0.032 0.892
#> GSM152030     3  0.1411      0.825 0.000 0.036 0.964
#> GSM152038     3  0.5397      0.523 0.280 0.000 0.720
#> GSM152042     3  0.0000      0.832 0.000 0.000 1.000
#> GSM152062     3  0.0000      0.832 0.000 0.000 1.000
#> GSM152077     1  0.1529      0.882 0.960 0.000 0.040
#> GSM152088     2  0.1289      0.916 0.000 0.968 0.032
#> GSM152100     3  0.5731      0.770 0.088 0.108 0.804
#> GSM152102     2  0.3686      0.806 0.000 0.860 0.140
#> GSM152104     2  0.1289      0.916 0.000 0.968 0.032
#> GSM152028     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152029     3  0.2261      0.828 0.068 0.000 0.932
#> GSM152049     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152053     3  0.1289      0.826 0.000 0.032 0.968
#> GSM152059     3  0.6286      0.118 0.464 0.000 0.536
#> GSM152085     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152101     3  0.1289      0.826 0.000 0.032 0.968
#> GSM152105     1  0.4062      0.792 0.836 0.000 0.164
#> GSM152034     3  0.4931      0.756 0.232 0.000 0.768
#> GSM152036     3  0.6228      0.394 0.004 0.372 0.624
#> GSM152040     1  0.4062      0.792 0.836 0.000 0.164
#> GSM152043     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152046     1  0.4931      0.594 0.768 0.000 0.232
#> GSM152047     3  0.4931      0.756 0.232 0.000 0.768
#> GSM152048     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152050     1  0.4842      0.613 0.776 0.000 0.224
#> GSM152052     3  0.6026      0.564 0.376 0.000 0.624
#> GSM152056     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152060     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152065     1  0.4062      0.792 0.836 0.000 0.164
#> GSM152066     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152069     3  0.0237      0.833 0.004 0.000 0.996
#> GSM152070     1  0.3482      0.821 0.872 0.000 0.128
#> GSM152071     3  0.2066      0.830 0.060 0.000 0.940
#> GSM152072     3  0.2261      0.828 0.068 0.000 0.932
#> GSM152073     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152078     3  0.2261      0.828 0.068 0.000 0.932
#> GSM152082     1  0.3941      0.799 0.844 0.000 0.156
#> GSM152086     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152090     3  0.4931      0.756 0.232 0.000 0.768
#> GSM152092     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152093     3  0.6302      0.294 0.480 0.000 0.520
#> GSM152094     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152098     1  0.1643      0.876 0.956 0.000 0.044
#> GSM152110     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152031     1  0.5327      0.665 0.728 0.000 0.272
#> GSM152037     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152055     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152061     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152064     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152087     1  0.0000      0.902 1.000 0.000 0.000
#> GSM152103     3  0.4931      0.756 0.232 0.000 0.768

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.0000      0.772 0.000 0.000 1.000 0.000
#> GSM152033     1  0.4697      0.490 0.644 0.000 0.356 0.000
#> GSM152063     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152074     3  0.0707      0.761 0.000 0.000 0.980 0.020
#> GSM152080     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152081     4  0.4941      0.191 0.000 0.000 0.436 0.564
#> GSM152083     2  0.4697      0.479 0.000 0.644 0.356 0.000
#> GSM152091     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152108     3  0.6731      0.569 0.248 0.148 0.604 0.000
#> GSM152114     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152035     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152039     4  0.0000      0.895 0.000 0.000 0.000 1.000
#> GSM152041     1  0.7706     -0.251 0.412 0.000 0.364 0.224
#> GSM152044     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152045     4  0.5427      0.725 0.100 0.000 0.164 0.736
#> GSM152051     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152054     4  0.3108      0.847 0.016 0.000 0.112 0.872
#> GSM152057     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152058     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152067     3  0.0188      0.770 0.000 0.000 0.996 0.004
#> GSM152068     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152075     4  0.0000      0.895 0.000 0.000 0.000 1.000
#> GSM152076     4  0.0000      0.895 0.000 0.000 0.000 1.000
#> GSM152079     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152084     3  0.4522      0.407 0.000 0.000 0.680 0.320
#> GSM152089     4  0.3523      0.801 0.112 0.000 0.032 0.856
#> GSM152095     4  0.0000      0.895 0.000 0.000 0.000 1.000
#> GSM152096     3  0.1118      0.753 0.000 0.000 0.964 0.036
#> GSM152097     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152099     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152106     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152107     4  0.2530      0.855 0.000 0.000 0.112 0.888
#> GSM152109     3  0.0592      0.766 0.000 0.000 0.984 0.016
#> GSM152111     3  0.4713      0.539 0.360 0.000 0.640 0.000
#> GSM152112     4  0.1118      0.891 0.000 0.000 0.036 0.964
#> GSM152113     3  0.0707      0.764 0.020 0.000 0.980 0.000
#> GSM152115     4  0.2530      0.855 0.000 0.000 0.112 0.888
#> GSM152030     4  0.0000      0.895 0.000 0.000 0.000 1.000
#> GSM152038     3  0.3688      0.572 0.208 0.000 0.792 0.000
#> GSM152042     4  0.3764      0.708 0.000 0.000 0.216 0.784
#> GSM152062     3  0.0000      0.772 0.000 0.000 1.000 0.000
#> GSM152077     1  0.3074      0.730 0.848 0.000 0.152 0.000
#> GSM152088     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152100     4  0.0000      0.895 0.000 0.000 0.000 1.000
#> GSM152102     2  0.6074      0.491 0.000 0.648 0.084 0.268
#> GSM152104     2  0.0000      0.950 0.000 1.000 0.000 0.000
#> GSM152028     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152029     3  0.0000      0.772 0.000 0.000 1.000 0.000
#> GSM152049     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152053     4  0.0817      0.891 0.000 0.000 0.024 0.976
#> GSM152059     3  0.4679      0.293 0.352 0.000 0.648 0.000
#> GSM152085     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152101     4  0.1637      0.883 0.000 0.000 0.060 0.940
#> GSM152105     1  0.4697      0.490 0.644 0.000 0.356 0.000
#> GSM152034     3  0.5331      0.564 0.332 0.000 0.644 0.024
#> GSM152036     4  0.0000      0.895 0.000 0.000 0.000 1.000
#> GSM152040     1  0.4643      0.508 0.656 0.000 0.344 0.000
#> GSM152043     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152046     1  0.3266      0.661 0.832 0.000 0.168 0.000
#> GSM152047     3  0.4697      0.544 0.356 0.000 0.644 0.000
#> GSM152048     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152050     1  0.3172      0.673 0.840 0.000 0.160 0.000
#> GSM152052     3  0.4961      0.368 0.448 0.000 0.552 0.000
#> GSM152056     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152060     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152065     1  0.4697      0.490 0.644 0.000 0.356 0.000
#> GSM152066     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152069     3  0.0000      0.772 0.000 0.000 1.000 0.000
#> GSM152070     1  0.3688      0.672 0.792 0.000 0.208 0.000
#> GSM152071     3  0.0000      0.772 0.000 0.000 1.000 0.000
#> GSM152072     3  0.0000      0.772 0.000 0.000 1.000 0.000
#> GSM152073     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152078     3  0.0000      0.772 0.000 0.000 1.000 0.000
#> GSM152082     1  0.4304      0.586 0.716 0.000 0.284 0.000
#> GSM152086     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152090     3  0.5331      0.564 0.332 0.000 0.644 0.024
#> GSM152092     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152093     1  0.4866      0.071 0.596 0.000 0.404 0.000
#> GSM152094     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152098     1  0.1389      0.814 0.952 0.000 0.048 0.000
#> GSM152110     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152031     1  0.4888      0.391 0.588 0.000 0.412 0.000
#> GSM152037     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152055     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152061     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152064     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152087     1  0.0000      0.844 1.000 0.000 0.000 0.000
#> GSM152103     3  0.4697      0.544 0.356 0.000 0.644 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
#> GSM152032     3  0.3796    0.60954 0.000 0.000 0.700 0.000 0.300
#> GSM152033     1  0.6234    0.20426 0.524 0.000 0.172 0.000 0.304
#> GSM152063     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152074     3  0.4836    0.57505 0.000 0.000 0.652 0.044 0.304
#> GSM152080     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152081     4  0.4655    0.28065 0.000 0.000 0.328 0.644 0.028
#> GSM152083     2  0.6301    0.22629 0.000 0.516 0.184 0.000 0.300
#> GSM152091     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152108     3  0.5789    0.41389 0.260 0.124 0.612 0.000 0.004
#> GSM152114     1  0.1106    0.50648 0.964 0.000 0.012 0.024 0.000
#> GSM152035     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152039     4  0.0794    0.72139 0.000 0.000 0.000 0.972 0.028
#> GSM152041     1  0.8018   -0.12433 0.444 0.000 0.144 0.204 0.208
#> GSM152044     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152045     4  0.7682   -0.01678 0.196 0.000 0.068 0.392 0.344
#> GSM152051     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152054     4  0.4517    0.48905 0.000 0.000 0.008 0.556 0.436
#> GSM152057     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152058     1  0.0794    0.50547 0.972 0.000 0.000 0.000 0.028
#> GSM152067     3  0.3109    0.64524 0.000 0.000 0.800 0.000 0.200
#> GSM152068     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152075     4  0.0963    0.71792 0.000 0.000 0.036 0.964 0.000
#> GSM152076     4  0.0794    0.72139 0.000 0.000 0.000 0.972 0.028
#> GSM152079     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152084     3  0.2890    0.56834 0.004 0.000 0.836 0.160 0.000
#> GSM152089     4  0.6082    0.43603 0.000 0.000 0.312 0.540 0.148
#> GSM152095     4  0.0794    0.72139 0.000 0.000 0.000 0.972 0.028
#> GSM152096     3  0.0162    0.66862 0.000 0.000 0.996 0.004 0.000
#> GSM152097     2  0.0510    0.93121 0.000 0.984 0.000 0.000 0.016
#> GSM152099     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152106     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152107     4  0.5887    0.51213 0.000 0.000 0.156 0.592 0.252
#> GSM152109     3  0.1043    0.65534 0.000 0.000 0.960 0.040 0.000
#> GSM152111     5  0.4996    0.09784 0.032 0.000 0.420 0.000 0.548
#> GSM152112     4  0.3812    0.65112 0.000 0.000 0.024 0.772 0.204
#> GSM152113     3  0.4269    0.60820 0.016 0.000 0.684 0.000 0.300
#> GSM152115     4  0.5819    0.51930 0.000 0.000 0.148 0.600 0.252
#> GSM152030     4  0.0162    0.72290 0.000 0.000 0.000 0.996 0.004
#> GSM152038     3  0.5804    0.52469 0.120 0.000 0.576 0.000 0.304
#> GSM152042     4  0.3932    0.52797 0.000 0.000 0.328 0.672 0.000
#> GSM152062     3  0.4325    0.60771 0.012 0.000 0.684 0.004 0.300
#> GSM152077     1  0.2891    0.40716 0.824 0.000 0.000 0.000 0.176
#> GSM152088     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152100     4  0.0000    0.72286 0.000 0.000 0.000 1.000 0.000
#> GSM152102     2  0.4040    0.60580 0.000 0.724 0.000 0.016 0.260
#> GSM152104     2  0.0000    0.94301 0.000 1.000 0.000 0.000 0.000
#> GSM152028     1  0.0000    0.51231 1.000 0.000 0.000 0.000 0.000
#> GSM152029     3  0.2929    0.56228 0.000 0.000 0.820 0.000 0.180
#> GSM152049     1  0.3109    0.32311 0.800 0.000 0.000 0.000 0.200
#> GSM152053     4  0.3661    0.58423 0.000 0.000 0.276 0.724 0.000
#> GSM152059     5  0.3060    0.30798 0.128 0.000 0.024 0.000 0.848
#> GSM152085     1  0.4088    0.07001 0.632 0.000 0.000 0.000 0.368
#> GSM152101     4  0.5470    0.55666 0.000 0.000 0.112 0.636 0.252
#> GSM152105     1  0.6234    0.20426 0.524 0.000 0.172 0.000 0.304
#> GSM152034     3  0.5412    0.40705 0.004 0.000 0.644 0.088 0.264
#> GSM152036     4  0.0794    0.72139 0.000 0.000 0.000 0.972 0.028
#> GSM152040     5  0.4196    0.00466 0.356 0.000 0.004 0.000 0.640
#> GSM152043     1  0.3353    0.37230 0.796 0.000 0.008 0.000 0.196
#> GSM152046     5  0.3949    0.48833 0.332 0.000 0.000 0.000 0.668
#> GSM152047     3  0.4225    0.29679 0.004 0.000 0.632 0.000 0.364
#> GSM152048     1  0.0794    0.50547 0.972 0.000 0.000 0.000 0.028
#> GSM152050     1  0.5252    0.04500 0.616 0.000 0.068 0.000 0.316
#> GSM152052     1  0.6024   -0.04986 0.532 0.000 0.336 0.000 0.132
#> GSM152056     1  0.0794    0.50547 0.972 0.000 0.000 0.000 0.028
#> GSM152060     5  0.3949    0.48833 0.332 0.000 0.000 0.000 0.668
#> GSM152065     1  0.6326    0.18052 0.492 0.000 0.172 0.000 0.336
#> GSM152066     1  0.0000    0.51231 1.000 0.000 0.000 0.000 0.000
#> GSM152069     3  0.0000    0.66948 0.000 0.000 1.000 0.000 0.000
#> GSM152070     1  0.4549   -0.03185 0.528 0.000 0.008 0.000 0.464
#> GSM152071     3  0.0000    0.66948 0.000 0.000 1.000 0.000 0.000
#> GSM152072     3  0.4114    0.57589 0.000 0.000 0.624 0.000 0.376
#> GSM152073     1  0.3999    0.10845 0.656 0.000 0.000 0.000 0.344
#> GSM152078     3  0.3966    0.60225 0.000 0.000 0.664 0.000 0.336
#> GSM152082     1  0.4321    0.20062 0.600 0.000 0.004 0.000 0.396
#> GSM152086     1  0.2516    0.43324 0.860 0.000 0.000 0.000 0.140
#> GSM152090     3  0.2488    0.59809 0.004 0.000 0.872 0.124 0.000
#> GSM152092     1  0.3143    0.36536 0.796 0.000 0.000 0.000 0.204
#> GSM152093     3  0.4227    0.26827 0.420 0.000 0.580 0.000 0.000
#> GSM152094     1  0.4015    0.09985 0.652 0.000 0.000 0.000 0.348
#> GSM152098     1  0.4800    0.03039 0.604 0.000 0.028 0.000 0.368
#> GSM152110     1  0.0000    0.51231 1.000 0.000 0.000 0.000 0.000
#> GSM152031     1  0.6234    0.20426 0.524 0.000 0.172 0.000 0.304
#> GSM152037     1  0.0162    0.51211 0.996 0.000 0.000 0.000 0.004
#> GSM152055     1  0.3857    0.17040 0.688 0.000 0.000 0.000 0.312
#> GSM152061     5  0.3949    0.48833 0.332 0.000 0.000 0.000 0.668
#> GSM152064     1  0.4294   -0.20200 0.532 0.000 0.000 0.000 0.468
#> GSM152087     5  0.4304    0.23881 0.484 0.000 0.000 0.000 0.516
#> GSM152103     3  0.3086    0.55835 0.004 0.000 0.816 0.000 0.180

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.0363   4.78e-01 0.000 0.000 0.988 0.012 0.000 0.000
#> GSM152033     3  0.3998  -8.23e-02 0.492 0.000 0.504 0.000 0.000 0.004
#> GSM152063     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152074     3  0.2393   4.33e-01 0.000 0.000 0.892 0.064 0.040 0.004
#> GSM152080     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152081     4  0.2660   8.85e-01 0.000 0.000 0.048 0.868 0.084 0.000
#> GSM152083     3  0.3995  -1.67e-01 0.000 0.480 0.516 0.004 0.000 0.000
#> GSM152091     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152108     3  0.8316   2.71e-01 0.228 0.124 0.388 0.000 0.108 0.152
#> GSM152114     1  0.0363   5.72e-01 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM152035     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152039     4  0.1501   9.72e-01 0.000 0.000 0.000 0.924 0.076 0.000
#> GSM152041     1  0.8260  -9.29e-02 0.324 0.000 0.052 0.256 0.140 0.228
#> GSM152044     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152045     5  0.5664   2.72e-01 0.060 0.000 0.048 0.000 0.540 0.352
#> GSM152051     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.4311   5.22e-01 0.000 0.008 0.040 0.000 0.692 0.260
#> GSM152057     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     1  0.0713   5.69e-01 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM152067     3  0.2313   4.82e-01 0.000 0.000 0.884 0.012 0.004 0.100
#> GSM152068     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     5  0.2996   5.27e-01 0.000 0.000 0.000 0.228 0.772 0.000
#> GSM152076     4  0.1501   9.72e-01 0.000 0.000 0.000 0.924 0.076 0.000
#> GSM152079     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152084     3  0.6014   4.38e-01 0.004 0.000 0.468 0.000 0.292 0.236
#> GSM152089     5  0.1760   5.57e-01 0.000 0.000 0.048 0.020 0.928 0.004
#> GSM152095     4  0.1501   9.72e-01 0.000 0.000 0.000 0.924 0.076 0.000
#> GSM152096     3  0.5753   4.52e-01 0.000 0.000 0.512 0.000 0.252 0.236
#> GSM152097     2  0.1910   8.54e-01 0.000 0.892 0.000 0.108 0.000 0.000
#> GSM152099     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152106     2  0.0547   9.44e-01 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM152107     5  0.3812   6.22e-01 0.000 0.000 0.264 0.024 0.712 0.000
#> GSM152109     3  0.6071   4.53e-01 0.000 0.000 0.500 0.012 0.252 0.236
#> GSM152111     6  0.2573   4.04e-01 0.024 0.000 0.112 0.000 0.000 0.864
#> GSM152112     5  0.3265   6.33e-01 0.000 0.000 0.248 0.004 0.748 0.000
#> GSM152113     3  0.0777   4.80e-01 0.024 0.000 0.972 0.000 0.004 0.000
#> GSM152115     5  0.3244   6.25e-01 0.000 0.000 0.268 0.000 0.732 0.000
#> GSM152030     5  0.3727   2.78e-01 0.000 0.000 0.000 0.388 0.612 0.000
#> GSM152038     3  0.3426   4.12e-01 0.116 0.000 0.816 0.064 0.000 0.004
#> GSM152042     5  0.3715   3.66e-01 0.000 0.000 0.048 0.000 0.764 0.188
#> GSM152062     3  0.1059   4.75e-01 0.016 0.000 0.964 0.000 0.016 0.004
#> GSM152077     1  0.2300   4.65e-01 0.856 0.000 0.144 0.000 0.000 0.000
#> GSM152088     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152100     5  0.3351   4.85e-01 0.000 0.000 0.000 0.288 0.712 0.000
#> GSM152102     2  0.5061   4.49e-01 0.000 0.620 0.000 0.000 0.128 0.252
#> GSM152104     2  0.0000   9.60e-01 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152028     1  0.0000   5.73e-01 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152029     3  0.6101   4.29e-01 0.000 0.000 0.472 0.008 0.252 0.268
#> GSM152049     1  0.2912   3.98e-01 0.784 0.000 0.000 0.000 0.000 0.216
#> GSM152053     5  0.0547   5.72e-01 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM152059     6  0.5572   3.38e-01 0.072 0.000 0.236 0.064 0.000 0.628
#> GSM152085     1  0.3843   8.01e-02 0.548 0.000 0.000 0.000 0.000 0.452
#> GSM152101     5  0.3151   6.32e-01 0.000 0.000 0.252 0.000 0.748 0.000
#> GSM152105     3  0.3998  -8.23e-02 0.492 0.000 0.504 0.000 0.000 0.004
#> GSM152034     6  0.6051  -2.85e-01 0.004 0.000 0.284 0.000 0.252 0.460
#> GSM152036     4  0.1501   9.72e-01 0.000 0.000 0.000 0.924 0.076 0.000
#> GSM152040     6  0.5937  -3.99e-02 0.352 0.000 0.220 0.000 0.000 0.428
#> GSM152043     1  0.3834   4.11e-01 0.728 0.000 0.004 0.000 0.024 0.244
#> GSM152046     6  0.3076   4.12e-01 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM152047     6  0.3499   8.72e-02 0.000 0.000 0.320 0.000 0.000 0.680
#> GSM152048     1  0.0713   5.69e-01 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM152050     1  0.6654  -5.18e-02 0.416 0.000 0.036 0.000 0.252 0.296
#> GSM152052     1  0.6367   4.02e-02 0.520 0.000 0.284 0.064 0.000 0.132
#> GSM152056     1  0.0713   5.69e-01 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM152060     6  0.3076   4.12e-01 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM152065     3  0.3998  -8.23e-02 0.492 0.000 0.504 0.000 0.000 0.004
#> GSM152066     1  0.0000   5.73e-01 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152069     3  0.6071   4.53e-01 0.000 0.000 0.500 0.012 0.252 0.236
#> GSM152070     1  0.5282   5.19e-02 0.484 0.000 0.100 0.000 0.000 0.416
#> GSM152071     3  0.6071   4.53e-01 0.000 0.000 0.500 0.012 0.252 0.236
#> GSM152072     3  0.3440   4.03e-01 0.000 0.000 0.776 0.028 0.000 0.196
#> GSM152073     1  0.3789   1.64e-01 0.584 0.000 0.000 0.000 0.000 0.416
#> GSM152078     3  0.2106   4.58e-01 0.000 0.000 0.904 0.064 0.000 0.032
#> GSM152082     1  0.5190   2.82e-01 0.596 0.000 0.132 0.000 0.000 0.272
#> GSM152086     1  0.2664   4.80e-01 0.816 0.000 0.000 0.000 0.000 0.184
#> GSM152090     3  0.5812   4.45e-01 0.000 0.000 0.496 0.000 0.268 0.236
#> GSM152092     1  0.3266   3.93e-01 0.728 0.000 0.000 0.000 0.000 0.272
#> GSM152093     1  0.7733  -3.51e-01 0.264 0.000 0.248 0.000 0.252 0.236
#> GSM152094     1  0.3797   1.57e-01 0.580 0.000 0.000 0.000 0.000 0.420
#> GSM152098     1  0.4509   9.54e-02 0.532 0.000 0.032 0.000 0.000 0.436
#> GSM152110     1  0.0000   5.73e-01 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM152031     3  0.5060  -3.75e-06 0.428 0.000 0.504 0.064 0.000 0.004
#> GSM152037     1  0.0146   5.73e-01 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM152055     1  0.3499   2.82e-01 0.680 0.000 0.000 0.000 0.000 0.320
#> GSM152061     6  0.3076   4.12e-01 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM152064     6  0.3823   9.44e-02 0.436 0.000 0.000 0.000 0.000 0.564
#> GSM152087     6  0.3747   2.13e-01 0.396 0.000 0.000 0.000 0.000 0.604
#> GSM152103     3  0.5874   4.30e-01 0.000 0.000 0.480 0.000 0.252 0.268

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 specimen(p) k
#> MAD:pam 85    4.08e-05 2
#> MAD:pam 83    4.06e-05 3
#> MAD:pam 76    4.47e-05 4
#> MAD:pam 52    9.84e-02 5
#> MAD:pam 35    3.46e-02 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 10612 rows and 88 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 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-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.730           0.938       0.954         0.4854 0.504   0.504
#> 3 3 0.689           0.761       0.893         0.3060 0.828   0.666
#> 4 4 0.593           0.588       0.721         0.0824 0.882   0.695
#> 5 5 0.610           0.614       0.768         0.1263 0.757   0.371
#> 6 6 0.599           0.492       0.655         0.0442 0.904   0.623

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
#> GSM152032     2  0.4939      0.925 0.108 0.892
#> GSM152033     2  0.7453      0.834 0.212 0.788
#> GSM152063     2  0.0000      0.926 0.000 1.000
#> GSM152074     2  0.4690      0.928 0.100 0.900
#> GSM152080     2  0.2778      0.935 0.048 0.952
#> GSM152081     2  0.2948      0.936 0.052 0.948
#> GSM152083     2  0.2948      0.936 0.052 0.948
#> GSM152091     2  0.0000      0.926 0.000 1.000
#> GSM152108     2  0.4815      0.926 0.104 0.896
#> GSM152114     2  0.5842      0.906 0.140 0.860
#> GSM152035     2  0.1633      0.932 0.024 0.976
#> GSM152039     2  0.0000      0.926 0.000 1.000
#> GSM152041     2  0.4298      0.931 0.088 0.912
#> GSM152044     2  0.0000      0.926 0.000 1.000
#> GSM152045     1  0.0000      0.988 1.000 0.000
#> GSM152051     2  0.0000      0.926 0.000 1.000
#> GSM152054     2  0.7674      0.817 0.224 0.776
#> GSM152057     2  0.0000      0.926 0.000 1.000
#> GSM152058     1  0.0000      0.988 1.000 0.000
#> GSM152067     2  0.4690      0.928 0.100 0.900
#> GSM152068     2  0.0000      0.926 0.000 1.000
#> GSM152075     2  0.3114      0.936 0.056 0.944
#> GSM152076     2  0.0000      0.926 0.000 1.000
#> GSM152079     2  0.0000      0.926 0.000 1.000
#> GSM152084     2  0.5294      0.918 0.120 0.880
#> GSM152089     2  0.7056      0.854 0.192 0.808
#> GSM152095     2  0.0000      0.926 0.000 1.000
#> GSM152096     2  0.4939      0.925 0.108 0.892
#> GSM152097     2  0.0000      0.926 0.000 1.000
#> GSM152099     2  0.0000      0.926 0.000 1.000
#> GSM152106     2  0.0000      0.926 0.000 1.000
#> GSM152107     2  0.3733      0.934 0.072 0.928
#> GSM152109     2  0.4939      0.925 0.108 0.892
#> GSM152111     1  0.0000      0.988 1.000 0.000
#> GSM152112     2  0.2948      0.936 0.052 0.948
#> GSM152113     2  0.6438      0.886 0.164 0.836
#> GSM152115     2  0.4690      0.928 0.100 0.900
#> GSM152030     2  0.0000      0.926 0.000 1.000
#> GSM152038     2  0.6531      0.882 0.168 0.832
#> GSM152042     2  0.3114      0.936 0.056 0.944
#> GSM152062     2  0.5408      0.916 0.124 0.876
#> GSM152077     2  0.8207      0.772 0.256 0.744
#> GSM152088     2  0.0000      0.926 0.000 1.000
#> GSM152100     2  0.0938      0.929 0.012 0.988
#> GSM152102     2  0.4431      0.930 0.092 0.908
#> GSM152104     2  0.0000      0.926 0.000 1.000
#> GSM152028     1  0.0000      0.988 1.000 0.000
#> GSM152029     1  0.0672      0.980 0.992 0.008
#> GSM152049     1  0.0000      0.988 1.000 0.000
#> GSM152053     2  0.3274      0.935 0.060 0.940
#> GSM152059     1  0.0000      0.988 1.000 0.000
#> GSM152085     1  0.0000      0.988 1.000 0.000
#> GSM152101     2  0.3584      0.935 0.068 0.932
#> GSM152105     1  0.0000      0.988 1.000 0.000
#> GSM152034     1  0.0000      0.988 1.000 0.000
#> GSM152036     2  0.0000      0.926 0.000 1.000
#> GSM152040     1  0.0000      0.988 1.000 0.000
#> GSM152043     1  0.0000      0.988 1.000 0.000
#> GSM152046     1  0.0000      0.988 1.000 0.000
#> GSM152047     1  0.0000      0.988 1.000 0.000
#> GSM152048     1  0.0000      0.988 1.000 0.000
#> GSM152050     1  0.0000      0.988 1.000 0.000
#> GSM152052     1  0.0000      0.988 1.000 0.000
#> GSM152056     1  0.0000      0.988 1.000 0.000
#> GSM152060     1  0.0000      0.988 1.000 0.000
#> GSM152065     1  0.0000      0.988 1.000 0.000
#> GSM152066     1  0.0000      0.988 1.000 0.000
#> GSM152069     2  0.5737      0.909 0.136 0.864
#> GSM152070     1  0.0000      0.988 1.000 0.000
#> GSM152071     2  0.5842      0.906 0.140 0.860
#> GSM152072     1  0.0376      0.984 0.996 0.004
#> GSM152073     1  0.0000      0.988 1.000 0.000
#> GSM152078     1  0.0000      0.988 1.000 0.000
#> GSM152082     1  0.0000      0.988 1.000 0.000
#> GSM152086     1  0.0000      0.988 1.000 0.000
#> GSM152090     2  0.6048      0.900 0.148 0.852
#> GSM152092     1  0.0000      0.988 1.000 0.000
#> GSM152093     1  0.9580      0.263 0.620 0.380
#> GSM152094     1  0.0000      0.988 1.000 0.000
#> GSM152098     1  0.0000      0.988 1.000 0.000
#> GSM152110     1  0.0000      0.988 1.000 0.000
#> GSM152031     1  0.0000      0.988 1.000 0.000
#> GSM152037     1  0.0000      0.988 1.000 0.000
#> GSM152055     1  0.0000      0.988 1.000 0.000
#> GSM152061     1  0.0000      0.988 1.000 0.000
#> GSM152064     1  0.0000      0.988 1.000 0.000
#> GSM152087     1  0.0000      0.988 1.000 0.000
#> GSM152103     2  0.7299      0.844 0.204 0.796

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.1163     0.6792 0.000 0.028 0.972
#> GSM152033     3  0.6140     0.3311 0.404 0.000 0.596
#> GSM152063     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152074     3  0.2959     0.6371 0.000 0.100 0.900
#> GSM152080     2  0.5497     0.5778 0.000 0.708 0.292
#> GSM152081     3  0.5497     0.5663 0.000 0.292 0.708
#> GSM152083     2  0.5621     0.5635 0.000 0.692 0.308
#> GSM152091     2  0.5058     0.6289 0.000 0.756 0.244
#> GSM152108     3  0.2959     0.6994 0.100 0.000 0.900
#> GSM152114     3  0.5291     0.6258 0.268 0.000 0.732
#> GSM152035     2  0.5178     0.6034 0.000 0.744 0.256
#> GSM152039     2  0.6307    -0.0934 0.000 0.512 0.488
#> GSM152041     3  0.7265     0.6423 0.160 0.128 0.712
#> GSM152044     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152045     1  0.0237     0.9915 0.996 0.000 0.004
#> GSM152051     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152054     3  0.5621     0.5908 0.308 0.000 0.692
#> GSM152057     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152058     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152067     3  0.5098     0.3824 0.000 0.248 0.752
#> GSM152068     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152075     3  0.5497     0.5663 0.000 0.292 0.708
#> GSM152076     2  0.6305    -0.0812 0.000 0.516 0.484
#> GSM152079     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152084     3  0.3686     0.6917 0.140 0.000 0.860
#> GSM152089     3  0.5291     0.6258 0.268 0.000 0.732
#> GSM152095     2  0.5621     0.4079 0.000 0.692 0.308
#> GSM152096     3  0.0000     0.6800 0.000 0.000 1.000
#> GSM152097     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152099     2  0.0424     0.7776 0.000 0.992 0.008
#> GSM152106     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152107     3  0.2165     0.6788 0.000 0.064 0.936
#> GSM152109     3  0.2711     0.6306 0.000 0.088 0.912
#> GSM152111     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152112     3  0.5497     0.5663 0.000 0.292 0.708
#> GSM152113     3  0.4654     0.6638 0.208 0.000 0.792
#> GSM152115     3  0.1031     0.6803 0.000 0.024 0.976
#> GSM152030     3  0.5497     0.5663 0.000 0.292 0.708
#> GSM152038     3  0.4504     0.6253 0.196 0.000 0.804
#> GSM152042     3  0.5497     0.5663 0.000 0.292 0.708
#> GSM152062     3  0.0237     0.6825 0.004 0.000 0.996
#> GSM152077     1  0.1031     0.9720 0.976 0.000 0.024
#> GSM152088     2  0.4235     0.6814 0.000 0.824 0.176
#> GSM152100     3  0.5497     0.5663 0.000 0.292 0.708
#> GSM152102     3  0.6280    -0.2160 0.000 0.460 0.540
#> GSM152104     2  0.0000     0.7805 0.000 1.000 0.000
#> GSM152028     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152029     1  0.1163     0.9648 0.972 0.000 0.028
#> GSM152049     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152053     3  0.5497     0.5663 0.000 0.292 0.708
#> GSM152059     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152085     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152101     3  0.3551     0.6062 0.000 0.132 0.868
#> GSM152105     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152034     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152036     2  0.6308    -0.1059 0.000 0.508 0.492
#> GSM152040     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152043     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152046     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152047     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152048     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152050     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152052     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152056     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152060     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152065     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152066     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152069     3  0.0661     0.6819 0.008 0.004 0.988
#> GSM152070     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152071     3  0.3425     0.6574 0.112 0.004 0.884
#> GSM152072     1  0.2537     0.9042 0.920 0.000 0.080
#> GSM152073     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152078     1  0.0237     0.9915 0.996 0.000 0.004
#> GSM152082     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152086     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152090     3  0.5291     0.6258 0.268 0.000 0.732
#> GSM152092     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152093     1  0.1031     0.9720 0.976 0.000 0.024
#> GSM152094     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152098     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152110     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152031     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152037     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152055     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152061     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152064     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152087     1  0.0000     0.9950 1.000 0.000 0.000
#> GSM152103     3  0.6111     0.4946 0.396 0.000 0.604

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     4  0.7009    -0.3730 0.000 0.120 0.392 0.488
#> GSM152033     3  0.7185     0.4717 0.176 0.000 0.540 0.284
#> GSM152063     2  0.4746     0.7111 0.000 0.632 0.000 0.368
#> GSM152074     4  0.7345    -0.2888 0.000 0.172 0.336 0.492
#> GSM152080     2  0.5881     0.3416 0.000 0.544 0.420 0.036
#> GSM152081     4  0.0188     0.5803 0.000 0.004 0.000 0.996
#> GSM152083     2  0.5630     0.4659 0.000 0.724 0.136 0.140
#> GSM152091     2  0.5881     0.3416 0.000 0.544 0.420 0.036
#> GSM152108     3  0.5510     0.4702 0.000 0.016 0.504 0.480
#> GSM152114     4  0.7043    -0.5143 0.120 0.000 0.424 0.456
#> GSM152035     4  0.5512    -0.1514 0.000 0.492 0.016 0.492
#> GSM152039     4  0.3172     0.4510 0.000 0.160 0.000 0.840
#> GSM152041     4  0.3030     0.4806 0.076 0.004 0.028 0.892
#> GSM152044     2  0.4661     0.7338 0.000 0.652 0.000 0.348
#> GSM152045     1  0.2597     0.8812 0.904 0.008 0.084 0.004
#> GSM152051     2  0.4605     0.7339 0.000 0.664 0.000 0.336
#> GSM152054     1  0.7998    -0.1866 0.452 0.016 0.340 0.192
#> GSM152057     2  0.4661     0.7338 0.000 0.652 0.000 0.348
#> GSM152058     1  0.2814     0.8627 0.868 0.000 0.132 0.000
#> GSM152067     3  0.7764     0.1474 0.000 0.356 0.404 0.240
#> GSM152068     2  0.4643     0.7343 0.000 0.656 0.000 0.344
#> GSM152075     4  0.0000     0.5805 0.000 0.000 0.000 1.000
#> GSM152076     4  0.3172     0.4510 0.000 0.160 0.000 0.840
#> GSM152079     2  0.4477     0.7269 0.000 0.688 0.000 0.312
#> GSM152084     3  0.5137     0.5261 0.004 0.000 0.544 0.452
#> GSM152089     4  0.5980    -0.0552 0.396 0.000 0.044 0.560
#> GSM152095     4  0.3311     0.4241 0.000 0.172 0.000 0.828
#> GSM152096     4  0.7044    -0.4411 0.000 0.120 0.428 0.452
#> GSM152097     2  0.4661     0.7338 0.000 0.652 0.000 0.348
#> GSM152099     2  0.4560     0.7185 0.000 0.700 0.004 0.296
#> GSM152106     2  0.4661     0.7338 0.000 0.652 0.000 0.348
#> GSM152107     4  0.4188     0.3881 0.000 0.064 0.112 0.824
#> GSM152109     3  0.6921     0.3988 0.000 0.160 0.580 0.260
#> GSM152111     1  0.1452     0.8820 0.956 0.036 0.008 0.000
#> GSM152112     4  0.0336     0.5772 0.000 0.000 0.008 0.992
#> GSM152113     3  0.5257     0.5329 0.008 0.000 0.548 0.444
#> GSM152115     4  0.6919    -0.3341 0.000 0.116 0.368 0.516
#> GSM152030     4  0.0000     0.5805 0.000 0.000 0.000 1.000
#> GSM152038     3  0.6443     0.5500 0.076 0.000 0.548 0.376
#> GSM152042     4  0.0336     0.5772 0.000 0.000 0.008 0.992
#> GSM152062     3  0.5137     0.5261 0.004 0.000 0.544 0.452
#> GSM152077     1  0.7618     0.1087 0.472 0.000 0.244 0.284
#> GSM152088     2  0.4874     0.5189 0.000 0.764 0.180 0.056
#> GSM152100     4  0.0000     0.5805 0.000 0.000 0.000 1.000
#> GSM152102     2  0.7072     0.2419 0.000 0.524 0.336 0.140
#> GSM152104     2  0.4661     0.7338 0.000 0.652 0.000 0.348
#> GSM152028     1  0.3545     0.8452 0.828 0.008 0.164 0.000
#> GSM152029     1  0.3860     0.8571 0.852 0.032 0.104 0.012
#> GSM152049     1  0.1356     0.8860 0.960 0.032 0.008 0.000
#> GSM152053     4  0.0817     0.5660 0.000 0.000 0.024 0.976
#> GSM152059     1  0.1042     0.8871 0.972 0.020 0.008 0.000
#> GSM152085     1  0.1452     0.8820 0.956 0.036 0.008 0.000
#> GSM152101     4  0.6565     0.1167 0.000 0.224 0.148 0.628
#> GSM152105     1  0.3569     0.8229 0.804 0.000 0.196 0.000
#> GSM152034     1  0.1452     0.8820 0.956 0.036 0.008 0.000
#> GSM152036     4  0.3123     0.4576 0.000 0.156 0.000 0.844
#> GSM152040     1  0.1256     0.8847 0.964 0.028 0.008 0.000
#> GSM152043     1  0.2868     0.8582 0.864 0.000 0.136 0.000
#> GSM152046     1  0.1545     0.8818 0.952 0.040 0.008 0.000
#> GSM152047     1  0.1811     0.8826 0.948 0.028 0.020 0.004
#> GSM152048     1  0.1637     0.8843 0.940 0.000 0.060 0.000
#> GSM152050     1  0.1584     0.8851 0.952 0.036 0.012 0.000
#> GSM152052     1  0.3196     0.8526 0.856 0.008 0.136 0.000
#> GSM152056     1  0.1936     0.8853 0.940 0.032 0.028 0.000
#> GSM152060     1  0.1545     0.8818 0.952 0.040 0.008 0.000
#> GSM152065     1  0.3486     0.8281 0.812 0.000 0.188 0.000
#> GSM152066     1  0.1211     0.8868 0.960 0.000 0.040 0.000
#> GSM152069     3  0.7815     0.4652 0.048 0.148 0.576 0.228
#> GSM152070     1  0.1042     0.8871 0.972 0.020 0.008 0.000
#> GSM152071     3  0.8141     0.4654 0.088 0.148 0.576 0.188
#> GSM152072     1  0.3780     0.8438 0.832 0.016 0.148 0.004
#> GSM152073     1  0.1174     0.8874 0.968 0.012 0.020 0.000
#> GSM152078     1  0.3355     0.8454 0.836 0.000 0.160 0.004
#> GSM152082     1  0.3545     0.8452 0.828 0.008 0.164 0.000
#> GSM152086     1  0.0672     0.8877 0.984 0.008 0.008 0.000
#> GSM152090     3  0.6755     0.4957 0.092 0.000 0.460 0.448
#> GSM152092     1  0.3024     0.8513 0.852 0.000 0.148 0.000
#> GSM152093     1  0.7129     0.3429 0.560 0.000 0.196 0.244
#> GSM152094     1  0.0657     0.8868 0.984 0.012 0.004 0.000
#> GSM152098     1  0.1820     0.8855 0.944 0.020 0.036 0.000
#> GSM152110     1  0.1488     0.8864 0.956 0.032 0.012 0.000
#> GSM152031     1  0.3172     0.8470 0.840 0.000 0.160 0.000
#> GSM152037     1  0.3219     0.8459 0.836 0.000 0.164 0.000
#> GSM152055     1  0.1929     0.8833 0.940 0.036 0.024 0.000
#> GSM152061     1  0.1545     0.8818 0.952 0.040 0.008 0.000
#> GSM152064     1  0.1452     0.8820 0.956 0.036 0.008 0.000
#> GSM152087     1  0.0469     0.8869 0.988 0.012 0.000 0.000
#> GSM152103     3  0.7821     0.3674 0.260 0.000 0.396 0.344

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.3961     0.6416 0.000 0.000 0.736 0.248 0.016
#> GSM152033     1  0.7219     0.1589 0.484 0.000 0.256 0.220 0.040
#> GSM152063     2  0.1205     0.7694 0.000 0.956 0.040 0.004 0.000
#> GSM152074     3  0.4848     0.6231 0.000 0.060 0.732 0.192 0.016
#> GSM152080     4  0.3607     0.8446 0.000 0.244 0.004 0.752 0.000
#> GSM152081     3  0.3177     0.5134 0.000 0.208 0.792 0.000 0.000
#> GSM152083     2  0.5422     0.1663 0.000 0.568 0.372 0.056 0.004
#> GSM152091     4  0.3508     0.8457 0.000 0.252 0.000 0.748 0.000
#> GSM152108     3  0.4070     0.6627 0.004 0.016 0.776 0.192 0.012
#> GSM152114     3  0.6605     0.5981 0.128 0.000 0.604 0.208 0.060
#> GSM152035     2  0.1469     0.7627 0.000 0.948 0.036 0.016 0.000
#> GSM152039     2  0.3876     0.6194 0.000 0.684 0.316 0.000 0.000
#> GSM152041     3  0.8172    -0.0765 0.052 0.324 0.368 0.024 0.232
#> GSM152044     2  0.0162     0.7735 0.000 0.996 0.000 0.000 0.004
#> GSM152045     5  0.3586     0.6964 0.264 0.000 0.000 0.000 0.736
#> GSM152051     2  0.0324     0.7735 0.000 0.992 0.004 0.004 0.000
#> GSM152054     5  0.6397     0.5278 0.124 0.004 0.024 0.256 0.592
#> GSM152057     2  0.0290     0.7746 0.000 0.992 0.008 0.000 0.000
#> GSM152058     1  0.1892     0.7869 0.916 0.000 0.004 0.000 0.080
#> GSM152067     5  0.8281    -0.1182 0.000 0.176 0.172 0.280 0.372
#> GSM152068     2  0.0324     0.7735 0.000 0.992 0.004 0.004 0.000
#> GSM152075     3  0.2848     0.5763 0.000 0.156 0.840 0.004 0.000
#> GSM152076     2  0.3876     0.6194 0.000 0.684 0.316 0.000 0.000
#> GSM152079     2  0.0324     0.7735 0.000 0.992 0.004 0.004 0.000
#> GSM152084     3  0.4834     0.6396 0.016 0.000 0.716 0.224 0.044
#> GSM152089     5  0.6833     0.3719 0.016 0.132 0.204 0.044 0.604
#> GSM152095     2  0.3876     0.6194 0.000 0.684 0.316 0.000 0.000
#> GSM152096     3  0.4236     0.6423 0.008 0.000 0.728 0.248 0.016
#> GSM152097     2  0.1041     0.7689 0.000 0.964 0.032 0.000 0.004
#> GSM152099     2  0.0451     0.7710 0.000 0.988 0.004 0.008 0.000
#> GSM152106     2  0.0162     0.7735 0.000 0.996 0.000 0.000 0.004
#> GSM152107     3  0.2853     0.6369 0.000 0.072 0.876 0.052 0.000
#> GSM152109     5  0.6481     0.1960 0.000 0.000 0.184 0.408 0.408
#> GSM152111     5  0.3039     0.6447 0.192 0.000 0.000 0.000 0.808
#> GSM152112     3  0.2890     0.5732 0.000 0.160 0.836 0.004 0.000
#> GSM152113     3  0.6101     0.5988 0.100 0.000 0.636 0.224 0.040
#> GSM152115     3  0.4035     0.6524 0.008 0.000 0.756 0.220 0.016
#> GSM152030     3  0.2806     0.5803 0.000 0.152 0.844 0.004 0.000
#> GSM152038     1  0.7176     0.1976 0.504 0.000 0.228 0.224 0.044
#> GSM152042     3  0.2806     0.5803 0.000 0.152 0.844 0.004 0.000
#> GSM152062     3  0.4629     0.6393 0.008 0.000 0.724 0.224 0.044
#> GSM152077     3  0.4632     0.2160 0.448 0.000 0.540 0.000 0.012
#> GSM152088     4  0.3752     0.8203 0.000 0.292 0.000 0.708 0.000
#> GSM152100     3  0.3969     0.3241 0.000 0.304 0.692 0.004 0.000
#> GSM152102     4  0.6455     0.5975 0.000 0.240 0.004 0.528 0.228
#> GSM152104     2  0.0162     0.7735 0.000 0.996 0.000 0.000 0.004
#> GSM152028     1  0.0000     0.7886 1.000 0.000 0.000 0.000 0.000
#> GSM152029     5  0.3969     0.6802 0.304 0.000 0.004 0.000 0.692
#> GSM152049     1  0.3336     0.7136 0.772 0.000 0.000 0.000 0.228
#> GSM152053     3  0.2806     0.5803 0.000 0.152 0.844 0.004 0.000
#> GSM152059     5  0.4029     0.6753 0.316 0.000 0.000 0.004 0.680
#> GSM152085     5  0.2179     0.7060 0.112 0.000 0.000 0.000 0.888
#> GSM152101     2  0.5504     0.2150 0.000 0.488 0.448 0.064 0.000
#> GSM152105     1  0.0162     0.7874 0.996 0.000 0.004 0.000 0.000
#> GSM152034     5  0.2020     0.7051 0.100 0.000 0.000 0.000 0.900
#> GSM152036     2  0.3876     0.6194 0.000 0.684 0.316 0.000 0.000
#> GSM152040     5  0.2377     0.7091 0.128 0.000 0.000 0.000 0.872
#> GSM152043     1  0.0000     0.7886 1.000 0.000 0.000 0.000 0.000
#> GSM152046     5  0.1270     0.6925 0.052 0.000 0.000 0.000 0.948
#> GSM152047     5  0.1732     0.7095 0.080 0.000 0.000 0.000 0.920
#> GSM152048     1  0.2280     0.7736 0.880 0.000 0.000 0.000 0.120
#> GSM152050     1  0.3837     0.6429 0.692 0.000 0.000 0.000 0.308
#> GSM152052     1  0.2813     0.6107 0.832 0.000 0.000 0.000 0.168
#> GSM152056     1  0.3366     0.7082 0.768 0.000 0.000 0.000 0.232
#> GSM152060     5  0.1341     0.6948 0.056 0.000 0.000 0.000 0.944
#> GSM152065     1  0.0000     0.7886 1.000 0.000 0.000 0.000 0.000
#> GSM152066     1  0.1732     0.7867 0.920 0.000 0.000 0.000 0.080
#> GSM152069     5  0.6504     0.2859 0.004 0.000 0.172 0.352 0.472
#> GSM152070     5  0.4066     0.6704 0.324 0.000 0.000 0.004 0.672
#> GSM152071     5  0.6471     0.2929 0.004 0.000 0.168 0.348 0.480
#> GSM152072     5  0.3913     0.6686 0.324 0.000 0.000 0.000 0.676
#> GSM152073     5  0.3999     0.6570 0.344 0.000 0.000 0.000 0.656
#> GSM152078     5  0.4030     0.6503 0.352 0.000 0.000 0.000 0.648
#> GSM152082     1  0.2020     0.7129 0.900 0.000 0.000 0.000 0.100
#> GSM152086     1  0.2020     0.7818 0.900 0.000 0.000 0.000 0.100
#> GSM152090     3  0.8357     0.2221 0.160 0.000 0.360 0.224 0.256
#> GSM152092     1  0.0000     0.7886 1.000 0.000 0.000 0.000 0.000
#> GSM152093     1  0.5797     0.4456 0.592 0.000 0.276 0.000 0.132
#> GSM152094     5  0.2852     0.7081 0.172 0.000 0.000 0.000 0.828
#> GSM152098     5  0.3983     0.6617 0.340 0.000 0.000 0.000 0.660
#> GSM152110     1  0.3661     0.6759 0.724 0.000 0.000 0.000 0.276
#> GSM152031     1  0.0000     0.7886 1.000 0.000 0.000 0.000 0.000
#> GSM152037     1  0.0000     0.7886 1.000 0.000 0.000 0.000 0.000
#> GSM152055     1  0.3876     0.6380 0.684 0.000 0.000 0.000 0.316
#> GSM152061     5  0.1270     0.6925 0.052 0.000 0.000 0.000 0.948
#> GSM152064     5  0.3003     0.6436 0.188 0.000 0.000 0.000 0.812
#> GSM152087     5  0.3003     0.7005 0.188 0.000 0.000 0.000 0.812
#> GSM152103     5  0.7509     0.4661 0.252 0.000 0.072 0.196 0.480

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.2523     0.4743 0.000 0.036 0.896 0.048 0.016 0.004
#> GSM152033     3  0.4549     0.4696 0.248 0.000 0.688 0.048 0.000 0.016
#> GSM152063     2  0.2320     0.6517 0.000 0.864 0.000 0.132 0.004 0.000
#> GSM152074     3  0.3147     0.4523 0.000 0.092 0.852 0.036 0.016 0.004
#> GSM152080     5  0.5089     0.8698 0.000 0.260 0.004 0.112 0.624 0.000
#> GSM152081     4  0.5447     0.7635 0.000 0.152 0.264 0.580 0.004 0.000
#> GSM152083     2  0.5272     0.0383 0.000 0.504 0.420 0.060 0.016 0.000
#> GSM152091     5  0.5089     0.8698 0.000 0.260 0.004 0.112 0.624 0.000
#> GSM152108     3  0.3895     0.1703 0.008 0.008 0.708 0.272 0.004 0.000
#> GSM152114     3  0.5094     0.0996 0.100 0.000 0.628 0.264 0.000 0.008
#> GSM152035     2  0.3452     0.6160 0.000 0.828 0.040 0.112 0.016 0.004
#> GSM152039     2  0.5984     0.3058 0.000 0.536 0.040 0.344 0.064 0.016
#> GSM152041     4  0.9321     0.1540 0.192 0.160 0.176 0.312 0.112 0.048
#> GSM152044     2  0.2339     0.6288 0.000 0.896 0.000 0.020 0.072 0.012
#> GSM152045     6  0.5071     0.5032 0.156 0.000 0.012 0.016 0.116 0.700
#> GSM152051     2  0.1493     0.6381 0.000 0.936 0.004 0.056 0.004 0.000
#> GSM152054     6  0.6637     0.1790 0.032 0.028 0.264 0.076 0.032 0.568
#> GSM152057     2  0.1753     0.6362 0.000 0.912 0.000 0.084 0.004 0.000
#> GSM152058     1  0.0405     0.6595 0.988 0.000 0.000 0.008 0.000 0.004
#> GSM152067     3  0.8578    -0.1381 0.000 0.176 0.356 0.140 0.192 0.136
#> GSM152068     2  0.1010     0.6358 0.000 0.960 0.000 0.036 0.004 0.000
#> GSM152075     4  0.5298     0.7789 0.000 0.100 0.348 0.548 0.000 0.004
#> GSM152076     2  0.6062     0.2803 0.000 0.496 0.040 0.384 0.064 0.016
#> GSM152079     2  0.1674     0.6384 0.000 0.924 0.004 0.068 0.004 0.000
#> GSM152084     3  0.3166     0.3504 0.008 0.000 0.800 0.184 0.000 0.008
#> GSM152089     6  0.9181     0.2490 0.176 0.080 0.132 0.248 0.056 0.308
#> GSM152095     2  0.5936     0.3168 0.000 0.540 0.040 0.344 0.060 0.016
#> GSM152096     3  0.2660     0.4901 0.004 0.008 0.872 0.100 0.016 0.000
#> GSM152097     2  0.2554     0.6334 0.000 0.880 0.000 0.020 0.088 0.012
#> GSM152099     2  0.1845     0.6392 0.000 0.916 0.004 0.072 0.008 0.000
#> GSM152106     2  0.2554     0.6280 0.000 0.880 0.000 0.020 0.088 0.012
#> GSM152107     4  0.5867     0.6078 0.000 0.112 0.380 0.488 0.016 0.004
#> GSM152109     3  0.6830     0.3155 0.000 0.008 0.540 0.140 0.176 0.136
#> GSM152111     6  0.5963     0.5451 0.320 0.000 0.000 0.000 0.240 0.440
#> GSM152112     4  0.5127     0.7788 0.000 0.112 0.300 0.588 0.000 0.000
#> GSM152113     3  0.4121     0.4743 0.088 0.000 0.788 0.084 0.000 0.040
#> GSM152115     3  0.2753     0.4513 0.012 0.004 0.876 0.088 0.016 0.004
#> GSM152030     4  0.5166     0.7789 0.000 0.100 0.348 0.552 0.000 0.000
#> GSM152038     3  0.4424     0.4687 0.252 0.000 0.692 0.044 0.000 0.012
#> GSM152042     4  0.5083     0.7872 0.000 0.100 0.320 0.580 0.000 0.000
#> GSM152062     3  0.2174     0.4655 0.008 0.000 0.896 0.088 0.000 0.008
#> GSM152077     3  0.6619    -0.0601 0.368 0.000 0.400 0.196 0.004 0.032
#> GSM152088     5  0.5303     0.8327 0.000 0.312 0.004 0.112 0.572 0.000
#> GSM152100     4  0.5621     0.6614 0.000 0.216 0.216 0.564 0.000 0.004
#> GSM152102     5  0.7680     0.6762 0.000 0.260 0.020 0.200 0.396 0.124
#> GSM152104     2  0.2449     0.6290 0.000 0.888 0.000 0.020 0.080 0.012
#> GSM152028     1  0.4093     0.6563 0.736 0.000 0.000 0.056 0.004 0.204
#> GSM152029     6  0.2965     0.4783 0.108 0.000 0.012 0.016 0.008 0.856
#> GSM152049     1  0.3148     0.5455 0.840 0.000 0.000 0.004 0.092 0.064
#> GSM152053     4  0.5176     0.7764 0.000 0.100 0.352 0.548 0.000 0.000
#> GSM152059     6  0.2333     0.4643 0.120 0.000 0.000 0.004 0.004 0.872
#> GSM152085     6  0.5891     0.5634 0.300 0.000 0.000 0.000 0.232 0.468
#> GSM152101     2  0.6576    -0.0561 0.000 0.408 0.312 0.256 0.020 0.004
#> GSM152105     1  0.3786     0.6702 0.772 0.000 0.000 0.052 0.004 0.172
#> GSM152034     6  0.5894     0.5662 0.284 0.000 0.000 0.000 0.244 0.472
#> GSM152036     2  0.6012     0.2975 0.000 0.524 0.040 0.356 0.064 0.016
#> GSM152040     6  0.5805     0.5786 0.276 0.000 0.000 0.000 0.228 0.496
#> GSM152043     1  0.2915     0.6711 0.808 0.000 0.000 0.008 0.000 0.184
#> GSM152046     6  0.6340     0.5684 0.252 0.000 0.000 0.024 0.248 0.476
#> GSM152047     6  0.6384     0.5825 0.224 0.000 0.012 0.016 0.244 0.504
#> GSM152048     1  0.0984     0.6489 0.968 0.000 0.000 0.008 0.012 0.012
#> GSM152050     1  0.4624     0.3519 0.700 0.000 0.000 0.004 0.184 0.112
#> GSM152052     6  0.4984    -0.3497 0.464 0.000 0.000 0.048 0.008 0.480
#> GSM152056     1  0.3598     0.4996 0.804 0.000 0.000 0.004 0.112 0.080
#> GSM152060     6  0.6340     0.5684 0.252 0.000 0.000 0.024 0.248 0.476
#> GSM152065     1  0.4361     0.6315 0.708 0.000 0.004 0.052 0.004 0.232
#> GSM152066     1  0.1644     0.6752 0.932 0.000 0.000 0.012 0.004 0.052
#> GSM152069     3  0.6267     0.3684 0.000 0.000 0.592 0.132 0.124 0.152
#> GSM152070     6  0.2871     0.4294 0.192 0.000 0.000 0.004 0.000 0.804
#> GSM152071     3  0.6267     0.3684 0.000 0.000 0.592 0.132 0.124 0.152
#> GSM152072     6  0.3227     0.4627 0.132 0.000 0.012 0.016 0.008 0.832
#> GSM152073     6  0.3725     0.3201 0.316 0.000 0.000 0.000 0.008 0.676
#> GSM152078     6  0.3471     0.4589 0.120 0.000 0.036 0.016 0.004 0.824
#> GSM152082     1  0.4507     0.5878 0.660 0.000 0.000 0.052 0.004 0.284
#> GSM152086     1  0.2101     0.6488 0.912 0.000 0.000 0.008 0.028 0.052
#> GSM152090     3  0.5348     0.4543 0.056 0.000 0.652 0.224 0.000 0.068
#> GSM152092     1  0.3924     0.6550 0.740 0.000 0.000 0.052 0.000 0.208
#> GSM152093     1  0.6762     0.3278 0.556 0.000 0.216 0.112 0.024 0.092
#> GSM152094     6  0.5624     0.5797 0.264 0.000 0.000 0.000 0.200 0.536
#> GSM152098     6  0.2994     0.4148 0.208 0.000 0.000 0.004 0.000 0.788
#> GSM152110     1  0.4391     0.4082 0.728 0.000 0.000 0.004 0.160 0.108
#> GSM152031     1  0.4059     0.6372 0.720 0.000 0.000 0.052 0.000 0.228
#> GSM152037     1  0.3213     0.6746 0.808 0.000 0.000 0.032 0.000 0.160
#> GSM152055     1  0.4963     0.2453 0.648 0.000 0.000 0.004 0.236 0.112
#> GSM152061     6  0.6340     0.5684 0.252 0.000 0.000 0.024 0.248 0.476
#> GSM152064     6  0.5944     0.5505 0.304 0.000 0.000 0.000 0.244 0.452
#> GSM152087     6  0.5761     0.5019 0.396 0.000 0.000 0.000 0.172 0.432
#> GSM152103     3  0.6528     0.1932 0.068 0.000 0.460 0.076 0.016 0.380

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

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.999           0.965       0.985         0.4958 0.504   0.504
#> 3 3 0.589           0.581       0.777         0.3137 0.752   0.551
#> 4 4 0.528           0.471       0.711         0.1190 0.866   0.650
#> 5 5 0.675           0.699       0.839         0.0894 0.846   0.510
#> 6 6 0.703           0.670       0.822         0.0446 0.913   0.614

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
#> GSM152032     2  0.3879      0.911 0.076 0.924
#> GSM152033     1  0.0000      0.988 1.000 0.000
#> GSM152063     2  0.0000      0.980 0.000 1.000
#> GSM152074     2  0.1184      0.969 0.016 0.984
#> GSM152080     2  0.0000      0.980 0.000 1.000
#> GSM152081     2  0.0000      0.980 0.000 1.000
#> GSM152083     2  0.0000      0.980 0.000 1.000
#> GSM152091     2  0.0000      0.980 0.000 1.000
#> GSM152108     2  0.0376      0.977 0.004 0.996
#> GSM152114     1  0.0376      0.985 0.996 0.004
#> GSM152035     2  0.0000      0.980 0.000 1.000
#> GSM152039     2  0.0000      0.980 0.000 1.000
#> GSM152041     2  0.9775      0.297 0.412 0.588
#> GSM152044     2  0.0000      0.980 0.000 1.000
#> GSM152045     1  0.0000      0.988 1.000 0.000
#> GSM152051     2  0.0000      0.980 0.000 1.000
#> GSM152054     1  0.8713      0.587 0.708 0.292
#> GSM152057     2  0.0000      0.980 0.000 1.000
#> GSM152058     1  0.0000      0.988 1.000 0.000
#> GSM152067     2  0.0938      0.972 0.012 0.988
#> GSM152068     2  0.0000      0.980 0.000 1.000
#> GSM152075     2  0.0000      0.980 0.000 1.000
#> GSM152076     2  0.0000      0.980 0.000 1.000
#> GSM152079     2  0.0000      0.980 0.000 1.000
#> GSM152084     1  0.5178      0.869 0.884 0.116
#> GSM152089     2  0.2043      0.956 0.032 0.968
#> GSM152095     2  0.0000      0.980 0.000 1.000
#> GSM152096     2  0.1184      0.969 0.016 0.984
#> GSM152097     2  0.0000      0.980 0.000 1.000
#> GSM152099     2  0.0000      0.980 0.000 1.000
#> GSM152106     2  0.0000      0.980 0.000 1.000
#> GSM152107     2  0.0000      0.980 0.000 1.000
#> GSM152109     2  0.1414      0.966 0.020 0.980
#> GSM152111     1  0.0000      0.988 1.000 0.000
#> GSM152112     2  0.0000      0.980 0.000 1.000
#> GSM152113     1  0.0376      0.985 0.996 0.004
#> GSM152115     2  0.6048      0.825 0.148 0.852
#> GSM152030     2  0.0000      0.980 0.000 1.000
#> GSM152038     1  0.0000      0.988 1.000 0.000
#> GSM152042     2  0.0000      0.980 0.000 1.000
#> GSM152062     1  0.4161      0.906 0.916 0.084
#> GSM152077     1  0.0000      0.988 1.000 0.000
#> GSM152088     2  0.0000      0.980 0.000 1.000
#> GSM152100     2  0.0000      0.980 0.000 1.000
#> GSM152102     2  0.0000      0.980 0.000 1.000
#> GSM152104     2  0.0000      0.980 0.000 1.000
#> GSM152028     1  0.0000      0.988 1.000 0.000
#> GSM152029     1  0.0000      0.988 1.000 0.000
#> GSM152049     1  0.0000      0.988 1.000 0.000
#> GSM152053     2  0.0000      0.980 0.000 1.000
#> GSM152059     1  0.0000      0.988 1.000 0.000
#> GSM152085     1  0.0000      0.988 1.000 0.000
#> GSM152101     2  0.0000      0.980 0.000 1.000
#> GSM152105     1  0.0000      0.988 1.000 0.000
#> GSM152034     1  0.0000      0.988 1.000 0.000
#> GSM152036     2  0.0000      0.980 0.000 1.000
#> GSM152040     1  0.0000      0.988 1.000 0.000
#> GSM152043     1  0.0000      0.988 1.000 0.000
#> GSM152046     1  0.0000      0.988 1.000 0.000
#> GSM152047     1  0.0000      0.988 1.000 0.000
#> GSM152048     1  0.0000      0.988 1.000 0.000
#> GSM152050     1  0.0000      0.988 1.000 0.000
#> GSM152052     1  0.0000      0.988 1.000 0.000
#> GSM152056     1  0.0000      0.988 1.000 0.000
#> GSM152060     1  0.0000      0.988 1.000 0.000
#> GSM152065     1  0.0000      0.988 1.000 0.000
#> GSM152066     1  0.0000      0.988 1.000 0.000
#> GSM152069     1  0.0938      0.978 0.988 0.012
#> GSM152070     1  0.0000      0.988 1.000 0.000
#> GSM152071     1  0.0376      0.985 0.996 0.004
#> GSM152072     1  0.0000      0.988 1.000 0.000
#> GSM152073     1  0.0000      0.988 1.000 0.000
#> GSM152078     1  0.0000      0.988 1.000 0.000
#> GSM152082     1  0.0000      0.988 1.000 0.000
#> GSM152086     1  0.0000      0.988 1.000 0.000
#> GSM152090     1  0.3584      0.924 0.932 0.068
#> GSM152092     1  0.0000      0.988 1.000 0.000
#> GSM152093     1  0.0000      0.988 1.000 0.000
#> GSM152094     1  0.0000      0.988 1.000 0.000
#> GSM152098     1  0.0000      0.988 1.000 0.000
#> GSM152110     1  0.0000      0.988 1.000 0.000
#> GSM152031     1  0.0000      0.988 1.000 0.000
#> GSM152037     1  0.0000      0.988 1.000 0.000
#> GSM152055     1  0.0000      0.988 1.000 0.000
#> GSM152061     1  0.0000      0.988 1.000 0.000
#> GSM152064     1  0.0000      0.988 1.000 0.000
#> GSM152087     1  0.0000      0.988 1.000 0.000
#> GSM152103     1  0.0000      0.988 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
#> GSM152032     3  0.0000    0.76289 0.000 0.000 1.000
#> GSM152033     1  0.6302    0.13286 0.520 0.000 0.480
#> GSM152063     3  0.6302    0.21023 0.000 0.480 0.520
#> GSM152074     3  0.0000    0.76289 0.000 0.000 1.000
#> GSM152080     3  0.0000    0.76289 0.000 0.000 1.000
#> GSM152081     2  0.1289    0.67320 0.000 0.968 0.032
#> GSM152083     3  0.0000    0.76289 0.000 0.000 1.000
#> GSM152091     3  0.6204    0.34167 0.000 0.424 0.576
#> GSM152108     3  0.0237    0.76303 0.000 0.004 0.996
#> GSM152114     1  0.3587    0.77025 0.892 0.088 0.020
#> GSM152035     3  0.5733    0.51441 0.000 0.324 0.676
#> GSM152039     2  0.0000    0.69111 0.000 1.000 0.000
#> GSM152041     2  0.0424    0.68857 0.008 0.992 0.000
#> GSM152044     2  0.6291   -0.13500 0.000 0.532 0.468
#> GSM152045     1  0.0237    0.82704 0.996 0.000 0.004
#> GSM152051     3  0.5810    0.49876 0.000 0.336 0.664
#> GSM152054     2  0.7658    0.31268 0.356 0.588 0.056
#> GSM152057     3  0.3619    0.71147 0.000 0.136 0.864
#> GSM152058     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152067     3  0.0000    0.76289 0.000 0.000 1.000
#> GSM152068     3  0.6267    0.27994 0.000 0.452 0.548
#> GSM152075     2  0.0000    0.69111 0.000 1.000 0.000
#> GSM152076     2  0.0000    0.69111 0.000 1.000 0.000
#> GSM152079     3  0.4291    0.67754 0.000 0.180 0.820
#> GSM152084     3  0.5733    0.39819 0.324 0.000 0.676
#> GSM152089     2  0.0000    0.69111 0.000 1.000 0.000
#> GSM152095     2  0.0000    0.69111 0.000 1.000 0.000
#> GSM152096     3  0.0000    0.76289 0.000 0.000 1.000
#> GSM152097     2  0.6062    0.12008 0.000 0.616 0.384
#> GSM152099     3  0.3116    0.72771 0.000 0.108 0.892
#> GSM152106     2  0.2261    0.64310 0.000 0.932 0.068
#> GSM152107     3  0.0592    0.76138 0.000 0.012 0.988
#> GSM152109     3  0.0000    0.76289 0.000 0.000 1.000
#> GSM152111     1  0.6215    0.15919 0.572 0.428 0.000
#> GSM152112     3  0.5706    0.51751 0.000 0.320 0.680
#> GSM152113     1  0.6308    0.09540 0.508 0.000 0.492
#> GSM152115     3  0.0237    0.76104 0.004 0.000 0.996
#> GSM152030     2  0.6168    0.04203 0.000 0.588 0.412
#> GSM152038     1  0.6309    0.08200 0.504 0.000 0.496
#> GSM152042     3  0.6045    0.42986 0.000 0.380 0.620
#> GSM152062     3  0.6045    0.26894 0.380 0.000 0.620
#> GSM152077     1  0.0424    0.82585 0.992 0.000 0.008
#> GSM152088     3  0.2711    0.73693 0.000 0.088 0.912
#> GSM152100     2  0.0000    0.69111 0.000 1.000 0.000
#> GSM152102     3  0.0237    0.76303 0.000 0.004 0.996
#> GSM152104     2  0.5016    0.42819 0.000 0.760 0.240
#> GSM152028     1  0.0237    0.82704 0.996 0.000 0.004
#> GSM152029     1  0.4062    0.70748 0.836 0.000 0.164
#> GSM152049     1  0.0237    0.82640 0.996 0.004 0.000
#> GSM152053     3  0.3412    0.71996 0.000 0.124 0.876
#> GSM152059     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152085     1  0.4654    0.62141 0.792 0.208 0.000
#> GSM152101     3  0.0237    0.76298 0.000 0.004 0.996
#> GSM152105     1  0.1289    0.81409 0.968 0.000 0.032
#> GSM152034     1  0.6299    0.00913 0.524 0.476 0.000
#> GSM152036     2  0.0000    0.69111 0.000 1.000 0.000
#> GSM152040     1  0.0237    0.82661 0.996 0.004 0.000
#> GSM152043     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152046     2  0.6309    0.00857 0.496 0.504 0.000
#> GSM152047     1  0.6168    0.20319 0.588 0.412 0.000
#> GSM152048     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152050     1  0.4504    0.64087 0.804 0.196 0.000
#> GSM152052     1  0.0892    0.82057 0.980 0.000 0.020
#> GSM152056     1  0.1753    0.79930 0.952 0.048 0.000
#> GSM152060     2  0.6309   -0.00424 0.500 0.500 0.000
#> GSM152065     1  0.1964    0.79835 0.944 0.000 0.056
#> GSM152066     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152069     3  0.4178    0.62393 0.172 0.000 0.828
#> GSM152070     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152071     3  0.5859    0.35547 0.344 0.000 0.656
#> GSM152072     1  0.5591    0.53128 0.696 0.000 0.304
#> GSM152073     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152078     1  0.5465    0.55536 0.712 0.000 0.288
#> GSM152082     1  0.0237    0.82704 0.996 0.000 0.004
#> GSM152086     1  0.0237    0.82640 0.996 0.004 0.000
#> GSM152090     3  0.6168    0.17156 0.412 0.000 0.588
#> GSM152092     1  0.0237    0.82704 0.996 0.000 0.004
#> GSM152093     1  0.0424    0.82472 0.992 0.008 0.000
#> GSM152094     1  0.1031    0.81567 0.976 0.024 0.000
#> GSM152098     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152110     1  0.1964    0.79361 0.944 0.056 0.000
#> GSM152031     1  0.0424    0.82585 0.992 0.000 0.008
#> GSM152037     1  0.0000    0.82737 1.000 0.000 0.000
#> GSM152055     1  0.6307   -0.03197 0.512 0.488 0.000
#> GSM152061     2  0.6308    0.02054 0.492 0.508 0.000
#> GSM152064     2  0.6302    0.05071 0.480 0.520 0.000
#> GSM152087     1  0.0237    0.82640 0.996 0.004 0.000
#> GSM152103     1  0.6267    0.21259 0.548 0.000 0.452

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.7002      0.393 0.268 0.164 0.568 0.000
#> GSM152033     1  0.5168      0.260 0.712 0.040 0.248 0.000
#> GSM152063     2  0.3573      0.655 0.028 0.864 0.008 0.100
#> GSM152074     3  0.6954      0.389 0.280 0.152 0.568 0.000
#> GSM152080     2  0.0804      0.658 0.000 0.980 0.008 0.012
#> GSM152081     4  0.4465      0.583 0.000 0.056 0.144 0.800
#> GSM152083     3  0.4999      0.237 0.000 0.492 0.508 0.000
#> GSM152091     2  0.1970      0.671 0.000 0.932 0.008 0.060
#> GSM152108     2  0.7282      0.115 0.416 0.436 0.148 0.000
#> GSM152114     1  0.6162      0.273 0.708 0.032 0.192 0.068
#> GSM152035     2  0.4413      0.604 0.140 0.812 0.008 0.040
#> GSM152039     4  0.0188      0.738 0.000 0.004 0.000 0.996
#> GSM152041     4  0.0000      0.738 0.000 0.000 0.000 1.000
#> GSM152044     2  0.4855      0.442 0.000 0.644 0.004 0.352
#> GSM152045     1  0.6348      0.630 0.516 0.008 0.432 0.044
#> GSM152051     2  0.1489      0.670 0.000 0.952 0.004 0.044
#> GSM152054     2  0.9053      0.265 0.212 0.472 0.200 0.116
#> GSM152057     2  0.2987      0.641 0.000 0.880 0.016 0.104
#> GSM152058     1  0.1486      0.619 0.960 0.024 0.008 0.008
#> GSM152067     3  0.5000      0.203 0.000 0.496 0.504 0.000
#> GSM152068     2  0.1824      0.669 0.000 0.936 0.004 0.060
#> GSM152075     4  0.0336      0.738 0.000 0.008 0.000 0.992
#> GSM152076     4  0.0336      0.738 0.000 0.008 0.000 0.992
#> GSM152079     2  0.1489      0.670 0.000 0.952 0.004 0.044
#> GSM152084     3  0.6240      0.357 0.368 0.064 0.568 0.000
#> GSM152089     4  0.4871      0.640 0.012 0.040 0.168 0.780
#> GSM152095     4  0.0336      0.738 0.000 0.008 0.000 0.992
#> GSM152096     2  0.5052      0.447 0.244 0.720 0.036 0.000
#> GSM152097     4  0.3975      0.518 0.000 0.240 0.000 0.760
#> GSM152099     2  0.5109      0.383 0.000 0.736 0.212 0.052
#> GSM152106     4  0.2704      0.657 0.000 0.124 0.000 0.876
#> GSM152107     3  0.5360      0.299 0.000 0.436 0.552 0.012
#> GSM152109     3  0.4989      0.268 0.000 0.472 0.528 0.000
#> GSM152111     1  0.7575      0.435 0.484 0.000 0.252 0.264
#> GSM152112     3  0.6627      0.223 0.000 0.412 0.504 0.084
#> GSM152113     1  0.4998      0.339 0.748 0.052 0.200 0.000
#> GSM152115     3  0.6553      0.360 0.100 0.316 0.584 0.000
#> GSM152030     3  0.8948      0.185 0.172 0.080 0.376 0.372
#> GSM152038     1  0.5671     -0.138 0.572 0.028 0.400 0.000
#> GSM152042     3  0.7130      0.233 0.000 0.396 0.472 0.132
#> GSM152062     3  0.5756      0.336 0.400 0.032 0.568 0.000
#> GSM152077     1  0.3653      0.485 0.844 0.028 0.128 0.000
#> GSM152088     2  0.1305      0.667 0.000 0.960 0.004 0.036
#> GSM152100     4  0.0592      0.734 0.000 0.016 0.000 0.984
#> GSM152102     2  0.2945      0.650 0.056 0.904 0.024 0.016
#> GSM152104     4  0.4008      0.515 0.000 0.244 0.000 0.756
#> GSM152028     1  0.1109      0.622 0.968 0.028 0.004 0.000
#> GSM152029     3  0.7246     -0.551 0.408 0.144 0.448 0.000
#> GSM152049     1  0.5062      0.674 0.680 0.000 0.300 0.020
#> GSM152053     3  0.7457      0.396 0.216 0.208 0.564 0.012
#> GSM152059     1  0.5193      0.658 0.580 0.000 0.412 0.008
#> GSM152085     1  0.6562      0.608 0.516 0.000 0.404 0.080
#> GSM152101     3  0.4925      0.301 0.000 0.428 0.572 0.000
#> GSM152105     1  0.2413      0.574 0.916 0.020 0.064 0.000
#> GSM152034     3  0.7834     -0.409 0.284 0.000 0.408 0.308
#> GSM152036     4  0.0000      0.738 0.000 0.000 0.000 1.000
#> GSM152040     1  0.5902      0.644 0.540 0.004 0.428 0.028
#> GSM152043     1  0.5050      0.660 0.588 0.000 0.408 0.004
#> GSM152046     4  0.7285      0.238 0.308 0.000 0.176 0.516
#> GSM152047     3  0.7721     -0.523 0.380 0.004 0.424 0.192
#> GSM152048     1  0.1229      0.623 0.968 0.020 0.004 0.008
#> GSM152050     1  0.7518      0.466 0.496 0.000 0.260 0.244
#> GSM152052     1  0.1388      0.623 0.960 0.028 0.012 0.000
#> GSM152056     1  0.1396      0.635 0.960 0.004 0.004 0.032
#> GSM152060     4  0.6356      0.389 0.320 0.000 0.084 0.596
#> GSM152065     1  0.3342      0.633 0.868 0.032 0.100 0.000
#> GSM152066     1  0.0592      0.642 0.984 0.000 0.016 0.000
#> GSM152069     2  0.6393     -0.211 0.064 0.480 0.456 0.000
#> GSM152070     1  0.5276      0.652 0.560 0.004 0.432 0.004
#> GSM152071     3  0.5939      0.232 0.084 0.248 0.668 0.000
#> GSM152072     1  0.5590      0.634 0.524 0.020 0.456 0.000
#> GSM152073     1  0.5060      0.659 0.584 0.000 0.412 0.004
#> GSM152078     1  0.5626      0.665 0.588 0.028 0.384 0.000
#> GSM152082     1  0.4855      0.666 0.600 0.000 0.400 0.000
#> GSM152086     1  0.5217      0.667 0.608 0.000 0.380 0.012
#> GSM152090     2  0.7851     -0.115 0.356 0.376 0.268 0.000
#> GSM152092     1  0.3351      0.663 0.844 0.008 0.148 0.000
#> GSM152093     1  0.1936      0.642 0.940 0.000 0.032 0.028
#> GSM152094     1  0.5517      0.654 0.568 0.000 0.412 0.020
#> GSM152098     1  0.5260      0.655 0.568 0.004 0.424 0.004
#> GSM152110     1  0.1576      0.632 0.948 0.004 0.000 0.048
#> GSM152031     1  0.2401      0.658 0.904 0.004 0.092 0.000
#> GSM152037     1  0.0336      0.632 0.992 0.000 0.008 0.000
#> GSM152055     4  0.5090      0.469 0.324 0.000 0.016 0.660
#> GSM152061     4  0.5453      0.482 0.304 0.000 0.036 0.660
#> GSM152064     4  0.5894      0.263 0.392 0.000 0.040 0.568
#> GSM152087     1  0.5691      0.651 0.564 0.000 0.408 0.028
#> GSM152103     1  0.6426      0.614 0.568 0.080 0.352 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
#> GSM152032     3  0.2179     0.7879 0.112 0.000 0.888 0.000 0.000
#> GSM152033     1  0.2193     0.7814 0.900 0.000 0.092 0.000 0.008
#> GSM152063     2  0.0798     0.8330 0.000 0.976 0.008 0.016 0.000
#> GSM152074     3  0.2020     0.7937 0.100 0.000 0.900 0.000 0.000
#> GSM152080     2  0.0000     0.8339 0.000 1.000 0.000 0.000 0.000
#> GSM152081     4  0.4171     0.2378 0.000 0.000 0.396 0.604 0.000
#> GSM152083     3  0.4331     0.3641 0.004 0.400 0.596 0.000 0.000
#> GSM152091     2  0.0162     0.8338 0.000 0.996 0.004 0.000 0.000
#> GSM152108     1  0.2359     0.7886 0.904 0.060 0.036 0.000 0.000
#> GSM152114     1  0.1364     0.8228 0.952 0.000 0.012 0.036 0.000
#> GSM152035     2  0.1877     0.8040 0.000 0.924 0.064 0.012 0.000
#> GSM152039     4  0.0000     0.7901 0.000 0.000 0.000 1.000 0.000
#> GSM152041     4  0.0000     0.7901 0.000 0.000 0.000 1.000 0.000
#> GSM152044     2  0.2074     0.7739 0.000 0.896 0.000 0.104 0.000
#> GSM152045     5  0.2228     0.7782 0.004 0.004 0.092 0.000 0.900
#> GSM152051     2  0.0162     0.8342 0.000 0.996 0.000 0.004 0.000
#> GSM152054     2  0.7826     0.3565 0.228 0.460 0.084 0.004 0.224
#> GSM152057     2  0.1168     0.8258 0.008 0.960 0.000 0.032 0.000
#> GSM152058     1  0.0290     0.8390 0.992 0.000 0.000 0.000 0.008
#> GSM152067     3  0.3840     0.7804 0.000 0.076 0.808 0.000 0.116
#> GSM152068     2  0.0404     0.8335 0.000 0.988 0.000 0.012 0.000
#> GSM152075     4  0.0162     0.7891 0.000 0.000 0.004 0.996 0.000
#> GSM152076     4  0.0000     0.7901 0.000 0.000 0.000 1.000 0.000
#> GSM152079     2  0.0162     0.8342 0.000 0.996 0.000 0.004 0.000
#> GSM152084     3  0.3534     0.6298 0.256 0.000 0.744 0.000 0.000
#> GSM152089     4  0.5982     0.5140 0.000 0.028 0.076 0.600 0.296
#> GSM152095     4  0.0162     0.7891 0.000 0.000 0.004 0.996 0.000
#> GSM152096     2  0.4273     0.1665 0.448 0.552 0.000 0.000 0.000
#> GSM152097     4  0.2424     0.7111 0.000 0.132 0.000 0.868 0.000
#> GSM152099     2  0.4305    -0.1702 0.000 0.512 0.488 0.000 0.000
#> GSM152106     4  0.1410     0.7617 0.000 0.060 0.000 0.940 0.000
#> GSM152107     3  0.1831     0.7954 0.000 0.076 0.920 0.004 0.000
#> GSM152109     3  0.2416     0.7896 0.000 0.100 0.888 0.000 0.012
#> GSM152111     5  0.4704     0.7786 0.152 0.000 0.000 0.112 0.736
#> GSM152112     3  0.2801     0.7696 0.004 0.004 0.884 0.024 0.084
#> GSM152113     1  0.2139     0.7988 0.916 0.000 0.052 0.000 0.032
#> GSM152115     3  0.1788     0.7888 0.008 0.004 0.932 0.000 0.056
#> GSM152030     3  0.4587     0.6685 0.068 0.000 0.728 0.204 0.000
#> GSM152038     1  0.3424     0.6257 0.760 0.000 0.240 0.000 0.000
#> GSM152042     3  0.2592     0.7942 0.000 0.056 0.892 0.052 0.000
#> GSM152062     1  0.4300     0.0552 0.524 0.000 0.476 0.000 0.000
#> GSM152077     1  0.0703     0.8289 0.976 0.000 0.024 0.000 0.000
#> GSM152088     2  0.0162     0.8327 0.000 0.996 0.004 0.000 0.000
#> GSM152100     4  0.0000     0.7901 0.000 0.000 0.000 1.000 0.000
#> GSM152102     2  0.3362     0.7375 0.000 0.844 0.080 0.000 0.076
#> GSM152104     4  0.4300     0.0506 0.000 0.476 0.000 0.524 0.000
#> GSM152028     1  0.0609     0.8410 0.980 0.000 0.000 0.000 0.020
#> GSM152029     5  0.2504     0.8370 0.040 0.064 0.000 0.000 0.896
#> GSM152049     1  0.4307    -0.1774 0.504 0.000 0.000 0.000 0.496
#> GSM152053     3  0.2241     0.7984 0.076 0.008 0.908 0.008 0.000
#> GSM152059     5  0.2179     0.8524 0.112 0.000 0.000 0.000 0.888
#> GSM152085     5  0.2519     0.8522 0.100 0.000 0.000 0.016 0.884
#> GSM152101     3  0.2124     0.7724 0.000 0.004 0.900 0.000 0.096
#> GSM152105     1  0.0579     0.8382 0.984 0.000 0.008 0.000 0.008
#> GSM152034     5  0.2522     0.8050 0.012 0.000 0.000 0.108 0.880
#> GSM152036     4  0.0000     0.7901 0.000 0.000 0.000 1.000 0.000
#> GSM152040     5  0.2449     0.7848 0.012 0.004 0.080 0.004 0.900
#> GSM152043     5  0.2230     0.8532 0.116 0.000 0.000 0.000 0.884
#> GSM152046     5  0.4054     0.6657 0.028 0.000 0.000 0.224 0.748
#> GSM152047     5  0.1043     0.8107 0.000 0.000 0.040 0.000 0.960
#> GSM152048     1  0.0510     0.8406 0.984 0.000 0.000 0.000 0.016
#> GSM152050     5  0.4588     0.7851 0.136 0.000 0.000 0.116 0.748
#> GSM152052     1  0.1341     0.8338 0.944 0.000 0.000 0.000 0.056
#> GSM152056     1  0.2074     0.8290 0.920 0.000 0.000 0.036 0.044
#> GSM152060     4  0.5052     0.2359 0.036 0.000 0.000 0.552 0.412
#> GSM152065     1  0.4868     0.6633 0.720 0.004 0.084 0.000 0.192
#> GSM152066     1  0.1851     0.8129 0.912 0.000 0.000 0.000 0.088
#> GSM152069     3  0.5632     0.6069 0.000 0.140 0.628 0.000 0.232
#> GSM152070     5  0.1892     0.7885 0.000 0.004 0.080 0.000 0.916
#> GSM152071     3  0.5354     0.4742 0.028 0.028 0.620 0.000 0.324
#> GSM152072     5  0.2170     0.7812 0.004 0.004 0.088 0.000 0.904
#> GSM152073     5  0.2074     0.8541 0.104 0.000 0.000 0.000 0.896
#> GSM152078     5  0.3642     0.7647 0.232 0.008 0.000 0.000 0.760
#> GSM152082     5  0.2773     0.8451 0.112 0.000 0.020 0.000 0.868
#> GSM152086     5  0.3579     0.7585 0.240 0.000 0.000 0.004 0.756
#> GSM152090     5  0.6927     0.5361 0.168 0.052 0.224 0.000 0.556
#> GSM152092     1  0.3810     0.7125 0.792 0.000 0.040 0.000 0.168
#> GSM152093     1  0.1597     0.8363 0.940 0.000 0.000 0.012 0.048
#> GSM152094     5  0.2020     0.8537 0.100 0.000 0.000 0.000 0.900
#> GSM152098     5  0.0609     0.8366 0.020 0.000 0.000 0.000 0.980
#> GSM152110     1  0.1992     0.8288 0.924 0.000 0.000 0.044 0.032
#> GSM152031     1  0.4088     0.3106 0.632 0.000 0.000 0.000 0.368
#> GSM152037     1  0.0794     0.8405 0.972 0.000 0.000 0.000 0.028
#> GSM152055     4  0.2932     0.7310 0.032 0.000 0.000 0.864 0.104
#> GSM152061     4  0.4326     0.5594 0.028 0.000 0.000 0.708 0.264
#> GSM152064     4  0.4871     0.3373 0.024 0.000 0.004 0.604 0.368
#> GSM152087     5  0.2179     0.8538 0.100 0.000 0.000 0.004 0.896
#> GSM152103     5  0.5175     0.6816 0.272 0.036 0.024 0.000 0.668

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.0547     0.7102 0.020 0.000 0.980 0.000 0.000 0.000
#> GSM152033     1  0.1327     0.8185 0.936 0.000 0.000 0.000 0.064 0.000
#> GSM152063     2  0.0837     0.8926 0.004 0.972 0.000 0.020 0.004 0.000
#> GSM152074     3  0.2432     0.6615 0.100 0.000 0.876 0.000 0.024 0.000
#> GSM152080     2  0.0000     0.8924 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152081     4  0.4509     0.1571 0.000 0.000 0.436 0.532 0.032 0.000
#> GSM152083     3  0.4850     0.1921 0.016 0.440 0.516 0.000 0.028 0.000
#> GSM152091     2  0.0146     0.8928 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM152108     1  0.2201     0.8068 0.900 0.048 0.000 0.000 0.052 0.000
#> GSM152114     1  0.2159     0.8302 0.904 0.000 0.000 0.012 0.072 0.012
#> GSM152035     2  0.2554     0.8374 0.012 0.880 0.000 0.020 0.088 0.000
#> GSM152039     4  0.0260     0.7981 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM152041     4  0.1701     0.7895 0.000 0.000 0.000 0.920 0.072 0.008
#> GSM152044     2  0.1913     0.8582 0.000 0.908 0.000 0.080 0.012 0.000
#> GSM152045     5  0.2890     0.6747 0.004 0.000 0.004 0.028 0.856 0.108
#> GSM152051     2  0.0260     0.8947 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM152054     5  0.4113     0.6569 0.112 0.044 0.000 0.036 0.796 0.012
#> GSM152057     2  0.1950     0.8772 0.008 0.924 0.004 0.044 0.020 0.000
#> GSM152058     1  0.0865     0.8431 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM152067     3  0.2791     0.6776 0.000 0.008 0.852 0.000 0.124 0.016
#> GSM152068     2  0.0508     0.8943 0.000 0.984 0.000 0.012 0.004 0.000
#> GSM152075     4  0.0951     0.7984 0.000 0.000 0.008 0.968 0.020 0.004
#> GSM152076     4  0.0000     0.7973 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM152079     2  0.0260     0.8947 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM152084     3  0.4295     0.5834 0.160 0.000 0.728 0.000 0.112 0.000
#> GSM152089     5  0.3592     0.6337 0.000 0.012 0.004 0.156 0.800 0.028
#> GSM152095     4  0.0858     0.7964 0.000 0.000 0.004 0.968 0.028 0.000
#> GSM152096     2  0.3714     0.4430 0.340 0.656 0.000 0.000 0.004 0.000
#> GSM152097     4  0.2740     0.7184 0.000 0.120 0.000 0.852 0.028 0.000
#> GSM152099     3  0.4147     0.2315 0.000 0.436 0.552 0.012 0.000 0.000
#> GSM152106     4  0.1789     0.7703 0.000 0.044 0.000 0.924 0.032 0.000
#> GSM152107     3  0.1152     0.7088 0.000 0.000 0.952 0.004 0.044 0.000
#> GSM152109     3  0.2274     0.6967 0.000 0.008 0.892 0.000 0.088 0.012
#> GSM152111     6  0.3170     0.7993 0.036 0.000 0.000 0.052 0.056 0.856
#> GSM152112     5  0.4474     0.5880 0.000 0.000 0.188 0.108 0.704 0.000
#> GSM152113     1  0.1863     0.7994 0.896 0.000 0.000 0.000 0.104 0.000
#> GSM152115     5  0.3650     0.5561 0.008 0.000 0.272 0.004 0.716 0.000
#> GSM152030     3  0.3915     0.4732 0.004 0.000 0.704 0.272 0.020 0.000
#> GSM152038     1  0.4179     0.6962 0.760 0.000 0.144 0.000 0.084 0.012
#> GSM152042     3  0.0653     0.7116 0.004 0.000 0.980 0.004 0.012 0.000
#> GSM152062     1  0.4903     0.0645 0.476 0.000 0.464 0.000 0.060 0.000
#> GSM152077     1  0.0632     0.8336 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM152088     2  0.0000     0.8924 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152100     4  0.1714     0.7720 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM152102     5  0.4046     0.3604 0.004 0.368 0.000 0.008 0.620 0.000
#> GSM152104     2  0.4319     0.4769 0.000 0.620 0.000 0.348 0.032 0.000
#> GSM152028     1  0.0520     0.8398 0.984 0.000 0.000 0.000 0.008 0.008
#> GSM152029     6  0.2912     0.7642 0.000 0.028 0.012 0.000 0.104 0.856
#> GSM152049     6  0.4443     0.5005 0.328 0.000 0.000 0.012 0.024 0.636
#> GSM152053     3  0.0551     0.7070 0.004 0.000 0.984 0.004 0.008 0.000
#> GSM152059     6  0.0291     0.8076 0.004 0.000 0.000 0.000 0.004 0.992
#> GSM152085     6  0.0964     0.8077 0.012 0.000 0.000 0.016 0.004 0.968
#> GSM152101     5  0.3907     0.3573 0.000 0.000 0.408 0.004 0.588 0.000
#> GSM152105     1  0.1408     0.8435 0.944 0.000 0.000 0.000 0.020 0.036
#> GSM152034     6  0.1882     0.7998 0.000 0.000 0.008 0.012 0.060 0.920
#> GSM152036     4  0.0972     0.7940 0.000 0.000 0.000 0.964 0.028 0.008
#> GSM152040     5  0.4082     0.6643 0.028 0.000 0.000 0.028 0.752 0.192
#> GSM152043     6  0.2737     0.7940 0.044 0.000 0.004 0.000 0.084 0.868
#> GSM152046     6  0.3189     0.6802 0.000 0.000 0.000 0.184 0.020 0.796
#> GSM152047     6  0.2913     0.6616 0.000 0.000 0.004 0.004 0.180 0.812
#> GSM152048     1  0.1297     0.8428 0.948 0.000 0.000 0.000 0.012 0.040
#> GSM152050     6  0.2540     0.7791 0.020 0.000 0.000 0.104 0.004 0.872
#> GSM152052     1  0.2482     0.7842 0.848 0.000 0.000 0.000 0.004 0.148
#> GSM152056     1  0.2834     0.8004 0.852 0.000 0.000 0.008 0.020 0.120
#> GSM152060     4  0.4833     0.2773 0.000 0.000 0.000 0.516 0.056 0.428
#> GSM152065     5  0.3890     0.2763 0.400 0.000 0.000 0.000 0.596 0.004
#> GSM152066     1  0.3578     0.7502 0.784 0.000 0.000 0.000 0.052 0.164
#> GSM152069     3  0.5628     0.4112 0.000 0.016 0.564 0.000 0.124 0.296
#> GSM152070     5  0.3706     0.4519 0.000 0.000 0.000 0.000 0.620 0.380
#> GSM152071     3  0.5777     0.2648 0.000 0.016 0.500 0.000 0.120 0.364
#> GSM152072     5  0.3986     0.4321 0.004 0.004 0.004 0.000 0.648 0.340
#> GSM152073     6  0.0405     0.8081 0.008 0.000 0.000 0.000 0.004 0.988
#> GSM152078     6  0.2846     0.7692 0.140 0.016 0.000 0.000 0.004 0.840
#> GSM152082     6  0.4535     0.4761 0.060 0.000 0.000 0.000 0.296 0.644
#> GSM152086     6  0.2149     0.7883 0.104 0.000 0.000 0.004 0.004 0.888
#> GSM152090     6  0.5679     0.6445 0.052 0.036 0.132 0.000 0.092 0.688
#> GSM152092     1  0.5142     0.1420 0.488 0.000 0.000 0.000 0.428 0.084
#> GSM152093     1  0.4184     0.7613 0.768 0.000 0.000 0.016 0.108 0.108
#> GSM152094     6  0.0865     0.8061 0.000 0.000 0.000 0.000 0.036 0.964
#> GSM152098     6  0.2191     0.7535 0.000 0.000 0.004 0.000 0.120 0.876
#> GSM152110     1  0.2231     0.8355 0.908 0.000 0.000 0.016 0.048 0.028
#> GSM152031     6  0.3950     0.2387 0.432 0.000 0.000 0.000 0.004 0.564
#> GSM152037     1  0.1492     0.8407 0.940 0.000 0.000 0.000 0.036 0.024
#> GSM152055     4  0.3306     0.7238 0.008 0.000 0.000 0.820 0.036 0.136
#> GSM152061     4  0.4167     0.4584 0.000 0.000 0.000 0.612 0.020 0.368
#> GSM152064     4  0.4596     0.5960 0.000 0.000 0.000 0.672 0.088 0.240
#> GSM152087     6  0.0653     0.8086 0.004 0.000 0.000 0.004 0.012 0.980
#> GSM152103     6  0.5130     0.6986 0.148 0.048 0.020 0.000 0.064 0.720

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 specimen(p) k
#> MAD:NMF 87    3.20e-08 2
#> MAD:NMF 62    3.93e-05 3
#> MAD:NMF 51    3.25e-06 4
#> MAD:NMF 76    3.49e-04 5
#> MAD:NMF 69    1.72e-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.


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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.287           0.581       0.816         0.4277 0.589   0.589
#> 3 3 0.302           0.417       0.655         0.3744 0.714   0.549
#> 4 4 0.453           0.541       0.748         0.1943 0.767   0.477
#> 5 5 0.508           0.562       0.733         0.0668 0.909   0.693
#> 6 6 0.586           0.530       0.718         0.0379 0.972   0.886

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
#> GSM152032     1  0.4022     0.7137 0.920 0.080
#> GSM152033     1  0.0000     0.7341 1.000 0.000
#> GSM152063     2  0.0376     0.7858 0.004 0.996
#> GSM152074     1  0.0000     0.7341 1.000 0.000
#> GSM152080     1  0.8443     0.5906 0.728 0.272
#> GSM152081     2  0.8861     0.5202 0.304 0.696
#> GSM152083     1  0.4022     0.7137 0.920 0.080
#> GSM152091     1  0.9754     0.3571 0.592 0.408
#> GSM152108     2  0.9998    -0.1736 0.492 0.508
#> GSM152114     1  0.9998     0.1311 0.508 0.492
#> GSM152035     1  0.9000     0.5260 0.684 0.316
#> GSM152039     2  0.0376     0.7867 0.004 0.996
#> GSM152041     2  0.8327     0.5863 0.264 0.736
#> GSM152044     2  0.0000     0.7860 0.000 1.000
#> GSM152045     1  0.0376     0.7351 0.996 0.004
#> GSM152051     2  0.0376     0.7858 0.004 0.996
#> GSM152054     1  0.1633     0.7376 0.976 0.024
#> GSM152057     2  0.0376     0.7858 0.004 0.996
#> GSM152058     1  0.9944     0.2516 0.544 0.456
#> GSM152067     1  0.2778     0.7234 0.952 0.048
#> GSM152068     2  0.0376     0.7858 0.004 0.996
#> GSM152075     2  0.7950     0.6208 0.240 0.760
#> GSM152076     2  0.0376     0.7867 0.004 0.996
#> GSM152079     2  0.0376     0.7858 0.004 0.996
#> GSM152084     1  0.6048     0.7073 0.852 0.148
#> GSM152089     2  0.9881     0.0557 0.436 0.564
#> GSM152095     2  0.0376     0.7867 0.004 0.996
#> GSM152096     1  0.6048     0.7073 0.852 0.148
#> GSM152097     2  0.0000     0.7860 0.000 1.000
#> GSM152099     2  0.0376     0.7858 0.004 0.996
#> GSM152106     2  0.0000     0.7860 0.000 1.000
#> GSM152107     1  0.6343     0.7022 0.840 0.160
#> GSM152109     1  0.3879     0.7129 0.924 0.076
#> GSM152111     1  0.9963     0.2315 0.536 0.464
#> GSM152112     1  0.6247     0.7030 0.844 0.156
#> GSM152113     1  0.6048     0.7073 0.852 0.148
#> GSM152115     1  0.0938     0.7363 0.988 0.012
#> GSM152030     2  0.8763     0.5335 0.296 0.704
#> GSM152038     1  0.0672     0.7366 0.992 0.008
#> GSM152042     2  0.9087     0.4651 0.324 0.676
#> GSM152062     1  0.6048     0.7073 0.852 0.148
#> GSM152077     1  0.9909     0.2652 0.556 0.444
#> GSM152088     2  0.6887     0.6559 0.184 0.816
#> GSM152100     2  0.7950     0.6208 0.240 0.760
#> GSM152102     1  0.1843     0.7374 0.972 0.028
#> GSM152104     2  0.0000     0.7860 0.000 1.000
#> GSM152028     1  0.0000     0.7341 1.000 0.000
#> GSM152029     1  0.5059     0.7176 0.888 0.112
#> GSM152049     1  0.9933     0.2612 0.548 0.452
#> GSM152053     2  0.9087     0.4651 0.324 0.676
#> GSM152059     1  0.2236     0.7378 0.964 0.036
#> GSM152085     1  0.9922     0.2700 0.552 0.448
#> GSM152101     1  0.1843     0.7366 0.972 0.028
#> GSM152105     1  0.0672     0.7366 0.992 0.008
#> GSM152034     1  0.9970     0.2186 0.532 0.468
#> GSM152036     2  0.0376     0.7867 0.004 0.996
#> GSM152040     1  0.4939     0.7167 0.892 0.108
#> GSM152043     1  0.5408     0.7069 0.876 0.124
#> GSM152046     1  0.9977     0.2071 0.528 0.472
#> GSM152047     1  0.5059     0.7152 0.888 0.112
#> GSM152048     1  0.9944     0.2516 0.544 0.456
#> GSM152050     1  0.9963     0.2315 0.536 0.464
#> GSM152052     1  0.1843     0.7379 0.972 0.028
#> GSM152056     1  0.9944     0.2516 0.544 0.456
#> GSM152060     1  0.9977     0.2071 0.528 0.472
#> GSM152065     1  0.0000     0.7341 1.000 0.000
#> GSM152066     1  0.9427     0.4364 0.640 0.360
#> GSM152069     1  0.3879     0.7129 0.924 0.076
#> GSM152070     1  0.0000     0.7341 1.000 0.000
#> GSM152071     1  0.3879     0.7129 0.924 0.076
#> GSM152072     1  0.0000     0.7341 1.000 0.000
#> GSM152073     1  0.5946     0.6980 0.856 0.144
#> GSM152078     1  0.0672     0.7366 0.992 0.008
#> GSM152082     1  0.0000     0.7341 1.000 0.000
#> GSM152086     1  0.9754     0.3518 0.592 0.408
#> GSM152090     1  0.6048     0.7066 0.852 0.148
#> GSM152092     1  0.4022     0.7268 0.920 0.080
#> GSM152093     1  0.9988     0.1697 0.520 0.480
#> GSM152094     1  0.6247     0.6907 0.844 0.156
#> GSM152098     1  0.0000     0.7341 1.000 0.000
#> GSM152110     1  0.9944     0.2527 0.544 0.456
#> GSM152031     1  0.0672     0.7366 0.992 0.008
#> GSM152037     1  0.9427     0.4364 0.640 0.360
#> GSM152055     1  0.9977     0.2071 0.528 0.472
#> GSM152061     1  0.9977     0.2071 0.528 0.472
#> GSM152064     2  1.0000    -0.1415 0.496 0.504
#> GSM152087     1  0.6247     0.6907 0.844 0.156
#> GSM152103     1  0.6048     0.7066 0.852 0.148

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.3607     0.6301 0.112 0.008 0.880
#> GSM152033     1  0.6126     0.0188 0.600 0.000 0.400
#> GSM152063     2  0.2590     0.7344 0.004 0.924 0.072
#> GSM152074     1  0.6308    -0.2128 0.508 0.000 0.492
#> GSM152080     3  0.4555     0.4129 0.000 0.200 0.800
#> GSM152081     2  0.6825     0.2077 0.488 0.500 0.012
#> GSM152083     3  0.3607     0.6301 0.112 0.008 0.880
#> GSM152091     3  0.5810     0.2229 0.000 0.336 0.664
#> GSM152108     1  0.9212     0.2378 0.516 0.304 0.180
#> GSM152114     1  0.6082     0.4025 0.692 0.296 0.012
#> GSM152035     3  0.9722     0.4279 0.312 0.244 0.444
#> GSM152039     2  0.4261     0.7353 0.140 0.848 0.012
#> GSM152041     2  0.7029     0.3365 0.440 0.540 0.020
#> GSM152044     2  0.0424     0.7428 0.008 0.992 0.000
#> GSM152045     1  0.6079     0.0336 0.612 0.000 0.388
#> GSM152051     2  0.2590     0.7344 0.004 0.924 0.072
#> GSM152054     1  0.6931    -0.2161 0.528 0.016 0.456
#> GSM152057     2  0.2590     0.7344 0.004 0.924 0.072
#> GSM152058     1  0.5365     0.4698 0.744 0.252 0.004
#> GSM152067     3  0.4605     0.6126 0.204 0.000 0.796
#> GSM152068     2  0.2590     0.7344 0.004 0.924 0.072
#> GSM152075     2  0.6950     0.4020 0.408 0.572 0.020
#> GSM152076     2  0.4261     0.7353 0.140 0.848 0.012
#> GSM152079     2  0.2590     0.7344 0.004 0.924 0.072
#> GSM152084     3  0.7114     0.5781 0.388 0.028 0.584
#> GSM152089     2  0.9964    -0.0291 0.328 0.372 0.300
#> GSM152095     2  0.4261     0.7353 0.140 0.848 0.012
#> GSM152096     3  0.7099     0.5833 0.384 0.028 0.588
#> GSM152097     2  0.1529     0.7544 0.040 0.960 0.000
#> GSM152099     2  0.2590     0.7344 0.004 0.924 0.072
#> GSM152106     2  0.1529     0.7544 0.040 0.960 0.000
#> GSM152107     3  0.7379     0.5814 0.376 0.040 0.584
#> GSM152109     3  0.1753     0.6346 0.048 0.000 0.952
#> GSM152111     1  0.5178     0.4617 0.744 0.256 0.000
#> GSM152112     3  0.7584     0.3403 0.472 0.040 0.488
#> GSM152113     3  0.7099     0.5833 0.384 0.028 0.588
#> GSM152115     1  0.6500    -0.1958 0.532 0.004 0.464
#> GSM152030     2  0.6822     0.2327 0.480 0.508 0.012
#> GSM152038     1  0.5254     0.2849 0.736 0.000 0.264
#> GSM152042     1  0.7919    -0.2232 0.480 0.464 0.056
#> GSM152062     3  0.7099     0.5833 0.384 0.028 0.588
#> GSM152077     1  0.7277     0.4490 0.660 0.280 0.060
#> GSM152088     2  0.5138     0.5379 0.000 0.748 0.252
#> GSM152100     2  0.6950     0.4020 0.408 0.572 0.020
#> GSM152102     3  0.7295     0.2482 0.480 0.028 0.492
#> GSM152104     2  0.1529     0.7544 0.040 0.960 0.000
#> GSM152028     1  0.5497     0.2498 0.708 0.000 0.292
#> GSM152029     3  0.6247     0.5851 0.376 0.004 0.620
#> GSM152049     1  0.5325     0.4742 0.748 0.248 0.004
#> GSM152053     1  0.7919    -0.2232 0.480 0.464 0.056
#> GSM152059     1  0.4654     0.3333 0.792 0.000 0.208
#> GSM152085     1  0.5285     0.4779 0.752 0.244 0.004
#> GSM152101     1  0.6822    -0.2600 0.508 0.012 0.480
#> GSM152105     1  0.5254     0.2849 0.736 0.000 0.264
#> GSM152034     1  0.5803     0.4552 0.736 0.248 0.016
#> GSM152036     2  0.4261     0.7353 0.140 0.848 0.012
#> GSM152040     1  0.5850     0.4126 0.772 0.040 0.188
#> GSM152043     1  0.5947     0.4360 0.776 0.052 0.172
#> GSM152046     1  0.5698     0.4504 0.736 0.252 0.012
#> GSM152047     1  0.5746     0.4196 0.780 0.040 0.180
#> GSM152048     1  0.5365     0.4698 0.744 0.252 0.004
#> GSM152050     1  0.5178     0.4617 0.744 0.256 0.000
#> GSM152052     1  0.5178     0.2813 0.744 0.000 0.256
#> GSM152056     1  0.5365     0.4698 0.744 0.252 0.004
#> GSM152060     1  0.5698     0.4504 0.736 0.252 0.012
#> GSM152065     1  0.5882     0.1441 0.652 0.000 0.348
#> GSM152066     1  0.5402     0.5330 0.792 0.180 0.028
#> GSM152069     3  0.1860     0.6368 0.052 0.000 0.948
#> GSM152070     1  0.5529     0.2432 0.704 0.000 0.296
#> GSM152071     3  0.1860     0.6368 0.052 0.000 0.948
#> GSM152072     1  0.6095     0.0309 0.608 0.000 0.392
#> GSM152073     1  0.4137     0.4648 0.872 0.032 0.096
#> GSM152078     1  0.5254     0.2849 0.736 0.000 0.264
#> GSM152082     1  0.5529     0.2412 0.704 0.000 0.296
#> GSM152086     1  0.5061     0.5063 0.784 0.208 0.008
#> GSM152090     3  0.7143     0.5737 0.396 0.028 0.576
#> GSM152092     1  0.4749     0.4038 0.816 0.012 0.172
#> GSM152093     1  0.6420     0.4207 0.688 0.288 0.024
#> GSM152094     1  0.4289     0.4716 0.868 0.040 0.092
#> GSM152098     1  0.5465     0.2547 0.712 0.000 0.288
#> GSM152110     1  0.5098     0.4718 0.752 0.248 0.000
#> GSM152031     1  0.5254     0.2849 0.736 0.000 0.264
#> GSM152037     1  0.5402     0.5330 0.792 0.180 0.028
#> GSM152055     1  0.5698     0.4504 0.736 0.252 0.012
#> GSM152061     1  0.5698     0.4504 0.736 0.252 0.012
#> GSM152064     1  0.6262     0.4017 0.696 0.284 0.020
#> GSM152087     1  0.4289     0.4716 0.868 0.040 0.092
#> GSM152103     3  0.7143     0.5737 0.396 0.028 0.576

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     4  0.4790     0.4533 0.000 0.000 0.380 0.620
#> GSM152033     3  0.2281     0.4924 0.000 0.000 0.904 0.096
#> GSM152063     2  0.2921     0.7939 0.000 0.860 0.000 0.140
#> GSM152074     3  0.3400     0.4003 0.000 0.000 0.820 0.180
#> GSM152080     4  0.2345     0.3545 0.000 0.100 0.000 0.900
#> GSM152081     1  0.4993     0.6053 0.728 0.244 0.008 0.020
#> GSM152083     4  0.4790     0.4533 0.000 0.000 0.380 0.620
#> GSM152091     4  0.3942     0.1090 0.000 0.236 0.000 0.764
#> GSM152108     1  0.8048     0.4626 0.588 0.088 0.156 0.168
#> GSM152114     1  0.3094     0.7783 0.900 0.032 0.048 0.020
#> GSM152035     4  0.8508     0.1925 0.056 0.152 0.368 0.424
#> GSM152039     2  0.4524     0.6665 0.204 0.768 0.000 0.028
#> GSM152041     1  0.5886     0.4764 0.640 0.316 0.016 0.028
#> GSM152044     2  0.1637     0.7921 0.000 0.940 0.000 0.060
#> GSM152045     3  0.3796     0.4914 0.056 0.000 0.848 0.096
#> GSM152051     2  0.2921     0.7939 0.000 0.860 0.000 0.140
#> GSM152054     3  0.5840     0.2902 0.060 0.004 0.672 0.264
#> GSM152057     2  0.2921     0.7939 0.000 0.860 0.000 0.140
#> GSM152058     1  0.0336     0.7978 0.992 0.000 0.008 0.000
#> GSM152067     4  0.4967     0.3719 0.000 0.000 0.452 0.548
#> GSM152068     2  0.2921     0.7939 0.000 0.860 0.000 0.140
#> GSM152075     1  0.6031     0.4016 0.608 0.348 0.016 0.028
#> GSM152076     2  0.4524     0.6665 0.204 0.768 0.000 0.028
#> GSM152079     2  0.2921     0.7939 0.000 0.860 0.000 0.140
#> GSM152084     4  0.7568     0.4389 0.148 0.008 0.408 0.436
#> GSM152089     2  0.9996    -0.1968 0.252 0.256 0.236 0.256
#> GSM152095     2  0.4524     0.6665 0.204 0.768 0.000 0.028
#> GSM152096     4  0.7536     0.4434 0.144 0.008 0.408 0.440
#> GSM152097     2  0.0000     0.7876 0.000 1.000 0.000 0.000
#> GSM152099     2  0.2921     0.7939 0.000 0.860 0.000 0.140
#> GSM152106     2  0.0000     0.7876 0.000 1.000 0.000 0.000
#> GSM152107     4  0.7633     0.4475 0.144 0.012 0.392 0.452
#> GSM152109     4  0.4382     0.5202 0.000 0.000 0.296 0.704
#> GSM152111     1  0.0564     0.7993 0.988 0.004 0.004 0.004
#> GSM152112     3  0.7108     0.1097 0.124 0.020 0.608 0.248
#> GSM152113     4  0.7536     0.4434 0.144 0.008 0.408 0.440
#> GSM152115     3  0.5184     0.3473 0.060 0.000 0.736 0.204
#> GSM152030     1  0.5055     0.5966 0.720 0.252 0.008 0.020
#> GSM152038     3  0.3636     0.5921 0.172 0.000 0.820 0.008
#> GSM152042     1  0.5882     0.6120 0.708 0.212 0.016 0.064
#> GSM152062     4  0.7536     0.4434 0.144 0.008 0.408 0.440
#> GSM152077     1  0.4952     0.7122 0.796 0.028 0.132 0.044
#> GSM152088     2  0.4564     0.6134 0.000 0.672 0.000 0.328
#> GSM152100     1  0.6031     0.4016 0.608 0.348 0.016 0.028
#> GSM152102     3  0.6226     0.1906 0.056 0.008 0.616 0.320
#> GSM152104     2  0.0000     0.7876 0.000 1.000 0.000 0.000
#> GSM152028     3  0.2737     0.6028 0.104 0.000 0.888 0.008
#> GSM152029     3  0.7120    -0.4208 0.128 0.000 0.436 0.436
#> GSM152049     1  0.0469     0.7977 0.988 0.000 0.012 0.000
#> GSM152053     1  0.5882     0.6120 0.708 0.212 0.016 0.064
#> GSM152059     3  0.4748     0.5163 0.268 0.000 0.716 0.016
#> GSM152085     1  0.0592     0.7964 0.984 0.000 0.016 0.000
#> GSM152101     3  0.5572     0.3018 0.060 0.004 0.708 0.228
#> GSM152105     3  0.3636     0.5921 0.172 0.000 0.820 0.008
#> GSM152034     1  0.0657     0.7989 0.984 0.000 0.004 0.012
#> GSM152036     2  0.4524     0.6665 0.204 0.768 0.000 0.028
#> GSM152040     3  0.5168     0.1131 0.492 0.000 0.504 0.004
#> GSM152043     1  0.4985    -0.0481 0.532 0.000 0.468 0.000
#> GSM152046     1  0.0336     0.7989 0.992 0.000 0.000 0.008
#> GSM152047     3  0.5000     0.0952 0.500 0.000 0.500 0.000
#> GSM152048     1  0.0336     0.7978 0.992 0.000 0.008 0.000
#> GSM152050     1  0.0564     0.7993 0.988 0.004 0.004 0.004
#> GSM152052     3  0.4888     0.5178 0.224 0.000 0.740 0.036
#> GSM152056     1  0.0336     0.7978 0.992 0.000 0.008 0.000
#> GSM152060     1  0.0336     0.7989 0.992 0.000 0.000 0.008
#> GSM152065     3  0.2111     0.5468 0.024 0.000 0.932 0.044
#> GSM152066     1  0.2589     0.7182 0.884 0.000 0.116 0.000
#> GSM152069     4  0.4406     0.5208 0.000 0.000 0.300 0.700
#> GSM152070     3  0.2345     0.6013 0.100 0.000 0.900 0.000
#> GSM152071     4  0.4406     0.5208 0.000 0.000 0.300 0.700
#> GSM152072     3  0.2730     0.5168 0.016 0.000 0.896 0.088
#> GSM152073     1  0.4837     0.2604 0.648 0.000 0.348 0.004
#> GSM152078     3  0.3636     0.5921 0.172 0.000 0.820 0.008
#> GSM152082     3  0.2216     0.5984 0.092 0.000 0.908 0.000
#> GSM152086     1  0.1637     0.7706 0.940 0.000 0.060 0.000
#> GSM152090     4  0.7539     0.4335 0.144 0.008 0.416 0.432
#> GSM152092     3  0.4992     0.1780 0.476 0.000 0.524 0.000
#> GSM152093     1  0.3877     0.7623 0.860 0.032 0.084 0.024
#> GSM152094     1  0.4781     0.2922 0.660 0.000 0.336 0.004
#> GSM152098     3  0.2469     0.6024 0.108 0.000 0.892 0.000
#> GSM152110     1  0.0779     0.7984 0.980 0.004 0.016 0.000
#> GSM152031     3  0.3636     0.5921 0.172 0.000 0.820 0.008
#> GSM152037     1  0.2589     0.7182 0.884 0.000 0.116 0.000
#> GSM152055     1  0.0336     0.7989 0.992 0.000 0.000 0.008
#> GSM152061     1  0.0336     0.7989 0.992 0.000 0.000 0.008
#> GSM152064     1  0.2432     0.7890 0.928 0.028 0.020 0.024
#> GSM152087     1  0.4781     0.2922 0.660 0.000 0.336 0.004
#> GSM152103     4  0.7539     0.4335 0.144 0.008 0.416 0.432

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     4  0.4171   0.627955 0.000 0.000 0.112 0.784 0.104
#> GSM152033     5  0.4908   0.245680 0.000 0.000 0.320 0.044 0.636
#> GSM152063     2  0.1851   0.809608 0.000 0.912 0.088 0.000 0.000
#> GSM152074     5  0.6367   0.181982 0.000 0.000 0.232 0.248 0.520
#> GSM152080     4  0.5813   0.458200 0.000 0.084 0.184 0.680 0.052
#> GSM152081     1  0.4793   0.582136 0.708 0.216 0.076 0.000 0.000
#> GSM152083     4  0.4171   0.627955 0.000 0.000 0.112 0.784 0.104
#> GSM152091     4  0.7385   0.281470 0.000 0.212 0.264 0.472 0.052
#> GSM152108     1  0.6602   0.345708 0.552 0.064 0.308 0.000 0.076
#> GSM152114     1  0.2800   0.740484 0.888 0.016 0.072 0.000 0.024
#> GSM152035     3  0.6607   0.242812 0.008 0.196 0.620 0.048 0.128
#> GSM152039     2  0.5275   0.663617 0.200 0.684 0.112 0.004 0.000
#> GSM152041     1  0.5570   0.455435 0.620 0.292 0.080 0.000 0.008
#> GSM152044     2  0.0162   0.804182 0.000 0.996 0.004 0.000 0.000
#> GSM152045     5  0.5421  -0.150434 0.008 0.000 0.448 0.040 0.504
#> GSM152051     2  0.1851   0.809608 0.000 0.912 0.088 0.000 0.000
#> GSM152054     3  0.5716   0.418435 0.008 0.000 0.628 0.108 0.256
#> GSM152057     2  0.1851   0.809608 0.000 0.912 0.088 0.000 0.000
#> GSM152058     1  0.0290   0.768220 0.992 0.000 0.000 0.000 0.008
#> GSM152067     4  0.5237   0.515352 0.000 0.000 0.156 0.684 0.160
#> GSM152068     2  0.1851   0.809608 0.000 0.912 0.088 0.000 0.000
#> GSM152075     1  0.5564   0.393307 0.596 0.328 0.068 0.000 0.008
#> GSM152076     2  0.5275   0.663617 0.200 0.684 0.112 0.004 0.000
#> GSM152079     2  0.1851   0.809608 0.000 0.912 0.088 0.000 0.000
#> GSM152084     3  0.7996   0.501943 0.104 0.000 0.396 0.296 0.204
#> GSM152089     3  0.8726   0.216177 0.212 0.232 0.416 0.064 0.076
#> GSM152095     2  0.5275   0.663617 0.200 0.684 0.112 0.004 0.000
#> GSM152096     3  0.7962   0.504749 0.100 0.000 0.400 0.296 0.204
#> GSM152097     2  0.1638   0.795364 0.000 0.932 0.064 0.004 0.000
#> GSM152099     2  0.1851   0.809608 0.000 0.912 0.088 0.000 0.000
#> GSM152106     2  0.1638   0.795364 0.000 0.932 0.064 0.004 0.000
#> GSM152107     3  0.7788   0.486036 0.100 0.004 0.460 0.284 0.152
#> GSM152109     4  0.2677   0.663101 0.000 0.000 0.016 0.872 0.112
#> GSM152111     1  0.0162   0.769134 0.996 0.000 0.004 0.000 0.000
#> GSM152112     3  0.6650   0.445333 0.068 0.012 0.608 0.072 0.240
#> GSM152113     3  0.7962   0.504749 0.100 0.000 0.400 0.296 0.204
#> GSM152115     3  0.5963   0.391153 0.008 0.000 0.560 0.100 0.332
#> GSM152030     1  0.4850   0.573406 0.700 0.224 0.076 0.000 0.000
#> GSM152038     5  0.3320   0.696761 0.164 0.000 0.004 0.012 0.820
#> GSM152042     1  0.5169   0.586772 0.688 0.184 0.128 0.000 0.000
#> GSM152062     3  0.7962   0.504749 0.100 0.000 0.400 0.296 0.204
#> GSM152077     1  0.4283   0.668868 0.780 0.004 0.136 0.000 0.080
#> GSM152088     2  0.5017   0.609486 0.000 0.724 0.112 0.156 0.008
#> GSM152100     1  0.5564   0.393307 0.596 0.328 0.068 0.000 0.008
#> GSM152102     3  0.5810   0.383181 0.008 0.000 0.632 0.136 0.224
#> GSM152104     2  0.1638   0.795364 0.000 0.932 0.064 0.004 0.000
#> GSM152028     5  0.2720   0.687802 0.096 0.000 0.020 0.004 0.880
#> GSM152029     4  0.8181  -0.353154 0.112 0.000 0.280 0.356 0.252
#> GSM152049     1  0.0451   0.768630 0.988 0.000 0.004 0.000 0.008
#> GSM152053     1  0.5169   0.586772 0.688 0.184 0.128 0.000 0.000
#> GSM152059     5  0.4065   0.606126 0.264 0.000 0.000 0.016 0.720
#> GSM152085     1  0.0579   0.768125 0.984 0.000 0.008 0.000 0.008
#> GSM152101     3  0.5798   0.424087 0.008 0.000 0.596 0.096 0.300
#> GSM152105     5  0.3320   0.696761 0.164 0.000 0.004 0.012 0.820
#> GSM152034     1  0.0865   0.768991 0.972 0.000 0.024 0.000 0.004
#> GSM152036     2  0.5275   0.663617 0.200 0.684 0.112 0.004 0.000
#> GSM152040     1  0.5440   0.000548 0.476 0.000 0.048 0.004 0.472
#> GSM152043     1  0.5303   0.107526 0.516 0.000 0.040 0.004 0.440
#> GSM152046     1  0.0566   0.769354 0.984 0.000 0.012 0.000 0.004
#> GSM152047     1  0.5381   0.016164 0.484 0.000 0.044 0.004 0.468
#> GSM152048     1  0.0290   0.768220 0.992 0.000 0.000 0.000 0.008
#> GSM152050     1  0.0162   0.769134 0.996 0.000 0.004 0.000 0.000
#> GSM152052     5  0.4862   0.602863 0.220 0.000 0.004 0.068 0.708
#> GSM152056     1  0.0290   0.768220 0.992 0.000 0.000 0.000 0.008
#> GSM152060     1  0.0566   0.769354 0.984 0.000 0.012 0.000 0.004
#> GSM152065     5  0.3398   0.535314 0.024 0.000 0.144 0.004 0.828
#> GSM152066     1  0.2928   0.701775 0.872 0.000 0.032 0.004 0.092
#> GSM152069     4  0.2727   0.663407 0.000 0.000 0.016 0.868 0.116
#> GSM152070     5  0.2249   0.689445 0.096 0.000 0.008 0.000 0.896
#> GSM152071     4  0.2727   0.663407 0.000 0.000 0.016 0.868 0.116
#> GSM152072     5  0.5033   0.264676 0.016 0.000 0.292 0.032 0.660
#> GSM152073     1  0.5037   0.339262 0.636 0.000 0.036 0.008 0.320
#> GSM152078     5  0.3320   0.696761 0.164 0.000 0.004 0.012 0.820
#> GSM152082     5  0.2351   0.686601 0.088 0.000 0.016 0.000 0.896
#> GSM152086     1  0.1800   0.744519 0.932 0.000 0.020 0.000 0.048
#> GSM152090     3  0.8080   0.488342 0.108 0.000 0.376 0.300 0.216
#> GSM152092     5  0.5318   0.013366 0.460 0.000 0.040 0.004 0.496
#> GSM152093     1  0.3627   0.724237 0.848 0.016 0.092 0.008 0.036
#> GSM152094     1  0.4984   0.366554 0.648 0.000 0.036 0.008 0.308
#> GSM152098     5  0.2358   0.691035 0.104 0.000 0.008 0.000 0.888
#> GSM152110     1  0.0451   0.769075 0.988 0.000 0.004 0.000 0.008
#> GSM152031     5  0.3320   0.696761 0.164 0.000 0.004 0.012 0.820
#> GSM152037     1  0.2928   0.701775 0.872 0.000 0.032 0.004 0.092
#> GSM152055     1  0.0566   0.769354 0.984 0.000 0.012 0.000 0.004
#> GSM152061     1  0.0566   0.769354 0.984 0.000 0.012 0.000 0.004
#> GSM152064     1  0.2251   0.758084 0.916 0.024 0.052 0.000 0.008
#> GSM152087     1  0.4984   0.366554 0.648 0.000 0.036 0.008 0.308
#> GSM152103     3  0.8080   0.488342 0.108 0.000 0.376 0.300 0.216

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.2944    0.64458 0.004 0.000 0.856 0.072 0.068 0.000
#> GSM152033     1  0.5647    0.11092 0.488 0.000 0.028 0.076 0.408 0.000
#> GSM152063     2  0.0000    0.82088 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152074     3  0.7378    0.17673 0.308 0.000 0.324 0.112 0.256 0.000
#> GSM152080     3  0.6482    0.38183 0.056 0.064 0.500 0.348 0.032 0.000
#> GSM152081     6  0.4651    0.51528 0.000 0.124 0.000 0.172 0.004 0.700
#> GSM152083     3  0.2944    0.64458 0.004 0.000 0.856 0.072 0.068 0.000
#> GSM152091     4  0.7548   -0.37849 0.056 0.272 0.292 0.348 0.032 0.000
#> GSM152108     6  0.6611    0.33900 0.008 0.132 0.000 0.088 0.224 0.548
#> GSM152114     6  0.2635    0.70823 0.004 0.008 0.000 0.068 0.036 0.884
#> GSM152035     5  0.5405    0.25760 0.020 0.284 0.004 0.084 0.608 0.000
#> GSM152039     4  0.5753    0.64654 0.000 0.384 0.000 0.444 0.000 0.172
#> GSM152041     6  0.5510    0.35295 0.000 0.164 0.000 0.220 0.012 0.604
#> GSM152044     2  0.2416    0.71215 0.000 0.844 0.000 0.156 0.000 0.000
#> GSM152045     5  0.5142    0.13750 0.292 0.000 0.024 0.064 0.620 0.000
#> GSM152051     2  0.0000    0.82088 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.2906    0.37775 0.028 0.004 0.052 0.040 0.876 0.000
#> GSM152057     2  0.0000    0.82088 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     6  0.0260    0.75490 0.008 0.000 0.000 0.000 0.000 0.992
#> GSM152067     3  0.3724    0.55033 0.028 0.000 0.772 0.012 0.188 0.000
#> GSM152068     2  0.0000    0.82088 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     6  0.5700    0.27143 0.000 0.196 0.000 0.216 0.012 0.576
#> GSM152076     4  0.5753    0.64654 0.000 0.384 0.000 0.444 0.000 0.172
#> GSM152079     2  0.0000    0.82088 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152084     5  0.8567    0.43461 0.108 0.076 0.296 0.048 0.376 0.096
#> GSM152089     5  0.8121    0.07381 0.004 0.248 0.036 0.148 0.372 0.192
#> GSM152095     4  0.5753    0.64654 0.000 0.384 0.000 0.444 0.000 0.172
#> GSM152096     5  0.8536    0.43717 0.108 0.076 0.296 0.048 0.380 0.092
#> GSM152097     2  0.3050    0.63445 0.000 0.764 0.000 0.236 0.000 0.000
#> GSM152099     2  0.0000    0.82088 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152106     2  0.3050    0.63445 0.000 0.764 0.000 0.236 0.000 0.000
#> GSM152107     5  0.8176    0.42707 0.064 0.080 0.288 0.048 0.428 0.092
#> GSM152109     3  0.0692    0.66673 0.020 0.000 0.976 0.000 0.004 0.000
#> GSM152111     6  0.0260    0.75449 0.000 0.000 0.000 0.008 0.000 0.992
#> GSM152112     5  0.6257    0.40453 0.156 0.092 0.044 0.004 0.644 0.060
#> GSM152113     5  0.8536    0.43717 0.108 0.076 0.296 0.048 0.380 0.092
#> GSM152115     5  0.3983    0.37691 0.164 0.000 0.056 0.012 0.768 0.000
#> GSM152030     6  0.4713    0.50517 0.000 0.124 0.000 0.180 0.004 0.692
#> GSM152038     1  0.2615    0.72626 0.852 0.000 0.004 0.008 0.000 0.136
#> GSM152042     6  0.5255    0.50932 0.000 0.140 0.000 0.140 0.040 0.680
#> GSM152062     5  0.8536    0.43717 0.108 0.076 0.296 0.048 0.380 0.092
#> GSM152077     6  0.4073    0.64955 0.016 0.000 0.000 0.084 0.124 0.776
#> GSM152088     2  0.3516    0.57248 0.000 0.812 0.096 0.088 0.004 0.000
#> GSM152100     6  0.5700    0.27143 0.000 0.196 0.000 0.216 0.012 0.576
#> GSM152102     5  0.3512    0.35368 0.028 0.004 0.056 0.076 0.836 0.000
#> GSM152104     2  0.3050    0.63445 0.000 0.764 0.000 0.236 0.000 0.000
#> GSM152028     1  0.3052    0.71392 0.864 0.000 0.004 0.020 0.044 0.068
#> GSM152029     3  0.8160   -0.31439 0.188 0.072 0.360 0.000 0.276 0.104
#> GSM152049     6  0.0405    0.75554 0.008 0.000 0.000 0.000 0.004 0.988
#> GSM152053     6  0.5255    0.50932 0.000 0.140 0.000 0.140 0.040 0.680
#> GSM152059     1  0.3806    0.63354 0.736 0.000 0.012 0.004 0.008 0.240
#> GSM152085     6  0.0665    0.75482 0.008 0.000 0.000 0.004 0.008 0.980
#> GSM152101     5  0.4146    0.38486 0.160 0.012 0.060 0.004 0.764 0.000
#> GSM152105     1  0.2615    0.72626 0.852 0.000 0.004 0.008 0.000 0.136
#> GSM152034     6  0.0964    0.75418 0.004 0.000 0.000 0.016 0.012 0.968
#> GSM152036     4  0.5753    0.64654 0.000 0.384 0.000 0.444 0.000 0.172
#> GSM152040     6  0.5415   -0.02327 0.444 0.000 0.000 0.008 0.088 0.460
#> GSM152043     6  0.5192    0.10529 0.416 0.000 0.000 0.008 0.068 0.508
#> GSM152046     6  0.0603    0.75400 0.004 0.000 0.000 0.016 0.000 0.980
#> GSM152047     6  0.5338   -0.00725 0.444 0.000 0.000 0.008 0.080 0.468
#> GSM152048     6  0.0260    0.75490 0.008 0.000 0.000 0.000 0.000 0.992
#> GSM152050     6  0.0260    0.75449 0.000 0.000 0.000 0.008 0.000 0.992
#> GSM152052     1  0.4800    0.60852 0.716 0.000 0.056 0.024 0.012 0.192
#> GSM152056     6  0.0260    0.75490 0.008 0.000 0.000 0.000 0.000 0.992
#> GSM152060     6  0.0603    0.75400 0.004 0.000 0.000 0.016 0.000 0.980
#> GSM152065     1  0.4516    0.53584 0.704 0.000 0.012 0.064 0.220 0.000
#> GSM152066     6  0.2721    0.69773 0.088 0.000 0.000 0.004 0.040 0.868
#> GSM152069     3  0.0777    0.66747 0.024 0.000 0.972 0.000 0.004 0.000
#> GSM152070     1  0.4311    0.70196 0.792 0.000 0.012 0.064 0.064 0.068
#> GSM152071     3  0.0777    0.66747 0.024 0.000 0.972 0.000 0.004 0.000
#> GSM152072     1  0.5528    0.19723 0.488 0.000 0.028 0.064 0.420 0.000
#> GSM152073     6  0.4702    0.30572 0.332 0.000 0.000 0.004 0.052 0.612
#> GSM152078     1  0.2615    0.72626 0.852 0.000 0.004 0.008 0.000 0.136
#> GSM152082     1  0.4022    0.70076 0.812 0.000 0.012 0.064 0.052 0.060
#> GSM152086     6  0.1844    0.73710 0.048 0.000 0.000 0.004 0.024 0.924
#> GSM152090     5  0.8610    0.41995 0.124 0.076 0.300 0.040 0.360 0.100
#> GSM152092     1  0.5216    0.01686 0.476 0.000 0.000 0.008 0.068 0.448
#> GSM152093     6  0.3469    0.69468 0.016 0.008 0.004 0.068 0.060 0.844
#> GSM152094     6  0.4659    0.33307 0.320 0.000 0.000 0.004 0.052 0.624
#> GSM152098     1  0.4305    0.70496 0.792 0.000 0.012 0.068 0.056 0.072
#> GSM152110     6  0.0436    0.75516 0.004 0.000 0.000 0.004 0.004 0.988
#> GSM152031     1  0.2615    0.72626 0.852 0.000 0.004 0.008 0.000 0.136
#> GSM152037     6  0.2721    0.69773 0.088 0.000 0.000 0.004 0.040 0.868
#> GSM152055     6  0.0603    0.75400 0.004 0.000 0.000 0.016 0.000 0.980
#> GSM152061     6  0.0603    0.75400 0.004 0.000 0.000 0.016 0.000 0.980
#> GSM152064     6  0.2108    0.72957 0.000 0.016 0.000 0.056 0.016 0.912
#> GSM152087     6  0.4659    0.33307 0.320 0.000 0.000 0.004 0.052 0.624
#> GSM152103     5  0.8610    0.41995 0.124 0.076 0.300 0.040 0.360 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-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 specimen(p) k
#> ATC:hclust 63     0.00521 2
#> ATC:hclust 32     0.13036 3
#> ATC:hclust 54     0.00335 4
#> ATC:hclust 60     0.00191 5
#> ATC:hclust 56     0.00565 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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.599           0.808       0.900         0.4793 0.538   0.538
#> 3 3 0.668           0.759       0.872         0.3729 0.736   0.535
#> 4 4 0.541           0.418       0.653         0.1279 0.836   0.562
#> 5 5 0.640           0.685       0.798         0.0681 0.856   0.515
#> 6 6 0.694           0.647       0.771         0.0411 0.946   0.745

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
#> GSM152032     1  0.2778      0.831 0.952 0.048
#> GSM152033     1  0.0376      0.844 0.996 0.004
#> GSM152063     2  0.0000      0.948 0.000 1.000
#> GSM152074     1  0.2778      0.831 0.952 0.048
#> GSM152080     2  0.9323      0.455 0.348 0.652
#> GSM152081     2  0.0376      0.947 0.004 0.996
#> GSM152083     2  0.9323      0.455 0.348 0.652
#> GSM152091     2  0.0000      0.948 0.000 1.000
#> GSM152108     2  0.0000      0.948 0.000 1.000
#> GSM152114     1  0.9710      0.557 0.600 0.400
#> GSM152035     2  0.0000      0.948 0.000 1.000
#> GSM152039     2  0.0376      0.947 0.004 0.996
#> GSM152041     2  0.0376      0.947 0.004 0.996
#> GSM152044     2  0.0000      0.948 0.000 1.000
#> GSM152045     1  0.0000      0.845 1.000 0.000
#> GSM152051     2  0.0000      0.948 0.000 1.000
#> GSM152054     1  0.2603      0.833 0.956 0.044
#> GSM152057     2  0.0000      0.948 0.000 1.000
#> GSM152058     1  0.8207      0.718 0.744 0.256
#> GSM152067     1  0.2778      0.831 0.952 0.048
#> GSM152068     2  0.0000      0.948 0.000 1.000
#> GSM152075     2  0.0376      0.947 0.004 0.996
#> GSM152076     2  0.0376      0.947 0.004 0.996
#> GSM152079     2  0.0000      0.948 0.000 1.000
#> GSM152084     1  0.6801      0.782 0.820 0.180
#> GSM152089     2  0.0000      0.948 0.000 1.000
#> GSM152095     2  0.0000      0.948 0.000 1.000
#> GSM152096     2  0.9993      0.117 0.484 0.516
#> GSM152097     2  0.0000      0.948 0.000 1.000
#> GSM152099     2  0.0000      0.948 0.000 1.000
#> GSM152106     2  0.0000      0.948 0.000 1.000
#> GSM152107     2  0.0000      0.948 0.000 1.000
#> GSM152109     1  0.2778      0.831 0.952 0.048
#> GSM152111     1  0.9393      0.613 0.644 0.356
#> GSM152112     2  0.3114      0.883 0.056 0.944
#> GSM152113     1  0.2603      0.833 0.956 0.044
#> GSM152115     1  0.2778      0.831 0.952 0.048
#> GSM152030     2  0.0376      0.947 0.004 0.996
#> GSM152038     1  0.0000      0.845 1.000 0.000
#> GSM152042     2  0.0376      0.947 0.004 0.996
#> GSM152062     1  0.2423      0.835 0.960 0.040
#> GSM152077     1  0.8207      0.718 0.744 0.256
#> GSM152088     2  0.0000      0.948 0.000 1.000
#> GSM152100     2  0.0000      0.948 0.000 1.000
#> GSM152102     1  0.7745      0.640 0.772 0.228
#> GSM152104     2  0.0000      0.948 0.000 1.000
#> GSM152028     1  0.0000      0.845 1.000 0.000
#> GSM152029     1  0.0000      0.845 1.000 0.000
#> GSM152049     1  0.8955      0.664 0.688 0.312
#> GSM152053     2  0.0376      0.947 0.004 0.996
#> GSM152059     1  0.0000      0.845 1.000 0.000
#> GSM152085     1  0.8499      0.700 0.724 0.276
#> GSM152101     1  0.7745      0.640 0.772 0.228
#> GSM152105     1  0.0000      0.845 1.000 0.000
#> GSM152034     1  0.9393      0.613 0.644 0.356
#> GSM152036     2  0.0376      0.947 0.004 0.996
#> GSM152040     1  0.0000      0.845 1.000 0.000
#> GSM152043     1  0.0000      0.845 1.000 0.000
#> GSM152046     1  0.9323      0.624 0.652 0.348
#> GSM152047     1  0.0000      0.845 1.000 0.000
#> GSM152048     1  0.8207      0.718 0.744 0.256
#> GSM152050     1  0.9323      0.624 0.652 0.348
#> GSM152052     1  0.0000      0.845 1.000 0.000
#> GSM152056     1  0.9323      0.624 0.652 0.348
#> GSM152060     1  0.9323      0.624 0.652 0.348
#> GSM152065     1  0.0000      0.845 1.000 0.000
#> GSM152066     1  0.4298      0.820 0.912 0.088
#> GSM152069     1  0.2778      0.831 0.952 0.048
#> GSM152070     1  0.0000      0.845 1.000 0.000
#> GSM152071     1  0.1843      0.838 0.972 0.028
#> GSM152072     1  0.0376      0.844 0.996 0.004
#> GSM152073     1  0.0000      0.845 1.000 0.000
#> GSM152078     1  0.0000      0.845 1.000 0.000
#> GSM152082     1  0.0000      0.845 1.000 0.000
#> GSM152086     1  0.7602      0.744 0.780 0.220
#> GSM152090     1  0.9686      0.567 0.604 0.396
#> GSM152092     1  0.0000      0.845 1.000 0.000
#> GSM152093     1  0.9460      0.600 0.636 0.364
#> GSM152094     1  0.1184      0.843 0.984 0.016
#> GSM152098     1  0.0000      0.845 1.000 0.000
#> GSM152110     1  0.9323      0.624 0.652 0.348
#> GSM152031     1  0.0000      0.845 1.000 0.000
#> GSM152037     1  0.0000      0.845 1.000 0.000
#> GSM152055     1  0.9323      0.624 0.652 0.348
#> GSM152061     1  0.9323      0.624 0.652 0.348
#> GSM152064     1  0.9460      0.600 0.636 0.364
#> GSM152087     1  0.0000      0.845 1.000 0.000
#> GSM152103     1  0.4562      0.823 0.904 0.096

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152033     3  0.1411      0.878 0.036 0.000 0.964
#> GSM152063     2  0.0592      0.810 0.000 0.988 0.012
#> GSM152074     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152080     3  0.5254      0.631 0.000 0.264 0.736
#> GSM152081     2  0.6111      0.614 0.396 0.604 0.000
#> GSM152083     3  0.4750      0.693 0.000 0.216 0.784
#> GSM152091     2  0.1753      0.799 0.000 0.952 0.048
#> GSM152108     2  0.7671      0.732 0.300 0.628 0.072
#> GSM152114     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152035     2  0.2356      0.781 0.000 0.928 0.072
#> GSM152039     2  0.4796      0.797 0.220 0.780 0.000
#> GSM152041     2  0.5678      0.733 0.316 0.684 0.000
#> GSM152044     2  0.0424      0.811 0.000 0.992 0.008
#> GSM152045     3  0.1529      0.877 0.040 0.000 0.960
#> GSM152051     2  0.1529      0.803 0.000 0.960 0.040
#> GSM152054     3  0.0892      0.883 0.020 0.000 0.980
#> GSM152057     2  0.1529      0.803 0.000 0.960 0.040
#> GSM152058     1  0.0000      0.841 1.000 0.000 0.000
#> GSM152067     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152068     2  0.1529      0.803 0.000 0.960 0.040
#> GSM152075     2  0.5650      0.737 0.312 0.688 0.000
#> GSM152076     2  0.4796      0.797 0.220 0.780 0.000
#> GSM152079     2  0.1529      0.803 0.000 0.960 0.040
#> GSM152084     1  0.6252      0.233 0.556 0.000 0.444
#> GSM152089     2  0.5958      0.746 0.300 0.692 0.008
#> GSM152095     2  0.4796      0.797 0.220 0.780 0.000
#> GSM152096     3  0.2625      0.831 0.000 0.084 0.916
#> GSM152097     2  0.0000      0.812 0.000 1.000 0.000
#> GSM152099     2  0.1529      0.803 0.000 0.960 0.040
#> GSM152106     2  0.0000      0.812 0.000 1.000 0.000
#> GSM152107     3  0.9596     -0.241 0.200 0.384 0.416
#> GSM152109     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152111     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152112     3  0.8727      0.268 0.148 0.280 0.572
#> GSM152113     3  0.0237      0.885 0.004 0.000 0.996
#> GSM152115     3  0.0747      0.884 0.016 0.000 0.984
#> GSM152030     2  0.5678      0.733 0.316 0.684 0.000
#> GSM152038     3  0.1529      0.877 0.040 0.000 0.960
#> GSM152042     2  0.5678      0.733 0.316 0.684 0.000
#> GSM152062     3  0.0237      0.885 0.004 0.000 0.996
#> GSM152077     1  0.0000      0.841 1.000 0.000 0.000
#> GSM152088     2  0.1529      0.803 0.000 0.960 0.040
#> GSM152100     2  0.4796      0.797 0.220 0.780 0.000
#> GSM152102     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152104     2  0.0000      0.812 0.000 1.000 0.000
#> GSM152028     1  0.6008      0.479 0.628 0.000 0.372
#> GSM152029     3  0.2356      0.848 0.072 0.000 0.928
#> GSM152049     1  0.0424      0.841 0.992 0.008 0.000
#> GSM152053     2  0.5882      0.692 0.348 0.652 0.000
#> GSM152059     1  0.5859      0.534 0.656 0.000 0.344
#> GSM152085     1  0.0424      0.841 0.992 0.008 0.000
#> GSM152101     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152105     1  0.5948      0.504 0.640 0.000 0.360
#> GSM152034     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152036     2  0.5016      0.787 0.240 0.760 0.000
#> GSM152040     1  0.4887      0.687 0.772 0.000 0.228
#> GSM152043     1  0.4654      0.709 0.792 0.000 0.208
#> GSM152046     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152047     1  0.2878      0.808 0.904 0.000 0.096
#> GSM152048     1  0.0000      0.841 1.000 0.000 0.000
#> GSM152050     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152052     1  0.5859      0.535 0.656 0.000 0.344
#> GSM152056     1  0.0747      0.839 0.984 0.016 0.000
#> GSM152060     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152065     3  0.1529      0.877 0.040 0.000 0.960
#> GSM152066     1  0.0000      0.841 1.000 0.000 0.000
#> GSM152069     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152070     3  0.2537      0.849 0.080 0.000 0.920
#> GSM152071     3  0.0000      0.885 0.000 0.000 1.000
#> GSM152072     3  0.1529      0.877 0.040 0.000 0.960
#> GSM152073     1  0.5529      0.602 0.704 0.000 0.296
#> GSM152078     3  0.2448      0.852 0.076 0.000 0.924
#> GSM152082     3  0.4178      0.737 0.172 0.000 0.828
#> GSM152086     1  0.0000      0.841 1.000 0.000 0.000
#> GSM152090     1  0.1753      0.824 0.952 0.000 0.048
#> GSM152092     1  0.5988      0.487 0.632 0.000 0.368
#> GSM152093     1  0.1411      0.832 0.964 0.036 0.000
#> GSM152094     1  0.1411      0.834 0.964 0.000 0.036
#> GSM152098     3  0.6225      0.103 0.432 0.000 0.568
#> GSM152110     1  0.0892      0.838 0.980 0.020 0.000
#> GSM152031     1  0.5882      0.527 0.652 0.000 0.348
#> GSM152037     1  0.1643      0.832 0.956 0.000 0.044
#> GSM152055     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152061     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152064     1  0.1529      0.830 0.960 0.040 0.000
#> GSM152087     1  0.0892      0.839 0.980 0.000 0.020
#> GSM152103     1  0.4062      0.780 0.836 0.000 0.164

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     2  0.4981    0.25201 0.000 0.536 0.464 0.000
#> GSM152033     3  0.3074    0.37003 0.000 0.152 0.848 0.000
#> GSM152063     4  0.4967    0.50562 0.000 0.452 0.000 0.548
#> GSM152074     3  0.4999   -0.26426 0.000 0.492 0.508 0.000
#> GSM152080     2  0.2282    0.39876 0.000 0.924 0.052 0.024
#> GSM152081     4  0.4697    0.35863 0.356 0.000 0.000 0.644
#> GSM152083     2  0.4155    0.41043 0.000 0.756 0.240 0.004
#> GSM152091     2  0.4679   -0.25528 0.000 0.648 0.000 0.352
#> GSM152108     4  0.8076    0.25467 0.156 0.380 0.028 0.436
#> GSM152114     1  0.4509    0.54952 0.708 0.004 0.000 0.288
#> GSM152035     2  0.4643   -0.24724 0.000 0.656 0.000 0.344
#> GSM152039     4  0.1637    0.61009 0.060 0.000 0.000 0.940
#> GSM152041     4  0.3764    0.56673 0.216 0.000 0.000 0.784
#> GSM152044     4  0.4804    0.52875 0.000 0.384 0.000 0.616
#> GSM152045     3  0.2814    0.39295 0.000 0.132 0.868 0.000
#> GSM152051     4  0.4981    0.49534 0.000 0.464 0.000 0.536
#> GSM152054     3  0.4103    0.23280 0.000 0.256 0.744 0.000
#> GSM152057     4  0.4967    0.50562 0.000 0.452 0.000 0.548
#> GSM152058     1  0.0188    0.80917 0.996 0.004 0.000 0.000
#> GSM152067     2  0.5000    0.19050 0.000 0.504 0.496 0.000
#> GSM152068     4  0.4967    0.50562 0.000 0.452 0.000 0.548
#> GSM152075     4  0.3649    0.57337 0.204 0.000 0.000 0.796
#> GSM152076     4  0.1637    0.61009 0.060 0.000 0.000 0.940
#> GSM152079     4  0.4977    0.49916 0.000 0.460 0.000 0.540
#> GSM152084     2  0.9014    0.20554 0.276 0.436 0.084 0.204
#> GSM152089     4  0.6898    0.41437 0.164 0.224 0.004 0.608
#> GSM152095     4  0.1637    0.61009 0.060 0.000 0.000 0.940
#> GSM152096     2  0.4372    0.39976 0.000 0.728 0.268 0.004
#> GSM152097     4  0.4624    0.54484 0.000 0.340 0.000 0.660
#> GSM152099     4  0.4994    0.47862 0.000 0.480 0.000 0.520
#> GSM152106     4  0.4624    0.54484 0.000 0.340 0.000 0.660
#> GSM152107     2  0.5994    0.38173 0.000 0.636 0.068 0.296
#> GSM152109     2  0.5000    0.18957 0.000 0.500 0.500 0.000
#> GSM152111     1  0.2281    0.79396 0.904 0.000 0.000 0.096
#> GSM152112     2  0.8007    0.23507 0.016 0.416 0.184 0.384
#> GSM152113     2  0.4994    0.23427 0.000 0.520 0.480 0.000
#> GSM152115     3  0.4250    0.18966 0.000 0.276 0.724 0.000
#> GSM152030     4  0.3649    0.57337 0.204 0.000 0.000 0.796
#> GSM152038     3  0.1716    0.44442 0.000 0.064 0.936 0.000
#> GSM152042     4  0.4452    0.52250 0.260 0.008 0.000 0.732
#> GSM152062     2  0.4998    0.22493 0.000 0.512 0.488 0.000
#> GSM152077     1  0.1004    0.81379 0.972 0.004 0.000 0.024
#> GSM152088     2  0.4866   -0.35295 0.000 0.596 0.000 0.404
#> GSM152100     4  0.1637    0.61009 0.060 0.000 0.000 0.940
#> GSM152102     3  0.4996   -0.23028 0.000 0.484 0.516 0.000
#> GSM152104     4  0.4624    0.54484 0.000 0.340 0.000 0.660
#> GSM152028     3  0.3945    0.48914 0.216 0.004 0.780 0.000
#> GSM152029     2  0.6708    0.05837 0.088 0.464 0.448 0.000
#> GSM152049     1  0.0188    0.80917 0.996 0.004 0.000 0.000
#> GSM152053     4  0.4643    0.38440 0.344 0.000 0.000 0.656
#> GSM152059     3  0.5168    0.00189 0.492 0.004 0.504 0.000
#> GSM152085     1  0.0188    0.80874 0.996 0.000 0.004 0.000
#> GSM152101     3  0.4994   -0.22499 0.000 0.480 0.520 0.000
#> GSM152105     3  0.5085    0.29636 0.376 0.008 0.616 0.000
#> GSM152034     1  0.2654    0.78523 0.888 0.000 0.004 0.108
#> GSM152036     4  0.2921    0.59478 0.140 0.000 0.000 0.860
#> GSM152040     3  0.5168   -0.08733 0.496 0.004 0.500 0.000
#> GSM152043     1  0.4697    0.37612 0.644 0.000 0.356 0.000
#> GSM152046     1  0.1824    0.81227 0.936 0.000 0.004 0.060
#> GSM152047     1  0.4781    0.43176 0.660 0.004 0.336 0.000
#> GSM152048     1  0.0188    0.80917 0.996 0.004 0.000 0.000
#> GSM152050     1  0.2081    0.80131 0.916 0.000 0.000 0.084
#> GSM152052     1  0.5466    0.10423 0.548 0.016 0.436 0.000
#> GSM152056     1  0.1004    0.81379 0.972 0.004 0.000 0.024
#> GSM152060     1  0.1824    0.81227 0.936 0.000 0.004 0.060
#> GSM152065     3  0.1004    0.48049 0.024 0.004 0.972 0.000
#> GSM152066     1  0.1489    0.78458 0.952 0.004 0.044 0.000
#> GSM152069     3  0.5000   -0.26903 0.000 0.496 0.504 0.000
#> GSM152070     3  0.2266    0.49918 0.084 0.004 0.912 0.000
#> GSM152071     3  0.5000   -0.26903 0.000 0.496 0.504 0.000
#> GSM152072     3  0.3123    0.36882 0.000 0.156 0.844 0.000
#> GSM152073     3  0.5000   -0.03584 0.500 0.000 0.500 0.000
#> GSM152078     3  0.3370    0.48860 0.080 0.048 0.872 0.000
#> GSM152082     3  0.2149    0.49988 0.088 0.000 0.912 0.000
#> GSM152086     1  0.1398    0.78703 0.956 0.004 0.040 0.000
#> GSM152090     1  0.7046    0.35759 0.524 0.340 0.000 0.136
#> GSM152092     3  0.4535    0.41354 0.292 0.004 0.704 0.000
#> GSM152093     1  0.2944    0.76891 0.868 0.004 0.000 0.128
#> GSM152094     1  0.2868    0.70936 0.864 0.000 0.136 0.000
#> GSM152098     3  0.3400    0.49686 0.180 0.000 0.820 0.000
#> GSM152110     1  0.2266    0.80127 0.912 0.004 0.000 0.084
#> GSM152031     3  0.5288    0.05745 0.472 0.008 0.520 0.000
#> GSM152037     1  0.3494    0.66869 0.824 0.004 0.172 0.000
#> GSM152055     1  0.2334    0.79929 0.908 0.000 0.004 0.088
#> GSM152061     1  0.1824    0.81227 0.936 0.000 0.004 0.060
#> GSM152064     1  0.4088    0.64210 0.764 0.000 0.004 0.232
#> GSM152087     1  0.2973    0.70136 0.856 0.000 0.144 0.000
#> GSM152103     1  0.6819    0.12802 0.500 0.424 0.060 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.1197    0.72471 0.000 0.000 0.952 0.000 0.048
#> GSM152033     5  0.5405    0.45020 0.000 0.000 0.256 0.104 0.640
#> GSM152063     2  0.0162    0.90172 0.000 0.996 0.000 0.004 0.000
#> GSM152074     3  0.2843    0.71058 0.000 0.000 0.876 0.048 0.076
#> GSM152080     3  0.4305    0.48544 0.000 0.296 0.688 0.012 0.004
#> GSM152081     4  0.5768    0.67358 0.268 0.076 0.024 0.632 0.000
#> GSM152083     3  0.2865    0.68492 0.000 0.132 0.856 0.008 0.004
#> GSM152091     2  0.2927    0.80681 0.000 0.872 0.068 0.060 0.000
#> GSM152108     4  0.8171   -0.01177 0.128 0.148 0.316 0.400 0.008
#> GSM152114     1  0.4000    0.68387 0.788 0.000 0.028 0.172 0.012
#> GSM152035     2  0.3844    0.72826 0.000 0.804 0.064 0.132 0.000
#> GSM152039     4  0.4773    0.64523 0.012 0.256 0.012 0.704 0.016
#> GSM152041     4  0.4686    0.74477 0.160 0.104 0.000 0.736 0.000
#> GSM152044     2  0.1830    0.87352 0.000 0.932 0.004 0.052 0.012
#> GSM152045     5  0.5783    0.43847 0.000 0.000 0.228 0.160 0.612
#> GSM152051     2  0.0290    0.90142 0.000 0.992 0.000 0.008 0.000
#> GSM152054     5  0.6401    0.11101 0.000 0.000 0.336 0.184 0.480
#> GSM152057     2  0.0162    0.90172 0.000 0.996 0.000 0.004 0.000
#> GSM152058     1  0.0955    0.86205 0.968 0.000 0.000 0.004 0.028
#> GSM152067     3  0.2491    0.71238 0.000 0.000 0.896 0.036 0.068
#> GSM152068     2  0.0162    0.90172 0.000 0.996 0.000 0.004 0.000
#> GSM152075     4  0.5085    0.74758 0.152 0.112 0.012 0.724 0.000
#> GSM152076     4  0.4773    0.64523 0.012 0.256 0.012 0.704 0.016
#> GSM152079     2  0.0290    0.90142 0.000 0.992 0.000 0.008 0.000
#> GSM152084     3  0.7163    0.41381 0.192 0.012 0.524 0.244 0.028
#> GSM152089     4  0.5004    0.65311 0.084 0.076 0.076 0.764 0.000
#> GSM152095     4  0.4773    0.64523 0.012 0.256 0.012 0.704 0.016
#> GSM152096     3  0.4142    0.68758 0.004 0.120 0.800 0.072 0.004
#> GSM152097     2  0.3459    0.80066 0.000 0.832 0.016 0.136 0.016
#> GSM152099     2  0.0693    0.89651 0.000 0.980 0.008 0.012 0.000
#> GSM152106     2  0.3459    0.80066 0.000 0.832 0.016 0.136 0.016
#> GSM152107     3  0.5540    0.45138 0.012 0.056 0.592 0.340 0.000
#> GSM152109     3  0.2110    0.71601 0.000 0.000 0.912 0.016 0.072
#> GSM152111     1  0.1251    0.85752 0.956 0.000 0.000 0.036 0.008
#> GSM152112     4  0.5831    0.29359 0.016 0.028 0.244 0.660 0.052
#> GSM152113     3  0.4973    0.69216 0.032 0.008 0.756 0.152 0.052
#> GSM152115     3  0.6349    0.00487 0.000 0.000 0.424 0.160 0.416
#> GSM152030     4  0.5855    0.74294 0.184 0.124 0.028 0.664 0.000
#> GSM152038     5  0.4032    0.63166 0.004 0.000 0.192 0.032 0.772
#> GSM152042     4  0.5910    0.72095 0.220 0.092 0.036 0.652 0.000
#> GSM152062     3  0.4551    0.69846 0.028 0.004 0.780 0.144 0.044
#> GSM152077     1  0.2095    0.84422 0.928 0.000 0.020 0.028 0.024
#> GSM152088     2  0.1444    0.87180 0.000 0.948 0.040 0.012 0.000
#> GSM152100     4  0.3878    0.68120 0.016 0.236 0.000 0.748 0.000
#> GSM152102     3  0.5808    0.61853 0.000 0.016 0.656 0.176 0.152
#> GSM152104     2  0.3413    0.80436 0.000 0.836 0.016 0.132 0.016
#> GSM152028     5  0.1591    0.74811 0.052 0.000 0.004 0.004 0.940
#> GSM152029     3  0.5692    0.58783 0.052 0.000 0.676 0.060 0.212
#> GSM152049     1  0.0510    0.86384 0.984 0.000 0.000 0.000 0.016
#> GSM152053     4  0.5863    0.71224 0.228 0.084 0.036 0.652 0.000
#> GSM152059     5  0.3935    0.68302 0.220 0.000 0.008 0.012 0.760
#> GSM152085     1  0.1195    0.86109 0.960 0.000 0.000 0.012 0.028
#> GSM152101     3  0.5608    0.62032 0.000 0.008 0.664 0.176 0.152
#> GSM152105     5  0.3552    0.72364 0.164 0.000 0.012 0.012 0.812
#> GSM152034     1  0.2951    0.82496 0.860 0.000 0.000 0.112 0.028
#> GSM152036     4  0.5256    0.70143 0.064 0.188 0.012 0.720 0.016
#> GSM152040     5  0.3197    0.73620 0.116 0.000 0.008 0.024 0.852
#> GSM152043     5  0.4152    0.56829 0.296 0.000 0.000 0.012 0.692
#> GSM152046     1  0.2628    0.83603 0.884 0.000 0.000 0.088 0.028
#> GSM152047     1  0.5548   -0.01002 0.480 0.000 0.008 0.048 0.464
#> GSM152048     1  0.0955    0.86205 0.968 0.000 0.000 0.004 0.028
#> GSM152050     1  0.0865    0.86172 0.972 0.000 0.000 0.024 0.004
#> GSM152052     5  0.4799    0.45597 0.360 0.000 0.012 0.012 0.616
#> GSM152056     1  0.0671    0.86332 0.980 0.000 0.000 0.004 0.016
#> GSM152060     1  0.2628    0.83603 0.884 0.000 0.000 0.088 0.028
#> GSM152065     5  0.2954    0.70526 0.004 0.000 0.064 0.056 0.876
#> GSM152066     1  0.1628    0.84923 0.936 0.000 0.000 0.008 0.056
#> GSM152069     3  0.2172    0.71471 0.000 0.000 0.908 0.016 0.076
#> GSM152070     5  0.2536    0.72195 0.004 0.000 0.044 0.052 0.900
#> GSM152071     3  0.2172    0.71471 0.000 0.000 0.908 0.016 0.076
#> GSM152072     5  0.5505    0.38969 0.000 0.000 0.304 0.092 0.604
#> GSM152073     5  0.3596    0.69321 0.212 0.000 0.000 0.012 0.776
#> GSM152078     5  0.3224    0.73042 0.044 0.000 0.080 0.012 0.864
#> GSM152082     5  0.2060    0.73338 0.012 0.000 0.036 0.024 0.928
#> GSM152086     1  0.1205    0.85680 0.956 0.000 0.000 0.004 0.040
#> GSM152090     3  0.7285    0.27299 0.332 0.008 0.452 0.180 0.028
#> GSM152092     5  0.2249    0.74448 0.096 0.000 0.000 0.008 0.896
#> GSM152093     1  0.3395    0.77184 0.848 0.000 0.028 0.108 0.016
#> GSM152094     1  0.3355    0.72945 0.804 0.000 0.000 0.012 0.184
#> GSM152098     5  0.2060    0.74142 0.024 0.000 0.036 0.012 0.928
#> GSM152110     1  0.1644    0.84959 0.940 0.000 0.004 0.048 0.008
#> GSM152031     5  0.3840    0.69818 0.196 0.000 0.008 0.016 0.780
#> GSM152037     1  0.3612    0.65977 0.764 0.000 0.000 0.008 0.228
#> GSM152055     1  0.2136    0.83744 0.904 0.000 0.000 0.088 0.008
#> GSM152061     1  0.2628    0.83603 0.884 0.000 0.000 0.088 0.028
#> GSM152064     1  0.3170    0.76670 0.828 0.000 0.008 0.160 0.004
#> GSM152087     1  0.3427    0.71966 0.796 0.000 0.000 0.012 0.192
#> GSM152103     3  0.6860    0.43602 0.296 0.008 0.544 0.112 0.040

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.1918     0.7330 0.008 0.000 0.904 0.000 0.088 0.000
#> GSM152033     1  0.6641     0.1547 0.436 0.000 0.236 0.040 0.288 0.000
#> GSM152063     2  0.0436     0.8995 0.004 0.988 0.000 0.004 0.004 0.000
#> GSM152074     3  0.2386     0.7216 0.028 0.000 0.896 0.012 0.064 0.000
#> GSM152080     3  0.4806     0.5378 0.000 0.220 0.684 0.016 0.080 0.000
#> GSM152081     4  0.4774     0.7287 0.000 0.008 0.000 0.696 0.160 0.136
#> GSM152083     3  0.3559     0.6898 0.004 0.084 0.816 0.004 0.092 0.000
#> GSM152091     2  0.2288     0.8488 0.000 0.900 0.016 0.016 0.068 0.000
#> GSM152108     5  0.6635     0.3867 0.020 0.056 0.096 0.152 0.628 0.048
#> GSM152114     6  0.5284     0.4985 0.008 0.000 0.000 0.124 0.256 0.612
#> GSM152035     2  0.3528     0.5823 0.000 0.700 0.000 0.004 0.296 0.000
#> GSM152039     4  0.2355     0.7527 0.000 0.112 0.008 0.876 0.000 0.004
#> GSM152041     4  0.3868     0.7886 0.000 0.012 0.000 0.792 0.096 0.100
#> GSM152044     2  0.1836     0.8777 0.004 0.928 0.008 0.048 0.012 0.000
#> GSM152045     5  0.6562     0.0577 0.328 0.000 0.196 0.040 0.436 0.000
#> GSM152051     2  0.0363     0.8991 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM152054     5  0.6283     0.2246 0.244 0.000 0.200 0.036 0.520 0.000
#> GSM152057     2  0.0260     0.8999 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM152058     6  0.2051     0.8394 0.036 0.000 0.000 0.008 0.040 0.916
#> GSM152067     3  0.1333     0.7275 0.008 0.000 0.944 0.000 0.048 0.000
#> GSM152068     2  0.0291     0.8997 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM152075     4  0.3903     0.7923 0.000 0.016 0.000 0.792 0.108 0.084
#> GSM152076     4  0.2355     0.7527 0.000 0.112 0.008 0.876 0.000 0.004
#> GSM152079     2  0.0260     0.8999 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM152084     5  0.7267     0.3522 0.072 0.008 0.208 0.084 0.544 0.084
#> GSM152089     5  0.4779    -0.1588 0.000 0.016 0.000 0.436 0.524 0.024
#> GSM152095     4  0.2355     0.7527 0.000 0.112 0.008 0.876 0.000 0.004
#> GSM152096     3  0.5262     0.2379 0.000 0.080 0.536 0.008 0.376 0.000
#> GSM152097     2  0.3499     0.7829 0.004 0.780 0.008 0.196 0.012 0.000
#> GSM152099     2  0.0458     0.8983 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM152106     2  0.3499     0.7829 0.004 0.780 0.008 0.196 0.012 0.000
#> GSM152107     5  0.6417     0.3530 0.012 0.016 0.216 0.180 0.560 0.016
#> GSM152109     3  0.0547     0.7582 0.020 0.000 0.980 0.000 0.000 0.000
#> GSM152111     6  0.0806     0.8454 0.000 0.000 0.000 0.020 0.008 0.972
#> GSM152112     5  0.4555     0.3163 0.008 0.008 0.052 0.208 0.720 0.004
#> GSM152113     5  0.5850     0.2970 0.096 0.000 0.276 0.024 0.588 0.016
#> GSM152115     5  0.6427     0.1379 0.172 0.000 0.320 0.040 0.468 0.000
#> GSM152030     4  0.4541     0.7714 0.000 0.020 0.000 0.732 0.160 0.088
#> GSM152038     1  0.3546     0.7024 0.824 0.000 0.096 0.024 0.056 0.000
#> GSM152042     4  0.4892     0.6643 0.000 0.012 0.000 0.648 0.268 0.072
#> GSM152062     5  0.5968     0.2242 0.080 0.000 0.340 0.028 0.536 0.016
#> GSM152077     6  0.3917     0.7496 0.040 0.000 0.000 0.024 0.156 0.780
#> GSM152088     2  0.1605     0.8737 0.000 0.940 0.012 0.016 0.032 0.000
#> GSM152100     4  0.3703     0.7872 0.000 0.092 0.000 0.796 0.108 0.004
#> GSM152102     5  0.5573     0.1512 0.096 0.004 0.316 0.016 0.568 0.000
#> GSM152104     2  0.3371     0.7975 0.004 0.796 0.008 0.180 0.012 0.000
#> GSM152028     1  0.1750     0.7626 0.932 0.000 0.000 0.016 0.040 0.012
#> GSM152029     3  0.6765     0.1981 0.204 0.000 0.504 0.004 0.216 0.072
#> GSM152049     6  0.1167     0.8463 0.020 0.000 0.000 0.008 0.012 0.960
#> GSM152053     4  0.4921     0.6680 0.000 0.012 0.000 0.648 0.264 0.076
#> GSM152059     1  0.2700     0.7214 0.836 0.000 0.000 0.004 0.004 0.156
#> GSM152085     6  0.0551     0.8450 0.004 0.000 0.000 0.008 0.004 0.984
#> GSM152101     5  0.5397     0.1572 0.088 0.000 0.328 0.016 0.568 0.000
#> GSM152105     1  0.2936     0.7352 0.856 0.000 0.000 0.004 0.060 0.080
#> GSM152034     6  0.2340     0.8249 0.000 0.000 0.004 0.056 0.044 0.896
#> GSM152036     4  0.2151     0.7610 0.000 0.072 0.008 0.904 0.000 0.016
#> GSM152040     1  0.3093     0.7367 0.852 0.000 0.000 0.012 0.076 0.060
#> GSM152043     1  0.3302     0.6490 0.760 0.000 0.000 0.004 0.004 0.232
#> GSM152046     6  0.2344     0.8235 0.000 0.000 0.004 0.052 0.048 0.896
#> GSM152047     6  0.5731     0.2942 0.324 0.000 0.000 0.012 0.136 0.528
#> GSM152048     6  0.2051     0.8394 0.036 0.000 0.000 0.008 0.040 0.916
#> GSM152050     6  0.0508     0.8452 0.000 0.000 0.000 0.012 0.004 0.984
#> GSM152052     1  0.4455     0.6527 0.756 0.000 0.024 0.008 0.064 0.148
#> GSM152056     6  0.1838     0.8411 0.020 0.000 0.000 0.012 0.040 0.928
#> GSM152060     6  0.2344     0.8235 0.000 0.000 0.004 0.052 0.048 0.896
#> GSM152065     1  0.4030     0.6683 0.776 0.000 0.040 0.032 0.152 0.000
#> GSM152066     6  0.2445     0.8326 0.060 0.000 0.000 0.008 0.040 0.892
#> GSM152069     3  0.0692     0.7586 0.020 0.000 0.976 0.000 0.004 0.000
#> GSM152070     1  0.3627     0.6957 0.808 0.000 0.028 0.032 0.132 0.000
#> GSM152071     3  0.0692     0.7586 0.020 0.000 0.976 0.000 0.004 0.000
#> GSM152072     1  0.6744     0.0642 0.396 0.000 0.300 0.040 0.264 0.000
#> GSM152073     1  0.2700     0.7222 0.836 0.000 0.000 0.004 0.004 0.156
#> GSM152078     1  0.2259     0.7555 0.912 0.000 0.036 0.004 0.024 0.024
#> GSM152082     1  0.2688     0.7394 0.884 0.000 0.020 0.024 0.068 0.004
#> GSM152086     6  0.1757     0.8404 0.052 0.000 0.000 0.008 0.012 0.928
#> GSM152090     5  0.7967     0.2931 0.072 0.004 0.208 0.084 0.436 0.196
#> GSM152092     1  0.0748     0.7636 0.976 0.000 0.000 0.004 0.004 0.016
#> GSM152093     6  0.4789     0.6186 0.020 0.000 0.000 0.072 0.220 0.688
#> GSM152094     6  0.2848     0.7536 0.176 0.000 0.000 0.008 0.000 0.816
#> GSM152098     1  0.2051     0.7581 0.920 0.000 0.004 0.020 0.044 0.012
#> GSM152110     6  0.2239     0.8307 0.008 0.000 0.000 0.020 0.072 0.900
#> GSM152031     1  0.3065     0.7259 0.844 0.000 0.000 0.004 0.052 0.100
#> GSM152037     6  0.4354     0.6241 0.268 0.000 0.000 0.008 0.040 0.684
#> GSM152055     6  0.2344     0.8235 0.000 0.000 0.004 0.052 0.048 0.896
#> GSM152061     6  0.2344     0.8235 0.000 0.000 0.004 0.052 0.048 0.896
#> GSM152064     6  0.3221     0.7727 0.000 0.000 0.000 0.096 0.076 0.828
#> GSM152087     6  0.2848     0.7530 0.176 0.000 0.000 0.008 0.000 0.816
#> GSM152103     5  0.7568     0.2429 0.100 0.004 0.260 0.024 0.440 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-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 specimen(p) k
#> ATC:kmeans 85    9.69e-06 2
#> ATC:kmeans 82    3.40e-06 3
#> ATC:kmeans 38    5.08e-04 4
#> ATC:kmeans 74    1.42e-04 5
#> ATC:kmeans 68    2.25e-06 6

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


ATC:skmeans*

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.482           0.767       0.896         0.5031 0.504   0.504
#> 3 3 0.924           0.890       0.959         0.3350 0.710   0.482
#> 4 4 0.768           0.855       0.913         0.1197 0.853   0.592
#> 5 5 0.782           0.745       0.858         0.0667 0.926   0.713
#> 6 6 0.820           0.775       0.862         0.0393 0.946   0.746

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
#> GSM152032     2  0.9732      0.311 0.404 0.596
#> GSM152033     1  0.0000      0.829 1.000 0.000
#> GSM152063     2  0.0000      0.924 0.000 1.000
#> GSM152074     1  0.9710      0.330 0.600 0.400
#> GSM152080     2  0.7139      0.727 0.196 0.804
#> GSM152081     2  0.0000      0.924 0.000 1.000
#> GSM152083     2  0.7139      0.727 0.196 0.804
#> GSM152091     2  0.0000      0.924 0.000 1.000
#> GSM152108     2  0.0000      0.924 0.000 1.000
#> GSM152114     2  0.3733      0.846 0.072 0.928
#> GSM152035     2  0.0000      0.924 0.000 1.000
#> GSM152039     2  0.0000      0.924 0.000 1.000
#> GSM152041     2  0.0000      0.924 0.000 1.000
#> GSM152044     2  0.0000      0.924 0.000 1.000
#> GSM152045     1  0.0000      0.829 1.000 0.000
#> GSM152051     2  0.0000      0.924 0.000 1.000
#> GSM152054     1  0.7815      0.633 0.768 0.232
#> GSM152057     2  0.0000      0.924 0.000 1.000
#> GSM152058     1  0.6973      0.749 0.812 0.188
#> GSM152067     1  0.9710      0.330 0.600 0.400
#> GSM152068     2  0.0000      0.924 0.000 1.000
#> GSM152075     2  0.0000      0.924 0.000 1.000
#> GSM152076     2  0.0000      0.924 0.000 1.000
#> GSM152079     2  0.0000      0.924 0.000 1.000
#> GSM152084     2  0.8713      0.579 0.292 0.708
#> GSM152089     2  0.0000      0.924 0.000 1.000
#> GSM152095     2  0.0000      0.924 0.000 1.000
#> GSM152096     2  0.7139      0.727 0.196 0.804
#> GSM152097     2  0.0000      0.924 0.000 1.000
#> GSM152099     2  0.0000      0.924 0.000 1.000
#> GSM152106     2  0.0000      0.924 0.000 1.000
#> GSM152107     2  0.0938      0.915 0.012 0.988
#> GSM152109     1  0.9732      0.319 0.596 0.404
#> GSM152111     1  0.9635      0.470 0.612 0.388
#> GSM152112     2  0.0000      0.924 0.000 1.000
#> GSM152113     1  0.9686      0.340 0.604 0.396
#> GSM152115     1  0.9661      0.349 0.608 0.392
#> GSM152030     2  0.0000      0.924 0.000 1.000
#> GSM152038     1  0.0000      0.829 1.000 0.000
#> GSM152042     2  0.0000      0.924 0.000 1.000
#> GSM152062     1  0.9686      0.340 0.604 0.396
#> GSM152077     1  0.6973      0.749 0.812 0.188
#> GSM152088     2  0.0000      0.924 0.000 1.000
#> GSM152100     2  0.0000      0.924 0.000 1.000
#> GSM152102     2  0.7299      0.718 0.204 0.796
#> GSM152104     2  0.0000      0.924 0.000 1.000
#> GSM152028     1  0.0000      0.829 1.000 0.000
#> GSM152029     1  0.0000      0.829 1.000 0.000
#> GSM152049     1  0.7139      0.743 0.804 0.196
#> GSM152053     2  0.0000      0.924 0.000 1.000
#> GSM152059     1  0.0000      0.829 1.000 0.000
#> GSM152085     1  0.7056      0.746 0.808 0.192
#> GSM152101     2  0.7219      0.723 0.200 0.800
#> GSM152105     1  0.0000      0.829 1.000 0.000
#> GSM152034     1  0.9710      0.445 0.600 0.400
#> GSM152036     2  0.0000      0.924 0.000 1.000
#> GSM152040     1  0.0000      0.829 1.000 0.000
#> GSM152043     1  0.0000      0.829 1.000 0.000
#> GSM152046     1  0.7139      0.743 0.804 0.196
#> GSM152047     1  0.0000      0.829 1.000 0.000
#> GSM152048     1  0.6973      0.749 0.812 0.188
#> GSM152050     1  0.7139      0.743 0.804 0.196
#> GSM152052     1  0.0000      0.829 1.000 0.000
#> GSM152056     1  0.7139      0.743 0.804 0.196
#> GSM152060     1  0.7139      0.743 0.804 0.196
#> GSM152065     1  0.0000      0.829 1.000 0.000
#> GSM152066     1  0.0000      0.829 1.000 0.000
#> GSM152069     1  0.9686      0.340 0.604 0.396
#> GSM152070     1  0.0000      0.829 1.000 0.000
#> GSM152071     1  0.6801      0.699 0.820 0.180
#> GSM152072     1  0.0000      0.829 1.000 0.000
#> GSM152073     1  0.0000      0.829 1.000 0.000
#> GSM152078     1  0.0000      0.829 1.000 0.000
#> GSM152082     1  0.0000      0.829 1.000 0.000
#> GSM152086     1  0.0938      0.825 0.988 0.012
#> GSM152090     2  0.0000      0.924 0.000 1.000
#> GSM152092     1  0.0000      0.829 1.000 0.000
#> GSM152093     1  0.9909      0.343 0.556 0.444
#> GSM152094     1  0.0000      0.829 1.000 0.000
#> GSM152098     1  0.0000      0.829 1.000 0.000
#> GSM152110     1  0.7139      0.743 0.804 0.196
#> GSM152031     1  0.0000      0.829 1.000 0.000
#> GSM152037     1  0.0000      0.829 1.000 0.000
#> GSM152055     1  0.7139      0.743 0.804 0.196
#> GSM152061     1  0.7139      0.743 0.804 0.196
#> GSM152064     2  0.9754      0.110 0.408 0.592
#> GSM152087     1  0.0000      0.829 1.000 0.000
#> GSM152103     1  0.7815      0.651 0.768 0.232

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152033     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152063     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152074     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152080     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152081     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152083     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152091     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152108     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152114     1  0.3816     0.7862 0.852 0.148 0.000
#> GSM152035     2  0.0747     0.9802 0.000 0.984 0.016
#> GSM152039     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152041     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152044     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152045     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152051     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152054     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152057     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152058     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152067     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152068     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152075     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152076     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152079     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152084     3  0.0592     0.9080 0.000 0.012 0.988
#> GSM152089     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152095     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152096     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152097     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152099     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152106     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152107     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152109     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152111     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152112     2  0.2448     0.9199 0.000 0.924 0.076
#> GSM152113     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152115     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152030     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152038     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152042     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152062     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152077     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152088     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152100     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152102     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152104     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152028     3  0.6274     0.2035 0.456 0.000 0.544
#> GSM152029     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152049     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152053     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152059     1  0.5016     0.6341 0.760 0.000 0.240
#> GSM152085     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152101     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152105     3  0.6309     0.0661 0.496 0.000 0.504
#> GSM152034     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152036     2  0.0000     0.9939 0.000 1.000 0.000
#> GSM152040     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152043     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152046     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152047     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152048     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152050     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152052     1  0.6244     0.1224 0.560 0.000 0.440
#> GSM152056     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152060     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152065     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152066     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152069     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152070     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152071     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152072     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152073     1  0.0747     0.9332 0.984 0.000 0.016
#> GSM152078     3  0.0000     0.9172 0.000 0.000 1.000
#> GSM152082     3  0.4555     0.7207 0.200 0.000 0.800
#> GSM152086     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152090     2  0.2448     0.9146 0.076 0.924 0.000
#> GSM152092     3  0.6280     0.1911 0.460 0.000 0.540
#> GSM152093     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152094     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152098     3  0.6111     0.3671 0.396 0.000 0.604
#> GSM152110     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152031     1  0.6225     0.1509 0.568 0.000 0.432
#> GSM152037     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152055     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152061     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152064     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152087     1  0.0000     0.9475 1.000 0.000 0.000
#> GSM152103     3  0.4235     0.7529 0.176 0.000 0.824

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.2345      0.882 0.000 0.000 0.900 0.100
#> GSM152033     4  0.4072      0.603 0.000 0.000 0.252 0.748
#> GSM152063     2  0.0592      0.931 0.000 0.984 0.016 0.000
#> GSM152074     3  0.2589      0.881 0.000 0.000 0.884 0.116
#> GSM152080     3  0.2216      0.846 0.000 0.092 0.908 0.000
#> GSM152081     2  0.4998      0.815 0.128 0.780 0.088 0.004
#> GSM152083     3  0.2266      0.850 0.000 0.084 0.912 0.004
#> GSM152091     2  0.2647      0.848 0.000 0.880 0.120 0.000
#> GSM152108     2  0.0921      0.928 0.000 0.972 0.028 0.000
#> GSM152114     1  0.2795      0.851 0.896 0.012 0.088 0.004
#> GSM152035     2  0.1118      0.924 0.000 0.964 0.036 0.000
#> GSM152039     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152041     2  0.2795      0.922 0.012 0.896 0.088 0.004
#> GSM152044     2  0.0592      0.931 0.000 0.984 0.016 0.000
#> GSM152045     4  0.1716      0.811 0.000 0.000 0.064 0.936
#> GSM152051     2  0.0817      0.929 0.000 0.976 0.024 0.000
#> GSM152054     4  0.4193      0.574 0.000 0.000 0.268 0.732
#> GSM152057     2  0.0817      0.929 0.000 0.976 0.024 0.000
#> GSM152058     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152067     3  0.2589      0.881 0.000 0.000 0.884 0.116
#> GSM152068     2  0.0817      0.929 0.000 0.976 0.024 0.000
#> GSM152075     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152076     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152079     2  0.0817      0.929 0.000 0.976 0.024 0.000
#> GSM152084     3  0.0336      0.842 0.000 0.000 0.992 0.008
#> GSM152089     2  0.1940      0.930 0.000 0.924 0.076 0.000
#> GSM152095     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152096     3  0.2216      0.846 0.000 0.092 0.908 0.000
#> GSM152097     2  0.0188      0.932 0.000 0.996 0.004 0.000
#> GSM152099     2  0.0817      0.929 0.000 0.976 0.024 0.000
#> GSM152106     2  0.0188      0.932 0.000 0.996 0.004 0.000
#> GSM152107     3  0.3907      0.574 0.000 0.232 0.768 0.000
#> GSM152109     3  0.2408      0.883 0.000 0.000 0.896 0.104
#> GSM152111     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152112     2  0.3547      0.877 0.000 0.840 0.144 0.016
#> GSM152113     3  0.2760      0.875 0.000 0.000 0.872 0.128
#> GSM152115     4  0.4543      0.462 0.000 0.000 0.324 0.676
#> GSM152030     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152038     4  0.1022      0.831 0.000 0.000 0.032 0.968
#> GSM152042     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152062     3  0.2469      0.882 0.000 0.000 0.892 0.108
#> GSM152077     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152088     2  0.2589      0.852 0.000 0.884 0.116 0.000
#> GSM152100     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152102     3  0.3975      0.762 0.000 0.000 0.760 0.240
#> GSM152104     2  0.0469      0.931 0.000 0.988 0.012 0.000
#> GSM152028     4  0.0469      0.845 0.012 0.000 0.000 0.988
#> GSM152029     3  0.3400      0.841 0.000 0.000 0.820 0.180
#> GSM152049     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152053     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152059     4  0.3400      0.755 0.180 0.000 0.000 0.820
#> GSM152085     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152101     3  0.3726      0.799 0.000 0.000 0.788 0.212
#> GSM152105     4  0.1302      0.841 0.044 0.000 0.000 0.956
#> GSM152034     1  0.0188      0.950 0.996 0.000 0.000 0.004
#> GSM152036     2  0.2334      0.928 0.000 0.908 0.088 0.004
#> GSM152040     4  0.2345      0.821 0.100 0.000 0.000 0.900
#> GSM152043     4  0.3649      0.726 0.204 0.000 0.000 0.796
#> GSM152046     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152047     4  0.2408      0.819 0.104 0.000 0.000 0.896
#> GSM152048     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152050     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152052     4  0.5543      0.415 0.360 0.000 0.028 0.612
#> GSM152056     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152060     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152065     4  0.0188      0.842 0.000 0.000 0.004 0.996
#> GSM152066     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152069     3  0.2530      0.882 0.000 0.000 0.888 0.112
#> GSM152070     4  0.0188      0.842 0.000 0.000 0.004 0.996
#> GSM152071     3  0.2530      0.882 0.000 0.000 0.888 0.112
#> GSM152072     4  0.4331      0.536 0.000 0.000 0.288 0.712
#> GSM152073     4  0.2469      0.817 0.108 0.000 0.000 0.892
#> GSM152078     4  0.0188      0.842 0.000 0.000 0.004 0.996
#> GSM152082     4  0.0188      0.843 0.004 0.000 0.000 0.996
#> GSM152086     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152090     3  0.4770      0.618 0.012 0.288 0.700 0.000
#> GSM152092     4  0.0592      0.845 0.016 0.000 0.000 0.984
#> GSM152093     1  0.0524      0.944 0.988 0.000 0.008 0.004
#> GSM152094     1  0.4222      0.629 0.728 0.000 0.000 0.272
#> GSM152098     4  0.0469      0.845 0.012 0.000 0.000 0.988
#> GSM152110     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152031     4  0.2921      0.798 0.140 0.000 0.000 0.860
#> GSM152037     1  0.4072      0.662 0.748 0.000 0.000 0.252
#> GSM152055     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152061     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM152064     1  0.0564      0.944 0.988 0.004 0.004 0.004
#> GSM152087     1  0.3873      0.702 0.772 0.000 0.000 0.228
#> GSM152103     3  0.3898      0.822 0.008 0.092 0.852 0.048

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.0771     0.7657 0.000 0.004 0.976 0.000 0.020
#> GSM152033     5  0.5557     0.0423 0.000 0.068 0.460 0.000 0.472
#> GSM152063     2  0.2471     0.8798 0.000 0.864 0.000 0.136 0.000
#> GSM152074     3  0.1582     0.7602 0.000 0.028 0.944 0.000 0.028
#> GSM152080     3  0.4278     0.2385 0.000 0.452 0.548 0.000 0.000
#> GSM152081     4  0.0162     0.9449 0.004 0.000 0.000 0.996 0.000
#> GSM152083     3  0.2891     0.6763 0.000 0.176 0.824 0.000 0.000
#> GSM152091     2  0.2236     0.8489 0.000 0.908 0.024 0.068 0.000
#> GSM152108     2  0.2286     0.8699 0.000 0.888 0.004 0.108 0.000
#> GSM152114     1  0.3920     0.6216 0.724 0.004 0.004 0.268 0.000
#> GSM152035     2  0.1638     0.8421 0.000 0.932 0.004 0.064 0.000
#> GSM152039     4  0.0162     0.9478 0.000 0.004 0.000 0.996 0.000
#> GSM152041     4  0.0451     0.9422 0.008 0.004 0.000 0.988 0.000
#> GSM152044     2  0.2561     0.8755 0.000 0.856 0.000 0.144 0.000
#> GSM152045     5  0.5916     0.3320 0.000 0.120 0.336 0.000 0.544
#> GSM152051     2  0.2424     0.8811 0.000 0.868 0.000 0.132 0.000
#> GSM152054     3  0.6062    -0.0381 0.000 0.120 0.464 0.000 0.416
#> GSM152057     2  0.2424     0.8811 0.000 0.868 0.000 0.132 0.000
#> GSM152058     1  0.0000     0.9131 1.000 0.000 0.000 0.000 0.000
#> GSM152067     3  0.1725     0.7536 0.000 0.044 0.936 0.000 0.020
#> GSM152068     2  0.2424     0.8811 0.000 0.868 0.000 0.132 0.000
#> GSM152075     4  0.0000     0.9479 0.000 0.000 0.000 1.000 0.000
#> GSM152076     4  0.0162     0.9478 0.000 0.004 0.000 0.996 0.000
#> GSM152079     2  0.2424     0.8811 0.000 0.868 0.000 0.132 0.000
#> GSM152084     3  0.2311     0.7543 0.004 0.020 0.920 0.040 0.016
#> GSM152089     4  0.3177     0.7557 0.000 0.208 0.000 0.792 0.000
#> GSM152095     4  0.0162     0.9478 0.000 0.004 0.000 0.996 0.000
#> GSM152096     3  0.4126     0.3896 0.000 0.380 0.620 0.000 0.000
#> GSM152097     2  0.4074     0.6069 0.000 0.636 0.000 0.364 0.000
#> GSM152099     2  0.2424     0.8811 0.000 0.868 0.000 0.132 0.000
#> GSM152106     2  0.4015     0.6360 0.000 0.652 0.000 0.348 0.000
#> GSM152107     3  0.6175     0.3122 0.000 0.332 0.516 0.152 0.000
#> GSM152109     3  0.0798     0.7662 0.000 0.008 0.976 0.000 0.016
#> GSM152111     1  0.0324     0.9132 0.992 0.000 0.000 0.004 0.004
#> GSM152112     4  0.5869     0.5881 0.000 0.160 0.164 0.656 0.020
#> GSM152113     3  0.2036     0.7512 0.000 0.024 0.920 0.000 0.056
#> GSM152115     3  0.5988     0.1196 0.000 0.120 0.516 0.000 0.364
#> GSM152030     4  0.0000     0.9479 0.000 0.000 0.000 1.000 0.000
#> GSM152038     5  0.4003     0.5605 0.000 0.008 0.288 0.000 0.704
#> GSM152042     4  0.0000     0.9479 0.000 0.000 0.000 1.000 0.000
#> GSM152062     3  0.0865     0.7652 0.000 0.004 0.972 0.000 0.024
#> GSM152077     1  0.0451     0.9100 0.988 0.000 0.000 0.004 0.008
#> GSM152088     2  0.2707     0.8657 0.000 0.876 0.024 0.100 0.000
#> GSM152100     4  0.0404     0.9412 0.000 0.012 0.000 0.988 0.000
#> GSM152102     3  0.4711     0.6286 0.000 0.148 0.736 0.000 0.116
#> GSM152104     2  0.3636     0.7477 0.000 0.728 0.000 0.272 0.000
#> GSM152028     5  0.0693     0.8317 0.008 0.000 0.012 0.000 0.980
#> GSM152029     3  0.3487     0.6186 0.000 0.008 0.780 0.000 0.212
#> GSM152049     1  0.0000     0.9131 1.000 0.000 0.000 0.000 0.000
#> GSM152053     4  0.0000     0.9479 0.000 0.000 0.000 1.000 0.000
#> GSM152059     5  0.1851     0.7949 0.088 0.000 0.000 0.000 0.912
#> GSM152085     1  0.0510     0.9113 0.984 0.000 0.000 0.000 0.016
#> GSM152101     3  0.4312     0.6492 0.000 0.124 0.772 0.000 0.104
#> GSM152105     5  0.1670     0.8219 0.052 0.000 0.012 0.000 0.936
#> GSM152034     1  0.1018     0.9083 0.968 0.000 0.000 0.016 0.016
#> GSM152036     4  0.0162     0.9478 0.000 0.004 0.000 0.996 0.000
#> GSM152040     5  0.1419     0.8268 0.012 0.016 0.016 0.000 0.956
#> GSM152043     5  0.2074     0.7821 0.104 0.000 0.000 0.000 0.896
#> GSM152046     1  0.0798     0.9110 0.976 0.000 0.000 0.008 0.016
#> GSM152047     5  0.1904     0.8224 0.020 0.028 0.016 0.000 0.936
#> GSM152048     1  0.0000     0.9131 1.000 0.000 0.000 0.000 0.000
#> GSM152050     1  0.0324     0.9132 0.992 0.000 0.000 0.004 0.004
#> GSM152052     5  0.4359     0.6646 0.188 0.004 0.052 0.000 0.756
#> GSM152056     1  0.0000     0.9131 1.000 0.000 0.000 0.000 0.000
#> GSM152060     1  0.0798     0.9110 0.976 0.000 0.000 0.008 0.016
#> GSM152065     5  0.2144     0.7984 0.000 0.020 0.068 0.000 0.912
#> GSM152066     1  0.0162     0.9124 0.996 0.000 0.000 0.000 0.004
#> GSM152069     3  0.0798     0.7662 0.000 0.008 0.976 0.000 0.016
#> GSM152070     5  0.1386     0.8238 0.000 0.016 0.032 0.000 0.952
#> GSM152071     3  0.0798     0.7662 0.000 0.008 0.976 0.000 0.016
#> GSM152072     5  0.5507     0.0722 0.000 0.064 0.456 0.000 0.480
#> GSM152073     5  0.0880     0.8269 0.032 0.000 0.000 0.000 0.968
#> GSM152078     5  0.0955     0.8295 0.004 0.000 0.028 0.000 0.968
#> GSM152082     5  0.0771     0.8308 0.004 0.000 0.020 0.000 0.976
#> GSM152086     1  0.0162     0.9124 0.996 0.000 0.000 0.000 0.004
#> GSM152090     2  0.5002    -0.1376 0.016 0.488 0.488 0.008 0.000
#> GSM152092     5  0.0798     0.8320 0.008 0.000 0.016 0.000 0.976
#> GSM152093     1  0.1202     0.8970 0.960 0.004 0.004 0.032 0.000
#> GSM152094     1  0.4201     0.3835 0.592 0.000 0.000 0.000 0.408
#> GSM152098     5  0.0579     0.8316 0.008 0.000 0.008 0.000 0.984
#> GSM152110     1  0.0162     0.9129 0.996 0.000 0.000 0.004 0.000
#> GSM152031     5  0.1830     0.8129 0.068 0.000 0.008 0.000 0.924
#> GSM152037     1  0.3816     0.5662 0.696 0.000 0.000 0.000 0.304
#> GSM152055     1  0.0693     0.9118 0.980 0.000 0.000 0.008 0.012
#> GSM152061     1  0.0798     0.9110 0.976 0.000 0.000 0.008 0.016
#> GSM152064     1  0.3280     0.7676 0.812 0.000 0.000 0.176 0.012
#> GSM152087     1  0.4126     0.4435 0.620 0.000 0.000 0.000 0.380
#> GSM152103     3  0.5235     0.4798 0.016 0.304 0.640 0.000 0.040

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     3  0.1863     0.7969 0.016 0.004 0.920 0.000 0.060 0.000
#> GSM152033     5  0.4980     0.6077 0.280 0.004 0.092 0.000 0.624 0.000
#> GSM152063     2  0.0146     0.9771 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152074     3  0.4373     0.4902 0.028 0.004 0.624 0.000 0.344 0.000
#> GSM152080     3  0.3470     0.6605 0.000 0.248 0.740 0.000 0.012 0.000
#> GSM152081     4  0.0582     0.9441 0.000 0.004 0.004 0.984 0.004 0.004
#> GSM152083     3  0.2733     0.7913 0.000 0.080 0.864 0.000 0.056 0.000
#> GSM152091     2  0.0405     0.9718 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM152108     2  0.0291     0.9732 0.004 0.992 0.000 0.000 0.004 0.000
#> GSM152114     6  0.6815     0.1769 0.060 0.000 0.052 0.400 0.060 0.428
#> GSM152035     2  0.0458     0.9693 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM152039     4  0.0260     0.9465 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM152041     4  0.0260     0.9465 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM152044     2  0.0458     0.9724 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM152045     5  0.2842     0.8183 0.104 0.000 0.044 0.000 0.852 0.000
#> GSM152051     2  0.0146     0.9771 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152054     5  0.2688     0.8361 0.068 0.000 0.064 0.000 0.868 0.000
#> GSM152057     2  0.0146     0.9771 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152058     6  0.2747     0.8274 0.076 0.000 0.008 0.004 0.036 0.876
#> GSM152067     3  0.3717     0.4450 0.000 0.000 0.616 0.000 0.384 0.000
#> GSM152068     2  0.0146     0.9771 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152075     4  0.0291     0.9467 0.000 0.004 0.004 0.992 0.000 0.000
#> GSM152076     4  0.0146     0.9470 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM152079     2  0.0146     0.9771 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152084     3  0.2024     0.7839 0.020 0.008 0.924 0.012 0.036 0.000
#> GSM152089     4  0.5705     0.3091 0.000 0.308 0.000 0.504 0.188 0.000
#> GSM152095     4  0.0260     0.9465 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM152096     3  0.2704     0.7562 0.000 0.140 0.844 0.000 0.016 0.000
#> GSM152097     2  0.1863     0.8958 0.000 0.896 0.000 0.104 0.000 0.000
#> GSM152099     2  0.0146     0.9771 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM152106     2  0.1556     0.9210 0.000 0.920 0.000 0.080 0.000 0.000
#> GSM152107     3  0.6612     0.3694 0.000 0.260 0.484 0.200 0.056 0.000
#> GSM152109     3  0.1918     0.7947 0.008 0.000 0.904 0.000 0.088 0.000
#> GSM152111     6  0.0665     0.8407 0.008 0.000 0.004 0.000 0.008 0.980
#> GSM152112     5  0.3650     0.5408 0.000 0.004 0.008 0.272 0.716 0.000
#> GSM152113     3  0.3810     0.6869 0.036 0.004 0.752 0.000 0.208 0.000
#> GSM152115     5  0.2573     0.8284 0.024 0.000 0.112 0.000 0.864 0.000
#> GSM152030     4  0.0551     0.9449 0.000 0.004 0.008 0.984 0.004 0.000
#> GSM152038     1  0.4259     0.6284 0.716 0.004 0.060 0.000 0.220 0.000
#> GSM152042     4  0.0551     0.9449 0.000 0.004 0.008 0.984 0.004 0.000
#> GSM152062     3  0.2651     0.7919 0.036 0.004 0.872 0.000 0.088 0.000
#> GSM152077     6  0.3673     0.7796 0.148 0.000 0.008 0.008 0.036 0.800
#> GSM152088     2  0.0260     0.9725 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM152100     4  0.0363     0.9437 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM152102     5  0.2234     0.8169 0.004 0.000 0.124 0.000 0.872 0.000
#> GSM152104     2  0.0937     0.9554 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM152028     1  0.1714     0.8119 0.908 0.000 0.000 0.000 0.092 0.000
#> GSM152029     3  0.2688     0.7747 0.068 0.000 0.868 0.000 0.064 0.000
#> GSM152049     6  0.1697     0.8405 0.036 0.000 0.004 0.004 0.020 0.936
#> GSM152053     4  0.0551     0.9449 0.000 0.004 0.008 0.984 0.004 0.000
#> GSM152059     1  0.1787     0.7923 0.920 0.000 0.004 0.000 0.008 0.068
#> GSM152085     6  0.1261     0.8314 0.024 0.000 0.000 0.000 0.024 0.952
#> GSM152101     5  0.2278     0.8134 0.004 0.000 0.128 0.000 0.868 0.000
#> GSM152105     1  0.1346     0.7968 0.952 0.000 0.016 0.000 0.024 0.008
#> GSM152034     6  0.2109     0.8221 0.024 0.000 0.004 0.024 0.028 0.920
#> GSM152036     4  0.0146     0.9470 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM152040     1  0.3271     0.7241 0.760 0.000 0.000 0.000 0.232 0.008
#> GSM152043     1  0.1918     0.7846 0.904 0.000 0.000 0.000 0.008 0.088
#> GSM152046     6  0.1341     0.8304 0.024 0.000 0.000 0.000 0.028 0.948
#> GSM152047     1  0.4946     0.5419 0.616 0.000 0.000 0.000 0.284 0.100
#> GSM152048     6  0.2635     0.8298 0.068 0.000 0.008 0.004 0.036 0.884
#> GSM152050     6  0.0405     0.8391 0.004 0.000 0.000 0.000 0.008 0.988
#> GSM152052     1  0.3935     0.6971 0.808 0.000 0.092 0.004 0.052 0.044
#> GSM152056     6  0.2392     0.8324 0.064 0.000 0.004 0.004 0.032 0.896
#> GSM152060     6  0.1341     0.8304 0.024 0.000 0.000 0.000 0.028 0.948
#> GSM152065     1  0.3151     0.7040 0.748 0.000 0.000 0.000 0.252 0.000
#> GSM152066     6  0.2692     0.8290 0.072 0.000 0.008 0.004 0.036 0.880
#> GSM152069     3  0.2212     0.7877 0.008 0.000 0.880 0.000 0.112 0.000
#> GSM152070     1  0.3266     0.6911 0.728 0.000 0.000 0.000 0.272 0.000
#> GSM152071     3  0.2212     0.7877 0.008 0.000 0.880 0.000 0.112 0.000
#> GSM152072     5  0.3806     0.7850 0.152 0.000 0.076 0.000 0.772 0.000
#> GSM152073     1  0.1856     0.8105 0.920 0.000 0.000 0.000 0.048 0.032
#> GSM152078     1  0.2747     0.7989 0.860 0.000 0.044 0.000 0.096 0.000
#> GSM152082     1  0.1863     0.8093 0.896 0.000 0.000 0.000 0.104 0.000
#> GSM152086     6  0.2329     0.8370 0.048 0.000 0.008 0.004 0.036 0.904
#> GSM152090     3  0.3156     0.7399 0.012 0.052 0.860 0.000 0.064 0.012
#> GSM152092     1  0.1765     0.8117 0.904 0.000 0.000 0.000 0.096 0.000
#> GSM152093     6  0.5300     0.7500 0.064 0.000 0.056 0.084 0.064 0.732
#> GSM152094     6  0.4602    -0.0317 0.484 0.000 0.004 0.000 0.028 0.484
#> GSM152098     1  0.2053     0.8094 0.888 0.000 0.000 0.000 0.108 0.004
#> GSM152110     6  0.1649     0.8395 0.036 0.000 0.000 0.000 0.032 0.932
#> GSM152031     1  0.1086     0.7954 0.964 0.000 0.012 0.000 0.012 0.012
#> GSM152037     1  0.4932    -0.0833 0.516 0.000 0.008 0.004 0.036 0.436
#> GSM152055     6  0.0692     0.8359 0.004 0.000 0.000 0.000 0.020 0.976
#> GSM152061     6  0.1341     0.8304 0.024 0.000 0.000 0.000 0.028 0.948
#> GSM152064     6  0.3780     0.6256 0.004 0.000 0.000 0.248 0.020 0.728
#> GSM152087     6  0.4331     0.0533 0.464 0.000 0.000 0.000 0.020 0.516
#> GSM152103     3  0.2520     0.7568 0.012 0.020 0.896 0.000 0.060 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-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 specimen(p) k
#> ATC:skmeans 76    4.23e-08 2
#> ATC:skmeans 82    8.61e-05 3
#> ATC:skmeans 86    7.87e-05 4
#> ATC:skmeans 76    9.13e-05 5
#> ATC:skmeans 80    1.74e-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.


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

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.562           0.818       0.919         0.4999 0.495   0.495
#> 3 3 0.590           0.770       0.857         0.2931 0.773   0.577
#> 4 4 0.902           0.878       0.951         0.1379 0.686   0.323
#> 5 5 0.822           0.851       0.899         0.0831 0.895   0.626
#> 6 6 0.796           0.718       0.835         0.0363 0.956   0.781

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
#> GSM152032     2  0.4939     0.8431 0.108 0.892
#> GSM152033     1  0.0000     0.8745 1.000 0.000
#> GSM152063     2  0.0000     0.9351 0.000 1.000
#> GSM152074     1  0.9732     0.3842 0.596 0.404
#> GSM152080     2  0.0376     0.9349 0.004 0.996
#> GSM152081     2  0.0376     0.9349 0.004 0.996
#> GSM152083     2  0.4939     0.8431 0.108 0.892
#> GSM152091     2  0.0000     0.9351 0.000 1.000
#> GSM152108     2  0.3114     0.9014 0.056 0.944
#> GSM152114     2  0.3584     0.8910 0.068 0.932
#> GSM152035     2  0.0000     0.9351 0.000 1.000
#> GSM152039     2  0.0000     0.9351 0.000 1.000
#> GSM152041     2  0.3584     0.8910 0.068 0.932
#> GSM152044     2  0.0000     0.9351 0.000 1.000
#> GSM152045     1  0.0000     0.8745 1.000 0.000
#> GSM152051     2  0.0000     0.9351 0.000 1.000
#> GSM152054     1  0.0000     0.8745 1.000 0.000
#> GSM152057     2  0.0000     0.9351 0.000 1.000
#> GSM152058     1  0.4815     0.8308 0.896 0.104
#> GSM152067     1  0.9580     0.4408 0.620 0.380
#> GSM152068     2  0.0000     0.9351 0.000 1.000
#> GSM152075     2  0.0376     0.9349 0.004 0.996
#> GSM152076     2  0.0000     0.9351 0.000 1.000
#> GSM152079     2  0.0000     0.9351 0.000 1.000
#> GSM152084     2  0.0376     0.9349 0.004 0.996
#> GSM152089     2  0.1633     0.9243 0.024 0.976
#> GSM152095     2  0.0000     0.9351 0.000 1.000
#> GSM152096     2  0.0376     0.9349 0.004 0.996
#> GSM152097     2  0.0000     0.9351 0.000 1.000
#> GSM152099     2  0.0000     0.9351 0.000 1.000
#> GSM152106     2  0.0000     0.9351 0.000 1.000
#> GSM152107     2  0.0376     0.9349 0.004 0.996
#> GSM152109     1  0.9988     0.1509 0.520 0.480
#> GSM152111     2  0.8608     0.5707 0.284 0.716
#> GSM152112     2  0.7376     0.6879 0.208 0.792
#> GSM152113     2  0.9963     0.0656 0.464 0.536
#> GSM152115     1  0.2948     0.8540 0.948 0.052
#> GSM152030     2  0.0376     0.9349 0.004 0.996
#> GSM152038     1  0.1633     0.8666 0.976 0.024
#> GSM152042     2  0.0376     0.9349 0.004 0.996
#> GSM152062     2  0.4939     0.8431 0.108 0.892
#> GSM152077     2  0.9000     0.5119 0.316 0.684
#> GSM152088     2  0.0000     0.9351 0.000 1.000
#> GSM152100     2  0.0000     0.9351 0.000 1.000
#> GSM152102     1  0.4161     0.8377 0.916 0.084
#> GSM152104     2  0.0000     0.9351 0.000 1.000
#> GSM152028     1  0.0000     0.8745 1.000 0.000
#> GSM152029     1  0.9427     0.4720 0.640 0.360
#> GSM152049     1  0.4939     0.8289 0.892 0.108
#> GSM152053     2  0.0376     0.9349 0.004 0.996
#> GSM152059     1  0.0000     0.8745 1.000 0.000
#> GSM152085     1  0.5842     0.8016 0.860 0.140
#> GSM152101     2  0.9044     0.5333 0.320 0.680
#> GSM152105     1  0.0000     0.8745 1.000 0.000
#> GSM152034     2  0.0376     0.9349 0.004 0.996
#> GSM152036     2  0.0000     0.9351 0.000 1.000
#> GSM152040     1  0.0000     0.8745 1.000 0.000
#> GSM152043     1  0.0000     0.8745 1.000 0.000
#> GSM152046     1  0.4815     0.8308 0.896 0.104
#> GSM152047     1  0.2603     0.8579 0.956 0.044
#> GSM152048     1  0.3733     0.8480 0.928 0.072
#> GSM152050     2  0.6247     0.7980 0.156 0.844
#> GSM152052     1  0.9000     0.5354 0.684 0.316
#> GSM152056     1  0.4815     0.8308 0.896 0.104
#> GSM152060     1  0.4815     0.8308 0.896 0.104
#> GSM152065     1  0.0000     0.8745 1.000 0.000
#> GSM152066     1  0.0000     0.8745 1.000 0.000
#> GSM152069     1  0.9580     0.4408 0.620 0.380
#> GSM152070     1  0.0000     0.8745 1.000 0.000
#> GSM152071     1  0.9552     0.4475 0.624 0.376
#> GSM152072     1  0.2603     0.8579 0.956 0.044
#> GSM152073     1  0.0000     0.8745 1.000 0.000
#> GSM152078     1  0.0000     0.8745 1.000 0.000
#> GSM152082     1  0.0000     0.8745 1.000 0.000
#> GSM152086     1  0.4815     0.8308 0.896 0.104
#> GSM152090     2  0.0376     0.9349 0.004 0.996
#> GSM152092     1  0.0000     0.8745 1.000 0.000
#> GSM152093     2  0.1633     0.9243 0.024 0.976
#> GSM152094     1  0.0000     0.8745 1.000 0.000
#> GSM152098     1  0.0000     0.8745 1.000 0.000
#> GSM152110     1  0.9922     0.2195 0.552 0.448
#> GSM152031     1  0.0000     0.8745 1.000 0.000
#> GSM152037     1  0.0000     0.8745 1.000 0.000
#> GSM152055     1  0.8861     0.5743 0.696 0.304
#> GSM152061     1  0.4815     0.8308 0.896 0.104
#> GSM152064     2  0.4562     0.8673 0.096 0.904
#> GSM152087     1  0.0000     0.8745 1.000 0.000
#> GSM152103     2  0.1843     0.9225 0.028 0.972

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.5363      0.745 0.276 0.000 0.724
#> GSM152033     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152063     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152074     1  0.6026     -0.108 0.624 0.000 0.376
#> GSM152080     3  0.5859      0.475 0.000 0.344 0.656
#> GSM152081     3  0.0747      0.778 0.016 0.000 0.984
#> GSM152083     3  0.7416      0.719 0.276 0.068 0.656
#> GSM152091     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152108     3  0.0747      0.778 0.016 0.000 0.984
#> GSM152114     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152035     2  0.1411      0.939 0.000 0.964 0.036
#> GSM152039     2  0.2261      0.924 0.000 0.932 0.068
#> GSM152041     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152044     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152045     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152051     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152054     1  0.1643      0.746 0.956 0.000 0.044
#> GSM152057     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152058     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152067     3  0.5859      0.710 0.344 0.000 0.656
#> GSM152068     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152075     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152076     2  0.2261      0.924 0.000 0.932 0.068
#> GSM152079     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152084     3  0.4796      0.765 0.220 0.000 0.780
#> GSM152089     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152095     2  0.4291      0.805 0.000 0.820 0.180
#> GSM152096     3  0.5363      0.745 0.276 0.000 0.724
#> GSM152097     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152099     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152106     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152107     3  0.5363      0.745 0.276 0.000 0.724
#> GSM152109     3  0.5859      0.710 0.344 0.000 0.656
#> GSM152111     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152112     3  0.6280      0.519 0.460 0.000 0.540
#> GSM152113     3  0.5363      0.745 0.276 0.000 0.724
#> GSM152115     1  0.1643      0.746 0.956 0.000 0.044
#> GSM152030     3  0.0237      0.775 0.000 0.004 0.996
#> GSM152038     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152042     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152062     3  0.5363      0.745 0.276 0.000 0.724
#> GSM152077     3  0.5678      0.225 0.316 0.000 0.684
#> GSM152088     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152100     2  0.2356      0.922 0.000 0.928 0.072
#> GSM152102     1  0.2711      0.704 0.912 0.000 0.088
#> GSM152104     2  0.0000      0.962 0.000 1.000 0.000
#> GSM152028     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152029     3  0.5882      0.707 0.348 0.000 0.652
#> GSM152049     1  0.6008      0.682 0.628 0.000 0.372
#> GSM152053     3  0.3340      0.772 0.120 0.000 0.880
#> GSM152059     1  0.3340      0.799 0.880 0.000 0.120
#> GSM152085     1  0.5905      0.710 0.648 0.000 0.352
#> GSM152101     3  0.6260      0.549 0.448 0.000 0.552
#> GSM152105     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152034     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152036     2  0.4605      0.783 0.000 0.796 0.204
#> GSM152040     1  0.4887      0.790 0.772 0.000 0.228
#> GSM152043     1  0.3941      0.800 0.844 0.000 0.156
#> GSM152046     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152047     1  0.4291      0.798 0.820 0.000 0.180
#> GSM152048     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152050     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152052     3  0.6045      0.493 0.380 0.000 0.620
#> GSM152056     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152060     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152065     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152066     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152069     3  0.5905      0.703 0.352 0.000 0.648
#> GSM152070     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152071     3  0.5859      0.710 0.344 0.000 0.656
#> GSM152072     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152073     1  0.3340      0.799 0.880 0.000 0.120
#> GSM152078     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152082     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152086     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152090     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152092     1  0.3340      0.799 0.880 0.000 0.120
#> GSM152093     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152094     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152098     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152110     1  0.6180      0.626 0.584 0.000 0.416
#> GSM152031     1  0.0000      0.780 1.000 0.000 0.000
#> GSM152037     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152055     1  0.5785      0.725 0.668 0.000 0.332
#> GSM152061     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152064     3  0.0000      0.775 0.000 0.000 1.000
#> GSM152087     1  0.5363      0.776 0.724 0.000 0.276
#> GSM152103     3  0.3879      0.769 0.152 0.000 0.848

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152033     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152063     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152074     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152080     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152081     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152083     3  0.2345      0.864 0.000 0.100 0.900 0.000
#> GSM152091     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152108     4  0.5613      0.310 0.380 0.000 0.028 0.592
#> GSM152114     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152035     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152039     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152041     1  0.4746      0.380 0.632 0.000 0.000 0.368
#> GSM152044     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152045     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152051     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152054     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152057     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152058     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152067     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152068     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152075     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152076     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152079     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152084     4  0.0895      0.925 0.020 0.000 0.004 0.976
#> GSM152089     4  0.4790      0.328 0.380 0.000 0.000 0.620
#> GSM152095     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152096     4  0.0921      0.920 0.000 0.028 0.000 0.972
#> GSM152097     2  0.0469      0.990 0.000 0.988 0.000 0.012
#> GSM152099     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152106     2  0.0469      0.990 0.000 0.988 0.000 0.012
#> GSM152107     4  0.0817      0.920 0.000 0.000 0.024 0.976
#> GSM152109     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152111     1  0.0188      0.885 0.996 0.000 0.000 0.004
#> GSM152112     4  0.0469      0.929 0.000 0.000 0.012 0.988
#> GSM152113     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152115     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152030     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152038     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152042     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152062     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152077     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152088     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152100     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152102     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152104     2  0.0000      0.998 0.000 1.000 0.000 0.000
#> GSM152028     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152029     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152049     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152053     4  0.0188      0.934 0.000 0.000 0.004 0.996
#> GSM152059     1  0.4817      0.458 0.612 0.000 0.388 0.000
#> GSM152085     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152101     3  0.0188      0.970 0.000 0.000 0.996 0.004
#> GSM152105     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152034     4  0.0707      0.926 0.020 0.000 0.000 0.980
#> GSM152036     4  0.0000      0.935 0.000 0.000 0.000 1.000
#> GSM152040     1  0.3486      0.755 0.812 0.000 0.188 0.000
#> GSM152043     1  0.4585      0.562 0.668 0.000 0.332 0.000
#> GSM152046     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152047     1  0.3569      0.745 0.804 0.000 0.196 0.000
#> GSM152048     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152050     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152052     1  0.4817      0.458 0.612 0.000 0.388 0.000
#> GSM152056     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152060     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152065     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152066     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152069     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152070     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152071     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152072     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152073     1  0.4817      0.458 0.612 0.000 0.388 0.000
#> GSM152078     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152082     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152086     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152090     4  0.0817      0.923 0.024 0.000 0.000 0.976
#> GSM152092     3  0.4996     -0.140 0.484 0.000 0.516 0.000
#> GSM152093     1  0.0188      0.885 0.996 0.000 0.000 0.004
#> GSM152094     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152098     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152110     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152031     3  0.0000      0.974 0.000 0.000 1.000 0.000
#> GSM152037     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152055     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152061     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152064     1  0.2149      0.821 0.912 0.000 0.000 0.088
#> GSM152087     1  0.0000      0.887 1.000 0.000 0.000 0.000
#> GSM152103     1  0.4830      0.354 0.608 0.000 0.000 0.392

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.1671     0.8653 0.000 0.000 0.924 0.000 0.076
#> GSM152033     3  0.2773     0.8854 0.000 0.000 0.836 0.000 0.164
#> GSM152063     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152074     3  0.2424     0.8838 0.000 0.000 0.868 0.000 0.132
#> GSM152080     2  0.3696     0.7860 0.000 0.772 0.212 0.016 0.000
#> GSM152081     4  0.1399     0.9087 0.028 0.000 0.000 0.952 0.020
#> GSM152083     3  0.0162     0.8234 0.000 0.000 0.996 0.004 0.000
#> GSM152091     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152108     4  0.4262     0.1719 0.440 0.000 0.000 0.560 0.000
#> GSM152114     1  0.0162     0.9331 0.996 0.000 0.000 0.004 0.000
#> GSM152035     2  0.0794     0.9522 0.000 0.972 0.000 0.028 0.000
#> GSM152039     4  0.3035     0.8906 0.000 0.032 0.000 0.856 0.112
#> GSM152041     1  0.4624     0.6603 0.744 0.000 0.000 0.144 0.112
#> GSM152044     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152045     5  0.2179     0.8011 0.000 0.000 0.112 0.000 0.888
#> GSM152051     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152054     3  0.3612     0.8043 0.000 0.000 0.732 0.000 0.268
#> GSM152057     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152058     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152067     3  0.0000     0.8258 0.000 0.000 1.000 0.000 0.000
#> GSM152068     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152075     4  0.1732     0.9105 0.000 0.000 0.000 0.920 0.080
#> GSM152076     4  0.2179     0.9059 0.000 0.000 0.000 0.888 0.112
#> GSM152079     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152084     4  0.0000     0.9094 0.000 0.000 0.000 1.000 0.000
#> GSM152089     4  0.2020     0.8989 0.000 0.000 0.000 0.900 0.100
#> GSM152095     4  0.2179     0.9059 0.000 0.000 0.000 0.888 0.112
#> GSM152096     4  0.3201     0.8396 0.000 0.052 0.096 0.852 0.000
#> GSM152097     2  0.2127     0.8984 0.000 0.892 0.000 0.000 0.108
#> GSM152099     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152106     2  0.1121     0.9475 0.000 0.956 0.000 0.000 0.044
#> GSM152107     4  0.0162     0.9094 0.000 0.000 0.004 0.996 0.000
#> GSM152109     3  0.0609     0.8113 0.000 0.000 0.980 0.020 0.000
#> GSM152111     1  0.0162     0.9328 0.996 0.000 0.000 0.004 0.000
#> GSM152112     4  0.0609     0.9065 0.000 0.000 0.020 0.980 0.000
#> GSM152113     3  0.2848     0.8868 0.000 0.000 0.840 0.004 0.156
#> GSM152115     3  0.2690     0.8862 0.000 0.000 0.844 0.000 0.156
#> GSM152030     4  0.1197     0.9106 0.000 0.000 0.000 0.952 0.048
#> GSM152038     3  0.3210     0.8631 0.000 0.000 0.788 0.000 0.212
#> GSM152042     4  0.0000     0.9094 0.000 0.000 0.000 1.000 0.000
#> GSM152062     3  0.2848     0.8868 0.000 0.000 0.840 0.004 0.156
#> GSM152077     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152088     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152100     4  0.2127     0.9067 0.000 0.000 0.000 0.892 0.108
#> GSM152102     3  0.2732     0.8862 0.000 0.000 0.840 0.000 0.160
#> GSM152104     2  0.0000     0.9722 0.000 1.000 0.000 0.000 0.000
#> GSM152028     5  0.3586     0.5630 0.000 0.000 0.264 0.000 0.736
#> GSM152029     5  0.4100     0.6933 0.000 0.000 0.192 0.044 0.764
#> GSM152049     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152053     4  0.0000     0.9094 0.000 0.000 0.000 1.000 0.000
#> GSM152059     5  0.2628     0.8407 0.088 0.000 0.028 0.000 0.884
#> GSM152085     1  0.4242     0.0913 0.572 0.000 0.000 0.000 0.428
#> GSM152101     3  0.4548     0.8353 0.000 0.000 0.748 0.096 0.156
#> GSM152105     3  0.3210     0.8631 0.000 0.000 0.788 0.000 0.212
#> GSM152034     4  0.1478     0.8886 0.064 0.000 0.000 0.936 0.000
#> GSM152036     4  0.2179     0.9059 0.000 0.000 0.000 0.888 0.112
#> GSM152040     5  0.2536     0.8261 0.128 0.000 0.004 0.000 0.868
#> GSM152043     5  0.2597     0.8400 0.092 0.000 0.024 0.000 0.884
#> GSM152046     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152047     5  0.3810     0.7738 0.168 0.000 0.000 0.040 0.792
#> GSM152048     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152050     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152052     5  0.4501     0.6602 0.276 0.000 0.008 0.020 0.696
#> GSM152056     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152060     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152065     3  0.3210     0.8631 0.000 0.000 0.788 0.000 0.212
#> GSM152066     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152069     3  0.0000     0.8258 0.000 0.000 1.000 0.000 0.000
#> GSM152070     5  0.2179     0.8011 0.000 0.000 0.112 0.000 0.888
#> GSM152071     3  0.0000     0.8258 0.000 0.000 1.000 0.000 0.000
#> GSM152072     3  0.2561     0.8808 0.000 0.000 0.856 0.000 0.144
#> GSM152073     5  0.2628     0.8407 0.088 0.000 0.028 0.000 0.884
#> GSM152078     3  0.3210     0.8631 0.000 0.000 0.788 0.000 0.212
#> GSM152082     5  0.2179     0.8011 0.000 0.000 0.112 0.000 0.888
#> GSM152086     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152090     4  0.1410     0.8900 0.060 0.000 0.000 0.940 0.000
#> GSM152092     5  0.2654     0.8358 0.064 0.000 0.048 0.000 0.888
#> GSM152093     1  0.1197     0.8978 0.952 0.000 0.000 0.048 0.000
#> GSM152094     5  0.3612     0.6687 0.268 0.000 0.000 0.000 0.732
#> GSM152098     5  0.2179     0.8011 0.000 0.000 0.112 0.000 0.888
#> GSM152110     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152031     3  0.4242     0.4735 0.000 0.000 0.572 0.000 0.428
#> GSM152037     1  0.3242     0.6562 0.784 0.000 0.000 0.000 0.216
#> GSM152055     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152061     1  0.0000     0.9357 1.000 0.000 0.000 0.000 0.000
#> GSM152064     1  0.1732     0.8634 0.920 0.000 0.000 0.080 0.000
#> GSM152087     5  0.3612     0.6687 0.268 0.000 0.000 0.000 0.732
#> GSM152103     4  0.4330     0.7664 0.152 0.000 0.028 0.784 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
#> GSM152032     1  0.2179     0.7520 0.900 0.000 0.064 0.000 0.036 0.000
#> GSM152033     1  0.3490     0.7029 0.724 0.000 0.008 0.000 0.268 0.000
#> GSM152063     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152074     1  0.1500     0.7574 0.936 0.000 0.012 0.000 0.052 0.000
#> GSM152080     2  0.5936     0.4699 0.272 0.576 0.076 0.076 0.000 0.000
#> GSM152081     4  0.5934     0.3931 0.000 0.000 0.328 0.444 0.000 0.228
#> GSM152083     1  0.1901     0.7179 0.912 0.000 0.008 0.076 0.004 0.000
#> GSM152091     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152108     3  0.3383     0.4851 0.004 0.000 0.728 0.000 0.000 0.268
#> GSM152114     6  0.2378     0.7483 0.000 0.000 0.152 0.000 0.000 0.848
#> GSM152035     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152039     4  0.1719     0.7300 0.000 0.016 0.060 0.924 0.000 0.000
#> GSM152041     4  0.3857     0.0461 0.000 0.000 0.000 0.532 0.000 0.468
#> GSM152044     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152045     5  0.0547     0.8458 0.020 0.000 0.000 0.000 0.980 0.000
#> GSM152051     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     1  0.4837     0.6756 0.624 0.000 0.088 0.000 0.288 0.000
#> GSM152057     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152067     1  0.2039     0.7027 0.904 0.000 0.000 0.076 0.020 0.000
#> GSM152068     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     4  0.3409     0.6608 0.000 0.000 0.300 0.700 0.000 0.000
#> GSM152076     4  0.1501     0.7402 0.000 0.000 0.076 0.924 0.000 0.000
#> GSM152079     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152084     3  0.0000     0.7193 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM152089     3  0.3821     0.5202 0.000 0.000 0.740 0.220 0.040 0.000
#> GSM152095     4  0.1501     0.7402 0.000 0.000 0.076 0.924 0.000 0.000
#> GSM152096     3  0.1794     0.7097 0.024 0.012 0.936 0.008 0.020 0.000
#> GSM152097     2  0.3833     0.3124 0.000 0.556 0.000 0.444 0.000 0.000
#> GSM152099     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152106     2  0.3151     0.6628 0.000 0.748 0.000 0.252 0.000 0.000
#> GSM152107     3  0.0146     0.7201 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM152109     1  0.5533    -0.1757 0.468 0.000 0.436 0.076 0.020 0.000
#> GSM152111     6  0.0146     0.9249 0.000 0.000 0.004 0.000 0.000 0.996
#> GSM152112     3  0.4576    -0.0201 0.400 0.000 0.560 0.000 0.040 0.000
#> GSM152113     1  0.4122     0.6926 0.724 0.000 0.212 0.000 0.064 0.000
#> GSM152115     1  0.2006     0.7550 0.892 0.000 0.004 0.000 0.104 0.000
#> GSM152030     4  0.3531     0.6406 0.000 0.000 0.328 0.672 0.000 0.000
#> GSM152038     1  0.3309     0.6946 0.720 0.000 0.000 0.000 0.280 0.000
#> GSM152042     3  0.0146     0.7183 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM152062     1  0.4122     0.6926 0.724 0.000 0.212 0.000 0.064 0.000
#> GSM152077     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152088     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152100     4  0.4210     0.6488 0.000 0.000 0.288 0.672 0.040 0.000
#> GSM152102     1  0.4421     0.7263 0.716 0.000 0.128 0.000 0.156 0.000
#> GSM152104     2  0.0000     0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152028     5  0.2883     0.6208 0.212 0.000 0.000 0.000 0.788 0.000
#> GSM152029     3  0.4829     0.3575 0.080 0.000 0.612 0.000 0.308 0.000
#> GSM152049     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152053     3  0.1196     0.7067 0.000 0.000 0.952 0.000 0.040 0.008
#> GSM152059     5  0.1444     0.8799 0.000 0.000 0.000 0.000 0.928 0.072
#> GSM152085     6  0.3804     0.2012 0.000 0.000 0.000 0.000 0.424 0.576
#> GSM152101     1  0.4704     0.6497 0.664 0.000 0.236 0.000 0.100 0.000
#> GSM152105     1  0.3309     0.6946 0.720 0.000 0.000 0.000 0.280 0.000
#> GSM152034     3  0.2823     0.5674 0.000 0.000 0.796 0.000 0.000 0.204
#> GSM152036     4  0.1501     0.7402 0.000 0.000 0.076 0.924 0.000 0.000
#> GSM152040     5  0.1501     0.8785 0.000 0.000 0.000 0.000 0.924 0.076
#> GSM152043     5  0.1588     0.8795 0.000 0.000 0.004 0.000 0.924 0.072
#> GSM152046     6  0.0146     0.9259 0.000 0.000 0.000 0.000 0.004 0.996
#> GSM152047     5  0.2488     0.8522 0.000 0.000 0.044 0.000 0.880 0.076
#> GSM152048     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152050     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152052     5  0.5162     0.1989 0.000 0.000 0.408 0.000 0.504 0.088
#> GSM152056     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152060     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152065     1  0.3309     0.6946 0.720 0.000 0.000 0.000 0.280 0.000
#> GSM152066     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152069     1  0.2039     0.7027 0.904 0.000 0.000 0.076 0.020 0.000
#> GSM152070     5  0.1267     0.8452 0.060 0.000 0.000 0.000 0.940 0.000
#> GSM152071     1  0.2039     0.7027 0.904 0.000 0.000 0.076 0.020 0.000
#> GSM152072     1  0.2801     0.7353 0.860 0.000 0.000 0.072 0.068 0.000
#> GSM152073     5  0.1444     0.8799 0.000 0.000 0.000 0.000 0.928 0.072
#> GSM152078     1  0.3309     0.6946 0.720 0.000 0.000 0.000 0.280 0.000
#> GSM152082     5  0.1267     0.8452 0.060 0.000 0.000 0.000 0.940 0.000
#> GSM152086     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152090     3  0.0865     0.7222 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM152092     5  0.1387     0.8796 0.000 0.000 0.000 0.000 0.932 0.068
#> GSM152093     3  0.3862     0.1624 0.000 0.000 0.524 0.000 0.000 0.476
#> GSM152094     5  0.2340     0.8221 0.000 0.000 0.000 0.000 0.852 0.148
#> GSM152098     5  0.1267     0.8452 0.060 0.000 0.000 0.000 0.940 0.000
#> GSM152110     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152031     1  0.3857     0.3605 0.532 0.000 0.000 0.000 0.468 0.000
#> GSM152037     6  0.3499     0.4352 0.000 0.000 0.000 0.000 0.320 0.680
#> GSM152055     6  0.0000     0.9283 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152061     6  0.0146     0.9259 0.000 0.000 0.000 0.000 0.004 0.996
#> GSM152064     6  0.0858     0.9005 0.000 0.000 0.028 0.000 0.004 0.968
#> GSM152087     5  0.2340     0.8221 0.000 0.000 0.000 0.000 0.852 0.148
#> GSM152103     3  0.1196     0.7221 0.008 0.000 0.952 0.000 0.000 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-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 specimen(p) k
#> ATC:pam 80    0.000022 2
#> ATC:pam 84    0.000319 3
#> ATC:pam 80    0.001273 4
#> ATC:pam 85    0.000913 5
#> ATC:pam 75    0.013315 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 10612 rows and 88 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.522           0.844       0.910         0.2899 0.762   0.762
#> 3 3 0.437           0.744       0.787         1.1172 0.526   0.405
#> 4 4 0.415           0.594       0.767         0.1051 0.649   0.318
#> 5 5 0.850           0.867       0.909         0.0976 0.851   0.582
#> 6 6 0.666           0.542       0.793         0.0516 0.859   0.544

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
#> GSM152032     2  0.0000      0.893 0.000 1.000
#> GSM152033     2  0.0000      0.893 0.000 1.000
#> GSM152063     2  0.0376      0.892 0.004 0.996
#> GSM152074     2  0.0000      0.893 0.000 1.000
#> GSM152080     2  0.0000      0.893 0.000 1.000
#> GSM152081     2  0.7950      0.756 0.240 0.760
#> GSM152083     2  0.0000      0.893 0.000 1.000
#> GSM152091     2  0.0376      0.892 0.004 0.996
#> GSM152108     2  0.0000      0.893 0.000 1.000
#> GSM152114     2  0.8909      0.661 0.308 0.692
#> GSM152035     2  0.0376      0.892 0.004 0.996
#> GSM152039     2  0.7299      0.793 0.204 0.796
#> GSM152041     2  0.8081      0.752 0.248 0.752
#> GSM152044     2  0.0376      0.892 0.004 0.996
#> GSM152045     2  0.2236      0.868 0.036 0.964
#> GSM152051     2  0.0376      0.892 0.004 0.996
#> GSM152054     2  0.2236      0.868 0.036 0.964
#> GSM152057     2  0.0376      0.892 0.004 0.996
#> GSM152058     1  0.2423      0.924 0.960 0.040
#> GSM152067     2  0.0000      0.893 0.000 1.000
#> GSM152068     2  0.0376      0.892 0.004 0.996
#> GSM152075     2  0.8016      0.756 0.244 0.756
#> GSM152076     2  0.7376      0.789 0.208 0.792
#> GSM152079     2  0.0376      0.892 0.004 0.996
#> GSM152084     2  0.0000      0.893 0.000 1.000
#> GSM152089     2  0.0000      0.893 0.000 1.000
#> GSM152095     2  0.6531      0.821 0.168 0.832
#> GSM152096     2  0.0000      0.893 0.000 1.000
#> GSM152097     2  0.0376      0.892 0.004 0.996
#> GSM152099     2  0.0376      0.892 0.004 0.996
#> GSM152106     2  0.0376      0.892 0.004 0.996
#> GSM152107     2  0.0000      0.893 0.000 1.000
#> GSM152109     2  0.0000      0.893 0.000 1.000
#> GSM152111     1  0.4815      0.882 0.896 0.104
#> GSM152112     2  0.2236      0.868 0.036 0.964
#> GSM152113     2  0.0000      0.893 0.000 1.000
#> GSM152115     2  0.2236      0.868 0.036 0.964
#> GSM152030     2  0.8081      0.752 0.248 0.752
#> GSM152038     2  0.0000      0.893 0.000 1.000
#> GSM152042     2  0.6048      0.831 0.148 0.852
#> GSM152062     2  0.0000      0.893 0.000 1.000
#> GSM152077     2  0.8955      0.655 0.312 0.688
#> GSM152088     2  0.0376      0.892 0.004 0.996
#> GSM152100     2  0.0376      0.892 0.004 0.996
#> GSM152102     2  0.2236      0.868 0.036 0.964
#> GSM152104     2  0.0376      0.892 0.004 0.996
#> GSM152028     2  0.5408      0.843 0.124 0.876
#> GSM152029     2  0.0000      0.893 0.000 1.000
#> GSM152049     1  0.2423      0.924 0.960 0.040
#> GSM152053     2  0.6801      0.809 0.180 0.820
#> GSM152059     2  0.8144      0.745 0.252 0.748
#> GSM152085     1  0.4298      0.897 0.912 0.088
#> GSM152101     2  0.2236      0.868 0.036 0.964
#> GSM152105     2  0.5842      0.836 0.140 0.860
#> GSM152034     2  0.8207      0.740 0.256 0.744
#> GSM152036     2  0.7883      0.764 0.236 0.764
#> GSM152040     2  0.5946      0.833 0.144 0.856
#> GSM152043     2  0.8443      0.720 0.272 0.728
#> GSM152046     2  0.8443      0.720 0.272 0.728
#> GSM152047     2  0.5946      0.833 0.144 0.856
#> GSM152048     1  0.2423      0.924 0.960 0.040
#> GSM152050     1  0.2423      0.924 0.960 0.040
#> GSM152052     2  0.0672      0.890 0.008 0.992
#> GSM152056     1  0.2423      0.924 0.960 0.040
#> GSM152060     2  0.8327      0.731 0.264 0.736
#> GSM152065     2  0.0000      0.893 0.000 1.000
#> GSM152066     1  0.2423      0.924 0.960 0.040
#> GSM152069     2  0.0000      0.893 0.000 1.000
#> GSM152070     2  0.0000      0.893 0.000 1.000
#> GSM152071     2  0.0000      0.893 0.000 1.000
#> GSM152072     2  0.0000      0.893 0.000 1.000
#> GSM152073     2  0.8081      0.748 0.248 0.752
#> GSM152078     2  0.0000      0.893 0.000 1.000
#> GSM152082     2  0.0000      0.893 0.000 1.000
#> GSM152086     1  0.2423      0.924 0.960 0.040
#> GSM152090     2  0.0000      0.893 0.000 1.000
#> GSM152092     2  0.5842      0.835 0.140 0.860
#> GSM152093     2  0.8386      0.724 0.268 0.732
#> GSM152094     1  0.2948      0.919 0.948 0.052
#> GSM152098     2  0.2043      0.883 0.032 0.968
#> GSM152110     2  0.8207      0.740 0.256 0.744
#> GSM152031     2  0.5842      0.837 0.140 0.860
#> GSM152037     1  0.8207      0.667 0.744 0.256
#> GSM152055     2  0.8327      0.731 0.264 0.736
#> GSM152061     2  0.8327      0.731 0.264 0.736
#> GSM152064     2  0.8016      0.752 0.244 0.756
#> GSM152087     1  0.9460      0.391 0.636 0.364
#> GSM152103     2  0.0000      0.893 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.5223      0.720 0.024 0.176 0.800
#> GSM152033     3  0.0237      0.735 0.000 0.004 0.996
#> GSM152063     2  0.2711      0.789 0.000 0.912 0.088
#> GSM152074     3  0.4749      0.720 0.012 0.172 0.816
#> GSM152080     3  0.5775      0.665 0.012 0.260 0.728
#> GSM152081     2  0.8951      0.372 0.396 0.476 0.128
#> GSM152083     3  0.5737      0.668 0.012 0.256 0.732
#> GSM152091     2  0.2625      0.790 0.000 0.916 0.084
#> GSM152108     3  0.8098      0.635 0.140 0.216 0.644
#> GSM152114     1  0.3267      0.860 0.884 0.000 0.116
#> GSM152035     3  0.6308      0.202 0.000 0.492 0.508
#> GSM152039     2  0.7248      0.727 0.184 0.708 0.108
#> GSM152041     2  0.8250      0.601 0.292 0.600 0.108
#> GSM152044     2  0.2625      0.790 0.000 0.916 0.084
#> GSM152045     3  0.1411      0.721 0.000 0.036 0.964
#> GSM152051     2  0.2625      0.790 0.000 0.916 0.084
#> GSM152054     3  0.1411      0.721 0.000 0.036 0.964
#> GSM152057     2  0.2625      0.790 0.000 0.916 0.084
#> GSM152058     1  0.0000      0.936 1.000 0.000 0.000
#> GSM152067     3  0.2066      0.738 0.000 0.060 0.940
#> GSM152068     2  0.2625      0.790 0.000 0.916 0.084
#> GSM152075     2  0.7610      0.697 0.216 0.676 0.108
#> GSM152076     2  0.7248      0.727 0.184 0.708 0.108
#> GSM152079     2  0.2625      0.790 0.000 0.916 0.084
#> GSM152084     3  0.5560      0.675 0.300 0.000 0.700
#> GSM152089     3  0.6400      0.489 0.052 0.208 0.740
#> GSM152095     2  0.7316      0.729 0.184 0.704 0.112
#> GSM152096     3  0.4968      0.712 0.012 0.188 0.800
#> GSM152097     2  0.2496      0.789 0.004 0.928 0.068
#> GSM152099     2  0.2625      0.790 0.000 0.916 0.084
#> GSM152106     2  0.2496      0.789 0.004 0.928 0.068
#> GSM152107     3  0.6542      0.711 0.060 0.204 0.736
#> GSM152109     3  0.4749      0.720 0.012 0.172 0.816
#> GSM152111     1  0.0237      0.937 0.996 0.000 0.004
#> GSM152112     3  0.1411      0.721 0.000 0.036 0.964
#> GSM152113     3  0.5911      0.748 0.156 0.060 0.784
#> GSM152115     3  0.1411      0.721 0.000 0.036 0.964
#> GSM152030     2  0.8048      0.657 0.264 0.628 0.108
#> GSM152038     3  0.5138      0.731 0.252 0.000 0.748
#> GSM152042     2  0.8674      0.602 0.296 0.568 0.136
#> GSM152062     3  0.5875      0.747 0.160 0.056 0.784
#> GSM152077     1  0.1411      0.936 0.964 0.000 0.036
#> GSM152088     2  0.2860      0.789 0.004 0.912 0.084
#> GSM152100     2  0.7777      0.742 0.164 0.676 0.160
#> GSM152102     3  0.1411      0.721 0.000 0.036 0.964
#> GSM152104     2  0.2261      0.787 0.000 0.932 0.068
#> GSM152028     3  0.6264      0.616 0.380 0.004 0.616
#> GSM152029     3  0.6979      0.736 0.128 0.140 0.732
#> GSM152049     1  0.0000      0.936 1.000 0.000 0.000
#> GSM152053     2  0.9975      0.245 0.312 0.368 0.320
#> GSM152059     3  0.6126      0.593 0.400 0.000 0.600
#> GSM152085     1  0.1031      0.939 0.976 0.000 0.024
#> GSM152101     3  0.1411      0.721 0.000 0.036 0.964
#> GSM152105     3  0.6111      0.599 0.396 0.000 0.604
#> GSM152034     1  0.3120      0.898 0.908 0.012 0.080
#> GSM152036     2  0.7365      0.726 0.188 0.700 0.112
#> GSM152040     3  0.5363      0.697 0.276 0.000 0.724
#> GSM152043     1  0.5956      0.318 0.672 0.004 0.324
#> GSM152046     1  0.1832      0.935 0.956 0.008 0.036
#> GSM152047     3  0.5815      0.684 0.304 0.004 0.692
#> GSM152048     1  0.0000      0.936 1.000 0.000 0.000
#> GSM152050     1  0.0000      0.936 1.000 0.000 0.000
#> GSM152052     3  0.6008      0.631 0.372 0.000 0.628
#> GSM152056     1  0.0000      0.936 1.000 0.000 0.000
#> GSM152060     1  0.1832      0.935 0.956 0.008 0.036
#> GSM152065     3  0.2261      0.739 0.068 0.000 0.932
#> GSM152066     1  0.0000      0.936 1.000 0.000 0.000
#> GSM152069     3  0.4390      0.728 0.012 0.148 0.840
#> GSM152070     3  0.2261      0.739 0.068 0.000 0.932
#> GSM152071     3  0.4749      0.720 0.012 0.172 0.816
#> GSM152072     3  0.0237      0.735 0.000 0.004 0.996
#> GSM152073     3  0.6330      0.596 0.396 0.004 0.600
#> GSM152078     3  0.5835      0.664 0.340 0.000 0.660
#> GSM152082     3  0.4293      0.744 0.164 0.004 0.832
#> GSM152086     1  0.0000      0.936 1.000 0.000 0.000
#> GSM152090     3  0.5560      0.675 0.300 0.000 0.700
#> GSM152092     3  0.6079      0.608 0.388 0.000 0.612
#> GSM152093     1  0.2356      0.910 0.928 0.000 0.072
#> GSM152094     1  0.0000      0.936 1.000 0.000 0.000
#> GSM152098     3  0.5956      0.675 0.324 0.004 0.672
#> GSM152110     1  0.1647      0.936 0.960 0.004 0.036
#> GSM152031     3  0.6111      0.600 0.396 0.000 0.604
#> GSM152037     1  0.0747      0.939 0.984 0.000 0.016
#> GSM152055     1  0.1832      0.935 0.956 0.008 0.036
#> GSM152061     1  0.2173      0.932 0.944 0.008 0.048
#> GSM152064     1  0.3377      0.883 0.896 0.012 0.092
#> GSM152087     1  0.1289      0.936 0.968 0.000 0.032
#> GSM152103     3  0.6875      0.718 0.244 0.056 0.700

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     2  0.5742      0.584 0.000 0.648 0.300 0.052
#> GSM152033     3  0.0524      0.815 0.000 0.004 0.988 0.008
#> GSM152063     4  0.6165      0.451 0.008 0.380 0.040 0.572
#> GSM152074     2  0.5742      0.584 0.000 0.648 0.300 0.052
#> GSM152080     2  0.3569      0.630 0.000 0.804 0.196 0.000
#> GSM152081     1  0.7047      0.346 0.440 0.000 0.120 0.440
#> GSM152083     2  0.3569      0.630 0.000 0.804 0.196 0.000
#> GSM152091     2  0.5371      0.500 0.000 0.732 0.080 0.188
#> GSM152108     1  0.9123      0.456 0.476 0.156 0.200 0.168
#> GSM152114     1  0.3959      0.734 0.840 0.000 0.068 0.092
#> GSM152035     2  0.7611      0.343 0.004 0.424 0.400 0.172
#> GSM152039     4  0.1489      0.663 0.044 0.000 0.004 0.952
#> GSM152041     4  0.5119     -0.257 0.440 0.000 0.004 0.556
#> GSM152044     4  0.5000      0.219 0.000 0.500 0.000 0.500
#> GSM152045     3  0.0188      0.816 0.000 0.000 0.996 0.004
#> GSM152051     2  0.3610      0.436 0.000 0.800 0.000 0.200
#> GSM152054     3  0.0469      0.817 0.000 0.000 0.988 0.012
#> GSM152057     2  0.3610      0.436 0.000 0.800 0.000 0.200
#> GSM152058     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152067     3  0.3257      0.631 0.000 0.152 0.844 0.004
#> GSM152068     2  0.3610      0.436 0.000 0.800 0.000 0.200
#> GSM152075     4  0.2266      0.636 0.084 0.000 0.004 0.912
#> GSM152076     4  0.1489      0.663 0.044 0.000 0.004 0.952
#> GSM152079     2  0.3610      0.436 0.000 0.800 0.000 0.200
#> GSM152084     1  0.6576      0.618 0.632 0.000 0.200 0.168
#> GSM152089     3  0.6442      0.486 0.124 0.000 0.632 0.244
#> GSM152095     4  0.1489      0.663 0.044 0.000 0.004 0.952
#> GSM152096     2  0.5849      0.588 0.004 0.656 0.288 0.052
#> GSM152097     4  0.4543      0.526 0.000 0.324 0.000 0.676
#> GSM152099     2  0.3610      0.436 0.000 0.800 0.000 0.200
#> GSM152106     4  0.4643      0.510 0.000 0.344 0.000 0.656
#> GSM152107     2  0.8935      0.420 0.148 0.472 0.264 0.116
#> GSM152109     2  0.5742      0.584 0.000 0.648 0.300 0.052
#> GSM152111     1  0.0188      0.739 0.996 0.000 0.004 0.000
#> GSM152112     3  0.0469      0.817 0.000 0.000 0.988 0.012
#> GSM152113     1  0.9165      0.436 0.468 0.156 0.212 0.164
#> GSM152115     3  0.0336      0.817 0.000 0.000 0.992 0.008
#> GSM152030     1  0.6737      0.432 0.532 0.000 0.100 0.368
#> GSM152038     1  0.6316      0.531 0.596 0.000 0.324 0.080
#> GSM152042     1  0.6664      0.624 0.616 0.000 0.152 0.232
#> GSM152062     1  0.9646      0.204 0.380 0.244 0.212 0.164
#> GSM152077     1  0.2300      0.739 0.920 0.000 0.016 0.064
#> GSM152088     2  0.3123      0.459 0.000 0.844 0.000 0.156
#> GSM152100     4  0.3962      0.533 0.044 0.000 0.124 0.832
#> GSM152102     3  0.0336      0.815 0.000 0.000 0.992 0.008
#> GSM152104     4  0.4916      0.388 0.000 0.424 0.000 0.576
#> GSM152028     1  0.4697      0.607 0.696 0.000 0.296 0.008
#> GSM152029     2  0.9636      0.201 0.252 0.380 0.204 0.164
#> GSM152049     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152053     1  0.7398      0.453 0.456 0.000 0.168 0.376
#> GSM152059     1  0.3569      0.698 0.804 0.000 0.196 0.000
#> GSM152085     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152101     3  0.0336      0.815 0.000 0.000 0.992 0.008
#> GSM152105     1  0.3569      0.698 0.804 0.000 0.196 0.000
#> GSM152034     1  0.4898      0.597 0.716 0.000 0.024 0.260
#> GSM152036     4  0.1489      0.663 0.044 0.000 0.004 0.952
#> GSM152040     3  0.6278      0.530 0.228 0.000 0.652 0.120
#> GSM152043     1  0.3047      0.735 0.872 0.000 0.116 0.012
#> GSM152046     1  0.4559      0.639 0.792 0.040 0.004 0.164
#> GSM152047     3  0.7261      0.101 0.340 0.000 0.500 0.160
#> GSM152048     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152050     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152052     1  0.3688      0.694 0.792 0.000 0.208 0.000
#> GSM152056     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152060     1  0.5011      0.589 0.748 0.040 0.004 0.208
#> GSM152065     3  0.3435      0.760 0.100 0.000 0.864 0.036
#> GSM152066     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152069     2  0.5742      0.584 0.000 0.648 0.300 0.052
#> GSM152070     3  0.3107      0.772 0.080 0.000 0.884 0.036
#> GSM152071     2  0.5742      0.584 0.000 0.648 0.300 0.052
#> GSM152072     3  0.0336      0.817 0.000 0.000 0.992 0.008
#> GSM152073     1  0.3933      0.696 0.792 0.000 0.200 0.008
#> GSM152078     1  0.5219      0.670 0.728 0.000 0.216 0.056
#> GSM152082     3  0.3581      0.749 0.116 0.000 0.852 0.032
#> GSM152086     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152090     1  0.6570      0.617 0.632 0.000 0.204 0.164
#> GSM152092     1  0.4524      0.688 0.768 0.000 0.204 0.028
#> GSM152093     1  0.2197      0.748 0.928 0.000 0.048 0.024
#> GSM152094     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152098     1  0.5673      0.474 0.596 0.000 0.372 0.032
#> GSM152110     1  0.4542      0.630 0.752 0.000 0.020 0.228
#> GSM152031     1  0.3569      0.698 0.804 0.000 0.196 0.000
#> GSM152037     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152055     1  0.5011      0.589 0.748 0.040 0.004 0.208
#> GSM152061     1  0.5011      0.589 0.748 0.040 0.004 0.208
#> GSM152064     1  0.5754      0.546 0.636 0.000 0.048 0.316
#> GSM152087     1  0.0000      0.739 1.000 0.000 0.000 0.000
#> GSM152103     1  0.7795      0.574 0.584 0.048 0.204 0.164

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.1992      0.983 0.044 0.000 0.924 0.000 0.032
#> GSM152033     5  0.1443      0.856 0.044 0.000 0.004 0.004 0.948
#> GSM152063     2  0.1787      0.882 0.044 0.936 0.004 0.016 0.000
#> GSM152074     3  0.1992      0.983 0.044 0.000 0.924 0.000 0.032
#> GSM152080     3  0.3016      0.959 0.044 0.040 0.884 0.000 0.032
#> GSM152081     4  0.1617      0.897 0.020 0.020 0.000 0.948 0.012
#> GSM152083     3  0.3016      0.959 0.044 0.040 0.884 0.000 0.032
#> GSM152091     2  0.3016      0.852 0.044 0.884 0.040 0.000 0.032
#> GSM152108     1  0.4053      0.864 0.840 0.060 0.024 0.044 0.032
#> GSM152114     1  0.1901      0.931 0.932 0.000 0.004 0.040 0.024
#> GSM152035     2  0.5485      0.121 0.044 0.496 0.008 0.000 0.452
#> GSM152039     4  0.1644      0.899 0.008 0.048 0.004 0.940 0.000
#> GSM152041     4  0.1012      0.904 0.012 0.020 0.000 0.968 0.000
#> GSM152044     2  0.1626      0.882 0.044 0.940 0.000 0.016 0.000
#> GSM152045     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000
#> GSM152051     2  0.1978      0.891 0.044 0.928 0.024 0.004 0.000
#> GSM152054     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000
#> GSM152057     2  0.1978      0.891 0.044 0.928 0.024 0.004 0.000
#> GSM152058     1  0.1626      0.921 0.940 0.000 0.044 0.016 0.000
#> GSM152067     5  0.5167      0.216 0.044 0.000 0.404 0.000 0.552
#> GSM152068     2  0.1978      0.891 0.044 0.928 0.024 0.004 0.000
#> GSM152075     4  0.1408      0.900 0.008 0.044 0.000 0.948 0.000
#> GSM152076     4  0.1644      0.899 0.008 0.048 0.004 0.940 0.000
#> GSM152079     2  0.1978      0.891 0.044 0.928 0.024 0.004 0.000
#> GSM152084     1  0.2122      0.918 0.924 0.000 0.008 0.036 0.032
#> GSM152089     5  0.5915      0.338 0.056 0.012 0.008 0.380 0.544
#> GSM152095     4  0.1644      0.899 0.008 0.048 0.004 0.940 0.000
#> GSM152096     3  0.2675      0.973 0.044 0.012 0.904 0.008 0.032
#> GSM152097     2  0.0510      0.853 0.000 0.984 0.000 0.016 0.000
#> GSM152099     2  0.1907      0.890 0.044 0.928 0.028 0.000 0.000
#> GSM152106     2  0.0510      0.853 0.000 0.984 0.000 0.016 0.000
#> GSM152107     2  0.5945      0.541 0.240 0.656 0.056 0.016 0.032
#> GSM152109     3  0.1992      0.983 0.044 0.000 0.924 0.000 0.032
#> GSM152111     1  0.1626      0.921 0.940 0.000 0.044 0.016 0.000
#> GSM152112     5  0.0290      0.859 0.000 0.000 0.008 0.000 0.992
#> GSM152113     1  0.2696      0.908 0.900 0.000 0.040 0.028 0.032
#> GSM152115     5  0.0000      0.860 0.000 0.000 0.000 0.000 1.000
#> GSM152030     1  0.2460      0.912 0.900 0.024 0.000 0.072 0.004
#> GSM152038     1  0.2351      0.918 0.916 0.000 0.028 0.020 0.036
#> GSM152042     1  0.2580      0.920 0.900 0.020 0.000 0.064 0.016
#> GSM152062     1  0.2617      0.909 0.904 0.000 0.036 0.028 0.032
#> GSM152077     1  0.1205      0.931 0.956 0.000 0.000 0.040 0.004
#> GSM152088     2  0.1907      0.890 0.044 0.928 0.028 0.000 0.000
#> GSM152100     4  0.1883      0.891 0.012 0.048 0.008 0.932 0.000
#> GSM152102     5  0.0162      0.860 0.000 0.000 0.004 0.000 0.996
#> GSM152104     2  0.0510      0.853 0.000 0.984 0.000 0.016 0.000
#> GSM152028     1  0.2067      0.928 0.928 0.000 0.028 0.032 0.012
#> GSM152029     1  0.2987      0.894 0.884 0.000 0.056 0.028 0.032
#> GSM152049     1  0.1626      0.921 0.940 0.000 0.044 0.016 0.000
#> GSM152053     4  0.4970      0.443 0.340 0.008 0.000 0.624 0.028
#> GSM152059     1  0.1299      0.935 0.960 0.000 0.020 0.008 0.012
#> GSM152085     1  0.2074      0.918 0.920 0.000 0.044 0.036 0.000
#> GSM152101     5  0.0162      0.860 0.000 0.000 0.004 0.000 0.996
#> GSM152105     1  0.1012      0.934 0.968 0.000 0.020 0.000 0.012
#> GSM152034     4  0.2411      0.870 0.108 0.000 0.000 0.884 0.008
#> GSM152036     4  0.1484      0.899 0.008 0.048 0.000 0.944 0.000
#> GSM152040     5  0.2248      0.837 0.088 0.000 0.000 0.012 0.900
#> GSM152043     1  0.1686      0.931 0.944 0.000 0.020 0.028 0.008
#> GSM152046     4  0.1768      0.895 0.072 0.000 0.004 0.924 0.000
#> GSM152047     5  0.5136      0.585 0.080 0.000 0.000 0.260 0.660
#> GSM152048     1  0.2074      0.918 0.920 0.000 0.044 0.036 0.000
#> GSM152050     1  0.1626      0.921 0.940 0.000 0.044 0.016 0.000
#> GSM152052     1  0.1168      0.931 0.960 0.000 0.000 0.008 0.032
#> GSM152056     1  0.1626      0.921 0.940 0.000 0.044 0.016 0.000
#> GSM152060     4  0.1697      0.897 0.060 0.000 0.008 0.932 0.000
#> GSM152065     5  0.1924      0.854 0.064 0.000 0.008 0.004 0.924
#> GSM152066     1  0.1626      0.921 0.940 0.000 0.044 0.016 0.000
#> GSM152069     3  0.1992      0.983 0.044 0.000 0.924 0.000 0.032
#> GSM152070     5  0.1924      0.854 0.064 0.000 0.008 0.004 0.924
#> GSM152071     3  0.1992      0.983 0.044 0.000 0.924 0.000 0.032
#> GSM152072     5  0.1443      0.856 0.044 0.000 0.004 0.004 0.948
#> GSM152073     1  0.1799      0.930 0.940 0.000 0.020 0.028 0.012
#> GSM152078     1  0.1202      0.929 0.960 0.000 0.004 0.004 0.032
#> GSM152082     5  0.2666      0.841 0.076 0.000 0.012 0.020 0.892
#> GSM152086     1  0.1626      0.921 0.940 0.000 0.044 0.016 0.000
#> GSM152090     1  0.2234      0.922 0.920 0.000 0.012 0.036 0.032
#> GSM152092     1  0.1885      0.930 0.936 0.000 0.020 0.032 0.012
#> GSM152093     1  0.0898      0.936 0.972 0.000 0.000 0.020 0.008
#> GSM152094     1  0.1408      0.922 0.948 0.000 0.044 0.008 0.000
#> GSM152098     1  0.4244      0.764 0.780 0.000 0.024 0.028 0.168
#> GSM152110     4  0.2848      0.822 0.156 0.000 0.000 0.840 0.004
#> GSM152031     1  0.1299      0.935 0.960 0.000 0.020 0.008 0.012
#> GSM152037     1  0.1648      0.924 0.940 0.000 0.040 0.020 0.000
#> GSM152055     4  0.1697      0.897 0.060 0.000 0.008 0.932 0.000
#> GSM152061     4  0.1697      0.897 0.060 0.000 0.008 0.932 0.000
#> GSM152064     4  0.2104      0.891 0.060 0.000 0.000 0.916 0.024
#> GSM152087     1  0.1836      0.924 0.932 0.000 0.032 0.036 0.000
#> GSM152103     1  0.2256      0.922 0.920 0.000 0.016 0.032 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
#> GSM152032     3  0.0363     0.8506 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM152033     5  0.4531     0.2038 0.464 0.000 0.032 0.000 0.504 0.000
#> GSM152063     2  0.1285     0.8433 0.000 0.944 0.004 0.052 0.000 0.000
#> GSM152074     3  0.0363     0.8506 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM152080     3  0.3586     0.6405 0.000 0.268 0.720 0.000 0.012 0.000
#> GSM152081     4  0.4464     0.4137 0.028 0.000 0.000 0.624 0.008 0.340
#> GSM152083     3  0.3586     0.6405 0.000 0.268 0.720 0.000 0.012 0.000
#> GSM152091     2  0.2189     0.8099 0.008 0.912 0.044 0.004 0.032 0.000
#> GSM152108     6  0.7682     0.2283 0.144 0.132 0.012 0.236 0.020 0.456
#> GSM152114     6  0.3269     0.5969 0.052 0.000 0.000 0.108 0.008 0.832
#> GSM152035     2  0.4318     0.4568 0.008 0.632 0.020 0.000 0.340 0.000
#> GSM152039     4  0.0000     0.7451 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM152041     4  0.2402     0.7224 0.012 0.000 0.000 0.868 0.000 0.120
#> GSM152044     2  0.1152     0.8452 0.000 0.952 0.004 0.044 0.000 0.000
#> GSM152045     5  0.0363     0.7812 0.012 0.000 0.000 0.000 0.988 0.000
#> GSM152051     2  0.0000     0.8503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152054     5  0.0260     0.7826 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM152057     2  0.0000     0.8503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152058     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152067     3  0.4109     0.3199 0.012 0.000 0.576 0.000 0.412 0.000
#> GSM152068     2  0.0000     0.8503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM152075     4  0.1644     0.7413 0.004 0.000 0.000 0.920 0.000 0.076
#> GSM152076     4  0.0000     0.7451 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM152079     2  0.0146     0.8504 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM152084     6  0.6384     0.3479 0.244 0.000 0.012 0.224 0.016 0.504
#> GSM152089     5  0.6779    -0.1383 0.048 0.000 0.000 0.264 0.420 0.268
#> GSM152095     4  0.0000     0.7451 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM152096     3  0.2497     0.8058 0.040 0.032 0.896 0.000 0.032 0.000
#> GSM152097     2  0.2584     0.7998 0.004 0.848 0.004 0.144 0.000 0.000
#> GSM152099     2  0.0146     0.8504 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM152106     2  0.2584     0.7998 0.004 0.848 0.004 0.144 0.000 0.000
#> GSM152107     2  0.8429    -0.2571 0.120 0.320 0.024 0.224 0.032 0.280
#> GSM152109     3  0.0363     0.8506 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM152111     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152112     5  0.0260     0.7826 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM152113     6  0.6736     0.3184 0.244 0.000 0.016 0.224 0.032 0.484
#> GSM152115     5  0.0363     0.7812 0.012 0.000 0.000 0.000 0.988 0.000
#> GSM152030     6  0.4569     0.1811 0.040 0.000 0.000 0.396 0.000 0.564
#> GSM152038     1  0.2298     0.5340 0.912 0.000 0.024 0.008 0.032 0.024
#> GSM152042     6  0.5698     0.3261 0.112 0.000 0.004 0.308 0.016 0.560
#> GSM152062     1  0.8005     0.0497 0.336 0.000 0.132 0.224 0.032 0.276
#> GSM152077     6  0.0972     0.6582 0.008 0.000 0.000 0.028 0.000 0.964
#> GSM152088     2  0.0146     0.8504 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM152100     4  0.1268     0.7201 0.036 0.004 0.000 0.952 0.008 0.000
#> GSM152102     5  0.0260     0.7826 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM152104     2  0.2584     0.7998 0.004 0.848 0.004 0.144 0.000 0.000
#> GSM152028     1  0.2911     0.5514 0.832 0.000 0.000 0.000 0.024 0.144
#> GSM152029     6  0.7564     0.1012 0.300 0.000 0.096 0.224 0.016 0.364
#> GSM152049     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152053     4  0.5167     0.3265 0.060 0.000 0.000 0.564 0.016 0.360
#> GSM152059     6  0.3563     0.3529 0.336 0.000 0.000 0.000 0.000 0.664
#> GSM152085     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152101     5  0.0260     0.7826 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM152105     6  0.3684     0.2774 0.372 0.000 0.000 0.000 0.000 0.628
#> GSM152034     6  0.4136     0.0728 0.012 0.000 0.000 0.428 0.000 0.560
#> GSM152036     4  0.0000     0.7451 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM152040     1  0.6733     0.2078 0.408 0.000 0.000 0.048 0.212 0.332
#> GSM152043     6  0.3151     0.5092 0.252 0.000 0.000 0.000 0.000 0.748
#> GSM152046     6  0.4173     0.3787 0.028 0.000 0.008 0.272 0.000 0.692
#> GSM152047     6  0.7350    -0.1357 0.316 0.000 0.000 0.252 0.108 0.324
#> GSM152048     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152050     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152052     6  0.3885     0.4240 0.300 0.000 0.004 0.000 0.012 0.684
#> GSM152056     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152060     6  0.4684     0.3263 0.036 0.000 0.008 0.300 0.008 0.648
#> GSM152065     1  0.3850     0.2919 0.716 0.000 0.004 0.000 0.260 0.020
#> GSM152066     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152069     3  0.0363     0.8506 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM152070     1  0.3879     0.2538 0.688 0.000 0.000 0.000 0.292 0.020
#> GSM152071     3  0.0363     0.8506 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM152072     5  0.4186     0.4718 0.312 0.000 0.032 0.000 0.656 0.000
#> GSM152073     6  0.3717     0.2717 0.384 0.000 0.000 0.000 0.000 0.616
#> GSM152078     1  0.6206     0.1489 0.512 0.000 0.012 0.116 0.028 0.332
#> GSM152082     1  0.3023     0.4944 0.836 0.000 0.000 0.000 0.120 0.044
#> GSM152086     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152090     6  0.6214     0.3905 0.204 0.000 0.012 0.228 0.016 0.540
#> GSM152092     1  0.3699     0.3774 0.660 0.000 0.000 0.000 0.004 0.336
#> GSM152093     6  0.1141     0.6523 0.052 0.000 0.000 0.000 0.000 0.948
#> GSM152094     6  0.1814     0.6251 0.100 0.000 0.000 0.000 0.000 0.900
#> GSM152098     1  0.2265     0.5425 0.896 0.000 0.000 0.000 0.052 0.052
#> GSM152110     6  0.3565     0.3638 0.004 0.000 0.000 0.304 0.000 0.692
#> GSM152031     6  0.3563     0.3529 0.336 0.000 0.000 0.000 0.000 0.664
#> GSM152037     6  0.0146     0.6621 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM152055     6  0.4684     0.3263 0.036 0.000 0.008 0.300 0.008 0.648
#> GSM152061     6  0.4684     0.3263 0.036 0.000 0.008 0.300 0.008 0.648
#> GSM152064     4  0.4496     0.2782 0.020 0.000 0.000 0.564 0.008 0.408
#> GSM152087     6  0.0000     0.6631 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM152103     6  0.6194     0.3957 0.204 0.000 0.012 0.224 0.016 0.544

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

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.860           0.919       0.965         0.4997 0.498   0.498
#> 3 3 0.469           0.440       0.719         0.3301 0.639   0.393
#> 4 4 0.649           0.725       0.859         0.1193 0.721   0.357
#> 5 5 0.590           0.595       0.776         0.0581 0.912   0.686
#> 6 6 0.614           0.592       0.750         0.0393 0.954   0.796

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
#> GSM152032     2   0.644      0.800 0.164 0.836
#> GSM152033     1   0.000      0.959 1.000 0.000
#> GSM152063     2   0.000      0.966 0.000 1.000
#> GSM152074     1   0.000      0.959 1.000 0.000
#> GSM152080     2   0.000      0.966 0.000 1.000
#> GSM152081     2   0.000      0.966 0.000 1.000
#> GSM152083     2   0.000      0.966 0.000 1.000
#> GSM152091     2   0.000      0.966 0.000 1.000
#> GSM152108     2   0.000      0.966 0.000 1.000
#> GSM152114     2   0.204      0.940 0.032 0.968
#> GSM152035     2   0.000      0.966 0.000 1.000
#> GSM152039     2   0.000      0.966 0.000 1.000
#> GSM152041     2   0.000      0.966 0.000 1.000
#> GSM152044     2   0.000      0.966 0.000 1.000
#> GSM152045     1   0.000      0.959 1.000 0.000
#> GSM152051     2   0.000      0.966 0.000 1.000
#> GSM152054     1   0.295      0.917 0.948 0.052
#> GSM152057     2   0.000      0.966 0.000 1.000
#> GSM152058     1   0.000      0.959 1.000 0.000
#> GSM152067     1   0.904      0.544 0.680 0.320
#> GSM152068     2   0.000      0.966 0.000 1.000
#> GSM152075     2   0.000      0.966 0.000 1.000
#> GSM152076     2   0.000      0.966 0.000 1.000
#> GSM152079     2   0.000      0.966 0.000 1.000
#> GSM152084     2   0.833      0.645 0.264 0.736
#> GSM152089     2   0.000      0.966 0.000 1.000
#> GSM152095     2   0.000      0.966 0.000 1.000
#> GSM152096     2   0.000      0.966 0.000 1.000
#> GSM152097     2   0.000      0.966 0.000 1.000
#> GSM152099     2   0.000      0.966 0.000 1.000
#> GSM152106     2   0.000      0.966 0.000 1.000
#> GSM152107     2   0.000      0.966 0.000 1.000
#> GSM152109     2   0.671      0.784 0.176 0.824
#> GSM152111     1   0.653      0.790 0.832 0.168
#> GSM152112     2   0.000      0.966 0.000 1.000
#> GSM152113     1   0.886      0.575 0.696 0.304
#> GSM152115     1   0.000      0.959 1.000 0.000
#> GSM152030     2   0.000      0.966 0.000 1.000
#> GSM152038     1   0.000      0.959 1.000 0.000
#> GSM152042     2   0.000      0.966 0.000 1.000
#> GSM152062     1   0.260      0.924 0.956 0.044
#> GSM152077     1   0.000      0.959 1.000 0.000
#> GSM152088     2   0.000      0.966 0.000 1.000
#> GSM152100     2   0.000      0.966 0.000 1.000
#> GSM152102     2   0.000      0.966 0.000 1.000
#> GSM152104     2   0.000      0.966 0.000 1.000
#> GSM152028     1   0.000      0.959 1.000 0.000
#> GSM152029     1   0.574      0.829 0.864 0.136
#> GSM152049     1   0.000      0.959 1.000 0.000
#> GSM152053     2   0.000      0.966 0.000 1.000
#> GSM152059     1   0.000      0.959 1.000 0.000
#> GSM152085     1   0.000      0.959 1.000 0.000
#> GSM152101     2   0.118      0.954 0.016 0.984
#> GSM152105     1   0.000      0.959 1.000 0.000
#> GSM152034     1   0.978      0.313 0.588 0.412
#> GSM152036     2   0.000      0.966 0.000 1.000
#> GSM152040     1   0.000      0.959 1.000 0.000
#> GSM152043     1   0.000      0.959 1.000 0.000
#> GSM152046     1   0.000      0.959 1.000 0.000
#> GSM152047     1   0.000      0.959 1.000 0.000
#> GSM152048     1   0.000      0.959 1.000 0.000
#> GSM152050     1   0.000      0.959 1.000 0.000
#> GSM152052     1   0.000      0.959 1.000 0.000
#> GSM152056     1   0.000      0.959 1.000 0.000
#> GSM152060     1   0.000      0.959 1.000 0.000
#> GSM152065     1   0.000      0.959 1.000 0.000
#> GSM152066     1   0.000      0.959 1.000 0.000
#> GSM152069     1   0.118      0.947 0.984 0.016
#> GSM152070     1   0.000      0.959 1.000 0.000
#> GSM152071     1   0.000      0.959 1.000 0.000
#> GSM152072     1   0.000      0.959 1.000 0.000
#> GSM152073     1   0.000      0.959 1.000 0.000
#> GSM152078     1   0.000      0.959 1.000 0.000
#> GSM152082     1   0.000      0.959 1.000 0.000
#> GSM152086     1   0.000      0.959 1.000 0.000
#> GSM152090     2   0.000      0.966 0.000 1.000
#> GSM152092     1   0.000      0.959 1.000 0.000
#> GSM152093     1   0.955      0.413 0.624 0.376
#> GSM152094     1   0.000      0.959 1.000 0.000
#> GSM152098     1   0.000      0.959 1.000 0.000
#> GSM152110     1   0.000      0.959 1.000 0.000
#> GSM152031     1   0.000      0.959 1.000 0.000
#> GSM152037     1   0.000      0.959 1.000 0.000
#> GSM152055     1   0.000      0.959 1.000 0.000
#> GSM152061     1   0.000      0.959 1.000 0.000
#> GSM152064     2   0.929      0.473 0.344 0.656
#> GSM152087     1   0.000      0.959 1.000 0.000
#> GSM152103     2   0.781      0.701 0.232 0.768

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM152032     3  0.0237   0.692689 0.004 0.000 0.996
#> GSM152033     1  0.6252   0.104053 0.556 0.000 0.444
#> GSM152063     2  0.6309  -0.305897 0.000 0.500 0.500
#> GSM152074     3  0.2959   0.646595 0.100 0.000 0.900
#> GSM152080     3  0.3116   0.668518 0.000 0.108 0.892
#> GSM152081     2  0.0747   0.658164 0.016 0.984 0.000
#> GSM152083     3  0.0747   0.692066 0.000 0.016 0.984
#> GSM152091     3  0.5397   0.568174 0.000 0.280 0.720
#> GSM152108     2  0.6095   0.026088 0.000 0.608 0.392
#> GSM152114     2  0.4002   0.588538 0.160 0.840 0.000
#> GSM152035     3  0.4346   0.632483 0.000 0.184 0.816
#> GSM152039     2  0.0000   0.654399 0.000 1.000 0.000
#> GSM152041     2  0.2356   0.645833 0.072 0.928 0.000
#> GSM152044     2  0.6299  -0.251657 0.000 0.524 0.476
#> GSM152045     1  0.4235   0.587208 0.824 0.000 0.176
#> GSM152051     3  0.6267   0.359298 0.000 0.452 0.548
#> GSM152054     1  0.7049   0.080645 0.528 0.020 0.452
#> GSM152057     3  0.6252   0.372480 0.000 0.444 0.556
#> GSM152058     1  0.6280   0.075505 0.540 0.460 0.000
#> GSM152067     3  0.0892   0.690667 0.020 0.000 0.980
#> GSM152068     3  0.6274   0.352787 0.000 0.456 0.544
#> GSM152075     2  0.1031   0.658093 0.024 0.976 0.000
#> GSM152076     2  0.0000   0.654399 0.000 1.000 0.000
#> GSM152079     3  0.6274   0.352787 0.000 0.456 0.544
#> GSM152084     3  0.9364   0.158532 0.172 0.372 0.456
#> GSM152089     2  0.0424   0.651434 0.000 0.992 0.008
#> GSM152095     2  0.0237   0.653032 0.000 0.996 0.004
#> GSM152096     3  0.1964   0.685313 0.000 0.056 0.944
#> GSM152097     2  0.3879   0.508773 0.000 0.848 0.152
#> GSM152099     3  0.5882   0.501356 0.000 0.348 0.652
#> GSM152106     2  0.3879   0.508894 0.000 0.848 0.152
#> GSM152107     3  0.5397   0.567728 0.000 0.280 0.720
#> GSM152109     3  0.0592   0.692128 0.012 0.000 0.988
#> GSM152111     2  0.5733   0.402112 0.324 0.676 0.000
#> GSM152112     2  0.6252  -0.054970 0.000 0.556 0.444
#> GSM152113     3  0.5591   0.406901 0.304 0.000 0.696
#> GSM152115     3  0.6307   0.020213 0.488 0.000 0.512
#> GSM152030     2  0.0424   0.651170 0.000 0.992 0.008
#> GSM152038     1  0.5760   0.354289 0.672 0.000 0.328
#> GSM152042     2  0.0747   0.646952 0.000 0.984 0.016
#> GSM152062     3  0.6302   0.040271 0.480 0.000 0.520
#> GSM152077     1  0.5988   0.291034 0.632 0.368 0.000
#> GSM152088     3  0.6095   0.447181 0.000 0.392 0.608
#> GSM152100     2  0.0747   0.646952 0.000 0.984 0.016
#> GSM152102     3  0.0424   0.692896 0.000 0.008 0.992
#> GSM152104     2  0.5650   0.209217 0.000 0.688 0.312
#> GSM152028     1  0.1289   0.703330 0.968 0.000 0.032
#> GSM152029     3  0.6008   0.289780 0.372 0.000 0.628
#> GSM152049     1  0.6305   0.001349 0.516 0.484 0.000
#> GSM152053     2  0.1753   0.622504 0.000 0.952 0.048
#> GSM152059     1  0.0424   0.702109 0.992 0.008 0.000
#> GSM152085     1  0.6308  -0.026609 0.508 0.492 0.000
#> GSM152101     3  0.0475   0.693136 0.004 0.004 0.992
#> GSM152105     1  0.1163   0.704434 0.972 0.000 0.028
#> GSM152034     2  0.5016   0.516938 0.240 0.760 0.000
#> GSM152036     2  0.0747   0.657621 0.016 0.984 0.000
#> GSM152040     1  0.2625   0.662396 0.916 0.084 0.000
#> GSM152043     1  0.0592   0.700742 0.988 0.012 0.000
#> GSM152046     2  0.6274   0.136608 0.456 0.544 0.000
#> GSM152047     1  0.5291   0.467764 0.732 0.268 0.000
#> GSM152048     1  0.6079   0.255964 0.612 0.388 0.000
#> GSM152050     2  0.6204   0.209906 0.424 0.576 0.000
#> GSM152052     1  0.0000   0.704081 1.000 0.000 0.000
#> GSM152056     2  0.6291   0.102733 0.468 0.532 0.000
#> GSM152060     2  0.6291   0.102973 0.468 0.532 0.000
#> GSM152065     1  0.4399   0.573077 0.812 0.000 0.188
#> GSM152066     1  0.6168   0.201841 0.588 0.412 0.000
#> GSM152069     3  0.2165   0.669589 0.064 0.000 0.936
#> GSM152070     1  0.2625   0.671751 0.916 0.000 0.084
#> GSM152071     3  0.5254   0.467889 0.264 0.000 0.736
#> GSM152072     1  0.6260   0.095713 0.552 0.000 0.448
#> GSM152073     1  0.0000   0.704081 1.000 0.000 0.000
#> GSM152078     1  0.4121   0.595962 0.832 0.000 0.168
#> GSM152082     1  0.2356   0.680158 0.928 0.000 0.072
#> GSM152086     1  0.6305   0.000653 0.516 0.484 0.000
#> GSM152090     2  0.6126   0.090280 0.004 0.644 0.352
#> GSM152092     1  0.1031   0.704961 0.976 0.000 0.024
#> GSM152093     2  0.5363   0.473631 0.276 0.724 0.000
#> GSM152094     1  0.5560   0.420025 0.700 0.300 0.000
#> GSM152098     1  0.0592   0.705407 0.988 0.000 0.012
#> GSM152110     2  0.6286   0.115080 0.464 0.536 0.000
#> GSM152031     1  0.0592   0.705407 0.988 0.000 0.012
#> GSM152037     1  0.0747   0.699307 0.984 0.016 0.000
#> GSM152055     2  0.6267   0.146745 0.452 0.548 0.000
#> GSM152061     2  0.6280   0.125777 0.460 0.540 0.000
#> GSM152064     2  0.4931   0.525841 0.232 0.768 0.000
#> GSM152087     1  0.2711   0.659876 0.912 0.088 0.000
#> GSM152103     3  0.7824   0.589694 0.212 0.124 0.664

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM152032     2  0.1706      0.842 0.016 0.948 0.036 0.000
#> GSM152033     3  0.0804      0.826 0.008 0.012 0.980 0.000
#> GSM152063     4  0.4941      0.128 0.000 0.436 0.000 0.564
#> GSM152074     3  0.4245      0.725 0.020 0.196 0.784 0.000
#> GSM152080     2  0.0336      0.868 0.000 0.992 0.008 0.000
#> GSM152081     4  0.0469      0.840 0.012 0.000 0.000 0.988
#> GSM152083     2  0.0469      0.865 0.000 0.988 0.012 0.000
#> GSM152091     2  0.1022      0.879 0.000 0.968 0.000 0.032
#> GSM152108     2  0.5774      0.635 0.004 0.692 0.068 0.236
#> GSM152114     1  0.3597      0.772 0.836 0.016 0.000 0.148
#> GSM152035     2  0.6465      0.101 0.000 0.516 0.412 0.072
#> GSM152039     4  0.0188      0.840 0.004 0.000 0.000 0.996
#> GSM152041     4  0.1211      0.835 0.040 0.000 0.000 0.960
#> GSM152044     2  0.3726      0.718 0.000 0.788 0.000 0.212
#> GSM152045     3  0.0592      0.824 0.000 0.000 0.984 0.016
#> GSM152051     2  0.1474      0.876 0.000 0.948 0.000 0.052
#> GSM152054     3  0.1118      0.819 0.000 0.000 0.964 0.036
#> GSM152057     2  0.1389      0.877 0.000 0.952 0.000 0.048
#> GSM152058     1  0.0707      0.836 0.980 0.000 0.000 0.020
#> GSM152067     3  0.3123      0.766 0.000 0.156 0.844 0.000
#> GSM152068     2  0.2011      0.860 0.000 0.920 0.000 0.080
#> GSM152075     4  0.0000      0.840 0.000 0.000 0.000 1.000
#> GSM152076     4  0.0000      0.840 0.000 0.000 0.000 1.000
#> GSM152079     2  0.1211      0.878 0.000 0.960 0.000 0.040
#> GSM152084     1  0.5977      0.263 0.528 0.432 0.000 0.040
#> GSM152089     4  0.2921      0.738 0.000 0.000 0.140 0.860
#> GSM152095     4  0.0336      0.840 0.000 0.008 0.000 0.992
#> GSM152096     2  0.0000      0.869 0.000 1.000 0.000 0.000
#> GSM152097     4  0.2973      0.767 0.000 0.144 0.000 0.856
#> GSM152099     2  0.0921      0.879 0.000 0.972 0.000 0.028
#> GSM152106     4  0.2216      0.805 0.000 0.092 0.000 0.908
#> GSM152107     2  0.1824      0.872 0.000 0.936 0.004 0.060
#> GSM152109     2  0.4820      0.454 0.012 0.692 0.296 0.000
#> GSM152111     1  0.3196      0.783 0.856 0.008 0.000 0.136
#> GSM152112     3  0.4431      0.561 0.000 0.000 0.696 0.304
#> GSM152113     3  0.4964      0.662 0.028 0.256 0.716 0.000
#> GSM152115     3  0.0469      0.826 0.000 0.012 0.988 0.000
#> GSM152030     4  0.2830      0.818 0.040 0.060 0.000 0.900
#> GSM152038     3  0.3324      0.769 0.136 0.012 0.852 0.000
#> GSM152042     4  0.4903      0.640 0.028 0.248 0.000 0.724
#> GSM152062     3  0.6757      0.561 0.192 0.196 0.612 0.000
#> GSM152077     1  0.4095      0.747 0.804 0.000 0.024 0.172
#> GSM152088     2  0.0469      0.875 0.000 0.988 0.000 0.012
#> GSM152100     4  0.0336      0.838 0.000 0.000 0.008 0.992
#> GSM152102     3  0.1557      0.817 0.000 0.056 0.944 0.000
#> GSM152104     4  0.4431      0.545 0.000 0.304 0.000 0.696
#> GSM152028     1  0.4431      0.565 0.696 0.000 0.304 0.000
#> GSM152029     1  0.4428      0.624 0.720 0.276 0.004 0.000
#> GSM152049     1  0.1022      0.834 0.968 0.000 0.000 0.032
#> GSM152053     4  0.0524      0.839 0.000 0.008 0.004 0.988
#> GSM152059     1  0.0817      0.836 0.976 0.000 0.024 0.000
#> GSM152085     1  0.2611      0.814 0.896 0.000 0.008 0.096
#> GSM152101     3  0.1211      0.821 0.000 0.040 0.960 0.000
#> GSM152105     1  0.0921      0.836 0.972 0.000 0.028 0.000
#> GSM152034     1  0.5143      0.236 0.540 0.000 0.004 0.456
#> GSM152036     4  0.0336      0.838 0.000 0.000 0.008 0.992
#> GSM152040     3  0.4050      0.739 0.036 0.000 0.820 0.144
#> GSM152043     1  0.1211      0.835 0.960 0.000 0.040 0.000
#> GSM152046     1  0.4991      0.413 0.608 0.000 0.004 0.388
#> GSM152047     3  0.5078      0.580 0.028 0.000 0.700 0.272
#> GSM152048     1  0.1929      0.837 0.940 0.000 0.024 0.036
#> GSM152050     1  0.3123      0.770 0.844 0.000 0.000 0.156
#> GSM152052     1  0.1388      0.832 0.960 0.028 0.012 0.000
#> GSM152056     1  0.2469      0.804 0.892 0.000 0.000 0.108
#> GSM152060     1  0.5628      0.306 0.556 0.000 0.024 0.420
#> GSM152065     3  0.0779      0.825 0.016 0.004 0.980 0.000
#> GSM152066     1  0.0469      0.836 0.988 0.000 0.000 0.012
#> GSM152069     3  0.4916      0.350 0.000 0.424 0.576 0.000
#> GSM152070     3  0.0336      0.825 0.008 0.000 0.992 0.000
#> GSM152071     3  0.7098      0.299 0.132 0.376 0.492 0.000
#> GSM152072     3  0.0672      0.826 0.008 0.008 0.984 0.000
#> GSM152073     1  0.1474      0.832 0.948 0.000 0.052 0.000
#> GSM152078     1  0.2021      0.827 0.936 0.024 0.040 0.000
#> GSM152082     3  0.1792      0.808 0.068 0.000 0.932 0.000
#> GSM152086     1  0.0592      0.836 0.984 0.000 0.000 0.016
#> GSM152090     1  0.5159      0.463 0.624 0.364 0.000 0.012
#> GSM152092     1  0.3074      0.767 0.848 0.000 0.152 0.000
#> GSM152093     1  0.2198      0.820 0.920 0.008 0.000 0.072
#> GSM152094     1  0.1297      0.838 0.964 0.000 0.020 0.016
#> GSM152098     1  0.4679      0.501 0.648 0.000 0.352 0.000
#> GSM152110     4  0.4155      0.626 0.240 0.000 0.004 0.756
#> GSM152031     1  0.0817      0.836 0.976 0.000 0.024 0.000
#> GSM152037     1  0.0817      0.836 0.976 0.000 0.024 0.000
#> GSM152055     4  0.4792      0.474 0.312 0.000 0.008 0.680
#> GSM152061     4  0.5432      0.454 0.316 0.000 0.032 0.652
#> GSM152064     4  0.2647      0.781 0.120 0.000 0.000 0.880
#> GSM152087     1  0.1211      0.835 0.960 0.000 0.040 0.000
#> GSM152103     1  0.3710      0.725 0.804 0.192 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM152032     3  0.4010     0.6417 0.000 0.088 0.796 0.000 0.116
#> GSM152033     3  0.4114     0.3189 0.000 0.000 0.624 0.000 0.376
#> GSM152063     4  0.4300    -0.0908 0.000 0.476 0.000 0.524 0.000
#> GSM152074     3  0.3274     0.5726 0.000 0.000 0.780 0.000 0.220
#> GSM152080     2  0.1018     0.7908 0.000 0.968 0.016 0.000 0.016
#> GSM152081     4  0.1195     0.7327 0.000 0.012 0.028 0.960 0.000
#> GSM152083     2  0.3530     0.6622 0.000 0.784 0.204 0.000 0.012
#> GSM152091     2  0.0671     0.7945 0.000 0.980 0.016 0.000 0.004
#> GSM152108     3  0.4639     0.6448 0.000 0.056 0.788 0.084 0.072
#> GSM152114     3  0.6495     0.1382 0.216 0.000 0.480 0.304 0.000
#> GSM152035     2  0.6350     0.3821 0.000 0.552 0.024 0.108 0.316
#> GSM152039     4  0.0451     0.7355 0.000 0.000 0.004 0.988 0.008
#> GSM152041     4  0.1978     0.7239 0.024 0.004 0.044 0.928 0.000
#> GSM152044     2  0.4473     0.5114 0.000 0.656 0.020 0.324 0.000
#> GSM152045     5  0.1978     0.7645 0.004 0.000 0.024 0.044 0.928
#> GSM152051     2  0.2362     0.8001 0.000 0.900 0.024 0.076 0.000
#> GSM152054     5  0.3051     0.7570 0.000 0.000 0.120 0.028 0.852
#> GSM152057     2  0.3485     0.7672 0.000 0.828 0.048 0.124 0.000
#> GSM152058     1  0.5493     0.6131 0.628 0.000 0.264 0.108 0.000
#> GSM152067     5  0.4403     0.5743 0.004 0.240 0.032 0.000 0.724
#> GSM152068     2  0.2361     0.7952 0.000 0.892 0.012 0.096 0.000
#> GSM152075     4  0.0867     0.7369 0.000 0.008 0.008 0.976 0.008
#> GSM152076     4  0.0451     0.7365 0.000 0.004 0.000 0.988 0.008
#> GSM152079     2  0.1725     0.8058 0.000 0.936 0.020 0.044 0.000
#> GSM152084     3  0.4469     0.6063 0.048 0.044 0.800 0.104 0.004
#> GSM152089     4  0.4610     0.2622 0.000 0.000 0.016 0.596 0.388
#> GSM152095     4  0.0290     0.7371 0.000 0.008 0.000 0.992 0.000
#> GSM152096     2  0.0613     0.8026 0.000 0.984 0.004 0.008 0.004
#> GSM152097     4  0.2886     0.6809 0.000 0.148 0.008 0.844 0.000
#> GSM152099     2  0.2046     0.8050 0.000 0.916 0.016 0.068 0.000
#> GSM152106     4  0.3010     0.6613 0.000 0.172 0.004 0.824 0.000
#> GSM152107     2  0.5118     0.7007 0.000 0.716 0.128 0.148 0.008
#> GSM152109     2  0.3327     0.7193 0.000 0.828 0.028 0.000 0.144
#> GSM152111     1  0.4621     0.6874 0.744 0.004 0.076 0.176 0.000
#> GSM152112     5  0.3884     0.5535 0.000 0.000 0.004 0.288 0.708
#> GSM152113     3  0.4461     0.6217 0.000 0.036 0.760 0.020 0.184
#> GSM152115     5  0.2852     0.7275 0.000 0.000 0.172 0.000 0.828
#> GSM152030     4  0.5133     0.2788 0.012 0.024 0.384 0.580 0.000
#> GSM152038     3  0.4118     0.4094 0.004 0.000 0.660 0.000 0.336
#> GSM152042     4  0.3666     0.6735 0.012 0.032 0.132 0.824 0.000
#> GSM152062     3  0.2660     0.6403 0.000 0.000 0.864 0.008 0.128
#> GSM152077     3  0.3738     0.6496 0.052 0.000 0.844 0.064 0.040
#> GSM152088     2  0.0162     0.8011 0.000 0.996 0.000 0.004 0.000
#> GSM152100     4  0.1591     0.7218 0.000 0.004 0.004 0.940 0.052
#> GSM152102     5  0.3067     0.7489 0.000 0.012 0.140 0.004 0.844
#> GSM152104     4  0.4367     0.3032 0.000 0.372 0.008 0.620 0.000
#> GSM152028     1  0.5555     0.4795 0.640 0.000 0.140 0.000 0.220
#> GSM152029     1  0.5483     0.3870 0.616 0.316 0.016 0.000 0.052
#> GSM152049     1  0.3169     0.7346 0.856 0.000 0.084 0.060 0.000
#> GSM152053     3  0.5673     0.1569 0.000 0.020 0.512 0.428 0.040
#> GSM152059     1  0.0000     0.7324 1.000 0.000 0.000 0.000 0.000
#> GSM152085     1  0.1168     0.7376 0.960 0.000 0.000 0.032 0.008
#> GSM152101     5  0.1471     0.7675 0.000 0.020 0.024 0.004 0.952
#> GSM152105     3  0.4817     0.0938 0.404 0.000 0.572 0.000 0.024
#> GSM152034     1  0.5526     0.4798 0.608 0.000 0.004 0.308 0.080
#> GSM152036     4  0.1894     0.7103 0.000 0.000 0.008 0.920 0.072
#> GSM152040     5  0.4651     0.6863 0.104 0.000 0.012 0.120 0.764
#> GSM152043     1  0.0404     0.7300 0.988 0.000 0.000 0.000 0.012
#> GSM152046     1  0.4564     0.4766 0.612 0.000 0.000 0.372 0.016
#> GSM152047     5  0.4758     0.6397 0.088 0.000 0.008 0.160 0.744
#> GSM152048     1  0.5750     0.6143 0.616 0.000 0.228 0.156 0.000
#> GSM152050     1  0.5144     0.5669 0.640 0.000 0.068 0.292 0.000
#> GSM152052     1  0.2732     0.7103 0.840 0.000 0.160 0.000 0.000
#> GSM152056     1  0.5952     0.5757 0.584 0.000 0.164 0.252 0.000
#> GSM152060     1  0.5019     0.3124 0.532 0.000 0.000 0.436 0.032
#> GSM152065     5  0.3318     0.7273 0.012 0.000 0.180 0.000 0.808
#> GSM152066     1  0.3639     0.7186 0.812 0.000 0.144 0.044 0.000
#> GSM152069     2  0.5226     0.4951 0.012 0.636 0.044 0.000 0.308
#> GSM152070     5  0.3825     0.7393 0.136 0.000 0.060 0.000 0.804
#> GSM152071     2  0.6676     0.4300 0.080 0.568 0.076 0.000 0.276
#> GSM152072     5  0.2388     0.7713 0.028 0.000 0.072 0.000 0.900
#> GSM152073     1  0.0609     0.7265 0.980 0.000 0.000 0.000 0.020
#> GSM152078     1  0.1280     0.7326 0.960 0.008 0.024 0.000 0.008
#> GSM152082     5  0.5441     0.5505 0.324 0.000 0.080 0.000 0.596
#> GSM152086     1  0.2409     0.7381 0.900 0.000 0.068 0.032 0.000
#> GSM152090     1  0.4595     0.1498 0.504 0.488 0.004 0.004 0.000
#> GSM152092     1  0.2074     0.6890 0.896 0.000 0.000 0.000 0.104
#> GSM152093     1  0.5896     0.6024 0.596 0.000 0.236 0.168 0.000
#> GSM152094     1  0.0162     0.7318 0.996 0.000 0.000 0.000 0.004
#> GSM152098     1  0.4557     0.0195 0.584 0.000 0.012 0.000 0.404
#> GSM152110     4  0.3905     0.5406 0.232 0.000 0.012 0.752 0.004
#> GSM152031     1  0.1908     0.7299 0.908 0.000 0.092 0.000 0.000
#> GSM152037     1  0.3231     0.6880 0.800 0.000 0.196 0.004 0.000
#> GSM152055     4  0.4613     0.2210 0.360 0.000 0.000 0.620 0.020
#> GSM152061     4  0.5799     0.1723 0.360 0.000 0.004 0.548 0.088
#> GSM152064     4  0.3443     0.6333 0.164 0.000 0.008 0.816 0.012
#> GSM152087     1  0.0290     0.7310 0.992 0.000 0.000 0.000 0.008
#> GSM152103     1  0.5783     0.5720 0.632 0.232 0.128 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM152032     1  0.5785     0.1651 0.496 0.048 0.392 0.000 0.064 0.000
#> GSM152033     1  0.4335     0.1090 0.508 0.000 0.020 0.000 0.472 0.000
#> GSM152063     2  0.3579     0.7717 0.008 0.784 0.020 0.184 0.004 0.000
#> GSM152074     1  0.5150     0.4230 0.608 0.000 0.256 0.000 0.136 0.000
#> GSM152080     2  0.0865     0.8538 0.000 0.964 0.036 0.000 0.000 0.000
#> GSM152081     4  0.3514     0.6970 0.032 0.000 0.108 0.824 0.000 0.036
#> GSM152083     2  0.4410     0.6815 0.096 0.744 0.144 0.000 0.016 0.000
#> GSM152091     2  0.0653     0.8671 0.000 0.980 0.012 0.004 0.004 0.000
#> GSM152108     1  0.3824     0.5507 0.820 0.064 0.016 0.020 0.080 0.000
#> GSM152114     1  0.5788     0.3199 0.632 0.004 0.052 0.192 0.000 0.120
#> GSM152035     2  0.4029     0.7355 0.032 0.780 0.008 0.024 0.156 0.000
#> GSM152039     4  0.0767     0.7270 0.004 0.008 0.012 0.976 0.000 0.000
#> GSM152041     4  0.3348     0.7068 0.048 0.008 0.060 0.852 0.000 0.032
#> GSM152044     2  0.2996     0.8108 0.008 0.832 0.016 0.144 0.000 0.000
#> GSM152045     5  0.2726     0.7550 0.004 0.000 0.052 0.056 0.880 0.008
#> GSM152051     2  0.1194     0.8741 0.004 0.956 0.008 0.032 0.000 0.000
#> GSM152054     5  0.2571     0.7336 0.060 0.004 0.024 0.020 0.892 0.000
#> GSM152057     2  0.1666     0.8717 0.008 0.936 0.020 0.036 0.000 0.000
#> GSM152058     6  0.5291     0.4657 0.424 0.000 0.040 0.032 0.000 0.504
#> GSM152067     3  0.4500     0.5353 0.000 0.088 0.688 0.000 0.224 0.000
#> GSM152068     2  0.1332     0.8739 0.008 0.952 0.012 0.028 0.000 0.000
#> GSM152075     4  0.1628     0.7279 0.008 0.004 0.036 0.940 0.000 0.012
#> GSM152076     4  0.1138     0.7240 0.004 0.012 0.024 0.960 0.000 0.000
#> GSM152079     2  0.1116     0.8741 0.004 0.960 0.008 0.028 0.000 0.000
#> GSM152084     3  0.5825     0.2708 0.280 0.008 0.596 0.072 0.004 0.040
#> GSM152089     4  0.5281     0.4164 0.004 0.004 0.172 0.636 0.184 0.000
#> GSM152095     4  0.1526     0.7255 0.008 0.004 0.036 0.944 0.000 0.008
#> GSM152096     2  0.0603     0.8656 0.004 0.980 0.016 0.000 0.000 0.000
#> GSM152097     4  0.4441     0.5189 0.016 0.240 0.044 0.700 0.000 0.000
#> GSM152099     2  0.3275     0.7818 0.008 0.820 0.140 0.032 0.000 0.000
#> GSM152106     4  0.4877    -0.0947 0.008 0.464 0.040 0.488 0.000 0.000
#> GSM152107     3  0.4332     0.5820 0.024 0.052 0.792 0.092 0.040 0.000
#> GSM152109     3  0.4145     0.5722 0.004 0.220 0.724 0.000 0.052 0.000
#> GSM152111     6  0.4298     0.6895 0.084 0.000 0.048 0.092 0.000 0.776
#> GSM152112     5  0.5348     0.5169 0.016 0.000 0.104 0.272 0.608 0.000
#> GSM152113     1  0.3075     0.5706 0.844 0.004 0.020 0.000 0.120 0.012
#> GSM152115     5  0.2941     0.7042 0.064 0.000 0.076 0.004 0.856 0.000
#> GSM152030     4  0.5410     0.5477 0.164 0.012 0.128 0.672 0.000 0.024
#> GSM152038     1  0.5120     0.4821 0.600 0.000 0.120 0.000 0.280 0.000
#> GSM152042     3  0.5289     0.1944 0.032 0.004 0.520 0.412 0.000 0.032
#> GSM152062     1  0.5520     0.2127 0.496 0.000 0.396 0.004 0.100 0.004
#> GSM152077     1  0.2671     0.5475 0.892 0.000 0.008 0.040 0.024 0.036
#> GSM152088     2  0.0260     0.8670 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM152100     4  0.1655     0.7158 0.004 0.012 0.044 0.936 0.004 0.000
#> GSM152102     5  0.3066     0.7243 0.056 0.048 0.016 0.012 0.868 0.000
#> GSM152104     2  0.3883     0.6966 0.004 0.728 0.028 0.240 0.000 0.000
#> GSM152028     6  0.6370     0.2029 0.248 0.000 0.016 0.000 0.320 0.416
#> GSM152029     6  0.4805     0.5431 0.000 0.160 0.120 0.000 0.016 0.704
#> GSM152049     6  0.2880     0.7127 0.108 0.000 0.024 0.012 0.000 0.856
#> GSM152053     3  0.6105     0.2116 0.132 0.004 0.436 0.412 0.008 0.008
#> GSM152059     6  0.1503     0.6985 0.008 0.000 0.016 0.000 0.032 0.944
#> GSM152085     6  0.1844     0.7098 0.012 0.000 0.028 0.024 0.004 0.932
#> GSM152101     5  0.4096     0.6524 0.012 0.004 0.200 0.036 0.748 0.000
#> GSM152105     1  0.4471     0.1956 0.648 0.000 0.020 0.000 0.020 0.312
#> GSM152034     6  0.4731     0.4082 0.000 0.008 0.036 0.340 0.004 0.612
#> GSM152036     4  0.1749     0.7243 0.004 0.004 0.044 0.932 0.000 0.016
#> GSM152040     5  0.3995     0.6898 0.000 0.000 0.032 0.028 0.768 0.172
#> GSM152043     6  0.1693     0.7029 0.000 0.000 0.032 0.012 0.020 0.936
#> GSM152046     6  0.4077     0.6056 0.000 0.000 0.044 0.228 0.004 0.724
#> GSM152047     5  0.5690     0.5974 0.000 0.000 0.052 0.124 0.632 0.192
#> GSM152048     6  0.5394     0.5186 0.368 0.000 0.036 0.040 0.004 0.552
#> GSM152050     6  0.5048     0.6087 0.064 0.000 0.044 0.212 0.000 0.680
#> GSM152052     6  0.4487     0.6077 0.316 0.000 0.020 0.000 0.020 0.644
#> GSM152056     6  0.6004     0.5868 0.252 0.000 0.048 0.128 0.000 0.572
#> GSM152060     6  0.4780     0.3784 0.000 0.000 0.036 0.372 0.012 0.580
#> GSM152065     5  0.2772     0.7301 0.068 0.000 0.020 0.000 0.876 0.036
#> GSM152066     6  0.4003     0.6871 0.192 0.000 0.028 0.012 0.008 0.760
#> GSM152069     3  0.4732     0.5922 0.004 0.136 0.724 0.000 0.120 0.016
#> GSM152070     5  0.2831     0.7246 0.000 0.000 0.024 0.000 0.840 0.136
#> GSM152071     3  0.4826     0.5889 0.008 0.108 0.736 0.000 0.116 0.032
#> GSM152072     5  0.2395     0.7491 0.020 0.000 0.076 0.000 0.892 0.012
#> GSM152073     6  0.1594     0.6939 0.000 0.000 0.016 0.000 0.052 0.932
#> GSM152078     6  0.3023     0.7075 0.084 0.004 0.012 0.000 0.040 0.860
#> GSM152082     5  0.5087     0.5309 0.028 0.000 0.052 0.000 0.620 0.300
#> GSM152086     6  0.2841     0.7113 0.092 0.000 0.032 0.012 0.000 0.864
#> GSM152090     6  0.6445     0.4657 0.068 0.272 0.080 0.024 0.000 0.556
#> GSM152092     6  0.4193     0.5180 0.028 0.000 0.008 0.000 0.276 0.688
#> GSM152093     6  0.6246     0.4609 0.360 0.000 0.060 0.100 0.000 0.480
#> GSM152094     6  0.1167     0.7060 0.000 0.000 0.020 0.008 0.012 0.960
#> GSM152098     6  0.4224     0.4068 0.004 0.000 0.036 0.000 0.276 0.684
#> GSM152110     4  0.5443     0.5323 0.080 0.004 0.048 0.656 0.000 0.212
#> GSM152031     6  0.3201     0.6994 0.140 0.000 0.008 0.000 0.028 0.824
#> GSM152037     6  0.4606     0.5915 0.312 0.000 0.020 0.004 0.020 0.644
#> GSM152055     4  0.4492     0.5633 0.004 0.000 0.044 0.700 0.012 0.240
#> GSM152061     4  0.5178     0.3273 0.004 0.000 0.040 0.592 0.028 0.336
#> GSM152064     4  0.3546     0.6758 0.012 0.000 0.036 0.812 0.004 0.136
#> GSM152087     6  0.0881     0.7083 0.000 0.000 0.012 0.008 0.008 0.972
#> GSM152103     6  0.6226     0.3985 0.116 0.344 0.040 0.004 0.000 0.496

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 specimen(p) k
#> ATC:NMF 85    4.10e-06 2
#> ATC:NMF 49    1.74e-03 3
#> ATC:NMF 76    1.92e-04 4
#> ATC:NMF 67    1.50e-04 5
#> ATC:NMF 67    2.34e-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.

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