cola Report for GDS181

Date: 2019-12-25 20:17:11 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 8229 rows and 84 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] 8229   84

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:pam 3 1.000 0.964 0.988 ** 2
ATC:hclust 2 1.000 0.987 0.995 **
MAD:mclust 3 0.981 0.919 0.954 **
CV:NMF 4 0.974 0.925 0.967 ** 2
ATC:skmeans 4 0.973 0.946 0.978 ** 2,3
ATC:pam 6 0.973 0.901 0.951 ** 4,5
SD:skmeans 4 0.964 0.964 0.983 ** 2
ATC:NMF 4 0.961 0.948 0.977 ** 3
CV:mclust 3 0.958 0.900 0.957 **
MAD:NMF 4 0.941 0.926 0.963 * 3
SD:NMF 4 0.938 0.919 0.963 *
SD:mclust 3 0.937 0.893 0.947 *
MAD:hclust 6 0.935 0.884 0.903 * 4
MAD:pam 5 0.925 0.831 0.932 * 3
MAD:skmeans 5 0.916 0.893 0.896 * 4
CV:skmeans 5 0.910 0.810 0.899 * 2,4
CV:pam 4 0.904 0.884 0.948 * 3
CV:hclust 5 0.903 0.897 0.926 * 4
ATC:mclust 6 0.901 0.844 0.910 *
SD:hclust 4 0.891 0.939 0.965
CV:kmeans 4 0.630 0.908 0.854
SD:kmeans 4 0.613 0.901 0.834
MAD:kmeans 4 0.603 0.896 0.853
ATC:kmeans 3 0.592 0.878 0.871

**: 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.892           0.896       0.935          0.437 0.577   0.577
#> CV:NMF      2 0.910           0.917       0.960          0.456 0.550   0.550
#> MAD:NMF     2 0.861           0.883       0.937          0.447 0.550   0.550
#> ATC:NMF     2 0.894           0.912       0.961          0.453 0.535   0.535
#> SD:skmeans  2 1.000           0.937       0.949          0.506 0.494   0.494
#> CV:skmeans  2 1.000           0.980       0.991          0.506 0.494   0.494
#> MAD:skmeans 2 0.494           0.926       0.943          0.506 0.494   0.494
#> ATC:skmeans 2 1.000           0.954       0.966          0.504 0.497   0.497
#> SD:mclust   2 0.221           0.373       0.679          0.503 0.559   0.559
#> CV:mclust   2 0.220           0.484       0.677          0.503 0.620   0.620
#> MAD:mclust  2 0.279           0.886       0.894          0.505 0.497   0.497
#> ATC:mclust  2 0.532           0.919       0.924          0.498 0.501   0.501
#> SD:kmeans   2 0.229           0.504       0.653          0.396 0.494   0.494
#> CV:kmeans   2 0.242           0.524       0.644          0.385 0.598   0.598
#> MAD:kmeans  2 0.189           0.502       0.686          0.399 0.508   0.508
#> ATC:kmeans  2 0.223           0.681       0.723          0.381 0.646   0.646
#> SD:pam      2 1.000           0.982       0.979          0.350 0.646   0.646
#> CV:pam      2 0.485           0.834       0.851          0.342 0.646   0.646
#> MAD:pam     2 0.491           0.806       0.827          0.346 0.646   0.646
#> ATC:pam     2 0.510           0.893       0.895          0.335 0.659   0.659
#> SD:hclust   2 0.371           0.728       0.810          0.355 0.512   0.512
#> CV:hclust   2 0.405           0.359       0.691          0.361 0.620   0.620
#> MAD:hclust  2 0.280           0.598       0.791          0.398 0.703   0.703
#> ATC:hclust  2 1.000           0.987       0.995          0.347 0.659   0.659
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.821           0.869       0.937          0.427 0.648   0.465
#> CV:NMF      3 0.778           0.887       0.939          0.377 0.616   0.419
#> MAD:NMF     3 0.945           0.932       0.969          0.387 0.626   0.430
#> ATC:NMF     3 1.000           0.966       0.984          0.396 0.793   0.626
#> SD:skmeans  3 0.609           0.786       0.870          0.272 0.598   0.364
#> CV:skmeans  3 0.589           0.604       0.776          0.274 0.572   0.319
#> MAD:skmeans 3 0.564           0.699       0.859          0.283 0.687   0.453
#> ATC:skmeans 3 1.000           0.973       0.988          0.271 0.804   0.627
#> SD:mclust   3 0.937           0.893       0.947          0.273 0.551   0.339
#> CV:mclust   3 0.958           0.900       0.957          0.279 0.690   0.519
#> MAD:mclust  3 0.981           0.919       0.954          0.265 0.824   0.659
#> ATC:mclust  3 0.585           0.814       0.777          0.273 0.579   0.345
#> SD:kmeans   3 0.391           0.764       0.780          0.499 0.592   0.375
#> CV:kmeans   3 0.382           0.778       0.781          0.544 0.685   0.521
#> MAD:kmeans  3 0.478           0.636       0.634          0.511 0.641   0.408
#> ATC:kmeans  3 0.592           0.878       0.871          0.559 0.739   0.604
#> SD:pam      3 1.000           0.964       0.988          0.653 0.785   0.667
#> CV:pam      3 1.000           0.996       0.999          0.719 0.766   0.637
#> MAD:pam     3 1.000           0.984       0.994          0.701 0.766   0.637
#> ATC:pam     3 0.676           0.906       0.861          0.705 0.771   0.652
#> SD:hclust   3 0.639           0.808       0.813          0.588 0.918   0.840
#> CV:hclust   3 0.640           0.832       0.829          0.550 0.659   0.510
#> MAD:hclust  3 0.657           0.816       0.821          0.392 0.727   0.612
#> ATC:hclust  3 0.626           0.483       0.769          0.700 0.673   0.508
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.938           0.919       0.963          0.202 0.834   0.589
#> CV:NMF      4 0.974           0.925       0.967          0.199 0.861   0.640
#> MAD:NMF     4 0.941           0.926       0.963          0.212 0.850   0.618
#> ATC:NMF     4 0.961           0.948       0.977          0.187 0.820   0.546
#> SD:skmeans  4 0.964           0.964       0.983          0.173 0.876   0.664
#> CV:skmeans  4 0.964           0.967       0.985          0.172 0.865   0.621
#> MAD:skmeans 4 1.000           0.968       0.912          0.164 0.837   0.563
#> ATC:skmeans 4 0.973           0.946       0.978          0.181 0.849   0.599
#> SD:mclust   4 0.659           0.817       0.838          0.145 0.857   0.613
#> CV:mclust   4 0.783           0.859       0.915          0.153 0.818   0.533
#> MAD:mclust  4 0.718           0.779       0.886          0.138 0.803   0.517
#> ATC:mclust  4 0.820           0.807       0.897          0.166 0.880   0.669
#> SD:kmeans   4 0.613           0.901       0.834          0.175 0.850   0.628
#> CV:kmeans   4 0.630           0.908       0.854          0.189 0.850   0.628
#> MAD:kmeans  4 0.603           0.896       0.853          0.163 0.899   0.711
#> ATC:kmeans  4 0.828           0.956       0.909          0.200 0.849   0.632
#> SD:pam      4 0.880           0.867       0.939          0.272 0.813   0.573
#> CV:pam      4 0.904           0.884       0.948          0.260 0.849   0.633
#> MAD:pam     4 0.862           0.805       0.930          0.262 0.837   0.605
#> ATC:pam     4 1.000           0.969       0.989          0.279 0.839   0.626
#> SD:hclust   4 0.891           0.939       0.965          0.287 0.849   0.650
#> CV:hclust   4 0.938           0.963       0.972          0.292 0.849   0.650
#> MAD:hclust  4 0.914           0.954       0.973          0.305 0.849   0.650
#> ATC:hclust  4 0.869           0.921       0.961          0.241 0.757   0.435
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.878           0.825       0.887         0.0483 0.944   0.787
#> CV:NMF      5 0.852           0.743       0.822         0.0499 0.943   0.780
#> MAD:NMF     5 0.888           0.799       0.893         0.0473 0.977   0.908
#> ATC:NMF     5 0.853           0.872       0.902         0.0434 0.987   0.948
#> SD:skmeans  5 0.891           0.879       0.896         0.0463 0.971   0.880
#> CV:skmeans  5 0.910           0.810       0.899         0.0470 0.983   0.930
#> MAD:skmeans 5 0.916           0.893       0.896         0.0471 0.971   0.880
#> ATC:skmeans 5 0.892           0.863       0.927         0.0434 0.962   0.847
#> SD:mclust   5 0.780           0.658       0.834         0.0748 0.913   0.680
#> CV:mclust   5 0.813           0.780       0.889         0.0654 0.882   0.572
#> MAD:mclust  5 0.830           0.643       0.827         0.0875 0.936   0.761
#> ATC:mclust  5 0.875           0.840       0.916         0.0731 0.917   0.682
#> SD:kmeans   5 0.765           0.836       0.841         0.0871 1.000   1.000
#> CV:kmeans   5 0.790           0.853       0.853         0.0823 1.000   1.000
#> MAD:kmeans  5 0.806           0.831       0.852         0.0904 0.987   0.949
#> ATC:kmeans  5 0.743           0.892       0.877         0.0643 1.000   1.000
#> SD:pam      5 0.795           0.810       0.873         0.0382 0.971   0.888
#> CV:pam      5 0.828           0.806       0.890         0.0326 0.974   0.899
#> MAD:pam     5 0.925           0.831       0.932         0.0346 0.917   0.707
#> ATC:pam     5 1.000           0.958       0.983         0.0278 0.981   0.931
#> SD:hclust   5 0.855           0.869       0.914         0.0461 0.964   0.873
#> CV:hclust   5 0.903           0.897       0.926         0.0492 0.964   0.873
#> MAD:hclust  5 0.889           0.902       0.945         0.0539 0.964   0.873
#> ATC:hclust  5 0.866           0.894       0.941         0.0371 0.977   0.916
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.868           0.803       0.857         0.0381 0.968   0.853
#> CV:NMF      6 0.869           0.738       0.859         0.0371 0.949   0.771
#> MAD:NMF     6 0.858           0.785       0.872         0.0392 0.955   0.807
#> ATC:NMF     6 0.826           0.797       0.851         0.0316 0.964   0.857
#> SD:skmeans  6 0.869           0.757       0.839         0.0389 0.961   0.823
#> CV:skmeans  6 0.858           0.761       0.780         0.0377 0.930   0.704
#> MAD:skmeans 6 0.871           0.799       0.836         0.0380 0.943   0.744
#> ATC:skmeans 6 0.879           0.776       0.864         0.0333 0.990   0.954
#> SD:mclust   6 0.839           0.822       0.856         0.0442 0.884   0.541
#> CV:mclust   6 0.840           0.778       0.869         0.0398 0.940   0.715
#> MAD:mclust  6 0.849           0.672       0.846         0.0387 0.906   0.607
#> ATC:mclust  6 0.901           0.844       0.910         0.0395 0.916   0.628
#> SD:kmeans   6 0.764           0.731       0.811         0.0533 0.978   0.914
#> CV:kmeans   6 0.765           0.755       0.800         0.0445 0.987   0.949
#> MAD:kmeans  6 0.776           0.728       0.816         0.0494 0.991   0.963
#> ATC:kmeans  6 0.810           0.821       0.822         0.0438 1.000   1.000
#> SD:pam      6 0.856           0.861       0.916         0.0268 0.987   0.946
#> CV:pam      6 0.878           0.869       0.917         0.0243 0.987   0.947
#> MAD:pam     6 0.876           0.820       0.914         0.0199 0.987   0.946
#> ATC:pam     6 0.973           0.901       0.951         0.0250 0.968   0.879
#> SD:hclust   6 0.873           0.877       0.917         0.0438 0.974   0.894
#> CV:hclust   6 0.870           0.887       0.910         0.0393 0.974   0.894
#> MAD:hclust  6 0.935           0.884       0.903         0.0427 0.955   0.819
#> ATC:hclust  6 0.874           0.867       0.936         0.0490 0.952   0.808

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 = 823, method = "euler")

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

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

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

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

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

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

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

top_rows_overlap(res_list, top_n = 4114, 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 = 823, method = "correspondance")

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

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

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

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

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

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

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

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

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

Heatmaps of the top rows:

top_rows_heatmap(res_list, top_n = 823)

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

top_rows_heatmap(res_list, top_n = 1646)

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

top_rows_heatmap(res_list, top_n = 2468)

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

top_rows_heatmap(res_list, top_n = 3291)

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

top_rows_heatmap(res_list, top_n = 4114)

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 tissue(p) k
#> SD:NMF      79  4.66e-05 2
#> CV:NMF      81  6.04e-05 2
#> MAD:NMF     80  5.31e-05 2
#> ATC:NMF     81  6.04e-05 2
#> SD:skmeans  83  3.39e-05 2
#> CV:skmeans  83  3.39e-05 2
#> MAD:skmeans 83  3.39e-05 2
#> ATC:skmeans 84  4.54e-05 2
#> SD:mclust   19        NA 2
#> CV:mclust   19        NA 2
#> MAD:mclust  84  2.53e-05 2
#> ATC:mclust  84  4.57e-05 2
#> SD:kmeans   60  1.68e-04 2
#> CV:kmeans   61  1.95e-04 2
#> MAD:kmeans  45        NA 2
#> ATC:kmeans  64  3.97e-04 2
#> SD:pam      84  2.53e-05 2
#> CV:pam      84  2.53e-05 2
#> MAD:pam     84  2.53e-05 2
#> ATC:pam     84  2.53e-05 2
#> SD:hclust   67  1.21e-04 2
#> CV:hclust   15        NA 2
#> MAD:hclust  65  1.42e-04 2
#> ATC:hclust  83  3.39e-05 2
test_to_known_factors(res_list, k = 3)
#>              n tissue(p) k
#> SD:NMF      77  2.99e-08 3
#> CV:NMF      79  2.19e-08 3
#> MAD:NMF     82  9.10e-09 3
#> ATC:NMF     84  1.72e-08 3
#> SD:skmeans  81  6.98e-09 3
#> CV:skmeans  64  1.46e-07 3
#> MAD:skmeans 64  1.46e-07 3
#> ATC:skmeans 84  6.67e-09 3
#> SD:mclust   78  1.69e-08 3
#> CV:mclust   79  2.19e-08 3
#> MAD:mclust  80  1.24e-08 3
#> ATC:mclust  83  5.13e-09 3
#> SD:kmeans   84  6.67e-09 3
#> CV:kmeans   84  6.67e-09 3
#> MAD:kmeans  61  8.31e-07 3
#> ATC:kmeans  84  1.65e-08 3
#> SD:pam      82  2.06e-08 3
#> CV:pam      84  2.34e-08 3
#> MAD:pam     84  2.34e-08 3
#> ATC:pam     84  1.63e-07 3
#> SD:hclust   84  6.67e-09 3
#> CV:hclust   84  6.67e-09 3
#> MAD:hclust  84  6.67e-09 3
#> ATC:hclust  50  1.60e-05 3
test_to_known_factors(res_list, k = 4)
#>              n tissue(p) k
#> SD:NMF      81  2.10e-11 4
#> CV:NMF      80  1.46e-11 4
#> MAD:NMF     82  9.12e-12 4
#> ATC:NMF     83  4.06e-12 4
#> SD:skmeans  83  4.22e-12 4
#> CV:skmeans  83  4.22e-12 4
#> MAD:skmeans 83  4.22e-12 4
#> ATC:skmeans 81  6.79e-12 4
#> SD:mclust   76  3.70e-11 4
#> CV:mclust   79  1.16e-11 4
#> MAD:mclust  74  6.77e-11 4
#> ATC:mclust  77  1.70e-11 4
#> SD:kmeans   82  8.86e-12 4
#> CV:kmeans   84  5.71e-12 4
#> MAD:kmeans  82  8.86e-12 4
#> ATC:kmeans  84  5.57e-12 4
#> SD:pam      81  2.66e-10 4
#> CV:pam      80  6.57e-11 4
#> MAD:pam     73  4.97e-10 4
#> ATC:pam     83  1.77e-10 4
#> SD:hclust   84  1.99e-12 4
#> CV:hclust   84  1.99e-12 4
#> MAD:hclust  84  1.99e-12 4
#> ATC:hclust  81  7.31e-12 4
test_to_known_factors(res_list, k = 5)
#>              n tissue(p) k
#> SD:NMF      77  3.38e-14 5
#> CV:NMF      61  8.46e-07 5
#> MAD:NMF     76  2.03e-14 5
#> ATC:NMF     83  4.06e-12 5
#> SD:skmeans  82  3.49e-15 5
#> CV:skmeans  79  1.87e-14 5
#> MAD:skmeans 82  3.49e-15 5
#> ATC:skmeans 78  3.91e-15 5
#> SD:mclust   64  1.46e-12 5
#> CV:mclust   74  6.72e-14 5
#> MAD:mclust  63  8.71e-13 5
#> ATC:mclust  79  4.10e-15 5
#> SD:kmeans   79  3.12e-11 5
#> CV:kmeans   82  8.86e-12 5
#> MAD:kmeans  79  3.61e-15 5
#> ATC:kmeans  84  5.57e-12 5
#> SD:pam      75  3.07e-10 5
#> CV:pam      76  1.38e-10 5
#> MAD:pam     74  3.22e-13 5
#> ATC:pam     83  4.01e-12 5
#> SD:hclust   78  3.91e-15 5
#> CV:hclust   84  6.24e-16 5
#> MAD:hclust  82  1.15e-15 5
#> ATC:hclust  79  6.48e-15 5
test_to_known_factors(res_list, k = 6)
#>              n tissue(p) k
#> SD:NMF      78  5.97e-18 6
#> CV:NMF      75  5.30e-17 6
#> MAD:NMF     78  5.97e-18 6
#> ATC:NMF     80  6.28e-15 6
#> SD:skmeans  67  6.10e-12 6
#> CV:skmeans  73  3.70e-17 6
#> MAD:skmeans 77  8.02e-18 6
#> ATC:skmeans 74  9.11e-18 6
#> SD:mclust   78  4.67e-17 6
#> CV:mclust   78  2.87e-16 6
#> MAD:mclust  61  1.60e-12 6
#> ATC:mclust  73  3.70e-17 6
#> SD:kmeans   77  6.70e-15 6
#> CV:kmeans   77  6.70e-15 6
#> MAD:kmeans  77  6.70e-15 6
#> ATC:kmeans  84  5.57e-12 6
#> SD:pam      80  1.42e-16 6
#> CV:pam      81  1.23e-17 6
#> MAD:pam     74  4.81e-16 6
#> ATC:pam     80  8.33e-17 6
#> SD:hclust   78  1.99e-18 6
#> CV:hclust   80  9.28e-19 6
#> MAD:hclust  78  1.99e-18 6
#> ATC:hclust  79  3.73e-18 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-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.371           0.728       0.810         0.3549 0.512   0.512
#> 3 3 0.639           0.808       0.813         0.5876 0.918   0.840
#> 4 4 0.891           0.939       0.965         0.2867 0.849   0.650
#> 5 5 0.855           0.869       0.914         0.0461 0.964   0.873
#> 6 6 0.873           0.877       0.917         0.0438 0.974   0.894

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
#> GSM2819     2  0.6048      0.730 0.148 0.852
#> GSM2820     2  0.1633      0.946 0.024 0.976
#> GSM2822     2  0.0672      0.951 0.008 0.992
#> GSM2832     2  0.0672      0.951 0.008 0.992
#> GSM2823     2  0.4161      0.846 0.084 0.916
#> GSM2824     2  0.4161      0.846 0.084 0.916
#> GSM2825     2  0.0672      0.951 0.008 0.992
#> GSM2826     2  0.0672      0.951 0.008 0.992
#> GSM2829     1  0.9775      0.532 0.588 0.412
#> GSM2856     1  0.9775      0.532 0.588 0.412
#> GSM2830     1  0.9775      0.532 0.588 0.412
#> GSM2843     1  0.9775      0.532 0.588 0.412
#> GSM2871     1  0.9775      0.532 0.588 0.412
#> GSM2831     1  0.9775      0.532 0.588 0.412
#> GSM2844     1  0.9775      0.532 0.588 0.412
#> GSM2833     1  0.9775      0.532 0.588 0.412
#> GSM2846     1  0.9775      0.532 0.588 0.412
#> GSM2835     1  0.9775      0.532 0.588 0.412
#> GSM2858     1  0.9775      0.532 0.588 0.412
#> GSM2836     2  0.0000      0.959 0.000 1.000
#> GSM2848     2  0.0000      0.959 0.000 1.000
#> GSM2828     2  0.1633      0.946 0.024 0.976
#> GSM2837     2  0.1633      0.946 0.024 0.976
#> GSM2839     1  0.9983      0.303 0.524 0.476
#> GSM2841     1  0.9983      0.303 0.524 0.476
#> GSM2827     2  0.0000      0.959 0.000 1.000
#> GSM2842     2  0.0000      0.959 0.000 1.000
#> GSM2845     1  0.9775      0.532 0.588 0.412
#> GSM2872     1  0.9775      0.532 0.588 0.412
#> GSM2834     1  0.9775      0.532 0.588 0.412
#> GSM2847     1  0.9775      0.532 0.588 0.412
#> GSM2849     2  0.1633      0.946 0.024 0.976
#> GSM2850     2  0.1633      0.946 0.024 0.976
#> GSM2838     2  0.0000      0.959 0.000 1.000
#> GSM2853     2  0.0000      0.959 0.000 1.000
#> GSM2852     2  0.0000      0.959 0.000 1.000
#> GSM2855     2  0.0000      0.959 0.000 1.000
#> GSM2840     1  0.9983      0.303 0.524 0.476
#> GSM2857     1  0.9983      0.303 0.524 0.476
#> GSM2859     2  0.0000      0.959 0.000 1.000
#> GSM2860     2  0.0000      0.959 0.000 1.000
#> GSM2861     2  0.0000      0.959 0.000 1.000
#> GSM2862     2  0.0000      0.959 0.000 1.000
#> GSM2863     2  0.0000      0.959 0.000 1.000
#> GSM2864     2  0.0000      0.959 0.000 1.000
#> GSM2865     2  0.0000      0.959 0.000 1.000
#> GSM2866     2  0.0000      0.959 0.000 1.000
#> GSM2868     2  0.0000      0.959 0.000 1.000
#> GSM2869     2  0.0000      0.959 0.000 1.000
#> GSM2851     2  0.0000      0.959 0.000 1.000
#> GSM2867     2  0.0000      0.959 0.000 1.000
#> GSM2870     2  0.0000      0.959 0.000 1.000
#> GSM2854     1  0.9909      0.490 0.556 0.444
#> GSM2873     1  0.9909      0.490 0.556 0.444
#> GSM2874     2  0.1633      0.946 0.024 0.976
#> GSM2884     2  0.1633      0.946 0.024 0.976
#> GSM2875     1  0.9983      0.303 0.524 0.476
#> GSM2890     1  0.9983      0.303 0.524 0.476
#> GSM2877     1  0.9983      0.303 0.524 0.476
#> GSM2892     1  0.9983      0.303 0.524 0.476
#> GSM2902     1  0.9983      0.303 0.524 0.476
#> GSM2878     1  0.9983      0.303 0.524 0.476
#> GSM2901     1  0.9983      0.303 0.524 0.476
#> GSM2879     2  0.0000      0.959 0.000 1.000
#> GSM2898     2  0.0000      0.959 0.000 1.000
#> GSM2881     2  0.1633      0.946 0.024 0.976
#> GSM2897     2  0.1633      0.946 0.024 0.976
#> GSM2882     1  0.9775      0.532 0.588 0.412
#> GSM2894     1  0.9775      0.532 0.588 0.412
#> GSM2883     2  0.1633      0.946 0.024 0.976
#> GSM2895     2  0.1633      0.946 0.024 0.976
#> GSM2885     2  0.1633      0.946 0.024 0.976
#> GSM2886     2  0.1633      0.946 0.024 0.976
#> GSM2887     2  0.1633      0.946 0.024 0.976
#> GSM2896     2  0.1633      0.946 0.024 0.976
#> GSM2888     2  0.0000      0.959 0.000 1.000
#> GSM2889     2  0.0000      0.959 0.000 1.000
#> GSM2876     1  0.9983      0.303 0.524 0.476
#> GSM2891     1  0.9983      0.303 0.524 0.476
#> GSM2880     1  0.9983      0.303 0.524 0.476
#> GSM2893     1  0.9983      0.303 0.524 0.476
#> GSM2821     2  0.6048      0.730 0.148 0.852
#> GSM2900     2  0.6048      0.730 0.148 0.852
#> GSM2903     2  0.6048      0.730 0.148 0.852

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     3  0.9497      0.572 0.200 0.332 0.468
#> GSM2820     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2822     3  0.6192      0.737 0.000 0.420 0.580
#> GSM2832     3  0.6192      0.737 0.000 0.420 0.580
#> GSM2823     3  0.8887      0.641 0.128 0.368 0.504
#> GSM2824     3  0.8887      0.641 0.128 0.368 0.504
#> GSM2825     3  0.6192      0.737 0.000 0.420 0.580
#> GSM2826     3  0.6192      0.737 0.000 0.420 0.580
#> GSM2829     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2856     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2830     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2843     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2871     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2831     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2844     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2833     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2846     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2835     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2858     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2836     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2848     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2828     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2837     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2839     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2827     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2842     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2845     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2872     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2834     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2847     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2849     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2850     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2838     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2853     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2852     3  0.6008      0.737 0.000 0.372 0.628
#> GSM2855     3  0.6008      0.737 0.000 0.372 0.628
#> GSM2840     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2859     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2860     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2861     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2862     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2863     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2864     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2865     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2866     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2868     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2869     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2851     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2867     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2870     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2854     2  0.1289      0.950 0.000 0.968 0.032
#> GSM2873     2  0.1289      0.950 0.000 0.968 0.032
#> GSM2874     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2884     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2875     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2879     3  0.6095      0.743 0.000 0.392 0.608
#> GSM2898     3  0.6095      0.743 0.000 0.392 0.608
#> GSM2881     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2897     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2882     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2894     2  0.0000      0.994 0.000 1.000 0.000
#> GSM2883     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2895     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2885     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2886     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2887     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2896     3  0.0000      0.601 0.000 0.000 1.000
#> GSM2888     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2889     3  0.6168      0.745 0.000 0.412 0.588
#> GSM2876     1  0.0592      0.985 0.988 0.000 0.012
#> GSM2891     1  0.0592      0.985 0.988 0.000 0.012
#> GSM2880     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.998 1.000 0.000 0.000
#> GSM2821     3  0.9497      0.572 0.200 0.332 0.468
#> GSM2900     3  0.9497      0.572 0.200 0.332 0.468
#> GSM2903     3  0.9497      0.572 0.200 0.332 0.468

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.4284      0.761 0.200 0.780 0.000 0.020
#> GSM2820     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2822     2  0.3688      0.755 0.000 0.792 0.000 0.208
#> GSM2832     2  0.3688      0.755 0.000 0.792 0.000 0.208
#> GSM2823     2  0.3088      0.847 0.128 0.864 0.000 0.008
#> GSM2824     2  0.3088      0.847 0.128 0.864 0.000 0.008
#> GSM2825     2  0.3688      0.755 0.000 0.792 0.000 0.208
#> GSM2826     2  0.3688      0.755 0.000 0.792 0.000 0.208
#> GSM2829     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2856     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2830     4  0.0921      0.962 0.000 0.028 0.000 0.972
#> GSM2843     4  0.0921      0.962 0.000 0.028 0.000 0.972
#> GSM2871     4  0.0921      0.962 0.000 0.028 0.000 0.972
#> GSM2831     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2844     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2833     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2846     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2835     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2858     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2836     2  0.0336      0.932 0.000 0.992 0.000 0.008
#> GSM2848     2  0.0336      0.932 0.000 0.992 0.000 0.008
#> GSM2828     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2827     2  0.0336      0.932 0.000 0.992 0.000 0.008
#> GSM2842     2  0.0336      0.932 0.000 0.992 0.000 0.008
#> GSM2845     4  0.0921      0.962 0.000 0.028 0.000 0.972
#> GSM2872     4  0.0921      0.962 0.000 0.028 0.000 0.972
#> GSM2834     4  0.0921      0.962 0.000 0.028 0.000 0.972
#> GSM2847     4  0.0921      0.962 0.000 0.028 0.000 0.972
#> GSM2849     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2838     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2853     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2852     2  0.1557      0.905 0.000 0.944 0.056 0.000
#> GSM2855     2  0.1557      0.905 0.000 0.944 0.056 0.000
#> GSM2840     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2857     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2861     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2862     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2868     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2869     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2851     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2867     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2870     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2854     4  0.3528      0.774 0.000 0.192 0.000 0.808
#> GSM2873     4  0.3528      0.774 0.000 0.192 0.000 0.808
#> GSM2874     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2879     2  0.1042      0.925 0.000 0.972 0.020 0.008
#> GSM2898     2  0.1042      0.925 0.000 0.972 0.020 0.008
#> GSM2881     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2894     4  0.0336      0.965 0.000 0.008 0.000 0.992
#> GSM2883     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2895     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2885     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2887     3  0.0188      0.995 0.000 0.004 0.996 0.000
#> GSM2896     3  0.0188      0.995 0.000 0.004 0.996 0.000
#> GSM2888     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2889     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM2876     1  0.0469      0.986 0.988 0.012 0.000 0.000
#> GSM2891     1  0.0469      0.986 0.988 0.012 0.000 0.000
#> GSM2880     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM2821     2  0.4284      0.761 0.200 0.780 0.000 0.020
#> GSM2900     2  0.4284      0.761 0.200 0.780 0.000 0.020
#> GSM2903     2  0.4284      0.761 0.200 0.780 0.000 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
#> GSM2819     5  0.4045      1.000 0.000 0.356 0.000 0.000 0.644
#> GSM2820     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.4073      0.498 0.000 0.752 0.000 0.216 0.032
#> GSM2832     2  0.4073      0.498 0.000 0.752 0.000 0.216 0.032
#> GSM2823     2  0.3582      0.429 0.000 0.768 0.000 0.008 0.224
#> GSM2824     2  0.3582      0.429 0.000 0.768 0.000 0.008 0.224
#> GSM2825     2  0.4073      0.498 0.000 0.752 0.000 0.216 0.032
#> GSM2826     2  0.4073      0.498 0.000 0.752 0.000 0.216 0.032
#> GSM2829     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2856     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2830     4  0.4599      0.768 0.000 0.020 0.000 0.624 0.356
#> GSM2843     4  0.4599      0.768 0.000 0.020 0.000 0.624 0.356
#> GSM2871     4  0.4599      0.768 0.000 0.020 0.000 0.624 0.356
#> GSM2831     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2846     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2835     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2858     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2836     2  0.0290      0.897 0.000 0.992 0.000 0.008 0.000
#> GSM2848     2  0.0290      0.897 0.000 0.992 0.000 0.008 0.000
#> GSM2828     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2827     2  0.0290      0.897 0.000 0.992 0.000 0.008 0.000
#> GSM2842     2  0.0290      0.897 0.000 0.992 0.000 0.008 0.000
#> GSM2845     4  0.4599      0.768 0.000 0.020 0.000 0.624 0.356
#> GSM2872     4  0.4599      0.768 0.000 0.020 0.000 0.624 0.356
#> GSM2834     4  0.4599      0.768 0.000 0.020 0.000 0.624 0.356
#> GSM2847     4  0.4599      0.768 0.000 0.020 0.000 0.624 0.356
#> GSM2849     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2852     2  0.1341      0.837 0.000 0.944 0.056 0.000 0.000
#> GSM2855     2  0.1341      0.837 0.000 0.944 0.056 0.000 0.000
#> GSM2840     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2857     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2860     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2862     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2868     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2869     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2851     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2867     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2870     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2854     4  0.6326      0.563 0.000 0.160 0.000 0.460 0.380
#> GSM2873     4  0.6326      0.563 0.000 0.160 0.000 0.460 0.380
#> GSM2874     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2879     2  0.0898      0.882 0.000 0.972 0.020 0.008 0.000
#> GSM2898     2  0.0898      0.882 0.000 0.972 0.020 0.008 0.000
#> GSM2881     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2894     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> GSM2883     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2885     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0162      0.995 0.000 0.004 0.996 0.000 0.000
#> GSM2896     3  0.0162      0.995 0.000 0.004 0.996 0.000 0.000
#> GSM2888     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2889     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000
#> GSM2876     1  0.3210      0.780 0.788 0.000 0.000 0.000 0.212
#> GSM2891     1  0.3210      0.780 0.788 0.000 0.000 0.000 0.212
#> GSM2880     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.971 1.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.4045      1.000 0.000 0.356 0.000 0.000 0.644
#> GSM2900     5  0.4045      1.000 0.000 0.356 0.000 0.000 0.644
#> GSM2903     5  0.4045      1.000 0.000 0.356 0.000 0.000 0.644

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.1957      1.000 0.000 0.112 0.000 0.000 0.888 0.000
#> GSM2820     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     2  0.5321      0.442 0.000 0.596 0.000 0.136 0.004 0.264
#> GSM2832     2  0.5321      0.442 0.000 0.596 0.000 0.136 0.004 0.264
#> GSM2823     2  0.4300      0.259 0.000 0.608 0.000 0.000 0.364 0.028
#> GSM2824     2  0.4300      0.259 0.000 0.608 0.000 0.000 0.364 0.028
#> GSM2825     2  0.5321      0.442 0.000 0.596 0.000 0.136 0.004 0.264
#> GSM2826     2  0.5321      0.442 0.000 0.596 0.000 0.136 0.004 0.264
#> GSM2829     4  0.0000      0.957 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000      0.957 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     6  0.3244      0.871 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2843     6  0.3244      0.871 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2871     6  0.3244      0.871 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2831     4  0.1267      0.934 0.000 0.000 0.000 0.940 0.000 0.060
#> GSM2844     4  0.1267      0.934 0.000 0.000 0.000 0.940 0.000 0.060
#> GSM2833     4  0.0000      0.957 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2846     4  0.0000      0.957 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2835     4  0.0000      0.957 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000      0.957 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     2  0.0632      0.884 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM2848     2  0.0632      0.884 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM2828     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     1  0.1957      0.897 0.888 0.000 0.000 0.000 0.112 0.000
#> GSM2841     1  0.1957      0.897 0.888 0.000 0.000 0.000 0.112 0.000
#> GSM2827     2  0.0632      0.884 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM2842     2  0.0632      0.884 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM2845     6  0.3244      0.871 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2872     6  0.3244      0.871 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2834     6  0.3244      0.871 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2847     6  0.3244      0.871 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2849     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0000      0.894 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2853     2  0.0000      0.894 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2852     2  0.1349      0.852 0.000 0.940 0.056 0.000 0.000 0.004
#> GSM2855     2  0.1349      0.852 0.000 0.940 0.056 0.000 0.000 0.004
#> GSM2840     1  0.1957      0.897 0.888 0.000 0.000 0.000 0.112 0.000
#> GSM2857     1  0.1957      0.897 0.888 0.000 0.000 0.000 0.112 0.000
#> GSM2859     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2860     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2861     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2862     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2863     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2864     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2865     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2866     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2868     2  0.0000      0.894 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2869     2  0.0000      0.894 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2851     2  0.0000      0.894 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2867     2  0.0000      0.894 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2870     2  0.0000      0.894 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2854     6  0.3388      0.564 0.000 0.036 0.000 0.172 0.000 0.792
#> GSM2873     6  0.3388      0.564 0.000 0.036 0.000 0.172 0.000 0.792
#> GSM2874     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     2  0.1257      0.873 0.000 0.952 0.020 0.000 0.000 0.028
#> GSM2898     2  0.1257      0.873 0.000 0.952 0.020 0.000 0.000 0.028
#> GSM2881     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.1267      0.934 0.000 0.000 0.000 0.940 0.000 0.060
#> GSM2894     4  0.1267      0.934 0.000 0.000 0.000 0.940 0.000 0.060
#> GSM2883     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0146      0.994 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM2896     3  0.0146      0.994 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM2888     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2889     2  0.0146      0.894 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2876     1  0.2883      0.742 0.788 0.000 0.000 0.000 0.212 0.000
#> GSM2891     1  0.2883      0.742 0.788 0.000 0.000 0.000 0.212 0.000
#> GSM2880     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.1957      1.000 0.000 0.112 0.000 0.000 0.888 0.000
#> GSM2900     5  0.1957      1.000 0.000 0.112 0.000 0.000 0.888 0.000
#> GSM2903     5  0.1957      1.000 0.000 0.112 0.000 0.000 0.888 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

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

test_to_known_factors(res)
#>            n tissue(p) k
#> SD:hclust 67  1.21e-04 2
#> SD:hclust 84  6.67e-09 3
#> SD:hclust 84  1.99e-12 4
#> SD:hclust 78  3.91e-15 5
#> SD:hclust 78  1.99e-18 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-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.229           0.504       0.653         0.3958 0.494   0.494
#> 3 3 0.391           0.764       0.780         0.4991 0.592   0.375
#> 4 4 0.613           0.901       0.834         0.1754 0.850   0.628
#> 5 5 0.765           0.836       0.841         0.0871 1.000   1.000
#> 6 6 0.764           0.731       0.811         0.0533 0.978   0.914

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
#> GSM2819     1  0.9933      0.136 0.548 0.452
#> GSM2820     2  0.0938      0.618 0.012 0.988
#> GSM2822     1  0.9896      0.180 0.560 0.440
#> GSM2832     1  0.9896      0.180 0.560 0.440
#> GSM2823     2  0.8555      0.537 0.280 0.720
#> GSM2824     2  0.8555      0.537 0.280 0.720
#> GSM2825     1  0.9881      0.182 0.564 0.436
#> GSM2826     1  0.9881      0.182 0.564 0.436
#> GSM2829     1  0.9635      0.368 0.612 0.388
#> GSM2856     1  0.9635      0.368 0.612 0.388
#> GSM2830     1  0.9635      0.368 0.612 0.388
#> GSM2843     1  0.9635      0.368 0.612 0.388
#> GSM2871     1  0.9635      0.368 0.612 0.388
#> GSM2831     1  0.9635      0.368 0.612 0.388
#> GSM2844     1  0.9635      0.368 0.612 0.388
#> GSM2833     1  0.9635      0.368 0.612 0.388
#> GSM2846     1  0.9635      0.368 0.612 0.388
#> GSM2835     1  0.9635      0.368 0.612 0.388
#> GSM2858     1  0.9635      0.368 0.612 0.388
#> GSM2836     2  0.9427      0.595 0.360 0.640
#> GSM2848     2  0.9427      0.595 0.360 0.640
#> GSM2828     2  0.0938      0.618 0.012 0.988
#> GSM2837     2  0.0938      0.618 0.012 0.988
#> GSM2839     1  0.6801      0.514 0.820 0.180
#> GSM2841     1  0.6801      0.514 0.820 0.180
#> GSM2827     2  0.9427      0.595 0.360 0.640
#> GSM2842     2  0.9427      0.595 0.360 0.640
#> GSM2845     1  0.9635      0.368 0.612 0.388
#> GSM2872     1  0.9635      0.368 0.612 0.388
#> GSM2834     1  0.9635      0.368 0.612 0.388
#> GSM2847     1  0.9635      0.368 0.612 0.388
#> GSM2849     2  0.0938      0.618 0.012 0.988
#> GSM2850     2  0.0938      0.618 0.012 0.988
#> GSM2838     2  0.9460      0.595 0.364 0.636
#> GSM2853     2  0.9460      0.595 0.364 0.636
#> GSM2852     2  0.3733      0.608 0.072 0.928
#> GSM2855     2  0.3733      0.608 0.072 0.928
#> GSM2840     1  0.6801      0.514 0.820 0.180
#> GSM2857     1  0.6801      0.514 0.820 0.180
#> GSM2859     2  0.9460      0.595 0.364 0.636
#> GSM2860     2  0.9460      0.595 0.364 0.636
#> GSM2861     2  0.9460      0.595 0.364 0.636
#> GSM2862     2  0.9460      0.595 0.364 0.636
#> GSM2863     2  0.9460      0.595 0.364 0.636
#> GSM2864     2  0.9460      0.595 0.364 0.636
#> GSM2865     2  0.9460      0.595 0.364 0.636
#> GSM2866     2  0.9460      0.595 0.364 0.636
#> GSM2868     2  0.9460      0.595 0.364 0.636
#> GSM2869     2  0.9460      0.595 0.364 0.636
#> GSM2851     2  0.9460      0.595 0.364 0.636
#> GSM2867     2  0.9460      0.595 0.364 0.636
#> GSM2870     2  0.9460      0.595 0.364 0.636
#> GSM2854     1  0.9710      0.345 0.600 0.400
#> GSM2873     2  0.9850      0.413 0.428 0.572
#> GSM2874     2  0.0938      0.618 0.012 0.988
#> GSM2884     2  0.0938      0.618 0.012 0.988
#> GSM2875     1  0.7299      0.507 0.796 0.204
#> GSM2890     1  0.7299      0.507 0.796 0.204
#> GSM2877     1  0.7299      0.507 0.796 0.204
#> GSM2892     1  0.7299      0.507 0.796 0.204
#> GSM2902     1  0.7299      0.507 0.796 0.204
#> GSM2878     1  0.7299      0.507 0.796 0.204
#> GSM2901     1  0.7299      0.507 0.796 0.204
#> GSM2879     2  0.3733      0.612 0.072 0.928
#> GSM2898     2  0.3733      0.612 0.072 0.928
#> GSM2881     2  0.0938      0.618 0.012 0.988
#> GSM2897     2  0.0938      0.618 0.012 0.988
#> GSM2882     1  0.9635      0.368 0.612 0.388
#> GSM2894     1  0.9635      0.368 0.612 0.388
#> GSM2883     2  0.0938      0.618 0.012 0.988
#> GSM2895     2  0.0938      0.618 0.012 0.988
#> GSM2885     2  0.0938      0.618 0.012 0.988
#> GSM2886     2  0.0938      0.618 0.012 0.988
#> GSM2887     2  0.0938      0.618 0.012 0.988
#> GSM2896     2  0.0938      0.618 0.012 0.988
#> GSM2888     2  0.9209      0.603 0.336 0.664
#> GSM2889     2  0.9209      0.603 0.336 0.664
#> GSM2876     1  0.7139      0.510 0.804 0.196
#> GSM2891     1  0.7139      0.510 0.804 0.196
#> GSM2880     1  0.7299      0.507 0.796 0.204
#> GSM2893     1  0.7299      0.507 0.796 0.204
#> GSM2821     1  0.7674      0.501 0.776 0.224
#> GSM2900     1  0.7674      0.501 0.776 0.224
#> GSM2903     1  0.7674      0.501 0.776 0.224

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     2   0.802      0.679 0.160 0.656 0.184
#> GSM2820     3   0.380      0.954 0.052 0.056 0.892
#> GSM2822     2   0.679      0.690 0.100 0.740 0.160
#> GSM2832     2   0.679      0.690 0.100 0.740 0.160
#> GSM2823     2   0.891      0.597 0.176 0.564 0.260
#> GSM2824     2   0.891      0.597 0.176 0.564 0.260
#> GSM2825     2   0.760      0.649 0.228 0.672 0.100
#> GSM2826     2   0.760      0.649 0.228 0.672 0.100
#> GSM2829     2   0.492      0.614 0.108 0.840 0.052
#> GSM2856     2   0.492      0.614 0.108 0.840 0.052
#> GSM2830     2   0.484      0.614 0.104 0.844 0.052
#> GSM2843     2   0.484      0.614 0.104 0.844 0.052
#> GSM2871     2   0.436      0.623 0.080 0.868 0.052
#> GSM2831     2   0.484      0.614 0.104 0.844 0.052
#> GSM2844     2   0.484      0.614 0.104 0.844 0.052
#> GSM2833     2   0.492      0.614 0.108 0.840 0.052
#> GSM2846     2   0.492      0.614 0.108 0.840 0.052
#> GSM2835     2   0.492      0.614 0.108 0.840 0.052
#> GSM2858     2   0.492      0.614 0.108 0.840 0.052
#> GSM2836     2   0.788      0.683 0.100 0.640 0.260
#> GSM2848     2   0.788      0.683 0.100 0.640 0.260
#> GSM2828     3   0.380      0.954 0.052 0.056 0.892
#> GSM2837     3   0.380      0.954 0.052 0.056 0.892
#> GSM2839     1   0.175      0.928 0.960 0.012 0.028
#> GSM2841     1   0.175      0.928 0.960 0.012 0.028
#> GSM2827     2   0.798      0.679 0.100 0.628 0.272
#> GSM2842     2   0.798      0.679 0.100 0.628 0.272
#> GSM2845     2   0.484      0.614 0.104 0.844 0.052
#> GSM2872     2   0.484      0.614 0.104 0.844 0.052
#> GSM2834     2   0.477      0.616 0.100 0.848 0.052
#> GSM2847     2   0.484      0.614 0.104 0.844 0.052
#> GSM2849     3   0.380      0.954 0.052 0.056 0.892
#> GSM2850     3   0.380      0.954 0.052 0.056 0.892
#> GSM2838     2   0.801      0.678 0.100 0.624 0.276
#> GSM2853     2   0.801      0.678 0.100 0.624 0.276
#> GSM2852     3   0.311      0.861 0.004 0.096 0.900
#> GSM2855     3   0.311      0.861 0.004 0.096 0.900
#> GSM2840     1   0.175      0.928 0.960 0.012 0.028
#> GSM2857     1   0.175      0.928 0.960 0.012 0.028
#> GSM2859     2   0.801      0.678 0.100 0.624 0.276
#> GSM2860     2   0.801      0.678 0.100 0.624 0.276
#> GSM2861     2   0.801      0.678 0.100 0.624 0.276
#> GSM2862     2   0.801      0.678 0.100 0.624 0.276
#> GSM2863     2   0.801      0.678 0.100 0.624 0.276
#> GSM2864     2   0.801      0.678 0.100 0.624 0.276
#> GSM2865     2   0.801      0.678 0.100 0.624 0.276
#> GSM2866     2   0.785      0.683 0.100 0.644 0.256
#> GSM2868     2   0.801      0.678 0.100 0.624 0.276
#> GSM2869     2   0.801      0.678 0.100 0.624 0.276
#> GSM2851     2   0.801      0.678 0.100 0.624 0.276
#> GSM2867     2   0.801      0.678 0.100 0.624 0.276
#> GSM2870     2   0.801      0.678 0.100 0.624 0.276
#> GSM2854     2   0.304      0.628 0.044 0.920 0.036
#> GSM2873     2   0.672      0.690 0.096 0.744 0.160
#> GSM2874     3   0.380      0.954 0.052 0.056 0.892
#> GSM2884     3   0.380      0.954 0.052 0.056 0.892
#> GSM2875     1   0.195      0.936 0.952 0.008 0.040
#> GSM2890     1   0.195      0.936 0.952 0.008 0.040
#> GSM2877     1   0.195      0.936 0.952 0.008 0.040
#> GSM2892     1   0.195      0.936 0.952 0.008 0.040
#> GSM2902     1   0.195      0.936 0.952 0.008 0.040
#> GSM2878     1   0.145      0.936 0.968 0.008 0.024
#> GSM2901     1   0.145      0.936 0.968 0.008 0.024
#> GSM2879     3   0.706      0.693 0.068 0.236 0.696
#> GSM2898     3   0.706      0.693 0.068 0.236 0.696
#> GSM2881     3   0.380      0.954 0.052 0.056 0.892
#> GSM2897     3   0.380      0.954 0.052 0.056 0.892
#> GSM2882     2   0.484      0.614 0.104 0.844 0.052
#> GSM2894     2   0.484      0.614 0.104 0.844 0.052
#> GSM2883     3   0.379      0.943 0.060 0.048 0.892
#> GSM2895     3   0.379      0.943 0.060 0.048 0.892
#> GSM2885     3   0.380      0.954 0.052 0.056 0.892
#> GSM2886     3   0.380      0.954 0.052 0.056 0.892
#> GSM2887     3   0.380      0.954 0.052 0.056 0.892
#> GSM2896     3   0.380      0.954 0.052 0.056 0.892
#> GSM2888     2   0.797      0.674 0.096 0.624 0.280
#> GSM2889     2   0.797      0.674 0.096 0.624 0.280
#> GSM2876     1   0.195      0.933 0.952 0.008 0.040
#> GSM2891     1   0.195      0.933 0.952 0.008 0.040
#> GSM2880     1   0.195      0.936 0.952 0.008 0.040
#> GSM2893     1   0.195      0.936 0.952 0.008 0.040
#> GSM2821     1   0.601      0.728 0.768 0.184 0.048
#> GSM2900     1   0.601      0.728 0.768 0.184 0.048
#> GSM2903     1   0.601      0.728 0.768 0.184 0.048

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.4807      0.773 0.008 0.800 0.104 0.088
#> GSM2820     3  0.4217      0.940 0.016 0.152 0.816 0.016
#> GSM2822     2  0.4055      0.792 0.000 0.832 0.060 0.108
#> GSM2832     2  0.4055      0.792 0.000 0.832 0.060 0.108
#> GSM2823     2  0.3705      0.852 0.016 0.868 0.040 0.076
#> GSM2824     2  0.3705      0.852 0.016 0.868 0.040 0.076
#> GSM2825     2  0.5518      0.681 0.020 0.752 0.064 0.164
#> GSM2826     2  0.5518      0.681 0.020 0.752 0.064 0.164
#> GSM2829     4  0.5234      0.975 0.024 0.208 0.024 0.744
#> GSM2856     4  0.5234      0.975 0.024 0.208 0.024 0.744
#> GSM2830     4  0.5520      0.974 0.028 0.208 0.032 0.732
#> GSM2843     4  0.5520      0.974 0.028 0.208 0.032 0.732
#> GSM2871     4  0.5394      0.969 0.020 0.216 0.032 0.732
#> GSM2831     4  0.4808      0.976 0.020 0.208 0.012 0.760
#> GSM2844     4  0.4808      0.976 0.020 0.208 0.012 0.760
#> GSM2833     4  0.5424      0.973 0.024 0.208 0.032 0.736
#> GSM2846     4  0.5424      0.973 0.024 0.208 0.032 0.736
#> GSM2835     4  0.5387      0.971 0.024 0.204 0.032 0.740
#> GSM2858     4  0.5387      0.971 0.024 0.204 0.032 0.740
#> GSM2836     2  0.0188      0.936 0.000 0.996 0.000 0.004
#> GSM2848     2  0.0188      0.936 0.000 0.996 0.000 0.004
#> GSM2828     3  0.4217      0.940 0.016 0.152 0.816 0.016
#> GSM2837     3  0.4217      0.940 0.016 0.152 0.816 0.016
#> GSM2839     1  0.4653      0.882 0.820 0.020 0.080 0.080
#> GSM2841     1  0.4653      0.882 0.820 0.020 0.080 0.080
#> GSM2827     2  0.0188      0.936 0.000 0.996 0.000 0.004
#> GSM2842     2  0.0188      0.936 0.000 0.996 0.000 0.004
#> GSM2845     4  0.5520      0.974 0.028 0.208 0.032 0.732
#> GSM2872     4  0.5520      0.974 0.028 0.208 0.032 0.732
#> GSM2834     4  0.5608      0.974 0.028 0.208 0.036 0.728
#> GSM2847     4  0.5608      0.974 0.028 0.208 0.036 0.728
#> GSM2849     3  0.4217      0.940 0.016 0.152 0.816 0.016
#> GSM2850     3  0.4217      0.940 0.016 0.152 0.816 0.016
#> GSM2838     2  0.0336      0.937 0.000 0.992 0.008 0.000
#> GSM2853     2  0.0336      0.937 0.000 0.992 0.008 0.000
#> GSM2852     3  0.4467      0.920 0.000 0.172 0.788 0.040
#> GSM2855     3  0.4467      0.920 0.000 0.172 0.788 0.040
#> GSM2840     1  0.4653      0.882 0.820 0.020 0.080 0.080
#> GSM2857     1  0.4653      0.882 0.820 0.020 0.080 0.080
#> GSM2859     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM2861     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM2862     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.937 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0188      0.936 0.000 0.996 0.004 0.000
#> GSM2868     2  0.0336      0.937 0.000 0.992 0.008 0.000
#> GSM2869     2  0.0336      0.937 0.000 0.992 0.008 0.000
#> GSM2851     2  0.0336      0.937 0.000 0.992 0.008 0.000
#> GSM2867     2  0.0336      0.937 0.000 0.992 0.008 0.000
#> GSM2870     2  0.0336      0.937 0.000 0.992 0.008 0.000
#> GSM2854     4  0.5217      0.952 0.012 0.232 0.028 0.728
#> GSM2873     2  0.2867      0.834 0.000 0.884 0.012 0.104
#> GSM2874     3  0.4217      0.940 0.016 0.152 0.816 0.016
#> GSM2884     3  0.4217      0.940 0.016 0.152 0.816 0.016
#> GSM2875     1  0.1516      0.901 0.960 0.016 0.008 0.016
#> GSM2890     1  0.1516      0.901 0.960 0.016 0.008 0.016
#> GSM2877     1  0.1516      0.901 0.960 0.016 0.008 0.016
#> GSM2892     1  0.1516      0.901 0.960 0.016 0.008 0.016
#> GSM2902     1  0.1516      0.901 0.960 0.016 0.008 0.016
#> GSM2878     1  0.0967      0.902 0.976 0.016 0.004 0.004
#> GSM2901     1  0.0967      0.902 0.976 0.016 0.004 0.004
#> GSM2879     3  0.6152      0.425 0.008 0.464 0.496 0.032
#> GSM2898     3  0.6152      0.425 0.008 0.464 0.496 0.032
#> GSM2881     3  0.3982      0.940 0.012 0.152 0.824 0.012
#> GSM2897     3  0.3982      0.940 0.012 0.152 0.824 0.012
#> GSM2882     4  0.4732      0.974 0.020 0.200 0.012 0.768
#> GSM2894     4  0.4732      0.974 0.020 0.200 0.012 0.768
#> GSM2883     3  0.5159      0.921 0.020 0.152 0.776 0.052
#> GSM2895     3  0.5159      0.921 0.020 0.152 0.776 0.052
#> GSM2885     3  0.3982      0.940 0.012 0.152 0.824 0.012
#> GSM2886     3  0.3982      0.940 0.012 0.152 0.824 0.012
#> GSM2887     3  0.4258      0.937 0.012 0.156 0.812 0.020
#> GSM2896     3  0.4258      0.937 0.012 0.156 0.812 0.020
#> GSM2888     2  0.0921      0.919 0.000 0.972 0.000 0.028
#> GSM2889     2  0.0921      0.919 0.000 0.972 0.000 0.028
#> GSM2876     1  0.3959      0.889 0.856 0.016 0.052 0.076
#> GSM2891     1  0.3959      0.889 0.856 0.016 0.052 0.076
#> GSM2880     1  0.1516      0.901 0.960 0.016 0.008 0.016
#> GSM2893     1  0.1516      0.901 0.960 0.016 0.008 0.016
#> GSM2821     1  0.8107      0.695 0.584 0.176 0.096 0.144
#> GSM2900     1  0.8107      0.695 0.584 0.176 0.096 0.144
#> GSM2903     1  0.8107      0.695 0.584 0.176 0.096 0.144

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     2  0.4608      0.699 0.000 0.644 0.008 0.012 0.336
#> GSM2820     3  0.1996      0.905 0.000 0.036 0.928 0.004 0.032
#> GSM2822     2  0.4269      0.767 0.000 0.780 0.004 0.076 0.140
#> GSM2832     2  0.4269      0.767 0.000 0.780 0.004 0.076 0.140
#> GSM2823     2  0.5177      0.743 0.004 0.660 0.020 0.028 0.288
#> GSM2824     2  0.5177      0.743 0.004 0.660 0.020 0.028 0.288
#> GSM2825     2  0.5689      0.591 0.000 0.644 0.004 0.160 0.192
#> GSM2826     2  0.5689      0.591 0.000 0.644 0.004 0.160 0.192
#> GSM2829     4  0.4089      0.920 0.000 0.100 0.008 0.804 0.088
#> GSM2856     4  0.4089      0.920 0.000 0.100 0.008 0.804 0.088
#> GSM2830     4  0.3908      0.922 0.000 0.088 0.016 0.824 0.072
#> GSM2843     4  0.3908      0.922 0.000 0.088 0.016 0.824 0.072
#> GSM2871     4  0.3908      0.922 0.000 0.088 0.016 0.824 0.072
#> GSM2831     4  0.2532      0.931 0.000 0.088 0.008 0.892 0.012
#> GSM2844     4  0.2532      0.931 0.000 0.088 0.008 0.892 0.012
#> GSM2833     4  0.4195      0.918 0.000 0.104 0.008 0.796 0.092
#> GSM2846     4  0.4195      0.918 0.000 0.104 0.008 0.796 0.092
#> GSM2835     4  0.4351      0.914 0.000 0.104 0.008 0.784 0.104
#> GSM2858     4  0.4351      0.914 0.000 0.104 0.008 0.784 0.104
#> GSM2836     2  0.1799      0.879 0.000 0.940 0.012 0.020 0.028
#> GSM2848     2  0.1799      0.879 0.000 0.940 0.012 0.020 0.028
#> GSM2828     3  0.1996      0.905 0.000 0.036 0.928 0.004 0.032
#> GSM2837     3  0.1996      0.905 0.000 0.036 0.928 0.004 0.032
#> GSM2839     1  0.4915      0.796 0.700 0.000 0.012 0.048 0.240
#> GSM2841     1  0.4915      0.796 0.700 0.000 0.012 0.048 0.240
#> GSM2827     2  0.2859      0.880 0.000 0.876 0.012 0.016 0.096
#> GSM2842     2  0.2859      0.880 0.000 0.876 0.012 0.016 0.096
#> GSM2845     4  0.3852      0.920 0.000 0.084 0.016 0.828 0.072
#> GSM2872     4  0.3852      0.920 0.000 0.084 0.016 0.828 0.072
#> GSM2834     4  0.4121      0.923 0.000 0.088 0.020 0.812 0.080
#> GSM2847     4  0.4121      0.923 0.000 0.088 0.020 0.812 0.080
#> GSM2849     3  0.2122      0.904 0.000 0.036 0.924 0.008 0.032
#> GSM2850     3  0.2122      0.904 0.000 0.036 0.924 0.008 0.032
#> GSM2838     2  0.2305      0.881 0.000 0.896 0.012 0.000 0.092
#> GSM2853     2  0.2305      0.881 0.000 0.896 0.012 0.000 0.092
#> GSM2852     3  0.4031      0.861 0.004 0.044 0.804 0.008 0.140
#> GSM2855     3  0.4031      0.861 0.004 0.044 0.804 0.008 0.140
#> GSM2840     1  0.4915      0.796 0.700 0.000 0.012 0.048 0.240
#> GSM2857     1  0.4915      0.796 0.700 0.000 0.012 0.048 0.240
#> GSM2859     2  0.1074      0.884 0.000 0.968 0.012 0.004 0.016
#> GSM2860     2  0.1074      0.884 0.000 0.968 0.012 0.004 0.016
#> GSM2861     2  0.1364      0.885 0.000 0.952 0.012 0.000 0.036
#> GSM2862     2  0.1074      0.884 0.000 0.968 0.012 0.004 0.016
#> GSM2863     2  0.1074      0.884 0.000 0.968 0.012 0.004 0.016
#> GSM2864     2  0.1074      0.884 0.000 0.968 0.012 0.004 0.016
#> GSM2865     2  0.1074      0.884 0.000 0.968 0.012 0.004 0.016
#> GSM2866     2  0.0671      0.882 0.000 0.980 0.000 0.004 0.016
#> GSM2868     2  0.2574      0.878 0.000 0.876 0.012 0.000 0.112
#> GSM2869     2  0.2574      0.878 0.000 0.876 0.012 0.000 0.112
#> GSM2851     2  0.2522      0.878 0.000 0.880 0.012 0.000 0.108
#> GSM2867     2  0.2574      0.878 0.000 0.876 0.012 0.000 0.112
#> GSM2870     2  0.2574      0.878 0.000 0.876 0.012 0.000 0.112
#> GSM2854     4  0.4455      0.912 0.000 0.112 0.012 0.780 0.096
#> GSM2873     2  0.3448      0.805 0.000 0.852 0.012 0.072 0.064
#> GSM2874     3  0.1412      0.906 0.000 0.036 0.952 0.004 0.008
#> GSM2884     3  0.1412      0.906 0.000 0.036 0.952 0.004 0.008
#> GSM2875     1  0.0162      0.847 0.996 0.000 0.000 0.004 0.000
#> GSM2890     1  0.0162      0.847 0.996 0.000 0.000 0.004 0.000
#> GSM2877     1  0.0162      0.847 0.996 0.000 0.000 0.004 0.000
#> GSM2892     1  0.0162      0.847 0.996 0.000 0.000 0.004 0.000
#> GSM2902     1  0.0162      0.847 0.996 0.000 0.000 0.004 0.000
#> GSM2878     1  0.1646      0.846 0.944 0.000 0.004 0.020 0.032
#> GSM2901     1  0.1646      0.846 0.944 0.000 0.004 0.020 0.032
#> GSM2879     3  0.6695      0.247 0.004 0.388 0.468 0.020 0.120
#> GSM2898     3  0.6695      0.247 0.004 0.388 0.468 0.020 0.120
#> GSM2881     3  0.1630      0.906 0.000 0.036 0.944 0.004 0.016
#> GSM2897     3  0.1630      0.906 0.000 0.036 0.944 0.004 0.016
#> GSM2882     4  0.2532      0.932 0.000 0.088 0.008 0.892 0.012
#> GSM2894     4  0.2532      0.932 0.000 0.088 0.008 0.892 0.012
#> GSM2883     3  0.3058      0.880 0.004 0.032 0.884 0.024 0.056
#> GSM2895     3  0.3058      0.880 0.004 0.032 0.884 0.024 0.056
#> GSM2885     3  0.1630      0.906 0.000 0.036 0.944 0.004 0.016
#> GSM2886     3  0.1630      0.906 0.000 0.036 0.944 0.004 0.016
#> GSM2887     3  0.2853      0.890 0.000 0.040 0.880 0.004 0.076
#> GSM2896     3  0.2853      0.890 0.000 0.040 0.880 0.004 0.076
#> GSM2888     2  0.3067      0.868 0.000 0.844 0.012 0.004 0.140
#> GSM2889     2  0.3067      0.868 0.000 0.844 0.012 0.004 0.140
#> GSM2876     1  0.3360      0.826 0.816 0.000 0.004 0.012 0.168
#> GSM2891     1  0.3360      0.826 0.816 0.000 0.004 0.012 0.168
#> GSM2880     1  0.0162      0.847 0.996 0.000 0.000 0.004 0.000
#> GSM2893     1  0.0162      0.847 0.996 0.000 0.000 0.004 0.000
#> GSM2821     1  0.7352      0.434 0.384 0.216 0.008 0.020 0.372
#> GSM2900     1  0.7337      0.441 0.388 0.212 0.008 0.020 0.372
#> GSM2903     1  0.7337      0.441 0.388 0.212 0.008 0.020 0.372

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM2819     5  0.4528     0.0195 0.000 0.428 0.000 0.008 0.544 NA
#> GSM2820     3  0.1718     0.8621 0.000 0.024 0.936 0.000 0.020 NA
#> GSM2822     2  0.5709     0.5324 0.000 0.652 0.000 0.088 0.124 NA
#> GSM2832     2  0.5709     0.5324 0.000 0.652 0.000 0.088 0.124 NA
#> GSM2823     2  0.5700     0.0358 0.000 0.464 0.004 0.020 0.432 NA
#> GSM2824     2  0.5700     0.0358 0.000 0.464 0.004 0.020 0.432 NA
#> GSM2825     2  0.6628     0.3464 0.000 0.544 0.000 0.152 0.132 NA
#> GSM2826     2  0.6628     0.3464 0.000 0.544 0.000 0.152 0.132 NA
#> GSM2829     4  0.3152     0.8596 0.000 0.020 0.000 0.832 0.016 NA
#> GSM2856     4  0.3152     0.8596 0.000 0.020 0.000 0.832 0.016 NA
#> GSM2830     4  0.2592     0.8584 0.000 0.016 0.000 0.864 0.004 NA
#> GSM2843     4  0.2592     0.8584 0.000 0.016 0.000 0.864 0.004 NA
#> GSM2871     4  0.3111     0.8425 0.000 0.016 0.000 0.820 0.008 NA
#> GSM2831     4  0.1672     0.8748 0.000 0.016 0.000 0.932 0.048 NA
#> GSM2844     4  0.1672     0.8748 0.000 0.016 0.000 0.932 0.048 NA
#> GSM2833     4  0.3357     0.8538 0.000 0.020 0.000 0.816 0.020 NA
#> GSM2846     4  0.3357     0.8538 0.000 0.020 0.000 0.816 0.020 NA
#> GSM2835     4  0.3438     0.8532 0.000 0.020 0.000 0.812 0.024 NA
#> GSM2858     4  0.3438     0.8532 0.000 0.020 0.000 0.812 0.024 NA
#> GSM2836     2  0.2556     0.7084 0.000 0.888 0.000 0.012 0.052 NA
#> GSM2848     2  0.2556     0.7084 0.000 0.888 0.000 0.012 0.052 NA
#> GSM2828     3  0.1802     0.8615 0.000 0.024 0.932 0.000 0.020 NA
#> GSM2837     3  0.1802     0.8615 0.000 0.024 0.932 0.000 0.020 NA
#> GSM2839     1  0.4828     0.7094 0.676 0.000 0.004 0.000 0.196 NA
#> GSM2841     1  0.4828     0.7094 0.676 0.000 0.004 0.000 0.196 NA
#> GSM2827     2  0.3955     0.7004 0.000 0.772 0.000 0.004 0.132 NA
#> GSM2842     2  0.3955     0.7004 0.000 0.772 0.000 0.004 0.132 NA
#> GSM2845     4  0.3406     0.8429 0.000 0.016 0.012 0.820 0.012 NA
#> GSM2872     4  0.3406     0.8429 0.000 0.016 0.012 0.820 0.012 NA
#> GSM2834     4  0.2704     0.8595 0.000 0.016 0.000 0.844 0.000 NA
#> GSM2847     4  0.2664     0.8606 0.000 0.016 0.000 0.848 0.000 NA
#> GSM2849     3  0.2172     0.8591 0.000 0.024 0.912 0.000 0.020 NA
#> GSM2850     3  0.2172     0.8591 0.000 0.024 0.912 0.000 0.020 NA
#> GSM2838     2  0.3686     0.6987 0.000 0.788 0.000 0.000 0.088 NA
#> GSM2853     2  0.3686     0.6987 0.000 0.788 0.000 0.000 0.088 NA
#> GSM2852     3  0.5226     0.7264 0.000 0.032 0.676 0.000 0.140 NA
#> GSM2855     3  0.5226     0.7264 0.000 0.032 0.676 0.000 0.140 NA
#> GSM2840     1  0.4828     0.7094 0.676 0.000 0.004 0.000 0.196 NA
#> GSM2857     1  0.4828     0.7094 0.676 0.000 0.004 0.000 0.196 NA
#> GSM2859     2  0.1462     0.7189 0.000 0.936 0.000 0.000 0.008 NA
#> GSM2860     2  0.1462     0.7189 0.000 0.936 0.000 0.000 0.008 NA
#> GSM2861     2  0.2147     0.7178 0.000 0.896 0.000 0.000 0.020 NA
#> GSM2862     2  0.1462     0.7189 0.000 0.936 0.000 0.000 0.008 NA
#> GSM2863     2  0.1462     0.7189 0.000 0.936 0.000 0.000 0.008 NA
#> GSM2864     2  0.1462     0.7189 0.000 0.936 0.000 0.000 0.008 NA
#> GSM2865     2  0.1462     0.7189 0.000 0.936 0.000 0.000 0.008 NA
#> GSM2866     2  0.1524     0.7173 0.000 0.932 0.000 0.000 0.008 NA
#> GSM2868     2  0.4074     0.6814 0.000 0.748 0.000 0.000 0.092 NA
#> GSM2869     2  0.4074     0.6814 0.000 0.748 0.000 0.000 0.092 NA
#> GSM2851     2  0.4050     0.6843 0.000 0.752 0.000 0.000 0.096 NA
#> GSM2867     2  0.4074     0.6814 0.000 0.748 0.000 0.000 0.092 NA
#> GSM2870     2  0.4074     0.6814 0.000 0.748 0.000 0.000 0.092 NA
#> GSM2854     4  0.3969     0.8278 0.000 0.032 0.000 0.760 0.020 NA
#> GSM2873     2  0.4747     0.6054 0.000 0.736 0.000 0.084 0.052 NA
#> GSM2874     3  0.0922     0.8643 0.000 0.024 0.968 0.000 0.004 NA
#> GSM2884     3  0.0632     0.8644 0.000 0.024 0.976 0.000 0.000 NA
#> GSM2875     1  0.0146     0.8540 0.996 0.000 0.000 0.000 0.000 NA
#> GSM2890     1  0.0146     0.8540 0.996 0.000 0.000 0.000 0.000 NA
#> GSM2877     1  0.0146     0.8540 0.996 0.000 0.000 0.000 0.000 NA
#> GSM2892     1  0.0146     0.8540 0.996 0.000 0.000 0.000 0.000 NA
#> GSM2902     1  0.0146     0.8540 0.996 0.000 0.000 0.000 0.000 NA
#> GSM2878     1  0.1562     0.8452 0.940 0.000 0.000 0.004 0.032 NA
#> GSM2901     1  0.1562     0.8452 0.940 0.000 0.000 0.004 0.032 NA
#> GSM2879     3  0.7330     0.1321 0.000 0.340 0.360 0.004 0.184 NA
#> GSM2898     3  0.7330     0.1321 0.000 0.340 0.360 0.004 0.184 NA
#> GSM2881     3  0.1138     0.8650 0.000 0.024 0.960 0.000 0.004 NA
#> GSM2897     3  0.1138     0.8650 0.000 0.024 0.960 0.000 0.004 NA
#> GSM2882     4  0.1913     0.8749 0.000 0.016 0.000 0.924 0.044 NA
#> GSM2894     4  0.1913     0.8749 0.000 0.016 0.000 0.924 0.044 NA
#> GSM2883     3  0.3150     0.8314 0.000 0.024 0.848 0.000 0.032 NA
#> GSM2895     3  0.3150     0.8314 0.000 0.024 0.848 0.000 0.032 NA
#> GSM2885     3  0.1138     0.8650 0.000 0.024 0.960 0.000 0.004 NA
#> GSM2886     3  0.1138     0.8650 0.000 0.024 0.960 0.000 0.004 NA
#> GSM2887     3  0.3467     0.8249 0.000 0.024 0.832 0.000 0.068 NA
#> GSM2896     3  0.3467     0.8249 0.000 0.024 0.832 0.000 0.068 NA
#> GSM2888     2  0.4465     0.6728 0.000 0.712 0.000 0.000 0.144 NA
#> GSM2889     2  0.4465     0.6728 0.000 0.712 0.000 0.000 0.144 NA
#> GSM2876     1  0.3817     0.7533 0.780 0.000 0.008 0.008 0.172 NA
#> GSM2891     1  0.3817     0.7533 0.780 0.000 0.008 0.008 0.172 NA
#> GSM2880     1  0.0146     0.8538 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2893     1  0.0146     0.8538 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2821     5  0.5430     0.7519 0.260 0.128 0.000 0.012 0.600 NA
#> GSM2900     5  0.5430     0.7519 0.260 0.128 0.000 0.012 0.600 NA
#> GSM2903     5  0.5430     0.7519 0.260 0.128 0.000 0.012 0.600 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 tissue(p) k
#> SD:kmeans 60  1.68e-04 2
#> SD:kmeans 84  6.67e-09 3
#> SD:kmeans 82  8.86e-12 4
#> SD:kmeans 79  3.12e-11 5
#> SD:kmeans 77  6.70e-15 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) are extracted by 'SD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.937       0.949         0.5061 0.494   0.494
#> 3 3 0.609           0.786       0.870         0.2723 0.598   0.364
#> 4 4 0.964           0.964       0.983         0.1733 0.876   0.664
#> 5 5 0.891           0.879       0.896         0.0463 0.971   0.880
#> 6 6 0.869           0.757       0.839         0.0389 0.961   0.823

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

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

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
#> GSM2819     1  0.0000      0.952 1.000 0.000
#> GSM2820     2  0.0000      0.937 0.000 1.000
#> GSM2822     1  0.0000      0.952 1.000 0.000
#> GSM2832     1  0.0000      0.952 1.000 0.000
#> GSM2823     2  0.0938      0.933 0.012 0.988
#> GSM2824     2  0.0938      0.933 0.012 0.988
#> GSM2825     1  0.0000      0.952 1.000 0.000
#> GSM2826     1  0.0000      0.952 1.000 0.000
#> GSM2829     1  0.0376      0.954 0.996 0.004
#> GSM2856     1  0.0376      0.954 0.996 0.004
#> GSM2830     1  0.0376      0.954 0.996 0.004
#> GSM2843     1  0.0376      0.954 0.996 0.004
#> GSM2871     1  0.0376      0.954 0.996 0.004
#> GSM2831     1  0.0376      0.954 0.996 0.004
#> GSM2844     1  0.0376      0.954 0.996 0.004
#> GSM2833     1  0.0376      0.954 0.996 0.004
#> GSM2846     1  0.0376      0.954 0.996 0.004
#> GSM2835     1  0.0376      0.954 0.996 0.004
#> GSM2858     1  0.0376      0.954 0.996 0.004
#> GSM2836     2  0.4562      0.942 0.096 0.904
#> GSM2848     2  0.4562      0.942 0.096 0.904
#> GSM2828     2  0.0000      0.937 0.000 1.000
#> GSM2837     2  0.0000      0.937 0.000 1.000
#> GSM2839     1  0.4431      0.941 0.908 0.092
#> GSM2841     1  0.4431      0.941 0.908 0.092
#> GSM2827     2  0.4562      0.942 0.096 0.904
#> GSM2842     2  0.4562      0.942 0.096 0.904
#> GSM2845     1  0.0376      0.954 0.996 0.004
#> GSM2872     1  0.0376      0.954 0.996 0.004
#> GSM2834     1  0.0376      0.954 0.996 0.004
#> GSM2847     1  0.0376      0.954 0.996 0.004
#> GSM2849     2  0.0000      0.937 0.000 1.000
#> GSM2850     2  0.0000      0.937 0.000 1.000
#> GSM2838     2  0.4562      0.942 0.096 0.904
#> GSM2853     2  0.4562      0.942 0.096 0.904
#> GSM2852     2  0.2423      0.941 0.040 0.960
#> GSM2855     2  0.2423      0.941 0.040 0.960
#> GSM2840     1  0.4431      0.941 0.908 0.092
#> GSM2857     1  0.4431      0.941 0.908 0.092
#> GSM2859     2  0.4562      0.942 0.096 0.904
#> GSM2860     2  0.4562      0.942 0.096 0.904
#> GSM2861     2  0.4562      0.942 0.096 0.904
#> GSM2862     2  0.4562      0.942 0.096 0.904
#> GSM2863     2  0.4562      0.942 0.096 0.904
#> GSM2864     2  0.4562      0.942 0.096 0.904
#> GSM2865     2  0.4562      0.942 0.096 0.904
#> GSM2866     2  0.4562      0.942 0.096 0.904
#> GSM2868     2  0.4562      0.942 0.096 0.904
#> GSM2869     2  0.4562      0.942 0.096 0.904
#> GSM2851     2  0.4562      0.942 0.096 0.904
#> GSM2867     2  0.4562      0.942 0.096 0.904
#> GSM2870     2  0.4562      0.942 0.096 0.904
#> GSM2854     1  0.0376      0.954 0.996 0.004
#> GSM2873     2  0.9909      0.363 0.444 0.556
#> GSM2874     2  0.0000      0.937 0.000 1.000
#> GSM2884     2  0.0000      0.937 0.000 1.000
#> GSM2875     1  0.4431      0.941 0.908 0.092
#> GSM2890     1  0.4431      0.941 0.908 0.092
#> GSM2877     1  0.4431      0.941 0.908 0.092
#> GSM2892     1  0.4431      0.941 0.908 0.092
#> GSM2902     1  0.4431      0.941 0.908 0.092
#> GSM2878     1  0.4431      0.941 0.908 0.092
#> GSM2901     1  0.4431      0.941 0.908 0.092
#> GSM2879     2  0.0000      0.937 0.000 1.000
#> GSM2898     2  0.0000      0.937 0.000 1.000
#> GSM2881     2  0.0000      0.937 0.000 1.000
#> GSM2897     2  0.0000      0.937 0.000 1.000
#> GSM2882     1  0.0376      0.954 0.996 0.004
#> GSM2894     1  0.0376      0.954 0.996 0.004
#> GSM2883     2  0.0000      0.937 0.000 1.000
#> GSM2895     2  0.0000      0.937 0.000 1.000
#> GSM2885     2  0.0000      0.937 0.000 1.000
#> GSM2886     2  0.0000      0.937 0.000 1.000
#> GSM2887     2  0.0000      0.937 0.000 1.000
#> GSM2896     2  0.0000      0.937 0.000 1.000
#> GSM2888     2  0.4562      0.942 0.096 0.904
#> GSM2889     2  0.4562      0.942 0.096 0.904
#> GSM2876     1  0.4431      0.941 0.908 0.092
#> GSM2891     1  0.4431      0.941 0.908 0.092
#> GSM2880     1  0.4431      0.941 0.908 0.092
#> GSM2893     1  0.4431      0.941 0.908 0.092
#> GSM2821     1  0.4431      0.941 0.908 0.092
#> GSM2900     1  0.4431      0.941 0.908 0.092
#> GSM2903     1  0.4431      0.941 0.908 0.092

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2   p3
#> GSM2819     1  0.6045      0.329 0.620 0.380 0.00
#> GSM2820     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2822     2  0.5560      0.704 0.000 0.700 0.30
#> GSM2832     2  0.5560      0.704 0.000 0.700 0.30
#> GSM2823     1  0.5506      0.692 0.764 0.016 0.22
#> GSM2824     1  0.5506      0.692 0.764 0.016 0.22
#> GSM2825     1  0.2165      0.901 0.936 0.064 0.00
#> GSM2826     1  0.2165      0.901 0.936 0.064 0.00
#> GSM2829     2  0.8362      0.684 0.112 0.588 0.30
#> GSM2856     2  0.8362      0.684 0.112 0.588 0.30
#> GSM2830     2  0.8362      0.684 0.112 0.588 0.30
#> GSM2843     2  0.8301      0.686 0.108 0.592 0.30
#> GSM2871     2  0.7749      0.697 0.076 0.624 0.30
#> GSM2831     2  0.9800      0.537 0.268 0.432 0.30
#> GSM2844     2  0.9800      0.537 0.268 0.432 0.30
#> GSM2833     2  0.8362      0.684 0.112 0.588 0.30
#> GSM2846     2  0.8362      0.684 0.112 0.588 0.30
#> GSM2835     2  0.9800      0.537 0.268 0.432 0.30
#> GSM2858     2  0.9800      0.537 0.268 0.432 0.30
#> GSM2836     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2848     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2828     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2837     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2839     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2841     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2827     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2842     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2845     2  0.9783      0.542 0.264 0.436 0.30
#> GSM2872     2  0.9833      0.525 0.276 0.424 0.30
#> GSM2834     2  0.8301      0.686 0.108 0.592 0.30
#> GSM2847     2  0.8362      0.684 0.112 0.588 0.30
#> GSM2849     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2850     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2838     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2853     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2852     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2855     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2840     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2857     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2859     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2860     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2861     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2862     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2863     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2864     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2865     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2866     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2868     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2869     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2851     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2867     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2870     2  0.0000      0.673 0.000 1.000 0.00
#> GSM2854     2  0.6744      0.706 0.032 0.668 0.30
#> GSM2873     2  0.5560      0.704 0.000 0.700 0.30
#> GSM2874     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2884     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2875     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2890     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2877     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2892     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2902     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2878     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2901     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2879     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2898     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2881     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2897     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2882     2  0.9817      0.531 0.272 0.428 0.30
#> GSM2894     2  0.9817      0.531 0.272 0.428 0.30
#> GSM2883     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2895     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2885     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2886     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2887     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2896     3  0.5560      1.000 0.000 0.300 0.70
#> GSM2888     2  0.4796      0.199 0.000 0.780 0.22
#> GSM2889     2  0.4796      0.199 0.000 0.780 0.22
#> GSM2876     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2891     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2880     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2893     1  0.0000      0.950 1.000 0.000 0.00
#> GSM2821     1  0.0237      0.948 0.996 0.004 0.00
#> GSM2900     1  0.0237      0.948 0.996 0.004 0.00
#> GSM2903     1  0.0237      0.948 0.996 0.004 0.00

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2 p3   p4
#> GSM2819     1   0.480      0.415 0.616 0.384  0 0.00
#> GSM2820     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2822     2   0.265      0.871 0.000 0.880  0 0.12
#> GSM2832     2   0.265      0.871 0.000 0.880  0 0.12
#> GSM2823     1   0.139      0.918 0.952 0.048  0 0.00
#> GSM2824     1   0.139      0.918 0.952 0.048  0 0.00
#> GSM2825     1   0.596      0.655 0.692 0.128  0 0.18
#> GSM2826     1   0.596      0.655 0.692 0.128  0 0.18
#> GSM2829     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2856     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2830     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2843     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2871     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2831     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2844     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2833     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2846     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2835     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2858     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2836     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2848     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2828     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2837     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2839     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2841     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2827     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2842     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2845     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2872     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2834     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2847     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2849     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2850     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2838     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2853     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2852     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2855     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2840     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2857     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2859     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2860     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2861     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2862     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2863     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2864     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2865     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2866     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2868     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2869     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2851     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2867     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2870     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2854     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2873     2   0.265      0.871 0.000 0.880  0 0.12
#> GSM2874     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2884     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2875     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2890     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2877     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2892     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2902     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2878     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2901     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2879     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2898     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2881     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2897     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2882     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2894     4   0.000      1.000 0.000 0.000  0 1.00
#> GSM2883     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2895     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2885     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2886     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2887     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2896     3   0.000      1.000 0.000 0.000  1 0.00
#> GSM2888     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2889     2   0.000      0.983 0.000 1.000  0 0.00
#> GSM2876     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2891     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2880     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2893     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2821     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2900     1   0.000      0.951 1.000 0.000  0 0.00
#> GSM2903     1   0.000      0.951 1.000 0.000  0 0.00

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.6332      0.612 0.264 0.212 0.000 0.000 0.524
#> GSM2820     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.4768      0.667 0.000 0.592 0.000 0.024 0.384
#> GSM2832     2  0.4768      0.667 0.000 0.592 0.000 0.024 0.384
#> GSM2823     5  0.5227      0.845 0.448 0.044 0.000 0.000 0.508
#> GSM2824     5  0.5227      0.845 0.448 0.044 0.000 0.000 0.508
#> GSM2825     1  0.5620      0.279 0.504 0.020 0.000 0.036 0.440
#> GSM2826     1  0.5620      0.279 0.504 0.020 0.000 0.036 0.440
#> GSM2829     4  0.2329      0.920 0.000 0.000 0.000 0.876 0.124
#> GSM2856     4  0.2329      0.920 0.000 0.000 0.000 0.876 0.124
#> GSM2830     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2843     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2871     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2831     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.2329      0.920 0.000 0.000 0.000 0.876 0.124
#> GSM2846     4  0.2329      0.920 0.000 0.000 0.000 0.876 0.124
#> GSM2835     4  0.2329      0.920 0.000 0.000 0.000 0.876 0.124
#> GSM2858     4  0.2329      0.920 0.000 0.000 0.000 0.876 0.124
#> GSM2836     2  0.3177      0.866 0.000 0.792 0.000 0.000 0.208
#> GSM2848     2  0.3177      0.866 0.000 0.792 0.000 0.000 0.208
#> GSM2828     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.2471      0.743 0.864 0.000 0.000 0.000 0.136
#> GSM2841     1  0.2471      0.743 0.864 0.000 0.000 0.000 0.136
#> GSM2827     2  0.1270      0.881 0.000 0.948 0.000 0.000 0.052
#> GSM2842     2  0.1043      0.878 0.000 0.960 0.000 0.000 0.040
#> GSM2845     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2872     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2834     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2847     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2849     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0404      0.883 0.000 0.988 0.000 0.000 0.012
#> GSM2853     2  0.0404      0.883 0.000 0.988 0.000 0.000 0.012
#> GSM2852     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2855     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2840     1  0.2471      0.743 0.864 0.000 0.000 0.000 0.136
#> GSM2857     1  0.2471      0.743 0.864 0.000 0.000 0.000 0.136
#> GSM2859     2  0.2773      0.882 0.000 0.836 0.000 0.000 0.164
#> GSM2860     2  0.2773      0.882 0.000 0.836 0.000 0.000 0.164
#> GSM2861     2  0.2074      0.886 0.000 0.896 0.000 0.000 0.104
#> GSM2862     2  0.2773      0.882 0.000 0.836 0.000 0.000 0.164
#> GSM2863     2  0.2773      0.882 0.000 0.836 0.000 0.000 0.164
#> GSM2864     2  0.2773      0.882 0.000 0.836 0.000 0.000 0.164
#> GSM2865     2  0.2773      0.882 0.000 0.836 0.000 0.000 0.164
#> GSM2866     2  0.2773      0.882 0.000 0.836 0.000 0.000 0.164
#> GSM2868     2  0.0404      0.883 0.000 0.988 0.000 0.000 0.012
#> GSM2869     2  0.0404      0.883 0.000 0.988 0.000 0.000 0.012
#> GSM2851     2  0.0404      0.883 0.000 0.988 0.000 0.000 0.012
#> GSM2867     2  0.0404      0.883 0.000 0.988 0.000 0.000 0.012
#> GSM2870     2  0.0404      0.883 0.000 0.988 0.000 0.000 0.012
#> GSM2854     4  0.2516      0.909 0.000 0.000 0.000 0.860 0.140
#> GSM2873     2  0.4456      0.750 0.000 0.660 0.000 0.020 0.320
#> GSM2874     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2879     3  0.0290      0.993 0.000 0.000 0.992 0.000 0.008
#> GSM2898     3  0.0290      0.993 0.000 0.000 0.992 0.000 0.008
#> GSM2881     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2894     4  0.0000      0.950 0.000 0.000 0.000 1.000 0.000
#> GSM2883     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2885     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2888     2  0.0609      0.883 0.000 0.980 0.000 0.000 0.020
#> GSM2889     2  0.0609      0.883 0.000 0.980 0.000 0.000 0.020
#> GSM2876     1  0.0162      0.820 0.996 0.000 0.000 0.000 0.004
#> GSM2891     1  0.0162      0.820 0.996 0.000 0.000 0.000 0.004
#> GSM2880     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.4307      0.839 0.496 0.000 0.000 0.000 0.504
#> GSM2900     5  0.4307      0.839 0.496 0.000 0.000 0.000 0.504
#> GSM2903     5  0.4307      0.839 0.496 0.000 0.000 0.000 0.504

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.5183      0.744 0.128 0.160 0.000 0.000 0.680 0.032
#> GSM2820     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     6  0.3487      0.483 0.000 0.224 0.000 0.000 0.020 0.756
#> GSM2832     6  0.3487      0.483 0.000 0.224 0.000 0.000 0.020 0.756
#> GSM2823     5  0.4389      0.830 0.208 0.076 0.004 0.000 0.712 0.000
#> GSM2824     5  0.4389      0.830 0.208 0.076 0.004 0.000 0.712 0.000
#> GSM2825     6  0.4862      0.287 0.216 0.020 0.000 0.000 0.080 0.684
#> GSM2826     6  0.4862      0.287 0.216 0.020 0.000 0.000 0.080 0.684
#> GSM2829     4  0.3104      0.852 0.000 0.000 0.000 0.800 0.016 0.184
#> GSM2856     4  0.3104      0.852 0.000 0.000 0.000 0.800 0.016 0.184
#> GSM2830     4  0.0146      0.908 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2843     4  0.0146      0.908 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2871     4  0.0146      0.908 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2831     4  0.0146      0.909 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2844     4  0.0146      0.909 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2833     4  0.3104      0.852 0.000 0.000 0.000 0.800 0.016 0.184
#> GSM2846     4  0.3104      0.852 0.000 0.000 0.000 0.800 0.016 0.184
#> GSM2835     4  0.3168      0.847 0.000 0.000 0.000 0.792 0.016 0.192
#> GSM2858     4  0.3168      0.847 0.000 0.000 0.000 0.792 0.016 0.192
#> GSM2836     6  0.5658     -0.203 0.000 0.380 0.000 0.000 0.156 0.464
#> GSM2848     6  0.5662     -0.208 0.000 0.384 0.000 0.000 0.156 0.460
#> GSM2828     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     1  0.3871      0.751 0.768 0.000 0.000 0.000 0.084 0.148
#> GSM2841     1  0.3871      0.751 0.768 0.000 0.000 0.000 0.084 0.148
#> GSM2827     2  0.4079      0.456 0.000 0.744 0.000 0.000 0.084 0.172
#> GSM2842     2  0.3978      0.461 0.000 0.756 0.000 0.000 0.084 0.160
#> GSM2845     4  0.0260      0.907 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM2872     4  0.0146      0.908 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2834     4  0.0717      0.906 0.000 0.000 0.000 0.976 0.008 0.016
#> GSM2847     4  0.0622      0.907 0.000 0.000 0.000 0.980 0.008 0.012
#> GSM2849     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0146      0.628 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2853     2  0.0146      0.628 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2852     3  0.0520      0.978 0.000 0.000 0.984 0.000 0.008 0.008
#> GSM2855     3  0.0520      0.978 0.000 0.000 0.984 0.000 0.008 0.008
#> GSM2840     1  0.3871      0.751 0.768 0.000 0.000 0.000 0.084 0.148
#> GSM2857     1  0.3871      0.751 0.768 0.000 0.000 0.000 0.084 0.148
#> GSM2859     2  0.5583      0.394 0.000 0.508 0.000 0.000 0.156 0.336
#> GSM2860     2  0.5583      0.394 0.000 0.508 0.000 0.000 0.156 0.336
#> GSM2861     2  0.5411      0.421 0.000 0.560 0.000 0.000 0.152 0.288
#> GSM2862     2  0.5583      0.394 0.000 0.508 0.000 0.000 0.156 0.336
#> GSM2863     2  0.5583      0.394 0.000 0.508 0.000 0.000 0.156 0.336
#> GSM2864     2  0.5583      0.394 0.000 0.508 0.000 0.000 0.156 0.336
#> GSM2865     2  0.5583      0.394 0.000 0.508 0.000 0.000 0.156 0.336
#> GSM2866     2  0.5583      0.394 0.000 0.508 0.000 0.000 0.156 0.336
#> GSM2868     2  0.0260      0.628 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM2869     2  0.0260      0.628 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM2851     2  0.0260      0.628 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM2867     2  0.0260      0.628 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM2870     2  0.0260      0.628 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM2854     4  0.3314      0.797 0.000 0.000 0.000 0.740 0.004 0.256
#> GSM2873     6  0.3853      0.403 0.000 0.196 0.000 0.004 0.044 0.756
#> GSM2874     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     3  0.2039      0.908 0.000 0.000 0.904 0.000 0.076 0.020
#> GSM2898     3  0.2039      0.908 0.000 0.000 0.904 0.000 0.076 0.020
#> GSM2881     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0291      0.909 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2894     4  0.0291      0.909 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2883     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.1625      0.592 0.000 0.928 0.000 0.000 0.012 0.060
#> GSM2889     2  0.1625      0.592 0.000 0.928 0.000 0.000 0.012 0.060
#> GSM2876     1  0.0458      0.900 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM2891     1  0.0458      0.900 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM2880     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.911 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.3871      0.836 0.308 0.000 0.000 0.000 0.676 0.016
#> GSM2900     5  0.3871      0.836 0.308 0.000 0.000 0.000 0.676 0.016
#> GSM2903     5  0.3871      0.836 0.308 0.000 0.000 0.000 0.676 0.016

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 tissue(p) k
#> SD:skmeans 83  3.39e-05 2
#> SD:skmeans 81  6.98e-09 3
#> SD:skmeans 83  4.22e-12 4
#> SD:skmeans 82  3.49e-15 5
#> SD:skmeans 67  6.10e-12 6

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


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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.982       0.979         0.3503 0.646   0.646
#> 3 3 1.000           0.964       0.988         0.6525 0.785   0.667
#> 4 4 0.880           0.867       0.939         0.2722 0.813   0.573
#> 5 5 0.795           0.810       0.873         0.0382 0.971   0.888
#> 6 6 0.856           0.861       0.916         0.0268 0.987   0.946

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
#> GSM2819     1   0.000      0.989 1.000 0.000
#> GSM2820     2   0.260      0.988 0.044 0.956
#> GSM2822     1   0.000      0.989 1.000 0.000
#> GSM2832     1   0.000      0.989 1.000 0.000
#> GSM2823     1   0.000      0.989 1.000 0.000
#> GSM2824     1   0.000      0.989 1.000 0.000
#> GSM2825     1   0.000      0.989 1.000 0.000
#> GSM2826     1   0.000      0.989 1.000 0.000
#> GSM2829     1   0.000      0.989 1.000 0.000
#> GSM2856     1   0.000      0.989 1.000 0.000
#> GSM2830     1   0.000      0.989 1.000 0.000
#> GSM2843     1   0.000      0.989 1.000 0.000
#> GSM2871     1   0.000      0.989 1.000 0.000
#> GSM2831     1   0.000      0.989 1.000 0.000
#> GSM2844     1   0.000      0.989 1.000 0.000
#> GSM2833     1   0.000      0.989 1.000 0.000
#> GSM2846     1   0.000      0.989 1.000 0.000
#> GSM2835     1   0.000      0.989 1.000 0.000
#> GSM2858     1   0.000      0.989 1.000 0.000
#> GSM2836     1   0.000      0.989 1.000 0.000
#> GSM2848     1   0.000      0.989 1.000 0.000
#> GSM2828     2   0.260      0.988 0.044 0.956
#> GSM2837     2   0.260      0.988 0.044 0.956
#> GSM2839     1   0.260      0.964 0.956 0.044
#> GSM2841     1   0.260      0.964 0.956 0.044
#> GSM2827     1   0.000      0.989 1.000 0.000
#> GSM2842     1   0.000      0.989 1.000 0.000
#> GSM2845     1   0.000      0.989 1.000 0.000
#> GSM2872     1   0.000      0.989 1.000 0.000
#> GSM2834     1   0.000      0.989 1.000 0.000
#> GSM2847     1   0.000      0.989 1.000 0.000
#> GSM2849     2   0.260      0.988 0.044 0.956
#> GSM2850     2   0.260      0.988 0.044 0.956
#> GSM2838     1   0.000      0.989 1.000 0.000
#> GSM2853     1   0.000      0.989 1.000 0.000
#> GSM2852     2   0.260      0.988 0.044 0.956
#> GSM2855     2   0.260      0.988 0.044 0.956
#> GSM2840     1   0.260      0.964 0.956 0.044
#> GSM2857     1   0.260      0.964 0.956 0.044
#> GSM2859     1   0.000      0.989 1.000 0.000
#> GSM2860     1   0.000      0.989 1.000 0.000
#> GSM2861     1   0.000      0.989 1.000 0.000
#> GSM2862     1   0.000      0.989 1.000 0.000
#> GSM2863     1   0.000      0.989 1.000 0.000
#> GSM2864     1   0.000      0.989 1.000 0.000
#> GSM2865     1   0.000      0.989 1.000 0.000
#> GSM2866     1   0.000      0.989 1.000 0.000
#> GSM2868     1   0.000      0.989 1.000 0.000
#> GSM2869     1   0.000      0.989 1.000 0.000
#> GSM2851     1   0.000      0.989 1.000 0.000
#> GSM2867     1   0.000      0.989 1.000 0.000
#> GSM2870     1   0.000      0.989 1.000 0.000
#> GSM2854     1   0.000      0.989 1.000 0.000
#> GSM2873     1   0.000      0.989 1.000 0.000
#> GSM2874     2   0.260      0.988 0.044 0.956
#> GSM2884     2   0.260      0.988 0.044 0.956
#> GSM2875     1   0.260      0.964 0.956 0.044
#> GSM2890     1   0.260      0.964 0.956 0.044
#> GSM2877     1   0.260      0.964 0.956 0.044
#> GSM2892     1   0.260      0.964 0.956 0.044
#> GSM2902     1   0.260      0.964 0.956 0.044
#> GSM2878     1   0.260      0.964 0.956 0.044
#> GSM2901     1   0.260      0.964 0.956 0.044
#> GSM2879     2   0.574      0.898 0.136 0.864
#> GSM2898     2   0.615      0.879 0.152 0.848
#> GSM2881     2   0.260      0.988 0.044 0.956
#> GSM2897     2   0.260      0.988 0.044 0.956
#> GSM2882     1   0.000      0.989 1.000 0.000
#> GSM2894     1   0.000      0.989 1.000 0.000
#> GSM2883     2   0.260      0.988 0.044 0.956
#> GSM2895     2   0.260      0.988 0.044 0.956
#> GSM2885     2   0.260      0.988 0.044 0.956
#> GSM2886     2   0.260      0.988 0.044 0.956
#> GSM2887     2   0.260      0.988 0.044 0.956
#> GSM2896     2   0.260      0.988 0.044 0.956
#> GSM2888     1   0.000      0.989 1.000 0.000
#> GSM2889     1   0.000      0.989 1.000 0.000
#> GSM2876     1   0.260      0.964 0.956 0.044
#> GSM2891     1   0.260      0.964 0.956 0.044
#> GSM2880     1   0.260      0.964 0.956 0.044
#> GSM2893     1   0.260      0.964 0.956 0.044
#> GSM2821     1   0.000      0.989 1.000 0.000
#> GSM2900     1   0.141      0.978 0.980 0.020
#> GSM2903     1   0.141      0.978 0.980 0.020

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2   p3
#> GSM2819     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2820     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2822     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2832     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2823     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2824     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2825     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2826     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2829     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2856     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2830     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2843     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2871     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2831     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2844     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2833     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2846     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2835     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2858     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2836     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2848     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2828     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2837     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2839     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2841     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2827     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2842     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2845     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2872     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2834     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2847     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2849     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2850     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2838     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2853     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2852     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2855     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2840     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2857     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2859     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2860     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2861     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2862     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2863     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2864     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2865     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2866     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2868     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2869     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2851     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2867     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2870     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2854     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2873     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2874     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2884     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2875     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2890     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2877     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2892     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2902     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2878     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2901     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2879     3  0.0892     0.9731 0.000 0.020 0.98
#> GSM2898     3  0.0892     0.9731 0.000 0.020 0.98
#> GSM2881     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2897     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2882     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2894     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2883     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2895     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2885     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2886     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2887     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2896     3  0.0000     0.9969 0.000 0.000 1.00
#> GSM2888     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2889     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2876     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2891     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2880     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2893     1  0.0000     1.0000 1.000 0.000 0.00
#> GSM2821     2  0.0000     0.9797 0.000 1.000 0.00
#> GSM2900     2  0.6309     0.0356 0.496 0.504 0.00
#> GSM2903     2  0.6307     0.0653 0.488 0.512 0.00

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2 p3    p4
#> GSM2819     2  0.1867     0.8559 0.000 0.928  0 0.072
#> GSM2820     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2822     2  0.4605     0.6260 0.000 0.664  0 0.336
#> GSM2832     2  0.4605     0.6260 0.000 0.664  0 0.336
#> GSM2823     2  0.4454     0.6638 0.000 0.692  0 0.308
#> GSM2824     2  0.4164     0.7144 0.000 0.736  0 0.264
#> GSM2825     2  0.4605     0.6260 0.000 0.664  0 0.336
#> GSM2826     2  0.4605     0.6260 0.000 0.664  0 0.336
#> GSM2829     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2856     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2830     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2843     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2871     2  0.4830     0.5080 0.000 0.608  0 0.392
#> GSM2831     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2844     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2833     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2846     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2835     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2858     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2836     2  0.2868     0.8207 0.000 0.864  0 0.136
#> GSM2848     2  0.3444     0.7872 0.000 0.816  0 0.184
#> GSM2828     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2837     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2839     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2841     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2827     2  0.0336     0.8755 0.000 0.992  0 0.008
#> GSM2842     2  0.1389     0.8654 0.000 0.952  0 0.048
#> GSM2845     4  0.4925     0.0293 0.000 0.428  0 0.572
#> GSM2872     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2834     4  0.4250     0.5207 0.000 0.276  0 0.724
#> GSM2847     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2849     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2850     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2838     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2853     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2852     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2855     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2840     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2857     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2859     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2860     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2861     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2862     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2863     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2864     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2865     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2866     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2868     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2869     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2851     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2867     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2870     2  0.0000     0.8764 0.000 1.000  0 0.000
#> GSM2854     4  0.1302     0.9005 0.000 0.044  0 0.956
#> GSM2873     2  0.4605     0.6260 0.000 0.664  0 0.336
#> GSM2874     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2884     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2875     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2890     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2877     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2892     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2902     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2878     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2901     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2879     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2898     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2881     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2897     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2882     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2894     4  0.0000     0.9416 0.000 0.000  0 1.000
#> GSM2883     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2895     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2885     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2886     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2887     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2896     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2888     2  0.1022     0.8708 0.000 0.968  0 0.032
#> GSM2889     2  0.1118     0.8697 0.000 0.964  0 0.036
#> GSM2876     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2891     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2880     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2893     1  0.0000     0.9312 1.000 0.000  0 0.000
#> GSM2821     2  0.3074     0.8102 0.000 0.848  0 0.152
#> GSM2900     1  0.7098     0.1108 0.472 0.400  0 0.128
#> GSM2903     1  0.7464     0.1942 0.480 0.328  0 0.192

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2 p3    p4    p5
#> GSM2819     2   0.457    0.44844 0.000 0.664  0 0.028 0.308
#> GSM2820     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2822     2   0.389    0.64018 0.000 0.680  0 0.320 0.000
#> GSM2832     2   0.389    0.64018 0.000 0.680  0 0.320 0.000
#> GSM2823     2   0.345    0.72993 0.000 0.784  0 0.208 0.008
#> GSM2824     2   0.477    0.63633 0.000 0.728  0 0.108 0.164
#> GSM2825     2   0.431    0.62105 0.000 0.660  0 0.328 0.012
#> GSM2826     2   0.408    0.62754 0.000 0.668  0 0.328 0.004
#> GSM2829     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2856     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2830     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2843     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2871     2   0.416    0.50923 0.000 0.608  0 0.392 0.000
#> GSM2831     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2844     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2833     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2846     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2835     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2858     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2836     2   0.364    0.78208 0.000 0.812  0 0.144 0.044
#> GSM2848     2   0.357    0.76837 0.000 0.800  0 0.176 0.024
#> GSM2828     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2837     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2839     5   0.429    0.32406 0.468 0.000  0 0.000 0.532
#> GSM2841     5   0.429    0.32406 0.468 0.000  0 0.000 0.532
#> GSM2827     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2842     2   0.029    0.81748 0.000 0.992  0 0.008 0.000
#> GSM2845     4   0.424    0.00988 0.000 0.428  0 0.572 0.000
#> GSM2872     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2834     4   0.366    0.50981 0.000 0.276  0 0.724 0.000
#> GSM2847     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2849     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2850     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2838     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2853     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2852     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2855     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2840     5   0.429    0.32406 0.468 0.000  0 0.000 0.532
#> GSM2857     5   0.429    0.32406 0.468 0.000  0 0.000 0.532
#> GSM2859     2   0.273    0.79951 0.000 0.840  0 0.000 0.160
#> GSM2860     2   0.273    0.79951 0.000 0.840  0 0.000 0.160
#> GSM2861     2   0.273    0.79951 0.000 0.840  0 0.000 0.160
#> GSM2862     2   0.273    0.79951 0.000 0.840  0 0.000 0.160
#> GSM2863     2   0.273    0.79951 0.000 0.840  0 0.000 0.160
#> GSM2864     2   0.273    0.79951 0.000 0.840  0 0.000 0.160
#> GSM2865     2   0.273    0.79951 0.000 0.840  0 0.000 0.160
#> GSM2866     2   0.273    0.79951 0.000 0.840  0 0.000 0.160
#> GSM2868     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2869     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2851     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2867     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2870     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2854     4   0.120    0.87932 0.000 0.048  0 0.952 0.000
#> GSM2873     2   0.437    0.63713 0.000 0.664  0 0.320 0.016
#> GSM2874     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2884     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2875     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2890     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2877     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2892     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2902     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2878     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2901     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2879     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2898     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2881     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2897     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2882     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2894     4   0.000    0.93073 0.000 0.000  0 1.000 0.000
#> GSM2883     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2895     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2885     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2886     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2887     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2896     3   0.000    1.00000 0.000 0.000  1 0.000 0.000
#> GSM2888     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2889     2   0.000    0.81829 0.000 1.000  0 0.000 0.000
#> GSM2876     1   0.223    0.81779 0.884 0.000  0 0.000 0.116
#> GSM2891     1   0.223    0.81773 0.884 0.000  0 0.000 0.116
#> GSM2880     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2893     1   0.000    0.96455 1.000 0.000  0 0.000 0.000
#> GSM2821     5   0.466   -0.13345 0.000 0.488  0 0.012 0.500
#> GSM2900     5   0.676    0.34765 0.244 0.116  0 0.064 0.576
#> GSM2903     5   0.666    0.36227 0.220 0.100  0 0.080 0.600

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2 p3    p4    p5    p6
#> GSM2819     5  0.1863    0.86454 0.000 0.104  0 0.000 0.896 0.000
#> GSM2820     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2822     2  0.3619    0.64155 0.000 0.680  0 0.316 0.004 0.000
#> GSM2832     2  0.3619    0.64155 0.000 0.680  0 0.316 0.004 0.000
#> GSM2823     2  0.3189    0.74492 0.000 0.796  0 0.184 0.020 0.000
#> GSM2824     2  0.4565    0.01576 0.000 0.532  0 0.036 0.432 0.000
#> GSM2825     2  0.3515    0.63181 0.000 0.676  0 0.324 0.000 0.000
#> GSM2826     2  0.3515    0.63181 0.000 0.676  0 0.324 0.000 0.000
#> GSM2829     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2856     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2830     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2843     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2871     2  0.3747    0.49962 0.000 0.604  0 0.396 0.000 0.000
#> GSM2831     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2844     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2833     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2846     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2835     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2858     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2836     2  0.3820    0.78303 0.000 0.784  0 0.144 0.008 0.064
#> GSM2848     2  0.3602    0.77350 0.000 0.784  0 0.176 0.008 0.032
#> GSM2828     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2837     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2839     6  0.3514    1.00000 0.108 0.000  0 0.000 0.088 0.804
#> GSM2841     6  0.3514    1.00000 0.108 0.000  0 0.000 0.088 0.804
#> GSM2827     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2842     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2845     4  0.3810    0.00917 0.000 0.428  0 0.572 0.000 0.000
#> GSM2872     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2834     4  0.3309    0.49739 0.000 0.280  0 0.720 0.000 0.000
#> GSM2847     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2849     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2850     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2838     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2853     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2852     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2855     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2840     6  0.3514    1.00000 0.108 0.000  0 0.000 0.088 0.804
#> GSM2857     6  0.3514    1.00000 0.108 0.000  0 0.000 0.088 0.804
#> GSM2859     2  0.3200    0.78909 0.000 0.788  0 0.000 0.016 0.196
#> GSM2860     2  0.3200    0.78909 0.000 0.788  0 0.000 0.016 0.196
#> GSM2861     2  0.3200    0.78909 0.000 0.788  0 0.000 0.016 0.196
#> GSM2862     2  0.3200    0.78909 0.000 0.788  0 0.000 0.016 0.196
#> GSM2863     2  0.3200    0.78909 0.000 0.788  0 0.000 0.016 0.196
#> GSM2864     2  0.3200    0.78909 0.000 0.788  0 0.000 0.016 0.196
#> GSM2865     2  0.3200    0.78909 0.000 0.788  0 0.000 0.016 0.196
#> GSM2866     2  0.3200    0.78909 0.000 0.788  0 0.000 0.016 0.196
#> GSM2868     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2869     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2851     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2867     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2870     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2854     4  0.1075    0.87878 0.000 0.048  0 0.952 0.000 0.000
#> GSM2873     2  0.3986    0.63740 0.000 0.664  0 0.316 0.000 0.020
#> GSM2874     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2884     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2875     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2890     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2877     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2892     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2902     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2878     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2901     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2879     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2898     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2881     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2897     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2882     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2894     4  0.0000    0.93012 0.000 0.000  0 1.000 0.000 0.000
#> GSM2883     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2895     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2885     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2886     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2887     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2896     3  0.0000    1.00000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2888     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2889     2  0.0146    0.81032 0.000 0.996  0 0.000 0.004 0.000
#> GSM2876     1  0.3877    0.72581 0.764 0.000  0 0.000 0.160 0.076
#> GSM2891     1  0.3694    0.73974 0.784 0.000  0 0.000 0.140 0.076
#> GSM2880     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2893     1  0.0000    0.95158 1.000 0.000  0 0.000 0.000 0.000
#> GSM2821     5  0.1082    0.92957 0.000 0.040  0 0.004 0.956 0.000
#> GSM2900     5  0.0458    0.92983 0.000 0.016  0 0.000 0.984 0.000
#> GSM2903     5  0.0508    0.92549 0.000 0.012  0 0.000 0.984 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-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 tissue(p) k
#> SD:pam 84  2.53e-05 2
#> SD:pam 82  2.06e-08 3
#> SD:pam 81  2.66e-10 4
#> SD:pam 75  3.07e-10 5
#> SD:pam 80  1.42e-16 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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.221           0.373       0.679         0.5030 0.559   0.559
#> 3 3 0.937           0.893       0.947         0.2735 0.551   0.339
#> 4 4 0.659           0.817       0.838         0.1447 0.857   0.613
#> 5 5 0.780           0.658       0.834         0.0748 0.913   0.680
#> 6 6 0.839           0.822       0.856         0.0442 0.884   0.541

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
#> GSM2819     2   0.997    -0.1865 0.468 0.532
#> GSM2820     2   0.909     0.4134 0.324 0.676
#> GSM2822     1   0.925     0.4433 0.660 0.340
#> GSM2832     1   0.925     0.4433 0.660 0.340
#> GSM2823     2   0.141     0.4278 0.020 0.980
#> GSM2824     2   0.141     0.4278 0.020 0.980
#> GSM2825     1   0.992     0.2569 0.552 0.448
#> GSM2826     1   0.992     0.2569 0.552 0.448
#> GSM2829     1   0.000     0.7722 1.000 0.000
#> GSM2856     1   0.000     0.7722 1.000 0.000
#> GSM2830     1   0.000     0.7722 1.000 0.000
#> GSM2843     1   0.000     0.7722 1.000 0.000
#> GSM2871     1   0.000     0.7722 1.000 0.000
#> GSM2831     1   0.000     0.7722 1.000 0.000
#> GSM2844     1   0.000     0.7722 1.000 0.000
#> GSM2833     1   0.000     0.7722 1.000 0.000
#> GSM2846     1   0.000     0.7722 1.000 0.000
#> GSM2835     1   0.000     0.7722 1.000 0.000
#> GSM2858     1   0.000     0.7722 1.000 0.000
#> GSM2836     1   0.961     0.4101 0.616 0.384
#> GSM2848     1   0.961     0.4102 0.616 0.384
#> GSM2828     2   0.909     0.4134 0.324 0.676
#> GSM2837     2   0.909     0.4134 0.324 0.676
#> GSM2839     2   0.767     0.4166 0.224 0.776
#> GSM2841     2   0.767     0.4166 0.224 0.776
#> GSM2827     1   0.871     0.5107 0.708 0.292
#> GSM2842     1   0.961     0.4103 0.616 0.384
#> GSM2845     1   0.000     0.7722 1.000 0.000
#> GSM2872     1   0.000     0.7722 1.000 0.000
#> GSM2834     1   0.000     0.7722 1.000 0.000
#> GSM2847     1   0.000     0.7722 1.000 0.000
#> GSM2849     2   0.909     0.4134 0.324 0.676
#> GSM2850     2   0.909     0.4134 0.324 0.676
#> GSM2838     2   0.993    -0.1423 0.452 0.548
#> GSM2853     2   0.993    -0.1423 0.452 0.548
#> GSM2852     2   0.909     0.4134 0.324 0.676
#> GSM2855     2   0.909     0.4134 0.324 0.676
#> GSM2840     2   0.767     0.4166 0.224 0.776
#> GSM2857     2   0.767     0.4166 0.224 0.776
#> GSM2859     2   0.993    -0.1423 0.452 0.548
#> GSM2860     2   0.993    -0.1423 0.452 0.548
#> GSM2861     2   0.993    -0.1423 0.452 0.548
#> GSM2862     2   0.993    -0.1423 0.452 0.548
#> GSM2863     2   0.993    -0.1423 0.452 0.548
#> GSM2864     2   0.993    -0.1423 0.452 0.548
#> GSM2865     2   0.993    -0.1423 0.452 0.548
#> GSM2866     2   0.993    -0.1423 0.452 0.548
#> GSM2868     2   0.993    -0.1423 0.452 0.548
#> GSM2869     2   0.993    -0.1423 0.452 0.548
#> GSM2851     2   0.993    -0.1423 0.452 0.548
#> GSM2867     2   0.993    -0.1423 0.452 0.548
#> GSM2870     2   0.993    -0.1423 0.452 0.548
#> GSM2854     1   0.000     0.7722 1.000 0.000
#> GSM2873     1   0.913     0.4505 0.672 0.328
#> GSM2874     2   0.909     0.4134 0.324 0.676
#> GSM2884     2   0.909     0.4134 0.324 0.676
#> GSM2875     2   0.767     0.4166 0.224 0.776
#> GSM2890     2   0.767     0.4166 0.224 0.776
#> GSM2877     2   0.767     0.4166 0.224 0.776
#> GSM2892     2   0.767     0.4166 0.224 0.776
#> GSM2902     2   0.767     0.4166 0.224 0.776
#> GSM2878     2   0.767     0.4166 0.224 0.776
#> GSM2901     2   0.767     0.4166 0.224 0.776
#> GSM2879     2   0.909     0.4134 0.324 0.676
#> GSM2898     2   0.909     0.4134 0.324 0.676
#> GSM2881     2   0.909     0.4134 0.324 0.676
#> GSM2897     2   0.909     0.4134 0.324 0.676
#> GSM2882     1   0.000     0.7722 1.000 0.000
#> GSM2894     1   0.000     0.7722 1.000 0.000
#> GSM2883     2   0.909     0.4134 0.324 0.676
#> GSM2895     2   0.909     0.4134 0.324 0.676
#> GSM2885     2   0.909     0.4134 0.324 0.676
#> GSM2886     2   0.909     0.4134 0.324 0.676
#> GSM2887     2   0.909     0.4134 0.324 0.676
#> GSM2896     2   0.909     0.4134 0.324 0.676
#> GSM2888     2   0.952    -0.0258 0.372 0.628
#> GSM2889     2   0.952    -0.0258 0.372 0.628
#> GSM2876     2   0.767     0.4166 0.224 0.776
#> GSM2891     2   0.767     0.4166 0.224 0.776
#> GSM2880     2   0.767     0.4166 0.224 0.776
#> GSM2893     2   0.767     0.4166 0.224 0.776
#> GSM2821     2   0.767     0.4166 0.224 0.776
#> GSM2900     2   0.767     0.4166 0.224 0.776
#> GSM2903     2   0.767     0.4166 0.224 0.776

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     1  0.0661      0.917 0.988 0.008 0.004
#> GSM2820     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2822     1  0.6432      0.219 0.568 0.428 0.004
#> GSM2832     2  0.6169      0.440 0.360 0.636 0.004
#> GSM2823     1  0.6410      0.277 0.576 0.004 0.420
#> GSM2824     1  0.6410      0.277 0.576 0.004 0.420
#> GSM2825     1  0.3644      0.810 0.872 0.124 0.004
#> GSM2826     1  0.3644      0.810 0.872 0.124 0.004
#> GSM2829     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2856     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2830     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2843     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2871     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2831     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2844     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2833     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2846     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2835     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2858     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2836     2  0.1337      0.965 0.016 0.972 0.012
#> GSM2848     2  0.1337      0.965 0.016 0.972 0.012
#> GSM2828     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2837     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2839     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2827     2  0.1163      0.962 0.028 0.972 0.000
#> GSM2842     2  0.1163      0.962 0.028 0.972 0.000
#> GSM2845     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2872     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2834     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2847     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2849     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2850     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2838     2  0.2229      0.948 0.012 0.944 0.044
#> GSM2853     2  0.1620      0.955 0.012 0.964 0.024
#> GSM2852     3  0.1289      0.930 0.032 0.000 0.968
#> GSM2855     3  0.1289      0.930 0.032 0.000 0.968
#> GSM2840     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2859     2  0.1620      0.955 0.012 0.964 0.024
#> GSM2860     2  0.2446      0.944 0.012 0.936 0.052
#> GSM2861     2  0.2550      0.941 0.012 0.932 0.056
#> GSM2862     2  0.2446      0.944 0.012 0.936 0.052
#> GSM2863     2  0.1751      0.954 0.012 0.960 0.028
#> GSM2864     2  0.2229      0.948 0.012 0.944 0.044
#> GSM2865     2  0.1999      0.952 0.012 0.952 0.036
#> GSM2866     2  0.1751      0.961 0.028 0.960 0.012
#> GSM2868     2  0.2681      0.945 0.040 0.932 0.028
#> GSM2869     2  0.2339      0.946 0.012 0.940 0.048
#> GSM2851     2  0.2446      0.944 0.012 0.936 0.052
#> GSM2867     2  0.2527      0.949 0.020 0.936 0.044
#> GSM2870     2  0.2939      0.928 0.012 0.916 0.072
#> GSM2854     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2873     2  0.1267      0.964 0.024 0.972 0.004
#> GSM2874     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2884     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2875     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2879     3  0.1289      0.930 0.032 0.000 0.968
#> GSM2898     3  0.1289      0.930 0.032 0.000 0.968
#> GSM2881     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2897     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2882     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2894     2  0.0747      0.966 0.016 0.984 0.000
#> GSM2883     3  0.1411      0.928 0.036 0.000 0.964
#> GSM2895     3  0.1411      0.928 0.036 0.000 0.964
#> GSM2885     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2886     3  0.0747      0.936 0.016 0.000 0.984
#> GSM2887     3  0.0892      0.935 0.020 0.000 0.980
#> GSM2896     3  0.0892      0.935 0.020 0.000 0.980
#> GSM2888     3  0.7102      0.227 0.024 0.420 0.556
#> GSM2889     3  0.7102      0.227 0.024 0.420 0.556
#> GSM2876     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2891     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2880     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2821     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2900     1  0.0000      0.924 1.000 0.000 0.000
#> GSM2903     1  0.0000      0.924 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     1  0.5389      0.616 0.660 0.308 0.000 0.032
#> GSM2820     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2822     1  0.7516      0.169 0.496 0.240 0.000 0.264
#> GSM2832     1  0.7516      0.169 0.496 0.240 0.000 0.264
#> GSM2823     1  0.8413      0.118 0.416 0.264 0.296 0.024
#> GSM2824     1  0.8413      0.118 0.416 0.264 0.296 0.024
#> GSM2825     1  0.6732      0.495 0.612 0.220 0.000 0.168
#> GSM2826     1  0.6732      0.495 0.612 0.220 0.000 0.168
#> GSM2829     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2843     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2871     4  0.0188      0.995 0.000 0.004 0.000 0.996
#> GSM2831     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2846     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2836     2  0.6265      0.799 0.124 0.656 0.000 0.220
#> GSM2848     2  0.6265      0.799 0.124 0.656 0.000 0.220
#> GSM2828     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0921      0.833 0.972 0.028 0.000 0.000
#> GSM2841     1  0.0921      0.833 0.972 0.028 0.000 0.000
#> GSM2827     2  0.6374      0.791 0.128 0.644 0.000 0.228
#> GSM2842     2  0.6344      0.793 0.128 0.648 0.000 0.224
#> GSM2845     4  0.0188      0.995 0.000 0.004 0.000 0.996
#> GSM2872     4  0.0188      0.995 0.000 0.004 0.000 0.996
#> GSM2834     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2847     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2849     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2838     2  0.2704      0.889 0.000 0.876 0.000 0.124
#> GSM2853     2  0.2704      0.889 0.000 0.876 0.000 0.124
#> GSM2852     3  0.7797      0.481 0.148 0.320 0.508 0.024
#> GSM2855     3  0.7797      0.481 0.148 0.320 0.508 0.024
#> GSM2840     1  0.0921      0.833 0.972 0.028 0.000 0.000
#> GSM2857     1  0.0921      0.833 0.972 0.028 0.000 0.000
#> GSM2859     2  0.3311      0.875 0.000 0.828 0.000 0.172
#> GSM2860     2  0.2704      0.889 0.000 0.876 0.000 0.124
#> GSM2861     2  0.4669      0.868 0.052 0.780 0.000 0.168
#> GSM2862     2  0.2760      0.889 0.000 0.872 0.000 0.128
#> GSM2863     2  0.2760      0.889 0.000 0.872 0.000 0.128
#> GSM2864     2  0.2760      0.889 0.000 0.872 0.000 0.128
#> GSM2865     2  0.2760      0.889 0.000 0.872 0.000 0.128
#> GSM2866     2  0.5184      0.851 0.060 0.736 0.000 0.204
#> GSM2868     2  0.3907      0.879 0.032 0.828 0.000 0.140
#> GSM2869     2  0.2704      0.889 0.000 0.876 0.000 0.124
#> GSM2851     2  0.2704      0.889 0.000 0.876 0.000 0.124
#> GSM2867     2  0.3088      0.889 0.008 0.864 0.000 0.128
#> GSM2870     2  0.2921      0.887 0.000 0.860 0.000 0.140
#> GSM2854     4  0.0524      0.984 0.004 0.008 0.000 0.988
#> GSM2873     2  0.6432      0.632 0.076 0.552 0.000 0.372
#> GSM2874     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> GSM2890     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> GSM2877     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> GSM2892     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> GSM2902     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> GSM2878     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> GSM2901     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> GSM2879     3  0.7047      0.620 0.148 0.192 0.636 0.024
#> GSM2898     3  0.7047      0.620 0.148 0.192 0.636 0.024
#> GSM2881     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2883     3  0.5369      0.759 0.084 0.116 0.776 0.024
#> GSM2895     3  0.5369      0.759 0.084 0.116 0.776 0.024
#> GSM2885     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000      0.882 0.000 0.000 1.000 0.000
#> GSM2887     3  0.0469      0.878 0.012 0.000 0.988 0.000
#> GSM2896     3  0.0469      0.878 0.012 0.000 0.988 0.000
#> GSM2888     2  0.6455      0.711 0.132 0.716 0.060 0.092
#> GSM2889     2  0.6443      0.706 0.136 0.716 0.060 0.088
#> GSM2876     1  0.0921      0.833 0.972 0.028 0.000 0.000
#> GSM2891     1  0.0921      0.833 0.972 0.028 0.000 0.000
#> GSM2880     1  0.0000      0.831 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> GSM2821     1  0.3711      0.780 0.836 0.140 0.000 0.024
#> GSM2900     1  0.3711      0.780 0.836 0.140 0.000 0.024
#> GSM2903     1  0.3711      0.780 0.836 0.140 0.000 0.024

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.6726     0.6096 0.348 0.176 0.000 0.012 0.464
#> GSM2820     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.8217     0.1826 0.304 0.368 0.000 0.172 0.156
#> GSM2832     2  0.8212     0.1907 0.300 0.372 0.000 0.172 0.156
#> GSM2823     5  0.4300     0.8798 0.476 0.000 0.000 0.000 0.524
#> GSM2824     5  0.4300     0.8798 0.476 0.000 0.000 0.000 0.524
#> GSM2825     1  0.8140    -0.5076 0.364 0.176 0.000 0.136 0.324
#> GSM2826     1  0.8140    -0.5076 0.364 0.176 0.000 0.136 0.324
#> GSM2829     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2856     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2830     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2843     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2871     4  0.0162     0.9920 0.004 0.000 0.000 0.996 0.000
#> GSM2831     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.0162     0.9924 0.000 0.004 0.000 0.996 0.000
#> GSM2846     4  0.0162     0.9924 0.000 0.004 0.000 0.996 0.000
#> GSM2835     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2858     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2836     2  0.7426     0.3816 0.268 0.488 0.000 0.172 0.072
#> GSM2848     2  0.7447     0.3799 0.268 0.488 0.000 0.168 0.076
#> GSM2828     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.0000     0.3016 1.000 0.000 0.000 0.000 0.000
#> GSM2841     1  0.0000     0.3016 1.000 0.000 0.000 0.000 0.000
#> GSM2827     2  0.8090     0.2580 0.276 0.408 0.000 0.176 0.140
#> GSM2842     2  0.8095     0.2550 0.276 0.408 0.000 0.172 0.144
#> GSM2845     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2872     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2834     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2847     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2849     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2852     1  0.6777    -0.6108 0.372 0.000 0.276 0.000 0.352
#> GSM2855     1  0.6777    -0.6108 0.372 0.000 0.276 0.000 0.352
#> GSM2840     1  0.0000     0.3016 1.000 0.000 0.000 0.000 0.000
#> GSM2857     1  0.0000     0.3016 1.000 0.000 0.000 0.000 0.000
#> GSM2859     2  0.1082     0.6981 0.000 0.964 0.000 0.028 0.008
#> GSM2860     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.2732     0.6590 0.088 0.884 0.000 0.008 0.020
#> GSM2862     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.7125     0.4771 0.140 0.576 0.000 0.132 0.152
#> GSM2868     2  0.2784     0.6774 0.012 0.888 0.000 0.072 0.028
#> GSM2869     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2851     2  0.0000     0.7015 0.000 1.000 0.000 0.000 0.000
#> GSM2867     2  0.2390     0.6840 0.008 0.908 0.000 0.060 0.024
#> GSM2870     2  0.0290     0.7010 0.000 0.992 0.000 0.008 0.000
#> GSM2854     4  0.1538     0.9423 0.008 0.008 0.000 0.948 0.036
#> GSM2873     2  0.8063     0.3052 0.200 0.412 0.000 0.264 0.124
#> GSM2874     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.4297     0.5952 0.528 0.000 0.000 0.000 0.472
#> GSM2890     1  0.4297     0.5952 0.528 0.000 0.000 0.000 0.472
#> GSM2877     1  0.4297     0.5952 0.528 0.000 0.000 0.000 0.472
#> GSM2892     1  0.4297     0.5952 0.528 0.000 0.000 0.000 0.472
#> GSM2902     1  0.4297     0.5952 0.528 0.000 0.000 0.000 0.472
#> GSM2878     1  0.4297     0.5952 0.528 0.000 0.000 0.000 0.472
#> GSM2901     1  0.4297     0.5952 0.528 0.000 0.000 0.000 0.472
#> GSM2879     5  0.5812     0.8131 0.372 0.000 0.100 0.000 0.528
#> GSM2898     5  0.5812     0.8131 0.372 0.000 0.100 0.000 0.528
#> GSM2881     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2894     4  0.0000     0.9958 0.000 0.000 0.000 1.000 0.000
#> GSM2883     3  0.4434     0.6526 0.056 0.000 0.736 0.000 0.208
#> GSM2895     3  0.4434     0.6526 0.056 0.000 0.736 0.000 0.208
#> GSM2885     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0579     0.9470 0.008 0.000 0.984 0.000 0.008
#> GSM2896     3  0.0579     0.9470 0.008 0.000 0.984 0.000 0.008
#> GSM2888     2  0.7473    -0.0378 0.280 0.392 0.000 0.036 0.292
#> GSM2889     2  0.7473    -0.0378 0.280 0.392 0.000 0.036 0.292
#> GSM2876     1  0.0609     0.3142 0.980 0.000 0.000 0.000 0.020
#> GSM2891     1  0.0609     0.3142 0.980 0.000 0.000 0.000 0.020
#> GSM2880     1  0.4294     0.5938 0.532 0.000 0.000 0.000 0.468
#> GSM2893     1  0.4297     0.5952 0.528 0.000 0.000 0.000 0.472
#> GSM2821     5  0.4302     0.8785 0.480 0.000 0.000 0.000 0.520
#> GSM2900     5  0.4302     0.8785 0.480 0.000 0.000 0.000 0.520
#> GSM2903     5  0.4305     0.8711 0.488 0.000 0.000 0.000 0.512

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.1391     0.6047 0.000 0.016 0.000 0.000 0.944 0.040
#> GSM2820     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     5  0.5114     0.6642 0.000 0.128 0.000 0.028 0.684 0.160
#> GSM2832     5  0.5114     0.6642 0.000 0.128 0.000 0.028 0.684 0.160
#> GSM2823     5  0.2340     0.5969 0.000 0.000 0.000 0.000 0.852 0.148
#> GSM2824     5  0.2340     0.5969 0.000 0.000 0.000 0.000 0.852 0.148
#> GSM2825     5  0.4297     0.4993 0.068 0.000 0.000 0.044 0.772 0.116
#> GSM2826     5  0.4297     0.4993 0.068 0.000 0.000 0.044 0.772 0.116
#> GSM2829     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2843     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2871     4  0.0993     0.9520 0.000 0.000 0.000 0.964 0.024 0.012
#> GSM2831     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.1434     0.9359 0.000 0.000 0.000 0.940 0.012 0.048
#> GSM2846     4  0.1367     0.9392 0.000 0.000 0.000 0.944 0.012 0.044
#> GSM2835     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     5  0.5967     0.6315 0.000 0.228 0.000 0.020 0.548 0.204
#> GSM2848     5  0.5904     0.6380 0.000 0.220 0.000 0.020 0.560 0.200
#> GSM2828     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     6  0.5787     0.9922 0.248 0.000 0.000 0.000 0.248 0.504
#> GSM2841     6  0.5787     0.9922 0.248 0.000 0.000 0.000 0.248 0.504
#> GSM2827     5  0.6282     0.6411 0.000 0.204 0.000 0.048 0.544 0.204
#> GSM2842     5  0.6282     0.6411 0.000 0.204 0.000 0.048 0.544 0.204
#> GSM2845     4  0.0622     0.9599 0.000 0.000 0.000 0.980 0.008 0.012
#> GSM2872     4  0.0622     0.9599 0.000 0.000 0.000 0.980 0.008 0.012
#> GSM2834     4  0.0146     0.9664 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2847     4  0.0520     0.9620 0.000 0.000 0.000 0.984 0.008 0.008
#> GSM2849     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0000     0.9372 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2853     2  0.0146     0.9352 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2852     5  0.3802     0.6196 0.000 0.000 0.012 0.000 0.676 0.312
#> GSM2855     5  0.3802     0.6196 0.000 0.000 0.012 0.000 0.676 0.312
#> GSM2840     6  0.5787     0.9922 0.248 0.000 0.000 0.000 0.248 0.504
#> GSM2857     6  0.5787     0.9922 0.248 0.000 0.000 0.000 0.248 0.504
#> GSM2859     2  0.0922     0.9192 0.000 0.968 0.000 0.004 0.004 0.024
#> GSM2860     2  0.0000     0.9372 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2861     2  0.1970     0.8639 0.000 0.912 0.000 0.000 0.028 0.060
#> GSM2862     2  0.0000     0.9372 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2863     2  0.0000     0.9372 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2864     2  0.0000     0.9372 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2865     2  0.0000     0.9372 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2866     5  0.5771     0.3894 0.000 0.396 0.000 0.012 0.468 0.124
#> GSM2868     2  0.4516    -0.0872 0.000 0.564 0.000 0.000 0.400 0.036
#> GSM2869     2  0.0508     0.9298 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM2851     2  0.0000     0.9372 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2867     2  0.1789     0.8768 0.000 0.924 0.000 0.000 0.044 0.032
#> GSM2870     2  0.0000     0.9372 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2854     4  0.4855     0.5121 0.000 0.000 0.000 0.660 0.204 0.136
#> GSM2873     5  0.6683     0.6095 0.000 0.200 0.000 0.112 0.528 0.160
#> GSM2874     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.9828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.9828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.9828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.9828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.9828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0405     0.9736 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM2901     1  0.0692     0.9644 0.976 0.000 0.000 0.000 0.020 0.004
#> GSM2879     5  0.3636     0.6197 0.000 0.000 0.004 0.000 0.676 0.320
#> GSM2898     5  0.3636     0.6197 0.000 0.000 0.004 0.000 0.676 0.320
#> GSM2881     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2894     4  0.0000     0.9674 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2883     3  0.5651     0.4933 0.000 0.000 0.532 0.000 0.208 0.260
#> GSM2895     3  0.5651     0.4933 0.000 0.000 0.532 0.000 0.208 0.260
#> GSM2885     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.8995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.3670     0.7401 0.000 0.000 0.736 0.000 0.024 0.240
#> GSM2896     3  0.3645     0.7429 0.000 0.000 0.740 0.000 0.024 0.236
#> GSM2888     5  0.5430     0.6526 0.000 0.224 0.000 0.016 0.620 0.140
#> GSM2889     5  0.5430     0.6526 0.000 0.224 0.000 0.016 0.620 0.140
#> GSM2876     6  0.5784     0.9842 0.260 0.000 0.000 0.000 0.236 0.504
#> GSM2891     6  0.5784     0.9842 0.260 0.000 0.000 0.000 0.236 0.504
#> GSM2880     1  0.1219     0.9116 0.948 0.000 0.000 0.000 0.048 0.004
#> GSM2893     1  0.0000     0.9828 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.1757     0.5754 0.000 0.008 0.000 0.000 0.916 0.076
#> GSM2900     5  0.1967     0.5681 0.000 0.012 0.000 0.000 0.904 0.084
#> GSM2903     5  0.1866     0.5675 0.000 0.008 0.000 0.000 0.908 0.084

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 tissue(p) k
#> SD:mclust 19        NA 2
#> SD:mclust 78  1.69e-08 3
#> SD:mclust 76  3.70e-11 4
#> SD:mclust 64  1.46e-12 5
#> SD:mclust 78  4.67e-17 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) are extracted by 'SD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.892           0.896       0.935         0.4374 0.577   0.577
#> 3 3 0.821           0.869       0.937         0.4272 0.648   0.465
#> 4 4 0.938           0.919       0.963         0.2023 0.834   0.589
#> 5 5 0.878           0.825       0.887         0.0483 0.944   0.787
#> 6 6 0.868           0.803       0.857         0.0381 0.968   0.853

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
#> GSM2819     1  0.9129      0.465 0.672 0.328
#> GSM2820     2  0.2043      0.908 0.032 0.968
#> GSM2822     2  0.9998      0.150 0.492 0.508
#> GSM2832     2  0.7453      0.784 0.212 0.788
#> GSM2823     2  0.7950      0.712 0.240 0.760
#> GSM2824     2  0.9552      0.483 0.376 0.624
#> GSM2825     1  0.2043      0.960 0.968 0.032
#> GSM2826     1  0.2043      0.960 0.968 0.032
#> GSM2829     2  0.3274      0.929 0.060 0.940
#> GSM2856     2  0.3431      0.927 0.064 0.936
#> GSM2830     2  0.3274      0.929 0.060 0.940
#> GSM2843     2  0.3274      0.929 0.060 0.940
#> GSM2871     2  0.3274      0.929 0.060 0.940
#> GSM2831     2  0.9661      0.455 0.392 0.608
#> GSM2844     2  0.9866      0.347 0.432 0.568
#> GSM2833     2  0.5408      0.881 0.124 0.876
#> GSM2846     2  0.3431      0.927 0.064 0.936
#> GSM2835     1  0.2043      0.960 0.968 0.032
#> GSM2858     1  0.2043      0.960 0.968 0.032
#> GSM2836     2  0.3274      0.929 0.060 0.940
#> GSM2848     2  0.3274      0.929 0.060 0.940
#> GSM2828     2  0.2043      0.908 0.032 0.968
#> GSM2837     2  0.2043      0.908 0.032 0.968
#> GSM2839     1  0.0000      0.972 1.000 0.000
#> GSM2841     1  0.0000      0.972 1.000 0.000
#> GSM2827     2  0.3274      0.929 0.060 0.940
#> GSM2842     2  0.3274      0.929 0.060 0.940
#> GSM2845     2  0.3274      0.929 0.060 0.940
#> GSM2872     2  0.7376      0.790 0.208 0.792
#> GSM2834     2  0.3274      0.929 0.060 0.940
#> GSM2847     2  0.3274      0.929 0.060 0.940
#> GSM2849     2  0.2043      0.908 0.032 0.968
#> GSM2850     2  0.2043      0.908 0.032 0.968
#> GSM2838     2  0.3274      0.929 0.060 0.940
#> GSM2853     2  0.3274      0.929 0.060 0.940
#> GSM2852     2  0.1633      0.910 0.024 0.976
#> GSM2855     2  0.1633      0.910 0.024 0.976
#> GSM2840     1  0.0000      0.972 1.000 0.000
#> GSM2857     1  0.0000      0.972 1.000 0.000
#> GSM2859     2  0.3274      0.929 0.060 0.940
#> GSM2860     2  0.3274      0.929 0.060 0.940
#> GSM2861     2  0.3274      0.929 0.060 0.940
#> GSM2862     2  0.3274      0.929 0.060 0.940
#> GSM2863     2  0.3274      0.929 0.060 0.940
#> GSM2864     2  0.3274      0.929 0.060 0.940
#> GSM2865     2  0.3274      0.929 0.060 0.940
#> GSM2866     2  0.3274      0.929 0.060 0.940
#> GSM2868     2  0.3274      0.929 0.060 0.940
#> GSM2869     2  0.3274      0.929 0.060 0.940
#> GSM2851     2  0.3274      0.929 0.060 0.940
#> GSM2867     2  0.3274      0.929 0.060 0.940
#> GSM2870     2  0.3274      0.929 0.060 0.940
#> GSM2854     2  0.3431      0.927 0.064 0.936
#> GSM2873     2  0.3274      0.929 0.060 0.940
#> GSM2874     2  0.2043      0.908 0.032 0.968
#> GSM2884     2  0.2043      0.908 0.032 0.968
#> GSM2875     1  0.0000      0.972 1.000 0.000
#> GSM2890     1  0.0000      0.972 1.000 0.000
#> GSM2877     1  0.0000      0.972 1.000 0.000
#> GSM2892     1  0.0000      0.972 1.000 0.000
#> GSM2902     1  0.0000      0.972 1.000 0.000
#> GSM2878     1  0.0000      0.972 1.000 0.000
#> GSM2901     1  0.0000      0.972 1.000 0.000
#> GSM2879     2  0.1414      0.911 0.020 0.980
#> GSM2898     2  0.1184      0.911 0.016 0.984
#> GSM2881     2  0.2043      0.908 0.032 0.968
#> GSM2897     2  0.2043      0.908 0.032 0.968
#> GSM2882     1  0.2778      0.949 0.952 0.048
#> GSM2894     1  0.2778      0.949 0.952 0.048
#> GSM2883     2  0.2043      0.908 0.032 0.968
#> GSM2895     2  0.2043      0.908 0.032 0.968
#> GSM2885     2  0.2043      0.908 0.032 0.968
#> GSM2886     2  0.2043      0.908 0.032 0.968
#> GSM2887     2  0.2043      0.908 0.032 0.968
#> GSM2896     2  0.2043      0.908 0.032 0.968
#> GSM2888     2  0.0672      0.915 0.008 0.992
#> GSM2889     2  0.0672      0.915 0.008 0.992
#> GSM2876     1  0.0000      0.972 1.000 0.000
#> GSM2891     1  0.0000      0.972 1.000 0.000
#> GSM2880     1  0.0000      0.972 1.000 0.000
#> GSM2893     1  0.0000      0.972 1.000 0.000
#> GSM2821     1  0.1843      0.962 0.972 0.028
#> GSM2900     1  0.1414      0.966 0.980 0.020
#> GSM2903     1  0.1414      0.966 0.980 0.020

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2820     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2822     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2832     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2823     3  0.9949    -0.0397 0.356 0.284 0.360
#> GSM2824     1  0.8853     0.4225 0.568 0.264 0.168
#> GSM2825     2  0.6079     0.4020 0.388 0.612 0.000
#> GSM2826     2  0.6126     0.3788 0.400 0.600 0.000
#> GSM2829     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2856     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2830     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2843     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2871     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2831     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2844     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2833     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2846     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2835     2  0.0892     0.8984 0.020 0.980 0.000
#> GSM2858     2  0.0747     0.9007 0.016 0.984 0.000
#> GSM2836     2  0.2448     0.8837 0.000 0.924 0.076
#> GSM2848     2  0.1529     0.8984 0.000 0.960 0.040
#> GSM2828     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2837     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2839     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2841     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2827     2  0.2261     0.8883 0.000 0.932 0.068
#> GSM2842     2  0.4121     0.8172 0.000 0.832 0.168
#> GSM2845     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2872     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2834     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2847     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2849     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2850     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2838     2  0.0237     0.9077 0.000 0.996 0.004
#> GSM2853     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2852     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2855     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2840     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2857     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2859     2  0.1411     0.8995 0.000 0.964 0.036
#> GSM2860     2  0.2625     0.8798 0.000 0.916 0.084
#> GSM2861     2  0.4654     0.7756 0.000 0.792 0.208
#> GSM2862     2  0.1753     0.8954 0.000 0.952 0.048
#> GSM2863     2  0.3038     0.8681 0.000 0.896 0.104
#> GSM2864     2  0.4002     0.8240 0.000 0.840 0.160
#> GSM2865     2  0.2878     0.8731 0.000 0.904 0.096
#> GSM2866     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2868     2  0.6111     0.4729 0.000 0.604 0.396
#> GSM2869     2  0.4931     0.7476 0.000 0.768 0.232
#> GSM2851     2  0.2878     0.8734 0.000 0.904 0.096
#> GSM2867     2  0.5327     0.6945 0.000 0.728 0.272
#> GSM2870     2  0.3116     0.8654 0.000 0.892 0.108
#> GSM2854     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2873     2  0.0000     0.9083 0.000 1.000 0.000
#> GSM2874     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2884     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2875     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2890     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2877     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2892     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2902     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2878     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2901     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2879     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2898     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2881     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2897     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2882     2  0.0424     0.9049 0.008 0.992 0.000
#> GSM2894     2  0.0424     0.9049 0.008 0.992 0.000
#> GSM2883     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2895     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2885     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2886     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2887     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2896     3  0.0000     0.9673 0.000 0.000 1.000
#> GSM2888     2  0.6286     0.3016 0.000 0.536 0.464
#> GSM2889     2  0.6302     0.2540 0.000 0.520 0.480
#> GSM2876     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2891     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2880     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2893     1  0.0000     0.9596 1.000 0.000 0.000
#> GSM2821     1  0.3816     0.7927 0.852 0.148 0.000
#> GSM2900     1  0.1163     0.9356 0.972 0.028 0.000
#> GSM2903     1  0.1289     0.9317 0.968 0.032 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.0524      0.903 0.008 0.988 0.000 0.004
#> GSM2820     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2822     2  0.3400      0.768 0.000 0.820 0.000 0.180
#> GSM2832     2  0.3400      0.768 0.000 0.820 0.000 0.180
#> GSM2823     2  0.4967      0.138 0.452 0.548 0.000 0.000
#> GSM2824     2  0.4843      0.312 0.396 0.604 0.000 0.000
#> GSM2825     2  0.7430      0.423 0.228 0.512 0.000 0.260
#> GSM2826     2  0.6680      0.542 0.136 0.604 0.000 0.260
#> GSM2829     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2843     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2871     4  0.0188      0.995 0.000 0.004 0.000 0.996
#> GSM2831     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0188      0.995 0.000 0.004 0.000 0.996
#> GSM2846     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2836     2  0.1211      0.891 0.000 0.960 0.000 0.040
#> GSM2848     2  0.1022      0.895 0.000 0.968 0.000 0.032
#> GSM2828     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2827     2  0.1211      0.891 0.000 0.960 0.000 0.040
#> GSM2842     2  0.0817      0.899 0.000 0.976 0.000 0.024
#> GSM2845     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2872     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2834     4  0.0188      0.995 0.000 0.004 0.000 0.996
#> GSM2847     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2849     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2838     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2853     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2852     3  0.0336      0.991 0.000 0.008 0.992 0.000
#> GSM2855     3  0.0188      0.995 0.000 0.004 0.996 0.000
#> GSM2840     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2857     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2861     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2862     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2868     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2869     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2851     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2867     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2870     2  0.0000      0.907 0.000 1.000 0.000 0.000
#> GSM2854     4  0.0707      0.979 0.000 0.020 0.000 0.980
#> GSM2873     2  0.4277      0.637 0.000 0.720 0.000 0.280
#> GSM2874     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2879     3  0.0469      0.988 0.000 0.012 0.988 0.000
#> GSM2898     3  0.0817      0.977 0.000 0.024 0.976 0.000
#> GSM2881     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2883     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2895     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2885     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2887     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2896     3  0.0000      0.997 0.000 0.000 1.000 0.000
#> GSM2888     2  0.0524      0.905 0.000 0.988 0.004 0.008
#> GSM2889     2  0.0376      0.906 0.000 0.992 0.004 0.004
#> GSM2876     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.968 1.000 0.000 0.000 0.000
#> GSM2821     1  0.4222      0.634 0.728 0.272 0.000 0.000
#> GSM2900     1  0.2647      0.864 0.880 0.120 0.000 0.000
#> GSM2903     1  0.2647      0.864 0.880 0.120 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     2  0.6446      0.288 0.388 0.464 0.000 0.008 0.140
#> GSM2820     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.5390      0.733 0.056 0.724 0.000 0.072 0.148
#> GSM2832     2  0.5308      0.723 0.036 0.728 0.000 0.108 0.128
#> GSM2823     1  0.5584      0.198 0.584 0.324 0.000 0.000 0.092
#> GSM2824     1  0.5289      0.204 0.616 0.312 0.000 0.000 0.072
#> GSM2825     5  0.6858      0.525 0.124 0.184 0.000 0.096 0.596
#> GSM2826     5  0.6803      0.476 0.104 0.256 0.000 0.072 0.568
#> GSM2829     4  0.0609      0.967 0.000 0.000 0.000 0.980 0.020
#> GSM2856     4  0.0703      0.967 0.000 0.000 0.000 0.976 0.024
#> GSM2830     4  0.0451      0.969 0.004 0.000 0.000 0.988 0.008
#> GSM2843     4  0.0451      0.969 0.000 0.004 0.000 0.988 0.008
#> GSM2871     4  0.1267      0.963 0.004 0.012 0.000 0.960 0.024
#> GSM2831     4  0.0162      0.969 0.004 0.000 0.000 0.996 0.000
#> GSM2844     4  0.0162      0.969 0.004 0.000 0.000 0.996 0.000
#> GSM2833     4  0.2236      0.937 0.024 0.000 0.000 0.908 0.068
#> GSM2846     4  0.2079      0.941 0.020 0.000 0.000 0.916 0.064
#> GSM2835     4  0.1270      0.956 0.000 0.000 0.000 0.948 0.052
#> GSM2858     4  0.1732      0.938 0.000 0.000 0.000 0.920 0.080
#> GSM2836     2  0.0865      0.900 0.004 0.972 0.000 0.000 0.024
#> GSM2848     2  0.0510      0.903 0.000 0.984 0.000 0.000 0.016
#> GSM2828     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2839     5  0.2648      0.663 0.152 0.000 0.000 0.000 0.848
#> GSM2841     5  0.2813      0.631 0.168 0.000 0.000 0.000 0.832
#> GSM2827     2  0.1012      0.906 0.020 0.968 0.000 0.000 0.012
#> GSM2842     2  0.1386      0.905 0.032 0.952 0.000 0.000 0.016
#> GSM2845     4  0.0609      0.968 0.000 0.000 0.000 0.980 0.020
#> GSM2872     4  0.0566      0.969 0.004 0.000 0.000 0.984 0.012
#> GSM2834     4  0.1568      0.948 0.000 0.020 0.000 0.944 0.036
#> GSM2847     4  0.0609      0.968 0.000 0.000 0.000 0.980 0.020
#> GSM2849     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.2359      0.896 0.060 0.904 0.000 0.000 0.036
#> GSM2853     2  0.2359      0.896 0.060 0.904 0.000 0.000 0.036
#> GSM2852     3  0.0162      0.994 0.000 0.004 0.996 0.000 0.000
#> GSM2855     3  0.0162      0.994 0.000 0.004 0.996 0.000 0.000
#> GSM2840     5  0.2439      0.676 0.120 0.000 0.000 0.004 0.876
#> GSM2857     5  0.2536      0.676 0.128 0.000 0.000 0.004 0.868
#> GSM2859     2  0.0912      0.903 0.012 0.972 0.000 0.000 0.016
#> GSM2860     2  0.0510      0.903 0.000 0.984 0.000 0.000 0.016
#> GSM2861     2  0.0693      0.906 0.012 0.980 0.000 0.000 0.008
#> GSM2862     2  0.0671      0.902 0.004 0.980 0.000 0.000 0.016
#> GSM2863     2  0.0798      0.902 0.008 0.976 0.000 0.000 0.016
#> GSM2864     2  0.0912      0.903 0.012 0.972 0.000 0.000 0.016
#> GSM2865     2  0.0798      0.902 0.008 0.976 0.000 0.000 0.016
#> GSM2866     2  0.0609      0.902 0.000 0.980 0.000 0.000 0.020
#> GSM2868     2  0.3075      0.875 0.092 0.860 0.000 0.000 0.048
#> GSM2869     2  0.2889      0.884 0.084 0.872 0.000 0.000 0.044
#> GSM2851     2  0.2426      0.894 0.064 0.900 0.000 0.000 0.036
#> GSM2867     2  0.2770      0.887 0.076 0.880 0.000 0.000 0.044
#> GSM2870     2  0.2554      0.891 0.072 0.892 0.000 0.000 0.036
#> GSM2854     4  0.1568      0.955 0.000 0.020 0.000 0.944 0.036
#> GSM2873     2  0.3019      0.816 0.000 0.864 0.000 0.088 0.048
#> GSM2874     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.3999      0.625 0.656 0.000 0.000 0.000 0.344
#> GSM2890     1  0.3999      0.625 0.656 0.000 0.000 0.000 0.344
#> GSM2877     1  0.4015      0.621 0.652 0.000 0.000 0.000 0.348
#> GSM2892     1  0.3999      0.625 0.656 0.000 0.000 0.000 0.344
#> GSM2902     1  0.3999      0.625 0.656 0.000 0.000 0.000 0.344
#> GSM2878     1  0.3949      0.623 0.668 0.000 0.000 0.000 0.332
#> GSM2901     1  0.3949      0.623 0.668 0.000 0.000 0.000 0.332
#> GSM2879     3  0.0771      0.976 0.000 0.020 0.976 0.000 0.004
#> GSM2898     3  0.0609      0.978 0.000 0.020 0.980 0.000 0.000
#> GSM2881     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0693      0.967 0.012 0.000 0.000 0.980 0.008
#> GSM2894     4  0.0912      0.965 0.016 0.000 0.000 0.972 0.012
#> GSM2883     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2885     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000      0.997 0.000 0.000 1.000 0.000 0.000
#> GSM2888     2  0.2536      0.897 0.044 0.900 0.004 0.000 0.052
#> GSM2889     2  0.2536      0.897 0.044 0.900 0.004 0.000 0.052
#> GSM2876     1  0.3508      0.548 0.748 0.000 0.000 0.000 0.252
#> GSM2891     1  0.3452      0.545 0.756 0.000 0.000 0.000 0.244
#> GSM2880     1  0.4045      0.612 0.644 0.000 0.000 0.000 0.356
#> GSM2893     1  0.4045      0.612 0.644 0.000 0.000 0.000 0.356
#> GSM2821     1  0.4525      0.263 0.740 0.056 0.000 0.004 0.200
#> GSM2900     1  0.3174      0.379 0.844 0.020 0.000 0.004 0.132
#> GSM2903     1  0.3219      0.375 0.840 0.020 0.000 0.004 0.136

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.2324     0.5743 0.016 0.048 0.000 0.020 0.908 0.008
#> GSM2820     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     6  0.5879    -0.3229 0.000 0.396 0.000 0.016 0.128 0.460
#> GSM2832     2  0.6099     0.3270 0.000 0.440 0.000 0.024 0.140 0.396
#> GSM2823     5  0.5082     0.3999 0.460 0.056 0.000 0.000 0.476 0.008
#> GSM2824     5  0.5108     0.4821 0.424 0.060 0.000 0.000 0.508 0.008
#> GSM2825     6  0.3311     0.6374 0.092 0.024 0.000 0.016 0.020 0.848
#> GSM2826     6  0.3298     0.6167 0.064 0.044 0.000 0.016 0.020 0.856
#> GSM2829     4  0.1471     0.9091 0.000 0.000 0.000 0.932 0.004 0.064
#> GSM2856     4  0.1753     0.9017 0.000 0.000 0.000 0.912 0.004 0.084
#> GSM2830     4  0.0725     0.9211 0.000 0.000 0.000 0.976 0.012 0.012
#> GSM2843     4  0.0820     0.9206 0.000 0.000 0.000 0.972 0.012 0.016
#> GSM2871     4  0.1798     0.9070 0.000 0.028 0.000 0.932 0.020 0.020
#> GSM2831     4  0.0146     0.9231 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2844     4  0.0291     0.9233 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2833     4  0.3426     0.8393 0.000 0.000 0.000 0.808 0.124 0.068
#> GSM2846     4  0.3261     0.8531 0.000 0.000 0.000 0.824 0.104 0.072
#> GSM2835     4  0.3440     0.8043 0.000 0.000 0.000 0.776 0.028 0.196
#> GSM2858     4  0.3470     0.8000 0.000 0.000 0.000 0.772 0.028 0.200
#> GSM2836     2  0.1148     0.7854 0.000 0.960 0.000 0.004 0.016 0.020
#> GSM2848     2  0.0436     0.7988 0.000 0.988 0.000 0.004 0.004 0.004
#> GSM2828     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     6  0.4520     0.6782 0.220 0.000 0.000 0.000 0.092 0.688
#> GSM2841     6  0.4614     0.6692 0.228 0.000 0.000 0.000 0.096 0.676
#> GSM2827     2  0.2724     0.8013 0.000 0.864 0.000 0.000 0.052 0.084
#> GSM2842     2  0.3321     0.7953 0.000 0.820 0.000 0.000 0.080 0.100
#> GSM2845     4  0.1350     0.9176 0.000 0.008 0.000 0.952 0.020 0.020
#> GSM2872     4  0.1059     0.9191 0.000 0.004 0.000 0.964 0.016 0.016
#> GSM2834     4  0.2816     0.8561 0.000 0.088 0.000 0.868 0.020 0.024
#> GSM2847     4  0.1369     0.9163 0.000 0.016 0.000 0.952 0.016 0.016
#> GSM2849     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.4780     0.7511 0.000 0.660 0.000 0.000 0.228 0.112
#> GSM2853     2  0.4866     0.7450 0.000 0.648 0.000 0.000 0.236 0.116
#> GSM2852     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2855     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2840     6  0.4156     0.6972 0.188 0.000 0.000 0.000 0.080 0.732
#> GSM2857     6  0.4186     0.6969 0.192 0.000 0.000 0.000 0.080 0.728
#> GSM2859     2  0.0748     0.7966 0.000 0.976 0.000 0.004 0.004 0.016
#> GSM2860     2  0.0363     0.7969 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2861     2  0.1984     0.8050 0.000 0.912 0.000 0.000 0.056 0.032
#> GSM2862     2  0.0363     0.7969 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2863     2  0.0603     0.7944 0.000 0.980 0.000 0.000 0.004 0.016
#> GSM2864     2  0.0951     0.7898 0.000 0.968 0.000 0.004 0.008 0.020
#> GSM2865     2  0.0748     0.7931 0.000 0.976 0.000 0.004 0.004 0.016
#> GSM2866     2  0.0725     0.7928 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM2868     2  0.4873     0.7283 0.000 0.632 0.000 0.000 0.268 0.100
#> GSM2869     2  0.4834     0.7394 0.000 0.644 0.000 0.000 0.252 0.104
#> GSM2851     2  0.4625     0.7582 0.000 0.680 0.000 0.000 0.216 0.104
#> GSM2867     2  0.4769     0.7467 0.000 0.656 0.000 0.000 0.240 0.104
#> GSM2870     2  0.4914     0.7314 0.000 0.628 0.000 0.000 0.268 0.104
#> GSM2854     4  0.1555     0.9141 0.000 0.004 0.000 0.932 0.004 0.060
#> GSM2873     2  0.2084     0.7734 0.000 0.916 0.000 0.044 0.016 0.024
#> GSM2874     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.8781 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.8781 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0291     0.8751 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM2892     1  0.0000     0.8781 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0146     0.8769 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM2878     1  0.0458     0.8689 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM2901     1  0.0458     0.8689 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM2879     3  0.1588     0.9132 0.000 0.072 0.924 0.000 0.004 0.000
#> GSM2898     3  0.1219     0.9396 0.000 0.048 0.948 0.000 0.004 0.000
#> GSM2881     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0363     0.9231 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM2894     4  0.0603     0.9228 0.000 0.000 0.000 0.980 0.016 0.004
#> GSM2883     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000     0.9919 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.5008     0.7246 0.000 0.644 0.000 0.000 0.168 0.188
#> GSM2889     2  0.5088     0.7302 0.000 0.648 0.004 0.000 0.168 0.180
#> GSM2876     1  0.3899     0.1325 0.628 0.000 0.000 0.000 0.364 0.008
#> GSM2891     1  0.3945     0.0706 0.612 0.000 0.000 0.000 0.380 0.008
#> GSM2880     1  0.0405     0.8733 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM2893     1  0.0405     0.8733 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM2821     5  0.3025     0.7149 0.132 0.012 0.000 0.004 0.840 0.012
#> GSM2900     5  0.3368     0.7174 0.232 0.000 0.000 0.000 0.756 0.012
#> GSM2903     5  0.3398     0.7236 0.216 0.004 0.000 0.000 0.768 0.012

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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

test_to_known_factors(res)
#>         n tissue(p) k
#> SD:NMF 79  4.66e-05 2
#> SD:NMF 77  2.99e-08 3
#> SD:NMF 81  2.10e-11 4
#> SD:NMF 77  3.38e-14 5
#> SD:NMF 78  5.97e-18 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 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-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.405           0.359       0.691         0.3610 0.620   0.620
#> 3 3 0.640           0.832       0.829         0.5497 0.659   0.510
#> 4 4 0.938           0.963       0.972         0.2916 0.849   0.650
#> 5 5 0.903           0.897       0.926         0.0492 0.964   0.873
#> 6 6 0.870           0.887       0.910         0.0393 0.974   0.894

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

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

There is also optional best \(k\) = 4 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
#> GSM2819     1   0.993     -0.318 0.548 0.452
#> GSM2820     2   0.978      0.384 0.412 0.588
#> GSM2822     2   1.000      0.414 0.496 0.504
#> GSM2832     2   1.000      0.414 0.496 0.504
#> GSM2823     1   1.000     -0.425 0.508 0.492
#> GSM2824     1   1.000     -0.425 0.508 0.492
#> GSM2825     2   1.000      0.414 0.496 0.504
#> GSM2826     2   1.000      0.414 0.496 0.504
#> GSM2829     2   0.855      0.195 0.280 0.720
#> GSM2856     2   0.855      0.195 0.280 0.720
#> GSM2830     2   0.855      0.195 0.280 0.720
#> GSM2843     2   0.855      0.195 0.280 0.720
#> GSM2871     2   0.855      0.195 0.280 0.720
#> GSM2831     2   0.855      0.195 0.280 0.720
#> GSM2844     2   0.855      0.195 0.280 0.720
#> GSM2833     2   0.855      0.195 0.280 0.720
#> GSM2846     2   0.855      0.195 0.280 0.720
#> GSM2835     2   0.855      0.195 0.280 0.720
#> GSM2858     2   0.855      0.195 0.280 0.720
#> GSM2836     2   1.000      0.414 0.496 0.504
#> GSM2848     2   1.000      0.414 0.496 0.504
#> GSM2828     2   0.978      0.384 0.412 0.588
#> GSM2837     2   0.978      0.384 0.412 0.588
#> GSM2839     1   0.000      0.725 1.000 0.000
#> GSM2841     1   0.000      0.725 1.000 0.000
#> GSM2827     2   1.000      0.414 0.496 0.504
#> GSM2842     2   1.000      0.414 0.496 0.504
#> GSM2845     2   0.855      0.195 0.280 0.720
#> GSM2872     2   0.855      0.195 0.280 0.720
#> GSM2834     2   0.855      0.195 0.280 0.720
#> GSM2847     2   0.855      0.195 0.280 0.720
#> GSM2849     2   0.978      0.384 0.412 0.588
#> GSM2850     2   0.978      0.384 0.412 0.588
#> GSM2838     2   1.000      0.414 0.496 0.504
#> GSM2853     2   1.000      0.414 0.496 0.504
#> GSM2852     2   0.998      0.405 0.472 0.528
#> GSM2855     2   0.998      0.405 0.472 0.528
#> GSM2840     1   0.000      0.725 1.000 0.000
#> GSM2857     1   0.000      0.725 1.000 0.000
#> GSM2859     2   1.000      0.414 0.496 0.504
#> GSM2860     2   1.000      0.414 0.496 0.504
#> GSM2861     2   1.000      0.414 0.496 0.504
#> GSM2862     2   1.000      0.414 0.496 0.504
#> GSM2863     2   1.000      0.414 0.496 0.504
#> GSM2864     2   1.000      0.414 0.496 0.504
#> GSM2865     2   1.000      0.414 0.496 0.504
#> GSM2866     2   1.000      0.414 0.496 0.504
#> GSM2868     2   1.000      0.414 0.496 0.504
#> GSM2869     2   1.000      0.414 0.496 0.504
#> GSM2851     2   1.000      0.414 0.496 0.504
#> GSM2867     2   1.000      0.414 0.496 0.504
#> GSM2870     2   1.000      0.414 0.496 0.504
#> GSM2854     2   0.886      0.184 0.304 0.696
#> GSM2873     2   0.886      0.184 0.304 0.696
#> GSM2874     2   0.978      0.384 0.412 0.588
#> GSM2884     2   0.978      0.384 0.412 0.588
#> GSM2875     1   0.000      0.725 1.000 0.000
#> GSM2890     1   0.000      0.725 1.000 0.000
#> GSM2877     1   0.000      0.725 1.000 0.000
#> GSM2892     1   0.000      0.725 1.000 0.000
#> GSM2902     1   0.000      0.725 1.000 0.000
#> GSM2878     1   0.000      0.725 1.000 0.000
#> GSM2901     1   0.000      0.725 1.000 0.000
#> GSM2879     2   1.000      0.414 0.496 0.504
#> GSM2898     2   1.000      0.414 0.496 0.504
#> GSM2881     2   0.978      0.384 0.412 0.588
#> GSM2897     2   0.978      0.384 0.412 0.588
#> GSM2882     2   0.855      0.195 0.280 0.720
#> GSM2894     2   0.855      0.195 0.280 0.720
#> GSM2883     2   0.978      0.384 0.412 0.588
#> GSM2895     2   0.978      0.384 0.412 0.588
#> GSM2885     2   0.978      0.384 0.412 0.588
#> GSM2886     2   0.978      0.384 0.412 0.588
#> GSM2887     2   0.978      0.384 0.412 0.588
#> GSM2896     2   0.978      0.384 0.412 0.588
#> GSM2888     2   1.000      0.414 0.496 0.504
#> GSM2889     2   1.000      0.414 0.496 0.504
#> GSM2876     1   0.000      0.725 1.000 0.000
#> GSM2891     1   0.000      0.725 1.000 0.000
#> GSM2880     1   0.000      0.725 1.000 0.000
#> GSM2893     1   0.000      0.725 1.000 0.000
#> GSM2821     1   0.993     -0.318 0.548 0.452
#> GSM2900     1   0.993     -0.318 0.548 0.452
#> GSM2903     1   0.993     -0.318 0.548 0.452

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     3  0.2448      0.730 0.076 0.000 0.924
#> GSM2820     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2822     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2832     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2823     3  0.1411      0.749 0.036 0.000 0.964
#> GSM2824     3  0.1411      0.749 0.036 0.000 0.964
#> GSM2825     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2826     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2829     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2856     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2830     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2843     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2871     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2831     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2844     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2833     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2846     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2835     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2858     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2836     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2848     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2828     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2837     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2839     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2827     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2842     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2845     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2872     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2834     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2847     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2849     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2850     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2838     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2853     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2852     3  0.3752      0.720 0.000 0.144 0.856
#> GSM2855     3  0.3752      0.720 0.000 0.144 0.856
#> GSM2840     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2859     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2860     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2861     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2862     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2863     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2864     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2865     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2866     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2868     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2869     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2851     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2867     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2870     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2854     2  0.6204      0.963 0.000 0.576 0.424
#> GSM2873     2  0.6204      0.963 0.000 0.576 0.424
#> GSM2874     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2884     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2875     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2879     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2898     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2881     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2897     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2882     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2894     2  0.6126      0.996 0.000 0.600 0.400
#> GSM2883     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2895     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2885     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2886     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2887     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2896     3  0.6126      0.621 0.000 0.400 0.600
#> GSM2888     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2889     3  0.0000      0.776 0.000 0.000 1.000
#> GSM2876     1  0.0892      0.976 0.980 0.000 0.020
#> GSM2891     1  0.0892      0.976 0.980 0.000 0.020
#> GSM2880     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.996 1.000 0.000 0.000
#> GSM2821     3  0.2448      0.730 0.076 0.000 0.924
#> GSM2900     3  0.2448      0.730 0.076 0.000 0.924
#> GSM2903     3  0.2448      0.730 0.076 0.000 0.924

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.3621      0.881 0.072 0.860 0.000 0.068
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2822     2  0.3356      0.824 0.000 0.824 0.000 0.176
#> GSM2832     2  0.3356      0.824 0.000 0.824 0.000 0.176
#> GSM2823     2  0.1305      0.934 0.036 0.960 0.000 0.004
#> GSM2824     2  0.1305      0.934 0.036 0.960 0.000 0.004
#> GSM2825     2  0.3356      0.824 0.000 0.824 0.000 0.176
#> GSM2826     2  0.3356      0.824 0.000 0.824 0.000 0.176
#> GSM2829     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2856     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2830     4  0.0707      0.989 0.000 0.020 0.000 0.980
#> GSM2843     4  0.0707      0.989 0.000 0.020 0.000 0.980
#> GSM2871     4  0.0707      0.989 0.000 0.020 0.000 0.980
#> GSM2831     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2844     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2833     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2846     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2835     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2858     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2836     2  0.0188      0.952 0.000 0.996 0.000 0.004
#> GSM2848     2  0.0188      0.952 0.000 0.996 0.000 0.004
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2827     2  0.0188      0.952 0.000 0.996 0.000 0.004
#> GSM2842     2  0.0188      0.952 0.000 0.996 0.000 0.004
#> GSM2845     4  0.0707      0.989 0.000 0.020 0.000 0.980
#> GSM2872     4  0.0707      0.989 0.000 0.020 0.000 0.980
#> GSM2834     4  0.0817      0.986 0.000 0.024 0.000 0.976
#> GSM2847     4  0.0817      0.986 0.000 0.024 0.000 0.976
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2838     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2853     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2852     2  0.2973      0.840 0.000 0.856 0.144 0.000
#> GSM2855     2  0.2973      0.840 0.000 0.856 0.144 0.000
#> GSM2840     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2857     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2859     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2860     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2861     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2862     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2863     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2864     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2865     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2866     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2868     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM2869     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM2851     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2867     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM2870     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2854     4  0.1940      0.933 0.000 0.076 0.000 0.924
#> GSM2873     4  0.1940      0.933 0.000 0.076 0.000 0.924
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2879     2  0.0376      0.951 0.000 0.992 0.004 0.004
#> GSM2898     2  0.0376      0.951 0.000 0.992 0.004 0.004
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2894     4  0.0592      0.990 0.000 0.016 0.000 0.984
#> GSM2883     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2888     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2889     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM2876     1  0.0707      0.976 0.980 0.020 0.000 0.000
#> GSM2891     1  0.0707      0.976 0.980 0.020 0.000 0.000
#> GSM2880     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM2821     2  0.3621      0.881 0.072 0.860 0.000 0.068
#> GSM2900     2  0.3621      0.881 0.072 0.860 0.000 0.068
#> GSM2903     2  0.3621      0.881 0.072 0.860 0.000 0.068

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.3949      1.000 0.000 0.332 0.000 0.000 0.668
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.4395      0.511 0.000 0.748 0.000 0.188 0.064
#> GSM2832     2  0.4395      0.511 0.000 0.748 0.000 0.188 0.064
#> GSM2823     2  0.2124      0.800 0.000 0.900 0.000 0.004 0.096
#> GSM2824     2  0.2124      0.800 0.000 0.900 0.000 0.004 0.096
#> GSM2825     2  0.4395      0.511 0.000 0.748 0.000 0.188 0.064
#> GSM2826     2  0.4395      0.511 0.000 0.748 0.000 0.188 0.064
#> GSM2829     4  0.0000      0.843 0.000 0.000 0.000 1.000 0.000
#> GSM2856     4  0.0000      0.843 0.000 0.000 0.000 1.000 0.000
#> GSM2830     4  0.4288      0.817 0.000 0.012 0.000 0.664 0.324
#> GSM2843     4  0.4288      0.817 0.000 0.012 0.000 0.664 0.324
#> GSM2871     4  0.4288      0.817 0.000 0.012 0.000 0.664 0.324
#> GSM2831     4  0.0609      0.842 0.000 0.000 0.000 0.980 0.020
#> GSM2844     4  0.0609      0.842 0.000 0.000 0.000 0.980 0.020
#> GSM2833     4  0.0000      0.843 0.000 0.000 0.000 1.000 0.000
#> GSM2846     4  0.0000      0.843 0.000 0.000 0.000 1.000 0.000
#> GSM2835     4  0.0000      0.843 0.000 0.000 0.000 1.000 0.000
#> GSM2858     4  0.0000      0.843 0.000 0.000 0.000 1.000 0.000
#> GSM2836     2  0.0566      0.905 0.000 0.984 0.000 0.004 0.012
#> GSM2848     2  0.0566      0.905 0.000 0.984 0.000 0.004 0.012
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2827     2  0.0566      0.905 0.000 0.984 0.000 0.004 0.012
#> GSM2842     2  0.0566      0.905 0.000 0.984 0.000 0.004 0.012
#> GSM2845     4  0.4288      0.817 0.000 0.012 0.000 0.664 0.324
#> GSM2872     4  0.4288      0.817 0.000 0.012 0.000 0.664 0.324
#> GSM2834     4  0.4290      0.815 0.000 0.016 0.000 0.680 0.304
#> GSM2847     4  0.4290      0.815 0.000 0.016 0.000 0.680 0.304
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2852     2  0.2561      0.701 0.000 0.856 0.144 0.000 0.000
#> GSM2855     2  0.2561      0.701 0.000 0.856 0.144 0.000 0.000
#> GSM2840     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2857     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2860     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2862     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2868     2  0.0404      0.905 0.000 0.988 0.000 0.000 0.012
#> GSM2869     2  0.0404      0.905 0.000 0.988 0.000 0.000 0.012
#> GSM2851     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2867     2  0.0404      0.905 0.000 0.988 0.000 0.000 0.012
#> GSM2870     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2854     4  0.5126      0.774 0.000 0.064 0.000 0.636 0.300
#> GSM2873     4  0.5126      0.774 0.000 0.064 0.000 0.636 0.300
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2879     2  0.0727      0.903 0.000 0.980 0.004 0.004 0.012
#> GSM2898     2  0.0727      0.903 0.000 0.980 0.004 0.004 0.012
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0609      0.842 0.000 0.000 0.000 0.980 0.020
#> GSM2894     4  0.0609      0.842 0.000 0.000 0.000 0.980 0.020
#> GSM2883     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2888     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2889     2  0.0000      0.909 0.000 1.000 0.000 0.000 0.000
#> GSM2876     1  0.1478      0.940 0.936 0.000 0.000 0.000 0.064
#> GSM2891     1  0.1478      0.940 0.936 0.000 0.000 0.000 0.064
#> GSM2880     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.3949      1.000 0.000 0.332 0.000 0.000 0.668
#> GSM2900     5  0.3949      1.000 0.000 0.332 0.000 0.000 0.668
#> GSM2903     5  0.3949      1.000 0.000 0.332 0.000 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
#> GSM2819     5  0.2260      1.000 0.000 0.140 0.000 0.000 0.860 0.000
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     2  0.5709      0.396 0.000 0.584 0.000 0.152 0.020 0.244
#> GSM2832     2  0.5709      0.396 0.000 0.584 0.000 0.152 0.020 0.244
#> GSM2823     2  0.3168      0.705 0.000 0.804 0.000 0.000 0.172 0.024
#> GSM2824     2  0.3168      0.705 0.000 0.804 0.000 0.000 0.172 0.024
#> GSM2825     2  0.5709      0.396 0.000 0.584 0.000 0.152 0.020 0.244
#> GSM2826     2  0.5709      0.396 0.000 0.584 0.000 0.152 0.020 0.244
#> GSM2829     4  0.0000      0.901 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000      0.901 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     6  0.3244      0.885 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2843     6  0.3244      0.885 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2871     6  0.3244      0.885 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2831     4  0.2219      0.843 0.000 0.000 0.000 0.864 0.000 0.136
#> GSM2844     4  0.2219      0.843 0.000 0.000 0.000 0.864 0.000 0.136
#> GSM2833     4  0.0000      0.901 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2846     4  0.0000      0.901 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2835     4  0.0000      0.901 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000      0.901 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     2  0.0777      0.890 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM2848     2  0.0777      0.890 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     1  0.2531      0.891 0.856 0.000 0.000 0.000 0.132 0.012
#> GSM2841     1  0.2531      0.891 0.856 0.000 0.000 0.000 0.132 0.012
#> GSM2827     2  0.0777      0.890 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM2842     2  0.0777      0.890 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM2845     6  0.3244      0.885 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2872     6  0.3244      0.885 0.000 0.000 0.000 0.268 0.000 0.732
#> GSM2834     6  0.3830      0.846 0.000 0.004 0.000 0.376 0.000 0.620
#> GSM2847     6  0.3830      0.846 0.000 0.004 0.000 0.376 0.000 0.620
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0146      0.895 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2853     2  0.0146      0.895 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2852     2  0.2300      0.758 0.000 0.856 0.144 0.000 0.000 0.000
#> GSM2855     2  0.2300      0.758 0.000 0.856 0.144 0.000 0.000 0.000
#> GSM2840     1  0.2531      0.891 0.856 0.000 0.000 0.000 0.132 0.012
#> GSM2857     1  0.2531      0.891 0.856 0.000 0.000 0.000 0.132 0.012
#> GSM2859     2  0.0260      0.895 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2860     2  0.0260      0.895 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2861     2  0.0260      0.895 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2862     2  0.0260      0.895 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2863     2  0.0260      0.895 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2864     2  0.0260      0.895 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2865     2  0.0260      0.895 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2866     2  0.0260      0.895 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2868     2  0.0717      0.890 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM2869     2  0.0717      0.890 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM2851     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2867     2  0.0717      0.890 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM2870     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2854     6  0.4444      0.793 0.000 0.024 0.000 0.356 0.008 0.612
#> GSM2873     6  0.4444      0.793 0.000 0.024 0.000 0.356 0.008 0.612
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     2  0.0922      0.888 0.000 0.968 0.004 0.000 0.004 0.024
#> GSM2898     2  0.0922      0.888 0.000 0.968 0.004 0.000 0.004 0.024
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.2219      0.843 0.000 0.000 0.000 0.864 0.000 0.136
#> GSM2894     4  0.2219      0.843 0.000 0.000 0.000 0.864 0.000 0.136
#> GSM2883     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2889     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2876     1  0.1327      0.913 0.936 0.000 0.000 0.000 0.064 0.000
#> GSM2891     1  0.1327      0.913 0.936 0.000 0.000 0.000 0.064 0.000
#> GSM2880     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.2260      1.000 0.000 0.140 0.000 0.000 0.860 0.000
#> GSM2900     5  0.2260      1.000 0.000 0.140 0.000 0.000 0.860 0.000
#> GSM2903     5  0.2260      1.000 0.000 0.140 0.000 0.000 0.860 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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

test_to_known_factors(res)
#>            n tissue(p) k
#> CV:hclust 15        NA 2
#> CV:hclust 84  6.67e-09 3
#> CV:hclust 84  1.99e-12 4
#> CV:hclust 84  6.24e-16 5
#> CV:hclust 80  9.28e-19 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) are extracted by 'CV' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.242           0.524       0.644         0.3847 0.598   0.598
#> 3 3 0.382           0.778       0.781         0.5444 0.685   0.521
#> 4 4 0.630           0.908       0.854         0.1890 0.850   0.628
#> 5 5 0.790           0.853       0.853         0.0823 1.000   1.000
#> 6 6 0.765           0.755       0.800         0.0445 0.987   0.949

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
#> GSM2819     1  0.9954     -0.396 0.540 0.460
#> GSM2820     2  0.6973      0.537 0.188 0.812
#> GSM2822     1  0.9988     -0.429 0.520 0.480
#> GSM2832     1  0.9988     -0.429 0.520 0.480
#> GSM2823     2  0.9933      0.565 0.452 0.548
#> GSM2824     2  0.9933      0.565 0.452 0.548
#> GSM2825     1  0.9922     -0.373 0.552 0.448
#> GSM2826     1  0.9922     -0.373 0.552 0.448
#> GSM2829     2  0.9833      0.405 0.424 0.576
#> GSM2856     2  0.9833      0.405 0.424 0.576
#> GSM2830     2  0.9833      0.405 0.424 0.576
#> GSM2843     2  0.9833      0.405 0.424 0.576
#> GSM2871     2  0.9833      0.405 0.424 0.576
#> GSM2831     2  0.9850      0.398 0.428 0.572
#> GSM2844     2  0.9850      0.398 0.428 0.572
#> GSM2833     2  0.9815      0.405 0.420 0.580
#> GSM2846     2  0.9815      0.405 0.420 0.580
#> GSM2835     2  0.9881      0.381 0.436 0.564
#> GSM2858     2  0.9881      0.381 0.436 0.564
#> GSM2836     2  0.9686      0.603 0.396 0.604
#> GSM2848     2  0.9686      0.603 0.396 0.604
#> GSM2828     2  0.6973      0.537 0.188 0.812
#> GSM2837     2  0.6973      0.537 0.188 0.812
#> GSM2839     1  0.0000      0.793 1.000 0.000
#> GSM2841     1  0.0000      0.793 1.000 0.000
#> GSM2827     2  0.9635      0.605 0.388 0.612
#> GSM2842     2  0.9635      0.605 0.388 0.612
#> GSM2845     2  0.9833      0.405 0.424 0.576
#> GSM2872     2  0.9833      0.405 0.424 0.576
#> GSM2834     2  0.9833      0.405 0.424 0.576
#> GSM2847     2  0.9833      0.405 0.424 0.576
#> GSM2849     2  0.6973      0.537 0.188 0.812
#> GSM2850     2  0.6973      0.537 0.188 0.812
#> GSM2838     2  0.9686      0.603 0.396 0.604
#> GSM2853     2  0.9686      0.603 0.396 0.604
#> GSM2852     2  0.5408      0.547 0.124 0.876
#> GSM2855     2  0.5408      0.547 0.124 0.876
#> GSM2840     1  0.0000      0.793 1.000 0.000
#> GSM2857     1  0.0000      0.793 1.000 0.000
#> GSM2859     2  0.9686      0.603 0.396 0.604
#> GSM2860     2  0.9686      0.603 0.396 0.604
#> GSM2861     2  0.9686      0.603 0.396 0.604
#> GSM2862     2  0.9686      0.603 0.396 0.604
#> GSM2863     2  0.9686      0.603 0.396 0.604
#> GSM2864     2  0.9686      0.603 0.396 0.604
#> GSM2865     2  0.9686      0.603 0.396 0.604
#> GSM2866     2  0.9686      0.603 0.396 0.604
#> GSM2868     2  0.9686      0.603 0.396 0.604
#> GSM2869     2  0.9686      0.603 0.396 0.604
#> GSM2851     2  0.9686      0.603 0.396 0.604
#> GSM2867     2  0.9686      0.603 0.396 0.604
#> GSM2870     2  0.9686      0.603 0.396 0.604
#> GSM2854     2  0.9710      0.404 0.400 0.600
#> GSM2873     2  0.9795      0.571 0.416 0.584
#> GSM2874     2  0.6973      0.537 0.188 0.812
#> GSM2884     2  0.6973      0.537 0.188 0.812
#> GSM2875     1  0.0672      0.793 0.992 0.008
#> GSM2890     1  0.0672      0.793 0.992 0.008
#> GSM2877     1  0.0672      0.793 0.992 0.008
#> GSM2892     1  0.0672      0.793 0.992 0.008
#> GSM2902     1  0.0672      0.793 0.992 0.008
#> GSM2878     1  0.0672      0.793 0.992 0.008
#> GSM2901     1  0.0672      0.793 0.992 0.008
#> GSM2879     2  0.7376      0.541 0.208 0.792
#> GSM2898     2  0.7376      0.541 0.208 0.792
#> GSM2881     2  0.6973      0.537 0.188 0.812
#> GSM2897     2  0.6973      0.537 0.188 0.812
#> GSM2882     2  0.9881      0.381 0.436 0.564
#> GSM2894     2  0.9881      0.381 0.436 0.564
#> GSM2883     2  0.6973      0.537 0.188 0.812
#> GSM2895     2  0.6973      0.537 0.188 0.812
#> GSM2885     2  0.6973      0.537 0.188 0.812
#> GSM2886     2  0.6973      0.537 0.188 0.812
#> GSM2887     2  0.6887      0.537 0.184 0.816
#> GSM2896     2  0.6887      0.537 0.184 0.816
#> GSM2888     2  0.9323      0.606 0.348 0.652
#> GSM2889     2  0.9323      0.606 0.348 0.652
#> GSM2876     1  0.0000      0.793 1.000 0.000
#> GSM2891     1  0.0000      0.793 1.000 0.000
#> GSM2880     1  0.0672      0.793 0.992 0.008
#> GSM2893     1  0.0672      0.793 0.992 0.008
#> GSM2821     1  0.1843      0.770 0.972 0.028
#> GSM2900     1  0.1843      0.770 0.972 0.028
#> GSM2903     1  0.1843      0.770 0.972 0.028

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     2   0.780      0.673 0.140 0.672 0.188
#> GSM2820     3   0.298      0.973 0.024 0.056 0.920
#> GSM2822     2   0.672      0.681 0.096 0.744 0.160
#> GSM2832     2   0.672      0.681 0.096 0.744 0.160
#> GSM2823     2   0.835      0.650 0.120 0.600 0.280
#> GSM2824     2   0.835      0.650 0.120 0.600 0.280
#> GSM2825     2   0.780      0.612 0.276 0.636 0.088
#> GSM2826     2   0.780      0.612 0.276 0.636 0.088
#> GSM2829     2   0.466      0.602 0.124 0.844 0.032
#> GSM2856     2   0.466      0.602 0.124 0.844 0.032
#> GSM2830     2   0.473      0.602 0.128 0.840 0.032
#> GSM2843     2   0.473      0.602 0.128 0.840 0.032
#> GSM2871     2   0.473      0.602 0.128 0.840 0.032
#> GSM2831     2   0.466      0.602 0.124 0.844 0.032
#> GSM2844     2   0.466      0.602 0.124 0.844 0.032
#> GSM2833     2   0.454      0.603 0.124 0.848 0.028
#> GSM2846     2   0.454      0.603 0.124 0.848 0.028
#> GSM2835     2   0.454      0.603 0.124 0.848 0.028
#> GSM2858     2   0.454      0.603 0.124 0.848 0.028
#> GSM2836     2   0.807      0.671 0.104 0.620 0.276
#> GSM2848     2   0.807      0.671 0.104 0.620 0.276
#> GSM2828     3   0.298      0.973 0.024 0.056 0.920
#> GSM2837     3   0.298      0.973 0.024 0.056 0.920
#> GSM2839     1   0.241      0.954 0.940 0.020 0.040
#> GSM2841     1   0.241      0.954 0.940 0.020 0.040
#> GSM2827     2   0.807      0.671 0.104 0.620 0.276
#> GSM2842     2   0.807      0.671 0.104 0.620 0.276
#> GSM2845     2   0.473      0.602 0.128 0.840 0.032
#> GSM2872     2   0.473      0.602 0.128 0.840 0.032
#> GSM2834     2   0.454      0.605 0.124 0.848 0.028
#> GSM2847     2   0.473      0.602 0.128 0.840 0.032
#> GSM2849     3   0.298      0.973 0.024 0.056 0.920
#> GSM2850     3   0.298      0.973 0.024 0.056 0.920
#> GSM2838     2   0.807      0.671 0.104 0.620 0.276
#> GSM2853     2   0.807      0.671 0.104 0.620 0.276
#> GSM2852     3   0.268      0.942 0.008 0.068 0.924
#> GSM2855     3   0.268      0.942 0.008 0.068 0.924
#> GSM2840     1   0.241      0.954 0.940 0.020 0.040
#> GSM2857     1   0.241      0.954 0.940 0.020 0.040
#> GSM2859     2   0.807      0.671 0.104 0.620 0.276
#> GSM2860     2   0.807      0.671 0.104 0.620 0.276
#> GSM2861     2   0.807      0.671 0.104 0.620 0.276
#> GSM2862     2   0.807      0.671 0.104 0.620 0.276
#> GSM2863     2   0.807      0.671 0.104 0.620 0.276
#> GSM2864     2   0.807      0.671 0.104 0.620 0.276
#> GSM2865     2   0.807      0.671 0.104 0.620 0.276
#> GSM2866     2   0.792      0.675 0.104 0.640 0.256
#> GSM2868     2   0.807      0.671 0.104 0.620 0.276
#> GSM2869     2   0.807      0.671 0.104 0.620 0.276
#> GSM2851     2   0.807      0.671 0.104 0.620 0.276
#> GSM2867     2   0.807      0.671 0.104 0.620 0.276
#> GSM2870     2   0.807      0.671 0.104 0.620 0.276
#> GSM2854     2   0.165      0.631 0.036 0.960 0.004
#> GSM2873     2   0.666      0.681 0.096 0.748 0.156
#> GSM2874     3   0.285      0.973 0.020 0.056 0.924
#> GSM2884     3   0.285      0.973 0.020 0.056 0.924
#> GSM2875     1   0.132      0.965 0.972 0.008 0.020
#> GSM2890     1   0.132      0.965 0.972 0.008 0.020
#> GSM2877     1   0.132      0.965 0.972 0.008 0.020
#> GSM2892     1   0.132      0.965 0.972 0.008 0.020
#> GSM2902     1   0.132      0.965 0.972 0.008 0.020
#> GSM2878     1   0.117      0.965 0.976 0.008 0.016
#> GSM2901     1   0.117      0.965 0.976 0.008 0.016
#> GSM2879     3   0.551      0.812 0.044 0.156 0.800
#> GSM2898     3   0.551      0.812 0.044 0.156 0.800
#> GSM2881     3   0.285      0.973 0.020 0.056 0.924
#> GSM2897     3   0.285      0.973 0.020 0.056 0.924
#> GSM2882     2   0.478      0.598 0.124 0.840 0.036
#> GSM2894     2   0.478      0.598 0.124 0.840 0.036
#> GSM2883     3   0.311      0.972 0.028 0.056 0.916
#> GSM2895     3   0.311      0.972 0.028 0.056 0.916
#> GSM2885     3   0.285      0.973 0.020 0.056 0.924
#> GSM2886     3   0.285      0.973 0.020 0.056 0.924
#> GSM2887     3   0.285      0.973 0.020 0.056 0.924
#> GSM2896     3   0.285      0.973 0.020 0.056 0.924
#> GSM2888     2   0.807      0.659 0.100 0.616 0.284
#> GSM2889     2   0.807      0.659 0.100 0.616 0.284
#> GSM2876     1   0.206      0.961 0.948 0.008 0.044
#> GSM2891     1   0.206      0.961 0.948 0.008 0.044
#> GSM2880     1   0.132      0.965 0.972 0.008 0.020
#> GSM2893     1   0.132      0.965 0.972 0.008 0.020
#> GSM2821     1   0.440      0.882 0.864 0.092 0.044
#> GSM2900     1   0.440      0.882 0.864 0.092 0.044
#> GSM2903     1   0.440      0.882 0.864 0.092 0.044

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.4758      0.806 0.024 0.816 0.080 0.080
#> GSM2820     3  0.4526      0.952 0.016 0.160 0.800 0.024
#> GSM2822     2  0.4370      0.767 0.000 0.800 0.044 0.156
#> GSM2832     2  0.4370      0.767 0.000 0.800 0.044 0.156
#> GSM2823     2  0.3471      0.860 0.016 0.880 0.036 0.068
#> GSM2824     2  0.3471      0.860 0.016 0.880 0.036 0.068
#> GSM2825     2  0.6410      0.625 0.040 0.688 0.064 0.208
#> GSM2826     2  0.6410      0.625 0.040 0.688 0.064 0.208
#> GSM2829     4  0.4400      0.971 0.012 0.136 0.036 0.816
#> GSM2856     4  0.4400      0.971 0.012 0.136 0.036 0.816
#> GSM2830     4  0.4853      0.971 0.024 0.132 0.044 0.800
#> GSM2843     4  0.4853      0.971 0.024 0.132 0.044 0.800
#> GSM2871     4  0.4853      0.971 0.024 0.132 0.044 0.800
#> GSM2831     4  0.4606      0.973 0.016 0.136 0.040 0.808
#> GSM2844     4  0.4606      0.973 0.016 0.136 0.040 0.808
#> GSM2833     4  0.4360      0.969 0.012 0.140 0.032 0.816
#> GSM2846     4  0.4360      0.969 0.012 0.140 0.032 0.816
#> GSM2835     4  0.4348      0.966 0.012 0.132 0.036 0.820
#> GSM2858     4  0.4348      0.966 0.012 0.132 0.036 0.820
#> GSM2836     2  0.1296      0.921 0.004 0.964 0.004 0.028
#> GSM2848     2  0.1296      0.921 0.004 0.964 0.004 0.028
#> GSM2828     3  0.4526      0.952 0.016 0.160 0.800 0.024
#> GSM2837     3  0.4526      0.952 0.016 0.160 0.800 0.024
#> GSM2839     1  0.4185      0.906 0.848 0.024 0.072 0.056
#> GSM2841     1  0.4185      0.906 0.848 0.024 0.072 0.056
#> GSM2827     2  0.1151      0.920 0.000 0.968 0.008 0.024
#> GSM2842     2  0.1151      0.920 0.000 0.968 0.008 0.024
#> GSM2845     4  0.4853      0.971 0.024 0.132 0.044 0.800
#> GSM2872     4  0.4853      0.971 0.024 0.132 0.044 0.800
#> GSM2834     4  0.4640      0.971 0.024 0.136 0.032 0.808
#> GSM2847     4  0.4680      0.972 0.024 0.132 0.036 0.808
#> GSM2849     3  0.4625      0.952 0.016 0.160 0.796 0.028
#> GSM2850     3  0.4625      0.952 0.016 0.160 0.796 0.028
#> GSM2838     2  0.0672      0.922 0.000 0.984 0.008 0.008
#> GSM2853     2  0.0672      0.922 0.000 0.984 0.008 0.008
#> GSM2852     3  0.4776      0.920 0.004 0.184 0.772 0.040
#> GSM2855     3  0.4776      0.920 0.004 0.184 0.772 0.040
#> GSM2840     1  0.4185      0.906 0.848 0.024 0.072 0.056
#> GSM2857     1  0.4185      0.906 0.848 0.024 0.072 0.056
#> GSM2859     2  0.1229      0.921 0.008 0.968 0.004 0.020
#> GSM2860     2  0.1229      0.921 0.008 0.968 0.004 0.020
#> GSM2861     2  0.1114      0.921 0.004 0.972 0.008 0.016
#> GSM2862     2  0.1229      0.921 0.008 0.968 0.004 0.020
#> GSM2863     2  0.1229      0.921 0.008 0.968 0.004 0.020
#> GSM2864     2  0.1229      0.921 0.008 0.968 0.004 0.020
#> GSM2865     2  0.1229      0.921 0.008 0.968 0.004 0.020
#> GSM2866     2  0.2057      0.911 0.008 0.940 0.020 0.032
#> GSM2868     2  0.0524      0.921 0.000 0.988 0.008 0.004
#> GSM2869     2  0.0524      0.921 0.000 0.988 0.008 0.004
#> GSM2851     2  0.0524      0.921 0.000 0.988 0.008 0.004
#> GSM2867     2  0.0524      0.921 0.000 0.988 0.008 0.004
#> GSM2870     2  0.0524      0.921 0.000 0.988 0.008 0.004
#> GSM2854     4  0.4418      0.941 0.008 0.172 0.024 0.796
#> GSM2873     2  0.4232      0.763 0.004 0.804 0.024 0.168
#> GSM2874     3  0.4305      0.952 0.012 0.160 0.808 0.020
#> GSM2884     3  0.4305      0.952 0.012 0.160 0.808 0.020
#> GSM2875     1  0.1749      0.927 0.952 0.024 0.012 0.012
#> GSM2890     1  0.1749      0.927 0.952 0.024 0.012 0.012
#> GSM2877     1  0.1749      0.927 0.952 0.024 0.012 0.012
#> GSM2892     1  0.1749      0.927 0.952 0.024 0.012 0.012
#> GSM2902     1  0.1749      0.927 0.952 0.024 0.012 0.012
#> GSM2878     1  0.1339      0.927 0.964 0.024 0.004 0.008
#> GSM2901     1  0.1339      0.927 0.964 0.024 0.004 0.008
#> GSM2879     3  0.5907      0.613 0.004 0.392 0.572 0.032
#> GSM2898     3  0.5907      0.613 0.004 0.392 0.572 0.032
#> GSM2881     3  0.4178      0.953 0.008 0.160 0.812 0.020
#> GSM2897     3  0.4178      0.953 0.008 0.160 0.812 0.020
#> GSM2882     4  0.4308      0.972 0.012 0.136 0.032 0.820
#> GSM2894     4  0.4308      0.972 0.012 0.136 0.032 0.820
#> GSM2883     3  0.5251      0.942 0.020 0.160 0.768 0.052
#> GSM2895     3  0.5251      0.942 0.020 0.160 0.768 0.052
#> GSM2885     3  0.4178      0.953 0.008 0.160 0.812 0.020
#> GSM2886     3  0.4178      0.953 0.008 0.160 0.812 0.020
#> GSM2887     3  0.4567      0.949 0.008 0.160 0.796 0.036
#> GSM2896     3  0.4567      0.949 0.008 0.160 0.796 0.036
#> GSM2888     2  0.1584      0.912 0.000 0.952 0.012 0.036
#> GSM2889     2  0.1584      0.912 0.000 0.952 0.012 0.036
#> GSM2876     1  0.3379      0.917 0.888 0.024 0.052 0.036
#> GSM2891     1  0.3379      0.917 0.888 0.024 0.052 0.036
#> GSM2880     1  0.1749      0.927 0.952 0.024 0.012 0.012
#> GSM2893     1  0.1749      0.927 0.952 0.024 0.012 0.012
#> GSM2821     1  0.6791      0.765 0.684 0.172 0.072 0.072
#> GSM2900     1  0.6791      0.765 0.684 0.172 0.072 0.072
#> GSM2903     1  0.6791      0.765 0.684 0.172 0.072 0.072

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4 p5
#> GSM2819     2  0.4329      0.697 0.000 0.672 0.000 0.016 NA
#> GSM2820     3  0.2663      0.912 0.004 0.064 0.896 0.004 NA
#> GSM2822     2  0.4944      0.751 0.000 0.724 0.004 0.116 NA
#> GSM2832     2  0.4944      0.751 0.000 0.724 0.004 0.116 NA
#> GSM2823     2  0.4468      0.736 0.000 0.696 0.004 0.024 NA
#> GSM2824     2  0.4468      0.736 0.000 0.696 0.004 0.024 NA
#> GSM2825     2  0.6093      0.638 0.000 0.608 0.012 0.156 NA
#> GSM2826     2  0.6093      0.638 0.000 0.608 0.012 0.156 NA
#> GSM2829     4  0.3522      0.923 0.000 0.032 0.020 0.844 NA
#> GSM2856     4  0.3522      0.923 0.000 0.032 0.020 0.844 NA
#> GSM2830     4  0.2386      0.929 0.004 0.032 0.004 0.912 NA
#> GSM2843     4  0.2386      0.929 0.004 0.032 0.004 0.912 NA
#> GSM2871     4  0.2722      0.925 0.004 0.032 0.008 0.896 NA
#> GSM2831     4  0.2045      0.934 0.004 0.032 0.012 0.932 NA
#> GSM2844     4  0.2045      0.934 0.004 0.032 0.012 0.932 NA
#> GSM2833     4  0.3452      0.925 0.000 0.032 0.024 0.852 NA
#> GSM2846     4  0.3452      0.925 0.000 0.032 0.024 0.852 NA
#> GSM2835     4  0.3640      0.916 0.000 0.028 0.020 0.832 NA
#> GSM2858     4  0.3640      0.916 0.000 0.028 0.020 0.832 NA
#> GSM2836     2  0.1818      0.877 0.000 0.932 0.000 0.024 NA
#> GSM2848     2  0.1818      0.877 0.000 0.932 0.000 0.024 NA
#> GSM2828     3  0.2663      0.912 0.004 0.064 0.896 0.004 NA
#> GSM2837     3  0.2663      0.912 0.004 0.064 0.896 0.004 NA
#> GSM2839     1  0.4163      0.839 0.772 0.004 0.020 0.012 NA
#> GSM2841     1  0.4163      0.839 0.772 0.004 0.020 0.012 NA
#> GSM2827     2  0.1725      0.878 0.000 0.936 0.000 0.020 NA
#> GSM2842     2  0.1725      0.878 0.000 0.936 0.000 0.020 NA
#> GSM2845     4  0.2741      0.924 0.000 0.032 0.012 0.892 NA
#> GSM2872     4  0.2741      0.924 0.000 0.032 0.012 0.892 NA
#> GSM2834     4  0.2632      0.930 0.000 0.032 0.004 0.892 NA
#> GSM2847     4  0.2569      0.931 0.000 0.032 0.004 0.896 NA
#> GSM2849     3  0.2972      0.911 0.004 0.064 0.880 0.004 NA
#> GSM2850     3  0.2972      0.911 0.004 0.064 0.880 0.004 NA
#> GSM2838     2  0.1697      0.874 0.000 0.932 0.000 0.008 NA
#> GSM2853     2  0.1697      0.874 0.000 0.932 0.000 0.008 NA
#> GSM2852     3  0.4643      0.856 0.000 0.068 0.736 0.004 NA
#> GSM2855     3  0.4643      0.856 0.000 0.068 0.736 0.004 NA
#> GSM2840     1  0.4163      0.839 0.772 0.004 0.020 0.012 NA
#> GSM2857     1  0.4163      0.839 0.772 0.004 0.020 0.012 NA
#> GSM2859     2  0.1205      0.880 0.000 0.956 0.000 0.004 NA
#> GSM2860     2  0.1205      0.880 0.000 0.956 0.000 0.004 NA
#> GSM2861     2  0.1638      0.879 0.000 0.932 0.000 0.004 NA
#> GSM2862     2  0.1205      0.880 0.000 0.956 0.000 0.004 NA
#> GSM2863     2  0.1205      0.880 0.000 0.956 0.000 0.004 NA
#> GSM2864     2  0.1205      0.880 0.000 0.956 0.000 0.004 NA
#> GSM2865     2  0.1205      0.880 0.000 0.956 0.000 0.004 NA
#> GSM2866     2  0.1484      0.880 0.000 0.944 0.000 0.008 NA
#> GSM2868     2  0.2011      0.867 0.000 0.908 0.000 0.004 NA
#> GSM2869     2  0.2011      0.867 0.000 0.908 0.000 0.004 NA
#> GSM2851     2  0.1952      0.868 0.000 0.912 0.000 0.004 NA
#> GSM2867     2  0.2011      0.867 0.000 0.908 0.000 0.004 NA
#> GSM2870     2  0.2011      0.867 0.000 0.908 0.000 0.004 NA
#> GSM2854     4  0.3781      0.915 0.000 0.040 0.020 0.828 NA
#> GSM2873     2  0.4280      0.776 0.000 0.772 0.000 0.140 NA
#> GSM2874     3  0.1924      0.914 0.000 0.064 0.924 0.004 NA
#> GSM2884     3  0.1638      0.914 0.000 0.064 0.932 0.000 NA
#> GSM2875     1  0.0486      0.878 0.988 0.004 0.004 0.004 NA
#> GSM2890     1  0.0486      0.878 0.988 0.004 0.004 0.004 NA
#> GSM2877     1  0.0486      0.878 0.988 0.004 0.004 0.004 NA
#> GSM2892     1  0.0486      0.878 0.988 0.004 0.004 0.004 NA
#> GSM2902     1  0.0486      0.878 0.988 0.004 0.004 0.004 NA
#> GSM2878     1  0.0613      0.878 0.984 0.004 0.008 0.004 NA
#> GSM2901     1  0.0613      0.878 0.984 0.004 0.008 0.004 NA
#> GSM2879     3  0.6471      0.437 0.000 0.336 0.488 0.004 NA
#> GSM2898     3  0.6471      0.437 0.000 0.336 0.488 0.004 NA
#> GSM2881     3  0.1981      0.915 0.000 0.064 0.920 0.000 NA
#> GSM2897     3  0.1981      0.915 0.000 0.064 0.920 0.000 NA
#> GSM2882     4  0.2312      0.934 0.004 0.032 0.012 0.920 NA
#> GSM2894     4  0.2312      0.934 0.004 0.032 0.012 0.920 NA
#> GSM2883     3  0.3275      0.899 0.000 0.064 0.860 0.008 NA
#> GSM2895     3  0.3275      0.899 0.000 0.064 0.860 0.008 NA
#> GSM2885     3  0.1981      0.915 0.000 0.064 0.920 0.000 NA
#> GSM2886     3  0.1981      0.915 0.000 0.064 0.920 0.000 NA
#> GSM2887     3  0.3334      0.900 0.000 0.064 0.852 0.004 NA
#> GSM2896     3  0.3334      0.900 0.000 0.064 0.852 0.004 NA
#> GSM2888     2  0.2783      0.854 0.000 0.868 0.004 0.012 NA
#> GSM2889     2  0.2783      0.854 0.000 0.868 0.004 0.012 NA
#> GSM2876     1  0.3180      0.855 0.844 0.004 0.012 0.004 NA
#> GSM2891     1  0.3180      0.855 0.844 0.004 0.012 0.004 NA
#> GSM2880     1  0.0486      0.878 0.988 0.004 0.004 0.004 NA
#> GSM2893     1  0.0486      0.878 0.988 0.004 0.004 0.004 NA
#> GSM2821     1  0.6660      0.572 0.480 0.168 0.000 0.012 NA
#> GSM2900     1  0.6660      0.572 0.480 0.168 0.000 0.012 NA
#> GSM2903     1  0.6660      0.572 0.480 0.168 0.000 0.012 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM2819     2  0.4095      0.139 0.000 0.512 0.000 0.008 0.480 NA
#> GSM2820     3  0.2135      0.857 0.000 0.024 0.916 0.004 0.012 NA
#> GSM2822     2  0.5419      0.595 0.000 0.688 0.004 0.124 0.116 NA
#> GSM2832     2  0.5419      0.595 0.000 0.688 0.004 0.124 0.116 NA
#> GSM2823     2  0.5187      0.306 0.000 0.524 0.012 0.012 0.416 NA
#> GSM2824     2  0.5187      0.306 0.000 0.524 0.012 0.012 0.416 NA
#> GSM2825     2  0.6517      0.466 0.004 0.584 0.004 0.152 0.148 NA
#> GSM2826     2  0.6517      0.466 0.004 0.584 0.004 0.152 0.148 NA
#> GSM2829     4  0.1148      0.864 0.000 0.016 0.004 0.960 0.020 NA
#> GSM2856     4  0.1148      0.864 0.000 0.016 0.004 0.960 0.020 NA
#> GSM2830     4  0.3876      0.866 0.000 0.012 0.000 0.728 0.016 NA
#> GSM2843     4  0.3876      0.866 0.000 0.012 0.000 0.728 0.016 NA
#> GSM2871     4  0.4039      0.863 0.004 0.012 0.000 0.720 0.016 NA
#> GSM2831     4  0.3457      0.878 0.000 0.012 0.016 0.820 0.016 NA
#> GSM2844     4  0.3457      0.878 0.000 0.012 0.016 0.820 0.016 NA
#> GSM2833     4  0.1266      0.868 0.004 0.016 0.004 0.960 0.008 NA
#> GSM2846     4  0.1266      0.868 0.004 0.016 0.004 0.960 0.008 NA
#> GSM2835     4  0.1779      0.855 0.000 0.020 0.004 0.936 0.020 NA
#> GSM2858     4  0.1779      0.855 0.000 0.020 0.004 0.936 0.020 NA
#> GSM2836     2  0.2145      0.736 0.000 0.912 0.004 0.008 0.056 NA
#> GSM2848     2  0.2145      0.736 0.000 0.912 0.004 0.008 0.056 NA
#> GSM2828     3  0.2135      0.857 0.000 0.024 0.916 0.004 0.012 NA
#> GSM2837     3  0.2135      0.857 0.000 0.024 0.916 0.004 0.012 NA
#> GSM2839     1  0.5007      0.635 0.680 0.008 0.004 0.000 0.136 NA
#> GSM2841     1  0.5007      0.635 0.680 0.008 0.004 0.000 0.136 NA
#> GSM2827     2  0.3218      0.732 0.000 0.836 0.004 0.004 0.112 NA
#> GSM2842     2  0.3218      0.732 0.000 0.836 0.004 0.004 0.112 NA
#> GSM2845     4  0.3746      0.861 0.004 0.012 0.000 0.712 0.000 NA
#> GSM2872     4  0.3746      0.861 0.004 0.012 0.000 0.712 0.000 NA
#> GSM2834     4  0.3507      0.868 0.000 0.012 0.000 0.752 0.004 NA
#> GSM2847     4  0.3507      0.868 0.000 0.012 0.000 0.752 0.004 NA
#> GSM2849     3  0.2666      0.854 0.000 0.024 0.892 0.008 0.032 NA
#> GSM2850     3  0.2666      0.854 0.000 0.024 0.892 0.008 0.032 NA
#> GSM2838     2  0.3751      0.719 0.000 0.792 0.004 0.000 0.108 NA
#> GSM2853     2  0.3751      0.719 0.000 0.792 0.004 0.000 0.108 NA
#> GSM2852     3  0.5741      0.713 0.000 0.052 0.612 0.000 0.232 NA
#> GSM2855     3  0.5741      0.713 0.000 0.052 0.612 0.000 0.232 NA
#> GSM2840     1  0.5007      0.635 0.680 0.008 0.004 0.000 0.136 NA
#> GSM2857     1  0.5007      0.635 0.680 0.008 0.004 0.000 0.136 NA
#> GSM2859     2  0.2485      0.732 0.000 0.884 0.004 0.004 0.020 NA
#> GSM2860     2  0.2485      0.732 0.000 0.884 0.004 0.004 0.020 NA
#> GSM2861     2  0.3172      0.731 0.000 0.840 0.004 0.004 0.044 NA
#> GSM2862     2  0.2485      0.732 0.000 0.884 0.004 0.004 0.020 NA
#> GSM2863     2  0.2485      0.732 0.000 0.884 0.004 0.004 0.020 NA
#> GSM2864     2  0.2485      0.732 0.000 0.884 0.004 0.004 0.020 NA
#> GSM2865     2  0.2485      0.732 0.000 0.884 0.004 0.004 0.020 NA
#> GSM2866     2  0.2425      0.730 0.000 0.884 0.000 0.004 0.024 NA
#> GSM2868     2  0.4218      0.700 0.000 0.748 0.004 0.000 0.112 NA
#> GSM2869     2  0.4218      0.700 0.000 0.748 0.004 0.000 0.112 NA
#> GSM2851     2  0.4141      0.704 0.000 0.756 0.004 0.000 0.112 NA
#> GSM2867     2  0.4218      0.700 0.000 0.748 0.004 0.000 0.112 NA
#> GSM2870     2  0.4218      0.700 0.000 0.748 0.004 0.000 0.112 NA
#> GSM2854     4  0.2399      0.851 0.000 0.024 0.004 0.904 0.024 NA
#> GSM2873     2  0.4756      0.635 0.000 0.732 0.000 0.144 0.060 NA
#> GSM2874     3  0.1232      0.859 0.000 0.024 0.956 0.004 0.000 NA
#> GSM2884     3  0.1138      0.859 0.000 0.024 0.960 0.004 0.000 NA
#> GSM2875     1  0.0405      0.832 0.988 0.008 0.004 0.000 0.000 NA
#> GSM2890     1  0.0405      0.832 0.988 0.008 0.004 0.000 0.000 NA
#> GSM2877     1  0.0405      0.832 0.988 0.008 0.004 0.000 0.000 NA
#> GSM2892     1  0.0405      0.832 0.988 0.008 0.004 0.000 0.000 NA
#> GSM2902     1  0.0405      0.832 0.988 0.008 0.004 0.000 0.000 NA
#> GSM2878     1  0.1406      0.825 0.952 0.008 0.004 0.000 0.016 NA
#> GSM2901     1  0.1406      0.825 0.952 0.008 0.004 0.000 0.016 NA
#> GSM2879     3  0.7140      0.341 0.000 0.268 0.396 0.000 0.248 NA
#> GSM2898     3  0.7140      0.341 0.000 0.268 0.396 0.000 0.248 NA
#> GSM2881     3  0.1743      0.860 0.000 0.024 0.936 0.004 0.008 NA
#> GSM2897     3  0.1743      0.860 0.000 0.024 0.936 0.004 0.008 NA
#> GSM2882     4  0.3110      0.878 0.000 0.012 0.016 0.852 0.016 NA
#> GSM2894     4  0.3110      0.878 0.000 0.012 0.016 0.852 0.016 NA
#> GSM2883     3  0.3573      0.829 0.000 0.024 0.824 0.004 0.040 NA
#> GSM2895     3  0.3573      0.829 0.000 0.024 0.824 0.004 0.040 NA
#> GSM2885     3  0.1743      0.860 0.000 0.024 0.936 0.004 0.008 NA
#> GSM2886     3  0.1743      0.860 0.000 0.024 0.936 0.004 0.008 NA
#> GSM2887     3  0.3972      0.820 0.000 0.024 0.800 0.004 0.092 NA
#> GSM2896     3  0.3972      0.820 0.000 0.024 0.800 0.004 0.092 NA
#> GSM2888     2  0.4326      0.695 0.000 0.732 0.004 0.000 0.168 NA
#> GSM2889     2  0.4326      0.695 0.000 0.732 0.004 0.000 0.168 NA
#> GSM2876     1  0.3853      0.692 0.788 0.008 0.008 0.004 0.160 NA
#> GSM2891     1  0.3853      0.692 0.788 0.008 0.008 0.004 0.160 NA
#> GSM2880     1  0.0405      0.832 0.988 0.008 0.004 0.000 0.000 NA
#> GSM2893     1  0.0405      0.832 0.988 0.008 0.004 0.000 0.000 NA
#> GSM2821     5  0.5829      1.000 0.332 0.160 0.000 0.008 0.500 NA
#> GSM2900     5  0.5829      1.000 0.332 0.160 0.000 0.008 0.500 NA
#> GSM2903     5  0.5829      1.000 0.332 0.160 0.000 0.008 0.500 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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 tissue(p) k
#> CV:kmeans 61  1.95e-04 2
#> CV:kmeans 84  6.67e-09 3
#> CV:kmeans 84  5.71e-12 4
#> CV:kmeans 82  8.86e-12 5
#> CV:kmeans 77  6.70e-15 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 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-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.980       0.991         0.5064 0.494   0.494
#> 3 3 0.589           0.604       0.776         0.2736 0.572   0.319
#> 4 4 0.964           0.967       0.985         0.1718 0.865   0.621
#> 5 5 0.910           0.810       0.899         0.0470 0.983   0.930
#> 6 6 0.858           0.761       0.780         0.0377 0.930   0.704

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

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

There is also optional best \(k\) = 2 4 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
#> GSM2819     1  0.0000      0.985 1.000 0.000
#> GSM2820     2  0.0000      0.996 0.000 1.000
#> GSM2822     1  0.0000      0.985 1.000 0.000
#> GSM2832     1  0.0000      0.985 1.000 0.000
#> GSM2823     2  0.0000      0.996 0.000 1.000
#> GSM2824     2  0.0000      0.996 0.000 1.000
#> GSM2825     1  0.0000      0.985 1.000 0.000
#> GSM2826     1  0.0000      0.985 1.000 0.000
#> GSM2829     1  0.0000      0.985 1.000 0.000
#> GSM2856     1  0.0000      0.985 1.000 0.000
#> GSM2830     1  0.0000      0.985 1.000 0.000
#> GSM2843     1  0.0000      0.985 1.000 0.000
#> GSM2871     1  0.0000      0.985 1.000 0.000
#> GSM2831     1  0.0000      0.985 1.000 0.000
#> GSM2844     1  0.0000      0.985 1.000 0.000
#> GSM2833     1  0.0000      0.985 1.000 0.000
#> GSM2846     1  0.0000      0.985 1.000 0.000
#> GSM2835     1  0.0000      0.985 1.000 0.000
#> GSM2858     1  0.0000      0.985 1.000 0.000
#> GSM2836     2  0.0672      0.996 0.008 0.992
#> GSM2848     2  0.0672      0.996 0.008 0.992
#> GSM2828     2  0.0000      0.996 0.000 1.000
#> GSM2837     2  0.0000      0.996 0.000 1.000
#> GSM2839     1  0.0672      0.984 0.992 0.008
#> GSM2841     1  0.0672      0.984 0.992 0.008
#> GSM2827     2  0.0672      0.996 0.008 0.992
#> GSM2842     2  0.0672      0.996 0.008 0.992
#> GSM2845     1  0.0000      0.985 1.000 0.000
#> GSM2872     1  0.0000      0.985 1.000 0.000
#> GSM2834     1  0.0000      0.985 1.000 0.000
#> GSM2847     1  0.0000      0.985 1.000 0.000
#> GSM2849     2  0.0000      0.996 0.000 1.000
#> GSM2850     2  0.0000      0.996 0.000 1.000
#> GSM2838     2  0.0672      0.996 0.008 0.992
#> GSM2853     2  0.0672      0.996 0.008 0.992
#> GSM2852     2  0.0000      0.996 0.000 1.000
#> GSM2855     2  0.0000      0.996 0.000 1.000
#> GSM2840     1  0.0672      0.984 0.992 0.008
#> GSM2857     1  0.0672      0.984 0.992 0.008
#> GSM2859     2  0.0672      0.996 0.008 0.992
#> GSM2860     2  0.0672      0.996 0.008 0.992
#> GSM2861     2  0.0672      0.996 0.008 0.992
#> GSM2862     2  0.0672      0.996 0.008 0.992
#> GSM2863     2  0.0672      0.996 0.008 0.992
#> GSM2864     2  0.0672      0.996 0.008 0.992
#> GSM2865     2  0.0672      0.996 0.008 0.992
#> GSM2866     2  0.0672      0.996 0.008 0.992
#> GSM2868     2  0.0672      0.996 0.008 0.992
#> GSM2869     2  0.0672      0.996 0.008 0.992
#> GSM2851     2  0.0672      0.996 0.008 0.992
#> GSM2867     2  0.0672      0.996 0.008 0.992
#> GSM2870     2  0.0672      0.996 0.008 0.992
#> GSM2854     1  0.0000      0.985 1.000 0.000
#> GSM2873     1  0.9970      0.108 0.532 0.468
#> GSM2874     2  0.0000      0.996 0.000 1.000
#> GSM2884     2  0.0000      0.996 0.000 1.000
#> GSM2875     1  0.0672      0.984 0.992 0.008
#> GSM2890     1  0.0672      0.984 0.992 0.008
#> GSM2877     1  0.0672      0.984 0.992 0.008
#> GSM2892     1  0.0672      0.984 0.992 0.008
#> GSM2902     1  0.0672      0.984 0.992 0.008
#> GSM2878     1  0.0672      0.984 0.992 0.008
#> GSM2901     1  0.0672      0.984 0.992 0.008
#> GSM2879     2  0.0000      0.996 0.000 1.000
#> GSM2898     2  0.0000      0.996 0.000 1.000
#> GSM2881     2  0.0000      0.996 0.000 1.000
#> GSM2897     2  0.0000      0.996 0.000 1.000
#> GSM2882     1  0.0000      0.985 1.000 0.000
#> GSM2894     1  0.0000      0.985 1.000 0.000
#> GSM2883     2  0.0000      0.996 0.000 1.000
#> GSM2895     2  0.0000      0.996 0.000 1.000
#> GSM2885     2  0.0000      0.996 0.000 1.000
#> GSM2886     2  0.0000      0.996 0.000 1.000
#> GSM2887     2  0.0000      0.996 0.000 1.000
#> GSM2896     2  0.0000      0.996 0.000 1.000
#> GSM2888     2  0.0672      0.996 0.008 0.992
#> GSM2889     2  0.0672      0.996 0.008 0.992
#> GSM2876     1  0.0672      0.984 0.992 0.008
#> GSM2891     1  0.0672      0.984 0.992 0.008
#> GSM2880     1  0.0672      0.984 0.992 0.008
#> GSM2893     1  0.0672      0.984 0.992 0.008
#> GSM2821     1  0.0672      0.984 0.992 0.008
#> GSM2900     1  0.0672      0.984 0.992 0.008
#> GSM2903     1  0.0672      0.984 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     1  0.6215      0.267 0.572 0.428 0.000
#> GSM2820     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2822     2  0.6252      0.556 0.008 0.648 0.344
#> GSM2832     2  0.6252      0.556 0.008 0.648 0.344
#> GSM2823     1  0.5954      0.748 0.792 0.116 0.092
#> GSM2824     1  0.5954      0.748 0.792 0.116 0.092
#> GSM2825     1  0.1643      0.921 0.956 0.044 0.000
#> GSM2826     1  0.1643      0.921 0.956 0.044 0.000
#> GSM2829     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2856     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2830     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2843     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2871     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2831     3  0.9993     -0.266 0.324 0.324 0.352
#> GSM2844     3  0.9993     -0.266 0.324 0.324 0.352
#> GSM2833     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2846     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2835     3  0.9989     -0.253 0.336 0.312 0.352
#> GSM2858     3  0.9989     -0.253 0.336 0.312 0.352
#> GSM2836     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2848     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2828     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2837     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2839     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2827     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2842     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2845     3  0.9992     -0.272 0.320 0.328 0.352
#> GSM2872     3  0.9992     -0.272 0.320 0.328 0.352
#> GSM2834     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2847     2  0.9241      0.471 0.164 0.484 0.352
#> GSM2849     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2850     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2838     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2853     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2852     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2855     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2840     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2859     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2860     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2861     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2862     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2863     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2864     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2865     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2866     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2868     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2869     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2851     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2867     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2870     2  0.0000      0.686 0.000 1.000 0.000
#> GSM2854     2  0.7462      0.535 0.048 0.600 0.352
#> GSM2873     2  0.5905      0.555 0.000 0.648 0.352
#> GSM2874     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2884     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2875     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2879     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2898     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2881     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2897     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2882     3  0.9986     -0.250 0.340 0.308 0.352
#> GSM2894     3  0.9986     -0.250 0.340 0.308 0.352
#> GSM2883     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2895     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2885     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2886     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2887     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2896     3  0.5905      0.628 0.000 0.352 0.648
#> GSM2888     2  0.4235      0.362 0.000 0.824 0.176
#> GSM2889     2  0.4235      0.362 0.000 0.824 0.176
#> GSM2876     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2891     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2880     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.949 1.000 0.000 0.000
#> GSM2821     1  0.0892      0.937 0.980 0.020 0.000
#> GSM2900     1  0.0892      0.937 0.980 0.020 0.000
#> GSM2903     1  0.0892      0.937 0.980 0.020 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2 p3    p4
#> GSM2819     1  0.4790      0.415 0.620 0.380  0 0.000
#> GSM2820     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2822     2  0.2973      0.841 0.000 0.856  0 0.144
#> GSM2832     2  0.2973      0.841 0.000 0.856  0 0.144
#> GSM2823     1  0.0592      0.950 0.984 0.016  0 0.000
#> GSM2824     1  0.0592      0.950 0.984 0.016  0 0.000
#> GSM2825     1  0.4638      0.742 0.776 0.044  0 0.180
#> GSM2826     1  0.4638      0.742 0.776 0.044  0 0.180
#> GSM2829     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2856     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2830     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2843     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2871     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2831     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2844     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2833     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2846     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2835     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2858     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2836     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2848     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2828     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2839     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2841     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2827     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2842     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2845     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2872     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2834     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2847     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2849     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2838     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2853     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2852     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2855     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2840     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2857     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2859     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2860     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2861     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2862     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2863     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2864     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2865     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2866     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2868     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2869     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2851     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2867     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2870     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2854     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2873     2  0.2973      0.841 0.000 0.856  0 0.144
#> GSM2874     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2875     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2890     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2877     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2892     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2902     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2878     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2901     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2879     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2898     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2881     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2882     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2894     4  0.0000      1.000 0.000 0.000  0 1.000
#> GSM2883     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2888     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2889     2  0.0000      0.980 0.000 1.000  0 0.000
#> GSM2876     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2891     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2880     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2893     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2821     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2900     1  0.0000      0.961 1.000 0.000  0 0.000
#> GSM2903     1  0.0000      0.961 1.000 0.000  0 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
#> GSM2819     5  0.6319      0.646 0.216 0.256 0.000 0.000 0.528
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.5151      0.641 0.000 0.560 0.000 0.044 0.396
#> GSM2832     2  0.5151      0.641 0.000 0.560 0.000 0.044 0.396
#> GSM2823     5  0.5795      0.772 0.412 0.092 0.000 0.000 0.496
#> GSM2824     5  0.5795      0.772 0.412 0.092 0.000 0.000 0.496
#> GSM2825     1  0.5494      0.276 0.556 0.012 0.000 0.044 0.388
#> GSM2826     1  0.5494      0.276 0.556 0.012 0.000 0.044 0.388
#> GSM2829     4  0.1608      0.952 0.000 0.000 0.000 0.928 0.072
#> GSM2856     4  0.1608      0.952 0.000 0.000 0.000 0.928 0.072
#> GSM2830     4  0.0162      0.967 0.000 0.000 0.000 0.996 0.004
#> GSM2843     4  0.0162      0.967 0.000 0.000 0.000 0.996 0.004
#> GSM2871     4  0.0162      0.967 0.000 0.000 0.000 0.996 0.004
#> GSM2831     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.1544      0.954 0.000 0.000 0.000 0.932 0.068
#> GSM2846     4  0.1544      0.954 0.000 0.000 0.000 0.932 0.068
#> GSM2835     4  0.1732      0.948 0.000 0.000 0.000 0.920 0.080
#> GSM2858     4  0.1732      0.948 0.000 0.000 0.000 0.920 0.080
#> GSM2836     2  0.3684      0.825 0.000 0.720 0.000 0.000 0.280
#> GSM2848     2  0.3684      0.825 0.000 0.720 0.000 0.000 0.280
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.1851      0.723 0.912 0.000 0.000 0.000 0.088
#> GSM2841     1  0.1851      0.723 0.912 0.000 0.000 0.000 0.088
#> GSM2827     2  0.1341      0.824 0.000 0.944 0.000 0.000 0.056
#> GSM2842     2  0.1197      0.821 0.000 0.952 0.000 0.000 0.048
#> GSM2845     4  0.0162      0.967 0.000 0.000 0.000 0.996 0.004
#> GSM2872     4  0.0162      0.967 0.000 0.000 0.000 0.996 0.004
#> GSM2834     4  0.0510      0.968 0.000 0.000 0.000 0.984 0.016
#> GSM2847     4  0.0510      0.968 0.000 0.000 0.000 0.984 0.016
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0000      0.827 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2  0.0000      0.827 0.000 1.000 0.000 0.000 0.000
#> GSM2852     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2855     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2840     1  0.1851      0.723 0.912 0.000 0.000 0.000 0.088
#> GSM2857     1  0.1851      0.723 0.912 0.000 0.000 0.000 0.088
#> GSM2859     2  0.3452      0.834 0.000 0.756 0.000 0.000 0.244
#> GSM2860     2  0.3452      0.834 0.000 0.756 0.000 0.000 0.244
#> GSM2861     2  0.3177      0.837 0.000 0.792 0.000 0.000 0.208
#> GSM2862     2  0.3452      0.834 0.000 0.756 0.000 0.000 0.244
#> GSM2863     2  0.3452      0.834 0.000 0.756 0.000 0.000 0.244
#> GSM2864     2  0.3452      0.834 0.000 0.756 0.000 0.000 0.244
#> GSM2865     2  0.3452      0.834 0.000 0.756 0.000 0.000 0.244
#> GSM2866     2  0.3452      0.834 0.000 0.756 0.000 0.000 0.244
#> GSM2868     2  0.0290      0.824 0.000 0.992 0.000 0.000 0.008
#> GSM2869     2  0.0290      0.824 0.000 0.992 0.000 0.000 0.008
#> GSM2851     2  0.0162      0.826 0.000 0.996 0.000 0.000 0.004
#> GSM2867     2  0.0290      0.824 0.000 0.992 0.000 0.000 0.008
#> GSM2870     2  0.0162      0.826 0.000 0.996 0.000 0.000 0.004
#> GSM2854     4  0.2074      0.934 0.000 0.000 0.000 0.896 0.104
#> GSM2873     2  0.5176      0.693 0.000 0.572 0.000 0.048 0.380
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2879     3  0.0162      0.997 0.000 0.000 0.996 0.000 0.004
#> GSM2898     3  0.0162      0.997 0.000 0.000 0.996 0.000 0.004
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM2894     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM2883     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2888     2  0.0963      0.823 0.000 0.964 0.000 0.000 0.036
#> GSM2889     2  0.0963      0.823 0.000 0.964 0.000 0.000 0.036
#> GSM2876     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM2821     1  0.4306     -0.574 0.508 0.000 0.000 0.000 0.492
#> GSM2900     1  0.4306     -0.574 0.508 0.000 0.000 0.000 0.492
#> GSM2903     1  0.4306     -0.574 0.508 0.000 0.000 0.000 0.492

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.7329    -0.0845 0.128 0.192 0.000 0.000 0.352 0.328
#> GSM2820     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     6  0.6178     0.5092 0.000 0.280 0.000 0.016 0.220 0.484
#> GSM2832     6  0.6178     0.5092 0.000 0.280 0.000 0.016 0.220 0.484
#> GSM2823     5  0.7260    -0.1046 0.192 0.120 0.000 0.000 0.384 0.304
#> GSM2824     5  0.7260    -0.1046 0.192 0.120 0.000 0.000 0.384 0.304
#> GSM2825     6  0.4648     0.4147 0.276 0.004 0.000 0.016 0.036 0.668
#> GSM2826     6  0.4648     0.4147 0.276 0.004 0.000 0.016 0.036 0.668
#> GSM2829     4  0.2730     0.8709 0.000 0.000 0.000 0.836 0.012 0.152
#> GSM2856     4  0.2730     0.8709 0.000 0.000 0.000 0.836 0.012 0.152
#> GSM2830     4  0.0520     0.9115 0.000 0.000 0.000 0.984 0.008 0.008
#> GSM2843     4  0.0520     0.9115 0.000 0.000 0.000 0.984 0.008 0.008
#> GSM2871     4  0.0520     0.9115 0.000 0.000 0.000 0.984 0.008 0.008
#> GSM2831     4  0.0000     0.9141 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000     0.9141 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.2768     0.8684 0.000 0.000 0.000 0.832 0.012 0.156
#> GSM2846     4  0.2768     0.8684 0.000 0.000 0.000 0.832 0.012 0.156
#> GSM2835     4  0.2948     0.8479 0.000 0.000 0.000 0.804 0.008 0.188
#> GSM2858     4  0.2948     0.8479 0.000 0.000 0.000 0.804 0.008 0.188
#> GSM2836     5  0.4948     0.4658 0.000 0.360 0.000 0.000 0.564 0.076
#> GSM2848     5  0.4948     0.4658 0.000 0.360 0.000 0.000 0.564 0.076
#> GSM2828     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     1  0.3023     0.6732 0.784 0.000 0.000 0.000 0.004 0.212
#> GSM2841     1  0.3023     0.6732 0.784 0.000 0.000 0.000 0.004 0.212
#> GSM2827     2  0.3611     0.7727 0.000 0.796 0.000 0.000 0.108 0.096
#> GSM2842     2  0.3167     0.8017 0.000 0.832 0.000 0.000 0.072 0.096
#> GSM2845     4  0.0520     0.9115 0.000 0.000 0.000 0.984 0.008 0.008
#> GSM2872     4  0.0520     0.9115 0.000 0.000 0.000 0.984 0.008 0.008
#> GSM2834     4  0.1225     0.9111 0.000 0.000 0.000 0.952 0.012 0.036
#> GSM2847     4  0.1225     0.9111 0.000 0.000 0.000 0.952 0.012 0.036
#> GSM2849     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0790     0.8999 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM2853     2  0.0790     0.8999 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM2852     3  0.0692     0.9777 0.000 0.000 0.976 0.000 0.004 0.020
#> GSM2855     3  0.0692     0.9777 0.000 0.000 0.976 0.000 0.004 0.020
#> GSM2840     1  0.3023     0.6732 0.784 0.000 0.000 0.000 0.004 0.212
#> GSM2857     1  0.3023     0.6732 0.784 0.000 0.000 0.000 0.004 0.212
#> GSM2859     5  0.3804     0.5664 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM2860     5  0.3804     0.5664 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM2861     5  0.3838     0.5253 0.000 0.448 0.000 0.000 0.552 0.000
#> GSM2862     5  0.3804     0.5664 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM2863     5  0.3804     0.5664 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM2864     5  0.3804     0.5664 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM2865     5  0.3804     0.5664 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM2866     5  0.3804     0.5664 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM2868     2  0.0000     0.9194 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2869     2  0.0000     0.9194 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2851     2  0.0000     0.9194 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2867     2  0.0000     0.9194 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2870     2  0.0000     0.9194 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2854     4  0.3487     0.8041 0.000 0.000 0.000 0.756 0.020 0.224
#> GSM2873     6  0.6433     0.3057 0.000 0.196 0.000 0.028 0.364 0.412
#> GSM2874     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     3  0.1434     0.9476 0.000 0.000 0.940 0.000 0.048 0.012
#> GSM2898     3  0.1434     0.9476 0.000 0.000 0.940 0.000 0.048 0.012
#> GSM2881     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0000     0.9141 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2894     4  0.0000     0.9141 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2883     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9912 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0146     0.9895 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM2896     3  0.0146     0.9895 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM2888     2  0.2325     0.8800 0.000 0.892 0.000 0.000 0.048 0.060
#> GSM2889     2  0.2325     0.8800 0.000 0.892 0.000 0.000 0.048 0.060
#> GSM2876     1  0.0146     0.8068 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM2891     1  0.0146     0.8068 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM2880     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000     0.8086 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     1  0.6123     0.2086 0.352 0.000 0.000 0.000 0.340 0.308
#> GSM2900     1  0.6123     0.2086 0.352 0.000 0.000 0.000 0.340 0.308
#> GSM2903     1  0.6123     0.2086 0.352 0.000 0.000 0.000 0.340 0.308

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 tissue(p) k
#> CV:skmeans 83  3.39e-05 2
#> CV:skmeans 64  1.46e-07 3
#> CV:skmeans 83  4.22e-12 4
#> CV:skmeans 79  1.87e-14 5
#> CV:skmeans 73  3.70e-17 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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.485           0.834       0.851         0.3419 0.646   0.646
#> 3 3 1.000           0.996       0.999         0.7189 0.766   0.637
#> 4 4 0.904           0.884       0.948         0.2603 0.849   0.633
#> 5 5 0.828           0.806       0.890         0.0326 0.974   0.899
#> 6 6 0.878           0.869       0.917         0.0243 0.987   0.947

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>         class entropy silhouette    p1    p2
#> GSM2819     1  0.9248      0.859 0.660 0.340
#> GSM2820     2  0.0000      0.978 0.000 1.000
#> GSM2822     1  0.9248      0.859 0.660 0.340
#> GSM2832     1  0.9248      0.859 0.660 0.340
#> GSM2823     1  0.9248      0.859 0.660 0.340
#> GSM2824     1  0.9248      0.859 0.660 0.340
#> GSM2825     1  0.9248      0.859 0.660 0.340
#> GSM2826     1  0.9248      0.859 0.660 0.340
#> GSM2829     1  0.9248      0.859 0.660 0.340
#> GSM2856     1  0.9248      0.859 0.660 0.340
#> GSM2830     1  0.9248      0.859 0.660 0.340
#> GSM2843     1  0.9248      0.859 0.660 0.340
#> GSM2871     1  0.9248      0.859 0.660 0.340
#> GSM2831     1  0.9248      0.859 0.660 0.340
#> GSM2844     1  0.9248      0.859 0.660 0.340
#> GSM2833     1  0.9248      0.859 0.660 0.340
#> GSM2846     1  0.9248      0.859 0.660 0.340
#> GSM2835     1  0.9248      0.859 0.660 0.340
#> GSM2858     1  0.9248      0.859 0.660 0.340
#> GSM2836     1  0.9248      0.859 0.660 0.340
#> GSM2848     1  0.9248      0.859 0.660 0.340
#> GSM2828     2  0.0000      0.978 0.000 1.000
#> GSM2837     2  0.0000      0.978 0.000 1.000
#> GSM2839     1  0.0000      0.625 1.000 0.000
#> GSM2841     1  0.0000      0.625 1.000 0.000
#> GSM2827     1  0.9248      0.859 0.660 0.340
#> GSM2842     1  0.9248      0.859 0.660 0.340
#> GSM2845     1  0.9248      0.859 0.660 0.340
#> GSM2872     1  0.9248      0.859 0.660 0.340
#> GSM2834     1  0.9248      0.859 0.660 0.340
#> GSM2847     1  0.9248      0.859 0.660 0.340
#> GSM2849     2  0.0000      0.978 0.000 1.000
#> GSM2850     2  0.0000      0.978 0.000 1.000
#> GSM2838     1  0.9248      0.859 0.660 0.340
#> GSM2853     1  0.9248      0.859 0.660 0.340
#> GSM2852     2  0.0000      0.978 0.000 1.000
#> GSM2855     2  0.0000      0.978 0.000 1.000
#> GSM2840     1  0.0000      0.625 1.000 0.000
#> GSM2857     1  0.0000      0.625 1.000 0.000
#> GSM2859     1  0.9248      0.859 0.660 0.340
#> GSM2860     1  0.9248      0.859 0.660 0.340
#> GSM2861     1  0.9248      0.859 0.660 0.340
#> GSM2862     1  0.9248      0.859 0.660 0.340
#> GSM2863     1  0.9248      0.859 0.660 0.340
#> GSM2864     1  0.9248      0.859 0.660 0.340
#> GSM2865     1  0.9248      0.859 0.660 0.340
#> GSM2866     1  0.9248      0.859 0.660 0.340
#> GSM2868     1  0.9248      0.859 0.660 0.340
#> GSM2869     1  0.9248      0.859 0.660 0.340
#> GSM2851     1  0.9248      0.859 0.660 0.340
#> GSM2867     1  0.9248      0.859 0.660 0.340
#> GSM2870     1  0.9248      0.859 0.660 0.340
#> GSM2854     1  0.9248      0.859 0.660 0.340
#> GSM2873     1  0.9248      0.859 0.660 0.340
#> GSM2874     2  0.0000      0.978 0.000 1.000
#> GSM2884     2  0.0000      0.978 0.000 1.000
#> GSM2875     1  0.0000      0.625 1.000 0.000
#> GSM2890     1  0.0000      0.625 1.000 0.000
#> GSM2877     1  0.0000      0.625 1.000 0.000
#> GSM2892     1  0.0000      0.625 1.000 0.000
#> GSM2902     1  0.0000      0.625 1.000 0.000
#> GSM2878     1  0.0000      0.625 1.000 0.000
#> GSM2901     1  0.0000      0.625 1.000 0.000
#> GSM2879     2  0.5519      0.778 0.128 0.872
#> GSM2898     2  0.5737      0.761 0.136 0.864
#> GSM2881     2  0.0000      0.978 0.000 1.000
#> GSM2897     2  0.0000      0.978 0.000 1.000
#> GSM2882     1  0.9248      0.859 0.660 0.340
#> GSM2894     1  0.9248      0.859 0.660 0.340
#> GSM2883     2  0.0000      0.978 0.000 1.000
#> GSM2895     2  0.0000      0.978 0.000 1.000
#> GSM2885     2  0.0000      0.978 0.000 1.000
#> GSM2886     2  0.0000      0.978 0.000 1.000
#> GSM2887     2  0.0000      0.978 0.000 1.000
#> GSM2896     2  0.0000      0.978 0.000 1.000
#> GSM2888     1  0.9248      0.859 0.660 0.340
#> GSM2889     1  0.9248      0.859 0.660 0.340
#> GSM2876     1  0.0000      0.625 1.000 0.000
#> GSM2891     1  0.0000      0.625 1.000 0.000
#> GSM2880     1  0.0000      0.625 1.000 0.000
#> GSM2893     1  0.0000      0.625 1.000 0.000
#> GSM2821     1  0.9129      0.851 0.672 0.328
#> GSM2900     1  0.0376      0.627 0.996 0.004
#> GSM2903     1  0.0672      0.630 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2820     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2822     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2832     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2823     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2824     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2825     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2826     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2829     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2856     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2830     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2843     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2871     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2831     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2844     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2833     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2846     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2835     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2858     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2836     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2848     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2828     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2837     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2839     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2827     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2842     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2845     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2872     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2834     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2847     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2849     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2850     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2838     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2853     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2852     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2855     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2840     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2859     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2860     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2861     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2862     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2863     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2864     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2865     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2866     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2868     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2869     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2851     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2867     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2870     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2854     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2873     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2874     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2884     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2875     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2879     3  0.1163      0.963 0.000 0.028 0.972
#> GSM2898     3  0.1163      0.963 0.000 0.028 0.972
#> GSM2881     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2897     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2882     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2894     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2883     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2895     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2885     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2886     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2887     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2896     3  0.0000      0.996 0.000 0.000 1.000
#> GSM2888     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2889     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2876     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2891     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2880     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.995 1.000 0.000 0.000
#> GSM2821     2  0.0000      1.000 0.000 1.000 0.000
#> GSM2900     1  0.0747      0.977 0.984 0.016 0.000
#> GSM2903     1  0.1643      0.941 0.956 0.044 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2 p3    p4
#> GSM2819     2  0.3024      0.785 0.000 0.852  0 0.148
#> GSM2820     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2822     2  0.4761      0.522 0.000 0.628  0 0.372
#> GSM2832     2  0.4776      0.515 0.000 0.624  0 0.376
#> GSM2823     2  0.4679      0.556 0.000 0.648  0 0.352
#> GSM2824     2  0.4454      0.619 0.000 0.692  0 0.308
#> GSM2825     2  0.4790      0.507 0.000 0.620  0 0.380
#> GSM2826     2  0.4713      0.543 0.000 0.640  0 0.360
#> GSM2829     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2856     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2830     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2843     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2871     2  0.4994      0.225 0.000 0.520  0 0.480
#> GSM2831     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2844     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2833     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2846     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2835     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2858     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2836     2  0.0707      0.865 0.000 0.980  0 0.020
#> GSM2848     2  0.2647      0.809 0.000 0.880  0 0.120
#> GSM2828     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2839     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2841     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2827     2  0.0817      0.864 0.000 0.976  0 0.024
#> GSM2842     2  0.0817      0.864 0.000 0.976  0 0.024
#> GSM2845     4  0.4605      0.396 0.000 0.336  0 0.664
#> GSM2872     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2834     4  0.3688      0.679 0.000 0.208  0 0.792
#> GSM2847     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2849     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2838     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2853     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2852     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2855     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2840     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2857     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2859     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2860     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2861     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2862     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2863     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2864     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2865     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2866     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2868     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2869     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2851     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2867     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2870     2  0.0000      0.869 0.000 1.000  0 0.000
#> GSM2854     4  0.4477      0.466 0.000 0.312  0 0.688
#> GSM2873     2  0.4804      0.499 0.000 0.616  0 0.384
#> GSM2874     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2875     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2890     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2877     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2892     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2902     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2878     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2901     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2879     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2898     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2881     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2882     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2894     4  0.0000      0.934 0.000 0.000  0 1.000
#> GSM2883     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000  1 0.000
#> GSM2888     2  0.1557      0.850 0.000 0.944  0 0.056
#> GSM2889     2  0.0188      0.869 0.000 0.996  0 0.004
#> GSM2876     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2891     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2880     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2893     1  0.0000      0.996 1.000 0.000  0 0.000
#> GSM2821     2  0.1302      0.856 0.000 0.956  0 0.044
#> GSM2900     1  0.0657      0.982 0.984 0.012  0 0.004
#> GSM2903     1  0.1356      0.956 0.960 0.032  0 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
#> GSM2819     5  0.4256      0.411 0.000 0.436  0 0.000 0.564
#> GSM2820     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2822     2  0.4088      0.531 0.000 0.632  0 0.368 0.000
#> GSM2832     2  0.4101      0.524 0.000 0.628  0 0.372 0.000
#> GSM2823     2  0.3861      0.588 0.000 0.712  0 0.284 0.004
#> GSM2824     2  0.5158      0.439 0.000 0.676  0 0.100 0.224
#> GSM2825     2  0.4114      0.517 0.000 0.624  0 0.376 0.000
#> GSM2826     2  0.4045      0.545 0.000 0.644  0 0.356 0.000
#> GSM2829     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2856     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2830     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2843     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2871     2  0.4448      0.230 0.000 0.516  0 0.480 0.004
#> GSM2831     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2844     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2833     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2846     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2835     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2858     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2836     2  0.2669      0.781 0.000 0.876  0 0.020 0.104
#> GSM2848     2  0.2540      0.767 0.000 0.888  0 0.088 0.024
#> GSM2828     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2839     1  0.3876      0.689 0.684 0.000  0 0.000 0.316
#> GSM2841     1  0.3876      0.689 0.684 0.000  0 0.000 0.316
#> GSM2827     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2842     2  0.0290      0.789 0.000 0.992  0 0.008 0.000
#> GSM2845     4  0.3966      0.383 0.000 0.336  0 0.664 0.000
#> GSM2872     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2834     4  0.3177      0.665 0.000 0.208  0 0.792 0.000
#> GSM2847     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2849     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2838     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2853     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2852     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2855     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2840     1  0.3876      0.689 0.684 0.000  0 0.000 0.316
#> GSM2857     1  0.3876      0.689 0.684 0.000  0 0.000 0.316
#> GSM2859     2  0.2280      0.780 0.000 0.880  0 0.000 0.120
#> GSM2860     2  0.2280      0.780 0.000 0.880  0 0.000 0.120
#> GSM2861     2  0.2280      0.780 0.000 0.880  0 0.000 0.120
#> GSM2862     2  0.2280      0.780 0.000 0.880  0 0.000 0.120
#> GSM2863     2  0.2280      0.780 0.000 0.880  0 0.000 0.120
#> GSM2864     2  0.2280      0.780 0.000 0.880  0 0.000 0.120
#> GSM2865     2  0.2280      0.780 0.000 0.880  0 0.000 0.120
#> GSM2866     2  0.2280      0.780 0.000 0.880  0 0.000 0.120
#> GSM2868     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2869     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2851     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2867     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2870     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2854     4  0.3876      0.448 0.000 0.316  0 0.684 0.000
#> GSM2873     2  0.4126      0.508 0.000 0.620  0 0.380 0.000
#> GSM2874     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2875     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2890     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2877     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2892     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2902     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2878     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2901     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2879     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2898     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2881     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2882     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2894     4  0.0000      0.921 0.000 0.000  0 1.000 0.000
#> GSM2883     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2888     2  0.0404      0.788 0.000 0.988  0 0.012 0.000
#> GSM2889     2  0.0000      0.790 0.000 1.000  0 0.000 0.000
#> GSM2876     1  0.1121      0.855 0.956 0.000  0 0.000 0.044
#> GSM2891     1  0.0404      0.883 0.988 0.000  0 0.000 0.012
#> GSM2880     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2893     1  0.0000      0.890 1.000 0.000  0 0.000 0.000
#> GSM2821     5  0.4242      0.425 0.000 0.428  0 0.000 0.572
#> GSM2900     5  0.4331      0.302 0.400 0.004  0 0.000 0.596
#> GSM2903     5  0.4770      0.336 0.384 0.012  0 0.008 0.596

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2 p3    p4    p5    p6
#> GSM2819     5  0.0260      0.987 0.000 0.008  0 0.000 0.992 0.000
#> GSM2820     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2822     2  0.3911      0.537 0.000 0.624  0 0.368 0.000 0.008
#> GSM2832     2  0.3923      0.530 0.000 0.620  0 0.372 0.000 0.008
#> GSM2823     2  0.3855      0.644 0.000 0.704  0 0.276 0.004 0.016
#> GSM2824     2  0.4361      0.603 0.000 0.700  0 0.060 0.236 0.004
#> GSM2825     2  0.3695      0.523 0.000 0.624  0 0.376 0.000 0.000
#> GSM2826     2  0.3874      0.557 0.000 0.636  0 0.356 0.000 0.008
#> GSM2829     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2856     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2830     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2843     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2871     2  0.4183      0.242 0.000 0.508  0 0.480 0.000 0.012
#> GSM2831     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2844     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2833     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2846     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2835     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2858     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2836     2  0.3284      0.794 0.000 0.784  0 0.020 0.000 0.196
#> GSM2848     2  0.3123      0.799 0.000 0.836  0 0.088 0.000 0.076
#> GSM2828     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2839     6  0.3133      1.000 0.212 0.000  0 0.000 0.008 0.780
#> GSM2841     6  0.3133      1.000 0.212 0.000  0 0.000 0.008 0.780
#> GSM2827     2  0.0363      0.807 0.000 0.988  0 0.000 0.000 0.012
#> GSM2842     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2845     4  0.3563      0.374 0.000 0.336  0 0.664 0.000 0.000
#> GSM2872     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2834     4  0.2854      0.668 0.000 0.208  0 0.792 0.000 0.000
#> GSM2847     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2849     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2838     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2853     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2852     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2855     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2840     6  0.3133      1.000 0.212 0.000  0 0.000 0.008 0.780
#> GSM2857     6  0.3133      1.000 0.212 0.000  0 0.000 0.008 0.780
#> GSM2859     2  0.2912      0.792 0.000 0.784  0 0.000 0.000 0.216
#> GSM2860     2  0.2912      0.792 0.000 0.784  0 0.000 0.000 0.216
#> GSM2861     2  0.2912      0.792 0.000 0.784  0 0.000 0.000 0.216
#> GSM2862     2  0.2912      0.792 0.000 0.784  0 0.000 0.000 0.216
#> GSM2863     2  0.2912      0.792 0.000 0.784  0 0.000 0.000 0.216
#> GSM2864     2  0.2912      0.792 0.000 0.784  0 0.000 0.000 0.216
#> GSM2865     2  0.2912      0.792 0.000 0.784  0 0.000 0.000 0.216
#> GSM2866     2  0.2912      0.792 0.000 0.784  0 0.000 0.000 0.216
#> GSM2868     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2869     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2851     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2867     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2870     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2854     4  0.3601      0.443 0.000 0.312  0 0.684 0.000 0.004
#> GSM2873     2  0.3945      0.514 0.000 0.612  0 0.380 0.000 0.008
#> GSM2874     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2875     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2879     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2898     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2881     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2882     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2894     4  0.0000      0.921 0.000 0.000  0 1.000 0.000 0.000
#> GSM2883     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> GSM2888     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2889     2  0.0146      0.807 0.000 0.996  0 0.000 0.000 0.004
#> GSM2876     1  0.1714      0.875 0.908 0.000  0 0.000 0.092 0.000
#> GSM2891     1  0.0632      0.961 0.976 0.000  0 0.000 0.024 0.000
#> GSM2880     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.984 1.000 0.000  0 0.000 0.000 0.000
#> GSM2821     5  0.0000      0.996 0.000 0.000  0 0.000 1.000 0.000
#> GSM2900     5  0.0000      0.996 0.000 0.000  0 0.000 1.000 0.000
#> GSM2903     5  0.0000      0.996 0.000 0.000  0 0.000 1.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

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

test_to_known_factors(res)
#>         n tissue(p) k
#> CV:pam 84  2.53e-05 2
#> CV:pam 84  2.34e-08 3
#> CV:pam 80  6.57e-11 4
#> CV:pam 76  1.38e-10 5
#> CV:pam 81  1.23e-17 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 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-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.220           0.484       0.677         0.5035 0.620   0.620
#> 3 3 0.958           0.900       0.957         0.2795 0.690   0.519
#> 4 4 0.783           0.859       0.915         0.1531 0.818   0.533
#> 5 5 0.813           0.780       0.889         0.0654 0.882   0.572
#> 6 6 0.840           0.778       0.869         0.0398 0.940   0.715

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
#> GSM2819     1   0.625      0.463 0.844 0.156
#> GSM2820     2   0.000      0.944 0.000 1.000
#> GSM2822     1   0.469      0.492 0.900 0.100
#> GSM2832     1   0.469      0.492 0.900 0.100
#> GSM2823     2   0.866      0.385 0.288 0.712
#> GSM2824     2   0.866      0.385 0.288 0.712
#> GSM2825     1   0.430      0.467 0.912 0.088
#> GSM2826     1   0.430      0.467 0.912 0.088
#> GSM2829     1   0.850      0.431 0.724 0.276
#> GSM2856     1   0.850      0.431 0.724 0.276
#> GSM2830     1   0.850      0.431 0.724 0.276
#> GSM2843     1   0.850      0.431 0.724 0.276
#> GSM2871     1   0.850      0.431 0.724 0.276
#> GSM2831     1   0.850      0.431 0.724 0.276
#> GSM2844     1   0.850      0.431 0.724 0.276
#> GSM2833     1   0.850      0.431 0.724 0.276
#> GSM2846     1   0.850      0.431 0.724 0.276
#> GSM2835     1   0.850      0.431 0.724 0.276
#> GSM2858     1   0.850      0.431 0.724 0.276
#> GSM2836     1   0.861      0.434 0.716 0.284
#> GSM2848     1   0.861      0.434 0.716 0.284
#> GSM2828     2   0.000      0.944 0.000 1.000
#> GSM2837     2   0.000      0.944 0.000 1.000
#> GSM2839     1   0.980      0.148 0.584 0.416
#> GSM2841     1   0.980      0.148 0.584 0.416
#> GSM2827     1   0.952      0.369 0.628 0.372
#> GSM2842     1   0.909      0.412 0.676 0.324
#> GSM2845     1   0.850      0.431 0.724 0.276
#> GSM2872     1   0.850      0.431 0.724 0.276
#> GSM2834     1   0.850      0.431 0.724 0.276
#> GSM2847     1   0.850      0.431 0.724 0.276
#> GSM2849     2   0.000      0.944 0.000 1.000
#> GSM2850     2   0.000      0.944 0.000 1.000
#> GSM2838     1   0.886      0.421 0.696 0.304
#> GSM2853     1   0.886      0.421 0.696 0.304
#> GSM2852     2   0.000      0.944 0.000 1.000
#> GSM2855     2   0.000      0.944 0.000 1.000
#> GSM2840     1   0.980      0.148 0.584 0.416
#> GSM2857     1   0.980      0.148 0.584 0.416
#> GSM2859     1   0.886      0.421 0.696 0.304
#> GSM2860     1   0.886      0.421 0.696 0.304
#> GSM2861     1   0.886      0.421 0.696 0.304
#> GSM2862     1   0.886      0.421 0.696 0.304
#> GSM2863     1   0.886      0.421 0.696 0.304
#> GSM2864     1   0.886      0.421 0.696 0.304
#> GSM2865     1   0.886      0.421 0.696 0.304
#> GSM2866     1   0.886      0.421 0.696 0.304
#> GSM2868     1   0.886      0.421 0.696 0.304
#> GSM2869     1   0.886      0.421 0.696 0.304
#> GSM2851     1   0.886      0.421 0.696 0.304
#> GSM2867     1   0.886      0.421 0.696 0.304
#> GSM2870     1   0.886      0.421 0.696 0.304
#> GSM2854     1   0.850      0.431 0.724 0.276
#> GSM2873     1   0.141      0.490 0.980 0.020
#> GSM2874     2   0.000      0.944 0.000 1.000
#> GSM2884     2   0.000      0.944 0.000 1.000
#> GSM2875     1   0.980      0.148 0.584 0.416
#> GSM2890     1   0.980      0.148 0.584 0.416
#> GSM2877     1   0.980      0.148 0.584 0.416
#> GSM2892     1   0.980      0.148 0.584 0.416
#> GSM2902     1   0.980      0.148 0.584 0.416
#> GSM2878     1   0.980      0.148 0.584 0.416
#> GSM2901     1   0.980      0.148 0.584 0.416
#> GSM2879     2   0.000      0.944 0.000 1.000
#> GSM2898     2   0.000      0.944 0.000 1.000
#> GSM2881     2   0.000      0.944 0.000 1.000
#> GSM2897     2   0.000      0.944 0.000 1.000
#> GSM2882     1   0.850      0.431 0.724 0.276
#> GSM2894     1   0.850      0.431 0.724 0.276
#> GSM2883     2   0.000      0.944 0.000 1.000
#> GSM2895     2   0.000      0.944 0.000 1.000
#> GSM2885     2   0.000      0.944 0.000 1.000
#> GSM2886     2   0.000      0.944 0.000 1.000
#> GSM2887     2   0.000      0.944 0.000 1.000
#> GSM2896     2   0.000      0.944 0.000 1.000
#> GSM2888     1   0.943      0.365 0.640 0.360
#> GSM2889     1   0.946      0.360 0.636 0.364
#> GSM2876     1   0.980      0.148 0.584 0.416
#> GSM2891     1   0.980      0.148 0.584 0.416
#> GSM2880     1   0.980      0.148 0.584 0.416
#> GSM2893     1   0.980      0.148 0.584 0.416
#> GSM2821     1   0.980      0.148 0.584 0.416
#> GSM2900     1   0.980      0.148 0.584 0.416
#> GSM2903     1   0.980      0.148 0.584 0.416

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     1  0.0237     0.9491 0.996 0.004 0.000
#> GSM2820     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2822     2  0.6308     0.0551 0.492 0.508 0.000
#> GSM2832     2  0.5650     0.5527 0.312 0.688 0.000
#> GSM2823     1  0.6386     0.3334 0.584 0.004 0.412
#> GSM2824     1  0.6386     0.3334 0.584 0.004 0.412
#> GSM2825     1  0.2261     0.8855 0.932 0.068 0.000
#> GSM2826     1  0.2356     0.8839 0.928 0.072 0.000
#> GSM2829     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2856     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2830     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2843     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2871     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2831     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2844     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2833     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2846     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2835     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2858     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2836     2  0.0237     0.9559 0.000 0.996 0.004
#> GSM2848     2  0.0237     0.9559 0.000 0.996 0.004
#> GSM2828     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2837     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2839     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2841     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2827     2  0.0237     0.9566 0.004 0.996 0.000
#> GSM2842     2  0.0237     0.9566 0.004 0.996 0.000
#> GSM2845     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2872     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2834     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2847     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2849     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2850     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2838     2  0.1163     0.9478 0.000 0.972 0.028
#> GSM2853     2  0.0424     0.9554 0.000 0.992 0.008
#> GSM2852     3  0.0661     0.9408 0.004 0.008 0.988
#> GSM2855     3  0.0661     0.9408 0.004 0.008 0.988
#> GSM2840     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2857     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2859     2  0.0892     0.9516 0.000 0.980 0.020
#> GSM2860     2  0.1860     0.9327 0.000 0.948 0.052
#> GSM2861     2  0.3349     0.8737 0.004 0.888 0.108
#> GSM2862     2  0.1860     0.9327 0.000 0.948 0.052
#> GSM2863     2  0.0592     0.9544 0.000 0.988 0.012
#> GSM2864     2  0.1411     0.9436 0.000 0.964 0.036
#> GSM2865     2  0.0892     0.9517 0.000 0.980 0.020
#> GSM2866     2  0.0237     0.9566 0.004 0.996 0.000
#> GSM2868     2  0.3528     0.8873 0.016 0.892 0.092
#> GSM2869     2  0.1529     0.9411 0.000 0.960 0.040
#> GSM2851     2  0.1411     0.9435 0.000 0.964 0.036
#> GSM2867     2  0.2749     0.9174 0.012 0.924 0.064
#> GSM2870     2  0.2537     0.9095 0.000 0.920 0.080
#> GSM2854     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2873     2  0.0237     0.9572 0.004 0.996 0.000
#> GSM2874     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2884     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2875     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2890     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2877     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2892     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2902     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2878     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2901     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2879     3  0.0661     0.9408 0.004 0.008 0.988
#> GSM2898     3  0.0661     0.9408 0.004 0.008 0.988
#> GSM2881     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2897     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2882     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2894     2  0.0424     0.9579 0.008 0.992 0.000
#> GSM2883     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2895     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2885     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2886     3  0.0237     0.9443 0.004 0.000 0.996
#> GSM2887     3  0.0475     0.9429 0.004 0.004 0.992
#> GSM2896     3  0.0475     0.9429 0.004 0.004 0.992
#> GSM2888     3  0.6421     0.2599 0.004 0.424 0.572
#> GSM2889     3  0.6421     0.2599 0.004 0.424 0.572
#> GSM2876     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2891     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2880     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2893     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2821     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2900     1  0.0000     0.9529 1.000 0.000 0.000
#> GSM2903     1  0.0000     0.9529 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     1   0.228      0.897 0.904 0.096 0.000 0.000
#> GSM2820     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2822     1   0.447      0.778 0.784 0.036 0.000 0.180
#> GSM2832     1   0.451      0.773 0.780 0.036 0.000 0.184
#> GSM2823     3   0.744      0.343 0.172 0.384 0.444 0.000
#> GSM2824     3   0.744      0.343 0.172 0.384 0.444 0.000
#> GSM2825     1   0.280      0.875 0.884 0.008 0.000 0.108
#> GSM2826     1   0.280      0.875 0.884 0.008 0.000 0.108
#> GSM2829     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2856     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2830     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2843     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2871     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2831     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2844     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2833     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2846     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2835     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2858     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2836     2   0.542      0.778 0.148 0.740 0.000 0.112
#> GSM2848     2   0.542      0.778 0.148 0.740 0.000 0.112
#> GSM2828     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2837     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2839     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2841     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2827     2   0.557      0.770 0.148 0.728 0.000 0.124
#> GSM2842     2   0.547      0.776 0.148 0.736 0.000 0.116
#> GSM2845     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2872     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2834     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2847     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2849     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2850     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2838     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2853     2   0.121      0.894 0.000 0.960 0.000 0.040
#> GSM2852     3   0.734      0.390 0.164 0.360 0.476 0.000
#> GSM2855     3   0.734      0.390 0.164 0.360 0.476 0.000
#> GSM2840     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2857     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2859     2   0.139      0.891 0.000 0.952 0.000 0.048
#> GSM2860     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2861     2   0.139      0.891 0.000 0.952 0.000 0.048
#> GSM2862     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2863     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2864     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2865     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2866     2   0.309      0.865 0.060 0.888 0.000 0.052
#> GSM2868     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2869     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2851     2   0.102      0.893 0.000 0.968 0.000 0.032
#> GSM2867     2   0.102      0.893 0.000 0.968 0.000 0.032
#> GSM2870     2   0.112      0.895 0.000 0.964 0.000 0.036
#> GSM2854     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2873     2   0.724      0.379 0.148 0.476 0.000 0.376
#> GSM2874     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2884     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2875     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2890     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2877     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2892     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2902     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2878     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2901     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2879     3   0.698      0.551 0.164 0.264 0.572 0.000
#> GSM2898     3   0.698      0.551 0.164 0.264 0.572 0.000
#> GSM2881     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2897     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2882     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2894     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2883     3   0.512      0.705 0.164 0.080 0.756 0.000
#> GSM2895     3   0.512      0.705 0.164 0.080 0.756 0.000
#> GSM2885     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2886     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2887     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2896     3   0.000      0.826 0.000 0.000 1.000 0.000
#> GSM2888     2   0.508      0.721 0.148 0.780 0.056 0.016
#> GSM2889     2   0.508      0.721 0.148 0.780 0.056 0.016
#> GSM2876     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2891     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2880     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2893     1   0.000      0.951 1.000 0.000 0.000 0.000
#> GSM2821     1   0.208      0.905 0.916 0.084 0.000 0.000
#> GSM2900     1   0.208      0.905 0.916 0.084 0.000 0.000
#> GSM2903     1   0.208      0.905 0.916 0.084 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.5038     0.6389 0.132 0.164 0.000 0.000 0.704
#> GSM2820     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2822     5  0.7069     0.4641 0.076 0.340 0.000 0.096 0.488
#> GSM2832     5  0.7069     0.4641 0.076 0.340 0.000 0.096 0.488
#> GSM2823     5  0.0404     0.6698 0.012 0.000 0.000 0.000 0.988
#> GSM2824     5  0.0404     0.6698 0.012 0.000 0.000 0.000 0.988
#> GSM2825     5  0.6819     0.6051 0.152 0.164 0.000 0.084 0.600
#> GSM2826     5  0.6819     0.6051 0.152 0.164 0.000 0.084 0.600
#> GSM2829     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2856     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2830     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2843     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2871     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2831     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.0162     0.9901 0.000 0.004 0.000 0.996 0.000
#> GSM2846     4  0.0162     0.9901 0.000 0.004 0.000 0.996 0.000
#> GSM2835     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2858     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2836     2  0.5646    -0.1210 0.000 0.520 0.000 0.080 0.400
#> GSM2848     2  0.5562    -0.1277 0.000 0.520 0.000 0.072 0.408
#> GSM2828     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.3885     0.7481 0.724 0.008 0.000 0.000 0.268
#> GSM2841     1  0.3885     0.7481 0.724 0.008 0.000 0.000 0.268
#> GSM2827     5  0.5867     0.3665 0.000 0.404 0.000 0.100 0.496
#> GSM2842     5  0.5867     0.3665 0.000 0.404 0.000 0.100 0.496
#> GSM2845     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2872     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2834     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2847     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2849     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2  0.0404     0.8536 0.000 0.988 0.000 0.000 0.012
#> GSM2852     5  0.3452     0.5550 0.000 0.000 0.244 0.000 0.756
#> GSM2855     5  0.3452     0.5550 0.000 0.000 0.244 0.000 0.756
#> GSM2840     1  0.3885     0.7481 0.724 0.008 0.000 0.000 0.268
#> GSM2857     1  0.3885     0.7481 0.724 0.008 0.000 0.000 0.268
#> GSM2859     2  0.0162     0.8566 0.000 0.996 0.000 0.004 0.000
#> GSM2860     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.3010     0.6641 0.000 0.824 0.000 0.004 0.172
#> GSM2862     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.5500     0.0265 0.000 0.552 0.000 0.072 0.376
#> GSM2868     2  0.1341     0.8150 0.000 0.944 0.000 0.000 0.056
#> GSM2869     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2851     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2867     2  0.0703     0.8444 0.000 0.976 0.000 0.000 0.024
#> GSM2870     2  0.0000     0.8588 0.000 1.000 0.000 0.000 0.000
#> GSM2854     4  0.2266     0.8943 0.008 0.016 0.000 0.912 0.064
#> GSM2873     5  0.7073     0.2787 0.012 0.348 0.000 0.260 0.380
#> GSM2874     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000     0.8591 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.8591 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.8591 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.8591 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.8591 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000     0.8591 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000     0.8591 1.000 0.000 0.000 0.000 0.000
#> GSM2879     5  0.1270     0.6692 0.000 0.000 0.052 0.000 0.948
#> GSM2898     5  0.1270     0.6692 0.000 0.000 0.052 0.000 0.948
#> GSM2881     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2894     4  0.0000     0.9937 0.000 0.000 0.000 1.000 0.000
#> GSM2883     3  0.3816     0.5436 0.000 0.000 0.696 0.000 0.304
#> GSM2895     3  0.3816     0.5436 0.000 0.000 0.696 0.000 0.304
#> GSM2885     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000     0.9501 0.000 0.000 1.000 0.000 0.000
#> GSM2888     5  0.4491     0.4815 0.000 0.364 0.004 0.008 0.624
#> GSM2889     5  0.4491     0.4815 0.000 0.364 0.004 0.008 0.624
#> GSM2876     1  0.3612     0.7514 0.732 0.000 0.000 0.000 0.268
#> GSM2891     1  0.3612     0.7514 0.732 0.000 0.000 0.000 0.268
#> GSM2880     1  0.1121     0.8474 0.956 0.000 0.000 0.000 0.044
#> GSM2893     1  0.0000     0.8591 1.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.1331     0.6619 0.040 0.008 0.000 0.000 0.952
#> GSM2900     5  0.1331     0.6619 0.040 0.008 0.000 0.000 0.952
#> GSM2903     5  0.1331     0.6619 0.040 0.008 0.000 0.000 0.952

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     6  0.4387      0.533 0.004 0.020 0.000 0.000 0.404 0.572
#> GSM2820     3  0.0146      0.921 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM2822     6  0.4130      0.708 0.000 0.164 0.000 0.016 0.060 0.760
#> GSM2832     6  0.4073      0.709 0.000 0.164 0.000 0.016 0.056 0.764
#> GSM2823     6  0.3727      0.516 0.000 0.000 0.000 0.000 0.388 0.612
#> GSM2824     6  0.3737      0.515 0.000 0.000 0.000 0.000 0.392 0.608
#> GSM2825     6  0.5198      0.513 0.048 0.020 0.000 0.020 0.260 0.652
#> GSM2826     6  0.5177      0.516 0.048 0.020 0.000 0.020 0.256 0.656
#> GSM2829     4  0.0260      0.971 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM2856     4  0.0260      0.971 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM2830     4  0.0260      0.971 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM2843     4  0.0146      0.970 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2871     4  0.0858      0.950 0.000 0.000 0.000 0.968 0.004 0.028
#> GSM2831     4  0.0146      0.971 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2844     4  0.0146      0.971 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2833     4  0.0603      0.964 0.000 0.000 0.000 0.980 0.004 0.016
#> GSM2846     4  0.0508      0.966 0.000 0.000 0.000 0.984 0.004 0.012
#> GSM2835     4  0.0405      0.968 0.000 0.000 0.000 0.988 0.008 0.004
#> GSM2858     4  0.0405      0.968 0.000 0.000 0.000 0.988 0.008 0.004
#> GSM2836     6  0.3559      0.693 0.000 0.240 0.000 0.004 0.012 0.744
#> GSM2848     6  0.3596      0.700 0.000 0.232 0.000 0.004 0.016 0.748
#> GSM2828     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     5  0.3390      0.543 0.296 0.000 0.000 0.000 0.704 0.000
#> GSM2841     5  0.3390      0.543 0.296 0.000 0.000 0.000 0.704 0.000
#> GSM2827     6  0.3231      0.709 0.000 0.200 0.000 0.016 0.000 0.784
#> GSM2842     6  0.3231      0.709 0.000 0.200 0.000 0.016 0.000 0.784
#> GSM2845     4  0.0146      0.970 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2872     4  0.0146      0.970 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2834     4  0.0291      0.969 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2847     4  0.0291      0.971 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2849     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2853     2  0.1204      0.899 0.000 0.944 0.000 0.000 0.000 0.056
#> GSM2852     6  0.2805      0.605 0.000 0.004 0.000 0.000 0.184 0.812
#> GSM2855     6  0.2805      0.605 0.000 0.004 0.000 0.000 0.184 0.812
#> GSM2840     5  0.3175      0.558 0.256 0.000 0.000 0.000 0.744 0.000
#> GSM2857     5  0.3175      0.558 0.256 0.000 0.000 0.000 0.744 0.000
#> GSM2859     2  0.0260      0.937 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2860     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2861     2  0.2300      0.788 0.000 0.856 0.000 0.000 0.000 0.144
#> GSM2862     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2863     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2864     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2865     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2866     6  0.4124      0.573 0.000 0.332 0.000 0.008 0.012 0.648
#> GSM2868     2  0.3448      0.461 0.000 0.716 0.000 0.000 0.004 0.280
#> GSM2869     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2851     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2867     2  0.1610      0.867 0.000 0.916 0.000 0.000 0.000 0.084
#> GSM2870     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2854     4  0.3741      0.533 0.000 0.000 0.000 0.672 0.008 0.320
#> GSM2873     6  0.5198      0.606 0.000 0.200 0.000 0.140 0.012 0.648
#> GSM2874     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.991 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0458      0.982 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM2901     1  0.0458      0.982 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM2879     6  0.2882      0.603 0.000 0.000 0.008 0.000 0.180 0.812
#> GSM2898     6  0.2882      0.603 0.000 0.000 0.008 0.000 0.180 0.812
#> GSM2881     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0405      0.968 0.000 0.000 0.000 0.988 0.008 0.004
#> GSM2894     4  0.0405      0.968 0.000 0.000 0.000 0.988 0.008 0.004
#> GSM2883     3  0.5480      0.486 0.000 0.000 0.564 0.000 0.184 0.252
#> GSM2895     3  0.5461      0.491 0.000 0.000 0.568 0.000 0.184 0.248
#> GSM2885     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.2146      0.856 0.000 0.000 0.880 0.000 0.004 0.116
#> GSM2896     3  0.2006      0.863 0.000 0.000 0.892 0.000 0.004 0.104
#> GSM2888     6  0.4628      0.708 0.000 0.204 0.000 0.000 0.112 0.684
#> GSM2889     6  0.4628      0.708 0.000 0.204 0.000 0.000 0.112 0.684
#> GSM2876     5  0.3446      0.530 0.308 0.000 0.000 0.000 0.692 0.000
#> GSM2891     5  0.3446      0.530 0.308 0.000 0.000 0.000 0.692 0.000
#> GSM2880     1  0.0547      0.976 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM2893     1  0.0146      0.990 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM2821     5  0.3847     -0.367 0.000 0.000 0.000 0.000 0.544 0.456
#> GSM2900     5  0.3789     -0.269 0.000 0.000 0.000 0.000 0.584 0.416
#> GSM2903     5  0.3789     -0.269 0.000 0.000 0.000 0.000 0.584 0.416

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 tissue(p) k
#> CV:mclust 19        NA 2
#> CV:mclust 79  2.19e-08 3
#> CV:mclust 79  1.16e-11 4
#> CV:mclust 74  6.72e-14 5
#> CV:mclust 78  2.87e-16 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) are extracted by 'CV' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.910           0.917       0.960         0.4559 0.550   0.550
#> 3 3 0.778           0.887       0.939         0.3772 0.616   0.419
#> 4 4 0.974           0.925       0.967         0.1987 0.861   0.640
#> 5 5 0.852           0.743       0.822         0.0499 0.943   0.780
#> 6 6 0.869           0.738       0.859         0.0371 0.949   0.771

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

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

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
#> GSM2819     1  0.6887      0.774 0.816 0.184
#> GSM2820     2  0.1184      0.951 0.016 0.984
#> GSM2822     2  0.9963      0.157 0.464 0.536
#> GSM2832     2  0.5842      0.844 0.140 0.860
#> GSM2823     2  0.8327      0.650 0.264 0.736
#> GSM2824     2  0.9970      0.149 0.468 0.532
#> GSM2825     1  0.1184      0.960 0.984 0.016
#> GSM2826     1  0.1184      0.960 0.984 0.016
#> GSM2829     2  0.1633      0.954 0.024 0.976
#> GSM2856     2  0.2043      0.949 0.032 0.968
#> GSM2830     2  0.1633      0.954 0.024 0.976
#> GSM2843     2  0.1414      0.955 0.020 0.980
#> GSM2871     2  0.1414      0.955 0.020 0.980
#> GSM2831     1  0.5519      0.851 0.872 0.128
#> GSM2844     1  0.2948      0.932 0.948 0.052
#> GSM2833     2  0.8144      0.683 0.252 0.748
#> GSM2846     2  0.4939      0.880 0.108 0.892
#> GSM2835     1  0.0938      0.962 0.988 0.012
#> GSM2858     1  0.1184      0.960 0.984 0.016
#> GSM2836     2  0.1184      0.956 0.016 0.984
#> GSM2848     2  0.1184      0.956 0.016 0.984
#> GSM2828     2  0.1184      0.951 0.016 0.984
#> GSM2837     2  0.1184      0.951 0.016 0.984
#> GSM2839     1  0.0000      0.967 1.000 0.000
#> GSM2841     1  0.0000      0.967 1.000 0.000
#> GSM2827     2  0.1184      0.956 0.016 0.984
#> GSM2842     2  0.0938      0.956 0.012 0.988
#> GSM2845     2  0.2603      0.941 0.044 0.956
#> GSM2872     1  0.9754      0.286 0.592 0.408
#> GSM2834     2  0.1633      0.954 0.024 0.976
#> GSM2847     2  0.2603      0.941 0.044 0.956
#> GSM2849     2  0.1184      0.951 0.016 0.984
#> GSM2850     2  0.1184      0.951 0.016 0.984
#> GSM2838     2  0.1184      0.956 0.016 0.984
#> GSM2853     2  0.1184      0.956 0.016 0.984
#> GSM2852     2  0.0376      0.954 0.004 0.996
#> GSM2855     2  0.0376      0.954 0.004 0.996
#> GSM2840     1  0.0000      0.967 1.000 0.000
#> GSM2857     1  0.0000      0.967 1.000 0.000
#> GSM2859     2  0.1414      0.955 0.020 0.980
#> GSM2860     2  0.1184      0.956 0.016 0.984
#> GSM2861     2  0.0672      0.956 0.008 0.992
#> GSM2862     2  0.0672      0.956 0.008 0.992
#> GSM2863     2  0.1184      0.956 0.016 0.984
#> GSM2864     2  0.1184      0.956 0.016 0.984
#> GSM2865     2  0.1184      0.956 0.016 0.984
#> GSM2866     2  0.1414      0.955 0.020 0.980
#> GSM2868     2  0.0938      0.956 0.012 0.988
#> GSM2869     2  0.1184      0.956 0.016 0.984
#> GSM2851     2  0.1184      0.956 0.016 0.984
#> GSM2867     2  0.1184      0.956 0.016 0.984
#> GSM2870     2  0.1184      0.956 0.016 0.984
#> GSM2854     2  0.1843      0.952 0.028 0.972
#> GSM2873     2  0.1414      0.955 0.020 0.980
#> GSM2874     2  0.1184      0.951 0.016 0.984
#> GSM2884     2  0.1184      0.951 0.016 0.984
#> GSM2875     1  0.0000      0.967 1.000 0.000
#> GSM2890     1  0.0000      0.967 1.000 0.000
#> GSM2877     1  0.0000      0.967 1.000 0.000
#> GSM2892     1  0.0000      0.967 1.000 0.000
#> GSM2902     1  0.0000      0.967 1.000 0.000
#> GSM2878     1  0.0000      0.967 1.000 0.000
#> GSM2901     1  0.0000      0.967 1.000 0.000
#> GSM2879     2  0.0672      0.953 0.008 0.992
#> GSM2898     2  0.0376      0.954 0.004 0.996
#> GSM2881     2  0.1184      0.951 0.016 0.984
#> GSM2897     2  0.1184      0.951 0.016 0.984
#> GSM2882     1  0.0938      0.962 0.988 0.012
#> GSM2894     1  0.0938      0.962 0.988 0.012
#> GSM2883     2  0.1184      0.951 0.016 0.984
#> GSM2895     2  0.1184      0.951 0.016 0.984
#> GSM2885     2  0.1184      0.951 0.016 0.984
#> GSM2886     2  0.1184      0.951 0.016 0.984
#> GSM2887     2  0.0938      0.952 0.012 0.988
#> GSM2896     2  0.0938      0.952 0.012 0.988
#> GSM2888     2  0.0000      0.953 0.000 1.000
#> GSM2889     2  0.0000      0.953 0.000 1.000
#> GSM2876     1  0.0000      0.967 1.000 0.000
#> GSM2891     1  0.0000      0.967 1.000 0.000
#> GSM2880     1  0.0000      0.967 1.000 0.000
#> GSM2893     1  0.0000      0.967 1.000 0.000
#> GSM2821     1  0.0672      0.964 0.992 0.008
#> GSM2900     1  0.0000      0.967 1.000 0.000
#> GSM2903     1  0.0000      0.967 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
#> GSM2819     2  0.0237      0.898 0.004 0.996 0.000
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2822     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2832     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2823     1  0.9236      0.379 0.532 0.248 0.220
#> GSM2824     1  0.6158      0.700 0.760 0.188 0.052
#> GSM2825     2  0.6026      0.443 0.376 0.624 0.000
#> GSM2826     2  0.6062      0.424 0.384 0.616 0.000
#> GSM2829     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2856     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2830     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2843     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2871     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2831     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2844     2  0.0237      0.897 0.004 0.996 0.000
#> GSM2833     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2846     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2835     2  0.1964      0.867 0.056 0.944 0.000
#> GSM2858     2  0.0892      0.890 0.020 0.980 0.000
#> GSM2836     2  0.3340      0.864 0.000 0.880 0.120
#> GSM2848     2  0.2625      0.882 0.000 0.916 0.084
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2839     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2827     2  0.2537      0.884 0.000 0.920 0.080
#> GSM2842     2  0.4346      0.816 0.000 0.816 0.184
#> GSM2845     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2872     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2834     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2847     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2838     2  0.1289      0.895 0.000 0.968 0.032
#> GSM2853     2  0.0747      0.897 0.000 0.984 0.016
#> GSM2852     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2855     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2840     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2859     2  0.3192      0.869 0.000 0.888 0.112
#> GSM2860     2  0.2711      0.880 0.000 0.912 0.088
#> GSM2861     2  0.4555      0.800 0.000 0.800 0.200
#> GSM2862     2  0.2537      0.883 0.000 0.920 0.080
#> GSM2863     2  0.2959      0.875 0.000 0.900 0.100
#> GSM2864     2  0.4121      0.829 0.000 0.832 0.168
#> GSM2865     2  0.3038      0.874 0.000 0.896 0.104
#> GSM2866     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2868     2  0.6079      0.524 0.000 0.612 0.388
#> GSM2869     2  0.5216      0.732 0.000 0.740 0.260
#> GSM2851     2  0.3192      0.869 0.000 0.888 0.112
#> GSM2867     2  0.5529      0.683 0.000 0.704 0.296
#> GSM2870     2  0.3551      0.857 0.000 0.868 0.132
#> GSM2854     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2873     2  0.0000      0.898 0.000 1.000 0.000
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2875     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2879     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2898     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2882     2  0.3116      0.823 0.108 0.892 0.000
#> GSM2894     2  0.2625      0.845 0.084 0.916 0.000
#> GSM2883     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2895     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2887     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2896     3  0.0000      1.000 0.000 0.000 1.000
#> GSM2888     2  0.6180      0.463 0.000 0.584 0.416
#> GSM2889     2  0.6215      0.435 0.000 0.572 0.428
#> GSM2876     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2891     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2880     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2821     1  0.0592      0.949 0.988 0.012 0.000
#> GSM2900     1  0.0000      0.961 1.000 0.000 0.000
#> GSM2903     1  0.0000      0.961 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2820     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2822     2  0.3400      0.773 0.000 0.820 0.000 0.180
#> GSM2832     2  0.3528      0.759 0.000 0.808 0.000 0.192
#> GSM2823     1  0.5080      0.304 0.576 0.420 0.004 0.000
#> GSM2824     1  0.4804      0.402 0.616 0.384 0.000 0.000
#> GSM2825     2  0.7790      0.140 0.340 0.408 0.000 0.252
#> GSM2826     2  0.7322      0.433 0.224 0.532 0.000 0.244
#> GSM2829     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2843     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2871     4  0.0336      0.988 0.000 0.008 0.000 0.992
#> GSM2831     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2846     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2836     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2848     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2828     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2827     2  0.0817      0.920 0.000 0.976 0.000 0.024
#> GSM2842     2  0.0592      0.925 0.000 0.984 0.000 0.016
#> GSM2845     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2872     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2834     4  0.0336      0.988 0.000 0.008 0.000 0.992
#> GSM2847     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2849     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2838     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2853     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2852     3  0.0336      0.993 0.000 0.008 0.992 0.000
#> GSM2855     3  0.0188      0.997 0.000 0.004 0.996 0.000
#> GSM2840     1  0.0188      0.949 0.996 0.000 0.000 0.004
#> GSM2857     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2861     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM2862     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2863     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2864     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2866     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM2868     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM2869     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM2851     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM2867     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM2870     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM2854     4  0.1792      0.922 0.000 0.068 0.000 0.932
#> GSM2873     2  0.4406      0.601 0.000 0.700 0.000 0.300
#> GSM2874     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2879     3  0.0188      0.997 0.000 0.004 0.996 0.000
#> GSM2898     3  0.0336      0.993 0.000 0.008 0.992 0.000
#> GSM2881     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> GSM2883     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2895     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2885     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2887     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2896     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM2888     2  0.0336      0.927 0.000 0.992 0.008 0.000
#> GSM2889     2  0.0336      0.927 0.000 0.992 0.008 0.000
#> GSM2876     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM2821     1  0.1389      0.913 0.952 0.048 0.000 0.000
#> GSM2900     1  0.0188      0.949 0.996 0.004 0.000 0.000
#> GSM2903     1  0.0000      0.951 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.5071    -0.3167 0.012 0.440 0.000 0.016 0.532
#> GSM2820     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.6725     0.6402 0.104 0.608 0.000 0.100 0.188
#> GSM2832     2  0.6319     0.6670 0.076 0.648 0.000 0.108 0.168
#> GSM2823     5  0.5673     0.4117 0.156 0.216 0.000 0.000 0.628
#> GSM2824     5  0.5218     0.4356 0.136 0.180 0.000 0.000 0.684
#> GSM2825     1  0.6803     0.0893 0.604 0.176 0.000 0.120 0.100
#> GSM2826     1  0.7166     0.0386 0.536 0.256 0.000 0.112 0.096
#> GSM2829     4  0.0963     0.9568 0.000 0.000 0.000 0.964 0.036
#> GSM2856     4  0.1043     0.9558 0.000 0.000 0.000 0.960 0.040
#> GSM2830     4  0.0451     0.9589 0.000 0.000 0.004 0.988 0.008
#> GSM2843     4  0.0579     0.9587 0.000 0.008 0.000 0.984 0.008
#> GSM2871     4  0.1211     0.9516 0.000 0.024 0.000 0.960 0.016
#> GSM2831     4  0.0451     0.9602 0.004 0.000 0.000 0.988 0.008
#> GSM2844     4  0.0566     0.9601 0.004 0.000 0.000 0.984 0.012
#> GSM2833     4  0.2349     0.9402 0.012 0.004 0.000 0.900 0.084
#> GSM2846     4  0.2331     0.9381 0.020 0.000 0.000 0.900 0.080
#> GSM2835     4  0.2632     0.9261 0.040 0.000 0.000 0.888 0.072
#> GSM2858     4  0.2989     0.9116 0.060 0.000 0.000 0.868 0.072
#> GSM2836     2  0.0693     0.8630 0.000 0.980 0.000 0.012 0.008
#> GSM2848     2  0.0771     0.8699 0.000 0.976 0.000 0.004 0.020
#> GSM2828     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.1638     0.3579 0.932 0.000 0.000 0.004 0.064
#> GSM2841     1  0.1831     0.3591 0.920 0.000 0.000 0.004 0.076
#> GSM2827     2  0.2136     0.8709 0.000 0.904 0.000 0.008 0.088
#> GSM2842     2  0.2127     0.8676 0.000 0.892 0.000 0.000 0.108
#> GSM2845     4  0.0566     0.9594 0.004 0.000 0.000 0.984 0.012
#> GSM2872     4  0.0510     0.9589 0.000 0.000 0.000 0.984 0.016
#> GSM2834     4  0.2284     0.9241 0.004 0.056 0.000 0.912 0.028
#> GSM2847     4  0.1074     0.9574 0.004 0.012 0.000 0.968 0.016
#> GSM2849     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.2605     0.8539 0.000 0.852 0.000 0.000 0.148
#> GSM2853     2  0.2891     0.8441 0.000 0.824 0.000 0.000 0.176
#> GSM2852     3  0.0162     0.9952 0.004 0.000 0.996 0.000 0.000
#> GSM2855     3  0.0162     0.9952 0.004 0.000 0.996 0.000 0.000
#> GSM2840     1  0.1597     0.3379 0.940 0.000 0.000 0.012 0.048
#> GSM2857     1  0.1484     0.3451 0.944 0.000 0.000 0.008 0.048
#> GSM2859     2  0.0000     0.8697 0.000 1.000 0.000 0.000 0.000
#> GSM2860     2  0.0000     0.8697 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.1121     0.8723 0.000 0.956 0.000 0.000 0.044
#> GSM2862     2  0.0000     0.8697 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000     0.8697 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0162     0.8689 0.000 0.996 0.000 0.000 0.004
#> GSM2865     2  0.0000     0.8697 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.0451     0.8658 0.000 0.988 0.000 0.004 0.008
#> GSM2868     2  0.4475     0.7419 0.032 0.692 0.000 0.000 0.276
#> GSM2869     2  0.3988     0.7814 0.016 0.732 0.000 0.000 0.252
#> GSM2851     2  0.3231     0.8327 0.004 0.800 0.000 0.000 0.196
#> GSM2867     2  0.4404     0.7552 0.032 0.704 0.000 0.000 0.264
#> GSM2870     2  0.3551     0.8140 0.008 0.772 0.000 0.000 0.220
#> GSM2854     4  0.1978     0.9447 0.004 0.024 0.000 0.928 0.044
#> GSM2873     2  0.3273     0.7694 0.004 0.848 0.000 0.112 0.036
#> GSM2874     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.4268     0.4196 0.556 0.000 0.000 0.000 0.444
#> GSM2890     1  0.4268     0.4196 0.556 0.000 0.000 0.000 0.444
#> GSM2877     1  0.4262     0.4219 0.560 0.000 0.000 0.000 0.440
#> GSM2892     1  0.4268     0.4196 0.556 0.000 0.000 0.000 0.444
#> GSM2902     1  0.4268     0.4196 0.556 0.000 0.000 0.000 0.444
#> GSM2878     1  0.4278     0.4067 0.548 0.000 0.000 0.000 0.452
#> GSM2901     1  0.4283     0.3972 0.544 0.000 0.000 0.000 0.456
#> GSM2879     3  0.0566     0.9849 0.004 0.012 0.984 0.000 0.000
#> GSM2898     3  0.0566     0.9842 0.004 0.012 0.984 0.000 0.000
#> GSM2881     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0955     0.9570 0.004 0.000 0.000 0.968 0.028
#> GSM2894     4  0.1251     0.9557 0.008 0.000 0.000 0.956 0.036
#> GSM2883     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2885     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000     0.9978 0.000 0.000 1.000 0.000 0.000
#> GSM2888     2  0.3243     0.8487 0.004 0.812 0.000 0.004 0.180
#> GSM2889     2  0.3243     0.8487 0.004 0.812 0.000 0.004 0.180
#> GSM2876     5  0.4273    -0.2485 0.448 0.000 0.000 0.000 0.552
#> GSM2891     5  0.4256    -0.2189 0.436 0.000 0.000 0.000 0.564
#> GSM2880     1  0.4262     0.4219 0.560 0.000 0.000 0.000 0.440
#> GSM2893     1  0.4262     0.4219 0.560 0.000 0.000 0.000 0.440
#> GSM2821     5  0.2969     0.4420 0.128 0.020 0.000 0.000 0.852
#> GSM2900     5  0.3427     0.4114 0.192 0.012 0.000 0.000 0.796
#> GSM2903     5  0.3439     0.4083 0.188 0.008 0.000 0.004 0.800

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.2077     0.5081 0.032 0.032 0.000 0.012 0.920 0.004
#> GSM2820     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     6  0.5543    -0.0406 0.000 0.364 0.000 0.008 0.112 0.516
#> GSM2832     6  0.5558    -0.1249 0.000 0.396 0.000 0.008 0.108 0.488
#> GSM2823     1  0.4985    -0.3263 0.472 0.056 0.000 0.000 0.468 0.004
#> GSM2824     5  0.4775     0.1844 0.456 0.040 0.000 0.000 0.500 0.004
#> GSM2825     6  0.2519     0.5444 0.068 0.044 0.000 0.000 0.004 0.884
#> GSM2826     6  0.2766     0.5363 0.060 0.060 0.000 0.000 0.008 0.872
#> GSM2829     4  0.1745     0.8940 0.000 0.000 0.000 0.920 0.012 0.068
#> GSM2856     4  0.2218     0.8775 0.000 0.000 0.000 0.884 0.012 0.104
#> GSM2830     4  0.0291     0.9121 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2843     4  0.0291     0.9121 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2871     4  0.0881     0.9080 0.000 0.012 0.000 0.972 0.008 0.008
#> GSM2831     4  0.0146     0.9127 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2844     4  0.0146     0.9127 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2833     4  0.3268     0.8502 0.000 0.000 0.000 0.824 0.100 0.076
#> GSM2846     4  0.3277     0.8520 0.000 0.000 0.000 0.824 0.084 0.092
#> GSM2835     4  0.4165     0.6795 0.000 0.000 0.000 0.672 0.036 0.292
#> GSM2858     4  0.4551     0.5925 0.000 0.000 0.000 0.608 0.048 0.344
#> GSM2836     2  0.0508     0.7732 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM2848     2  0.0508     0.7752 0.000 0.984 0.000 0.000 0.012 0.004
#> GSM2828     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     6  0.4893     0.4886 0.340 0.000 0.000 0.000 0.076 0.584
#> GSM2841     6  0.4950     0.4815 0.344 0.000 0.000 0.000 0.080 0.576
#> GSM2827     2  0.3272     0.7439 0.000 0.824 0.000 0.004 0.124 0.048
#> GSM2842     2  0.4074     0.7166 0.000 0.748 0.000 0.000 0.160 0.092
#> GSM2845     4  0.0551     0.9110 0.000 0.004 0.000 0.984 0.004 0.008
#> GSM2872     4  0.0551     0.9118 0.000 0.004 0.000 0.984 0.008 0.004
#> GSM2834     4  0.1793     0.8865 0.000 0.048 0.000 0.928 0.012 0.012
#> GSM2847     4  0.0984     0.9086 0.000 0.012 0.000 0.968 0.008 0.012
#> GSM2849     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.4548     0.6687 0.000 0.672 0.000 0.000 0.248 0.080
#> GSM2853     2  0.4969     0.6288 0.000 0.616 0.000 0.000 0.280 0.104
#> GSM2852     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2855     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2840     6  0.4507     0.5515 0.268 0.000 0.000 0.000 0.068 0.664
#> GSM2857     6  0.4682     0.5403 0.284 0.000 0.000 0.000 0.076 0.640
#> GSM2859     2  0.0622     0.7740 0.000 0.980 0.000 0.000 0.008 0.012
#> GSM2860     2  0.0508     0.7732 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM2861     2  0.1196     0.7743 0.000 0.952 0.000 0.000 0.040 0.008
#> GSM2862     2  0.0508     0.7732 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM2863     2  0.0508     0.7732 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM2864     2  0.0508     0.7732 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM2865     2  0.0508     0.7732 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM2866     2  0.0717     0.7730 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM2868     5  0.4991    -0.4428 0.000 0.456 0.000 0.000 0.476 0.068
#> GSM2869     2  0.5181     0.4067 0.000 0.484 0.000 0.000 0.428 0.088
#> GSM2851     2  0.5197     0.5621 0.000 0.560 0.000 0.000 0.332 0.108
#> GSM2867     2  0.5105     0.3987 0.000 0.488 0.000 0.000 0.432 0.080
#> GSM2870     2  0.5152     0.5144 0.000 0.532 0.000 0.000 0.376 0.092
#> GSM2854     4  0.2958     0.8637 0.000 0.012 0.000 0.852 0.028 0.108
#> GSM2873     2  0.1785     0.7524 0.000 0.928 0.000 0.016 0.008 0.048
#> GSM2874     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.8625 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.8625 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.8625 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.8625 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.8625 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0405     0.8590 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM2901     1  0.0508     0.8570 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM2879     3  0.1219     0.9409 0.000 0.048 0.948 0.000 0.004 0.000
#> GSM2898     3  0.1010     0.9542 0.000 0.036 0.960 0.000 0.004 0.000
#> GSM2881     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0458     0.9122 0.000 0.000 0.000 0.984 0.016 0.000
#> GSM2894     4  0.1074     0.9085 0.000 0.000 0.000 0.960 0.028 0.012
#> GSM2883     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000     0.9941 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.5557     0.5434 0.000 0.552 0.000 0.000 0.200 0.248
#> GSM2889     2  0.5619     0.5484 0.000 0.560 0.004 0.000 0.188 0.248
#> GSM2876     1  0.3360     0.5562 0.732 0.000 0.000 0.000 0.264 0.004
#> GSM2891     1  0.3534     0.5302 0.716 0.000 0.000 0.000 0.276 0.008
#> GSM2880     1  0.0458     0.8525 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM2893     1  0.0547     0.8493 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM2821     5  0.3056     0.5833 0.184 0.000 0.000 0.004 0.804 0.008
#> GSM2900     5  0.3586     0.5439 0.280 0.000 0.000 0.004 0.712 0.004
#> GSM2903     5  0.3606     0.5410 0.284 0.000 0.000 0.004 0.708 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-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 tissue(p) k
#> CV:NMF 81  6.04e-05 2
#> CV:NMF 79  2.19e-08 3
#> CV:NMF 80  1.46e-11 4
#> CV:NMF 61  8.46e-07 5
#> CV:NMF 75  5.30e-17 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-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.280           0.598       0.791         0.3981 0.703   0.703
#> 3 3 0.657           0.816       0.821         0.3915 0.727   0.612
#> 4 4 0.914           0.954       0.973         0.3046 0.849   0.650
#> 5 5 0.889           0.902       0.945         0.0539 0.964   0.873
#> 6 6 0.935           0.884       0.903         0.0427 0.955   0.819

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

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

There is also optional best \(k\) = 4 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
#> GSM2819     2  0.8267      0.695 0.260 0.740
#> GSM2820     2  0.9850      0.540 0.428 0.572
#> GSM2822     2  0.8267      0.695 0.260 0.740
#> GSM2832     2  0.8267      0.695 0.260 0.740
#> GSM2823     2  0.8267      0.695 0.260 0.740
#> GSM2824     2  0.8267      0.695 0.260 0.740
#> GSM2825     2  0.9170      0.641 0.332 0.668
#> GSM2826     2  0.9170      0.641 0.332 0.668
#> GSM2829     2  0.8909      0.148 0.308 0.692
#> GSM2856     2  0.8909      0.148 0.308 0.692
#> GSM2830     2  0.8909      0.148 0.308 0.692
#> GSM2843     2  0.8909      0.148 0.308 0.692
#> GSM2871     2  0.8909      0.148 0.308 0.692
#> GSM2831     2  0.8909      0.148 0.308 0.692
#> GSM2844     2  0.8909      0.148 0.308 0.692
#> GSM2833     2  0.8909      0.148 0.308 0.692
#> GSM2846     2  0.8909      0.148 0.308 0.692
#> GSM2835     2  0.8909      0.148 0.308 0.692
#> GSM2858     2  0.8909      0.148 0.308 0.692
#> GSM2836     2  0.8267      0.695 0.260 0.740
#> GSM2848     2  0.8267      0.695 0.260 0.740
#> GSM2828     2  0.9850      0.540 0.428 0.572
#> GSM2837     2  0.9850      0.540 0.428 0.572
#> GSM2839     1  0.0938      1.000 0.988 0.012
#> GSM2841     1  0.0938      1.000 0.988 0.012
#> GSM2827     2  0.8267      0.695 0.260 0.740
#> GSM2842     2  0.8267      0.695 0.260 0.740
#> GSM2845     2  0.8909      0.148 0.308 0.692
#> GSM2872     2  0.8909      0.148 0.308 0.692
#> GSM2834     2  0.8909      0.148 0.308 0.692
#> GSM2847     2  0.8909      0.148 0.308 0.692
#> GSM2849     2  0.9850      0.540 0.428 0.572
#> GSM2850     2  0.9850      0.540 0.428 0.572
#> GSM2838     2  0.8267      0.695 0.260 0.740
#> GSM2853     2  0.8267      0.695 0.260 0.740
#> GSM2852     2  0.8327      0.692 0.264 0.736
#> GSM2855     2  0.8327      0.692 0.264 0.736
#> GSM2840     1  0.0938      1.000 0.988 0.012
#> GSM2857     1  0.0938      1.000 0.988 0.012
#> GSM2859     2  0.8267      0.695 0.260 0.740
#> GSM2860     2  0.8267      0.695 0.260 0.740
#> GSM2861     2  0.8267      0.695 0.260 0.740
#> GSM2862     2  0.8267      0.695 0.260 0.740
#> GSM2863     2  0.8267      0.695 0.260 0.740
#> GSM2864     2  0.8267      0.695 0.260 0.740
#> GSM2865     2  0.8267      0.695 0.260 0.740
#> GSM2866     2  0.8267      0.695 0.260 0.740
#> GSM2868     2  0.8267      0.695 0.260 0.740
#> GSM2869     2  0.8267      0.695 0.260 0.740
#> GSM2851     2  0.8267      0.695 0.260 0.740
#> GSM2867     2  0.8267      0.695 0.260 0.740
#> GSM2870     2  0.8267      0.695 0.260 0.740
#> GSM2854     2  0.8386      0.203 0.268 0.732
#> GSM2873     2  0.8386      0.203 0.268 0.732
#> GSM2874     2  0.9850      0.540 0.428 0.572
#> GSM2884     2  0.9850      0.540 0.428 0.572
#> GSM2875     1  0.0938      1.000 0.988 0.012
#> GSM2890     1  0.0938      1.000 0.988 0.012
#> GSM2877     1  0.0938      1.000 0.988 0.012
#> GSM2892     1  0.0938      1.000 0.988 0.012
#> GSM2902     1  0.0938      1.000 0.988 0.012
#> GSM2878     1  0.0938      1.000 0.988 0.012
#> GSM2901     1  0.0938      1.000 0.988 0.012
#> GSM2879     2  0.8267      0.695 0.260 0.740
#> GSM2898     2  0.8267      0.695 0.260 0.740
#> GSM2881     2  0.9850      0.540 0.428 0.572
#> GSM2897     2  0.9850      0.540 0.428 0.572
#> GSM2882     2  0.8909      0.148 0.308 0.692
#> GSM2894     2  0.8909      0.148 0.308 0.692
#> GSM2883     2  0.9850      0.540 0.428 0.572
#> GSM2895     2  0.9850      0.540 0.428 0.572
#> GSM2885     2  0.9850      0.540 0.428 0.572
#> GSM2886     2  0.9850      0.540 0.428 0.572
#> GSM2887     2  0.9850      0.540 0.428 0.572
#> GSM2896     2  0.9850      0.540 0.428 0.572
#> GSM2888     2  0.8267      0.695 0.260 0.740
#> GSM2889     2  0.8267      0.695 0.260 0.740
#> GSM2876     1  0.0938      1.000 0.988 0.012
#> GSM2891     1  0.0938      1.000 0.988 0.012
#> GSM2880     1  0.0938      1.000 0.988 0.012
#> GSM2893     1  0.0938      1.000 0.988 0.012
#> GSM2821     2  0.8267      0.695 0.260 0.740
#> GSM2900     2  0.8267      0.695 0.260 0.740
#> GSM2903     2  0.8267      0.695 0.260 0.740

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     3   0.622      0.757 0.432 0.000 0.568
#> GSM2820     3   0.000      0.568 0.000 0.000 1.000
#> GSM2822     3   0.622      0.757 0.432 0.000 0.568
#> GSM2832     3   0.622      0.757 0.432 0.000 0.568
#> GSM2823     3   0.619      0.754 0.420 0.000 0.580
#> GSM2824     3   0.619      0.754 0.420 0.000 0.580
#> GSM2825     3   0.788      0.689 0.392 0.060 0.548
#> GSM2826     3   0.788      0.689 0.392 0.060 0.548
#> GSM2829     2   0.622      0.990 0.432 0.568 0.000
#> GSM2856     2   0.622      0.990 0.432 0.568 0.000
#> GSM2830     2   0.622      0.990 0.432 0.568 0.000
#> GSM2843     2   0.622      0.990 0.432 0.568 0.000
#> GSM2871     2   0.622      0.990 0.432 0.568 0.000
#> GSM2831     2   0.622      0.990 0.432 0.568 0.000
#> GSM2844     2   0.622      0.990 0.432 0.568 0.000
#> GSM2833     2   0.622      0.990 0.432 0.568 0.000
#> GSM2846     2   0.622      0.990 0.432 0.568 0.000
#> GSM2835     2   0.622      0.990 0.432 0.568 0.000
#> GSM2858     2   0.622      0.990 0.432 0.568 0.000
#> GSM2836     3   0.622      0.757 0.432 0.000 0.568
#> GSM2848     3   0.622      0.757 0.432 0.000 0.568
#> GSM2828     3   0.000      0.568 0.000 0.000 1.000
#> GSM2837     3   0.000      0.568 0.000 0.000 1.000
#> GSM2839     1   0.622      1.000 0.568 0.432 0.000
#> GSM2841     1   0.622      1.000 0.568 0.432 0.000
#> GSM2827     3   0.622      0.757 0.432 0.000 0.568
#> GSM2842     3   0.622      0.757 0.432 0.000 0.568
#> GSM2845     2   0.622      0.990 0.432 0.568 0.000
#> GSM2872     2   0.622      0.990 0.432 0.568 0.000
#> GSM2834     2   0.622      0.990 0.432 0.568 0.000
#> GSM2847     2   0.622      0.990 0.432 0.568 0.000
#> GSM2849     3   0.000      0.568 0.000 0.000 1.000
#> GSM2850     3   0.000      0.568 0.000 0.000 1.000
#> GSM2838     3   0.622      0.757 0.432 0.000 0.568
#> GSM2853     3   0.622      0.757 0.432 0.000 0.568
#> GSM2852     3   0.617      0.750 0.412 0.000 0.588
#> GSM2855     3   0.617      0.750 0.412 0.000 0.588
#> GSM2840     1   0.622      1.000 0.568 0.432 0.000
#> GSM2857     1   0.622      1.000 0.568 0.432 0.000
#> GSM2859     3   0.622      0.757 0.432 0.000 0.568
#> GSM2860     3   0.622      0.757 0.432 0.000 0.568
#> GSM2861     3   0.622      0.757 0.432 0.000 0.568
#> GSM2862     3   0.622      0.757 0.432 0.000 0.568
#> GSM2863     3   0.622      0.757 0.432 0.000 0.568
#> GSM2864     3   0.622      0.757 0.432 0.000 0.568
#> GSM2865     3   0.622      0.757 0.432 0.000 0.568
#> GSM2866     3   0.622      0.757 0.432 0.000 0.568
#> GSM2868     3   0.622      0.757 0.432 0.000 0.568
#> GSM2869     3   0.622      0.757 0.432 0.000 0.568
#> GSM2851     3   0.622      0.757 0.432 0.000 0.568
#> GSM2867     3   0.622      0.757 0.432 0.000 0.568
#> GSM2870     3   0.622      0.757 0.432 0.000 0.568
#> GSM2854     2   0.789      0.906 0.432 0.512 0.056
#> GSM2873     2   0.789      0.906 0.432 0.512 0.056
#> GSM2874     3   0.000      0.568 0.000 0.000 1.000
#> GSM2884     3   0.000      0.568 0.000 0.000 1.000
#> GSM2875     1   0.622      1.000 0.568 0.432 0.000
#> GSM2890     1   0.622      1.000 0.568 0.432 0.000
#> GSM2877     1   0.622      1.000 0.568 0.432 0.000
#> GSM2892     1   0.622      1.000 0.568 0.432 0.000
#> GSM2902     1   0.622      1.000 0.568 0.432 0.000
#> GSM2878     1   0.622      1.000 0.568 0.432 0.000
#> GSM2901     1   0.622      1.000 0.568 0.432 0.000
#> GSM2879     3   0.620      0.755 0.424 0.000 0.576
#> GSM2898     3   0.620      0.755 0.424 0.000 0.576
#> GSM2881     3   0.000      0.568 0.000 0.000 1.000
#> GSM2897     3   0.000      0.568 0.000 0.000 1.000
#> GSM2882     2   0.622      0.990 0.432 0.568 0.000
#> GSM2894     2   0.622      0.990 0.432 0.568 0.000
#> GSM2883     3   0.000      0.568 0.000 0.000 1.000
#> GSM2895     3   0.000      0.568 0.000 0.000 1.000
#> GSM2885     3   0.000      0.568 0.000 0.000 1.000
#> GSM2886     3   0.000      0.568 0.000 0.000 1.000
#> GSM2887     3   0.000      0.568 0.000 0.000 1.000
#> GSM2896     3   0.000      0.568 0.000 0.000 1.000
#> GSM2888     3   0.622      0.757 0.432 0.000 0.568
#> GSM2889     3   0.622      0.757 0.432 0.000 0.568
#> GSM2876     1   0.622      1.000 0.568 0.432 0.000
#> GSM2891     1   0.622      1.000 0.568 0.432 0.000
#> GSM2880     1   0.622      1.000 0.568 0.432 0.000
#> GSM2893     1   0.622      1.000 0.568 0.432 0.000
#> GSM2821     3   0.622      0.757 0.432 0.000 0.568
#> GSM2900     3   0.622      0.757 0.432 0.000 0.568
#> GSM2903     3   0.622      0.757 0.432 0.000 0.568

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette   p1    p2    p3    p4
#> GSM2819     2  0.2973      0.861 0.00 0.856 0.000 0.144
#> GSM2820     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2822     2  0.3486      0.803 0.00 0.812 0.000 0.188
#> GSM2832     2  0.3486      0.803 0.00 0.812 0.000 0.188
#> GSM2823     2  0.1059      0.942 0.00 0.972 0.012 0.016
#> GSM2824     2  0.1059      0.942 0.00 0.972 0.012 0.016
#> GSM2825     2  0.5593      0.701 0.08 0.708 0.000 0.212
#> GSM2826     2  0.5593      0.701 0.08 0.708 0.000 0.212
#> GSM2829     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2856     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2830     4  0.0592      0.972 0.00 0.016 0.000 0.984
#> GSM2843     4  0.0592      0.972 0.00 0.016 0.000 0.984
#> GSM2871     4  0.0592      0.972 0.00 0.016 0.000 0.984
#> GSM2831     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2844     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2833     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2846     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2835     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2858     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2836     2  0.0336      0.949 0.00 0.992 0.000 0.008
#> GSM2848     2  0.0336      0.949 0.00 0.992 0.000 0.008
#> GSM2828     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2837     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2839     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2841     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2827     2  0.0336      0.949 0.00 0.992 0.000 0.008
#> GSM2842     2  0.0336      0.949 0.00 0.992 0.000 0.008
#> GSM2845     4  0.0592      0.972 0.00 0.016 0.000 0.984
#> GSM2872     4  0.0592      0.972 0.00 0.016 0.000 0.984
#> GSM2834     4  0.0592      0.972 0.00 0.016 0.000 0.984
#> GSM2847     4  0.0592      0.972 0.00 0.016 0.000 0.984
#> GSM2849     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2850     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2838     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2853     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2852     2  0.1302      0.925 0.00 0.956 0.044 0.000
#> GSM2855     2  0.1302      0.925 0.00 0.956 0.044 0.000
#> GSM2840     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2857     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2861     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2862     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2866     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2868     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2869     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2851     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2867     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2870     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2854     4  0.3400      0.795 0.00 0.180 0.000 0.820
#> GSM2873     4  0.3400      0.795 0.00 0.180 0.000 0.820
#> GSM2874     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2884     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2875     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2890     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2877     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2892     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2902     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2878     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2901     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2879     2  0.0336      0.948 0.00 0.992 0.008 0.000
#> GSM2898     2  0.0336      0.948 0.00 0.992 0.008 0.000
#> GSM2881     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2897     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2882     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2894     4  0.0336      0.973 0.00 0.008 0.000 0.992
#> GSM2883     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2895     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2885     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2886     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2887     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2896     3  0.0000      1.000 0.00 0.000 1.000 0.000
#> GSM2888     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2889     2  0.0000      0.951 0.00 1.000 0.000 0.000
#> GSM2876     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2891     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2880     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2893     1  0.0000      1.000 1.00 0.000 0.000 0.000
#> GSM2821     2  0.2973      0.861 0.00 0.856 0.000 0.144
#> GSM2900     2  0.2973      0.861 0.00 0.856 0.000 0.144
#> GSM2903     2  0.2973      0.861 0.00 0.856 0.000 0.144

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette   p1    p2    p3    p4    p5
#> GSM2819     5   0.285      1.000 0.00 0.172 0.000 0.000 0.828
#> GSM2820     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2822     2   0.356      0.655 0.00 0.788 0.000 0.196 0.016
#> GSM2832     2   0.356      0.655 0.00 0.788 0.000 0.196 0.016
#> GSM2823     2   0.462      0.149 0.00 0.612 0.012 0.004 0.372
#> GSM2824     2   0.462      0.149 0.00 0.612 0.012 0.004 0.372
#> GSM2825     2   0.535      0.507 0.08 0.684 0.000 0.220 0.016
#> GSM2826     2   0.535      0.507 0.08 0.684 0.000 0.220 0.016
#> GSM2829     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2856     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2830     4   0.313      0.876 0.00 0.008 0.000 0.820 0.172
#> GSM2843     4   0.313      0.876 0.00 0.008 0.000 0.820 0.172
#> GSM2871     4   0.313      0.876 0.00 0.008 0.000 0.820 0.172
#> GSM2831     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2844     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2833     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2846     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2835     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2858     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2836     2   0.029      0.908 0.00 0.992 0.000 0.008 0.000
#> GSM2848     2   0.029      0.908 0.00 0.992 0.000 0.008 0.000
#> GSM2828     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2837     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2839     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2841     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2827     2   0.029      0.908 0.00 0.992 0.000 0.008 0.000
#> GSM2842     2   0.029      0.908 0.00 0.992 0.000 0.008 0.000
#> GSM2845     4   0.313      0.876 0.00 0.008 0.000 0.820 0.172
#> GSM2872     4   0.313      0.876 0.00 0.008 0.000 0.820 0.172
#> GSM2834     4   0.313      0.876 0.00 0.008 0.000 0.820 0.172
#> GSM2847     4   0.313      0.876 0.00 0.008 0.000 0.820 0.172
#> GSM2849     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2850     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2838     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2853     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2852     2   0.112      0.872 0.00 0.956 0.044 0.000 0.000
#> GSM2855     2   0.112      0.872 0.00 0.956 0.044 0.000 0.000
#> GSM2840     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2857     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2859     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2860     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2861     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2862     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2863     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2864     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2865     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2866     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2868     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2869     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2851     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2867     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2870     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2854     4   0.545      0.681 0.00 0.172 0.000 0.660 0.168
#> GSM2873     4   0.545      0.681 0.00 0.172 0.000 0.660 0.168
#> GSM2874     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2884     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2875     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2890     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2877     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2892     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2902     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2878     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2901     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2879     2   0.029      0.907 0.00 0.992 0.008 0.000 0.000
#> GSM2898     2   0.029      0.907 0.00 0.992 0.008 0.000 0.000
#> GSM2881     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2897     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2882     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2894     4   0.000      0.898 0.00 0.000 0.000 1.000 0.000
#> GSM2883     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2895     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2885     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2886     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2887     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2896     3   0.000      1.000 0.00 0.000 1.000 0.000 0.000
#> GSM2888     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2889     2   0.000      0.912 0.00 1.000 0.000 0.000 0.000
#> GSM2876     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2891     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2880     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2893     1   0.000      1.000 1.00 0.000 0.000 0.000 0.000
#> GSM2821     5   0.285      1.000 0.00 0.172 0.000 0.000 0.828
#> GSM2900     5   0.285      1.000 0.00 0.172 0.000 0.000 0.828
#> GSM2903     5   0.285      1.000 0.00 0.172 0.000 0.000 0.828

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.0000      0.746 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     2  0.4920      0.452 0.000 0.580 0.000 0.064 0.004 0.352
#> GSM2832     2  0.4920      0.452 0.000 0.580 0.000 0.064 0.004 0.352
#> GSM2823     5  0.5265      0.385 0.000 0.404 0.008 0.000 0.512 0.076
#> GSM2824     5  0.5265      0.385 0.000 0.404 0.008 0.000 0.512 0.076
#> GSM2825     2  0.5649      0.296 0.016 0.488 0.000 0.084 0.004 0.408
#> GSM2826     2  0.5649      0.296 0.016 0.488 0.000 0.084 0.004 0.408
#> GSM2829     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     6  0.3868      0.841 0.000 0.000 0.000 0.492 0.000 0.508
#> GSM2843     6  0.3868      0.841 0.000 0.000 0.000 0.492 0.000 0.508
#> GSM2871     6  0.3868      0.841 0.000 0.000 0.000 0.492 0.000 0.508
#> GSM2831     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2846     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2835     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     2  0.1075      0.894 0.000 0.952 0.000 0.000 0.000 0.048
#> GSM2848     2  0.1075      0.894 0.000 0.952 0.000 0.000 0.000 0.048
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     1  0.1327      0.953 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM2841     1  0.1327      0.953 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM2827     2  0.1075      0.894 0.000 0.952 0.000 0.000 0.000 0.048
#> GSM2842     2  0.1075      0.894 0.000 0.952 0.000 0.000 0.000 0.048
#> GSM2845     6  0.3868      0.841 0.000 0.000 0.000 0.492 0.000 0.508
#> GSM2872     6  0.3868      0.841 0.000 0.000 0.000 0.492 0.000 0.508
#> GSM2834     6  0.3868      0.841 0.000 0.000 0.000 0.492 0.000 0.508
#> GSM2847     6  0.3868      0.841 0.000 0.000 0.000 0.492 0.000 0.508
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0146      0.902 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2853     2  0.0146      0.902 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2852     2  0.1633      0.871 0.000 0.932 0.044 0.000 0.000 0.024
#> GSM2855     2  0.1633      0.871 0.000 0.932 0.044 0.000 0.000 0.024
#> GSM2840     1  0.1327      0.953 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM2857     1  0.1327      0.953 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM2859     2  0.0458      0.901 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM2860     2  0.0458      0.901 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM2861     2  0.0458      0.901 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM2862     2  0.0458      0.901 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM2863     2  0.0458      0.901 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM2864     2  0.0458      0.901 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM2865     2  0.0458      0.901 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM2866     2  0.0458      0.901 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM2868     2  0.0547      0.899 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM2869     2  0.0547      0.899 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM2851     2  0.0547      0.900 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM2867     2  0.0547      0.899 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM2870     2  0.0547      0.900 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM2854     6  0.4968      0.559 0.000 0.120 0.000 0.248 0.000 0.632
#> GSM2873     6  0.4968      0.559 0.000 0.120 0.000 0.248 0.000 0.632
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     2  0.1471      0.881 0.000 0.932 0.004 0.000 0.000 0.064
#> GSM2898     2  0.1471      0.881 0.000 0.932 0.004 0.000 0.000 0.064
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2894     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2883     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.0632      0.899 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM2889     2  0.0632      0.899 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM2876     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.983 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.0000      0.746 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM2900     5  0.0000      0.746 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM2903     5  0.0000      0.746 0.000 0.000 0.000 0.000 1.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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 tissue(p) k
#> MAD:hclust 65  1.42e-04 2
#> MAD:hclust 84  6.67e-09 3
#> MAD:hclust 84  1.99e-12 4
#> MAD:hclust 82  1.15e-15 5
#> MAD:hclust 78  1.99e-18 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-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.189           0.502       0.686         0.3992 0.508   0.508
#> 3 3 0.478           0.636       0.634         0.5109 0.641   0.408
#> 4 4 0.603           0.896       0.853         0.1630 0.899   0.711
#> 5 5 0.806           0.831       0.852         0.0904 0.987   0.949
#> 6 6 0.776           0.728       0.816         0.0494 0.991   0.963

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
#> GSM2819     2  0.5737     0.6684 0.136 0.864
#> GSM2820     1  0.9850     0.1594 0.572 0.428
#> GSM2822     2  0.4939     0.6811 0.108 0.892
#> GSM2832     2  0.4939     0.6811 0.108 0.892
#> GSM2823     2  0.9732     0.4737 0.404 0.596
#> GSM2824     2  0.9732     0.4737 0.404 0.596
#> GSM2825     2  0.5629     0.6679 0.132 0.868
#> GSM2826     2  0.5629     0.6679 0.132 0.868
#> GSM2829     2  0.2948     0.6594 0.052 0.948
#> GSM2856     2  0.2948     0.6594 0.052 0.948
#> GSM2830     2  0.2423     0.6692 0.040 0.960
#> GSM2843     2  0.2423     0.6692 0.040 0.960
#> GSM2871     2  0.2423     0.6692 0.040 0.960
#> GSM2831     2  0.2948     0.6594 0.052 0.948
#> GSM2844     2  0.2948     0.6594 0.052 0.948
#> GSM2833     2  0.2236     0.6656 0.036 0.964
#> GSM2846     2  0.2236     0.6656 0.036 0.964
#> GSM2835     2  0.2948     0.6594 0.052 0.948
#> GSM2858     2  0.2948     0.6594 0.052 0.948
#> GSM2836     2  0.8207     0.7190 0.256 0.744
#> GSM2848     2  0.8207     0.7190 0.256 0.744
#> GSM2828     1  0.9850     0.1594 0.572 0.428
#> GSM2837     1  0.9850     0.1594 0.572 0.428
#> GSM2839     1  0.9608     0.4033 0.616 0.384
#> GSM2841     1  0.9608     0.4033 0.616 0.384
#> GSM2827     2  0.7950     0.7155 0.240 0.760
#> GSM2842     2  0.7950     0.7155 0.240 0.760
#> GSM2845     2  0.2423     0.6692 0.040 0.960
#> GSM2872     2  0.2948     0.6594 0.052 0.948
#> GSM2834     2  0.2043     0.6723 0.032 0.968
#> GSM2847     2  0.2423     0.6692 0.040 0.960
#> GSM2849     1  0.9850     0.1594 0.572 0.428
#> GSM2850     1  0.9850     0.1594 0.572 0.428
#> GSM2838     2  0.8327     0.7139 0.264 0.736
#> GSM2853     2  0.8327     0.7139 0.264 0.736
#> GSM2852     2  0.9909     0.1615 0.444 0.556
#> GSM2855     2  0.9909     0.1615 0.444 0.556
#> GSM2840     1  0.9608     0.4033 0.616 0.384
#> GSM2857     1  0.9608     0.4033 0.616 0.384
#> GSM2859     2  0.8207     0.7190 0.256 0.744
#> GSM2860     2  0.8207     0.7190 0.256 0.744
#> GSM2861     2  0.8327     0.7139 0.264 0.736
#> GSM2862     2  0.8207     0.7190 0.256 0.744
#> GSM2863     2  0.8207     0.7190 0.256 0.744
#> GSM2864     2  0.8207     0.7190 0.256 0.744
#> GSM2865     2  0.8207     0.7190 0.256 0.744
#> GSM2866     2  0.8207     0.7190 0.256 0.744
#> GSM2868     2  0.8327     0.7139 0.264 0.736
#> GSM2869     2  0.8327     0.7139 0.264 0.736
#> GSM2851     2  0.8327     0.7139 0.264 0.736
#> GSM2867     2  0.8327     0.7139 0.264 0.736
#> GSM2870     2  0.8327     0.7139 0.264 0.736
#> GSM2854     2  0.0672     0.6754 0.008 0.992
#> GSM2873     2  0.6712     0.7191 0.176 0.824
#> GSM2874     1  0.9850     0.1594 0.572 0.428
#> GSM2884     1  0.9850     0.1594 0.572 0.428
#> GSM2875     1  0.9248     0.4385 0.660 0.340
#> GSM2890     1  0.9248     0.4385 0.660 0.340
#> GSM2877     1  0.9248     0.4385 0.660 0.340
#> GSM2892     1  0.9248     0.4385 0.660 0.340
#> GSM2902     1  0.9248     0.4385 0.660 0.340
#> GSM2878     1  0.9248     0.4385 0.660 0.340
#> GSM2901     1  0.9248     0.4385 0.660 0.340
#> GSM2879     1  0.9922     0.0169 0.552 0.448
#> GSM2898     1  0.9922     0.0169 0.552 0.448
#> GSM2881     1  0.9850     0.1594 0.572 0.428
#> GSM2897     1  0.9850     0.1594 0.572 0.428
#> GSM2882     2  0.2948     0.6594 0.052 0.948
#> GSM2894     2  0.2948     0.6594 0.052 0.948
#> GSM2883     1  0.9850     0.1594 0.572 0.428
#> GSM2895     1  0.9850     0.1594 0.572 0.428
#> GSM2885     1  0.9850     0.1594 0.572 0.428
#> GSM2886     1  0.9850     0.1594 0.572 0.428
#> GSM2887     1  0.9850     0.1594 0.572 0.428
#> GSM2896     1  0.9850     0.1594 0.572 0.428
#> GSM2888     2  0.8081     0.7079 0.248 0.752
#> GSM2889     2  0.8081     0.7079 0.248 0.752
#> GSM2876     1  0.9323     0.4333 0.652 0.348
#> GSM2891     1  0.9323     0.4333 0.652 0.348
#> GSM2880     1  0.9248     0.4385 0.660 0.340
#> GSM2893     1  0.9248     0.4385 0.660 0.340
#> GSM2821     1  0.9954     0.3111 0.540 0.460
#> GSM2900     1  0.9954     0.3111 0.540 0.460
#> GSM2903     1  0.9954     0.3111 0.540 0.460

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     2  0.5681     0.6216 0.236 0.748 0.016
#> GSM2820     3  0.5982     0.9617 0.004 0.328 0.668
#> GSM2822     2  0.4121     0.7251 0.168 0.832 0.000
#> GSM2832     2  0.4121     0.7251 0.168 0.832 0.000
#> GSM2823     2  0.3888     0.7889 0.048 0.888 0.064
#> GSM2824     2  0.3888     0.7889 0.048 0.888 0.064
#> GSM2825     2  0.7300     0.4360 0.272 0.664 0.064
#> GSM2826     2  0.7300     0.4360 0.272 0.664 0.064
#> GSM2829     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2856     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2830     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2843     1  0.7722     0.1574 0.520 0.432 0.048
#> GSM2871     1  0.7758     0.0441 0.484 0.468 0.048
#> GSM2831     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2844     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2833     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2846     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2835     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2858     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2836     2  0.0892     0.8792 0.020 0.980 0.000
#> GSM2848     2  0.0892     0.8792 0.020 0.980 0.000
#> GSM2828     3  0.5982     0.9617 0.004 0.328 0.668
#> GSM2837     3  0.5982     0.9617 0.004 0.328 0.668
#> GSM2839     1  0.7613     0.5110 0.620 0.064 0.316
#> GSM2841     1  0.7613     0.5110 0.620 0.064 0.316
#> GSM2827     2  0.0892     0.8792 0.020 0.980 0.000
#> GSM2842     2  0.0892     0.8792 0.020 0.980 0.000
#> GSM2845     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2872     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2834     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2847     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2849     3  0.5982     0.9617 0.004 0.328 0.668
#> GSM2850     3  0.5982     0.9617 0.004 0.328 0.668
#> GSM2838     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2853     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2852     3  0.6154     0.8824 0.000 0.408 0.592
#> GSM2855     3  0.6154     0.8824 0.000 0.408 0.592
#> GSM2840     1  0.7613     0.5110 0.620 0.064 0.316
#> GSM2857     1  0.7613     0.5110 0.620 0.064 0.316
#> GSM2859     2  0.0424     0.8822 0.008 0.992 0.000
#> GSM2860     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2861     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2862     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2863     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2864     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2865     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2866     2  0.0892     0.8792 0.020 0.980 0.000
#> GSM2868     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2869     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2851     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2867     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2870     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2854     2  0.6836     0.2050 0.412 0.572 0.016
#> GSM2873     2  0.4235     0.7105 0.176 0.824 0.000
#> GSM2874     3  0.5982     0.9617 0.004 0.328 0.668
#> GSM2884     3  0.5982     0.9617 0.004 0.328 0.668
#> GSM2875     1  0.7571     0.5008 0.592 0.052 0.356
#> GSM2890     1  0.7571     0.5008 0.592 0.052 0.356
#> GSM2877     1  0.7571     0.5008 0.592 0.052 0.356
#> GSM2892     1  0.7571     0.5008 0.592 0.052 0.356
#> GSM2902     1  0.7571     0.5008 0.592 0.052 0.356
#> GSM2878     1  0.7552     0.5008 0.596 0.052 0.352
#> GSM2901     1  0.7552     0.5008 0.596 0.052 0.352
#> GSM2879     3  0.6299     0.7765 0.000 0.476 0.524
#> GSM2898     3  0.6299     0.7765 0.000 0.476 0.524
#> GSM2881     3  0.5760     0.9614 0.000 0.328 0.672
#> GSM2897     3  0.5760     0.9614 0.000 0.328 0.672
#> GSM2882     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2894     1  0.7715     0.1688 0.524 0.428 0.048
#> GSM2883     3  0.6008     0.9606 0.004 0.332 0.664
#> GSM2895     3  0.6008     0.9606 0.004 0.332 0.664
#> GSM2885     3  0.5760     0.9614 0.000 0.328 0.672
#> GSM2886     3  0.5760     0.9614 0.000 0.328 0.672
#> GSM2887     3  0.5785     0.9602 0.000 0.332 0.668
#> GSM2896     3  0.5785     0.9602 0.000 0.332 0.668
#> GSM2888     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2889     2  0.0000     0.8833 0.000 1.000 0.000
#> GSM2876     1  0.7448     0.5075 0.616 0.052 0.332
#> GSM2891     1  0.7448     0.5075 0.616 0.052 0.332
#> GSM2880     1  0.7571     0.5008 0.592 0.052 0.356
#> GSM2893     1  0.7571     0.5008 0.592 0.052 0.356
#> GSM2821     1  0.9184     0.4655 0.528 0.188 0.284
#> GSM2900     1  0.9145     0.4682 0.532 0.184 0.284
#> GSM2903     1  0.9145     0.4682 0.532 0.184 0.284

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.4932      0.783 0.012 0.792 0.068 0.128
#> GSM2820     3  0.3272      0.937 0.008 0.128 0.860 0.004
#> GSM2822     2  0.3889      0.812 0.004 0.844 0.040 0.112
#> GSM2832     2  0.3889      0.812 0.004 0.844 0.040 0.112
#> GSM2823     2  0.3552      0.841 0.000 0.848 0.024 0.128
#> GSM2824     2  0.3552      0.841 0.000 0.848 0.024 0.128
#> GSM2825     2  0.5967      0.602 0.028 0.708 0.052 0.212
#> GSM2826     2  0.5967      0.602 0.028 0.708 0.052 0.212
#> GSM2829     4  0.4898      0.982 0.024 0.184 0.020 0.772
#> GSM2856     4  0.4898      0.982 0.024 0.184 0.020 0.772
#> GSM2830     4  0.5281      0.980 0.036 0.184 0.024 0.756
#> GSM2843     4  0.5232      0.979 0.032 0.188 0.024 0.756
#> GSM2871     4  0.5369      0.973 0.032 0.192 0.028 0.748
#> GSM2831     4  0.4673      0.983 0.024 0.184 0.012 0.780
#> GSM2844     4  0.4673      0.983 0.024 0.184 0.012 0.780
#> GSM2833     4  0.5098      0.979 0.024 0.184 0.028 0.764
#> GSM2846     4  0.5098      0.979 0.024 0.184 0.028 0.764
#> GSM2835     4  0.5015      0.975 0.024 0.176 0.028 0.772
#> GSM2858     4  0.5015      0.975 0.024 0.176 0.028 0.772
#> GSM2836     2  0.1118      0.915 0.000 0.964 0.000 0.036
#> GSM2848     2  0.1118      0.915 0.000 0.964 0.000 0.036
#> GSM2828     3  0.3272      0.937 0.008 0.128 0.860 0.004
#> GSM2837     3  0.3272      0.937 0.008 0.128 0.860 0.004
#> GSM2839     1  0.4161      0.894 0.852 0.032 0.056 0.060
#> GSM2841     1  0.4161      0.894 0.852 0.032 0.056 0.060
#> GSM2827     2  0.0921      0.920 0.000 0.972 0.000 0.028
#> GSM2842     2  0.0921      0.920 0.000 0.972 0.000 0.028
#> GSM2845     4  0.5378      0.979 0.036 0.184 0.028 0.752
#> GSM2872     4  0.5378      0.979 0.036 0.184 0.028 0.752
#> GSM2834     4  0.5139      0.980 0.028 0.188 0.024 0.760
#> GSM2847     4  0.5192      0.981 0.032 0.184 0.024 0.760
#> GSM2849     3  0.3272      0.937 0.008 0.128 0.860 0.004
#> GSM2850     3  0.3272      0.937 0.008 0.128 0.860 0.004
#> GSM2838     2  0.0188      0.928 0.000 0.996 0.004 0.000
#> GSM2853     2  0.0188      0.928 0.000 0.996 0.004 0.000
#> GSM2852     3  0.4764      0.912 0.008 0.136 0.796 0.060
#> GSM2855     3  0.4764      0.912 0.008 0.136 0.796 0.060
#> GSM2840     1  0.4161      0.894 0.852 0.032 0.056 0.060
#> GSM2857     1  0.4161      0.894 0.852 0.032 0.056 0.060
#> GSM2859     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM2861     2  0.0188      0.928 0.000 0.996 0.004 0.000
#> GSM2862     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0804      0.922 0.000 0.980 0.012 0.008
#> GSM2868     2  0.0564      0.927 0.004 0.988 0.004 0.004
#> GSM2869     2  0.0564      0.927 0.004 0.988 0.004 0.004
#> GSM2851     2  0.0564      0.927 0.004 0.988 0.004 0.004
#> GSM2867     2  0.0564      0.927 0.004 0.988 0.004 0.004
#> GSM2870     2  0.0564      0.927 0.004 0.988 0.004 0.004
#> GSM2854     4  0.4754      0.943 0.004 0.220 0.024 0.752
#> GSM2873     2  0.3325      0.823 0.000 0.864 0.024 0.112
#> GSM2874     3  0.3415      0.937 0.008 0.128 0.856 0.008
#> GSM2884     3  0.3415      0.937 0.008 0.128 0.856 0.008
#> GSM2875     1  0.1953      0.911 0.944 0.032 0.012 0.012
#> GSM2890     1  0.1953      0.911 0.944 0.032 0.012 0.012
#> GSM2877     1  0.1953      0.911 0.944 0.032 0.012 0.012
#> GSM2892     1  0.1953      0.911 0.944 0.032 0.012 0.012
#> GSM2902     1  0.1953      0.911 0.944 0.032 0.012 0.012
#> GSM2878     1  0.1543      0.911 0.956 0.032 0.008 0.004
#> GSM2901     1  0.1543      0.911 0.956 0.032 0.008 0.004
#> GSM2879     3  0.6542      0.422 0.000 0.428 0.496 0.076
#> GSM2898     3  0.6542      0.422 0.000 0.428 0.496 0.076
#> GSM2881     3  0.3272      0.937 0.004 0.128 0.860 0.008
#> GSM2897     3  0.3272      0.937 0.004 0.128 0.860 0.008
#> GSM2882     4  0.4673      0.983 0.024 0.184 0.012 0.780
#> GSM2894     4  0.4673      0.983 0.024 0.184 0.012 0.780
#> GSM2883     3  0.4903      0.916 0.016 0.128 0.796 0.060
#> GSM2895     3  0.4903      0.916 0.016 0.128 0.796 0.060
#> GSM2885     3  0.3272      0.937 0.004 0.128 0.860 0.008
#> GSM2886     3  0.3272      0.937 0.004 0.128 0.860 0.008
#> GSM2887     3  0.3932      0.932 0.004 0.128 0.836 0.032
#> GSM2896     3  0.3932      0.932 0.004 0.128 0.836 0.032
#> GSM2888     2  0.1443      0.909 0.004 0.960 0.008 0.028
#> GSM2889     2  0.1443      0.909 0.004 0.960 0.008 0.028
#> GSM2876     1  0.3921      0.894 0.864 0.032 0.048 0.056
#> GSM2891     1  0.3921      0.894 0.864 0.032 0.048 0.056
#> GSM2880     1  0.1953      0.911 0.944 0.032 0.012 0.012
#> GSM2893     1  0.1953      0.911 0.944 0.032 0.012 0.012
#> GSM2821     1  0.8064      0.640 0.568 0.216 0.068 0.148
#> GSM2900     1  0.8064      0.640 0.568 0.216 0.068 0.148
#> GSM2903     1  0.8064      0.640 0.568 0.216 0.068 0.148

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     2  0.5012      0.388 0.000 0.600 0.004 0.032 0.364
#> GSM2820     3  0.2053      0.904 0.000 0.048 0.924 0.004 0.024
#> GSM2822     2  0.4764      0.695 0.000 0.756 0.016 0.088 0.140
#> GSM2832     2  0.4764      0.695 0.000 0.756 0.016 0.088 0.140
#> GSM2823     2  0.5041      0.514 0.004 0.636 0.000 0.044 0.316
#> GSM2824     2  0.5041      0.514 0.004 0.636 0.000 0.044 0.316
#> GSM2825     2  0.6362      0.418 0.000 0.584 0.016 0.204 0.196
#> GSM2826     2  0.6362      0.418 0.000 0.584 0.016 0.204 0.196
#> GSM2829     4  0.2772      0.943 0.000 0.052 0.012 0.892 0.044
#> GSM2856     4  0.2772      0.943 0.000 0.052 0.012 0.892 0.044
#> GSM2830     4  0.3046      0.943 0.000 0.052 0.020 0.880 0.048
#> GSM2843     4  0.3046      0.943 0.000 0.052 0.020 0.880 0.048
#> GSM2871     4  0.3254      0.938 0.000 0.052 0.020 0.868 0.060
#> GSM2831     4  0.1591      0.951 0.000 0.052 0.004 0.940 0.004
#> GSM2844     4  0.1591      0.951 0.000 0.052 0.004 0.940 0.004
#> GSM2833     4  0.2987      0.940 0.000 0.052 0.012 0.880 0.056
#> GSM2846     4  0.2987      0.940 0.000 0.052 0.012 0.880 0.056
#> GSM2835     4  0.2983      0.937 0.000 0.048 0.012 0.880 0.060
#> GSM2858     4  0.2983      0.937 0.000 0.048 0.012 0.880 0.060
#> GSM2836     2  0.1661      0.822 0.000 0.940 0.000 0.036 0.024
#> GSM2848     2  0.1661      0.822 0.000 0.940 0.000 0.036 0.024
#> GSM2828     3  0.2053      0.904 0.000 0.048 0.924 0.004 0.024
#> GSM2837     3  0.2053      0.904 0.000 0.048 0.924 0.004 0.024
#> GSM2839     1  0.4463      0.721 0.764 0.004 0.024 0.024 0.184
#> GSM2841     1  0.4463      0.721 0.764 0.004 0.024 0.024 0.184
#> GSM2827     2  0.2036      0.823 0.000 0.920 0.000 0.024 0.056
#> GSM2842     2  0.2036      0.823 0.000 0.920 0.000 0.024 0.056
#> GSM2845     4  0.3248      0.937 0.000 0.048 0.020 0.868 0.064
#> GSM2872     4  0.3248      0.937 0.000 0.048 0.020 0.868 0.064
#> GSM2834     4  0.3117      0.943 0.000 0.052 0.020 0.876 0.052
#> GSM2847     4  0.3117      0.943 0.000 0.052 0.020 0.876 0.052
#> GSM2849     3  0.2053      0.904 0.000 0.048 0.924 0.004 0.024
#> GSM2850     3  0.2053      0.904 0.000 0.048 0.924 0.004 0.024
#> GSM2838     2  0.2329      0.818 0.000 0.876 0.000 0.000 0.124
#> GSM2853     2  0.2329      0.818 0.000 0.876 0.000 0.000 0.124
#> GSM2852     3  0.4272      0.846 0.000 0.060 0.780 0.008 0.152
#> GSM2855     3  0.4272      0.846 0.000 0.060 0.780 0.008 0.152
#> GSM2840     1  0.4463      0.721 0.764 0.004 0.024 0.024 0.184
#> GSM2857     1  0.4463      0.721 0.764 0.004 0.024 0.024 0.184
#> GSM2859     2  0.0510      0.835 0.000 0.984 0.000 0.000 0.016
#> GSM2860     2  0.0510      0.835 0.000 0.984 0.000 0.000 0.016
#> GSM2861     2  0.1270      0.833 0.000 0.948 0.000 0.000 0.052
#> GSM2862     2  0.0510      0.835 0.000 0.984 0.000 0.000 0.016
#> GSM2863     2  0.0510      0.835 0.000 0.984 0.000 0.000 0.016
#> GSM2864     2  0.0510      0.835 0.000 0.984 0.000 0.000 0.016
#> GSM2865     2  0.0510      0.835 0.000 0.984 0.000 0.000 0.016
#> GSM2866     2  0.0609      0.835 0.000 0.980 0.000 0.000 0.020
#> GSM2868     2  0.2377      0.816 0.000 0.872 0.000 0.000 0.128
#> GSM2869     2  0.2377      0.816 0.000 0.872 0.000 0.000 0.128
#> GSM2851     2  0.2329      0.818 0.000 0.876 0.000 0.000 0.124
#> GSM2867     2  0.2377      0.816 0.000 0.872 0.000 0.000 0.128
#> GSM2870     2  0.2377      0.816 0.000 0.872 0.000 0.000 0.128
#> GSM2854     4  0.3388      0.936 0.000 0.056 0.020 0.860 0.064
#> GSM2873     2  0.3495      0.762 0.000 0.852 0.020 0.080 0.048
#> GSM2874     3  0.1805      0.905 0.004 0.048 0.936 0.004 0.008
#> GSM2884     3  0.1679      0.905 0.004 0.048 0.940 0.004 0.004
#> GSM2875     1  0.0162      0.869 0.996 0.004 0.000 0.000 0.000
#> GSM2890     1  0.0162      0.869 0.996 0.004 0.000 0.000 0.000
#> GSM2877     1  0.0162      0.869 0.996 0.004 0.000 0.000 0.000
#> GSM2892     1  0.0162      0.869 0.996 0.004 0.000 0.000 0.000
#> GSM2902     1  0.0162      0.869 0.996 0.004 0.000 0.000 0.000
#> GSM2878     1  0.0775      0.865 0.980 0.004 0.004 0.004 0.008
#> GSM2901     1  0.0775      0.865 0.980 0.004 0.004 0.004 0.008
#> GSM2879     3  0.6545      0.403 0.000 0.344 0.484 0.008 0.164
#> GSM2898     3  0.6545      0.403 0.000 0.344 0.484 0.008 0.164
#> GSM2881     3  0.2120      0.905 0.004 0.048 0.924 0.004 0.020
#> GSM2897     3  0.2120      0.905 0.004 0.048 0.924 0.004 0.020
#> GSM2882     4  0.1430      0.951 0.000 0.052 0.004 0.944 0.000
#> GSM2894     4  0.1430      0.951 0.000 0.052 0.004 0.944 0.000
#> GSM2883     3  0.3514      0.880 0.000 0.048 0.848 0.016 0.088
#> GSM2895     3  0.3514      0.880 0.000 0.048 0.848 0.016 0.088
#> GSM2885     3  0.2120      0.905 0.004 0.048 0.924 0.004 0.020
#> GSM2886     3  0.2120      0.905 0.004 0.048 0.924 0.004 0.020
#> GSM2887     3  0.3395      0.889 0.004 0.048 0.860 0.012 0.076
#> GSM2896     3  0.3395      0.889 0.004 0.048 0.860 0.012 0.076
#> GSM2888     2  0.2563      0.815 0.000 0.872 0.000 0.008 0.120
#> GSM2889     2  0.2563      0.815 0.000 0.872 0.000 0.008 0.120
#> GSM2876     1  0.3088      0.734 0.828 0.004 0.000 0.004 0.164
#> GSM2891     1  0.3088      0.734 0.828 0.004 0.000 0.004 0.164
#> GSM2880     1  0.0162      0.869 0.996 0.004 0.000 0.000 0.000
#> GSM2893     1  0.0162      0.869 0.996 0.004 0.000 0.000 0.000
#> GSM2821     5  0.7293      1.000 0.372 0.196 0.000 0.036 0.396
#> GSM2900     5  0.7293      1.000 0.372 0.196 0.000 0.036 0.396
#> GSM2903     5  0.7293      1.000 0.372 0.196 0.000 0.036 0.396

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM2819     5  0.5298    -0.0733 0.000 0.420 0.000 0.020 0.504 NA
#> GSM2820     3  0.2195     0.8581 0.000 0.012 0.904 0.000 0.068 NA
#> GSM2822     2  0.5401     0.5638 0.000 0.688 0.004 0.068 0.140 NA
#> GSM2832     2  0.5401     0.5638 0.000 0.688 0.004 0.068 0.140 NA
#> GSM2823     2  0.6606     0.0157 0.008 0.416 0.004 0.016 0.352 NA
#> GSM2824     2  0.6606     0.0157 0.008 0.416 0.004 0.016 0.352 NA
#> GSM2825     2  0.6952     0.2332 0.000 0.488 0.000 0.136 0.216 NA
#> GSM2826     2  0.6952     0.2332 0.000 0.488 0.000 0.136 0.216 NA
#> GSM2829     4  0.2010     0.8751 0.000 0.004 0.004 0.920 0.036 NA
#> GSM2856     4  0.2010     0.8751 0.000 0.004 0.004 0.920 0.036 NA
#> GSM2830     4  0.2955     0.8573 0.000 0.008 0.000 0.816 0.004 NA
#> GSM2843     4  0.2955     0.8573 0.000 0.008 0.000 0.816 0.004 NA
#> GSM2871     4  0.3198     0.8485 0.000 0.008 0.000 0.796 0.008 NA
#> GSM2831     4  0.0870     0.8852 0.000 0.004 0.000 0.972 0.012 NA
#> GSM2844     4  0.0870     0.8852 0.000 0.004 0.000 0.972 0.012 NA
#> GSM2833     4  0.2483     0.8669 0.000 0.004 0.004 0.892 0.056 NA
#> GSM2846     4  0.2483     0.8669 0.000 0.004 0.004 0.892 0.056 NA
#> GSM2835     4  0.2856     0.8555 0.000 0.004 0.004 0.868 0.060 NA
#> GSM2858     4  0.2856     0.8555 0.000 0.004 0.004 0.868 0.060 NA
#> GSM2836     2  0.2898     0.7028 0.000 0.868 0.000 0.020 0.040 NA
#> GSM2848     2  0.2898     0.7028 0.000 0.868 0.000 0.020 0.040 NA
#> GSM2828     3  0.2195     0.8581 0.000 0.012 0.904 0.000 0.068 NA
#> GSM2837     3  0.2195     0.8581 0.000 0.012 0.904 0.000 0.068 NA
#> GSM2839     1  0.4857     0.6817 0.668 0.000 0.000 0.004 0.212 NA
#> GSM2841     1  0.4857     0.6817 0.668 0.000 0.000 0.004 0.212 NA
#> GSM2827     2  0.3583     0.6966 0.000 0.800 0.000 0.008 0.048 NA
#> GSM2842     2  0.3583     0.6966 0.000 0.800 0.000 0.008 0.048 NA
#> GSM2845     4  0.3404     0.8480 0.000 0.008 0.004 0.792 0.012 NA
#> GSM2872     4  0.3404     0.8480 0.000 0.008 0.004 0.792 0.012 NA
#> GSM2834     4  0.3065     0.8562 0.000 0.008 0.000 0.812 0.008 NA
#> GSM2847     4  0.3065     0.8562 0.000 0.008 0.000 0.812 0.008 NA
#> GSM2849     3  0.2395     0.8569 0.000 0.012 0.892 0.000 0.076 NA
#> GSM2850     3  0.2395     0.8569 0.000 0.012 0.892 0.000 0.076 NA
#> GSM2838     2  0.3695     0.6934 0.000 0.772 0.000 0.004 0.040 NA
#> GSM2853     2  0.3695     0.6934 0.000 0.772 0.000 0.004 0.040 NA
#> GSM2852     3  0.4375     0.7396 0.000 0.020 0.700 0.000 0.032 NA
#> GSM2855     3  0.4375     0.7396 0.000 0.020 0.700 0.000 0.032 NA
#> GSM2840     1  0.4857     0.6817 0.668 0.000 0.000 0.004 0.212 NA
#> GSM2857     1  0.4857     0.6817 0.668 0.000 0.000 0.004 0.212 NA
#> GSM2859     2  0.1334     0.7293 0.000 0.948 0.000 0.000 0.032 NA
#> GSM2860     2  0.1334     0.7293 0.000 0.948 0.000 0.000 0.032 NA
#> GSM2861     2  0.2046     0.7287 0.000 0.908 0.000 0.000 0.032 NA
#> GSM2862     2  0.1334     0.7293 0.000 0.948 0.000 0.000 0.032 NA
#> GSM2863     2  0.1334     0.7293 0.000 0.948 0.000 0.000 0.032 NA
#> GSM2864     2  0.1334     0.7293 0.000 0.948 0.000 0.000 0.032 NA
#> GSM2865     2  0.1334     0.7293 0.000 0.948 0.000 0.000 0.032 NA
#> GSM2866     2  0.1334     0.7293 0.000 0.948 0.000 0.000 0.032 NA
#> GSM2868     2  0.4059     0.6760 0.000 0.732 0.000 0.004 0.048 NA
#> GSM2869     2  0.4059     0.6760 0.000 0.732 0.000 0.004 0.048 NA
#> GSM2851     2  0.3969     0.6790 0.000 0.740 0.000 0.004 0.044 NA
#> GSM2867     2  0.4059     0.6760 0.000 0.732 0.000 0.004 0.048 NA
#> GSM2870     2  0.3969     0.6790 0.000 0.740 0.000 0.004 0.044 NA
#> GSM2854     4  0.2907     0.8635 0.000 0.008 0.004 0.868 0.056 NA
#> GSM2873     2  0.3830     0.6667 0.000 0.816 0.004 0.056 0.040 NA
#> GSM2874     3  0.1225     0.8601 0.000 0.012 0.952 0.000 0.036 NA
#> GSM2884     3  0.0993     0.8607 0.000 0.012 0.964 0.000 0.024 NA
#> GSM2875     1  0.0146     0.8492 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2890     1  0.0146     0.8492 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2877     1  0.0146     0.8492 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2892     1  0.0146     0.8492 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2902     1  0.0146     0.8492 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2878     1  0.1312     0.8421 0.956 0.000 0.004 0.008 0.012 NA
#> GSM2901     1  0.1312     0.8421 0.956 0.000 0.004 0.008 0.012 NA
#> GSM2879     3  0.7351     0.1691 0.000 0.288 0.388 0.004 0.108 NA
#> GSM2898     3  0.7351     0.1691 0.000 0.288 0.388 0.004 0.108 NA
#> GSM2881     3  0.0725     0.8608 0.000 0.012 0.976 0.000 0.000 NA
#> GSM2897     3  0.0725     0.8608 0.000 0.012 0.976 0.000 0.000 NA
#> GSM2882     4  0.0748     0.8850 0.000 0.004 0.000 0.976 0.016 NA
#> GSM2894     4  0.0748     0.8850 0.000 0.004 0.000 0.976 0.016 NA
#> GSM2883     3  0.3767     0.8226 0.004 0.012 0.808 0.000 0.092 NA
#> GSM2895     3  0.3767     0.8226 0.004 0.012 0.808 0.000 0.092 NA
#> GSM2885     3  0.0725     0.8608 0.000 0.012 0.976 0.000 0.000 NA
#> GSM2886     3  0.0725     0.8608 0.000 0.012 0.976 0.000 0.000 NA
#> GSM2887     3  0.2518     0.8373 0.000 0.012 0.880 0.000 0.016 NA
#> GSM2896     3  0.2518     0.8373 0.000 0.012 0.880 0.000 0.016 NA
#> GSM2888     2  0.3997     0.6882 0.000 0.736 0.000 0.004 0.044 NA
#> GSM2889     2  0.3997     0.6882 0.000 0.736 0.000 0.004 0.044 NA
#> GSM2876     1  0.3777     0.7265 0.776 0.000 0.000 0.004 0.164 NA
#> GSM2891     1  0.3777     0.7265 0.776 0.000 0.000 0.004 0.164 NA
#> GSM2880     1  0.0146     0.8492 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2893     1  0.0146     0.8492 0.996 0.000 0.000 0.004 0.000 NA
#> GSM2821     5  0.5703     0.7141 0.316 0.108 0.000 0.024 0.552 NA
#> GSM2900     5  0.5703     0.7141 0.316 0.108 0.000 0.024 0.552 NA
#> GSM2903     5  0.5703     0.7141 0.316 0.108 0.000 0.024 0.552 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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 tissue(p) k
#> MAD:kmeans 45        NA 2
#> MAD:kmeans 61  8.31e-07 3
#> MAD:kmeans 82  8.86e-12 4
#> MAD:kmeans 79  3.61e-15 5
#> MAD:kmeans 77  6.70e-15 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.494           0.926       0.943         0.5056 0.494   0.494
#> 3 3 0.564           0.699       0.859         0.2831 0.687   0.453
#> 4 4 1.000           0.968       0.912         0.1639 0.837   0.563
#> 5 5 0.916           0.893       0.896         0.0471 0.971   0.880
#> 6 6 0.871           0.799       0.836         0.0380 0.943   0.744

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

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

There is also optional best \(k\) = 4 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
#> GSM2819     1   0.494      0.937 0.892 0.108
#> GSM2820     2   0.494      0.931 0.108 0.892
#> GSM2822     1   0.494      0.937 0.892 0.108
#> GSM2832     1   0.494      0.937 0.892 0.108
#> GSM2823     2   0.494      0.931 0.108 0.892
#> GSM2824     2   0.494      0.931 0.108 0.892
#> GSM2825     1   0.494      0.937 0.892 0.108
#> GSM2826     1   0.494      0.937 0.892 0.108
#> GSM2829     1   0.494      0.937 0.892 0.108
#> GSM2856     1   0.494      0.937 0.892 0.108
#> GSM2830     1   0.494      0.937 0.892 0.108
#> GSM2843     1   0.494      0.937 0.892 0.108
#> GSM2871     1   0.494      0.937 0.892 0.108
#> GSM2831     1   0.494      0.937 0.892 0.108
#> GSM2844     1   0.494      0.937 0.892 0.108
#> GSM2833     1   0.494      0.937 0.892 0.108
#> GSM2846     1   0.494      0.937 0.892 0.108
#> GSM2835     1   0.494      0.937 0.892 0.108
#> GSM2858     1   0.494      0.937 0.892 0.108
#> GSM2836     2   0.000      0.943 0.000 1.000
#> GSM2848     2   0.000      0.943 0.000 1.000
#> GSM2828     2   0.494      0.931 0.108 0.892
#> GSM2837     2   0.494      0.931 0.108 0.892
#> GSM2839     1   0.000      0.921 1.000 0.000
#> GSM2841     1   0.000      0.921 1.000 0.000
#> GSM2827     2   0.000      0.943 0.000 1.000
#> GSM2842     2   0.000      0.943 0.000 1.000
#> GSM2845     1   0.494      0.937 0.892 0.108
#> GSM2872     1   0.494      0.937 0.892 0.108
#> GSM2834     1   0.494      0.937 0.892 0.108
#> GSM2847     1   0.494      0.937 0.892 0.108
#> GSM2849     2   0.494      0.931 0.108 0.892
#> GSM2850     2   0.494      0.931 0.108 0.892
#> GSM2838     2   0.000      0.943 0.000 1.000
#> GSM2853     2   0.000      0.943 0.000 1.000
#> GSM2852     2   0.000      0.943 0.000 1.000
#> GSM2855     2   0.000      0.943 0.000 1.000
#> GSM2840     1   0.000      0.921 1.000 0.000
#> GSM2857     1   0.000      0.921 1.000 0.000
#> GSM2859     2   0.000      0.943 0.000 1.000
#> GSM2860     2   0.000      0.943 0.000 1.000
#> GSM2861     2   0.000      0.943 0.000 1.000
#> GSM2862     2   0.000      0.943 0.000 1.000
#> GSM2863     2   0.000      0.943 0.000 1.000
#> GSM2864     2   0.000      0.943 0.000 1.000
#> GSM2865     2   0.000      0.943 0.000 1.000
#> GSM2866     2   0.000      0.943 0.000 1.000
#> GSM2868     2   0.000      0.943 0.000 1.000
#> GSM2869     2   0.000      0.943 0.000 1.000
#> GSM2851     2   0.000      0.943 0.000 1.000
#> GSM2867     2   0.000      0.943 0.000 1.000
#> GSM2870     2   0.000      0.943 0.000 1.000
#> GSM2854     1   0.494      0.937 0.892 0.108
#> GSM2873     1   0.998      0.293 0.524 0.476
#> GSM2874     2   0.494      0.931 0.108 0.892
#> GSM2884     2   0.494      0.931 0.108 0.892
#> GSM2875     1   0.000      0.921 1.000 0.000
#> GSM2890     1   0.000      0.921 1.000 0.000
#> GSM2877     1   0.000      0.921 1.000 0.000
#> GSM2892     1   0.000      0.921 1.000 0.000
#> GSM2902     1   0.000      0.921 1.000 0.000
#> GSM2878     1   0.000      0.921 1.000 0.000
#> GSM2901     1   0.000      0.921 1.000 0.000
#> GSM2879     2   0.494      0.931 0.108 0.892
#> GSM2898     2   0.494      0.931 0.108 0.892
#> GSM2881     2   0.494      0.931 0.108 0.892
#> GSM2897     2   0.494      0.931 0.108 0.892
#> GSM2882     1   0.494      0.937 0.892 0.108
#> GSM2894     1   0.494      0.937 0.892 0.108
#> GSM2883     2   0.494      0.931 0.108 0.892
#> GSM2895     2   0.494      0.931 0.108 0.892
#> GSM2885     2   0.494      0.931 0.108 0.892
#> GSM2886     2   0.494      0.931 0.108 0.892
#> GSM2887     2   0.494      0.931 0.108 0.892
#> GSM2896     2   0.494      0.931 0.108 0.892
#> GSM2888     2   0.000      0.943 0.000 1.000
#> GSM2889     2   0.000      0.943 0.000 1.000
#> GSM2876     1   0.000      0.921 1.000 0.000
#> GSM2891     1   0.000      0.921 1.000 0.000
#> GSM2880     1   0.000      0.921 1.000 0.000
#> GSM2893     1   0.000      0.921 1.000 0.000
#> GSM2821     1   0.000      0.921 1.000 0.000
#> GSM2900     1   0.000      0.921 1.000 0.000
#> GSM2903     1   0.000      0.921 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
#> GSM2819     1  0.6267      0.111 0.548 0.452 0.000
#> GSM2820     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2822     2  0.0237      0.712 0.004 0.996 0.000
#> GSM2832     2  0.0237      0.712 0.004 0.996 0.000
#> GSM2823     3  0.6045      0.471 0.380 0.000 0.620
#> GSM2824     3  0.6045      0.471 0.380 0.000 0.620
#> GSM2825     1  0.5254      0.511 0.736 0.264 0.000
#> GSM2826     1  0.5254      0.511 0.736 0.264 0.000
#> GSM2829     2  0.6140      0.127 0.404 0.596 0.000
#> GSM2856     2  0.6140      0.127 0.404 0.596 0.000
#> GSM2830     2  0.6140      0.127 0.404 0.596 0.000
#> GSM2843     2  0.6140      0.127 0.404 0.596 0.000
#> GSM2871     2  0.5882      0.250 0.348 0.652 0.000
#> GSM2831     1  0.6192      0.414 0.580 0.420 0.000
#> GSM2844     1  0.6192      0.414 0.580 0.420 0.000
#> GSM2833     2  0.6140      0.127 0.404 0.596 0.000
#> GSM2846     2  0.6140      0.127 0.404 0.596 0.000
#> GSM2835     1  0.6168      0.429 0.588 0.412 0.000
#> GSM2858     1  0.6168      0.429 0.588 0.412 0.000
#> GSM2836     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2848     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2828     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2837     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2839     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2827     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2842     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2845     1  0.6286      0.300 0.536 0.464 0.000
#> GSM2872     1  0.6204      0.405 0.576 0.424 0.000
#> GSM2834     2  0.6140      0.127 0.404 0.596 0.000
#> GSM2847     2  0.6140      0.127 0.404 0.596 0.000
#> GSM2849     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2850     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2838     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2853     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2852     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2855     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2840     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2859     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2860     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2861     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2862     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2863     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2864     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2865     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2866     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2868     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2869     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2851     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2867     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2870     2  0.3686      0.794 0.000 0.860 0.140
#> GSM2854     2  0.2356      0.659 0.072 0.928 0.000
#> GSM2873     2  0.0000      0.711 0.000 1.000 0.000
#> GSM2874     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2884     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2875     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2879     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2898     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2881     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2897     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2882     1  0.6180      0.422 0.584 0.416 0.000
#> GSM2894     1  0.6180      0.422 0.584 0.416 0.000
#> GSM2883     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2895     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2885     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2886     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2887     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2896     3  0.0000      0.958 0.000 0.000 1.000
#> GSM2888     2  0.4605      0.727 0.000 0.796 0.204
#> GSM2889     2  0.4605      0.727 0.000 0.796 0.204
#> GSM2876     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2891     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2880     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2821     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2900     1  0.0000      0.809 1.000 0.000 0.000
#> GSM2903     1  0.0000      0.809 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3   p4
#> GSM2819     1   0.492      0.295 0.576 0.424 0.000 0.00
#> GSM2820     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2822     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2832     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2823     1   0.344      0.768 0.816 0.000 0.184 0.00
#> GSM2824     1   0.344      0.768 0.816 0.000 0.184 0.00
#> GSM2825     1   0.455      0.752 0.780 0.180 0.000 0.04
#> GSM2826     1   0.455      0.752 0.780 0.180 0.000 0.04
#> GSM2829     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2856     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2830     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2843     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2871     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2831     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2844     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2833     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2846     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2835     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2858     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2836     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2848     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2828     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2837     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2839     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2841     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2827     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2842     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2845     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2872     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2834     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2847     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2849     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2850     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2838     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2853     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2852     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2855     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2840     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2857     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2859     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2860     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2861     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2862     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2863     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2864     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2865     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2866     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2868     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2869     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2851     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2867     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2870     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2854     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2873     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2874     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2884     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2875     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2890     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2877     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2892     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2902     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2878     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2901     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2879     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2898     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2881     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2897     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2882     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2894     4   0.000      1.000 0.000 0.000 0.000 1.00
#> GSM2883     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2895     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2885     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2886     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2887     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2896     3   0.000      1.000 0.000 0.000 1.000 0.00
#> GSM2888     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2889     2   0.000      1.000 0.000 1.000 0.000 0.00
#> GSM2876     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2891     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2880     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2893     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2821     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2900     1   0.000      0.942 1.000 0.000 0.000 0.00
#> GSM2903     1   0.000      0.942 1.000 0.000 0.000 0.00

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.5158      0.632 0.224 0.100 0.000 0.000 0.676
#> GSM2820     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.3707      0.741 0.000 0.716 0.000 0.000 0.284
#> GSM2832     2  0.3707      0.741 0.000 0.716 0.000 0.000 0.284
#> GSM2823     5  0.5510      0.804 0.380 0.000 0.072 0.000 0.548
#> GSM2824     5  0.5510      0.804 0.380 0.000 0.072 0.000 0.548
#> GSM2825     1  0.5975      0.363 0.572 0.124 0.000 0.004 0.300
#> GSM2826     1  0.5975      0.363 0.572 0.124 0.000 0.004 0.300
#> GSM2829     4  0.1341      0.963 0.000 0.000 0.000 0.944 0.056
#> GSM2856     4  0.1341      0.963 0.000 0.000 0.000 0.944 0.056
#> GSM2830     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> GSM2843     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> GSM2871     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> GSM2831     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.1341      0.963 0.000 0.000 0.000 0.944 0.056
#> GSM2846     4  0.1341      0.963 0.000 0.000 0.000 0.944 0.056
#> GSM2835     4  0.1410      0.961 0.000 0.000 0.000 0.940 0.060
#> GSM2858     4  0.1410      0.961 0.000 0.000 0.000 0.940 0.060
#> GSM2836     2  0.1270      0.854 0.000 0.948 0.000 0.000 0.052
#> GSM2848     2  0.1270      0.854 0.000 0.948 0.000 0.000 0.052
#> GSM2828     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.2127      0.802 0.892 0.000 0.000 0.000 0.108
#> GSM2841     1  0.2127      0.802 0.892 0.000 0.000 0.000 0.108
#> GSM2827     2  0.3452      0.868 0.000 0.756 0.000 0.000 0.244
#> GSM2842     2  0.3452      0.868 0.000 0.756 0.000 0.000 0.244
#> GSM2845     4  0.0162      0.975 0.000 0.000 0.000 0.996 0.004
#> GSM2872     4  0.0162      0.975 0.000 0.000 0.000 0.996 0.004
#> GSM2834     4  0.0162      0.975 0.000 0.000 0.000 0.996 0.004
#> GSM2847     4  0.0162      0.975 0.000 0.000 0.000 0.996 0.004
#> GSM2849     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.3274      0.872 0.000 0.780 0.000 0.000 0.220
#> GSM2853     2  0.3274      0.872 0.000 0.780 0.000 0.000 0.220
#> GSM2852     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2855     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2840     1  0.2127      0.802 0.892 0.000 0.000 0.000 0.108
#> GSM2857     1  0.2127      0.802 0.892 0.000 0.000 0.000 0.108
#> GSM2859     2  0.0000      0.870 0.000 1.000 0.000 0.000 0.000
#> GSM2860     2  0.0000      0.870 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.1965      0.874 0.000 0.904 0.000 0.000 0.096
#> GSM2862     2  0.0000      0.870 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000      0.870 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0000      0.870 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2  0.0000      0.870 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.0000      0.870 0.000 1.000 0.000 0.000 0.000
#> GSM2868     2  0.3242      0.872 0.000 0.784 0.000 0.000 0.216
#> GSM2869     2  0.3242      0.872 0.000 0.784 0.000 0.000 0.216
#> GSM2851     2  0.3274      0.872 0.000 0.780 0.000 0.000 0.220
#> GSM2867     2  0.3242      0.872 0.000 0.784 0.000 0.000 0.216
#> GSM2870     2  0.3274      0.872 0.000 0.780 0.000 0.000 0.220
#> GSM2854     4  0.1732      0.948 0.000 0.000 0.000 0.920 0.080
#> GSM2873     2  0.2605      0.801 0.000 0.852 0.000 0.000 0.148
#> GSM2874     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2879     3  0.0290      0.993 0.000 0.000 0.992 0.000 0.008
#> GSM2898     3  0.0290      0.993 0.000 0.000 0.992 0.000 0.008
#> GSM2881     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> GSM2894     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> GSM2883     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2885     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000
#> GSM2888     2  0.3305      0.873 0.000 0.776 0.000 0.000 0.224
#> GSM2889     2  0.3305      0.873 0.000 0.776 0.000 0.000 0.224
#> GSM2876     1  0.0290      0.855 0.992 0.000 0.000 0.000 0.008
#> GSM2891     1  0.0290      0.855 0.992 0.000 0.000 0.000 0.008
#> GSM2880     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.4287      0.809 0.460 0.000 0.000 0.000 0.540
#> GSM2900     5  0.4287      0.809 0.460 0.000 0.000 0.000 0.540
#> GSM2903     5  0.4287      0.809 0.460 0.000 0.000 0.000 0.540

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.5341     0.7312 0.140 0.136 0.000 0.000 0.676 0.048
#> GSM2820     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     2  0.5972    -0.0427 0.000 0.452 0.000 0.004 0.200 0.344
#> GSM2832     2  0.5972    -0.0427 0.000 0.452 0.000 0.004 0.200 0.344
#> GSM2823     5  0.4839     0.8125 0.228 0.072 0.020 0.000 0.680 0.000
#> GSM2824     5  0.4839     0.8125 0.228 0.072 0.020 0.000 0.680 0.000
#> GSM2825     2  0.7446    -0.1377 0.244 0.396 0.000 0.008 0.244 0.108
#> GSM2826     2  0.7446    -0.1377 0.244 0.396 0.000 0.008 0.244 0.108
#> GSM2829     4  0.1921     0.9249 0.000 0.052 0.000 0.916 0.032 0.000
#> GSM2856     4  0.1921     0.9249 0.000 0.052 0.000 0.916 0.032 0.000
#> GSM2830     4  0.1092     0.9368 0.000 0.020 0.000 0.960 0.020 0.000
#> GSM2843     4  0.1092     0.9368 0.000 0.020 0.000 0.960 0.020 0.000
#> GSM2871     4  0.1176     0.9357 0.000 0.024 0.000 0.956 0.020 0.000
#> GSM2831     4  0.0146     0.9399 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2844     4  0.0146     0.9399 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2833     4  0.2308     0.9152 0.000 0.068 0.000 0.892 0.040 0.000
#> GSM2846     4  0.2308     0.9152 0.000 0.068 0.000 0.892 0.040 0.000
#> GSM2835     4  0.2442     0.9112 0.000 0.068 0.000 0.884 0.048 0.000
#> GSM2858     4  0.2442     0.9112 0.000 0.068 0.000 0.884 0.048 0.000
#> GSM2836     6  0.3042     0.7294 0.000 0.128 0.000 0.004 0.032 0.836
#> GSM2848     6  0.3155     0.7260 0.000 0.132 0.000 0.004 0.036 0.828
#> GSM2828     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     1  0.4237     0.7066 0.736 0.144 0.000 0.000 0.120 0.000
#> GSM2841     1  0.4237     0.7066 0.736 0.144 0.000 0.000 0.120 0.000
#> GSM2827     2  0.5044     0.3898 0.000 0.536 0.000 0.000 0.080 0.384
#> GSM2842     2  0.4905     0.4455 0.000 0.580 0.000 0.000 0.076 0.344
#> GSM2845     4  0.1176     0.9357 0.000 0.024 0.000 0.956 0.020 0.000
#> GSM2872     4  0.1176     0.9357 0.000 0.024 0.000 0.956 0.020 0.000
#> GSM2834     4  0.1261     0.9366 0.000 0.024 0.000 0.952 0.024 0.000
#> GSM2847     4  0.1261     0.9366 0.000 0.024 0.000 0.952 0.024 0.000
#> GSM2849     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.3843     0.5745 0.000 0.548 0.000 0.000 0.000 0.452
#> GSM2853     2  0.3843     0.5745 0.000 0.548 0.000 0.000 0.000 0.452
#> GSM2852     3  0.0146     0.9846 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM2855     3  0.0146     0.9846 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM2840     1  0.4237     0.7066 0.736 0.144 0.000 0.000 0.120 0.000
#> GSM2857     1  0.4237     0.7066 0.736 0.144 0.000 0.000 0.120 0.000
#> GSM2859     6  0.0000     0.8714 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2860     6  0.0000     0.8714 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2861     6  0.1610     0.7267 0.000 0.084 0.000 0.000 0.000 0.916
#> GSM2862     6  0.0000     0.8714 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2863     6  0.0000     0.8714 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2864     6  0.0000     0.8714 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2865     6  0.0000     0.8714 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2866     6  0.0000     0.8714 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2868     2  0.3843     0.5745 0.000 0.548 0.000 0.000 0.000 0.452
#> GSM2869     2  0.3843     0.5745 0.000 0.548 0.000 0.000 0.000 0.452
#> GSM2851     2  0.3843     0.5745 0.000 0.548 0.000 0.000 0.000 0.452
#> GSM2867     2  0.3843     0.5745 0.000 0.548 0.000 0.000 0.000 0.452
#> GSM2870     2  0.3843     0.5745 0.000 0.548 0.000 0.000 0.000 0.452
#> GSM2854     4  0.3123     0.8705 0.000 0.112 0.000 0.832 0.056 0.000
#> GSM2873     6  0.4796     0.4559 0.000 0.260 0.000 0.004 0.084 0.652
#> GSM2874     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     3  0.2361     0.8860 0.000 0.028 0.884 0.000 0.088 0.000
#> GSM2898     3  0.2361     0.8860 0.000 0.028 0.884 0.000 0.088 0.000
#> GSM2881     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0291     0.9400 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM2894     4  0.0291     0.9400 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM2883     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000     0.9872 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.4157     0.5611 0.000 0.544 0.000 0.000 0.012 0.444
#> GSM2889     2  0.4157     0.5611 0.000 0.544 0.000 0.000 0.012 0.444
#> GSM2876     1  0.0260     0.8911 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM2891     1  0.0260     0.8911 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM2880     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.3547     0.8237 0.332 0.000 0.000 0.000 0.668 0.000
#> GSM2900     5  0.3547     0.8237 0.332 0.000 0.000 0.000 0.668 0.000
#> GSM2903     5  0.3547     0.8237 0.332 0.000 0.000 0.000 0.668 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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 tissue(p) k
#> MAD:skmeans 83  3.39e-05 2
#> MAD:skmeans 64  1.46e-07 3
#> MAD:skmeans 83  4.22e-12 4
#> MAD:skmeans 82  3.49e-15 5
#> MAD:skmeans 77  8.02e-18 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.491           0.806       0.827         0.3457 0.646   0.646
#> 3 3 1.000           0.984       0.994         0.7006 0.766   0.637
#> 4 4 0.862           0.805       0.930         0.2623 0.837   0.605
#> 5 5 0.925           0.831       0.932         0.0346 0.917   0.707
#> 6 6 0.876           0.820       0.914         0.0199 0.987   0.946

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>         class entropy silhouette    p1    p2
#> GSM2819     1  0.9710      0.820 0.600 0.400
#> GSM2820     2  0.0000      0.999 0.000 1.000
#> GSM2822     1  0.9710      0.820 0.600 0.400
#> GSM2832     1  0.9710      0.820 0.600 0.400
#> GSM2823     1  0.9710      0.820 0.600 0.400
#> GSM2824     1  0.9710      0.820 0.600 0.400
#> GSM2825     1  0.9686      0.817 0.604 0.396
#> GSM2826     1  0.9686      0.817 0.604 0.396
#> GSM2829     1  0.9710      0.820 0.600 0.400
#> GSM2856     1  0.9710      0.820 0.600 0.400
#> GSM2830     1  0.9710      0.820 0.600 0.400
#> GSM2843     1  0.9710      0.820 0.600 0.400
#> GSM2871     1  0.9710      0.820 0.600 0.400
#> GSM2831     1  0.9710      0.820 0.600 0.400
#> GSM2844     1  0.9710      0.820 0.600 0.400
#> GSM2833     1  0.9710      0.820 0.600 0.400
#> GSM2846     1  0.9710      0.820 0.600 0.400
#> GSM2835     1  0.9710      0.820 0.600 0.400
#> GSM2858     1  0.9710      0.820 0.600 0.400
#> GSM2836     1  0.9710      0.820 0.600 0.400
#> GSM2848     1  0.9710      0.820 0.600 0.400
#> GSM2828     2  0.0000      0.999 0.000 1.000
#> GSM2837     2  0.0000      0.999 0.000 1.000
#> GSM2839     1  0.0000      0.560 1.000 0.000
#> GSM2841     1  0.0000      0.560 1.000 0.000
#> GSM2827     1  0.9710      0.820 0.600 0.400
#> GSM2842     1  0.9710      0.820 0.600 0.400
#> GSM2845     1  0.9710      0.820 0.600 0.400
#> GSM2872     1  0.9710      0.820 0.600 0.400
#> GSM2834     1  0.9710      0.820 0.600 0.400
#> GSM2847     1  0.9710      0.820 0.600 0.400
#> GSM2849     2  0.0000      0.999 0.000 1.000
#> GSM2850     2  0.0000      0.999 0.000 1.000
#> GSM2838     1  0.9710      0.820 0.600 0.400
#> GSM2853     1  0.9710      0.820 0.600 0.400
#> GSM2852     2  0.0000      0.999 0.000 1.000
#> GSM2855     2  0.0000      0.999 0.000 1.000
#> GSM2840     1  0.0000      0.560 1.000 0.000
#> GSM2857     1  0.0000      0.560 1.000 0.000
#> GSM2859     1  0.9710      0.820 0.600 0.400
#> GSM2860     1  0.9710      0.820 0.600 0.400
#> GSM2861     1  0.9710      0.820 0.600 0.400
#> GSM2862     1  0.9710      0.820 0.600 0.400
#> GSM2863     1  0.9710      0.820 0.600 0.400
#> GSM2864     1  0.9710      0.820 0.600 0.400
#> GSM2865     1  0.9710      0.820 0.600 0.400
#> GSM2866     1  0.9710      0.820 0.600 0.400
#> GSM2868     1  0.9710      0.820 0.600 0.400
#> GSM2869     1  0.9710      0.820 0.600 0.400
#> GSM2851     1  0.9710      0.820 0.600 0.400
#> GSM2867     1  0.9710      0.820 0.600 0.400
#> GSM2870     1  0.9710      0.820 0.600 0.400
#> GSM2854     1  0.9710      0.820 0.600 0.400
#> GSM2873     1  0.9710      0.820 0.600 0.400
#> GSM2874     2  0.0000      0.999 0.000 1.000
#> GSM2884     2  0.0000      0.999 0.000 1.000
#> GSM2875     1  0.0000      0.560 1.000 0.000
#> GSM2890     1  0.0000      0.560 1.000 0.000
#> GSM2877     1  0.0000      0.560 1.000 0.000
#> GSM2892     1  0.0000      0.560 1.000 0.000
#> GSM2902     1  0.0000      0.560 1.000 0.000
#> GSM2878     1  0.0000      0.560 1.000 0.000
#> GSM2901     1  0.0000      0.560 1.000 0.000
#> GSM2879     2  0.0376      0.993 0.004 0.996
#> GSM2898     2  0.0938      0.981 0.012 0.988
#> GSM2881     2  0.0000      0.999 0.000 1.000
#> GSM2897     2  0.0000      0.999 0.000 1.000
#> GSM2882     1  0.9710      0.820 0.600 0.400
#> GSM2894     1  0.9710      0.820 0.600 0.400
#> GSM2883     2  0.0000      0.999 0.000 1.000
#> GSM2895     2  0.0000      0.999 0.000 1.000
#> GSM2885     2  0.0000      0.999 0.000 1.000
#> GSM2886     2  0.0000      0.999 0.000 1.000
#> GSM2887     2  0.0000      0.999 0.000 1.000
#> GSM2896     2  0.0000      0.999 0.000 1.000
#> GSM2888     1  0.9710      0.820 0.600 0.400
#> GSM2889     1  0.9710      0.820 0.600 0.400
#> GSM2876     1  0.0000      0.560 1.000 0.000
#> GSM2891     1  0.0000      0.560 1.000 0.000
#> GSM2880     1  0.0000      0.560 1.000 0.000
#> GSM2893     1  0.0000      0.560 1.000 0.000
#> GSM2821     1  0.8016      0.702 0.756 0.244
#> GSM2900     1  0.0672      0.564 0.992 0.008
#> GSM2903     1  0.0938      0.566 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2 p3
#> GSM2819     2   0.000      0.995 0.000 1.000  0
#> GSM2820     3   0.000      1.000 0.000 0.000  1
#> GSM2822     2   0.000      0.995 0.000 1.000  0
#> GSM2832     2   0.000      0.995 0.000 1.000  0
#> GSM2823     2   0.000      0.995 0.000 1.000  0
#> GSM2824     2   0.000      0.995 0.000 1.000  0
#> GSM2825     2   0.000      0.995 0.000 1.000  0
#> GSM2826     2   0.000      0.995 0.000 1.000  0
#> GSM2829     2   0.000      0.995 0.000 1.000  0
#> GSM2856     2   0.000      0.995 0.000 1.000  0
#> GSM2830     2   0.000      0.995 0.000 1.000  0
#> GSM2843     2   0.000      0.995 0.000 1.000  0
#> GSM2871     2   0.000      0.995 0.000 1.000  0
#> GSM2831     2   0.000      0.995 0.000 1.000  0
#> GSM2844     2   0.000      0.995 0.000 1.000  0
#> GSM2833     2   0.000      0.995 0.000 1.000  0
#> GSM2846     2   0.000      0.995 0.000 1.000  0
#> GSM2835     2   0.000      0.995 0.000 1.000  0
#> GSM2858     2   0.000      0.995 0.000 1.000  0
#> GSM2836     2   0.000      0.995 0.000 1.000  0
#> GSM2848     2   0.000      0.995 0.000 1.000  0
#> GSM2828     3   0.000      1.000 0.000 0.000  1
#> GSM2837     3   0.000      1.000 0.000 0.000  1
#> GSM2839     1   0.000      0.974 1.000 0.000  0
#> GSM2841     1   0.000      0.974 1.000 0.000  0
#> GSM2827     2   0.000      0.995 0.000 1.000  0
#> GSM2842     2   0.000      0.995 0.000 1.000  0
#> GSM2845     2   0.000      0.995 0.000 1.000  0
#> GSM2872     2   0.000      0.995 0.000 1.000  0
#> GSM2834     2   0.000      0.995 0.000 1.000  0
#> GSM2847     2   0.000      0.995 0.000 1.000  0
#> GSM2849     3   0.000      1.000 0.000 0.000  1
#> GSM2850     3   0.000      1.000 0.000 0.000  1
#> GSM2838     2   0.000      0.995 0.000 1.000  0
#> GSM2853     2   0.000      0.995 0.000 1.000  0
#> GSM2852     3   0.000      1.000 0.000 0.000  1
#> GSM2855     3   0.000      1.000 0.000 0.000  1
#> GSM2840     1   0.000      0.974 1.000 0.000  0
#> GSM2857     1   0.000      0.974 1.000 0.000  0
#> GSM2859     2   0.000      0.995 0.000 1.000  0
#> GSM2860     2   0.000      0.995 0.000 1.000  0
#> GSM2861     2   0.000      0.995 0.000 1.000  0
#> GSM2862     2   0.000      0.995 0.000 1.000  0
#> GSM2863     2   0.000      0.995 0.000 1.000  0
#> GSM2864     2   0.000      0.995 0.000 1.000  0
#> GSM2865     2   0.000      0.995 0.000 1.000  0
#> GSM2866     2   0.000      0.995 0.000 1.000  0
#> GSM2868     2   0.000      0.995 0.000 1.000  0
#> GSM2869     2   0.000      0.995 0.000 1.000  0
#> GSM2851     2   0.000      0.995 0.000 1.000  0
#> GSM2867     2   0.000      0.995 0.000 1.000  0
#> GSM2870     2   0.000      0.995 0.000 1.000  0
#> GSM2854     2   0.000      0.995 0.000 1.000  0
#> GSM2873     2   0.000      0.995 0.000 1.000  0
#> GSM2874     3   0.000      1.000 0.000 0.000  1
#> GSM2884     3   0.000      1.000 0.000 0.000  1
#> GSM2875     1   0.000      0.974 1.000 0.000  0
#> GSM2890     1   0.000      0.974 1.000 0.000  0
#> GSM2877     1   0.000      0.974 1.000 0.000  0
#> GSM2892     1   0.000      0.974 1.000 0.000  0
#> GSM2902     1   0.000      0.974 1.000 0.000  0
#> GSM2878     1   0.000      0.974 1.000 0.000  0
#> GSM2901     1   0.000      0.974 1.000 0.000  0
#> GSM2879     3   0.000      1.000 0.000 0.000  1
#> GSM2898     3   0.000      1.000 0.000 0.000  1
#> GSM2881     3   0.000      1.000 0.000 0.000  1
#> GSM2897     3   0.000      1.000 0.000 0.000  1
#> GSM2882     2   0.000      0.995 0.000 1.000  0
#> GSM2894     2   0.000      0.995 0.000 1.000  0
#> GSM2883     3   0.000      1.000 0.000 0.000  1
#> GSM2895     3   0.000      1.000 0.000 0.000  1
#> GSM2885     3   0.000      1.000 0.000 0.000  1
#> GSM2886     3   0.000      1.000 0.000 0.000  1
#> GSM2887     3   0.000      1.000 0.000 0.000  1
#> GSM2896     3   0.000      1.000 0.000 0.000  1
#> GSM2888     2   0.000      0.995 0.000 1.000  0
#> GSM2889     2   0.000      0.995 0.000 1.000  0
#> GSM2876     1   0.000      0.974 1.000 0.000  0
#> GSM2891     1   0.000      0.974 1.000 0.000  0
#> GSM2880     1   0.000      0.974 1.000 0.000  0
#> GSM2893     1   0.000      0.974 1.000 0.000  0
#> GSM2821     2   0.484      0.702 0.224 0.776  0
#> GSM2900     1   0.348      0.828 0.872 0.128  0
#> GSM2903     1   0.424      0.765 0.824 0.176  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2 p3    p4
#> GSM2819     2  0.2704     0.7654 0.000 0.876  0 0.124
#> GSM2820     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2822     4  0.5000     0.0517 0.000 0.496  0 0.504
#> GSM2832     2  0.5000    -0.1150 0.000 0.500  0 0.500
#> GSM2823     4  0.5000     0.0517 0.000 0.496  0 0.504
#> GSM2824     2  0.4992    -0.0271 0.000 0.524  0 0.476
#> GSM2825     4  0.5000     0.0517 0.000 0.496  0 0.504
#> GSM2826     2  0.5000    -0.1008 0.000 0.504  0 0.496
#> GSM2829     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2856     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2830     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2843     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2871     2  0.4992    -0.0236 0.000 0.524  0 0.476
#> GSM2831     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2844     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2833     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2846     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2835     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2858     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2836     2  0.2081     0.8041 0.000 0.916  0 0.084
#> GSM2848     2  0.3266     0.7100 0.000 0.832  0 0.168
#> GSM2828     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2837     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2839     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2841     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2827     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2842     2  0.0188     0.8676 0.000 0.996  0 0.004
#> GSM2845     4  0.4679     0.4225 0.000 0.352  0 0.648
#> GSM2872     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2834     4  0.4761     0.3827 0.000 0.372  0 0.628
#> GSM2847     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2849     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2850     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2838     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2853     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2852     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2855     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2840     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2857     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2859     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2860     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2861     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2862     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2863     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2864     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2865     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2866     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2868     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2869     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2851     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2867     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2870     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2854     4  0.1389     0.7966 0.000 0.048  0 0.952
#> GSM2873     4  0.5000     0.0517 0.000 0.496  0 0.504
#> GSM2874     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2884     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2875     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2890     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2877     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2892     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2902     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2878     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2901     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2879     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2898     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2881     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2897     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2882     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2894     4  0.0000     0.8289 0.000 0.000  0 1.000
#> GSM2883     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2895     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2885     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2886     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2887     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2896     3  0.0000     1.0000 0.000 0.000  1 0.000
#> GSM2888     2  0.0188     0.8676 0.000 0.996  0 0.004
#> GSM2889     2  0.0000     0.8699 0.000 1.000  0 0.000
#> GSM2876     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2891     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2880     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2893     1  0.0000     0.9777 1.000 0.000  0 0.000
#> GSM2821     2  0.7010     0.3863 0.184 0.576  0 0.240
#> GSM2900     1  0.4259     0.8129 0.816 0.128  0 0.056
#> GSM2903     1  0.4410     0.7885 0.808 0.064  0 0.128

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2 p3    p4    p5
#> GSM2819     5  0.1741      0.920 0.000 0.040  0 0.024 0.936
#> GSM2820     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2822     2  0.4304      0.191 0.000 0.516  0 0.484 0.000
#> GSM2832     2  0.4302      0.202 0.000 0.520  0 0.480 0.000
#> GSM2823     2  0.4560      0.175 0.000 0.508  0 0.484 0.008
#> GSM2824     4  0.6779      0.113 0.000 0.300  0 0.392 0.308
#> GSM2825     2  0.4304      0.191 0.000 0.516  0 0.484 0.000
#> GSM2826     2  0.4300      0.212 0.000 0.524  0 0.476 0.000
#> GSM2829     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2856     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2830     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2843     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2871     2  0.4294      0.227 0.000 0.532  0 0.468 0.000
#> GSM2831     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2844     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2833     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2846     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2835     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2858     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2836     2  0.1792      0.773 0.000 0.916  0 0.084 0.000
#> GSM2848     2  0.2690      0.718 0.000 0.844  0 0.156 0.000
#> GSM2828     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2839     1  0.1478      0.957 0.936 0.000  0 0.000 0.064
#> GSM2841     1  0.1478      0.957 0.936 0.000  0 0.000 0.064
#> GSM2827     2  0.0162      0.819 0.000 0.996  0 0.000 0.004
#> GSM2842     2  0.0771      0.818 0.000 0.976  0 0.004 0.020
#> GSM2845     4  0.4015      0.341 0.000 0.348  0 0.652 0.000
#> GSM2872     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2834     4  0.4138      0.229 0.000 0.384  0 0.616 0.000
#> GSM2847     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2849     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2838     2  0.0609      0.818 0.000 0.980  0 0.000 0.020
#> GSM2853     2  0.0609      0.818 0.000 0.980  0 0.000 0.020
#> GSM2852     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2855     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2840     1  0.1478      0.957 0.936 0.000  0 0.000 0.064
#> GSM2857     1  0.1478      0.957 0.936 0.000  0 0.000 0.064
#> GSM2859     2  0.0000      0.818 0.000 1.000  0 0.000 0.000
#> GSM2860     2  0.0000      0.818 0.000 1.000  0 0.000 0.000
#> GSM2861     2  0.0000      0.818 0.000 1.000  0 0.000 0.000
#> GSM2862     2  0.0000      0.818 0.000 1.000  0 0.000 0.000
#> GSM2863     2  0.0000      0.818 0.000 1.000  0 0.000 0.000
#> GSM2864     2  0.0000      0.818 0.000 1.000  0 0.000 0.000
#> GSM2865     2  0.0000      0.818 0.000 1.000  0 0.000 0.000
#> GSM2866     2  0.0000      0.818 0.000 1.000  0 0.000 0.000
#> GSM2868     2  0.0609      0.818 0.000 0.980  0 0.000 0.020
#> GSM2869     2  0.0609      0.818 0.000 0.980  0 0.000 0.020
#> GSM2851     2  0.0609      0.818 0.000 0.980  0 0.000 0.020
#> GSM2867     2  0.0609      0.818 0.000 0.980  0 0.000 0.020
#> GSM2870     2  0.0609      0.818 0.000 0.980  0 0.000 0.020
#> GSM2854     4  0.1197      0.850 0.000 0.048  0 0.952 0.000
#> GSM2873     2  0.4304      0.191 0.000 0.516  0 0.484 0.000
#> GSM2874     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2875     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2890     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2877     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2892     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2902     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2878     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2901     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2879     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2898     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2881     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2882     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2894     4  0.0000      0.896 0.000 0.000  0 1.000 0.000
#> GSM2883     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2895     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> GSM2888     2  0.0771      0.818 0.000 0.976  0 0.004 0.020
#> GSM2889     2  0.0609      0.818 0.000 0.980  0 0.000 0.020
#> GSM2876     1  0.1478      0.957 0.936 0.000  0 0.000 0.064
#> GSM2891     1  0.1478      0.957 0.936 0.000  0 0.000 0.064
#> GSM2880     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2893     1  0.0000      0.972 1.000 0.000  0 0.000 0.000
#> GSM2821     5  0.0000      0.962 0.000 0.000  0 0.000 1.000
#> GSM2900     5  0.0510      0.964 0.016 0.000  0 0.000 0.984
#> GSM2903     5  0.0510      0.964 0.016 0.000  0 0.000 0.984

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.0363     0.9824 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM2820     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     2  0.3997     0.2049 0.000 0.508 0.000 0.488 0.000 0.004
#> GSM2832     2  0.3866     0.2160 0.000 0.516 0.000 0.484 0.000 0.000
#> GSM2823     2  0.4097     0.1912 0.000 0.504 0.000 0.488 0.008 0.000
#> GSM2824     4  0.6317     0.0319 0.000 0.308 0.000 0.376 0.308 0.008
#> GSM2825     2  0.4184     0.1844 0.000 0.500 0.000 0.488 0.000 0.012
#> GSM2826     2  0.4183     0.2080 0.000 0.508 0.000 0.480 0.000 0.012
#> GSM2829     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2843     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2871     2  0.4175     0.2547 0.000 0.524 0.000 0.464 0.000 0.012
#> GSM2831     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2846     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2835     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     2  0.3372     0.7582 0.000 0.816 0.000 0.084 0.000 0.100
#> GSM2848     2  0.3920     0.7162 0.000 0.764 0.000 0.148 0.000 0.088
#> GSM2828     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     6  0.2346     1.0000 0.124 0.000 0.000 0.000 0.008 0.868
#> GSM2841     6  0.2346     1.0000 0.124 0.000 0.000 0.000 0.008 0.868
#> GSM2827     2  0.1663     0.7853 0.000 0.912 0.000 0.000 0.000 0.088
#> GSM2842     2  0.0405     0.7843 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM2845     4  0.3620     0.3050 0.000 0.352 0.000 0.648 0.000 0.000
#> GSM2872     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2834     4  0.3717     0.1959 0.000 0.384 0.000 0.616 0.000 0.000
#> GSM2847     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2849     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2853     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2852     3  0.0260     0.9907 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM2855     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2840     6  0.2346     1.0000 0.124 0.000 0.000 0.000 0.008 0.868
#> GSM2857     6  0.2346     1.0000 0.124 0.000 0.000 0.000 0.008 0.868
#> GSM2859     2  0.2048     0.7832 0.000 0.880 0.000 0.000 0.000 0.120
#> GSM2860     2  0.2048     0.7832 0.000 0.880 0.000 0.000 0.000 0.120
#> GSM2861     2  0.2048     0.7832 0.000 0.880 0.000 0.000 0.000 0.120
#> GSM2862     2  0.2048     0.7832 0.000 0.880 0.000 0.000 0.000 0.120
#> GSM2863     2  0.2048     0.7832 0.000 0.880 0.000 0.000 0.000 0.120
#> GSM2864     2  0.2048     0.7832 0.000 0.880 0.000 0.000 0.000 0.120
#> GSM2865     2  0.2048     0.7832 0.000 0.880 0.000 0.000 0.000 0.120
#> GSM2866     2  0.2048     0.7832 0.000 0.880 0.000 0.000 0.000 0.120
#> GSM2868     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2869     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2851     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2867     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2870     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2854     4  0.1075     0.8510 0.000 0.048 0.000 0.952 0.000 0.000
#> GSM2873     2  0.3867     0.2051 0.000 0.512 0.000 0.488 0.000 0.000
#> GSM2874     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2898     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2881     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2894     4  0.0000     0.8958 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2883     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000     0.9995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2889     2  0.0363     0.7837 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM2876     1  0.2669     0.7919 0.836 0.000 0.000 0.000 0.008 0.156
#> GSM2891     1  0.2706     0.7865 0.832 0.000 0.000 0.000 0.008 0.160
#> GSM2880     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000     0.9605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.0000     0.9941 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM2900     5  0.0000     0.9941 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM2903     5  0.0000     0.9941 0.000 0.000 0.000 0.000 1.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-pam-collect-classes

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

test_to_known_factors(res)
#>          n tissue(p) k
#> MAD:pam 84  2.53e-05 2
#> MAD:pam 84  2.34e-08 3
#> MAD:pam 73  4.97e-10 4
#> MAD:pam 74  3.22e-13 5
#> MAD:pam 74  4.81e-16 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.279           0.886       0.894         0.5045 0.497   0.497
#> 3 3 0.981           0.919       0.954         0.2655 0.824   0.659
#> 4 4 0.718           0.779       0.886         0.1384 0.803   0.517
#> 5 5 0.830           0.643       0.827         0.0875 0.936   0.761
#> 6 6 0.849           0.672       0.846         0.0387 0.906   0.607

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
#> GSM2819     1  0.7674      0.815 0.776 0.224
#> GSM2820     2  0.5178      0.897 0.116 0.884
#> GSM2822     1  0.5629      0.877 0.868 0.132
#> GSM2832     1  0.5629      0.877 0.868 0.132
#> GSM2823     2  0.0376      0.867 0.004 0.996
#> GSM2824     2  0.0376      0.867 0.004 0.996
#> GSM2825     1  0.8555      0.711 0.720 0.280
#> GSM2826     1  0.8555      0.711 0.720 0.280
#> GSM2829     1  0.0000      0.893 1.000 0.000
#> GSM2856     1  0.0000      0.893 1.000 0.000
#> GSM2830     1  0.0000      0.893 1.000 0.000
#> GSM2843     1  0.0000      0.893 1.000 0.000
#> GSM2871     1  0.0000      0.893 1.000 0.000
#> GSM2831     1  0.0000      0.893 1.000 0.000
#> GSM2844     1  0.0000      0.893 1.000 0.000
#> GSM2833     1  0.0000      0.893 1.000 0.000
#> GSM2846     1  0.0000      0.893 1.000 0.000
#> GSM2835     1  0.0000      0.893 1.000 0.000
#> GSM2858     1  0.0000      0.893 1.000 0.000
#> GSM2836     1  0.6048      0.883 0.852 0.148
#> GSM2848     1  0.6247      0.885 0.844 0.156
#> GSM2828     2  0.5178      0.897 0.116 0.884
#> GSM2837     2  0.5178      0.897 0.116 0.884
#> GSM2839     2  0.4815      0.891 0.104 0.896
#> GSM2841     2  0.4815      0.891 0.104 0.896
#> GSM2827     1  0.2948      0.890 0.948 0.052
#> GSM2842     1  0.4690      0.894 0.900 0.100
#> GSM2845     1  0.0000      0.893 1.000 0.000
#> GSM2872     1  0.0000      0.893 1.000 0.000
#> GSM2834     1  0.0000      0.893 1.000 0.000
#> GSM2847     1  0.0000      0.893 1.000 0.000
#> GSM2849     2  0.5178      0.897 0.116 0.884
#> GSM2850     2  0.5178      0.897 0.116 0.884
#> GSM2838     1  0.7602      0.889 0.780 0.220
#> GSM2853     1  0.7602      0.889 0.780 0.220
#> GSM2852     2  0.5178      0.897 0.116 0.884
#> GSM2855     2  0.5178      0.897 0.116 0.884
#> GSM2840     2  0.4815      0.891 0.104 0.896
#> GSM2857     2  0.4815      0.891 0.104 0.896
#> GSM2859     1  0.7602      0.889 0.780 0.220
#> GSM2860     1  0.7602      0.889 0.780 0.220
#> GSM2861     1  0.7602      0.889 0.780 0.220
#> GSM2862     1  0.7602      0.889 0.780 0.220
#> GSM2863     1  0.7602      0.889 0.780 0.220
#> GSM2864     1  0.7602      0.889 0.780 0.220
#> GSM2865     1  0.7602      0.889 0.780 0.220
#> GSM2866     1  0.7602      0.889 0.780 0.220
#> GSM2868     1  0.7602      0.889 0.780 0.220
#> GSM2869     1  0.7602      0.889 0.780 0.220
#> GSM2851     1  0.7602      0.889 0.780 0.220
#> GSM2867     1  0.7602      0.889 0.780 0.220
#> GSM2870     1  0.7602      0.889 0.780 0.220
#> GSM2854     1  0.0000      0.893 1.000 0.000
#> GSM2873     1  0.3114      0.890 0.944 0.056
#> GSM2874     2  0.5178      0.897 0.116 0.884
#> GSM2884     2  0.5178      0.897 0.116 0.884
#> GSM2875     2  0.4815      0.891 0.104 0.896
#> GSM2890     2  0.4815      0.891 0.104 0.896
#> GSM2877     2  0.4815      0.891 0.104 0.896
#> GSM2892     2  0.4815      0.891 0.104 0.896
#> GSM2902     2  0.4815      0.891 0.104 0.896
#> GSM2878     2  0.4815      0.891 0.104 0.896
#> GSM2901     2  0.4815      0.891 0.104 0.896
#> GSM2879     2  0.5178      0.897 0.116 0.884
#> GSM2898     2  0.5178      0.897 0.116 0.884
#> GSM2881     2  0.5178      0.897 0.116 0.884
#> GSM2897     2  0.5178      0.897 0.116 0.884
#> GSM2882     1  0.0000      0.893 1.000 0.000
#> GSM2894     1  0.0000      0.893 1.000 0.000
#> GSM2883     2  0.5178      0.897 0.116 0.884
#> GSM2895     2  0.5178      0.897 0.116 0.884
#> GSM2885     2  0.5178      0.897 0.116 0.884
#> GSM2886     2  0.5178      0.897 0.116 0.884
#> GSM2887     2  0.5178      0.897 0.116 0.884
#> GSM2896     2  0.5178      0.897 0.116 0.884
#> GSM2888     1  0.7602      0.889 0.780 0.220
#> GSM2889     1  0.7602      0.889 0.780 0.220
#> GSM2876     2  0.4815      0.891 0.104 0.896
#> GSM2891     2  0.4815      0.891 0.104 0.896
#> GSM2880     2  0.4815      0.891 0.104 0.896
#> GSM2893     2  0.4815      0.891 0.104 0.896
#> GSM2821     2  0.4815      0.891 0.104 0.896
#> GSM2900     2  0.4815      0.891 0.104 0.896
#> GSM2903     2  0.4815      0.891 0.104 0.896

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     1  0.1860     0.9149 0.948 0.052 0.000
#> GSM2820     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2822     1  0.6008     0.4148 0.628 0.372 0.000
#> GSM2832     2  0.6302     0.0193 0.480 0.520 0.000
#> GSM2823     3  0.6330     0.4748 0.396 0.004 0.600
#> GSM2824     3  0.6330     0.4748 0.396 0.004 0.600
#> GSM2825     1  0.2165     0.9041 0.936 0.064 0.000
#> GSM2826     1  0.2165     0.9041 0.936 0.064 0.000
#> GSM2829     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2856     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2830     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2843     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2871     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2831     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2844     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2833     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2846     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2835     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2858     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2836     2  0.0475     0.9620 0.004 0.992 0.004
#> GSM2848     2  0.0475     0.9620 0.004 0.992 0.004
#> GSM2828     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2837     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2839     1  0.0000     0.9630 1.000 0.000 0.000
#> GSM2841     1  0.0000     0.9630 1.000 0.000 0.000
#> GSM2827     2  0.0892     0.9573 0.020 0.980 0.000
#> GSM2842     2  0.0892     0.9573 0.020 0.980 0.000
#> GSM2845     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2872     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2834     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2847     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2849     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2850     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2838     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2853     2  0.1015     0.9601 0.012 0.980 0.008
#> GSM2852     3  0.3670     0.9079 0.092 0.020 0.888
#> GSM2855     3  0.3670     0.9079 0.092 0.020 0.888
#> GSM2840     1  0.0000     0.9630 1.000 0.000 0.000
#> GSM2857     1  0.0000     0.9630 1.000 0.000 0.000
#> GSM2859     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2860     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2861     2  0.1170     0.9589 0.008 0.976 0.016
#> GSM2862     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2863     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2864     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2865     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2866     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2868     2  0.2229     0.9367 0.012 0.944 0.044
#> GSM2869     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2851     2  0.0848     0.9613 0.008 0.984 0.008
#> GSM2867     2  0.1182     0.9589 0.012 0.976 0.012
#> GSM2870     2  0.1015     0.9604 0.008 0.980 0.012
#> GSM2854     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2873     2  0.0424     0.9615 0.008 0.992 0.000
#> GSM2874     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2884     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2875     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2890     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2877     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2892     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2902     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2878     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2901     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2879     3  0.3112     0.9121 0.096 0.004 0.900
#> GSM2898     3  0.3112     0.9121 0.096 0.004 0.900
#> GSM2881     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2897     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2882     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2894     2  0.0983     0.9632 0.004 0.980 0.016
#> GSM2883     3  0.2625     0.9188 0.084 0.000 0.916
#> GSM2895     3  0.2625     0.9188 0.084 0.000 0.916
#> GSM2885     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2886     3  0.1031     0.9402 0.024 0.000 0.976
#> GSM2887     3  0.1163     0.9389 0.028 0.000 0.972
#> GSM2896     3  0.1163     0.9389 0.028 0.000 0.972
#> GSM2888     2  0.4700     0.7681 0.008 0.812 0.180
#> GSM2889     2  0.4755     0.7623 0.008 0.808 0.184
#> GSM2876     1  0.0000     0.9630 1.000 0.000 0.000
#> GSM2891     1  0.0000     0.9630 1.000 0.000 0.000
#> GSM2880     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2893     1  0.0237     0.9630 0.996 0.000 0.004
#> GSM2821     1  0.0000     0.9630 1.000 0.000 0.000
#> GSM2900     1  0.0000     0.9630 1.000 0.000 0.000
#> GSM2903     1  0.0000     0.9630 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     1  0.4214     0.7095 0.780 0.204 0.000 0.016
#> GSM2820     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2822     1  0.6156     0.3521 0.592 0.344 0.000 0.064
#> GSM2832     1  0.6263     0.3107 0.576 0.356 0.000 0.068
#> GSM2823     1  0.5873     0.6090 0.668 0.256 0.076 0.000
#> GSM2824     1  0.5873     0.6090 0.668 0.256 0.076 0.000
#> GSM2825     1  0.3610     0.7180 0.800 0.200 0.000 0.000
#> GSM2826     1  0.3610     0.7180 0.800 0.200 0.000 0.000
#> GSM2829     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2843     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2871     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2831     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2846     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2836     2  0.5383     0.7351 0.160 0.740 0.000 0.100
#> GSM2848     2  0.5339     0.7395 0.156 0.744 0.000 0.100
#> GSM2828     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0000     0.8100 1.000 0.000 0.000 0.000
#> GSM2841     1  0.0000     0.8100 1.000 0.000 0.000 0.000
#> GSM2827     2  0.7121     0.4482 0.300 0.540 0.000 0.160
#> GSM2842     2  0.6792     0.5341 0.272 0.588 0.000 0.140
#> GSM2845     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2872     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2834     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2847     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2849     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2838     2  0.1118     0.8674 0.000 0.964 0.000 0.036
#> GSM2853     2  0.1305     0.8671 0.004 0.960 0.000 0.036
#> GSM2852     1  0.7722     0.2812 0.428 0.336 0.236 0.000
#> GSM2855     1  0.7722     0.2812 0.428 0.336 0.236 0.000
#> GSM2840     1  0.0000     0.8100 1.000 0.000 0.000 0.000
#> GSM2857     1  0.0000     0.8100 1.000 0.000 0.000 0.000
#> GSM2859     2  0.1792     0.8590 0.000 0.932 0.000 0.068
#> GSM2860     2  0.1118     0.8674 0.000 0.964 0.000 0.036
#> GSM2861     2  0.2549     0.8554 0.024 0.916 0.004 0.056
#> GSM2862     2  0.1118     0.8674 0.000 0.964 0.000 0.036
#> GSM2863     2  0.1211     0.8688 0.000 0.960 0.000 0.040
#> GSM2864     2  0.1211     0.8688 0.000 0.960 0.000 0.040
#> GSM2865     2  0.1211     0.8688 0.000 0.960 0.000 0.040
#> GSM2866     2  0.3082     0.8433 0.032 0.884 0.000 0.084
#> GSM2868     2  0.1211     0.8688 0.000 0.960 0.000 0.040
#> GSM2869     2  0.1211     0.8688 0.000 0.960 0.000 0.040
#> GSM2851     2  0.1302     0.8683 0.000 0.956 0.000 0.044
#> GSM2867     2  0.1211     0.8688 0.000 0.960 0.000 0.040
#> GSM2870     2  0.1302     0.8683 0.000 0.956 0.000 0.044
#> GSM2854     4  0.1022     0.9614 0.000 0.032 0.000 0.968
#> GSM2873     2  0.7421     0.4463 0.268 0.512 0.000 0.220
#> GSM2874     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0592     0.8092 0.984 0.016 0.000 0.000
#> GSM2890     1  0.0592     0.8092 0.984 0.016 0.000 0.000
#> GSM2877     1  0.0592     0.8092 0.984 0.016 0.000 0.000
#> GSM2892     1  0.0592     0.8092 0.984 0.016 0.000 0.000
#> GSM2902     1  0.0592     0.8092 0.984 0.016 0.000 0.000
#> GSM2878     1  0.0592     0.8092 0.984 0.016 0.000 0.000
#> GSM2901     1  0.0592     0.8092 0.984 0.016 0.000 0.000
#> GSM2879     1  0.7711     0.2377 0.428 0.232 0.340 0.000
#> GSM2898     1  0.7711     0.2377 0.428 0.232 0.340 0.000
#> GSM2881     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000     0.9978 0.000 0.000 0.000 1.000
#> GSM2883     3  0.7210    -0.0782 0.404 0.140 0.456 0.000
#> GSM2895     3  0.7210    -0.0782 0.404 0.140 0.456 0.000
#> GSM2885     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000     0.8777 0.000 0.000 1.000 0.000
#> GSM2887     3  0.3626     0.6983 0.184 0.004 0.812 0.000
#> GSM2896     3  0.3626     0.6983 0.184 0.004 0.812 0.000
#> GSM2888     2  0.5992     0.5834 0.264 0.672 0.016 0.048
#> GSM2889     2  0.6044     0.5676 0.272 0.664 0.016 0.048
#> GSM2876     1  0.0000     0.8100 1.000 0.000 0.000 0.000
#> GSM2891     1  0.0000     0.8100 1.000 0.000 0.000 0.000
#> GSM2880     1  0.0469     0.8093 0.988 0.012 0.000 0.000
#> GSM2893     1  0.0592     0.8092 0.984 0.016 0.000 0.000
#> GSM2821     1  0.2345     0.7841 0.900 0.100 0.000 0.000
#> GSM2900     1  0.2345     0.7841 0.900 0.100 0.000 0.000
#> GSM2903     1  0.2345     0.7841 0.900 0.100 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     1  0.6808     -0.437 0.368 0.308 0.000 0.000 0.324
#> GSM2820     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.6909      0.299 0.224 0.448 0.000 0.012 0.316
#> GSM2832     2  0.6909      0.299 0.224 0.448 0.000 0.012 0.316
#> GSM2823     5  0.4300      0.898 0.476 0.000 0.000 0.000 0.524
#> GSM2824     5  0.4300      0.898 0.476 0.000 0.000 0.000 0.524
#> GSM2825     1  0.6939     -0.437 0.368 0.300 0.000 0.004 0.328
#> GSM2826     1  0.6942     -0.438 0.364 0.300 0.000 0.004 0.332
#> GSM2829     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2856     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2830     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2843     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2871     4  0.4546      0.988 0.008 0.000 0.000 0.532 0.460
#> GSM2831     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2844     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2833     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2846     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2835     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2858     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2836     2  0.6643      0.413 0.196 0.516 0.000 0.012 0.276
#> GSM2848     2  0.6603      0.424 0.192 0.524 0.000 0.012 0.272
#> GSM2828     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.0162      0.294 0.996 0.004 0.000 0.000 0.000
#> GSM2841     1  0.0162      0.294 0.996 0.004 0.000 0.000 0.000
#> GSM2827     2  0.6824      0.332 0.204 0.464 0.000 0.012 0.320
#> GSM2842     2  0.6814      0.340 0.204 0.468 0.000 0.012 0.316
#> GSM2845     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2872     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2834     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2847     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2849     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0000      0.745 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2  0.0000      0.745 0.000 1.000 0.000 0.000 0.000
#> GSM2852     5  0.5889      0.893 0.428 0.000 0.100 0.000 0.472
#> GSM2855     5  0.5889      0.893 0.428 0.000 0.100 0.000 0.472
#> GSM2840     1  0.0162      0.294 0.996 0.004 0.000 0.000 0.000
#> GSM2857     1  0.0162      0.294 0.996 0.004 0.000 0.000 0.000
#> GSM2859     2  0.0912      0.740 0.000 0.972 0.000 0.012 0.016
#> GSM2860     2  0.0000      0.745 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.2472      0.726 0.036 0.908 0.000 0.012 0.044
#> GSM2862     2  0.0000      0.745 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000      0.745 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0000      0.745 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2  0.0000      0.745 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.3556      0.697 0.036 0.836 0.000 0.012 0.116
#> GSM2868     2  0.2293      0.717 0.016 0.900 0.000 0.000 0.084
#> GSM2869     2  0.0000      0.745 0.000 1.000 0.000 0.000 0.000
#> GSM2851     2  0.0290      0.745 0.000 0.992 0.000 0.000 0.008
#> GSM2867     2  0.1364      0.737 0.012 0.952 0.000 0.000 0.036
#> GSM2870     2  0.0290      0.745 0.000 0.992 0.000 0.000 0.008
#> GSM2854     4  0.5097      0.947 0.012 0.016 0.000 0.496 0.476
#> GSM2873     2  0.7440      0.369 0.160 0.472 0.000 0.072 0.296
#> GSM2874     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.4294      0.540 0.532 0.000 0.000 0.468 0.000
#> GSM2890     1  0.4294      0.540 0.532 0.000 0.000 0.468 0.000
#> GSM2877     1  0.4294      0.540 0.532 0.000 0.000 0.468 0.000
#> GSM2892     1  0.4294      0.540 0.532 0.000 0.000 0.468 0.000
#> GSM2902     1  0.4294      0.540 0.532 0.000 0.000 0.468 0.000
#> GSM2878     1  0.4291      0.539 0.536 0.000 0.000 0.464 0.000
#> GSM2901     1  0.4291      0.539 0.536 0.000 0.000 0.464 0.000
#> GSM2879     5  0.5143      0.928 0.428 0.000 0.040 0.000 0.532
#> GSM2898     5  0.5143      0.928 0.428 0.000 0.040 0.000 0.532
#> GSM2881     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2894     4  0.4294      0.996 0.000 0.000 0.000 0.532 0.468
#> GSM2883     3  0.4618      0.591 0.068 0.000 0.724 0.000 0.208
#> GSM2895     3  0.4649      0.584 0.068 0.000 0.720 0.000 0.212
#> GSM2885     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0162      0.951 0.000 0.000 0.996 0.000 0.004
#> GSM2896     3  0.0162      0.951 0.000 0.000 0.996 0.000 0.004
#> GSM2888     2  0.7036      0.339 0.200 0.468 0.008 0.012 0.312
#> GSM2889     2  0.7036      0.339 0.200 0.468 0.008 0.012 0.312
#> GSM2876     1  0.0000      0.296 1.000 0.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.296 1.000 0.000 0.000 0.000 0.000
#> GSM2880     1  0.4283      0.537 0.544 0.000 0.000 0.456 0.000
#> GSM2893     1  0.4294      0.540 0.532 0.000 0.000 0.468 0.000
#> GSM2821     1  0.4522     -0.786 0.552 0.008 0.000 0.000 0.440
#> GSM2900     1  0.4522     -0.786 0.552 0.008 0.000 0.000 0.440
#> GSM2903     1  0.4522     -0.786 0.552 0.008 0.000 0.000 0.440

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.5198    -0.1387 0.016 0.052 0.000 0.000 0.476 0.456
#> GSM2820     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     5  0.6477     0.3207 0.000 0.272 0.000 0.020 0.404 0.304
#> GSM2832     5  0.6477     0.3207 0.000 0.272 0.000 0.020 0.404 0.304
#> GSM2823     5  0.3804    -0.0816 0.000 0.000 0.000 0.000 0.576 0.424
#> GSM2824     5  0.3828    -0.0953 0.000 0.000 0.000 0.000 0.560 0.440
#> GSM2825     6  0.5569     0.1273 0.056 0.040 0.000 0.000 0.384 0.520
#> GSM2826     6  0.5569     0.1273 0.056 0.040 0.000 0.000 0.384 0.520
#> GSM2829     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2843     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2871     4  0.0260     0.9818 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM2831     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.0146     0.9870 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2846     4  0.0146     0.9870 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2835     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     2  0.6358    -0.1794 0.000 0.408 0.000 0.032 0.396 0.164
#> GSM2848     2  0.6371    -0.1599 0.000 0.416 0.000 0.036 0.392 0.156
#> GSM2828     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     6  0.3076     0.6007 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM2841     6  0.3076     0.6007 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM2827     5  0.6373     0.1308 0.000 0.380 0.000 0.048 0.440 0.132
#> GSM2842     5  0.6373     0.1308 0.000 0.380 0.000 0.048 0.440 0.132
#> GSM2845     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2872     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2834     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2847     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2849     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2853     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2852     5  0.1572     0.3897 0.000 0.000 0.028 0.000 0.936 0.036
#> GSM2855     5  0.1572     0.3897 0.000 0.000 0.028 0.000 0.936 0.036
#> GSM2840     6  0.3076     0.6007 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM2857     6  0.3076     0.6007 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM2859     2  0.0806     0.8030 0.000 0.972 0.000 0.020 0.008 0.000
#> GSM2860     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2861     2  0.2339     0.7543 0.000 0.896 0.000 0.020 0.072 0.012
#> GSM2862     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2863     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2864     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2865     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2866     2  0.3724     0.6269 0.000 0.780 0.000 0.020 0.176 0.024
#> GSM2868     2  0.2996     0.5564 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM2869     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2851     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2867     2  0.1267     0.7776 0.000 0.940 0.000 0.000 0.060 0.000
#> GSM2870     2  0.0000     0.8184 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2854     4  0.2860     0.8103 0.000 0.000 0.000 0.852 0.100 0.048
#> GSM2873     2  0.7061    -0.1564 0.000 0.380 0.000 0.120 0.360 0.140
#> GSM2874     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.9914 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.9914 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.9914 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.9914 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.9914 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0260     0.9872 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM2901     1  0.0260     0.9872 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM2879     5  0.1492     0.3900 0.000 0.000 0.024 0.000 0.940 0.036
#> GSM2898     5  0.1492     0.3900 0.000 0.000 0.024 0.000 0.940 0.036
#> GSM2881     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2894     4  0.0000     0.9893 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2883     5  0.4039    -0.1392 0.000 0.000 0.424 0.000 0.568 0.008
#> GSM2895     5  0.3993    -0.0901 0.000 0.000 0.400 0.000 0.592 0.008
#> GSM2885     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9569 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.3198     0.7195 0.000 0.000 0.740 0.000 0.260 0.000
#> GSM2896     3  0.3175     0.7241 0.000 0.000 0.744 0.000 0.256 0.000
#> GSM2888     5  0.5343     0.1267 0.000 0.440 0.004 0.020 0.488 0.048
#> GSM2889     5  0.5343     0.1267 0.000 0.440 0.004 0.020 0.488 0.048
#> GSM2876     6  0.3371     0.5425 0.292 0.000 0.000 0.000 0.000 0.708
#> GSM2891     6  0.3351     0.5472 0.288 0.000 0.000 0.000 0.000 0.712
#> GSM2880     1  0.0865     0.9488 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM2893     1  0.0000     0.9914 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     6  0.4245     0.2974 0.016 0.004 0.000 0.000 0.376 0.604
#> GSM2900     6  0.4234     0.3044 0.016 0.004 0.000 0.000 0.372 0.608
#> GSM2903     6  0.4234     0.3044 0.016 0.004 0.000 0.000 0.372 0.608

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 tissue(p) k
#> MAD:mclust 84  2.53e-05 2
#> MAD:mclust 80  1.24e-08 3
#> MAD:mclust 74  6.77e-11 4
#> MAD:mclust 63  8.71e-13 5
#> MAD:mclust 61  1.60e-12 6

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


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

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.861           0.883       0.937         0.4465 0.550   0.550
#> 3 3 0.945           0.932       0.969         0.3872 0.626   0.430
#> 4 4 0.941           0.926       0.963         0.2123 0.850   0.618
#> 5 5 0.888           0.799       0.893         0.0473 0.977   0.908
#> 6 6 0.858           0.785       0.872         0.0392 0.955   0.807

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>         class entropy silhouette    p1    p2
#> GSM2819     1  0.8499      0.594 0.724 0.276
#> GSM2820     2  0.0000      0.923 0.000 1.000
#> GSM2822     1  0.7745      0.680 0.772 0.228
#> GSM2832     2  0.9963      0.219 0.464 0.536
#> GSM2823     2  0.6438      0.778 0.164 0.836
#> GSM2824     2  0.8661      0.571 0.288 0.712
#> GSM2825     1  0.0000      0.943 1.000 0.000
#> GSM2826     1  0.0000      0.943 1.000 0.000
#> GSM2829     2  0.4022      0.927 0.080 0.920
#> GSM2856     2  0.4431      0.919 0.092 0.908
#> GSM2830     2  0.3733      0.931 0.072 0.928
#> GSM2843     2  0.3274      0.933 0.060 0.940
#> GSM2871     2  0.2778      0.931 0.048 0.952
#> GSM2831     1  0.9427      0.397 0.640 0.360
#> GSM2844     1  0.9635      0.315 0.612 0.388
#> GSM2833     2  0.9795      0.369 0.416 0.584
#> GSM2846     2  0.6531      0.842 0.168 0.832
#> GSM2835     1  0.0000      0.943 1.000 0.000
#> GSM2858     1  0.0000      0.943 1.000 0.000
#> GSM2836     2  0.3584      0.933 0.068 0.932
#> GSM2848     2  0.3584      0.933 0.068 0.932
#> GSM2828     2  0.0000      0.923 0.000 1.000
#> GSM2837     2  0.0000      0.923 0.000 1.000
#> GSM2839     1  0.0000      0.943 1.000 0.000
#> GSM2841     1  0.0000      0.943 1.000 0.000
#> GSM2827     2  0.3584      0.933 0.068 0.932
#> GSM2842     2  0.3584      0.933 0.068 0.932
#> GSM2845     2  0.4298      0.922 0.088 0.912
#> GSM2872     2  0.9460      0.507 0.364 0.636
#> GSM2834     2  0.4431      0.919 0.092 0.908
#> GSM2847     2  0.4022      0.927 0.080 0.920
#> GSM2849     2  0.0000      0.923 0.000 1.000
#> GSM2850     2  0.0000      0.923 0.000 1.000
#> GSM2838     2  0.3584      0.933 0.068 0.932
#> GSM2853     2  0.3584      0.933 0.068 0.932
#> GSM2852     2  0.0000      0.923 0.000 1.000
#> GSM2855     2  0.0000      0.923 0.000 1.000
#> GSM2840     1  0.0000      0.943 1.000 0.000
#> GSM2857     1  0.0000      0.943 1.000 0.000
#> GSM2859     2  0.3733      0.931 0.072 0.928
#> GSM2860     2  0.3584      0.933 0.068 0.932
#> GSM2861     2  0.3431      0.933 0.064 0.936
#> GSM2862     2  0.3584      0.933 0.068 0.932
#> GSM2863     2  0.3584      0.933 0.068 0.932
#> GSM2864     2  0.3584      0.933 0.068 0.932
#> GSM2865     2  0.3584      0.933 0.068 0.932
#> GSM2866     2  0.3733      0.931 0.072 0.928
#> GSM2868     2  0.3584      0.933 0.068 0.932
#> GSM2869     2  0.3584      0.933 0.068 0.932
#> GSM2851     2  0.3584      0.933 0.068 0.932
#> GSM2867     2  0.3584      0.933 0.068 0.932
#> GSM2870     2  0.3584      0.933 0.068 0.932
#> GSM2854     2  0.4022      0.927 0.080 0.920
#> GSM2873     2  0.3733      0.931 0.072 0.928
#> GSM2874     2  0.0000      0.923 0.000 1.000
#> GSM2884     2  0.0000      0.923 0.000 1.000
#> GSM2875     1  0.0000      0.943 1.000 0.000
#> GSM2890     1  0.0000      0.943 1.000 0.000
#> GSM2877     1  0.0000      0.943 1.000 0.000
#> GSM2892     1  0.0000      0.943 1.000 0.000
#> GSM2902     1  0.0000      0.943 1.000 0.000
#> GSM2878     1  0.0000      0.943 1.000 0.000
#> GSM2901     1  0.0000      0.943 1.000 0.000
#> GSM2879     2  0.0000      0.923 0.000 1.000
#> GSM2898     2  0.0000      0.923 0.000 1.000
#> GSM2881     2  0.0000      0.923 0.000 1.000
#> GSM2897     2  0.0000      0.923 0.000 1.000
#> GSM2882     1  0.2603      0.908 0.956 0.044
#> GSM2894     1  0.3274      0.894 0.940 0.060
#> GSM2883     2  0.0000      0.923 0.000 1.000
#> GSM2895     2  0.0000      0.923 0.000 1.000
#> GSM2885     2  0.0000      0.923 0.000 1.000
#> GSM2886     2  0.0000      0.923 0.000 1.000
#> GSM2887     2  0.0000      0.923 0.000 1.000
#> GSM2896     2  0.0000      0.923 0.000 1.000
#> GSM2888     2  0.0376      0.924 0.004 0.996
#> GSM2889     2  0.0000      0.923 0.000 1.000
#> GSM2876     1  0.0000      0.943 1.000 0.000
#> GSM2891     1  0.0000      0.943 1.000 0.000
#> GSM2880     1  0.0000      0.943 1.000 0.000
#> GSM2893     1  0.0000      0.943 1.000 0.000
#> GSM2821     1  0.0000      0.943 1.000 0.000
#> GSM2900     1  0.0000      0.943 1.000 0.000
#> GSM2903     1  0.0000      0.943 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
#> GSM2819     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2820     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2822     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2832     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2823     3  0.7905      0.260 0.376 0.064 0.560
#> GSM2824     1  0.8238      0.426 0.596 0.104 0.300
#> GSM2825     2  0.4702      0.738 0.212 0.788 0.000
#> GSM2826     2  0.4974      0.704 0.236 0.764 0.000
#> GSM2829     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2856     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2830     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2843     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2871     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2831     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2844     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2833     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2846     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2835     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2858     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2836     2  0.0237      0.962 0.000 0.996 0.004
#> GSM2848     2  0.0237      0.962 0.000 0.996 0.004
#> GSM2828     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2837     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2839     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2827     2  0.0592      0.958 0.000 0.988 0.012
#> GSM2842     2  0.1289      0.946 0.000 0.968 0.032
#> GSM2845     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2872     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2834     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2847     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2849     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2850     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2838     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2853     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2852     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2855     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2840     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2859     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2860     2  0.0237      0.962 0.000 0.996 0.004
#> GSM2861     2  0.2165      0.921 0.000 0.936 0.064
#> GSM2862     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2863     2  0.1031      0.951 0.000 0.976 0.024
#> GSM2864     2  0.1411      0.943 0.000 0.964 0.036
#> GSM2865     2  0.0237      0.962 0.000 0.996 0.004
#> GSM2866     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2868     2  0.4555      0.774 0.000 0.800 0.200
#> GSM2869     2  0.1860      0.931 0.000 0.948 0.052
#> GSM2851     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2867     2  0.3116      0.881 0.000 0.892 0.108
#> GSM2870     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2854     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2873     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2874     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2884     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2875     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2879     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2898     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2881     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2897     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2882     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2894     2  0.0000      0.964 0.000 1.000 0.000
#> GSM2883     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2895     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2885     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2886     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2887     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2896     3  0.0000      0.977 0.000 0.000 1.000
#> GSM2888     2  0.5529      0.625 0.000 0.704 0.296
#> GSM2889     2  0.5560      0.617 0.000 0.700 0.300
#> GSM2876     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2891     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2880     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2821     1  0.2878      0.861 0.904 0.096 0.000
#> GSM2900     1  0.0747      0.954 0.984 0.016 0.000
#> GSM2903     1  0.1163      0.942 0.972 0.028 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.1118      0.928 0.000 0.964 0.000 0.036
#> GSM2820     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2822     2  0.2647      0.868 0.000 0.880 0.000 0.120
#> GSM2832     2  0.3123      0.832 0.000 0.844 0.000 0.156
#> GSM2823     1  0.6038      0.304 0.532 0.424 0.044 0.000
#> GSM2824     1  0.5581      0.264 0.532 0.448 0.020 0.000
#> GSM2825     2  0.6585      0.605 0.180 0.632 0.000 0.188
#> GSM2826     2  0.6393      0.624 0.188 0.652 0.000 0.160
#> GSM2829     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2843     4  0.0188      0.994 0.000 0.004 0.000 0.996
#> GSM2871     4  0.0188      0.994 0.000 0.004 0.000 0.996
#> GSM2831     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2846     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2836     2  0.1716      0.910 0.000 0.936 0.000 0.064
#> GSM2848     2  0.1792      0.908 0.000 0.932 0.000 0.068
#> GSM2828     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0188      0.925 0.996 0.000 0.000 0.004
#> GSM2841     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM2827     2  0.1302      0.924 0.000 0.956 0.000 0.044
#> GSM2842     2  0.1022      0.929 0.000 0.968 0.000 0.032
#> GSM2845     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2872     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2834     4  0.0188      0.994 0.000 0.004 0.000 0.996
#> GSM2847     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2849     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2838     2  0.0188      0.939 0.000 0.996 0.000 0.004
#> GSM2853     2  0.0188      0.939 0.000 0.996 0.000 0.004
#> GSM2852     3  0.0707      0.982 0.000 0.020 0.980 0.000
#> GSM2855     3  0.0592      0.985 0.000 0.016 0.984 0.000
#> GSM2840     1  0.0188      0.925 0.996 0.000 0.000 0.004
#> GSM2857     1  0.0188      0.925 0.996 0.000 0.000 0.004
#> GSM2859     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0188      0.939 0.000 0.996 0.000 0.004
#> GSM2861     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2862     2  0.0188      0.939 0.000 0.996 0.000 0.004
#> GSM2863     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0336      0.938 0.000 0.992 0.000 0.008
#> GSM2868     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2869     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2851     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2867     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2870     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2854     4  0.0921      0.969 0.000 0.028 0.000 0.972
#> GSM2873     2  0.4477      0.610 0.000 0.688 0.000 0.312
#> GSM2874     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0188      0.925 0.996 0.000 0.000 0.004
#> GSM2890     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0188      0.925 0.996 0.000 0.000 0.004
#> GSM2892     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM2879     3  0.0707      0.982 0.000 0.020 0.980 0.000
#> GSM2898     3  0.1211      0.963 0.000 0.040 0.960 0.000
#> GSM2881     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000      0.997 0.000 0.000 0.000 1.000
#> GSM2883     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2895     3  0.0188      0.993 0.000 0.004 0.996 0.000
#> GSM2885     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2887     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2896     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> GSM2888     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2889     2  0.0000      0.939 0.000 1.000 0.000 0.000
#> GSM2876     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM2880     1  0.0188      0.925 0.996 0.000 0.000 0.004
#> GSM2893     1  0.0188      0.925 0.996 0.000 0.000 0.004
#> GSM2821     1  0.3311      0.794 0.828 0.172 0.000 0.000
#> GSM2900     1  0.2647      0.847 0.880 0.120 0.000 0.000
#> GSM2903     1  0.2704      0.843 0.876 0.124 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.4581     0.3447 0.032 0.268 0.000 0.004 0.696
#> GSM2820     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.4221     0.7381 0.000 0.732 0.000 0.032 0.236
#> GSM2832     2  0.4587     0.7180 0.000 0.728 0.000 0.068 0.204
#> GSM2823     1  0.7270    -0.2101 0.504 0.260 0.060 0.000 0.176
#> GSM2824     1  0.6843    -0.2553 0.496 0.260 0.016 0.000 0.228
#> GSM2825     2  0.7750    -0.0862 0.244 0.360 0.000 0.060 0.336
#> GSM2826     2  0.7666    -0.0816 0.248 0.364 0.000 0.052 0.336
#> GSM2829     4  0.0510     0.9626 0.000 0.000 0.000 0.984 0.016
#> GSM2856     4  0.0510     0.9626 0.000 0.000 0.000 0.984 0.016
#> GSM2830     4  0.0000     0.9630 0.000 0.000 0.000 1.000 0.000
#> GSM2843     4  0.0000     0.9630 0.000 0.000 0.000 1.000 0.000
#> GSM2871     4  0.0898     0.9533 0.000 0.020 0.000 0.972 0.008
#> GSM2831     4  0.0162     0.9631 0.000 0.000 0.000 0.996 0.004
#> GSM2844     4  0.0162     0.9631 0.000 0.000 0.000 0.996 0.004
#> GSM2833     4  0.2471     0.9001 0.000 0.000 0.000 0.864 0.136
#> GSM2846     4  0.2329     0.9091 0.000 0.000 0.000 0.876 0.124
#> GSM2835     4  0.2280     0.9095 0.000 0.000 0.000 0.880 0.120
#> GSM2858     4  0.2536     0.9005 0.004 0.000 0.000 0.868 0.128
#> GSM2836     2  0.0693     0.8534 0.000 0.980 0.000 0.008 0.012
#> GSM2848     2  0.0451     0.8559 0.000 0.988 0.000 0.004 0.008
#> GSM2828     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.3796     0.5461 0.700 0.000 0.000 0.000 0.300
#> GSM2841     1  0.3906     0.5479 0.704 0.004 0.000 0.000 0.292
#> GSM2827     2  0.0912     0.8567 0.000 0.972 0.000 0.012 0.016
#> GSM2842     2  0.0955     0.8592 0.000 0.968 0.000 0.004 0.028
#> GSM2845     4  0.0162     0.9627 0.000 0.004 0.000 0.996 0.000
#> GSM2872     4  0.0162     0.9627 0.000 0.004 0.000 0.996 0.000
#> GSM2834     4  0.0898     0.9532 0.000 0.020 0.000 0.972 0.008
#> GSM2847     4  0.0451     0.9607 0.000 0.008 0.000 0.988 0.004
#> GSM2849     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.2648     0.8269 0.000 0.848 0.000 0.000 0.152
#> GSM2853     2  0.2773     0.8215 0.000 0.836 0.000 0.000 0.164
#> GSM2852     3  0.0162     0.9910 0.000 0.004 0.996 0.000 0.000
#> GSM2855     3  0.0162     0.9910 0.000 0.004 0.996 0.000 0.000
#> GSM2840     1  0.4302     0.4979 0.648 0.004 0.000 0.004 0.344
#> GSM2857     1  0.4268     0.5003 0.648 0.008 0.000 0.000 0.344
#> GSM2859     2  0.0162     0.8576 0.000 0.996 0.000 0.000 0.004
#> GSM2860     2  0.0000     0.8583 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.0880     0.8579 0.000 0.968 0.000 0.000 0.032
#> GSM2862     2  0.0000     0.8583 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0162     0.8576 0.000 0.996 0.000 0.000 0.004
#> GSM2864     2  0.0290     0.8567 0.000 0.992 0.000 0.000 0.008
#> GSM2865     2  0.0162     0.8576 0.000 0.996 0.000 0.000 0.004
#> GSM2866     2  0.0000     0.8583 0.000 1.000 0.000 0.000 0.000
#> GSM2868     2  0.3003     0.8048 0.000 0.812 0.000 0.000 0.188
#> GSM2869     2  0.2929     0.8111 0.000 0.820 0.000 0.000 0.180
#> GSM2851     2  0.2605     0.8279 0.000 0.852 0.000 0.000 0.148
#> GSM2867     2  0.2966     0.8094 0.000 0.816 0.000 0.000 0.184
#> GSM2870     2  0.2852     0.8159 0.000 0.828 0.000 0.000 0.172
#> GSM2854     4  0.1012     0.9546 0.000 0.020 0.000 0.968 0.012
#> GSM2873     2  0.2069     0.8072 0.000 0.912 0.000 0.076 0.012
#> GSM2874     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000     0.7296 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.7296 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.7296 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.7296 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.7296 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0162     0.7276 0.996 0.000 0.000 0.000 0.004
#> GSM2901     1  0.0404     0.7232 0.988 0.000 0.000 0.000 0.012
#> GSM2879     3  0.1282     0.9486 0.000 0.044 0.952 0.000 0.004
#> GSM2898     3  0.0963     0.9599 0.000 0.036 0.964 0.000 0.000
#> GSM2881     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0880     0.9589 0.000 0.000 0.000 0.968 0.032
#> GSM2894     4  0.0963     0.9578 0.000 0.000 0.000 0.964 0.036
#> GSM2883     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2885     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000     0.9942 0.000 0.000 1.000 0.000 0.000
#> GSM2888     2  0.1965     0.8459 0.000 0.904 0.000 0.000 0.096
#> GSM2889     2  0.1851     0.8478 0.000 0.912 0.000 0.000 0.088
#> GSM2876     1  0.3177     0.4583 0.792 0.000 0.000 0.000 0.208
#> GSM2891     1  0.3305     0.4246 0.776 0.000 0.000 0.000 0.224
#> GSM2880     1  0.0000     0.7296 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000     0.7296 1.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.4341     0.6771 0.364 0.008 0.000 0.000 0.628
#> GSM2900     5  0.4464     0.6669 0.408 0.008 0.000 0.000 0.584
#> GSM2903     5  0.4464     0.6669 0.408 0.008 0.000 0.000 0.584

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.1995     0.7049 0.036 0.024 0.000 0.004 0.924 0.012
#> GSM2820     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     6  0.5781     0.0379 0.000 0.336 0.000 0.016 0.128 0.520
#> GSM2832     6  0.6019    -0.1554 0.000 0.396 0.000 0.024 0.128 0.452
#> GSM2823     1  0.5651    -0.0750 0.512 0.088 0.016 0.000 0.380 0.004
#> GSM2824     1  0.5355    -0.2421 0.468 0.060 0.008 0.000 0.456 0.008
#> GSM2825     6  0.3058     0.6265 0.136 0.016 0.000 0.004 0.008 0.836
#> GSM2826     6  0.3043     0.6282 0.140 0.020 0.000 0.000 0.008 0.832
#> GSM2829     4  0.1649     0.8968 0.000 0.000 0.000 0.932 0.032 0.036
#> GSM2856     4  0.1995     0.8913 0.000 0.000 0.000 0.912 0.036 0.052
#> GSM2830     4  0.0146     0.9030 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2843     4  0.0405     0.9028 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM2871     4  0.1850     0.8787 0.000 0.052 0.000 0.924 0.008 0.016
#> GSM2831     4  0.0260     0.9036 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM2844     4  0.0146     0.9034 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM2833     4  0.4171     0.7743 0.004 0.000 0.000 0.736 0.192 0.068
#> GSM2846     4  0.3877     0.8001 0.000 0.000 0.000 0.764 0.160 0.076
#> GSM2835     4  0.4513     0.7377 0.004 0.000 0.000 0.700 0.084 0.212
#> GSM2858     4  0.4790     0.6712 0.004 0.000 0.000 0.648 0.080 0.268
#> GSM2836     2  0.0665     0.8141 0.000 0.980 0.000 0.008 0.004 0.008
#> GSM2848     2  0.0665     0.8179 0.000 0.980 0.000 0.008 0.004 0.008
#> GSM2828     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     6  0.4118     0.5987 0.312 0.000 0.000 0.000 0.028 0.660
#> GSM2841     6  0.3969     0.5976 0.312 0.000 0.000 0.000 0.020 0.668
#> GSM2827     2  0.1851     0.8232 0.000 0.928 0.000 0.012 0.024 0.036
#> GSM2842     2  0.2994     0.8171 0.000 0.852 0.000 0.004 0.080 0.064
#> GSM2845     4  0.1577     0.8890 0.000 0.036 0.000 0.940 0.008 0.016
#> GSM2872     4  0.1149     0.8962 0.000 0.024 0.000 0.960 0.008 0.008
#> GSM2834     4  0.2418     0.8477 0.000 0.092 0.000 0.884 0.008 0.016
#> GSM2847     4  0.1307     0.8934 0.000 0.032 0.000 0.952 0.008 0.008
#> GSM2849     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.4641     0.7578 0.000 0.668 0.000 0.000 0.240 0.092
#> GSM2853     2  0.5020     0.7320 0.000 0.628 0.000 0.000 0.244 0.128
#> GSM2852     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2855     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2840     6  0.3758     0.6473 0.232 0.000 0.000 0.004 0.024 0.740
#> GSM2857     6  0.3956     0.6443 0.252 0.000 0.000 0.004 0.028 0.716
#> GSM2859     2  0.0767     0.8207 0.000 0.976 0.000 0.004 0.012 0.008
#> GSM2860     2  0.0508     0.8233 0.000 0.984 0.000 0.000 0.012 0.004
#> GSM2861     2  0.2680     0.8172 0.000 0.860 0.000 0.000 0.108 0.032
#> GSM2862     2  0.0653     0.8170 0.000 0.980 0.000 0.004 0.004 0.012
#> GSM2863     2  0.0665     0.8176 0.000 0.980 0.000 0.004 0.008 0.008
#> GSM2864     2  0.0551     0.8155 0.000 0.984 0.000 0.004 0.004 0.008
#> GSM2865     2  0.0405     0.8171 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM2866     2  0.0622     0.8226 0.000 0.980 0.000 0.000 0.012 0.008
#> GSM2868     2  0.4686     0.7478 0.000 0.660 0.000 0.000 0.248 0.092
#> GSM2869     2  0.4793     0.7442 0.000 0.648 0.000 0.000 0.252 0.100
#> GSM2851     2  0.4855     0.7407 0.000 0.640 0.000 0.000 0.256 0.104
#> GSM2867     2  0.4699     0.7537 0.000 0.668 0.000 0.000 0.228 0.104
#> GSM2870     2  0.4914     0.7324 0.000 0.628 0.000 0.000 0.268 0.104
#> GSM2854     4  0.2257     0.8902 0.000 0.008 0.000 0.904 0.040 0.048
#> GSM2873     2  0.1442     0.7985 0.000 0.944 0.000 0.040 0.004 0.012
#> GSM2874     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.8116 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0146     0.8114 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM2877     1  0.0000     0.8116 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0146     0.8114 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM2902     1  0.0146     0.8114 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM2878     1  0.0146     0.8103 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM2901     1  0.0260     0.8088 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM2879     3  0.2553     0.8192 0.000 0.144 0.848 0.000 0.000 0.008
#> GSM2898     3  0.1714     0.8887 0.000 0.092 0.908 0.000 0.000 0.000
#> GSM2881     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0909     0.9033 0.000 0.000 0.000 0.968 0.020 0.012
#> GSM2894     4  0.1176     0.9025 0.000 0.000 0.000 0.956 0.024 0.020
#> GSM2883     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2885     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000     0.9847 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.4980     0.7324 0.000 0.648 0.000 0.000 0.184 0.168
#> GSM2889     2  0.5008     0.7300 0.000 0.644 0.000 0.000 0.188 0.168
#> GSM2876     1  0.3634     0.4451 0.696 0.000 0.000 0.000 0.296 0.008
#> GSM2891     1  0.3672     0.4297 0.688 0.000 0.000 0.000 0.304 0.008
#> GSM2880     1  0.0405     0.8067 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM2893     1  0.0405     0.8067 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM2821     5  0.2902     0.8550 0.196 0.000 0.000 0.000 0.800 0.004
#> GSM2900     5  0.3240     0.8307 0.244 0.000 0.000 0.000 0.752 0.004
#> GSM2903     5  0.3136     0.8508 0.228 0.000 0.000 0.000 0.768 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-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 tissue(p) k
#> MAD:NMF 80  5.31e-05 2
#> MAD:NMF 82  9.10e-09 3
#> MAD:NMF 82  9.12e-12 4
#> MAD:NMF 76  2.03e-14 5
#> MAD:NMF 78  5.97e-18 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 1.000           0.987       0.995         0.3467 0.659   0.659
#> 3 3 0.626           0.483       0.769         0.7001 0.673   0.508
#> 4 4 0.869           0.921       0.961         0.2415 0.757   0.435
#> 5 5 0.866           0.894       0.941         0.0371 0.977   0.916
#> 6 6 0.874           0.867       0.936         0.0490 0.952   0.808

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
#> GSM2819     2  0.0376      0.990 0.004 0.996
#> GSM2820     2  0.0000      0.994 0.000 1.000
#> GSM2822     2  0.0000      0.994 0.000 1.000
#> GSM2832     2  0.0000      0.994 0.000 1.000
#> GSM2823     2  0.0000      0.994 0.000 1.000
#> GSM2824     2  0.0000      0.994 0.000 1.000
#> GSM2825     2  0.0000      0.994 0.000 1.000
#> GSM2826     2  0.0000      0.994 0.000 1.000
#> GSM2829     1  0.0000      1.000 1.000 0.000
#> GSM2856     1  0.0000      1.000 1.000 0.000
#> GSM2830     1  0.0000      1.000 1.000 0.000
#> GSM2843     1  0.0000      1.000 1.000 0.000
#> GSM2871     1  0.0000      1.000 1.000 0.000
#> GSM2831     1  0.0000      1.000 1.000 0.000
#> GSM2844     1  0.0000      1.000 1.000 0.000
#> GSM2833     1  0.0000      1.000 1.000 0.000
#> GSM2846     1  0.0000      1.000 1.000 0.000
#> GSM2835     1  0.0000      1.000 1.000 0.000
#> GSM2858     1  0.0000      1.000 1.000 0.000
#> GSM2836     2  0.0000      0.994 0.000 1.000
#> GSM2848     2  0.0000      0.994 0.000 1.000
#> GSM2828     2  0.0000      0.994 0.000 1.000
#> GSM2837     2  0.0000      0.994 0.000 1.000
#> GSM2839     2  0.0000      0.994 0.000 1.000
#> GSM2841     2  0.0000      0.994 0.000 1.000
#> GSM2827     2  0.0000      0.994 0.000 1.000
#> GSM2842     2  0.0000      0.994 0.000 1.000
#> GSM2845     1  0.0000      1.000 1.000 0.000
#> GSM2872     1  0.0000      1.000 1.000 0.000
#> GSM2834     1  0.0000      1.000 1.000 0.000
#> GSM2847     1  0.0000      1.000 1.000 0.000
#> GSM2849     2  0.0000      0.994 0.000 1.000
#> GSM2850     2  0.0000      0.994 0.000 1.000
#> GSM2838     2  0.0000      0.994 0.000 1.000
#> GSM2853     2  0.0000      0.994 0.000 1.000
#> GSM2852     2  0.0000      0.994 0.000 1.000
#> GSM2855     2  0.0000      0.994 0.000 1.000
#> GSM2840     2  0.0000      0.994 0.000 1.000
#> GSM2857     2  0.0000      0.994 0.000 1.000
#> GSM2859     2  0.0000      0.994 0.000 1.000
#> GSM2860     2  0.0000      0.994 0.000 1.000
#> GSM2861     2  0.0000      0.994 0.000 1.000
#> GSM2862     2  0.0000      0.994 0.000 1.000
#> GSM2863     2  0.0000      0.994 0.000 1.000
#> GSM2864     2  0.0000      0.994 0.000 1.000
#> GSM2865     2  0.0000      0.994 0.000 1.000
#> GSM2866     2  0.0000      0.994 0.000 1.000
#> GSM2868     2  0.0000      0.994 0.000 1.000
#> GSM2869     2  0.0000      0.994 0.000 1.000
#> GSM2851     2  0.0000      0.994 0.000 1.000
#> GSM2867     2  0.0000      0.994 0.000 1.000
#> GSM2870     2  0.0000      0.994 0.000 1.000
#> GSM2854     1  0.0672      0.992 0.992 0.008
#> GSM2873     2  0.9661      0.355 0.392 0.608
#> GSM2874     2  0.0000      0.994 0.000 1.000
#> GSM2884     2  0.0000      0.994 0.000 1.000
#> GSM2875     2  0.0000      0.994 0.000 1.000
#> GSM2890     2  0.0000      0.994 0.000 1.000
#> GSM2877     2  0.0000      0.994 0.000 1.000
#> GSM2892     2  0.0000      0.994 0.000 1.000
#> GSM2902     2  0.0000      0.994 0.000 1.000
#> GSM2878     2  0.0000      0.994 0.000 1.000
#> GSM2901     2  0.0000      0.994 0.000 1.000
#> GSM2879     2  0.0000      0.994 0.000 1.000
#> GSM2898     2  0.0000      0.994 0.000 1.000
#> GSM2881     2  0.0000      0.994 0.000 1.000
#> GSM2897     2  0.0000      0.994 0.000 1.000
#> GSM2882     1  0.0000      1.000 1.000 0.000
#> GSM2894     1  0.0000      1.000 1.000 0.000
#> GSM2883     2  0.0000      0.994 0.000 1.000
#> GSM2895     2  0.0000      0.994 0.000 1.000
#> GSM2885     2  0.0000      0.994 0.000 1.000
#> GSM2886     2  0.0000      0.994 0.000 1.000
#> GSM2887     2  0.0000      0.994 0.000 1.000
#> GSM2896     2  0.0000      0.994 0.000 1.000
#> GSM2888     2  0.0000      0.994 0.000 1.000
#> GSM2889     2  0.0000      0.994 0.000 1.000
#> GSM2876     2  0.0000      0.994 0.000 1.000
#> GSM2891     2  0.0000      0.994 0.000 1.000
#> GSM2880     2  0.0000      0.994 0.000 1.000
#> GSM2893     2  0.0000      0.994 0.000 1.000
#> GSM2821     2  0.0000      0.994 0.000 1.000
#> GSM2900     2  0.0000      0.994 0.000 1.000
#> GSM2903     2  0.0000      0.994 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
#> GSM2819     1  0.6345      0.311 0.596 0.004 0.400
#> GSM2820     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2822     1  0.6299      0.181 0.524 0.000 0.476
#> GSM2832     1  0.6299      0.181 0.524 0.000 0.476
#> GSM2823     1  0.6286      0.208 0.536 0.000 0.464
#> GSM2824     1  0.6286      0.208 0.536 0.000 0.464
#> GSM2825     1  0.6295      0.191 0.528 0.000 0.472
#> GSM2826     1  0.6295      0.191 0.528 0.000 0.472
#> GSM2829     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2856     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2830     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2843     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2871     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2831     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2844     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2833     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2846     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2835     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2858     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2836     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2848     1  0.6309      0.106 0.500 0.000 0.500
#> GSM2828     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2837     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2839     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2827     1  0.6309      0.106 0.500 0.000 0.500
#> GSM2842     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2845     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2872     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2834     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2847     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2849     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2850     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2838     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2853     1  0.6309      0.106 0.500 0.000 0.500
#> GSM2852     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2855     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2840     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2859     1  0.6309      0.106 0.500 0.000 0.500
#> GSM2860     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2861     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2862     1  0.6309      0.106 0.500 0.000 0.500
#> GSM2863     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2864     1  0.6309      0.106 0.500 0.000 0.500
#> GSM2865     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2866     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2868     1  0.6309      0.106 0.500 0.000 0.500
#> GSM2869     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2851     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2867     3  0.6309     -0.160 0.500 0.000 0.500
#> GSM2870     1  0.6309      0.106 0.500 0.000 0.500
#> GSM2854     2  0.0424      0.955 0.000 0.992 0.008
#> GSM2873     2  0.9883     -0.301 0.344 0.392 0.264
#> GSM2874     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2884     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2875     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2879     3  0.4605      0.489 0.204 0.000 0.796
#> GSM2898     3  0.4605      0.489 0.204 0.000 0.796
#> GSM2881     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2897     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2882     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2894     2  0.0000      0.963 0.000 1.000 0.000
#> GSM2883     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2895     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2885     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2886     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2887     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2896     3  0.0000      0.652 0.000 0.000 1.000
#> GSM2888     3  0.6008      0.203 0.372 0.000 0.628
#> GSM2889     3  0.6008      0.203 0.372 0.000 0.628
#> GSM2876     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2891     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2880     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.605 1.000 0.000 0.000
#> GSM2821     1  0.5291      0.471 0.732 0.000 0.268
#> GSM2900     1  0.5291      0.471 0.732 0.000 0.268
#> GSM2903     1  0.5291      0.471 0.732 0.000 0.268

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.2466      0.856 0.096 0.900 0.004 0.000
#> GSM2820     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2822     2  0.0817      0.910 0.024 0.976 0.000 0.000
#> GSM2832     2  0.0817      0.910 0.024 0.976 0.000 0.000
#> GSM2823     2  0.1118      0.905 0.036 0.964 0.000 0.000
#> GSM2824     2  0.1118      0.905 0.036 0.964 0.000 0.000
#> GSM2825     2  0.0921      0.909 0.028 0.972 0.000 0.000
#> GSM2826     2  0.0921      0.909 0.028 0.972 0.000 0.000
#> GSM2829     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0188      0.998 0.000 0.000 0.004 0.996
#> GSM2843     4  0.0188      0.998 0.000 0.000 0.004 0.996
#> GSM2871     4  0.0188      0.998 0.000 0.000 0.004 0.996
#> GSM2831     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2846     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2836     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2848     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2828     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2837     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2839     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2827     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2842     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2845     4  0.0188      0.998 0.000 0.000 0.004 0.996
#> GSM2872     4  0.0188      0.998 0.000 0.000 0.004 0.996
#> GSM2834     4  0.0188      0.998 0.000 0.000 0.004 0.996
#> GSM2847     4  0.0188      0.998 0.000 0.000 0.004 0.996
#> GSM2849     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2850     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2838     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2853     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2852     3  0.2589      0.903 0.000 0.116 0.884 0.000
#> GSM2855     3  0.2589      0.903 0.000 0.116 0.884 0.000
#> GSM2840     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2857     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2861     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2862     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2868     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2869     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2851     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2867     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2870     2  0.0000      0.919 0.000 1.000 0.000 0.000
#> GSM2854     4  0.0524      0.990 0.000 0.008 0.004 0.988
#> GSM2873     2  0.4991      0.342 0.000 0.608 0.004 0.388
#> GSM2874     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2884     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2875     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2879     2  0.4713      0.416 0.000 0.640 0.360 0.000
#> GSM2898     2  0.4713      0.416 0.000 0.640 0.360 0.000
#> GSM2881     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2897     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2882     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000      0.998 0.000 0.000 0.000 1.000
#> GSM2883     3  0.2921      0.881 0.000 0.140 0.860 0.000
#> GSM2895     3  0.2921      0.881 0.000 0.140 0.860 0.000
#> GSM2885     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2886     3  0.0188      0.947 0.000 0.004 0.996 0.000
#> GSM2887     3  0.2589      0.903 0.000 0.116 0.884 0.000
#> GSM2896     3  0.2589      0.903 0.000 0.116 0.884 0.000
#> GSM2888     2  0.3400      0.751 0.000 0.820 0.180 0.000
#> GSM2889     2  0.3400      0.751 0.000 0.820 0.180 0.000
#> GSM2876     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM2821     2  0.3907      0.716 0.232 0.768 0.000 0.000
#> GSM2900     2  0.3907      0.716 0.232 0.768 0.000 0.000
#> GSM2903     2  0.3907      0.716 0.232 0.768 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     2   0.306      0.836 0.068 0.864 0.000 0.000 0.068
#> GSM2820     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2   0.141      0.889 0.000 0.940 0.000 0.000 0.060
#> GSM2832     2   0.141      0.889 0.000 0.940 0.000 0.000 0.060
#> GSM2823     2   0.181      0.884 0.012 0.928 0.000 0.000 0.060
#> GSM2824     2   0.181      0.884 0.012 0.928 0.000 0.000 0.060
#> GSM2825     2   0.148      0.887 0.000 0.936 0.000 0.000 0.064
#> GSM2826     2   0.148      0.887 0.000 0.936 0.000 0.000 0.064
#> GSM2829     4   0.000      0.914 0.000 0.000 0.000 1.000 0.000
#> GSM2856     4   0.000      0.914 0.000 0.000 0.000 1.000 0.000
#> GSM2830     5   0.167      0.989 0.000 0.000 0.000 0.076 0.924
#> GSM2843     5   0.167      0.989 0.000 0.000 0.000 0.076 0.924
#> GSM2871     5   0.154      0.993 0.000 0.000 0.000 0.068 0.932
#> GSM2831     4   0.000      0.914 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4   0.000      0.914 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4   0.000      0.914 0.000 0.000 0.000 1.000 0.000
#> GSM2846     4   0.000      0.914 0.000 0.000 0.000 1.000 0.000
#> GSM2835     4   0.000      0.914 0.000 0.000 0.000 1.000 0.000
#> GSM2858     4   0.000      0.914 0.000 0.000 0.000 1.000 0.000
#> GSM2836     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2848     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2828     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2841     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2827     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2842     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2845     5   0.154      0.993 0.000 0.000 0.000 0.068 0.932
#> GSM2872     5   0.154      0.993 0.000 0.000 0.000 0.068 0.932
#> GSM2834     5   0.154      0.993 0.000 0.000 0.000 0.068 0.932
#> GSM2847     5   0.154      0.993 0.000 0.000 0.000 0.068 0.932
#> GSM2849     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2852     3   0.218      0.893 0.000 0.112 0.888 0.000 0.000
#> GSM2855     3   0.218      0.893 0.000 0.112 0.888 0.000 0.000
#> GSM2840     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2857     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2859     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2860     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2862     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2868     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2869     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2851     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2867     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2870     2   0.000      0.910 0.000 1.000 0.000 0.000 0.000
#> GSM2854     5   0.195      0.972 0.000 0.004 0.000 0.084 0.912
#> GSM2873     2   0.421      0.318 0.000 0.588 0.000 0.000 0.412
#> GSM2874     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2879     2   0.406      0.417 0.000 0.640 0.360 0.000 0.000
#> GSM2898     2   0.406      0.417 0.000 0.640 0.360 0.000 0.000
#> GSM2881     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4   0.400      0.484 0.000 0.000 0.000 0.656 0.344
#> GSM2894     4   0.400      0.484 0.000 0.000 0.000 0.656 0.344
#> GSM2883     3   0.247      0.868 0.000 0.136 0.864 0.000 0.000
#> GSM2895     3   0.247      0.868 0.000 0.136 0.864 0.000 0.000
#> GSM2885     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3   0.000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3   0.218      0.893 0.000 0.112 0.888 0.000 0.000
#> GSM2896     3   0.218      0.893 0.000 0.112 0.888 0.000 0.000
#> GSM2888     2   0.293      0.750 0.000 0.820 0.180 0.000 0.000
#> GSM2889     2   0.293      0.750 0.000 0.820 0.180 0.000 0.000
#> GSM2876     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2891     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2880     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1   0.000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM2821     2   0.447      0.711 0.204 0.736 0.000 0.000 0.060
#> GSM2900     2   0.447      0.711 0.204 0.736 0.000 0.000 0.060
#> GSM2903     2   0.447      0.711 0.204 0.736 0.000 0.000 0.060

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.2320      0.701 0.000 0.132 0.000 0.000 0.864 0.004
#> GSM2820     3  0.0000      0.908 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     2  0.1444      0.849 0.000 0.928 0.000 0.000 0.072 0.000
#> GSM2832     2  0.1444      0.849 0.000 0.928 0.000 0.000 0.072 0.000
#> GSM2823     5  0.3727      0.517 0.000 0.388 0.000 0.000 0.612 0.000
#> GSM2824     5  0.3727      0.517 0.000 0.388 0.000 0.000 0.612 0.000
#> GSM2825     2  0.1501      0.845 0.000 0.924 0.000 0.000 0.076 0.000
#> GSM2826     2  0.1501      0.845 0.000 0.924 0.000 0.000 0.076 0.000
#> GSM2829     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     6  0.0260      0.989 0.000 0.000 0.000 0.008 0.000 0.992
#> GSM2843     6  0.0260      0.989 0.000 0.000 0.000 0.008 0.000 0.992
#> GSM2871     6  0.0000      0.993 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2831     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2846     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2835     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2848     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2828     3  0.1141      0.893 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM2837     3  0.1141      0.893 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM2839     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2827     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2842     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2845     6  0.0000      0.993 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2872     6  0.0000      0.993 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2834     6  0.0000      0.993 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2847     6  0.0000      0.993 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2849     3  0.1141      0.893 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM2850     3  0.1141      0.893 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM2838     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2853     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2852     3  0.3196      0.844 0.000 0.108 0.828 0.000 0.064 0.000
#> GSM2855     3  0.3196      0.844 0.000 0.108 0.828 0.000 0.064 0.000
#> GSM2840     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2857     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2860     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2861     2  0.0146      0.907 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2862     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2863     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2864     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2865     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2866     2  0.0000      0.908 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2868     2  0.0146      0.907 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2869     2  0.0146      0.907 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2851     2  0.0146      0.907 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2867     2  0.0146      0.907 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2870     2  0.0146      0.907 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2854     6  0.0891      0.968 0.000 0.000 0.000 0.024 0.008 0.968
#> GSM2873     2  0.4301      0.231 0.000 0.584 0.000 0.000 0.024 0.392
#> GSM2874     3  0.0000      0.908 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000      0.908 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     2  0.4621      0.423 0.000 0.632 0.304 0.000 0.064 0.000
#> GSM2898     2  0.4621      0.423 0.000 0.632 0.304 0.000 0.064 0.000
#> GSM2881     3  0.0000      0.908 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000      0.908 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.3765      0.400 0.000 0.000 0.000 0.596 0.000 0.404
#> GSM2894     4  0.3765      0.400 0.000 0.000 0.000 0.596 0.000 0.404
#> GSM2883     3  0.3522      0.816 0.000 0.128 0.800 0.000 0.072 0.000
#> GSM2895     3  0.3522      0.816 0.000 0.128 0.800 0.000 0.072 0.000
#> GSM2885     3  0.0000      0.908 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000      0.908 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.3196      0.844 0.000 0.108 0.828 0.000 0.064 0.000
#> GSM2896     3  0.3196      0.844 0.000 0.108 0.828 0.000 0.064 0.000
#> GSM2888     2  0.3354      0.710 0.000 0.812 0.128 0.000 0.060 0.000
#> GSM2889     2  0.3354      0.710 0.000 0.812 0.128 0.000 0.060 0.000
#> GSM2876     1  0.0146      0.996 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM2891     1  0.0146      0.996 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM2880     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.2489      0.717 0.128 0.012 0.000 0.000 0.860 0.000
#> GSM2900     5  0.2489      0.717 0.128 0.012 0.000 0.000 0.860 0.000
#> GSM2903     5  0.2489      0.717 0.128 0.012 0.000 0.000 0.860 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-hclust-collect-classes

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

test_to_known_factors(res)
#>             n tissue(p) k
#> ATC:hclust 83  3.39e-05 2
#> ATC:hclust 50  1.60e-05 3
#> ATC:hclust 81  7.31e-12 4
#> ATC:hclust 79  6.48e-15 5
#> ATC:hclust 79  3.73e-18 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.223           0.681       0.723         0.3811 0.646   0.646
#> 3 3 0.592           0.878       0.871         0.5595 0.739   0.604
#> 4 4 0.828           0.956       0.909         0.1998 0.849   0.632
#> 5 5 0.743           0.892       0.877         0.0643 1.000   1.000
#> 6 6 0.810           0.821       0.822         0.0438 1.000   1.000

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

suggest_best_k(res)
#> [1] 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
#> GSM2819     1   0.999     -0.584 0.516 0.484
#> GSM2820     2   0.891      0.647 0.308 0.692
#> GSM2822     2   0.958      0.712 0.380 0.620
#> GSM2832     2   0.958      0.712 0.380 0.620
#> GSM2823     2   0.844      0.680 0.272 0.728
#> GSM2824     2   0.844      0.680 0.272 0.728
#> GSM2825     2   1.000      0.555 0.496 0.504
#> GSM2826     2   1.000      0.555 0.496 0.504
#> GSM2829     1   0.000      0.951 1.000 0.000
#> GSM2856     1   0.000      0.951 1.000 0.000
#> GSM2830     1   0.000      0.951 1.000 0.000
#> GSM2843     1   0.000      0.951 1.000 0.000
#> GSM2871     1   0.000      0.951 1.000 0.000
#> GSM2831     1   0.000      0.951 1.000 0.000
#> GSM2844     1   0.000      0.951 1.000 0.000
#> GSM2833     1   0.000      0.951 1.000 0.000
#> GSM2846     1   0.000      0.951 1.000 0.000
#> GSM2835     1   0.000      0.951 1.000 0.000
#> GSM2858     1   0.000      0.951 1.000 0.000
#> GSM2836     2   0.955      0.715 0.376 0.624
#> GSM2848     2   0.955      0.715 0.376 0.624
#> GSM2828     2   0.891      0.647 0.308 0.692
#> GSM2837     2   0.973      0.480 0.404 0.596
#> GSM2839     2   0.827      0.482 0.260 0.740
#> GSM2841     2   0.827      0.482 0.260 0.740
#> GSM2827     2   0.955      0.715 0.376 0.624
#> GSM2842     2   0.955      0.715 0.376 0.624
#> GSM2845     1   0.000      0.951 1.000 0.000
#> GSM2872     1   0.000      0.951 1.000 0.000
#> GSM2834     1   0.000      0.951 1.000 0.000
#> GSM2847     1   0.000      0.951 1.000 0.000
#> GSM2849     2   0.891      0.647 0.308 0.692
#> GSM2850     2   0.891      0.647 0.308 0.692
#> GSM2838     2   0.955      0.715 0.376 0.624
#> GSM2853     2   0.955      0.715 0.376 0.624
#> GSM2852     2   0.839      0.682 0.268 0.732
#> GSM2855     2   0.839      0.682 0.268 0.732
#> GSM2840     2   0.827      0.482 0.260 0.740
#> GSM2857     2   0.827      0.482 0.260 0.740
#> GSM2859     2   0.955      0.715 0.376 0.624
#> GSM2860     2   0.955      0.715 0.376 0.624
#> GSM2861     2   0.917      0.710 0.332 0.668
#> GSM2862     2   0.955      0.715 0.376 0.624
#> GSM2863     2   0.955      0.715 0.376 0.624
#> GSM2864     2   0.955      0.715 0.376 0.624
#> GSM2865     2   0.955      0.715 0.376 0.624
#> GSM2866     2   0.955      0.715 0.376 0.624
#> GSM2868     2   0.955      0.715 0.376 0.624
#> GSM2869     2   0.955      0.715 0.376 0.624
#> GSM2851     2   0.955      0.715 0.376 0.624
#> GSM2867     2   0.955      0.715 0.376 0.624
#> GSM2870     2   0.955      0.715 0.376 0.624
#> GSM2854     1   0.000      0.951 1.000 0.000
#> GSM2873     2   0.955      0.715 0.376 0.624
#> GSM2874     2   0.891      0.647 0.308 0.692
#> GSM2884     2   0.891      0.647 0.308 0.692
#> GSM2875     2   0.827      0.482 0.260 0.740
#> GSM2890     2   0.827      0.482 0.260 0.740
#> GSM2877     2   0.827      0.482 0.260 0.740
#> GSM2892     2   0.827      0.482 0.260 0.740
#> GSM2902     2   0.827      0.482 0.260 0.740
#> GSM2878     2   0.827      0.482 0.260 0.740
#> GSM2901     2   0.827      0.482 0.260 0.740
#> GSM2879     2   0.814      0.689 0.252 0.748
#> GSM2898     2   0.814      0.689 0.252 0.748
#> GSM2881     2   0.891      0.647 0.308 0.692
#> GSM2897     2   0.891      0.647 0.308 0.692
#> GSM2882     1   0.000      0.951 1.000 0.000
#> GSM2894     1   0.000      0.951 1.000 0.000
#> GSM2883     2   0.814      0.689 0.252 0.748
#> GSM2895     2   0.814      0.689 0.252 0.748
#> GSM2885     2   0.891      0.647 0.308 0.692
#> GSM2886     2   0.891      0.647 0.308 0.692
#> GSM2887     2   0.833      0.683 0.264 0.736
#> GSM2896     2   0.833      0.683 0.264 0.736
#> GSM2888     2   0.821      0.688 0.256 0.744
#> GSM2889     2   0.821      0.688 0.256 0.744
#> GSM2876     2   0.827      0.482 0.260 0.740
#> GSM2891     2   0.827      0.482 0.260 0.740
#> GSM2880     2   0.827      0.482 0.260 0.740
#> GSM2893     2   0.827      0.482 0.260 0.740
#> GSM2821     2   0.827      0.482 0.260 0.740
#> GSM2900     2   0.827      0.482 0.260 0.740
#> GSM2903     2   0.827      0.482 0.260 0.740

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     3   0.832      0.674 0.284 0.116 0.600
#> GSM2820     3   0.270      0.794 0.016 0.056 0.928
#> GSM2822     3   0.650      0.827 0.140 0.100 0.760
#> GSM2832     3   0.650      0.827 0.140 0.100 0.760
#> GSM2823     3   0.663      0.581 0.360 0.016 0.624
#> GSM2824     3   0.663      0.581 0.360 0.016 0.624
#> GSM2825     3   0.795      0.703 0.252 0.108 0.640
#> GSM2826     3   0.795      0.703 0.252 0.108 0.640
#> GSM2829     2   0.341      0.989 0.080 0.900 0.020
#> GSM2856     2   0.341      0.989 0.080 0.900 0.020
#> GSM2830     2   0.295      0.991 0.060 0.920 0.020
#> GSM2843     2   0.285      0.991 0.056 0.924 0.020
#> GSM2871     2   0.295      0.990 0.060 0.920 0.020
#> GSM2831     2   0.333      0.990 0.076 0.904 0.020
#> GSM2844     2   0.333      0.990 0.076 0.904 0.020
#> GSM2833     2   0.341      0.989 0.080 0.900 0.020
#> GSM2846     2   0.341      0.989 0.080 0.900 0.020
#> GSM2835     2   0.341      0.989 0.080 0.900 0.020
#> GSM2858     2   0.341      0.989 0.080 0.900 0.020
#> GSM2836     3   0.650      0.827 0.140 0.100 0.760
#> GSM2848     3   0.650      0.827 0.140 0.100 0.760
#> GSM2828     3   0.270      0.794 0.016 0.056 0.928
#> GSM2837     3   0.300      0.786 0.016 0.068 0.916
#> GSM2839     1   0.231      0.988 0.944 0.024 0.032
#> GSM2841     1   0.231      0.988 0.944 0.024 0.032
#> GSM2827     3   0.650      0.827 0.140 0.100 0.760
#> GSM2842     3   0.650      0.827 0.140 0.100 0.760
#> GSM2845     2   0.295      0.990 0.060 0.920 0.020
#> GSM2872     2   0.295      0.990 0.060 0.920 0.020
#> GSM2834     2   0.295      0.990 0.060 0.920 0.020
#> GSM2847     2   0.295      0.990 0.060 0.920 0.020
#> GSM2849     3   0.270      0.794 0.016 0.056 0.928
#> GSM2850     3   0.270      0.794 0.016 0.056 0.928
#> GSM2838     3   0.650      0.827 0.140 0.100 0.760
#> GSM2853     3   0.650      0.827 0.140 0.100 0.760
#> GSM2852     3   0.270      0.794 0.016 0.056 0.928
#> GSM2855     3   0.270      0.794 0.016 0.056 0.928
#> GSM2840     1   0.231      0.988 0.944 0.024 0.032
#> GSM2857     1   0.231      0.988 0.944 0.024 0.032
#> GSM2859     3   0.650      0.827 0.140 0.100 0.760
#> GSM2860     3   0.650      0.827 0.140 0.100 0.760
#> GSM2861     3   0.534      0.826 0.092 0.084 0.824
#> GSM2862     3   0.650      0.827 0.140 0.100 0.760
#> GSM2863     3   0.650      0.827 0.140 0.100 0.760
#> GSM2864     3   0.650      0.827 0.140 0.100 0.760
#> GSM2865     3   0.650      0.827 0.140 0.100 0.760
#> GSM2866     3   0.650      0.827 0.140 0.100 0.760
#> GSM2868     3   0.650      0.827 0.140 0.100 0.760
#> GSM2869     3   0.650      0.827 0.140 0.100 0.760
#> GSM2851     3   0.650      0.827 0.140 0.100 0.760
#> GSM2867     3   0.650      0.827 0.140 0.100 0.760
#> GSM2870     3   0.650      0.827 0.140 0.100 0.760
#> GSM2854     2   0.295      0.991 0.060 0.920 0.020
#> GSM2873     3   0.650      0.827 0.140 0.100 0.760
#> GSM2874     3   0.270      0.794 0.016 0.056 0.928
#> GSM2884     3   0.270      0.794 0.016 0.056 0.928
#> GSM2875     1   0.175      0.992 0.960 0.012 0.028
#> GSM2890     1   0.175      0.992 0.960 0.012 0.028
#> GSM2877     1   0.175      0.992 0.960 0.012 0.028
#> GSM2892     1   0.175      0.992 0.960 0.012 0.028
#> GSM2902     1   0.175      0.992 0.960 0.012 0.028
#> GSM2878     1   0.175      0.992 0.960 0.012 0.028
#> GSM2901     1   0.175      0.992 0.960 0.012 0.028
#> GSM2879     3   0.116      0.811 0.028 0.000 0.972
#> GSM2898     3   0.116      0.811 0.028 0.000 0.972
#> GSM2881     3   0.270      0.794 0.016 0.056 0.928
#> GSM2897     3   0.270      0.794 0.016 0.056 0.928
#> GSM2882     2   0.285      0.991 0.056 0.924 0.020
#> GSM2894     2   0.285      0.991 0.056 0.924 0.020
#> GSM2883     3   0.270      0.794 0.016 0.056 0.928
#> GSM2895     3   0.270      0.794 0.016 0.056 0.928
#> GSM2885     3   0.270      0.794 0.016 0.056 0.928
#> GSM2886     3   0.270      0.794 0.016 0.056 0.928
#> GSM2887     3   0.270      0.794 0.016 0.056 0.928
#> GSM2896     3   0.270      0.794 0.016 0.056 0.928
#> GSM2888     3   0.103      0.812 0.024 0.000 0.976
#> GSM2889     3   0.103      0.812 0.024 0.000 0.976
#> GSM2876     1   0.175      0.992 0.960 0.012 0.028
#> GSM2891     1   0.175      0.992 0.960 0.012 0.028
#> GSM2880     1   0.175      0.992 0.960 0.012 0.028
#> GSM2893     1   0.175      0.992 0.960 0.012 0.028
#> GSM2821     1   0.223      0.977 0.944 0.012 0.044
#> GSM2900     1   0.223      0.977 0.944 0.012 0.044
#> GSM2903     1   0.223      0.977 0.944 0.012 0.044

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.3626      0.833 0.016 0.844 0.136 0.004
#> GSM2820     3  0.3801      0.998 0.000 0.220 0.780 0.000
#> GSM2822     2  0.1867      0.911 0.000 0.928 0.072 0.000
#> GSM2832     2  0.1867      0.911 0.000 0.928 0.072 0.000
#> GSM2823     2  0.3006      0.878 0.012 0.888 0.092 0.008
#> GSM2824     2  0.3006      0.878 0.012 0.888 0.092 0.008
#> GSM2825     2  0.2593      0.879 0.004 0.892 0.104 0.000
#> GSM2826     2  0.2593      0.879 0.004 0.892 0.104 0.000
#> GSM2829     4  0.2465      0.963 0.020 0.012 0.044 0.924
#> GSM2856     4  0.2465      0.963 0.020 0.012 0.044 0.924
#> GSM2830     4  0.1749      0.964 0.024 0.012 0.012 0.952
#> GSM2843     4  0.1471      0.963 0.024 0.012 0.004 0.960
#> GSM2871     4  0.2956      0.950 0.036 0.012 0.048 0.904
#> GSM2831     4  0.2284      0.963 0.020 0.012 0.036 0.932
#> GSM2844     4  0.2284      0.963 0.020 0.012 0.036 0.932
#> GSM2833     4  0.2465      0.963 0.020 0.012 0.044 0.924
#> GSM2846     4  0.2465      0.963 0.020 0.012 0.044 0.924
#> GSM2835     4  0.2465      0.963 0.020 0.012 0.044 0.924
#> GSM2858     4  0.2465      0.963 0.020 0.012 0.044 0.924
#> GSM2836     2  0.0000      0.955 0.000 1.000 0.000 0.000
#> GSM2848     2  0.0000      0.955 0.000 1.000 0.000 0.000
#> GSM2828     3  0.3982      0.997 0.000 0.220 0.776 0.004
#> GSM2837     3  0.3982      0.997 0.000 0.220 0.776 0.004
#> GSM2839     1  0.3752      0.947 0.864 0.036 0.084 0.016
#> GSM2841     1  0.3752      0.947 0.864 0.036 0.084 0.016
#> GSM2827     2  0.0336      0.953 0.000 0.992 0.008 0.000
#> GSM2842     2  0.0188      0.954 0.000 0.996 0.004 0.000
#> GSM2845     4  0.2956      0.950 0.036 0.012 0.048 0.904
#> GSM2872     4  0.2956      0.950 0.036 0.012 0.048 0.904
#> GSM2834     4  0.2956      0.950 0.036 0.012 0.048 0.904
#> GSM2847     4  0.2781      0.952 0.036 0.012 0.040 0.912
#> GSM2849     3  0.3982      0.997 0.000 0.220 0.776 0.004
#> GSM2850     3  0.3982      0.997 0.000 0.220 0.776 0.004
#> GSM2838     2  0.0336      0.954 0.008 0.992 0.000 0.000
#> GSM2853     2  0.0336      0.954 0.008 0.992 0.000 0.000
#> GSM2852     3  0.3982      0.997 0.000 0.220 0.776 0.004
#> GSM2855     3  0.3982      0.997 0.000 0.220 0.776 0.004
#> GSM2840     1  0.3752      0.947 0.864 0.036 0.084 0.016
#> GSM2857     1  0.3752      0.947 0.864 0.036 0.084 0.016
#> GSM2859     2  0.0000      0.955 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.955 0.000 1.000 0.000 0.000
#> GSM2861     2  0.0524      0.950 0.004 0.988 0.008 0.000
#> GSM2862     2  0.0000      0.955 0.000 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.955 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.955 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.955 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0188      0.954 0.000 0.996 0.004 0.000
#> GSM2868     2  0.0524      0.953 0.008 0.988 0.000 0.004
#> GSM2869     2  0.0524      0.953 0.008 0.988 0.000 0.004
#> GSM2851     2  0.0524      0.953 0.008 0.988 0.000 0.004
#> GSM2867     2  0.0524      0.953 0.008 0.988 0.000 0.004
#> GSM2870     2  0.0524      0.953 0.008 0.988 0.000 0.004
#> GSM2854     4  0.2686      0.957 0.032 0.012 0.040 0.916
#> GSM2873     2  0.1004      0.943 0.004 0.972 0.024 0.000
#> GSM2874     3  0.3801      0.998 0.000 0.220 0.780 0.000
#> GSM2884     3  0.3801      0.998 0.000 0.220 0.780 0.000
#> GSM2875     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2890     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2877     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2892     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2902     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2878     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2901     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2879     2  0.1389      0.912 0.000 0.952 0.048 0.000
#> GSM2898     2  0.1389      0.912 0.000 0.952 0.048 0.000
#> GSM2881     3  0.3801      0.998 0.000 0.220 0.780 0.000
#> GSM2897     3  0.3801      0.998 0.000 0.220 0.780 0.000
#> GSM2882     4  0.0937      0.965 0.012 0.012 0.000 0.976
#> GSM2894     4  0.0937      0.965 0.012 0.012 0.000 0.976
#> GSM2883     3  0.4163      0.995 0.004 0.220 0.772 0.004
#> GSM2895     3  0.4163      0.995 0.004 0.220 0.772 0.004
#> GSM2885     3  0.3801      0.998 0.000 0.220 0.780 0.000
#> GSM2886     3  0.3801      0.998 0.000 0.220 0.780 0.000
#> GSM2887     3  0.3982      0.997 0.000 0.220 0.776 0.004
#> GSM2896     3  0.3982      0.997 0.000 0.220 0.776 0.004
#> GSM2888     2  0.1762      0.908 0.004 0.944 0.048 0.004
#> GSM2889     2  0.1762      0.908 0.004 0.944 0.048 0.004
#> GSM2876     1  0.1584      0.968 0.952 0.036 0.000 0.012
#> GSM2891     1  0.1584      0.968 0.952 0.036 0.000 0.012
#> GSM2880     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2893     1  0.1452      0.969 0.956 0.036 0.000 0.008
#> GSM2821     1  0.3877      0.931 0.852 0.044 0.096 0.008
#> GSM2900     1  0.3919      0.933 0.852 0.040 0.096 0.012
#> GSM2903     1  0.3919      0.933 0.852 0.040 0.096 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4 p5
#> GSM2819     2  0.4401      0.694 0.000 0.656 0.016 0.000 NA
#> GSM2820     3  0.2488      0.948 0.000 0.124 0.872 0.000 NA
#> GSM2822     2  0.2612      0.867 0.000 0.868 0.008 0.000 NA
#> GSM2832     2  0.2612      0.867 0.000 0.868 0.008 0.000 NA
#> GSM2823     2  0.4422      0.730 0.004 0.680 0.016 0.000 NA
#> GSM2824     2  0.4422      0.730 0.004 0.680 0.016 0.000 NA
#> GSM2825     2  0.3562      0.818 0.000 0.788 0.016 0.000 NA
#> GSM2826     2  0.3562      0.818 0.000 0.788 0.016 0.000 NA
#> GSM2829     4  0.0807      0.909 0.000 0.000 0.012 0.976 NA
#> GSM2856     4  0.0807      0.909 0.000 0.000 0.012 0.976 NA
#> GSM2830     4  0.2389      0.914 0.000 0.000 0.004 0.880 NA
#> GSM2843     4  0.2909      0.909 0.000 0.000 0.012 0.848 NA
#> GSM2871     4  0.4193      0.873 0.000 0.000 0.024 0.720 NA
#> GSM2831     4  0.0566      0.911 0.000 0.000 0.012 0.984 NA
#> GSM2844     4  0.0566      0.911 0.000 0.000 0.012 0.984 NA
#> GSM2833     4  0.0693      0.911 0.000 0.000 0.012 0.980 NA
#> GSM2846     4  0.0693      0.911 0.000 0.000 0.012 0.980 NA
#> GSM2835     4  0.0451      0.911 0.000 0.000 0.004 0.988 NA
#> GSM2858     4  0.0451      0.911 0.000 0.000 0.004 0.988 NA
#> GSM2836     2  0.0794      0.906 0.000 0.972 0.000 0.000 NA
#> GSM2848     2  0.0794      0.906 0.000 0.972 0.000 0.000 NA
#> GSM2828     3  0.3339      0.941 0.000 0.124 0.836 0.000 NA
#> GSM2837     3  0.3339      0.941 0.000 0.124 0.836 0.000 NA
#> GSM2839     1  0.4411      0.858 0.756 0.004 0.044 0.004 NA
#> GSM2841     1  0.4411      0.858 0.756 0.004 0.044 0.004 NA
#> GSM2827     2  0.1121      0.904 0.000 0.956 0.000 0.000 NA
#> GSM2842     2  0.1121      0.904 0.000 0.956 0.000 0.000 NA
#> GSM2845     4  0.4223      0.875 0.000 0.000 0.028 0.724 NA
#> GSM2872     4  0.4223      0.875 0.000 0.000 0.028 0.724 NA
#> GSM2834     4  0.4141      0.876 0.000 0.000 0.024 0.728 NA
#> GSM2847     4  0.4026      0.879 0.000 0.000 0.020 0.736 NA
#> GSM2849     3  0.3339      0.941 0.000 0.124 0.836 0.000 NA
#> GSM2850     3  0.3339      0.941 0.000 0.124 0.836 0.000 NA
#> GSM2838     2  0.1357      0.904 0.004 0.948 0.000 0.000 NA
#> GSM2853     2  0.1357      0.904 0.004 0.948 0.000 0.000 NA
#> GSM2852     3  0.4679      0.914 0.000 0.124 0.740 0.000 NA
#> GSM2855     3  0.4679      0.914 0.000 0.124 0.740 0.000 NA
#> GSM2840     1  0.4481      0.857 0.752 0.004 0.048 0.004 NA
#> GSM2857     1  0.4481      0.857 0.752 0.004 0.048 0.004 NA
#> GSM2859     2  0.0162      0.908 0.000 0.996 0.000 0.000 NA
#> GSM2860     2  0.0162      0.908 0.000 0.996 0.000 0.000 NA
#> GSM2861     2  0.0955      0.905 0.004 0.968 0.000 0.000 NA
#> GSM2862     2  0.0162      0.908 0.000 0.996 0.000 0.000 NA
#> GSM2863     2  0.0162      0.908 0.000 0.996 0.000 0.000 NA
#> GSM2864     2  0.0162      0.908 0.000 0.996 0.000 0.000 NA
#> GSM2865     2  0.0162      0.908 0.000 0.996 0.000 0.000 NA
#> GSM2866     2  0.0162      0.908 0.000 0.996 0.000 0.000 NA
#> GSM2868     2  0.1831      0.898 0.004 0.920 0.000 0.000 NA
#> GSM2869     2  0.1831      0.898 0.004 0.920 0.000 0.000 NA
#> GSM2851     2  0.1831      0.898 0.004 0.920 0.000 0.000 NA
#> GSM2867     2  0.1831      0.898 0.004 0.920 0.000 0.000 NA
#> GSM2870     2  0.1831      0.898 0.004 0.920 0.000 0.000 NA
#> GSM2854     4  0.3769      0.900 0.000 0.000 0.032 0.788 NA
#> GSM2873     2  0.1386      0.903 0.000 0.952 0.016 0.000 NA
#> GSM2874     3  0.2329      0.948 0.000 0.124 0.876 0.000 NA
#> GSM2884     3  0.2329      0.948 0.000 0.124 0.876 0.000 NA
#> GSM2875     1  0.0324      0.921 0.992 0.004 0.000 0.004 NA
#> GSM2890     1  0.0324      0.921 0.992 0.004 0.000 0.004 NA
#> GSM2877     1  0.0324      0.921 0.992 0.004 0.000 0.004 NA
#> GSM2892     1  0.0324      0.921 0.992 0.004 0.000 0.004 NA
#> GSM2902     1  0.0324      0.921 0.992 0.004 0.000 0.004 NA
#> GSM2878     1  0.0324      0.921 0.992 0.004 0.000 0.004 NA
#> GSM2901     1  0.0324      0.921 0.992 0.004 0.000 0.004 NA
#> GSM2879     2  0.3086      0.811 0.000 0.816 0.004 0.000 NA
#> GSM2898     2  0.3086      0.811 0.000 0.816 0.004 0.000 NA
#> GSM2881     3  0.2329      0.948 0.000 0.124 0.876 0.000 NA
#> GSM2897     3  0.2329      0.948 0.000 0.124 0.876 0.000 NA
#> GSM2882     4  0.2331      0.915 0.000 0.000 0.020 0.900 NA
#> GSM2894     4  0.2331      0.915 0.000 0.000 0.020 0.900 NA
#> GSM2883     3  0.5332      0.883 0.004 0.120 0.680 0.000 NA
#> GSM2895     3  0.5332      0.883 0.004 0.120 0.680 0.000 NA
#> GSM2885     3  0.2329      0.948 0.000 0.124 0.876 0.000 NA
#> GSM2886     3  0.2329      0.948 0.000 0.124 0.876 0.000 NA
#> GSM2887     3  0.4593      0.915 0.000 0.124 0.748 0.000 NA
#> GSM2896     3  0.4593      0.915 0.000 0.124 0.748 0.000 NA
#> GSM2888     2  0.2763      0.842 0.000 0.848 0.004 0.000 NA
#> GSM2889     2  0.2763      0.842 0.000 0.848 0.004 0.000 NA
#> GSM2876     1  0.0833      0.919 0.976 0.004 0.000 0.004 NA
#> GSM2891     1  0.0833      0.919 0.976 0.004 0.000 0.004 NA
#> GSM2880     1  0.0486      0.921 0.988 0.004 0.004 0.004 NA
#> GSM2893     1  0.0486      0.921 0.988 0.004 0.004 0.004 NA
#> GSM2821     1  0.4025      0.811 0.700 0.008 0.000 0.000 NA
#> GSM2900     1  0.3885      0.826 0.724 0.008 0.000 0.000 NA
#> GSM2903     1  0.3885      0.826 0.724 0.008 0.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4 p5    p6
#> GSM2819     2  0.4721      0.586 0.008 0.540 0.000 0.000 NA 0.032
#> GSM2820     3  0.1785      0.892 0.000 0.048 0.928 0.000 NA 0.016
#> GSM2822     2  0.3175      0.816 0.000 0.808 0.000 0.000 NA 0.028
#> GSM2832     2  0.3175      0.816 0.000 0.808 0.000 0.000 NA 0.028
#> GSM2823     2  0.5150      0.607 0.004 0.528 0.008 0.004 NA 0.044
#> GSM2824     2  0.5150      0.607 0.004 0.528 0.008 0.004 NA 0.044
#> GSM2825     2  0.4164      0.776 0.000 0.728 0.012 0.000 NA 0.040
#> GSM2826     2  0.4164      0.776 0.000 0.728 0.012 0.000 NA 0.040
#> GSM2829     4  0.0810      0.828 0.008 0.000 0.008 0.976 NA 0.004
#> GSM2856     4  0.0810      0.828 0.008 0.000 0.008 0.976 NA 0.004
#> GSM2830     4  0.3759      0.839 0.008 0.000 0.008 0.732 NA 0.248
#> GSM2843     4  0.3997      0.831 0.008 0.000 0.008 0.688 NA 0.292
#> GSM2871     4  0.4348      0.778 0.004 0.004 0.000 0.520 NA 0.464
#> GSM2831     4  0.1129      0.829 0.008 0.000 0.012 0.964 NA 0.012
#> GSM2844     4  0.1129      0.829 0.008 0.000 0.012 0.964 NA 0.012
#> GSM2833     4  0.0972      0.829 0.008 0.000 0.000 0.964 NA 0.000
#> GSM2846     4  0.0972      0.829 0.008 0.000 0.000 0.964 NA 0.000
#> GSM2835     4  0.0806      0.829 0.008 0.000 0.000 0.972 NA 0.000
#> GSM2858     4  0.0806      0.829 0.008 0.000 0.000 0.972 NA 0.000
#> GSM2836     2  0.1686      0.852 0.000 0.924 0.000 0.000 NA 0.012
#> GSM2848     2  0.1686      0.852 0.000 0.924 0.000 0.000 NA 0.012
#> GSM2828     3  0.3899      0.867 0.000 0.048 0.804 0.004 NA 0.112
#> GSM2837     3  0.3899      0.867 0.000 0.048 0.804 0.004 NA 0.112
#> GSM2839     1  0.5634      0.771 0.636 0.004 0.020 0.004 NA 0.164
#> GSM2841     1  0.5634      0.771 0.636 0.004 0.020 0.004 NA 0.164
#> GSM2827     2  0.2199      0.849 0.000 0.892 0.000 0.000 NA 0.020
#> GSM2842     2  0.2199      0.849 0.000 0.892 0.000 0.000 NA 0.020
#> GSM2845     4  0.4393      0.786 0.012 0.000 0.000 0.532 NA 0.448
#> GSM2872     4  0.4393      0.786 0.012 0.000 0.000 0.532 NA 0.448
#> GSM2834     4  0.4083      0.786 0.008 0.000 0.000 0.532 NA 0.460
#> GSM2847     4  0.4072      0.791 0.008 0.000 0.000 0.544 NA 0.448
#> GSM2849     3  0.3899      0.867 0.000 0.048 0.804 0.004 NA 0.112
#> GSM2850     3  0.3899      0.867 0.000 0.048 0.804 0.004 NA 0.112
#> GSM2838     2  0.2309      0.842 0.000 0.888 0.000 0.000 NA 0.028
#> GSM2853     2  0.2309      0.842 0.000 0.888 0.000 0.000 NA 0.028
#> GSM2852     3  0.5133      0.838 0.000 0.048 0.696 0.000 NA 0.104
#> GSM2855     3  0.5133      0.838 0.000 0.048 0.696 0.000 NA 0.104
#> GSM2840     1  0.5634      0.771 0.636 0.004 0.020 0.004 NA 0.164
#> GSM2857     1  0.5634      0.771 0.636 0.004 0.020 0.004 NA 0.164
#> GSM2859     2  0.0146      0.857 0.000 0.996 0.000 0.000 NA 0.000
#> GSM2860     2  0.0146      0.857 0.000 0.996 0.000 0.000 NA 0.000
#> GSM2861     2  0.1643      0.848 0.000 0.924 0.000 0.000 NA 0.008
#> GSM2862     2  0.0146      0.857 0.000 0.996 0.000 0.000 NA 0.000
#> GSM2863     2  0.0146      0.857 0.000 0.996 0.000 0.000 NA 0.000
#> GSM2864     2  0.0146      0.857 0.000 0.996 0.000 0.000 NA 0.000
#> GSM2865     2  0.0146      0.857 0.000 0.996 0.000 0.000 NA 0.000
#> GSM2866     2  0.0405      0.857 0.000 0.988 0.000 0.000 NA 0.004
#> GSM2868     2  0.3332      0.824 0.000 0.808 0.000 0.000 NA 0.048
#> GSM2869     2  0.3332      0.824 0.000 0.808 0.000 0.000 NA 0.048
#> GSM2851     2  0.3213      0.827 0.000 0.820 0.000 0.000 NA 0.048
#> GSM2867     2  0.3332      0.824 0.000 0.808 0.000 0.000 NA 0.048
#> GSM2870     2  0.3254      0.826 0.000 0.816 0.000 0.000 NA 0.048
#> GSM2854     4  0.4264      0.809 0.008 0.000 0.000 0.604 NA 0.376
#> GSM2873     2  0.2250      0.846 0.000 0.896 0.000 0.000 NA 0.040
#> GSM2874     3  0.1477      0.892 0.000 0.048 0.940 0.000 NA 0.008
#> GSM2884     3  0.1075      0.894 0.000 0.048 0.952 0.000 NA 0.000
#> GSM2875     1  0.0291      0.871 0.992 0.004 0.000 0.004 NA 0.000
#> GSM2890     1  0.0291      0.871 0.992 0.004 0.000 0.004 NA 0.000
#> GSM2877     1  0.0291      0.871 0.992 0.004 0.000 0.004 NA 0.000
#> GSM2892     1  0.0291      0.871 0.992 0.004 0.000 0.004 NA 0.000
#> GSM2902     1  0.0291      0.871 0.992 0.004 0.000 0.004 NA 0.000
#> GSM2878     1  0.0291      0.871 0.992 0.004 0.000 0.004 NA 0.000
#> GSM2901     1  0.0291      0.871 0.992 0.004 0.000 0.004 NA 0.000
#> GSM2879     2  0.4656      0.717 0.000 0.684 0.004 0.004 NA 0.072
#> GSM2898     2  0.4656      0.717 0.000 0.684 0.004 0.004 NA 0.072
#> GSM2881     3  0.1075      0.894 0.000 0.048 0.952 0.000 NA 0.000
#> GSM2897     3  0.1075      0.894 0.000 0.048 0.952 0.000 NA 0.000
#> GSM2882     4  0.3521      0.841 0.008 0.000 0.008 0.768 NA 0.212
#> GSM2894     4  0.3521      0.841 0.008 0.000 0.008 0.768 NA 0.212
#> GSM2883     3  0.5903      0.795 0.004 0.052 0.620 0.000 NA 0.136
#> GSM2895     3  0.5903      0.795 0.004 0.052 0.620 0.000 NA 0.136
#> GSM2885     3  0.1075      0.894 0.000 0.048 0.952 0.000 NA 0.000
#> GSM2886     3  0.1075      0.894 0.000 0.048 0.952 0.000 NA 0.000
#> GSM2887     3  0.4811      0.844 0.000 0.048 0.728 0.000 NA 0.088
#> GSM2896     3  0.4811      0.844 0.000 0.048 0.728 0.000 NA 0.088
#> GSM2888     2  0.4438      0.725 0.000 0.708 0.004 0.000 NA 0.080
#> GSM2889     2  0.4438      0.725 0.000 0.708 0.004 0.000 NA 0.080
#> GSM2876     1  0.2016      0.861 0.916 0.004 0.008 0.004 NA 0.004
#> GSM2891     1  0.2016      0.861 0.916 0.004 0.008 0.004 NA 0.004
#> GSM2880     1  0.0436      0.871 0.988 0.004 0.000 0.004 NA 0.004
#> GSM2893     1  0.0436      0.871 0.988 0.004 0.000 0.004 NA 0.004
#> GSM2821     1  0.4522      0.694 0.548 0.008 0.000 0.000 NA 0.020
#> GSM2900     1  0.4473      0.715 0.576 0.008 0.000 0.000 NA 0.020
#> GSM2903     1  0.4473      0.715 0.576 0.008 0.000 0.000 NA 0.020

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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 tissue(p) k
#> ATC:kmeans 64  3.97e-04 2
#> ATC:kmeans 84  1.65e-08 3
#> ATC:kmeans 84  5.57e-12 4
#> ATC:kmeans 84  5.57e-12 5
#> ATC:kmeans 84  5.57e-12 6

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


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

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

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.954       0.966         0.5036 0.497   0.497
#> 3 3 1.000           0.973       0.988         0.2712 0.804   0.627
#> 4 4 0.973           0.946       0.978         0.1806 0.849   0.599
#> 5 5 0.892           0.863       0.927         0.0434 0.962   0.847
#> 6 6 0.879           0.776       0.864         0.0333 0.990   0.954

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>         class entropy silhouette    p1    p2
#> GSM2819     1  0.3431      0.967 0.936 0.064
#> GSM2820     2  0.3431      0.948 0.064 0.936
#> GSM2822     2  0.7745      0.685 0.228 0.772
#> GSM2832     2  0.7745      0.685 0.228 0.772
#> GSM2823     2  0.0000      0.963 0.000 1.000
#> GSM2824     2  0.0000      0.963 0.000 1.000
#> GSM2825     1  0.3431      0.967 0.936 0.064
#> GSM2826     1  0.3431      0.967 0.936 0.064
#> GSM2829     1  0.0000      0.962 1.000 0.000
#> GSM2856     1  0.0000      0.962 1.000 0.000
#> GSM2830     1  0.0000      0.962 1.000 0.000
#> GSM2843     1  0.0000      0.962 1.000 0.000
#> GSM2871     1  0.0000      0.962 1.000 0.000
#> GSM2831     1  0.0000      0.962 1.000 0.000
#> GSM2844     1  0.0000      0.962 1.000 0.000
#> GSM2833     1  0.0000      0.962 1.000 0.000
#> GSM2846     1  0.0000      0.962 1.000 0.000
#> GSM2835     1  0.0000      0.962 1.000 0.000
#> GSM2858     1  0.0000      0.962 1.000 0.000
#> GSM2836     2  0.0000      0.963 0.000 1.000
#> GSM2848     2  0.0000      0.963 0.000 1.000
#> GSM2828     2  0.3431      0.948 0.064 0.936
#> GSM2837     2  0.3431      0.948 0.064 0.936
#> GSM2839     1  0.3431      0.967 0.936 0.064
#> GSM2841     1  0.3431      0.967 0.936 0.064
#> GSM2827     2  0.0000      0.963 0.000 1.000
#> GSM2842     2  0.0000      0.963 0.000 1.000
#> GSM2845     1  0.0000      0.962 1.000 0.000
#> GSM2872     1  0.0000      0.962 1.000 0.000
#> GSM2834     1  0.0000      0.962 1.000 0.000
#> GSM2847     1  0.0000      0.962 1.000 0.000
#> GSM2849     2  0.3431      0.948 0.064 0.936
#> GSM2850     2  0.3431      0.948 0.064 0.936
#> GSM2838     2  0.0000      0.963 0.000 1.000
#> GSM2853     2  0.2043      0.957 0.032 0.968
#> GSM2852     2  0.3431      0.948 0.064 0.936
#> GSM2855     2  0.3431      0.948 0.064 0.936
#> GSM2840     1  0.3431      0.967 0.936 0.064
#> GSM2857     1  0.3431      0.967 0.936 0.064
#> GSM2859     2  0.0000      0.963 0.000 1.000
#> GSM2860     2  0.0000      0.963 0.000 1.000
#> GSM2861     2  0.0000      0.963 0.000 1.000
#> GSM2862     2  0.0000      0.963 0.000 1.000
#> GSM2863     2  0.0000      0.963 0.000 1.000
#> GSM2864     2  0.0000      0.963 0.000 1.000
#> GSM2865     2  0.0000      0.963 0.000 1.000
#> GSM2866     2  0.0000      0.963 0.000 1.000
#> GSM2868     2  0.0000      0.963 0.000 1.000
#> GSM2869     2  0.0000      0.963 0.000 1.000
#> GSM2851     2  0.0000      0.963 0.000 1.000
#> GSM2867     2  0.0000      0.963 0.000 1.000
#> GSM2870     2  0.0000      0.963 0.000 1.000
#> GSM2854     1  0.0000      0.962 1.000 0.000
#> GSM2873     2  0.3114      0.950 0.056 0.944
#> GSM2874     2  0.3431      0.948 0.064 0.936
#> GSM2884     2  0.3431      0.948 0.064 0.936
#> GSM2875     1  0.3431      0.967 0.936 0.064
#> GSM2890     1  0.3431      0.967 0.936 0.064
#> GSM2877     1  0.3431      0.967 0.936 0.064
#> GSM2892     1  0.3431      0.967 0.936 0.064
#> GSM2902     1  0.3431      0.967 0.936 0.064
#> GSM2878     1  0.3431      0.967 0.936 0.064
#> GSM2901     1  0.3431      0.967 0.936 0.064
#> GSM2879     2  0.0000      0.963 0.000 1.000
#> GSM2898     2  0.0000      0.963 0.000 1.000
#> GSM2881     2  0.3431      0.948 0.064 0.936
#> GSM2897     2  0.3431      0.948 0.064 0.936
#> GSM2882     1  0.0000      0.962 1.000 0.000
#> GSM2894     1  0.0000      0.962 1.000 0.000
#> GSM2883     2  0.0938      0.961 0.012 0.988
#> GSM2895     2  0.0376      0.963 0.004 0.996
#> GSM2885     2  0.3431      0.948 0.064 0.936
#> GSM2886     2  0.3431      0.948 0.064 0.936
#> GSM2887     2  0.3431      0.948 0.064 0.936
#> GSM2896     2  0.3431      0.948 0.064 0.936
#> GSM2888     2  0.0000      0.963 0.000 1.000
#> GSM2889     2  0.0000      0.963 0.000 1.000
#> GSM2876     1  0.3431      0.967 0.936 0.064
#> GSM2891     1  0.3431      0.967 0.936 0.064
#> GSM2880     1  0.3431      0.967 0.936 0.064
#> GSM2893     1  0.3431      0.967 0.936 0.064
#> GSM2821     1  0.3431      0.967 0.936 0.064
#> GSM2900     1  0.3431      0.967 0.936 0.064
#> GSM2903     1  0.3431      0.967 0.936 0.064

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     1   0.435      0.770 0.816 0.184 0.000
#> GSM2820     3   0.000      0.995 0.000 0.000 1.000
#> GSM2822     1   0.617      0.685 0.740 0.036 0.224
#> GSM2832     1   0.617      0.685 0.740 0.036 0.224
#> GSM2823     1   0.000      0.968 1.000 0.000 0.000
#> GSM2824     1   0.000      0.968 1.000 0.000 0.000
#> GSM2825     1   0.000      0.968 1.000 0.000 0.000
#> GSM2826     1   0.000      0.968 1.000 0.000 0.000
#> GSM2829     2   0.000      0.994 0.000 1.000 0.000
#> GSM2856     2   0.000      0.994 0.000 1.000 0.000
#> GSM2830     2   0.000      0.994 0.000 1.000 0.000
#> GSM2843     2   0.000      0.994 0.000 1.000 0.000
#> GSM2871     2   0.000      0.994 0.000 1.000 0.000
#> GSM2831     2   0.000      0.994 0.000 1.000 0.000
#> GSM2844     2   0.000      0.994 0.000 1.000 0.000
#> GSM2833     2   0.000      0.994 0.000 1.000 0.000
#> GSM2846     2   0.000      0.994 0.000 1.000 0.000
#> GSM2835     2   0.000      0.994 0.000 1.000 0.000
#> GSM2858     2   0.000      0.994 0.000 1.000 0.000
#> GSM2836     3   0.000      0.995 0.000 0.000 1.000
#> GSM2848     3   0.000      0.995 0.000 0.000 1.000
#> GSM2828     3   0.000      0.995 0.000 0.000 1.000
#> GSM2837     3   0.465      0.738 0.000 0.208 0.792
#> GSM2839     1   0.000      0.968 1.000 0.000 0.000
#> GSM2841     1   0.000      0.968 1.000 0.000 0.000
#> GSM2827     3   0.000      0.995 0.000 0.000 1.000
#> GSM2842     3   0.000      0.995 0.000 0.000 1.000
#> GSM2845     2   0.000      0.994 0.000 1.000 0.000
#> GSM2872     2   0.000      0.994 0.000 1.000 0.000
#> GSM2834     2   0.000      0.994 0.000 1.000 0.000
#> GSM2847     2   0.000      0.994 0.000 1.000 0.000
#> GSM2849     3   0.000      0.995 0.000 0.000 1.000
#> GSM2850     3   0.000      0.995 0.000 0.000 1.000
#> GSM2838     3   0.000      0.995 0.000 0.000 1.000
#> GSM2853     3   0.000      0.995 0.000 0.000 1.000
#> GSM2852     3   0.000      0.995 0.000 0.000 1.000
#> GSM2855     3   0.000      0.995 0.000 0.000 1.000
#> GSM2840     1   0.000      0.968 1.000 0.000 0.000
#> GSM2857     1   0.000      0.968 1.000 0.000 0.000
#> GSM2859     3   0.000      0.995 0.000 0.000 1.000
#> GSM2860     3   0.000      0.995 0.000 0.000 1.000
#> GSM2861     3   0.000      0.995 0.000 0.000 1.000
#> GSM2862     3   0.000      0.995 0.000 0.000 1.000
#> GSM2863     3   0.000      0.995 0.000 0.000 1.000
#> GSM2864     3   0.000      0.995 0.000 0.000 1.000
#> GSM2865     3   0.000      0.995 0.000 0.000 1.000
#> GSM2866     3   0.000      0.995 0.000 0.000 1.000
#> GSM2868     3   0.000      0.995 0.000 0.000 1.000
#> GSM2869     3   0.000      0.995 0.000 0.000 1.000
#> GSM2851     3   0.000      0.995 0.000 0.000 1.000
#> GSM2867     3   0.000      0.995 0.000 0.000 1.000
#> GSM2870     3   0.000      0.995 0.000 0.000 1.000
#> GSM2854     2   0.000      0.994 0.000 1.000 0.000
#> GSM2873     2   0.288      0.879 0.000 0.904 0.096
#> GSM2874     3   0.000      0.995 0.000 0.000 1.000
#> GSM2884     3   0.000      0.995 0.000 0.000 1.000
#> GSM2875     1   0.000      0.968 1.000 0.000 0.000
#> GSM2890     1   0.000      0.968 1.000 0.000 0.000
#> GSM2877     1   0.000      0.968 1.000 0.000 0.000
#> GSM2892     1   0.000      0.968 1.000 0.000 0.000
#> GSM2902     1   0.000      0.968 1.000 0.000 0.000
#> GSM2878     1   0.000      0.968 1.000 0.000 0.000
#> GSM2901     1   0.000      0.968 1.000 0.000 0.000
#> GSM2879     3   0.000      0.995 0.000 0.000 1.000
#> GSM2898     3   0.000      0.995 0.000 0.000 1.000
#> GSM2881     3   0.000      0.995 0.000 0.000 1.000
#> GSM2897     3   0.000      0.995 0.000 0.000 1.000
#> GSM2882     2   0.000      0.994 0.000 1.000 0.000
#> GSM2894     2   0.000      0.994 0.000 1.000 0.000
#> GSM2883     3   0.000      0.995 0.000 0.000 1.000
#> GSM2895     3   0.000      0.995 0.000 0.000 1.000
#> GSM2885     3   0.000      0.995 0.000 0.000 1.000
#> GSM2886     3   0.000      0.995 0.000 0.000 1.000
#> GSM2887     3   0.000      0.995 0.000 0.000 1.000
#> GSM2896     3   0.000      0.995 0.000 0.000 1.000
#> GSM2888     3   0.000      0.995 0.000 0.000 1.000
#> GSM2889     3   0.000      0.995 0.000 0.000 1.000
#> GSM2876     1   0.000      0.968 1.000 0.000 0.000
#> GSM2891     1   0.000      0.968 1.000 0.000 0.000
#> GSM2880     1   0.000      0.968 1.000 0.000 0.000
#> GSM2893     1   0.000      0.968 1.000 0.000 0.000
#> GSM2821     1   0.000      0.968 1.000 0.000 0.000
#> GSM2900     1   0.000      0.968 1.000 0.000 0.000
#> GSM2903     1   0.000      0.968 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     1   0.484      0.358 0.604 0.000 0.000 0.396
#> GSM2820     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2822     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2832     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2823     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2824     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2825     1   0.297      0.827 0.856 0.144 0.000 0.000
#> GSM2826     1   0.297      0.827 0.856 0.144 0.000 0.000
#> GSM2829     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2856     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2830     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2843     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2871     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2831     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2844     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2833     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2846     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2835     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2858     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2836     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2848     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2828     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2837     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2839     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2841     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2827     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2842     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2845     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2872     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2834     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2847     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2849     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2850     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2838     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2853     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2852     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2855     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2840     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2857     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2859     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2860     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2861     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2862     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2863     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2864     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2865     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2866     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2868     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2869     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2851     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2867     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2870     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2854     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2873     2   0.000      0.966 0.000 1.000 0.000 0.000
#> GSM2874     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2884     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2875     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2890     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2877     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2892     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2902     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2878     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2901     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2879     3   0.387      0.710 0.000 0.228 0.772 0.000
#> GSM2898     3   0.387      0.710 0.000 0.228 0.772 0.000
#> GSM2881     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2897     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2882     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2894     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM2883     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2895     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2885     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2886     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2887     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2896     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM2888     2   0.476      0.428 0.000 0.628 0.372 0.000
#> GSM2889     2   0.476      0.428 0.000 0.628 0.372 0.000
#> GSM2876     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2891     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2880     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2893     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2821     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2900     1   0.000      0.968 1.000 0.000 0.000 0.000
#> GSM2903     1   0.000      0.968 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.6124      0.090 0.412 0.000 0.000 0.128 0.460
#> GSM2820     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2822     5  0.3661      0.572 0.000 0.276 0.000 0.000 0.724
#> GSM2832     5  0.3661      0.572 0.000 0.276 0.000 0.000 0.724
#> GSM2823     1  0.2732      0.839 0.840 0.000 0.000 0.000 0.160
#> GSM2824     1  0.2732      0.839 0.840 0.000 0.000 0.000 0.160
#> GSM2825     5  0.3727      0.630 0.216 0.016 0.000 0.000 0.768
#> GSM2826     5  0.3727      0.630 0.216 0.016 0.000 0.000 0.768
#> GSM2829     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2856     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2830     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2843     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2871     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2831     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2846     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2835     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2858     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2836     2  0.2732      0.800 0.000 0.840 0.000 0.000 0.160
#> GSM2848     2  0.2732      0.800 0.000 0.840 0.000 0.000 0.160
#> GSM2828     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.1671      0.903 0.924 0.000 0.000 0.000 0.076
#> GSM2841     1  0.1671      0.903 0.924 0.000 0.000 0.000 0.076
#> GSM2827     2  0.3752      0.657 0.000 0.708 0.000 0.000 0.292
#> GSM2842     2  0.3752      0.657 0.000 0.708 0.000 0.000 0.292
#> GSM2845     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2872     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2834     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2847     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2849     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.1270      0.837 0.000 0.948 0.000 0.000 0.052
#> GSM2853     2  0.1270      0.837 0.000 0.948 0.000 0.000 0.052
#> GSM2852     3  0.0162      0.943 0.000 0.000 0.996 0.000 0.004
#> GSM2855     3  0.0162      0.943 0.000 0.000 0.996 0.000 0.004
#> GSM2840     1  0.1671      0.903 0.924 0.000 0.000 0.000 0.076
#> GSM2857     1  0.1671      0.903 0.924 0.000 0.000 0.000 0.076
#> GSM2859     2  0.1732      0.847 0.000 0.920 0.000 0.000 0.080
#> GSM2860     2  0.1732      0.847 0.000 0.920 0.000 0.000 0.080
#> GSM2861     2  0.0000      0.844 0.000 1.000 0.000 0.000 0.000
#> GSM2862     2  0.1732      0.847 0.000 0.920 0.000 0.000 0.080
#> GSM2863     2  0.1732      0.847 0.000 0.920 0.000 0.000 0.080
#> GSM2864     2  0.1732      0.847 0.000 0.920 0.000 0.000 0.080
#> GSM2865     2  0.1732      0.847 0.000 0.920 0.000 0.000 0.080
#> GSM2866     2  0.1732      0.847 0.000 0.920 0.000 0.000 0.080
#> GSM2868     2  0.1270      0.837 0.000 0.948 0.000 0.000 0.052
#> GSM2869     2  0.1270      0.837 0.000 0.948 0.000 0.000 0.052
#> GSM2851     2  0.1270      0.837 0.000 0.948 0.000 0.000 0.052
#> GSM2867     2  0.1270      0.837 0.000 0.948 0.000 0.000 0.052
#> GSM2870     2  0.1270      0.837 0.000 0.948 0.000 0.000 0.052
#> GSM2854     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2873     5  0.3999      0.442 0.000 0.344 0.000 0.000 0.656
#> GSM2874     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2879     3  0.5580      0.370 0.000 0.336 0.576 0.000 0.088
#> GSM2898     3  0.5593      0.360 0.000 0.340 0.572 0.000 0.088
#> GSM2881     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2894     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM2883     3  0.0162      0.943 0.000 0.000 0.996 0.000 0.004
#> GSM2895     3  0.0162      0.943 0.000 0.000 0.996 0.000 0.004
#> GSM2885     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      0.944 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0162      0.943 0.000 0.000 0.996 0.000 0.004
#> GSM2896     3  0.0162      0.943 0.000 0.000 0.996 0.000 0.004
#> GSM2888     2  0.4290      0.443 0.000 0.680 0.304 0.000 0.016
#> GSM2889     2  0.4290      0.443 0.000 0.680 0.304 0.000 0.016
#> GSM2876     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM2821     1  0.2020      0.892 0.900 0.000 0.000 0.000 0.100
#> GSM2900     1  0.2020      0.892 0.900 0.000 0.000 0.000 0.100
#> GSM2903     1  0.2020      0.892 0.900 0.000 0.000 0.000 0.100

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.6921     0.0732 0.336 0.000 0.000 0.080 0.408 0.176
#> GSM2820     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     5  0.4239     0.5957 0.000 0.248 0.000 0.000 0.696 0.056
#> GSM2832     5  0.4239     0.5957 0.000 0.248 0.000 0.000 0.696 0.056
#> GSM2823     1  0.5629     0.2483 0.448 0.000 0.000 0.000 0.148 0.404
#> GSM2824     1  0.5629     0.2483 0.448 0.000 0.000 0.000 0.148 0.404
#> GSM2825     5  0.3874     0.6030 0.136 0.060 0.000 0.000 0.788 0.016
#> GSM2826     5  0.3874     0.6030 0.136 0.060 0.000 0.000 0.788 0.016
#> GSM2829     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2843     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2871     4  0.0291     0.9941 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2831     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2846     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2835     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     2  0.3514     0.4195 0.000 0.752 0.000 0.000 0.020 0.228
#> GSM2848     2  0.3514     0.4195 0.000 0.752 0.000 0.000 0.020 0.228
#> GSM2828     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     1  0.2868     0.7654 0.840 0.000 0.000 0.000 0.132 0.028
#> GSM2841     1  0.2868     0.7654 0.840 0.000 0.000 0.000 0.132 0.028
#> GSM2827     2  0.5582    -0.1216 0.000 0.476 0.000 0.000 0.144 0.380
#> GSM2842     2  0.5582    -0.1216 0.000 0.476 0.000 0.000 0.144 0.380
#> GSM2845     4  0.0291     0.9941 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2872     4  0.0291     0.9941 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM2834     4  0.0146     0.9965 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2847     4  0.0146     0.9965 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2849     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.3619     0.6526 0.000 0.680 0.000 0.000 0.004 0.316
#> GSM2853     2  0.3619     0.6526 0.000 0.680 0.000 0.000 0.004 0.316
#> GSM2852     3  0.1461     0.9379 0.000 0.000 0.940 0.000 0.016 0.044
#> GSM2855     3  0.1461     0.9379 0.000 0.000 0.940 0.000 0.016 0.044
#> GSM2840     1  0.2868     0.7654 0.840 0.000 0.000 0.000 0.132 0.028
#> GSM2857     1  0.2868     0.7654 0.840 0.000 0.000 0.000 0.132 0.028
#> GSM2859     2  0.0146     0.6746 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2860     2  0.0146     0.6746 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2861     2  0.1957     0.6736 0.000 0.888 0.000 0.000 0.000 0.112
#> GSM2862     2  0.0146     0.6746 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2863     2  0.0146     0.6746 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2864     2  0.0146     0.6746 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2865     2  0.0146     0.6746 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM2866     2  0.0260     0.6724 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM2868     2  0.3953     0.6497 0.000 0.656 0.000 0.000 0.016 0.328
#> GSM2869     2  0.3953     0.6497 0.000 0.656 0.000 0.000 0.016 0.328
#> GSM2851     2  0.3953     0.6497 0.000 0.656 0.000 0.000 0.016 0.328
#> GSM2867     2  0.3953     0.6497 0.000 0.656 0.000 0.000 0.016 0.328
#> GSM2870     2  0.3953     0.6497 0.000 0.656 0.000 0.000 0.016 0.328
#> GSM2854     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2873     5  0.5469     0.4048 0.000 0.324 0.000 0.000 0.532 0.144
#> GSM2874     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     6  0.6838     1.0000 0.000 0.212 0.288 0.000 0.064 0.436
#> GSM2898     6  0.6838     1.0000 0.000 0.212 0.288 0.000 0.064 0.436
#> GSM2881     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2894     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2883     3  0.1500     0.9352 0.000 0.000 0.936 0.000 0.012 0.052
#> GSM2895     3  0.1563     0.9314 0.000 0.000 0.932 0.000 0.012 0.056
#> GSM2885     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9691 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.1461     0.9379 0.000 0.000 0.940 0.000 0.016 0.044
#> GSM2896     3  0.1461     0.9379 0.000 0.000 0.940 0.000 0.016 0.044
#> GSM2888     2  0.6183     0.2440 0.000 0.488 0.252 0.000 0.016 0.244
#> GSM2889     2  0.6183     0.2440 0.000 0.488 0.252 0.000 0.016 0.244
#> GSM2876     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2891     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2880     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000     0.8544 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     1  0.4094     0.6850 0.744 0.000 0.000 0.000 0.088 0.168
#> GSM2900     1  0.4094     0.6850 0.744 0.000 0.000 0.000 0.088 0.168
#> GSM2903     1  0.4094     0.6850 0.744 0.000 0.000 0.000 0.088 0.168

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 tissue(p) k
#> ATC:skmeans 84  4.54e-05 2
#> ATC:skmeans 84  6.67e-09 3
#> ATC:skmeans 81  6.79e-12 4
#> ATC:skmeans 78  3.91e-15 5
#> ATC:skmeans 74  9.11e-18 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) are extracted by 'ATC' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.510           0.893       0.895         0.3347 0.659   0.659
#> 3 3 0.676           0.906       0.861         0.7047 0.771   0.652
#> 4 4 1.000           0.969       0.989         0.2790 0.839   0.626
#> 5 5 1.000           0.958       0.983         0.0278 0.981   0.931
#> 6 6 0.973           0.901       0.951         0.0250 0.968   0.879

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>         class entropy silhouette    p1    p2
#> GSM2819     2   0.000      0.914 0.000 1.000
#> GSM2820     2   0.000      0.914 0.000 1.000
#> GSM2822     2   0.000      0.914 0.000 1.000
#> GSM2832     2   0.000      0.914 0.000 1.000
#> GSM2823     2   0.000      0.914 0.000 1.000
#> GSM2824     2   0.000      0.914 0.000 1.000
#> GSM2825     2   0.000      0.914 0.000 1.000
#> GSM2826     2   0.000      0.914 0.000 1.000
#> GSM2829     2   0.808      0.746 0.248 0.752
#> GSM2856     2   0.808      0.746 0.248 0.752
#> GSM2830     2   0.808      0.746 0.248 0.752
#> GSM2843     2   0.808      0.746 0.248 0.752
#> GSM2871     2   0.000      0.914 0.000 1.000
#> GSM2831     2   0.808      0.746 0.248 0.752
#> GSM2844     2   0.808      0.746 0.248 0.752
#> GSM2833     2   0.808      0.746 0.248 0.752
#> GSM2846     2   0.808      0.746 0.248 0.752
#> GSM2835     2   0.808      0.746 0.248 0.752
#> GSM2858     2   0.808      0.746 0.248 0.752
#> GSM2836     2   0.000      0.914 0.000 1.000
#> GSM2848     2   0.000      0.914 0.000 1.000
#> GSM2828     2   0.000      0.914 0.000 1.000
#> GSM2837     2   0.000      0.914 0.000 1.000
#> GSM2839     1   0.808      0.986 0.752 0.248
#> GSM2841     1   0.808      0.986 0.752 0.248
#> GSM2827     2   0.000      0.914 0.000 1.000
#> GSM2842     2   0.000      0.914 0.000 1.000
#> GSM2845     2   0.745      0.771 0.212 0.788
#> GSM2872     2   0.808      0.746 0.248 0.752
#> GSM2834     2   0.767      0.763 0.224 0.776
#> GSM2847     2   0.808      0.746 0.248 0.752
#> GSM2849     2   0.000      0.914 0.000 1.000
#> GSM2850     2   0.000      0.914 0.000 1.000
#> GSM2838     2   0.000      0.914 0.000 1.000
#> GSM2853     2   0.000      0.914 0.000 1.000
#> GSM2852     2   0.000      0.914 0.000 1.000
#> GSM2855     2   0.000      0.914 0.000 1.000
#> GSM2840     1   0.808      0.986 0.752 0.248
#> GSM2857     1   0.808      0.986 0.752 0.248
#> GSM2859     2   0.000      0.914 0.000 1.000
#> GSM2860     2   0.000      0.914 0.000 1.000
#> GSM2861     2   0.000      0.914 0.000 1.000
#> GSM2862     2   0.000      0.914 0.000 1.000
#> GSM2863     2   0.000      0.914 0.000 1.000
#> GSM2864     2   0.000      0.914 0.000 1.000
#> GSM2865     2   0.000      0.914 0.000 1.000
#> GSM2866     2   0.000      0.914 0.000 1.000
#> GSM2868     2   0.000      0.914 0.000 1.000
#> GSM2869     2   0.000      0.914 0.000 1.000
#> GSM2851     2   0.000      0.914 0.000 1.000
#> GSM2867     2   0.000      0.914 0.000 1.000
#> GSM2870     2   0.000      0.914 0.000 1.000
#> GSM2854     2   0.808      0.746 0.248 0.752
#> GSM2873     2   0.000      0.914 0.000 1.000
#> GSM2874     2   0.000      0.914 0.000 1.000
#> GSM2884     2   0.000      0.914 0.000 1.000
#> GSM2875     1   0.808      0.986 0.752 0.248
#> GSM2890     1   0.808      0.986 0.752 0.248
#> GSM2877     1   0.808      0.986 0.752 0.248
#> GSM2892     1   0.808      0.986 0.752 0.248
#> GSM2902     1   0.808      0.986 0.752 0.248
#> GSM2878     1   0.808      0.986 0.752 0.248
#> GSM2901     1   0.808      0.986 0.752 0.248
#> GSM2879     2   0.000      0.914 0.000 1.000
#> GSM2898     2   0.000      0.914 0.000 1.000
#> GSM2881     2   0.000      0.914 0.000 1.000
#> GSM2897     2   0.000      0.914 0.000 1.000
#> GSM2882     2   0.808      0.746 0.248 0.752
#> GSM2894     2   0.808      0.746 0.248 0.752
#> GSM2883     2   0.000      0.914 0.000 1.000
#> GSM2895     2   0.000      0.914 0.000 1.000
#> GSM2885     2   0.000      0.914 0.000 1.000
#> GSM2886     2   0.000      0.914 0.000 1.000
#> GSM2887     2   0.000      0.914 0.000 1.000
#> GSM2896     2   0.000      0.914 0.000 1.000
#> GSM2888     2   0.000      0.914 0.000 1.000
#> GSM2889     2   0.000      0.914 0.000 1.000
#> GSM2876     1   0.808      0.986 0.752 0.248
#> GSM2891     1   0.808      0.986 0.752 0.248
#> GSM2880     1   0.808      0.986 0.752 0.248
#> GSM2893     1   0.808      0.986 0.752 0.248
#> GSM2821     1   0.981      0.705 0.580 0.420
#> GSM2900     1   0.808      0.986 0.752 0.248
#> GSM2903     1   0.808      0.986 0.752 0.248

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>         class entropy silhouette    p1    p2    p3
#> GSM2819     3   0.460      0.902 0.000 0.204 0.796
#> GSM2820     3   0.000      0.831 0.000 0.000 1.000
#> GSM2822     3   0.460      0.902 0.000 0.204 0.796
#> GSM2832     3   0.460      0.902 0.000 0.204 0.796
#> GSM2823     3   0.460      0.902 0.000 0.204 0.796
#> GSM2824     3   0.460      0.902 0.000 0.204 0.796
#> GSM2825     3   0.460      0.902 0.000 0.204 0.796
#> GSM2826     3   0.460      0.902 0.000 0.204 0.796
#> GSM2829     2   0.000      0.982 0.000 1.000 0.000
#> GSM2856     2   0.000      0.982 0.000 1.000 0.000
#> GSM2830     2   0.000      0.982 0.000 1.000 0.000
#> GSM2843     2   0.000      0.982 0.000 1.000 0.000
#> GSM2871     3   0.475      0.891 0.000 0.216 0.784
#> GSM2831     2   0.000      0.982 0.000 1.000 0.000
#> GSM2844     2   0.000      0.982 0.000 1.000 0.000
#> GSM2833     2   0.000      0.982 0.000 1.000 0.000
#> GSM2846     2   0.000      0.982 0.000 1.000 0.000
#> GSM2835     2   0.000      0.982 0.000 1.000 0.000
#> GSM2858     2   0.000      0.982 0.000 1.000 0.000
#> GSM2836     3   0.460      0.902 0.000 0.204 0.796
#> GSM2848     3   0.460      0.902 0.000 0.204 0.796
#> GSM2828     3   0.000      0.831 0.000 0.000 1.000
#> GSM2837     3   0.000      0.831 0.000 0.000 1.000
#> GSM2839     1   0.000      0.975 1.000 0.000 0.000
#> GSM2841     1   0.000      0.975 1.000 0.000 0.000
#> GSM2827     3   0.460      0.902 0.000 0.204 0.796
#> GSM2842     3   0.460      0.902 0.000 0.204 0.796
#> GSM2845     3   0.604      0.653 0.000 0.380 0.620
#> GSM2872     2   0.000      0.982 0.000 1.000 0.000
#> GSM2834     2   0.450      0.676 0.000 0.804 0.196
#> GSM2847     2   0.000      0.982 0.000 1.000 0.000
#> GSM2849     3   0.000      0.831 0.000 0.000 1.000
#> GSM2850     3   0.000      0.831 0.000 0.000 1.000
#> GSM2838     3   0.460      0.902 0.000 0.204 0.796
#> GSM2853     3   0.460      0.902 0.000 0.204 0.796
#> GSM2852     3   0.000      0.831 0.000 0.000 1.000
#> GSM2855     3   0.000      0.831 0.000 0.000 1.000
#> GSM2840     1   0.382      0.760 0.852 0.148 0.000
#> GSM2857     1   0.000      0.975 1.000 0.000 0.000
#> GSM2859     3   0.460      0.902 0.000 0.204 0.796
#> GSM2860     3   0.460      0.902 0.000 0.204 0.796
#> GSM2861     3   0.460      0.902 0.000 0.204 0.796
#> GSM2862     3   0.460      0.902 0.000 0.204 0.796
#> GSM2863     3   0.460      0.902 0.000 0.204 0.796
#> GSM2864     3   0.460      0.902 0.000 0.204 0.796
#> GSM2865     3   0.460      0.902 0.000 0.204 0.796
#> GSM2866     3   0.460      0.902 0.000 0.204 0.796
#> GSM2868     3   0.460      0.902 0.000 0.204 0.796
#> GSM2869     3   0.460      0.902 0.000 0.204 0.796
#> GSM2851     3   0.460      0.902 0.000 0.204 0.796
#> GSM2867     3   0.460      0.902 0.000 0.204 0.796
#> GSM2870     3   0.460      0.902 0.000 0.204 0.796
#> GSM2854     2   0.000      0.982 0.000 1.000 0.000
#> GSM2873     3   0.460      0.902 0.000 0.204 0.796
#> GSM2874     3   0.000      0.831 0.000 0.000 1.000
#> GSM2884     3   0.000      0.831 0.000 0.000 1.000
#> GSM2875     1   0.000      0.975 1.000 0.000 0.000
#> GSM2890     1   0.000      0.975 1.000 0.000 0.000
#> GSM2877     1   0.000      0.975 1.000 0.000 0.000
#> GSM2892     1   0.000      0.975 1.000 0.000 0.000
#> GSM2902     1   0.000      0.975 1.000 0.000 0.000
#> GSM2878     1   0.000      0.975 1.000 0.000 0.000
#> GSM2901     1   0.000      0.975 1.000 0.000 0.000
#> GSM2879     3   0.440      0.898 0.000 0.188 0.812
#> GSM2898     3   0.375      0.884 0.000 0.144 0.856
#> GSM2881     3   0.000      0.831 0.000 0.000 1.000
#> GSM2897     3   0.000      0.831 0.000 0.000 1.000
#> GSM2882     2   0.000      0.982 0.000 1.000 0.000
#> GSM2894     2   0.000      0.982 0.000 1.000 0.000
#> GSM2883     3   0.000      0.831 0.000 0.000 1.000
#> GSM2895     3   0.000      0.831 0.000 0.000 1.000
#> GSM2885     3   0.000      0.831 0.000 0.000 1.000
#> GSM2886     3   0.000      0.831 0.000 0.000 1.000
#> GSM2887     3   0.000      0.831 0.000 0.000 1.000
#> GSM2896     3   0.000      0.831 0.000 0.000 1.000
#> GSM2888     3   0.450      0.900 0.000 0.196 0.804
#> GSM2889     3   0.429      0.896 0.000 0.180 0.820
#> GSM2876     1   0.000      0.975 1.000 0.000 0.000
#> GSM2891     1   0.000      0.975 1.000 0.000 0.000
#> GSM2880     1   0.000      0.975 1.000 0.000 0.000
#> GSM2893     1   0.000      0.975 1.000 0.000 0.000
#> GSM2821     1   0.462      0.761 0.840 0.024 0.136
#> GSM2900     1   0.000      0.975 1.000 0.000 0.000
#> GSM2903     1   0.000      0.975 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2822     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2832     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2823     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2824     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2825     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2826     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2829     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2843     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2871     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2831     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2846     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2836     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2848     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2841     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2827     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2842     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2845     2  0.4331      0.575 0.000 0.712 0.000 0.288
#> GSM2872     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2834     4  0.4981      0.114 0.000 0.464 0.000 0.536
#> GSM2847     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2838     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2853     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2852     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2855     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2840     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2857     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2859     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2861     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2862     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2868     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2869     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2851     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2867     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2870     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2854     4  0.0188      0.958 0.000 0.004 0.000 0.996
#> GSM2873     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2879     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2898     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000      0.962 0.000 0.000 0.000 1.000
#> GSM2883     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2895     3  0.0188      0.995 0.000 0.004 0.996 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM2888     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2889     2  0.0000      0.991 0.000 1.000 0.000 0.000
#> GSM2876     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2821     1  0.3074      0.799 0.848 0.152 0.000 0.000
#> GSM2900     1  0.0000      0.989 1.000 0.000 0.000 0.000
#> GSM2903     1  0.0000      0.989 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2832     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2823     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2824     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2825     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2826     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2829     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2856     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2830     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2843     4  0.0290      0.944 0.000 0.000 0.000 0.992 0.008
#> GSM2871     2  0.0609      0.970 0.000 0.980 0.000 0.000 0.020
#> GSM2831     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2846     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2835     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2858     4  0.0000      0.946 0.000 0.000 0.000 1.000 0.000
#> GSM2836     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2848     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2839     5  0.0609      0.998 0.020 0.000 0.000 0.000 0.980
#> GSM2841     5  0.0609      0.998 0.020 0.000 0.000 0.000 0.980
#> GSM2827     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2842     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2845     2  0.4206      0.576 0.000 0.708 0.000 0.272 0.020
#> GSM2872     4  0.0609      0.939 0.000 0.000 0.000 0.980 0.020
#> GSM2834     4  0.4821      0.100 0.000 0.464 0.000 0.516 0.020
#> GSM2847     4  0.0609      0.939 0.000 0.000 0.000 0.980 0.020
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2852     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2855     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2840     5  0.0609      0.998 0.020 0.000 0.000 0.000 0.980
#> GSM2857     5  0.0609      0.998 0.020 0.000 0.000 0.000 0.980
#> GSM2859     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2860     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2862     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2868     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2869     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2851     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2867     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2870     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2854     4  0.0771      0.936 0.000 0.004 0.000 0.976 0.020
#> GSM2873     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2879     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2898     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0290      0.944 0.000 0.000 0.000 0.992 0.008
#> GSM2894     4  0.0609      0.939 0.000 0.000 0.000 0.980 0.020
#> GSM2883     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2895     3  0.0162      0.994 0.000 0.004 0.996 0.000 0.000
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2887     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2896     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2888     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2889     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> GSM2876     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.962 1.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.0671      0.993 0.016 0.004 0.000 0.000 0.980
#> GSM2900     1  0.2516      0.829 0.860 0.000 0.000 0.000 0.140
#> GSM2903     1  0.3774      0.596 0.704 0.000 0.000 0.000 0.296

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.3620     0.2941 0.000 0.352 0.000 0.000 0.648 0.000
#> GSM2820     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2832     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2823     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2824     2  0.1327     0.8837 0.000 0.936 0.000 0.000 0.064 0.000
#> GSM2825     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2826     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2829     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2856     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2830     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2843     4  0.2300     0.8525 0.000 0.000 0.000 0.856 0.144 0.000
#> GSM2871     2  0.3428     0.5520 0.000 0.696 0.000 0.000 0.304 0.000
#> GSM2831     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2846     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2835     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2858     4  0.0000     0.8935 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2836     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2848     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2828     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     6  0.0000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2841     6  0.0000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2827     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2842     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2845     2  0.5104     0.3522 0.000 0.588 0.000 0.108 0.304 0.000
#> GSM2872     4  0.3428     0.7685 0.000 0.000 0.000 0.696 0.304 0.000
#> GSM2834     2  0.6062    -0.0989 0.000 0.408 0.000 0.288 0.304 0.000
#> GSM2847     4  0.3428     0.7685 0.000 0.000 0.000 0.696 0.304 0.000
#> GSM2849     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2853     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2852     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2855     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2840     6  0.0000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2857     6  0.0000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2859     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2860     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2861     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2862     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2863     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2864     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2865     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2866     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2868     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2869     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2851     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2867     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2870     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2854     4  0.3565     0.7648 0.000 0.004 0.000 0.692 0.304 0.000
#> GSM2873     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2874     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2879     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2898     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2881     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.2300     0.8525 0.000 0.000 0.000 0.856 0.144 0.000
#> GSM2894     4  0.3409     0.7712 0.000 0.000 0.000 0.700 0.300 0.000
#> GSM2883     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2895     3  0.0146     0.9939 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM2885     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2896     3  0.0000     0.9996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2888     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2889     2  0.0000     0.9503 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2876     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2891     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2880     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000     1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM2821     5  0.3428     0.2042 0.000 0.000 0.000 0.000 0.696 0.304
#> GSM2900     5  0.3428     0.5591 0.304 0.000 0.000 0.000 0.696 0.000
#> GSM2903     5  0.3428     0.5591 0.304 0.000 0.000 0.000 0.696 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

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

test_to_known_factors(res)
#>          n tissue(p) k
#> ATC:pam 84  2.53e-05 2
#> ATC:pam 84  1.63e-07 3
#> ATC:pam 83  1.77e-10 4
#> ATC:pam 83  4.01e-12 5
#> ATC:pam 80  8.33e-17 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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.532           0.919       0.924         0.4978 0.501   0.501
#> 3 3 0.585           0.814       0.777         0.2734 0.579   0.345
#> 4 4 0.820           0.807       0.897         0.1657 0.880   0.669
#> 5 5 0.875           0.840       0.916         0.0731 0.917   0.682
#> 6 6 0.901           0.844       0.910         0.0395 0.916   0.628

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

suggest_best_k(res)
#> [1] 6

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>         class entropy silhouette    p1    p2
#> GSM2819     1   0.311      0.915 0.944 0.056
#> GSM2820     2   0.506      0.915 0.112 0.888
#> GSM2822     2   0.242      0.934 0.040 0.960
#> GSM2832     2   0.242      0.934 0.040 0.960
#> GSM2823     2   0.662      0.887 0.172 0.828
#> GSM2824     2   0.662      0.887 0.172 0.828
#> GSM2825     2   0.529      0.895 0.120 0.880
#> GSM2826     2   0.373      0.928 0.072 0.928
#> GSM2829     1   0.662      0.914 0.828 0.172
#> GSM2856     1   0.662      0.914 0.828 0.172
#> GSM2830     1   0.662      0.914 0.828 0.172
#> GSM2843     1   0.662      0.914 0.828 0.172
#> GSM2871     1   0.821      0.828 0.744 0.256
#> GSM2831     1   0.662      0.914 0.828 0.172
#> GSM2844     1   0.662      0.914 0.828 0.172
#> GSM2833     1   0.662      0.914 0.828 0.172
#> GSM2846     1   0.662      0.914 0.828 0.172
#> GSM2835     1   0.662      0.914 0.828 0.172
#> GSM2858     1   0.662      0.914 0.828 0.172
#> GSM2836     2   0.224      0.936 0.036 0.964
#> GSM2848     2   0.224      0.936 0.036 0.964
#> GSM2828     2   0.506      0.915 0.112 0.888
#> GSM2837     2   0.506      0.915 0.112 0.888
#> GSM2839     1   0.000      0.918 1.000 0.000
#> GSM2841     1   0.000      0.918 1.000 0.000
#> GSM2827     2   0.224      0.936 0.036 0.964
#> GSM2842     2   0.224      0.936 0.036 0.964
#> GSM2845     1   0.662      0.914 0.828 0.172
#> GSM2872     1   0.662      0.914 0.828 0.172
#> GSM2834     1   0.662      0.914 0.828 0.172
#> GSM2847     1   0.662      0.914 0.828 0.172
#> GSM2849     2   0.506      0.915 0.112 0.888
#> GSM2850     2   0.506      0.915 0.112 0.888
#> GSM2838     2   0.224      0.936 0.036 0.964
#> GSM2853     2   0.224      0.936 0.036 0.964
#> GSM2852     2   0.506      0.915 0.112 0.888
#> GSM2855     2   0.506      0.915 0.112 0.888
#> GSM2840     1   0.000      0.918 1.000 0.000
#> GSM2857     1   0.000      0.918 1.000 0.000
#> GSM2859     2   0.224      0.936 0.036 0.964
#> GSM2860     2   0.224      0.936 0.036 0.964
#> GSM2861     2   0.224      0.936 0.036 0.964
#> GSM2862     2   0.224      0.936 0.036 0.964
#> GSM2863     2   0.224      0.936 0.036 0.964
#> GSM2864     2   0.224      0.936 0.036 0.964
#> GSM2865     2   0.224      0.936 0.036 0.964
#> GSM2866     2   0.224      0.936 0.036 0.964
#> GSM2868     2   0.224      0.936 0.036 0.964
#> GSM2869     2   0.224      0.936 0.036 0.964
#> GSM2851     2   0.224      0.936 0.036 0.964
#> GSM2867     2   0.224      0.936 0.036 0.964
#> GSM2870     2   0.224      0.936 0.036 0.964
#> GSM2854     1   0.662      0.914 0.828 0.172
#> GSM2873     2   0.224      0.936 0.036 0.964
#> GSM2874     2   0.506      0.915 0.112 0.888
#> GSM2884     2   0.506      0.915 0.112 0.888
#> GSM2875     1   0.000      0.918 1.000 0.000
#> GSM2890     1   0.000      0.918 1.000 0.000
#> GSM2877     1   0.000      0.918 1.000 0.000
#> GSM2892     1   0.000      0.918 1.000 0.000
#> GSM2902     1   0.000      0.918 1.000 0.000
#> GSM2878     1   0.000      0.918 1.000 0.000
#> GSM2901     1   0.000      0.918 1.000 0.000
#> GSM2879     2   0.118      0.925 0.016 0.984
#> GSM2898     2   0.118      0.925 0.016 0.984
#> GSM2881     2   0.506      0.915 0.112 0.888
#> GSM2897     2   0.506      0.915 0.112 0.888
#> GSM2882     1   0.662      0.914 0.828 0.172
#> GSM2894     1   0.662      0.914 0.828 0.172
#> GSM2883     2   0.541      0.906 0.124 0.876
#> GSM2895     2   0.574      0.897 0.136 0.864
#> GSM2885     2   0.506      0.915 0.112 0.888
#> GSM2886     2   0.506      0.915 0.112 0.888
#> GSM2887     2   0.506      0.915 0.112 0.888
#> GSM2896     2   0.506      0.915 0.112 0.888
#> GSM2888     2   0.118      0.925 0.016 0.984
#> GSM2889     2   0.118      0.925 0.016 0.984
#> GSM2876     1   0.000      0.918 1.000 0.000
#> GSM2891     1   0.000      0.918 1.000 0.000
#> GSM2880     1   0.000      0.918 1.000 0.000
#> GSM2893     1   0.000      0.918 1.000 0.000
#> GSM2821     1   0.000      0.918 1.000 0.000
#> GSM2900     1   0.000      0.918 1.000 0.000
#> GSM2903     1   0.000      0.918 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
#> GSM2819     2  0.9701     -0.168 0.284 0.456 0.260
#> GSM2820     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2822     2  0.3192      0.745 0.112 0.888 0.000
#> GSM2832     2  0.2796      0.755 0.092 0.908 0.000
#> GSM2823     1  0.5591      0.898 0.696 0.000 0.304
#> GSM2824     1  0.5591      0.898 0.696 0.000 0.304
#> GSM2825     1  0.9258      0.607 0.528 0.216 0.256
#> GSM2826     1  0.9258      0.607 0.528 0.216 0.256
#> GSM2829     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2856     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2830     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2843     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2871     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2831     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2844     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2833     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2846     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2835     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2858     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2836     2  0.4281      0.758 0.056 0.872 0.072
#> GSM2848     2  0.3637      0.766 0.024 0.892 0.084
#> GSM2828     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2837     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2839     1  0.5216      0.939 0.740 0.000 0.260
#> GSM2841     1  0.5216      0.939 0.740 0.000 0.260
#> GSM2827     2  0.5845      0.564 0.004 0.688 0.308
#> GSM2842     2  0.6102      0.549 0.008 0.672 0.320
#> GSM2845     2  0.6735      0.762 0.260 0.696 0.044
#> GSM2872     2  0.6633      0.764 0.260 0.700 0.040
#> GSM2834     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2847     2  0.6053      0.776 0.260 0.720 0.020
#> GSM2849     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2850     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2838     2  0.3965      0.754 0.008 0.860 0.132
#> GSM2853     2  0.4137      0.760 0.032 0.872 0.096
#> GSM2852     3  0.1163      0.922 0.028 0.000 0.972
#> GSM2855     3  0.1163      0.922 0.028 0.000 0.972
#> GSM2840     1  0.5216      0.939 0.740 0.000 0.260
#> GSM2857     1  0.5216      0.939 0.740 0.000 0.260
#> GSM2859     2  0.3686      0.752 0.000 0.860 0.140
#> GSM2860     2  0.4842      0.676 0.000 0.776 0.224
#> GSM2861     2  0.5397      0.605 0.000 0.720 0.280
#> GSM2862     2  0.3816      0.748 0.000 0.852 0.148
#> GSM2863     2  0.4002      0.739 0.000 0.840 0.160
#> GSM2864     2  0.3752      0.750 0.000 0.856 0.144
#> GSM2865     2  0.3686      0.752 0.000 0.860 0.140
#> GSM2866     2  0.4269      0.754 0.076 0.872 0.052
#> GSM2868     2  0.3752      0.750 0.000 0.856 0.144
#> GSM2869     2  0.3941      0.742 0.000 0.844 0.156
#> GSM2851     2  0.3619      0.754 0.000 0.864 0.136
#> GSM2867     2  0.3816      0.748 0.000 0.852 0.148
#> GSM2870     2  0.3816      0.748 0.000 0.852 0.148
#> GSM2854     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2873     2  0.0661      0.780 0.008 0.988 0.004
#> GSM2874     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2884     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2875     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2890     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2877     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2892     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2902     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2878     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2901     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2879     3  0.4504      0.728 0.196 0.000 0.804
#> GSM2898     3  0.4452      0.735 0.192 0.000 0.808
#> GSM2881     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2897     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2882     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2894     2  0.5443      0.784 0.260 0.736 0.004
#> GSM2883     3  0.4235      0.717 0.176 0.000 0.824
#> GSM2895     3  0.4235      0.717 0.176 0.000 0.824
#> GSM2885     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2886     3  0.0000      0.933 0.000 0.000 1.000
#> GSM2887     3  0.1163      0.922 0.028 0.000 0.972
#> GSM2896     3  0.1163      0.922 0.028 0.000 0.972
#> GSM2888     3  0.2599      0.900 0.052 0.016 0.932
#> GSM2889     3  0.2599      0.900 0.052 0.016 0.932
#> GSM2876     1  0.5216      0.939 0.740 0.000 0.260
#> GSM2891     1  0.5216      0.939 0.740 0.000 0.260
#> GSM2880     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2893     1  0.5465      0.937 0.712 0.000 0.288
#> GSM2821     1  0.5216      0.939 0.740 0.000 0.260
#> GSM2900     1  0.5216      0.939 0.740 0.000 0.260
#> GSM2903     1  0.5216      0.939 0.740 0.000 0.260

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     4  0.9602    -0.0761 0.296 0.248 0.124 0.332
#> GSM2820     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2822     2  0.5738     0.7328 0.164 0.744 0.060 0.032
#> GSM2832     2  0.5738     0.7328 0.164 0.744 0.060 0.032
#> GSM2823     1  0.5956     0.4519 0.680 0.100 0.220 0.000
#> GSM2824     1  0.5956     0.4519 0.680 0.100 0.220 0.000
#> GSM2825     1  0.7131     0.2658 0.520 0.352 0.124 0.004
#> GSM2826     1  0.7119     0.2767 0.524 0.348 0.124 0.004
#> GSM2829     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2843     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2871     4  0.0188     0.9607 0.000 0.004 0.000 0.996
#> GSM2831     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2846     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2836     2  0.1610     0.9015 0.016 0.952 0.000 0.032
#> GSM2848     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2828     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2841     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2827     2  0.8444     0.1997 0.320 0.472 0.148 0.060
#> GSM2842     2  0.7761     0.2156 0.320 0.512 0.144 0.024
#> GSM2845     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2872     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2834     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2847     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2849     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2838     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2853     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2852     3  0.6685     0.5942 0.324 0.108 0.568 0.000
#> GSM2855     3  0.6685     0.5942 0.324 0.108 0.568 0.000
#> GSM2840     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2857     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2859     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2860     2  0.0921     0.9097 0.000 0.972 0.000 0.028
#> GSM2861     2  0.1284     0.8996 0.000 0.964 0.012 0.024
#> GSM2862     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2863     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2864     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2865     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2866     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2868     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2869     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2851     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2867     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2870     2  0.1022     0.9125 0.000 0.968 0.000 0.032
#> GSM2854     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2873     2  0.6196     0.7435 0.072 0.736 0.072 0.120
#> GSM2874     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2890     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2892     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2879     3  0.6685     0.5942 0.324 0.108 0.568 0.000
#> GSM2898     3  0.6685     0.5942 0.324 0.108 0.568 0.000
#> GSM2881     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000     0.9647 0.000 0.000 0.000 1.000
#> GSM2883     3  0.5793     0.6176 0.324 0.048 0.628 0.000
#> GSM2895     3  0.5793     0.6176 0.324 0.048 0.628 0.000
#> GSM2885     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000     0.7755 0.000 0.000 1.000 0.000
#> GSM2887     3  0.5537     0.6746 0.256 0.056 0.688 0.000
#> GSM2896     3  0.5537     0.6746 0.256 0.056 0.688 0.000
#> GSM2888     3  0.7142     0.5475 0.324 0.152 0.524 0.000
#> GSM2889     3  0.7142     0.5475 0.324 0.152 0.524 0.000
#> GSM2876     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2891     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2880     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2821     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2900     1  0.0000     0.9074 1.000 0.000 0.000 0.000
#> GSM2903     1  0.0000     0.9074 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4    p5
#> GSM2819     5  0.8595      0.155 0.240 0.228 0.000 0.252 0.280
#> GSM2820     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2822     2  0.4364      0.647 0.048 0.736 0.000 0.000 0.216
#> GSM2832     2  0.4364      0.647 0.048 0.736 0.000 0.000 0.216
#> GSM2823     5  0.3177      0.550 0.208 0.000 0.000 0.000 0.792
#> GSM2824     5  0.3177      0.550 0.208 0.000 0.000 0.000 0.792
#> GSM2825     5  0.5069      0.435 0.052 0.328 0.000 0.000 0.620
#> GSM2826     5  0.5069      0.435 0.052 0.328 0.000 0.000 0.620
#> GSM2829     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2856     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2830     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2843     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2871     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2831     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2844     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2833     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2846     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2835     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2858     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2836     2  0.1544      0.880 0.000 0.932 0.000 0.000 0.068
#> GSM2848     2  0.1043      0.900 0.000 0.960 0.000 0.000 0.040
#> GSM2828     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2837     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2839     1  0.3661      0.734 0.724 0.000 0.000 0.000 0.276
#> GSM2841     1  0.3661      0.734 0.724 0.000 0.000 0.000 0.276
#> GSM2827     2  0.5047     -0.146 0.000 0.496 0.000 0.032 0.472
#> GSM2842     5  0.4451      0.084 0.000 0.492 0.000 0.004 0.504
#> GSM2845     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2872     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2834     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2847     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2849     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2850     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2838     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2853     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2852     5  0.1732      0.759 0.000 0.000 0.080 0.000 0.920
#> GSM2855     5  0.1732      0.759 0.000 0.000 0.080 0.000 0.920
#> GSM2840     1  0.3661      0.734 0.724 0.000 0.000 0.000 0.276
#> GSM2857     1  0.3661      0.734 0.724 0.000 0.000 0.000 0.276
#> GSM2859     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2860     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2861     2  0.2127      0.851 0.000 0.892 0.000 0.000 0.108
#> GSM2862     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2863     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2864     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2865     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2866     2  0.1197      0.895 0.000 0.952 0.000 0.000 0.048
#> GSM2868     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2869     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2851     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2867     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2870     2  0.0000      0.918 0.000 1.000 0.000 0.000 0.000
#> GSM2854     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM2873     2  0.2863      0.836 0.000 0.876 0.000 0.060 0.064
#> GSM2874     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2884     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2875     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2879     5  0.1043      0.756 0.000 0.000 0.040 0.000 0.960
#> GSM2898     5  0.1043      0.756 0.000 0.000 0.040 0.000 0.960
#> GSM2881     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2897     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2882     4  0.0162      0.995 0.000 0.004 0.000 0.996 0.000
#> GSM2894     4  0.0162      0.995 0.000 0.004 0.000 0.996 0.000
#> GSM2883     5  0.2605      0.735 0.000 0.000 0.148 0.000 0.852
#> GSM2895     5  0.2605      0.735 0.000 0.000 0.148 0.000 0.852
#> GSM2885     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2886     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM2887     5  0.2852      0.724 0.000 0.000 0.172 0.000 0.828
#> GSM2896     5  0.2891      0.722 0.000 0.000 0.176 0.000 0.824
#> GSM2888     5  0.3058      0.751 0.000 0.096 0.044 0.000 0.860
#> GSM2889     5  0.3058      0.751 0.000 0.096 0.044 0.000 0.860
#> GSM2876     1  0.1121      0.846 0.956 0.000 0.000 0.000 0.044
#> GSM2891     1  0.1121      0.846 0.956 0.000 0.000 0.000 0.044
#> GSM2880     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000
#> GSM2821     1  0.3816      0.702 0.696 0.000 0.000 0.000 0.304
#> GSM2900     1  0.3636      0.736 0.728 0.000 0.000 0.000 0.272
#> GSM2903     1  0.3636      0.736 0.728 0.000 0.000 0.000 0.272

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM2819     5  0.5451     0.5931 0.000 0.156 0.000 0.140 0.660 0.044
#> GSM2820     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2822     5  0.5711     0.4086 0.000 0.392 0.000 0.008 0.472 0.128
#> GSM2832     5  0.5735     0.4151 0.000 0.388 0.000 0.008 0.472 0.132
#> GSM2823     5  0.3531     0.4777 0.000 0.000 0.000 0.000 0.672 0.328
#> GSM2824     5  0.3547     0.4718 0.000 0.000 0.000 0.000 0.668 0.332
#> GSM2825     5  0.5641     0.4970 0.000 0.328 0.000 0.000 0.504 0.168
#> GSM2826     5  0.5641     0.4970 0.000 0.328 0.000 0.000 0.504 0.168
#> GSM2829     4  0.0260     0.9816 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM2856     4  0.0260     0.9816 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM2830     4  0.0260     0.9816 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM2843     4  0.0260     0.9816 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM2871     4  0.2000     0.9496 0.048 0.004 0.000 0.916 0.032 0.000
#> GSM2831     4  0.0000     0.9820 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2844     4  0.0000     0.9820 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2833     4  0.0000     0.9820 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM2846     4  0.0260     0.9816 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM2835     4  0.0146     0.9820 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM2858     4  0.0146     0.9820 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM2836     2  0.0260     0.9413 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2848     2  0.0260     0.9413 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM2828     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2837     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2839     5  0.0790     0.6305 0.032 0.000 0.000 0.000 0.968 0.000
#> GSM2841     5  0.0790     0.6305 0.032 0.000 0.000 0.000 0.968 0.000
#> GSM2827     5  0.5899     0.4386 0.000 0.372 0.000 0.008 0.460 0.160
#> GSM2842     5  0.5719     0.4373 0.000 0.372 0.000 0.000 0.460 0.168
#> GSM2845     4  0.1265     0.9667 0.044 0.000 0.000 0.948 0.008 0.000
#> GSM2872     4  0.1265     0.9667 0.044 0.000 0.000 0.948 0.008 0.000
#> GSM2834     4  0.1265     0.9667 0.044 0.000 0.000 0.948 0.008 0.000
#> GSM2847     4  0.1152     0.9683 0.044 0.000 0.000 0.952 0.004 0.000
#> GSM2849     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2850     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2838     2  0.0000     0.9451 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2853     2  0.0291     0.9409 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM2852     6  0.0865     0.9647 0.000 0.000 0.036 0.000 0.000 0.964
#> GSM2855     6  0.0865     0.9647 0.000 0.000 0.036 0.000 0.000 0.964
#> GSM2840     5  0.0790     0.6305 0.032 0.000 0.000 0.000 0.968 0.000
#> GSM2857     5  0.0790     0.6305 0.032 0.000 0.000 0.000 0.968 0.000
#> GSM2859     2  0.0000     0.9451 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2860     2  0.0146     0.9444 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2861     2  0.3081     0.6911 0.000 0.776 0.000 0.000 0.004 0.220
#> GSM2862     2  0.0146     0.9444 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2863     2  0.0146     0.9444 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2864     2  0.0146     0.9444 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM2865     2  0.0000     0.9451 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2866     2  0.0520     0.9356 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM2868     2  0.0000     0.9451 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2869     2  0.0000     0.9451 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2851     2  0.0000     0.9451 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2867     2  0.0000     0.9451 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2870     2  0.0000     0.9451 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM2854     4  0.1010     0.9713 0.036 0.000 0.000 0.960 0.004 0.000
#> GSM2873     2  0.5668    -0.1947 0.016 0.500 0.000 0.028 0.412 0.044
#> GSM2874     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2884     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2875     1  0.1141     0.9544 0.948 0.000 0.000 0.000 0.052 0.000
#> GSM2890     1  0.1141     0.9544 0.948 0.000 0.000 0.000 0.052 0.000
#> GSM2877     1  0.1141     0.9544 0.948 0.000 0.000 0.000 0.052 0.000
#> GSM2892     1  0.1141     0.9544 0.948 0.000 0.000 0.000 0.052 0.000
#> GSM2902     1  0.1141     0.9544 0.948 0.000 0.000 0.000 0.052 0.000
#> GSM2878     1  0.1765     0.9404 0.904 0.000 0.000 0.000 0.096 0.000
#> GSM2901     1  0.1765     0.9404 0.904 0.000 0.000 0.000 0.096 0.000
#> GSM2879     6  0.0000     0.9734 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2898     6  0.0000     0.9734 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2881     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2897     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2882     4  0.0146     0.9814 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2894     4  0.0146     0.9814 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM2883     6  0.0000     0.9734 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2895     6  0.0000     0.9734 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM2885     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2886     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM2887     6  0.1267     0.9463 0.000 0.000 0.060 0.000 0.000 0.940
#> GSM2896     6  0.1444     0.9348 0.000 0.000 0.072 0.000 0.000 0.928
#> GSM2888     6  0.0146     0.9739 0.000 0.000 0.004 0.000 0.000 0.996
#> GSM2889     6  0.0146     0.9739 0.000 0.000 0.004 0.000 0.000 0.996
#> GSM2876     5  0.3838     0.0642 0.448 0.000 0.000 0.000 0.552 0.000
#> GSM2891     5  0.3838     0.0642 0.448 0.000 0.000 0.000 0.552 0.000
#> GSM2880     1  0.2969     0.7210 0.776 0.000 0.000 0.000 0.224 0.000
#> GSM2893     1  0.1610     0.9460 0.916 0.000 0.000 0.000 0.084 0.000
#> GSM2821     5  0.0790     0.6305 0.032 0.000 0.000 0.000 0.968 0.000
#> GSM2900     5  0.1141     0.6196 0.052 0.000 0.000 0.000 0.948 0.000
#> GSM2903     5  0.1075     0.6216 0.048 0.000 0.000 0.000 0.952 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-mclust-collect-classes

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

test_to_known_factors(res)
#>             n tissue(p) k
#> ATC:mclust 84  4.57e-05 2
#> ATC:mclust 83  5.13e-09 3
#> ATC:mclust 77  1.70e-11 4
#> ATC:mclust 79  4.10e-15 5
#> ATC:mclust 73  3.70e-17 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 8229 rows and 84 columns.
#>   Top rows (823, 1646, 2468, 3291, 4114) 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 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-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.894           0.912       0.961         0.4531 0.535   0.535
#> 3 3 1.000           0.966       0.984         0.3958 0.793   0.626
#> 4 4 0.961           0.948       0.977         0.1871 0.820   0.546
#> 5 5 0.853           0.872       0.902         0.0434 0.987   0.948
#> 6 6 0.826           0.797       0.851         0.0316 0.964   0.857

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>         class entropy silhouette    p1    p2
#> GSM2819     1  0.0000      0.921 1.000 0.000
#> GSM2820     2  0.0000      0.978 0.000 1.000
#> GSM2822     1  0.9323      0.520 0.652 0.348
#> GSM2832     1  0.9881      0.303 0.564 0.436
#> GSM2823     1  0.0376      0.920 0.996 0.004
#> GSM2824     1  0.0376      0.920 0.996 0.004
#> GSM2825     1  0.0376      0.920 0.996 0.004
#> GSM2826     1  0.0376      0.920 0.996 0.004
#> GSM2829     2  0.0376      0.976 0.004 0.996
#> GSM2856     2  0.0376      0.976 0.004 0.996
#> GSM2830     2  0.0376      0.976 0.004 0.996
#> GSM2843     2  0.0376      0.976 0.004 0.996
#> GSM2871     2  0.0376      0.976 0.004 0.996
#> GSM2831     2  0.7602      0.707 0.220 0.780
#> GSM2844     2  0.4431      0.893 0.092 0.908
#> GSM2833     2  0.1184      0.969 0.016 0.984
#> GSM2846     2  0.0376      0.976 0.004 0.996
#> GSM2835     1  0.8081      0.686 0.752 0.248
#> GSM2858     1  0.9460      0.483 0.636 0.364
#> GSM2836     2  0.1184      0.968 0.016 0.984
#> GSM2848     2  0.0000      0.978 0.000 1.000
#> GSM2828     2  0.0000      0.978 0.000 1.000
#> GSM2837     2  0.0000      0.978 0.000 1.000
#> GSM2839     1  0.0000      0.921 1.000 0.000
#> GSM2841     1  0.0000      0.921 1.000 0.000
#> GSM2827     2  0.0000      0.978 0.000 1.000
#> GSM2842     2  0.0000      0.978 0.000 1.000
#> GSM2845     2  0.3584      0.921 0.068 0.932
#> GSM2872     1  0.9944      0.234 0.544 0.456
#> GSM2834     2  0.8955      0.515 0.312 0.688
#> GSM2847     2  0.0938      0.972 0.012 0.988
#> GSM2849     2  0.0000      0.978 0.000 1.000
#> GSM2850     2  0.0000      0.978 0.000 1.000
#> GSM2838     2  0.0000      0.978 0.000 1.000
#> GSM2853     2  0.0000      0.978 0.000 1.000
#> GSM2852     2  0.0000      0.978 0.000 1.000
#> GSM2855     2  0.0000      0.978 0.000 1.000
#> GSM2840     1  0.0000      0.921 1.000 0.000
#> GSM2857     1  0.0000      0.921 1.000 0.000
#> GSM2859     2  0.0000      0.978 0.000 1.000
#> GSM2860     2  0.0000      0.978 0.000 1.000
#> GSM2861     2  0.0000      0.978 0.000 1.000
#> GSM2862     2  0.0000      0.978 0.000 1.000
#> GSM2863     2  0.0000      0.978 0.000 1.000
#> GSM2864     2  0.0000      0.978 0.000 1.000
#> GSM2865     2  0.0000      0.978 0.000 1.000
#> GSM2866     2  0.0376      0.976 0.004 0.996
#> GSM2868     2  0.5629      0.843 0.132 0.868
#> GSM2869     2  0.1843      0.958 0.028 0.972
#> GSM2851     2  0.0938      0.971 0.012 0.988
#> GSM2867     2  0.2423      0.948 0.040 0.960
#> GSM2870     2  0.0376      0.976 0.004 0.996
#> GSM2854     2  0.4022      0.908 0.080 0.920
#> GSM2873     2  0.0000      0.978 0.000 1.000
#> GSM2874     2  0.0000      0.978 0.000 1.000
#> GSM2884     2  0.0000      0.978 0.000 1.000
#> GSM2875     1  0.0000      0.921 1.000 0.000
#> GSM2890     1  0.0000      0.921 1.000 0.000
#> GSM2877     1  0.0000      0.921 1.000 0.000
#> GSM2892     1  0.0000      0.921 1.000 0.000
#> GSM2902     1  0.0000      0.921 1.000 0.000
#> GSM2878     1  0.0000      0.921 1.000 0.000
#> GSM2901     1  0.0000      0.921 1.000 0.000
#> GSM2879     2  0.0000      0.978 0.000 1.000
#> GSM2898     2  0.0000      0.978 0.000 1.000
#> GSM2881     2  0.0000      0.978 0.000 1.000
#> GSM2897     2  0.0000      0.978 0.000 1.000
#> GSM2882     1  0.7376      0.738 0.792 0.208
#> GSM2894     1  0.4562      0.851 0.904 0.096
#> GSM2883     2  0.0000      0.978 0.000 1.000
#> GSM2895     2  0.0000      0.978 0.000 1.000
#> GSM2885     2  0.0000      0.978 0.000 1.000
#> GSM2886     2  0.0000      0.978 0.000 1.000
#> GSM2887     2  0.0000      0.978 0.000 1.000
#> GSM2896     2  0.0000      0.978 0.000 1.000
#> GSM2888     2  0.0000      0.978 0.000 1.000
#> GSM2889     2  0.0000      0.978 0.000 1.000
#> GSM2876     1  0.0000      0.921 1.000 0.000
#> GSM2891     1  0.0000      0.921 1.000 0.000
#> GSM2880     1  0.0000      0.921 1.000 0.000
#> GSM2893     1  0.0000      0.921 1.000 0.000
#> GSM2821     1  0.0376      0.920 0.996 0.004
#> GSM2900     1  0.0000      0.921 1.000 0.000
#> GSM2903     1  0.0000      0.921 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
#> GSM2819     1  0.2165      0.910 0.936 0.064 0.000
#> GSM2820     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2822     1  0.5138      0.669 0.748 0.000 0.252
#> GSM2832     1  0.5397      0.622 0.720 0.000 0.280
#> GSM2823     1  0.0747      0.954 0.984 0.000 0.016
#> GSM2824     1  0.0747      0.954 0.984 0.000 0.016
#> GSM2825     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2826     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2829     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2856     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2830     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2843     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2871     2  0.4452      0.763 0.000 0.808 0.192
#> GSM2831     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2844     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2833     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2846     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2835     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2858     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2836     3  0.1289      0.969 0.032 0.000 0.968
#> GSM2848     3  0.0592      0.983 0.012 0.000 0.988
#> GSM2828     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2837     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2839     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2841     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2827     3  0.0237      0.987 0.004 0.000 0.996
#> GSM2842     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2845     2  0.1711      0.951 0.032 0.960 0.008
#> GSM2872     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2834     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2847     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2849     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2850     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2838     3  0.0237      0.987 0.004 0.000 0.996
#> GSM2853     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2852     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2855     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2840     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2857     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2859     3  0.0892      0.978 0.020 0.000 0.980
#> GSM2860     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2861     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2862     3  0.0424      0.985 0.008 0.000 0.992
#> GSM2863     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2864     3  0.0424      0.985 0.008 0.000 0.992
#> GSM2865     3  0.0424      0.985 0.008 0.000 0.992
#> GSM2866     3  0.0892      0.978 0.020 0.000 0.980
#> GSM2868     3  0.2878      0.901 0.096 0.000 0.904
#> GSM2869     3  0.1163      0.972 0.028 0.000 0.972
#> GSM2851     3  0.1031      0.975 0.024 0.000 0.976
#> GSM2867     3  0.1753      0.953 0.048 0.000 0.952
#> GSM2870     3  0.0892      0.978 0.020 0.000 0.980
#> GSM2854     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2873     3  0.3695      0.873 0.012 0.108 0.880
#> GSM2874     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2884     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2875     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2890     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2877     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2892     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2902     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2878     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2901     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2879     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2898     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2881     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2897     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2882     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2894     2  0.0000      0.985 0.000 1.000 0.000
#> GSM2883     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2895     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2885     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2886     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2887     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2896     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2888     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2889     3  0.0000      0.989 0.000 0.000 1.000
#> GSM2876     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2891     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2880     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2893     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2821     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2900     1  0.0000      0.968 1.000 0.000 0.000
#> GSM2903     1  0.0000      0.968 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>         class entropy silhouette    p1    p2    p3    p4
#> GSM2819     2  0.5244      0.356 0.388 0.600 0.000 0.012
#> GSM2820     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2822     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2832     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2823     1  0.0188      0.996 0.996 0.004 0.000 0.000
#> GSM2824     1  0.0707      0.979 0.980 0.020 0.000 0.000
#> GSM2825     2  0.0707      0.947 0.020 0.980 0.000 0.000
#> GSM2826     2  0.0707      0.947 0.020 0.980 0.000 0.000
#> GSM2829     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2856     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2830     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2843     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2871     4  0.3528      0.795 0.000 0.192 0.000 0.808
#> GSM2831     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2844     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2833     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2846     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2835     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2858     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2836     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2848     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2828     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2837     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2839     1  0.0188      0.996 0.996 0.004 0.000 0.000
#> GSM2841     1  0.0188      0.996 0.996 0.004 0.000 0.000
#> GSM2827     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2842     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2845     4  0.3907      0.739 0.000 0.232 0.000 0.768
#> GSM2872     4  0.3219      0.827 0.000 0.164 0.000 0.836
#> GSM2834     4  0.1302      0.932 0.000 0.044 0.000 0.956
#> GSM2847     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2849     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2850     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2838     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2853     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2852     3  0.0188      0.975 0.000 0.004 0.996 0.000
#> GSM2855     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2840     1  0.0336      0.992 0.992 0.008 0.000 0.000
#> GSM2857     1  0.0188      0.996 0.996 0.004 0.000 0.000
#> GSM2859     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2860     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2861     2  0.0469      0.952 0.000 0.988 0.012 0.000
#> GSM2862     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2863     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2864     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2865     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2866     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2868     2  0.0188      0.959 0.004 0.996 0.000 0.000
#> GSM2869     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2851     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2867     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2870     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2854     4  0.0817      0.944 0.000 0.024 0.000 0.976
#> GSM2873     2  0.0000      0.962 0.000 1.000 0.000 0.000
#> GSM2874     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2884     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2875     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2890     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2877     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2892     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2902     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2878     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2901     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2879     3  0.2868      0.842 0.000 0.136 0.864 0.000
#> GSM2898     3  0.3610      0.753 0.000 0.200 0.800 0.000
#> GSM2881     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2897     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2882     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2894     4  0.0000      0.958 0.000 0.000 0.000 1.000
#> GSM2883     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2895     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2885     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2886     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2887     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2896     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM2888     2  0.3907      0.693 0.000 0.768 0.232 0.000
#> GSM2889     2  0.3942      0.687 0.000 0.764 0.236 0.000
#> GSM2876     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2891     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2880     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2893     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2821     1  0.0188      0.996 0.996 0.004 0.000 0.000
#> GSM2900     1  0.0000      0.997 1.000 0.000 0.000 0.000
#> GSM2903     1  0.0000      0.997 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>         class entropy silhouette    p1    p2    p3    p4 p5
#> GSM2819     1  0.7751     0.0808 0.392 0.304 0.000 0.064 NA
#> GSM2820     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2822     2  0.3508     0.8038 0.000 0.748 0.000 0.000 NA
#> GSM2832     2  0.3837     0.7613 0.000 0.692 0.000 0.000 NA
#> GSM2823     1  0.0798     0.9260 0.976 0.016 0.000 0.000 NA
#> GSM2824     1  0.1682     0.9034 0.940 0.044 0.004 0.000 NA
#> GSM2825     2  0.4418     0.7113 0.016 0.652 0.000 0.000 NA
#> GSM2826     2  0.3934     0.7895 0.016 0.740 0.000 0.000 NA
#> GSM2829     4  0.0000     0.9077 0.000 0.000 0.000 1.000 NA
#> GSM2856     4  0.0162     0.9074 0.000 0.000 0.000 0.996 NA
#> GSM2830     4  0.1121     0.9017 0.000 0.000 0.000 0.956 NA
#> GSM2843     4  0.1270     0.9002 0.000 0.000 0.000 0.948 NA
#> GSM2871     4  0.5191     0.7449 0.000 0.088 0.000 0.660 NA
#> GSM2831     4  0.0000     0.9077 0.000 0.000 0.000 1.000 NA
#> GSM2844     4  0.0162     0.9075 0.000 0.000 0.000 0.996 NA
#> GSM2833     4  0.2648     0.8506 0.000 0.000 0.000 0.848 NA
#> GSM2846     4  0.1792     0.8880 0.000 0.000 0.000 0.916 NA
#> GSM2835     4  0.1197     0.8994 0.000 0.000 0.000 0.952 NA
#> GSM2858     4  0.1544     0.8942 0.000 0.000 0.000 0.932 NA
#> GSM2836     2  0.1792     0.8696 0.000 0.916 0.000 0.000 NA
#> GSM2848     2  0.1341     0.8778 0.000 0.944 0.000 0.000 NA
#> GSM2828     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2837     3  0.0162     0.9697 0.000 0.000 0.996 0.000 NA
#> GSM2839     1  0.2516     0.8682 0.860 0.000 0.000 0.000 NA
#> GSM2841     1  0.2648     0.8611 0.848 0.000 0.000 0.000 NA
#> GSM2827     2  0.3305     0.8036 0.000 0.776 0.000 0.000 NA
#> GSM2842     2  0.2966     0.8306 0.000 0.816 0.000 0.000 NA
#> GSM2845     4  0.6054     0.5824 0.000 0.124 0.000 0.496 NA
#> GSM2872     4  0.5498     0.6846 0.000 0.080 0.000 0.580 NA
#> GSM2834     4  0.2970     0.8584 0.000 0.004 0.000 0.828 NA
#> GSM2847     4  0.2773     0.8620 0.000 0.000 0.000 0.836 NA
#> GSM2849     3  0.0162     0.9697 0.000 0.000 0.996 0.000 NA
#> GSM2850     3  0.0162     0.9697 0.000 0.000 0.996 0.000 NA
#> GSM2838     2  0.3876     0.7660 0.000 0.684 0.000 0.000 NA
#> GSM2853     2  0.3586     0.8026 0.000 0.736 0.000 0.000 NA
#> GSM2852     3  0.0162     0.9697 0.000 0.000 0.996 0.000 NA
#> GSM2855     3  0.0162     0.9697 0.000 0.000 0.996 0.000 NA
#> GSM2840     1  0.4178     0.7425 0.696 0.008 0.000 0.004 NA
#> GSM2857     1  0.3143     0.8274 0.796 0.000 0.000 0.000 NA
#> GSM2859     2  0.2074     0.8680 0.000 0.896 0.000 0.000 NA
#> GSM2860     2  0.0510     0.8797 0.000 0.984 0.000 0.000 NA
#> GSM2861     2  0.2230     0.8662 0.000 0.884 0.000 0.000 NA
#> GSM2862     2  0.0609     0.8812 0.000 0.980 0.000 0.000 NA
#> GSM2863     2  0.0162     0.8804 0.000 0.996 0.000 0.000 NA
#> GSM2864     2  0.1478     0.8737 0.000 0.936 0.000 0.000 NA
#> GSM2865     2  0.0880     0.8782 0.000 0.968 0.000 0.000 NA
#> GSM2866     2  0.0609     0.8817 0.000 0.980 0.000 0.000 NA
#> GSM2868     2  0.2280     0.8769 0.000 0.880 0.000 0.000 NA
#> GSM2869     2  0.2127     0.8780 0.000 0.892 0.000 0.000 NA
#> GSM2851     2  0.1671     0.8750 0.000 0.924 0.000 0.000 NA
#> GSM2867     2  0.1908     0.8759 0.000 0.908 0.000 0.000 NA
#> GSM2870     2  0.2280     0.8659 0.000 0.880 0.000 0.000 NA
#> GSM2854     4  0.1671     0.8914 0.000 0.000 0.000 0.924 NA
#> GSM2873     2  0.2929     0.8303 0.000 0.820 0.000 0.000 NA
#> GSM2874     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2884     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2875     1  0.0000     0.9317 1.000 0.000 0.000 0.000 NA
#> GSM2890     1  0.0162     0.9315 0.996 0.000 0.000 0.000 NA
#> GSM2877     1  0.0404     0.9309 0.988 0.000 0.000 0.000 NA
#> GSM2892     1  0.0290     0.9319 0.992 0.000 0.000 0.000 NA
#> GSM2902     1  0.0162     0.9315 0.996 0.000 0.000 0.000 NA
#> GSM2878     1  0.0404     0.9313 0.988 0.000 0.000 0.000 NA
#> GSM2901     1  0.0290     0.9314 0.992 0.000 0.000 0.000 NA
#> GSM2879     3  0.3264     0.7801 0.000 0.164 0.820 0.000 NA
#> GSM2898     3  0.4268     0.5945 0.000 0.268 0.708 0.000 NA
#> GSM2881     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2897     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2882     4  0.0000     0.9077 0.000 0.000 0.000 1.000 NA
#> GSM2894     4  0.0000     0.9077 0.000 0.000 0.000 1.000 NA
#> GSM2883     3  0.0162     0.9697 0.000 0.000 0.996 0.000 NA
#> GSM2895     3  0.0324     0.9675 0.000 0.004 0.992 0.000 NA
#> GSM2885     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2886     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2887     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2896     3  0.0000     0.9703 0.000 0.000 1.000 0.000 NA
#> GSM2888     2  0.5102     0.7324 0.000 0.696 0.176 0.000 NA
#> GSM2889     2  0.4968     0.7581 0.000 0.712 0.152 0.000 NA
#> GSM2876     1  0.0510     0.9311 0.984 0.000 0.000 0.000 NA
#> GSM2891     1  0.0290     0.9311 0.992 0.000 0.000 0.000 NA
#> GSM2880     1  0.0290     0.9311 0.992 0.000 0.000 0.000 NA
#> GSM2893     1  0.0162     0.9318 0.996 0.000 0.000 0.000 NA
#> GSM2821     1  0.0880     0.9263 0.968 0.000 0.000 0.000 NA
#> GSM2900     1  0.0703     0.9285 0.976 0.000 0.000 0.000 NA
#> GSM2903     1  0.0703     0.9285 0.976 0.000 0.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>         class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM2819     1  0.7065      0.280 0.516 0.108 0.000 0.048 0.072 NA
#> GSM2820     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.004 NA
#> GSM2822     2  0.3487      0.767 0.000 0.756 0.000 0.000 0.020 NA
#> GSM2832     2  0.4462      0.678 0.000 0.660 0.000 0.000 0.060 NA
#> GSM2823     1  0.2263      0.881 0.896 0.000 0.000 0.000 0.056 NA
#> GSM2824     1  0.2375      0.880 0.896 0.008 0.000 0.000 0.060 NA
#> GSM2825     5  0.3596      0.529 0.008 0.244 0.000 0.000 0.740 NA
#> GSM2826     5  0.3861      0.390 0.004 0.316 0.000 0.000 0.672 NA
#> GSM2829     4  0.1007      0.797 0.000 0.000 0.000 0.956 0.000 NA
#> GSM2856     4  0.1010      0.798 0.000 0.000 0.000 0.960 0.004 NA
#> GSM2830     4  0.2340      0.777 0.000 0.000 0.000 0.852 0.000 NA
#> GSM2843     4  0.2805      0.764 0.000 0.000 0.000 0.812 0.004 NA
#> GSM2871     4  0.5470      0.556 0.000 0.060 0.000 0.504 0.028 NA
#> GSM2831     4  0.0363      0.803 0.000 0.000 0.000 0.988 0.000 NA
#> GSM2844     4  0.0632      0.803 0.000 0.000 0.000 0.976 0.000 NA
#> GSM2833     4  0.3564      0.695 0.000 0.000 0.000 0.724 0.012 NA
#> GSM2846     4  0.3342      0.722 0.000 0.000 0.000 0.760 0.012 NA
#> GSM2835     4  0.2772      0.751 0.000 0.000 0.000 0.816 0.004 NA
#> GSM2858     4  0.2838      0.747 0.000 0.000 0.000 0.808 0.004 NA
#> GSM2836     2  0.2560      0.810 0.000 0.872 0.000 0.000 0.036 NA
#> GSM2848     2  0.2106      0.824 0.000 0.904 0.000 0.000 0.032 NA
#> GSM2828     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.000 NA
#> GSM2837     3  0.0291      0.937 0.000 0.000 0.992 0.000 0.004 NA
#> GSM2839     5  0.3741      0.663 0.320 0.000 0.000 0.000 0.672 NA
#> GSM2841     5  0.3409      0.691 0.300 0.000 0.000 0.000 0.700 NA
#> GSM2827     2  0.4404      0.650 0.004 0.696 0.000 0.008 0.040 NA
#> GSM2842     2  0.3347      0.771 0.004 0.812 0.000 0.004 0.028 NA
#> GSM2845     4  0.6180      0.512 0.000 0.076 0.000 0.472 0.072 NA
#> GSM2872     4  0.5759      0.583 0.004 0.040 0.000 0.528 0.064 NA
#> GSM2834     4  0.4639      0.681 0.000 0.016 0.000 0.644 0.036 NA
#> GSM2847     4  0.3812      0.718 0.000 0.000 0.000 0.712 0.024 NA
#> GSM2849     3  0.0291      0.938 0.000 0.000 0.992 0.000 0.004 NA
#> GSM2850     3  0.0291      0.938 0.000 0.000 0.992 0.000 0.004 NA
#> GSM2838     2  0.3518      0.747 0.000 0.732 0.000 0.000 0.012 NA
#> GSM2853     2  0.3719      0.749 0.000 0.728 0.000 0.000 0.024 NA
#> GSM2852     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.004 NA
#> GSM2855     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.004 NA
#> GSM2840     5  0.3110      0.738 0.196 0.000 0.000 0.000 0.792 NA
#> GSM2857     5  0.3076      0.734 0.240 0.000 0.000 0.000 0.760 NA
#> GSM2859     2  0.1657      0.839 0.000 0.928 0.000 0.000 0.016 NA
#> GSM2860     2  0.0508      0.839 0.000 0.984 0.000 0.000 0.012 NA
#> GSM2861     2  0.2039      0.833 0.000 0.904 0.000 0.000 0.020 NA
#> GSM2862     2  0.0806      0.838 0.000 0.972 0.000 0.000 0.020 NA
#> GSM2863     2  0.0405      0.839 0.000 0.988 0.000 0.000 0.004 NA
#> GSM2864     2  0.1908      0.825 0.000 0.916 0.000 0.000 0.028 NA
#> GSM2865     2  0.1176      0.836 0.000 0.956 0.000 0.000 0.020 NA
#> GSM2866     2  0.0520      0.839 0.000 0.984 0.000 0.000 0.008 NA
#> GSM2868     2  0.3743      0.697 0.000 0.724 0.000 0.000 0.252 NA
#> GSM2869     2  0.3746      0.752 0.000 0.760 0.000 0.000 0.192 NA
#> GSM2851     2  0.2956      0.818 0.000 0.848 0.000 0.000 0.088 NA
#> GSM2867     2  0.3778      0.677 0.000 0.708 0.000 0.000 0.272 NA
#> GSM2870     2  0.3341      0.813 0.000 0.816 0.000 0.000 0.068 NA
#> GSM2854     4  0.2980      0.756 0.000 0.000 0.000 0.808 0.012 NA
#> GSM2873     2  0.3163      0.776 0.000 0.820 0.000 0.000 0.040 NA
#> GSM2874     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.000 NA
#> GSM2884     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.000 NA
#> GSM2875     1  0.0363      0.925 0.988 0.000 0.000 0.000 0.012 NA
#> GSM2890     1  0.0363      0.925 0.988 0.000 0.000 0.000 0.012 NA
#> GSM2877     1  0.0146      0.926 0.996 0.000 0.000 0.000 0.000 NA
#> GSM2892     1  0.0146      0.927 0.996 0.000 0.000 0.000 0.004 NA
#> GSM2902     1  0.0146      0.927 0.996 0.000 0.000 0.000 0.004 NA
#> GSM2878     1  0.0458      0.924 0.984 0.000 0.000 0.000 0.016 NA
#> GSM2901     1  0.0547      0.922 0.980 0.000 0.000 0.000 0.020 NA
#> GSM2879     3  0.4908      0.351 0.000 0.348 0.584 0.000 0.004 NA
#> GSM2898     3  0.5040      0.169 0.000 0.408 0.528 0.000 0.008 NA
#> GSM2881     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.000 NA
#> GSM2897     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.000 NA
#> GSM2882     4  0.0458      0.803 0.000 0.000 0.000 0.984 0.000 NA
#> GSM2894     4  0.0547      0.803 0.000 0.000 0.000 0.980 0.000 NA
#> GSM2883     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.004 NA
#> GSM2895     3  0.0146      0.938 0.000 0.000 0.996 0.000 0.004 NA
#> GSM2885     3  0.0000      0.939 0.000 0.000 1.000 0.000 0.000 NA
#> GSM2886     3  0.0000      0.939 0.000 0.000 1.000 0.000 0.000 NA
#> GSM2887     3  0.0000      0.939 0.000 0.000 1.000 0.000 0.000 NA
#> GSM2896     3  0.0000      0.939 0.000 0.000 1.000 0.000 0.000 NA
#> GSM2888     2  0.4103      0.747 0.000 0.764 0.136 0.000 0.008 NA
#> GSM2889     2  0.3784      0.765 0.000 0.792 0.124 0.000 0.008 NA
#> GSM2876     1  0.0622      0.925 0.980 0.000 0.000 0.000 0.008 NA
#> GSM2891     1  0.0622      0.925 0.980 0.000 0.000 0.000 0.008 NA
#> GSM2880     1  0.0820      0.921 0.972 0.000 0.000 0.000 0.016 NA
#> GSM2893     1  0.0508      0.926 0.984 0.000 0.000 0.000 0.004 NA
#> GSM2821     1  0.2058      0.890 0.908 0.000 0.000 0.000 0.056 NA
#> GSM2900     1  0.1765      0.897 0.924 0.000 0.000 0.000 0.052 NA
#> GSM2903     1  0.1829      0.898 0.920 0.000 0.000 0.000 0.056 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 tissue(p) k
#> ATC:NMF 81  6.04e-05 2
#> ATC:NMF 84  1.72e-08 3
#> ATC:NMF 83  4.06e-12 4
#> ATC:NMF 83  4.06e-12 5
#> ATC:NMF 80  6.28e-15 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