cola Report for GDS1975

Date: 2019-12-25 20:17:12 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 21168 rows and 85 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] 21168    85

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:skmeans 3 1.000 0.983 0.993 ** 2
CV:skmeans 3 1.000 0.969 0.987 ** 2
MAD:kmeans 3 1.000 0.962 0.984 **
MAD:skmeans 3 1.000 0.979 0.990 ** 2
ATC:NMF 3 1.000 0.979 0.990 ** 2
CV:kmeans 3 0.984 0.954 0.978 **
SD:kmeans 3 0.984 0.937 0.974 **
ATC:pam 4 0.976 0.947 0.978 ** 2
ATC:kmeans 3 0.969 0.937 0.975 ** 2
CV:NMF 3 0.967 0.951 0.979 ** 2
MAD:NMF 3 0.967 0.957 0.981 ** 2
MAD:mclust 5 0.966 0.898 0.959 ** 3
SD:NMF 3 0.952 0.940 0.976 ** 2
ATC:skmeans 4 0.903 0.882 0.939 * 2,3
MAD:pam 4 0.888 0.880 0.944
SD:pam 6 0.867 0.815 0.918
SD:mclust 3 0.825 0.929 0.965
ATC:mclust 3 0.824 0.882 0.918
CV:mclust 3 0.785 0.760 0.905
ATC:hclust 4 0.688 0.727 0.830
CV:pam 3 0.634 0.822 0.910
MAD:hclust 5 0.611 0.684 0.802
CV:hclust 3 0.605 0.768 0.888
SD:hclust 5 0.589 0.662 0.806

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 1.000           0.971       0.988          0.501 0.500   0.500
#> CV:NMF      2 1.000           0.975       0.989          0.502 0.497   0.497
#> MAD:NMF     2 1.000           0.962       0.984          0.503 0.496   0.496
#> ATC:NMF     2 1.000           0.962       0.984          0.495 0.506   0.506
#> SD:skmeans  2 1.000           0.968       0.988          0.505 0.496   0.496
#> CV:skmeans  2 1.000           0.973       0.989          0.505 0.496   0.496
#> MAD:skmeans 2 1.000           0.974       0.989          0.505 0.496   0.496
#> ATC:skmeans 2 1.000           0.989       0.995          0.500 0.500   0.500
#> SD:mclust   2 0.289           0.682       0.805          0.444 0.525   0.525
#> CV:mclust   2 0.290           0.807       0.841          0.437 0.545   0.545
#> MAD:mclust  2 0.335           0.707       0.843          0.472 0.506   0.506
#> ATC:mclust  2 0.263           0.791       0.801          0.402 0.545   0.545
#> SD:kmeans   2 0.691           0.898       0.947          0.485 0.514   0.514
#> CV:kmeans   2 0.651           0.888       0.937          0.485 0.514   0.514
#> MAD:kmeans  2 0.683           0.836       0.926          0.486 0.503   0.503
#> ATC:kmeans  2 1.000           0.973       0.989          0.482 0.514   0.514
#> SD:pam      2 0.671           0.783       0.912          0.492 0.500   0.500
#> CV:pam      2 0.563           0.892       0.936          0.447 0.570   0.570
#> MAD:pam     2 0.547           0.756       0.900          0.483 0.500   0.500
#> ATC:pam     2 1.000           0.984       0.994          0.506 0.494   0.494
#> SD:hclust   2 0.559           0.742       0.897          0.364 0.649   0.649
#> CV:hclust   2 0.666           0.849       0.930          0.304 0.722   0.722
#> MAD:hclust  2 0.361           0.800       0.878          0.421 0.519   0.519
#> ATC:hclust  2 0.608           0.839       0.919          0.442 0.525   0.525
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.952           0.940       0.976          0.344 0.725   0.501
#> CV:NMF      3 0.967           0.951       0.979          0.342 0.711   0.481
#> MAD:NMF     3 0.967           0.957       0.981          0.338 0.729   0.505
#> ATC:NMF     3 1.000           0.979       0.990          0.361 0.759   0.552
#> SD:skmeans  3 1.000           0.983       0.993          0.332 0.757   0.545
#> CV:skmeans  3 1.000           0.969       0.987          0.332 0.736   0.514
#> MAD:skmeans 3 1.000           0.979       0.990          0.327 0.757   0.545
#> ATC:skmeans 3 0.999           0.974       0.988          0.334 0.783   0.587
#> SD:mclust   3 0.825           0.929       0.965          0.509 0.728   0.516
#> CV:mclust   3 0.785           0.760       0.905          0.507 0.752   0.557
#> MAD:mclust  3 1.000           0.958       0.976          0.417 0.746   0.533
#> ATC:mclust  3 0.824           0.882       0.918          0.643 0.750   0.554
#> SD:kmeans   3 0.984           0.937       0.974          0.385 0.718   0.499
#> CV:kmeans   3 0.984           0.954       0.978          0.383 0.718   0.499
#> MAD:kmeans  3 1.000           0.962       0.984          0.385 0.729   0.507
#> ATC:kmeans  3 0.969           0.937       0.975          0.395 0.741   0.530
#> SD:pam      3 0.655           0.767       0.872          0.336 0.709   0.480
#> CV:pam      3 0.634           0.822       0.910          0.471 0.762   0.583
#> MAD:pam     3 0.660           0.799       0.889          0.363 0.722   0.497
#> ATC:pam     3 0.840           0.905       0.936          0.313 0.720   0.491
#> SD:hclust   3 0.462           0.621       0.832          0.734 0.709   0.551
#> CV:hclust   3 0.605           0.768       0.888          0.973 0.684   0.562
#> MAD:hclust  3 0.503           0.669       0.840          0.540 0.764   0.563
#> ATC:hclust  3 0.546           0.687       0.841          0.463 0.742   0.535
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.852           0.833       0.922         0.1049 0.887   0.673
#> CV:NMF      4 0.766           0.716       0.855         0.1017 0.886   0.674
#> MAD:NMF     4 0.884           0.898       0.947         0.1069 0.884   0.666
#> ATC:NMF     4 0.819           0.804       0.899         0.1020 0.887   0.674
#> SD:skmeans  4 0.804           0.765       0.894         0.0992 0.909   0.735
#> CV:skmeans  4 0.805           0.782       0.895         0.0999 0.908   0.732
#> MAD:skmeans 4 0.839           0.823       0.914         0.0915 0.944   0.832
#> ATC:skmeans 4 0.903           0.882       0.939         0.0767 0.929   0.791
#> SD:mclust   4 0.832           0.796       0.900         0.0940 0.911   0.743
#> CV:mclust   4 0.675           0.753       0.845         0.0952 0.859   0.622
#> MAD:mclust  4 0.709           0.688       0.848         0.0776 0.946   0.835
#> ATC:mclust  4 0.681           0.780       0.851         0.1163 0.882   0.662
#> SD:kmeans   4 0.744           0.770       0.851         0.1042 0.860   0.613
#> CV:kmeans   4 0.720           0.700       0.820         0.1074 0.876   0.646
#> MAD:kmeans  4 0.774           0.639       0.832         0.1079 0.955   0.865
#> ATC:kmeans  4 0.799           0.786       0.893         0.1114 0.855   0.596
#> SD:pam      4 0.692           0.808       0.835         0.1405 0.820   0.522
#> CV:pam      4 0.604           0.695       0.832         0.1037 0.922   0.778
#> MAD:pam     4 0.888           0.880       0.944         0.1443 0.826   0.539
#> ATC:pam     4 0.976           0.947       0.978         0.1295 0.850   0.587
#> SD:hclust   4 0.496           0.635       0.750         0.1311 0.818   0.547
#> CV:hclust   4 0.581           0.693       0.809         0.1801 0.829   0.595
#> MAD:hclust  4 0.513           0.471       0.680         0.1034 0.775   0.484
#> ATC:hclust  4 0.688           0.727       0.830         0.1416 0.851   0.588
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.750           0.655       0.815         0.0552 0.943   0.789
#> CV:NMF      5 0.740           0.641       0.828         0.0621 0.915   0.702
#> MAD:NMF     5 0.755           0.688       0.833         0.0470 0.965   0.869
#> ATC:NMF     5 0.752           0.695       0.843         0.0441 0.956   0.835
#> SD:skmeans  5 0.761           0.628       0.834         0.0613 0.924   0.727
#> CV:skmeans  5 0.741           0.620       0.816         0.0617 0.928   0.743
#> MAD:skmeans 5 0.764           0.638       0.827         0.0623 0.925   0.747
#> ATC:skmeans 5 0.821           0.798       0.898         0.0478 0.975   0.909
#> SD:mclust   5 0.873           0.821       0.922         0.0834 0.893   0.637
#> CV:mclust   5 0.823           0.754       0.893         0.0974 0.853   0.541
#> MAD:mclust  5 0.966           0.898       0.959         0.0925 0.891   0.636
#> ATC:mclust  5 0.659           0.615       0.780         0.0430 0.843   0.527
#> SD:kmeans   5 0.746           0.701       0.837         0.0635 0.940   0.772
#> CV:kmeans   5 0.736           0.660       0.831         0.0625 0.897   0.640
#> MAD:kmeans  5 0.731           0.643       0.815         0.0636 0.870   0.590
#> ATC:kmeans  5 0.757           0.676       0.837         0.0586 0.931   0.741
#> SD:pam      5 0.768           0.654       0.810         0.0588 0.969   0.875
#> CV:pam      5 0.681           0.556       0.750         0.0816 0.835   0.498
#> MAD:pam     5 0.824           0.724       0.864         0.0536 0.944   0.782
#> ATC:pam     5 0.866           0.810       0.917         0.0486 0.964   0.857
#> SD:hclust   5 0.589           0.662       0.806         0.0821 0.922   0.719
#> CV:hclust   5 0.630           0.647       0.806         0.0860 0.953   0.823
#> MAD:hclust  5 0.611           0.684       0.802         0.0872 0.846   0.550
#> ATC:hclust  5 0.672           0.633       0.811         0.0597 0.976   0.904
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.729           0.582       0.790         0.0400 0.904   0.632
#> CV:NMF      6 0.701           0.513       0.724         0.0408 0.893   0.574
#> MAD:NMF     6 0.733           0.598       0.785         0.0446 0.896   0.608
#> ATC:NMF     6 0.745           0.666       0.807         0.0360 0.939   0.761
#> SD:skmeans  6 0.740           0.561       0.774         0.0351 0.959   0.822
#> CV:skmeans  6 0.718           0.556       0.767         0.0365 0.937   0.739
#> MAD:skmeans 6 0.731           0.587       0.761         0.0353 0.949   0.791
#> ATC:skmeans 6 0.790           0.582       0.828         0.0413 0.958   0.843
#> SD:mclust   6 0.825           0.675       0.862         0.0220 0.963   0.835
#> CV:mclust   6 0.802           0.755       0.864         0.0295 0.959   0.818
#> MAD:mclust  6 0.879           0.751       0.880         0.0356 0.978   0.899
#> ATC:mclust  6 0.721           0.612       0.784         0.0438 0.961   0.848
#> SD:kmeans   6 0.758           0.591       0.784         0.0421 0.968   0.853
#> CV:kmeans   6 0.773           0.634       0.803         0.0416 0.952   0.794
#> MAD:kmeans  6 0.751           0.645       0.790         0.0420 0.909   0.607
#> ATC:kmeans  6 0.739           0.644       0.774         0.0406 0.937   0.735
#> SD:pam      6 0.867           0.815       0.918         0.0433 0.923   0.673
#> CV:pam      6 0.830           0.777       0.895         0.0538 0.902   0.588
#> MAD:pam     6 0.888           0.842       0.913         0.0414 0.920   0.657
#> ATC:pam     6 0.844           0.763       0.872         0.0369 0.968   0.856
#> SD:hclust   6 0.654           0.548       0.770         0.0433 0.977   0.896
#> CV:hclust   6 0.684           0.621       0.777         0.0392 0.992   0.964
#> MAD:hclust  6 0.683           0.589       0.788         0.0425 0.963   0.838
#> ATC:hclust  6 0.728           0.635       0.785         0.0425 0.945   0.760

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

collect_stats(res_list, k = 2)

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

collect_stats(res_list, k = 3)

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

collect_stats(res_list, k = 4)

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

collect_stats(res_list, k = 5)

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

collect_stats(res_list, k = 6)

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

Partition from all methods

Collect partitions from all methods:

collect_classes(res_list, k = 2)

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

collect_classes(res_list, k = 3)

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

collect_classes(res_list, k = 4)

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

collect_classes(res_list, k = 5)

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

collect_classes(res_list, k = 6)

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

Top rows overlap

Overlap of top rows from different top-row methods:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Heatmaps of the top rows:

top_rows_heatmap(res_list, top_n = 1000)

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

top_rows_heatmap(res_list, top_n = 2000)

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

top_rows_heatmap(res_list, top_n = 3000)

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

top_rows_heatmap(res_list, top_n = 4000)

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

top_rows_heatmap(res_list, top_n = 5000)

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

Test to known annotations

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

test_to_known_factors(res_list, k = 2)
#>              n disease.state(p) cell.type(p) k
#> SD:NMF      84         8.94e-05     4.59e-04 2
#> CV:NMF      84         8.94e-05     4.59e-04 2
#> MAD:NMF     83         6.56e-05     3.42e-04 2
#> ATC:NMF     84         4.25e-06     2.72e-05 2
#> SD:skmeans  83         3.58e-05     1.92e-04 2
#> CV:skmeans  84         4.99e-05     2.64e-04 2
#> MAD:skmeans 84         2.71e-05     1.47e-04 2
#> ATC:skmeans 85         1.64e-06     1.09e-05 2
#> SD:mclust   80         2.30e-01     4.33e-01 2
#> CV:mclust   85         1.92e-01     3.83e-01 2
#> MAD:mclust  76         2.92e-05     1.66e-04 2
#> ATC:mclust  84         2.10e-01     4.08e-01 2
#> SD:kmeans   84         2.54e-05     1.50e-04 2
#> CV:kmeans   84         1.43e-05     8.68e-05 2
#> MAD:kmeans  80         3.14e-05     1.80e-04 2
#> ATC:kmeans  84         2.54e-05     1.50e-04 2
#> SD:pam      71         2.91e-03     1.38e-02 2
#> CV:pam      84         2.30e-02     4.40e-02 2
#> MAD:pam     70         5.55e-04     2.98e-03 2
#> ATC:pam     84         7.45e-05     5.12e-04 2
#> SD:hclust   73         1.31e-02     3.99e-02 2
#> CV:hclust   78         3.49e-02     1.10e-01 2
#> MAD:hclust  81         6.16e-05     3.41e-04 2
#> ATC:hclust  82         7.90e-05     4.32e-04 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) cell.type(p) k
#> SD:NMF      83         5.12e-04      0.01152 3
#> CV:NMF      83         8.28e-04      0.01680 3
#> MAD:NMF     84         2.31e-04      0.00609 3
#> ATC:NMF     85         1.76e-04      0.00487 3
#> SD:skmeans  84         1.12e-04      0.00336 3
#> CV:skmeans  84         1.32e-04      0.00385 3
#> MAD:skmeans 85         8.48e-05      0.00267 3
#> ATC:skmeans 85         2.80e-05      0.00105 3
#> SD:mclust   83         1.97e-03      0.03264 3
#> CV:mclust   70         1.56e-04      0.00353 3
#> MAD:mclust  85         2.97e-04      0.00744 3
#> ATC:mclust  83         3.19e-04      0.00790 3
#> SD:kmeans   82         6.74e-04      0.01431 3
#> CV:kmeans   83         1.97e-03      0.03264 3
#> MAD:kmeans  84         3.89e-04      0.00926 3
#> ATC:kmeans  81         2.02e-04      0.00547 3
#> SD:pam      81         6.50e-05      0.00168 3
#> CV:pam      81         1.67e-03      0.02369 3
#> MAD:pam     81         3.72e-05      0.00135 3
#> ATC:pam     85         1.78e-04      0.00492 3
#> SD:hclust   61         5.60e-03      0.09983 3
#> CV:hclust   74         2.19e-02      0.24306 3
#> MAD:hclust  70         1.32e-04      0.00469 3
#> ATC:hclust  72         4.87e-04      0.01334 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) cell.type(p) k
#> SD:NMF      78         1.16e-05     5.77e-04 4
#> CV:NMF      67         2.80e-04     1.09e-02 4
#> MAD:NMF     83         2.94e-05     9.99e-04 4
#> ATC:NMF     77         3.63e-05     1.57e-03 4
#> SD:skmeans  74         6.44e-05     4.22e-03 4
#> CV:skmeans  75         4.71e-05     3.29e-03 4
#> MAD:skmeans 77         8.20e-05     2.61e-03 4
#> ATC:skmeans 80         4.19e-05     2.37e-03 4
#> SD:mclust   82         2.28e-04     1.27e-02 4
#> CV:mclust   79         6.06e-04     2.56e-02 4
#> MAD:mclust  73         6.20e-04     2.15e-02 4
#> ATC:mclust  79         7.25e-05     5.52e-03 4
#> SD:kmeans   74         1.82e-04     1.41e-02 4
#> CV:kmeans   69         1.24e-03     4.48e-02 4
#> MAD:kmeans  68         2.71e-03     7.71e-02 4
#> ATC:kmeans  75         5.12e-05     4.14e-03 4
#> SD:pam      82         1.66e-06     1.92e-04 4
#> CV:pam      79         1.46e-03     4.43e-02 4
#> MAD:pam     82         4.73e-07     8.75e-05 4
#> ATC:pam     84         5.18e-06     6.31e-04 4
#> SD:hclust   66         4.34e-06     9.52e-04 4
#> CV:hclust   70         5.52e-04     2.97e-02 4
#> MAD:hclust  37         1.74e-02     9.57e-02 4
#> ATC:hclust  73         6.08e-06     1.04e-03 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) cell.type(p) k
#> SD:NMF      67         7.51e-04     1.65e-02 5
#> CV:NMF      62         3.07e-05     5.86e-04 5
#> MAD:NMF     71         1.56e-04     3.62e-03 5
#> ATC:NMF     67         5.28e-05     1.68e-03 5
#> SD:skmeans  62         1.10e-04     1.58e-02 5
#> CV:skmeans  59         5.15e-04     2.48e-02 5
#> MAD:skmeans 64         3.35e-04     3.38e-02 5
#> ATC:skmeans 76         5.82e-05     2.77e-03 5
#> SD:mclust   80         4.54e-05     7.92e-03 5
#> CV:mclust   72         3.67e-05     8.25e-03 5
#> MAD:mclust  81         2.71e-04     1.04e-02 5
#> ATC:mclust  64         2.38e-05     3.39e-03 5
#> SD:kmeans   68         4.73e-05     1.04e-02 5
#> CV:kmeans   67         7.83e-05     1.40e-02 5
#> MAD:kmeans  62         1.49e-06     4.00e-04 5
#> ATC:kmeans  70         1.04e-04     1.84e-02 5
#> SD:pam      64         1.93e-04     1.47e-02 5
#> CV:pam      58         3.15e-04     2.75e-02 5
#> MAD:pam     74         1.17e-06     8.56e-05 5
#> ATC:pam     78         1.46e-07     9.16e-05 5
#> SD:hclust   70         5.12e-05     3.79e-03 5
#> CV:hclust   64         1.75e-05     4.91e-03 5
#> MAD:hclust  71         3.44e-06     1.50e-03 5
#> ATC:hclust  66         1.86e-06     9.24e-04 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) cell.type(p) k
#> SD:NMF      57         1.57e-04     5.00e-03 6
#> CV:NMF      48         9.25e-03     2.10e-01 6
#> MAD:NMF     55         2.97e-03     2.42e-02 6
#> ATC:NMF     69         1.53e-03     3.53e-02 6
#> SD:skmeans  52         5.85e-04     1.26e-02 6
#> CV:skmeans  53         3.08e-04     1.66e-02 6
#> MAD:skmeans 53         2.09e-04     5.39e-03 6
#> ATC:skmeans 60         2.43e-04     9.05e-03 6
#> SD:mclust   67         2.89e-05     4.20e-03 6
#> CV:mclust   76         3.71e-05     1.61e-02 6
#> MAD:mclust  72         1.44e-04     9.40e-03 6
#> ATC:mclust  68         7.73e-05     2.82e-02 6
#> SD:kmeans   56         2.47e-04     2.24e-02 6
#> CV:kmeans   65         9.59e-06     5.03e-03 6
#> MAD:kmeans  59         3.81e-05     5.00e-03 6
#> ATC:kmeans  63         6.22e-05     1.45e-02 6
#> SD:pam      77         4.88e-06     2.71e-03 6
#> CV:pam      75         1.08e-05     4.34e-03 6
#> MAD:pam     79         6.14e-06     1.81e-03 6
#> ATC:pam     76         2.94e-08     7.66e-05 6
#> SD:hclust   53         2.88e-06     1.65e-03 6
#> CV:hclust   64         2.21e-05     5.49e-03 6
#> MAD:hclust  65         8.30e-08     2.83e-05 6
#> ATC:hclust  67         6.41e-06     4.15e-03 6

Results for each method


SD:hclust

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

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

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

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

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.559           0.742       0.897         0.3636 0.649   0.649
#> 3 3 0.462           0.621       0.832         0.7340 0.709   0.551
#> 4 4 0.496           0.635       0.750         0.1311 0.818   0.547
#> 5 5 0.589           0.662       0.806         0.0821 0.922   0.719
#> 6 6 0.654           0.548       0.770         0.0433 0.977   0.896

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

suggest_best_k(res)
#> [1] 5

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM99496     1  0.0000      0.888 1.000 0.000
#> GSM99502     1  0.0000      0.888 1.000 0.000
#> GSM99504     1  0.0000      0.888 1.000 0.000
#> GSM99506     1  0.0000      0.888 1.000 0.000
#> GSM99566     1  0.0000      0.888 1.000 0.000
#> GSM99574     1  0.0000      0.888 1.000 0.000
#> GSM99592     1  0.0000      0.888 1.000 0.000
#> GSM99594     1  0.0000      0.888 1.000 0.000
#> GSM99468     1  0.0000      0.888 1.000 0.000
#> GSM99498     1  0.0000      0.888 1.000 0.000
#> GSM99500     1  0.0000      0.888 1.000 0.000
#> GSM99508     1  0.0000      0.888 1.000 0.000
#> GSM99568     1  0.0000      0.888 1.000 0.000
#> GSM99596     1  0.0000      0.888 1.000 0.000
#> GSM99600     2  0.9087      0.566 0.324 0.676
#> GSM99458     1  0.0000      0.888 1.000 0.000
#> GSM99460     1  0.0000      0.888 1.000 0.000
#> GSM99510     1  0.0376      0.886 0.996 0.004
#> GSM99512     1  0.0376      0.886 0.996 0.004
#> GSM99514     1  0.0000      0.888 1.000 0.000
#> GSM99516     1  0.0000      0.888 1.000 0.000
#> GSM99518     1  0.0000      0.888 1.000 0.000
#> GSM99520     1  0.0672      0.884 0.992 0.008
#> GSM99522     1  0.0000      0.888 1.000 0.000
#> GSM99570     1  0.0000      0.888 1.000 0.000
#> GSM99598     1  0.0000      0.888 1.000 0.000
#> GSM99432     1  0.9833      0.186 0.576 0.424
#> GSM99434     1  0.0000      0.888 1.000 0.000
#> GSM99436     2  0.9977      0.177 0.472 0.528
#> GSM99438     2  0.0938      0.804 0.012 0.988
#> GSM99440     1  0.0000      0.888 1.000 0.000
#> GSM99442     2  0.9323      0.524 0.348 0.652
#> GSM99444     2  0.0672      0.803 0.008 0.992
#> GSM99446     2  0.9170      0.554 0.332 0.668
#> GSM99448     1  0.6048      0.765 0.852 0.148
#> GSM99450     1  0.0000      0.888 1.000 0.000
#> GSM99452     1  0.0000      0.888 1.000 0.000
#> GSM99454     1  0.0000      0.888 1.000 0.000
#> GSM99456     1  0.0000      0.888 1.000 0.000
#> GSM99462     2  0.0000      0.800 0.000 1.000
#> GSM99464     1  0.0000      0.888 1.000 0.000
#> GSM99466     1  0.8763      0.541 0.704 0.296
#> GSM99470     1  0.3584      0.842 0.932 0.068
#> GSM99472     1  0.3584      0.842 0.932 0.068
#> GSM99474     1  0.5059      0.802 0.888 0.112
#> GSM99476     1  0.4161      0.830 0.916 0.084
#> GSM99478     1  0.9286      0.435 0.656 0.344
#> GSM99480     1  0.0000      0.888 1.000 0.000
#> GSM99482     1  0.0000      0.888 1.000 0.000
#> GSM99484     1  0.9393      0.411 0.644 0.356
#> GSM99486     1  1.0000     -0.106 0.504 0.496
#> GSM99488     2  0.0000      0.800 0.000 1.000
#> GSM99490     2  0.2423      0.797 0.040 0.960
#> GSM99492     1  0.0000      0.888 1.000 0.000
#> GSM99494     2  0.0000      0.800 0.000 1.000
#> GSM99524     1  0.0000      0.888 1.000 0.000
#> GSM99526     1  0.0672      0.884 0.992 0.008
#> GSM99528     1  0.8443      0.587 0.728 0.272
#> GSM99530     1  0.0000      0.888 1.000 0.000
#> GSM99532     1  0.0000      0.888 1.000 0.000
#> GSM99534     2  0.9988      0.151 0.480 0.520
#> GSM99536     1  0.0000      0.888 1.000 0.000
#> GSM99538     1  0.9686      0.287 0.604 0.396
#> GSM99540     1  0.0000      0.888 1.000 0.000
#> GSM99542     2  0.2236      0.796 0.036 0.964
#> GSM99544     1  0.9686      0.287 0.604 0.396
#> GSM99546     1  0.8016      0.630 0.756 0.244
#> GSM99548     2  0.0000      0.800 0.000 1.000
#> GSM99550     1  0.1184      0.879 0.984 0.016
#> GSM99552     1  0.8861      0.525 0.696 0.304
#> GSM99554     2  0.9850      0.329 0.428 0.572
#> GSM99556     2  0.0376      0.802 0.004 0.996
#> GSM99558     1  0.7745      0.661 0.772 0.228
#> GSM99560     1  0.9170      0.461 0.668 0.332
#> GSM99562     1  0.0000      0.888 1.000 0.000
#> GSM99564     1  1.0000     -0.106 0.504 0.496
#> GSM99572     2  0.0938      0.804 0.012 0.988
#> GSM99576     1  0.3879      0.840 0.924 0.076
#> GSM99578     2  0.5842      0.748 0.140 0.860
#> GSM99580     1  0.5178      0.798 0.884 0.116
#> GSM99582     1  0.4298      0.827 0.912 0.088
#> GSM99584     1  0.9686      0.283 0.604 0.396
#> GSM99586     1  0.0000      0.888 1.000 0.000
#> GSM99588     2  0.9087      0.564 0.324 0.676
#> GSM99590     2  0.0938      0.804 0.012 0.988

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM99496     3  0.0237     0.7198 0.004 0.000 0.996
#> GSM99502     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99504     1  0.3192     0.8355 0.888 0.000 0.112
#> GSM99506     3  0.0237     0.7198 0.004 0.000 0.996
#> GSM99566     3  0.0237     0.7198 0.004 0.000 0.996
#> GSM99574     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99592     3  0.0237     0.7198 0.004 0.000 0.996
#> GSM99594     3  0.0237     0.7198 0.004 0.000 0.996
#> GSM99468     1  0.3192     0.8355 0.888 0.000 0.112
#> GSM99498     1  0.3192     0.8355 0.888 0.000 0.112
#> GSM99500     1  0.3192     0.8355 0.888 0.000 0.112
#> GSM99508     3  0.0892     0.7193 0.020 0.000 0.980
#> GSM99568     3  0.4796     0.6101 0.220 0.000 0.780
#> GSM99596     3  0.4178     0.6457 0.172 0.000 0.828
#> GSM99600     2  0.5760     0.4993 0.000 0.672 0.328
#> GSM99458     3  0.6305    -0.0687 0.484 0.000 0.516
#> GSM99460     3  0.5988     0.2697 0.368 0.000 0.632
#> GSM99510     3  0.0475     0.7200 0.004 0.004 0.992
#> GSM99512     3  0.0475     0.7198 0.004 0.004 0.992
#> GSM99514     3  0.0237     0.7198 0.004 0.000 0.996
#> GSM99516     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99518     1  0.1860     0.8646 0.948 0.000 0.052
#> GSM99520     3  0.1267     0.7202 0.024 0.004 0.972
#> GSM99522     3  0.1964     0.7121 0.056 0.000 0.944
#> GSM99570     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99432     3  0.6192     0.2120 0.000 0.420 0.580
#> GSM99434     3  0.2625     0.7021 0.084 0.000 0.916
#> GSM99436     2  0.6299     0.0914 0.000 0.524 0.476
#> GSM99438     2  0.0592     0.7816 0.000 0.988 0.012
#> GSM99440     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99442     2  0.5905     0.4495 0.000 0.648 0.352
#> GSM99444     2  0.0424     0.7809 0.000 0.992 0.008
#> GSM99446     2  0.5810     0.4849 0.000 0.664 0.336
#> GSM99448     3  0.3752     0.6607 0.000 0.144 0.856
#> GSM99450     3  0.2711     0.7013 0.088 0.000 0.912
#> GSM99452     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99456     1  0.1031     0.8736 0.976 0.000 0.024
#> GSM99462     2  0.0000     0.7782 0.000 1.000 0.000
#> GSM99464     3  0.5760     0.3764 0.328 0.000 0.672
#> GSM99466     3  0.6326     0.5116 0.020 0.292 0.688
#> GSM99470     1  0.7318     0.5717 0.668 0.068 0.264
#> GSM99472     1  0.7318     0.5717 0.668 0.068 0.264
#> GSM99474     3  0.5304     0.6923 0.068 0.108 0.824
#> GSM99476     3  0.2860     0.7010 0.004 0.084 0.912
#> GSM99478     3  0.6651     0.4294 0.020 0.340 0.640
#> GSM99480     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99482     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99484     3  0.7462     0.4007 0.048 0.352 0.600
#> GSM99486     3  0.6308    -0.0395 0.000 0.492 0.508
#> GSM99488     2  0.0000     0.7782 0.000 1.000 0.000
#> GSM99490     2  0.1529     0.7727 0.000 0.960 0.040
#> GSM99492     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99494     2  0.0000     0.7782 0.000 1.000 0.000
#> GSM99524     1  0.0000     0.8793 1.000 0.000 0.000
#> GSM99526     3  0.3375     0.6980 0.100 0.008 0.892
#> GSM99528     3  0.8790     0.4438 0.160 0.268 0.572
#> GSM99530     3  0.6225     0.0602 0.432 0.000 0.568
#> GSM99532     1  0.6291     0.2115 0.532 0.000 0.468
#> GSM99534     2  0.8772     0.1904 0.120 0.516 0.364
#> GSM99536     1  0.0424     0.8782 0.992 0.000 0.008
#> GSM99538     3  0.6095     0.3021 0.000 0.392 0.608
#> GSM99540     1  0.6280     0.2330 0.540 0.000 0.460
#> GSM99542     2  0.1647     0.7588 0.036 0.960 0.004
#> GSM99544     3  0.6095     0.3021 0.000 0.392 0.608
#> GSM99546     3  0.7381     0.5737 0.080 0.244 0.676
#> GSM99548     2  0.0000     0.7782 0.000 1.000 0.000
#> GSM99550     1  0.4723     0.7728 0.824 0.016 0.160
#> GSM99552     3  0.5785     0.4943 0.004 0.300 0.696
#> GSM99554     2  0.6225     0.2523 0.000 0.568 0.432
#> GSM99556     2  0.0237     0.7796 0.000 0.996 0.004
#> GSM99558     3  0.5070     0.5952 0.004 0.224 0.772
#> GSM99560     3  0.6448     0.4495 0.016 0.328 0.656
#> GSM99562     3  0.0237     0.7198 0.004 0.000 0.996
#> GSM99564     3  0.6308    -0.0395 0.000 0.492 0.508
#> GSM99572     2  0.0592     0.7816 0.000 0.988 0.012
#> GSM99576     1  0.8097     0.3211 0.540 0.072 0.388
#> GSM99578     2  0.3686     0.7139 0.000 0.860 0.140
#> GSM99580     3  0.3607     0.6837 0.008 0.112 0.880
#> GSM99582     3  0.5346     0.6950 0.088 0.088 0.824
#> GSM99584     3  0.8180     0.2874 0.076 0.392 0.532
#> GSM99586     1  0.1031     0.8736 0.976 0.000 0.024
#> GSM99588     2  0.5956     0.5114 0.004 0.672 0.324
#> GSM99590     2  0.0592     0.7816 0.000 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0188     0.6808 0.000 0.000 0.996 0.004
#> GSM99502     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99504     1  0.3325     0.8279 0.864 0.000 0.112 0.024
#> GSM99506     3  0.0188     0.6808 0.000 0.000 0.996 0.004
#> GSM99566     3  0.0188     0.6808 0.000 0.000 0.996 0.004
#> GSM99574     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99592     3  0.1211     0.6725 0.000 0.000 0.960 0.040
#> GSM99594     3  0.0188     0.6808 0.000 0.000 0.996 0.004
#> GSM99468     1  0.3325     0.8279 0.864 0.000 0.112 0.024
#> GSM99498     1  0.3325     0.8279 0.864 0.000 0.112 0.024
#> GSM99500     1  0.3325     0.8279 0.864 0.000 0.112 0.024
#> GSM99508     3  0.0524     0.6819 0.008 0.000 0.988 0.004
#> GSM99568     3  0.4511     0.5842 0.176 0.000 0.784 0.040
#> GSM99596     3  0.3863     0.5978 0.144 0.000 0.828 0.028
#> GSM99600     4  0.7042     0.4742 0.000 0.352 0.132 0.516
#> GSM99458     3  0.7838     0.2212 0.316 0.000 0.404 0.280
#> GSM99460     3  0.6835     0.4709 0.156 0.000 0.592 0.252
#> GSM99510     3  0.1557     0.6645 0.000 0.000 0.944 0.056
#> GSM99512     3  0.0895     0.6760 0.000 0.004 0.976 0.020
#> GSM99514     3  0.0336     0.6810 0.000 0.000 0.992 0.008
#> GSM99516     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99518     1  0.2385     0.8634 0.920 0.000 0.052 0.028
#> GSM99520     3  0.2376     0.6596 0.016 0.000 0.916 0.068
#> GSM99522     3  0.1584     0.6781 0.036 0.000 0.952 0.012
#> GSM99570     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99432     4  0.6854     0.6795 0.000 0.120 0.332 0.548
#> GSM99434     3  0.3842     0.6458 0.036 0.000 0.836 0.128
#> GSM99436     4  0.7042     0.6948 0.000 0.188 0.240 0.572
#> GSM99438     2  0.3074     0.8628 0.000 0.848 0.000 0.152
#> GSM99440     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99442     4  0.7164     0.5400 0.000 0.320 0.156 0.524
#> GSM99444     2  0.2868     0.8708 0.000 0.864 0.000 0.136
#> GSM99446     4  0.7058     0.4920 0.000 0.344 0.136 0.520
#> GSM99448     3  0.5062     0.2586 0.000 0.024 0.692 0.284
#> GSM99450     3  0.3706     0.6513 0.040 0.000 0.848 0.112
#> GSM99452     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99456     1  0.4746     0.7165 0.688 0.000 0.008 0.304
#> GSM99462     2  0.2011     0.8888 0.000 0.920 0.000 0.080
#> GSM99464     3  0.6538     0.4987 0.140 0.000 0.628 0.232
#> GSM99466     4  0.5993     0.5244 0.008 0.028 0.408 0.556
#> GSM99470     1  0.6994     0.5446 0.604 0.012 0.128 0.256
#> GSM99472     1  0.6994     0.5446 0.604 0.012 0.128 0.256
#> GSM99474     3  0.5378     0.4297 0.036 0.004 0.696 0.264
#> GSM99476     3  0.4372     0.3843 0.000 0.004 0.728 0.268
#> GSM99478     4  0.6401     0.6082 0.008 0.056 0.364 0.572
#> GSM99480     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0707     0.8812 0.980 0.000 0.000 0.020
#> GSM99484     4  0.6394     0.6167 0.012 0.060 0.316 0.612
#> GSM99486     4  0.6868     0.6990 0.000 0.152 0.264 0.584
#> GSM99488     2  0.0336     0.8678 0.000 0.992 0.000 0.008
#> GSM99490     2  0.2706     0.8719 0.000 0.900 0.020 0.080
#> GSM99492     1  0.2589     0.8473 0.884 0.000 0.000 0.116
#> GSM99494     2  0.0336     0.8678 0.000 0.992 0.000 0.008
#> GSM99524     1  0.0000     0.8854 1.000 0.000 0.000 0.000
#> GSM99526     3  0.4418     0.6213 0.032 0.000 0.784 0.184
#> GSM99528     4  0.7142     0.3270 0.052 0.044 0.360 0.544
#> GSM99530     3  0.6991     0.4154 0.136 0.000 0.540 0.324
#> GSM99532     3  0.7717     0.2155 0.304 0.000 0.444 0.252
#> GSM99534     4  0.7778     0.5130 0.064 0.208 0.132 0.596
#> GSM99536     1  0.1256     0.8803 0.964 0.000 0.008 0.028
#> GSM99538     4  0.6589     0.6549 0.000 0.092 0.352 0.556
#> GSM99540     3  0.7731     0.1865 0.316 0.000 0.436 0.248
#> GSM99542     2  0.2654     0.8235 0.004 0.888 0.000 0.108
#> GSM99544     4  0.6589     0.6549 0.000 0.092 0.352 0.556
#> GSM99546     4  0.6528     0.3559 0.032 0.024 0.432 0.512
#> GSM99548     2  0.1389     0.8855 0.000 0.952 0.000 0.048
#> GSM99550     1  0.7006     0.5109 0.528 0.000 0.132 0.340
#> GSM99552     3  0.6366    -0.4103 0.000 0.064 0.512 0.424
#> GSM99554     4  0.7117     0.6535 0.000 0.228 0.208 0.564
#> GSM99556     2  0.1302     0.8859 0.000 0.956 0.000 0.044
#> GSM99558     3  0.6000    -0.0871 0.000 0.052 0.592 0.356
#> GSM99560     4  0.6612     0.5819 0.004 0.072 0.400 0.524
#> GSM99562     3  0.0188     0.6808 0.000 0.000 0.996 0.004
#> GSM99564     4  0.6868     0.6990 0.000 0.152 0.264 0.584
#> GSM99572     2  0.3172     0.8554 0.000 0.840 0.000 0.160
#> GSM99576     4  0.8283    -0.2476 0.320 0.012 0.308 0.360
#> GSM99578     2  0.4986     0.6517 0.000 0.740 0.044 0.216
#> GSM99580     3  0.4368     0.3917 0.004 0.004 0.748 0.244
#> GSM99582     3  0.5873     0.4016 0.056 0.004 0.660 0.280
#> GSM99584     4  0.7346     0.6407 0.032 0.096 0.304 0.568
#> GSM99586     1  0.4746     0.7165 0.688 0.000 0.008 0.304
#> GSM99588     4  0.7398     0.3536 0.000 0.412 0.164 0.424
#> GSM99590     2  0.2973     0.8662 0.000 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
#> GSM99496     3  0.0451      0.746 0.000 0.000 0.988 0.004 0.008
#> GSM99502     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.3055      0.766 0.864 0.000 0.072 0.000 0.064
#> GSM99506     3  0.0451      0.746 0.000 0.000 0.988 0.004 0.008
#> GSM99566     3  0.0771      0.742 0.000 0.000 0.976 0.004 0.020
#> GSM99574     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.2144      0.747 0.000 0.000 0.912 0.068 0.020
#> GSM99594     3  0.0771      0.742 0.000 0.000 0.976 0.004 0.020
#> GSM99468     1  0.3055      0.766 0.864 0.000 0.072 0.000 0.064
#> GSM99498     1  0.3055      0.766 0.864 0.000 0.072 0.000 0.064
#> GSM99500     1  0.3055      0.766 0.864 0.000 0.072 0.000 0.064
#> GSM99508     3  0.0671      0.745 0.004 0.000 0.980 0.000 0.016
#> GSM99568     3  0.4922      0.481 0.156 0.000 0.732 0.008 0.104
#> GSM99596     3  0.4192      0.534 0.144 0.000 0.784 0.004 0.068
#> GSM99600     4  0.3766      0.552 0.000 0.268 0.004 0.728 0.000
#> GSM99458     5  0.7707      0.610 0.212 0.000 0.184 0.116 0.488
#> GSM99460     5  0.5271      0.571 0.052 0.000 0.272 0.016 0.660
#> GSM99510     3  0.3339      0.727 0.000 0.000 0.840 0.112 0.048
#> GSM99512     3  0.1845      0.745 0.000 0.000 0.928 0.056 0.016
#> GSM99514     3  0.0671      0.747 0.000 0.000 0.980 0.004 0.016
#> GSM99516     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.1894      0.811 0.920 0.000 0.008 0.000 0.072
#> GSM99520     3  0.2331      0.743 0.008 0.000 0.908 0.068 0.016
#> GSM99522     3  0.1981      0.723 0.016 0.000 0.920 0.000 0.064
#> GSM99570     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.3735      0.751 0.000 0.040 0.116 0.828 0.016
#> GSM99434     3  0.5224      0.623 0.012 0.000 0.712 0.128 0.148
#> GSM99436     4  0.2628      0.726 0.000 0.088 0.028 0.884 0.000
#> GSM99438     2  0.3143      0.821 0.000 0.796 0.000 0.204 0.000
#> GSM99440     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.3461      0.610 0.000 0.224 0.004 0.772 0.000
#> GSM99444     2  0.2813      0.845 0.000 0.832 0.000 0.168 0.000
#> GSM99446     4  0.3689      0.571 0.000 0.256 0.004 0.740 0.000
#> GSM99448     3  0.4726      0.338 0.000 0.000 0.580 0.400 0.020
#> GSM99450     3  0.5183      0.621 0.016 0.000 0.720 0.112 0.152
#> GSM99452     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.4397      0.107 0.564 0.000 0.004 0.000 0.432
#> GSM99462     2  0.2233      0.870 0.000 0.892 0.000 0.104 0.004
#> GSM99464     5  0.5235      0.509 0.036 0.000 0.300 0.020 0.644
#> GSM99466     4  0.4599      0.681 0.004 0.000 0.156 0.752 0.088
#> GSM99470     1  0.6812      0.311 0.600 0.012 0.052 0.220 0.116
#> GSM99472     1  0.6812      0.311 0.600 0.012 0.052 0.220 0.116
#> GSM99474     3  0.5537      0.561 0.012 0.000 0.648 0.256 0.084
#> GSM99476     3  0.5790      0.205 0.000 0.000 0.500 0.408 0.092
#> GSM99478     4  0.4173      0.711 0.004 0.000 0.148 0.784 0.064
#> GSM99480     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99482     1  0.0740      0.839 0.980 0.004 0.000 0.008 0.008
#> GSM99484     4  0.4895      0.718 0.008 0.028 0.088 0.772 0.104
#> GSM99486     4  0.2139      0.737 0.000 0.052 0.032 0.916 0.000
#> GSM99488     2  0.1012      0.854 0.000 0.968 0.000 0.020 0.012
#> GSM99490     2  0.2389      0.855 0.000 0.880 0.000 0.116 0.004
#> GSM99492     1  0.2471      0.744 0.864 0.000 0.000 0.000 0.136
#> GSM99494     2  0.1012      0.854 0.000 0.968 0.000 0.020 0.012
#> GSM99524     1  0.0000      0.847 1.000 0.000 0.000 0.000 0.000
#> GSM99526     3  0.6591      0.166 0.012 0.000 0.460 0.148 0.380
#> GSM99528     4  0.6512      0.450 0.012 0.020 0.092 0.544 0.332
#> GSM99530     5  0.2664      0.622 0.020 0.000 0.092 0.004 0.884
#> GSM99532     5  0.5847      0.693 0.204 0.000 0.188 0.000 0.608
#> GSM99534     4  0.6319      0.531 0.060 0.192 0.008 0.652 0.088
#> GSM99536     1  0.0963      0.834 0.964 0.000 0.000 0.000 0.036
#> GSM99538     4  0.2929      0.740 0.000 0.012 0.128 0.856 0.004
#> GSM99540     5  0.5867      0.691 0.216 0.000 0.180 0.000 0.604
#> GSM99542     2  0.2592      0.793 0.000 0.892 0.000 0.052 0.056
#> GSM99544     4  0.2929      0.740 0.000 0.012 0.128 0.856 0.004
#> GSM99546     4  0.5963      0.499 0.012 0.000 0.232 0.620 0.136
#> GSM99548     2  0.1697      0.868 0.000 0.932 0.000 0.060 0.008
#> GSM99550     5  0.4867      0.283 0.404 0.004 0.008 0.008 0.576
#> GSM99552     4  0.4456      0.493 0.000 0.000 0.320 0.660 0.020
#> GSM99554     4  0.2771      0.693 0.000 0.128 0.012 0.860 0.000
#> GSM99556     2  0.1502      0.869 0.000 0.940 0.000 0.056 0.004
#> GSM99558     4  0.4781      0.136 0.000 0.000 0.428 0.552 0.020
#> GSM99560     4  0.4609      0.722 0.004 0.016 0.072 0.776 0.132
#> GSM99562     3  0.0566      0.745 0.000 0.000 0.984 0.004 0.012
#> GSM99564     4  0.2139      0.737 0.000 0.052 0.032 0.916 0.000
#> GSM99572     2  0.3210      0.812 0.000 0.788 0.000 0.212 0.000
#> GSM99576     5  0.6815      0.576 0.240 0.016 0.044 0.108 0.592
#> GSM99578     2  0.4065      0.645 0.000 0.720 0.000 0.264 0.016
#> GSM99580     3  0.4422      0.540 0.004 0.000 0.680 0.300 0.016
#> GSM99582     3  0.6742      0.264 0.028 0.000 0.488 0.352 0.132
#> GSM99584     4  0.5090      0.711 0.012 0.024 0.128 0.756 0.080
#> GSM99586     1  0.4397      0.107 0.564 0.000 0.004 0.000 0.432
#> GSM99588     4  0.4356      0.422 0.000 0.340 0.012 0.648 0.000
#> GSM99590     2  0.2891      0.840 0.000 0.824 0.000 0.176 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0000    0.71710 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99502     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.3208    0.75576 0.844 0.000 0.068 0.000 0.076 0.012
#> GSM99506     3  0.0000    0.71710 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99566     3  0.0909    0.71382 0.000 0.000 0.968 0.000 0.020 0.012
#> GSM99574     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.2940    0.68113 0.000 0.000 0.848 0.036 0.004 0.112
#> GSM99594     3  0.0909    0.71382 0.000 0.000 0.968 0.000 0.020 0.012
#> GSM99468     1  0.3208    0.75576 0.844 0.000 0.068 0.000 0.076 0.012
#> GSM99498     1  0.3208    0.75576 0.844 0.000 0.068 0.000 0.076 0.012
#> GSM99500     1  0.3208    0.75576 0.844 0.000 0.068 0.000 0.076 0.012
#> GSM99508     3  0.0458    0.71778 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM99568     3  0.4917    0.51713 0.128 0.000 0.716 0.000 0.116 0.040
#> GSM99596     3  0.3870    0.55606 0.128 0.000 0.788 0.000 0.072 0.012
#> GSM99600     4  0.3302    0.48299 0.000 0.232 0.000 0.760 0.004 0.004
#> GSM99458     5  0.7164    0.41785 0.172 0.000 0.056 0.024 0.420 0.328
#> GSM99460     5  0.5714    0.37264 0.020 0.000 0.100 0.004 0.552 0.324
#> GSM99510     3  0.4763    0.50056 0.000 0.000 0.620 0.052 0.008 0.320
#> GSM99512     3  0.3419    0.65153 0.000 0.000 0.792 0.028 0.004 0.176
#> GSM99514     3  0.0363    0.71869 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99516     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.2062    0.79579 0.900 0.000 0.008 0.000 0.088 0.004
#> GSM99520     3  0.2782    0.69436 0.000 0.000 0.876 0.032 0.024 0.068
#> GSM99522     3  0.2672    0.69290 0.000 0.000 0.868 0.000 0.052 0.080
#> GSM99570     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.3106    0.53563 0.000 0.016 0.024 0.840 0.000 0.120
#> GSM99434     3  0.5811    0.13105 0.000 0.000 0.448 0.044 0.068 0.440
#> GSM99436     4  0.1285    0.56905 0.000 0.052 0.004 0.944 0.000 0.000
#> GSM99438     2  0.2854    0.81614 0.000 0.792 0.000 0.208 0.000 0.000
#> GSM99440     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.2838    0.51842 0.000 0.188 0.000 0.808 0.000 0.004
#> GSM99444     2  0.2738    0.83817 0.000 0.820 0.000 0.176 0.000 0.004
#> GSM99446     4  0.3650    0.50218 0.000 0.216 0.000 0.756 0.004 0.024
#> GSM99448     3  0.5716    0.20256 0.000 0.000 0.500 0.312 0.000 0.188
#> GSM99450     3  0.5775    0.17812 0.000 0.000 0.472 0.036 0.076 0.416
#> GSM99452     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.4338   -0.07178 0.492 0.000 0.000 0.000 0.488 0.020
#> GSM99462     2  0.2218    0.86158 0.000 0.884 0.000 0.104 0.000 0.012
#> GSM99464     5  0.5504    0.29938 0.004 0.000 0.108 0.004 0.536 0.348
#> GSM99466     4  0.5204    0.33518 0.000 0.000 0.072 0.632 0.028 0.268
#> GSM99470     1  0.5823    0.29577 0.564 0.000 0.016 0.072 0.028 0.320
#> GSM99472     1  0.5823    0.29577 0.564 0.000 0.016 0.072 0.028 0.320
#> GSM99474     3  0.6351    0.38062 0.000 0.000 0.568 0.172 0.084 0.176
#> GSM99476     4  0.6623   -0.18142 0.000 0.000 0.384 0.384 0.044 0.188
#> GSM99478     4  0.4917    0.39960 0.000 0.000 0.072 0.656 0.016 0.256
#> GSM99480     1  0.0363    0.83185 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99482     1  0.0790    0.82220 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM99484     4  0.4969    0.35525 0.000 0.020 0.020 0.628 0.020 0.312
#> GSM99486     4  0.0603    0.56921 0.000 0.016 0.004 0.980 0.000 0.000
#> GSM99488     2  0.0363    0.84421 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM99490     2  0.2592    0.83900 0.000 0.864 0.000 0.116 0.004 0.016
#> GSM99492     1  0.2859    0.71069 0.828 0.000 0.000 0.000 0.156 0.016
#> GSM99494     2  0.0363    0.84421 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM99524     1  0.0000    0.83483 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99526     6  0.6322   -0.00897 0.000 0.000 0.136 0.068 0.252 0.544
#> GSM99528     4  0.6782   -0.05878 0.000 0.012 0.024 0.420 0.272 0.272
#> GSM99530     5  0.1794    0.45199 0.000 0.000 0.036 0.000 0.924 0.040
#> GSM99532     5  0.5820    0.59838 0.168 0.000 0.100 0.000 0.636 0.096
#> GSM99534     4  0.6705    0.17502 0.036 0.156 0.000 0.452 0.016 0.340
#> GSM99536     1  0.1141    0.82051 0.948 0.000 0.000 0.000 0.052 0.000
#> GSM99538     4  0.3649    0.49539 0.000 0.000 0.040 0.764 0.000 0.196
#> GSM99540     5  0.5822    0.59974 0.180 0.000 0.092 0.000 0.632 0.096
#> GSM99542     2  0.2504    0.77845 0.000 0.856 0.000 0.004 0.004 0.136
#> GSM99544     4  0.3649    0.49539 0.000 0.000 0.040 0.764 0.000 0.196
#> GSM99546     6  0.5850   -0.14142 0.000 0.000 0.044 0.428 0.072 0.456
#> GSM99548     2  0.1296    0.86021 0.000 0.948 0.000 0.044 0.004 0.004
#> GSM99550     5  0.4884    0.40241 0.332 0.004 0.000 0.008 0.608 0.048
#> GSM99552     4  0.5304    0.25562 0.000 0.000 0.276 0.580 0.000 0.144
#> GSM99554     4  0.1858    0.55992 0.000 0.092 0.000 0.904 0.000 0.004
#> GSM99556     2  0.1657    0.86060 0.000 0.928 0.000 0.056 0.000 0.016
#> GSM99558     4  0.5680    0.04941 0.000 0.000 0.360 0.476 0.000 0.164
#> GSM99560     4  0.4666    0.45009 0.000 0.008 0.008 0.720 0.092 0.172
#> GSM99562     3  0.1204    0.71114 0.000 0.000 0.944 0.000 0.000 0.056
#> GSM99564     4  0.0603    0.56921 0.000 0.016 0.004 0.980 0.000 0.000
#> GSM99572     2  0.3052    0.80942 0.000 0.780 0.000 0.216 0.004 0.000
#> GSM99576     5  0.6270    0.49480 0.200 0.000 0.008 0.052 0.580 0.160
#> GSM99578     2  0.4415    0.59963 0.000 0.696 0.000 0.236 0.004 0.064
#> GSM99580     3  0.5395    0.41820 0.000 0.000 0.612 0.216 0.008 0.164
#> GSM99582     3  0.7273   -0.15862 0.004 0.000 0.404 0.296 0.108 0.188
#> GSM99584     4  0.4533    0.40822 0.000 0.004 0.032 0.736 0.048 0.180
#> GSM99586     1  0.4338   -0.07178 0.492 0.000 0.000 0.000 0.488 0.020
#> GSM99588     4  0.4975    0.41490 0.000 0.312 0.000 0.596 0.000 0.092
#> GSM99590     2  0.2664    0.83442 0.000 0.816 0.000 0.184 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) cell.type(p) k
#> SD:hclust 73         1.31e-02     0.039908 2
#> SD:hclust 61         5.60e-03     0.099827 3
#> SD:hclust 66         4.34e-06     0.000952 4
#> SD:hclust 70         5.12e-05     0.003785 5
#> SD:hclust 53         2.88e-06     0.001654 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.691           0.898       0.947         0.4852 0.514   0.514
#> 3 3 0.984           0.937       0.974         0.3849 0.718   0.499
#> 4 4 0.744           0.770       0.851         0.1042 0.860   0.613
#> 5 5 0.746           0.701       0.837         0.0635 0.940   0.772
#> 6 6 0.758           0.591       0.784         0.0421 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] 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
#> GSM99496     1  0.6531      0.844 0.832 0.168
#> GSM99502     1  0.0000      0.917 1.000 0.000
#> GSM99504     1  0.0000      0.917 1.000 0.000
#> GSM99506     1  0.6531      0.844 0.832 0.168
#> GSM99566     1  0.6531      0.844 0.832 0.168
#> GSM99574     1  0.0000      0.917 1.000 0.000
#> GSM99592     1  0.6531      0.844 0.832 0.168
#> GSM99594     1  0.6531      0.844 0.832 0.168
#> GSM99468     1  0.0000      0.917 1.000 0.000
#> GSM99498     1  0.0000      0.917 1.000 0.000
#> GSM99500     1  0.0000      0.917 1.000 0.000
#> GSM99508     1  0.5408      0.870 0.876 0.124
#> GSM99568     1  0.6531      0.844 0.832 0.168
#> GSM99596     1  0.0376      0.916 0.996 0.004
#> GSM99600     2  0.0000      0.981 0.000 1.000
#> GSM99458     1  0.0000      0.917 1.000 0.000
#> GSM99460     1  0.0000      0.917 1.000 0.000
#> GSM99510     1  0.9580      0.528 0.620 0.380
#> GSM99512     1  0.9580      0.528 0.620 0.380
#> GSM99514     1  0.6531      0.844 0.832 0.168
#> GSM99516     1  0.0000      0.917 1.000 0.000
#> GSM99518     1  0.0000      0.917 1.000 0.000
#> GSM99520     1  0.6438      0.847 0.836 0.164
#> GSM99522     1  0.0000      0.917 1.000 0.000
#> GSM99570     1  0.0000      0.917 1.000 0.000
#> GSM99598     1  0.0000      0.917 1.000 0.000
#> GSM99432     2  0.0000      0.981 0.000 1.000
#> GSM99434     1  0.8016      0.758 0.756 0.244
#> GSM99436     2  0.0000      0.981 0.000 1.000
#> GSM99438     2  0.0000      0.981 0.000 1.000
#> GSM99440     1  0.0000      0.917 1.000 0.000
#> GSM99442     2  0.0000      0.981 0.000 1.000
#> GSM99444     2  0.0000      0.981 0.000 1.000
#> GSM99446     2  0.0000      0.981 0.000 1.000
#> GSM99448     2  0.0000      0.981 0.000 1.000
#> GSM99450     1  0.4690      0.881 0.900 0.100
#> GSM99452     1  0.0000      0.917 1.000 0.000
#> GSM99454     1  0.0000      0.917 1.000 0.000
#> GSM99456     1  0.0000      0.917 1.000 0.000
#> GSM99462     2  0.0000      0.981 0.000 1.000
#> GSM99464     1  0.0000      0.917 1.000 0.000
#> GSM99466     2  0.0000      0.981 0.000 1.000
#> GSM99470     1  0.3879      0.892 0.924 0.076
#> GSM99472     1  0.0000      0.917 1.000 0.000
#> GSM99474     1  0.6531      0.844 0.832 0.168
#> GSM99476     2  0.0000      0.981 0.000 1.000
#> GSM99478     2  0.0000      0.981 0.000 1.000
#> GSM99480     1  0.0000      0.917 1.000 0.000
#> GSM99482     1  0.0000      0.917 1.000 0.000
#> GSM99484     2  0.0000      0.981 0.000 1.000
#> GSM99486     2  0.0000      0.981 0.000 1.000
#> GSM99488     2  0.0000      0.981 0.000 1.000
#> GSM99490     2  0.0000      0.981 0.000 1.000
#> GSM99492     1  0.0000      0.917 1.000 0.000
#> GSM99494     2  0.0000      0.981 0.000 1.000
#> GSM99524     1  0.0000      0.917 1.000 0.000
#> GSM99526     1  0.9358      0.586 0.648 0.352
#> GSM99528     2  0.3114      0.917 0.056 0.944
#> GSM99530     1  0.0938      0.914 0.988 0.012
#> GSM99532     1  0.0000      0.917 1.000 0.000
#> GSM99534     2  0.0000      0.981 0.000 1.000
#> GSM99536     1  0.0000      0.917 1.000 0.000
#> GSM99538     2  0.0000      0.981 0.000 1.000
#> GSM99540     1  0.0000      0.917 1.000 0.000
#> GSM99542     2  0.0000      0.981 0.000 1.000
#> GSM99544     2  0.0000      0.981 0.000 1.000
#> GSM99546     2  0.9998     -0.194 0.492 0.508
#> GSM99548     2  0.0000      0.981 0.000 1.000
#> GSM99550     1  0.0000      0.917 1.000 0.000
#> GSM99552     1  0.9286      0.603 0.656 0.344
#> GSM99554     2  0.0000      0.981 0.000 1.000
#> GSM99556     2  0.0000      0.981 0.000 1.000
#> GSM99558     2  0.0000      0.981 0.000 1.000
#> GSM99560     2  0.0000      0.981 0.000 1.000
#> GSM99562     1  0.6531      0.844 0.832 0.168
#> GSM99564     2  0.0000      0.981 0.000 1.000
#> GSM99572     2  0.0000      0.981 0.000 1.000
#> GSM99576     1  0.0000      0.917 1.000 0.000
#> GSM99578     2  0.0000      0.981 0.000 1.000
#> GSM99580     1  0.6623      0.840 0.828 0.172
#> GSM99582     1  0.4815      0.880 0.896 0.104
#> GSM99584     2  0.0000      0.981 0.000 1.000
#> GSM99586     1  0.0000      0.917 1.000 0.000
#> GSM99588     2  0.0000      0.981 0.000 1.000
#> GSM99590     2  0.0000      0.981 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
#> GSM99496     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99502     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99504     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99506     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99566     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99574     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99592     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99594     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99468     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99498     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99500     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99508     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99568     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99596     3  0.0237      0.950 0.004 0.000 0.996
#> GSM99600     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99458     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99460     1  0.0424      0.997 0.992 0.000 0.008
#> GSM99510     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99512     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99514     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99516     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99518     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99520     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99522     3  0.0237      0.950 0.004 0.000 0.996
#> GSM99570     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99598     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99432     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99434     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99436     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99440     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99442     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99448     3  0.0424      0.950 0.000 0.008 0.992
#> GSM99450     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99452     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99454     1  0.0237      0.998 0.996 0.000 0.004
#> GSM99456     1  0.0424      0.997 0.992 0.000 0.008
#> GSM99462     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99464     3  0.0000      0.950 0.000 0.000 1.000
#> GSM99466     3  0.6386      0.295 0.004 0.412 0.584
#> GSM99470     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99472     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99474     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99476     3  0.0475      0.951 0.004 0.004 0.992
#> GSM99478     2  0.5722      0.575 0.004 0.704 0.292
#> GSM99480     1  0.0424      0.997 0.992 0.000 0.008
#> GSM99482     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99484     2  0.0237      0.968 0.004 0.996 0.000
#> GSM99486     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99488     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99492     1  0.0424      0.997 0.992 0.000 0.008
#> GSM99494     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99526     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99528     3  0.6359      0.317 0.004 0.404 0.592
#> GSM99530     3  0.0000      0.950 0.000 0.000 1.000
#> GSM99532     3  0.0000      0.950 0.000 0.000 1.000
#> GSM99534     2  0.0237      0.968 0.004 0.996 0.000
#> GSM99536     1  0.0424      0.997 0.992 0.000 0.008
#> GSM99538     3  0.6295      0.109 0.000 0.472 0.528
#> GSM99540     1  0.0424      0.997 0.992 0.000 0.008
#> GSM99542     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99544     2  0.4504      0.748 0.000 0.804 0.196
#> GSM99546     3  0.0475      0.951 0.004 0.004 0.992
#> GSM99548     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99550     1  0.0237      0.996 0.996 0.000 0.004
#> GSM99552     3  0.0475      0.951 0.004 0.004 0.992
#> GSM99554     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99558     3  0.0424      0.950 0.000 0.008 0.992
#> GSM99560     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99562     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99564     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99572     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99576     1  0.0237      0.996 0.996 0.000 0.004
#> GSM99578     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99580     3  0.0237      0.953 0.000 0.004 0.996
#> GSM99582     3  0.0475      0.951 0.004 0.004 0.992
#> GSM99584     2  0.4702      0.724 0.000 0.788 0.212
#> GSM99586     1  0.0424      0.997 0.992 0.000 0.008
#> GSM99588     2  0.0000      0.970 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.970 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99592     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99594     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99600     4  0.4500     0.2034 0.000 0.316 0.000 0.684
#> GSM99458     1  0.3105     0.8770 0.868 0.120 0.000 0.012
#> GSM99460     1  0.4387     0.8067 0.752 0.236 0.000 0.012
#> GSM99510     3  0.3764     0.8025 0.000 0.012 0.816 0.172
#> GSM99512     3  0.0804     0.9049 0.000 0.008 0.980 0.012
#> GSM99514     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99570     1  0.0336     0.9306 0.992 0.008 0.000 0.000
#> GSM99598     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99432     4  0.0469     0.6320 0.000 0.012 0.000 0.988
#> GSM99434     3  0.3937     0.7882 0.000 0.012 0.800 0.188
#> GSM99436     4  0.3649     0.4917 0.000 0.204 0.000 0.796
#> GSM99438     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99440     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99442     2  0.4661     0.9132 0.000 0.652 0.000 0.348
#> GSM99444     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99446     4  0.3688     0.4856 0.000 0.208 0.000 0.792
#> GSM99448     3  0.2466     0.8637 0.000 0.004 0.900 0.096
#> GSM99450     3  0.3681     0.8013 0.000 0.008 0.816 0.176
#> GSM99452     1  0.0336     0.9306 0.992 0.008 0.000 0.000
#> GSM99454     1  0.0000     0.9324 1.000 0.000 0.000 0.000
#> GSM99456     1  0.4018     0.8329 0.772 0.224 0.000 0.004
#> GSM99462     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99464     3  0.7049     0.5595 0.000 0.236 0.572 0.192
#> GSM99466     4  0.1978     0.6317 0.000 0.004 0.068 0.928
#> GSM99470     1  0.5254     0.5072 0.672 0.028 0.000 0.300
#> GSM99472     1  0.1388     0.9213 0.960 0.028 0.000 0.012
#> GSM99474     3  0.0336     0.9086 0.000 0.000 0.992 0.008
#> GSM99476     4  0.4647     0.4130 0.000 0.008 0.288 0.704
#> GSM99478     4  0.0921     0.6405 0.000 0.000 0.028 0.972
#> GSM99480     1  0.2345     0.8996 0.900 0.100 0.000 0.000
#> GSM99482     1  0.0336     0.9306 0.992 0.008 0.000 0.000
#> GSM99484     4  0.2530     0.5858 0.000 0.112 0.000 0.888
#> GSM99486     4  0.3266     0.5404 0.000 0.168 0.000 0.832
#> GSM99488     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99490     2  0.4661     0.9132 0.000 0.652 0.000 0.348
#> GSM99492     1  0.2345     0.8996 0.900 0.100 0.000 0.000
#> GSM99494     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99524     1  0.0336     0.9306 0.992 0.008 0.000 0.000
#> GSM99526     4  0.7180     0.2763 0.000 0.188 0.264 0.548
#> GSM99528     4  0.4776     0.5684 0.000 0.164 0.060 0.776
#> GSM99530     3  0.4609     0.7315 0.000 0.224 0.752 0.024
#> GSM99532     3  0.3161     0.8295 0.000 0.124 0.864 0.012
#> GSM99534     4  0.3649     0.5244 0.000 0.204 0.000 0.796
#> GSM99536     1  0.1474     0.9172 0.948 0.052 0.000 0.000
#> GSM99538     4  0.3245     0.6218 0.000 0.056 0.064 0.880
#> GSM99540     1  0.3726     0.8330 0.788 0.212 0.000 0.000
#> GSM99542     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99544     4  0.1059     0.6384 0.000 0.012 0.016 0.972
#> GSM99546     4  0.5783     0.5304 0.000 0.188 0.108 0.704
#> GSM99548     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99550     4  0.7825     0.0277 0.304 0.284 0.000 0.412
#> GSM99552     3  0.2647     0.8088 0.000 0.000 0.880 0.120
#> GSM99554     4  0.3801     0.4646 0.000 0.220 0.000 0.780
#> GSM99556     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99558     4  0.4967     0.1211 0.000 0.000 0.452 0.548
#> GSM99560     4  0.2589     0.6270 0.000 0.116 0.000 0.884
#> GSM99562     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99564     4  0.3266     0.5404 0.000 0.168 0.000 0.832
#> GSM99572     2  0.4382     0.9838 0.000 0.704 0.000 0.296
#> GSM99576     1  0.4453     0.8049 0.744 0.244 0.000 0.012
#> GSM99578     4  0.3975     0.4221 0.000 0.240 0.000 0.760
#> GSM99580     3  0.0000     0.9113 0.000 0.000 1.000 0.000
#> GSM99582     3  0.4830     0.4082 0.000 0.000 0.608 0.392
#> GSM99584     4  0.1059     0.6395 0.000 0.016 0.012 0.972
#> GSM99586     1  0.3764     0.8396 0.784 0.216 0.000 0.000
#> GSM99588     4  0.4866    -0.2098 0.000 0.404 0.000 0.596
#> GSM99590     2  0.4382     0.9838 0.000 0.704 0.000 0.296

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0000     0.8647 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0162     0.8649 0.996 0.000 0.004 0.000 0.000
#> GSM99506     3  0.0324     0.8628 0.000 0.000 0.992 0.004 0.004
#> GSM99566     3  0.0324     0.8628 0.000 0.000 0.992 0.004 0.004
#> GSM99574     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0162     0.8639 0.000 0.000 0.996 0.004 0.000
#> GSM99594     3  0.0324     0.8628 0.000 0.000 0.992 0.004 0.004
#> GSM99468     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.8647 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0000     0.8647 0.000 0.000 1.000 0.000 0.000
#> GSM99596     3  0.0000     0.8647 0.000 0.000 1.000 0.000 0.000
#> GSM99600     4  0.3730     0.6471 0.000 0.288 0.000 0.712 0.000
#> GSM99458     1  0.4470    -0.0480 0.596 0.004 0.000 0.004 0.396
#> GSM99460     5  0.4898     0.4803 0.376 0.000 0.000 0.032 0.592
#> GSM99510     3  0.5799     0.5417 0.000 0.000 0.612 0.168 0.220
#> GSM99512     3  0.3182     0.7766 0.000 0.000 0.844 0.032 0.124
#> GSM99514     3  0.0000     0.8647 0.000 0.000 1.000 0.000 0.000
#> GSM99516     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0162     0.8657 0.996 0.000 0.000 0.000 0.004
#> GSM99520     3  0.0000     0.8647 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0000     0.8647 0.000 0.000 1.000 0.000 0.000
#> GSM99570     1  0.0740     0.8600 0.980 0.008 0.000 0.004 0.008
#> GSM99598     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.3146     0.7672 0.000 0.052 0.000 0.856 0.092
#> GSM99434     3  0.6176     0.4480 0.000 0.000 0.540 0.172 0.288
#> GSM99436     4  0.3242     0.7221 0.000 0.216 0.000 0.784 0.000
#> GSM99438     2  0.0703     0.9133 0.000 0.976 0.000 0.024 0.000
#> GSM99440     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.4045     0.3812 0.000 0.644 0.000 0.356 0.000
#> GSM99444     2  0.0992     0.9127 0.000 0.968 0.000 0.024 0.008
#> GSM99446     4  0.3336     0.7135 0.000 0.228 0.000 0.772 0.000
#> GSM99448     3  0.5329     0.6034 0.000 0.000 0.672 0.184 0.144
#> GSM99450     3  0.5903     0.4472 0.000 0.000 0.548 0.120 0.332
#> GSM99452     1  0.0854     0.8579 0.976 0.008 0.000 0.004 0.012
#> GSM99454     1  0.0000     0.8675 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.4321     0.4070 0.396 0.000 0.000 0.004 0.600
#> GSM99462     2  0.0992     0.9127 0.000 0.968 0.000 0.024 0.008
#> GSM99464     5  0.4559     0.4147 0.000 0.000 0.152 0.100 0.748
#> GSM99466     4  0.3474     0.7663 0.000 0.044 0.004 0.836 0.116
#> GSM99470     1  0.7112    -0.1045 0.412 0.024 0.000 0.364 0.200
#> GSM99472     1  0.4181     0.6155 0.780 0.016 0.000 0.032 0.172
#> GSM99474     3  0.0162     0.8636 0.000 0.000 0.996 0.000 0.004
#> GSM99476     4  0.4395     0.6482 0.000 0.000 0.064 0.748 0.188
#> GSM99478     4  0.3734     0.7639 0.000 0.060 0.000 0.812 0.128
#> GSM99480     1  0.3550     0.5886 0.760 0.000 0.000 0.004 0.236
#> GSM99482     1  0.1372     0.8429 0.956 0.016 0.000 0.004 0.024
#> GSM99484     4  0.3962     0.7599 0.000 0.112 0.000 0.800 0.088
#> GSM99486     4  0.2732     0.7562 0.000 0.160 0.000 0.840 0.000
#> GSM99488     2  0.0912     0.9120 0.000 0.972 0.000 0.016 0.012
#> GSM99490     2  0.4290     0.4741 0.000 0.680 0.000 0.304 0.016
#> GSM99492     1  0.3579     0.5811 0.756 0.000 0.000 0.004 0.240
#> GSM99494     2  0.0912     0.9120 0.000 0.972 0.000 0.016 0.012
#> GSM99524     1  0.0451     0.8631 0.988 0.008 0.000 0.000 0.004
#> GSM99526     5  0.4822     0.1271 0.000 0.000 0.032 0.352 0.616
#> GSM99528     4  0.4464     0.5998 0.000 0.028 0.000 0.684 0.288
#> GSM99530     5  0.5206     0.0292 0.000 0.000 0.428 0.044 0.528
#> GSM99532     3  0.4479     0.5680 0.000 0.000 0.700 0.036 0.264
#> GSM99534     4  0.5210     0.6994 0.000 0.200 0.000 0.680 0.120
#> GSM99536     1  0.1965     0.7707 0.904 0.000 0.000 0.000 0.096
#> GSM99538     4  0.2660     0.7345 0.000 0.008 0.000 0.864 0.128
#> GSM99540     5  0.4979     0.3188 0.480 0.000 0.000 0.028 0.492
#> GSM99542     2  0.1701     0.8751 0.000 0.936 0.000 0.016 0.048
#> GSM99544     4  0.3267     0.7565 0.000 0.044 0.000 0.844 0.112
#> GSM99546     4  0.4415     0.3466 0.000 0.000 0.004 0.552 0.444
#> GSM99548     2  0.0671     0.9129 0.000 0.980 0.000 0.016 0.004
#> GSM99550     5  0.3339     0.5634 0.112 0.000 0.000 0.048 0.840
#> GSM99552     3  0.1741     0.8220 0.000 0.000 0.936 0.024 0.040
#> GSM99554     4  0.3521     0.7096 0.000 0.232 0.000 0.764 0.004
#> GSM99556     2  0.0671     0.9129 0.000 0.980 0.000 0.016 0.004
#> GSM99558     4  0.3875     0.6813 0.000 0.000 0.160 0.792 0.048
#> GSM99560     4  0.2889     0.7659 0.000 0.084 0.000 0.872 0.044
#> GSM99562     3  0.0324     0.8628 0.000 0.000 0.992 0.004 0.004
#> GSM99564     4  0.2930     0.7546 0.000 0.164 0.000 0.832 0.004
#> GSM99572     2  0.0703     0.9133 0.000 0.976 0.000 0.024 0.000
#> GSM99576     5  0.5388     0.4764 0.360 0.004 0.000 0.056 0.580
#> GSM99578     4  0.5037     0.6836 0.000 0.228 0.000 0.684 0.088
#> GSM99580     3  0.0000     0.8647 0.000 0.000 1.000 0.000 0.000
#> GSM99582     3  0.6132     0.3855 0.000 0.000 0.564 0.224 0.212
#> GSM99584     4  0.3731     0.7337 0.000 0.040 0.000 0.800 0.160
#> GSM99586     5  0.4425     0.2728 0.452 0.000 0.000 0.004 0.544
#> GSM99588     4  0.4734     0.4919 0.000 0.372 0.000 0.604 0.024
#> GSM99590     2  0.0703     0.9133 0.000 0.976 0.000 0.024 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99502     1  0.0291     0.8532 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM99504     1  0.0665     0.8506 0.980 0.000 0.008 0.000 0.004 0.008
#> GSM99506     3  0.0363     0.8084 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99566     3  0.0748     0.8066 0.000 0.000 0.976 0.004 0.004 0.016
#> GSM99574     1  0.0291     0.8532 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM99592     3  0.0508     0.8091 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM99594     3  0.0508     0.8076 0.000 0.000 0.984 0.004 0.000 0.012
#> GSM99468     1  0.0622     0.8519 0.980 0.000 0.000 0.000 0.008 0.012
#> GSM99498     1  0.0508     0.8521 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM99500     1  0.0508     0.8521 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM99508     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99568     3  0.0146     0.8098 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99596     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99600     4  0.2902     0.6181 0.000 0.196 0.000 0.800 0.000 0.004
#> GSM99458     1  0.5259    -0.1908 0.468 0.000 0.000 0.000 0.436 0.096
#> GSM99460     5  0.4600     0.5359 0.136 0.000 0.000 0.004 0.708 0.152
#> GSM99510     3  0.7013    -0.0681 0.000 0.000 0.392 0.120 0.132 0.356
#> GSM99512     3  0.5177     0.5198 0.000 0.000 0.656 0.028 0.088 0.228
#> GSM99514     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99516     1  0.0363     0.8529 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM99518     1  0.0622     0.8516 0.980 0.000 0.000 0.000 0.008 0.012
#> GSM99520     3  0.0146     0.8093 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99522     3  0.1148     0.8000 0.000 0.000 0.960 0.004 0.016 0.020
#> GSM99570     1  0.1267     0.8363 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM99598     1  0.0363     0.8525 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM99432     4  0.3318     0.5431 0.000 0.024 0.000 0.824 0.020 0.132
#> GSM99434     6  0.7231    -0.0341 0.000 0.000 0.328 0.112 0.192 0.368
#> GSM99436     4  0.2320     0.6411 0.000 0.132 0.000 0.864 0.000 0.004
#> GSM99438     2  0.0146     0.9296 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99440     1  0.0458     0.8527 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM99442     4  0.3997     0.1444 0.000 0.488 0.000 0.508 0.000 0.004
#> GSM99444     2  0.0520     0.9296 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM99446     4  0.2595     0.6358 0.000 0.160 0.000 0.836 0.000 0.004
#> GSM99448     3  0.6409     0.1792 0.000 0.000 0.512 0.216 0.044 0.228
#> GSM99450     3  0.6903    -0.1336 0.000 0.000 0.376 0.060 0.220 0.344
#> GSM99452     1  0.1501     0.8288 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM99454     1  0.0363     0.8525 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM99456     5  0.4949     0.5621 0.208 0.000 0.000 0.000 0.648 0.144
#> GSM99462     2  0.0993     0.9259 0.000 0.964 0.000 0.000 0.012 0.024
#> GSM99464     5  0.4260     0.3726 0.000 0.000 0.024 0.028 0.720 0.228
#> GSM99466     4  0.4316     0.3735 0.000 0.004 0.008 0.628 0.012 0.348
#> GSM99470     6  0.6861     0.0812 0.284 0.000 0.000 0.200 0.072 0.444
#> GSM99472     1  0.5135     0.4335 0.608 0.000 0.000 0.016 0.072 0.304
#> GSM99474     3  0.0622     0.8063 0.000 0.000 0.980 0.000 0.008 0.012
#> GSM99476     4  0.4857     0.3192 0.000 0.000 0.016 0.656 0.064 0.264
#> GSM99478     4  0.4388     0.3467 0.000 0.004 0.008 0.604 0.012 0.372
#> GSM99480     1  0.5138     0.3505 0.604 0.000 0.000 0.000 0.268 0.128
#> GSM99482     1  0.2750     0.7646 0.844 0.000 0.000 0.000 0.020 0.136
#> GSM99484     4  0.4527     0.4369 0.000 0.040 0.000 0.624 0.004 0.332
#> GSM99486     4  0.2003     0.6420 0.000 0.116 0.000 0.884 0.000 0.000
#> GSM99488     2  0.0993     0.9259 0.000 0.964 0.000 0.000 0.012 0.024
#> GSM99490     2  0.4300     0.3333 0.000 0.640 0.000 0.324 0.000 0.036
#> GSM99492     1  0.5347     0.2476 0.560 0.000 0.000 0.000 0.304 0.136
#> GSM99494     2  0.0993     0.9259 0.000 0.964 0.000 0.000 0.012 0.024
#> GSM99524     1  0.1327     0.8343 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM99526     5  0.5585    -0.0594 0.000 0.000 0.000 0.148 0.488 0.364
#> GSM99528     6  0.6115    -0.1198 0.000 0.004 0.004 0.376 0.196 0.420
#> GSM99530     5  0.3907     0.3760 0.000 0.000 0.268 0.000 0.704 0.028
#> GSM99532     3  0.4500     0.2861 0.000 0.000 0.572 0.000 0.392 0.036
#> GSM99534     4  0.5640     0.3106 0.000 0.100 0.000 0.500 0.016 0.384
#> GSM99536     1  0.2572     0.7325 0.852 0.000 0.000 0.000 0.136 0.012
#> GSM99538     4  0.3728     0.4689 0.000 0.000 0.004 0.772 0.044 0.180
#> GSM99540     5  0.3883     0.4728 0.332 0.000 0.000 0.000 0.656 0.012
#> GSM99542     2  0.2784     0.8471 0.000 0.868 0.000 0.020 0.020 0.092
#> GSM99544     4  0.3690     0.4882 0.000 0.012 0.004 0.784 0.024 0.176
#> GSM99546     6  0.5839     0.1962 0.000 0.000 0.000 0.276 0.236 0.488
#> GSM99548     2  0.0146     0.9296 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99550     5  0.3781     0.5325 0.036 0.000 0.000 0.004 0.756 0.204
#> GSM99552     3  0.3201     0.6098 0.000 0.000 0.780 0.012 0.000 0.208
#> GSM99554     4  0.2669     0.6370 0.000 0.156 0.000 0.836 0.000 0.008
#> GSM99556     2  0.0508     0.9306 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM99558     4  0.4541     0.4612 0.000 0.000 0.096 0.704 0.004 0.196
#> GSM99560     4  0.3666     0.6052 0.000 0.084 0.000 0.820 0.064 0.032
#> GSM99562     3  0.1552     0.7929 0.000 0.000 0.940 0.004 0.020 0.036
#> GSM99564     4  0.2048     0.6420 0.000 0.120 0.000 0.880 0.000 0.000
#> GSM99572     2  0.0405     0.9253 0.000 0.988 0.000 0.008 0.000 0.004
#> GSM99576     5  0.5059     0.5491 0.172 0.000 0.000 0.020 0.680 0.128
#> GSM99578     4  0.5419     0.4368 0.000 0.132 0.000 0.568 0.004 0.296
#> GSM99580     3  0.0458     0.8086 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM99582     3  0.6411     0.0977 0.000 0.000 0.492 0.112 0.072 0.324
#> GSM99584     4  0.4063     0.4303 0.000 0.004 0.000 0.736 0.052 0.208
#> GSM99586     5  0.5113     0.5305 0.236 0.000 0.000 0.000 0.620 0.144
#> GSM99588     4  0.5172     0.5086 0.000 0.284 0.000 0.592 0.000 0.124
#> GSM99590     2  0.0000     0.9304 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-kmeans-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) cell.type(p) k
#> SD:kmeans 84         2.54e-05      0.00015 2
#> SD:kmeans 82         6.74e-04      0.01431 3
#> SD:kmeans 74         1.82e-04      0.01413 4
#> SD:kmeans 68         4.73e-05      0.01039 5
#> SD:kmeans 56         2.47e-04      0.02244 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.968       0.988         0.5045 0.496   0.496
#> 3 3 1.000           0.983       0.993         0.3322 0.757   0.545
#> 4 4 0.804           0.765       0.894         0.0992 0.909   0.735
#> 5 5 0.761           0.628       0.834         0.0613 0.924   0.727
#> 6 6 0.740           0.561       0.774         0.0351 0.959   0.822

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
#> GSM99496     1  0.0000      0.988 1.000 0.000
#> GSM99502     1  0.0000      0.988 1.000 0.000
#> GSM99504     1  0.0000      0.988 1.000 0.000
#> GSM99506     1  0.0000      0.988 1.000 0.000
#> GSM99566     1  0.0000      0.988 1.000 0.000
#> GSM99574     1  0.0000      0.988 1.000 0.000
#> GSM99592     1  0.5408      0.850 0.876 0.124
#> GSM99594     1  0.0000      0.988 1.000 0.000
#> GSM99468     1  0.0000      0.988 1.000 0.000
#> GSM99498     1  0.0000      0.988 1.000 0.000
#> GSM99500     1  0.0000      0.988 1.000 0.000
#> GSM99508     1  0.0000      0.988 1.000 0.000
#> GSM99568     1  0.0000      0.988 1.000 0.000
#> GSM99596     1  0.0000      0.988 1.000 0.000
#> GSM99600     2  0.0000      0.986 0.000 1.000
#> GSM99458     1  0.0000      0.988 1.000 0.000
#> GSM99460     1  0.0000      0.988 1.000 0.000
#> GSM99510     2  0.0000      0.986 0.000 1.000
#> GSM99512     2  0.0000      0.986 0.000 1.000
#> GSM99514     1  0.0000      0.988 1.000 0.000
#> GSM99516     1  0.0000      0.988 1.000 0.000
#> GSM99518     1  0.0000      0.988 1.000 0.000
#> GSM99520     1  0.0000      0.988 1.000 0.000
#> GSM99522     1  0.0000      0.988 1.000 0.000
#> GSM99570     1  0.0000      0.988 1.000 0.000
#> GSM99598     1  0.0000      0.988 1.000 0.000
#> GSM99432     2  0.0000      0.986 0.000 1.000
#> GSM99434     2  0.5178      0.860 0.116 0.884
#> GSM99436     2  0.0000      0.986 0.000 1.000
#> GSM99438     2  0.0000      0.986 0.000 1.000
#> GSM99440     1  0.0000      0.988 1.000 0.000
#> GSM99442     2  0.0000      0.986 0.000 1.000
#> GSM99444     2  0.0000      0.986 0.000 1.000
#> GSM99446     2  0.0000      0.986 0.000 1.000
#> GSM99448     2  0.0000      0.986 0.000 1.000
#> GSM99450     1  0.0000      0.988 1.000 0.000
#> GSM99452     1  0.0000      0.988 1.000 0.000
#> GSM99454     1  0.0000      0.988 1.000 0.000
#> GSM99456     1  0.0000      0.988 1.000 0.000
#> GSM99462     2  0.0000      0.986 0.000 1.000
#> GSM99464     1  0.0000      0.988 1.000 0.000
#> GSM99466     2  0.0000      0.986 0.000 1.000
#> GSM99470     1  0.9710      0.321 0.600 0.400
#> GSM99472     1  0.0000      0.988 1.000 0.000
#> GSM99474     1  0.0000      0.988 1.000 0.000
#> GSM99476     2  0.0000      0.986 0.000 1.000
#> GSM99478     2  0.0000      0.986 0.000 1.000
#> GSM99480     1  0.0000      0.988 1.000 0.000
#> GSM99482     1  0.0000      0.988 1.000 0.000
#> GSM99484     2  0.0000      0.986 0.000 1.000
#> GSM99486     2  0.0000      0.986 0.000 1.000
#> GSM99488     2  0.0000      0.986 0.000 1.000
#> GSM99490     2  0.0000      0.986 0.000 1.000
#> GSM99492     1  0.0000      0.988 1.000 0.000
#> GSM99494     2  0.0000      0.986 0.000 1.000
#> GSM99524     1  0.0000      0.988 1.000 0.000
#> GSM99526     2  0.0376      0.983 0.004 0.996
#> GSM99528     2  0.0000      0.986 0.000 1.000
#> GSM99530     1  0.0000      0.988 1.000 0.000
#> GSM99532     1  0.0000      0.988 1.000 0.000
#> GSM99534     2  0.0000      0.986 0.000 1.000
#> GSM99536     1  0.0000      0.988 1.000 0.000
#> GSM99538     2  0.0000      0.986 0.000 1.000
#> GSM99540     1  0.0000      0.988 1.000 0.000
#> GSM99542     2  0.0000      0.986 0.000 1.000
#> GSM99544     2  0.0000      0.986 0.000 1.000
#> GSM99546     2  0.0000      0.986 0.000 1.000
#> GSM99548     2  0.0000      0.986 0.000 1.000
#> GSM99550     1  0.0000      0.988 1.000 0.000
#> GSM99552     2  0.0000      0.986 0.000 1.000
#> GSM99554     2  0.0000      0.986 0.000 1.000
#> GSM99556     2  0.0000      0.986 0.000 1.000
#> GSM99558     2  0.0000      0.986 0.000 1.000
#> GSM99560     2  0.0000      0.986 0.000 1.000
#> GSM99562     1  0.0000      0.988 1.000 0.000
#> GSM99564     2  0.0000      0.986 0.000 1.000
#> GSM99572     2  0.0000      0.986 0.000 1.000
#> GSM99576     1  0.0000      0.988 1.000 0.000
#> GSM99578     2  0.0000      0.986 0.000 1.000
#> GSM99580     2  0.9732      0.311 0.404 0.596
#> GSM99582     1  0.0000      0.988 1.000 0.000
#> GSM99584     2  0.0000      0.986 0.000 1.000
#> GSM99586     1  0.0000      0.988 1.000 0.000
#> GSM99588     2  0.0000      0.986 0.000 1.000
#> GSM99590     2  0.0000      0.986 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
#> GSM99496     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99506     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99566     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99508     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99568     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99596     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99600     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99514     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99520     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99522     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99570     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99432     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99434     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99448     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99450     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99464     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99466     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99470     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99472     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99474     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99476     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99478     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99480     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99484     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99486     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99488     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99526     3  0.1860      0.944 0.000 0.052 0.948
#> GSM99528     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99530     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99532     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99534     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99536     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99538     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99540     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99542     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99544     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99546     2  0.0237      0.983 0.000 0.996 0.004
#> GSM99548     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99550     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99552     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99554     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99558     2  0.6095      0.356 0.000 0.608 0.392
#> GSM99560     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99562     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99564     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99572     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99576     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99578     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99580     3  0.0000      0.998 0.000 0.000 1.000
#> GSM99582     1  0.3267      0.869 0.884 0.000 0.116
#> GSM99584     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99586     1  0.0000      0.996 1.000 0.000 0.000
#> GSM99588     2  0.0000      0.987 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.987 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0469     0.9299 0.988 0.000 0.012 0.000
#> GSM99506     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99592     3  0.0921     0.8742 0.000 0.000 0.972 0.028
#> GSM99594     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99600     2  0.2281     0.8399 0.000 0.904 0.000 0.096
#> GSM99458     1  0.1940     0.9043 0.924 0.000 0.000 0.076
#> GSM99460     1  0.4040     0.7811 0.752 0.000 0.000 0.248
#> GSM99510     4  0.4817     0.3438 0.000 0.000 0.388 0.612
#> GSM99512     3  0.3486     0.6860 0.000 0.000 0.812 0.188
#> GSM99514     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0707     0.9316 0.980 0.000 0.000 0.020
#> GSM99520     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0188     0.8894 0.000 0.000 0.996 0.004
#> GSM99570     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99432     4  0.4996    -0.1014 0.000 0.484 0.000 0.516
#> GSM99434     4  0.4817     0.3325 0.000 0.000 0.388 0.612
#> GSM99436     2  0.3837     0.7217 0.000 0.776 0.000 0.224
#> GSM99438     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0592     0.8831 0.000 0.984 0.000 0.016
#> GSM99444     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99446     2  0.3688     0.7418 0.000 0.792 0.000 0.208
#> GSM99448     4  0.4933     0.2611 0.000 0.000 0.432 0.568
#> GSM99450     3  0.4972     0.0391 0.000 0.000 0.544 0.456
#> GSM99452     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99456     1  0.3569     0.8287 0.804 0.000 0.000 0.196
#> GSM99462     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99464     4  0.5312     0.3222 0.040 0.000 0.268 0.692
#> GSM99466     2  0.4994     0.1378 0.000 0.520 0.000 0.480
#> GSM99470     1  0.0469     0.9296 0.988 0.012 0.000 0.000
#> GSM99472     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99474     3  0.0336     0.8872 0.000 0.000 0.992 0.008
#> GSM99476     4  0.3688     0.5582 0.000 0.000 0.208 0.792
#> GSM99478     2  0.3486     0.7205 0.000 0.812 0.000 0.188
#> GSM99480     1  0.0707     0.9311 0.980 0.000 0.000 0.020
#> GSM99482     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99484     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99486     2  0.4356     0.6174 0.000 0.708 0.000 0.292
#> GSM99488     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99490     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99492     1  0.1389     0.9202 0.952 0.000 0.000 0.048
#> GSM99494     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0000     0.9356 1.000 0.000 0.000 0.000
#> GSM99526     4  0.0188     0.5992 0.000 0.000 0.004 0.996
#> GSM99528     2  0.3710     0.7043 0.000 0.804 0.004 0.192
#> GSM99530     3  0.4328     0.6143 0.008 0.000 0.748 0.244
#> GSM99532     3  0.2408     0.8045 0.000 0.000 0.896 0.104
#> GSM99534     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99536     1  0.0921     0.9284 0.972 0.000 0.000 0.028
#> GSM99538     4  0.4730     0.3137 0.000 0.364 0.000 0.636
#> GSM99540     1  0.2589     0.8848 0.884 0.000 0.000 0.116
#> GSM99542     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99544     4  0.4605     0.3742 0.000 0.336 0.000 0.664
#> GSM99546     4  0.1118     0.6181 0.000 0.036 0.000 0.964
#> GSM99548     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99550     1  0.4164     0.7650 0.736 0.000 0.000 0.264
#> GSM99552     3  0.0707     0.8764 0.000 0.000 0.980 0.020
#> GSM99554     2  0.2704     0.8214 0.000 0.876 0.000 0.124
#> GSM99556     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99558     3  0.7666    -0.3437 0.000 0.212 0.396 0.392
#> GSM99560     2  0.3311     0.7872 0.000 0.828 0.000 0.172
#> GSM99562     3  0.0188     0.8894 0.000 0.000 0.996 0.004
#> GSM99564     2  0.4382     0.6102 0.000 0.704 0.000 0.296
#> GSM99572     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99576     1  0.3400     0.8412 0.820 0.000 0.000 0.180
#> GSM99578     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99580     3  0.0000     0.8909 0.000 0.000 1.000 0.000
#> GSM99582     1  0.5712     0.3311 0.584 0.000 0.384 0.032
#> GSM99584     4  0.3975     0.5151 0.000 0.240 0.000 0.760
#> GSM99586     1  0.3569     0.8287 0.804 0.000 0.000 0.196
#> GSM99588     2  0.0000     0.8895 0.000 1.000 0.000 0.000
#> GSM99590     2  0.0000     0.8895 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0000     0.8986 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0000     0.8473 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0955     0.8262 0.968 0.000 0.028 0.000 0.004
#> GSM99506     3  0.0000     0.8986 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0000     0.8986 0.000 0.000 1.000 0.000 0.000
#> GSM99574     1  0.0000     0.8473 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.1661     0.8762 0.000 0.000 0.940 0.024 0.036
#> GSM99594     3  0.0324     0.8985 0.000 0.000 0.992 0.004 0.004
#> GSM99468     1  0.0404     0.8455 0.988 0.000 0.000 0.000 0.012
#> GSM99498     1  0.0404     0.8455 0.988 0.000 0.000 0.000 0.012
#> GSM99500     1  0.0290     0.8465 0.992 0.000 0.000 0.000 0.008
#> GSM99508     3  0.0404     0.8987 0.000 0.000 0.988 0.000 0.012
#> GSM99568     3  0.0404     0.8981 0.000 0.000 0.988 0.000 0.012
#> GSM99596     3  0.0000     0.8986 0.000 0.000 1.000 0.000 0.000
#> GSM99600     2  0.3366     0.6314 0.000 0.768 0.000 0.232 0.000
#> GSM99458     1  0.3852     0.5582 0.760 0.000 0.000 0.020 0.220
#> GSM99460     5  0.4613     0.4484 0.360 0.000 0.000 0.020 0.620
#> GSM99510     4  0.6593     0.0524 0.000 0.000 0.368 0.420 0.212
#> GSM99512     3  0.4879     0.6506 0.000 0.000 0.720 0.156 0.124
#> GSM99514     3  0.0000     0.8986 0.000 0.000 1.000 0.000 0.000
#> GSM99516     1  0.0162     0.8467 0.996 0.000 0.000 0.000 0.004
#> GSM99518     1  0.1851     0.7912 0.912 0.000 0.000 0.000 0.088
#> GSM99520     3  0.0404     0.8988 0.000 0.000 0.988 0.000 0.012
#> GSM99522     3  0.0771     0.8966 0.000 0.000 0.976 0.004 0.020
#> GSM99570     1  0.0162     0.8467 0.996 0.000 0.000 0.000 0.004
#> GSM99598     1  0.0000     0.8473 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.4067     0.4231 0.000 0.300 0.000 0.692 0.008
#> GSM99434     4  0.6624     0.2204 0.000 0.000 0.264 0.456 0.280
#> GSM99436     2  0.4262     0.2066 0.000 0.560 0.000 0.440 0.000
#> GSM99438     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0162     0.8474 0.996 0.000 0.000 0.000 0.004
#> GSM99442     2  0.1851     0.7824 0.000 0.912 0.000 0.088 0.000
#> GSM99444     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99446     2  0.4150     0.3451 0.000 0.612 0.000 0.388 0.000
#> GSM99448     4  0.5328     0.2566 0.000 0.000 0.352 0.584 0.064
#> GSM99450     3  0.6606     0.1625 0.000 0.000 0.444 0.228 0.328
#> GSM99452     1  0.0609     0.8459 0.980 0.000 0.000 0.000 0.020
#> GSM99454     1  0.0000     0.8473 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.4242     0.3049 0.428 0.000 0.000 0.000 0.572
#> GSM99462     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99464     5  0.3342     0.3613 0.008 0.000 0.020 0.136 0.836
#> GSM99466     4  0.4522     0.5131 0.000 0.176 0.000 0.744 0.080
#> GSM99470     1  0.2355     0.7833 0.916 0.024 0.000 0.024 0.036
#> GSM99472     1  0.0510     0.8438 0.984 0.000 0.000 0.000 0.016
#> GSM99474     3  0.2079     0.8634 0.000 0.000 0.916 0.020 0.064
#> GSM99476     4  0.2124     0.5298 0.000 0.000 0.028 0.916 0.056
#> GSM99478     2  0.5524     0.1631 0.000 0.516 0.000 0.416 0.068
#> GSM99480     1  0.2773     0.7110 0.836 0.000 0.000 0.000 0.164
#> GSM99482     1  0.0510     0.8438 0.984 0.000 0.000 0.000 0.016
#> GSM99484     2  0.3058     0.7383 0.000 0.860 0.000 0.096 0.044
#> GSM99486     4  0.4307    -0.0954 0.000 0.496 0.000 0.504 0.000
#> GSM99488     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99490     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99492     1  0.3480     0.5779 0.752 0.000 0.000 0.000 0.248
#> GSM99494     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99524     1  0.0290     0.8456 0.992 0.000 0.000 0.000 0.008
#> GSM99526     5  0.4262    -0.1094 0.000 0.000 0.000 0.440 0.560
#> GSM99528     2  0.6539     0.2531 0.000 0.544 0.012 0.216 0.228
#> GSM99530     5  0.4194     0.3221 0.012 0.000 0.276 0.004 0.708
#> GSM99532     3  0.4613     0.4683 0.000 0.000 0.620 0.020 0.360
#> GSM99534     2  0.0807     0.8283 0.000 0.976 0.000 0.012 0.012
#> GSM99536     1  0.2732     0.7135 0.840 0.000 0.000 0.000 0.160
#> GSM99538     4  0.4203     0.5735 0.000 0.188 0.000 0.760 0.052
#> GSM99540     1  0.4299     0.1747 0.608 0.000 0.000 0.004 0.388
#> GSM99542     2  0.0324     0.8334 0.000 0.992 0.000 0.004 0.004
#> GSM99544     4  0.3152     0.5994 0.000 0.136 0.000 0.840 0.024
#> GSM99546     4  0.4201     0.2117 0.000 0.000 0.000 0.592 0.408
#> GSM99548     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99550     5  0.3957     0.5211 0.280 0.000 0.000 0.008 0.712
#> GSM99552     3  0.3891     0.7350 0.000 0.004 0.808 0.128 0.060
#> GSM99554     2  0.3999     0.4485 0.000 0.656 0.000 0.344 0.000
#> GSM99556     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99558     4  0.6169     0.5210 0.000 0.120 0.184 0.648 0.048
#> GSM99560     2  0.4468     0.5774 0.000 0.716 0.000 0.240 0.044
#> GSM99562     3  0.1041     0.8928 0.000 0.000 0.964 0.004 0.032
#> GSM99564     4  0.4300    -0.0255 0.000 0.476 0.000 0.524 0.000
#> GSM99572     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.4307     0.0635 0.496 0.000 0.000 0.000 0.504
#> GSM99578     2  0.0671     0.8281 0.000 0.980 0.000 0.004 0.016
#> GSM99580     3  0.1106     0.8897 0.000 0.000 0.964 0.024 0.012
#> GSM99582     1  0.7130    -0.0568 0.440 0.000 0.384 0.116 0.060
#> GSM99584     4  0.3354     0.5789 0.000 0.088 0.000 0.844 0.068
#> GSM99586     1  0.4307    -0.2161 0.504 0.000 0.000 0.000 0.496
#> GSM99588     2  0.0162     0.8350 0.000 0.996 0.000 0.004 0.000
#> GSM99590     2  0.0000     0.8367 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0260     0.8207 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM99502     1  0.0291     0.8121 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM99504     1  0.1194     0.8019 0.956 0.000 0.032 0.000 0.004 0.008
#> GSM99506     3  0.0458     0.8211 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM99566     3  0.1082     0.8205 0.000 0.000 0.956 0.000 0.004 0.040
#> GSM99574     1  0.0291     0.8121 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM99592     3  0.2103     0.8043 0.000 0.000 0.912 0.020 0.012 0.056
#> GSM99594     3  0.1010     0.8212 0.000 0.000 0.960 0.000 0.004 0.036
#> GSM99468     1  0.1398     0.8001 0.940 0.000 0.000 0.000 0.052 0.008
#> GSM99498     1  0.0891     0.8098 0.968 0.000 0.000 0.000 0.024 0.008
#> GSM99500     1  0.0717     0.8110 0.976 0.000 0.000 0.000 0.016 0.008
#> GSM99508     3  0.0146     0.8205 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99568     3  0.0692     0.8220 0.000 0.000 0.976 0.000 0.004 0.020
#> GSM99596     3  0.0790     0.8202 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM99600     2  0.3584     0.5026 0.000 0.688 0.000 0.308 0.000 0.004
#> GSM99458     1  0.4703     0.3952 0.652 0.000 0.000 0.008 0.280 0.060
#> GSM99460     5  0.5059     0.5173 0.284 0.000 0.000 0.008 0.620 0.088
#> GSM99510     3  0.7490    -0.1545 0.000 0.000 0.304 0.300 0.132 0.264
#> GSM99512     3  0.5920     0.4988 0.000 0.000 0.604 0.108 0.068 0.220
#> GSM99514     3  0.0405     0.8210 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM99516     1  0.0260     0.8121 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM99518     1  0.1812     0.7791 0.912 0.000 0.000 0.000 0.080 0.008
#> GSM99520     3  0.0653     0.8214 0.000 0.000 0.980 0.004 0.004 0.012
#> GSM99522     3  0.1464     0.8129 0.016 0.000 0.944 0.000 0.004 0.036
#> GSM99570     1  0.1049     0.8055 0.960 0.000 0.000 0.000 0.008 0.032
#> GSM99598     1  0.0000     0.8122 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.4248     0.4475 0.000 0.236 0.000 0.708 0.004 0.052
#> GSM99434     6  0.7473    -0.1058 0.000 0.000 0.172 0.316 0.176 0.336
#> GSM99436     4  0.3804     0.1700 0.000 0.424 0.000 0.576 0.000 0.000
#> GSM99438     2  0.0632     0.8219 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM99440     1  0.0632     0.8119 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM99442     2  0.2762     0.6891 0.000 0.804 0.000 0.196 0.000 0.000
#> GSM99444     2  0.0713     0.8210 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM99446     2  0.3986     0.0930 0.000 0.532 0.000 0.464 0.000 0.004
#> GSM99448     4  0.6283    -0.0165 0.000 0.000 0.336 0.476 0.036 0.152
#> GSM99450     3  0.7560    -0.0689 0.000 0.000 0.336 0.180 0.200 0.284
#> GSM99452     1  0.1649     0.8008 0.932 0.000 0.000 0.000 0.032 0.036
#> GSM99454     1  0.0405     0.8134 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM99456     5  0.3499     0.4761 0.320 0.000 0.000 0.000 0.680 0.000
#> GSM99462     2  0.0632     0.8216 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM99464     5  0.4488     0.3014 0.004 0.000 0.020 0.048 0.724 0.204
#> GSM99466     4  0.4989     0.1711 0.000 0.060 0.000 0.528 0.004 0.408
#> GSM99470     1  0.4601     0.5940 0.716 0.016 0.000 0.008 0.052 0.208
#> GSM99472     1  0.3213     0.7160 0.820 0.000 0.000 0.000 0.048 0.132
#> GSM99474     3  0.3325     0.7692 0.000 0.000 0.836 0.020 0.044 0.100
#> GSM99476     4  0.4703     0.2555 0.000 0.000 0.008 0.652 0.060 0.280
#> GSM99478     6  0.6064     0.2051 0.000 0.352 0.000 0.220 0.004 0.424
#> GSM99480     1  0.3101     0.5966 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM99482     1  0.2889     0.7411 0.848 0.000 0.000 0.000 0.044 0.108
#> GSM99484     2  0.4251     0.5168 0.000 0.716 0.000 0.076 0.000 0.208
#> GSM99486     4  0.3927     0.3645 0.000 0.344 0.000 0.644 0.000 0.012
#> GSM99488     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     2  0.0146     0.8208 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99492     1  0.3592     0.3957 0.656 0.000 0.000 0.000 0.344 0.000
#> GSM99494     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.1594     0.7912 0.932 0.000 0.000 0.000 0.016 0.052
#> GSM99526     5  0.6031    -0.0972 0.000 0.000 0.000 0.344 0.404 0.252
#> GSM99528     6  0.6459     0.2889 0.000 0.392 0.000 0.092 0.084 0.432
#> GSM99530     5  0.5561     0.2725 0.012 0.000 0.232 0.008 0.616 0.132
#> GSM99532     3  0.5653     0.4853 0.008 0.000 0.596 0.008 0.236 0.152
#> GSM99534     2  0.2682     0.7342 0.000 0.876 0.000 0.020 0.020 0.084
#> GSM99536     1  0.2871     0.6644 0.804 0.000 0.000 0.000 0.192 0.004
#> GSM99538     4  0.5184     0.3679 0.000 0.188 0.000 0.652 0.012 0.148
#> GSM99540     1  0.4845     0.1727 0.580 0.000 0.000 0.008 0.364 0.048
#> GSM99542     2  0.1194     0.7908 0.000 0.956 0.000 0.004 0.008 0.032
#> GSM99544     4  0.3123     0.4621 0.000 0.112 0.000 0.832 0.000 0.056
#> GSM99546     4  0.6062    -0.0877 0.000 0.004 0.000 0.444 0.320 0.232
#> GSM99548     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99550     5  0.3094     0.5474 0.140 0.000 0.000 0.000 0.824 0.036
#> GSM99552     3  0.5036     0.4422 0.000 0.000 0.604 0.076 0.008 0.312
#> GSM99554     2  0.3937     0.2464 0.000 0.572 0.000 0.424 0.000 0.004
#> GSM99556     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99558     4  0.6347     0.2516 0.000 0.048 0.144 0.552 0.008 0.248
#> GSM99560     2  0.6005     0.1593 0.000 0.524 0.000 0.336 0.080 0.060
#> GSM99562     3  0.1625     0.8099 0.000 0.000 0.928 0.000 0.012 0.060
#> GSM99564     4  0.3847     0.3573 0.000 0.348 0.000 0.644 0.000 0.008
#> GSM99572     2  0.0790     0.8198 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM99576     5  0.4947     0.2912 0.384 0.000 0.000 0.004 0.552 0.060
#> GSM99578     2  0.1049     0.8014 0.000 0.960 0.000 0.008 0.000 0.032
#> GSM99580     3  0.2326     0.7862 0.000 0.000 0.888 0.012 0.008 0.092
#> GSM99582     1  0.7758    -0.1755 0.324 0.000 0.248 0.048 0.060 0.320
#> GSM99584     4  0.3020     0.4032 0.000 0.040 0.000 0.864 0.032 0.064
#> GSM99586     5  0.3765     0.3159 0.404 0.000 0.000 0.000 0.596 0.000
#> GSM99588     2  0.0993     0.8132 0.000 0.964 0.000 0.024 0.000 0.012
#> GSM99590     2  0.0363     0.8225 0.000 0.988 0.000 0.012 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) cell.type(p) k
#> SD:skmeans 83         3.58e-05     0.000192 2
#> SD:skmeans 84         1.12e-04     0.003364 3
#> SD:skmeans 74         6.44e-05     0.004225 4
#> SD:skmeans 62         1.10e-04     0.015755 5
#> SD:skmeans 52         5.85e-04     0.012583 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.671           0.783       0.912         0.4917 0.500   0.500
#> 3 3 0.655           0.767       0.872         0.3358 0.709   0.480
#> 4 4 0.692           0.808       0.835         0.1405 0.820   0.522
#> 5 5 0.768           0.654       0.810         0.0588 0.969   0.875
#> 6 6 0.867           0.815       0.918         0.0433 0.923   0.673

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
#> GSM99496     2  0.9866      0.338 0.432 0.568
#> GSM99502     1  0.0000      0.914 1.000 0.000
#> GSM99504     1  0.0000      0.914 1.000 0.000
#> GSM99506     2  0.9850      0.348 0.428 0.572
#> GSM99566     2  0.9833      0.358 0.424 0.576
#> GSM99574     1  0.0000      0.914 1.000 0.000
#> GSM99592     2  0.8763      0.580 0.296 0.704
#> GSM99594     2  0.9580      0.445 0.380 0.620
#> GSM99468     1  0.0000      0.914 1.000 0.000
#> GSM99498     1  0.0000      0.914 1.000 0.000
#> GSM99500     1  0.0000      0.914 1.000 0.000
#> GSM99508     1  0.7883      0.653 0.764 0.236
#> GSM99568     1  0.3879      0.866 0.924 0.076
#> GSM99596     1  0.3114      0.881 0.944 0.056
#> GSM99600     2  0.0000      0.877 0.000 1.000
#> GSM99458     1  0.0000      0.914 1.000 0.000
#> GSM99460     1  0.0000      0.914 1.000 0.000
#> GSM99510     2  0.0000      0.877 0.000 1.000
#> GSM99512     2  0.0376      0.875 0.004 0.996
#> GSM99514     2  0.9866      0.338 0.432 0.568
#> GSM99516     1  0.0000      0.914 1.000 0.000
#> GSM99518     1  0.0000      0.914 1.000 0.000
#> GSM99520     2  0.9815      0.366 0.420 0.580
#> GSM99522     1  0.0000      0.914 1.000 0.000
#> GSM99570     1  0.0000      0.914 1.000 0.000
#> GSM99598     1  0.0000      0.914 1.000 0.000
#> GSM99432     2  0.0000      0.877 0.000 1.000
#> GSM99434     2  0.0938      0.870 0.012 0.988
#> GSM99436     2  0.0000      0.877 0.000 1.000
#> GSM99438     2  0.0000      0.877 0.000 1.000
#> GSM99440     1  0.0000      0.914 1.000 0.000
#> GSM99442     2  0.0000      0.877 0.000 1.000
#> GSM99444     2  0.0000      0.877 0.000 1.000
#> GSM99446     2  0.0000      0.877 0.000 1.000
#> GSM99448     2  0.0000      0.877 0.000 1.000
#> GSM99450     1  1.0000     -0.118 0.504 0.496
#> GSM99452     1  0.0000      0.914 1.000 0.000
#> GSM99454     1  0.0000      0.914 1.000 0.000
#> GSM99456     1  0.0000      0.914 1.000 0.000
#> GSM99462     2  0.0000      0.877 0.000 1.000
#> GSM99464     1  0.2948      0.884 0.948 0.052
#> GSM99466     2  0.0000      0.877 0.000 1.000
#> GSM99470     1  0.4298      0.857 0.912 0.088
#> GSM99472     1  0.0000      0.914 1.000 0.000
#> GSM99474     2  0.9754      0.391 0.408 0.592
#> GSM99476     2  0.0000      0.877 0.000 1.000
#> GSM99478     2  0.0000      0.877 0.000 1.000
#> GSM99480     1  0.0000      0.914 1.000 0.000
#> GSM99482     1  0.0000      0.914 1.000 0.000
#> GSM99484     2  0.0000      0.877 0.000 1.000
#> GSM99486     2  0.0000      0.877 0.000 1.000
#> GSM99488     2  0.0000      0.877 0.000 1.000
#> GSM99490     2  0.0000      0.877 0.000 1.000
#> GSM99492     1  0.0000      0.914 1.000 0.000
#> GSM99494     2  0.0000      0.877 0.000 1.000
#> GSM99524     1  0.0000      0.914 1.000 0.000
#> GSM99526     2  0.0376      0.874 0.004 0.996
#> GSM99528     2  0.9393      0.487 0.356 0.644
#> GSM99530     1  0.7139      0.721 0.804 0.196
#> GSM99532     1  0.9661      0.258 0.608 0.392
#> GSM99534     1  0.9996      0.108 0.512 0.488
#> GSM99536     1  0.0000      0.914 1.000 0.000
#> GSM99538     2  0.0000      0.877 0.000 1.000
#> GSM99540     1  0.0000      0.914 1.000 0.000
#> GSM99542     1  0.9129      0.510 0.672 0.328
#> GSM99544     2  0.0000      0.877 0.000 1.000
#> GSM99546     2  0.1184      0.867 0.016 0.984
#> GSM99548     2  0.0000      0.877 0.000 1.000
#> GSM99550     1  0.4690      0.848 0.900 0.100
#> GSM99552     2  0.9522      0.460 0.372 0.628
#> GSM99554     2  0.0000      0.877 0.000 1.000
#> GSM99556     2  0.0000      0.877 0.000 1.000
#> GSM99558     2  0.0000      0.877 0.000 1.000
#> GSM99560     2  0.0000      0.877 0.000 1.000
#> GSM99562     2  0.9850      0.348 0.428 0.572
#> GSM99564     2  0.0000      0.877 0.000 1.000
#> GSM99572     2  0.0000      0.877 0.000 1.000
#> GSM99576     1  0.2423      0.893 0.960 0.040
#> GSM99578     2  0.0000      0.877 0.000 1.000
#> GSM99580     2  0.9580      0.445 0.380 0.620
#> GSM99582     1  0.6623      0.764 0.828 0.172
#> GSM99584     2  0.0000      0.877 0.000 1.000
#> GSM99586     1  0.0000      0.914 1.000 0.000
#> GSM99588     2  0.0000      0.877 0.000 1.000
#> GSM99590     2  0.0000      0.877 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
#> GSM99496     3  0.0747      0.815 0.016 0.000 0.984
#> GSM99502     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99506     3  0.0747      0.815 0.016 0.000 0.984
#> GSM99566     3  0.0747      0.815 0.016 0.000 0.984
#> GSM99574     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.810 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.810 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99498     1  0.0237      0.961 0.996 0.000 0.004
#> GSM99500     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99508     3  0.4887      0.695 0.228 0.000 0.772
#> GSM99568     3  0.5621      0.582 0.308 0.000 0.692
#> GSM99596     3  0.5678      0.570 0.316 0.000 0.684
#> GSM99600     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99460     1  0.2625      0.883 0.916 0.000 0.084
#> GSM99510     3  0.0424      0.805 0.000 0.008 0.992
#> GSM99512     3  0.0000      0.810 0.000 0.000 1.000
#> GSM99514     3  0.0747      0.815 0.016 0.000 0.984
#> GSM99516     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99520     3  0.0592      0.814 0.012 0.000 0.988
#> GSM99522     3  0.6026      0.446 0.376 0.000 0.624
#> GSM99570     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99432     2  0.5785      0.690 0.000 0.668 0.332
#> GSM99434     3  0.0000      0.810 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99442     2  0.0237      0.746 0.000 0.996 0.004
#> GSM99444     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99446     2  0.5650      0.695 0.000 0.688 0.312
#> GSM99448     3  0.0892      0.793 0.000 0.020 0.980
#> GSM99450     3  0.2448      0.796 0.076 0.000 0.924
#> GSM99452     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99464     3  0.5785      0.548 0.332 0.000 0.668
#> GSM99466     2  0.6299      0.535 0.000 0.524 0.476
#> GSM99470     1  0.3263      0.879 0.912 0.040 0.048
#> GSM99472     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99474     3  0.4654      0.683 0.208 0.000 0.792
#> GSM99476     2  0.6280      0.567 0.000 0.540 0.460
#> GSM99478     2  0.6244      0.599 0.000 0.560 0.440
#> GSM99480     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99484     2  0.6225      0.610 0.000 0.568 0.432
#> GSM99486     2  0.5988      0.673 0.000 0.632 0.368
#> GSM99488     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99490     2  0.0237      0.746 0.000 0.996 0.004
#> GSM99492     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99526     2  0.6500      0.556 0.004 0.532 0.464
#> GSM99528     3  0.8688      0.243 0.196 0.208 0.596
#> GSM99530     3  0.5138      0.671 0.252 0.000 0.748
#> GSM99532     3  0.2959      0.787 0.100 0.000 0.900
#> GSM99534     2  0.5414      0.609 0.212 0.772 0.016
#> GSM99536     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99538     2  0.6244      0.599 0.000 0.560 0.440
#> GSM99540     1  0.3752      0.808 0.856 0.000 0.144
#> GSM99542     2  0.4002      0.605 0.160 0.840 0.000
#> GSM99544     2  0.6026      0.668 0.000 0.624 0.376
#> GSM99546     2  0.7223      0.587 0.028 0.548 0.424
#> GSM99548     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99550     1  0.7935      0.484 0.648 0.236 0.116
#> GSM99552     3  0.0000      0.810 0.000 0.000 1.000
#> GSM99554     2  0.0424      0.746 0.000 0.992 0.008
#> GSM99556     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99558     3  0.2959      0.691 0.000 0.100 0.900
#> GSM99560     2  0.5988      0.674 0.000 0.632 0.368
#> GSM99562     3  0.0747      0.815 0.016 0.000 0.984
#> GSM99564     2  0.5785      0.689 0.000 0.668 0.332
#> GSM99572     2  0.0000      0.746 0.000 1.000 0.000
#> GSM99576     1  0.3619      0.820 0.864 0.000 0.136
#> GSM99578     2  0.6008      0.671 0.000 0.628 0.372
#> GSM99580     3  0.0000      0.810 0.000 0.000 1.000
#> GSM99582     3  0.6252      0.304 0.444 0.000 0.556
#> GSM99584     2  0.6235      0.604 0.000 0.564 0.436
#> GSM99586     1  0.0000      0.964 1.000 0.000 0.000
#> GSM99588     2  0.6008      0.671 0.000 0.628 0.372
#> GSM99590     2  0.0000      0.746 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.2921     0.8629 0.000 0.000 0.860 0.140
#> GSM99502     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99504     1  0.1004     0.9361 0.972 0.000 0.024 0.004
#> GSM99506     3  0.2921     0.8629 0.000 0.000 0.860 0.140
#> GSM99566     3  0.3074     0.8602 0.000 0.000 0.848 0.152
#> GSM99574     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99592     3  0.3172     0.8564 0.000 0.000 0.840 0.160
#> GSM99594     3  0.3172     0.8564 0.000 0.000 0.840 0.160
#> GSM99468     1  0.3249     0.9088 0.852 0.000 0.140 0.008
#> GSM99498     1  0.3249     0.9088 0.852 0.000 0.140 0.008
#> GSM99500     1  0.2799     0.9190 0.884 0.000 0.108 0.008
#> GSM99508     3  0.0469     0.8120 0.000 0.000 0.988 0.012
#> GSM99568     3  0.0000     0.8042 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000     0.8042 0.000 0.000 1.000 0.000
#> GSM99600     2  0.0188     0.9001 0.000 0.996 0.000 0.004
#> GSM99458     1  0.3249     0.9088 0.852 0.000 0.140 0.008
#> GSM99460     1  0.4996     0.8216 0.752 0.000 0.192 0.056
#> GSM99510     3  0.4877     0.4470 0.000 0.000 0.592 0.408
#> GSM99512     3  0.2921     0.8629 0.000 0.000 0.860 0.140
#> GSM99514     3  0.3123     0.8583 0.000 0.000 0.844 0.156
#> GSM99516     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99518     1  0.1489     0.9345 0.952 0.000 0.044 0.004
#> GSM99520     3  0.3266     0.8513 0.000 0.000 0.832 0.168
#> GSM99522     3  0.0000     0.8042 0.000 0.000 1.000 0.000
#> GSM99570     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99432     4  0.4072     0.7054 0.000 0.252 0.000 0.748
#> GSM99434     4  0.3528     0.6587 0.000 0.000 0.192 0.808
#> GSM99436     2  0.0188     0.9001 0.000 0.996 0.000 0.004
#> GSM99438     2  0.0000     0.9003 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0336     0.8988 0.000 0.992 0.000 0.008
#> GSM99444     2  0.1302     0.8961 0.000 0.956 0.000 0.044
#> GSM99446     2  0.3356     0.7172 0.000 0.824 0.000 0.176
#> GSM99448     3  0.4761     0.5627 0.000 0.000 0.628 0.372
#> GSM99450     3  0.2868     0.8631 0.000 0.000 0.864 0.136
#> GSM99452     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99456     1  0.3249     0.9088 0.852 0.000 0.140 0.008
#> GSM99462     2  0.0000     0.9003 0.000 1.000 0.000 0.000
#> GSM99464     3  0.0000     0.8042 0.000 0.000 1.000 0.000
#> GSM99466     4  0.0336     0.8171 0.000 0.008 0.000 0.992
#> GSM99470     4  0.6215     0.5364 0.192 0.000 0.140 0.668
#> GSM99472     1  0.3249     0.9088 0.852 0.000 0.140 0.008
#> GSM99474     4  0.4872     0.2748 0.004 0.000 0.356 0.640
#> GSM99476     4  0.1557     0.8095 0.000 0.056 0.000 0.944
#> GSM99478     4  0.0336     0.8171 0.000 0.008 0.000 0.992
#> GSM99480     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99484     4  0.0336     0.8171 0.000 0.008 0.000 0.992
#> GSM99486     4  0.4543     0.6143 0.000 0.324 0.000 0.676
#> GSM99488     2  0.1867     0.8825 0.000 0.928 0.000 0.072
#> GSM99490     2  0.4222     0.6689 0.000 0.728 0.000 0.272
#> GSM99492     1  0.1474     0.9337 0.948 0.000 0.052 0.000
#> GSM99494     2  0.1389     0.8947 0.000 0.952 0.000 0.048
#> GSM99524     1  0.0000     0.9366 1.000 0.000 0.000 0.000
#> GSM99526     4  0.4642     0.7094 0.000 0.240 0.020 0.740
#> GSM99528     4  0.0336     0.8130 0.000 0.000 0.008 0.992
#> GSM99530     3  0.0592     0.8145 0.000 0.000 0.984 0.016
#> GSM99532     3  0.2868     0.8629 0.000 0.000 0.864 0.136
#> GSM99534     4  0.5998     0.6161 0.000 0.240 0.092 0.668
#> GSM99536     1  0.3249     0.9088 0.852 0.000 0.140 0.008
#> GSM99538     4  0.0469     0.8174 0.000 0.012 0.000 0.988
#> GSM99540     3  0.5220    -0.0748 0.424 0.000 0.568 0.008
#> GSM99542     2  0.4155     0.7148 0.000 0.756 0.004 0.240
#> GSM99544     4  0.4134     0.6968 0.000 0.260 0.000 0.740
#> GSM99546     4  0.2413     0.8093 0.000 0.064 0.020 0.916
#> GSM99548     2  0.1389     0.8947 0.000 0.952 0.000 0.048
#> GSM99550     4  0.3402     0.7111 0.004 0.000 0.164 0.832
#> GSM99552     4  0.1557     0.7900 0.000 0.000 0.056 0.944
#> GSM99554     2  0.0188     0.9001 0.000 0.996 0.000 0.004
#> GSM99556     2  0.3726     0.7488 0.000 0.788 0.000 0.212
#> GSM99558     4  0.0524     0.8143 0.000 0.004 0.008 0.988
#> GSM99560     4  0.4509     0.6663 0.000 0.288 0.004 0.708
#> GSM99562     3  0.2921     0.8629 0.000 0.000 0.860 0.140
#> GSM99564     2  0.3400     0.7119 0.000 0.820 0.000 0.180
#> GSM99572     2  0.0000     0.9003 0.000 1.000 0.000 0.000
#> GSM99576     4  0.5944     0.5973 0.140 0.000 0.164 0.696
#> GSM99578     4  0.0336     0.8171 0.000 0.008 0.000 0.992
#> GSM99580     3  0.3266     0.8513 0.000 0.000 0.832 0.168
#> GSM99582     4  0.4252     0.6514 0.004 0.000 0.252 0.744
#> GSM99584     4  0.3975     0.7121 0.000 0.240 0.000 0.760
#> GSM99586     1  0.3249     0.9088 0.852 0.000 0.140 0.008
#> GSM99588     4  0.0469     0.8166 0.000 0.012 0.000 0.988
#> GSM99590     2  0.1022     0.8988 0.000 0.968 0.000 0.032

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.1608      0.809 0.928 0.000 0.000 0.000 0.072
#> GSM99506     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM99574     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM99594     3  0.0162      0.888 0.000 0.000 0.996 0.004 0.000
#> GSM99468     1  0.3274      0.677 0.780 0.000 0.000 0.000 0.220
#> GSM99498     1  0.3274      0.677 0.780 0.000 0.000 0.000 0.220
#> GSM99500     1  0.2377      0.772 0.872 0.000 0.000 0.000 0.128
#> GSM99508     3  0.0794      0.879 0.000 0.000 0.972 0.000 0.028
#> GSM99568     3  0.0880      0.877 0.000 0.000 0.968 0.000 0.032
#> GSM99596     3  0.0880      0.877 0.000 0.000 0.968 0.000 0.032
#> GSM99600     2  0.1908      0.578 0.000 0.908 0.000 0.092 0.000
#> GSM99458     1  0.4235      0.163 0.576 0.000 0.000 0.000 0.424
#> GSM99460     5  0.4387      0.531 0.336 0.000 0.004 0.008 0.652
#> GSM99510     3  0.3636      0.573 0.000 0.000 0.728 0.272 0.000
#> GSM99512     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM99514     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM99516     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.2329      0.774 0.876 0.000 0.000 0.000 0.124
#> GSM99520     3  0.1197      0.860 0.000 0.000 0.952 0.048 0.000
#> GSM99522     3  0.0880      0.877 0.000 0.000 0.968 0.000 0.032
#> GSM99570     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.4278      0.463 0.000 0.452 0.000 0.548 0.000
#> GSM99434     4  0.3837      0.490 0.000 0.000 0.308 0.692 0.000
#> GSM99436     2  0.1908      0.578 0.000 0.908 0.000 0.092 0.000
#> GSM99438     2  0.4015      0.763 0.000 0.652 0.000 0.000 0.348
#> GSM99440     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.3800      0.649 0.000 0.812 0.000 0.080 0.108
#> GSM99444     2  0.5016      0.760 0.000 0.608 0.000 0.044 0.348
#> GSM99446     2  0.3074      0.424 0.000 0.804 0.000 0.196 0.000
#> GSM99448     3  0.3774      0.530 0.000 0.000 0.704 0.296 0.000
#> GSM99450     3  0.0703      0.882 0.000 0.000 0.976 0.000 0.024
#> GSM99452     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.4015      0.516 0.348 0.000 0.000 0.000 0.652
#> GSM99462     2  0.4015      0.763 0.000 0.652 0.000 0.000 0.348
#> GSM99464     3  0.4242      0.376 0.000 0.000 0.572 0.000 0.428
#> GSM99466     4  0.0880      0.689 0.000 0.000 0.032 0.968 0.000
#> GSM99470     4  0.5394      0.201 0.132 0.000 0.000 0.660 0.208
#> GSM99472     1  0.3561      0.614 0.740 0.000 0.000 0.000 0.260
#> GSM99474     4  0.6096      0.271 0.000 0.000 0.316 0.536 0.148
#> GSM99476     4  0.1992      0.689 0.000 0.044 0.032 0.924 0.000
#> GSM99478     4  0.0880      0.689 0.000 0.000 0.032 0.968 0.000
#> GSM99480     1  0.1410      0.790 0.940 0.000 0.000 0.000 0.060
#> GSM99482     1  0.0162      0.833 0.996 0.000 0.000 0.000 0.004
#> GSM99484     4  0.0880      0.689 0.000 0.000 0.032 0.968 0.000
#> GSM99486     4  0.4307      0.385 0.000 0.500 0.000 0.500 0.000
#> GSM99488     2  0.5080      0.758 0.000 0.604 0.000 0.048 0.348
#> GSM99490     2  0.5678      0.478 0.000 0.600 0.000 0.284 0.116
#> GSM99492     1  0.4306     -0.252 0.508 0.000 0.000 0.000 0.492
#> GSM99494     2  0.5016      0.760 0.000 0.608 0.000 0.044 0.348
#> GSM99524     1  0.0000      0.835 1.000 0.000 0.000 0.000 0.000
#> GSM99526     4  0.5638      0.472 0.000 0.404 0.020 0.536 0.040
#> GSM99528     4  0.2278      0.644 0.000 0.000 0.032 0.908 0.060
#> GSM99530     3  0.1121      0.871 0.000 0.000 0.956 0.000 0.044
#> GSM99532     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM99534     4  0.5059      0.423 0.000 0.416 0.000 0.548 0.036
#> GSM99536     1  0.3274      0.677 0.780 0.000 0.000 0.000 0.220
#> GSM99538     4  0.1579      0.694 0.000 0.024 0.032 0.944 0.000
#> GSM99540     3  0.6794     -0.300 0.300 0.000 0.380 0.000 0.320
#> GSM99542     2  0.5822      0.713 0.000 0.548 0.000 0.108 0.344
#> GSM99544     4  0.4971      0.477 0.000 0.460 0.028 0.512 0.000
#> GSM99546     4  0.1557      0.681 0.000 0.052 0.000 0.940 0.008
#> GSM99548     2  0.5016      0.760 0.000 0.608 0.000 0.044 0.348
#> GSM99550     5  0.4015      0.407 0.000 0.000 0.000 0.348 0.652
#> GSM99552     4  0.2329      0.641 0.000 0.000 0.124 0.876 0.000
#> GSM99554     2  0.1908      0.578 0.000 0.908 0.000 0.092 0.000
#> GSM99556     2  0.5664      0.725 0.000 0.560 0.000 0.092 0.348
#> GSM99558     4  0.1410      0.679 0.000 0.000 0.060 0.940 0.000
#> GSM99560     4  0.4448      0.420 0.000 0.480 0.000 0.516 0.004
#> GSM99562     3  0.0000      0.890 0.000 0.000 1.000 0.000 0.000
#> GSM99564     2  0.3074      0.424 0.000 0.804 0.000 0.196 0.000
#> GSM99572     2  0.4015      0.763 0.000 0.652 0.000 0.000 0.348
#> GSM99576     5  0.5393      0.284 0.056 0.000 0.000 0.440 0.504
#> GSM99578     4  0.1211      0.691 0.000 0.024 0.016 0.960 0.000
#> GSM99580     3  0.2074      0.807 0.000 0.000 0.896 0.104 0.000
#> GSM99582     4  0.5030      0.428 0.000 0.000 0.104 0.696 0.200
#> GSM99584     4  0.4268      0.471 0.000 0.444 0.000 0.556 0.000
#> GSM99586     5  0.4060      0.495 0.360 0.000 0.000 0.000 0.640
#> GSM99588     4  0.1992      0.668 0.000 0.044 0.032 0.924 0.000
#> GSM99590     2  0.4733      0.763 0.000 0.624 0.000 0.028 0.348

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99502     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.1387    0.88465 0.932 0.000 0.000 0.000 0.068 0.000
#> GSM99506     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99566     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99574     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99594     3  0.0260    0.90766 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM99468     1  0.2562    0.82541 0.828 0.000 0.000 0.000 0.172 0.000
#> GSM99498     1  0.2562    0.82541 0.828 0.000 0.000 0.000 0.172 0.000
#> GSM99500     1  0.1556    0.88040 0.920 0.000 0.000 0.000 0.080 0.000
#> GSM99508     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99568     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99596     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99600     4  0.0260    0.88502 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM99458     1  0.3971    0.36277 0.548 0.000 0.000 0.004 0.448 0.000
#> GSM99460     5  0.0000    0.80513 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM99510     3  0.3309    0.59816 0.000 0.000 0.720 0.000 0.000 0.280
#> GSM99512     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99514     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99516     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.2178    0.85109 0.868 0.000 0.000 0.000 0.132 0.000
#> GSM99520     3  0.1501    0.85512 0.000 0.000 0.924 0.000 0.000 0.076
#> GSM99522     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99570     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0458    0.88330 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM99434     6  0.2941    0.64292 0.000 0.000 0.220 0.000 0.000 0.780
#> GSM99436     4  0.0146    0.88529 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM99438     2  0.0000    0.99745 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.3647    0.47345 0.000 0.360 0.000 0.640 0.000 0.000
#> GSM99444     2  0.0000    0.99745 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     4  0.0458    0.88246 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM99448     3  0.3563    0.49129 0.000 0.000 0.664 0.000 0.000 0.336
#> GSM99450     3  0.0937    0.88112 0.000 0.000 0.960 0.000 0.040 0.000
#> GSM99452     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.0000    0.80513 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM99462     2  0.0000    0.99745 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     5  0.3592    0.39392 0.000 0.000 0.344 0.000 0.656 0.000
#> GSM99466     6  0.0000    0.86982 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99470     6  0.4629    0.55222 0.064 0.000 0.000 0.016 0.224 0.696
#> GSM99472     1  0.3265    0.73885 0.748 0.000 0.000 0.004 0.248 0.000
#> GSM99474     6  0.4986    0.42471 0.000 0.000 0.304 0.000 0.096 0.600
#> GSM99476     6  0.0146    0.86846 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM99478     6  0.0000    0.86982 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99480     1  0.2219    0.79228 0.864 0.000 0.000 0.000 0.136 0.000
#> GSM99482     1  0.0291    0.89824 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM99484     6  0.0000    0.86982 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99486     4  0.0146    0.88505 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM99488     2  0.0000    0.99745 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     4  0.5784    0.22893 0.000 0.356 0.000 0.460 0.000 0.184
#> GSM99492     5  0.2454    0.68455 0.160 0.000 0.000 0.000 0.840 0.000
#> GSM99494     2  0.0000    0.99745 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.0000    0.90051 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99526     4  0.3020    0.79010 0.000 0.000 0.000 0.844 0.076 0.080
#> GSM99528     6  0.0000    0.86982 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99530     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99532     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99534     4  0.2668    0.74635 0.000 0.000 0.000 0.828 0.004 0.168
#> GSM99536     1  0.2562    0.82541 0.828 0.000 0.000 0.000 0.172 0.000
#> GSM99538     6  0.1075    0.84532 0.000 0.000 0.000 0.048 0.000 0.952
#> GSM99540     3  0.5919   -0.03204 0.228 0.000 0.452 0.000 0.320 0.000
#> GSM99542     2  0.0508    0.98184 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM99544     4  0.1714    0.82597 0.000 0.000 0.000 0.908 0.000 0.092
#> GSM99546     6  0.3027    0.73615 0.000 0.000 0.000 0.148 0.028 0.824
#> GSM99548     2  0.0000    0.99745 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99550     5  0.0000    0.80513 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM99552     6  0.0000    0.86982 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99554     4  0.0146    0.88529 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM99556     2  0.0000    0.99745 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99558     6  0.0000    0.86982 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99560     4  0.0146    0.88505 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM99562     3  0.0000    0.91236 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99564     4  0.0146    0.88529 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM99572     2  0.0000    0.99745 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99576     5  0.3979   -0.00107 0.000 0.000 0.000 0.004 0.540 0.456
#> GSM99578     6  0.1863    0.80889 0.000 0.000 0.000 0.104 0.000 0.896
#> GSM99580     3  0.2260    0.79434 0.000 0.000 0.860 0.000 0.000 0.140
#> GSM99582     6  0.3909    0.68881 0.000 0.000 0.076 0.004 0.148 0.772
#> GSM99584     4  0.0547    0.88174 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM99586     5  0.0547    0.79913 0.020 0.000 0.000 0.000 0.980 0.000
#> GSM99588     6  0.0000    0.86982 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99590     2  0.0146    0.99372 0.000 0.996 0.000 0.004 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) cell.type(p) k
#> SD:pam 71         2.91e-03     0.013771 2
#> SD:pam 81         6.50e-05     0.001684 3
#> SD:pam 82         1.66e-06     0.000192 4
#> SD:pam 64         1.93e-04     0.014743 5
#> SD:pam 77         4.88e-06     0.002708 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.289           0.682       0.805         0.4435 0.525   0.525
#> 3 3 0.825           0.929       0.965         0.5088 0.728   0.516
#> 4 4 0.832           0.796       0.900         0.0940 0.911   0.743
#> 5 5 0.873           0.821       0.922         0.0834 0.893   0.637
#> 6 6 0.825           0.675       0.862         0.0220 0.963   0.835

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
#> GSM99496     2  0.7453      0.555 0.212 0.788
#> GSM99502     1  0.0000      0.886 1.000 0.000
#> GSM99504     1  0.1184      0.874 0.984 0.016
#> GSM99506     2  0.7453      0.555 0.212 0.788
#> GSM99566     2  0.7453      0.555 0.212 0.788
#> GSM99574     1  0.0000      0.886 1.000 0.000
#> GSM99592     2  0.7453      0.555 0.212 0.788
#> GSM99594     2  0.7453      0.555 0.212 0.788
#> GSM99468     1  0.0000      0.886 1.000 0.000
#> GSM99498     1  0.0000      0.886 1.000 0.000
#> GSM99500     1  0.0000      0.886 1.000 0.000
#> GSM99508     2  0.7453      0.555 0.212 0.788
#> GSM99568     2  0.7528      0.556 0.216 0.784
#> GSM99596     2  0.7453      0.555 0.212 0.788
#> GSM99600     2  0.8861      0.705 0.304 0.696
#> GSM99458     1  0.2236      0.872 0.964 0.036
#> GSM99460     1  0.2236      0.872 0.964 0.036
#> GSM99510     2  0.3879      0.627 0.076 0.924
#> GSM99512     2  0.6531      0.580 0.168 0.832
#> GSM99514     2  0.7453      0.555 0.212 0.788
#> GSM99516     1  0.0000      0.886 1.000 0.000
#> GSM99518     1  0.0000      0.886 1.000 0.000
#> GSM99520     2  0.7453      0.555 0.212 0.788
#> GSM99522     2  0.7602      0.546 0.220 0.780
#> GSM99570     1  0.1633      0.871 0.976 0.024
#> GSM99598     1  0.0000      0.886 1.000 0.000
#> GSM99432     2  0.8661      0.704 0.288 0.712
#> GSM99434     2  0.4815      0.622 0.104 0.896
#> GSM99436     2  0.8861      0.705 0.304 0.696
#> GSM99438     2  0.8861      0.705 0.304 0.696
#> GSM99440     1  0.0000      0.886 1.000 0.000
#> GSM99442     2  0.8861      0.705 0.304 0.696
#> GSM99444     2  0.8861      0.705 0.304 0.696
#> GSM99446     2  0.8861      0.705 0.304 0.696
#> GSM99448     2  0.4939      0.605 0.108 0.892
#> GSM99450     2  0.6712      0.594 0.176 0.824
#> GSM99452     1  0.1843      0.867 0.972 0.028
#> GSM99454     1  0.0000      0.886 1.000 0.000
#> GSM99456     1  0.2236      0.872 0.964 0.036
#> GSM99462     2  0.8861      0.705 0.304 0.696
#> GSM99464     1  0.7745      0.615 0.772 0.228
#> GSM99466     2  0.8661      0.704 0.288 0.712
#> GSM99470     1  0.9044      0.232 0.680 0.320
#> GSM99472     1  0.3879      0.824 0.924 0.076
#> GSM99474     2  0.7745      0.557 0.228 0.772
#> GSM99476     2  0.4298      0.634 0.088 0.912
#> GSM99478     2  0.8763      0.705 0.296 0.704
#> GSM99480     1  0.0000      0.886 1.000 0.000
#> GSM99482     1  0.1843      0.867 0.972 0.028
#> GSM99484     2  0.8861      0.705 0.304 0.696
#> GSM99486     2  0.8861      0.705 0.304 0.696
#> GSM99488     2  0.8861      0.705 0.304 0.696
#> GSM99490     2  0.8861      0.705 0.304 0.696
#> GSM99492     1  0.0000      0.886 1.000 0.000
#> GSM99494     2  0.8861      0.705 0.304 0.696
#> GSM99524     1  0.0376      0.885 0.996 0.004
#> GSM99526     1  0.9087      0.376 0.676 0.324
#> GSM99528     2  0.8861      0.705 0.304 0.696
#> GSM99530     1  0.5842      0.734 0.860 0.140
#> GSM99532     1  0.9977     -0.377 0.528 0.472
#> GSM99534     2  0.9686      0.554 0.396 0.604
#> GSM99536     1  0.0000      0.886 1.000 0.000
#> GSM99538     2  0.8661      0.704 0.288 0.712
#> GSM99540     1  0.0938      0.878 0.988 0.012
#> GSM99542     2  0.9661      0.561 0.392 0.608
#> GSM99544     2  0.6531      0.678 0.168 0.832
#> GSM99546     2  0.9129      0.673 0.328 0.672
#> GSM99548     2  0.8861      0.705 0.304 0.696
#> GSM99550     1  0.5629      0.755 0.868 0.132
#> GSM99552     2  0.9988      0.485 0.480 0.520
#> GSM99554     2  0.8861      0.705 0.304 0.696
#> GSM99556     2  0.8861      0.705 0.304 0.696
#> GSM99558     2  0.3879      0.613 0.076 0.924
#> GSM99560     2  0.8861      0.705 0.304 0.696
#> GSM99562     2  0.7453      0.555 0.212 0.788
#> GSM99564     2  0.8661      0.704 0.288 0.712
#> GSM99572     2  0.8861      0.705 0.304 0.696
#> GSM99576     1  0.0938      0.880 0.988 0.012
#> GSM99578     2  0.8861      0.705 0.304 0.696
#> GSM99580     2  0.7453      0.555 0.212 0.788
#> GSM99582     1  0.9933     -0.365 0.548 0.452
#> GSM99584     2  0.8713      0.702 0.292 0.708
#> GSM99586     1  0.0672      0.881 0.992 0.008
#> GSM99588     2  0.8861      0.705 0.304 0.696
#> GSM99590     2  0.8861      0.705 0.304 0.696

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM99496     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99502     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99504     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99506     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99566     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99574     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99592     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99594     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99468     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99498     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99500     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99508     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99568     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99596     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99600     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99458     1  0.0237     0.9799 0.996 0.000 0.004
#> GSM99460     1  0.0237     0.9799 0.996 0.000 0.004
#> GSM99510     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99512     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99514     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99516     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99518     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99520     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99522     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99570     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99432     2  0.0237     0.9692 0.000 0.996 0.004
#> GSM99434     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99436     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99438     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99440     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99442     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99444     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99446     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99448     3  0.3038     0.8899 0.000 0.104 0.896
#> GSM99450     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99452     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99456     1  0.0237     0.9799 0.996 0.000 0.004
#> GSM99462     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99464     3  0.3038     0.8827 0.104 0.000 0.896
#> GSM99466     3  0.3267     0.8799 0.000 0.116 0.884
#> GSM99470     1  0.3349     0.8876 0.888 0.108 0.004
#> GSM99472     1  0.3349     0.8876 0.888 0.108 0.004
#> GSM99474     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99476     3  0.1031     0.9326 0.000 0.024 0.976
#> GSM99478     2  0.2878     0.8740 0.000 0.904 0.096
#> GSM99480     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99482     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99484     2  0.0237     0.9692 0.000 0.996 0.004
#> GSM99486     2  0.0237     0.9692 0.000 0.996 0.004
#> GSM99488     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99490     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99492     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99494     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99524     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99526     3  0.3590     0.8961 0.076 0.028 0.896
#> GSM99528     3  0.6095     0.4150 0.000 0.392 0.608
#> GSM99530     3  0.3038     0.8827 0.104 0.000 0.896
#> GSM99532     3  0.0892     0.9332 0.020 0.000 0.980
#> GSM99534     2  0.0237     0.9692 0.000 0.996 0.004
#> GSM99536     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99538     3  0.3116     0.8867 0.000 0.108 0.892
#> GSM99540     1  0.0237     0.9799 0.996 0.000 0.004
#> GSM99542     2  0.0237     0.9692 0.000 0.996 0.004
#> GSM99544     2  0.6274     0.0626 0.000 0.544 0.456
#> GSM99546     3  0.3038     0.8899 0.000 0.104 0.896
#> GSM99548     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99550     1  0.4095     0.8915 0.880 0.064 0.056
#> GSM99552     3  0.3038     0.8899 0.000 0.104 0.896
#> GSM99554     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99556     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99558     3  0.3038     0.8899 0.000 0.104 0.896
#> GSM99560     2  0.2711     0.8845 0.000 0.912 0.088
#> GSM99562     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99564     2  0.0237     0.9692 0.000 0.996 0.004
#> GSM99572     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99576     1  0.3349     0.8876 0.888 0.108 0.004
#> GSM99578     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99580     3  0.0000     0.9408 0.000 0.000 1.000
#> GSM99582     3  0.3038     0.8827 0.104 0.000 0.896
#> GSM99584     3  0.5706     0.5813 0.000 0.320 0.680
#> GSM99586     1  0.0000     0.9822 1.000 0.000 0.000
#> GSM99588     2  0.0000     0.9710 0.000 1.000 0.000
#> GSM99590     2  0.0000     0.9710 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99592     3  0.1389      0.847 0.000 0.000 0.952 0.048
#> GSM99594     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99568     3  0.1474      0.847 0.000 0.000 0.948 0.052
#> GSM99596     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99600     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99458     1  0.1557      0.898 0.944 0.000 0.000 0.056
#> GSM99460     4  0.4431      0.585 0.304 0.000 0.000 0.696
#> GSM99510     3  0.4522      0.684 0.000 0.000 0.680 0.320
#> GSM99512     3  0.1867      0.843 0.000 0.000 0.928 0.072
#> GSM99514     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0336      0.843 0.000 0.000 0.992 0.008
#> GSM99570     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99432     2  0.4543      0.647 0.000 0.676 0.000 0.324
#> GSM99434     3  0.4543      0.680 0.000 0.000 0.676 0.324
#> GSM99436     2  0.0336      0.900 0.000 0.992 0.000 0.008
#> GSM99438     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99444     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99446     2  0.0336      0.900 0.000 0.992 0.000 0.008
#> GSM99448     3  0.3837      0.768 0.000 0.000 0.776 0.224
#> GSM99450     3  0.4072      0.746 0.000 0.000 0.748 0.252
#> GSM99452     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99456     4  0.4500      0.571 0.316 0.000 0.000 0.684
#> GSM99462     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99464     4  0.0000      0.649 0.000 0.000 0.000 1.000
#> GSM99466     3  0.6779      0.521 0.000 0.116 0.560 0.324
#> GSM99470     1  0.0336      0.946 0.992 0.000 0.000 0.008
#> GSM99472     1  0.0336      0.946 0.992 0.000 0.000 0.008
#> GSM99474     3  0.1557      0.846 0.000 0.000 0.944 0.056
#> GSM99476     3  0.4543      0.680 0.000 0.000 0.676 0.324
#> GSM99478     2  0.4543      0.647 0.000 0.676 0.000 0.324
#> GSM99480     1  0.0188      0.952 0.996 0.000 0.000 0.004
#> GSM99482     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99484     2  0.1022      0.888 0.000 0.968 0.000 0.032
#> GSM99486     2  0.2530      0.839 0.000 0.888 0.000 0.112
#> GSM99488     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99490     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99492     1  0.3649      0.677 0.796 0.000 0.000 0.204
#> GSM99494     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99526     4  0.4843     -0.223 0.000 0.000 0.396 0.604
#> GSM99528     2  0.5289      0.601 0.000 0.636 0.020 0.344
#> GSM99530     4  0.0817      0.647 0.000 0.000 0.024 0.976
#> GSM99532     3  0.1637      0.846 0.000 0.000 0.940 0.060
#> GSM99534     2  0.0336      0.900 0.000 0.992 0.000 0.008
#> GSM99536     1  0.0000      0.955 1.000 0.000 0.000 0.000
#> GSM99538     3  0.7861      0.218 0.000 0.284 0.392 0.324
#> GSM99540     1  0.4994     -0.144 0.520 0.000 0.000 0.480
#> GSM99542     2  0.0336      0.900 0.000 0.992 0.000 0.008
#> GSM99544     2  0.5936      0.574 0.000 0.620 0.056 0.324
#> GSM99546     3  0.4817      0.603 0.000 0.000 0.612 0.388
#> GSM99548     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99550     4  0.0000      0.649 0.000 0.000 0.000 1.000
#> GSM99552     3  0.1557      0.846 0.000 0.000 0.944 0.056
#> GSM99554     2  0.0188      0.900 0.000 0.996 0.000 0.004
#> GSM99556     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99558     3  0.3873      0.766 0.000 0.000 0.772 0.228
#> GSM99560     2  0.4543      0.647 0.000 0.676 0.000 0.324
#> GSM99562     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> GSM99564     2  0.2868      0.821 0.000 0.864 0.000 0.136
#> GSM99572     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM99576     4  0.4543      0.562 0.324 0.000 0.000 0.676
#> GSM99578     2  0.0336      0.900 0.000 0.992 0.000 0.008
#> GSM99580     3  0.0592      0.845 0.000 0.000 0.984 0.016
#> GSM99582     3  0.3266      0.801 0.000 0.000 0.832 0.168
#> GSM99584     2  0.6316      0.534 0.000 0.596 0.080 0.324
#> GSM99586     4  0.4624      0.533 0.340 0.000 0.000 0.660
#> GSM99588     2  0.0336      0.900 0.000 0.992 0.000 0.008
#> GSM99590     2  0.0000      0.900 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99574     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99594     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99468     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99596     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99600     2  0.3707     0.6544 0.000 0.716 0.000 0.284 0.000
#> GSM99458     1  0.4192     0.3400 0.596 0.000 0.000 0.000 0.404
#> GSM99460     5  0.0162     0.8473 0.004 0.000 0.000 0.000 0.996
#> GSM99510     3  0.3837     0.6053 0.000 0.000 0.692 0.308 0.000
#> GSM99512     3  0.1544     0.8800 0.000 0.000 0.932 0.068 0.000
#> GSM99514     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99516     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99520     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99570     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0290     0.8641 0.000 0.008 0.000 0.992 0.000
#> GSM99434     3  0.3561     0.6798 0.000 0.000 0.740 0.260 0.000
#> GSM99436     4  0.4088     0.3231 0.000 0.368 0.000 0.632 0.000
#> GSM99438     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99444     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99446     4  0.3561     0.5797 0.000 0.260 0.000 0.740 0.000
#> GSM99448     3  0.4297     0.2111 0.000 0.000 0.528 0.472 0.000
#> GSM99450     3  0.2773     0.7923 0.000 0.000 0.836 0.000 0.164
#> GSM99452     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.0162     0.8464 0.000 0.000 0.000 0.004 0.996
#> GSM99462     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99464     5  0.0162     0.8467 0.000 0.000 0.000 0.004 0.996
#> GSM99466     4  0.0290     0.8605 0.000 0.000 0.008 0.992 0.000
#> GSM99470     1  0.1768     0.8965 0.924 0.000 0.000 0.004 0.072
#> GSM99472     1  0.1671     0.8953 0.924 0.000 0.000 0.000 0.076
#> GSM99474     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99476     4  0.4242     0.0523 0.000 0.000 0.428 0.572 0.000
#> GSM99478     4  0.0290     0.8641 0.000 0.008 0.000 0.992 0.000
#> GSM99480     1  0.1282     0.9190 0.952 0.000 0.000 0.004 0.044
#> GSM99482     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99484     4  0.3730     0.5294 0.000 0.288 0.000 0.712 0.000
#> GSM99486     4  0.0880     0.8527 0.000 0.032 0.000 0.968 0.000
#> GSM99488     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99490     2  0.0880     0.8749 0.000 0.968 0.000 0.032 0.000
#> GSM99492     1  0.3461     0.6820 0.772 0.000 0.000 0.004 0.224
#> GSM99494     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99524     1  0.0000     0.9548 1.000 0.000 0.000 0.000 0.000
#> GSM99526     5  0.6396     0.0530 0.000 0.000 0.168 0.412 0.420
#> GSM99528     4  0.0162     0.8608 0.000 0.000 0.000 0.996 0.004
#> GSM99530     5  0.2423     0.8071 0.000 0.000 0.080 0.024 0.896
#> GSM99532     3  0.0955     0.9062 0.000 0.000 0.968 0.004 0.028
#> GSM99534     2  0.3928     0.6348 0.000 0.700 0.000 0.296 0.004
#> GSM99536     1  0.0290     0.9496 0.992 0.000 0.000 0.000 0.008
#> GSM99538     4  0.0290     0.8605 0.000 0.000 0.008 0.992 0.000
#> GSM99540     5  0.3305     0.6970 0.224 0.000 0.000 0.000 0.776
#> GSM99542     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99544     4  0.0290     0.8641 0.000 0.008 0.000 0.992 0.000
#> GSM99546     4  0.2462     0.7781 0.000 0.000 0.008 0.880 0.112
#> GSM99548     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99550     5  0.0162     0.8467 0.000 0.000 0.000 0.004 0.996
#> GSM99552     3  0.1908     0.8388 0.000 0.000 0.908 0.092 0.000
#> GSM99554     2  0.3949     0.5770 0.000 0.668 0.000 0.332 0.000
#> GSM99556     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99558     4  0.0880     0.8469 0.000 0.000 0.032 0.968 0.000
#> GSM99560     4  0.0162     0.8608 0.000 0.000 0.000 0.996 0.004
#> GSM99562     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99564     4  0.0290     0.8641 0.000 0.008 0.000 0.992 0.000
#> GSM99572     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.2179     0.8201 0.100 0.000 0.000 0.004 0.896
#> GSM99578     2  0.3242     0.7321 0.000 0.784 0.000 0.216 0.000
#> GSM99580     3  0.0000     0.9221 0.000 0.000 1.000 0.000 0.000
#> GSM99582     3  0.1410     0.8865 0.000 0.000 0.940 0.000 0.060
#> GSM99584     4  0.0290     0.8641 0.000 0.008 0.000 0.992 0.000
#> GSM99586     5  0.2970     0.7634 0.168 0.000 0.000 0.004 0.828
#> GSM99588     2  0.3966     0.5689 0.000 0.664 0.000 0.336 0.000
#> GSM99590     2  0.0000     0.8889 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0865      0.875 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM99502     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0713      0.878 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM99566     3  0.0547      0.879 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM99574     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0146      0.878 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99594     3  0.0363      0.879 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99468     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0547      0.879 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM99568     3  0.0146      0.878 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99596     3  0.0547      0.879 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM99600     2  0.4184     -0.105 0.000 0.504 0.000 0.484 0.000 0.012
#> GSM99458     1  0.3789      0.316 0.584 0.000 0.000 0.000 0.416 0.000
#> GSM99460     5  0.1082      0.334 0.004 0.000 0.000 0.000 0.956 0.040
#> GSM99510     3  0.3982      0.669 0.000 0.000 0.740 0.200 0.000 0.060
#> GSM99512     3  0.1682      0.849 0.000 0.000 0.928 0.052 0.000 0.020
#> GSM99514     3  0.0865      0.875 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM99516     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.1501      0.823 0.924 0.000 0.000 0.000 0.076 0.000
#> GSM99520     3  0.0146      0.879 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99522     3  0.0865      0.877 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM99570     1  0.0937      0.857 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM99598     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0000      0.832 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99434     3  0.4907      0.543 0.000 0.000 0.644 0.096 0.004 0.256
#> GSM99436     4  0.3261      0.682 0.000 0.204 0.000 0.780 0.000 0.016
#> GSM99438     2  0.0000      0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.0260      0.887 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM99444     2  0.0000      0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     4  0.2572      0.754 0.000 0.136 0.000 0.852 0.000 0.012
#> GSM99448     3  0.4079      0.561 0.000 0.000 0.680 0.288 0.000 0.032
#> GSM99450     3  0.4354      0.632 0.000 0.000 0.720 0.004 0.080 0.196
#> GSM99452     1  0.0790      0.860 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM99454     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.3198      0.383 0.000 0.000 0.000 0.000 0.740 0.260
#> GSM99462     2  0.0000      0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     5  0.3862     -0.621 0.000 0.000 0.000 0.000 0.524 0.476
#> GSM99466     4  0.0146      0.831 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM99470     1  0.4392      0.640 0.720 0.000 0.000 0.000 0.136 0.144
#> GSM99472     1  0.4343      0.641 0.724 0.000 0.000 0.000 0.156 0.120
#> GSM99474     3  0.0458      0.877 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM99476     3  0.5864      0.161 0.000 0.000 0.468 0.352 0.004 0.176
#> GSM99478     4  0.0146      0.831 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM99480     1  0.5539      0.312 0.552 0.000 0.000 0.000 0.188 0.260
#> GSM99482     1  0.1501      0.837 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM99484     4  0.1829      0.804 0.000 0.056 0.000 0.920 0.000 0.024
#> GSM99486     4  0.0508      0.830 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM99488     2  0.0000      0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     2  0.2214      0.804 0.000 0.888 0.000 0.096 0.000 0.016
#> GSM99492     1  0.5847      0.154 0.488 0.000 0.000 0.000 0.252 0.260
#> GSM99494     2  0.0000      0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.0790      0.860 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM99526     6  0.5886      0.000 0.000 0.000 0.068 0.052 0.396 0.484
#> GSM99528     4  0.0717      0.824 0.000 0.000 0.000 0.976 0.008 0.016
#> GSM99530     5  0.4602     -0.666 0.000 0.000 0.028 0.004 0.492 0.476
#> GSM99532     3  0.2623      0.792 0.000 0.000 0.852 0.000 0.016 0.132
#> GSM99534     4  0.6440      0.137 0.000 0.364 0.000 0.456 0.068 0.112
#> GSM99536     1  0.3283      0.711 0.804 0.000 0.000 0.000 0.160 0.036
#> GSM99538     4  0.0547      0.826 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM99540     5  0.3797      0.125 0.420 0.000 0.000 0.000 0.580 0.000
#> GSM99542     2  0.1863      0.813 0.000 0.896 0.000 0.000 0.000 0.104
#> GSM99544     4  0.0146      0.831 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM99546     4  0.3715      0.622 0.000 0.000 0.000 0.764 0.048 0.188
#> GSM99548     2  0.0260      0.888 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM99550     5  0.2631      0.119 0.000 0.000 0.000 0.000 0.820 0.180
#> GSM99552     3  0.2070      0.798 0.000 0.000 0.892 0.100 0.000 0.008
#> GSM99554     4  0.4258      0.116 0.000 0.468 0.000 0.516 0.000 0.016
#> GSM99556     2  0.0000      0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99558     4  0.0891      0.816 0.000 0.000 0.024 0.968 0.000 0.008
#> GSM99560     4  0.0713      0.829 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM99562     3  0.0713      0.877 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM99564     4  0.0260      0.831 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM99572     2  0.0146      0.890 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99576     5  0.2448      0.391 0.052 0.000 0.000 0.000 0.884 0.064
#> GSM99578     2  0.4144      0.314 0.000 0.620 0.000 0.360 0.000 0.020
#> GSM99580     3  0.0146      0.878 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99582     3  0.1719      0.848 0.000 0.000 0.924 0.000 0.016 0.060
#> GSM99584     4  0.0291      0.831 0.000 0.000 0.000 0.992 0.004 0.004
#> GSM99586     5  0.4516      0.383 0.072 0.000 0.000 0.000 0.668 0.260
#> GSM99588     4  0.4250      0.161 0.000 0.456 0.000 0.528 0.000 0.016
#> GSM99590     2  0.0000      0.891 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) cell.type(p) k
#> SD:mclust 80         2.30e-01      0.43286 2
#> SD:mclust 83         1.97e-03      0.03264 3
#> SD:mclust 82         2.28e-04      0.01267 4
#> SD:mclust 80         4.54e-05      0.00792 5
#> SD:mclust 67         2.89e-05      0.00420 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.971       0.988         0.5012 0.500   0.500
#> 3 3 0.952           0.940       0.976         0.3437 0.725   0.501
#> 4 4 0.852           0.833       0.922         0.1049 0.887   0.673
#> 5 5 0.750           0.655       0.815         0.0552 0.943   0.789
#> 6 6 0.729           0.582       0.790         0.0400 0.904   0.632

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
#> GSM99496     1  0.0000      0.984 1.000 0.000
#> GSM99502     1  0.0000      0.984 1.000 0.000
#> GSM99504     1  0.0000      0.984 1.000 0.000
#> GSM99506     1  0.0000      0.984 1.000 0.000
#> GSM99566     1  0.0000      0.984 1.000 0.000
#> GSM99574     1  0.0000      0.984 1.000 0.000
#> GSM99592     1  0.2236      0.951 0.964 0.036
#> GSM99594     1  0.0000      0.984 1.000 0.000
#> GSM99468     1  0.0000      0.984 1.000 0.000
#> GSM99498     1  0.0000      0.984 1.000 0.000
#> GSM99500     1  0.0000      0.984 1.000 0.000
#> GSM99508     1  0.0000      0.984 1.000 0.000
#> GSM99568     1  0.0000      0.984 1.000 0.000
#> GSM99596     1  0.0000      0.984 1.000 0.000
#> GSM99600     2  0.0000      0.991 0.000 1.000
#> GSM99458     1  0.0000      0.984 1.000 0.000
#> GSM99460     1  0.0000      0.984 1.000 0.000
#> GSM99510     2  0.4562      0.898 0.096 0.904
#> GSM99512     2  0.0938      0.982 0.012 0.988
#> GSM99514     1  0.0000      0.984 1.000 0.000
#> GSM99516     1  0.0000      0.984 1.000 0.000
#> GSM99518     1  0.0000      0.984 1.000 0.000
#> GSM99520     1  0.0000      0.984 1.000 0.000
#> GSM99522     1  0.0000      0.984 1.000 0.000
#> GSM99570     1  0.0000      0.984 1.000 0.000
#> GSM99598     1  0.0000      0.984 1.000 0.000
#> GSM99432     2  0.0000      0.991 0.000 1.000
#> GSM99434     1  0.9866      0.237 0.568 0.432
#> GSM99436     2  0.0000      0.991 0.000 1.000
#> GSM99438     2  0.0000      0.991 0.000 1.000
#> GSM99440     1  0.0000      0.984 1.000 0.000
#> GSM99442     2  0.0000      0.991 0.000 1.000
#> GSM99444     2  0.0000      0.991 0.000 1.000
#> GSM99446     2  0.0000      0.991 0.000 1.000
#> GSM99448     2  0.0000      0.991 0.000 1.000
#> GSM99450     1  0.0000      0.984 1.000 0.000
#> GSM99452     1  0.0000      0.984 1.000 0.000
#> GSM99454     1  0.0000      0.984 1.000 0.000
#> GSM99456     1  0.0000      0.984 1.000 0.000
#> GSM99462     2  0.0000      0.991 0.000 1.000
#> GSM99464     1  0.0000      0.984 1.000 0.000
#> GSM99466     2  0.0000      0.991 0.000 1.000
#> GSM99470     1  0.2948      0.935 0.948 0.052
#> GSM99472     1  0.0000      0.984 1.000 0.000
#> GSM99474     1  0.0000      0.984 1.000 0.000
#> GSM99476     2  0.0000      0.991 0.000 1.000
#> GSM99478     2  0.0000      0.991 0.000 1.000
#> GSM99480     1  0.0000      0.984 1.000 0.000
#> GSM99482     1  0.0000      0.984 1.000 0.000
#> GSM99484     2  0.0000      0.991 0.000 1.000
#> GSM99486     2  0.0000      0.991 0.000 1.000
#> GSM99488     2  0.0000      0.991 0.000 1.000
#> GSM99490     2  0.0000      0.991 0.000 1.000
#> GSM99492     1  0.0000      0.984 1.000 0.000
#> GSM99494     2  0.0000      0.991 0.000 1.000
#> GSM99524     1  0.0000      0.984 1.000 0.000
#> GSM99526     2  0.4690      0.894 0.100 0.900
#> GSM99528     2  0.0672      0.985 0.008 0.992
#> GSM99530     1  0.0000      0.984 1.000 0.000
#> GSM99532     1  0.0000      0.984 1.000 0.000
#> GSM99534     2  0.0000      0.991 0.000 1.000
#> GSM99536     1  0.0000      0.984 1.000 0.000
#> GSM99538     2  0.0000      0.991 0.000 1.000
#> GSM99540     1  0.0000      0.984 1.000 0.000
#> GSM99542     2  0.0000      0.991 0.000 1.000
#> GSM99544     2  0.0000      0.991 0.000 1.000
#> GSM99546     2  0.1633      0.972 0.024 0.976
#> GSM99548     2  0.0000      0.991 0.000 1.000
#> GSM99550     1  0.0000      0.984 1.000 0.000
#> GSM99552     2  0.3879      0.921 0.076 0.924
#> GSM99554     2  0.0000      0.991 0.000 1.000
#> GSM99556     2  0.0000      0.991 0.000 1.000
#> GSM99558     2  0.0000      0.991 0.000 1.000
#> GSM99560     2  0.0000      0.991 0.000 1.000
#> GSM99562     1  0.0000      0.984 1.000 0.000
#> GSM99564     2  0.0000      0.991 0.000 1.000
#> GSM99572     2  0.0000      0.991 0.000 1.000
#> GSM99576     1  0.0000      0.984 1.000 0.000
#> GSM99578     2  0.0000      0.991 0.000 1.000
#> GSM99580     1  0.7299      0.742 0.796 0.204
#> GSM99582     1  0.0000      0.984 1.000 0.000
#> GSM99584     2  0.0000      0.991 0.000 1.000
#> GSM99586     1  0.0000      0.984 1.000 0.000
#> GSM99588     2  0.0000      0.991 0.000 1.000
#> GSM99590     2  0.0000      0.991 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
#> GSM99496     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99502     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99504     1  0.5291     0.6335 0.732 0.000 0.268
#> GSM99506     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99566     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99574     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99592     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99594     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99468     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99498     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99500     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99508     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99568     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99596     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99600     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99458     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99460     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99510     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99512     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99514     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99516     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99518     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99520     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99522     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99570     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99432     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99434     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99436     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99438     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99440     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99442     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99444     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99446     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99448     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99450     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99452     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99456     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99462     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99464     3  0.0237     0.9712 0.004 0.000 0.996
#> GSM99466     2  0.6309     0.0181 0.000 0.504 0.496
#> GSM99470     1  0.2959     0.8817 0.900 0.100 0.000
#> GSM99472     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99474     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99476     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99478     2  0.0892     0.9477 0.000 0.980 0.020
#> GSM99480     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99482     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99484     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99486     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99488     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99490     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99492     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99494     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99524     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99526     3  0.0424     0.9677 0.000 0.008 0.992
#> GSM99528     2  0.0237     0.9609 0.000 0.996 0.004
#> GSM99530     3  0.0237     0.9712 0.004 0.000 0.996
#> GSM99532     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99534     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99536     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99538     3  0.3941     0.7975 0.000 0.156 0.844
#> GSM99540     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99542     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99544     3  0.6168     0.2659 0.000 0.412 0.588
#> GSM99546     2  0.4796     0.7151 0.000 0.780 0.220
#> GSM99548     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99550     1  0.0424     0.9783 0.992 0.008 0.000
#> GSM99552     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99554     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99556     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99558     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99560     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99562     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99564     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99572     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99576     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99578     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99580     3  0.0000     0.9742 0.000 0.000 1.000
#> GSM99582     3  0.2959     0.8728 0.100 0.000 0.900
#> GSM99584     2  0.4931     0.6933 0.000 0.768 0.232
#> GSM99586     1  0.0000     0.9853 1.000 0.000 0.000
#> GSM99588     2  0.0000     0.9640 0.000 1.000 0.000
#> GSM99590     2  0.0000     0.9640 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0469      0.908 0.000 0.000 0.988 0.012
#> GSM99502     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99504     3  0.3486      0.709 0.188 0.000 0.812 0.000
#> GSM99506     3  0.0921      0.910 0.000 0.000 0.972 0.028
#> GSM99566     3  0.0336      0.902 0.000 0.000 0.992 0.008
#> GSM99574     1  0.0336      0.949 0.992 0.000 0.008 0.000
#> GSM99592     3  0.2868      0.855 0.000 0.000 0.864 0.136
#> GSM99594     3  0.1302      0.909 0.000 0.000 0.956 0.044
#> GSM99468     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99498     1  0.2469      0.845 0.892 0.000 0.108 0.000
#> GSM99500     1  0.0921      0.933 0.972 0.000 0.028 0.000
#> GSM99508     3  0.1474      0.907 0.000 0.000 0.948 0.052
#> GSM99568     3  0.2216      0.889 0.000 0.000 0.908 0.092
#> GSM99596     3  0.1302      0.910 0.000 0.000 0.956 0.044
#> GSM99600     2  0.0817      0.944 0.000 0.976 0.000 0.024
#> GSM99458     1  0.0592      0.947 0.984 0.000 0.000 0.016
#> GSM99460     4  0.4948      0.139 0.440 0.000 0.000 0.560
#> GSM99510     4  0.4998     -0.102 0.000 0.000 0.488 0.512
#> GSM99512     3  0.3873      0.736 0.000 0.000 0.772 0.228
#> GSM99514     3  0.0469      0.900 0.000 0.000 0.988 0.012
#> GSM99516     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0188      0.952 0.996 0.000 0.000 0.004
#> GSM99520     3  0.1118      0.910 0.000 0.000 0.964 0.036
#> GSM99522     3  0.0657      0.901 0.004 0.000 0.984 0.012
#> GSM99570     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99432     4  0.4331      0.535 0.000 0.288 0.000 0.712
#> GSM99434     4  0.2814      0.701 0.000 0.000 0.132 0.868
#> GSM99436     2  0.1716      0.920 0.000 0.936 0.000 0.064
#> GSM99438     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0469      0.948 0.000 0.988 0.000 0.012
#> GSM99444     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99446     2  0.2081      0.904 0.000 0.916 0.000 0.084
#> GSM99448     3  0.1792      0.892 0.000 0.000 0.932 0.068
#> GSM99450     4  0.4624      0.381 0.000 0.000 0.340 0.660
#> GSM99452     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99456     1  0.3123      0.807 0.844 0.000 0.000 0.156
#> GSM99462     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99464     4  0.0895      0.758 0.004 0.000 0.020 0.976
#> GSM99466     2  0.4300      0.791 0.000 0.820 0.092 0.088
#> GSM99470     1  0.4907      0.270 0.580 0.420 0.000 0.000
#> GSM99472     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99474     3  0.2345      0.884 0.000 0.000 0.900 0.100
#> GSM99476     4  0.1637      0.750 0.000 0.000 0.060 0.940
#> GSM99478     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99480     1  0.0188      0.952 0.996 0.000 0.000 0.004
#> GSM99482     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM99484     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99486     2  0.2174      0.917 0.000 0.928 0.020 0.052
#> GSM99488     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99490     2  0.0336      0.949 0.000 0.992 0.000 0.008
#> GSM99492     1  0.0469      0.949 0.988 0.000 0.000 0.012
#> GSM99494     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0188      0.951 0.996 0.000 0.004 0.000
#> GSM99526     4  0.0592      0.757 0.000 0.000 0.016 0.984
#> GSM99528     2  0.2593      0.867 0.000 0.892 0.004 0.104
#> GSM99530     4  0.2197      0.738 0.004 0.000 0.080 0.916
#> GSM99532     3  0.4994      0.147 0.000 0.000 0.520 0.480
#> GSM99534     2  0.0592      0.946 0.000 0.984 0.000 0.016
#> GSM99536     1  0.0188      0.952 0.996 0.000 0.000 0.004
#> GSM99538     4  0.1389      0.754 0.000 0.000 0.048 0.952
#> GSM99540     1  0.1792      0.910 0.932 0.000 0.000 0.068
#> GSM99542     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99544     4  0.5582      0.421 0.000 0.348 0.032 0.620
#> GSM99546     4  0.1637      0.750 0.000 0.060 0.000 0.940
#> GSM99548     2  0.0592      0.946 0.000 0.984 0.000 0.016
#> GSM99550     4  0.3718      0.677 0.168 0.012 0.000 0.820
#> GSM99552     3  0.0967      0.895 0.004 0.004 0.976 0.016
#> GSM99554     2  0.0592      0.946 0.000 0.984 0.000 0.016
#> GSM99556     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99558     3  0.0336      0.902 0.000 0.000 0.992 0.008
#> GSM99560     2  0.5000      0.046 0.000 0.504 0.000 0.496
#> GSM99562     3  0.1637      0.905 0.000 0.000 0.940 0.060
#> GSM99564     2  0.2469      0.881 0.000 0.892 0.000 0.108
#> GSM99572     2  0.0336      0.949 0.000 0.992 0.000 0.008
#> GSM99576     1  0.1022      0.937 0.968 0.000 0.000 0.032
#> GSM99578     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99580     3  0.1022      0.910 0.000 0.000 0.968 0.032
#> GSM99582     3  0.2730      0.824 0.088 0.000 0.896 0.016
#> GSM99584     4  0.3791      0.657 0.000 0.200 0.004 0.796
#> GSM99586     1  0.1716      0.912 0.936 0.000 0.000 0.064
#> GSM99588     2  0.0000      0.951 0.000 1.000 0.000 0.000
#> GSM99590     2  0.0000      0.951 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0880     0.7943 0.000 0.000 0.968 0.000 0.032
#> GSM99502     1  0.0162     0.9284 0.996 0.000 0.000 0.000 0.004
#> GSM99504     3  0.6202     0.4463 0.220 0.000 0.552 0.000 0.228
#> GSM99506     3  0.0703     0.7936 0.000 0.000 0.976 0.000 0.024
#> GSM99566     3  0.1908     0.7890 0.000 0.000 0.908 0.000 0.092
#> GSM99574     1  0.0162     0.9284 0.996 0.000 0.000 0.000 0.004
#> GSM99592     3  0.3532     0.7706 0.000 0.000 0.824 0.048 0.128
#> GSM99594     3  0.1872     0.7822 0.000 0.000 0.928 0.020 0.052
#> GSM99468     1  0.0451     0.9272 0.988 0.000 0.000 0.004 0.008
#> GSM99498     1  0.4109     0.5805 0.700 0.000 0.288 0.000 0.012
#> GSM99500     1  0.0865     0.9176 0.972 0.000 0.024 0.000 0.004
#> GSM99508     3  0.1331     0.7958 0.000 0.000 0.952 0.008 0.040
#> GSM99568     3  0.1300     0.7908 0.000 0.000 0.956 0.028 0.016
#> GSM99596     3  0.1704     0.7794 0.000 0.000 0.928 0.004 0.068
#> GSM99600     2  0.4276     0.5450 0.000 0.716 0.000 0.028 0.256
#> GSM99458     1  0.0404     0.9266 0.988 0.000 0.000 0.012 0.000
#> GSM99460     4  0.4262     0.0706 0.440 0.000 0.000 0.560 0.000
#> GSM99510     4  0.5748     0.3576 0.000 0.000 0.252 0.608 0.140
#> GSM99512     3  0.4016     0.7497 0.000 0.000 0.796 0.112 0.092
#> GSM99514     3  0.3424     0.7198 0.000 0.000 0.760 0.000 0.240
#> GSM99516     1  0.0162     0.9284 0.996 0.000 0.000 0.000 0.004
#> GSM99518     1  0.0290     0.9275 0.992 0.000 0.000 0.008 0.000
#> GSM99520     3  0.1331     0.7973 0.000 0.000 0.952 0.008 0.040
#> GSM99522     3  0.4559     0.4543 0.000 0.000 0.512 0.008 0.480
#> GSM99570     1  0.0162     0.9284 0.996 0.000 0.000 0.000 0.004
#> GSM99598     1  0.0290     0.9276 0.992 0.000 0.000 0.000 0.008
#> GSM99432     4  0.3513     0.5583 0.000 0.020 0.000 0.800 0.180
#> GSM99434     4  0.2376     0.6044 0.000 0.000 0.044 0.904 0.052
#> GSM99436     2  0.6599    -0.2916 0.000 0.436 0.000 0.220 0.344
#> GSM99438     2  0.0510     0.8033 0.000 0.984 0.000 0.000 0.016
#> GSM99440     1  0.0162     0.9281 0.996 0.000 0.000 0.000 0.004
#> GSM99442     2  0.4130     0.5171 0.000 0.696 0.000 0.012 0.292
#> GSM99444     2  0.0794     0.8008 0.000 0.972 0.000 0.000 0.028
#> GSM99446     2  0.6642    -0.2732 0.000 0.444 0.000 0.248 0.308
#> GSM99448     3  0.5142     0.5742 0.000 0.000 0.600 0.052 0.348
#> GSM99450     4  0.4482     0.5472 0.000 0.000 0.088 0.752 0.160
#> GSM99452     1  0.0290     0.9284 0.992 0.000 0.000 0.000 0.008
#> GSM99454     1  0.0162     0.9284 0.996 0.000 0.000 0.000 0.004
#> GSM99456     1  0.3724     0.7645 0.788 0.000 0.000 0.184 0.028
#> GSM99462     2  0.0880     0.7993 0.000 0.968 0.000 0.000 0.032
#> GSM99464     4  0.1862     0.5910 0.004 0.000 0.048 0.932 0.016
#> GSM99466     5  0.7173     0.3151 0.000 0.340 0.028 0.204 0.428
#> GSM99470     1  0.3421     0.7840 0.840 0.080 0.000 0.000 0.080
#> GSM99472     1  0.0290     0.9277 0.992 0.000 0.000 0.000 0.008
#> GSM99474     3  0.1701     0.7847 0.000 0.000 0.936 0.048 0.016
#> GSM99476     4  0.3461     0.5365 0.000 0.000 0.004 0.772 0.224
#> GSM99478     2  0.3100     0.7015 0.000 0.876 0.028 0.028 0.068
#> GSM99480     1  0.0451     0.9268 0.988 0.000 0.000 0.008 0.004
#> GSM99482     1  0.0162     0.9284 0.996 0.000 0.000 0.000 0.004
#> GSM99484     2  0.3366     0.6288 0.000 0.768 0.000 0.000 0.232
#> GSM99486     5  0.5543     0.4406 0.000 0.224 0.000 0.136 0.640
#> GSM99488     2  0.0290     0.8006 0.000 0.992 0.000 0.000 0.008
#> GSM99490     2  0.0404     0.7990 0.000 0.988 0.000 0.000 0.012
#> GSM99492     1  0.1310     0.9118 0.956 0.000 0.000 0.024 0.020
#> GSM99494     2  0.0290     0.8006 0.000 0.992 0.000 0.000 0.008
#> GSM99524     1  0.0510     0.9242 0.984 0.000 0.000 0.000 0.016
#> GSM99526     4  0.0703     0.6039 0.000 0.000 0.000 0.976 0.024
#> GSM99528     3  0.7316     0.1367 0.000 0.368 0.440 0.084 0.108
#> GSM99530     3  0.6157     0.2824 0.004 0.004 0.524 0.360 0.108
#> GSM99532     3  0.5066     0.5620 0.000 0.000 0.676 0.240 0.084
#> GSM99534     2  0.3675     0.6333 0.004 0.772 0.000 0.008 0.216
#> GSM99536     1  0.0566     0.9256 0.984 0.000 0.000 0.012 0.004
#> GSM99538     4  0.4964     0.4461 0.000 0.020 0.220 0.712 0.048
#> GSM99540     1  0.4928     0.7278 0.748 0.000 0.064 0.156 0.032
#> GSM99542     2  0.0290     0.8006 0.000 0.992 0.000 0.000 0.008
#> GSM99544     4  0.4824     0.3081 0.000 0.028 0.000 0.596 0.376
#> GSM99546     4  0.3039     0.5631 0.000 0.000 0.000 0.808 0.192
#> GSM99548     2  0.0703     0.7922 0.000 0.976 0.000 0.000 0.024
#> GSM99550     4  0.4415     0.4996 0.132 0.008 0.016 0.792 0.052
#> GSM99552     3  0.3039     0.7663 0.000 0.012 0.836 0.000 0.152
#> GSM99554     2  0.4794     0.3647 0.000 0.624 0.000 0.032 0.344
#> GSM99556     2  0.0162     0.8012 0.000 0.996 0.000 0.000 0.004
#> GSM99558     3  0.2377     0.7786 0.000 0.000 0.872 0.000 0.128
#> GSM99560     4  0.6636    -0.2985 0.000 0.312 0.000 0.444 0.244
#> GSM99562     3  0.3961     0.7023 0.000 0.000 0.736 0.016 0.248
#> GSM99564     5  0.6583     0.3845 0.000 0.256 0.000 0.276 0.468
#> GSM99572     2  0.1041     0.7996 0.000 0.964 0.000 0.004 0.032
#> GSM99576     1  0.7100     0.5985 0.640 0.104 0.116 0.076 0.064
#> GSM99578     2  0.0290     0.8039 0.000 0.992 0.000 0.000 0.008
#> GSM99580     3  0.1041     0.7961 0.000 0.000 0.964 0.004 0.032
#> GSM99582     5  0.6088    -0.2283 0.156 0.000 0.296 0.000 0.548
#> GSM99584     4  0.4387     0.3699 0.000 0.012 0.000 0.640 0.348
#> GSM99586     1  0.3090     0.8364 0.856 0.000 0.000 0.104 0.040
#> GSM99588     2  0.0404     0.8015 0.000 0.988 0.000 0.000 0.012
#> GSM99590     2  0.0510     0.8034 0.000 0.984 0.000 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.2402     0.5174 0.000 0.000 0.856 0.000 0.140 0.004
#> GSM99502     1  0.0547     0.9121 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM99504     3  0.5304    -0.0364 0.200 0.000 0.600 0.000 0.200 0.000
#> GSM99506     3  0.0891     0.5113 0.000 0.000 0.968 0.000 0.024 0.008
#> GSM99566     3  0.3440     0.2026 0.000 0.000 0.776 0.000 0.196 0.028
#> GSM99574     1  0.0937     0.9102 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM99592     3  0.4341     0.1268 0.000 0.000 0.736 0.004 0.136 0.124
#> GSM99594     3  0.3207     0.4917 0.000 0.000 0.828 0.004 0.124 0.044
#> GSM99468     1  0.0858     0.9076 0.968 0.000 0.000 0.000 0.028 0.004
#> GSM99498     1  0.4858     0.3703 0.588 0.000 0.348 0.000 0.060 0.004
#> GSM99500     1  0.3078     0.8352 0.852 0.000 0.080 0.004 0.060 0.004
#> GSM99508     3  0.1826     0.4628 0.000 0.000 0.924 0.004 0.052 0.020
#> GSM99568     3  0.1719     0.5181 0.000 0.000 0.924 0.000 0.060 0.016
#> GSM99596     3  0.4305     0.4214 0.000 0.000 0.656 0.020 0.312 0.012
#> GSM99600     4  0.3144     0.6951 0.000 0.172 0.000 0.808 0.016 0.004
#> GSM99458     1  0.0508     0.9126 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM99460     6  0.3925     0.3456 0.332 0.000 0.000 0.004 0.008 0.656
#> GSM99510     6  0.5719    -0.1120 0.000 0.000 0.300 0.004 0.172 0.524
#> GSM99512     6  0.6138    -0.4581 0.000 0.004 0.396 0.004 0.200 0.396
#> GSM99514     3  0.3053     0.4047 0.000 0.000 0.812 0.012 0.172 0.004
#> GSM99516     1  0.0858     0.9099 0.968 0.000 0.000 0.000 0.028 0.004
#> GSM99518     1  0.0291     0.9132 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM99520     3  0.2742     0.5191 0.000 0.000 0.852 0.008 0.128 0.012
#> GSM99522     5  0.5525     0.0000 0.004 0.000 0.404 0.012 0.500 0.080
#> GSM99570     1  0.0865     0.9099 0.964 0.000 0.000 0.000 0.036 0.000
#> GSM99598     1  0.0547     0.9116 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM99432     4  0.3995     0.2778 0.000 0.004 0.000 0.516 0.000 0.480
#> GSM99434     6  0.2560     0.5416 0.000 0.000 0.088 0.016 0.016 0.880
#> GSM99436     4  0.2136     0.7253 0.000 0.048 0.000 0.904 0.000 0.048
#> GSM99438     2  0.1219     0.9114 0.000 0.948 0.000 0.048 0.004 0.000
#> GSM99440     1  0.0260     0.9124 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM99442     4  0.2994     0.6598 0.000 0.208 0.000 0.788 0.004 0.000
#> GSM99444     2  0.0935     0.9192 0.000 0.964 0.000 0.032 0.004 0.000
#> GSM99446     4  0.3611     0.7158 0.000 0.108 0.000 0.796 0.000 0.096
#> GSM99448     3  0.6366    -0.6512 0.000 0.000 0.444 0.020 0.300 0.236
#> GSM99450     6  0.4283     0.5150 0.000 0.000 0.104 0.072 0.048 0.776
#> GSM99452     1  0.0146     0.9123 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99454     1  0.0260     0.9129 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM99456     1  0.4033     0.7749 0.776 0.000 0.000 0.012 0.088 0.124
#> GSM99462     2  0.0858     0.9194 0.000 0.968 0.000 0.028 0.004 0.000
#> GSM99464     6  0.1851     0.5774 0.000 0.000 0.012 0.024 0.036 0.928
#> GSM99466     4  0.3645     0.6728 0.000 0.000 0.056 0.804 0.128 0.012
#> GSM99470     1  0.3499     0.7571 0.796 0.008 0.000 0.164 0.032 0.000
#> GSM99472     1  0.1398     0.8909 0.940 0.000 0.000 0.052 0.008 0.000
#> GSM99474     3  0.3627     0.3178 0.000 0.000 0.792 0.000 0.080 0.128
#> GSM99476     4  0.3488     0.6534 0.000 0.000 0.004 0.764 0.016 0.216
#> GSM99478     4  0.7426     0.2341 0.000 0.052 0.220 0.368 0.328 0.032
#> GSM99480     1  0.0632     0.9103 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM99482     1  0.0547     0.9116 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM99484     4  0.3943     0.6811 0.004 0.172 0.012 0.772 0.040 0.000
#> GSM99486     4  0.1592     0.7170 0.000 0.008 0.000 0.940 0.032 0.020
#> GSM99488     2  0.0000     0.9166 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     2  0.3368     0.6889 0.000 0.756 0.000 0.232 0.012 0.000
#> GSM99492     1  0.1686     0.8895 0.924 0.000 0.000 0.000 0.064 0.012
#> GSM99494     2  0.0146     0.9160 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM99524     1  0.0777     0.9116 0.972 0.000 0.000 0.004 0.024 0.000
#> GSM99526     6  0.1349     0.5709 0.000 0.000 0.004 0.056 0.000 0.940
#> GSM99528     3  0.7278     0.2028 0.016 0.124 0.412 0.028 0.372 0.048
#> GSM99530     6  0.6485     0.0143 0.012 0.000 0.348 0.004 0.264 0.372
#> GSM99532     6  0.5040     0.1110 0.000 0.000 0.408 0.000 0.076 0.516
#> GSM99534     2  0.3969     0.6791 0.044 0.740 0.000 0.212 0.004 0.000
#> GSM99536     1  0.0717     0.9109 0.976 0.000 0.000 0.000 0.016 0.008
#> GSM99538     6  0.3456     0.5647 0.000 0.008 0.064 0.028 0.056 0.844
#> GSM99540     1  0.4091     0.7586 0.772 0.000 0.020 0.000 0.064 0.144
#> GSM99542     2  0.0000     0.9166 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99544     4  0.4779     0.1962 0.000 0.000 0.004 0.488 0.040 0.468
#> GSM99546     6  0.2730     0.5146 0.000 0.000 0.000 0.152 0.012 0.836
#> GSM99548     2  0.2358     0.8521 0.000 0.876 0.000 0.108 0.016 0.000
#> GSM99550     6  0.6732     0.2357 0.140 0.000 0.000 0.224 0.120 0.516
#> GSM99552     3  0.4110     0.4454 0.000 0.000 0.692 0.040 0.268 0.000
#> GSM99554     4  0.2772     0.7232 0.000 0.092 0.000 0.864 0.040 0.004
#> GSM99556     2  0.0603     0.9207 0.000 0.980 0.000 0.016 0.004 0.000
#> GSM99558     3  0.4819     0.4028 0.000 0.000 0.656 0.116 0.228 0.000
#> GSM99560     4  0.4207     0.6828 0.000 0.024 0.000 0.764 0.064 0.148
#> GSM99562     3  0.5586    -0.7615 0.000 0.000 0.472 0.000 0.384 0.144
#> GSM99564     4  0.1082     0.7165 0.000 0.004 0.000 0.956 0.000 0.040
#> GSM99572     2  0.2212     0.8642 0.000 0.880 0.000 0.112 0.008 0.000
#> GSM99576     1  0.5144     0.7403 0.736 0.052 0.036 0.004 0.128 0.044
#> GSM99578     4  0.5637     0.4893 0.000 0.292 0.040 0.592 0.072 0.004
#> GSM99580     3  0.2846     0.3789 0.000 0.000 0.856 0.000 0.084 0.060
#> GSM99582     4  0.6001     0.3873 0.024 0.000 0.244 0.564 0.164 0.004
#> GSM99584     4  0.3984     0.4943 0.000 0.000 0.000 0.648 0.016 0.336
#> GSM99586     1  0.3220     0.8353 0.840 0.000 0.004 0.004 0.096 0.056
#> GSM99588     2  0.0405     0.9189 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM99590     2  0.0363     0.9204 0.000 0.988 0.000 0.012 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) cell.type(p) k
#> SD:NMF 84         8.94e-05     0.000459 2
#> SD:NMF 83         5.12e-04     0.011515 3
#> SD:NMF 78         1.16e-05     0.000577 4
#> SD:NMF 67         7.51e-04     0.016450 5
#> SD:NMF 57         1.57e-04     0.005002 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.666           0.849       0.930         0.3044 0.722   0.722
#> 3 3 0.605           0.768       0.888         0.9728 0.684   0.562
#> 4 4 0.581           0.693       0.809         0.1801 0.829   0.595
#> 5 5 0.630           0.647       0.806         0.0860 0.953   0.823
#> 6 6 0.684           0.621       0.777         0.0392 0.992   0.964

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
#> GSM99496     1  0.0000     0.9300 1.000 0.000
#> GSM99502     1  0.0000     0.9300 1.000 0.000
#> GSM99504     1  0.0000     0.9300 1.000 0.000
#> GSM99506     1  0.0000     0.9300 1.000 0.000
#> GSM99566     1  0.0000     0.9300 1.000 0.000
#> GSM99574     1  0.0000     0.9300 1.000 0.000
#> GSM99592     1  0.0000     0.9300 1.000 0.000
#> GSM99594     1  0.0000     0.9300 1.000 0.000
#> GSM99468     1  0.0000     0.9300 1.000 0.000
#> GSM99498     1  0.0000     0.9300 1.000 0.000
#> GSM99500     1  0.0000     0.9300 1.000 0.000
#> GSM99508     1  0.0000     0.9300 1.000 0.000
#> GSM99568     1  0.0000     0.9300 1.000 0.000
#> GSM99596     1  0.0000     0.9300 1.000 0.000
#> GSM99600     1  0.9988     0.0534 0.520 0.480
#> GSM99458     1  0.0000     0.9300 1.000 0.000
#> GSM99460     1  0.0000     0.9300 1.000 0.000
#> GSM99510     1  0.0000     0.9300 1.000 0.000
#> GSM99512     1  0.0000     0.9300 1.000 0.000
#> GSM99514     1  0.0000     0.9300 1.000 0.000
#> GSM99516     1  0.0000     0.9300 1.000 0.000
#> GSM99518     1  0.0000     0.9300 1.000 0.000
#> GSM99520     1  0.0000     0.9300 1.000 0.000
#> GSM99522     1  0.0000     0.9300 1.000 0.000
#> GSM99570     1  0.0000     0.9300 1.000 0.000
#> GSM99598     1  0.0000     0.9300 1.000 0.000
#> GSM99432     1  0.7219     0.7700 0.800 0.200
#> GSM99434     1  0.0376     0.9285 0.996 0.004
#> GSM99436     1  0.8144     0.6926 0.748 0.252
#> GSM99438     2  0.2603     0.8649 0.044 0.956
#> GSM99440     1  0.0000     0.9300 1.000 0.000
#> GSM99442     2  0.9635     0.3877 0.388 0.612
#> GSM99444     2  0.2948     0.8634 0.052 0.948
#> GSM99446     1  0.9358     0.4881 0.648 0.352
#> GSM99448     1  0.4298     0.8848 0.912 0.088
#> GSM99450     1  0.0000     0.9300 1.000 0.000
#> GSM99452     1  0.0000     0.9300 1.000 0.000
#> GSM99454     1  0.0000     0.9300 1.000 0.000
#> GSM99456     1  0.0000     0.9300 1.000 0.000
#> GSM99462     2  0.0000     0.8614 0.000 1.000
#> GSM99464     1  0.0000     0.9300 1.000 0.000
#> GSM99466     1  0.4690     0.8745 0.900 0.100
#> GSM99470     1  0.4161     0.8876 0.916 0.084
#> GSM99472     1  0.4161     0.8876 0.916 0.084
#> GSM99474     1  0.0000     0.9300 1.000 0.000
#> GSM99476     1  0.4431     0.8804 0.908 0.092
#> GSM99478     1  0.5408     0.8551 0.876 0.124
#> GSM99480     1  0.0000     0.9300 1.000 0.000
#> GSM99482     1  0.0000     0.9300 1.000 0.000
#> GSM99484     1  0.5946     0.8379 0.856 0.144
#> GSM99486     1  0.7950     0.7111 0.760 0.240
#> GSM99488     2  0.0000     0.8614 0.000 1.000
#> GSM99490     2  0.5408     0.8097 0.124 0.876
#> GSM99492     1  0.0000     0.9300 1.000 0.000
#> GSM99494     2  0.0000     0.8614 0.000 1.000
#> GSM99524     1  0.0000     0.9300 1.000 0.000
#> GSM99526     1  0.0376     0.9285 0.996 0.004
#> GSM99528     1  0.3733     0.8974 0.928 0.072
#> GSM99530     1  0.0000     0.9300 1.000 0.000
#> GSM99532     1  0.0000     0.9300 1.000 0.000
#> GSM99534     1  0.9491     0.4422 0.632 0.368
#> GSM99536     1  0.0000     0.9300 1.000 0.000
#> GSM99538     1  0.5842     0.8397 0.860 0.140
#> GSM99540     1  0.0000     0.9300 1.000 0.000
#> GSM99542     2  0.1414     0.8639 0.020 0.980
#> GSM99544     1  0.6247     0.8225 0.844 0.156
#> GSM99546     1  0.6148     0.8272 0.848 0.152
#> GSM99548     2  0.0000     0.8614 0.000 1.000
#> GSM99550     1  0.0938     0.9256 0.988 0.012
#> GSM99552     1  0.3114     0.9057 0.944 0.056
#> GSM99554     1  0.9491     0.4433 0.632 0.368
#> GSM99556     2  0.0000     0.8614 0.000 1.000
#> GSM99558     1  0.3733     0.8957 0.928 0.072
#> GSM99560     1  0.5519     0.8529 0.872 0.128
#> GSM99562     1  0.0000     0.9300 1.000 0.000
#> GSM99564     1  0.7950     0.7111 0.760 0.240
#> GSM99572     2  0.2948     0.8634 0.052 0.948
#> GSM99576     1  0.1843     0.9187 0.972 0.028
#> GSM99578     2  0.9922     0.2052 0.448 0.552
#> GSM99580     1  0.3274     0.9023 0.940 0.060
#> GSM99582     1  0.4161     0.8866 0.916 0.084
#> GSM99584     1  0.6531     0.8089 0.832 0.168
#> GSM99586     1  0.0000     0.9300 1.000 0.000
#> GSM99588     2  0.9775     0.3208 0.412 0.588
#> GSM99590     2  0.3114     0.8615 0.056 0.944

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM99496     3  0.0592    0.84592 0.012 0.000 0.988
#> GSM99502     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99504     1  0.1529    0.89514 0.960 0.000 0.040
#> GSM99506     3  0.0592    0.84592 0.012 0.000 0.988
#> GSM99566     3  0.0747    0.84615 0.016 0.000 0.984
#> GSM99574     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99592     3  0.0592    0.84592 0.012 0.000 0.988
#> GSM99594     3  0.0747    0.84615 0.016 0.000 0.984
#> GSM99468     1  0.1411    0.89802 0.964 0.000 0.036
#> GSM99498     1  0.1411    0.89802 0.964 0.000 0.036
#> GSM99500     1  0.1411    0.89802 0.964 0.000 0.036
#> GSM99508     3  0.0747    0.84600 0.016 0.000 0.984
#> GSM99568     3  0.1643    0.84054 0.044 0.000 0.956
#> GSM99596     3  0.1643    0.84175 0.044 0.000 0.956
#> GSM99600     3  0.6291    0.15627 0.000 0.468 0.532
#> GSM99458     3  0.5859    0.49065 0.344 0.000 0.656
#> GSM99460     1  0.6302    0.00632 0.520 0.000 0.480
#> GSM99510     3  0.0592    0.84592 0.012 0.000 0.988
#> GSM99512     3  0.0592    0.84592 0.012 0.000 0.988
#> GSM99514     3  0.0592    0.84592 0.012 0.000 0.988
#> GSM99516     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99518     1  0.1031    0.90484 0.976 0.000 0.024
#> GSM99520     3  0.1289    0.84412 0.032 0.000 0.968
#> GSM99522     3  0.1529    0.84291 0.040 0.000 0.960
#> GSM99570     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99598     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99432     3  0.4399    0.76674 0.000 0.188 0.812
#> GSM99434     3  0.0424    0.84569 0.008 0.000 0.992
#> GSM99436     3  0.5016    0.70517 0.000 0.240 0.760
#> GSM99438     2  0.1964    0.84923 0.000 0.944 0.056
#> GSM99440     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99442     2  0.6126    0.31655 0.000 0.600 0.400
#> GSM99444     2  0.2165    0.84746 0.000 0.936 0.064
#> GSM99446     3  0.5835    0.53807 0.000 0.340 0.660
#> GSM99448     3  0.2772    0.83816 0.004 0.080 0.916
#> GSM99450     3  0.1753    0.84042 0.048 0.000 0.952
#> GSM99452     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99454     1  0.0237    0.91322 0.996 0.000 0.004
#> GSM99456     1  0.0237    0.91272 0.996 0.000 0.004
#> GSM99462     2  0.0237    0.84122 0.000 0.996 0.004
#> GSM99464     3  0.3340    0.79539 0.120 0.000 0.880
#> GSM99466     3  0.3213    0.83157 0.008 0.092 0.900
#> GSM99470     1  0.8162    0.30232 0.568 0.084 0.348
#> GSM99472     1  0.8162    0.30232 0.568 0.084 0.348
#> GSM99474     3  0.2625    0.82152 0.084 0.000 0.916
#> GSM99476     3  0.3043    0.83438 0.008 0.084 0.908
#> GSM99478     3  0.3500    0.82181 0.004 0.116 0.880
#> GSM99480     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99482     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99484     3  0.4345    0.81046 0.016 0.136 0.848
#> GSM99486     3  0.4887    0.71852 0.000 0.228 0.772
#> GSM99488     2  0.0000    0.83950 0.000 1.000 0.000
#> GSM99490     2  0.3619    0.78909 0.000 0.864 0.136
#> GSM99492     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99494     2  0.0000    0.83950 0.000 1.000 0.000
#> GSM99524     1  0.0237    0.91322 0.996 0.000 0.004
#> GSM99526     3  0.1031    0.84712 0.024 0.000 0.976
#> GSM99528     3  0.3993    0.83425 0.052 0.064 0.884
#> GSM99530     3  0.4452    0.72077 0.192 0.000 0.808
#> GSM99532     3  0.4702    0.71111 0.212 0.000 0.788
#> GSM99534     3  0.8705    0.29608 0.116 0.360 0.524
#> GSM99536     1  0.0000    0.91390 1.000 0.000 0.000
#> GSM99538     3  0.3482    0.81201 0.000 0.128 0.872
#> GSM99540     3  0.5254    0.64658 0.264 0.000 0.736
#> GSM99542     2  0.0892    0.83172 0.020 0.980 0.000
#> GSM99544     3  0.3752    0.80051 0.000 0.144 0.856
#> GSM99546     3  0.5634    0.78493 0.056 0.144 0.800
#> GSM99548     2  0.0424    0.84161 0.000 0.992 0.008
#> GSM99550     1  0.1989    0.88228 0.948 0.004 0.048
#> GSM99552     3  0.2280    0.84665 0.008 0.052 0.940
#> GSM99554     3  0.5926    0.49588 0.000 0.356 0.644
#> GSM99556     2  0.0237    0.84122 0.000 0.996 0.004
#> GSM99558     3  0.2400    0.84239 0.004 0.064 0.932
#> GSM99560     3  0.3918    0.82254 0.012 0.120 0.868
#> GSM99562     3  0.0592    0.84592 0.012 0.000 0.988
#> GSM99564     3  0.4887    0.71852 0.000 0.228 0.772
#> GSM99572     2  0.2165    0.84733 0.000 0.936 0.064
#> GSM99576     3  0.6859    0.45556 0.356 0.024 0.620
#> GSM99578     2  0.6647    0.11314 0.008 0.540 0.452
#> GSM99580     3  0.2096    0.84393 0.004 0.052 0.944
#> GSM99582     3  0.4838    0.81987 0.076 0.076 0.848
#> GSM99584     3  0.4172    0.79221 0.004 0.156 0.840
#> GSM99586     1  0.0237    0.91264 0.996 0.000 0.004
#> GSM99588     2  0.6204    0.23875 0.000 0.576 0.424
#> GSM99590     2  0.2261    0.84538 0.000 0.932 0.068

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000     0.7748 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000     0.9050 1.000 0.000 0.000 0.000
#> GSM99504     1  0.1545     0.8911 0.952 0.000 0.040 0.008
#> GSM99506     3  0.0000     0.7748 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0336     0.7747 0.000 0.000 0.992 0.008
#> GSM99574     1  0.0000     0.9050 1.000 0.000 0.000 0.000
#> GSM99592     3  0.1557     0.7597 0.000 0.000 0.944 0.056
#> GSM99594     3  0.0336     0.7747 0.000 0.000 0.992 0.008
#> GSM99468     1  0.1452     0.8937 0.956 0.000 0.036 0.008
#> GSM99498     1  0.1452     0.8937 0.956 0.000 0.036 0.008
#> GSM99500     1  0.1452     0.8937 0.956 0.000 0.036 0.008
#> GSM99508     3  0.0188     0.7760 0.004 0.000 0.996 0.000
#> GSM99568     3  0.1356     0.7726 0.032 0.000 0.960 0.008
#> GSM99596     3  0.1209     0.7729 0.032 0.000 0.964 0.004
#> GSM99600     4  0.6805     0.5047 0.000 0.260 0.148 0.592
#> GSM99458     3  0.7296     0.2675 0.320 0.000 0.508 0.172
#> GSM99460     1  0.6817    -0.0171 0.492 0.000 0.408 0.100
#> GSM99510     3  0.2408     0.7303 0.000 0.000 0.896 0.104
#> GSM99512     3  0.0336     0.7752 0.000 0.000 0.992 0.008
#> GSM99514     3  0.0188     0.7756 0.004 0.000 0.996 0.000
#> GSM99516     1  0.0000     0.9050 1.000 0.000 0.000 0.000
#> GSM99518     1  0.1151     0.8989 0.968 0.000 0.024 0.008
#> GSM99520     3  0.1406     0.7765 0.016 0.000 0.960 0.024
#> GSM99522     3  0.2111     0.7662 0.024 0.000 0.932 0.044
#> GSM99570     1  0.0000     0.9050 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9050 1.000 0.000 0.000 0.000
#> GSM99432     4  0.5367     0.6944 0.000 0.032 0.304 0.664
#> GSM99434     3  0.3494     0.6768 0.004 0.000 0.824 0.172
#> GSM99436     4  0.4671     0.7054 0.000 0.028 0.220 0.752
#> GSM99438     2  0.3172     0.8760 0.000 0.840 0.000 0.160
#> GSM99440     1  0.0000     0.9050 1.000 0.000 0.000 0.000
#> GSM99442     4  0.6882     0.1641 0.000 0.392 0.108 0.500
#> GSM99444     2  0.3710     0.8590 0.000 0.804 0.004 0.192
#> GSM99446     4  0.6373     0.6841 0.000 0.148 0.200 0.652
#> GSM99448     3  0.4655     0.2879 0.000 0.004 0.684 0.312
#> GSM99450     3  0.3749     0.7190 0.032 0.000 0.840 0.128
#> GSM99452     1  0.0000     0.9050 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0188     0.9049 0.996 0.000 0.004 0.000
#> GSM99456     1  0.2593     0.8592 0.892 0.000 0.004 0.104
#> GSM99462     2  0.1792     0.8941 0.000 0.932 0.000 0.068
#> GSM99464     3  0.5250     0.6627 0.068 0.000 0.736 0.196
#> GSM99466     4  0.5183     0.5894 0.008 0.000 0.408 0.584
#> GSM99470     1  0.7513     0.2898 0.548 0.012 0.180 0.260
#> GSM99472     1  0.7513     0.2898 0.548 0.012 0.180 0.260
#> GSM99474     3  0.3198     0.7496 0.040 0.000 0.880 0.080
#> GSM99476     4  0.5257     0.5244 0.008 0.000 0.444 0.548
#> GSM99478     4  0.5039     0.6015 0.004 0.000 0.404 0.592
#> GSM99480     1  0.0000     0.9050 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0707     0.8999 0.980 0.000 0.000 0.020
#> GSM99484     4  0.5633     0.6544 0.016 0.012 0.348 0.624
#> GSM99486     4  0.4284     0.7046 0.000 0.012 0.224 0.764
#> GSM99488     2  0.0000     0.8808 0.000 1.000 0.000 0.000
#> GSM99490     2  0.4744     0.7747 0.000 0.736 0.024 0.240
#> GSM99492     1  0.1022     0.8973 0.968 0.000 0.000 0.032
#> GSM99494     2  0.0000     0.8808 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0188     0.9049 0.996 0.000 0.004 0.000
#> GSM99526     3  0.4391     0.6063 0.008 0.000 0.740 0.252
#> GSM99528     3  0.5633     0.3122 0.016 0.008 0.596 0.380
#> GSM99530     3  0.4881     0.6062 0.048 0.000 0.756 0.196
#> GSM99532     3  0.5664     0.6141 0.124 0.000 0.720 0.156
#> GSM99534     4  0.7228     0.5575 0.092 0.140 0.104 0.664
#> GSM99536     1  0.0336     0.9045 0.992 0.000 0.000 0.008
#> GSM99538     4  0.5099     0.6384 0.000 0.008 0.380 0.612
#> GSM99540     3  0.6282     0.5537 0.176 0.000 0.664 0.160
#> GSM99542     2  0.0817     0.8751 0.000 0.976 0.000 0.024
#> GSM99544     4  0.4973     0.6676 0.000 0.008 0.348 0.644
#> GSM99546     4  0.6163     0.4927 0.052 0.000 0.416 0.532
#> GSM99548     2  0.1389     0.8933 0.000 0.952 0.000 0.048
#> GSM99550     1  0.3862     0.8122 0.824 0.000 0.024 0.152
#> GSM99552     3  0.4535     0.3530 0.004 0.000 0.704 0.292
#> GSM99554     4  0.6096     0.6628 0.000 0.136 0.184 0.680
#> GSM99556     2  0.0707     0.8889 0.000 0.980 0.000 0.020
#> GSM99558     3  0.4313     0.4690 0.000 0.004 0.736 0.260
#> GSM99560     4  0.5263     0.3309 0.000 0.008 0.448 0.544
#> GSM99562     3  0.0188     0.7747 0.000 0.000 0.996 0.004
#> GSM99564     4  0.4284     0.7046 0.000 0.012 0.224 0.764
#> GSM99572     2  0.3668     0.8599 0.000 0.808 0.004 0.188
#> GSM99576     3  0.7285     0.3327 0.300 0.000 0.520 0.180
#> GSM99578     4  0.7479     0.2664 0.008 0.384 0.140 0.468
#> GSM99580     3  0.3494     0.6233 0.000 0.004 0.824 0.172
#> GSM99582     4  0.6438     0.4437 0.068 0.000 0.436 0.496
#> GSM99584     4  0.5232     0.6730 0.004 0.012 0.340 0.644
#> GSM99586     1  0.2888     0.8465 0.872 0.000 0.004 0.124
#> GSM99588     4  0.7253     0.1648 0.000 0.428 0.144 0.428
#> GSM99590     2  0.3626     0.8617 0.000 0.812 0.004 0.184

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0162      0.741 0.000 0.000 0.996 0.000 0.004
#> GSM99502     1  0.0000      0.877 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.1485      0.861 0.948 0.000 0.020 0.000 0.032
#> GSM99506     3  0.0162      0.742 0.000 0.000 0.996 0.000 0.004
#> GSM99566     3  0.1410      0.724 0.000 0.000 0.940 0.000 0.060
#> GSM99574     1  0.0000      0.877 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.3242      0.694 0.000 0.000 0.852 0.072 0.076
#> GSM99594     3  0.1410      0.724 0.000 0.000 0.940 0.000 0.060
#> GSM99468     1  0.1469      0.862 0.948 0.000 0.016 0.000 0.036
#> GSM99498     1  0.1386      0.863 0.952 0.000 0.016 0.000 0.032
#> GSM99500     1  0.1386      0.863 0.952 0.000 0.016 0.000 0.032
#> GSM99508     3  0.0404      0.741 0.000 0.000 0.988 0.000 0.012
#> GSM99568     3  0.1568      0.726 0.020 0.000 0.944 0.000 0.036
#> GSM99596     3  0.1493      0.725 0.024 0.000 0.948 0.000 0.028
#> GSM99600     4  0.4603      0.548 0.000 0.248 0.028 0.712 0.012
#> GSM99458     5  0.8282      0.408 0.256 0.000 0.168 0.192 0.384
#> GSM99460     1  0.7385     -0.207 0.444 0.000 0.136 0.072 0.348
#> GSM99510     3  0.4757      0.564 0.000 0.000 0.732 0.148 0.120
#> GSM99512     3  0.1522      0.738 0.000 0.000 0.944 0.012 0.044
#> GSM99514     3  0.0290      0.742 0.000 0.000 0.992 0.000 0.008
#> GSM99516     1  0.0000      0.877 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.1082      0.869 0.964 0.000 0.008 0.000 0.028
#> GSM99520     3  0.2196      0.729 0.004 0.000 0.916 0.024 0.056
#> GSM99522     3  0.3226      0.695 0.016 0.000 0.868 0.060 0.056
#> GSM99570     1  0.0162      0.876 0.996 0.000 0.000 0.000 0.004
#> GSM99598     1  0.0000      0.877 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.3666      0.702 0.000 0.020 0.092 0.840 0.048
#> GSM99434     3  0.6337      0.205 0.000 0.000 0.524 0.216 0.260
#> GSM99436     4  0.1731      0.701 0.000 0.012 0.040 0.940 0.008
#> GSM99438     2  0.3010      0.854 0.000 0.824 0.000 0.172 0.004
#> GSM99440     1  0.0000      0.877 1.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.4759      0.223 0.000 0.380 0.008 0.600 0.012
#> GSM99444     2  0.3353      0.838 0.000 0.796 0.000 0.196 0.008
#> GSM99446     4  0.4036      0.676 0.000 0.132 0.052 0.804 0.012
#> GSM99448     3  0.5568      0.267 0.000 0.000 0.540 0.384 0.076
#> GSM99450     3  0.6366      0.320 0.016 0.000 0.576 0.164 0.244
#> GSM99452     1  0.0162      0.876 0.996 0.000 0.000 0.000 0.004
#> GSM99454     1  0.0162      0.877 0.996 0.000 0.000 0.000 0.004
#> GSM99456     1  0.2966      0.754 0.816 0.000 0.000 0.000 0.184
#> GSM99462     2  0.1704      0.879 0.000 0.928 0.000 0.068 0.004
#> GSM99464     5  0.6178      0.471 0.020 0.000 0.244 0.132 0.604
#> GSM99466     4  0.4541      0.626 0.000 0.000 0.172 0.744 0.084
#> GSM99470     1  0.7027      0.119 0.512 0.004 0.064 0.324 0.096
#> GSM99472     1  0.7027      0.119 0.512 0.004 0.064 0.324 0.096
#> GSM99474     3  0.4617      0.554 0.016 0.000 0.744 0.044 0.196
#> GSM99476     4  0.5091      0.579 0.000 0.000 0.196 0.692 0.112
#> GSM99478     4  0.4573      0.641 0.000 0.000 0.164 0.744 0.092
#> GSM99480     1  0.0162      0.876 0.996 0.000 0.000 0.000 0.004
#> GSM99482     1  0.1124      0.860 0.960 0.000 0.000 0.004 0.036
#> GSM99484     4  0.4153      0.669 0.004 0.004 0.116 0.800 0.076
#> GSM99486     4  0.1569      0.701 0.000 0.004 0.044 0.944 0.008
#> GSM99488     2  0.0290      0.861 0.000 0.992 0.000 0.000 0.008
#> GSM99490     2  0.3942      0.757 0.000 0.728 0.000 0.260 0.012
#> GSM99492     1  0.1043      0.865 0.960 0.000 0.000 0.000 0.040
#> GSM99494     2  0.0290      0.861 0.000 0.992 0.000 0.000 0.008
#> GSM99524     1  0.0162      0.877 0.996 0.000 0.000 0.000 0.004
#> GSM99526     5  0.6731      0.255 0.000 0.000 0.304 0.280 0.416
#> GSM99528     5  0.6378      0.135 0.008 0.004 0.112 0.404 0.472
#> GSM99530     5  0.3870      0.442 0.004 0.000 0.260 0.004 0.732
#> GSM99532     5  0.6450      0.495 0.084 0.000 0.320 0.044 0.552
#> GSM99534     4  0.4915      0.592 0.032 0.132 0.000 0.756 0.080
#> GSM99536     1  0.0404      0.876 0.988 0.000 0.000 0.000 0.012
#> GSM99538     4  0.4203      0.672 0.000 0.000 0.128 0.780 0.092
#> GSM99540     5  0.6795      0.542 0.136 0.000 0.260 0.048 0.556
#> GSM99542     2  0.0955      0.854 0.000 0.968 0.000 0.004 0.028
#> GSM99544     4  0.3601      0.685 0.000 0.000 0.128 0.820 0.052
#> GSM99546     4  0.5505      0.489 0.004 0.000 0.128 0.660 0.208
#> GSM99548     2  0.1357      0.878 0.000 0.948 0.000 0.048 0.004
#> GSM99550     1  0.3942      0.681 0.748 0.000 0.000 0.020 0.232
#> GSM99552     3  0.4874      0.326 0.000 0.000 0.600 0.368 0.032
#> GSM99554     4  0.3653      0.664 0.000 0.124 0.036 0.828 0.012
#> GSM99556     2  0.0771      0.872 0.000 0.976 0.000 0.020 0.004
#> GSM99558     3  0.5006      0.424 0.000 0.000 0.624 0.328 0.048
#> GSM99560     4  0.5024      0.371 0.000 0.004 0.044 0.640 0.312
#> GSM99562     3  0.0955      0.738 0.000 0.000 0.968 0.004 0.028
#> GSM99564     4  0.1569      0.701 0.000 0.004 0.044 0.944 0.008
#> GSM99572     2  0.3462      0.836 0.000 0.792 0.000 0.196 0.012
#> GSM99576     5  0.7519      0.496 0.268 0.000 0.128 0.112 0.492
#> GSM99578     4  0.5368      0.291 0.000 0.376 0.020 0.576 0.028
#> GSM99580     3  0.4400      0.570 0.000 0.000 0.736 0.212 0.052
#> GSM99582     4  0.6366      0.465 0.036 0.000 0.224 0.608 0.132
#> GSM99584     4  0.3825      0.680 0.000 0.000 0.136 0.804 0.060
#> GSM99586     1  0.3143      0.736 0.796 0.000 0.000 0.000 0.204
#> GSM99588     4  0.5726      0.199 0.000 0.420 0.056 0.512 0.012
#> GSM99590     2  0.3231      0.840 0.000 0.800 0.000 0.196 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4 p5    p6
#> GSM99496     3  0.0632     0.7229 0.000 0.000 0.976 0.024 NA 0.000
#> GSM99502     1  0.0000     0.8507 1.000 0.000 0.000 0.000 NA 0.000
#> GSM99504     1  0.1636     0.8366 0.936 0.000 0.024 0.000 NA 0.036
#> GSM99506     3  0.0891     0.7230 0.000 0.000 0.968 0.024 NA 0.000
#> GSM99566     3  0.2163     0.6770 0.000 0.000 0.892 0.000 NA 0.016
#> GSM99574     1  0.0000     0.8507 1.000 0.000 0.000 0.000 NA 0.000
#> GSM99592     3  0.4688     0.6426 0.000 0.000 0.748 0.076 NA 0.080
#> GSM99594     3  0.2112     0.6778 0.000 0.000 0.896 0.000 NA 0.016
#> GSM99468     1  0.1693     0.8368 0.932 0.000 0.020 0.000 NA 0.044
#> GSM99498     1  0.1552     0.8385 0.940 0.000 0.020 0.000 NA 0.036
#> GSM99500     1  0.1552     0.8385 0.940 0.000 0.020 0.000 NA 0.036
#> GSM99508     3  0.0891     0.7230 0.000 0.000 0.968 0.024 NA 0.008
#> GSM99568     3  0.2145     0.7134 0.016 0.000 0.920 0.020 NA 0.032
#> GSM99596     3  0.1892     0.7128 0.020 0.000 0.932 0.020 NA 0.020
#> GSM99600     4  0.3665     0.5456 0.000 0.252 0.000 0.728 NA 0.000
#> GSM99458     6  0.7691     0.4206 0.240 0.000 0.044 0.128 NA 0.448
#> GSM99460     1  0.6834    -0.1791 0.416 0.000 0.032 0.044 NA 0.396
#> GSM99510     3  0.6487     0.4095 0.000 0.000 0.564 0.128 NA 0.152
#> GSM99512     3  0.3167     0.6768 0.000 0.000 0.836 0.012 NA 0.032
#> GSM99514     3  0.0777     0.7233 0.000 0.000 0.972 0.024 NA 0.000
#> GSM99516     1  0.0000     0.8507 1.000 0.000 0.000 0.000 NA 0.000
#> GSM99518     1  0.1226     0.8443 0.952 0.000 0.004 0.000 NA 0.040
#> GSM99520     3  0.2782     0.7048 0.000 0.000 0.876 0.032 NA 0.068
#> GSM99522     3  0.4559     0.6467 0.016 0.000 0.776 0.064 NA 0.080
#> GSM99570     1  0.0363     0.8497 0.988 0.000 0.000 0.000 NA 0.000
#> GSM99598     1  0.0000     0.8507 1.000 0.000 0.000 0.000 NA 0.000
#> GSM99432     4  0.2990     0.6991 0.000 0.020 0.008 0.872 NA 0.048
#> GSM99434     6  0.7504     0.1514 0.000 0.000 0.276 0.168 NA 0.356
#> GSM99436     4  0.1003     0.7001 0.000 0.016 0.000 0.964 NA 0.000
#> GSM99438     2  0.2859     0.8449 0.000 0.828 0.000 0.156 NA 0.000
#> GSM99440     1  0.0146     0.8502 0.996 0.000 0.000 0.000 NA 0.000
#> GSM99442     4  0.4409     0.2350 0.000 0.380 0.000 0.588 NA 0.000
#> GSM99444     2  0.3136     0.8254 0.000 0.796 0.000 0.188 NA 0.000
#> GSM99446     4  0.3074     0.6787 0.000 0.132 0.004 0.836 NA 0.004
#> GSM99448     3  0.6391     0.1283 0.000 0.000 0.420 0.412 NA 0.076
#> GSM99450     3  0.7631    -0.0394 0.016 0.000 0.380 0.132 NA 0.296
#> GSM99452     1  0.0458     0.8492 0.984 0.000 0.000 0.000 NA 0.000
#> GSM99454     1  0.0405     0.8509 0.988 0.000 0.000 0.000 NA 0.008
#> GSM99456     1  0.4650     0.6289 0.688 0.000 0.000 0.000 NA 0.132
#> GSM99462     2  0.1584     0.8704 0.000 0.928 0.000 0.064 NA 0.000
#> GSM99464     6  0.4928     0.5503 0.008 0.000 0.060 0.064 NA 0.732
#> GSM99466     4  0.4828     0.6217 0.000 0.000 0.072 0.736 NA 0.096
#> GSM99470     1  0.6834     0.1237 0.484 0.000 0.024 0.288 NA 0.040
#> GSM99472     1  0.6834     0.1237 0.484 0.000 0.024 0.288 NA 0.040
#> GSM99474     3  0.5135     0.5131 0.008 0.000 0.664 0.048 NA 0.244
#> GSM99476     4  0.5260     0.5879 0.000 0.000 0.080 0.696 NA 0.128
#> GSM99478     4  0.4557     0.6442 0.000 0.000 0.060 0.756 NA 0.108
#> GSM99480     1  0.1049     0.8443 0.960 0.000 0.000 0.000 NA 0.008
#> GSM99482     1  0.1327     0.8283 0.936 0.000 0.000 0.000 NA 0.000
#> GSM99484     4  0.4327     0.6564 0.000 0.004 0.028 0.772 NA 0.084
#> GSM99486     4  0.0972     0.6982 0.000 0.008 0.000 0.964 NA 0.000
#> GSM99488     2  0.0632     0.8492 0.000 0.976 0.000 0.000 NA 0.000
#> GSM99490     2  0.4050     0.7424 0.000 0.716 0.000 0.236 NA 0.000
#> GSM99492     1  0.2309     0.8091 0.888 0.000 0.000 0.000 NA 0.028
#> GSM99494     2  0.0632     0.8492 0.000 0.976 0.000 0.000 NA 0.000
#> GSM99524     1  0.0405     0.8509 0.988 0.000 0.000 0.000 NA 0.008
#> GSM99526     6  0.6514     0.4129 0.000 0.000 0.068 0.180 NA 0.524
#> GSM99528     6  0.6352     0.1464 0.000 0.000 0.044 0.328 NA 0.480
#> GSM99530     6  0.5371     0.4238 0.000 0.000 0.176 0.000 NA 0.584
#> GSM99532     6  0.4933     0.4948 0.068 0.000 0.224 0.012 NA 0.684
#> GSM99534     4  0.5494     0.5195 0.008 0.104 0.000 0.588 NA 0.008
#> GSM99536     1  0.0909     0.8485 0.968 0.000 0.000 0.000 NA 0.012
#> GSM99538     4  0.3859     0.6653 0.000 0.000 0.028 0.804 NA 0.088
#> GSM99540     6  0.4976     0.5379 0.112 0.000 0.160 0.012 NA 0.704
#> GSM99542     2  0.1387     0.8363 0.000 0.932 0.000 0.000 NA 0.000
#> GSM99544     4  0.3284     0.6786 0.000 0.000 0.024 0.844 NA 0.052
#> GSM99546     4  0.6161     0.3687 0.000 0.004 0.012 0.504 NA 0.220
#> GSM99548     2  0.1562     0.8665 0.000 0.940 0.000 0.024 NA 0.004
#> GSM99550     1  0.5277     0.5381 0.620 0.000 0.000 0.004 NA 0.172
#> GSM99552     3  0.5101     0.3181 0.000 0.000 0.544 0.392 NA 0.020
#> GSM99554     4  0.2826     0.6638 0.000 0.128 0.000 0.844 NA 0.000
#> GSM99556     2  0.0603     0.8642 0.000 0.980 0.000 0.016 NA 0.000
#> GSM99558     3  0.5774     0.3733 0.000 0.000 0.528 0.356 NA 0.052
#> GSM99560     4  0.5377     0.3435 0.000 0.004 0.012 0.596 NA 0.296
#> GSM99562     3  0.2122     0.6921 0.000 0.000 0.900 0.000 NA 0.024
#> GSM99564     4  0.0972     0.6982 0.000 0.008 0.000 0.964 NA 0.000
#> GSM99572     2  0.3312     0.8256 0.000 0.792 0.000 0.180 NA 0.000
#> GSM99576     6  0.7282     0.4745 0.228 0.000 0.068 0.084 NA 0.516
#> GSM99578     4  0.5328     0.3102 0.000 0.364 0.008 0.556 NA 0.012
#> GSM99580     3  0.5291     0.5265 0.000 0.000 0.652 0.232 NA 0.056
#> GSM99582     4  0.6109     0.4771 0.016 0.000 0.152 0.624 NA 0.152
#> GSM99584     4  0.3375     0.6777 0.000 0.000 0.008 0.828 NA 0.088
#> GSM99586     1  0.4843     0.6018 0.664 0.000 0.000 0.000 NA 0.144
#> GSM99588     4  0.4936     0.2209 0.000 0.408 0.016 0.540 NA 0.000
#> GSM99590     2  0.3104     0.8275 0.000 0.800 0.000 0.184 NA 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) cell.type(p) k
#> CV:hclust 78         3.49e-02      0.10965 2
#> CV:hclust 74         2.19e-02      0.24306 3
#> CV:hclust 70         5.52e-04      0.02966 4
#> CV:hclust 64         1.75e-05      0.00491 5
#> CV:hclust 64         2.21e-05      0.00549 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.651           0.888       0.937         0.4847 0.514   0.514
#> 3 3 0.984           0.954       0.978         0.3830 0.718   0.499
#> 4 4 0.720           0.700       0.820         0.1074 0.876   0.646
#> 5 5 0.736           0.660       0.831         0.0625 0.897   0.640
#> 6 6 0.773           0.634       0.803         0.0416 0.952   0.794

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
#> GSM99496     1  0.7602      0.795 0.780 0.220
#> GSM99502     1  0.0000      0.894 1.000 0.000
#> GSM99504     1  0.0000      0.894 1.000 0.000
#> GSM99506     1  0.7602      0.795 0.780 0.220
#> GSM99566     1  0.7602      0.795 0.780 0.220
#> GSM99574     1  0.0000      0.894 1.000 0.000
#> GSM99592     1  0.7883      0.778 0.764 0.236
#> GSM99594     1  0.7602      0.795 0.780 0.220
#> GSM99468     1  0.0000      0.894 1.000 0.000
#> GSM99498     1  0.0000      0.894 1.000 0.000
#> GSM99500     1  0.0000      0.894 1.000 0.000
#> GSM99508     1  0.6048      0.840 0.852 0.148
#> GSM99568     1  0.7453      0.801 0.788 0.212
#> GSM99596     1  0.1184      0.891 0.984 0.016
#> GSM99600     2  0.0000      0.986 0.000 1.000
#> GSM99458     1  0.0000      0.894 1.000 0.000
#> GSM99460     1  0.0000      0.894 1.000 0.000
#> GSM99510     1  0.9460      0.589 0.636 0.364
#> GSM99512     1  0.9460      0.589 0.636 0.364
#> GSM99514     1  0.7602      0.795 0.780 0.220
#> GSM99516     1  0.0000      0.894 1.000 0.000
#> GSM99518     1  0.0000      0.894 1.000 0.000
#> GSM99520     1  0.7602      0.795 0.780 0.220
#> GSM99522     1  0.0000      0.894 1.000 0.000
#> GSM99570     1  0.0000      0.894 1.000 0.000
#> GSM99598     1  0.0000      0.894 1.000 0.000
#> GSM99432     2  0.0000      0.986 0.000 1.000
#> GSM99434     1  0.8909      0.683 0.692 0.308
#> GSM99436     2  0.0000      0.986 0.000 1.000
#> GSM99438     2  0.0000      0.986 0.000 1.000
#> GSM99440     1  0.0000      0.894 1.000 0.000
#> GSM99442     2  0.0000      0.986 0.000 1.000
#> GSM99444     2  0.0000      0.986 0.000 1.000
#> GSM99446     2  0.0000      0.986 0.000 1.000
#> GSM99448     2  0.0000      0.986 0.000 1.000
#> GSM99450     1  0.6438      0.831 0.836 0.164
#> GSM99452     1  0.0000      0.894 1.000 0.000
#> GSM99454     1  0.0000      0.894 1.000 0.000
#> GSM99456     1  0.0000      0.894 1.000 0.000
#> GSM99462     2  0.0000      0.986 0.000 1.000
#> GSM99464     1  0.0376      0.894 0.996 0.004
#> GSM99466     2  0.0000      0.986 0.000 1.000
#> GSM99470     1  0.5294      0.853 0.880 0.120
#> GSM99472     1  0.0000      0.894 1.000 0.000
#> GSM99474     1  0.7602      0.795 0.780 0.220
#> GSM99476     2  0.0000      0.986 0.000 1.000
#> GSM99478     2  0.0000      0.986 0.000 1.000
#> GSM99480     1  0.0000      0.894 1.000 0.000
#> GSM99482     1  0.0000      0.894 1.000 0.000
#> GSM99484     2  0.0000      0.986 0.000 1.000
#> GSM99486     2  0.0000      0.986 0.000 1.000
#> GSM99488     2  0.0000      0.986 0.000 1.000
#> GSM99490     2  0.0000      0.986 0.000 1.000
#> GSM99492     1  0.0000      0.894 1.000 0.000
#> GSM99494     2  0.0000      0.986 0.000 1.000
#> GSM99524     1  0.0000      0.894 1.000 0.000
#> GSM99526     1  0.9460      0.589 0.636 0.364
#> GSM99528     2  0.5519      0.821 0.128 0.872
#> GSM99530     1  0.2948      0.878 0.948 0.052
#> GSM99532     1  0.0376      0.894 0.996 0.004
#> GSM99534     2  0.0000      0.986 0.000 1.000
#> GSM99536     1  0.0000      0.894 1.000 0.000
#> GSM99538     2  0.0000      0.986 0.000 1.000
#> GSM99540     1  0.0000      0.894 1.000 0.000
#> GSM99542     2  0.0000      0.986 0.000 1.000
#> GSM99544     2  0.0000      0.986 0.000 1.000
#> GSM99546     2  0.8443      0.537 0.272 0.728
#> GSM99548     2  0.0000      0.986 0.000 1.000
#> GSM99550     1  0.0000      0.894 1.000 0.000
#> GSM99552     1  0.9988      0.297 0.520 0.480
#> GSM99554     2  0.0000      0.986 0.000 1.000
#> GSM99556     2  0.0000      0.986 0.000 1.000
#> GSM99558     2  0.0000      0.986 0.000 1.000
#> GSM99560     2  0.0000      0.986 0.000 1.000
#> GSM99562     1  0.7602      0.795 0.780 0.220
#> GSM99564     2  0.0000      0.986 0.000 1.000
#> GSM99572     2  0.0000      0.986 0.000 1.000
#> GSM99576     1  0.0000      0.894 1.000 0.000
#> GSM99578     2  0.0000      0.986 0.000 1.000
#> GSM99580     1  0.7602      0.795 0.780 0.220
#> GSM99582     1  0.6343      0.833 0.840 0.160
#> GSM99584     2  0.0000      0.986 0.000 1.000
#> GSM99586     1  0.0000      0.894 1.000 0.000
#> GSM99588     2  0.0000      0.986 0.000 1.000
#> GSM99590     2  0.0000      0.986 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
#> GSM99496     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99502     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99506     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99566     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99574     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99592     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99594     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99468     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99508     3  0.0475      0.981 0.004 0.004 0.992
#> GSM99568     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99596     3  0.0424      0.978 0.008 0.000 0.992
#> GSM99600     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99460     1  0.0237      0.997 0.996 0.000 0.004
#> GSM99510     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99512     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99514     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99516     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99518     1  0.0237      0.997 0.996 0.000 0.004
#> GSM99520     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99522     3  0.0424      0.978 0.008 0.000 0.992
#> GSM99570     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99432     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99434     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99436     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99448     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99450     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99452     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99456     1  0.0424      0.996 0.992 0.000 0.008
#> GSM99462     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99464     3  0.0000      0.979 0.000 0.000 1.000
#> GSM99466     3  0.3482      0.863 0.000 0.128 0.872
#> GSM99470     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99472     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99474     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99476     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99478     2  0.5650      0.551 0.000 0.688 0.312
#> GSM99480     1  0.0424      0.996 0.992 0.000 0.008
#> GSM99482     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99484     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99486     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99488     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99492     1  0.0424      0.996 0.992 0.000 0.008
#> GSM99494     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99526     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99528     3  0.3412      0.868 0.000 0.124 0.876
#> GSM99530     3  0.0000      0.979 0.000 0.000 1.000
#> GSM99532     3  0.0237      0.979 0.004 0.000 0.996
#> GSM99534     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99536     1  0.0237      0.997 0.996 0.000 0.004
#> GSM99538     3  0.3551      0.858 0.000 0.132 0.868
#> GSM99540     1  0.0237      0.997 0.996 0.000 0.004
#> GSM99542     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99544     2  0.6260      0.204 0.000 0.552 0.448
#> GSM99546     3  0.1529      0.957 0.000 0.040 0.960
#> GSM99548     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99550     1  0.0424      0.996 0.992 0.000 0.008
#> GSM99552     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99554     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99558     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99560     2  0.1163      0.930 0.000 0.972 0.028
#> GSM99562     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99564     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99572     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99576     1  0.0424      0.996 0.992 0.000 0.008
#> GSM99578     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99580     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99582     3  0.0424      0.984 0.000 0.008 0.992
#> GSM99584     2  0.5948      0.449 0.000 0.640 0.360
#> GSM99586     1  0.0424      0.996 0.992 0.000 0.008
#> GSM99588     2  0.0000      0.954 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.954 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99502     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0188    0.91605 0.996 0.000 0.004 0.000
#> GSM99506     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99566     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99574     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99592     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99594     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99468     1  0.0188    0.91730 0.996 0.000 0.000 0.004
#> GSM99498     1  0.0188    0.91730 0.996 0.000 0.000 0.004
#> GSM99500     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000    0.88594 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000    0.88594 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99600     2  0.4605    0.53468 0.000 0.664 0.000 0.336
#> GSM99458     1  0.2647    0.87096 0.880 0.000 0.000 0.120
#> GSM99460     1  0.4800    0.70245 0.656 0.000 0.004 0.340
#> GSM99510     3  0.3873    0.67277 0.000 0.000 0.772 0.228
#> GSM99512     3  0.0336    0.88399 0.000 0.000 0.992 0.008
#> GSM99514     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99516     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99518     1  0.1389    0.90765 0.952 0.000 0.000 0.048
#> GSM99520     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99522     3  0.0188    0.88490 0.000 0.000 0.996 0.004
#> GSM99570     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99432     4  0.4746    0.37094 0.000 0.368 0.000 0.632
#> GSM99434     3  0.4304    0.58331 0.000 0.000 0.716 0.284
#> GSM99436     2  0.4933    0.28965 0.000 0.568 0.000 0.432
#> GSM99438     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0188    0.91730 0.996 0.000 0.000 0.004
#> GSM99442     2  0.1867    0.76855 0.000 0.928 0.000 0.072
#> GSM99444     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99446     2  0.4761    0.46571 0.000 0.628 0.000 0.372
#> GSM99448     3  0.3486    0.72345 0.000 0.000 0.812 0.188
#> GSM99450     3  0.4564    0.53505 0.000 0.000 0.672 0.328
#> GSM99452     1  0.0188    0.91730 0.996 0.000 0.000 0.004
#> GSM99454     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99456     1  0.4277    0.78658 0.720 0.000 0.000 0.280
#> GSM99462     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99464     4  0.4933   -0.18185 0.000 0.000 0.432 0.568
#> GSM99466     4  0.6327    0.58433 0.000 0.124 0.228 0.648
#> GSM99470     1  0.4830    0.39506 0.608 0.000 0.000 0.392
#> GSM99472     1  0.2216    0.88220 0.908 0.000 0.000 0.092
#> GSM99474     3  0.0188    0.88497 0.000 0.000 0.996 0.004
#> GSM99476     4  0.4679    0.42287 0.000 0.000 0.352 0.648
#> GSM99478     4  0.6089    0.51295 0.000 0.280 0.080 0.640
#> GSM99480     1  0.2469    0.88355 0.892 0.000 0.000 0.108
#> GSM99482     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99484     4  0.4855    0.30120 0.000 0.400 0.000 0.600
#> GSM99486     4  0.4877    0.28120 0.000 0.408 0.000 0.592
#> GSM99488     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99490     2  0.1867    0.76860 0.000 0.928 0.000 0.072
#> GSM99492     1  0.2530    0.88196 0.888 0.000 0.000 0.112
#> GSM99494     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0000    0.91748 1.000 0.000 0.000 0.000
#> GSM99526     4  0.4222    0.36244 0.000 0.000 0.272 0.728
#> GSM99528     4  0.4188    0.59812 0.000 0.040 0.148 0.812
#> GSM99530     3  0.3942    0.65915 0.000 0.000 0.764 0.236
#> GSM99532     3  0.2149    0.82186 0.000 0.000 0.912 0.088
#> GSM99534     2  0.4761    0.48000 0.000 0.628 0.000 0.372
#> GSM99536     1  0.1637    0.90199 0.940 0.000 0.000 0.060
#> GSM99538     4  0.5633    0.60204 0.000 0.100 0.184 0.716
#> GSM99540     1  0.4040    0.79087 0.752 0.000 0.000 0.248
#> GSM99542     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99544     4  0.5883    0.49119 0.000 0.300 0.060 0.640
#> GSM99546     4  0.2799    0.57710 0.000 0.008 0.108 0.884
#> GSM99548     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99550     4  0.4936   -0.20557 0.372 0.000 0.004 0.624
#> GSM99552     3  0.3074    0.72155 0.000 0.000 0.848 0.152
#> GSM99554     2  0.4697    0.49968 0.000 0.644 0.000 0.356
#> GSM99556     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99558     4  0.4977    0.20634 0.000 0.000 0.460 0.540
#> GSM99560     4  0.3837    0.50998 0.000 0.224 0.000 0.776
#> GSM99562     3  0.0188    0.88490 0.000 0.000 0.996 0.004
#> GSM99564     4  0.4877    0.28120 0.000 0.408 0.000 0.592
#> GSM99572     2  0.0000    0.79310 0.000 1.000 0.000 0.000
#> GSM99576     1  0.4454    0.74496 0.692 0.000 0.000 0.308
#> GSM99578     2  0.4585    0.54039 0.000 0.668 0.000 0.332
#> GSM99580     3  0.0188    0.88702 0.000 0.000 0.996 0.004
#> GSM99582     3  0.4985   -0.00104 0.000 0.000 0.532 0.468
#> GSM99584     4  0.4964    0.51305 0.000 0.256 0.028 0.716
#> GSM99586     1  0.3726    0.82837 0.788 0.000 0.000 0.212
#> GSM99588     2  0.4304    0.59787 0.000 0.716 0.000 0.284
#> GSM99590     2  0.0000    0.79310 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0162     0.8371 0.000 0.000 0.996 0.000 0.004
#> GSM99502     1  0.0000     0.8519 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.1043     0.8162 0.960 0.000 0.040 0.000 0.000
#> GSM99506     3  0.0162     0.8371 0.000 0.000 0.996 0.000 0.004
#> GSM99566     3  0.0510     0.8331 0.000 0.000 0.984 0.000 0.016
#> GSM99574     1  0.0000     0.8519 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000     0.8377 0.000 0.000 1.000 0.000 0.000
#> GSM99594     3  0.0510     0.8331 0.000 0.000 0.984 0.000 0.016
#> GSM99468     1  0.0000     0.8519 1.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.8519 1.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.8519 1.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.8377 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0000     0.8377 0.000 0.000 1.000 0.000 0.000
#> GSM99596     3  0.0000     0.8377 0.000 0.000 1.000 0.000 0.000
#> GSM99600     4  0.3274     0.6548 0.000 0.220 0.000 0.780 0.000
#> GSM99458     1  0.4591     0.3868 0.648 0.008 0.000 0.012 0.332
#> GSM99460     5  0.4397     0.4318 0.276 0.000 0.000 0.028 0.696
#> GSM99510     3  0.5808     0.4899 0.000 0.000 0.608 0.160 0.232
#> GSM99512     3  0.2522     0.7833 0.000 0.000 0.880 0.012 0.108
#> GSM99514     3  0.0000     0.8377 0.000 0.000 1.000 0.000 0.000
#> GSM99516     1  0.0000     0.8519 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.1965     0.7919 0.904 0.000 0.000 0.000 0.096
#> GSM99520     3  0.0000     0.8377 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0000     0.8377 0.000 0.000 1.000 0.000 0.000
#> GSM99570     1  0.0162     0.8511 0.996 0.004 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.8519 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.2325     0.7141 0.000 0.028 0.000 0.904 0.068
#> GSM99434     3  0.6287     0.3440 0.000 0.000 0.512 0.176 0.312
#> GSM99436     4  0.2605     0.7137 0.000 0.148 0.000 0.852 0.000
#> GSM99438     2  0.1410     0.9562 0.000 0.940 0.000 0.060 0.000
#> GSM99440     1  0.0000     0.8519 1.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.4302     0.0197 0.000 0.480 0.000 0.520 0.000
#> GSM99444     2  0.1410     0.9562 0.000 0.940 0.000 0.060 0.000
#> GSM99446     4  0.2966     0.6898 0.000 0.184 0.000 0.816 0.000
#> GSM99448     3  0.5472     0.5423 0.000 0.000 0.652 0.208 0.140
#> GSM99450     3  0.6235     0.3106 0.000 0.000 0.500 0.156 0.344
#> GSM99452     1  0.0290     0.8502 0.992 0.008 0.000 0.000 0.000
#> GSM99454     1  0.0162     0.8512 0.996 0.004 0.000 0.000 0.000
#> GSM99456     5  0.5299    -0.0560 0.436 0.040 0.000 0.004 0.520
#> GSM99462     2  0.1571     0.9559 0.000 0.936 0.000 0.060 0.004
#> GSM99464     5  0.4219     0.4762 0.000 0.000 0.116 0.104 0.780
#> GSM99466     4  0.3708     0.6842 0.000 0.004 0.044 0.816 0.136
#> GSM99470     4  0.7071    -0.0675 0.360 0.020 0.000 0.412 0.208
#> GSM99472     1  0.4208     0.6135 0.760 0.020 0.000 0.016 0.204
#> GSM99474     3  0.1205     0.8188 0.000 0.000 0.956 0.004 0.040
#> GSM99476     4  0.4373     0.5863 0.000 0.000 0.080 0.760 0.160
#> GSM99478     4  0.3357     0.7038 0.000 0.016 0.012 0.836 0.136
#> GSM99480     1  0.4370     0.5949 0.724 0.040 0.000 0.000 0.236
#> GSM99482     1  0.1059     0.8387 0.968 0.020 0.000 0.004 0.008
#> GSM99484     4  0.2708     0.7282 0.000 0.044 0.000 0.884 0.072
#> GSM99486     4  0.1410     0.7343 0.000 0.060 0.000 0.940 0.000
#> GSM99488     2  0.1914     0.9516 0.000 0.924 0.000 0.060 0.016
#> GSM99490     2  0.4118     0.4994 0.000 0.660 0.000 0.336 0.004
#> GSM99492     1  0.4503     0.5677 0.704 0.040 0.000 0.000 0.256
#> GSM99494     2  0.1914     0.9516 0.000 0.924 0.000 0.060 0.016
#> GSM99524     1  0.0451     0.8486 0.988 0.008 0.000 0.000 0.004
#> GSM99526     5  0.5409     0.2532 0.000 0.000 0.080 0.316 0.604
#> GSM99528     4  0.4478     0.4357 0.000 0.004 0.008 0.628 0.360
#> GSM99530     3  0.4713     0.2725 0.000 0.000 0.544 0.016 0.440
#> GSM99532     3  0.3530     0.6737 0.000 0.000 0.784 0.012 0.204
#> GSM99534     4  0.5581     0.5726 0.000 0.224 0.000 0.636 0.140
#> GSM99536     1  0.3123     0.7140 0.828 0.012 0.000 0.000 0.160
#> GSM99538     4  0.4114     0.5218 0.000 0.000 0.016 0.712 0.272
#> GSM99540     1  0.4452    -0.0547 0.500 0.000 0.000 0.004 0.496
#> GSM99542     2  0.1774     0.9370 0.000 0.932 0.000 0.052 0.016
#> GSM99544     4  0.3293     0.6521 0.000 0.008 0.008 0.824 0.160
#> GSM99546     5  0.4449    -0.1612 0.000 0.000 0.004 0.484 0.512
#> GSM99548     2  0.1410     0.9562 0.000 0.940 0.000 0.060 0.000
#> GSM99550     5  0.4232     0.5041 0.152 0.040 0.000 0.020 0.788
#> GSM99552     3  0.2735     0.7544 0.000 0.000 0.880 0.084 0.036
#> GSM99554     4  0.3074     0.6776 0.000 0.196 0.000 0.804 0.000
#> GSM99556     2  0.1571     0.9559 0.000 0.936 0.000 0.060 0.004
#> GSM99558     4  0.4088     0.6141 0.000 0.000 0.168 0.776 0.056
#> GSM99560     4  0.3399     0.6543 0.000 0.020 0.000 0.812 0.168
#> GSM99562     3  0.0162     0.8371 0.000 0.000 0.996 0.000 0.004
#> GSM99564     4  0.1410     0.7343 0.000 0.060 0.000 0.940 0.000
#> GSM99572     2  0.1608     0.9480 0.000 0.928 0.000 0.072 0.000
#> GSM99576     5  0.4682     0.1230 0.420 0.000 0.000 0.016 0.564
#> GSM99578     4  0.4269     0.6731 0.000 0.188 0.000 0.756 0.056
#> GSM99580     3  0.0000     0.8377 0.000 0.000 1.000 0.000 0.000
#> GSM99582     3  0.6315     0.0052 0.000 0.000 0.448 0.396 0.156
#> GSM99584     4  0.3010     0.6459 0.000 0.004 0.000 0.824 0.172
#> GSM99586     1  0.5137     0.2215 0.536 0.040 0.000 0.000 0.424
#> GSM99588     4  0.3957     0.5706 0.000 0.280 0.000 0.712 0.008
#> GSM99590     2  0.1410     0.9562 0.000 0.940 0.000 0.060 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0146    0.82340 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99502     1  0.0000    0.79818 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.1155    0.77315 0.956 0.000 0.036 0.000 0.004 0.004
#> GSM99506     3  0.0717    0.82060 0.000 0.000 0.976 0.000 0.008 0.016
#> GSM99566     3  0.1297    0.80820 0.000 0.000 0.948 0.000 0.012 0.040
#> GSM99574     1  0.0146    0.79766 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99592     3  0.0777    0.82143 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM99594     3  0.1297    0.80820 0.000 0.000 0.948 0.000 0.012 0.040
#> GSM99468     1  0.0405    0.79625 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM99498     1  0.0405    0.79625 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM99500     1  0.0405    0.79625 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM99508     3  0.0146    0.82340 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99568     3  0.0291    0.82277 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM99596     3  0.0146    0.82340 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99600     4  0.2165    0.72919 0.000 0.108 0.000 0.884 0.008 0.000
#> GSM99458     1  0.6037   -0.05704 0.508 0.004 0.000 0.008 0.284 0.196
#> GSM99460     6  0.5423   -0.18938 0.088 0.004 0.000 0.004 0.408 0.496
#> GSM99510     6  0.4302    0.42302 0.000 0.000 0.368 0.020 0.004 0.608
#> GSM99512     3  0.3969    0.41402 0.000 0.000 0.652 0.000 0.016 0.332
#> GSM99514     3  0.0146    0.82269 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99516     1  0.0146    0.79805 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99518     1  0.2724    0.68388 0.864 0.000 0.000 0.000 0.084 0.052
#> GSM99520     3  0.0603    0.82105 0.000 0.000 0.980 0.000 0.004 0.016
#> GSM99522     3  0.0725    0.82098 0.000 0.000 0.976 0.000 0.012 0.012
#> GSM99570     1  0.0777    0.78994 0.972 0.000 0.000 0.004 0.024 0.000
#> GSM99598     1  0.0146    0.79805 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99432     4  0.2994    0.70252 0.000 0.008 0.000 0.820 0.008 0.164
#> GSM99434     6  0.4135    0.53234 0.000 0.000 0.300 0.032 0.000 0.668
#> GSM99436     4  0.1606    0.74131 0.000 0.056 0.000 0.932 0.004 0.008
#> GSM99438     2  0.0291    0.93052 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM99440     1  0.0000    0.79818 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.3774    0.47675 0.000 0.328 0.000 0.664 0.008 0.000
#> GSM99444     2  0.0291    0.93075 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM99446     4  0.2009    0.73647 0.000 0.084 0.000 0.904 0.008 0.004
#> GSM99448     3  0.5887   -0.10481 0.000 0.000 0.484 0.192 0.004 0.320
#> GSM99450     6  0.4605    0.53914 0.000 0.000 0.308 0.024 0.024 0.644
#> GSM99452     1  0.0692    0.79295 0.976 0.000 0.000 0.004 0.020 0.000
#> GSM99454     1  0.0000    0.79818 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.3230    0.70615 0.212 0.000 0.000 0.000 0.776 0.012
#> GSM99462     2  0.0653    0.92942 0.000 0.980 0.000 0.004 0.004 0.012
#> GSM99464     6  0.4400    0.27980 0.000 0.000 0.032 0.004 0.332 0.632
#> GSM99466     4  0.4844    0.67445 0.000 0.004 0.004 0.672 0.092 0.228
#> GSM99470     1  0.7513   -0.13459 0.368 0.004 0.000 0.244 0.256 0.128
#> GSM99472     1  0.4914    0.41302 0.672 0.004 0.000 0.020 0.244 0.060
#> GSM99474     3  0.1672    0.79478 0.000 0.000 0.932 0.004 0.016 0.048
#> GSM99476     4  0.4158    0.61293 0.000 0.000 0.012 0.688 0.020 0.280
#> GSM99478     4  0.4837    0.67558 0.000 0.008 0.000 0.668 0.092 0.232
#> GSM99480     1  0.3823   -0.00909 0.564 0.000 0.000 0.000 0.436 0.000
#> GSM99482     1  0.2089    0.74829 0.908 0.004 0.000 0.004 0.072 0.012
#> GSM99484     4  0.4088    0.70889 0.000 0.020 0.000 0.780 0.096 0.104
#> GSM99486     4  0.1168    0.74295 0.000 0.028 0.000 0.956 0.000 0.016
#> GSM99488     2  0.1053    0.92524 0.000 0.964 0.000 0.004 0.012 0.020
#> GSM99490     2  0.4936    0.27202 0.000 0.576 0.000 0.364 0.048 0.012
#> GSM99492     1  0.3868   -0.20380 0.504 0.000 0.000 0.000 0.496 0.000
#> GSM99494     2  0.1053    0.92524 0.000 0.964 0.000 0.004 0.012 0.020
#> GSM99524     1  0.0777    0.78994 0.972 0.000 0.000 0.004 0.024 0.000
#> GSM99526     6  0.4044    0.47787 0.000 0.000 0.008 0.084 0.140 0.768
#> GSM99528     4  0.6017    0.34136 0.000 0.000 0.004 0.424 0.204 0.368
#> GSM99530     3  0.6365   -0.08299 0.000 0.000 0.380 0.012 0.340 0.268
#> GSM99532     3  0.4886    0.46555 0.000 0.000 0.664 0.012 0.084 0.240
#> GSM99534     4  0.6628    0.49170 0.000 0.144 0.000 0.540 0.192 0.124
#> GSM99536     1  0.3522    0.54995 0.784 0.000 0.000 0.000 0.172 0.044
#> GSM99538     4  0.4076    0.48909 0.000 0.000 0.000 0.592 0.012 0.396
#> GSM99540     5  0.6147    0.56697 0.340 0.000 0.000 0.012 0.448 0.200
#> GSM99542     2  0.1710    0.90988 0.000 0.936 0.000 0.016 0.020 0.028
#> GSM99544     4  0.3703    0.58529 0.000 0.004 0.000 0.688 0.004 0.304
#> GSM99546     6  0.4828    0.38773 0.000 0.004 0.000 0.220 0.108 0.668
#> GSM99548     2  0.0665    0.92715 0.000 0.980 0.000 0.004 0.008 0.008
#> GSM99550     5  0.2619    0.55368 0.048 0.000 0.000 0.012 0.884 0.056
#> GSM99552     3  0.3836    0.65990 0.000 0.000 0.808 0.036 0.064 0.092
#> GSM99554     4  0.2001    0.73572 0.000 0.092 0.000 0.900 0.004 0.004
#> GSM99556     2  0.0551    0.93036 0.000 0.984 0.000 0.004 0.004 0.008
#> GSM99558     4  0.4513    0.68508 0.000 0.000 0.056 0.732 0.032 0.180
#> GSM99560     4  0.3815    0.64145 0.000 0.000 0.000 0.776 0.092 0.132
#> GSM99562     3  0.0972    0.81727 0.000 0.000 0.964 0.000 0.008 0.028
#> GSM99564     4  0.1257    0.74235 0.000 0.028 0.000 0.952 0.000 0.020
#> GSM99572     2  0.1483    0.90350 0.000 0.944 0.000 0.036 0.012 0.008
#> GSM99576     5  0.5836    0.61075 0.216 0.000 0.000 0.020 0.572 0.192
#> GSM99578     4  0.4693    0.70023 0.000 0.076 0.000 0.748 0.088 0.088
#> GSM99580     3  0.0363    0.82184 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99582     3  0.6796    0.19755 0.000 0.000 0.516 0.200 0.140 0.144
#> GSM99584     4  0.3953    0.53966 0.000 0.000 0.000 0.656 0.016 0.328
#> GSM99586     5  0.3126    0.69417 0.248 0.000 0.000 0.000 0.752 0.000
#> GSM99588     4  0.4225    0.70320 0.000 0.140 0.000 0.768 0.032 0.060
#> GSM99590     2  0.0291    0.93075 0.000 0.992 0.000 0.004 0.004 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-kmeans-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) cell.type(p) k
#> CV:kmeans 84         1.43e-05     8.68e-05 2
#> CV:kmeans 83         1.97e-03     3.26e-02 3
#> CV:kmeans 69         1.24e-03     4.48e-02 4
#> CV:kmeans 67         7.83e-05     1.40e-02 5
#> CV:kmeans 65         9.59e-06     5.03e-03 6

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


CV:skmeans**

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

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

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

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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.973       0.989         0.5047 0.496   0.496
#> 3 3 1.000           0.969       0.987         0.3322 0.736   0.514
#> 4 4 0.805           0.782       0.895         0.0999 0.908   0.732
#> 5 5 0.741           0.620       0.816         0.0617 0.928   0.743
#> 6 6 0.718           0.556       0.767         0.0365 0.937   0.739

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
#> GSM99496     1  0.0000      0.989 1.000 0.000
#> GSM99502     1  0.0000      0.989 1.000 0.000
#> GSM99504     1  0.0000      0.989 1.000 0.000
#> GSM99506     1  0.0000      0.989 1.000 0.000
#> GSM99566     1  0.0000      0.989 1.000 0.000
#> GSM99574     1  0.0000      0.989 1.000 0.000
#> GSM99592     1  0.6712      0.782 0.824 0.176
#> GSM99594     1  0.0000      0.989 1.000 0.000
#> GSM99468     1  0.0000      0.989 1.000 0.000
#> GSM99498     1  0.0000      0.989 1.000 0.000
#> GSM99500     1  0.0000      0.989 1.000 0.000
#> GSM99508     1  0.0000      0.989 1.000 0.000
#> GSM99568     1  0.0000      0.989 1.000 0.000
#> GSM99596     1  0.0000      0.989 1.000 0.000
#> GSM99600     2  0.0000      0.989 0.000 1.000
#> GSM99458     1  0.0000      0.989 1.000 0.000
#> GSM99460     1  0.0000      0.989 1.000 0.000
#> GSM99510     2  0.0000      0.989 0.000 1.000
#> GSM99512     2  0.0376      0.985 0.004 0.996
#> GSM99514     1  0.0000      0.989 1.000 0.000
#> GSM99516     1  0.0000      0.989 1.000 0.000
#> GSM99518     1  0.0000      0.989 1.000 0.000
#> GSM99520     1  0.0000      0.989 1.000 0.000
#> GSM99522     1  0.0000      0.989 1.000 0.000
#> GSM99570     1  0.0000      0.989 1.000 0.000
#> GSM99598     1  0.0000      0.989 1.000 0.000
#> GSM99432     2  0.0000      0.989 0.000 1.000
#> GSM99434     2  0.2043      0.958 0.032 0.968
#> GSM99436     2  0.0000      0.989 0.000 1.000
#> GSM99438     2  0.0000      0.989 0.000 1.000
#> GSM99440     1  0.0000      0.989 1.000 0.000
#> GSM99442     2  0.0000      0.989 0.000 1.000
#> GSM99444     2  0.0000      0.989 0.000 1.000
#> GSM99446     2  0.0000      0.989 0.000 1.000
#> GSM99448     2  0.0000      0.989 0.000 1.000
#> GSM99450     1  0.0000      0.989 1.000 0.000
#> GSM99452     1  0.0000      0.989 1.000 0.000
#> GSM99454     1  0.0000      0.989 1.000 0.000
#> GSM99456     1  0.0000      0.989 1.000 0.000
#> GSM99462     2  0.0000      0.989 0.000 1.000
#> GSM99464     1  0.0000      0.989 1.000 0.000
#> GSM99466     2  0.0000      0.989 0.000 1.000
#> GSM99470     2  0.9661      0.346 0.392 0.608
#> GSM99472     1  0.0000      0.989 1.000 0.000
#> GSM99474     1  0.0000      0.989 1.000 0.000
#> GSM99476     2  0.0000      0.989 0.000 1.000
#> GSM99478     2  0.0000      0.989 0.000 1.000
#> GSM99480     1  0.0000      0.989 1.000 0.000
#> GSM99482     1  0.0000      0.989 1.000 0.000
#> GSM99484     2  0.0000      0.989 0.000 1.000
#> GSM99486     2  0.0000      0.989 0.000 1.000
#> GSM99488     2  0.0000      0.989 0.000 1.000
#> GSM99490     2  0.0000      0.989 0.000 1.000
#> GSM99492     1  0.0000      0.989 1.000 0.000
#> GSM99494     2  0.0000      0.989 0.000 1.000
#> GSM99524     1  0.0000      0.989 1.000 0.000
#> GSM99526     2  0.0000      0.989 0.000 1.000
#> GSM99528     2  0.0000      0.989 0.000 1.000
#> GSM99530     1  0.0000      0.989 1.000 0.000
#> GSM99532     1  0.0000      0.989 1.000 0.000
#> GSM99534     2  0.0000      0.989 0.000 1.000
#> GSM99536     1  0.0000      0.989 1.000 0.000
#> GSM99538     2  0.0000      0.989 0.000 1.000
#> GSM99540     1  0.0000      0.989 1.000 0.000
#> GSM99542     2  0.0000      0.989 0.000 1.000
#> GSM99544     2  0.0000      0.989 0.000 1.000
#> GSM99546     2  0.0000      0.989 0.000 1.000
#> GSM99548     2  0.0000      0.989 0.000 1.000
#> GSM99550     1  0.0000      0.989 1.000 0.000
#> GSM99552     2  0.0000      0.989 0.000 1.000
#> GSM99554     2  0.0000      0.989 0.000 1.000
#> GSM99556     2  0.0000      0.989 0.000 1.000
#> GSM99558     2  0.0000      0.989 0.000 1.000
#> GSM99560     2  0.0000      0.989 0.000 1.000
#> GSM99562     1  0.0000      0.989 1.000 0.000
#> GSM99564     2  0.0000      0.989 0.000 1.000
#> GSM99572     2  0.0000      0.989 0.000 1.000
#> GSM99576     1  0.0000      0.989 1.000 0.000
#> GSM99578     2  0.0000      0.989 0.000 1.000
#> GSM99580     1  0.9000      0.533 0.684 0.316
#> GSM99582     1  0.0000      0.989 1.000 0.000
#> GSM99584     2  0.0000      0.989 0.000 1.000
#> GSM99586     1  0.0000      0.989 1.000 0.000
#> GSM99588     2  0.0000      0.989 0.000 1.000
#> GSM99590     2  0.0000      0.989 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
#> GSM99496     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99506     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99566     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99508     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99568     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99596     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99600     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99514     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99520     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99522     3  0.0424      0.967 0.008 0.000 0.992
#> GSM99570     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99432     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99434     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99448     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99450     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99464     3  0.0424      0.967 0.008 0.000 0.992
#> GSM99466     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99470     1  0.0237      0.982 0.996 0.004 0.000
#> GSM99472     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99474     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99476     3  0.1643      0.936 0.000 0.044 0.956
#> GSM99478     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99480     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99484     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99486     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99488     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99526     3  0.5529      0.590 0.000 0.296 0.704
#> GSM99528     2  0.0237      0.994 0.000 0.996 0.004
#> GSM99530     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99532     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99534     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99536     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99538     2  0.1964      0.939 0.000 0.944 0.056
#> GSM99540     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99542     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99544     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99546     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99548     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99550     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99552     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99554     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99558     3  0.5397      0.619 0.000 0.280 0.720
#> GSM99560     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99562     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99564     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99572     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99576     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99578     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99580     3  0.0000      0.973 0.000 0.000 1.000
#> GSM99582     1  0.6008      0.403 0.628 0.000 0.372
#> GSM99584     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99586     1  0.0000      0.986 1.000 0.000 0.000
#> GSM99588     2  0.0000      0.998 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.998 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0188    0.94834 0.996 0.000 0.000 0.004
#> GSM99504     1  0.1209    0.93042 0.964 0.000 0.032 0.004
#> GSM99506     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0188    0.94834 0.996 0.000 0.000 0.004
#> GSM99592     3  0.0817    0.85691 0.000 0.000 0.976 0.024
#> GSM99594     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000    0.94866 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000    0.94866 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000    0.94866 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99600     2  0.1389    0.88219 0.000 0.952 0.000 0.048
#> GSM99458     1  0.2281    0.90618 0.904 0.000 0.000 0.096
#> GSM99460     1  0.4277    0.74039 0.720 0.000 0.000 0.280
#> GSM99510     4  0.4898    0.32326 0.000 0.000 0.416 0.584
#> GSM99512     3  0.3219    0.71836 0.000 0.000 0.836 0.164
#> GSM99514     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0188    0.94834 0.996 0.000 0.000 0.004
#> GSM99518     1  0.1211    0.93956 0.960 0.000 0.000 0.040
#> GSM99520     3  0.0188    0.86824 0.000 0.000 0.996 0.004
#> GSM99522     3  0.0376    0.86693 0.004 0.000 0.992 0.004
#> GSM99570     1  0.0188    0.94834 0.996 0.000 0.000 0.004
#> GSM99598     1  0.0188    0.94834 0.996 0.000 0.000 0.004
#> GSM99432     2  0.4817    0.39133 0.000 0.612 0.000 0.388
#> GSM99434     4  0.4643    0.43588 0.000 0.000 0.344 0.656
#> GSM99436     2  0.3486    0.77146 0.000 0.812 0.000 0.188
#> GSM99438     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000    0.94866 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0707    0.89456 0.000 0.980 0.000 0.020
#> GSM99444     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99446     2  0.3356    0.78449 0.000 0.824 0.000 0.176
#> GSM99448     3  0.4977   -0.00807 0.000 0.000 0.540 0.460
#> GSM99450     4  0.4955    0.23511 0.000 0.000 0.444 0.556
#> GSM99452     1  0.0000    0.94866 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000    0.94866 1.000 0.000 0.000 0.000
#> GSM99456     1  0.2868    0.88839 0.864 0.000 0.000 0.136
#> GSM99462     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99464     4  0.4378    0.52435 0.040 0.000 0.164 0.796
#> GSM99466     4  0.5000   -0.13172 0.000 0.496 0.000 0.504
#> GSM99470     1  0.2489    0.88783 0.912 0.068 0.000 0.020
#> GSM99472     1  0.0188    0.94834 0.996 0.000 0.000 0.004
#> GSM99474     3  0.1022    0.85533 0.000 0.000 0.968 0.032
#> GSM99476     4  0.4175    0.58674 0.000 0.016 0.200 0.784
#> GSM99478     2  0.3649    0.74246 0.000 0.796 0.000 0.204
#> GSM99480     1  0.0817    0.94399 0.976 0.000 0.000 0.024
#> GSM99482     1  0.0188    0.94834 0.996 0.000 0.000 0.004
#> GSM99484     2  0.1118    0.88994 0.000 0.964 0.000 0.036
#> GSM99486     2  0.4040    0.69063 0.000 0.752 0.000 0.248
#> GSM99488     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99490     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99492     1  0.1302    0.93808 0.956 0.000 0.000 0.044
#> GSM99494     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0188    0.94834 0.996 0.000 0.000 0.004
#> GSM99526     4  0.1863    0.62155 0.004 0.012 0.040 0.944
#> GSM99528     2  0.4675    0.61781 0.000 0.736 0.020 0.244
#> GSM99530     3  0.4808    0.60032 0.028 0.000 0.736 0.236
#> GSM99532     3  0.2704    0.77848 0.000 0.000 0.876 0.124
#> GSM99534     2  0.0817    0.89055 0.000 0.976 0.000 0.024
#> GSM99536     1  0.1302    0.93776 0.956 0.000 0.000 0.044
#> GSM99538     4  0.4792    0.47798 0.000 0.312 0.008 0.680
#> GSM99540     1  0.2408    0.90887 0.896 0.000 0.000 0.104
#> GSM99542     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99544     4  0.4624    0.42336 0.000 0.340 0.000 0.660
#> GSM99546     4  0.2334    0.65190 0.000 0.088 0.004 0.908
#> GSM99548     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99550     1  0.4103    0.77595 0.744 0.000 0.000 0.256
#> GSM99552     3  0.2101    0.82159 0.000 0.012 0.928 0.060
#> GSM99554     2  0.2216    0.85590 0.000 0.908 0.000 0.092
#> GSM99556     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99558     3  0.6770    0.19803 0.000 0.128 0.580 0.292
#> GSM99560     2  0.3528    0.77088 0.000 0.808 0.000 0.192
#> GSM99562     3  0.0000    0.86968 0.000 0.000 1.000 0.000
#> GSM99564     2  0.4250    0.64490 0.000 0.724 0.000 0.276
#> GSM99572     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99576     1  0.3266    0.86183 0.832 0.000 0.000 0.168
#> GSM99578     2  0.0000    0.90002 0.000 1.000 0.000 0.000
#> GSM99580     3  0.0188    0.86820 0.000 0.000 0.996 0.004
#> GSM99582     3  0.6805    0.19204 0.400 0.000 0.500 0.100
#> GSM99584     4  0.4134    0.54592 0.000 0.260 0.000 0.740
#> GSM99586     1  0.2868    0.88794 0.864 0.000 0.000 0.136
#> GSM99588     2  0.0188    0.89844 0.000 0.996 0.000 0.004
#> GSM99590     2  0.0000    0.90002 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0162    0.87249 0.000 0.000 0.996 0.000 0.004
#> GSM99502     1  0.0000    0.86146 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.1484    0.83132 0.944 0.000 0.048 0.000 0.008
#> GSM99506     3  0.0000    0.87198 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0324    0.87194 0.000 0.000 0.992 0.004 0.004
#> GSM99574     1  0.0000    0.86146 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.2291    0.83834 0.000 0.000 0.908 0.056 0.036
#> GSM99594     3  0.0898    0.86912 0.000 0.000 0.972 0.008 0.020
#> GSM99468     1  0.0794    0.86191 0.972 0.000 0.000 0.000 0.028
#> GSM99498     1  0.0703    0.86161 0.976 0.000 0.000 0.000 0.024
#> GSM99500     1  0.0510    0.86207 0.984 0.000 0.000 0.000 0.016
#> GSM99508     3  0.0000    0.87198 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0290    0.87228 0.000 0.000 0.992 0.000 0.008
#> GSM99596     3  0.0566    0.87121 0.000 0.000 0.984 0.004 0.012
#> GSM99600     2  0.3305    0.66959 0.000 0.776 0.000 0.224 0.000
#> GSM99458     1  0.3970    0.65780 0.744 0.000 0.000 0.020 0.236
#> GSM99460     5  0.5016    0.18260 0.348 0.000 0.000 0.044 0.608
#> GSM99510     4  0.6586   -0.03057 0.000 0.000 0.384 0.408 0.208
#> GSM99512     3  0.4772    0.62205 0.000 0.000 0.728 0.108 0.164
#> GSM99514     3  0.0162    0.87258 0.000 0.000 0.996 0.000 0.004
#> GSM99516     1  0.0000    0.86146 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.1732    0.84068 0.920 0.000 0.000 0.000 0.080
#> GSM99520     3  0.1211    0.86702 0.000 0.000 0.960 0.024 0.016
#> GSM99522     3  0.2067    0.83562 0.044 0.000 0.924 0.004 0.028
#> GSM99570     1  0.0290    0.86011 0.992 0.000 0.000 0.000 0.008
#> GSM99598     1  0.0000    0.86146 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.4451    0.30545 0.000 0.340 0.000 0.644 0.016
#> GSM99434     4  0.6432   -0.05088 0.000 0.000 0.196 0.484 0.320
#> GSM99436     2  0.4235    0.30356 0.000 0.576 0.000 0.424 0.000
#> GSM99438     2  0.0510    0.81944 0.000 0.984 0.000 0.016 0.000
#> GSM99440     1  0.0703    0.86187 0.976 0.000 0.000 0.000 0.024
#> GSM99442     2  0.2488    0.76077 0.000 0.872 0.000 0.124 0.004
#> GSM99444     2  0.0404    0.81951 0.000 0.988 0.000 0.012 0.000
#> GSM99446     2  0.4088    0.42427 0.000 0.632 0.000 0.368 0.000
#> GSM99448     4  0.5576    0.18908 0.000 0.000 0.388 0.536 0.076
#> GSM99450     5  0.6824    0.00216 0.000 0.000 0.328 0.328 0.344
#> GSM99452     1  0.0963    0.86022 0.964 0.000 0.000 0.000 0.036
#> GSM99454     1  0.0404    0.86300 0.988 0.000 0.000 0.000 0.012
#> GSM99456     1  0.4390    0.43306 0.568 0.000 0.000 0.004 0.428
#> GSM99462     2  0.0510    0.81944 0.000 0.984 0.000 0.016 0.000
#> GSM99464     5  0.3864    0.37851 0.008 0.000 0.020 0.188 0.784
#> GSM99466     4  0.3882    0.49925 0.000 0.168 0.000 0.788 0.044
#> GSM99470     1  0.3623    0.76367 0.848 0.052 0.000 0.028 0.072
#> GSM99472     1  0.1331    0.85021 0.952 0.000 0.000 0.008 0.040
#> GSM99474     3  0.3317    0.78249 0.000 0.000 0.840 0.044 0.116
#> GSM99476     4  0.1918    0.43879 0.000 0.000 0.036 0.928 0.036
#> GSM99478     2  0.5148    0.20631 0.000 0.528 0.000 0.432 0.040
#> GSM99480     1  0.2891    0.78120 0.824 0.000 0.000 0.000 0.176
#> GSM99482     1  0.0955    0.85674 0.968 0.000 0.000 0.004 0.028
#> GSM99484     2  0.4141    0.64096 0.000 0.728 0.000 0.248 0.024
#> GSM99486     4  0.4557   -0.09861 0.000 0.476 0.000 0.516 0.008
#> GSM99488     2  0.0290    0.81768 0.000 0.992 0.000 0.000 0.008
#> GSM99490     2  0.0609    0.81353 0.000 0.980 0.000 0.000 0.020
#> GSM99492     1  0.3561    0.69912 0.740 0.000 0.000 0.000 0.260
#> GSM99494     2  0.0162    0.81836 0.000 0.996 0.000 0.000 0.004
#> GSM99524     1  0.0404    0.85914 0.988 0.000 0.000 0.000 0.012
#> GSM99526     5  0.4590    0.10963 0.000 0.000 0.012 0.420 0.568
#> GSM99528     2  0.6635    0.15436 0.000 0.484 0.004 0.228 0.284
#> GSM99530     5  0.5057    0.13239 0.016 0.000 0.384 0.016 0.584
#> GSM99532     3  0.4462    0.52929 0.004 0.000 0.672 0.016 0.308
#> GSM99534     2  0.1403    0.81017 0.000 0.952 0.000 0.024 0.024
#> GSM99536     1  0.2605    0.80128 0.852 0.000 0.000 0.000 0.148
#> GSM99538     4  0.5032    0.50116 0.000 0.168 0.000 0.704 0.128
#> GSM99540     1  0.4321    0.47780 0.600 0.000 0.000 0.004 0.396
#> GSM99542     2  0.0404    0.81662 0.000 0.988 0.000 0.000 0.012
#> GSM99544     4  0.4114    0.52920 0.000 0.164 0.000 0.776 0.060
#> GSM99546     4  0.5188    0.03797 0.000 0.044 0.000 0.540 0.416
#> GSM99548     2  0.0404    0.81672 0.000 0.988 0.000 0.000 0.012
#> GSM99550     5  0.4449    0.23946 0.288 0.004 0.000 0.020 0.688
#> GSM99552     3  0.3920    0.71672 0.000 0.004 0.796 0.156 0.044
#> GSM99554     2  0.4193    0.54739 0.000 0.684 0.000 0.304 0.012
#> GSM99556     2  0.0000    0.81895 0.000 1.000 0.000 0.000 0.000
#> GSM99558     4  0.6461    0.36611 0.000 0.108 0.288 0.568 0.036
#> GSM99560     2  0.5787    0.43945 0.000 0.608 0.000 0.240 0.152
#> GSM99562     3  0.0880    0.86686 0.000 0.000 0.968 0.000 0.032
#> GSM99564     4  0.4434   -0.03152 0.000 0.460 0.000 0.536 0.004
#> GSM99572     2  0.0510    0.81948 0.000 0.984 0.000 0.016 0.000
#> GSM99576     1  0.4450    0.28936 0.508 0.000 0.000 0.004 0.488
#> GSM99578     2  0.1818    0.80154 0.000 0.932 0.000 0.044 0.024
#> GSM99580     3  0.0798    0.87010 0.000 0.000 0.976 0.016 0.008
#> GSM99582     3  0.8009   -0.14294 0.348 0.000 0.360 0.180 0.112
#> GSM99584     4  0.3916    0.47767 0.000 0.092 0.000 0.804 0.104
#> GSM99586     1  0.4101    0.54500 0.628 0.000 0.000 0.000 0.372
#> GSM99588     2  0.1168    0.81490 0.000 0.960 0.000 0.032 0.008
#> GSM99590     2  0.0290    0.81974 0.000 0.992 0.000 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0405     0.8392 0.000 0.000 0.988 0.008 0.000 0.004
#> GSM99502     1  0.0291     0.7616 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM99504     1  0.1542     0.7365 0.936 0.000 0.052 0.000 0.008 0.004
#> GSM99506     3  0.1180     0.8406 0.000 0.000 0.960 0.016 0.012 0.012
#> GSM99566     3  0.1409     0.8400 0.000 0.000 0.948 0.012 0.008 0.032
#> GSM99574     1  0.0363     0.7620 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99592     3  0.4137     0.7293 0.000 0.000 0.780 0.068 0.032 0.120
#> GSM99594     3  0.2115     0.8347 0.000 0.000 0.916 0.020 0.032 0.032
#> GSM99468     1  0.1471     0.7510 0.932 0.000 0.000 0.000 0.064 0.004
#> GSM99498     1  0.1082     0.7588 0.956 0.000 0.000 0.000 0.040 0.004
#> GSM99500     1  0.1010     0.7597 0.960 0.000 0.000 0.000 0.036 0.004
#> GSM99508     3  0.0653     0.8390 0.000 0.000 0.980 0.004 0.004 0.012
#> GSM99568     3  0.1364     0.8389 0.000 0.000 0.952 0.012 0.020 0.016
#> GSM99596     3  0.0862     0.8401 0.000 0.000 0.972 0.004 0.008 0.016
#> GSM99600     2  0.3337     0.5596 0.000 0.736 0.000 0.260 0.000 0.004
#> GSM99458     1  0.5653     0.1521 0.584 0.000 0.000 0.012 0.212 0.192
#> GSM99460     5  0.6261     0.3443 0.232 0.000 0.000 0.012 0.424 0.332
#> GSM99510     6  0.5442     0.4204 0.000 0.000 0.312 0.128 0.004 0.556
#> GSM99512     3  0.5247     0.3499 0.000 0.000 0.560 0.044 0.032 0.364
#> GSM99514     3  0.0000     0.8390 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99516     1  0.0291     0.7612 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM99518     1  0.2963     0.6647 0.828 0.000 0.000 0.004 0.152 0.016
#> GSM99520     3  0.2696     0.8190 0.000 0.000 0.884 0.032 0.032 0.052
#> GSM99522     3  0.3689     0.7365 0.068 0.000 0.808 0.008 0.004 0.112
#> GSM99570     1  0.1155     0.7545 0.956 0.000 0.000 0.004 0.036 0.004
#> GSM99598     1  0.0146     0.7606 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM99432     4  0.5401     0.4563 0.000 0.332 0.000 0.568 0.020 0.080
#> GSM99434     6  0.5178     0.5972 0.000 0.000 0.124 0.164 0.032 0.680
#> GSM99436     4  0.4179     0.0676 0.000 0.472 0.000 0.516 0.000 0.012
#> GSM99438     2  0.0632     0.7877 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM99440     1  0.1267     0.7546 0.940 0.000 0.000 0.000 0.060 0.000
#> GSM99442     2  0.2814     0.6799 0.000 0.820 0.000 0.172 0.000 0.008
#> GSM99444     2  0.0865     0.7851 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM99446     2  0.4051     0.1120 0.000 0.560 0.000 0.432 0.000 0.008
#> GSM99448     4  0.6678    -0.1817 0.000 0.008 0.336 0.388 0.020 0.248
#> GSM99450     6  0.5267     0.6016 0.004 0.000 0.224 0.060 0.048 0.664
#> GSM99452     1  0.2734     0.7151 0.840 0.000 0.000 0.008 0.148 0.004
#> GSM99454     1  0.0865     0.7637 0.964 0.000 0.000 0.000 0.036 0.000
#> GSM99456     5  0.4938     0.4696 0.356 0.000 0.000 0.000 0.568 0.076
#> GSM99462     2  0.0713     0.7871 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM99464     6  0.4121     0.3046 0.004 0.000 0.004 0.004 0.384 0.604
#> GSM99466     4  0.4976     0.4789 0.000 0.100 0.000 0.724 0.092 0.084
#> GSM99470     1  0.6125     0.3947 0.636 0.048 0.000 0.076 0.188 0.052
#> GSM99472     1  0.3343     0.6694 0.812 0.000 0.000 0.040 0.144 0.004
#> GSM99474     3  0.4747     0.6888 0.000 0.000 0.732 0.040 0.100 0.128
#> GSM99476     4  0.5229     0.2794 0.000 0.012 0.032 0.644 0.044 0.268
#> GSM99478     4  0.6307     0.1924 0.000 0.392 0.000 0.448 0.088 0.072
#> GSM99480     1  0.3240     0.5645 0.752 0.000 0.000 0.000 0.244 0.004
#> GSM99482     1  0.2804     0.7087 0.852 0.000 0.000 0.024 0.120 0.004
#> GSM99484     2  0.5158     0.3184 0.000 0.584 0.000 0.340 0.052 0.024
#> GSM99486     4  0.4170     0.4290 0.000 0.328 0.000 0.648 0.004 0.020
#> GSM99488     2  0.0146     0.7860 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM99490     2  0.1078     0.7826 0.000 0.964 0.000 0.016 0.008 0.012
#> GSM99492     1  0.3965     0.1963 0.604 0.000 0.000 0.000 0.388 0.008
#> GSM99494     2  0.0146     0.7860 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM99524     1  0.1578     0.7428 0.936 0.000 0.000 0.012 0.048 0.004
#> GSM99526     6  0.4218     0.5905 0.000 0.000 0.000 0.108 0.156 0.736
#> GSM99528     2  0.7412    -0.1132 0.000 0.364 0.004 0.216 0.304 0.112
#> GSM99530     5  0.6251    -0.0638 0.004 0.000 0.236 0.032 0.540 0.188
#> GSM99532     3  0.6701     0.1844 0.020 0.000 0.476 0.024 0.204 0.276
#> GSM99534     2  0.3419     0.6922 0.000 0.840 0.000 0.056 0.040 0.064
#> GSM99536     1  0.3271     0.5683 0.760 0.000 0.000 0.000 0.232 0.008
#> GSM99538     4  0.6653     0.4048 0.000 0.184 0.016 0.516 0.040 0.244
#> GSM99540     1  0.5263     0.0283 0.556 0.000 0.000 0.012 0.356 0.076
#> GSM99542     2  0.1088     0.7722 0.000 0.960 0.000 0.016 0.024 0.000
#> GSM99544     4  0.5265     0.4911 0.000 0.148 0.000 0.640 0.012 0.200
#> GSM99546     6  0.5188     0.5462 0.000 0.032 0.000 0.156 0.132 0.680
#> GSM99548     2  0.0405     0.7859 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM99550     5  0.4505     0.4430 0.120 0.000 0.000 0.012 0.732 0.136
#> GSM99552     3  0.5691     0.5452 0.000 0.008 0.652 0.192 0.076 0.072
#> GSM99554     2  0.4101     0.2265 0.000 0.580 0.000 0.408 0.000 0.012
#> GSM99556     2  0.0291     0.7869 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM99558     4  0.6344     0.3116 0.000 0.064 0.232 0.596 0.044 0.064
#> GSM99560     2  0.6566     0.0108 0.000 0.472 0.000 0.328 0.120 0.080
#> GSM99562     3  0.2013     0.8245 0.000 0.000 0.908 0.008 0.008 0.076
#> GSM99564     4  0.3816     0.4803 0.000 0.296 0.000 0.688 0.000 0.016
#> GSM99572     2  0.0790     0.7882 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM99576     5  0.4770     0.4737 0.328 0.000 0.000 0.012 0.616 0.044
#> GSM99578     2  0.2108     0.7651 0.000 0.912 0.000 0.056 0.016 0.016
#> GSM99580     3  0.2383     0.8226 0.000 0.000 0.900 0.028 0.020 0.052
#> GSM99582     1  0.8651    -0.2671 0.280 0.000 0.260 0.212 0.144 0.104
#> GSM99584     4  0.5124     0.3263 0.000 0.072 0.000 0.592 0.012 0.324
#> GSM99586     5  0.4246     0.2498 0.452 0.000 0.000 0.000 0.532 0.016
#> GSM99588     2  0.1728     0.7679 0.000 0.924 0.000 0.064 0.004 0.008
#> GSM99590     2  0.0713     0.7871 0.000 0.972 0.000 0.028 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-skmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) cell.type(p) k
#> CV:skmeans 84         4.99e-05     0.000264 2
#> CV:skmeans 84         1.32e-04     0.003853 3
#> CV:skmeans 75         4.71e-05     0.003285 4
#> CV:skmeans 59         5.15e-04     0.024792 5
#> CV:skmeans 53         3.08e-04     0.016645 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.563           0.892       0.936         0.4474 0.570   0.570
#> 3 3 0.634           0.822       0.910         0.4707 0.762   0.583
#> 4 4 0.604           0.695       0.832         0.1037 0.922   0.778
#> 5 5 0.681           0.556       0.750         0.0816 0.835   0.498
#> 6 6 0.830           0.777       0.895         0.0538 0.902   0.588

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
#> GSM99496     2  0.6531      0.848 0.168 0.832
#> GSM99502     1  0.0000      0.981 1.000 0.000
#> GSM99504     1  0.0000      0.981 1.000 0.000
#> GSM99506     2  0.6438      0.850 0.164 0.836
#> GSM99566     2  0.6343      0.853 0.160 0.840
#> GSM99574     1  0.0000      0.981 1.000 0.000
#> GSM99592     2  0.5629      0.867 0.132 0.868
#> GSM99594     2  0.6438      0.850 0.164 0.836
#> GSM99468     1  0.0000      0.981 1.000 0.000
#> GSM99498     1  0.0000      0.981 1.000 0.000
#> GSM99500     1  0.0000      0.981 1.000 0.000
#> GSM99508     2  0.6623      0.845 0.172 0.828
#> GSM99568     2  0.6973      0.834 0.188 0.812
#> GSM99596     2  0.8713      0.718 0.292 0.708
#> GSM99600     2  0.0000      0.909 0.000 1.000
#> GSM99458     1  0.0000      0.981 1.000 0.000
#> GSM99460     1  0.0000      0.981 1.000 0.000
#> GSM99510     2  0.0000      0.909 0.000 1.000
#> GSM99512     2  0.1184      0.906 0.016 0.984
#> GSM99514     2  0.6531      0.848 0.168 0.832
#> GSM99516     1  0.0000      0.981 1.000 0.000
#> GSM99518     1  0.0000      0.981 1.000 0.000
#> GSM99520     2  0.6438      0.850 0.164 0.836
#> GSM99522     1  0.5629      0.817 0.868 0.132
#> GSM99570     1  0.0000      0.981 1.000 0.000
#> GSM99598     1  0.0000      0.981 1.000 0.000
#> GSM99432     2  0.0000      0.909 0.000 1.000
#> GSM99434     2  0.0000      0.909 0.000 1.000
#> GSM99436     2  0.0000      0.909 0.000 1.000
#> GSM99438     2  0.0000      0.909 0.000 1.000
#> GSM99440     1  0.0000      0.981 1.000 0.000
#> GSM99442     2  0.0000      0.909 0.000 1.000
#> GSM99444     2  0.0000      0.909 0.000 1.000
#> GSM99446     2  0.0000      0.909 0.000 1.000
#> GSM99448     2  0.0000      0.909 0.000 1.000
#> GSM99450     2  0.7602      0.804 0.220 0.780
#> GSM99452     1  0.0000      0.981 1.000 0.000
#> GSM99454     1  0.0000      0.981 1.000 0.000
#> GSM99456     1  0.0000      0.981 1.000 0.000
#> GSM99462     2  0.0000      0.909 0.000 1.000
#> GSM99464     2  0.8713      0.718 0.292 0.708
#> GSM99466     2  0.0000      0.909 0.000 1.000
#> GSM99470     1  0.8443      0.590 0.728 0.272
#> GSM99472     1  0.0938      0.969 0.988 0.012
#> GSM99474     2  0.7815      0.792 0.232 0.768
#> GSM99476     2  0.0000      0.909 0.000 1.000
#> GSM99478     2  0.0000      0.909 0.000 1.000
#> GSM99480     1  0.0000      0.981 1.000 0.000
#> GSM99482     1  0.0000      0.981 1.000 0.000
#> GSM99484     2  0.0000      0.909 0.000 1.000
#> GSM99486     2  0.0000      0.909 0.000 1.000
#> GSM99488     2  0.0000      0.909 0.000 1.000
#> GSM99490     2  0.0000      0.909 0.000 1.000
#> GSM99492     1  0.0000      0.981 1.000 0.000
#> GSM99494     2  0.0000      0.909 0.000 1.000
#> GSM99524     1  0.0000      0.981 1.000 0.000
#> GSM99526     2  0.0938      0.905 0.012 0.988
#> GSM99528     2  0.5294      0.872 0.120 0.880
#> GSM99530     2  0.6801      0.839 0.180 0.820
#> GSM99532     2  0.8555      0.735 0.280 0.720
#> GSM99534     2  0.5178      0.846 0.116 0.884
#> GSM99536     1  0.0000      0.981 1.000 0.000
#> GSM99538     2  0.0000      0.909 0.000 1.000
#> GSM99540     1  0.0000      0.981 1.000 0.000
#> GSM99542     2  0.6531      0.827 0.168 0.832
#> GSM99544     2  0.0000      0.909 0.000 1.000
#> GSM99546     2  0.5519      0.868 0.128 0.872
#> GSM99548     2  0.0000      0.909 0.000 1.000
#> GSM99550     2  0.8861      0.698 0.304 0.696
#> GSM99552     2  0.5737      0.865 0.136 0.864
#> GSM99554     2  0.0000      0.909 0.000 1.000
#> GSM99556     2  0.0000      0.909 0.000 1.000
#> GSM99558     2  0.0000      0.909 0.000 1.000
#> GSM99560     2  0.0000      0.909 0.000 1.000
#> GSM99562     2  0.6438      0.850 0.164 0.836
#> GSM99564     2  0.0000      0.909 0.000 1.000
#> GSM99572     2  0.0000      0.909 0.000 1.000
#> GSM99576     2  0.9963      0.345 0.464 0.536
#> GSM99578     2  0.0000      0.909 0.000 1.000
#> GSM99580     2  0.6438      0.850 0.164 0.836
#> GSM99582     2  0.8608      0.729 0.284 0.716
#> GSM99584     2  0.0000      0.909 0.000 1.000
#> GSM99586     1  0.0000      0.981 1.000 0.000
#> GSM99588     2  0.0000      0.909 0.000 1.000
#> GSM99590     2  0.0000      0.909 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
#> GSM99496     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99502     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99504     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99506     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99566     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99574     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99592     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99594     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99468     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99498     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99500     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99508     3  0.0424     0.8529 0.008 0.000 0.992
#> GSM99568     3  0.1289     0.8444 0.032 0.000 0.968
#> GSM99596     3  0.3340     0.7933 0.120 0.000 0.880
#> GSM99600     2  0.1163     0.8789 0.000 0.972 0.028
#> GSM99458     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99460     1  0.2537     0.8904 0.920 0.000 0.080
#> GSM99510     3  0.0424     0.8522 0.000 0.008 0.992
#> GSM99512     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99514     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99516     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99518     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99520     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99522     1  0.6095     0.3904 0.608 0.000 0.392
#> GSM99570     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99432     2  0.4654     0.8008 0.000 0.792 0.208
#> GSM99434     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99436     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99438     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99440     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99442     2  0.3482     0.8458 0.000 0.872 0.128
#> GSM99444     2  0.1964     0.8602 0.000 0.944 0.056
#> GSM99446     2  0.4452     0.8122 0.000 0.808 0.192
#> GSM99448     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99450     3  0.3267     0.8028 0.116 0.000 0.884
#> GSM99452     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99456     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99462     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99464     3  0.4235     0.7586 0.176 0.000 0.824
#> GSM99466     3  0.5098     0.6455 0.000 0.248 0.752
#> GSM99470     1  0.7807     0.5725 0.672 0.144 0.184
#> GSM99472     1  0.1860     0.9112 0.948 0.052 0.000
#> GSM99474     3  0.4346     0.7554 0.184 0.000 0.816
#> GSM99476     3  0.5560     0.5565 0.000 0.300 0.700
#> GSM99478     3  0.5098     0.6456 0.000 0.248 0.752
#> GSM99480     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99482     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99484     3  0.5327     0.6084 0.000 0.272 0.728
#> GSM99486     2  0.4796     0.7895 0.000 0.780 0.220
#> GSM99488     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99490     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99492     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99494     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99524     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99526     2  0.5708     0.7886 0.028 0.768 0.204
#> GSM99528     3  0.5780     0.7492 0.080 0.120 0.800
#> GSM99530     3  0.0892     0.8491 0.020 0.000 0.980
#> GSM99532     3  0.3340     0.7936 0.120 0.000 0.880
#> GSM99534     2  0.2959     0.8288 0.100 0.900 0.000
#> GSM99536     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99538     3  0.5216     0.6278 0.000 0.260 0.740
#> GSM99540     1  0.3879     0.8113 0.848 0.000 0.152
#> GSM99542     2  0.1529     0.8575 0.040 0.960 0.000
#> GSM99544     3  0.6302    -0.0108 0.000 0.480 0.520
#> GSM99546     2  0.7393     0.7107 0.140 0.704 0.156
#> GSM99548     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99550     3  0.9328     0.4405 0.232 0.248 0.520
#> GSM99552     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99554     2  0.2537     0.8665 0.000 0.920 0.080
#> GSM99556     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99558     3  0.0892     0.8468 0.000 0.020 0.980
#> GSM99560     2  0.4702     0.7974 0.000 0.788 0.212
#> GSM99562     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99564     2  0.4750     0.7936 0.000 0.784 0.216
#> GSM99572     2  0.0000     0.8800 0.000 1.000 0.000
#> GSM99576     3  0.5948     0.4730 0.360 0.000 0.640
#> GSM99578     2  0.5785     0.5968 0.000 0.668 0.332
#> GSM99580     3  0.0000     0.8546 0.000 0.000 1.000
#> GSM99582     3  0.4605     0.7330 0.204 0.000 0.796
#> GSM99584     2  0.4842     0.7852 0.000 0.776 0.224
#> GSM99586     1  0.0000     0.9588 1.000 0.000 0.000
#> GSM99588     3  0.5058     0.6516 0.000 0.244 0.756
#> GSM99590     2  0.0000     0.8800 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000    0.79805 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000    0.81227 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0779    0.80835 0.980 0.000 0.004 0.016
#> GSM99506     3  0.0000    0.79805 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000    0.79805 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000    0.81227 1.000 0.000 0.000 0.000
#> GSM99592     3  0.1389    0.80520 0.000 0.000 0.952 0.048
#> GSM99594     3  0.0336    0.80007 0.000 0.000 0.992 0.008
#> GSM99468     1  0.2760    0.75805 0.872 0.000 0.000 0.128
#> GSM99498     1  0.2760    0.75805 0.872 0.000 0.000 0.128
#> GSM99500     1  0.1557    0.80023 0.944 0.000 0.000 0.056
#> GSM99508     3  0.1356    0.78139 0.008 0.000 0.960 0.032
#> GSM99568     3  0.1118    0.78376 0.000 0.000 0.964 0.036
#> GSM99596     3  0.3392    0.67519 0.020 0.000 0.856 0.124
#> GSM99600     2  0.1297    0.81330 0.000 0.964 0.016 0.020
#> GSM99458     1  0.4605    0.46295 0.664 0.000 0.000 0.336
#> GSM99460     4  0.4617    0.72272 0.204 0.000 0.032 0.764
#> GSM99510     3  0.2053    0.80452 0.000 0.004 0.924 0.072
#> GSM99512     3  0.0000    0.79805 0.000 0.000 1.000 0.000
#> GSM99514     3  0.0336    0.80026 0.000 0.000 0.992 0.008
#> GSM99516     1  0.0000    0.81227 1.000 0.000 0.000 0.000
#> GSM99518     1  0.2868    0.75915 0.864 0.000 0.000 0.136
#> GSM99520     3  0.1940    0.80341 0.000 0.000 0.924 0.076
#> GSM99522     3  0.7449   -0.25922 0.356 0.000 0.464 0.180
#> GSM99570     1  0.0000    0.81227 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000    0.81227 1.000 0.000 0.000 0.000
#> GSM99432     2  0.5396    0.74136 0.000 0.740 0.156 0.104
#> GSM99434     3  0.4103    0.75504 0.000 0.000 0.744 0.256
#> GSM99436     2  0.0592    0.81018 0.000 0.984 0.000 0.016
#> GSM99438     2  0.0707    0.80639 0.000 0.980 0.000 0.020
#> GSM99440     1  0.0000    0.81227 1.000 0.000 0.000 0.000
#> GSM99442     2  0.3674    0.79268 0.000 0.852 0.104 0.044
#> GSM99444     2  0.2385    0.79318 0.000 0.920 0.052 0.028
#> GSM99446     2  0.4614    0.76832 0.000 0.792 0.144 0.064
#> GSM99448     3  0.2921    0.79497 0.000 0.000 0.860 0.140
#> GSM99450     3  0.3653    0.70565 0.028 0.000 0.844 0.128
#> GSM99452     1  0.2408    0.77014 0.896 0.000 0.000 0.104
#> GSM99454     1  0.0188    0.81205 0.996 0.000 0.000 0.004
#> GSM99456     4  0.4193    0.66440 0.268 0.000 0.000 0.732
#> GSM99462     2  0.0707    0.80639 0.000 0.980 0.000 0.020
#> GSM99464     4  0.5383    0.60470 0.036 0.000 0.292 0.672
#> GSM99466     3  0.6521    0.66658 0.000 0.124 0.620 0.256
#> GSM99470     1  0.8678   -0.23060 0.400 0.092 0.116 0.392
#> GSM99472     1  0.4678    0.58162 0.744 0.024 0.000 0.232
#> GSM99474     3  0.5395    0.73248 0.084 0.000 0.732 0.184
#> GSM99476     3  0.6975    0.58968 0.000 0.200 0.584 0.216
#> GSM99478     3  0.6538    0.66937 0.000 0.140 0.628 0.232
#> GSM99480     1  0.2149    0.75442 0.912 0.000 0.000 0.088
#> GSM99482     1  0.2149    0.77470 0.912 0.000 0.000 0.088
#> GSM99484     3  0.6672    0.64516 0.000 0.168 0.620 0.212
#> GSM99486     2  0.5325    0.74120 0.000 0.744 0.160 0.096
#> GSM99488     2  0.1022    0.80505 0.000 0.968 0.000 0.032
#> GSM99490     2  0.0469    0.81133 0.000 0.988 0.000 0.012
#> GSM99492     1  0.4972   -0.11908 0.544 0.000 0.000 0.456
#> GSM99494     2  0.0707    0.80639 0.000 0.980 0.000 0.020
#> GSM99524     1  0.0000    0.81227 1.000 0.000 0.000 0.000
#> GSM99526     2  0.6022    0.67370 0.004 0.668 0.076 0.252
#> GSM99528     3  0.5454    0.69324 0.028 0.004 0.664 0.304
#> GSM99530     3  0.1389    0.78528 0.000 0.000 0.952 0.048
#> GSM99532     3  0.2635    0.73146 0.020 0.000 0.904 0.076
#> GSM99534     2  0.4720    0.65577 0.016 0.720 0.000 0.264
#> GSM99536     1  0.2868    0.75370 0.864 0.000 0.000 0.136
#> GSM99538     3  0.6683    0.61824 0.000 0.204 0.620 0.176
#> GSM99540     1  0.7232    0.13581 0.516 0.000 0.164 0.320
#> GSM99542     2  0.3610    0.68562 0.000 0.800 0.000 0.200
#> GSM99544     2  0.7251   -0.00348 0.000 0.440 0.416 0.144
#> GSM99546     2  0.7068    0.51612 0.032 0.556 0.064 0.348
#> GSM99548     2  0.0817    0.80574 0.000 0.976 0.000 0.024
#> GSM99550     4  0.3363    0.71185 0.072 0.024 0.020 0.884
#> GSM99552     3  0.3801    0.76786 0.000 0.000 0.780 0.220
#> GSM99554     2  0.2675    0.81047 0.000 0.908 0.048 0.044
#> GSM99556     2  0.2149    0.78374 0.000 0.912 0.000 0.088
#> GSM99558     3  0.3852    0.77806 0.000 0.008 0.800 0.192
#> GSM99560     2  0.5321    0.75622 0.000 0.748 0.112 0.140
#> GSM99562     3  0.0000    0.79805 0.000 0.000 1.000 0.000
#> GSM99564     2  0.5141    0.74832 0.000 0.756 0.160 0.084
#> GSM99572     2  0.0707    0.80639 0.000 0.980 0.000 0.020
#> GSM99576     4  0.5066    0.67626 0.112 0.000 0.120 0.768
#> GSM99578     2  0.6500    0.56911 0.000 0.620 0.260 0.120
#> GSM99580     3  0.2408    0.80088 0.000 0.000 0.896 0.104
#> GSM99582     3  0.6293    0.59911 0.096 0.000 0.628 0.276
#> GSM99584     2  0.5574    0.74574 0.000 0.728 0.124 0.148
#> GSM99586     4  0.4454    0.60426 0.308 0.000 0.000 0.692
#> GSM99588     3  0.6403    0.68039 0.000 0.128 0.640 0.232
#> GSM99590     2  0.0336    0.80880 0.000 0.992 0.000 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
#> GSM99496     3  0.0000      0.833 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0404      0.874 0.988 0.000 0.000 0.000 0.012
#> GSM99506     3  0.0000      0.833 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0000      0.833 0.000 0.000 1.000 0.000 0.000
#> GSM99574     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.3932      0.358 0.000 0.000 0.672 0.328 0.000
#> GSM99594     3  0.1478      0.794 0.000 0.000 0.936 0.064 0.000
#> GSM99468     1  0.1965      0.839 0.904 0.000 0.000 0.000 0.096
#> GSM99498     1  0.1965      0.839 0.904 0.000 0.000 0.000 0.096
#> GSM99500     1  0.1197      0.865 0.952 0.000 0.000 0.000 0.048
#> GSM99508     3  0.0703      0.826 0.000 0.000 0.976 0.000 0.024
#> GSM99568     3  0.0703      0.826 0.000 0.000 0.976 0.000 0.024
#> GSM99596     3  0.1792      0.776 0.000 0.000 0.916 0.000 0.084
#> GSM99600     2  0.4508      0.667 0.000 0.648 0.000 0.332 0.020
#> GSM99458     1  0.4273      0.254 0.552 0.000 0.000 0.000 0.448
#> GSM99460     5  0.0955      0.660 0.028 0.000 0.004 0.000 0.968
#> GSM99510     3  0.3636      0.487 0.000 0.000 0.728 0.272 0.000
#> GSM99512     3  0.0162      0.832 0.000 0.000 0.996 0.004 0.000
#> GSM99514     3  0.0703      0.824 0.000 0.000 0.976 0.024 0.000
#> GSM99516     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.3143      0.726 0.796 0.000 0.000 0.000 0.204
#> GSM99520     3  0.4171      0.172 0.000 0.000 0.604 0.396 0.000
#> GSM99522     3  0.3644      0.643 0.096 0.000 0.824 0.000 0.080
#> GSM99570     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.4781     -0.378 0.000 0.428 0.000 0.552 0.020
#> GSM99434     4  0.5086      0.469 0.000 0.000 0.304 0.636 0.060
#> GSM99436     2  0.4473      0.672 0.000 0.656 0.000 0.324 0.020
#> GSM99438     2  0.0000      0.756 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.5334      0.595 0.000 0.588 0.028 0.364 0.020
#> GSM99444     2  0.0609      0.747 0.000 0.980 0.000 0.020 0.000
#> GSM99446     2  0.4830      0.444 0.000 0.492 0.000 0.488 0.020
#> GSM99448     4  0.4088      0.408 0.000 0.000 0.368 0.632 0.000
#> GSM99450     3  0.3160      0.666 0.000 0.000 0.808 0.004 0.188
#> GSM99452     1  0.2648      0.776 0.848 0.000 0.000 0.000 0.152
#> GSM99454     1  0.0290      0.875 0.992 0.000 0.000 0.000 0.008
#> GSM99456     5  0.1043      0.657 0.040 0.000 0.000 0.000 0.960
#> GSM99462     2  0.0000      0.756 0.000 1.000 0.000 0.000 0.000
#> GSM99464     3  0.4397      0.163 0.004 0.000 0.564 0.000 0.432
#> GSM99466     4  0.4042      0.553 0.000 0.000 0.212 0.756 0.032
#> GSM99470     5  0.8216      0.222 0.328 0.088 0.056 0.092 0.436
#> GSM99472     1  0.4444      0.389 0.624 0.000 0.000 0.012 0.364
#> GSM99474     4  0.4892      0.480 0.008 0.000 0.304 0.656 0.032
#> GSM99476     4  0.5152      0.546 0.000 0.064 0.200 0.712 0.024
#> GSM99478     4  0.3789      0.551 0.000 0.000 0.224 0.760 0.016
#> GSM99480     1  0.2127      0.798 0.892 0.000 0.000 0.000 0.108
#> GSM99482     1  0.2329      0.799 0.876 0.000 0.000 0.000 0.124
#> GSM99484     4  0.4065      0.556 0.000 0.020 0.212 0.760 0.008
#> GSM99486     4  0.4767     -0.361 0.000 0.420 0.000 0.560 0.020
#> GSM99488     2  0.0290      0.754 0.000 0.992 0.000 0.008 0.000
#> GSM99490     2  0.4437      0.683 0.000 0.664 0.000 0.316 0.020
#> GSM99492     5  0.4242      0.111 0.428 0.000 0.000 0.000 0.572
#> GSM99494     2  0.0000      0.756 0.000 1.000 0.000 0.000 0.000
#> GSM99524     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM99526     2  0.6728      0.402 0.000 0.416 0.000 0.276 0.308
#> GSM99528     4  0.4898      0.515 0.000 0.000 0.248 0.684 0.068
#> GSM99530     3  0.1965      0.810 0.000 0.000 0.924 0.052 0.024
#> GSM99532     3  0.0162      0.833 0.000 0.000 0.996 0.004 0.000
#> GSM99534     2  0.6773      0.336 0.000 0.380 0.000 0.276 0.344
#> GSM99536     1  0.2074      0.835 0.896 0.000 0.000 0.000 0.104
#> GSM99538     4  0.3487      0.556 0.000 0.008 0.212 0.780 0.000
#> GSM99540     5  0.6324      0.151 0.156 0.000 0.412 0.000 0.432
#> GSM99542     2  0.1670      0.707 0.000 0.936 0.000 0.012 0.052
#> GSM99544     4  0.4823      0.402 0.000 0.156 0.096 0.740 0.008
#> GSM99546     5  0.6719     -0.384 0.000 0.372 0.000 0.248 0.380
#> GSM99548     2  0.0290      0.754 0.000 0.992 0.000 0.008 0.000
#> GSM99550     5  0.0693      0.659 0.008 0.000 0.000 0.012 0.980
#> GSM99552     4  0.4348      0.476 0.000 0.000 0.316 0.668 0.016
#> GSM99554     2  0.4626      0.636 0.000 0.616 0.000 0.364 0.020
#> GSM99556     2  0.0404      0.752 0.000 0.988 0.000 0.012 0.000
#> GSM99558     4  0.4165      0.473 0.000 0.000 0.320 0.672 0.008
#> GSM99560     4  0.5721     -0.436 0.000 0.424 0.000 0.492 0.084
#> GSM99562     3  0.0000      0.833 0.000 0.000 1.000 0.000 0.000
#> GSM99564     4  0.4798     -0.398 0.000 0.440 0.000 0.540 0.020
#> GSM99572     2  0.0000      0.756 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.3349      0.625 0.016 0.000 0.052 0.072 0.860
#> GSM99578     4  0.5858     -0.123 0.000 0.348 0.064 0.568 0.020
#> GSM99580     4  0.4287      0.213 0.000 0.000 0.460 0.540 0.000
#> GSM99582     4  0.6686      0.148 0.012 0.000 0.400 0.428 0.160
#> GSM99584     4  0.6158     -0.455 0.000 0.416 0.000 0.452 0.132
#> GSM99586     5  0.2377      0.600 0.128 0.000 0.000 0.000 0.872
#> GSM99588     4  0.4153      0.545 0.000 0.008 0.236 0.740 0.016
#> GSM99590     2  0.2690      0.741 0.000 0.844 0.000 0.156 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0363     0.8771 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99502     1  0.0000     0.8659 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0870     0.8619 0.972 0.000 0.012 0.000 0.004 0.012
#> GSM99506     3  0.0458     0.8774 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM99566     3  0.0547     0.8768 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM99574     1  0.0000     0.8659 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     6  0.3847     0.2161 0.000 0.000 0.456 0.000 0.000 0.544
#> GSM99594     3  0.2378     0.7714 0.000 0.000 0.848 0.000 0.000 0.152
#> GSM99468     1  0.1585     0.8571 0.940 0.000 0.012 0.000 0.036 0.012
#> GSM99498     1  0.1585     0.8571 0.940 0.000 0.012 0.000 0.036 0.012
#> GSM99500     1  0.1511     0.8583 0.944 0.000 0.012 0.000 0.032 0.012
#> GSM99508     3  0.0146     0.8755 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99568     3  0.0146     0.8745 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99596     3  0.0000     0.8736 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99600     4  0.0363     0.9000 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM99458     1  0.3945     0.4427 0.612 0.000 0.000 0.008 0.380 0.000
#> GSM99460     5  0.0260     0.8527 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM99510     3  0.3727     0.3752 0.000 0.000 0.612 0.000 0.000 0.388
#> GSM99512     3  0.0790     0.8750 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM99514     3  0.1387     0.8553 0.000 0.000 0.932 0.000 0.000 0.068
#> GSM99516     1  0.0000     0.8659 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.3231     0.7442 0.800 0.000 0.008 0.000 0.180 0.012
#> GSM99520     6  0.3706     0.4528 0.000 0.000 0.380 0.000 0.000 0.620
#> GSM99522     3  0.0405     0.8722 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM99570     1  0.0000     0.8659 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.8659 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0937     0.8925 0.000 0.000 0.000 0.960 0.000 0.040
#> GSM99434     6  0.1010     0.8342 0.000 0.000 0.036 0.000 0.004 0.960
#> GSM99436     4  0.0363     0.9003 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM99438     2  0.0937     0.9043 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM99440     1  0.0000     0.8659 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.2190     0.8594 0.000 0.040 0.000 0.900 0.000 0.060
#> GSM99444     2  0.0363     0.9124 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM99446     4  0.0291     0.9006 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM99448     6  0.1387     0.8263 0.000 0.000 0.068 0.000 0.000 0.932
#> GSM99450     3  0.3594     0.7140 0.000 0.000 0.780 0.008 0.184 0.028
#> GSM99452     1  0.2734     0.7802 0.840 0.000 0.004 0.000 0.148 0.008
#> GSM99454     1  0.0260     0.8655 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM99456     5  0.0260     0.8527 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM99462     2  0.0146     0.9130 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM99464     3  0.3421     0.6332 0.000 0.000 0.736 0.008 0.256 0.000
#> GSM99466     6  0.0458     0.8361 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM99470     1  0.7297    -0.1306 0.348 0.000 0.000 0.132 0.344 0.176
#> GSM99472     1  0.4161     0.4827 0.632 0.000 0.000 0.016 0.348 0.004
#> GSM99474     6  0.1003     0.8341 0.000 0.000 0.016 0.000 0.020 0.964
#> GSM99476     6  0.2416     0.7533 0.000 0.000 0.000 0.156 0.000 0.844
#> GSM99478     6  0.0405     0.8387 0.000 0.000 0.004 0.008 0.000 0.988
#> GSM99480     1  0.2048     0.7748 0.880 0.000 0.000 0.000 0.120 0.000
#> GSM99482     1  0.1910     0.8092 0.892 0.000 0.000 0.000 0.108 0.000
#> GSM99484     6  0.2340     0.7737 0.000 0.000 0.000 0.148 0.000 0.852
#> GSM99486     4  0.0260     0.9006 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM99488     2  0.0000     0.9113 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     4  0.1908     0.8496 0.000 0.096 0.000 0.900 0.000 0.004
#> GSM99492     5  0.3804     0.4449 0.336 0.000 0.000 0.000 0.656 0.008
#> GSM99494     2  0.0000     0.9113 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.0000     0.8659 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99526     4  0.2762     0.7534 0.000 0.000 0.000 0.804 0.196 0.000
#> GSM99528     6  0.0260     0.8389 0.000 0.000 0.008 0.000 0.000 0.992
#> GSM99530     3  0.2340     0.7708 0.000 0.000 0.852 0.000 0.000 0.148
#> GSM99532     3  0.0865     0.8742 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM99534     4  0.3023     0.7050 0.000 0.000 0.000 0.768 0.232 0.000
#> GSM99536     1  0.1657     0.8563 0.936 0.000 0.012 0.000 0.040 0.012
#> GSM99538     6  0.1141     0.8282 0.000 0.000 0.000 0.052 0.000 0.948
#> GSM99540     3  0.4512     0.3955 0.024 0.000 0.616 0.000 0.348 0.012
#> GSM99542     2  0.0146     0.9097 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM99544     6  0.3706     0.3850 0.000 0.000 0.000 0.380 0.000 0.620
#> GSM99546     4  0.3915     0.6086 0.000 0.000 0.004 0.692 0.288 0.016
#> GSM99548     2  0.0937     0.9043 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM99550     5  0.0291     0.8529 0.000 0.000 0.000 0.004 0.992 0.004
#> GSM99552     6  0.0363     0.8397 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM99554     4  0.0790     0.8950 0.000 0.032 0.000 0.968 0.000 0.000
#> GSM99556     2  0.0260     0.9136 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM99558     6  0.0547     0.8404 0.000 0.000 0.020 0.000 0.000 0.980
#> GSM99560     4  0.0260     0.9006 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM99562     3  0.0458     0.8773 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM99564     4  0.0260     0.9006 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM99572     2  0.0937     0.9043 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM99576     5  0.2709     0.7579 0.000 0.000 0.020 0.000 0.848 0.132
#> GSM99578     4  0.2597     0.7570 0.000 0.000 0.000 0.824 0.000 0.176
#> GSM99580     6  0.2762     0.7384 0.000 0.000 0.196 0.000 0.000 0.804
#> GSM99582     6  0.4858     0.5908 0.000 0.000 0.180 0.000 0.156 0.664
#> GSM99584     4  0.1196     0.8884 0.000 0.000 0.000 0.952 0.040 0.008
#> GSM99586     5  0.1700     0.8208 0.080 0.000 0.000 0.000 0.916 0.004
#> GSM99588     6  0.0405     0.8395 0.000 0.000 0.008 0.004 0.000 0.988
#> GSM99590     2  0.3867    -0.0122 0.000 0.512 0.000 0.488 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) cell.type(p) k
#> CV:pam 84         2.30e-02      0.04396 2
#> CV:pam 81         1.67e-03      0.02369 3
#> CV:pam 79         1.46e-03      0.04433 4
#> CV:pam 58         3.15e-04      0.02751 5
#> CV:pam 75         1.08e-05      0.00434 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.290           0.807       0.841         0.4366 0.545   0.545
#> 3 3 0.785           0.760       0.905         0.5069 0.752   0.557
#> 4 4 0.675           0.753       0.845         0.0952 0.859   0.622
#> 5 5 0.823           0.754       0.893         0.0974 0.853   0.541
#> 6 6 0.802           0.755       0.864         0.0295 0.959   0.818

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
#> GSM99496     2  0.5519      0.697 0.128 0.872
#> GSM99502     1  0.0000      0.950 1.000 0.000
#> GSM99504     1  0.0376      0.947 0.996 0.004
#> GSM99506     2  0.5519      0.697 0.128 0.872
#> GSM99566     2  0.5519      0.697 0.128 0.872
#> GSM99574     1  0.0000      0.950 1.000 0.000
#> GSM99592     2  0.5519      0.697 0.128 0.872
#> GSM99594     2  0.5519      0.697 0.128 0.872
#> GSM99468     1  0.0000      0.950 1.000 0.000
#> GSM99498     1  0.0000      0.950 1.000 0.000
#> GSM99500     1  0.0000      0.950 1.000 0.000
#> GSM99508     2  0.5519      0.697 0.128 0.872
#> GSM99568     2  0.5519      0.697 0.128 0.872
#> GSM99596     2  0.6887      0.721 0.184 0.816
#> GSM99600     2  0.8207      0.809 0.256 0.744
#> GSM99458     1  0.2948      0.922 0.948 0.052
#> GSM99460     1  0.2948      0.922 0.948 0.052
#> GSM99510     2  0.2423      0.721 0.040 0.960
#> GSM99512     2  0.4690      0.717 0.100 0.900
#> GSM99514     2  0.6801      0.719 0.180 0.820
#> GSM99516     1  0.0000      0.950 1.000 0.000
#> GSM99518     1  0.0000      0.950 1.000 0.000
#> GSM99520     2  0.5519      0.697 0.128 0.872
#> GSM99522     2  0.9209      0.699 0.336 0.664
#> GSM99570     1  0.0376      0.947 0.996 0.004
#> GSM99598     1  0.0000      0.950 1.000 0.000
#> GSM99432     2  0.8016      0.809 0.244 0.756
#> GSM99434     2  0.1843      0.721 0.028 0.972
#> GSM99436     2  0.8207      0.809 0.256 0.744
#> GSM99438     2  0.8207      0.809 0.256 0.744
#> GSM99440     1  0.0000      0.950 1.000 0.000
#> GSM99442     2  0.8207      0.809 0.256 0.744
#> GSM99444     2  0.8207      0.809 0.256 0.744
#> GSM99446     2  0.8207      0.809 0.256 0.744
#> GSM99448     2  0.4431      0.720 0.092 0.908
#> GSM99450     2  0.5408      0.691 0.124 0.876
#> GSM99452     1  0.1184      0.938 0.984 0.016
#> GSM99454     1  0.0000      0.950 1.000 0.000
#> GSM99456     1  0.2948      0.922 0.948 0.052
#> GSM99462     2  0.8207      0.809 0.256 0.744
#> GSM99464     1  0.8499      0.549 0.724 0.276
#> GSM99466     2  0.8016      0.809 0.244 0.756
#> GSM99470     1  0.6048      0.783 0.852 0.148
#> GSM99472     1  0.2778      0.925 0.952 0.048
#> GSM99474     2  0.5946      0.705 0.144 0.856
#> GSM99476     2  0.1414      0.720 0.020 0.980
#> GSM99478     2  0.8081      0.810 0.248 0.752
#> GSM99480     1  0.0000      0.950 1.000 0.000
#> GSM99482     1  0.1184      0.938 0.984 0.016
#> GSM99484     2  0.8207      0.809 0.256 0.744
#> GSM99486     2  0.8081      0.810 0.248 0.752
#> GSM99488     2  0.8207      0.809 0.256 0.744
#> GSM99490     2  0.8207      0.809 0.256 0.744
#> GSM99492     1  0.0000      0.950 1.000 0.000
#> GSM99494     2  0.8207      0.809 0.256 0.744
#> GSM99524     1  0.0000      0.950 1.000 0.000
#> GSM99526     2  0.9522      0.685 0.372 0.628
#> GSM99528     2  0.8081      0.810 0.248 0.752
#> GSM99530     1  0.7883      0.582 0.764 0.236
#> GSM99532     2  0.9833      0.639 0.424 0.576
#> GSM99534     2  0.9608      0.638 0.384 0.616
#> GSM99536     1  0.0000      0.950 1.000 0.000
#> GSM99538     2  0.8144      0.808 0.252 0.748
#> GSM99540     1  0.2603      0.923 0.956 0.044
#> GSM99542     2  0.9580      0.645 0.380 0.620
#> GSM99544     2  0.7674      0.808 0.224 0.776
#> GSM99546     2  0.9248      0.731 0.340 0.660
#> GSM99548     2  0.8207      0.809 0.256 0.744
#> GSM99550     1  0.4690      0.875 0.900 0.100
#> GSM99552     2  0.9460      0.734 0.364 0.636
#> GSM99554     2  0.8207      0.809 0.256 0.744
#> GSM99556     2  0.8207      0.809 0.256 0.744
#> GSM99558     2  0.5408      0.755 0.124 0.876
#> GSM99560     2  0.8081      0.810 0.248 0.752
#> GSM99562     2  0.5519      0.697 0.128 0.872
#> GSM99564     2  0.8016      0.809 0.244 0.756
#> GSM99572     2  0.8207      0.809 0.256 0.744
#> GSM99576     1  0.2778      0.925 0.952 0.048
#> GSM99578     2  0.8207      0.809 0.256 0.744
#> GSM99580     2  0.5519      0.697 0.128 0.872
#> GSM99582     2  0.9775      0.680 0.412 0.588
#> GSM99584     2  0.8555      0.793 0.280 0.720
#> GSM99586     1  0.0000      0.950 1.000 0.000
#> GSM99588     2  0.8207      0.809 0.256 0.744
#> GSM99590     2  0.8207      0.809 0.256 0.744

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM99496     3  0.0000     0.8185 0.000 0.000 1.000
#> GSM99502     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99504     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99506     3  0.0000     0.8185 0.000 0.000 1.000
#> GSM99566     3  0.0000     0.8185 0.000 0.000 1.000
#> GSM99574     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99592     3  0.0237     0.8186 0.000 0.004 0.996
#> GSM99594     3  0.0237     0.8186 0.000 0.004 0.996
#> GSM99468     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99498     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99500     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99508     3  0.0000     0.8185 0.000 0.000 1.000
#> GSM99568     3  0.0237     0.8186 0.000 0.004 0.996
#> GSM99596     3  0.0592     0.8153 0.012 0.000 0.988
#> GSM99600     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99458     1  0.1643     0.9525 0.956 0.000 0.044
#> GSM99460     1  0.2356     0.9239 0.928 0.000 0.072
#> GSM99510     3  0.0000     0.8185 0.000 0.000 1.000
#> GSM99512     3  0.0237     0.8186 0.000 0.004 0.996
#> GSM99514     3  0.0237     0.8186 0.000 0.004 0.996
#> GSM99516     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99518     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99520     3  0.0000     0.8185 0.000 0.000 1.000
#> GSM99522     3  0.6079     0.4355 0.388 0.000 0.612
#> GSM99570     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99432     2  0.2448     0.8091 0.000 0.924 0.076
#> GSM99434     3  0.0747     0.8126 0.000 0.016 0.984
#> GSM99436     2  0.0592     0.8458 0.000 0.988 0.012
#> GSM99438     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99440     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99442     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99444     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99446     2  0.0592     0.8458 0.000 0.988 0.012
#> GSM99448     3  0.6168     0.2186 0.000 0.412 0.588
#> GSM99450     3  0.0892     0.8100 0.000 0.020 0.980
#> GSM99452     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99456     1  0.1411     0.9593 0.964 0.000 0.036
#> GSM99462     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99464     3  0.7102     0.3628 0.420 0.024 0.556
#> GSM99466     2  0.6307     0.0822 0.000 0.512 0.488
#> GSM99470     1  0.1289     0.9622 0.968 0.000 0.032
#> GSM99472     1  0.1289     0.9622 0.968 0.000 0.032
#> GSM99474     3  0.0237     0.8186 0.000 0.004 0.996
#> GSM99476     3  0.3412     0.7195 0.000 0.124 0.876
#> GSM99478     2  0.5397     0.5626 0.000 0.720 0.280
#> GSM99480     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99482     1  0.0237     0.9786 0.996 0.000 0.004
#> GSM99484     2  0.1411     0.8342 0.000 0.964 0.036
#> GSM99486     2  0.3340     0.7702 0.000 0.880 0.120
#> GSM99488     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99490     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99492     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99494     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99524     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99526     3  0.8513     0.3644 0.116 0.316 0.568
#> GSM99528     2  0.6307     0.0822 0.000 0.512 0.488
#> GSM99530     3  0.6192     0.3742 0.420 0.000 0.580
#> GSM99532     3  0.1643     0.7988 0.044 0.000 0.956
#> GSM99534     2  0.1289     0.8362 0.000 0.968 0.032
#> GSM99536     1  0.0000     0.9803 1.000 0.000 0.000
#> GSM99538     2  0.6308     0.0673 0.000 0.508 0.492
#> GSM99540     1  0.1289     0.9622 0.968 0.000 0.032
#> GSM99542     2  0.0592     0.8458 0.000 0.988 0.012
#> GSM99544     2  0.6305     0.0957 0.000 0.516 0.484
#> GSM99546     3  0.6252     0.1207 0.000 0.444 0.556
#> GSM99548     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99550     1  0.3983     0.8209 0.852 0.004 0.144
#> GSM99552     3  0.6168     0.2186 0.000 0.412 0.588
#> GSM99554     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99556     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99558     3  0.6192     0.1950 0.000 0.420 0.580
#> GSM99560     2  0.6302     0.1080 0.000 0.520 0.480
#> GSM99562     3  0.0000     0.8185 0.000 0.000 1.000
#> GSM99564     2  0.2537     0.8061 0.000 0.920 0.080
#> GSM99572     2  0.0000     0.8467 0.000 1.000 0.000
#> GSM99576     1  0.1289     0.9622 0.968 0.000 0.032
#> GSM99578     2  0.0592     0.8458 0.000 0.988 0.012
#> GSM99580     3  0.0000     0.8185 0.000 0.000 1.000
#> GSM99582     3  0.6192     0.3742 0.420 0.000 0.580
#> GSM99584     2  0.6305     0.0873 0.000 0.516 0.484
#> GSM99586     1  0.0237     0.9786 0.996 0.000 0.004
#> GSM99588     2  0.0592     0.8458 0.000 0.988 0.012
#> GSM99590     2  0.0000     0.8467 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.4761      0.702 0.372 0.000 0.628 0.000
#> GSM99502     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99504     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99506     3  0.4761      0.702 0.372 0.000 0.628 0.000
#> GSM99566     3  0.4761      0.702 0.372 0.000 0.628 0.000
#> GSM99574     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99592     3  0.2921      0.805 0.140 0.000 0.860 0.000
#> GSM99594     3  0.4761      0.702 0.372 0.000 0.628 0.000
#> GSM99468     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99498     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99500     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99508     3  0.4761      0.702 0.372 0.000 0.628 0.000
#> GSM99568     3  0.2921      0.805 0.140 0.000 0.860 0.000
#> GSM99596     3  0.4761      0.702 0.372 0.000 0.628 0.000
#> GSM99600     2  0.0707      0.878 0.000 0.980 0.020 0.000
#> GSM99458     1  0.6651      0.639 0.616 0.000 0.148 0.236
#> GSM99460     4  0.5256      0.657 0.064 0.000 0.204 0.732
#> GSM99510     3  0.0592      0.790 0.016 0.000 0.984 0.000
#> GSM99512     3  0.2011      0.806 0.080 0.000 0.920 0.000
#> GSM99514     3  0.4761      0.702 0.372 0.000 0.628 0.000
#> GSM99516     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99518     1  0.4877      0.891 0.592 0.000 0.000 0.408
#> GSM99520     3  0.3801      0.781 0.220 0.000 0.780 0.000
#> GSM99522     3  0.4175      0.781 0.200 0.000 0.784 0.016
#> GSM99570     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99598     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99432     2  0.4936      0.577 0.000 0.624 0.372 0.004
#> GSM99434     3  0.0779      0.788 0.016 0.000 0.980 0.004
#> GSM99436     2  0.1389      0.869 0.000 0.952 0.048 0.000
#> GSM99438     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99440     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99442     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99444     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99446     2  0.2760      0.816 0.000 0.872 0.128 0.000
#> GSM99448     3  0.1716      0.804 0.064 0.000 0.936 0.000
#> GSM99450     3  0.0779      0.788 0.016 0.000 0.980 0.004
#> GSM99452     1  0.4776      0.930 0.624 0.000 0.000 0.376
#> GSM99454     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99456     4  0.3351      0.688 0.008 0.000 0.148 0.844
#> GSM99462     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99464     3  0.3907      0.536 0.000 0.000 0.768 0.232
#> GSM99466     3  0.0188      0.782 0.000 0.000 0.996 0.004
#> GSM99470     1  0.6613      0.602 0.628 0.000 0.172 0.200
#> GSM99472     1  0.6565      0.655 0.628 0.000 0.148 0.224
#> GSM99474     3  0.2868      0.805 0.136 0.000 0.864 0.000
#> GSM99476     3  0.0188      0.782 0.000 0.000 0.996 0.004
#> GSM99478     2  0.4978      0.561 0.000 0.612 0.384 0.004
#> GSM99480     4  0.4500     -0.262 0.316 0.000 0.000 0.684
#> GSM99482     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99484     2  0.4277      0.676 0.000 0.720 0.280 0.000
#> GSM99486     2  0.4730      0.591 0.000 0.636 0.364 0.000
#> GSM99488     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99490     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99492     4  0.2408      0.423 0.104 0.000 0.000 0.896
#> GSM99494     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99524     1  0.4761      0.934 0.628 0.000 0.000 0.372
#> GSM99526     3  0.1557      0.754 0.000 0.000 0.944 0.056
#> GSM99528     3  0.4274      0.619 0.000 0.044 0.808 0.148
#> GSM99530     4  0.5577      0.495 0.036 0.000 0.328 0.636
#> GSM99532     3  0.2814      0.806 0.132 0.000 0.868 0.000
#> GSM99534     2  0.3356      0.763 0.000 0.824 0.176 0.000
#> GSM99536     4  0.3444      0.242 0.184 0.000 0.000 0.816
#> GSM99538     3  0.0188      0.782 0.000 0.000 0.996 0.004
#> GSM99540     4  0.3547      0.685 0.016 0.000 0.144 0.840
#> GSM99542     2  0.0707      0.878 0.000 0.980 0.020 0.000
#> GSM99544     3  0.1824      0.740 0.000 0.060 0.936 0.004
#> GSM99546     3  0.0817      0.773 0.000 0.000 0.976 0.024
#> GSM99548     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99550     4  0.4697      0.504 0.000 0.000 0.356 0.644
#> GSM99552     3  0.2647      0.806 0.120 0.000 0.880 0.000
#> GSM99554     2  0.0707      0.878 0.000 0.980 0.020 0.000
#> GSM99556     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99558     3  0.1637      0.803 0.060 0.000 0.940 0.000
#> GSM99560     3  0.4819      0.225 0.000 0.344 0.652 0.004
#> GSM99562     3  0.4761      0.702 0.372 0.000 0.628 0.000
#> GSM99564     2  0.4746      0.587 0.000 0.632 0.368 0.000
#> GSM99572     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM99576     4  0.3257      0.688 0.004 0.000 0.152 0.844
#> GSM99578     2  0.0707      0.878 0.000 0.980 0.020 0.000
#> GSM99580     3  0.4250      0.756 0.276 0.000 0.724 0.000
#> GSM99582     3  0.3048      0.803 0.108 0.000 0.876 0.016
#> GSM99584     3  0.4283      0.468 0.000 0.256 0.740 0.004
#> GSM99586     4  0.0188      0.544 0.004 0.000 0.000 0.996
#> GSM99588     2  0.1792      0.857 0.000 0.932 0.068 0.000
#> GSM99590     2  0.0000      0.880 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0162      0.872 0.000 0.000 0.996 0.000 0.004
#> GSM99502     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0162      0.872 0.000 0.000 0.996 0.000 0.004
#> GSM99566     3  0.0162      0.872 0.000 0.000 0.996 0.000 0.004
#> GSM99574     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000      0.871 0.000 0.000 1.000 0.000 0.000
#> GSM99594     3  0.0162      0.872 0.000 0.000 0.996 0.000 0.004
#> GSM99468     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0162      0.872 0.000 0.000 0.996 0.000 0.004
#> GSM99568     3  0.0000      0.871 0.000 0.000 1.000 0.000 0.000
#> GSM99596     3  0.0162      0.872 0.000 0.000 0.996 0.000 0.004
#> GSM99600     4  0.4150      0.488 0.000 0.388 0.000 0.612 0.000
#> GSM99458     1  0.4088      0.359 0.632 0.000 0.000 0.000 0.368
#> GSM99460     5  0.1043      0.721 0.040 0.000 0.000 0.000 0.960
#> GSM99510     3  0.3707      0.659 0.000 0.000 0.716 0.284 0.000
#> GSM99512     3  0.2020      0.812 0.000 0.000 0.900 0.100 0.000
#> GSM99514     3  0.0162      0.872 0.000 0.000 0.996 0.000 0.004
#> GSM99516     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.1792      0.827 0.916 0.000 0.000 0.000 0.084
#> GSM99520     3  0.0000      0.871 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0000      0.871 0.000 0.000 1.000 0.000 0.000
#> GSM99570     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0404      0.831 0.000 0.012 0.000 0.988 0.000
#> GSM99434     3  0.3814      0.664 0.000 0.000 0.720 0.276 0.004
#> GSM99436     4  0.3336      0.692 0.000 0.228 0.000 0.772 0.000
#> GSM99438     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0162      0.903 0.996 0.000 0.000 0.000 0.004
#> GSM99442     2  0.4171      0.098 0.000 0.604 0.000 0.396 0.000
#> GSM99444     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99446     4  0.2020      0.794 0.000 0.100 0.000 0.900 0.000
#> GSM99448     3  0.3895      0.622 0.000 0.000 0.680 0.320 0.000
#> GSM99450     3  0.3336      0.684 0.000 0.000 0.772 0.000 0.228
#> GSM99452     1  0.0290      0.901 0.992 0.000 0.000 0.000 0.008
#> GSM99454     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.0324      0.724 0.004 0.000 0.000 0.004 0.992
#> GSM99462     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99464     5  0.4193      0.340 0.000 0.000 0.304 0.012 0.684
#> GSM99466     4  0.0404      0.827 0.000 0.000 0.012 0.988 0.000
#> GSM99470     1  0.1043      0.874 0.960 0.000 0.000 0.000 0.040
#> GSM99472     1  0.1121      0.870 0.956 0.000 0.000 0.000 0.044
#> GSM99474     3  0.0000      0.871 0.000 0.000 1.000 0.000 0.000
#> GSM99476     3  0.4182      0.510 0.000 0.000 0.600 0.400 0.000
#> GSM99478     4  0.0451      0.830 0.000 0.008 0.004 0.988 0.000
#> GSM99480     1  0.4264      0.227 0.620 0.000 0.000 0.004 0.376
#> GSM99482     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99484     4  0.0794      0.828 0.000 0.028 0.000 0.972 0.000
#> GSM99486     4  0.0404      0.831 0.000 0.012 0.000 0.988 0.000
#> GSM99488     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99490     2  0.1121      0.904 0.000 0.956 0.000 0.044 0.000
#> GSM99492     5  0.4430      0.227 0.456 0.000 0.000 0.004 0.540
#> GSM99494     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99524     1  0.0000      0.905 1.000 0.000 0.000 0.000 0.000
#> GSM99526     3  0.5535      0.420 0.000 0.000 0.568 0.080 0.352
#> GSM99528     4  0.2011      0.762 0.000 0.000 0.004 0.908 0.088
#> GSM99530     5  0.4040      0.560 0.000 0.000 0.276 0.012 0.712
#> GSM99532     3  0.0404      0.867 0.000 0.000 0.988 0.000 0.012
#> GSM99534     4  0.4242      0.412 0.000 0.428 0.000 0.572 0.000
#> GSM99536     1  0.4307     -0.201 0.504 0.000 0.000 0.000 0.496
#> GSM99538     4  0.0404      0.826 0.000 0.000 0.012 0.988 0.000
#> GSM99540     5  0.3452      0.654 0.244 0.000 0.000 0.000 0.756
#> GSM99542     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99544     4  0.0404      0.827 0.000 0.000 0.012 0.988 0.000
#> GSM99546     4  0.3662      0.646 0.000 0.000 0.004 0.744 0.252
#> GSM99548     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99550     5  0.0404      0.722 0.000 0.000 0.000 0.012 0.988
#> GSM99552     3  0.4227      0.191 0.000 0.000 0.580 0.420 0.000
#> GSM99554     4  0.4210      0.446 0.000 0.412 0.000 0.588 0.000
#> GSM99556     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99558     4  0.0703      0.823 0.000 0.000 0.024 0.976 0.000
#> GSM99560     4  0.0324      0.827 0.000 0.000 0.004 0.992 0.004
#> GSM99562     3  0.0162      0.872 0.000 0.000 0.996 0.000 0.004
#> GSM99564     4  0.0404      0.831 0.000 0.012 0.000 0.988 0.000
#> GSM99572     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.3461      0.671 0.224 0.000 0.000 0.004 0.772
#> GSM99578     4  0.4235      0.421 0.000 0.424 0.000 0.576 0.000
#> GSM99580     3  0.0000      0.871 0.000 0.000 1.000 0.000 0.000
#> GSM99582     3  0.0162      0.870 0.000 0.000 0.996 0.000 0.004
#> GSM99584     4  0.0740      0.830 0.000 0.008 0.004 0.980 0.008
#> GSM99586     5  0.3715      0.637 0.260 0.000 0.000 0.004 0.736
#> GSM99588     4  0.4192      0.462 0.000 0.404 0.000 0.596 0.000
#> GSM99590     2  0.0000      0.949 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.1863      0.863 0.000 0.000 0.896 0.000 0.000 0.104
#> GSM99502     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.1814      0.864 0.000 0.000 0.900 0.000 0.000 0.100
#> GSM99566     3  0.1814      0.864 0.000 0.000 0.900 0.000 0.000 0.100
#> GSM99574     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0146      0.865 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99594     3  0.1814      0.864 0.000 0.000 0.900 0.000 0.000 0.100
#> GSM99468     1  0.0146      0.916 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99498     1  0.0146      0.916 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99500     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.1714      0.865 0.000 0.000 0.908 0.000 0.000 0.092
#> GSM99568     3  0.0260      0.865 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM99596     3  0.1714      0.865 0.000 0.000 0.908 0.000 0.000 0.092
#> GSM99600     4  0.2996      0.718 0.000 0.228 0.000 0.772 0.000 0.000
#> GSM99458     1  0.5111      0.343 0.624 0.000 0.000 0.000 0.152 0.224
#> GSM99460     5  0.5029      0.441 0.080 0.000 0.000 0.000 0.544 0.376
#> GSM99510     3  0.4604      0.700 0.000 0.000 0.716 0.184 0.084 0.016
#> GSM99512     3  0.1462      0.846 0.000 0.000 0.936 0.056 0.000 0.008
#> GSM99514     3  0.1863      0.863 0.000 0.000 0.896 0.000 0.000 0.104
#> GSM99516     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.2454      0.700 0.840 0.000 0.000 0.000 0.000 0.160
#> GSM99520     3  0.0260      0.865 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM99522     3  0.0363      0.865 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99570     1  0.0363      0.913 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99598     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0146      0.786 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM99434     3  0.5052      0.641 0.000 0.000 0.656 0.108 0.224 0.012
#> GSM99436     4  0.1444      0.784 0.000 0.072 0.000 0.928 0.000 0.000
#> GSM99438     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     1  0.1267      0.862 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM99442     4  0.3857      0.348 0.000 0.468 0.000 0.532 0.000 0.000
#> GSM99444     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     4  0.0790      0.791 0.000 0.032 0.000 0.968 0.000 0.000
#> GSM99448     3  0.3071      0.746 0.000 0.000 0.804 0.180 0.000 0.016
#> GSM99450     3  0.3584      0.646 0.000 0.000 0.688 0.000 0.308 0.004
#> GSM99452     1  0.0458      0.907 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM99454     1  0.0000      0.917 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     6  0.2378      0.279 0.000 0.000 0.000 0.000 0.152 0.848
#> GSM99462     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     5  0.0972      0.597 0.000 0.000 0.028 0.000 0.964 0.008
#> GSM99466     4  0.0603      0.783 0.000 0.000 0.000 0.980 0.004 0.016
#> GSM99470     1  0.2911      0.745 0.832 0.000 0.000 0.000 0.024 0.144
#> GSM99472     1  0.2872      0.749 0.836 0.000 0.000 0.000 0.024 0.140
#> GSM99474     3  0.0260      0.865 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM99476     3  0.5456      0.562 0.000 0.000 0.608 0.248 0.128 0.016
#> GSM99478     4  0.0000      0.787 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99480     6  0.3706      0.720 0.380 0.000 0.000 0.000 0.000 0.620
#> GSM99482     1  0.0458      0.911 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM99484     4  0.1075      0.790 0.000 0.048 0.000 0.952 0.000 0.000
#> GSM99486     4  0.0000      0.787 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99488     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     2  0.1007      0.945 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM99492     6  0.3620      0.731 0.352 0.000 0.000 0.000 0.000 0.648
#> GSM99494     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.0363      0.913 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99526     5  0.2121      0.568 0.000 0.000 0.096 0.012 0.892 0.000
#> GSM99528     5  0.4158      0.307 0.000 0.000 0.004 0.416 0.572 0.008
#> GSM99530     5  0.3620      0.551 0.000 0.000 0.184 0.000 0.772 0.044
#> GSM99532     3  0.1462      0.845 0.000 0.000 0.936 0.000 0.056 0.008
#> GSM99534     4  0.4348      0.590 0.000 0.320 0.000 0.640 0.000 0.040
#> GSM99536     6  0.3727      0.709 0.388 0.000 0.000 0.000 0.000 0.612
#> GSM99538     4  0.1951      0.741 0.000 0.000 0.000 0.908 0.076 0.016
#> GSM99540     5  0.5907      0.113 0.216 0.000 0.000 0.000 0.444 0.340
#> GSM99542     2  0.0547      0.975 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM99544     4  0.0603      0.783 0.000 0.000 0.000 0.980 0.004 0.016
#> GSM99546     4  0.3795      0.520 0.000 0.000 0.000 0.632 0.364 0.004
#> GSM99548     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99550     5  0.3175      0.579 0.000 0.000 0.000 0.000 0.744 0.256
#> GSM99552     3  0.4322      0.300 0.000 0.000 0.600 0.372 0.000 0.028
#> GSM99554     4  0.3390      0.654 0.000 0.296 0.000 0.704 0.000 0.000
#> GSM99556     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99558     4  0.2398      0.735 0.000 0.000 0.104 0.876 0.000 0.020
#> GSM99560     4  0.3996     -0.200 0.000 0.000 0.000 0.512 0.484 0.004
#> GSM99562     3  0.1814      0.864 0.000 0.000 0.900 0.000 0.000 0.100
#> GSM99564     4  0.0146      0.787 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM99572     2  0.0146      0.989 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM99576     5  0.5336      0.438 0.124 0.000 0.000 0.000 0.544 0.332
#> GSM99578     4  0.3547      0.607 0.000 0.332 0.000 0.668 0.000 0.000
#> GSM99580     3  0.0363      0.867 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99582     3  0.0405      0.865 0.000 0.000 0.988 0.004 0.000 0.008
#> GSM99584     4  0.2311      0.753 0.000 0.000 0.000 0.880 0.104 0.016
#> GSM99586     6  0.2744      0.563 0.144 0.000 0.000 0.000 0.016 0.840
#> GSM99588     4  0.3330      0.667 0.000 0.284 0.000 0.716 0.000 0.000
#> GSM99590     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-mclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) cell.type(p) k
#> CV:mclust 85         1.92e-01      0.38259 2
#> CV:mclust 70         1.56e-04      0.00353 3
#> CV:mclust 79         6.06e-04      0.02557 4
#> CV:mclust 72         3.67e-05      0.00825 5
#> CV:mclust 76         3.71e-05      0.01613 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.975       0.989         0.5019 0.497   0.497
#> 3 3 0.967           0.951       0.979         0.3418 0.711   0.481
#> 4 4 0.766           0.716       0.855         0.1017 0.886   0.674
#> 5 5 0.740           0.641       0.828         0.0621 0.915   0.702
#> 6 6 0.701           0.513       0.724         0.0408 0.893   0.574

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
#> GSM99496     1  0.0000      0.992 1.000 0.000
#> GSM99502     1  0.0000      0.992 1.000 0.000
#> GSM99504     1  0.0000      0.992 1.000 0.000
#> GSM99506     1  0.0000      0.992 1.000 0.000
#> GSM99566     1  0.0000      0.992 1.000 0.000
#> GSM99574     1  0.0000      0.992 1.000 0.000
#> GSM99592     1  0.5408      0.859 0.876 0.124
#> GSM99594     1  0.0000      0.992 1.000 0.000
#> GSM99468     1  0.0000      0.992 1.000 0.000
#> GSM99498     1  0.0000      0.992 1.000 0.000
#> GSM99500     1  0.0000      0.992 1.000 0.000
#> GSM99508     1  0.0000      0.992 1.000 0.000
#> GSM99568     1  0.0000      0.992 1.000 0.000
#> GSM99596     1  0.0000      0.992 1.000 0.000
#> GSM99600     2  0.0000      0.984 0.000 1.000
#> GSM99458     1  0.0000      0.992 1.000 0.000
#> GSM99460     1  0.0000      0.992 1.000 0.000
#> GSM99510     2  0.4022      0.911 0.080 0.920
#> GSM99512     2  0.2236      0.955 0.036 0.964
#> GSM99514     1  0.0000      0.992 1.000 0.000
#> GSM99516     1  0.0000      0.992 1.000 0.000
#> GSM99518     1  0.0000      0.992 1.000 0.000
#> GSM99520     1  0.0000      0.992 1.000 0.000
#> GSM99522     1  0.0000      0.992 1.000 0.000
#> GSM99570     1  0.0000      0.992 1.000 0.000
#> GSM99598     1  0.0000      0.992 1.000 0.000
#> GSM99432     2  0.0000      0.984 0.000 1.000
#> GSM99434     2  0.9460      0.431 0.364 0.636
#> GSM99436     2  0.0000      0.984 0.000 1.000
#> GSM99438     2  0.0000      0.984 0.000 1.000
#> GSM99440     1  0.0000      0.992 1.000 0.000
#> GSM99442     2  0.0000      0.984 0.000 1.000
#> GSM99444     2  0.0000      0.984 0.000 1.000
#> GSM99446     2  0.0000      0.984 0.000 1.000
#> GSM99448     2  0.0000      0.984 0.000 1.000
#> GSM99450     1  0.0000      0.992 1.000 0.000
#> GSM99452     1  0.0000      0.992 1.000 0.000
#> GSM99454     1  0.0000      0.992 1.000 0.000
#> GSM99456     1  0.0000      0.992 1.000 0.000
#> GSM99462     2  0.0000      0.984 0.000 1.000
#> GSM99464     1  0.0000      0.992 1.000 0.000
#> GSM99466     2  0.0000      0.984 0.000 1.000
#> GSM99470     1  0.4562      0.894 0.904 0.096
#> GSM99472     1  0.0000      0.992 1.000 0.000
#> GSM99474     1  0.0000      0.992 1.000 0.000
#> GSM99476     2  0.0000      0.984 0.000 1.000
#> GSM99478     2  0.0000      0.984 0.000 1.000
#> GSM99480     1  0.0000      0.992 1.000 0.000
#> GSM99482     1  0.0000      0.992 1.000 0.000
#> GSM99484     2  0.0000      0.984 0.000 1.000
#> GSM99486     2  0.0000      0.984 0.000 1.000
#> GSM99488     2  0.0000      0.984 0.000 1.000
#> GSM99490     2  0.0000      0.984 0.000 1.000
#> GSM99492     1  0.0000      0.992 1.000 0.000
#> GSM99494     2  0.0000      0.984 0.000 1.000
#> GSM99524     1  0.0000      0.992 1.000 0.000
#> GSM99526     2  0.3584      0.925 0.068 0.932
#> GSM99528     2  0.0376      0.981 0.004 0.996
#> GSM99530     1  0.0000      0.992 1.000 0.000
#> GSM99532     1  0.0000      0.992 1.000 0.000
#> GSM99534     2  0.0000      0.984 0.000 1.000
#> GSM99536     1  0.0000      0.992 1.000 0.000
#> GSM99538     2  0.0000      0.984 0.000 1.000
#> GSM99540     1  0.0000      0.992 1.000 0.000
#> GSM99542     2  0.0000      0.984 0.000 1.000
#> GSM99544     2  0.0000      0.984 0.000 1.000
#> GSM99546     2  0.0376      0.981 0.004 0.996
#> GSM99548     2  0.0000      0.984 0.000 1.000
#> GSM99550     1  0.0000      0.992 1.000 0.000
#> GSM99552     2  0.3114      0.936 0.056 0.944
#> GSM99554     2  0.0000      0.984 0.000 1.000
#> GSM99556     2  0.0000      0.984 0.000 1.000
#> GSM99558     2  0.0000      0.984 0.000 1.000
#> GSM99560     2  0.0000      0.984 0.000 1.000
#> GSM99562     1  0.0000      0.992 1.000 0.000
#> GSM99564     2  0.0000      0.984 0.000 1.000
#> GSM99572     2  0.0000      0.984 0.000 1.000
#> GSM99576     1  0.0000      0.992 1.000 0.000
#> GSM99578     2  0.0000      0.984 0.000 1.000
#> GSM99580     1  0.5737      0.844 0.864 0.136
#> GSM99582     1  0.0000      0.992 1.000 0.000
#> GSM99584     2  0.0000      0.984 0.000 1.000
#> GSM99586     1  0.0000      0.992 1.000 0.000
#> GSM99588     2  0.0000      0.984 0.000 1.000
#> GSM99590     2  0.0000      0.984 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
#> GSM99496     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99504     1  0.5178      0.653 0.744 0.000 0.256
#> GSM99506     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99566     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99508     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99568     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99596     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99600     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99514     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99520     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99522     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99570     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99432     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99434     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99448     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99450     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99464     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99466     3  0.5948      0.439 0.000 0.360 0.640
#> GSM99470     1  0.3482      0.847 0.872 0.128 0.000
#> GSM99472     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99474     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99476     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99478     2  0.0424      0.974 0.000 0.992 0.008
#> GSM99480     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99484     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99486     2  0.1163      0.956 0.000 0.972 0.028
#> GSM99488     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99526     3  0.0592      0.961 0.000 0.012 0.988
#> GSM99528     2  0.0237      0.977 0.000 0.996 0.004
#> GSM99530     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99532     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99534     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99536     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99538     3  0.1643      0.932 0.000 0.044 0.956
#> GSM99540     1  0.0424      0.978 0.992 0.000 0.008
#> GSM99542     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99544     3  0.5397      0.614 0.000 0.280 0.720
#> GSM99546     2  0.2959      0.879 0.000 0.900 0.100
#> GSM99548     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99550     1  0.0237      0.981 0.996 0.004 0.000
#> GSM99552     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99554     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99558     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99560     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99562     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99564     2  0.0424      0.974 0.000 0.992 0.008
#> GSM99572     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99576     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99578     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99580     3  0.0000      0.971 0.000 0.000 1.000
#> GSM99582     3  0.3482      0.837 0.128 0.000 0.872
#> GSM99584     2  0.6045      0.370 0.000 0.620 0.380
#> GSM99586     1  0.0000      0.984 1.000 0.000 0.000
#> GSM99588     2  0.0000      0.980 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.980 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.1118     0.7761 0.000 0.000 0.964 0.036
#> GSM99502     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99504     3  0.5420     0.4440 0.272 0.000 0.684 0.044
#> GSM99506     3  0.2011     0.7737 0.000 0.000 0.920 0.080
#> GSM99566     3  0.1389     0.7766 0.000 0.000 0.952 0.048
#> GSM99574     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99592     3  0.3801     0.6766 0.000 0.000 0.780 0.220
#> GSM99594     3  0.3400     0.7227 0.000 0.000 0.820 0.180
#> GSM99468     1  0.0336     0.9317 0.992 0.000 0.000 0.008
#> GSM99498     1  0.2124     0.8747 0.924 0.000 0.068 0.008
#> GSM99500     1  0.1004     0.9174 0.972 0.000 0.024 0.004
#> GSM99508     3  0.2216     0.7697 0.000 0.000 0.908 0.092
#> GSM99568     3  0.3311     0.7291 0.000 0.000 0.828 0.172
#> GSM99596     3  0.2814     0.7537 0.000 0.000 0.868 0.132
#> GSM99600     2  0.1022     0.8883 0.000 0.968 0.000 0.032
#> GSM99458     1  0.0469     0.9289 0.988 0.000 0.000 0.012
#> GSM99460     4  0.5290    -0.0710 0.476 0.000 0.008 0.516
#> GSM99510     3  0.4790     0.3976 0.000 0.000 0.620 0.380
#> GSM99512     3  0.4605     0.5011 0.000 0.000 0.664 0.336
#> GSM99514     3  0.2760     0.7155 0.000 0.000 0.872 0.128
#> GSM99516     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0336     0.9318 0.992 0.000 0.000 0.008
#> GSM99520     3  0.1940     0.7738 0.000 0.000 0.924 0.076
#> GSM99522     3  0.3074     0.7033 0.000 0.000 0.848 0.152
#> GSM99570     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99432     2  0.4916     0.2977 0.000 0.576 0.000 0.424
#> GSM99434     4  0.4564     0.4498 0.000 0.000 0.328 0.672
#> GSM99436     2  0.1716     0.8721 0.000 0.936 0.000 0.064
#> GSM99438     2  0.0336     0.8924 0.000 0.992 0.000 0.008
#> GSM99440     1  0.0188     0.9326 0.996 0.000 0.000 0.004
#> GSM99442     2  0.1022     0.8870 0.000 0.968 0.000 0.032
#> GSM99444     2  0.0188     0.8921 0.000 0.996 0.000 0.004
#> GSM99446     2  0.2081     0.8617 0.000 0.916 0.000 0.084
#> GSM99448     3  0.2868     0.7226 0.000 0.000 0.864 0.136
#> GSM99450     4  0.4855     0.2607 0.000 0.000 0.400 0.600
#> GSM99452     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99456     1  0.2345     0.8684 0.900 0.000 0.000 0.100
#> GSM99462     2  0.0469     0.8913 0.000 0.988 0.000 0.012
#> GSM99464     4  0.3649     0.5569 0.000 0.000 0.204 0.796
#> GSM99466     2  0.6571     0.4543 0.000 0.612 0.124 0.264
#> GSM99470     1  0.5894     0.2684 0.568 0.392 0.000 0.040
#> GSM99472     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99474     3  0.3975     0.6605 0.000 0.000 0.760 0.240
#> GSM99476     4  0.4477     0.4684 0.000 0.000 0.312 0.688
#> GSM99478     2  0.0469     0.8916 0.000 0.988 0.000 0.012
#> GSM99480     1  0.0188     0.9326 0.996 0.000 0.000 0.004
#> GSM99482     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99484     2  0.1474     0.8798 0.000 0.948 0.000 0.052
#> GSM99486     2  0.5288     0.6696 0.000 0.720 0.056 0.224
#> GSM99488     2  0.0336     0.8924 0.000 0.992 0.000 0.008
#> GSM99490     2  0.0707     0.8900 0.000 0.980 0.000 0.020
#> GSM99492     1  0.0921     0.9220 0.972 0.000 0.000 0.028
#> GSM99494     2  0.0336     0.8924 0.000 0.992 0.000 0.008
#> GSM99524     1  0.0000     0.9332 1.000 0.000 0.000 0.000
#> GSM99526     4  0.3569     0.5643 0.000 0.000 0.196 0.804
#> GSM99528     2  0.6813     0.0568 0.000 0.516 0.104 0.380
#> GSM99530     4  0.4855     0.2136 0.000 0.000 0.400 0.600
#> GSM99532     3  0.4967     0.1884 0.000 0.000 0.548 0.452
#> GSM99534     2  0.0817     0.8887 0.000 0.976 0.000 0.024
#> GSM99536     1  0.0469     0.9303 0.988 0.000 0.000 0.012
#> GSM99538     4  0.4122     0.5413 0.000 0.004 0.236 0.760
#> GSM99540     1  0.6661     0.3416 0.604 0.000 0.132 0.264
#> GSM99542     2  0.0336     0.8924 0.000 0.992 0.000 0.008
#> GSM99544     4  0.6797     0.2605 0.000 0.356 0.108 0.536
#> GSM99546     4  0.5193     0.3488 0.000 0.324 0.020 0.656
#> GSM99548     2  0.1118     0.8824 0.000 0.964 0.000 0.036
#> GSM99550     4  0.6826     0.4844 0.208 0.048 0.080 0.664
#> GSM99552     3  0.3448     0.6822 0.000 0.004 0.828 0.168
#> GSM99554     2  0.1557     0.8777 0.000 0.944 0.000 0.056
#> GSM99556     2  0.0336     0.8924 0.000 0.992 0.000 0.008
#> GSM99558     3  0.2760     0.7157 0.000 0.000 0.872 0.128
#> GSM99560     2  0.4866     0.3608 0.000 0.596 0.000 0.404
#> GSM99562     3  0.1867     0.7722 0.000 0.000 0.928 0.072
#> GSM99564     2  0.3401     0.8014 0.000 0.840 0.008 0.152
#> GSM99572     2  0.0817     0.8907 0.000 0.976 0.000 0.024
#> GSM99576     1  0.4331     0.7880 0.820 0.028 0.016 0.136
#> GSM99578     2  0.0336     0.8924 0.000 0.992 0.000 0.008
#> GSM99580     3  0.1211     0.7757 0.000 0.000 0.960 0.040
#> GSM99582     3  0.4549     0.6412 0.036 0.000 0.776 0.188
#> GSM99584     4  0.5837     0.0605 0.000 0.400 0.036 0.564
#> GSM99586     1  0.2081     0.8809 0.916 0.000 0.000 0.084
#> GSM99588     2  0.0336     0.8920 0.000 0.992 0.000 0.008
#> GSM99590     2  0.0336     0.8924 0.000 0.992 0.000 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
#> GSM99496     3  0.0880     0.7056 0.000 0.000 0.968 0.000 0.032
#> GSM99502     1  0.0290     0.8860 0.992 0.000 0.000 0.000 0.008
#> GSM99504     3  0.5925     0.1096 0.188 0.000 0.596 0.000 0.216
#> GSM99506     3  0.0703     0.7081 0.000 0.000 0.976 0.000 0.024
#> GSM99566     3  0.0963     0.7070 0.000 0.000 0.964 0.000 0.036
#> GSM99574     1  0.0451     0.8853 0.988 0.000 0.004 0.000 0.008
#> GSM99592     3  0.2848     0.6776 0.000 0.000 0.868 0.028 0.104
#> GSM99594     3  0.1732     0.6921 0.000 0.000 0.920 0.000 0.080
#> GSM99468     1  0.0404     0.8854 0.988 0.000 0.000 0.000 0.012
#> GSM99498     1  0.4942     0.1899 0.540 0.000 0.432 0.000 0.028
#> GSM99500     1  0.2411     0.7932 0.884 0.000 0.108 0.000 0.008
#> GSM99508     3  0.0703     0.7052 0.000 0.000 0.976 0.000 0.024
#> GSM99568     3  0.1270     0.7038 0.000 0.000 0.948 0.000 0.052
#> GSM99596     3  0.1544     0.6984 0.000 0.000 0.932 0.000 0.068
#> GSM99600     2  0.2359     0.8517 0.000 0.904 0.000 0.060 0.036
#> GSM99458     1  0.0579     0.8836 0.984 0.000 0.000 0.008 0.008
#> GSM99460     4  0.5447     0.4508 0.248 0.000 0.000 0.640 0.112
#> GSM99510     4  0.5575     0.3720 0.000 0.000 0.188 0.644 0.168
#> GSM99512     3  0.4535     0.5770 0.000 0.000 0.752 0.108 0.140
#> GSM99514     3  0.3508     0.4712 0.000 0.000 0.748 0.000 0.252
#> GSM99516     1  0.0290     0.8860 0.992 0.000 0.000 0.000 0.008
#> GSM99518     1  0.0404     0.8852 0.988 0.000 0.000 0.000 0.012
#> GSM99520     3  0.0880     0.6999 0.000 0.000 0.968 0.000 0.032
#> GSM99522     3  0.4658    -0.2819 0.000 0.000 0.504 0.012 0.484
#> GSM99570     1  0.0290     0.8860 0.992 0.000 0.000 0.000 0.008
#> GSM99598     1  0.0162     0.8864 0.996 0.000 0.000 0.000 0.004
#> GSM99432     4  0.2388     0.6221 0.000 0.072 0.000 0.900 0.028
#> GSM99434     4  0.3182     0.6281 0.000 0.000 0.032 0.844 0.124
#> GSM99436     2  0.6205     0.3089 0.000 0.512 0.000 0.332 0.156
#> GSM99438     2  0.0162     0.8862 0.000 0.996 0.000 0.004 0.000
#> GSM99440     1  0.0290     0.8857 0.992 0.000 0.000 0.000 0.008
#> GSM99442     2  0.3731     0.7923 0.000 0.816 0.000 0.072 0.112
#> GSM99444     2  0.0290     0.8861 0.000 0.992 0.000 0.000 0.008
#> GSM99446     2  0.6092     0.2632 0.000 0.504 0.000 0.364 0.132
#> GSM99448     5  0.5425     0.2202 0.000 0.000 0.420 0.060 0.520
#> GSM99450     4  0.3146     0.6088 0.000 0.000 0.028 0.844 0.128
#> GSM99452     1  0.0162     0.8861 0.996 0.000 0.000 0.000 0.004
#> GSM99454     1  0.0000     0.8864 1.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.3517     0.7736 0.832 0.000 0.000 0.068 0.100
#> GSM99462     2  0.0898     0.8814 0.000 0.972 0.000 0.008 0.020
#> GSM99464     4  0.3847     0.6031 0.000 0.000 0.036 0.784 0.180
#> GSM99466     4  0.6800     0.2353 0.000 0.272 0.012 0.488 0.228
#> GSM99470     1  0.3574     0.7500 0.836 0.072 0.000 0.004 0.088
#> GSM99472     1  0.0290     0.8860 0.992 0.000 0.000 0.000 0.008
#> GSM99474     3  0.2439     0.6679 0.000 0.000 0.876 0.004 0.120
#> GSM99476     4  0.1430     0.6363 0.000 0.000 0.004 0.944 0.052
#> GSM99478     2  0.0771     0.8813 0.000 0.976 0.004 0.020 0.000
#> GSM99480     1  0.0290     0.8857 0.992 0.000 0.000 0.000 0.008
#> GSM99482     1  0.0162     0.8864 0.996 0.000 0.000 0.000 0.004
#> GSM99484     2  0.4054     0.7706 0.000 0.788 0.000 0.072 0.140
#> GSM99486     5  0.5954    -0.1356 0.000 0.152 0.000 0.272 0.576
#> GSM99488     2  0.0510     0.8818 0.000 0.984 0.000 0.000 0.016
#> GSM99490     2  0.0451     0.8850 0.000 0.988 0.000 0.004 0.008
#> GSM99492     1  0.1043     0.8726 0.960 0.000 0.000 0.000 0.040
#> GSM99494     2  0.0404     0.8833 0.000 0.988 0.000 0.000 0.012
#> GSM99524     1  0.0290     0.8862 0.992 0.000 0.000 0.000 0.008
#> GSM99526     4  0.2629     0.6325 0.000 0.000 0.004 0.860 0.136
#> GSM99528     3  0.7051     0.2397 0.008 0.244 0.512 0.020 0.216
#> GSM99530     3  0.6083     0.3412 0.000 0.000 0.564 0.176 0.260
#> GSM99532     3  0.5526     0.4382 0.000 0.000 0.648 0.152 0.200
#> GSM99534     2  0.3849     0.7853 0.000 0.808 0.000 0.112 0.080
#> GSM99536     1  0.0794     0.8784 0.972 0.000 0.000 0.000 0.028
#> GSM99538     4  0.5597     0.4853 0.000 0.000 0.160 0.640 0.200
#> GSM99540     1  0.7718     0.1588 0.428 0.000 0.280 0.072 0.220
#> GSM99542     2  0.0609     0.8797 0.000 0.980 0.000 0.000 0.020
#> GSM99544     4  0.3880     0.5585 0.000 0.028 0.004 0.784 0.184
#> GSM99546     4  0.1357     0.6361 0.000 0.004 0.000 0.948 0.048
#> GSM99548     2  0.1251     0.8687 0.000 0.956 0.000 0.008 0.036
#> GSM99550     4  0.6108     0.4995 0.140 0.000 0.020 0.620 0.220
#> GSM99552     3  0.3659     0.4973 0.000 0.012 0.768 0.000 0.220
#> GSM99554     2  0.4569     0.7296 0.000 0.748 0.000 0.104 0.148
#> GSM99556     2  0.0510     0.8818 0.000 0.984 0.000 0.000 0.016
#> GSM99558     3  0.3790     0.4209 0.000 0.004 0.724 0.000 0.272
#> GSM99560     4  0.7412     0.1799 0.000 0.356 0.032 0.360 0.252
#> GSM99562     3  0.3724     0.5266 0.000 0.000 0.776 0.020 0.204
#> GSM99564     4  0.6616     0.0895 0.000 0.216 0.000 0.404 0.380
#> GSM99572     2  0.0693     0.8848 0.000 0.980 0.000 0.012 0.008
#> GSM99576     1  0.8190     0.0464 0.376 0.092 0.312 0.008 0.212
#> GSM99578     2  0.0510     0.8864 0.000 0.984 0.000 0.000 0.016
#> GSM99580     3  0.1197     0.6935 0.000 0.000 0.952 0.000 0.048
#> GSM99582     5  0.6083     0.2130 0.108 0.000 0.400 0.004 0.488
#> GSM99584     4  0.3805     0.5569 0.000 0.032 0.000 0.784 0.184
#> GSM99586     1  0.2771     0.7998 0.860 0.000 0.000 0.012 0.128
#> GSM99588     2  0.0162     0.8854 0.000 0.996 0.000 0.000 0.004
#> GSM99590     2  0.0162     0.8856 0.000 0.996 0.000 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     5  0.4264  -0.070465 0.000 0.000 0.484 0.016 0.500 0.000
#> GSM99502     1  0.0146   0.907954 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99504     3  0.4454   0.267010 0.144 0.000 0.736 0.012 0.108 0.000
#> GSM99506     5  0.4594  -0.170932 0.000 0.000 0.480 0.000 0.484 0.036
#> GSM99566     3  0.5286   0.197572 0.000 0.000 0.528 0.012 0.388 0.072
#> GSM99574     1  0.1413   0.894554 0.948 0.000 0.036 0.008 0.004 0.004
#> GSM99592     3  0.5728   0.194703 0.000 0.000 0.488 0.004 0.356 0.152
#> GSM99594     5  0.5481  -0.089865 0.000 0.000 0.360 0.016 0.536 0.088
#> GSM99468     1  0.1251   0.903047 0.956 0.000 0.008 0.012 0.024 0.000
#> GSM99498     1  0.6055  -0.000716 0.472 0.000 0.184 0.012 0.332 0.000
#> GSM99500     1  0.4541   0.681627 0.732 0.000 0.088 0.020 0.160 0.000
#> GSM99508     3  0.4246   0.088420 0.000 0.000 0.576 0.008 0.408 0.008
#> GSM99568     5  0.4876  -0.011572 0.000 0.000 0.444 0.048 0.504 0.004
#> GSM99596     5  0.4567   0.062730 0.000 0.000 0.332 0.052 0.616 0.000
#> GSM99600     4  0.4046   0.456523 0.000 0.368 0.000 0.620 0.004 0.008
#> GSM99458     1  0.0858   0.903122 0.968 0.000 0.000 0.000 0.004 0.028
#> GSM99460     6  0.3571   0.527241 0.216 0.000 0.004 0.000 0.020 0.760
#> GSM99510     6  0.5819   0.146872 0.000 0.000 0.340 0.076 0.048 0.536
#> GSM99512     3  0.7097   0.114198 0.000 0.020 0.364 0.032 0.260 0.324
#> GSM99514     3  0.3316   0.348208 0.000 0.000 0.804 0.028 0.164 0.004
#> GSM99516     1  0.0767   0.907032 0.976 0.000 0.012 0.000 0.008 0.004
#> GSM99518     1  0.1485   0.896171 0.944 0.000 0.004 0.000 0.024 0.028
#> GSM99520     5  0.4763  -0.075037 0.000 0.000 0.476 0.032 0.484 0.008
#> GSM99522     3  0.3910   0.358053 0.000 0.000 0.792 0.100 0.016 0.092
#> GSM99570     1  0.0912   0.905326 0.972 0.000 0.012 0.008 0.004 0.004
#> GSM99598     1  0.0000   0.908189 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     6  0.4329   0.233495 0.000 0.012 0.000 0.404 0.008 0.576
#> GSM99434     6  0.1710   0.680892 0.000 0.000 0.028 0.020 0.016 0.936
#> GSM99436     4  0.4638   0.581534 0.000 0.144 0.000 0.704 0.004 0.148
#> GSM99438     2  0.1007   0.875775 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM99440     1  0.0806   0.907677 0.972 0.000 0.000 0.008 0.020 0.000
#> GSM99442     2  0.3986  -0.107111 0.000 0.532 0.000 0.464 0.004 0.000
#> GSM99444     2  0.1010   0.881440 0.000 0.960 0.000 0.036 0.004 0.000
#> GSM99446     4  0.5354   0.557470 0.000 0.212 0.000 0.608 0.004 0.176
#> GSM99448     3  0.5395   0.318770 0.000 0.000 0.644 0.124 0.028 0.204
#> GSM99450     6  0.3605   0.656734 0.000 0.000 0.084 0.108 0.004 0.804
#> GSM99452     1  0.0363   0.909084 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99454     1  0.0146   0.908660 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99456     1  0.4747   0.715870 0.736 0.000 0.000 0.052 0.084 0.128
#> GSM99462     2  0.1010   0.881067 0.000 0.960 0.000 0.036 0.004 0.000
#> GSM99464     6  0.2737   0.671116 0.000 0.000 0.004 0.044 0.084 0.868
#> GSM99466     4  0.4811   0.530175 0.000 0.016 0.100 0.752 0.088 0.044
#> GSM99470     1  0.3492   0.769321 0.816 0.028 0.016 0.136 0.004 0.000
#> GSM99472     1  0.1285   0.887968 0.944 0.000 0.000 0.052 0.004 0.000
#> GSM99474     5  0.5625  -0.067529 0.000 0.000 0.356 0.008 0.512 0.124
#> GSM99476     4  0.4927   0.296380 0.000 0.000 0.036 0.616 0.028 0.320
#> GSM99478     4  0.6954   0.454613 0.000 0.144 0.080 0.476 0.288 0.012
#> GSM99480     1  0.0820   0.906327 0.972 0.000 0.000 0.012 0.016 0.000
#> GSM99482     1  0.0363   0.908371 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99484     4  0.4419   0.526447 0.000 0.304 0.040 0.652 0.004 0.000
#> GSM99486     4  0.5033   0.501909 0.000 0.040 0.084 0.736 0.024 0.116
#> GSM99488     2  0.0146   0.876583 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM99490     2  0.3641   0.616331 0.000 0.748 0.000 0.224 0.028 0.000
#> GSM99492     1  0.1707   0.888400 0.928 0.000 0.000 0.012 0.056 0.004
#> GSM99494     2  0.0551   0.871598 0.000 0.984 0.004 0.004 0.008 0.000
#> GSM99524     1  0.0363   0.908371 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99526     6  0.1498   0.685010 0.000 0.000 0.000 0.028 0.032 0.940
#> GSM99528     5  0.5496   0.158450 0.004 0.112 0.060 0.104 0.704 0.016
#> GSM99530     5  0.4517   0.192309 0.000 0.000 0.056 0.024 0.720 0.200
#> GSM99532     5  0.5631   0.076253 0.000 0.000 0.128 0.008 0.520 0.344
#> GSM99534     2  0.3437   0.765785 0.028 0.840 0.008 0.100 0.004 0.020
#> GSM99536     1  0.0862   0.906718 0.972 0.000 0.000 0.008 0.016 0.004
#> GSM99538     6  0.4078   0.630152 0.000 0.000 0.004 0.068 0.180 0.748
#> GSM99540     5  0.5991   0.047465 0.384 0.000 0.004 0.008 0.452 0.152
#> GSM99542     2  0.0291   0.874511 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM99544     6  0.4453   0.507261 0.000 0.000 0.032 0.296 0.012 0.660
#> GSM99546     6  0.2170   0.670547 0.000 0.000 0.012 0.100 0.000 0.888
#> GSM99548     2  0.2357   0.801695 0.000 0.872 0.000 0.116 0.012 0.000
#> GSM99550     6  0.6795   0.352349 0.076 0.004 0.000 0.268 0.164 0.488
#> GSM99552     3  0.4578   0.187972 0.000 0.000 0.624 0.056 0.320 0.000
#> GSM99554     4  0.4454   0.469947 0.000 0.348 0.032 0.616 0.004 0.000
#> GSM99556     2  0.0363   0.882584 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM99558     3  0.6036   0.101064 0.000 0.008 0.484 0.220 0.288 0.000
#> GSM99560     4  0.6390   0.398601 0.000 0.088 0.000 0.564 0.164 0.184
#> GSM99562     3  0.5850   0.307581 0.000 0.000 0.612 0.048 0.180 0.160
#> GSM99564     4  0.3964   0.520952 0.000 0.048 0.012 0.764 0.000 0.176
#> GSM99572     2  0.1411   0.864510 0.000 0.936 0.000 0.060 0.004 0.000
#> GSM99576     5  0.5950   0.159156 0.328 0.060 0.000 0.016 0.552 0.044
#> GSM99578     4  0.4975   0.266585 0.000 0.428 0.000 0.504 0.068 0.000
#> GSM99580     3  0.4848   0.196597 0.000 0.000 0.608 0.024 0.336 0.032
#> GSM99582     4  0.6038   0.033766 0.004 0.000 0.376 0.412 0.208 0.000
#> GSM99584     6  0.4195   0.232238 0.000 0.000 0.004 0.440 0.008 0.548
#> GSM99586     1  0.3802   0.791127 0.804 0.000 0.000 0.032 0.116 0.048
#> GSM99588     2  0.0458   0.883052 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM99590     2  0.0508   0.882534 0.000 0.984 0.000 0.012 0.004 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-NMF-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) cell.type(p) k
#> CV:NMF 84         8.94e-05     0.000459 2
#> CV:NMF 83         8.28e-04     0.016801 3
#> CV:NMF 67         2.80e-04     0.010857 4
#> CV:NMF 62         3.07e-05     0.000586 5
#> CV:NMF 48         9.25e-03     0.209661 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-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.361           0.800       0.878         0.4205 0.519   0.519
#> 3 3 0.503           0.669       0.840         0.5398 0.764   0.563
#> 4 4 0.513           0.471       0.680         0.1034 0.775   0.484
#> 5 5 0.611           0.684       0.802         0.0872 0.846   0.550
#> 6 6 0.683           0.589       0.788         0.0425 0.963   0.838

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

suggest_best_k(res)
#> [1] 5

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM99496     1  0.4939     0.8791 0.892 0.108
#> GSM99502     1  0.0000     0.9151 1.000 0.000
#> GSM99504     1  0.0000     0.9151 1.000 0.000
#> GSM99506     1  0.4939     0.8791 0.892 0.108
#> GSM99566     1  0.4939     0.8791 0.892 0.108
#> GSM99574     1  0.0000     0.9151 1.000 0.000
#> GSM99592     1  0.4939     0.8791 0.892 0.108
#> GSM99594     1  0.4939     0.8791 0.892 0.108
#> GSM99468     1  0.0000     0.9151 1.000 0.000
#> GSM99498     1  0.0000     0.9151 1.000 0.000
#> GSM99500     1  0.0000     0.9151 1.000 0.000
#> GSM99508     1  0.4939     0.8791 0.892 0.108
#> GSM99568     1  0.4690     0.8838 0.900 0.100
#> GSM99596     1  0.4939     0.8791 0.892 0.108
#> GSM99600     2  0.6343     0.7817 0.160 0.840
#> GSM99458     1  0.0672     0.9155 0.992 0.008
#> GSM99460     1  0.0672     0.9155 0.992 0.008
#> GSM99510     1  0.5178     0.8722 0.884 0.116
#> GSM99512     1  0.5408     0.8636 0.876 0.124
#> GSM99514     1  0.4939     0.8791 0.892 0.108
#> GSM99516     1  0.0000     0.9151 1.000 0.000
#> GSM99518     1  0.0000     0.9151 1.000 0.000
#> GSM99520     1  0.5408     0.8626 0.876 0.124
#> GSM99522     1  0.4815     0.8815 0.896 0.104
#> GSM99570     1  0.0000     0.9151 1.000 0.000
#> GSM99598     1  0.0000     0.9151 1.000 0.000
#> GSM99432     2  0.8081     0.7604 0.248 0.752
#> GSM99434     1  0.4161     0.8931 0.916 0.084
#> GSM99436     2  0.7376     0.7800 0.208 0.792
#> GSM99438     2  0.0000     0.7523 0.000 1.000
#> GSM99440     1  0.0000     0.9151 1.000 0.000
#> GSM99442     2  0.6438     0.7821 0.164 0.836
#> GSM99444     2  0.0000     0.7523 0.000 1.000
#> GSM99446     2  0.7453     0.7793 0.212 0.788
#> GSM99448     1  0.9815     0.0615 0.580 0.420
#> GSM99450     1  0.3733     0.8982 0.928 0.072
#> GSM99452     1  0.0000     0.9151 1.000 0.000
#> GSM99454     1  0.0000     0.9151 1.000 0.000
#> GSM99456     1  0.0000     0.9151 1.000 0.000
#> GSM99462     2  0.0000     0.7523 0.000 1.000
#> GSM99464     1  0.0672     0.9155 0.992 0.008
#> GSM99466     2  0.9909     0.5060 0.444 0.556
#> GSM99470     1  0.2423     0.9041 0.960 0.040
#> GSM99472     1  0.2423     0.9041 0.960 0.040
#> GSM99474     1  0.4815     0.8804 0.896 0.104
#> GSM99476     1  0.8207     0.6347 0.744 0.256
#> GSM99478     2  0.9815     0.5611 0.420 0.580
#> GSM99480     1  0.0000     0.9151 1.000 0.000
#> GSM99482     1  0.0376     0.9148 0.996 0.004
#> GSM99484     2  0.9866     0.5405 0.432 0.568
#> GSM99486     2  0.7376     0.7797 0.208 0.792
#> GSM99488     2  0.0000     0.7523 0.000 1.000
#> GSM99490     2  0.0000     0.7523 0.000 1.000
#> GSM99492     1  0.0000     0.9151 1.000 0.000
#> GSM99494     2  0.0000     0.7523 0.000 1.000
#> GSM99524     1  0.0000     0.9151 1.000 0.000
#> GSM99526     1  0.3733     0.8985 0.928 0.072
#> GSM99528     2  0.9988     0.4225 0.480 0.520
#> GSM99530     1  0.0672     0.9155 0.992 0.008
#> GSM99532     1  0.0672     0.9155 0.992 0.008
#> GSM99534     2  0.9393     0.6729 0.356 0.644
#> GSM99536     1  0.0000     0.9151 1.000 0.000
#> GSM99538     2  0.8955     0.7092 0.312 0.688
#> GSM99540     1  0.0672     0.9155 0.992 0.008
#> GSM99542     2  0.8955     0.6556 0.312 0.688
#> GSM99544     2  0.8909     0.7129 0.308 0.692
#> GSM99546     2  0.9815     0.5696 0.420 0.580
#> GSM99548     2  0.0000     0.7523 0.000 1.000
#> GSM99550     1  0.1184     0.9106 0.984 0.016
#> GSM99552     2  0.9909     0.4674 0.444 0.556
#> GSM99554     2  0.7219     0.7810 0.200 0.800
#> GSM99556     2  0.0000     0.7523 0.000 1.000
#> GSM99558     2  0.9998     0.3073 0.492 0.508
#> GSM99560     2  0.9248     0.6797 0.340 0.660
#> GSM99562     1  0.4939     0.8791 0.892 0.108
#> GSM99564     2  0.7376     0.7797 0.208 0.792
#> GSM99572     2  0.0000     0.7523 0.000 1.000
#> GSM99576     1  0.4161     0.8661 0.916 0.084
#> GSM99578     2  0.2603     0.7543 0.044 0.956
#> GSM99580     1  0.8608     0.5575 0.716 0.284
#> GSM99582     1  0.7299     0.7160 0.796 0.204
#> GSM99584     2  0.8555     0.7434 0.280 0.720
#> GSM99586     1  0.0000     0.9151 1.000 0.000
#> GSM99588     2  0.7528     0.7776 0.216 0.784
#> GSM99590     2  0.0000     0.7523 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
#> GSM99496     3  0.0424     0.7684 0.008 0.000 0.992
#> GSM99502     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99504     1  0.3340     0.8547 0.880 0.000 0.120
#> GSM99506     3  0.0424     0.7684 0.008 0.000 0.992
#> GSM99566     3  0.0237     0.7670 0.004 0.000 0.996
#> GSM99574     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99592     3  0.0424     0.7684 0.008 0.000 0.992
#> GSM99594     3  0.0237     0.7670 0.004 0.000 0.996
#> GSM99468     1  0.3340     0.8547 0.880 0.000 0.120
#> GSM99498     1  0.3340     0.8547 0.880 0.000 0.120
#> GSM99500     1  0.3340     0.8547 0.880 0.000 0.120
#> GSM99508     3  0.0424     0.7684 0.008 0.000 0.992
#> GSM99568     3  0.3340     0.7266 0.120 0.000 0.880
#> GSM99596     3  0.3192     0.7294 0.112 0.000 0.888
#> GSM99600     2  0.4842     0.7278 0.000 0.776 0.224
#> GSM99458     3  0.6126     0.2481 0.400 0.000 0.600
#> GSM99460     3  0.6111     0.2597 0.396 0.000 0.604
#> GSM99510     3  0.0848     0.7667 0.008 0.008 0.984
#> GSM99512     3  0.0983     0.7610 0.004 0.016 0.980
#> GSM99514     3  0.0424     0.7684 0.008 0.000 0.992
#> GSM99516     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99518     1  0.1529     0.9020 0.960 0.000 0.040
#> GSM99520     3  0.1482     0.7610 0.012 0.020 0.968
#> GSM99522     3  0.0592     0.7682 0.012 0.000 0.988
#> GSM99570     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99432     2  0.5785     0.6709 0.000 0.668 0.332
#> GSM99434     3  0.2165     0.7554 0.064 0.000 0.936
#> GSM99436     2  0.5560     0.6960 0.000 0.700 0.300
#> GSM99438     2  0.0000     0.7243 0.000 1.000 0.000
#> GSM99440     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99442     2  0.4062     0.7335 0.000 0.836 0.164
#> GSM99444     2  0.0000     0.7243 0.000 1.000 0.000
#> GSM99446     2  0.5327     0.7122 0.000 0.728 0.272
#> GSM99448     3  0.5621     0.2712 0.000 0.308 0.692
#> GSM99450     3  0.2537     0.7496 0.080 0.000 0.920
#> GSM99452     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99456     1  0.1529     0.9022 0.960 0.000 0.040
#> GSM99462     2  0.0000     0.7243 0.000 1.000 0.000
#> GSM99464     3  0.6111     0.2597 0.396 0.000 0.604
#> GSM99466     2  0.8140     0.3749 0.068 0.476 0.456
#> GSM99470     1  0.2050     0.8867 0.952 0.028 0.020
#> GSM99472     1  0.2050     0.8867 0.952 0.028 0.020
#> GSM99474     3  0.3966     0.7377 0.100 0.024 0.876
#> GSM99476     3  0.3983     0.6266 0.004 0.144 0.852
#> GSM99478     2  0.8050     0.4364 0.064 0.500 0.436
#> GSM99480     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99482     1  0.0237     0.9105 0.996 0.004 0.000
#> GSM99484     2  0.8316     0.4246 0.080 0.496 0.424
#> GSM99486     2  0.5650     0.6878 0.000 0.688 0.312
#> GSM99488     2  0.0000     0.7243 0.000 1.000 0.000
#> GSM99490     2  0.0237     0.7246 0.000 0.996 0.004
#> GSM99492     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99494     2  0.0000     0.7243 0.000 1.000 0.000
#> GSM99524     1  0.0000     0.9118 1.000 0.000 0.000
#> GSM99526     3  0.3918     0.7100 0.140 0.004 0.856
#> GSM99528     3  0.8524    -0.3654 0.092 0.452 0.456
#> GSM99530     3  0.6309    -0.1018 0.500 0.000 0.500
#> GSM99532     1  0.6140     0.3703 0.596 0.000 0.404
#> GSM99534     2  0.8525     0.5894 0.200 0.612 0.188
#> GSM99536     1  0.0237     0.9113 0.996 0.000 0.004
#> GSM99538     2  0.6192     0.5603 0.000 0.580 0.420
#> GSM99540     1  0.6140     0.3703 0.596 0.000 0.404
#> GSM99542     2  0.5873     0.4481 0.312 0.684 0.004
#> GSM99544     2  0.6180     0.5661 0.000 0.584 0.416
#> GSM99546     2  0.8627     0.4704 0.104 0.504 0.392
#> GSM99548     2  0.0000     0.7243 0.000 1.000 0.000
#> GSM99550     1  0.4692     0.7861 0.820 0.012 0.168
#> GSM99552     3  0.6483    -0.2636 0.004 0.452 0.544
#> GSM99554     2  0.5016     0.7231 0.000 0.760 0.240
#> GSM99556     2  0.0000     0.7243 0.000 1.000 0.000
#> GSM99558     3  0.6140    -0.0816 0.000 0.404 0.596
#> GSM99560     2  0.6745     0.5277 0.012 0.560 0.428
#> GSM99562     3  0.0237     0.7670 0.004 0.000 0.996
#> GSM99564     2  0.5650     0.6878 0.000 0.688 0.312
#> GSM99572     2  0.0000     0.7243 0.000 1.000 0.000
#> GSM99576     1  0.7145     0.6206 0.692 0.072 0.236
#> GSM99578     2  0.2564     0.7211 0.028 0.936 0.036
#> GSM99580     3  0.4700     0.5729 0.008 0.180 0.812
#> GSM99582     3  0.6511     0.6191 0.104 0.136 0.760
#> GSM99584     2  0.6510     0.6325 0.012 0.624 0.364
#> GSM99586     1  0.1529     0.9022 0.960 0.000 0.040
#> GSM99588     2  0.5138     0.7198 0.000 0.748 0.252
#> GSM99590     2  0.0237     0.7251 0.000 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.4713    0.33228 0.000 0.000 0.640 0.360
#> GSM99502     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99504     1  0.4323    0.69456 0.788 0.000 0.028 0.184
#> GSM99506     3  0.4713    0.33228 0.000 0.000 0.640 0.360
#> GSM99566     3  0.4730    0.33230 0.000 0.000 0.636 0.364
#> GSM99574     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99592     3  0.4522    0.34809 0.000 0.000 0.680 0.320
#> GSM99594     3  0.4730    0.33230 0.000 0.000 0.636 0.364
#> GSM99468     1  0.4323    0.69456 0.788 0.000 0.028 0.184
#> GSM99498     1  0.4323    0.69456 0.788 0.000 0.028 0.184
#> GSM99500     1  0.4323    0.69456 0.788 0.000 0.028 0.184
#> GSM99508     3  0.4713    0.33228 0.000 0.000 0.640 0.360
#> GSM99568     3  0.5731    0.16253 0.028 0.000 0.544 0.428
#> GSM99596     3  0.5716    0.17354 0.028 0.000 0.552 0.420
#> GSM99600     2  0.5607    0.20546 0.000 0.492 0.488 0.020
#> GSM99458     4  0.6587    0.62073 0.112 0.000 0.292 0.596
#> GSM99460     4  0.6538    0.61604 0.108 0.000 0.292 0.600
#> GSM99510     3  0.4585    0.34309 0.000 0.000 0.668 0.332
#> GSM99512     3  0.4585    0.34861 0.000 0.000 0.668 0.332
#> GSM99514     3  0.4713    0.33228 0.000 0.000 0.640 0.360
#> GSM99516     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99518     1  0.2654    0.78512 0.888 0.000 0.004 0.108
#> GSM99520     3  0.4564    0.34971 0.000 0.000 0.672 0.328
#> GSM99522     3  0.4920    0.32448 0.004 0.000 0.628 0.368
#> GSM99570     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99432     3  0.5482    0.05979 0.000 0.368 0.608 0.024
#> GSM99434     3  0.5143    0.25393 0.012 0.000 0.628 0.360
#> GSM99436     3  0.5660   -0.02318 0.000 0.396 0.576 0.028
#> GSM99438     2  0.1637    0.82262 0.000 0.940 0.060 0.000
#> GSM99440     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99442     2  0.5517    0.33547 0.000 0.568 0.412 0.020
#> GSM99444     2  0.1302    0.82763 0.000 0.956 0.044 0.000
#> GSM99446     3  0.5570   -0.13145 0.000 0.440 0.540 0.020
#> GSM99448     3  0.5434    0.43410 0.000 0.132 0.740 0.128
#> GSM99450     3  0.5339    0.21800 0.016 0.000 0.600 0.384
#> GSM99452     1  0.0469    0.83110 0.988 0.000 0.000 0.012
#> GSM99454     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99456     1  0.5151    0.29352 0.532 0.000 0.004 0.464
#> GSM99462     2  0.0592    0.82986 0.000 0.984 0.016 0.000
#> GSM99464     4  0.6538    0.61604 0.108 0.000 0.292 0.600
#> GSM99466     3  0.6325    0.34394 0.016 0.212 0.680 0.092
#> GSM99470     1  0.5945    0.52699 0.648 0.012 0.040 0.300
#> GSM99472     1  0.5945    0.52699 0.648 0.012 0.040 0.300
#> GSM99474     3  0.5536    0.21980 0.024 0.000 0.592 0.384
#> GSM99476     3  0.4793    0.39044 0.000 0.040 0.756 0.204
#> GSM99478     3  0.6164    0.31826 0.012 0.228 0.680 0.080
#> GSM99480     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99482     1  0.4482    0.63903 0.728 0.000 0.008 0.264
#> GSM99484     3  0.6595    0.30688 0.016 0.232 0.652 0.100
#> GSM99486     3  0.5548    0.00647 0.000 0.388 0.588 0.024
#> GSM99488     2  0.0188    0.82581 0.000 0.996 0.000 0.004
#> GSM99490     2  0.0524    0.82802 0.000 0.988 0.008 0.004
#> GSM99492     1  0.1389    0.82279 0.952 0.000 0.000 0.048
#> GSM99494     2  0.0188    0.82581 0.000 0.996 0.000 0.004
#> GSM99524     1  0.0000    0.83523 1.000 0.000 0.000 0.000
#> GSM99526     3  0.5488    0.02777 0.016 0.000 0.532 0.452
#> GSM99528     3  0.6954    0.34193 0.028 0.220 0.640 0.112
#> GSM99530     4  0.4920    0.65847 0.068 0.000 0.164 0.768
#> GSM99532     4  0.6732    0.68603 0.220 0.000 0.168 0.612
#> GSM99534     3  0.8652   -0.13322 0.076 0.344 0.440 0.140
#> GSM99536     1  0.0376    0.83318 0.992 0.000 0.004 0.004
#> GSM99538     3  0.5367    0.22328 0.000 0.304 0.664 0.032
#> GSM99540     4  0.6732    0.68603 0.220 0.000 0.168 0.612
#> GSM99542     2  0.5527    0.49101 0.016 0.664 0.016 0.304
#> GSM99544     3  0.5389    0.21572 0.000 0.308 0.660 0.032
#> GSM99546     3  0.7252    0.25907 0.016 0.240 0.592 0.152
#> GSM99548     2  0.0524    0.82856 0.000 0.988 0.008 0.004
#> GSM99550     4  0.6699    0.16793 0.388 0.004 0.080 0.528
#> GSM99552     3  0.6954    0.35961 0.000 0.280 0.568 0.152
#> GSM99554     3  0.5695   -0.20567 0.000 0.476 0.500 0.024
#> GSM99556     2  0.0000    0.82699 0.000 1.000 0.000 0.000
#> GSM99558     3  0.6134    0.42492 0.000 0.216 0.668 0.116
#> GSM99560     3  0.5790    0.25084 0.004 0.304 0.648 0.044
#> GSM99562     3  0.4730    0.33230 0.000 0.000 0.636 0.364
#> GSM99564     3  0.5548    0.00647 0.000 0.388 0.588 0.024
#> GSM99572     2  0.1474    0.82596 0.000 0.948 0.052 0.000
#> GSM99576     4  0.7223    0.43967 0.252 0.020 0.132 0.596
#> GSM99578     2  0.3036    0.78721 0.008 0.892 0.080 0.020
#> GSM99580     3  0.5361    0.40160 0.000 0.060 0.716 0.224
#> GSM99582     3  0.6401    0.27956 0.044 0.032 0.644 0.280
#> GSM99584     3  0.5596    0.13696 0.000 0.332 0.632 0.036
#> GSM99586     1  0.5151    0.29352 0.532 0.000 0.004 0.464
#> GSM99588     2  0.5250    0.25729 0.000 0.552 0.440 0.008
#> GSM99590     2  0.1576    0.82642 0.000 0.948 0.048 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0798    0.77362 0.000 0.000 0.976 0.016 0.008
#> GSM99502     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.4159    0.68155 0.776 0.000 0.068 0.000 0.156
#> GSM99506     3  0.1018    0.77357 0.000 0.000 0.968 0.016 0.016
#> GSM99566     3  0.1597    0.76687 0.000 0.000 0.940 0.012 0.048
#> GSM99574     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.3517    0.74417 0.000 0.000 0.832 0.100 0.068
#> GSM99594     3  0.1597    0.76687 0.000 0.000 0.940 0.012 0.048
#> GSM99468     1  0.4159    0.68155 0.776 0.000 0.068 0.000 0.156
#> GSM99498     1  0.4159    0.68155 0.776 0.000 0.068 0.000 0.156
#> GSM99500     1  0.4159    0.68155 0.776 0.000 0.068 0.000 0.156
#> GSM99508     3  0.0798    0.77362 0.000 0.000 0.976 0.016 0.008
#> GSM99568     3  0.3601    0.67901 0.024 0.000 0.832 0.020 0.124
#> GSM99596     3  0.3409    0.68073 0.024 0.000 0.844 0.016 0.116
#> GSM99600     4  0.2929    0.67677 0.000 0.180 0.000 0.820 0.000
#> GSM99458     5  0.5337    0.42652 0.040 0.000 0.328 0.016 0.616
#> GSM99460     5  0.5189    0.42082 0.036 0.000 0.332 0.012 0.620
#> GSM99510     3  0.3741    0.74435 0.000 0.000 0.816 0.108 0.076
#> GSM99512     3  0.3003    0.75665 0.000 0.000 0.864 0.092 0.044
#> GSM99514     3  0.0798    0.77362 0.000 0.000 0.976 0.016 0.008
#> GSM99516     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.2389    0.78344 0.880 0.000 0.004 0.000 0.116
#> GSM99520     3  0.2291    0.76859 0.000 0.000 0.908 0.056 0.036
#> GSM99522     3  0.1597    0.77094 0.000 0.000 0.940 0.012 0.048
#> GSM99570     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.2074    0.77809 0.000 0.036 0.044 0.920 0.000
#> GSM99434     3  0.5345    0.61013 0.000 0.000 0.668 0.136 0.196
#> GSM99436     4  0.2046    0.76396 0.000 0.068 0.016 0.916 0.000
#> GSM99438     2  0.3395    0.85044 0.000 0.764 0.000 0.236 0.000
#> GSM99440     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.3766    0.55113 0.000 0.268 0.004 0.728 0.000
#> GSM99444     2  0.3177    0.87484 0.000 0.792 0.000 0.208 0.000
#> GSM99446     4  0.2964    0.73831 0.000 0.120 0.024 0.856 0.000
#> GSM99448     4  0.5045    0.00462 0.000 0.004 0.464 0.508 0.024
#> GSM99450     3  0.5327    0.58605 0.000 0.000 0.664 0.120 0.216
#> GSM99452     1  0.0579    0.84897 0.984 0.008 0.000 0.000 0.008
#> GSM99454     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.4572    0.16967 0.452 0.004 0.004 0.000 0.540
#> GSM99462     2  0.2773    0.89319 0.000 0.836 0.000 0.164 0.000
#> GSM99464     5  0.5189    0.42082 0.036 0.000 0.332 0.012 0.620
#> GSM99466     4  0.4794    0.71988 0.000 0.020 0.120 0.760 0.100
#> GSM99470     1  0.6798    0.45116 0.616 0.108 0.012 0.068 0.196
#> GSM99472     1  0.6798    0.45116 0.616 0.108 0.012 0.068 0.196
#> GSM99474     3  0.5189    0.62502 0.012 0.000 0.700 0.084 0.204
#> GSM99476     3  0.6124    0.16929 0.000 0.000 0.460 0.412 0.128
#> GSM99478     4  0.4447    0.74193 0.000 0.020 0.100 0.788 0.092
#> GSM99480     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99482     1  0.5646    0.58217 0.700 0.096 0.012 0.020 0.172
#> GSM99484     4  0.4983    0.72997 0.000 0.036 0.104 0.756 0.104
#> GSM99486     4  0.1800    0.76971 0.000 0.048 0.020 0.932 0.000
#> GSM99488     2  0.2179    0.89334 0.000 0.888 0.000 0.112 0.000
#> GSM99490     2  0.2439    0.89535 0.000 0.876 0.000 0.120 0.004
#> GSM99492     1  0.1478    0.82896 0.936 0.000 0.000 0.000 0.064
#> GSM99494     2  0.2179    0.89334 0.000 0.888 0.000 0.112 0.000
#> GSM99524     1  0.0000    0.85637 1.000 0.000 0.000 0.000 0.000
#> GSM99526     3  0.6142    0.22763 0.000 0.000 0.472 0.132 0.396
#> GSM99528     4  0.5442    0.70223 0.004 0.024 0.116 0.716 0.140
#> GSM99530     5  0.3280    0.54432 0.000 0.004 0.160 0.012 0.824
#> GSM99532     5  0.5751    0.63687 0.160 0.000 0.172 0.012 0.656
#> GSM99534     4  0.5594    0.63319 0.052 0.160 0.004 0.712 0.072
#> GSM99536     1  0.0290    0.85370 0.992 0.000 0.000 0.000 0.008
#> GSM99538     4  0.2692    0.77957 0.000 0.008 0.092 0.884 0.016
#> GSM99540     5  0.5751    0.63687 0.160 0.000 0.172 0.012 0.656
#> GSM99542     2  0.4517    0.56712 0.000 0.756 0.012 0.052 0.180
#> GSM99544     4  0.2589    0.77857 0.000 0.008 0.092 0.888 0.012
#> GSM99546     4  0.4812    0.71431 0.004 0.016 0.112 0.764 0.104
#> GSM99548     2  0.2329    0.89599 0.000 0.876 0.000 0.124 0.000
#> GSM99550     5  0.5260    0.47753 0.304 0.004 0.024 0.024 0.644
#> GSM99552     4  0.4047    0.56151 0.000 0.004 0.320 0.676 0.000
#> GSM99554     4  0.2886    0.71050 0.000 0.148 0.008 0.844 0.000
#> GSM99556     2  0.2280    0.89562 0.000 0.880 0.000 0.120 0.000
#> GSM99558     4  0.4709    0.48648 0.000 0.004 0.324 0.648 0.024
#> GSM99560     4  0.3613    0.77831 0.000 0.016 0.072 0.844 0.068
#> GSM99562     3  0.1444    0.76594 0.000 0.000 0.948 0.012 0.040
#> GSM99564     4  0.1800    0.76971 0.000 0.048 0.020 0.932 0.000
#> GSM99572     2  0.3242    0.86983 0.000 0.784 0.000 0.216 0.000
#> GSM99576     5  0.7777    0.48361 0.188 0.072 0.060 0.120 0.560
#> GSM99578     2  0.4019    0.82417 0.000 0.768 0.004 0.200 0.028
#> GSM99580     3  0.4326    0.58086 0.000 0.000 0.708 0.264 0.028
#> GSM99582     3  0.7058    0.23677 0.024 0.000 0.444 0.336 0.196
#> GSM99584     4  0.2277    0.78434 0.000 0.016 0.052 0.916 0.016
#> GSM99586     5  0.4572    0.16967 0.452 0.004 0.004 0.000 0.540
#> GSM99588     4  0.4276    0.57380 0.000 0.256 0.028 0.716 0.000
#> GSM99590     2  0.3274    0.86830 0.000 0.780 0.000 0.220 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0405    0.73662 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM99502     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.4329    0.61639 0.776 0.000 0.060 0.000 0.080 0.084
#> GSM99506     3  0.0458    0.73601 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM99566     3  0.1464    0.72700 0.000 0.004 0.944 0.000 0.016 0.036
#> GSM99574     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.4949    0.63200 0.000 0.000 0.704 0.084 0.172 0.040
#> GSM99594     3  0.1464    0.72700 0.000 0.004 0.944 0.000 0.016 0.036
#> GSM99468     1  0.4329    0.61639 0.776 0.000 0.060 0.000 0.080 0.084
#> GSM99498     1  0.4329    0.61639 0.776 0.000 0.060 0.000 0.080 0.084
#> GSM99500     1  0.4329    0.61639 0.776 0.000 0.060 0.000 0.080 0.084
#> GSM99508     3  0.0405    0.73662 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM99568     3  0.3552    0.65725 0.024 0.000 0.832 0.004 0.064 0.076
#> GSM99596     3  0.3292    0.65987 0.024 0.000 0.844 0.000 0.056 0.076
#> GSM99600     4  0.3709    0.66193 0.000 0.204 0.000 0.756 0.000 0.040
#> GSM99458     5  0.2604    0.49634 0.020 0.000 0.100 0.000 0.872 0.008
#> GSM99460     5  0.2405    0.49938 0.016 0.000 0.100 0.000 0.880 0.004
#> GSM99510     3  0.6058    0.57337 0.000 0.000 0.600 0.068 0.168 0.164
#> GSM99512     3  0.4565    0.66766 0.000 0.004 0.744 0.072 0.028 0.152
#> GSM99514     3  0.0405    0.73662 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM99516     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.2512    0.70699 0.880 0.000 0.000 0.000 0.060 0.060
#> GSM99520     3  0.3840    0.69192 0.000 0.000 0.796 0.052 0.128 0.024
#> GSM99522     3  0.2866    0.72493 0.000 0.004 0.860 0.000 0.084 0.052
#> GSM99570     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.2006    0.74625 0.000 0.036 0.008 0.924 0.008 0.024
#> GSM99434     3  0.6940    0.26350 0.000 0.000 0.420 0.100 0.332 0.148
#> GSM99436     4  0.1838    0.74395 0.000 0.068 0.000 0.916 0.000 0.016
#> GSM99438     2  0.2750    0.85075 0.000 0.844 0.000 0.136 0.000 0.020
#> GSM99440     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     4  0.3936    0.57342 0.000 0.288 0.000 0.688 0.000 0.024
#> GSM99444     2  0.2450    0.86671 0.000 0.868 0.000 0.116 0.000 0.016
#> GSM99446     4  0.2734    0.73585 0.000 0.116 0.004 0.860 0.004 0.016
#> GSM99448     4  0.6056    0.12987 0.000 0.004 0.344 0.520 0.080 0.052
#> GSM99450     3  0.6515    0.26205 0.000 0.000 0.440 0.084 0.376 0.100
#> GSM99452     1  0.0458    0.76553 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM99454     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.5765   -0.30300 0.420 0.000 0.000 0.000 0.408 0.172
#> GSM99462     2  0.1471    0.88615 0.000 0.932 0.000 0.064 0.000 0.004
#> GSM99464     5  0.2405    0.49938 0.016 0.000 0.100 0.000 0.880 0.004
#> GSM99466     4  0.5247    0.66434 0.000 0.004 0.064 0.704 0.116 0.112
#> GSM99470     1  0.4527    0.15157 0.564 0.004 0.000 0.020 0.004 0.408
#> GSM99472     1  0.4527    0.15157 0.564 0.004 0.000 0.020 0.004 0.408
#> GSM99474     3  0.5969    0.47272 0.012 0.000 0.572 0.068 0.296 0.052
#> GSM99476     4  0.7138    0.04403 0.000 0.000 0.292 0.396 0.220 0.092
#> GSM99478     4  0.4893    0.68367 0.000 0.004 0.048 0.732 0.104 0.112
#> GSM99480     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99482     1  0.3607    0.35757 0.652 0.000 0.000 0.000 0.000 0.348
#> GSM99484     4  0.5379    0.66760 0.000 0.012 0.056 0.700 0.112 0.120
#> GSM99486     4  0.1865    0.74192 0.000 0.040 0.000 0.920 0.000 0.040
#> GSM99488     2  0.0260    0.87772 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM99490     2  0.0891    0.88343 0.000 0.968 0.000 0.024 0.000 0.008
#> GSM99492     1  0.2001    0.73272 0.912 0.000 0.000 0.000 0.048 0.040
#> GSM99494     2  0.0260    0.87772 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM99524     1  0.0000    0.77402 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99526     5  0.5878    0.27482 0.000 0.000 0.176 0.096 0.628 0.100
#> GSM99528     4  0.5732    0.63615 0.000 0.008 0.056 0.656 0.140 0.140
#> GSM99530     5  0.4673    0.19384 0.000 0.000 0.080 0.000 0.648 0.272
#> GSM99532     5  0.6047    0.14168 0.148 0.000 0.088 0.000 0.612 0.152
#> GSM99534     4  0.5258    0.59146 0.008 0.100 0.000 0.648 0.012 0.232
#> GSM99536     1  0.0260    0.77117 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM99538     4  0.2222    0.73601 0.000 0.004 0.012 0.912 0.040 0.032
#> GSM99540     5  0.6047    0.14168 0.148 0.000 0.088 0.000 0.612 0.152
#> GSM99542     2  0.3578    0.52123 0.000 0.660 0.000 0.000 0.000 0.340
#> GSM99544     4  0.2171    0.73546 0.000 0.004 0.016 0.916 0.032 0.032
#> GSM99546     4  0.5521    0.63851 0.004 0.004 0.060 0.684 0.112 0.136
#> GSM99548     2  0.0692    0.88199 0.000 0.976 0.000 0.020 0.000 0.004
#> GSM99550     5  0.5993   -0.28801 0.272 0.000 0.000 0.020 0.532 0.176
#> GSM99552     4  0.4264    0.56615 0.000 0.004 0.284 0.680 0.004 0.028
#> GSM99554     4  0.3172    0.71489 0.000 0.148 0.000 0.816 0.000 0.036
#> GSM99556     2  0.0935    0.88558 0.000 0.964 0.000 0.032 0.000 0.004
#> GSM99558     4  0.5478    0.53238 0.000 0.004 0.224 0.648 0.072 0.052
#> GSM99560     4  0.3935    0.73097 0.000 0.016 0.020 0.812 0.080 0.072
#> GSM99562     3  0.2182    0.72068 0.000 0.004 0.900 0.000 0.020 0.076
#> GSM99564     4  0.1865    0.74192 0.000 0.040 0.000 0.920 0.000 0.040
#> GSM99572     2  0.2536    0.86606 0.000 0.864 0.000 0.116 0.000 0.020
#> GSM99576     6  0.7370    0.00000 0.176 0.004 0.028 0.060 0.300 0.432
#> GSM99578     2  0.3237    0.81173 0.000 0.840 0.004 0.112 0.016 0.028
#> GSM99580     3  0.5665    0.50495 0.000 0.000 0.596 0.264 0.104 0.036
#> GSM99582     3  0.7395    0.00504 0.020 0.000 0.332 0.316 0.276 0.056
#> GSM99584     4  0.2452    0.74542 0.000 0.012 0.016 0.904 0.028 0.040
#> GSM99586     1  0.5765   -0.30300 0.420 0.000 0.000 0.000 0.408 0.172
#> GSM99588     4  0.3850    0.61592 0.000 0.260 0.004 0.716 0.000 0.020
#> GSM99590     2  0.2623    0.85961 0.000 0.852 0.000 0.132 0.000 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-MAD-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) cell.type(p) k
#> MAD:hclust 81         6.16e-05     3.41e-04 2
#> MAD:hclust 70         1.32e-04     4.69e-03 3
#> MAD:hclust 37         1.74e-02     9.57e-02 4
#> MAD:hclust 71         3.44e-06     1.50e-03 5
#> MAD:hclust 65         8.30e-08     2.83e-05 6

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


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

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.683           0.836       0.926         0.4862 0.503   0.503
#> 3 3 1.000           0.962       0.984         0.3849 0.729   0.507
#> 4 4 0.774           0.639       0.832         0.1079 0.955   0.865
#> 5 5 0.731           0.643       0.815         0.0636 0.870   0.590
#> 6 6 0.751           0.645       0.790         0.0420 0.909   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
#> GSM99496     1  0.8555     0.6989 0.720 0.280
#> GSM99502     1  0.0000     0.8895 1.000 0.000
#> GSM99504     1  0.0000     0.8895 1.000 0.000
#> GSM99506     1  0.8555     0.6989 0.720 0.280
#> GSM99566     1  0.8763     0.6762 0.704 0.296
#> GSM99574     1  0.0000     0.8895 1.000 0.000
#> GSM99592     1  0.8813     0.6701 0.700 0.300
#> GSM99594     1  0.8608     0.6934 0.716 0.284
#> GSM99468     1  0.0000     0.8895 1.000 0.000
#> GSM99498     1  0.0000     0.8895 1.000 0.000
#> GSM99500     1  0.0000     0.8895 1.000 0.000
#> GSM99508     1  0.6887     0.7874 0.816 0.184
#> GSM99568     1  0.8555     0.6989 0.720 0.280
#> GSM99596     1  0.3431     0.8617 0.936 0.064
#> GSM99600     2  0.0000     0.9438 0.000 1.000
#> GSM99458     1  0.0000     0.8895 1.000 0.000
#> GSM99460     1  0.0000     0.8895 1.000 0.000
#> GSM99510     2  0.9896     0.0552 0.440 0.560
#> GSM99512     2  0.9850     0.1038 0.428 0.572
#> GSM99514     1  0.8555     0.6989 0.720 0.280
#> GSM99516     1  0.0000     0.8895 1.000 0.000
#> GSM99518     1  0.0000     0.8895 1.000 0.000
#> GSM99520     1  0.8555     0.6989 0.720 0.280
#> GSM99522     1  0.0000     0.8895 1.000 0.000
#> GSM99570     1  0.0000     0.8895 1.000 0.000
#> GSM99598     1  0.0000     0.8895 1.000 0.000
#> GSM99432     2  0.0000     0.9438 0.000 1.000
#> GSM99434     1  0.9129     0.6219 0.672 0.328
#> GSM99436     2  0.0000     0.9438 0.000 1.000
#> GSM99438     2  0.0000     0.9438 0.000 1.000
#> GSM99440     1  0.0000     0.8895 1.000 0.000
#> GSM99442     2  0.0000     0.9438 0.000 1.000
#> GSM99444     2  0.0000     0.9438 0.000 1.000
#> GSM99446     2  0.0000     0.9438 0.000 1.000
#> GSM99448     2  0.0000     0.9438 0.000 1.000
#> GSM99450     1  0.5842     0.8185 0.860 0.140
#> GSM99452     1  0.0000     0.8895 1.000 0.000
#> GSM99454     1  0.0000     0.8895 1.000 0.000
#> GSM99456     1  0.0000     0.8895 1.000 0.000
#> GSM99462     2  0.0000     0.9438 0.000 1.000
#> GSM99464     1  0.0000     0.8895 1.000 0.000
#> GSM99466     2  0.0000     0.9438 0.000 1.000
#> GSM99470     1  0.0376     0.8880 0.996 0.004
#> GSM99472     1  0.0000     0.8895 1.000 0.000
#> GSM99474     1  0.8443     0.7074 0.728 0.272
#> GSM99476     2  0.0000     0.9438 0.000 1.000
#> GSM99478     2  0.0000     0.9438 0.000 1.000
#> GSM99480     1  0.0000     0.8895 1.000 0.000
#> GSM99482     1  0.0000     0.8895 1.000 0.000
#> GSM99484     2  0.0000     0.9438 0.000 1.000
#> GSM99486     2  0.0000     0.9438 0.000 1.000
#> GSM99488     2  0.0000     0.9438 0.000 1.000
#> GSM99490     2  0.0000     0.9438 0.000 1.000
#> GSM99492     1  0.0000     0.8895 1.000 0.000
#> GSM99494     2  0.0000     0.9438 0.000 1.000
#> GSM99524     1  0.0000     0.8895 1.000 0.000
#> GSM99526     1  0.9988     0.2274 0.520 0.480
#> GSM99528     2  0.3584     0.8721 0.068 0.932
#> GSM99530     1  0.4161     0.8519 0.916 0.084
#> GSM99532     1  0.0000     0.8895 1.000 0.000
#> GSM99534     2  0.0000     0.9438 0.000 1.000
#> GSM99536     1  0.0000     0.8895 1.000 0.000
#> GSM99538     2  0.0000     0.9438 0.000 1.000
#> GSM99540     1  0.0000     0.8895 1.000 0.000
#> GSM99542     2  0.0000     0.9438 0.000 1.000
#> GSM99544     2  0.0000     0.9438 0.000 1.000
#> GSM99546     2  0.9000     0.4459 0.316 0.684
#> GSM99548     2  0.0000     0.9438 0.000 1.000
#> GSM99550     1  0.0000     0.8895 1.000 0.000
#> GSM99552     2  0.9850     0.1038 0.428 0.572
#> GSM99554     2  0.0000     0.9438 0.000 1.000
#> GSM99556     2  0.0000     0.9438 0.000 1.000
#> GSM99558     2  0.0000     0.9438 0.000 1.000
#> GSM99560     2  0.0000     0.9438 0.000 1.000
#> GSM99562     1  0.8555     0.6989 0.720 0.280
#> GSM99564     2  0.0000     0.9438 0.000 1.000
#> GSM99572     2  0.0000     0.9438 0.000 1.000
#> GSM99576     1  0.0000     0.8895 1.000 0.000
#> GSM99578     2  0.0000     0.9438 0.000 1.000
#> GSM99580     1  0.8955     0.6506 0.688 0.312
#> GSM99582     1  0.6712     0.7935 0.824 0.176
#> GSM99584     2  0.0000     0.9438 0.000 1.000
#> GSM99586     1  0.0000     0.8895 1.000 0.000
#> GSM99588     2  0.0000     0.9438 0.000 1.000
#> GSM99590     2  0.0000     0.9438 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
#> GSM99496     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99502     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99504     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99506     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99566     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99574     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99592     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99594     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99468     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99498     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99500     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99508     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99568     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99596     3  0.0237     0.9767 0.004 0.000 0.996
#> GSM99600     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99458     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99460     1  0.0237     0.9975 0.996 0.000 0.004
#> GSM99510     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99512     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99514     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99516     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99518     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99520     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99522     3  0.0237     0.9767 0.004 0.000 0.996
#> GSM99570     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99432     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99434     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99436     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99438     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99440     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99442     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99444     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99446     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99448     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99450     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99452     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99456     1  0.0237     0.9975 0.996 0.000 0.004
#> GSM99462     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99464     3  0.0000     0.9770 0.000 0.000 1.000
#> GSM99466     2  0.5465     0.6065 0.000 0.712 0.288
#> GSM99470     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99472     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99474     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99476     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99478     2  0.4750     0.7298 0.000 0.784 0.216
#> GSM99480     1  0.0237     0.9975 0.996 0.000 0.004
#> GSM99482     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99484     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99486     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99488     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99490     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99492     1  0.0237     0.9975 0.996 0.000 0.004
#> GSM99494     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99524     1  0.0000     0.9987 1.000 0.000 0.000
#> GSM99526     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99528     3  0.6291     0.0667 0.000 0.468 0.532
#> GSM99530     3  0.0000     0.9770 0.000 0.000 1.000
#> GSM99532     3  0.0000     0.9770 0.000 0.000 1.000
#> GSM99534     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99536     1  0.0237     0.9975 0.996 0.000 0.004
#> GSM99538     2  0.4796     0.7241 0.000 0.780 0.220
#> GSM99540     1  0.0237     0.9975 0.996 0.000 0.004
#> GSM99542     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99544     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99546     3  0.1411     0.9499 0.000 0.036 0.964
#> GSM99548     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99550     1  0.0592     0.9907 0.988 0.000 0.012
#> GSM99552     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99554     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99556     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99558     3  0.0892     0.9659 0.000 0.020 0.980
#> GSM99560     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99562     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99564     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99572     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99576     1  0.0237     0.9975 0.996 0.000 0.004
#> GSM99578     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99580     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99582     3  0.0237     0.9799 0.000 0.004 0.996
#> GSM99584     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99586     1  0.0237     0.9975 0.996 0.000 0.004
#> GSM99588     2  0.0000     0.9729 0.000 1.000 0.000
#> GSM99590     2  0.0000     0.9729 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99592     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99594     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99600     2  0.4790     0.6500 0.000 0.620 0.000 0.380
#> GSM99458     1  0.3764     0.7988 0.784 0.000 0.000 0.216
#> GSM99460     1  0.4193     0.7596 0.732 0.000 0.000 0.268
#> GSM99510     3  0.4137     0.7040 0.000 0.012 0.780 0.208
#> GSM99512     3  0.0817     0.8525 0.000 0.000 0.976 0.024
#> GSM99514     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99570     1  0.0188     0.9160 0.996 0.000 0.000 0.004
#> GSM99598     1  0.0000     0.9163 1.000 0.000 0.000 0.000
#> GSM99432     2  0.3801    -0.0501 0.000 0.780 0.000 0.220
#> GSM99434     3  0.4635     0.6328 0.000 0.012 0.720 0.268
#> GSM99436     2  0.0000     0.4159 0.000 1.000 0.000 0.000
#> GSM99438     2  0.4866     0.6514 0.000 0.596 0.000 0.404
#> GSM99440     1  0.0469     0.9146 0.988 0.000 0.000 0.012
#> GSM99442     2  0.4855     0.6515 0.000 0.600 0.000 0.400
#> GSM99444     2  0.4866     0.6514 0.000 0.596 0.000 0.404
#> GSM99446     2  0.0592     0.4314 0.000 0.984 0.000 0.016
#> GSM99448     3  0.4614     0.6969 0.000 0.064 0.792 0.144
#> GSM99450     3  0.3907     0.6983 0.000 0.000 0.768 0.232
#> GSM99452     1  0.0469     0.9146 0.988 0.000 0.000 0.012
#> GSM99454     1  0.0188     0.9160 0.996 0.000 0.000 0.004
#> GSM99456     1  0.4164     0.7825 0.736 0.000 0.000 0.264
#> GSM99462     2  0.4866     0.6514 0.000 0.596 0.000 0.404
#> GSM99464     3  0.4992     0.3165 0.000 0.000 0.524 0.476
#> GSM99466     2  0.5522    -0.3593 0.000 0.668 0.044 0.288
#> GSM99470     1  0.6469     0.5142 0.644 0.192 0.000 0.164
#> GSM99472     1  0.3266     0.8340 0.832 0.000 0.000 0.168
#> GSM99474     3  0.0469     0.8577 0.000 0.000 0.988 0.012
#> GSM99476     2  0.7834    -0.6145 0.000 0.404 0.320 0.276
#> GSM99478     2  0.5247    -0.3112 0.000 0.684 0.032 0.284
#> GSM99480     1  0.2011     0.8885 0.920 0.000 0.000 0.080
#> GSM99482     1  0.0336     0.9154 0.992 0.000 0.000 0.008
#> GSM99484     2  0.3219     0.1420 0.000 0.836 0.000 0.164
#> GSM99486     2  0.1557     0.3412 0.000 0.944 0.000 0.056
#> GSM99488     2  0.4866     0.6514 0.000 0.596 0.000 0.404
#> GSM99490     2  0.4817     0.6512 0.000 0.612 0.000 0.388
#> GSM99492     1  0.2011     0.8885 0.920 0.000 0.000 0.080
#> GSM99494     2  0.4866     0.6514 0.000 0.596 0.000 0.404
#> GSM99524     1  0.0188     0.9160 0.996 0.000 0.000 0.004
#> GSM99526     4  0.6702     0.8884 0.000 0.396 0.092 0.512
#> GSM99528     4  0.6337     0.8330 0.000 0.468 0.060 0.472
#> GSM99530     3  0.4193     0.6369 0.000 0.000 0.732 0.268
#> GSM99532     3  0.3688     0.7033 0.000 0.000 0.792 0.208
#> GSM99534     2  0.2647     0.3509 0.000 0.880 0.000 0.120
#> GSM99536     1  0.0921     0.9090 0.972 0.000 0.000 0.028
#> GSM99538     2  0.5648    -0.3210 0.000 0.684 0.064 0.252
#> GSM99540     1  0.3649     0.8121 0.796 0.000 0.000 0.204
#> GSM99542     2  0.4972     0.6292 0.000 0.544 0.000 0.456
#> GSM99544     2  0.3688    -0.0141 0.000 0.792 0.000 0.208
#> GSM99546     4  0.6562     0.8948 0.000 0.404 0.080 0.516
#> GSM99548     2  0.4866     0.6514 0.000 0.596 0.000 0.404
#> GSM99550     4  0.5869     0.8106 0.044 0.360 0.000 0.596
#> GSM99552     3  0.0188     0.8604 0.000 0.004 0.996 0.000
#> GSM99554     2  0.4585     0.6364 0.000 0.668 0.000 0.332
#> GSM99556     2  0.4866     0.6514 0.000 0.596 0.000 0.404
#> GSM99558     3  0.7276    -0.3217 0.000 0.404 0.448 0.148
#> GSM99560     2  0.3649     0.0282 0.000 0.796 0.000 0.204
#> GSM99562     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99564     2  0.0921     0.3814 0.000 0.972 0.000 0.028
#> GSM99572     2  0.4866     0.6514 0.000 0.596 0.000 0.404
#> GSM99576     1  0.4304     0.7487 0.716 0.000 0.000 0.284
#> GSM99578     2  0.4643     0.5967 0.000 0.656 0.000 0.344
#> GSM99580     3  0.0000     0.8625 0.000 0.000 1.000 0.000
#> GSM99582     3  0.7173     0.1205 0.000 0.228 0.556 0.216
#> GSM99584     2  0.4431    -0.2774 0.000 0.696 0.000 0.304
#> GSM99586     1  0.4072     0.7925 0.748 0.000 0.000 0.252
#> GSM99588     2  0.4817     0.6512 0.000 0.612 0.000 0.388
#> GSM99590     2  0.4866     0.6514 0.000 0.596 0.000 0.404

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0162     0.8363 0.000 0.000 0.996 0.000 0.004
#> GSM99502     1  0.0404     0.8870 0.988 0.000 0.000 0.012 0.000
#> GSM99504     1  0.0404     0.8866 0.988 0.000 0.000 0.012 0.000
#> GSM99506     3  0.0162     0.8363 0.000 0.000 0.996 0.000 0.004
#> GSM99566     3  0.0162     0.8363 0.000 0.000 0.996 0.000 0.004
#> GSM99574     1  0.0404     0.8870 0.988 0.000 0.000 0.012 0.000
#> GSM99592     3  0.0290     0.8349 0.000 0.000 0.992 0.000 0.008
#> GSM99594     3  0.0324     0.8356 0.000 0.000 0.992 0.004 0.004
#> GSM99468     1  0.0510     0.8866 0.984 0.000 0.000 0.016 0.000
#> GSM99498     1  0.0404     0.8866 0.988 0.000 0.000 0.012 0.000
#> GSM99500     1  0.0404     0.8866 0.988 0.000 0.000 0.012 0.000
#> GSM99508     3  0.0162     0.8363 0.000 0.000 0.996 0.000 0.004
#> GSM99568     3  0.0162     0.8357 0.000 0.000 0.996 0.000 0.004
#> GSM99596     3  0.0324     0.8356 0.000 0.000 0.992 0.004 0.004
#> GSM99600     2  0.4419     0.4035 0.000 0.668 0.000 0.312 0.020
#> GSM99458     5  0.4321     0.3257 0.396 0.000 0.000 0.004 0.600
#> GSM99460     5  0.4218     0.4219 0.332 0.000 0.000 0.008 0.660
#> GSM99510     3  0.5775     0.5107 0.000 0.000 0.608 0.244 0.148
#> GSM99512     3  0.3110     0.7623 0.000 0.000 0.860 0.080 0.060
#> GSM99514     3  0.0162     0.8363 0.000 0.000 0.996 0.000 0.004
#> GSM99516     1  0.0162     0.8870 0.996 0.000 0.000 0.000 0.004
#> GSM99518     1  0.0912     0.8821 0.972 0.000 0.000 0.016 0.012
#> GSM99520     3  0.0000     0.8360 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0798     0.8299 0.000 0.000 0.976 0.008 0.016
#> GSM99570     1  0.0912     0.8821 0.972 0.000 0.000 0.012 0.016
#> GSM99598     1  0.0324     0.8871 0.992 0.000 0.000 0.004 0.004
#> GSM99432     4  0.2612     0.7089 0.000 0.124 0.000 0.868 0.008
#> GSM99434     3  0.6433     0.3478 0.000 0.000 0.504 0.268 0.228
#> GSM99436     4  0.4524     0.5772 0.000 0.336 0.000 0.644 0.020
#> GSM99438     2  0.0000     0.8713 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0451     0.8865 0.988 0.000 0.000 0.008 0.004
#> GSM99442     2  0.2144     0.8194 0.000 0.912 0.000 0.068 0.020
#> GSM99444     2  0.0162     0.8704 0.000 0.996 0.000 0.000 0.004
#> GSM99446     4  0.4540     0.5707 0.000 0.340 0.000 0.640 0.020
#> GSM99448     3  0.4976     0.2403 0.000 0.000 0.504 0.468 0.028
#> GSM99450     3  0.6120     0.4097 0.000 0.000 0.556 0.176 0.268
#> GSM99452     1  0.1012     0.8806 0.968 0.000 0.000 0.012 0.020
#> GSM99454     1  0.0162     0.8872 0.996 0.000 0.000 0.000 0.004
#> GSM99456     5  0.5009     0.1437 0.428 0.000 0.000 0.032 0.540
#> GSM99462     2  0.0162     0.8704 0.000 0.996 0.000 0.000 0.004
#> GSM99464     5  0.5268     0.4457 0.004 0.000 0.168 0.136 0.692
#> GSM99466     4  0.4730     0.6506 0.000 0.068 0.008 0.736 0.188
#> GSM99470     5  0.6779     0.2048 0.332 0.000 0.000 0.284 0.384
#> GSM99472     1  0.5218     0.2942 0.604 0.000 0.000 0.060 0.336
#> GSM99474     3  0.0992     0.8241 0.000 0.000 0.968 0.008 0.024
#> GSM99476     4  0.3758     0.5714 0.000 0.000 0.088 0.816 0.096
#> GSM99478     4  0.4730     0.6506 0.000 0.068 0.008 0.736 0.188
#> GSM99480     1  0.2450     0.8204 0.896 0.000 0.000 0.028 0.076
#> GSM99482     1  0.1557     0.8582 0.940 0.000 0.000 0.008 0.052
#> GSM99484     4  0.5472     0.6615 0.000 0.140 0.000 0.652 0.208
#> GSM99486     4  0.4526     0.6198 0.000 0.300 0.000 0.672 0.028
#> GSM99488     2  0.0162     0.8704 0.000 0.996 0.000 0.000 0.004
#> GSM99490     2  0.2761     0.7856 0.000 0.872 0.000 0.104 0.024
#> GSM99492     1  0.2535     0.8169 0.892 0.000 0.000 0.032 0.076
#> GSM99494     2  0.0162     0.8704 0.000 0.996 0.000 0.000 0.004
#> GSM99524     1  0.0798     0.8816 0.976 0.000 0.000 0.008 0.016
#> GSM99526     5  0.4276     0.3102 0.000 0.000 0.004 0.380 0.616
#> GSM99528     4  0.5021     0.3096 0.000 0.020 0.008 0.556 0.416
#> GSM99530     5  0.4827    -0.1128 0.000 0.000 0.476 0.020 0.504
#> GSM99532     3  0.4717     0.2983 0.000 0.000 0.584 0.020 0.396
#> GSM99534     4  0.6805     0.2979 0.000 0.316 0.000 0.372 0.312
#> GSM99536     1  0.1216     0.8767 0.960 0.000 0.000 0.020 0.020
#> GSM99538     4  0.3418     0.6803 0.000 0.068 0.028 0.860 0.044
#> GSM99540     1  0.4738    -0.1003 0.520 0.000 0.000 0.016 0.464
#> GSM99542     2  0.3090     0.7459 0.000 0.860 0.000 0.052 0.088
#> GSM99544     4  0.2771     0.7073 0.000 0.128 0.000 0.860 0.012
#> GSM99546     5  0.4452    -0.0181 0.000 0.000 0.004 0.496 0.500
#> GSM99548     2  0.0000     0.8713 0.000 1.000 0.000 0.000 0.000
#> GSM99550     5  0.2411     0.4756 0.008 0.000 0.000 0.108 0.884
#> GSM99552     3  0.2482     0.7663 0.000 0.000 0.892 0.024 0.084
#> GSM99554     4  0.4811     0.3258 0.000 0.452 0.000 0.528 0.020
#> GSM99556     2  0.0000     0.8713 0.000 1.000 0.000 0.000 0.000
#> GSM99558     4  0.4028     0.5688 0.000 0.000 0.192 0.768 0.040
#> GSM99560     4  0.4810     0.6799 0.000 0.204 0.000 0.712 0.084
#> GSM99562     3  0.0566     0.8327 0.000 0.000 0.984 0.004 0.012
#> GSM99564     4  0.4456     0.5984 0.000 0.320 0.000 0.660 0.020
#> GSM99572     2  0.0000     0.8713 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.4584     0.4045 0.312 0.000 0.000 0.028 0.660
#> GSM99578     2  0.6433    -0.0783 0.000 0.464 0.000 0.352 0.184
#> GSM99580     3  0.0000     0.8360 0.000 0.000 1.000 0.000 0.000
#> GSM99582     3  0.6623     0.1097 0.000 0.000 0.444 0.236 0.320
#> GSM99584     4  0.2989     0.6685 0.000 0.060 0.000 0.868 0.072
#> GSM99586     1  0.5047    -0.0568 0.496 0.000 0.000 0.032 0.472
#> GSM99588     2  0.3687     0.6690 0.000 0.792 0.000 0.180 0.028
#> GSM99590     2  0.0000     0.8713 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0260     0.8906 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM99502     1  0.0622     0.9491 0.980 0.000 0.000 0.000 0.012 0.008
#> GSM99504     1  0.0909     0.9475 0.968 0.000 0.000 0.000 0.012 0.020
#> GSM99506     3  0.0260     0.8907 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM99566     3  0.0260     0.8907 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM99574     1  0.0622     0.9491 0.980 0.000 0.000 0.000 0.012 0.008
#> GSM99592     3  0.0405     0.8891 0.000 0.000 0.988 0.004 0.008 0.000
#> GSM99594     3  0.0405     0.8905 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM99468     1  0.0820     0.9484 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM99498     1  0.0909     0.9475 0.968 0.000 0.000 0.000 0.012 0.020
#> GSM99500     1  0.0909     0.9475 0.968 0.000 0.000 0.000 0.012 0.020
#> GSM99508     3  0.0146     0.8910 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99568     3  0.0508     0.8897 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM99596     3  0.0363     0.8898 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99600     4  0.3838     0.1937 0.000 0.448 0.000 0.552 0.000 0.000
#> GSM99458     5  0.4416     0.4886 0.212 0.000 0.000 0.004 0.708 0.076
#> GSM99460     5  0.3220     0.5236 0.108 0.000 0.000 0.004 0.832 0.056
#> GSM99510     3  0.7476     0.0220 0.000 0.000 0.388 0.204 0.192 0.216
#> GSM99512     3  0.5683     0.5303 0.000 0.000 0.640 0.064 0.112 0.184
#> GSM99514     3  0.0146     0.8907 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99516     1  0.0146     0.9489 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99518     1  0.0806     0.9480 0.972 0.000 0.000 0.000 0.020 0.008
#> GSM99520     3  0.0146     0.8904 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99522     3  0.1788     0.8630 0.000 0.000 0.928 0.004 0.028 0.040
#> GSM99570     1  0.0520     0.9461 0.984 0.000 0.000 0.000 0.008 0.008
#> GSM99598     1  0.0146     0.9489 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99432     4  0.2867     0.6052 0.000 0.040 0.000 0.868 0.016 0.076
#> GSM99434     5  0.7557     0.2367 0.000 0.000 0.240 0.200 0.360 0.200
#> GSM99436     4  0.2883     0.5949 0.000 0.212 0.000 0.788 0.000 0.000
#> GSM99438     2  0.0000     0.8878 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     1  0.0260     0.9480 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM99442     2  0.3050     0.6591 0.000 0.764 0.000 0.236 0.000 0.000
#> GSM99444     2  0.0260     0.8869 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM99446     4  0.2969     0.5880 0.000 0.224 0.000 0.776 0.000 0.000
#> GSM99448     4  0.6434     0.2324 0.000 0.000 0.256 0.508 0.048 0.188
#> GSM99450     5  0.6846     0.1976 0.000 0.000 0.328 0.116 0.440 0.116
#> GSM99452     1  0.1088     0.9362 0.960 0.000 0.000 0.000 0.016 0.024
#> GSM99454     1  0.0146     0.9487 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99456     5  0.5586     0.4081 0.284 0.000 0.000 0.004 0.552 0.160
#> GSM99462     2  0.0820     0.8807 0.000 0.972 0.000 0.000 0.012 0.016
#> GSM99464     5  0.2325     0.5081 0.000 0.000 0.044 0.048 0.900 0.008
#> GSM99466     4  0.4604     0.0124 0.000 0.008 0.000 0.536 0.024 0.432
#> GSM99470     6  0.6041     0.4460 0.180 0.000 0.000 0.128 0.084 0.608
#> GSM99472     6  0.5052     0.1798 0.388 0.000 0.000 0.000 0.080 0.532
#> GSM99474     3  0.2680     0.7737 0.000 0.000 0.856 0.016 0.124 0.004
#> GSM99476     4  0.4395     0.4997 0.000 0.000 0.016 0.740 0.080 0.164
#> GSM99478     4  0.4624    -0.0465 0.000 0.008 0.000 0.516 0.024 0.452
#> GSM99480     1  0.2697     0.8481 0.864 0.000 0.000 0.000 0.044 0.092
#> GSM99482     1  0.2932     0.7923 0.820 0.000 0.000 0.000 0.016 0.164
#> GSM99484     6  0.4536     0.0592 0.000 0.024 0.000 0.476 0.004 0.496
#> GSM99486     4  0.3156     0.5998 0.000 0.180 0.000 0.800 0.000 0.020
#> GSM99488     2  0.0909     0.8806 0.000 0.968 0.000 0.000 0.012 0.020
#> GSM99490     2  0.3445     0.7268 0.000 0.796 0.000 0.156 0.000 0.048
#> GSM99492     1  0.3159     0.8172 0.836 0.000 0.000 0.004 0.052 0.108
#> GSM99494     2  0.0909     0.8806 0.000 0.968 0.000 0.000 0.012 0.020
#> GSM99524     1  0.1265     0.9255 0.948 0.000 0.000 0.000 0.008 0.044
#> GSM99526     5  0.4849     0.3940 0.000 0.000 0.000 0.188 0.664 0.148
#> GSM99528     6  0.5576     0.4130 0.000 0.000 0.004 0.244 0.184 0.568
#> GSM99530     5  0.4207     0.4481 0.000 0.000 0.244 0.024 0.712 0.020
#> GSM99532     5  0.4591     0.2862 0.000 0.000 0.372 0.020 0.592 0.016
#> GSM99534     6  0.5827     0.4465 0.000 0.148 0.000 0.220 0.036 0.596
#> GSM99536     1  0.1421     0.9338 0.944 0.000 0.000 0.000 0.028 0.028
#> GSM99538     4  0.3057     0.5769 0.000 0.008 0.004 0.844 0.024 0.120
#> GSM99540     5  0.4183     0.4521 0.296 0.000 0.000 0.000 0.668 0.036
#> GSM99542     2  0.3744     0.5958 0.000 0.724 0.000 0.004 0.016 0.256
#> GSM99544     4  0.3059     0.6037 0.000 0.040 0.000 0.856 0.020 0.084
#> GSM99546     5  0.5911     0.2085 0.000 0.000 0.000 0.252 0.468 0.280
#> GSM99548     2  0.0146     0.8876 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99550     5  0.3940     0.4268 0.008 0.000 0.000 0.016 0.704 0.272
#> GSM99552     3  0.3398     0.5826 0.000 0.000 0.740 0.008 0.000 0.252
#> GSM99554     4  0.3371     0.5239 0.000 0.292 0.000 0.708 0.000 0.000
#> GSM99556     2  0.0146     0.8876 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99558     4  0.4418     0.4778 0.000 0.000 0.076 0.728 0.012 0.184
#> GSM99560     4  0.3955     0.5391 0.000 0.092 0.000 0.784 0.012 0.112
#> GSM99562     3  0.1757     0.8611 0.000 0.000 0.928 0.008 0.012 0.052
#> GSM99564     4  0.2823     0.5986 0.000 0.204 0.000 0.796 0.000 0.000
#> GSM99572     2  0.0000     0.8878 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99576     5  0.5399     0.3500 0.116 0.000 0.000 0.008 0.576 0.300
#> GSM99578     6  0.5926     0.2777 0.000 0.260 0.000 0.276 0.000 0.464
#> GSM99580     3  0.0665     0.8877 0.000 0.000 0.980 0.004 0.008 0.008
#> GSM99582     6  0.6731     0.1440 0.000 0.000 0.364 0.064 0.164 0.408
#> GSM99584     4  0.3703     0.5514 0.000 0.008 0.000 0.796 0.064 0.132
#> GSM99586     5  0.5833     0.2500 0.380 0.000 0.000 0.004 0.452 0.164
#> GSM99588     2  0.4843     0.5148 0.000 0.652 0.000 0.232 0.000 0.116
#> GSM99590     2  0.0000     0.8878 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-kmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) cell.type(p) k
#> MAD:kmeans 80         3.14e-05      0.00018 2
#> MAD:kmeans 84         3.89e-04      0.00926 3
#> MAD:kmeans 68         2.71e-03      0.07714 4
#> MAD:kmeans 62         1.49e-06      0.00040 5
#> MAD:kmeans 59         3.81e-05      0.00500 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.974       0.989         0.5053 0.496   0.496
#> 3 3 1.000           0.979       0.990         0.3274 0.757   0.545
#> 4 4 0.839           0.823       0.914         0.0915 0.944   0.832
#> 5 5 0.764           0.638       0.827         0.0623 0.925   0.747
#> 6 6 0.731           0.587       0.761         0.0353 0.949   0.791

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
#> GSM99496     1  0.0000      0.982 1.000 0.000
#> GSM99502     1  0.0000      0.982 1.000 0.000
#> GSM99504     1  0.0000      0.982 1.000 0.000
#> GSM99506     1  0.0000      0.982 1.000 0.000
#> GSM99566     1  0.6712      0.787 0.824 0.176
#> GSM99574     1  0.0000      0.982 1.000 0.000
#> GSM99592     1  0.7745      0.710 0.772 0.228
#> GSM99594     1  0.0672      0.975 0.992 0.008
#> GSM99468     1  0.0000      0.982 1.000 0.000
#> GSM99498     1  0.0000      0.982 1.000 0.000
#> GSM99500     1  0.0000      0.982 1.000 0.000
#> GSM99508     1  0.0000      0.982 1.000 0.000
#> GSM99568     1  0.0000      0.982 1.000 0.000
#> GSM99596     1  0.0000      0.982 1.000 0.000
#> GSM99600     2  0.0000      0.996 0.000 1.000
#> GSM99458     1  0.0000      0.982 1.000 0.000
#> GSM99460     1  0.0000      0.982 1.000 0.000
#> GSM99510     2  0.0000      0.996 0.000 1.000
#> GSM99512     2  0.0000      0.996 0.000 1.000
#> GSM99514     1  0.0000      0.982 1.000 0.000
#> GSM99516     1  0.0000      0.982 1.000 0.000
#> GSM99518     1  0.0000      0.982 1.000 0.000
#> GSM99520     1  0.0000      0.982 1.000 0.000
#> GSM99522     1  0.0000      0.982 1.000 0.000
#> GSM99570     1  0.0000      0.982 1.000 0.000
#> GSM99598     1  0.0000      0.982 1.000 0.000
#> GSM99432     2  0.0000      0.996 0.000 1.000
#> GSM99434     2  0.3584      0.926 0.068 0.932
#> GSM99436     2  0.0000      0.996 0.000 1.000
#> GSM99438     2  0.0000      0.996 0.000 1.000
#> GSM99440     1  0.0000      0.982 1.000 0.000
#> GSM99442     2  0.0000      0.996 0.000 1.000
#> GSM99444     2  0.0000      0.996 0.000 1.000
#> GSM99446     2  0.0000      0.996 0.000 1.000
#> GSM99448     2  0.0000      0.996 0.000 1.000
#> GSM99450     1  0.0000      0.982 1.000 0.000
#> GSM99452     1  0.0000      0.982 1.000 0.000
#> GSM99454     1  0.0000      0.982 1.000 0.000
#> GSM99456     1  0.0000      0.982 1.000 0.000
#> GSM99462     2  0.0000      0.996 0.000 1.000
#> GSM99464     1  0.0000      0.982 1.000 0.000
#> GSM99466     2  0.0000      0.996 0.000 1.000
#> GSM99470     1  0.9608      0.381 0.616 0.384
#> GSM99472     1  0.0000      0.982 1.000 0.000
#> GSM99474     1  0.0000      0.982 1.000 0.000
#> GSM99476     2  0.0000      0.996 0.000 1.000
#> GSM99478     2  0.0000      0.996 0.000 1.000
#> GSM99480     1  0.0000      0.982 1.000 0.000
#> GSM99482     1  0.0000      0.982 1.000 0.000
#> GSM99484     2  0.0000      0.996 0.000 1.000
#> GSM99486     2  0.0000      0.996 0.000 1.000
#> GSM99488     2  0.0000      0.996 0.000 1.000
#> GSM99490     2  0.0000      0.996 0.000 1.000
#> GSM99492     1  0.0000      0.982 1.000 0.000
#> GSM99494     2  0.0000      0.996 0.000 1.000
#> GSM99524     1  0.0000      0.982 1.000 0.000
#> GSM99526     2  0.0000      0.996 0.000 1.000
#> GSM99528     2  0.0000      0.996 0.000 1.000
#> GSM99530     1  0.0000      0.982 1.000 0.000
#> GSM99532     1  0.0000      0.982 1.000 0.000
#> GSM99534     2  0.0000      0.996 0.000 1.000
#> GSM99536     1  0.0000      0.982 1.000 0.000
#> GSM99538     2  0.0000      0.996 0.000 1.000
#> GSM99540     1  0.0000      0.982 1.000 0.000
#> GSM99542     2  0.0000      0.996 0.000 1.000
#> GSM99544     2  0.0000      0.996 0.000 1.000
#> GSM99546     2  0.0000      0.996 0.000 1.000
#> GSM99548     2  0.0000      0.996 0.000 1.000
#> GSM99550     1  0.0000      0.982 1.000 0.000
#> GSM99552     2  0.0000      0.996 0.000 1.000
#> GSM99554     2  0.0000      0.996 0.000 1.000
#> GSM99556     2  0.0000      0.996 0.000 1.000
#> GSM99558     2  0.0000      0.996 0.000 1.000
#> GSM99560     2  0.0000      0.996 0.000 1.000
#> GSM99562     1  0.0000      0.982 1.000 0.000
#> GSM99564     2  0.0000      0.996 0.000 1.000
#> GSM99572     2  0.0000      0.996 0.000 1.000
#> GSM99576     1  0.0000      0.982 1.000 0.000
#> GSM99578     2  0.0000      0.996 0.000 1.000
#> GSM99580     2  0.3584      0.926 0.068 0.932
#> GSM99582     1  0.0000      0.982 1.000 0.000
#> GSM99584     2  0.0000      0.996 0.000 1.000
#> GSM99586     1  0.0000      0.982 1.000 0.000
#> GSM99588     2  0.0000      0.996 0.000 1.000
#> GSM99590     2  0.0000      0.996 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
#> GSM99496     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99506     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99566     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99508     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99568     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99596     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99600     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99514     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99520     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99522     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99570     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99432     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99434     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99448     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99450     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99464     3  0.4796      0.719 0.220 0.000 0.780
#> GSM99466     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99470     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99472     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99474     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99476     3  0.2959      0.882 0.000 0.100 0.900
#> GSM99478     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99480     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99484     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99486     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99488     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99526     3  0.5480      0.650 0.004 0.264 0.732
#> GSM99528     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99530     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99532     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99534     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99536     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99538     2  0.0237      0.990 0.000 0.996 0.004
#> GSM99540     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99542     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99544     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99546     2  0.0237      0.990 0.000 0.996 0.004
#> GSM99548     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99550     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99552     3  0.0237      0.972 0.000 0.004 0.996
#> GSM99554     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99558     2  0.4291      0.779 0.000 0.820 0.180
#> GSM99560     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99562     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99564     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99572     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99576     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99578     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99580     3  0.0000      0.975 0.000 0.000 1.000
#> GSM99582     1  0.1643      0.953 0.956 0.000 0.044
#> GSM99584     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99586     1  0.0000      0.998 1.000 0.000 0.000
#> GSM99588     2  0.0000      0.994 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.994 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0469     0.9305 0.988 0.000 0.012 0.000
#> GSM99506     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99592     3  0.1211     0.9010 0.000 0.000 0.960 0.040
#> GSM99594     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99600     2  0.0592     0.9023 0.000 0.984 0.000 0.016
#> GSM99458     1  0.2530     0.8673 0.888 0.000 0.000 0.112
#> GSM99460     1  0.4193     0.6950 0.732 0.000 0.000 0.268
#> GSM99510     4  0.4477     0.6185 0.000 0.000 0.312 0.688
#> GSM99512     3  0.4304     0.4672 0.000 0.000 0.716 0.284
#> GSM99514     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99522     3  0.1004     0.9033 0.024 0.000 0.972 0.004
#> GSM99570     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99432     2  0.4331     0.6717 0.000 0.712 0.000 0.288
#> GSM99434     4  0.3688     0.6996 0.000 0.000 0.208 0.792
#> GSM99436     2  0.2408     0.8619 0.000 0.896 0.000 0.104
#> GSM99438     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99444     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99446     2  0.2081     0.8734 0.000 0.916 0.000 0.084
#> GSM99448     4  0.5147     0.3141 0.000 0.004 0.460 0.536
#> GSM99450     4  0.4679     0.5182 0.000 0.000 0.352 0.648
#> GSM99452     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99456     1  0.2469     0.8737 0.892 0.000 0.000 0.108
#> GSM99462     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99464     4  0.4487     0.6323 0.100 0.000 0.092 0.808
#> GSM99466     2  0.4008     0.7393 0.000 0.756 0.000 0.244
#> GSM99470     1  0.0188     0.9361 0.996 0.000 0.000 0.004
#> GSM99472     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99474     3  0.0817     0.9153 0.000 0.000 0.976 0.024
#> GSM99476     4  0.3856     0.7182 0.000 0.032 0.136 0.832
#> GSM99478     2  0.2868     0.8341 0.000 0.864 0.000 0.136
#> GSM99480     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99484     2  0.0469     0.9012 0.000 0.988 0.000 0.012
#> GSM99486     2  0.2760     0.8453 0.000 0.872 0.000 0.128
#> GSM99488     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99490     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99492     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99494     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99526     4  0.0469     0.7111 0.000 0.000 0.012 0.988
#> GSM99528     2  0.2647     0.8392 0.000 0.880 0.000 0.120
#> GSM99530     3  0.4500     0.5183 0.000 0.000 0.684 0.316
#> GSM99532     3  0.4040     0.6389 0.000 0.000 0.752 0.248
#> GSM99534     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99536     1  0.0000     0.9382 1.000 0.000 0.000 0.000
#> GSM99538     2  0.5161     0.4488 0.000 0.592 0.008 0.400
#> GSM99540     1  0.1716     0.9053 0.936 0.000 0.000 0.064
#> GSM99542     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99544     2  0.4916     0.4048 0.000 0.576 0.000 0.424
#> GSM99546     4  0.0817     0.7103 0.000 0.024 0.000 0.976
#> GSM99548     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99550     1  0.4888     0.4447 0.588 0.000 0.000 0.412
#> GSM99552     3  0.0804     0.9124 0.000 0.008 0.980 0.012
#> GSM99554     2  0.0336     0.9046 0.000 0.992 0.000 0.008
#> GSM99556     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99558     2  0.7315     0.3056 0.000 0.532 0.252 0.216
#> GSM99560     2  0.1867     0.8821 0.000 0.928 0.000 0.072
#> GSM99562     3  0.0188     0.9265 0.000 0.000 0.996 0.004
#> GSM99564     2  0.2704     0.8482 0.000 0.876 0.000 0.124
#> GSM99572     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99576     1  0.2081     0.8929 0.916 0.000 0.000 0.084
#> GSM99578     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99580     3  0.0000     0.9286 0.000 0.000 1.000 0.000
#> GSM99582     1  0.6137     0.0879 0.504 0.000 0.448 0.048
#> GSM99584     4  0.4585     0.2938 0.000 0.332 0.000 0.668
#> GSM99586     1  0.2149     0.8887 0.912 0.000 0.000 0.088
#> GSM99588     2  0.0000     0.9066 0.000 1.000 0.000 0.000
#> GSM99590     2  0.0000     0.9066 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0000    0.86038 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0290    0.88829 0.992 0.000 0.000 0.000 0.008
#> GSM99504     1  0.0912    0.88613 0.972 0.000 0.012 0.000 0.016
#> GSM99506     3  0.0000    0.86038 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0162    0.86014 0.000 0.000 0.996 0.004 0.000
#> GSM99574     1  0.0404    0.88862 0.988 0.000 0.000 0.000 0.012
#> GSM99592     3  0.2378    0.82415 0.000 0.000 0.904 0.048 0.048
#> GSM99594     3  0.0912    0.85814 0.000 0.000 0.972 0.012 0.016
#> GSM99468     1  0.0609    0.88874 0.980 0.000 0.000 0.000 0.020
#> GSM99498     1  0.0404    0.88862 0.988 0.000 0.000 0.000 0.012
#> GSM99500     1  0.0510    0.88874 0.984 0.000 0.000 0.000 0.016
#> GSM99508     3  0.0162    0.86063 0.000 0.000 0.996 0.000 0.004
#> GSM99568     3  0.0404    0.86057 0.000 0.000 0.988 0.000 0.012
#> GSM99596     3  0.0000    0.86038 0.000 0.000 1.000 0.000 0.000
#> GSM99600     2  0.2516    0.69408 0.000 0.860 0.000 0.140 0.000
#> GSM99458     1  0.3551    0.72436 0.772 0.000 0.000 0.008 0.220
#> GSM99460     5  0.4708   -0.06650 0.436 0.000 0.000 0.016 0.548
#> GSM99510     3  0.6818   -0.26025 0.000 0.000 0.352 0.336 0.312
#> GSM99512     3  0.5263    0.53837 0.000 0.000 0.680 0.144 0.176
#> GSM99514     3  0.0162    0.86037 0.000 0.000 0.996 0.004 0.000
#> GSM99516     1  0.0404    0.88791 0.988 0.000 0.000 0.000 0.012
#> GSM99518     1  0.0963    0.88582 0.964 0.000 0.000 0.000 0.036
#> GSM99520     3  0.0771    0.85955 0.000 0.000 0.976 0.004 0.020
#> GSM99522     3  0.2308    0.82273 0.036 0.000 0.912 0.004 0.048
#> GSM99570     1  0.0404    0.88788 0.988 0.000 0.000 0.000 0.012
#> GSM99598     1  0.0290    0.88829 0.992 0.000 0.000 0.000 0.008
#> GSM99432     4  0.4627    0.29288 0.000 0.444 0.000 0.544 0.012
#> GSM99434     5  0.6536    0.31310 0.000 0.000 0.220 0.312 0.468
#> GSM99436     2  0.4101    0.25627 0.000 0.628 0.000 0.372 0.000
#> GSM99438     2  0.0290    0.78494 0.000 0.992 0.000 0.008 0.000
#> GSM99440     1  0.0510    0.88846 0.984 0.000 0.000 0.000 0.016
#> GSM99442     2  0.1270    0.76711 0.000 0.948 0.000 0.052 0.000
#> GSM99444     2  0.0290    0.78494 0.000 0.992 0.000 0.008 0.000
#> GSM99446     2  0.3999    0.33290 0.000 0.656 0.000 0.344 0.000
#> GSM99448     4  0.5960    0.06207 0.000 0.004 0.328 0.556 0.112
#> GSM99450     5  0.6107    0.17251 0.000 0.000 0.372 0.132 0.496
#> GSM99452     1  0.0671    0.88676 0.980 0.000 0.000 0.004 0.016
#> GSM99454     1  0.0000    0.88855 1.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.4135    0.57934 0.656 0.000 0.000 0.004 0.340
#> GSM99462     2  0.0162    0.78513 0.000 0.996 0.000 0.004 0.000
#> GSM99464     5  0.3164    0.50180 0.020 0.000 0.028 0.084 0.868
#> GSM99466     4  0.4428    0.49164 0.000 0.268 0.000 0.700 0.032
#> GSM99470     1  0.4153    0.75966 0.808 0.024 0.000 0.112 0.056
#> GSM99472     1  0.2153    0.85795 0.916 0.000 0.000 0.044 0.040
#> GSM99474     3  0.2850    0.79803 0.000 0.000 0.872 0.036 0.092
#> GSM99476     4  0.3876    0.31339 0.000 0.012 0.024 0.796 0.168
#> GSM99478     2  0.4747    0.01623 0.000 0.500 0.000 0.484 0.016
#> GSM99480     1  0.1341    0.87822 0.944 0.000 0.000 0.000 0.056
#> GSM99482     1  0.1918    0.86567 0.928 0.000 0.000 0.036 0.036
#> GSM99484     2  0.3530    0.60960 0.000 0.784 0.000 0.204 0.012
#> GSM99486     2  0.4283   -0.04948 0.000 0.544 0.000 0.456 0.000
#> GSM99488     2  0.0324    0.78418 0.000 0.992 0.000 0.004 0.004
#> GSM99490     2  0.0566    0.78420 0.000 0.984 0.000 0.012 0.004
#> GSM99492     1  0.2011    0.86008 0.908 0.000 0.000 0.004 0.088
#> GSM99494     2  0.0162    0.78444 0.000 0.996 0.000 0.000 0.004
#> GSM99524     1  0.0693    0.88546 0.980 0.000 0.000 0.008 0.012
#> GSM99526     5  0.3928    0.39849 0.000 0.004 0.000 0.296 0.700
#> GSM99528     2  0.5959    0.25996 0.000 0.576 0.004 0.296 0.124
#> GSM99530     5  0.4776    0.19520 0.004 0.000 0.364 0.020 0.612
#> GSM99532     3  0.5218    0.16607 0.004 0.000 0.536 0.036 0.424
#> GSM99534     2  0.1965    0.74462 0.000 0.924 0.000 0.052 0.024
#> GSM99536     1  0.1608    0.87310 0.928 0.000 0.000 0.000 0.072
#> GSM99538     4  0.5234    0.55377 0.000 0.332 0.004 0.612 0.052
#> GSM99540     1  0.3715    0.69705 0.736 0.000 0.000 0.004 0.260
#> GSM99542     2  0.2171    0.73467 0.000 0.912 0.000 0.064 0.024
#> GSM99544     4  0.4963    0.52293 0.000 0.352 0.000 0.608 0.040
#> GSM99546     5  0.4390    0.24389 0.000 0.004 0.000 0.428 0.568
#> GSM99548     2  0.0451    0.78298 0.000 0.988 0.000 0.008 0.004
#> GSM99550     5  0.4169    0.39928 0.240 0.000 0.000 0.028 0.732
#> GSM99552     3  0.3280    0.71612 0.000 0.000 0.812 0.176 0.012
#> GSM99554     2  0.3039    0.63532 0.000 0.808 0.000 0.192 0.000
#> GSM99556     2  0.0451    0.78298 0.000 0.988 0.000 0.008 0.004
#> GSM99558     4  0.6138    0.48763 0.000 0.188 0.208 0.596 0.008
#> GSM99560     2  0.4104    0.56561 0.000 0.748 0.000 0.220 0.032
#> GSM99562     3  0.1522    0.84792 0.000 0.000 0.944 0.012 0.044
#> GSM99564     2  0.4291   -0.08425 0.000 0.536 0.000 0.464 0.000
#> GSM99572     2  0.0566    0.78451 0.000 0.984 0.000 0.012 0.004
#> GSM99576     1  0.4573    0.67656 0.700 0.000 0.000 0.044 0.256
#> GSM99578     2  0.1571    0.75434 0.000 0.936 0.000 0.060 0.004
#> GSM99580     3  0.1638    0.83918 0.000 0.000 0.932 0.064 0.004
#> GSM99582     1  0.7943   -0.00553 0.428 0.000 0.284 0.152 0.136
#> GSM99584     4  0.5810    0.56683 0.000 0.244 0.000 0.604 0.152
#> GSM99586     1  0.3783    0.71264 0.740 0.000 0.000 0.008 0.252
#> GSM99588     2  0.0609    0.78332 0.000 0.980 0.000 0.020 0.000
#> GSM99590     2  0.0290    0.78494 0.000 0.992 0.000 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0146     0.8532 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99502     1  0.0603     0.8519 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM99504     1  0.1426     0.8402 0.948 0.000 0.028 0.000 0.008 0.016
#> GSM99506     3  0.0653     0.8544 0.000 0.000 0.980 0.004 0.004 0.012
#> GSM99566     3  0.0405     0.8547 0.000 0.000 0.988 0.008 0.000 0.004
#> GSM99574     1  0.0508     0.8520 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM99592     3  0.3320     0.8079 0.000 0.000 0.844 0.060 0.028 0.068
#> GSM99594     3  0.1332     0.8534 0.000 0.000 0.952 0.008 0.012 0.028
#> GSM99468     1  0.1245     0.8512 0.952 0.000 0.000 0.000 0.032 0.016
#> GSM99498     1  0.0820     0.8516 0.972 0.000 0.000 0.000 0.016 0.012
#> GSM99500     1  0.0725     0.8516 0.976 0.000 0.000 0.000 0.012 0.012
#> GSM99508     3  0.0508     0.8548 0.000 0.000 0.984 0.004 0.000 0.012
#> GSM99568     3  0.1802     0.8479 0.000 0.000 0.932 0.020 0.024 0.024
#> GSM99596     3  0.0547     0.8541 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM99600     2  0.2838     0.6778 0.000 0.808 0.000 0.188 0.000 0.004
#> GSM99458     1  0.5018     0.4736 0.604 0.000 0.000 0.028 0.328 0.040
#> GSM99460     5  0.4624     0.1604 0.340 0.000 0.000 0.032 0.616 0.012
#> GSM99510     4  0.7472    -0.2357 0.000 0.000 0.256 0.372 0.212 0.160
#> GSM99512     3  0.6270     0.4529 0.000 0.000 0.580 0.196 0.096 0.128
#> GSM99514     3  0.0000     0.8529 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99516     1  0.0000     0.8515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.1918     0.8352 0.904 0.000 0.000 0.000 0.088 0.008
#> GSM99520     3  0.1657     0.8459 0.000 0.000 0.936 0.012 0.012 0.040
#> GSM99522     3  0.4370     0.7587 0.044 0.000 0.796 0.036 0.068 0.056
#> GSM99570     1  0.0363     0.8515 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM99598     1  0.0000     0.8515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.4597     0.3156 0.000 0.376 0.000 0.584 0.004 0.036
#> GSM99434     4  0.7177    -0.3158 0.000 0.000 0.144 0.408 0.304 0.144
#> GSM99436     2  0.4242     0.0501 0.000 0.536 0.000 0.448 0.000 0.016
#> GSM99438     2  0.0363     0.8130 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM99440     1  0.0717     0.8530 0.976 0.000 0.000 0.000 0.016 0.008
#> GSM99442     2  0.1958     0.7690 0.000 0.896 0.000 0.100 0.000 0.004
#> GSM99444     2  0.0458     0.8128 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM99446     2  0.3807     0.3283 0.000 0.628 0.000 0.368 0.000 0.004
#> GSM99448     4  0.5752     0.1097 0.000 0.008 0.304 0.576 0.032 0.080
#> GSM99450     5  0.7299     0.2765 0.000 0.000 0.264 0.208 0.400 0.128
#> GSM99452     1  0.1572     0.8461 0.936 0.000 0.000 0.000 0.028 0.036
#> GSM99454     1  0.0458     0.8532 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM99456     1  0.4873     0.3365 0.508 0.000 0.000 0.004 0.440 0.048
#> GSM99462     2  0.0363     0.8128 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM99464     5  0.2844     0.4910 0.004 0.000 0.004 0.092 0.864 0.036
#> GSM99466     6  0.5806     0.1296 0.000 0.156 0.000 0.408 0.004 0.432
#> GSM99470     1  0.4954     0.4634 0.580 0.012 0.000 0.004 0.040 0.364
#> GSM99472     1  0.3455     0.7379 0.784 0.000 0.000 0.000 0.036 0.180
#> GSM99474     3  0.4207     0.7439 0.000 0.000 0.780 0.040 0.104 0.076
#> GSM99476     4  0.4327     0.1709 0.000 0.016 0.000 0.728 0.052 0.204
#> GSM99478     6  0.5922     0.3603 0.000 0.340 0.000 0.220 0.000 0.440
#> GSM99480     1  0.1838     0.8384 0.916 0.000 0.000 0.000 0.068 0.016
#> GSM99482     1  0.2704     0.7855 0.844 0.000 0.000 0.000 0.016 0.140
#> GSM99484     2  0.4687     0.2970 0.000 0.632 0.000 0.072 0.000 0.296
#> GSM99486     4  0.4169     0.1139 0.000 0.456 0.000 0.532 0.000 0.012
#> GSM99488     2  0.0146     0.8110 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99490     2  0.0547     0.8088 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM99492     1  0.3317     0.7755 0.808 0.000 0.000 0.004 0.156 0.032
#> GSM99494     2  0.0146     0.8110 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99524     1  0.1152     0.8419 0.952 0.000 0.000 0.000 0.004 0.044
#> GSM99526     5  0.5357     0.3890 0.000 0.000 0.000 0.340 0.536 0.124
#> GSM99528     6  0.5933     0.3966 0.000 0.328 0.004 0.088 0.040 0.540
#> GSM99530     5  0.5803     0.2460 0.000 0.000 0.292 0.040 0.568 0.100
#> GSM99532     3  0.6607     0.1230 0.016 0.000 0.456 0.056 0.372 0.100
#> GSM99534     2  0.3582     0.6108 0.000 0.776 0.000 0.024 0.008 0.192
#> GSM99536     1  0.1913     0.8375 0.908 0.000 0.000 0.000 0.080 0.012
#> GSM99538     4  0.4892     0.3145 0.000 0.280 0.000 0.632 0.004 0.084
#> GSM99540     1  0.4370     0.6275 0.672 0.000 0.000 0.008 0.284 0.036
#> GSM99542     2  0.2278     0.7062 0.000 0.868 0.000 0.000 0.004 0.128
#> GSM99544     4  0.3608     0.3865 0.000 0.272 0.000 0.716 0.000 0.012
#> GSM99546     5  0.5783     0.2810 0.000 0.004 0.000 0.408 0.436 0.152
#> GSM99548     2  0.0260     0.8110 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM99550     5  0.4895     0.3784 0.140 0.000 0.000 0.032 0.712 0.116
#> GSM99552     3  0.4617     0.4961 0.000 0.000 0.644 0.056 0.004 0.296
#> GSM99554     2  0.3468     0.5601 0.000 0.728 0.000 0.264 0.000 0.008
#> GSM99556     2  0.0458     0.8058 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM99558     4  0.6856    -0.0292 0.000 0.156 0.104 0.508 0.004 0.228
#> GSM99560     2  0.4879     0.3690 0.000 0.620 0.000 0.312 0.012 0.056
#> GSM99562     3  0.2670     0.8266 0.000 0.000 0.884 0.044 0.020 0.052
#> GSM99564     4  0.4246     0.1276 0.000 0.452 0.000 0.532 0.000 0.016
#> GSM99572     2  0.0806     0.8110 0.000 0.972 0.000 0.020 0.000 0.008
#> GSM99576     1  0.5410     0.5494 0.588 0.000 0.000 0.008 0.276 0.128
#> GSM99578     2  0.2178     0.7153 0.000 0.868 0.000 0.000 0.000 0.132
#> GSM99580     3  0.2066     0.8360 0.000 0.000 0.908 0.040 0.000 0.052
#> GSM99582     6  0.8152    -0.0740 0.256 0.000 0.216 0.068 0.100 0.360
#> GSM99584     4  0.4585     0.3505 0.000 0.164 0.000 0.736 0.048 0.052
#> GSM99586     1  0.4628     0.5506 0.608 0.000 0.000 0.004 0.344 0.044
#> GSM99588     2  0.1575     0.7959 0.000 0.936 0.000 0.032 0.000 0.032
#> GSM99590     2  0.0458     0.8129 0.000 0.984 0.000 0.016 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-skmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-skmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>              n disease.state(p) cell.type(p) k
#> MAD:skmeans 84         2.71e-05     0.000147 2
#> MAD:skmeans 85         8.48e-05     0.002667 3
#> MAD:skmeans 77         8.20e-05     0.002607 4
#> MAD:skmeans 64         3.35e-04     0.033821 5
#> MAD:skmeans 53         2.09e-04     0.005393 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-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.547           0.756       0.900         0.4834 0.500   0.500
#> 3 3 0.660           0.799       0.889         0.3627 0.722   0.497
#> 4 4 0.888           0.880       0.944         0.1443 0.826   0.539
#> 5 5 0.824           0.724       0.864         0.0536 0.944   0.782
#> 6 6 0.888           0.842       0.913         0.0414 0.920   0.657

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
#> GSM99496     1  0.9686      0.433 0.604 0.396
#> GSM99502     1  0.0000      0.859 1.000 0.000
#> GSM99504     1  0.0000      0.859 1.000 0.000
#> GSM99506     1  0.9754      0.405 0.592 0.408
#> GSM99566     1  0.9850      0.352 0.572 0.428
#> GSM99574     1  0.0000      0.859 1.000 0.000
#> GSM99592     2  0.7674      0.656 0.224 0.776
#> GSM99594     2  0.9522      0.346 0.372 0.628
#> GSM99468     1  0.0000      0.859 1.000 0.000
#> GSM99498     1  0.0000      0.859 1.000 0.000
#> GSM99500     1  0.0000      0.859 1.000 0.000
#> GSM99508     1  0.7815      0.690 0.768 0.232
#> GSM99568     1  0.9635      0.438 0.612 0.388
#> GSM99596     1  0.7950      0.678 0.760 0.240
#> GSM99600     2  0.0000      0.894 0.000 1.000
#> GSM99458     1  0.0000      0.859 1.000 0.000
#> GSM99460     1  0.0000      0.859 1.000 0.000
#> GSM99510     2  0.0000      0.894 0.000 1.000
#> GSM99512     2  0.1633      0.879 0.024 0.976
#> GSM99514     1  0.9686      0.433 0.604 0.396
#> GSM99516     1  0.0000      0.859 1.000 0.000
#> GSM99518     1  0.0000      0.859 1.000 0.000
#> GSM99520     2  0.9491      0.362 0.368 0.632
#> GSM99522     1  0.0938      0.853 0.988 0.012
#> GSM99570     1  0.0000      0.859 1.000 0.000
#> GSM99598     1  0.0000      0.859 1.000 0.000
#> GSM99432     2  0.0000      0.894 0.000 1.000
#> GSM99434     2  0.0938      0.887 0.012 0.988
#> GSM99436     2  0.0000      0.894 0.000 1.000
#> GSM99438     2  0.0000      0.894 0.000 1.000
#> GSM99440     1  0.0000      0.859 1.000 0.000
#> GSM99442     2  0.0000      0.894 0.000 1.000
#> GSM99444     2  0.0000      0.894 0.000 1.000
#> GSM99446     2  0.0000      0.894 0.000 1.000
#> GSM99448     2  0.0000      0.894 0.000 1.000
#> GSM99450     2  0.9881      0.181 0.436 0.564
#> GSM99452     1  0.0000      0.859 1.000 0.000
#> GSM99454     1  0.0000      0.859 1.000 0.000
#> GSM99456     1  0.0000      0.859 1.000 0.000
#> GSM99462     2  0.0000      0.894 0.000 1.000
#> GSM99464     1  0.6531      0.752 0.832 0.168
#> GSM99466     2  0.0000      0.894 0.000 1.000
#> GSM99470     2  0.9983      0.108 0.476 0.524
#> GSM99472     1  0.4939      0.780 0.892 0.108
#> GSM99474     1  0.9993      0.115 0.516 0.484
#> GSM99476     2  0.0000      0.894 0.000 1.000
#> GSM99478     2  0.0000      0.894 0.000 1.000
#> GSM99480     1  0.0000      0.859 1.000 0.000
#> GSM99482     1  0.0000      0.859 1.000 0.000
#> GSM99484     2  0.0000      0.894 0.000 1.000
#> GSM99486     2  0.0000      0.894 0.000 1.000
#> GSM99488     2  0.0000      0.894 0.000 1.000
#> GSM99490     2  0.0000      0.894 0.000 1.000
#> GSM99492     1  0.0000      0.859 1.000 0.000
#> GSM99494     2  0.0000      0.894 0.000 1.000
#> GSM99524     1  0.0000      0.859 1.000 0.000
#> GSM99526     2  0.2236      0.869 0.036 0.964
#> GSM99528     2  0.6438      0.739 0.164 0.836
#> GSM99530     1  0.9732      0.406 0.596 0.404
#> GSM99532     1  0.7745      0.696 0.772 0.228
#> GSM99534     2  0.5519      0.777 0.128 0.872
#> GSM99536     1  0.0000      0.859 1.000 0.000
#> GSM99538     2  0.0000      0.894 0.000 1.000
#> GSM99540     1  0.0000      0.859 1.000 0.000
#> GSM99542     2  0.8555      0.588 0.280 0.720
#> GSM99544     2  0.0000      0.894 0.000 1.000
#> GSM99546     2  0.1843      0.875 0.028 0.972
#> GSM99548     2  0.0000      0.894 0.000 1.000
#> GSM99550     2  0.9933      0.153 0.452 0.548
#> GSM99552     2  0.7950      0.632 0.240 0.760
#> GSM99554     2  0.0000      0.894 0.000 1.000
#> GSM99556     2  0.0000      0.894 0.000 1.000
#> GSM99558     2  0.0000      0.894 0.000 1.000
#> GSM99560     2  0.0000      0.894 0.000 1.000
#> GSM99562     1  0.9661      0.441 0.608 0.392
#> GSM99564     2  0.0000      0.894 0.000 1.000
#> GSM99572     2  0.0000      0.894 0.000 1.000
#> GSM99576     1  0.6887      0.738 0.816 0.184
#> GSM99578     2  0.0000      0.894 0.000 1.000
#> GSM99580     2  0.9170      0.447 0.332 0.668
#> GSM99582     2  0.9970      0.070 0.468 0.532
#> GSM99584     2  0.0000      0.894 0.000 1.000
#> GSM99586     1  0.0000      0.859 1.000 0.000
#> GSM99588     2  0.0000      0.894 0.000 1.000
#> GSM99590     2  0.0000      0.894 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
#> GSM99496     3  0.2165     0.8803 0.064 0.000 0.936
#> GSM99502     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99504     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99506     3  0.2066     0.8816 0.060 0.000 0.940
#> GSM99566     3  0.1860     0.8824 0.052 0.000 0.948
#> GSM99574     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99592     3  0.0000     0.8709 0.000 0.000 1.000
#> GSM99594     3  0.0237     0.8730 0.004 0.000 0.996
#> GSM99468     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99498     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99500     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99508     3  0.3686     0.8367 0.140 0.000 0.860
#> GSM99568     3  0.2261     0.8778 0.068 0.000 0.932
#> GSM99596     3  0.4121     0.8058 0.168 0.000 0.832
#> GSM99600     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99458     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99460     1  0.4750     0.6875 0.784 0.000 0.216
#> GSM99510     3  0.1163     0.8571 0.000 0.028 0.972
#> GSM99512     3  0.0000     0.8709 0.000 0.000 1.000
#> GSM99514     3  0.2165     0.8803 0.064 0.000 0.936
#> GSM99516     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99518     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99520     3  0.1031     0.8797 0.024 0.000 0.976
#> GSM99522     3  0.5650     0.5503 0.312 0.000 0.688
#> GSM99570     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99432     2  0.3482     0.7963 0.000 0.872 0.128
#> GSM99434     3  0.0592     0.8664 0.000 0.012 0.988
#> GSM99436     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99438     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99440     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99442     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99444     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99446     2  0.3551     0.7915 0.000 0.868 0.132
#> GSM99448     3  0.3192     0.7546 0.000 0.112 0.888
#> GSM99450     3  0.1860     0.8781 0.052 0.000 0.948
#> GSM99452     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99456     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99462     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99464     3  0.4346     0.7857 0.184 0.000 0.816
#> GSM99466     2  0.6235     0.5443 0.000 0.564 0.436
#> GSM99470     1  0.7926     0.4789 0.656 0.216 0.128
#> GSM99472     1  0.1015     0.9261 0.980 0.008 0.012
#> GSM99474     3  0.3293     0.8645 0.088 0.012 0.900
#> GSM99476     2  0.6126     0.6136 0.000 0.600 0.400
#> GSM99478     2  0.6079     0.6292 0.000 0.612 0.388
#> GSM99480     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99482     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99484     2  0.5905     0.6761 0.000 0.648 0.352
#> GSM99486     2  0.5529     0.7276 0.000 0.704 0.296
#> GSM99488     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99490     2  0.1529     0.8068 0.000 0.960 0.040
#> GSM99492     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99494     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99524     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99526     2  0.6950     0.5695 0.020 0.572 0.408
#> GSM99528     3  0.7190     0.0579 0.036 0.356 0.608
#> GSM99530     3  0.1643     0.8842 0.044 0.000 0.956
#> GSM99532     3  0.3482     0.8477 0.128 0.000 0.872
#> GSM99534     2  0.4087     0.7894 0.052 0.880 0.068
#> GSM99536     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99538     2  0.6140     0.6045 0.000 0.596 0.404
#> GSM99540     1  0.5678     0.5043 0.684 0.000 0.316
#> GSM99542     2  0.1525     0.7930 0.032 0.964 0.004
#> GSM99544     2  0.5650     0.7152 0.000 0.688 0.312
#> GSM99546     2  0.7013     0.6384 0.028 0.608 0.364
#> GSM99548     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99550     2  0.9520     0.3125 0.196 0.452 0.352
#> GSM99552     3  0.0592     0.8664 0.000 0.012 0.988
#> GSM99554     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99556     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99558     3  0.4796     0.5542 0.000 0.220 0.780
#> GSM99560     2  0.5291     0.7426 0.000 0.732 0.268
#> GSM99562     3  0.2066     0.8815 0.060 0.000 0.940
#> GSM99564     2  0.3038     0.7979 0.000 0.896 0.104
#> GSM99572     2  0.0000     0.8080 0.000 1.000 0.000
#> GSM99576     1  0.6773     0.4094 0.636 0.024 0.340
#> GSM99578     2  0.5529     0.7276 0.000 0.704 0.296
#> GSM99580     3  0.0000     0.8709 0.000 0.000 1.000
#> GSM99582     3  0.4345     0.8295 0.136 0.016 0.848
#> GSM99584     2  0.5905     0.6760 0.000 0.648 0.352
#> GSM99586     1  0.0000     0.9436 1.000 0.000 0.000
#> GSM99588     2  0.5529     0.7276 0.000 0.704 0.296
#> GSM99590     2  0.0000     0.8080 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99592     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99594     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99600     2  0.0000      0.954 0.000 1.000 0.000 0.000
#> GSM99458     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99460     1  0.1975      0.918 0.936 0.000 0.016 0.048
#> GSM99510     3  0.4072      0.628 0.000 0.000 0.748 0.252
#> GSM99512     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99514     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99570     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99432     4  0.4072      0.715 0.000 0.252 0.000 0.748
#> GSM99434     4  0.2921      0.777 0.000 0.000 0.140 0.860
#> GSM99436     2  0.0000      0.954 0.000 1.000 0.000 0.000
#> GSM99438     2  0.0000      0.954 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0000      0.954 0.000 1.000 0.000 0.000
#> GSM99444     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM99446     2  0.0469      0.945 0.000 0.988 0.000 0.012
#> GSM99448     4  0.4916      0.295 0.000 0.000 0.424 0.576
#> GSM99450     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99452     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99456     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99462     2  0.0000      0.954 0.000 1.000 0.000 0.000
#> GSM99464     3  0.0336      0.976 0.008 0.000 0.992 0.000
#> GSM99466     4  0.0000      0.855 0.000 0.000 0.000 1.000
#> GSM99470     4  0.2469      0.781 0.108 0.000 0.000 0.892
#> GSM99472     1  0.2149      0.887 0.912 0.000 0.000 0.088
#> GSM99474     4  0.5402      0.145 0.012 0.000 0.472 0.516
#> GSM99476     4  0.0188      0.855 0.000 0.004 0.000 0.996
#> GSM99478     4  0.0000      0.855 0.000 0.000 0.000 1.000
#> GSM99480     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99484     4  0.0000      0.855 0.000 0.000 0.000 1.000
#> GSM99486     4  0.4304      0.682 0.000 0.284 0.000 0.716
#> GSM99488     2  0.2216      0.876 0.000 0.908 0.000 0.092
#> GSM99490     4  0.4406      0.567 0.000 0.300 0.000 0.700
#> GSM99492     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99494     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM99524     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99526     4  0.4252      0.714 0.000 0.252 0.004 0.744
#> GSM99528     4  0.0000      0.855 0.000 0.000 0.000 1.000
#> GSM99530     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99532     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99534     4  0.3356      0.771 0.000 0.176 0.000 0.824
#> GSM99536     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99538     4  0.0188      0.854 0.000 0.004 0.000 0.996
#> GSM99540     1  0.4961      0.191 0.552 0.000 0.448 0.000
#> GSM99542     2  0.4304      0.628 0.000 0.716 0.000 0.284
#> GSM99544     4  0.4164      0.704 0.000 0.264 0.000 0.736
#> GSM99546     4  0.0188      0.855 0.000 0.004 0.000 0.996
#> GSM99548     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM99550     4  0.0188      0.854 0.004 0.000 0.000 0.996
#> GSM99552     4  0.0188      0.854 0.000 0.000 0.004 0.996
#> GSM99554     2  0.0000      0.954 0.000 1.000 0.000 0.000
#> GSM99556     2  0.3649      0.744 0.000 0.796 0.000 0.204
#> GSM99558     4  0.0000      0.855 0.000 0.000 0.000 1.000
#> GSM99560     4  0.4543      0.626 0.000 0.324 0.000 0.676
#> GSM99562     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99564     2  0.0000      0.954 0.000 1.000 0.000 0.000
#> GSM99572     2  0.0000      0.954 0.000 1.000 0.000 0.000
#> GSM99576     4  0.0707      0.846 0.020 0.000 0.000 0.980
#> GSM99578     4  0.0000      0.855 0.000 0.000 0.000 1.000
#> GSM99580     3  0.0000      0.984 0.000 0.000 1.000 0.000
#> GSM99582     4  0.0524      0.853 0.004 0.000 0.008 0.988
#> GSM99584     4  0.4072      0.715 0.000 0.252 0.000 0.748
#> GSM99586     1  0.0000      0.972 1.000 0.000 0.000 0.000
#> GSM99588     4  0.0188      0.854 0.000 0.004 0.000 0.996
#> GSM99590     2  0.0000      0.954 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0000    0.89940 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0162    0.89879 0.996 0.000 0.000 0.000 0.004
#> GSM99506     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99574     1  0.0000    0.89940 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99594     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99468     1  0.0510    0.89431 0.984 0.000 0.000 0.000 0.016
#> GSM99498     1  0.0510    0.89431 0.984 0.000 0.000 0.000 0.016
#> GSM99500     1  0.0404    0.89632 0.988 0.000 0.000 0.000 0.012
#> GSM99508     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99596     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99600     2  0.3707    0.76631 0.000 0.716 0.000 0.284 0.000
#> GSM99458     5  0.3857    0.54785 0.312 0.000 0.000 0.000 0.688
#> GSM99460     5  0.3707    0.57309 0.284 0.000 0.000 0.000 0.716
#> GSM99510     3  0.3728    0.61765 0.000 0.000 0.748 0.244 0.008
#> GSM99512     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99514     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99516     1  0.0000    0.89940 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0794    0.88531 0.972 0.000 0.000 0.000 0.028
#> GSM99520     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0162    0.93709 0.000 0.000 0.996 0.000 0.004
#> GSM99570     1  0.0000    0.89940 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000    0.89940 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.2179    0.56250 0.000 0.112 0.000 0.888 0.000
#> GSM99434     4  0.5422    0.66317 0.000 0.000 0.132 0.656 0.212
#> GSM99436     2  0.3774    0.75971 0.000 0.704 0.000 0.296 0.000
#> GSM99438     2  0.0000    0.86246 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0000    0.89940 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.2329    0.83209 0.000 0.876 0.000 0.124 0.000
#> GSM99444     2  0.0000    0.86246 0.000 1.000 0.000 0.000 0.000
#> GSM99446     2  0.3837    0.75120 0.000 0.692 0.000 0.308 0.000
#> GSM99448     4  0.6188    0.25684 0.000 0.000 0.416 0.448 0.136
#> GSM99450     3  0.0963    0.90991 0.000 0.000 0.964 0.000 0.036
#> GSM99452     1  0.0162    0.89884 0.996 0.000 0.000 0.000 0.004
#> GSM99454     1  0.0000    0.89940 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.3774    0.56398 0.296 0.000 0.000 0.000 0.704
#> GSM99462     2  0.0000    0.86246 0.000 1.000 0.000 0.000 0.000
#> GSM99464     5  0.4088    0.21890 0.000 0.000 0.368 0.000 0.632
#> GSM99466     4  0.3774    0.75294 0.000 0.000 0.000 0.704 0.296
#> GSM99470     4  0.5295    0.62343 0.052 0.000 0.000 0.540 0.408
#> GSM99472     1  0.4465    0.41726 0.672 0.000 0.000 0.024 0.304
#> GSM99474     3  0.6289   -0.17019 0.000 0.000 0.452 0.396 0.152
#> GSM99476     4  0.4046    0.75204 0.000 0.008 0.000 0.696 0.296
#> GSM99478     4  0.3774    0.75294 0.000 0.000 0.000 0.704 0.296
#> GSM99480     1  0.0162    0.89827 0.996 0.000 0.000 0.000 0.004
#> GSM99482     1  0.1341    0.84945 0.944 0.000 0.000 0.000 0.056
#> GSM99484     4  0.3774    0.75294 0.000 0.000 0.000 0.704 0.296
#> GSM99486     4  0.2561    0.53627 0.000 0.144 0.000 0.856 0.000
#> GSM99488     2  0.0794    0.84753 0.000 0.972 0.000 0.028 0.000
#> GSM99490     4  0.6549    0.50426 0.000 0.280 0.000 0.476 0.244
#> GSM99492     1  0.4242   -0.00524 0.572 0.000 0.000 0.000 0.428
#> GSM99494     2  0.0290    0.85986 0.000 0.992 0.000 0.008 0.000
#> GSM99524     1  0.0000    0.89940 1.000 0.000 0.000 0.000 0.000
#> GSM99526     4  0.5785    0.09866 0.000 0.112 0.000 0.568 0.320
#> GSM99528     4  0.3774    0.75294 0.000 0.000 0.000 0.704 0.296
#> GSM99530     3  0.0404    0.93182 0.000 0.000 0.988 0.000 0.012
#> GSM99532     3  0.0703    0.92271 0.000 0.000 0.976 0.000 0.024
#> GSM99534     4  0.4522    0.53988 0.000 0.068 0.000 0.736 0.196
#> GSM99536     1  0.0703    0.88887 0.976 0.000 0.000 0.000 0.024
#> GSM99538     4  0.3928    0.75298 0.000 0.004 0.000 0.700 0.296
#> GSM99540     1  0.6669   -0.23247 0.400 0.000 0.232 0.000 0.368
#> GSM99542     2  0.3759    0.69901 0.000 0.808 0.000 0.136 0.056
#> GSM99544     4  0.2280    0.55754 0.000 0.120 0.000 0.880 0.000
#> GSM99546     4  0.4341    0.71376 0.000 0.008 0.000 0.628 0.364
#> GSM99548     2  0.0290    0.85986 0.000 0.992 0.000 0.008 0.000
#> GSM99550     5  0.1908    0.28947 0.000 0.000 0.000 0.092 0.908
#> GSM99552     4  0.4046    0.75042 0.000 0.000 0.008 0.696 0.296
#> GSM99554     2  0.3774    0.75971 0.000 0.704 0.000 0.296 0.000
#> GSM99556     2  0.1792    0.79692 0.000 0.916 0.000 0.084 0.000
#> GSM99558     4  0.3774    0.75294 0.000 0.000 0.000 0.704 0.296
#> GSM99560     4  0.3209    0.47662 0.000 0.180 0.000 0.812 0.008
#> GSM99562     3  0.0000    0.93936 0.000 0.000 1.000 0.000 0.000
#> GSM99564     2  0.3816    0.75460 0.000 0.696 0.000 0.304 0.000
#> GSM99572     2  0.0000    0.86246 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.3766   -0.16779 0.004 0.000 0.000 0.268 0.728
#> GSM99578     4  0.3774    0.75294 0.000 0.000 0.000 0.704 0.296
#> GSM99580     3  0.0290    0.93327 0.000 0.000 0.992 0.008 0.000
#> GSM99582     4  0.3895    0.74328 0.000 0.000 0.000 0.680 0.320
#> GSM99584     4  0.2179    0.56250 0.000 0.112 0.000 0.888 0.000
#> GSM99586     5  0.4171    0.39794 0.396 0.000 0.000 0.000 0.604
#> GSM99588     4  0.3928    0.75255 0.000 0.004 0.000 0.700 0.296
#> GSM99590     2  0.0000    0.86246 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99502     1  0.0000     0.9299 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0146     0.9295 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99506     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99566     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99574     1  0.0000     0.9299 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99594     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99468     1  0.0547     0.9242 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM99498     1  0.0547     0.9242 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM99500     1  0.0458     0.9263 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM99508     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99568     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99596     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99600     4  0.3050     0.7557 0.000 0.236 0.000 0.764 0.000 0.000
#> GSM99458     5  0.1088     0.9038 0.024 0.000 0.000 0.016 0.960 0.000
#> GSM99460     5  0.0000     0.9117 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM99510     3  0.3420     0.6515 0.000 0.000 0.748 0.012 0.000 0.240
#> GSM99512     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99514     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99516     1  0.0000     0.9299 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0547     0.9241 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM99520     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99522     3  0.0146     0.9730 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99570     1  0.0000     0.9299 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9299 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.2597     0.8152 0.000 0.000 0.000 0.824 0.000 0.176
#> GSM99434     6  0.2473     0.7439 0.000 0.000 0.136 0.008 0.000 0.856
#> GSM99436     4  0.2631     0.8060 0.000 0.180 0.000 0.820 0.000 0.000
#> GSM99438     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     1  0.0000     0.9299 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.2730     0.7032 0.000 0.808 0.000 0.192 0.000 0.000
#> GSM99444     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     4  0.2527     0.8123 0.000 0.168 0.000 0.832 0.000 0.000
#> GSM99448     6  0.4010     0.3578 0.000 0.000 0.408 0.008 0.000 0.584
#> GSM99450     3  0.1341     0.9409 0.000 0.000 0.948 0.024 0.028 0.000
#> GSM99452     1  0.0146     0.9295 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99454     1  0.0000     0.9299 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.0000     0.9117 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM99462     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     5  0.1564     0.8849 0.000 0.000 0.040 0.024 0.936 0.000
#> GSM99466     6  0.0000     0.8490 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99470     6  0.3627     0.7212 0.008 0.000 0.000 0.136 0.056 0.800
#> GSM99472     1  0.5377     0.6219 0.684 0.000 0.000 0.136 0.100 0.080
#> GSM99474     6  0.5115     0.1934 0.000 0.000 0.436 0.024 0.036 0.504
#> GSM99476     6  0.0000     0.8490 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99478     6  0.0000     0.8490 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99480     1  0.0547     0.9198 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM99482     1  0.3254     0.7716 0.816 0.000 0.000 0.136 0.048 0.000
#> GSM99484     6  0.0000     0.8490 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99486     4  0.2831     0.8327 0.000 0.024 0.000 0.840 0.000 0.136
#> GSM99488     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     6  0.5253     0.3566 0.000 0.168 0.000 0.228 0.000 0.604
#> GSM99492     5  0.2912     0.7458 0.216 0.000 0.000 0.000 0.784 0.000
#> GSM99494     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.0000     0.9299 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99526     4  0.2703     0.7205 0.000 0.000 0.000 0.824 0.172 0.004
#> GSM99528     6  0.0000     0.8490 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99530     3  0.1088     0.9507 0.000 0.000 0.960 0.024 0.016 0.000
#> GSM99532     3  0.1088     0.9507 0.000 0.000 0.960 0.024 0.016 0.000
#> GSM99534     4  0.4312     0.4269 0.000 0.000 0.000 0.676 0.052 0.272
#> GSM99536     1  0.0713     0.9196 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM99538     6  0.0363     0.8451 0.000 0.000 0.000 0.012 0.000 0.988
#> GSM99540     1  0.6636    -0.0408 0.396 0.000 0.252 0.032 0.320 0.000
#> GSM99542     2  0.3871     0.7386 0.000 0.792 0.000 0.136 0.044 0.028
#> GSM99544     4  0.2631     0.8264 0.000 0.008 0.000 0.840 0.000 0.152
#> GSM99546     6  0.1434     0.8268 0.000 0.000 0.000 0.012 0.048 0.940
#> GSM99548     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99550     5  0.1501     0.8729 0.000 0.000 0.000 0.000 0.924 0.076
#> GSM99552     6  0.0000     0.8490 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99554     4  0.2793     0.7931 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM99556     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99558     6  0.0000     0.8490 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM99560     4  0.3025     0.8296 0.000 0.024 0.000 0.820 0.000 0.156
#> GSM99562     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99564     4  0.2454     0.8148 0.000 0.160 0.000 0.840 0.000 0.000
#> GSM99572     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99576     6  0.4903     0.3081 0.000 0.000 0.000 0.068 0.380 0.552
#> GSM99578     6  0.1663     0.8099 0.000 0.000 0.000 0.088 0.000 0.912
#> GSM99580     3  0.0000     0.9755 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99582     6  0.0260     0.8474 0.000 0.000 0.000 0.008 0.000 0.992
#> GSM99584     4  0.2454     0.8206 0.000 0.000 0.000 0.840 0.000 0.160
#> GSM99586     5  0.1141     0.9021 0.052 0.000 0.000 0.000 0.948 0.000
#> GSM99588     6  0.0146     0.8479 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM99590     2  0.0000     0.9542 0.000 1.000 0.000 0.000 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-pam-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-pam-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) cell.type(p) k
#> MAD:pam 70         5.55e-04     2.98e-03 2
#> MAD:pam 81         3.72e-05     1.35e-03 3
#> MAD:pam 82         4.73e-07     8.75e-05 4
#> MAD:pam 74         1.17e-06     8.56e-05 5
#> MAD:pam 79         6.14e-06     1.81e-03 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD: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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-mclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.335           0.707       0.843         0.4719 0.506   0.506
#> 3 3 1.000           0.958       0.976         0.4170 0.746   0.533
#> 4 4 0.709           0.688       0.848         0.0776 0.946   0.835
#> 5 5 0.966           0.898       0.959         0.0925 0.891   0.636
#> 6 6 0.879           0.751       0.880         0.0356 0.978   0.899

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
#> GSM99496     1  0.7950     0.6843 0.760 0.240
#> GSM99502     1  0.5842     0.7737 0.860 0.140
#> GSM99504     1  0.3584     0.7643 0.932 0.068
#> GSM99506     1  0.7950     0.6843 0.760 0.240
#> GSM99566     1  0.7950     0.6843 0.760 0.240
#> GSM99574     1  0.5842     0.7737 0.860 0.140
#> GSM99592     1  0.7950     0.6843 0.760 0.240
#> GSM99594     1  0.7950     0.6843 0.760 0.240
#> GSM99468     1  0.5842     0.7737 0.860 0.140
#> GSM99498     1  0.5842     0.7737 0.860 0.140
#> GSM99500     1  0.5842     0.7737 0.860 0.140
#> GSM99508     1  0.7950     0.6843 0.760 0.240
#> GSM99568     1  0.7950     0.6843 0.760 0.240
#> GSM99596     1  0.8016     0.6845 0.756 0.244
#> GSM99600     2  0.0000     0.8734 0.000 1.000
#> GSM99458     1  0.3733     0.7654 0.928 0.072
#> GSM99460     1  0.3584     0.7643 0.932 0.068
#> GSM99510     2  0.9909     0.1463 0.444 0.556
#> GSM99512     1  0.9427     0.5085 0.640 0.360
#> GSM99514     1  0.7950     0.6843 0.760 0.240
#> GSM99516     1  0.5842     0.7737 0.860 0.140
#> GSM99518     1  0.5842     0.7737 0.860 0.140
#> GSM99520     1  0.7950     0.6843 0.760 0.240
#> GSM99522     1  0.7883     0.6869 0.764 0.236
#> GSM99570     1  0.6048     0.7695 0.852 0.148
#> GSM99598     1  0.5842     0.7737 0.860 0.140
#> GSM99432     2  0.2778     0.8367 0.048 0.952
#> GSM99434     2  0.9909     0.1463 0.444 0.556
#> GSM99436     2  0.0000     0.8734 0.000 1.000
#> GSM99438     2  0.0000     0.8734 0.000 1.000
#> GSM99440     1  0.5842     0.7737 0.860 0.140
#> GSM99442     2  0.0000     0.8734 0.000 1.000
#> GSM99444     2  0.0000     0.8734 0.000 1.000
#> GSM99446     2  0.0000     0.8734 0.000 1.000
#> GSM99448     2  0.9988     0.0128 0.480 0.520
#> GSM99450     1  0.8443     0.6510 0.728 0.272
#> GSM99452     1  0.6438     0.7589 0.836 0.164
#> GSM99454     1  0.5842     0.7737 0.860 0.140
#> GSM99456     1  0.3584     0.7643 0.932 0.068
#> GSM99462     2  0.0000     0.8734 0.000 1.000
#> GSM99464     1  0.9993     0.0729 0.516 0.484
#> GSM99466     2  0.1414     0.8596 0.020 0.980
#> GSM99470     1  0.6887     0.7527 0.816 0.184
#> GSM99472     1  0.6438     0.7589 0.836 0.164
#> GSM99474     1  0.8016     0.6842 0.756 0.244
#> GSM99476     2  0.9881     0.1531 0.436 0.564
#> GSM99478     2  0.0000     0.8734 0.000 1.000
#> GSM99480     1  0.5842     0.7737 0.860 0.140
#> GSM99482     1  0.6438     0.7589 0.836 0.164
#> GSM99484     2  0.0000     0.8734 0.000 1.000
#> GSM99486     2  0.0376     0.8710 0.004 0.996
#> GSM99488     2  0.0000     0.8734 0.000 1.000
#> GSM99490     2  0.0000     0.8734 0.000 1.000
#> GSM99492     1  0.5842     0.7737 0.860 0.140
#> GSM99494     2  0.0000     0.8734 0.000 1.000
#> GSM99524     1  0.6048     0.7696 0.852 0.148
#> GSM99526     1  0.9996     0.0623 0.512 0.488
#> GSM99528     2  0.0672     0.8675 0.008 0.992
#> GSM99530     1  0.8499     0.6911 0.724 0.276
#> GSM99532     1  0.7883     0.7028 0.764 0.236
#> GSM99534     2  0.7056     0.6234 0.192 0.808
#> GSM99536     1  0.5842     0.7737 0.860 0.140
#> GSM99538     2  0.3879     0.8107 0.076 0.924
#> GSM99540     1  0.4431     0.7696 0.908 0.092
#> GSM99542     2  0.7056     0.6234 0.192 0.808
#> GSM99544     2  0.3733     0.8143 0.072 0.928
#> GSM99546     2  0.9954     0.0231 0.460 0.540
#> GSM99548     2  0.0000     0.8734 0.000 1.000
#> GSM99550     1  0.9491     0.3240 0.632 0.368
#> GSM99552     1  0.8763     0.6772 0.704 0.296
#> GSM99554     2  0.0000     0.8734 0.000 1.000
#> GSM99556     2  0.0000     0.8734 0.000 1.000
#> GSM99558     2  0.9686     0.2309 0.396 0.604
#> GSM99560     2  0.0000     0.8734 0.000 1.000
#> GSM99562     1  0.7950     0.6843 0.760 0.240
#> GSM99564     2  0.0000     0.8734 0.000 1.000
#> GSM99572     2  0.0000     0.8734 0.000 1.000
#> GSM99576     1  0.6438     0.7589 0.836 0.164
#> GSM99578     2  0.0000     0.8734 0.000 1.000
#> GSM99580     1  0.7950     0.6843 0.760 0.240
#> GSM99582     1  0.9129     0.6674 0.672 0.328
#> GSM99584     2  0.3733     0.8143 0.072 0.928
#> GSM99586     1  0.5737     0.7739 0.864 0.136
#> GSM99588     2  0.0000     0.8734 0.000 1.000
#> GSM99590     2  0.0000     0.8734 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
#> GSM99496     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99506     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99566     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99592     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99594     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99508     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99568     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99596     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99600     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99458     1  0.1643      0.958 0.956 0.000 0.044
#> GSM99460     1  0.2066      0.945 0.940 0.000 0.060
#> GSM99510     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99512     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99514     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99520     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99522     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99570     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99432     2  0.2066      0.934 0.000 0.940 0.060
#> GSM99434     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99436     2  0.0747      0.943 0.000 0.984 0.016
#> GSM99438     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99446     2  0.0747      0.943 0.000 0.984 0.016
#> GSM99448     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99450     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99456     1  0.1289      0.966 0.968 0.000 0.032
#> GSM99462     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99464     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99466     2  0.5785      0.590 0.000 0.668 0.332
#> GSM99470     1  0.2066      0.945 0.940 0.000 0.060
#> GSM99472     1  0.1753      0.955 0.952 0.000 0.048
#> GSM99474     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99476     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99478     2  0.3192      0.892 0.000 0.888 0.112
#> GSM99480     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99484     2  0.2066      0.934 0.000 0.940 0.060
#> GSM99486     2  0.2066      0.934 0.000 0.940 0.060
#> GSM99488     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99526     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99528     2  0.5882      0.558 0.000 0.652 0.348
#> GSM99530     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99532     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99534     2  0.2066      0.934 0.000 0.940 0.060
#> GSM99536     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99538     2  0.5216      0.712 0.000 0.740 0.260
#> GSM99540     1  0.0892      0.973 0.980 0.000 0.020
#> GSM99542     2  0.2066      0.934 0.000 0.940 0.060
#> GSM99544     2  0.2066      0.934 0.000 0.940 0.060
#> GSM99546     3  0.0592      0.987 0.000 0.012 0.988
#> GSM99548     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99550     1  0.2066      0.945 0.940 0.000 0.060
#> GSM99552     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99554     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99558     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99560     2  0.2066      0.934 0.000 0.940 0.060
#> GSM99562     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99564     2  0.1411      0.941 0.000 0.964 0.036
#> GSM99572     2  0.0000      0.942 0.000 1.000 0.000
#> GSM99576     1  0.2066      0.945 0.940 0.000 0.060
#> GSM99578     2  0.1529      0.940 0.000 0.960 0.040
#> GSM99580     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99582     3  0.0000      1.000 0.000 0.000 1.000
#> GSM99584     2  0.2066      0.934 0.000 0.940 0.060
#> GSM99586     1  0.0000      0.983 1.000 0.000 0.000
#> GSM99588     2  0.1289      0.942 0.000 0.968 0.032
#> GSM99590     2  0.0000      0.942 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000      0.727 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0000      0.727 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000      0.727 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99592     3  0.3024      0.714 0.000 0.148 0.852 0.000
#> GSM99594     3  0.0000      0.727 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000      0.727 0.000 0.000 1.000 0.000
#> GSM99568     3  0.3024      0.714 0.000 0.148 0.852 0.000
#> GSM99596     3  0.0000      0.727 0.000 0.000 1.000 0.000
#> GSM99600     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99458     1  0.2494      0.887 0.916 0.036 0.000 0.048
#> GSM99460     4  0.7743      0.533 0.256 0.308 0.000 0.436
#> GSM99510     3  0.7858     -0.271 0.000 0.316 0.396 0.288
#> GSM99512     3  0.5517      0.536 0.000 0.316 0.648 0.036
#> GSM99514     3  0.0000      0.727 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99520     3  0.2011      0.726 0.000 0.080 0.920 0.000
#> GSM99522     3  0.3123      0.710 0.000 0.156 0.844 0.000
#> GSM99570     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99432     2  0.3074      0.467 0.000 0.848 0.000 0.152
#> GSM99434     4  0.7901      0.417 0.000 0.316 0.312 0.372
#> GSM99436     2  0.1637      0.667 0.000 0.940 0.000 0.060
#> GSM99438     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99440     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99442     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99444     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99446     2  0.1302      0.664 0.000 0.956 0.000 0.044
#> GSM99448     3  0.5250      0.554 0.000 0.316 0.660 0.024
#> GSM99450     3  0.7313      0.171 0.000 0.316 0.508 0.176
#> GSM99452     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99456     1  0.5106      0.660 0.720 0.040 0.000 0.240
#> GSM99462     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99464     4  0.4500      0.806 0.000 0.316 0.000 0.684
#> GSM99466     2  0.3907      0.315 0.000 0.768 0.000 0.232
#> GSM99470     1  0.4500      0.391 0.684 0.316 0.000 0.000
#> GSM99472     1  0.2345      0.842 0.900 0.100 0.000 0.000
#> GSM99474     3  0.4844      0.591 0.000 0.300 0.688 0.012
#> GSM99476     4  0.7889      0.435 0.000 0.316 0.304 0.380
#> GSM99478     2  0.2408      0.534 0.000 0.896 0.000 0.104
#> GSM99480     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0188      0.947 0.996 0.004 0.000 0.000
#> GSM99484     2  0.0000      0.640 0.000 1.000 0.000 0.000
#> GSM99486     2  0.0188      0.643 0.000 0.996 0.000 0.004
#> GSM99488     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99490     2  0.4250      0.692 0.000 0.724 0.000 0.276
#> GSM99492     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99494     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99524     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99526     4  0.4500      0.806 0.000 0.316 0.000 0.684
#> GSM99528     2  0.3569      0.392 0.000 0.804 0.000 0.196
#> GSM99530     4  0.5966      0.777 0.000 0.316 0.060 0.624
#> GSM99532     3  0.5047      0.564 0.000 0.316 0.668 0.016
#> GSM99534     2  0.0000      0.640 0.000 1.000 0.000 0.000
#> GSM99536     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99538     2  0.4356      0.148 0.000 0.708 0.000 0.292
#> GSM99540     1  0.0336      0.944 0.992 0.008 0.000 0.000
#> GSM99542     2  0.0000      0.640 0.000 1.000 0.000 0.000
#> GSM99544     2  0.3726      0.360 0.000 0.788 0.000 0.212
#> GSM99546     4  0.4500      0.806 0.000 0.316 0.000 0.684
#> GSM99548     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99550     4  0.4500      0.806 0.000 0.316 0.000 0.684
#> GSM99552     3  0.4500      0.583 0.000 0.316 0.684 0.000
#> GSM99554     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99556     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99558     3  0.4500      0.583 0.000 0.316 0.684 0.000
#> GSM99560     2  0.4250      0.199 0.000 0.724 0.000 0.276
#> GSM99562     3  0.0000      0.727 0.000 0.000 1.000 0.000
#> GSM99564     2  0.0592      0.651 0.000 0.984 0.000 0.016
#> GSM99572     2  0.4500      0.693 0.000 0.684 0.000 0.316
#> GSM99576     1  0.3569      0.683 0.804 0.196 0.000 0.000
#> GSM99578     2  0.0000      0.640 0.000 1.000 0.000 0.000
#> GSM99580     3  0.0188      0.727 0.000 0.004 0.996 0.000
#> GSM99582     3  0.5432      0.540 0.000 0.316 0.652 0.032
#> GSM99584     2  0.4431      0.106 0.000 0.696 0.000 0.304
#> GSM99586     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> GSM99588     2  0.1118      0.661 0.000 0.964 0.000 0.036
#> GSM99590     2  0.4500      0.693 0.000 0.684 0.000 0.316

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0290     0.9289 0.000 0.000 0.992 0.000 0.008
#> GSM99502     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0290     0.9289 0.000 0.000 0.992 0.000 0.008
#> GSM99566     3  0.0290     0.9289 0.000 0.000 0.992 0.000 0.008
#> GSM99574     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99594     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99468     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99596     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99600     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99458     5  0.3274     0.6811 0.220 0.000 0.000 0.000 0.780
#> GSM99460     5  0.0290     0.8521 0.008 0.000 0.000 0.000 0.992
#> GSM99510     3  0.4235     0.3406 0.000 0.000 0.576 0.424 0.000
#> GSM99512     3  0.1908     0.8566 0.000 0.000 0.908 0.092 0.000
#> GSM99514     3  0.0290     0.9289 0.000 0.000 0.992 0.000 0.008
#> GSM99516     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99520     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99570     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99434     3  0.4309     0.5679 0.000 0.000 0.676 0.308 0.016
#> GSM99436     2  0.4297     0.0534 0.000 0.528 0.000 0.472 0.000
#> GSM99438     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99444     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99446     4  0.3837     0.5360 0.000 0.308 0.000 0.692 0.000
#> GSM99448     4  0.0609     0.9163 0.000 0.000 0.020 0.980 0.000
#> GSM99450     3  0.3160     0.7497 0.000 0.000 0.808 0.004 0.188
#> GSM99452     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.1341     0.8315 0.056 0.000 0.000 0.000 0.944
#> GSM99462     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99464     5  0.0290     0.8525 0.000 0.000 0.000 0.008 0.992
#> GSM99466     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99470     1  0.0290     0.9840 0.992 0.000 0.000 0.008 0.000
#> GSM99472     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99474     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99476     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99478     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99480     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99482     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99484     2  0.1197     0.9216 0.000 0.952 0.000 0.048 0.000
#> GSM99486     4  0.0794     0.9122 0.000 0.028 0.000 0.972 0.000
#> GSM99488     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99490     2  0.0290     0.9604 0.000 0.992 0.000 0.008 0.000
#> GSM99492     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99494     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99524     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99526     5  0.0510     0.8488 0.000 0.000 0.000 0.016 0.984
#> GSM99528     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99530     5  0.4249     0.1963 0.000 0.000 0.432 0.000 0.568
#> GSM99532     3  0.2074     0.8469 0.000 0.000 0.896 0.000 0.104
#> GSM99534     2  0.0290     0.9604 0.000 0.992 0.000 0.008 0.000
#> GSM99536     1  0.0000     0.9935 1.000 0.000 0.000 0.000 0.000
#> GSM99538     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99540     1  0.1608     0.9205 0.928 0.000 0.000 0.000 0.072
#> GSM99542     2  0.0290     0.9604 0.000 0.992 0.000 0.008 0.000
#> GSM99544     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99546     4  0.4192     0.3371 0.000 0.000 0.000 0.596 0.404
#> GSM99548     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99550     5  0.0290     0.8525 0.000 0.000 0.000 0.008 0.992
#> GSM99552     3  0.0290     0.9264 0.000 0.000 0.992 0.008 0.000
#> GSM99554     2  0.0162     0.9620 0.000 0.996 0.000 0.004 0.000
#> GSM99556     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99558     4  0.0162     0.9300 0.000 0.000 0.004 0.996 0.000
#> GSM99560     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99562     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99564     4  0.1121     0.8972 0.000 0.044 0.000 0.956 0.000
#> GSM99572     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000
#> GSM99576     1  0.1197     0.9485 0.952 0.000 0.000 0.000 0.048
#> GSM99578     2  0.0290     0.9604 0.000 0.992 0.000 0.008 0.000
#> GSM99580     3  0.0000     0.9306 0.000 0.000 1.000 0.000 0.000
#> GSM99582     3  0.0798     0.9190 0.000 0.000 0.976 0.008 0.016
#> GSM99584     4  0.0000     0.9326 0.000 0.000 0.000 1.000 0.000
#> GSM99586     1  0.0162     0.9903 0.996 0.000 0.000 0.000 0.004
#> GSM99588     2  0.0290     0.9604 0.000 0.992 0.000 0.008 0.000
#> GSM99590     2  0.0000     0.9633 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0713     0.8400 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM99502     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0713     0.8400 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM99566     3  0.0632     0.8417 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM99574     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.1556     0.8165 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM99594     3  0.0632     0.8417 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM99468     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.8421 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99568     3  0.1556     0.8161 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM99596     3  0.0632     0.8417 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM99600     2  0.0146     0.9173 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM99458     5  0.1204     0.6529 0.056 0.000 0.000 0.000 0.944 0.000
#> GSM99460     5  0.0000     0.6928 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM99510     3  0.6107    -0.4962 0.000 0.000 0.372 0.332 0.000 0.296
#> GSM99512     3  0.3602     0.6552 0.000 0.000 0.796 0.088 0.000 0.116
#> GSM99514     3  0.0713     0.8400 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM99516     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99520     3  0.0865     0.8355 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM99522     3  0.1444     0.8219 0.000 0.000 0.928 0.000 0.000 0.072
#> GSM99570     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0000     0.8944 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99434     6  0.5763     0.5218 0.000 0.000 0.292 0.208 0.000 0.500
#> GSM99436     4  0.3515     0.5158 0.000 0.324 0.000 0.676 0.000 0.000
#> GSM99438     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99444     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     4  0.2562     0.7315 0.000 0.172 0.000 0.828 0.000 0.000
#> GSM99448     4  0.1930     0.8420 0.000 0.000 0.048 0.916 0.000 0.036
#> GSM99450     3  0.5346    -0.0748 0.000 0.000 0.548 0.000 0.128 0.324
#> GSM99452     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.0972     0.6822 0.008 0.000 0.000 0.000 0.964 0.028
#> GSM99462     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     5  0.3672     0.4630 0.000 0.000 0.000 0.000 0.632 0.368
#> GSM99466     4  0.0000     0.8944 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99470     1  0.5481     0.2731 0.440 0.000 0.000 0.000 0.124 0.436
#> GSM99472     1  0.5480     0.2801 0.444 0.000 0.000 0.000 0.124 0.432
#> GSM99474     3  0.2003     0.7897 0.000 0.000 0.884 0.000 0.000 0.116
#> GSM99476     4  0.3290     0.6049 0.000 0.000 0.004 0.744 0.000 0.252
#> GSM99478     4  0.0000     0.8944 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99480     1  0.0713     0.8755 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM99482     1  0.2053     0.8180 0.888 0.000 0.000 0.000 0.004 0.108
#> GSM99484     2  0.4490     0.3621 0.000 0.604 0.000 0.360 0.004 0.032
#> GSM99486     4  0.0260     0.8924 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM99488     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     2  0.0146     0.9173 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM99492     1  0.0713     0.8755 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM99494     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99526     5  0.3819     0.4541 0.000 0.000 0.000 0.004 0.624 0.372
#> GSM99528     4  0.3121     0.7180 0.000 0.008 0.000 0.796 0.004 0.192
#> GSM99530     6  0.5894     0.3453 0.000 0.000 0.244 0.000 0.284 0.472
#> GSM99532     3  0.3588     0.6615 0.000 0.000 0.788 0.000 0.060 0.152
#> GSM99534     2  0.4886     0.3955 0.000 0.520 0.000 0.012 0.036 0.432
#> GSM99536     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99538     4  0.0000     0.8944 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99540     1  0.2378     0.7713 0.848 0.000 0.000 0.000 0.152 0.000
#> GSM99542     2  0.3944     0.4635 0.000 0.568 0.000 0.000 0.004 0.428
#> GSM99544     4  0.0000     0.8944 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99546     5  0.6079     0.0759 0.000 0.000 0.000 0.280 0.392 0.328
#> GSM99548     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99550     5  0.0000     0.6928 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM99552     3  0.0632     0.8417 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM99554     2  0.0260     0.9142 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM99556     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99558     4  0.1010     0.8734 0.000 0.000 0.036 0.960 0.000 0.004
#> GSM99560     4  0.0146     0.8928 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM99562     3  0.0146     0.8419 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99564     4  0.1075     0.8652 0.000 0.048 0.000 0.952 0.000 0.000
#> GSM99572     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99576     1  0.5607     0.2823 0.448 0.000 0.000 0.000 0.144 0.408
#> GSM99578     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99580     3  0.0363     0.8424 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM99582     3  0.2402     0.7772 0.000 0.000 0.868 0.000 0.012 0.120
#> GSM99584     4  0.0000     0.8944 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99586     1  0.4343     0.3999 0.592 0.000 0.000 0.000 0.380 0.028
#> GSM99588     2  0.0146     0.9173 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM99590     2  0.0000     0.9191 0.000 1.000 0.000 0.000 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-mclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) cell.type(p) k
#> MAD:mclust 76         2.92e-05     0.000166 2
#> MAD:mclust 85         2.97e-04     0.007444 3
#> MAD:mclust 73         6.20e-04     0.021537 4
#> MAD:mclust 81         2.71e-04     0.010396 5
#> MAD:mclust 72         1.44e-04     0.009396 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-NMF-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-NMF-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.962       0.984         0.5032 0.496   0.496
#> 3 3 0.967           0.957       0.981         0.3384 0.729   0.505
#> 4 4 0.884           0.898       0.947         0.1069 0.884   0.666
#> 5 5 0.755           0.688       0.833         0.0470 0.965   0.869
#> 6 6 0.733           0.598       0.785         0.0446 0.896   0.608

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
#> GSM99496     1  0.0000      0.991 1.000 0.000
#> GSM99502     1  0.0000      0.991 1.000 0.000
#> GSM99504     1  0.0000      0.991 1.000 0.000
#> GSM99506     1  0.0000      0.991 1.000 0.000
#> GSM99566     1  0.3733      0.918 0.928 0.072
#> GSM99574     1  0.0000      0.991 1.000 0.000
#> GSM99592     1  0.8267      0.639 0.740 0.260
#> GSM99594     1  0.0000      0.991 1.000 0.000
#> GSM99468     1  0.0000      0.991 1.000 0.000
#> GSM99498     1  0.0000      0.991 1.000 0.000
#> GSM99500     1  0.0000      0.991 1.000 0.000
#> GSM99508     1  0.0000      0.991 1.000 0.000
#> GSM99568     1  0.0000      0.991 1.000 0.000
#> GSM99596     1  0.0000      0.991 1.000 0.000
#> GSM99600     2  0.0000      0.975 0.000 1.000
#> GSM99458     1  0.0000      0.991 1.000 0.000
#> GSM99460     1  0.0000      0.991 1.000 0.000
#> GSM99510     2  0.3431      0.918 0.064 0.936
#> GSM99512     2  0.0672      0.969 0.008 0.992
#> GSM99514     1  0.0000      0.991 1.000 0.000
#> GSM99516     1  0.0000      0.991 1.000 0.000
#> GSM99518     1  0.0000      0.991 1.000 0.000
#> GSM99520     1  0.0000      0.991 1.000 0.000
#> GSM99522     1  0.0000      0.991 1.000 0.000
#> GSM99570     1  0.0000      0.991 1.000 0.000
#> GSM99598     1  0.0000      0.991 1.000 0.000
#> GSM99432     2  0.0000      0.975 0.000 1.000
#> GSM99434     2  0.9635      0.376 0.388 0.612
#> GSM99436     2  0.0000      0.975 0.000 1.000
#> GSM99438     2  0.0000      0.975 0.000 1.000
#> GSM99440     1  0.0000      0.991 1.000 0.000
#> GSM99442     2  0.0000      0.975 0.000 1.000
#> GSM99444     2  0.0000      0.975 0.000 1.000
#> GSM99446     2  0.0000      0.975 0.000 1.000
#> GSM99448     2  0.0000      0.975 0.000 1.000
#> GSM99450     1  0.0000      0.991 1.000 0.000
#> GSM99452     1  0.0000      0.991 1.000 0.000
#> GSM99454     1  0.0000      0.991 1.000 0.000
#> GSM99456     1  0.0000      0.991 1.000 0.000
#> GSM99462     2  0.0000      0.975 0.000 1.000
#> GSM99464     1  0.0000      0.991 1.000 0.000
#> GSM99466     2  0.0000      0.975 0.000 1.000
#> GSM99470     1  0.3114      0.935 0.944 0.056
#> GSM99472     1  0.0000      0.991 1.000 0.000
#> GSM99474     1  0.0000      0.991 1.000 0.000
#> GSM99476     2  0.0000      0.975 0.000 1.000
#> GSM99478     2  0.0000      0.975 0.000 1.000
#> GSM99480     1  0.0000      0.991 1.000 0.000
#> GSM99482     1  0.0000      0.991 1.000 0.000
#> GSM99484     2  0.0000      0.975 0.000 1.000
#> GSM99486     2  0.0000      0.975 0.000 1.000
#> GSM99488     2  0.0000      0.975 0.000 1.000
#> GSM99490     2  0.0000      0.975 0.000 1.000
#> GSM99492     1  0.0000      0.991 1.000 0.000
#> GSM99494     2  0.0000      0.975 0.000 1.000
#> GSM99524     1  0.0000      0.991 1.000 0.000
#> GSM99526     2  0.3274      0.922 0.060 0.940
#> GSM99528     2  0.0000      0.975 0.000 1.000
#> GSM99530     1  0.0000      0.991 1.000 0.000
#> GSM99532     1  0.0000      0.991 1.000 0.000
#> GSM99534     2  0.0000      0.975 0.000 1.000
#> GSM99536     1  0.0000      0.991 1.000 0.000
#> GSM99538     2  0.0000      0.975 0.000 1.000
#> GSM99540     1  0.0000      0.991 1.000 0.000
#> GSM99542     2  0.0000      0.975 0.000 1.000
#> GSM99544     2  0.0000      0.975 0.000 1.000
#> GSM99546     2  0.0376      0.972 0.004 0.996
#> GSM99548     2  0.0000      0.975 0.000 1.000
#> GSM99550     1  0.0000      0.991 1.000 0.000
#> GSM99552     2  0.1633      0.956 0.024 0.976
#> GSM99554     2  0.0000      0.975 0.000 1.000
#> GSM99556     2  0.0000      0.975 0.000 1.000
#> GSM99558     2  0.0000      0.975 0.000 1.000
#> GSM99560     2  0.0000      0.975 0.000 1.000
#> GSM99562     1  0.0000      0.991 1.000 0.000
#> GSM99564     2  0.0000      0.975 0.000 1.000
#> GSM99572     2  0.0000      0.975 0.000 1.000
#> GSM99576     1  0.0000      0.991 1.000 0.000
#> GSM99578     2  0.0000      0.975 0.000 1.000
#> GSM99580     2  0.9754      0.329 0.408 0.592
#> GSM99582     1  0.0000      0.991 1.000 0.000
#> GSM99584     2  0.0000      0.975 0.000 1.000
#> GSM99586     1  0.0000      0.991 1.000 0.000
#> GSM99588     2  0.0000      0.975 0.000 1.000
#> GSM99590     2  0.0000      0.975 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
#> GSM99496     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99504     1  0.3340      0.863 0.880 0.000 0.120
#> GSM99506     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99566     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99508     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99568     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99596     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99600     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99514     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99520     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99522     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99570     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99432     2  0.0237      0.977 0.000 0.996 0.004
#> GSM99434     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99448     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99450     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99464     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99466     2  0.3619      0.842 0.000 0.864 0.136
#> GSM99470     1  0.3340      0.865 0.880 0.120 0.000
#> GSM99472     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99474     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99476     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99478     2  0.0237      0.977 0.000 0.996 0.004
#> GSM99480     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99484     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99486     2  0.0237      0.977 0.000 0.996 0.004
#> GSM99488     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99526     3  0.4002      0.800 0.000 0.160 0.840
#> GSM99528     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99530     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99532     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99534     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99536     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99538     3  0.5810      0.479 0.000 0.336 0.664
#> GSM99540     1  0.0592      0.978 0.988 0.000 0.012
#> GSM99542     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99544     2  0.5706      0.527 0.000 0.680 0.320
#> GSM99546     2  0.2796      0.893 0.000 0.908 0.092
#> GSM99548     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99550     1  0.1860      0.942 0.948 0.052 0.000
#> GSM99552     3  0.0237      0.969 0.000 0.004 0.996
#> GSM99554     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99558     3  0.0237      0.969 0.000 0.004 0.996
#> GSM99560     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99562     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99564     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99572     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99576     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99578     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99580     3  0.0000      0.972 0.000 0.000 1.000
#> GSM99582     3  0.4702      0.722 0.212 0.000 0.788
#> GSM99584     2  0.0892      0.964 0.000 0.980 0.020
#> GSM99586     1  0.0000      0.988 1.000 0.000 0.000
#> GSM99588     2  0.0000      0.979 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.979 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000      0.941 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99504     3  0.2149      0.875 0.088 0.000 0.912 0.000
#> GSM99506     3  0.0188      0.942 0.000 0.000 0.996 0.004
#> GSM99566     3  0.0000      0.941 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99592     3  0.2408      0.899 0.000 0.000 0.896 0.104
#> GSM99594     3  0.0336      0.942 0.000 0.000 0.992 0.008
#> GSM99468     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99498     1  0.3444      0.750 0.816 0.000 0.184 0.000
#> GSM99500     1  0.0592      0.949 0.984 0.000 0.016 0.000
#> GSM99508     3  0.1022      0.940 0.000 0.000 0.968 0.032
#> GSM99568     3  0.1022      0.940 0.000 0.000 0.968 0.032
#> GSM99596     3  0.0469      0.940 0.000 0.000 0.988 0.012
#> GSM99600     2  0.0469      0.966 0.000 0.988 0.000 0.012
#> GSM99458     1  0.0817      0.945 0.976 0.000 0.000 0.024
#> GSM99460     4  0.4790      0.401 0.380 0.000 0.000 0.620
#> GSM99510     4  0.4164      0.613 0.000 0.000 0.264 0.736
#> GSM99512     3  0.3569      0.793 0.000 0.000 0.804 0.196
#> GSM99514     3  0.0188      0.942 0.000 0.000 0.996 0.004
#> GSM99516     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0817      0.941 0.000 0.000 0.976 0.024
#> GSM99522     3  0.1209      0.937 0.004 0.000 0.964 0.032
#> GSM99570     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99432     4  0.3172      0.771 0.000 0.160 0.000 0.840
#> GSM99434     4  0.1792      0.833 0.000 0.000 0.068 0.932
#> GSM99436     2  0.2589      0.888 0.000 0.884 0.000 0.116
#> GSM99438     2  0.0188      0.967 0.000 0.996 0.000 0.004
#> GSM99440     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0469      0.966 0.000 0.988 0.000 0.012
#> GSM99444     2  0.0188      0.967 0.000 0.996 0.000 0.004
#> GSM99446     2  0.2408      0.900 0.000 0.896 0.000 0.104
#> GSM99448     3  0.2081      0.911 0.000 0.000 0.916 0.084
#> GSM99450     4  0.3311      0.748 0.000 0.000 0.172 0.828
#> GSM99452     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99456     1  0.1557      0.916 0.944 0.000 0.000 0.056
#> GSM99462     2  0.0188      0.967 0.000 0.996 0.000 0.004
#> GSM99464     4  0.0336      0.853 0.000 0.000 0.008 0.992
#> GSM99466     2  0.1938      0.937 0.000 0.936 0.012 0.052
#> GSM99470     1  0.4933      0.232 0.568 0.432 0.000 0.000
#> GSM99472     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99474     3  0.1211      0.936 0.000 0.000 0.960 0.040
#> GSM99476     4  0.0592      0.852 0.000 0.000 0.016 0.984
#> GSM99478     2  0.0376      0.964 0.000 0.992 0.004 0.004
#> GSM99480     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99484     2  0.0188      0.967 0.000 0.996 0.000 0.004
#> GSM99486     2  0.1022      0.956 0.000 0.968 0.000 0.032
#> GSM99488     2  0.0000      0.967 0.000 1.000 0.000 0.000
#> GSM99490     2  0.0188      0.967 0.000 0.996 0.000 0.004
#> GSM99492     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99494     2  0.0000      0.967 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99526     4  0.0336      0.853 0.000 0.000 0.008 0.992
#> GSM99528     2  0.1406      0.944 0.000 0.960 0.016 0.024
#> GSM99530     4  0.3444      0.747 0.000 0.000 0.184 0.816
#> GSM99532     3  0.4431      0.617 0.000 0.000 0.696 0.304
#> GSM99534     2  0.0469      0.966 0.000 0.988 0.000 0.012
#> GSM99536     1  0.0000      0.961 1.000 0.000 0.000 0.000
#> GSM99538     4  0.1109      0.855 0.000 0.028 0.004 0.968
#> GSM99540     1  0.0592      0.952 0.984 0.000 0.000 0.016
#> GSM99542     2  0.0000      0.967 0.000 1.000 0.000 0.000
#> GSM99544     4  0.2973      0.789 0.000 0.144 0.000 0.856
#> GSM99546     4  0.1302      0.850 0.000 0.044 0.000 0.956
#> GSM99548     2  0.0188      0.967 0.000 0.996 0.000 0.004
#> GSM99550     4  0.3836      0.753 0.168 0.016 0.000 0.816
#> GSM99552     3  0.0188      0.940 0.000 0.004 0.996 0.000
#> GSM99554     2  0.0469      0.966 0.000 0.988 0.000 0.012
#> GSM99556     2  0.0000      0.967 0.000 1.000 0.000 0.000
#> GSM99558     3  0.0188      0.940 0.000 0.004 0.996 0.000
#> GSM99560     2  0.4356      0.617 0.000 0.708 0.000 0.292
#> GSM99562     3  0.2011      0.916 0.000 0.000 0.920 0.080
#> GSM99564     2  0.2647      0.883 0.000 0.880 0.000 0.120
#> GSM99572     2  0.0188      0.967 0.000 0.996 0.000 0.004
#> GSM99576     1  0.0524      0.954 0.988 0.004 0.000 0.008
#> GSM99578     2  0.0000      0.967 0.000 1.000 0.000 0.000
#> GSM99580     3  0.0188      0.942 0.000 0.000 0.996 0.004
#> GSM99582     3  0.2924      0.852 0.100 0.000 0.884 0.016
#> GSM99584     4  0.1792      0.840 0.000 0.068 0.000 0.932
#> GSM99586     1  0.0592      0.952 0.984 0.000 0.000 0.016
#> GSM99588     2  0.0000      0.967 0.000 1.000 0.000 0.000
#> GSM99590     2  0.0188      0.967 0.000 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0880     0.7554 0.000 0.000 0.968 0.000 0.032
#> GSM99502     1  0.0290     0.9322 0.992 0.000 0.000 0.000 0.008
#> GSM99504     3  0.5642     0.3457 0.240 0.000 0.624 0.000 0.136
#> GSM99506     3  0.0290     0.7570 0.000 0.000 0.992 0.000 0.008
#> GSM99566     3  0.1851     0.7460 0.000 0.000 0.912 0.000 0.088
#> GSM99574     1  0.0880     0.9236 0.968 0.000 0.000 0.000 0.032
#> GSM99592     3  0.3459     0.7234 0.000 0.000 0.832 0.052 0.116
#> GSM99594     3  0.2411     0.7280 0.000 0.000 0.884 0.008 0.108
#> GSM99468     1  0.0162     0.9323 0.996 0.000 0.000 0.000 0.004
#> GSM99498     1  0.3961     0.6542 0.760 0.000 0.212 0.000 0.028
#> GSM99500     1  0.0162     0.9323 0.996 0.000 0.000 0.000 0.004
#> GSM99508     3  0.1792     0.7439 0.000 0.000 0.916 0.000 0.084
#> GSM99568     3  0.1282     0.7521 0.000 0.000 0.952 0.004 0.044
#> GSM99596     3  0.2516     0.7132 0.000 0.000 0.860 0.000 0.140
#> GSM99600     2  0.2719     0.7480 0.000 0.852 0.000 0.004 0.144
#> GSM99458     1  0.0693     0.9305 0.980 0.000 0.000 0.012 0.008
#> GSM99460     4  0.4537     0.2638 0.396 0.000 0.000 0.592 0.012
#> GSM99510     4  0.5375     0.5277 0.000 0.000 0.176 0.668 0.156
#> GSM99512     3  0.5190     0.6271 0.000 0.000 0.688 0.140 0.172
#> GSM99514     3  0.2732     0.7100 0.000 0.000 0.840 0.000 0.160
#> GSM99516     1  0.0510     0.9307 0.984 0.000 0.000 0.000 0.016
#> GSM99518     1  0.0162     0.9325 0.996 0.000 0.000 0.004 0.000
#> GSM99520     3  0.0451     0.7575 0.000 0.000 0.988 0.004 0.008
#> GSM99522     3  0.4510     0.4199 0.008 0.000 0.560 0.000 0.432
#> GSM99570     1  0.0609     0.9294 0.980 0.000 0.000 0.000 0.020
#> GSM99598     1  0.0404     0.9318 0.988 0.000 0.000 0.000 0.012
#> GSM99432     4  0.4501     0.6183 0.000 0.128 0.000 0.756 0.116
#> GSM99434     4  0.1012     0.7308 0.000 0.000 0.020 0.968 0.012
#> GSM99436     2  0.5678     0.4324 0.000 0.612 0.000 0.128 0.260
#> GSM99438     2  0.0290     0.8025 0.000 0.992 0.000 0.000 0.008
#> GSM99440     1  0.0000     0.9328 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.3424     0.6657 0.000 0.760 0.000 0.000 0.240
#> GSM99444     2  0.1410     0.7904 0.000 0.940 0.000 0.000 0.060
#> GSM99446     2  0.5120     0.5615 0.000 0.684 0.000 0.104 0.212
#> GSM99448     3  0.5142     0.4924 0.000 0.000 0.600 0.052 0.348
#> GSM99450     4  0.3590     0.6961 0.000 0.000 0.080 0.828 0.092
#> GSM99452     1  0.0000     0.9328 1.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9328 1.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.3346     0.8269 0.844 0.000 0.000 0.092 0.064
#> GSM99462     2  0.0703     0.8006 0.000 0.976 0.000 0.000 0.024
#> GSM99464     4  0.1557     0.7183 0.000 0.000 0.008 0.940 0.052
#> GSM99466     2  0.6220     0.3984 0.000 0.572 0.032 0.084 0.312
#> GSM99470     1  0.4078     0.6803 0.784 0.148 0.000 0.000 0.068
#> GSM99472     1  0.0510     0.9310 0.984 0.000 0.000 0.000 0.016
#> GSM99474     3  0.2491     0.7374 0.000 0.000 0.896 0.036 0.068
#> GSM99476     4  0.2989     0.7145 0.000 0.008 0.008 0.852 0.132
#> GSM99478     2  0.3126     0.6962 0.000 0.868 0.048 0.008 0.076
#> GSM99480     1  0.0000     0.9328 1.000 0.000 0.000 0.000 0.000
#> GSM99482     1  0.0290     0.9322 0.992 0.000 0.000 0.000 0.008
#> GSM99484     2  0.2648     0.7451 0.000 0.848 0.000 0.000 0.152
#> GSM99486     5  0.5778    -0.4511 0.000 0.448 0.000 0.088 0.464
#> GSM99488     2  0.0794     0.7952 0.000 0.972 0.000 0.000 0.028
#> GSM99490     2  0.0609     0.7989 0.000 0.980 0.000 0.000 0.020
#> GSM99492     1  0.1251     0.9133 0.956 0.000 0.000 0.008 0.036
#> GSM99494     2  0.0703     0.7998 0.000 0.976 0.000 0.000 0.024
#> GSM99524     1  0.0404     0.9318 0.988 0.000 0.000 0.000 0.012
#> GSM99526     4  0.0794     0.7329 0.000 0.000 0.000 0.972 0.028
#> GSM99528     3  0.7464     0.0436 0.008 0.344 0.392 0.024 0.232
#> GSM99530     3  0.6619     0.2678 0.004 0.000 0.480 0.304 0.212
#> GSM99532     3  0.5939     0.4405 0.000 0.000 0.576 0.276 0.148
#> GSM99534     2  0.2997     0.7417 0.012 0.840 0.000 0.000 0.148
#> GSM99536     1  0.0566     0.9284 0.984 0.000 0.000 0.004 0.012
#> GSM99538     4  0.4796     0.5988 0.000 0.020 0.156 0.752 0.072
#> GSM99540     1  0.4528     0.7635 0.784 0.000 0.024 0.108 0.084
#> GSM99542     2  0.0963     0.7908 0.000 0.964 0.000 0.000 0.036
#> GSM99544     4  0.5657     0.4885 0.000 0.128 0.000 0.616 0.256
#> GSM99546     4  0.2505     0.7225 0.000 0.020 0.000 0.888 0.092
#> GSM99548     2  0.1357     0.7843 0.000 0.948 0.000 0.004 0.048
#> GSM99550     4  0.4166     0.6307 0.116 0.004 0.000 0.792 0.088
#> GSM99552     3  0.2179     0.7368 0.000 0.000 0.888 0.000 0.112
#> GSM99554     2  0.3480     0.6574 0.000 0.752 0.000 0.000 0.248
#> GSM99556     2  0.0703     0.7974 0.000 0.976 0.000 0.000 0.024
#> GSM99558     3  0.1469     0.7526 0.000 0.016 0.948 0.000 0.036
#> GSM99560     2  0.6231     0.2627 0.000 0.532 0.000 0.288 0.180
#> GSM99562     3  0.3730     0.6125 0.000 0.000 0.712 0.000 0.288
#> GSM99564     2  0.6282     0.1372 0.000 0.496 0.000 0.164 0.340
#> GSM99572     2  0.0162     0.8024 0.000 0.996 0.000 0.000 0.004
#> GSM99576     1  0.5650     0.6786 0.712 0.056 0.028 0.028 0.176
#> GSM99578     2  0.0703     0.8005 0.000 0.976 0.000 0.000 0.024
#> GSM99580     3  0.1197     0.7541 0.000 0.000 0.952 0.000 0.048
#> GSM99582     5  0.6579    -0.3266 0.208 0.000 0.372 0.000 0.420
#> GSM99584     4  0.5074     0.5503 0.000 0.072 0.000 0.660 0.268
#> GSM99586     1  0.2645     0.8658 0.888 0.000 0.000 0.044 0.068
#> GSM99588     2  0.0703     0.7995 0.000 0.976 0.000 0.000 0.024
#> GSM99590     2  0.0404     0.8023 0.000 0.988 0.000 0.000 0.012

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.4230    0.14053 0.000 0.000 0.584 0.008 0.008 0.400
#> GSM99502     1  0.0260    0.92419 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM99504     3  0.5025    0.28525 0.232 0.000 0.672 0.016 0.008 0.072
#> GSM99506     3  0.2969    0.48626 0.000 0.000 0.776 0.000 0.000 0.224
#> GSM99566     3  0.1003    0.59120 0.000 0.000 0.964 0.004 0.004 0.028
#> GSM99574     1  0.0622    0.92332 0.980 0.000 0.008 0.000 0.000 0.012
#> GSM99592     3  0.2998    0.58978 0.000 0.000 0.856 0.008 0.064 0.072
#> GSM99594     3  0.4199    0.29194 0.000 0.000 0.620 0.004 0.016 0.360
#> GSM99468     1  0.0405    0.92378 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM99498     1  0.4302    0.63967 0.728 0.000 0.156 0.000 0.000 0.116
#> GSM99500     1  0.2201    0.87720 0.896 0.000 0.028 0.000 0.000 0.076
#> GSM99508     3  0.2431    0.56021 0.000 0.000 0.860 0.000 0.008 0.132
#> GSM99568     3  0.3409    0.40120 0.000 0.000 0.700 0.000 0.000 0.300
#> GSM99596     6  0.3330    0.47156 0.000 0.000 0.284 0.000 0.000 0.716
#> GSM99600     4  0.4171    0.37337 0.000 0.380 0.000 0.604 0.012 0.004
#> GSM99458     1  0.0964    0.92131 0.968 0.000 0.000 0.004 0.012 0.016
#> GSM99460     5  0.4086    0.00541 0.464 0.000 0.000 0.000 0.528 0.008
#> GSM99510     3  0.5317    0.21000 0.000 0.000 0.524 0.032 0.400 0.044
#> GSM99512     3  0.5224    0.44824 0.000 0.020 0.668 0.012 0.220 0.080
#> GSM99514     3  0.4201    0.49105 0.000 0.000 0.760 0.056 0.024 0.160
#> GSM99516     1  0.0363    0.92449 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM99518     1  0.0508    0.92499 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM99520     3  0.4249    0.09225 0.000 0.000 0.568 0.012 0.004 0.416
#> GSM99522     3  0.5157    0.48547 0.000 0.000 0.700 0.080 0.072 0.148
#> GSM99570     1  0.0653    0.92418 0.980 0.000 0.004 0.004 0.000 0.012
#> GSM99598     1  0.0405    0.92435 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM99432     5  0.4306   -0.17869 0.000 0.012 0.000 0.464 0.520 0.004
#> GSM99434     5  0.3051    0.62317 0.000 0.000 0.112 0.036 0.844 0.008
#> GSM99436     4  0.4013    0.64297 0.000 0.104 0.000 0.768 0.124 0.004
#> GSM99438     2  0.1387    0.85934 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM99440     1  0.0146    0.92414 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99442     4  0.3841    0.38535 0.000 0.380 0.000 0.616 0.000 0.004
#> GSM99444     2  0.2260    0.80428 0.000 0.860 0.000 0.140 0.000 0.000
#> GSM99446     4  0.5079    0.51869 0.000 0.304 0.000 0.600 0.092 0.004
#> GSM99448     3  0.4966    0.49855 0.000 0.000 0.712 0.048 0.148 0.092
#> GSM99450     5  0.3868    0.59291 0.000 0.000 0.100 0.096 0.792 0.012
#> GSM99452     1  0.0146    0.92414 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99454     1  0.0405    0.92494 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM99456     1  0.3548    0.80558 0.816 0.000 0.000 0.016 0.116 0.052
#> GSM99462     2  0.1204    0.85886 0.000 0.944 0.000 0.056 0.000 0.000
#> GSM99464     5  0.2164    0.64383 0.000 0.000 0.028 0.016 0.912 0.044
#> GSM99466     4  0.4352    0.50449 0.000 0.016 0.012 0.704 0.016 0.252
#> GSM99470     1  0.3859    0.73368 0.772 0.016 0.000 0.176 0.000 0.036
#> GSM99472     1  0.1461    0.90411 0.940 0.000 0.000 0.044 0.000 0.016
#> GSM99474     3  0.4447    0.48080 0.000 0.000 0.704 0.000 0.100 0.196
#> GSM99476     4  0.4224    0.21076 0.000 0.000 0.000 0.552 0.432 0.016
#> GSM99478     6  0.5861    0.22233 0.000 0.076 0.040 0.268 0.016 0.600
#> GSM99480     1  0.0146    0.92377 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM99482     1  0.0692    0.92266 0.976 0.000 0.000 0.004 0.000 0.020
#> GSM99484     4  0.4361    0.49798 0.000 0.308 0.000 0.648 0.000 0.044
#> GSM99486     4  0.2553    0.62888 0.000 0.056 0.000 0.888 0.044 0.012
#> GSM99488     2  0.0000    0.85040 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     2  0.3606    0.63610 0.000 0.728 0.000 0.256 0.000 0.016
#> GSM99492     1  0.1483    0.90518 0.944 0.000 0.000 0.008 0.012 0.036
#> GSM99494     2  0.0146    0.84967 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM99524     1  0.1049    0.91807 0.960 0.000 0.000 0.008 0.000 0.032
#> GSM99526     5  0.1888    0.63465 0.000 0.000 0.004 0.068 0.916 0.012
#> GSM99528     6  0.5145    0.49947 0.004 0.060 0.120 0.024 0.056 0.736
#> GSM99530     6  0.6109    0.12414 0.000 0.000 0.204 0.008 0.364 0.424
#> GSM99532     5  0.5951   -0.01925 0.000 0.000 0.332 0.004 0.464 0.200
#> GSM99534     2  0.4256    0.67390 0.044 0.744 0.000 0.192 0.004 0.016
#> GSM99536     1  0.0405    0.92331 0.988 0.000 0.000 0.004 0.008 0.000
#> GSM99538     5  0.4587    0.55015 0.000 0.008 0.096 0.024 0.752 0.120
#> GSM99540     1  0.4540    0.72181 0.744 0.000 0.032 0.000 0.140 0.084
#> GSM99542     2  0.0146    0.84780 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM99544     4  0.5462    0.10626 0.000 0.028 0.016 0.476 0.452 0.028
#> GSM99546     5  0.2488    0.59663 0.000 0.004 0.000 0.124 0.864 0.008
#> GSM99548     2  0.2432    0.81779 0.000 0.876 0.000 0.100 0.000 0.024
#> GSM99550     5  0.5611    0.47692 0.068 0.004 0.000 0.160 0.664 0.104
#> GSM99552     6  0.4514    0.37348 0.000 0.004 0.336 0.024 0.008 0.628
#> GSM99554     4  0.3512    0.54190 0.000 0.272 0.000 0.720 0.000 0.008
#> GSM99556     2  0.0865    0.86199 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM99558     6  0.5600    0.22695 0.000 0.004 0.412 0.096 0.008 0.480
#> GSM99560     4  0.5899    0.51687 0.000 0.108 0.000 0.584 0.256 0.052
#> GSM99562     3  0.4203    0.53305 0.000 0.000 0.772 0.024 0.088 0.116
#> GSM99564     4  0.3402    0.63784 0.000 0.072 0.000 0.820 0.104 0.004
#> GSM99572     2  0.1863    0.84229 0.000 0.896 0.000 0.104 0.000 0.000
#> GSM99576     1  0.4856    0.74801 0.748 0.032 0.012 0.012 0.056 0.140
#> GSM99578     2  0.5058    0.01929 0.000 0.500 0.000 0.424 0.000 0.076
#> GSM99580     3  0.1333    0.59285 0.000 0.000 0.944 0.000 0.008 0.048
#> GSM99582     4  0.6069    0.20692 0.036 0.000 0.132 0.592 0.012 0.228
#> GSM99584     4  0.4317    0.31824 0.000 0.004 0.000 0.572 0.408 0.016
#> GSM99586     1  0.3017    0.84837 0.860 0.000 0.000 0.016 0.060 0.064
#> GSM99588     2  0.0458    0.85774 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM99590     2  0.1141    0.86280 0.000 0.948 0.000 0.052 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-NMF-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) cell.type(p) k
#> MAD:NMF 83         6.56e-05     0.000342 2
#> MAD:NMF 84         2.31e-04     0.006091 3
#> MAD:NMF 83         2.94e-05     0.000999 4
#> MAD:NMF 71         1.56e-04     0.003625 5
#> MAD:NMF 55         2.97e-03     0.024170 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-hclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-hclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.608           0.839       0.919         0.4421 0.525   0.525
#> 3 3 0.546           0.687       0.841         0.4631 0.742   0.535
#> 4 4 0.688           0.727       0.830         0.1416 0.851   0.588
#> 5 5 0.672           0.633       0.811         0.0597 0.976   0.904
#> 6 6 0.728           0.635       0.785         0.0425 0.945   0.760

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
#> GSM99496     1   0.000     0.9445 1.000 0.000
#> GSM99502     1   0.000     0.9445 1.000 0.000
#> GSM99504     1   0.000     0.9445 1.000 0.000
#> GSM99506     1   0.000     0.9445 1.000 0.000
#> GSM99566     1   0.000     0.9445 1.000 0.000
#> GSM99574     1   0.000     0.9445 1.000 0.000
#> GSM99592     1   0.662     0.7674 0.828 0.172
#> GSM99594     1   0.000     0.9445 1.000 0.000
#> GSM99468     1   0.000     0.9445 1.000 0.000
#> GSM99498     1   0.000     0.9445 1.000 0.000
#> GSM99500     1   0.000     0.9445 1.000 0.000
#> GSM99508     1   0.000     0.9445 1.000 0.000
#> GSM99568     1   0.000     0.9445 1.000 0.000
#> GSM99596     1   0.000     0.9445 1.000 0.000
#> GSM99600     2   0.204     0.8303 0.032 0.968
#> GSM99458     1   0.000     0.9445 1.000 0.000
#> GSM99460     1   0.000     0.9445 1.000 0.000
#> GSM99510     1   0.224     0.9201 0.964 0.036
#> GSM99512     1   0.184     0.9257 0.972 0.028
#> GSM99514     1   0.000     0.9445 1.000 0.000
#> GSM99516     1   0.000     0.9445 1.000 0.000
#> GSM99518     1   0.000     0.9445 1.000 0.000
#> GSM99520     1   0.000     0.9445 1.000 0.000
#> GSM99522     1   0.000     0.9445 1.000 0.000
#> GSM99570     1   0.000     0.9445 1.000 0.000
#> GSM99598     1   0.000     0.9445 1.000 0.000
#> GSM99432     2   0.932     0.6216 0.348 0.652
#> GSM99434     1   0.680     0.7553 0.820 0.180
#> GSM99436     2   0.808     0.7490 0.248 0.752
#> GSM99438     2   0.000     0.8340 0.000 1.000
#> GSM99440     1   0.000     0.9445 1.000 0.000
#> GSM99442     2   0.000     0.8340 0.000 1.000
#> GSM99444     2   0.000     0.8340 0.000 1.000
#> GSM99446     2   0.204     0.8303 0.032 0.968
#> GSM99448     2   0.871     0.7058 0.292 0.708
#> GSM99450     1   0.615     0.7936 0.848 0.152
#> GSM99452     1   0.000     0.9445 1.000 0.000
#> GSM99454     1   0.000     0.9445 1.000 0.000
#> GSM99456     1   0.000     0.9445 1.000 0.000
#> GSM99462     2   0.000     0.8340 0.000 1.000
#> GSM99464     1   0.000     0.9445 1.000 0.000
#> GSM99466     2   0.981     0.4697 0.420 0.580
#> GSM99470     1   0.443     0.8710 0.908 0.092
#> GSM99472     1   0.443     0.8710 0.908 0.092
#> GSM99474     1   0.000     0.9445 1.000 0.000
#> GSM99476     1   0.722     0.7247 0.800 0.200
#> GSM99478     2   0.808     0.7375 0.248 0.752
#> GSM99480     1   0.000     0.9445 1.000 0.000
#> GSM99482     1   0.000     0.9445 1.000 0.000
#> GSM99484     2   0.671     0.7856 0.176 0.824
#> GSM99486     2   0.808     0.7490 0.248 0.752
#> GSM99488     2   0.000     0.8340 0.000 1.000
#> GSM99490     2   0.000     0.8340 0.000 1.000
#> GSM99492     1   0.000     0.9445 1.000 0.000
#> GSM99494     2   0.000     0.8340 0.000 1.000
#> GSM99524     1   0.000     0.9445 1.000 0.000
#> GSM99526     1   0.781     0.6655 0.768 0.232
#> GSM99528     2   0.876     0.6784 0.296 0.704
#> GSM99530     1   0.000     0.9445 1.000 0.000
#> GSM99532     1   0.000     0.9445 1.000 0.000
#> GSM99534     2   0.000     0.8340 0.000 1.000
#> GSM99536     1   0.000     0.9445 1.000 0.000
#> GSM99538     2   0.871     0.7058 0.292 0.708
#> GSM99540     1   0.000     0.9445 1.000 0.000
#> GSM99542     2   0.000     0.8340 0.000 1.000
#> GSM99544     2   0.861     0.7144 0.284 0.716
#> GSM99546     1   0.850     0.5699 0.724 0.276
#> GSM99548     2   0.000     0.8340 0.000 1.000
#> GSM99550     1   0.278     0.9106 0.952 0.048
#> GSM99552     1   0.994    -0.0754 0.544 0.456
#> GSM99554     2   0.808     0.7490 0.248 0.752
#> GSM99556     2   0.000     0.8340 0.000 1.000
#> GSM99558     2   0.991     0.4020 0.444 0.556
#> GSM99560     2   0.929     0.6299 0.344 0.656
#> GSM99562     1   0.000     0.9445 1.000 0.000
#> GSM99564     2   0.808     0.7490 0.248 0.752
#> GSM99572     2   0.000     0.8340 0.000 1.000
#> GSM99576     1   0.430     0.8747 0.912 0.088
#> GSM99578     2   0.000     0.8340 0.000 1.000
#> GSM99580     1   0.430     0.8723 0.912 0.088
#> GSM99582     1   0.706     0.7376 0.808 0.192
#> GSM99584     2   0.949     0.5850 0.368 0.632
#> GSM99586     1   0.000     0.9445 1.000 0.000
#> GSM99588     2   0.000     0.8340 0.000 1.000
#> GSM99590     2   0.000     0.8340 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
#> GSM99496     3  0.4605     0.7647 0.204 0.000 0.796
#> GSM99502     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99504     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99506     3  0.4605     0.7647 0.204 0.000 0.796
#> GSM99566     3  0.4555     0.7658 0.200 0.000 0.800
#> GSM99574     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99592     3  0.1163     0.7112 0.028 0.000 0.972
#> GSM99594     3  0.4555     0.7658 0.200 0.000 0.800
#> GSM99468     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99498     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99500     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99508     3  0.4605     0.7647 0.204 0.000 0.796
#> GSM99568     3  0.4605     0.7647 0.204 0.000 0.796
#> GSM99596     3  0.4605     0.7647 0.204 0.000 0.796
#> GSM99600     2  0.1289     0.7916 0.000 0.968 0.032
#> GSM99458     3  0.6305     0.2766 0.484 0.000 0.516
#> GSM99460     3  0.6305     0.2766 0.484 0.000 0.516
#> GSM99510     3  0.4062     0.7657 0.164 0.000 0.836
#> GSM99512     3  0.4178     0.7653 0.172 0.000 0.828
#> GSM99514     3  0.4605     0.7647 0.204 0.000 0.796
#> GSM99516     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99518     1  0.2878     0.8286 0.904 0.000 0.096
#> GSM99520     3  0.4555     0.7658 0.200 0.000 0.800
#> GSM99522     3  0.4605     0.7647 0.204 0.000 0.796
#> GSM99570     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99598     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99432     2  0.6309     0.3556 0.000 0.504 0.496
#> GSM99434     3  0.0892     0.7041 0.020 0.000 0.980
#> GSM99436     2  0.6095     0.5624 0.000 0.608 0.392
#> GSM99438     2  0.0237     0.7997 0.000 0.996 0.004
#> GSM99440     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99442     2  0.0237     0.7997 0.000 0.996 0.004
#> GSM99444     2  0.0237     0.7997 0.000 0.996 0.004
#> GSM99446     2  0.1411     0.7909 0.000 0.964 0.036
#> GSM99448     2  0.6295     0.4515 0.000 0.528 0.472
#> GSM99450     3  0.1860     0.7242 0.052 0.000 0.948
#> GSM99452     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99454     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99456     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99462     2  0.0237     0.7997 0.000 0.996 0.004
#> GSM99464     3  0.6286     0.3300 0.464 0.000 0.536
#> GSM99466     3  0.6062    -0.1165 0.000 0.384 0.616
#> GSM99470     1  0.6295     0.6584 0.728 0.036 0.236
#> GSM99472     1  0.6295     0.6584 0.728 0.036 0.236
#> GSM99474     3  0.4555     0.7658 0.200 0.000 0.800
#> GSM99476     3  0.1781     0.6936 0.020 0.020 0.960
#> GSM99478     2  0.6244     0.5024 0.000 0.560 0.440
#> GSM99480     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99482     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99484     2  0.5926     0.6111 0.000 0.644 0.356
#> GSM99486     2  0.6095     0.5624 0.000 0.608 0.392
#> GSM99488     2  0.0237     0.7997 0.000 0.996 0.004
#> GSM99490     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM99492     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99494     2  0.0237     0.7997 0.000 0.996 0.004
#> GSM99524     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99526     3  0.3649     0.6708 0.036 0.068 0.896
#> GSM99528     2  0.6308     0.3927 0.000 0.508 0.492
#> GSM99530     1  0.6215     0.1236 0.572 0.000 0.428
#> GSM99532     3  0.4654     0.7613 0.208 0.000 0.792
#> GSM99534     2  0.1411     0.7921 0.000 0.964 0.036
#> GSM99536     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99538     2  0.6295     0.4515 0.000 0.528 0.472
#> GSM99540     1  0.3267     0.8023 0.884 0.000 0.116
#> GSM99542     2  0.1031     0.7932 0.000 0.976 0.024
#> GSM99544     2  0.6215     0.5037 0.000 0.572 0.428
#> GSM99546     3  0.4371     0.6213 0.032 0.108 0.860
#> GSM99548     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM99550     1  0.5318     0.7091 0.780 0.016 0.204
#> GSM99552     3  0.5480     0.2804 0.004 0.264 0.732
#> GSM99554     2  0.6095     0.5624 0.000 0.608 0.392
#> GSM99556     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM99558     3  0.6247    -0.0538 0.004 0.376 0.620
#> GSM99560     3  0.6291    -0.3550 0.000 0.468 0.532
#> GSM99562     3  0.4605     0.7647 0.204 0.000 0.796
#> GSM99564     2  0.6095     0.5624 0.000 0.608 0.392
#> GSM99572     2  0.0237     0.7997 0.000 0.996 0.004
#> GSM99576     1  0.6183     0.6632 0.732 0.032 0.236
#> GSM99578     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM99580     3  0.3500     0.7598 0.116 0.004 0.880
#> GSM99582     3  0.2050     0.7002 0.028 0.020 0.952
#> GSM99584     3  0.6305    -0.3485 0.000 0.484 0.516
#> GSM99586     1  0.0000     0.9212 1.000 0.000 0.000
#> GSM99588     2  0.0237     0.7999 0.000 0.996 0.004
#> GSM99590     2  0.0237     0.7997 0.000 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0592     0.7887 0.016 0.000 0.984 0.000
#> GSM99502     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0592     0.7887 0.016 0.000 0.984 0.000
#> GSM99566     3  0.0469     0.7884 0.012 0.000 0.988 0.000
#> GSM99574     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99592     3  0.4967     0.1992 0.000 0.000 0.548 0.452
#> GSM99594     3  0.1174     0.7892 0.012 0.000 0.968 0.020
#> GSM99468     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99508     3  0.1297     0.7903 0.016 0.000 0.964 0.020
#> GSM99568     3  0.1297     0.7903 0.016 0.000 0.964 0.020
#> GSM99596     3  0.1297     0.7903 0.016 0.000 0.964 0.020
#> GSM99600     2  0.2011     0.9180 0.000 0.920 0.000 0.080
#> GSM99458     3  0.5536     0.3443 0.384 0.000 0.592 0.024
#> GSM99460     3  0.5536     0.3443 0.384 0.000 0.592 0.024
#> GSM99510     3  0.2408     0.7444 0.000 0.000 0.896 0.104
#> GSM99512     3  0.1716     0.7715 0.000 0.000 0.936 0.064
#> GSM99514     3  0.0592     0.7887 0.016 0.000 0.984 0.000
#> GSM99516     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99518     1  0.2530     0.8472 0.896 0.000 0.100 0.004
#> GSM99520     3  0.1854     0.7813 0.012 0.000 0.940 0.048
#> GSM99522     3  0.0592     0.7887 0.016 0.000 0.984 0.000
#> GSM99570     1  0.2363     0.8960 0.920 0.000 0.024 0.056
#> GSM99598     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99432     4  0.5833     0.6950 0.000 0.212 0.096 0.692
#> GSM99434     3  0.5000     0.0779 0.000 0.000 0.504 0.496
#> GSM99436     4  0.4477     0.6248 0.000 0.312 0.000 0.688
#> GSM99438     2  0.0000     0.9396 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0000     0.9396 0.000 1.000 0.000 0.000
#> GSM99444     2  0.0000     0.9396 0.000 1.000 0.000 0.000
#> GSM99446     2  0.3074     0.8413 0.000 0.848 0.000 0.152
#> GSM99448     4  0.4399     0.6892 0.000 0.224 0.016 0.760
#> GSM99450     3  0.5353     0.2044 0.012 0.000 0.556 0.432
#> GSM99452     1  0.2363     0.8960 0.920 0.000 0.024 0.056
#> GSM99454     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99456     1  0.1938     0.8982 0.936 0.000 0.012 0.052
#> GSM99462     2  0.0000     0.9396 0.000 1.000 0.000 0.000
#> GSM99464     3  0.5452     0.4020 0.360 0.000 0.616 0.024
#> GSM99466     4  0.4163     0.6985 0.000 0.096 0.076 0.828
#> GSM99470     1  0.6368     0.6517 0.648 0.004 0.104 0.244
#> GSM99472     1  0.6368     0.6517 0.648 0.004 0.104 0.244
#> GSM99474     3  0.1854     0.7813 0.012 0.000 0.940 0.048
#> GSM99476     4  0.4916     0.0815 0.000 0.000 0.424 0.576
#> GSM99478     4  0.5085     0.6394 0.000 0.260 0.032 0.708
#> GSM99480     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99482     1  0.2363     0.8960 0.920 0.000 0.024 0.056
#> GSM99484     4  0.5055     0.5266 0.000 0.368 0.008 0.624
#> GSM99486     4  0.4477     0.6248 0.000 0.312 0.000 0.688
#> GSM99488     2  0.0000     0.9396 0.000 1.000 0.000 0.000
#> GSM99490     2  0.2081     0.9202 0.000 0.916 0.000 0.084
#> GSM99492     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99494     2  0.0000     0.9396 0.000 1.000 0.000 0.000
#> GSM99524     1  0.2363     0.8960 0.920 0.000 0.024 0.056
#> GSM99526     4  0.4981    -0.0242 0.000 0.000 0.464 0.536
#> GSM99528     4  0.4994     0.6512 0.000 0.208 0.048 0.744
#> GSM99530     3  0.6262     0.2334 0.400 0.000 0.540 0.060
#> GSM99532     3  0.2089     0.7815 0.020 0.000 0.932 0.048
#> GSM99534     2  0.3377     0.8635 0.000 0.848 0.012 0.140
#> GSM99536     1  0.0000     0.9199 1.000 0.000 0.000 0.000
#> GSM99538     4  0.4399     0.6892 0.000 0.224 0.016 0.760
#> GSM99540     1  0.2831     0.8248 0.876 0.000 0.120 0.004
#> GSM99542     2  0.2741     0.9081 0.000 0.892 0.012 0.096
#> GSM99544     4  0.4776     0.6634 0.000 0.272 0.016 0.712
#> GSM99546     4  0.5070     0.1314 0.000 0.004 0.416 0.580
#> GSM99548     2  0.1302     0.9366 0.000 0.956 0.000 0.044
#> GSM99550     1  0.6031     0.6745 0.676 0.000 0.108 0.216
#> GSM99552     4  0.4584     0.4433 0.000 0.004 0.300 0.696
#> GSM99554     4  0.4477     0.6248 0.000 0.312 0.000 0.688
#> GSM99556     2  0.1302     0.9367 0.000 0.956 0.000 0.044
#> GSM99558     4  0.6501     0.5673 0.000 0.116 0.268 0.616
#> GSM99560     4  0.3625     0.6972 0.000 0.160 0.012 0.828
#> GSM99562     3  0.0592     0.7887 0.016 0.000 0.984 0.000
#> GSM99564     4  0.4477     0.6248 0.000 0.312 0.000 0.688
#> GSM99572     2  0.0000     0.9396 0.000 1.000 0.000 0.000
#> GSM99576     1  0.6192     0.6556 0.652 0.000 0.104 0.244
#> GSM99578     2  0.2081     0.9202 0.000 0.916 0.000 0.084
#> GSM99580     3  0.4770     0.5103 0.012 0.000 0.700 0.288
#> GSM99582     4  0.5105     0.0537 0.004 0.000 0.432 0.564
#> GSM99584     4  0.5820     0.6968 0.000 0.192 0.108 0.700
#> GSM99586     1  0.1938     0.8982 0.936 0.000 0.012 0.052
#> GSM99588     2  0.2011     0.9218 0.000 0.920 0.000 0.080
#> GSM99590     2  0.0000     0.9396 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0703     0.7865 0.000 0.000 0.976 0.000 0.024
#> GSM99502     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0703     0.7865 0.000 0.000 0.976 0.000 0.024
#> GSM99566     3  0.0865     0.7872 0.000 0.000 0.972 0.004 0.024
#> GSM99574     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.5794     0.1734 0.000 0.000 0.520 0.384 0.096
#> GSM99594     3  0.0324     0.7883 0.000 0.000 0.992 0.004 0.004
#> GSM99468     1  0.0404     0.7703 0.988 0.000 0.000 0.000 0.012
#> GSM99498     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0000     0.7888 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0162     0.7886 0.000 0.000 0.996 0.000 0.004
#> GSM99596     3  0.0162     0.7885 0.000 0.000 0.996 0.000 0.004
#> GSM99600     2  0.2280     0.8801 0.000 0.880 0.000 0.120 0.000
#> GSM99458     3  0.6294     0.2614 0.160 0.000 0.532 0.004 0.304
#> GSM99460     3  0.6294     0.2614 0.160 0.000 0.532 0.004 0.304
#> GSM99510     3  0.3110     0.7272 0.000 0.000 0.860 0.080 0.060
#> GSM99512     3  0.2193     0.7628 0.000 0.000 0.912 0.028 0.060
#> GSM99514     3  0.0703     0.7865 0.000 0.000 0.976 0.000 0.024
#> GSM99516     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.3291     0.6139 0.848 0.000 0.088 0.000 0.064
#> GSM99520     3  0.1195     0.7814 0.000 0.000 0.960 0.028 0.012
#> GSM99522     3  0.1197     0.7820 0.000 0.000 0.952 0.000 0.048
#> GSM99570     1  0.4161     0.0930 0.608 0.000 0.000 0.000 0.392
#> GSM99598     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.4974     0.6967 0.000 0.116 0.092 0.756 0.036
#> GSM99434     3  0.5931     0.0161 0.000 0.000 0.460 0.436 0.104
#> GSM99436     4  0.3695     0.6569 0.000 0.164 0.000 0.800 0.036
#> GSM99438     2  0.0000     0.9048 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.0000     0.9048 0.000 1.000 0.000 0.000 0.000
#> GSM99444     2  0.0000     0.9048 0.000 1.000 0.000 0.000 0.000
#> GSM99446     2  0.3274     0.7925 0.000 0.780 0.000 0.220 0.000
#> GSM99448     4  0.2754     0.6991 0.000 0.080 0.000 0.880 0.040
#> GSM99450     3  0.5484     0.1690 0.000 0.000 0.540 0.392 0.068
#> GSM99452     1  0.4161     0.0930 0.608 0.000 0.000 0.000 0.392
#> GSM99454     1  0.0510     0.7674 0.984 0.000 0.000 0.000 0.016
#> GSM99456     1  0.4306     0.0239 0.508 0.000 0.000 0.000 0.492
#> GSM99462     2  0.0000     0.9048 0.000 1.000 0.000 0.000 0.000
#> GSM99464     3  0.6187     0.3188 0.156 0.000 0.556 0.004 0.284
#> GSM99466     4  0.3040     0.6727 0.000 0.012 0.068 0.876 0.044
#> GSM99470     5  0.5939     0.7937 0.320 0.000 0.032 0.060 0.588
#> GSM99472     5  0.5939     0.7937 0.320 0.000 0.032 0.060 0.588
#> GSM99474     3  0.1195     0.7814 0.000 0.000 0.960 0.028 0.012
#> GSM99476     4  0.5808     0.1210 0.000 0.000 0.392 0.512 0.096
#> GSM99478     4  0.3948     0.6555 0.000 0.128 0.008 0.808 0.056
#> GSM99480     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99482     1  0.4201     0.0365 0.592 0.000 0.000 0.000 0.408
#> GSM99484     4  0.4453     0.5787 0.000 0.228 0.000 0.724 0.048
#> GSM99486     4  0.3695     0.6569 0.000 0.164 0.000 0.800 0.036
#> GSM99488     2  0.0000     0.9048 0.000 1.000 0.000 0.000 0.000
#> GSM99490     2  0.3123     0.8584 0.000 0.828 0.000 0.160 0.012
#> GSM99492     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99494     2  0.0000     0.9048 0.000 1.000 0.000 0.000 0.000
#> GSM99524     1  0.4182     0.0657 0.600 0.000 0.000 0.000 0.400
#> GSM99526     4  0.5959     0.0252 0.000 0.000 0.420 0.472 0.108
#> GSM99528     4  0.4568     0.6401 0.000 0.116 0.024 0.780 0.080
#> GSM99530     3  0.6215     0.2730 0.152 0.000 0.500 0.000 0.348
#> GSM99532     3  0.1569     0.7802 0.008 0.000 0.948 0.032 0.012
#> GSM99534     2  0.4161     0.7991 0.000 0.752 0.000 0.208 0.040
#> GSM99536     1  0.0000     0.7781 1.000 0.000 0.000 0.000 0.000
#> GSM99538     4  0.2754     0.6991 0.000 0.080 0.000 0.880 0.040
#> GSM99540     1  0.3727     0.5782 0.824 0.000 0.104 0.004 0.068
#> GSM99542     2  0.3565     0.8589 0.000 0.816 0.000 0.144 0.040
#> GSM99544     4  0.3262     0.6828 0.000 0.124 0.000 0.840 0.036
#> GSM99546     4  0.5861     0.1706 0.000 0.000 0.376 0.520 0.104
#> GSM99548     2  0.1732     0.8981 0.000 0.920 0.000 0.080 0.000
#> GSM99550     5  0.5047     0.4457 0.216 0.000 0.036 0.036 0.712
#> GSM99552     4  0.5218     0.4514 0.000 0.000 0.296 0.632 0.072
#> GSM99554     4  0.3695     0.6569 0.000 0.164 0.000 0.800 0.036
#> GSM99556     2  0.1732     0.8982 0.000 0.920 0.000 0.080 0.000
#> GSM99558     4  0.6065     0.5530 0.000 0.068 0.276 0.612 0.044
#> GSM99560     4  0.3457     0.6823 0.000 0.048 0.016 0.852 0.084
#> GSM99562     3  0.1197     0.7820 0.000 0.000 0.952 0.000 0.048
#> GSM99564     4  0.3695     0.6569 0.000 0.164 0.000 0.800 0.036
#> GSM99572     2  0.0000     0.9048 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.5896     0.7888 0.324 0.000 0.032 0.056 0.588
#> GSM99578     2  0.3123     0.8584 0.000 0.828 0.000 0.160 0.012
#> GSM99580     3  0.4678     0.5180 0.000 0.000 0.712 0.224 0.064
#> GSM99582     4  0.5934     0.1084 0.000 0.000 0.396 0.496 0.108
#> GSM99584     4  0.5007     0.6905 0.000 0.100 0.104 0.756 0.040
#> GSM99586     1  0.4306     0.0239 0.508 0.000 0.000 0.000 0.492
#> GSM99588     2  0.2953     0.8671 0.000 0.844 0.000 0.144 0.012
#> GSM99590     2  0.0000     0.9048 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0146     0.7322 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99502     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0146     0.7322 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99566     3  0.0632     0.7330 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM99574     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     6  0.5052     0.6925 0.000 0.000 0.308 0.088 0.004 0.600
#> GSM99594     3  0.1387     0.7246 0.000 0.000 0.932 0.000 0.000 0.068
#> GSM99468     1  0.0458     0.8072 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM99498     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.1411     0.7296 0.000 0.000 0.936 0.000 0.004 0.060
#> GSM99568     3  0.1701     0.7297 0.000 0.000 0.920 0.000 0.008 0.072
#> GSM99596     3  0.1075     0.7294 0.000 0.000 0.952 0.000 0.000 0.048
#> GSM99600     2  0.3319     0.8181 0.000 0.800 0.000 0.164 0.000 0.036
#> GSM99458     3  0.6815     0.2196 0.064 0.000 0.452 0.000 0.252 0.232
#> GSM99460     3  0.6815     0.2196 0.064 0.000 0.452 0.000 0.252 0.232
#> GSM99510     3  0.4582     0.4953 0.000 0.000 0.672 0.024 0.032 0.272
#> GSM99512     3  0.3957     0.6076 0.000 0.000 0.752 0.012 0.036 0.200
#> GSM99514     3  0.0146     0.7322 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99516     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.3410     0.6212 0.836 0.000 0.076 0.000 0.064 0.024
#> GSM99520     3  0.1918     0.7105 0.000 0.000 0.904 0.008 0.000 0.088
#> GSM99522     3  0.2309     0.6991 0.000 0.000 0.888 0.000 0.028 0.084
#> GSM99570     1  0.3810     0.1181 0.572 0.000 0.000 0.000 0.428 0.000
#> GSM99598     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.4264     0.5470 0.000 0.028 0.004 0.680 0.004 0.284
#> GSM99434     6  0.4825     0.7477 0.000 0.000 0.216 0.100 0.008 0.676
#> GSM99436     4  0.1141     0.7208 0.000 0.052 0.000 0.948 0.000 0.000
#> GSM99438     2  0.0547     0.8554 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM99440     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.0000     0.8552 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99444     2  0.0000     0.8552 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     2  0.4165     0.6932 0.000 0.672 0.000 0.292 0.000 0.036
#> GSM99448     4  0.0937     0.7138 0.000 0.000 0.000 0.960 0.000 0.040
#> GSM99450     6  0.5042     0.6539 0.000 0.000 0.332 0.092 0.000 0.576
#> GSM99452     1  0.3810     0.1181 0.572 0.000 0.000 0.000 0.428 0.000
#> GSM99454     1  0.0632     0.8005 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM99456     5  0.5617     0.3528 0.388 0.000 0.000 0.000 0.464 0.148
#> GSM99462     2  0.0000     0.8552 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     3  0.6729     0.2575 0.060 0.000 0.468 0.000 0.232 0.240
#> GSM99466     4  0.4196     0.4604 0.000 0.000 0.028 0.640 0.000 0.332
#> GSM99470     5  0.6020     0.5336 0.288 0.000 0.016 0.012 0.548 0.136
#> GSM99472     5  0.6020     0.5336 0.288 0.000 0.016 0.012 0.548 0.136
#> GSM99474     3  0.1918     0.7105 0.000 0.000 0.904 0.008 0.000 0.088
#> GSM99476     6  0.5532     0.7214 0.000 0.000 0.212 0.204 0.004 0.580
#> GSM99478     4  0.5447     0.5461 0.000 0.048 0.008 0.596 0.036 0.312
#> GSM99480     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99482     1  0.3833     0.0688 0.556 0.000 0.000 0.000 0.444 0.000
#> GSM99484     4  0.5598     0.5509 0.000 0.116 0.000 0.612 0.032 0.240
#> GSM99486     4  0.1141     0.7208 0.000 0.052 0.000 0.948 0.000 0.000
#> GSM99488     2  0.0000     0.8552 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     2  0.4738     0.7731 0.000 0.712 0.000 0.188 0.032 0.068
#> GSM99492     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99494     2  0.0000     0.8552 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.3823     0.0905 0.564 0.000 0.000 0.000 0.436 0.000
#> GSM99526     6  0.5839     0.6888 0.000 0.000 0.208 0.200 0.020 0.572
#> GSM99528     4  0.5598     0.4763 0.000 0.048 0.008 0.544 0.036 0.364
#> GSM99530     3  0.6282     0.1610 0.080 0.000 0.436 0.000 0.408 0.076
#> GSM99532     3  0.2256     0.7109 0.004 0.000 0.892 0.008 0.004 0.092
#> GSM99534     2  0.5583     0.6986 0.000 0.624 0.000 0.236 0.048 0.092
#> GSM99536     1  0.0000     0.8186 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99538     4  0.0937     0.7138 0.000 0.000 0.000 0.960 0.000 0.040
#> GSM99540     1  0.3748     0.5808 0.812 0.000 0.092 0.000 0.068 0.028
#> GSM99542     2  0.5068     0.7718 0.000 0.700 0.000 0.160 0.048 0.092
#> GSM99544     4  0.1418     0.7203 0.000 0.032 0.000 0.944 0.000 0.024
#> GSM99546     6  0.5895     0.6418 0.000 0.000 0.176 0.248 0.020 0.556
#> GSM99548     2  0.1958     0.8466 0.000 0.896 0.000 0.100 0.000 0.004
#> GSM99550     5  0.5207     0.4200 0.092 0.000 0.020 0.000 0.636 0.252
#> GSM99552     6  0.6042     0.0628 0.000 0.000 0.208 0.388 0.004 0.400
#> GSM99554     4  0.1141     0.7208 0.000 0.052 0.000 0.948 0.000 0.000
#> GSM99556     2  0.2889     0.8415 0.000 0.848 0.000 0.108 0.000 0.044
#> GSM99558     4  0.5743     0.1160 0.000 0.000 0.204 0.504 0.000 0.292
#> GSM99560     4  0.3614     0.6113 0.000 0.000 0.000 0.752 0.028 0.220
#> GSM99562     3  0.2309     0.6991 0.000 0.000 0.888 0.000 0.028 0.084
#> GSM99564     4  0.1141     0.7208 0.000 0.052 0.000 0.948 0.000 0.000
#> GSM99572     2  0.0547     0.8554 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM99576     5  0.5945     0.5291 0.292 0.000 0.016 0.008 0.548 0.136
#> GSM99578     2  0.4738     0.7731 0.000 0.712 0.000 0.188 0.032 0.068
#> GSM99580     3  0.4567     0.1068 0.000 0.000 0.616 0.052 0.000 0.332
#> GSM99582     6  0.6110     0.7257 0.000 0.000 0.220 0.200 0.032 0.548
#> GSM99584     4  0.4467     0.4816 0.000 0.028 0.004 0.632 0.004 0.332
#> GSM99586     5  0.5617     0.3528 0.388 0.000 0.000 0.000 0.464 0.148
#> GSM99588     2  0.4624     0.7830 0.000 0.724 0.000 0.180 0.032 0.064
#> GSM99590     2  0.0547     0.8554 0.000 0.980 0.000 0.020 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-hclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-hclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-hclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) cell.type(p) k
#> ATC:hclust 82         7.90e-05     0.000432 2
#> ATC:hclust 72         4.87e-04     0.013337 3
#> ATC:hclust 73         6.08e-06     0.001043 4
#> ATC:hclust 66         1.86e-06     0.000924 5
#> ATC:hclust 67         6.41e-06     0.004149 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-kmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.973       0.989         0.4819 0.514   0.514
#> 3 3 0.969           0.937       0.975         0.3949 0.741   0.530
#> 4 4 0.799           0.786       0.893         0.1114 0.855   0.596
#> 5 5 0.757           0.676       0.837         0.0586 0.931   0.741
#> 6 6 0.739           0.644       0.774         0.0406 0.937   0.735

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
#> GSM99496     1   0.000      0.999 1.000 0.000
#> GSM99502     1   0.000      0.999 1.000 0.000
#> GSM99504     1   0.000      0.999 1.000 0.000
#> GSM99506     1   0.000      0.999 1.000 0.000
#> GSM99566     1   0.000      0.999 1.000 0.000
#> GSM99574     1   0.000      0.999 1.000 0.000
#> GSM99592     1   0.000      0.999 1.000 0.000
#> GSM99594     1   0.000      0.999 1.000 0.000
#> GSM99468     1   0.000      0.999 1.000 0.000
#> GSM99498     1   0.000      0.999 1.000 0.000
#> GSM99500     1   0.000      0.999 1.000 0.000
#> GSM99508     1   0.000      0.999 1.000 0.000
#> GSM99568     1   0.000      0.999 1.000 0.000
#> GSM99596     1   0.000      0.999 1.000 0.000
#> GSM99600     2   0.000      0.973 0.000 1.000
#> GSM99458     1   0.000      0.999 1.000 0.000
#> GSM99460     1   0.000      0.999 1.000 0.000
#> GSM99510     1   0.000      0.999 1.000 0.000
#> GSM99512     1   0.000      0.999 1.000 0.000
#> GSM99514     1   0.000      0.999 1.000 0.000
#> GSM99516     1   0.000      0.999 1.000 0.000
#> GSM99518     1   0.000      0.999 1.000 0.000
#> GSM99520     1   0.000      0.999 1.000 0.000
#> GSM99522     1   0.000      0.999 1.000 0.000
#> GSM99570     1   0.000      0.999 1.000 0.000
#> GSM99598     1   0.000      0.999 1.000 0.000
#> GSM99432     2   0.000      0.973 0.000 1.000
#> GSM99434     1   0.000      0.999 1.000 0.000
#> GSM99436     2   0.000      0.973 0.000 1.000
#> GSM99438     2   0.000      0.973 0.000 1.000
#> GSM99440     1   0.000      0.999 1.000 0.000
#> GSM99442     2   0.000      0.973 0.000 1.000
#> GSM99444     2   0.000      0.973 0.000 1.000
#> GSM99446     2   0.000      0.973 0.000 1.000
#> GSM99448     2   0.000      0.973 0.000 1.000
#> GSM99450     1   0.000      0.999 1.000 0.000
#> GSM99452     1   0.000      0.999 1.000 0.000
#> GSM99454     1   0.000      0.999 1.000 0.000
#> GSM99456     1   0.000      0.999 1.000 0.000
#> GSM99462     2   0.000      0.973 0.000 1.000
#> GSM99464     1   0.000      0.999 1.000 0.000
#> GSM99466     2   0.000      0.973 0.000 1.000
#> GSM99470     1   0.000      0.999 1.000 0.000
#> GSM99472     1   0.000      0.999 1.000 0.000
#> GSM99474     1   0.000      0.999 1.000 0.000
#> GSM99476     2   0.821      0.663 0.256 0.744
#> GSM99478     2   0.000      0.973 0.000 1.000
#> GSM99480     1   0.000      0.999 1.000 0.000
#> GSM99482     1   0.000      0.999 1.000 0.000
#> GSM99484     2   0.000      0.973 0.000 1.000
#> GSM99486     2   0.000      0.973 0.000 1.000
#> GSM99488     2   0.000      0.973 0.000 1.000
#> GSM99490     2   0.000      0.973 0.000 1.000
#> GSM99492     1   0.000      0.999 1.000 0.000
#> GSM99494     2   0.000      0.973 0.000 1.000
#> GSM99524     1   0.000      0.999 1.000 0.000
#> GSM99526     1   0.000      0.999 1.000 0.000
#> GSM99528     2   0.991      0.223 0.444 0.556
#> GSM99530     1   0.000      0.999 1.000 0.000
#> GSM99532     1   0.000      0.999 1.000 0.000
#> GSM99534     2   0.000      0.973 0.000 1.000
#> GSM99536     1   0.000      0.999 1.000 0.000
#> GSM99538     2   0.000      0.973 0.000 1.000
#> GSM99540     1   0.000      0.999 1.000 0.000
#> GSM99542     2   0.000      0.973 0.000 1.000
#> GSM99544     2   0.000      0.973 0.000 1.000
#> GSM99546     2   0.689      0.773 0.184 0.816
#> GSM99548     2   0.000      0.973 0.000 1.000
#> GSM99550     1   0.000      0.999 1.000 0.000
#> GSM99552     1   0.343      0.929 0.936 0.064
#> GSM99554     2   0.000      0.973 0.000 1.000
#> GSM99556     2   0.000      0.973 0.000 1.000
#> GSM99558     2   0.000      0.973 0.000 1.000
#> GSM99560     2   0.000      0.973 0.000 1.000
#> GSM99562     1   0.000      0.999 1.000 0.000
#> GSM99564     2   0.000      0.973 0.000 1.000
#> GSM99572     2   0.000      0.973 0.000 1.000
#> GSM99576     1   0.000      0.999 1.000 0.000
#> GSM99578     2   0.000      0.973 0.000 1.000
#> GSM99580     1   0.000      0.999 1.000 0.000
#> GSM99582     1   0.000      0.999 1.000 0.000
#> GSM99584     2   0.000      0.973 0.000 1.000
#> GSM99586     1   0.000      0.999 1.000 0.000
#> GSM99588     2   0.000      0.973 0.000 1.000
#> GSM99590     2   0.000      0.973 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM99496     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99506     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99566     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99508     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99568     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99596     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99600     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99514     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99520     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99522     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99570     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99432     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99434     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99436     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99438     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99442     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99444     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99446     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99448     3  0.5859      0.470 0.000 0.344 0.656
#> GSM99450     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99462     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99464     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99466     2  0.0424      0.991 0.000 0.992 0.008
#> GSM99470     3  0.6975      0.382 0.356 0.028 0.616
#> GSM99472     1  0.5397      0.611 0.720 0.000 0.280
#> GSM99474     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99476     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99478     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99480     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99484     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99486     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99488     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99490     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99494     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99526     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99528     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99530     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99532     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99534     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99536     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99538     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99540     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99542     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99544     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99546     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99548     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99550     3  0.5948      0.408 0.360 0.000 0.640
#> GSM99552     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99554     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99556     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99558     3  0.6235      0.235 0.000 0.436 0.564
#> GSM99560     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99562     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99564     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99572     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99576     1  0.5397      0.611 0.720 0.000 0.280
#> GSM99578     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99580     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99582     3  0.0000      0.945 0.000 0.000 1.000
#> GSM99584     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99586     1  0.0000      0.975 1.000 0.000 0.000
#> GSM99588     2  0.0000      1.000 0.000 1.000 0.000
#> GSM99590     2  0.0000      1.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0188    0.95238 0.996 0.000 0.000 0.004
#> GSM99504     1  0.0000    0.95262 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0188    0.95238 0.996 0.000 0.000 0.004
#> GSM99592     3  0.0817    0.96813 0.000 0.000 0.976 0.024
#> GSM99594     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0336    0.95161 0.992 0.000 0.000 0.008
#> GSM99498     1  0.0000    0.95262 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000    0.95262 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99600     2  0.2921    0.75521 0.000 0.860 0.000 0.140
#> GSM99458     1  0.1940    0.91437 0.924 0.000 0.000 0.076
#> GSM99460     1  0.1940    0.91437 0.924 0.000 0.000 0.076
#> GSM99510     3  0.1022    0.96451 0.000 0.000 0.968 0.032
#> GSM99512     3  0.1022    0.96451 0.000 0.000 0.968 0.032
#> GSM99514     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000    0.95262 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000    0.95262 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0336    0.97499 0.000 0.000 0.992 0.008
#> GSM99570     1  0.0336    0.95223 0.992 0.000 0.000 0.008
#> GSM99598     1  0.0188    0.95238 0.996 0.000 0.000 0.004
#> GSM99432     4  0.3172    0.68427 0.000 0.160 0.000 0.840
#> GSM99434     3  0.3400    0.77610 0.000 0.000 0.820 0.180
#> GSM99436     2  0.4898    0.36537 0.000 0.584 0.000 0.416
#> GSM99438     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0336    0.95223 0.992 0.000 0.000 0.008
#> GSM99442     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99444     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99446     2  0.4843    0.42588 0.000 0.604 0.000 0.396
#> GSM99448     4  0.3307    0.70041 0.000 0.028 0.104 0.868
#> GSM99450     3  0.0921    0.96592 0.000 0.000 0.972 0.028
#> GSM99452     1  0.0469    0.95122 0.988 0.000 0.000 0.012
#> GSM99454     1  0.0000    0.95262 1.000 0.000 0.000 0.000
#> GSM99456     1  0.1792    0.93228 0.932 0.000 0.000 0.068
#> GSM99462     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99464     3  0.2216    0.91820 0.000 0.000 0.908 0.092
#> GSM99466     4  0.2760    0.69471 0.000 0.128 0.000 0.872
#> GSM99470     4  0.2814    0.67772 0.052 0.008 0.032 0.908
#> GSM99472     1  0.5678    0.25078 0.524 0.000 0.024 0.452
#> GSM99474     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99476     4  0.4761    0.38884 0.000 0.000 0.372 0.628
#> GSM99478     4  0.3172    0.68427 0.000 0.160 0.000 0.840
#> GSM99480     1  0.1302    0.93778 0.956 0.000 0.000 0.044
#> GSM99482     1  0.0921    0.94619 0.972 0.000 0.000 0.028
#> GSM99484     4  0.3172    0.68427 0.000 0.160 0.000 0.840
#> GSM99486     4  0.4843    0.22424 0.000 0.396 0.000 0.604
#> GSM99488     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99490     2  0.4477    0.60527 0.000 0.688 0.000 0.312
#> GSM99492     1  0.1302    0.93778 0.956 0.000 0.000 0.044
#> GSM99494     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0592    0.95033 0.984 0.000 0.000 0.016
#> GSM99526     4  0.4888    0.25582 0.000 0.000 0.412 0.588
#> GSM99528     4  0.2530    0.69434 0.000 0.004 0.100 0.896
#> GSM99530     3  0.1211    0.95051 0.000 0.000 0.960 0.040
#> GSM99532     3  0.0469    0.97115 0.000 0.000 0.988 0.012
#> GSM99534     4  0.4304    0.52065 0.000 0.284 0.000 0.716
#> GSM99536     1  0.0188    0.95238 0.996 0.000 0.000 0.004
#> GSM99538     4  0.3172    0.68427 0.000 0.160 0.000 0.840
#> GSM99540     1  0.0592    0.94889 0.984 0.000 0.000 0.016
#> GSM99542     2  0.1716    0.80118 0.000 0.936 0.000 0.064
#> GSM99544     4  0.4981   -0.00304 0.000 0.464 0.000 0.536
#> GSM99546     4  0.2216    0.69339 0.000 0.000 0.092 0.908
#> GSM99548     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99550     4  0.6655    0.44691 0.192 0.000 0.184 0.624
#> GSM99552     4  0.4072    0.63716 0.000 0.000 0.252 0.748
#> GSM99554     2  0.4431    0.60658 0.000 0.696 0.000 0.304
#> GSM99556     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99558     4  0.3899    0.70306 0.000 0.052 0.108 0.840
#> GSM99560     4  0.2704    0.69535 0.000 0.124 0.000 0.876
#> GSM99562     3  0.0336    0.97499 0.000 0.000 0.992 0.008
#> GSM99564     4  0.5000   -0.14255 0.000 0.500 0.000 0.500
#> GSM99572     2  0.0000    0.82781 0.000 1.000 0.000 0.000
#> GSM99576     1  0.5105    0.63463 0.696 0.000 0.028 0.276
#> GSM99578     2  0.4661    0.54630 0.000 0.652 0.000 0.348
#> GSM99580     3  0.0000    0.97724 0.000 0.000 1.000 0.000
#> GSM99582     4  0.4730    0.43241 0.000 0.000 0.364 0.636
#> GSM99584     4  0.3172    0.68427 0.000 0.160 0.000 0.840
#> GSM99586     1  0.1716    0.93378 0.936 0.000 0.000 0.064
#> GSM99588     2  0.4477    0.60527 0.000 0.688 0.000 0.312
#> GSM99590     2  0.0000    0.82781 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0162     0.9111 0.000 0.000 0.996 0.000 0.004
#> GSM99502     1  0.0451     0.8863 0.988 0.000 0.000 0.008 0.004
#> GSM99504     1  0.0290     0.8872 0.992 0.000 0.000 0.000 0.008
#> GSM99506     3  0.0162     0.9111 0.000 0.000 0.996 0.000 0.004
#> GSM99566     3  0.0162     0.9111 0.000 0.000 0.996 0.000 0.004
#> GSM99574     1  0.0451     0.8863 0.988 0.000 0.000 0.008 0.004
#> GSM99592     3  0.2677     0.8516 0.000 0.000 0.872 0.016 0.112
#> GSM99594     3  0.0162     0.9111 0.000 0.000 0.996 0.000 0.004
#> GSM99468     1  0.1197     0.8803 0.952 0.000 0.000 0.000 0.048
#> GSM99498     1  0.0290     0.8872 0.992 0.000 0.000 0.000 0.008
#> GSM99500     1  0.0290     0.8872 0.992 0.000 0.000 0.000 0.008
#> GSM99508     3  0.0000     0.9109 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0000     0.9109 0.000 0.000 1.000 0.000 0.000
#> GSM99596     3  0.0162     0.9111 0.000 0.000 0.996 0.000 0.004
#> GSM99600     2  0.4147     0.4292 0.000 0.676 0.000 0.316 0.008
#> GSM99458     1  0.4225     0.5719 0.632 0.000 0.000 0.004 0.364
#> GSM99460     1  0.4066     0.6368 0.672 0.000 0.000 0.004 0.324
#> GSM99510     3  0.4489     0.7489 0.000 0.000 0.740 0.068 0.192
#> GSM99512     3  0.4252     0.7721 0.000 0.000 0.764 0.064 0.172
#> GSM99514     3  0.0162     0.9111 0.000 0.000 0.996 0.000 0.004
#> GSM99516     1  0.0000     0.8869 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0290     0.8872 0.992 0.000 0.000 0.000 0.008
#> GSM99520     3  0.0162     0.9111 0.000 0.000 0.996 0.000 0.004
#> GSM99522     3  0.0000     0.9109 0.000 0.000 1.000 0.000 0.000
#> GSM99570     1  0.2012     0.8767 0.920 0.000 0.000 0.020 0.060
#> GSM99598     1  0.0451     0.8863 0.988 0.000 0.000 0.008 0.004
#> GSM99432     4  0.1628     0.6274 0.000 0.056 0.000 0.936 0.008
#> GSM99434     3  0.5185     0.6591 0.000 0.000 0.672 0.100 0.228
#> GSM99436     4  0.4235     0.4492 0.000 0.336 0.000 0.656 0.008
#> GSM99438     2  0.0000     0.8476 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.1549     0.8782 0.944 0.000 0.000 0.016 0.040
#> GSM99442     2  0.0162     0.8464 0.000 0.996 0.000 0.004 0.000
#> GSM99444     2  0.0000     0.8476 0.000 1.000 0.000 0.000 0.000
#> GSM99446     4  0.4046     0.4901 0.000 0.296 0.000 0.696 0.008
#> GSM99448     4  0.2782     0.5418 0.000 0.000 0.048 0.880 0.072
#> GSM99450     3  0.3152     0.8315 0.000 0.000 0.840 0.024 0.136
#> GSM99452     1  0.2953     0.8373 0.844 0.000 0.000 0.012 0.144
#> GSM99454     1  0.0000     0.8869 1.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.4250     0.7603 0.720 0.000 0.000 0.028 0.252
#> GSM99462     2  0.0000     0.8476 0.000 1.000 0.000 0.000 0.000
#> GSM99464     3  0.4442     0.6846 0.000 0.000 0.688 0.028 0.284
#> GSM99466     4  0.3958     0.5488 0.000 0.040 0.000 0.776 0.184
#> GSM99470     5  0.4403     0.3791 0.008 0.000 0.004 0.340 0.648
#> GSM99472     5  0.4001     0.5537 0.208 0.000 0.004 0.024 0.764
#> GSM99474     3  0.1410     0.8863 0.000 0.000 0.940 0.000 0.060
#> GSM99476     4  0.6538    -0.0421 0.000 0.000 0.272 0.480 0.248
#> GSM99478     4  0.4096     0.5590 0.000 0.052 0.000 0.772 0.176
#> GSM99480     1  0.2850     0.8466 0.872 0.000 0.000 0.036 0.092
#> GSM99482     1  0.4371     0.5904 0.644 0.000 0.000 0.012 0.344
#> GSM99484     4  0.4190     0.5684 0.000 0.060 0.000 0.768 0.172
#> GSM99486     4  0.2561     0.6302 0.000 0.144 0.000 0.856 0.000
#> GSM99488     2  0.0162     0.8468 0.000 0.996 0.000 0.000 0.004
#> GSM99490     2  0.5238    -0.0244 0.000 0.484 0.000 0.472 0.044
#> GSM99492     1  0.2850     0.8466 0.872 0.000 0.000 0.036 0.092
#> GSM99494     2  0.0162     0.8468 0.000 0.996 0.000 0.000 0.004
#> GSM99524     1  0.3333     0.7673 0.788 0.000 0.000 0.004 0.208
#> GSM99526     4  0.6685    -0.1576 0.000 0.000 0.244 0.416 0.340
#> GSM99528     5  0.4748     0.0577 0.000 0.000 0.016 0.492 0.492
#> GSM99530     3  0.2719     0.8040 0.000 0.000 0.852 0.004 0.144
#> GSM99532     3  0.0955     0.8995 0.000 0.000 0.968 0.004 0.028
#> GSM99534     4  0.6053     0.4507 0.000 0.196 0.000 0.576 0.228
#> GSM99536     1  0.0451     0.8863 0.988 0.000 0.000 0.008 0.004
#> GSM99538     4  0.1872     0.6269 0.000 0.052 0.000 0.928 0.020
#> GSM99540     1  0.2389     0.8402 0.880 0.000 0.000 0.004 0.116
#> GSM99542     2  0.3732     0.6612 0.000 0.792 0.000 0.176 0.032
#> GSM99544     4  0.2813     0.6231 0.000 0.168 0.000 0.832 0.000
#> GSM99546     4  0.4846     0.0440 0.000 0.000 0.028 0.588 0.384
#> GSM99548     2  0.0404     0.8450 0.000 0.988 0.000 0.000 0.012
#> GSM99550     5  0.2152     0.5807 0.032 0.000 0.004 0.044 0.920
#> GSM99552     4  0.6536    -0.2578 0.000 0.000 0.196 0.408 0.396
#> GSM99554     4  0.4517     0.2020 0.000 0.436 0.000 0.556 0.008
#> GSM99556     2  0.0404     0.8450 0.000 0.988 0.000 0.000 0.012
#> GSM99558     4  0.2696     0.5978 0.000 0.012 0.040 0.896 0.052
#> GSM99560     4  0.3565     0.5799 0.000 0.040 0.000 0.816 0.144
#> GSM99562     3  0.0000     0.9109 0.000 0.000 1.000 0.000 0.000
#> GSM99564     4  0.3752     0.5299 0.000 0.292 0.000 0.708 0.000
#> GSM99572     2  0.0000     0.8476 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.3643     0.5197 0.212 0.000 0.004 0.008 0.776
#> GSM99578     4  0.6144     0.2793 0.000 0.344 0.000 0.512 0.144
#> GSM99580     3  0.1697     0.8821 0.000 0.000 0.932 0.008 0.060
#> GSM99582     5  0.6131     0.3369 0.000 0.000 0.208 0.228 0.564
#> GSM99584     4  0.1341     0.6287 0.000 0.056 0.000 0.944 0.000
#> GSM99586     1  0.3897     0.7987 0.768 0.000 0.000 0.028 0.204
#> GSM99588     2  0.5115    -0.0271 0.000 0.484 0.000 0.480 0.036
#> GSM99590     2  0.0000     0.8476 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0000      0.837 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99502     1  0.0858      0.811 0.968 0.000 0.000 0.000 0.004 0.028
#> GSM99504     1  0.1367      0.809 0.944 0.000 0.000 0.000 0.012 0.044
#> GSM99506     3  0.0000      0.837 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99566     3  0.0000      0.837 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99574     1  0.0858      0.811 0.968 0.000 0.000 0.000 0.004 0.028
#> GSM99592     3  0.3728      0.217 0.000 0.000 0.652 0.000 0.004 0.344
#> GSM99594     3  0.0000      0.837 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99468     1  0.2724      0.793 0.864 0.000 0.000 0.000 0.084 0.052
#> GSM99498     1  0.1367      0.809 0.944 0.000 0.000 0.000 0.012 0.044
#> GSM99500     1  0.1367      0.809 0.944 0.000 0.000 0.000 0.012 0.044
#> GSM99508     3  0.0000      0.837 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99568     3  0.0146      0.836 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM99596     3  0.0000      0.837 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99600     4  0.4461      0.311 0.000 0.404 0.000 0.564 0.000 0.032
#> GSM99458     1  0.5896      0.335 0.444 0.000 0.000 0.000 0.344 0.212
#> GSM99460     1  0.5854      0.383 0.468 0.000 0.000 0.000 0.320 0.212
#> GSM99510     6  0.4408      0.225 0.000 0.000 0.468 0.008 0.012 0.512
#> GSM99512     3  0.4413     -0.308 0.000 0.000 0.496 0.008 0.012 0.484
#> GSM99514     3  0.0000      0.837 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99516     1  0.0603      0.812 0.980 0.000 0.000 0.000 0.004 0.016
#> GSM99518     1  0.1434      0.808 0.940 0.000 0.000 0.000 0.012 0.048
#> GSM99520     3  0.0291      0.834 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM99522     3  0.0692      0.827 0.000 0.000 0.976 0.000 0.004 0.020
#> GSM99570     1  0.2679      0.794 0.864 0.000 0.000 0.000 0.096 0.040
#> GSM99598     1  0.1082      0.809 0.956 0.000 0.000 0.000 0.004 0.040
#> GSM99432     4  0.0547      0.685 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM99434     6  0.4601      0.390 0.000 0.000 0.408 0.032 0.004 0.556
#> GSM99436     4  0.2572      0.655 0.000 0.136 0.000 0.852 0.000 0.012
#> GSM99438     2  0.0458      0.960 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM99440     1  0.1845      0.803 0.920 0.000 0.000 0.000 0.028 0.052
#> GSM99442     2  0.0547      0.958 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM99444     2  0.0458      0.960 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM99446     4  0.2066      0.687 0.000 0.072 0.000 0.904 0.000 0.024
#> GSM99448     4  0.4090      0.122 0.000 0.000 0.008 0.604 0.004 0.384
#> GSM99450     3  0.3747      0.047 0.000 0.000 0.604 0.000 0.000 0.396
#> GSM99452     1  0.3529      0.741 0.764 0.000 0.000 0.000 0.208 0.028
#> GSM99454     1  0.0777      0.813 0.972 0.000 0.000 0.000 0.004 0.024
#> GSM99456     1  0.5736      0.631 0.580 0.016 0.000 0.000 0.212 0.192
#> GSM99462     2  0.0458      0.960 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM99464     6  0.5358      0.191 0.000 0.000 0.392 0.000 0.112 0.496
#> GSM99466     4  0.4682      0.487 0.000 0.000 0.000 0.640 0.284 0.076
#> GSM99470     5  0.3602      0.535 0.000 0.000 0.000 0.160 0.784 0.056
#> GSM99472     5  0.2537      0.562 0.096 0.000 0.000 0.000 0.872 0.032
#> GSM99474     3  0.1643      0.781 0.000 0.000 0.924 0.000 0.008 0.068
#> GSM99476     6  0.5743      0.496 0.000 0.000 0.148 0.276 0.016 0.560
#> GSM99478     4  0.4905      0.486 0.000 0.000 0.000 0.620 0.284 0.096
#> GSM99480     1  0.4092      0.733 0.772 0.016 0.000 0.000 0.076 0.136
#> GSM99482     1  0.4399      0.405 0.516 0.000 0.000 0.000 0.460 0.024
#> GSM99484     4  0.4892      0.514 0.000 0.000 0.000 0.628 0.272 0.100
#> GSM99486     4  0.0858      0.693 0.000 0.028 0.000 0.968 0.000 0.004
#> GSM99488     2  0.0603      0.959 0.000 0.980 0.000 0.016 0.000 0.004
#> GSM99490     4  0.6455      0.509 0.000 0.228 0.000 0.548 0.120 0.104
#> GSM99492     1  0.4130      0.730 0.768 0.016 0.000 0.000 0.076 0.140
#> GSM99494     2  0.0603      0.959 0.000 0.980 0.000 0.016 0.000 0.004
#> GSM99524     1  0.4109      0.608 0.648 0.000 0.000 0.000 0.328 0.024
#> GSM99526     6  0.5832      0.450 0.000 0.000 0.084 0.208 0.088 0.620
#> GSM99528     5  0.5807      0.327 0.000 0.000 0.004 0.284 0.516 0.196
#> GSM99530     3  0.4148      0.543 0.000 0.000 0.744 0.000 0.108 0.148
#> GSM99532     3  0.2762      0.713 0.000 0.000 0.860 0.000 0.048 0.092
#> GSM99534     4  0.6050      0.464 0.000 0.056 0.000 0.544 0.300 0.100
#> GSM99536     1  0.1320      0.809 0.948 0.000 0.000 0.000 0.016 0.036
#> GSM99538     4  0.0458      0.688 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM99540     1  0.4392      0.696 0.720 0.000 0.000 0.000 0.136 0.144
#> GSM99542     2  0.5133      0.594 0.000 0.688 0.000 0.180 0.048 0.084
#> GSM99544     4  0.0806      0.690 0.000 0.020 0.000 0.972 0.000 0.008
#> GSM99546     6  0.5074      0.256 0.000 0.000 0.000 0.296 0.108 0.596
#> GSM99548     2  0.1245      0.945 0.000 0.952 0.000 0.016 0.000 0.032
#> GSM99550     5  0.3452      0.479 0.000 0.004 0.000 0.004 0.736 0.256
#> GSM99552     5  0.7174      0.367 0.000 0.000 0.168 0.176 0.456 0.200
#> GSM99554     4  0.3134      0.639 0.000 0.168 0.000 0.808 0.000 0.024
#> GSM99556     2  0.1245      0.945 0.000 0.952 0.000 0.016 0.000 0.032
#> GSM99558     4  0.4118      0.598 0.000 0.000 0.004 0.748 0.172 0.076
#> GSM99560     4  0.3432      0.623 0.000 0.000 0.000 0.800 0.148 0.052
#> GSM99562     3  0.0508      0.831 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM99564     4  0.2191      0.659 0.000 0.120 0.000 0.876 0.000 0.004
#> GSM99572     2  0.0458      0.960 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM99576     5  0.3655      0.501 0.112 0.000 0.000 0.000 0.792 0.096
#> GSM99578     4  0.6630      0.471 0.000 0.124 0.000 0.516 0.252 0.108
#> GSM99580     3  0.2473      0.690 0.000 0.000 0.856 0.000 0.008 0.136
#> GSM99582     5  0.6906      0.301 0.000 0.000 0.120 0.132 0.460 0.288
#> GSM99584     4  0.0363      0.686 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM99586     1  0.5591      0.648 0.604 0.016 0.000 0.000 0.192 0.188
#> GSM99588     4  0.6386      0.534 0.000 0.196 0.000 0.568 0.128 0.108
#> GSM99590     2  0.0458      0.960 0.000 0.984 0.000 0.016 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-kmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-kmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-kmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) cell.type(p) k
#> ATC:kmeans 84         2.54e-05      0.00015 2
#> ATC:kmeans 81         2.02e-04      0.00547 3
#> ATC:kmeans 75         5.12e-05      0.00414 4
#> ATC:kmeans 70         1.04e-04      0.01845 5
#> ATC:kmeans 63         6.22e-05      0.01451 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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-skmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.989       0.995         0.5003 0.500   0.500
#> 3 3 0.999           0.974       0.988         0.3336 0.783   0.587
#> 4 4 0.903           0.882       0.939         0.0767 0.929   0.791
#> 5 5 0.821           0.798       0.898         0.0478 0.975   0.909
#> 6 6 0.790           0.582       0.828         0.0413 0.958   0.843

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
#> GSM99496     1   0.000      0.997 1.000 0.000
#> GSM99502     1   0.000      0.997 1.000 0.000
#> GSM99504     1   0.000      0.997 1.000 0.000
#> GSM99506     1   0.000      0.997 1.000 0.000
#> GSM99566     1   0.000      0.997 1.000 0.000
#> GSM99574     1   0.000      0.997 1.000 0.000
#> GSM99592     1   0.000      0.997 1.000 0.000
#> GSM99594     1   0.000      0.997 1.000 0.000
#> GSM99468     1   0.000      0.997 1.000 0.000
#> GSM99498     1   0.000      0.997 1.000 0.000
#> GSM99500     1   0.000      0.997 1.000 0.000
#> GSM99508     1   0.000      0.997 1.000 0.000
#> GSM99568     1   0.000      0.997 1.000 0.000
#> GSM99596     1   0.000      0.997 1.000 0.000
#> GSM99600     2   0.000      0.993 0.000 1.000
#> GSM99458     1   0.000      0.997 1.000 0.000
#> GSM99460     1   0.000      0.997 1.000 0.000
#> GSM99510     1   0.000      0.997 1.000 0.000
#> GSM99512     1   0.563      0.846 0.868 0.132
#> GSM99514     1   0.000      0.997 1.000 0.000
#> GSM99516     1   0.000      0.997 1.000 0.000
#> GSM99518     1   0.000      0.997 1.000 0.000
#> GSM99520     1   0.000      0.997 1.000 0.000
#> GSM99522     1   0.000      0.997 1.000 0.000
#> GSM99570     1   0.000      0.997 1.000 0.000
#> GSM99598     1   0.000      0.997 1.000 0.000
#> GSM99432     2   0.000      0.993 0.000 1.000
#> GSM99434     2   0.844      0.624 0.272 0.728
#> GSM99436     2   0.000      0.993 0.000 1.000
#> GSM99438     2   0.000      0.993 0.000 1.000
#> GSM99440     1   0.000      0.997 1.000 0.000
#> GSM99442     2   0.000      0.993 0.000 1.000
#> GSM99444     2   0.000      0.993 0.000 1.000
#> GSM99446     2   0.000      0.993 0.000 1.000
#> GSM99448     2   0.000      0.993 0.000 1.000
#> GSM99450     1   0.000      0.997 1.000 0.000
#> GSM99452     1   0.000      0.997 1.000 0.000
#> GSM99454     1   0.000      0.997 1.000 0.000
#> GSM99456     1   0.000      0.997 1.000 0.000
#> GSM99462     2   0.000      0.993 0.000 1.000
#> GSM99464     1   0.000      0.997 1.000 0.000
#> GSM99466     2   0.000      0.993 0.000 1.000
#> GSM99470     2   0.000      0.993 0.000 1.000
#> GSM99472     1   0.000      0.997 1.000 0.000
#> GSM99474     1   0.000      0.997 1.000 0.000
#> GSM99476     2   0.000      0.993 0.000 1.000
#> GSM99478     2   0.000      0.993 0.000 1.000
#> GSM99480     1   0.000      0.997 1.000 0.000
#> GSM99482     1   0.000      0.997 1.000 0.000
#> GSM99484     2   0.000      0.993 0.000 1.000
#> GSM99486     2   0.000      0.993 0.000 1.000
#> GSM99488     2   0.000      0.993 0.000 1.000
#> GSM99490     2   0.000      0.993 0.000 1.000
#> GSM99492     1   0.000      0.997 1.000 0.000
#> GSM99494     2   0.000      0.993 0.000 1.000
#> GSM99524     1   0.000      0.997 1.000 0.000
#> GSM99526     2   0.000      0.993 0.000 1.000
#> GSM99528     2   0.000      0.993 0.000 1.000
#> GSM99530     1   0.000      0.997 1.000 0.000
#> GSM99532     1   0.000      0.997 1.000 0.000
#> GSM99534     2   0.000      0.993 0.000 1.000
#> GSM99536     1   0.000      0.997 1.000 0.000
#> GSM99538     2   0.000      0.993 0.000 1.000
#> GSM99540     1   0.000      0.997 1.000 0.000
#> GSM99542     2   0.000      0.993 0.000 1.000
#> GSM99544     2   0.000      0.993 0.000 1.000
#> GSM99546     2   0.000      0.993 0.000 1.000
#> GSM99548     2   0.000      0.993 0.000 1.000
#> GSM99550     1   0.000      0.997 1.000 0.000
#> GSM99552     2   0.000      0.993 0.000 1.000
#> GSM99554     2   0.000      0.993 0.000 1.000
#> GSM99556     2   0.000      0.993 0.000 1.000
#> GSM99558     2   0.000      0.993 0.000 1.000
#> GSM99560     2   0.000      0.993 0.000 1.000
#> GSM99562     1   0.000      0.997 1.000 0.000
#> GSM99564     2   0.000      0.993 0.000 1.000
#> GSM99572     2   0.000      0.993 0.000 1.000
#> GSM99576     1   0.000      0.997 1.000 0.000
#> GSM99578     2   0.000      0.993 0.000 1.000
#> GSM99580     1   0.000      0.997 1.000 0.000
#> GSM99582     1   0.000      0.997 1.000 0.000
#> GSM99584     2   0.000      0.993 0.000 1.000
#> GSM99586     1   0.000      0.997 1.000 0.000
#> GSM99588     2   0.000      0.993 0.000 1.000
#> GSM99590     2   0.000      0.993 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM99496     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99506     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99566     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99508     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99568     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99596     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99600     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99514     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99520     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99522     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99570     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99432     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99434     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99448     2  0.4504      0.755 0.000 0.804 0.196
#> GSM99450     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99464     3  0.0592      0.972 0.012 0.000 0.988
#> GSM99466     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99470     1  0.3879      0.817 0.848 0.152 0.000
#> GSM99472     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99474     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99476     3  0.2448      0.915 0.000 0.076 0.924
#> GSM99478     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99480     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99484     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99486     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99488     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99526     3  0.3752      0.835 0.000 0.144 0.856
#> GSM99528     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99530     3  0.2066      0.934 0.060 0.000 0.940
#> GSM99532     3  0.2878      0.898 0.096 0.000 0.904
#> GSM99534     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99536     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99538     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99540     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99542     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99544     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99546     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99548     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99550     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99552     2  0.5058      0.680 0.000 0.756 0.244
#> GSM99554     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99558     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99560     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99562     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99564     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99572     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99576     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99578     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99580     3  0.0000      0.980 0.000 0.000 1.000
#> GSM99582     3  0.2165      0.929 0.064 0.000 0.936
#> GSM99584     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99586     1  0.0000      0.993 1.000 0.000 0.000
#> GSM99588     2  0.0000      0.986 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.986 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99592     4  0.4866      0.514 0.000 0.000 0.404 0.596
#> GSM99594     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99600     2  0.0188      0.956 0.000 0.996 0.000 0.004
#> GSM99458     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99460     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99510     4  0.3873      0.708 0.000 0.000 0.228 0.772
#> GSM99512     4  0.4994      0.317 0.000 0.000 0.480 0.520
#> GSM99514     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0188      0.919 0.004 0.000 0.996 0.000
#> GSM99570     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99432     2  0.2921      0.886 0.000 0.860 0.000 0.140
#> GSM99434     4  0.3311      0.724 0.000 0.000 0.172 0.828
#> GSM99436     2  0.2589      0.904 0.000 0.884 0.000 0.116
#> GSM99438     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0188      0.956 0.000 0.996 0.000 0.004
#> GSM99444     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99446     2  0.0188      0.956 0.000 0.996 0.000 0.004
#> GSM99448     4  0.5039      0.157 0.000 0.404 0.004 0.592
#> GSM99450     4  0.4406      0.662 0.000 0.000 0.300 0.700
#> GSM99452     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99456     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99462     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99464     4  0.5113      0.680 0.036 0.000 0.252 0.712
#> GSM99466     2  0.2868      0.896 0.000 0.864 0.000 0.136
#> GSM99470     1  0.6179      0.423 0.608 0.320 0.000 0.072
#> GSM99472     1  0.1118      0.954 0.964 0.000 0.000 0.036
#> GSM99474     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99476     4  0.2142      0.717 0.000 0.016 0.056 0.928
#> GSM99478     2  0.0921      0.940 0.000 0.972 0.000 0.028
#> GSM99480     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99482     1  0.1118      0.954 0.964 0.000 0.000 0.036
#> GSM99484     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99486     2  0.2760      0.895 0.000 0.872 0.000 0.128
#> GSM99488     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99490     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99492     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99494     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99526     4  0.2224      0.714 0.000 0.032 0.040 0.928
#> GSM99528     2  0.1118      0.935 0.000 0.964 0.000 0.036
#> GSM99530     3  0.1118      0.880 0.036 0.000 0.964 0.000
#> GSM99532     3  0.1792      0.837 0.068 0.000 0.932 0.000
#> GSM99534     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99536     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99538     2  0.2469      0.910 0.000 0.892 0.000 0.108
#> GSM99540     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99542     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99544     2  0.2814      0.892 0.000 0.868 0.000 0.132
#> GSM99546     4  0.2281      0.676 0.000 0.096 0.000 0.904
#> GSM99548     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99550     1  0.0707      0.965 0.980 0.000 0.000 0.020
#> GSM99552     3  0.5256      0.417 0.000 0.272 0.692 0.036
#> GSM99554     2  0.0188      0.956 0.000 0.996 0.000 0.004
#> GSM99556     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99558     2  0.2081      0.923 0.000 0.916 0.000 0.084
#> GSM99560     2  0.2081      0.923 0.000 0.916 0.000 0.084
#> GSM99562     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99564     2  0.2760      0.895 0.000 0.872 0.000 0.128
#> GSM99572     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99576     1  0.1118      0.954 0.964 0.000 0.000 0.036
#> GSM99578     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99580     3  0.0000      0.923 0.000 0.000 1.000 0.000
#> GSM99582     3  0.5808      0.102 0.032 0.000 0.544 0.424
#> GSM99584     2  0.2921      0.886 0.000 0.860 0.000 0.140
#> GSM99586     1  0.0000      0.978 1.000 0.000 0.000 0.000
#> GSM99588     2  0.0000      0.957 0.000 1.000 0.000 0.000
#> GSM99590     2  0.0000      0.957 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99574     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99592     4  0.4420    0.29837 0.000 0.000 0.448 0.548 0.004
#> GSM99594     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99468     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0290    0.94356 0.000 0.000 0.992 0.008 0.000
#> GSM99596     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99600     2  0.1341    0.88192 0.000 0.944 0.000 0.000 0.056
#> GSM99458     1  0.0162    0.93639 0.996 0.000 0.000 0.000 0.004
#> GSM99460     1  0.0510    0.93323 0.984 0.000 0.000 0.000 0.016
#> GSM99510     4  0.2230    0.67078 0.000 0.000 0.116 0.884 0.000
#> GSM99512     4  0.4341    0.37182 0.000 0.000 0.404 0.592 0.004
#> GSM99514     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99516     1  0.0162    0.93592 0.996 0.000 0.000 0.000 0.004
#> GSM99518     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99520     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0451    0.94123 0.004 0.000 0.988 0.008 0.000
#> GSM99570     1  0.1478    0.90588 0.936 0.000 0.000 0.000 0.064
#> GSM99598     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99432     2  0.3849    0.81130 0.000 0.808 0.000 0.080 0.112
#> GSM99434     4  0.1043    0.67946 0.000 0.000 0.040 0.960 0.000
#> GSM99436     2  0.3339    0.83526 0.000 0.840 0.000 0.048 0.112
#> GSM99438     2  0.0000    0.88880 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99442     2  0.1121    0.88447 0.000 0.956 0.000 0.000 0.044
#> GSM99444     2  0.0000    0.88880 0.000 1.000 0.000 0.000 0.000
#> GSM99446     2  0.1544    0.87922 0.000 0.932 0.000 0.000 0.068
#> GSM99448     4  0.5717   -0.00573 0.000 0.368 0.000 0.540 0.092
#> GSM99450     4  0.3109    0.61977 0.000 0.000 0.200 0.800 0.000
#> GSM99452     1  0.2074    0.87969 0.896 0.000 0.000 0.000 0.104
#> GSM99454     1  0.0000    0.93706 1.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.1197    0.91763 0.952 0.000 0.000 0.000 0.048
#> GSM99462     2  0.0000    0.88880 0.000 1.000 0.000 0.000 0.000
#> GSM99464     4  0.4293    0.61898 0.076 0.000 0.092 0.804 0.028
#> GSM99466     2  0.5010    0.40701 0.000 0.572 0.000 0.036 0.392
#> GSM99470     5  0.3578    0.36856 0.048 0.132 0.000 0.000 0.820
#> GSM99472     1  0.4150    0.55382 0.612 0.000 0.000 0.000 0.388
#> GSM99474     3  0.0000    0.94822 0.000 0.000 1.000 0.000 0.000
#> GSM99476     4  0.0794    0.66219 0.000 0.000 0.000 0.972 0.028
#> GSM99478     2  0.3774    0.48807 0.000 0.704 0.000 0.000 0.296
#> GSM99480     1  0.0404    0.93444 0.988 0.000 0.000 0.000 0.012
#> GSM99482     1  0.3949    0.63872 0.668 0.000 0.000 0.000 0.332
#> GSM99484     2  0.2424    0.78048 0.000 0.868 0.000 0.000 0.132
#> GSM99486     2  0.3409    0.83281 0.000 0.836 0.000 0.052 0.112
#> GSM99488     2  0.0404    0.88650 0.000 0.988 0.000 0.000 0.012
#> GSM99490     2  0.0404    0.88650 0.000 0.988 0.000 0.000 0.012
#> GSM99492     1  0.1121    0.91947 0.956 0.000 0.000 0.000 0.044
#> GSM99494     2  0.0404    0.88650 0.000 0.988 0.000 0.000 0.012
#> GSM99524     1  0.2230    0.87075 0.884 0.000 0.000 0.000 0.116
#> GSM99526     4  0.0000    0.66849 0.000 0.000 0.000 1.000 0.000
#> GSM99528     5  0.4287    0.15061 0.000 0.460 0.000 0.000 0.540
#> GSM99530     3  0.4272    0.59517 0.196 0.000 0.752 0.000 0.052
#> GSM99532     3  0.3209    0.67959 0.180 0.000 0.812 0.008 0.000
#> GSM99534     2  0.0404    0.88650 0.000 0.988 0.000 0.000 0.012
#> GSM99536     1  0.0290    0.93547 0.992 0.000 0.000 0.000 0.008
#> GSM99538     2  0.3237    0.84215 0.000 0.848 0.000 0.048 0.104
#> GSM99540     1  0.0290    0.93547 0.992 0.000 0.000 0.000 0.008
#> GSM99542     2  0.0510    0.88494 0.000 0.984 0.000 0.000 0.016
#> GSM99544     2  0.3543    0.82746 0.000 0.828 0.000 0.060 0.112
#> GSM99546     4  0.2149    0.62368 0.000 0.036 0.000 0.916 0.048
#> GSM99548     2  0.0404    0.88650 0.000 0.988 0.000 0.000 0.012
#> GSM99550     1  0.2329    0.87224 0.876 0.000 0.000 0.000 0.124
#> GSM99552     5  0.6235    0.39830 0.000 0.156 0.344 0.000 0.500
#> GSM99554     2  0.1851    0.87247 0.000 0.912 0.000 0.000 0.088
#> GSM99556     2  0.0404    0.88650 0.000 0.988 0.000 0.000 0.012
#> GSM99558     2  0.4136    0.77579 0.000 0.764 0.000 0.048 0.188
#> GSM99560     2  0.2006    0.87544 0.000 0.916 0.000 0.012 0.072
#> GSM99562     3  0.0290    0.94356 0.000 0.000 0.992 0.008 0.000
#> GSM99564     2  0.3409    0.83281 0.000 0.836 0.000 0.052 0.112
#> GSM99572     2  0.0000    0.88880 0.000 1.000 0.000 0.000 0.000
#> GSM99576     1  0.4015    0.64163 0.652 0.000 0.000 0.000 0.348
#> GSM99578     2  0.0609    0.88337 0.000 0.980 0.000 0.000 0.020
#> GSM99580     3  0.0290    0.94228 0.000 0.000 0.992 0.000 0.008
#> GSM99582     5  0.7408   -0.00180 0.028 0.000 0.316 0.296 0.360
#> GSM99584     2  0.3849    0.81130 0.000 0.808 0.000 0.080 0.112
#> GSM99586     1  0.1197    0.91763 0.952 0.000 0.000 0.000 0.048
#> GSM99588     2  0.0609    0.88353 0.000 0.980 0.000 0.000 0.020
#> GSM99590     2  0.0000    0.88880 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0000     0.8484 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99502     1  0.0000     0.8837 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.0000     0.8837 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0000     0.8484 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99566     3  0.0146     0.8479 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM99574     1  0.0000     0.8837 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.4300     0.2599 0.000 0.000 0.608 0.028 0.000 0.364
#> GSM99594     3  0.0146     0.8479 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM99468     1  0.0146     0.8835 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99498     1  0.0000     0.8837 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0000     0.8837 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99508     3  0.0363     0.8467 0.000 0.000 0.988 0.012 0.000 0.000
#> GSM99568     3  0.0717     0.8435 0.000 0.000 0.976 0.016 0.000 0.008
#> GSM99596     3  0.0260     0.8474 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM99600     2  0.1444     0.6782 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM99458     1  0.1152     0.8646 0.952 0.000 0.000 0.044 0.004 0.000
#> GSM99460     1  0.2094     0.8396 0.908 0.000 0.000 0.068 0.016 0.008
#> GSM99510     6  0.3295     0.6702 0.000 0.000 0.128 0.056 0.000 0.816
#> GSM99512     6  0.5179     0.3873 0.000 0.000 0.348 0.088 0.004 0.560
#> GSM99514     3  0.0000     0.8484 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99516     1  0.0000     0.8837 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0146     0.8835 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99520     3  0.0000     0.8484 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM99522     3  0.1148     0.8362 0.004 0.000 0.960 0.016 0.000 0.020
#> GSM99570     1  0.2135     0.7782 0.872 0.000 0.000 0.000 0.128 0.000
#> GSM99598     1  0.0000     0.8837 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     2  0.4859     0.0634 0.000 0.612 0.000 0.304 0.000 0.084
#> GSM99434     6  0.1327     0.6856 0.000 0.000 0.064 0.000 0.000 0.936
#> GSM99436     2  0.4552     0.1630 0.000 0.640 0.000 0.300 0.000 0.060
#> GSM99438     2  0.0000     0.7201 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     1  0.0547     0.8771 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM99442     2  0.1075     0.6960 0.000 0.952 0.000 0.048 0.000 0.000
#> GSM99444     2  0.0000     0.7201 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     2  0.1910     0.6445 0.000 0.892 0.000 0.108 0.000 0.000
#> GSM99448     6  0.6101    -0.2445 0.000 0.204 0.000 0.356 0.008 0.432
#> GSM99450     6  0.4131     0.5449 0.000 0.000 0.272 0.040 0.000 0.688
#> GSM99452     1  0.3151     0.5835 0.748 0.000 0.000 0.000 0.252 0.000
#> GSM99454     1  0.0146     0.8830 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99456     1  0.3946     0.6889 0.756 0.000 0.000 0.168 0.076 0.000
#> GSM99462     2  0.0000     0.7201 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     6  0.6227     0.4845 0.084 0.000 0.084 0.212 0.016 0.604
#> GSM99466     4  0.6374     0.0000 0.000 0.384 0.000 0.408 0.180 0.028
#> GSM99470     5  0.2036     0.3026 0.028 0.048 0.000 0.008 0.916 0.000
#> GSM99472     5  0.3737     0.3081 0.392 0.000 0.000 0.000 0.608 0.000
#> GSM99474     3  0.0692     0.8409 0.000 0.000 0.976 0.020 0.004 0.000
#> GSM99476     6  0.2558     0.6424 0.000 0.000 0.000 0.156 0.004 0.840
#> GSM99478     2  0.4691    -0.0200 0.000 0.680 0.000 0.124 0.196 0.000
#> GSM99480     1  0.1649     0.8608 0.932 0.000 0.000 0.032 0.036 0.000
#> GSM99482     5  0.3828     0.2115 0.440 0.000 0.000 0.000 0.560 0.000
#> GSM99484     2  0.1745     0.6490 0.000 0.924 0.000 0.020 0.056 0.000
#> GSM99486     2  0.4655     0.1381 0.000 0.632 0.000 0.300 0.000 0.068
#> GSM99488     2  0.0405     0.7183 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM99490     2  0.0405     0.7183 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM99492     1  0.3270     0.7593 0.820 0.000 0.000 0.120 0.060 0.000
#> GSM99494     2  0.0405     0.7183 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM99524     1  0.3390     0.4830 0.704 0.000 0.000 0.000 0.296 0.000
#> GSM99526     6  0.0777     0.6764 0.000 0.000 0.004 0.024 0.000 0.972
#> GSM99528     5  0.5991    -0.2191 0.000 0.256 0.000 0.308 0.436 0.000
#> GSM99530     3  0.6460     0.3378 0.168 0.000 0.540 0.236 0.048 0.008
#> GSM99532     3  0.4186     0.5978 0.180 0.000 0.744 0.068 0.000 0.008
#> GSM99534     2  0.0909     0.7033 0.000 0.968 0.000 0.012 0.020 0.000
#> GSM99536     1  0.0725     0.8780 0.976 0.000 0.000 0.012 0.012 0.000
#> GSM99538     2  0.4349     0.2714 0.000 0.684 0.000 0.264 0.004 0.048
#> GSM99540     1  0.0909     0.8757 0.968 0.000 0.000 0.020 0.012 0.000
#> GSM99542     2  0.0622     0.7138 0.000 0.980 0.000 0.008 0.012 0.000
#> GSM99544     2  0.4655     0.1385 0.000 0.632 0.000 0.300 0.000 0.068
#> GSM99546     6  0.3098     0.6341 0.000 0.040 0.000 0.120 0.004 0.836
#> GSM99548     2  0.0405     0.7183 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM99550     1  0.5582     0.3811 0.576 0.000 0.000 0.252 0.164 0.008
#> GSM99552     5  0.6549     0.0478 0.000 0.028 0.232 0.348 0.392 0.000
#> GSM99554     2  0.2664     0.5473 0.000 0.816 0.000 0.184 0.000 0.000
#> GSM99556     2  0.0405     0.7183 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM99558     2  0.5516    -0.5756 0.000 0.488 0.000 0.424 0.048 0.040
#> GSM99560     2  0.3691     0.4720 0.000 0.768 0.000 0.192 0.004 0.036
#> GSM99562     3  0.1003     0.8375 0.000 0.000 0.964 0.016 0.000 0.020
#> GSM99564     2  0.4655     0.1381 0.000 0.632 0.000 0.300 0.000 0.068
#> GSM99572     2  0.0000     0.7201 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99576     5  0.5558     0.0450 0.416 0.000 0.000 0.136 0.448 0.000
#> GSM99578     2  0.0622     0.7136 0.000 0.980 0.000 0.012 0.008 0.000
#> GSM99580     3  0.2632     0.7315 0.000 0.000 0.832 0.164 0.004 0.000
#> GSM99582     3  0.8416    -0.2447 0.048 0.000 0.276 0.216 0.236 0.224
#> GSM99584     2  0.4859     0.0633 0.000 0.612 0.000 0.304 0.000 0.084
#> GSM99586     1  0.3893     0.7005 0.764 0.000 0.000 0.156 0.080 0.000
#> GSM99588     2  0.0820     0.7081 0.000 0.972 0.000 0.016 0.012 0.000
#> GSM99590     2  0.0000     0.7201 0.000 1.000 0.000 0.000 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-skmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-skmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-skmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>              n disease.state(p) cell.type(p) k
#> ATC:skmeans 85         1.64e-06     1.09e-05 2
#> ATC:skmeans 85         2.80e-05     1.05e-03 3
#> ATC:skmeans 80         4.19e-05     2.37e-03 4
#> ATC:skmeans 76         5.82e-05     2.77e-03 5
#> ATC:skmeans 60         2.43e-04     9.05e-03 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:pam**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "pam"]
# you can also extract it by
# res = res_list["ATC:pam"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-pam-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.984       0.994         0.5061 0.494   0.494
#> 3 3 0.840           0.905       0.936         0.3128 0.720   0.491
#> 4 4 0.976           0.947       0.978         0.1295 0.850   0.587
#> 5 5 0.866           0.810       0.917         0.0486 0.964   0.857
#> 6 6 0.844           0.763       0.872         0.0369 0.968   0.856

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
#> GSM99496     1  0.0000      0.988 1.000 0.000
#> GSM99502     1  0.0000      0.988 1.000 0.000
#> GSM99504     1  0.0000      0.988 1.000 0.000
#> GSM99506     1  0.0000      0.988 1.000 0.000
#> GSM99566     1  0.0000      0.988 1.000 0.000
#> GSM99574     1  0.0000      0.988 1.000 0.000
#> GSM99592     2  0.0000      1.000 0.000 1.000
#> GSM99594     1  0.9922      0.192 0.552 0.448
#> GSM99468     1  0.0000      0.988 1.000 0.000
#> GSM99498     1  0.0000      0.988 1.000 0.000
#> GSM99500     1  0.0000      0.988 1.000 0.000
#> GSM99508     1  0.0000      0.988 1.000 0.000
#> GSM99568     1  0.0000      0.988 1.000 0.000
#> GSM99596     1  0.0000      0.988 1.000 0.000
#> GSM99600     2  0.0000      1.000 0.000 1.000
#> GSM99458     1  0.0000      0.988 1.000 0.000
#> GSM99460     1  0.0000      0.988 1.000 0.000
#> GSM99510     2  0.0000      1.000 0.000 1.000
#> GSM99512     2  0.0376      0.996 0.004 0.996
#> GSM99514     1  0.0000      0.988 1.000 0.000
#> GSM99516     1  0.0000      0.988 1.000 0.000
#> GSM99518     1  0.0000      0.988 1.000 0.000
#> GSM99520     1  0.0000      0.988 1.000 0.000
#> GSM99522     1  0.0000      0.988 1.000 0.000
#> GSM99570     1  0.0000      0.988 1.000 0.000
#> GSM99598     1  0.0000      0.988 1.000 0.000
#> GSM99432     2  0.0000      1.000 0.000 1.000
#> GSM99434     2  0.0000      1.000 0.000 1.000
#> GSM99436     2  0.0000      1.000 0.000 1.000
#> GSM99438     2  0.0000      1.000 0.000 1.000
#> GSM99440     1  0.0000      0.988 1.000 0.000
#> GSM99442     2  0.0000      1.000 0.000 1.000
#> GSM99444     2  0.0000      1.000 0.000 1.000
#> GSM99446     2  0.0000      1.000 0.000 1.000
#> GSM99448     2  0.0000      1.000 0.000 1.000
#> GSM99450     1  0.0000      0.988 1.000 0.000
#> GSM99452     1  0.0000      0.988 1.000 0.000
#> GSM99454     1  0.0000      0.988 1.000 0.000
#> GSM99456     1  0.0000      0.988 1.000 0.000
#> GSM99462     2  0.0000      1.000 0.000 1.000
#> GSM99464     1  0.0000      0.988 1.000 0.000
#> GSM99466     2  0.0000      1.000 0.000 1.000
#> GSM99470     2  0.0000      1.000 0.000 1.000
#> GSM99472     1  0.1184      0.974 0.984 0.016
#> GSM99474     1  0.1414      0.970 0.980 0.020
#> GSM99476     2  0.0000      1.000 0.000 1.000
#> GSM99478     2  0.0000      1.000 0.000 1.000
#> GSM99480     1  0.0000      0.988 1.000 0.000
#> GSM99482     1  0.0000      0.988 1.000 0.000
#> GSM99484     2  0.0000      1.000 0.000 1.000
#> GSM99486     2  0.0000      1.000 0.000 1.000
#> GSM99488     2  0.0000      1.000 0.000 1.000
#> GSM99490     2  0.0000      1.000 0.000 1.000
#> GSM99492     1  0.0000      0.988 1.000 0.000
#> GSM99494     2  0.0000      1.000 0.000 1.000
#> GSM99524     1  0.0000      0.988 1.000 0.000
#> GSM99526     2  0.0000      1.000 0.000 1.000
#> GSM99528     2  0.0000      1.000 0.000 1.000
#> GSM99530     1  0.0000      0.988 1.000 0.000
#> GSM99532     1  0.0000      0.988 1.000 0.000
#> GSM99534     2  0.0000      1.000 0.000 1.000
#> GSM99536     1  0.0000      0.988 1.000 0.000
#> GSM99538     2  0.0000      1.000 0.000 1.000
#> GSM99540     1  0.0000      0.988 1.000 0.000
#> GSM99542     2  0.0000      1.000 0.000 1.000
#> GSM99544     2  0.0000      1.000 0.000 1.000
#> GSM99546     2  0.0000      1.000 0.000 1.000
#> GSM99548     2  0.0000      1.000 0.000 1.000
#> GSM99550     1  0.0672      0.981 0.992 0.008
#> GSM99552     2  0.0000      1.000 0.000 1.000
#> GSM99554     2  0.0000      1.000 0.000 1.000
#> GSM99556     2  0.0000      1.000 0.000 1.000
#> GSM99558     2  0.0000      1.000 0.000 1.000
#> GSM99560     2  0.0000      1.000 0.000 1.000
#> GSM99562     1  0.0000      0.988 1.000 0.000
#> GSM99564     2  0.0000      1.000 0.000 1.000
#> GSM99572     2  0.0000      1.000 0.000 1.000
#> GSM99576     1  0.0000      0.988 1.000 0.000
#> GSM99578     2  0.0000      1.000 0.000 1.000
#> GSM99580     2  0.0000      1.000 0.000 1.000
#> GSM99582     2  0.0000      1.000 0.000 1.000
#> GSM99584     2  0.0000      1.000 0.000 1.000
#> GSM99586     1  0.0000      0.988 1.000 0.000
#> GSM99588     2  0.0000      1.000 0.000 1.000
#> GSM99590     2  0.0000      1.000 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
#> GSM99496     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99502     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99506     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99566     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99574     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.887 0.000 0.000 1.000
#> GSM99594     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99468     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99508     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99568     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99596     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99600     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.887 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.887 0.000 0.000 1.000
#> GSM99514     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99516     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99520     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99522     3  0.3267      0.862 0.116 0.000 0.884
#> GSM99570     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99432     2  0.2448      0.922 0.000 0.924 0.076
#> GSM99434     3  0.0000      0.887 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99446     2  0.2165      0.929 0.000 0.936 0.064
#> GSM99448     2  0.5810      0.581 0.000 0.664 0.336
#> GSM99450     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99452     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99464     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99466     2  0.4605      0.806 0.000 0.796 0.204
#> GSM99470     3  0.8309      0.585 0.180 0.188 0.632
#> GSM99472     1  0.2165      0.919 0.936 0.000 0.064
#> GSM99474     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99476     3  0.4399      0.748 0.000 0.188 0.812
#> GSM99478     2  0.3879      0.862 0.000 0.848 0.152
#> GSM99480     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99484     2  0.2165      0.929 0.000 0.936 0.064
#> GSM99486     2  0.2165      0.929 0.000 0.936 0.064
#> GSM99488     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99490     2  0.2165      0.929 0.000 0.936 0.064
#> GSM99492     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99526     3  0.3619      0.800 0.000 0.136 0.864
#> GSM99528     3  0.4452      0.743 0.000 0.192 0.808
#> GSM99530     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99532     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99534     2  0.2165      0.929 0.000 0.936 0.064
#> GSM99536     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99538     2  0.4504      0.816 0.000 0.804 0.196
#> GSM99540     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99542     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99544     2  0.0892      0.935 0.000 0.980 0.020
#> GSM99546     3  0.4654      0.720 0.000 0.208 0.792
#> GSM99548     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99550     3  0.6935      0.770 0.088 0.188 0.724
#> GSM99552     3  0.4399      0.748 0.000 0.188 0.812
#> GSM99554     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99558     2  0.5560      0.654 0.000 0.700 0.300
#> GSM99560     2  0.4346      0.831 0.000 0.816 0.184
#> GSM99562     3  0.2165      0.905 0.064 0.000 0.936
#> GSM99564     2  0.0592      0.935 0.000 0.988 0.012
#> GSM99572     2  0.0000      0.935 0.000 1.000 0.000
#> GSM99576     1  0.4654      0.704 0.792 0.000 0.208
#> GSM99578     2  0.2165      0.929 0.000 0.936 0.064
#> GSM99580     3  0.0000      0.887 0.000 0.000 1.000
#> GSM99582     3  0.4399      0.748 0.000 0.188 0.812
#> GSM99584     2  0.2165      0.929 0.000 0.936 0.064
#> GSM99586     1  0.0000      0.987 1.000 0.000 0.000
#> GSM99588     2  0.2165      0.929 0.000 0.936 0.064
#> GSM99590     2  0.0000      0.935 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99504     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99506     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99592     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99594     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99600     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99458     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99460     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99510     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99512     3  0.0707      0.960 0.000 0.000 0.980 0.020
#> GSM99514     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99570     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99432     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99434     3  0.4356      0.571 0.000 0.000 0.708 0.292
#> GSM99436     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99438     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99444     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99446     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99448     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99450     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99452     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99456     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99462     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99464     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99466     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99470     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99472     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99474     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99476     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99478     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99480     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99484     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99486     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99488     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99490     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99492     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99494     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99526     4  0.4431      0.571 0.000 0.000 0.304 0.696
#> GSM99528     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99530     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99532     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99534     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99536     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99538     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99540     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99542     2  0.4103      0.655 0.000 0.744 0.000 0.256
#> GSM99544     4  0.4898      0.248 0.000 0.416 0.000 0.584
#> GSM99546     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99548     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99550     4  0.3982      0.712 0.004 0.000 0.220 0.776
#> GSM99552     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99554     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99556     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99558     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99560     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99562     3  0.0000      0.978 0.000 0.000 1.000 0.000
#> GSM99564     2  0.2345      0.877 0.000 0.900 0.000 0.100
#> GSM99572     2  0.0000      0.974 0.000 1.000 0.000 0.000
#> GSM99576     1  0.0921      0.968 0.972 0.000 0.028 0.000
#> GSM99578     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99580     3  0.2011      0.900 0.000 0.000 0.920 0.080
#> GSM99582     4  0.2868      0.822 0.000 0.000 0.136 0.864
#> GSM99584     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99586     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM99588     4  0.0000      0.948 0.000 0.000 0.000 1.000
#> GSM99590     2  0.0000      0.974 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99502     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.2929      0.769 0.820 0.000 0.000 0.000 0.180
#> GSM99506     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99566     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99574     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99594     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99468     1  0.2929      0.769 0.820 0.000 0.000 0.000 0.180
#> GSM99498     1  0.2929      0.769 0.820 0.000 0.000 0.000 0.180
#> GSM99500     1  0.2929      0.769 0.820 0.000 0.000 0.000 0.180
#> GSM99508     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99568     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99596     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99600     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99458     1  0.2966      0.766 0.816 0.000 0.000 0.000 0.184
#> GSM99460     1  0.2929      0.769 0.820 0.000 0.000 0.000 0.180
#> GSM99510     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99512     3  0.1270      0.909 0.000 0.000 0.948 0.052 0.000
#> GSM99514     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99516     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.2929      0.769 0.820 0.000 0.000 0.000 0.180
#> GSM99520     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99522     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99570     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.0162      0.941 0.000 0.000 0.000 0.996 0.004
#> GSM99434     3  0.4045      0.447 0.000 0.000 0.644 0.356 0.000
#> GSM99436     2  0.0162      0.963 0.000 0.996 0.000 0.000 0.004
#> GSM99438     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99440     1  0.4192     -0.266 0.596 0.000 0.000 0.000 0.404
#> GSM99442     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99444     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99446     4  0.0162      0.941 0.000 0.000 0.000 0.996 0.004
#> GSM99448     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99450     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99452     1  0.1732      0.759 0.920 0.000 0.000 0.000 0.080
#> GSM99454     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000
#> GSM99456     5  0.3177      0.614 0.208 0.000 0.000 0.000 0.792
#> GSM99462     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99464     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99466     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99470     4  0.3143      0.759 0.000 0.000 0.000 0.796 0.204
#> GSM99472     1  0.4138      0.494 0.616 0.000 0.000 0.000 0.384
#> GSM99474     3  0.1671      0.887 0.000 0.000 0.924 0.000 0.076
#> GSM99476     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99478     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99480     5  0.4150      0.581 0.388 0.000 0.000 0.000 0.612
#> GSM99482     1  0.3949      0.514 0.668 0.000 0.000 0.000 0.332
#> GSM99484     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99486     4  0.0162      0.941 0.000 0.000 0.000 0.996 0.004
#> GSM99488     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99490     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99492     5  0.4150      0.581 0.388 0.000 0.000 0.000 0.612
#> GSM99494     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99524     1  0.2230      0.764 0.884 0.000 0.000 0.000 0.116
#> GSM99526     4  0.3242      0.682 0.000 0.000 0.216 0.784 0.000
#> GSM99528     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99530     3  0.2280      0.834 0.000 0.000 0.880 0.000 0.120
#> GSM99532     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99534     4  0.0963      0.920 0.000 0.000 0.000 0.964 0.036
#> GSM99536     1  0.4287     -0.290 0.540 0.000 0.000 0.000 0.460
#> GSM99538     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99540     1  0.2929      0.769 0.820 0.000 0.000 0.000 0.180
#> GSM99542     2  0.3534      0.629 0.000 0.744 0.000 0.256 0.000
#> GSM99544     4  0.4359      0.260 0.000 0.412 0.000 0.584 0.004
#> GSM99546     4  0.0794      0.926 0.000 0.000 0.000 0.972 0.028
#> GSM99548     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99550     5  0.3543      0.478 0.000 0.000 0.060 0.112 0.828
#> GSM99552     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99554     2  0.0162      0.963 0.000 0.996 0.000 0.000 0.004
#> GSM99556     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99558     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99560     4  0.0162      0.941 0.000 0.000 0.000 0.996 0.004
#> GSM99562     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000
#> GSM99564     2  0.2179      0.848 0.000 0.896 0.000 0.100 0.004
#> GSM99572     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000
#> GSM99576     5  0.4341     -0.120 0.404 0.000 0.004 0.000 0.592
#> GSM99578     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99580     3  0.2074      0.848 0.000 0.000 0.896 0.104 0.000
#> GSM99582     4  0.3143      0.759 0.000 0.000 0.000 0.796 0.204
#> GSM99584     4  0.0162      0.941 0.000 0.000 0.000 0.996 0.004
#> GSM99586     5  0.3177      0.614 0.208 0.000 0.000 0.000 0.792
#> GSM99588     4  0.0000      0.942 0.000 0.000 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.966 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99502     1  0.2260      0.801 0.860 0.000 0.000 0.000 0.000 0.140
#> GSM99504     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99506     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99566     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99574     1  0.2260      0.801 0.860 0.000 0.000 0.000 0.000 0.140
#> GSM99592     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99594     3  0.1257      0.933 0.000 0.000 0.952 0.000 0.020 0.028
#> GSM99468     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99500     1  0.0713      0.823 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM99508     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99568     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99596     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99600     2  0.2178      0.818 0.000 0.868 0.000 0.000 0.132 0.000
#> GSM99458     1  0.3482      0.322 0.684 0.000 0.000 0.000 0.316 0.000
#> GSM99460     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99510     3  0.1421      0.929 0.000 0.000 0.944 0.000 0.028 0.028
#> GSM99512     3  0.2201      0.912 0.000 0.000 0.912 0.032 0.028 0.028
#> GSM99514     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99516     1  0.2219      0.803 0.864 0.000 0.000 0.000 0.000 0.136
#> GSM99518     1  0.0146      0.824 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99520     3  0.1421      0.930 0.000 0.000 0.944 0.000 0.028 0.028
#> GSM99522     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99570     1  0.2219      0.804 0.864 0.000 0.000 0.000 0.000 0.136
#> GSM99598     1  0.2527      0.777 0.832 0.000 0.000 0.000 0.000 0.168
#> GSM99432     4  0.3547      0.675 0.000 0.000 0.000 0.696 0.300 0.004
#> GSM99434     3  0.4794      0.438 0.000 0.000 0.608 0.340 0.024 0.028
#> GSM99436     2  0.3636      0.679 0.000 0.676 0.000 0.000 0.320 0.004
#> GSM99438     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     6  0.2996      0.633 0.228 0.000 0.000 0.000 0.000 0.772
#> GSM99442     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99444     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     4  0.3619      0.662 0.000 0.000 0.000 0.680 0.316 0.004
#> GSM99448     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99450     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99452     1  0.4563      0.344 0.628 0.000 0.000 0.000 0.316 0.056
#> GSM99454     1  0.2219      0.803 0.864 0.000 0.000 0.000 0.000 0.136
#> GSM99456     6  0.2527      0.678 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM99462     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99466     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99470     5  0.3620      0.391 0.000 0.000 0.000 0.352 0.648 0.000
#> GSM99472     5  0.3620      0.607 0.352 0.000 0.000 0.000 0.648 0.000
#> GSM99474     3  0.2274      0.912 0.036 0.000 0.908 0.000 0.028 0.028
#> GSM99476     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99478     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99480     6  0.0790      0.722 0.032 0.000 0.000 0.000 0.000 0.968
#> GSM99482     5  0.4219      0.600 0.320 0.000 0.000 0.000 0.648 0.032
#> GSM99484     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99486     4  0.3636      0.658 0.000 0.000 0.000 0.676 0.320 0.004
#> GSM99488     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99492     6  0.0790      0.722 0.032 0.000 0.000 0.000 0.000 0.968
#> GSM99494     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.4497      0.315 0.624 0.000 0.000 0.000 0.328 0.048
#> GSM99526     4  0.4713      0.591 0.000 0.000 0.168 0.720 0.084 0.028
#> GSM99528     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99530     3  0.2247      0.895 0.060 0.000 0.904 0.000 0.012 0.024
#> GSM99532     3  0.2466      0.901 0.052 0.000 0.896 0.000 0.024 0.028
#> GSM99534     4  0.0547      0.829 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM99536     6  0.3847      0.293 0.456 0.000 0.000 0.000 0.000 0.544
#> GSM99538     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99540     1  0.0000      0.823 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99542     2  0.3175      0.599 0.000 0.744 0.000 0.256 0.000 0.000
#> GSM99544     4  0.6169      0.186 0.000 0.268 0.000 0.408 0.320 0.004
#> GSM99546     4  0.0717      0.828 0.000 0.000 0.000 0.976 0.016 0.008
#> GSM99548     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99550     5  0.6136      0.254 0.112 0.000 0.008 0.028 0.496 0.356
#> GSM99552     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99554     2  0.3636      0.679 0.000 0.676 0.000 0.000 0.320 0.004
#> GSM99556     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99558     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99560     4  0.3371      0.683 0.000 0.000 0.000 0.708 0.292 0.000
#> GSM99562     3  0.0146      0.945 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99564     2  0.4713      0.619 0.000 0.620 0.000 0.056 0.320 0.004
#> GSM99572     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99576     5  0.4616      0.645 0.280 0.000 0.000 0.000 0.648 0.072
#> GSM99578     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99580     3  0.3249      0.835 0.000 0.000 0.840 0.104 0.028 0.028
#> GSM99582     4  0.4938     -0.119 0.000 0.000 0.020 0.488 0.464 0.028
#> GSM99584     4  0.3351      0.686 0.000 0.000 0.000 0.712 0.288 0.000
#> GSM99586     6  0.2527      0.678 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM99588     4  0.0000      0.842 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM99590     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-pam-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-pam-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) cell.type(p) k
#> ATC:pam 84         7.45e-05     5.12e-04 2
#> ATC:pam 85         1.78e-04     4.92e-03 3
#> ATC:pam 84         5.18e-06     6.31e-04 4
#> ATC:pam 78         1.46e-07     9.16e-05 5
#> ATC:pam 76         2.94e-08     7.66e-05 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-mclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.263           0.791       0.801         0.4017 0.545   0.545
#> 3 3 0.824           0.882       0.918         0.6432 0.750   0.554
#> 4 4 0.681           0.780       0.851         0.1163 0.882   0.662
#> 5 5 0.659           0.615       0.780         0.0430 0.843   0.527
#> 6 6 0.721           0.612       0.784         0.0438 0.961   0.848

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
#> GSM99496     2  0.4022      0.689 0.080 0.920
#> GSM99502     1  0.5842      0.964 0.860 0.140
#> GSM99504     1  0.5842      0.964 0.860 0.140
#> GSM99506     2  0.4022      0.689 0.080 0.920
#> GSM99566     2  0.4022      0.689 0.080 0.920
#> GSM99574     1  0.5842      0.964 0.860 0.140
#> GSM99592     2  0.1414      0.708 0.020 0.980
#> GSM99594     2  0.4022      0.689 0.080 0.920
#> GSM99468     1  0.5842      0.964 0.860 0.140
#> GSM99498     1  0.5842      0.964 0.860 0.140
#> GSM99500     1  0.5842      0.964 0.860 0.140
#> GSM99508     2  0.4022      0.689 0.080 0.920
#> GSM99568     2  0.4022      0.689 0.080 0.920
#> GSM99596     2  0.4431      0.694 0.092 0.908
#> GSM99600     2  0.9087      0.745 0.324 0.676
#> GSM99458     1  0.5842      0.964 0.860 0.140
#> GSM99460     1  0.5946      0.959 0.856 0.144
#> GSM99510     2  0.0672      0.710 0.008 0.992
#> GSM99512     2  0.3584      0.694 0.068 0.932
#> GSM99514     2  0.4022      0.689 0.080 0.920
#> GSM99516     1  0.5842      0.964 0.860 0.140
#> GSM99518     1  0.5842      0.964 0.860 0.140
#> GSM99520     2  0.4022      0.689 0.080 0.920
#> GSM99522     2  0.4022      0.689 0.080 0.920
#> GSM99570     1  0.5842      0.964 0.860 0.140
#> GSM99598     1  0.5842      0.964 0.860 0.140
#> GSM99432     2  0.7950      0.770 0.240 0.760
#> GSM99434     2  0.0672      0.710 0.008 0.992
#> GSM99436     2  0.7950      0.770 0.240 0.760
#> GSM99438     2  0.9580      0.715 0.380 0.620
#> GSM99440     1  0.5842      0.964 0.860 0.140
#> GSM99442     2  0.9580      0.715 0.380 0.620
#> GSM99444     2  0.9580      0.715 0.380 0.620
#> GSM99446     2  0.7950      0.770 0.240 0.760
#> GSM99448     2  0.0000      0.709 0.000 1.000
#> GSM99450     2  0.1184      0.709 0.016 0.984
#> GSM99452     1  0.5842      0.964 0.860 0.140
#> GSM99454     1  0.5842      0.964 0.860 0.140
#> GSM99456     1  0.5842      0.964 0.860 0.140
#> GSM99462     2  0.9580      0.715 0.380 0.620
#> GSM99464     2  0.9522      0.574 0.372 0.628
#> GSM99466     2  0.7950      0.770 0.240 0.760
#> GSM99470     1  0.8661      0.725 0.712 0.288
#> GSM99472     1  0.5842      0.964 0.860 0.140
#> GSM99474     2  0.4022      0.689 0.080 0.920
#> GSM99476     2  0.8016      0.768 0.244 0.756
#> GSM99478     2  0.7950      0.770 0.240 0.760
#> GSM99480     1  0.5842      0.964 0.860 0.140
#> GSM99482     1  0.5842      0.964 0.860 0.140
#> GSM99484     2  0.7950      0.770 0.240 0.760
#> GSM99486     2  0.7950      0.770 0.240 0.760
#> GSM99488     2  0.9580      0.715 0.380 0.620
#> GSM99490     2  0.8661      0.760 0.288 0.712
#> GSM99492     1  0.5842      0.964 0.860 0.140
#> GSM99494     2  0.9580      0.715 0.380 0.620
#> GSM99524     1  0.5842      0.964 0.860 0.140
#> GSM99526     2  0.8081      0.766 0.248 0.752
#> GSM99528     2  0.8608      0.743 0.284 0.716
#> GSM99530     2  0.9866      0.488 0.432 0.568
#> GSM99532     2  0.9000      0.710 0.316 0.684
#> GSM99534     1  0.9460      0.567 0.636 0.364
#> GSM99536     1  0.5842      0.964 0.860 0.140
#> GSM99538     2  0.7950      0.770 0.240 0.760
#> GSM99540     1  0.5842      0.964 0.860 0.140
#> GSM99542     1  0.9460      0.567 0.636 0.364
#> GSM99544     2  0.7950      0.770 0.240 0.760
#> GSM99546     2  0.7950      0.770 0.240 0.760
#> GSM99548     2  0.9608      0.712 0.384 0.616
#> GSM99550     1  0.7139      0.886 0.804 0.196
#> GSM99552     2  0.9000      0.712 0.316 0.684
#> GSM99554     2  0.8443      0.765 0.272 0.728
#> GSM99556     2  0.9580      0.715 0.380 0.620
#> GSM99558     2  0.8555      0.746 0.280 0.720
#> GSM99560     2  0.7950      0.770 0.240 0.760
#> GSM99562     2  0.4022      0.689 0.080 0.920
#> GSM99564     2  0.7950      0.770 0.240 0.760
#> GSM99572     2  0.9580      0.715 0.380 0.620
#> GSM99576     1  0.5842      0.964 0.860 0.140
#> GSM99578     2  0.7950      0.770 0.240 0.760
#> GSM99580     2  0.3879      0.691 0.076 0.924
#> GSM99582     2  0.8608      0.743 0.284 0.716
#> GSM99584     2  0.7950      0.770 0.240 0.760
#> GSM99586     1  0.5842      0.964 0.860 0.140
#> GSM99588     2  0.7950      0.770 0.240 0.760
#> GSM99590     2  0.9580      0.715 0.380 0.620

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM99496     3  0.2152      0.889 0.036 0.016 0.948
#> GSM99502     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99504     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99506     3  0.2152      0.889 0.036 0.016 0.948
#> GSM99566     3  0.2152      0.889 0.036 0.016 0.948
#> GSM99574     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99592     3  0.3183      0.849 0.016 0.076 0.908
#> GSM99594     3  0.2152      0.889 0.036 0.016 0.948
#> GSM99468     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99508     3  0.2269      0.889 0.040 0.016 0.944
#> GSM99568     3  0.2269      0.889 0.040 0.016 0.944
#> GSM99596     3  0.2152      0.889 0.036 0.016 0.948
#> GSM99600     2  0.0475      0.921 0.004 0.992 0.004
#> GSM99458     1  0.0424      0.970 0.992 0.000 0.008
#> GSM99460     1  0.1643      0.941 0.956 0.000 0.044
#> GSM99510     3  0.5158      0.728 0.004 0.232 0.764
#> GSM99512     3  0.2297      0.889 0.036 0.020 0.944
#> GSM99514     3  0.2152      0.889 0.036 0.016 0.948
#> GSM99516     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99520     3  0.2152      0.889 0.036 0.016 0.948
#> GSM99522     3  0.1529      0.884 0.040 0.000 0.960
#> GSM99570     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99432     2  0.2945      0.917 0.004 0.908 0.088
#> GSM99434     3  0.5158      0.728 0.004 0.232 0.764
#> GSM99436     2  0.2945      0.917 0.004 0.908 0.088
#> GSM99438     2  0.0000      0.919 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.919 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.919 0.000 1.000 0.000
#> GSM99446     2  0.2550      0.919 0.024 0.936 0.040
#> GSM99448     3  0.3356      0.878 0.036 0.056 0.908
#> GSM99450     3  0.5115      0.729 0.004 0.228 0.768
#> GSM99452     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99456     1  0.0237      0.971 0.996 0.000 0.004
#> GSM99462     2  0.0000      0.919 0.000 1.000 0.000
#> GSM99464     3  0.5292      0.728 0.008 0.228 0.764
#> GSM99466     2  0.2926      0.913 0.036 0.924 0.040
#> GSM99470     1  0.8087      0.225 0.560 0.364 0.076
#> GSM99472     1  0.0424      0.970 0.992 0.000 0.008
#> GSM99474     3  0.2269      0.889 0.040 0.016 0.944
#> GSM99476     3  0.5158      0.728 0.004 0.232 0.764
#> GSM99478     2  0.2926      0.913 0.036 0.924 0.040
#> GSM99480     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99482     1  0.0237      0.971 0.996 0.000 0.004
#> GSM99484     2  0.3832      0.889 0.036 0.888 0.076
#> GSM99486     2  0.2945      0.917 0.004 0.908 0.088
#> GSM99488     2  0.0000      0.919 0.000 1.000 0.000
#> GSM99490     2  0.2414      0.921 0.020 0.940 0.040
#> GSM99492     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.919 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99526     3  0.5115      0.729 0.004 0.228 0.768
#> GSM99528     3  0.7128      0.427 0.036 0.344 0.620
#> GSM99530     3  0.2599      0.884 0.052 0.016 0.932
#> GSM99532     3  0.2269      0.889 0.040 0.016 0.944
#> GSM99534     2  0.6142      0.740 0.212 0.748 0.040
#> GSM99536     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99538     2  0.2926      0.913 0.036 0.924 0.040
#> GSM99540     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99542     2  0.6835      0.615 0.284 0.676 0.040
#> GSM99544     2  0.2772      0.919 0.004 0.916 0.080
#> GSM99546     3  0.5656      0.650 0.004 0.284 0.712
#> GSM99548     2  0.1289      0.923 0.000 0.968 0.032
#> GSM99550     1  0.3879      0.817 0.848 0.000 0.152
#> GSM99552     3  0.2689      0.885 0.036 0.032 0.932
#> GSM99554     2  0.2749      0.922 0.012 0.924 0.064
#> GSM99556     2  0.0000      0.919 0.000 1.000 0.000
#> GSM99558     3  0.4092      0.848 0.036 0.088 0.876
#> GSM99560     2  0.3030      0.916 0.004 0.904 0.092
#> GSM99562     3  0.1950      0.887 0.040 0.008 0.952
#> GSM99564     2  0.2945      0.917 0.004 0.908 0.088
#> GSM99572     2  0.0000      0.919 0.000 1.000 0.000
#> GSM99576     1  0.0424      0.970 0.992 0.000 0.008
#> GSM99578     2  0.4413      0.862 0.036 0.860 0.104
#> GSM99580     3  0.2297      0.889 0.036 0.020 0.944
#> GSM99582     3  0.6211      0.743 0.036 0.228 0.736
#> GSM99584     2  0.2945      0.917 0.004 0.908 0.088
#> GSM99586     1  0.0000      0.974 1.000 0.000 0.000
#> GSM99588     2  0.6597      0.624 0.036 0.696 0.268
#> GSM99590     2  0.0000      0.919 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99502     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99504     1  0.2408      0.849 0.896 0.000 0.104 0.000
#> GSM99506     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99566     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99574     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99592     3  0.4134      0.510 0.000 0.000 0.740 0.260
#> GSM99594     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99468     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99498     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99500     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99508     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99568     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99596     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99600     2  0.0336      0.828 0.000 0.992 0.000 0.008
#> GSM99458     1  0.1389      0.900 0.952 0.000 0.048 0.000
#> GSM99460     1  0.6894      0.379 0.536 0.000 0.120 0.344
#> GSM99510     4  0.4855      0.487 0.000 0.000 0.400 0.600
#> GSM99512     3  0.0336      0.920 0.000 0.000 0.992 0.008
#> GSM99514     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99516     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99520     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99522     3  0.0336      0.920 0.000 0.000 0.992 0.008
#> GSM99570     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99432     4  0.4193      0.610 0.000 0.268 0.000 0.732
#> GSM99434     4  0.4843      0.493 0.000 0.000 0.396 0.604
#> GSM99436     4  0.4888      0.390 0.000 0.412 0.000 0.588
#> GSM99438     2  0.0000      0.829 0.000 1.000 0.000 0.000
#> GSM99440     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0000      0.829 0.000 1.000 0.000 0.000
#> GSM99444     2  0.0000      0.829 0.000 1.000 0.000 0.000
#> GSM99446     2  0.2011      0.806 0.000 0.920 0.000 0.080
#> GSM99448     3  0.4008      0.641 0.000 0.000 0.756 0.244
#> GSM99450     4  0.4866      0.479 0.000 0.000 0.404 0.596
#> GSM99452     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99456     1  0.4072      0.782 0.748 0.000 0.000 0.252
#> GSM99462     2  0.0000      0.829 0.000 1.000 0.000 0.000
#> GSM99464     4  0.4669      0.577 0.100 0.000 0.104 0.796
#> GSM99466     2  0.6397      0.635 0.000 0.652 0.164 0.184
#> GSM99470     1  0.4466      0.699 0.784 0.180 0.000 0.036
#> GSM99472     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99474     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99476     4  0.3764      0.642 0.000 0.000 0.216 0.784
#> GSM99478     2  0.6295      0.645 0.000 0.660 0.196 0.144
#> GSM99480     1  0.3266      0.845 0.832 0.000 0.000 0.168
#> GSM99482     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99484     2  0.6251      0.649 0.000 0.664 0.196 0.140
#> GSM99486     4  0.4605      0.501 0.000 0.336 0.000 0.664
#> GSM99488     2  0.0000      0.829 0.000 1.000 0.000 0.000
#> GSM99490     2  0.2408      0.789 0.000 0.896 0.000 0.104
#> GSM99492     1  0.3311      0.843 0.828 0.000 0.000 0.172
#> GSM99494     2  0.0000      0.829 0.000 1.000 0.000 0.000
#> GSM99524     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99526     4  0.3649      0.645 0.000 0.000 0.204 0.796
#> GSM99528     2  0.6690      0.572 0.000 0.608 0.248 0.144
#> GSM99530     3  0.6221      0.515 0.100 0.000 0.644 0.256
#> GSM99532     3  0.0469      0.916 0.000 0.000 0.988 0.012
#> GSM99534     2  0.4839      0.656 0.200 0.756 0.000 0.044
#> GSM99536     1  0.0000      0.929 1.000 0.000 0.000 0.000
#> GSM99538     2  0.6585      0.612 0.000 0.632 0.180 0.188
#> GSM99540     1  0.1022      0.911 0.968 0.000 0.032 0.000
#> GSM99542     2  0.4175      0.663 0.200 0.784 0.000 0.016
#> GSM99544     4  0.4331      0.587 0.000 0.288 0.000 0.712
#> GSM99546     4  0.3751      0.656 0.000 0.004 0.196 0.800
#> GSM99548     2  0.0469      0.827 0.000 0.988 0.000 0.012
#> GSM99550     1  0.4661      0.675 0.652 0.000 0.000 0.348
#> GSM99552     3  0.2345      0.830 0.000 0.000 0.900 0.100
#> GSM99554     2  0.3649      0.683 0.000 0.796 0.000 0.204
#> GSM99556     2  0.0000      0.829 0.000 1.000 0.000 0.000
#> GSM99558     3  0.2973      0.784 0.000 0.000 0.856 0.144
#> GSM99560     4  0.4222      0.607 0.000 0.272 0.000 0.728
#> GSM99562     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99564     4  0.4250      0.602 0.000 0.276 0.000 0.724
#> GSM99572     2  0.0000      0.829 0.000 1.000 0.000 0.000
#> GSM99576     1  0.0592      0.923 0.984 0.000 0.000 0.016
#> GSM99578     2  0.4800      0.719 0.000 0.760 0.196 0.044
#> GSM99580     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM99582     4  0.4790      0.478 0.000 0.000 0.380 0.620
#> GSM99584     4  0.4193      0.610 0.000 0.268 0.000 0.732
#> GSM99586     1  0.3356      0.840 0.824 0.000 0.000 0.176
#> GSM99588     2  0.4716      0.721 0.000 0.764 0.196 0.040
#> GSM99590     2  0.0000      0.829 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM99496     3  0.3274     0.6346 0.000 0.000 0.780 0.000 0.220
#> GSM99502     1  0.0290     0.8134 0.992 0.000 0.000 0.000 0.008
#> GSM99504     1  0.1668     0.7930 0.940 0.000 0.028 0.000 0.032
#> GSM99506     3  0.3274     0.6346 0.000 0.000 0.780 0.000 0.220
#> GSM99566     3  0.3274     0.6346 0.000 0.000 0.780 0.000 0.220
#> GSM99574     1  0.0290     0.8134 0.992 0.000 0.000 0.000 0.008
#> GSM99592     3  0.4555     0.6234 0.000 0.000 0.732 0.200 0.068
#> GSM99594     3  0.1965     0.7020 0.000 0.000 0.904 0.000 0.096
#> GSM99468     1  0.1168     0.8077 0.960 0.008 0.000 0.000 0.032
#> GSM99498     1  0.1168     0.8077 0.960 0.008 0.000 0.000 0.032
#> GSM99500     1  0.1329     0.8067 0.956 0.008 0.004 0.000 0.032
#> GSM99508     3  0.1430     0.7163 0.000 0.000 0.944 0.004 0.052
#> GSM99568     3  0.1281     0.7216 0.000 0.000 0.956 0.012 0.032
#> GSM99596     3  0.1270     0.7128 0.000 0.000 0.948 0.000 0.052
#> GSM99600     4  0.4291     0.2079 0.000 0.464 0.000 0.536 0.000
#> GSM99458     1  0.5608     0.3340 0.712 0.008 0.128 0.028 0.124
#> GSM99460     1  0.7513    -0.3106 0.532 0.016 0.140 0.072 0.240
#> GSM99510     3  0.5903     0.4886 0.000 0.000 0.548 0.332 0.120
#> GSM99512     3  0.1981     0.7123 0.000 0.000 0.924 0.028 0.048
#> GSM99514     3  0.3274     0.6346 0.000 0.000 0.780 0.000 0.220
#> GSM99516     1  0.0290     0.8134 0.992 0.000 0.000 0.000 0.008
#> GSM99518     1  0.1168     0.8077 0.960 0.008 0.000 0.000 0.032
#> GSM99520     3  0.1121     0.7135 0.000 0.000 0.956 0.000 0.044
#> GSM99522     3  0.2522     0.7055 0.000 0.000 0.896 0.052 0.052
#> GSM99570     1  0.0693     0.8107 0.980 0.012 0.000 0.000 0.008
#> GSM99598     1  0.0290     0.8134 0.992 0.000 0.000 0.000 0.008
#> GSM99432     4  0.0992     0.6772 0.000 0.008 0.000 0.968 0.024
#> GSM99434     3  0.5873     0.4766 0.000 0.000 0.540 0.348 0.112
#> GSM99436     4  0.1579     0.6888 0.000 0.032 0.000 0.944 0.024
#> GSM99438     2  0.1043     0.8860 0.000 0.960 0.000 0.040 0.000
#> GSM99440     1  0.0290     0.8134 0.992 0.000 0.000 0.000 0.008
#> GSM99442     2  0.1671     0.8845 0.000 0.924 0.000 0.076 0.000
#> GSM99444     2  0.1043     0.8860 0.000 0.960 0.000 0.040 0.000
#> GSM99446     4  0.3967     0.5697 0.000 0.264 0.000 0.724 0.012
#> GSM99448     4  0.5154     0.3670 0.000 0.000 0.372 0.580 0.048
#> GSM99450     3  0.5903     0.4913 0.000 0.000 0.548 0.332 0.120
#> GSM99452     1  0.0404     0.8129 0.988 0.012 0.000 0.000 0.000
#> GSM99454     1  0.0290     0.8143 0.992 0.000 0.000 0.000 0.008
#> GSM99456     1  0.4288     0.2447 0.612 0.000 0.000 0.004 0.384
#> GSM99462     2  0.1043     0.8860 0.000 0.960 0.000 0.040 0.000
#> GSM99464     3  0.7029     0.3293 0.000 0.020 0.436 0.340 0.204
#> GSM99466     4  0.4519     0.6968 0.000 0.060 0.084 0.796 0.060
#> GSM99470     4  0.8982    -0.3793 0.272 0.036 0.124 0.308 0.260
#> GSM99472     1  0.6445     0.0451 0.624 0.012 0.128 0.028 0.208
#> GSM99474     3  0.0798     0.7212 0.000 0.000 0.976 0.016 0.008
#> GSM99476     3  0.6201     0.4315 0.000 0.008 0.500 0.380 0.112
#> GSM99478     4  0.6259     0.6548 0.000 0.116 0.108 0.664 0.112
#> GSM99480     1  0.3480     0.5471 0.752 0.000 0.000 0.000 0.248
#> GSM99482     1  0.1012     0.8093 0.968 0.012 0.000 0.000 0.020
#> GSM99484     4  0.6809     0.6220 0.000 0.128 0.108 0.608 0.156
#> GSM99486     4  0.1661     0.6897 0.000 0.036 0.000 0.940 0.024
#> GSM99488     2  0.1197     0.8846 0.000 0.952 0.000 0.048 0.000
#> GSM99490     4  0.4691     0.5646 0.000 0.276 0.000 0.680 0.044
#> GSM99492     1  0.3480     0.5471 0.752 0.000 0.000 0.000 0.248
#> GSM99494     2  0.1043     0.8860 0.000 0.960 0.000 0.040 0.000
#> GSM99524     1  0.1281     0.8075 0.956 0.012 0.000 0.000 0.032
#> GSM99526     3  0.6267     0.4264 0.000 0.008 0.496 0.376 0.120
#> GSM99528     4  0.7756     0.3699 0.000 0.072 0.304 0.408 0.216
#> GSM99530     3  0.3314     0.6527 0.000 0.020 0.852 0.020 0.108
#> GSM99532     3  0.2632     0.6946 0.000 0.000 0.888 0.040 0.072
#> GSM99534     4  0.7068     0.4732 0.140 0.164 0.000 0.580 0.116
#> GSM99536     1  0.0609     0.8106 0.980 0.000 0.000 0.000 0.020
#> GSM99538     4  0.4702     0.6931 0.000 0.052 0.108 0.780 0.060
#> GSM99540     1  0.1251     0.8059 0.956 0.008 0.000 0.000 0.036
#> GSM99542     2  0.7659     0.3516 0.140 0.488 0.000 0.244 0.128
#> GSM99544     4  0.1661     0.6894 0.000 0.036 0.000 0.940 0.024
#> GSM99546     4  0.4866     0.3906 0.000 0.004 0.148 0.732 0.116
#> GSM99548     2  0.3789     0.7265 0.000 0.768 0.000 0.212 0.020
#> GSM99550     5  0.7573     0.0000 0.244 0.016 0.128 0.084 0.528
#> GSM99552     3  0.4719     0.3826 0.000 0.000 0.696 0.248 0.056
#> GSM99554     4  0.3812     0.6173 0.000 0.204 0.000 0.772 0.024
#> GSM99556     2  0.2471     0.8481 0.000 0.864 0.000 0.136 0.000
#> GSM99558     4  0.5405     0.4516 0.000 0.000 0.380 0.556 0.064
#> GSM99560     4  0.0798     0.6637 0.000 0.008 0.000 0.976 0.016
#> GSM99562     3  0.1399     0.7206 0.000 0.000 0.952 0.020 0.028
#> GSM99564     4  0.1403     0.6862 0.000 0.024 0.000 0.952 0.024
#> GSM99572     2  0.2732     0.8207 0.000 0.840 0.000 0.160 0.000
#> GSM99576     1  0.5676     0.1179 0.632 0.000 0.124 0.004 0.240
#> GSM99578     4  0.7117     0.5883 0.000 0.172 0.108 0.572 0.148
#> GSM99580     3  0.0451     0.7198 0.000 0.000 0.988 0.004 0.008
#> GSM99582     3  0.5427     0.5576 0.000 0.000 0.636 0.260 0.104
#> GSM99584     4  0.1106     0.6800 0.000 0.012 0.000 0.964 0.024
#> GSM99586     1  0.3586     0.5211 0.736 0.000 0.000 0.000 0.264
#> GSM99588     4  0.7089     0.5991 0.000 0.152 0.108 0.576 0.164
#> GSM99590     2  0.1671     0.8845 0.000 0.924 0.000 0.076 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     3  0.3136   0.626749 0.000 0.000 0.796 0.000 0.188 0.016
#> GSM99502     1  0.0000   0.805918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.1196   0.796206 0.952 0.000 0.008 0.000 0.000 0.040
#> GSM99506     3  0.3136   0.626749 0.000 0.000 0.796 0.000 0.188 0.016
#> GSM99566     3  0.3136   0.626749 0.000 0.000 0.796 0.000 0.188 0.016
#> GSM99574     1  0.0000   0.805918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99592     3  0.5097   0.228502 0.000 0.004 0.664 0.080 0.232 0.020
#> GSM99594     3  0.1367   0.707474 0.000 0.000 0.944 0.000 0.044 0.012
#> GSM99468     1  0.0865   0.800045 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM99498     1  0.0937   0.799211 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM99500     1  0.0937   0.799211 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM99508     3  0.0405   0.718534 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM99568     3  0.0405   0.718283 0.000 0.000 0.988 0.008 0.000 0.004
#> GSM99596     3  0.0806   0.717024 0.000 0.000 0.972 0.000 0.020 0.008
#> GSM99600     4  0.4301   0.512286 0.000 0.392 0.000 0.584 0.000 0.024
#> GSM99458     1  0.4958   0.406420 0.704 0.000 0.044 0.008 0.048 0.196
#> GSM99460     1  0.7389  -0.176446 0.464 0.000 0.096 0.024 0.212 0.204
#> GSM99510     3  0.6328  -0.335329 0.000 0.016 0.488 0.116 0.352 0.028
#> GSM99512     3  0.1693   0.706974 0.000 0.000 0.936 0.012 0.020 0.032
#> GSM99514     3  0.3136   0.626749 0.000 0.000 0.796 0.000 0.188 0.016
#> GSM99516     1  0.0000   0.805918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0790   0.800768 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM99520     3  0.0146   0.718402 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM99522     3  0.1777   0.703771 0.000 0.000 0.932 0.024 0.032 0.012
#> GSM99570     1  0.2697   0.677265 0.812 0.000 0.000 0.000 0.000 0.188
#> GSM99598     1  0.0146   0.805594 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM99432     4  0.2520   0.702035 0.000 0.152 0.000 0.844 0.004 0.000
#> GSM99434     3  0.6240  -0.418134 0.000 0.016 0.464 0.116 0.384 0.020
#> GSM99436     4  0.2520   0.702035 0.000 0.152 0.000 0.844 0.004 0.000
#> GSM99438     2  0.0000   0.935681 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99440     1  0.0363   0.805027 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM99442     2  0.0363   0.934461 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM99444     2  0.0000   0.935681 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99446     4  0.2912   0.675164 0.000 0.216 0.000 0.784 0.000 0.000
#> GSM99448     4  0.5512   0.585199 0.000 0.008 0.176 0.660 0.032 0.124
#> GSM99450     3  0.5535  -0.163477 0.000 0.000 0.548 0.124 0.320 0.008
#> GSM99452     1  0.2823   0.667630 0.796 0.000 0.000 0.000 0.000 0.204
#> GSM99454     1  0.0000   0.805918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.5358   0.425908 0.596 0.000 0.000 0.008 0.272 0.124
#> GSM99462     2  0.0000   0.935681 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99464     5  0.5741   0.513280 0.000 0.000 0.296 0.112 0.564 0.028
#> GSM99466     4  0.4526   0.676719 0.000 0.024 0.072 0.752 0.008 0.144
#> GSM99470     6  0.3429   0.752883 0.128 0.000 0.028 0.012 0.008 0.824
#> GSM99472     6  0.4062   0.864199 0.236 0.000 0.028 0.000 0.012 0.724
#> GSM99474     3  0.1003   0.716241 0.000 0.000 0.964 0.020 0.000 0.016
#> GSM99476     5  0.6524   0.415824 0.000 0.028 0.404 0.116 0.428 0.024
#> GSM99478     4  0.4532   0.660315 0.000 0.028 0.036 0.716 0.004 0.216
#> GSM99480     1  0.3835   0.648782 0.756 0.000 0.000 0.000 0.188 0.056
#> GSM99482     1  0.3765   0.187294 0.596 0.000 0.000 0.000 0.000 0.404
#> GSM99484     4  0.5386   0.636666 0.000 0.048 0.028 0.664 0.032 0.228
#> GSM99486     4  0.2520   0.702035 0.000 0.152 0.000 0.844 0.004 0.000
#> GSM99488     2  0.0000   0.935681 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99490     4  0.5798   0.582231 0.000 0.312 0.008 0.532 0.004 0.144
#> GSM99492     1  0.3865   0.644872 0.752 0.000 0.000 0.000 0.192 0.056
#> GSM99494     2  0.0000   0.935681 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM99524     1  0.3175   0.623539 0.744 0.000 0.000 0.000 0.000 0.256
#> GSM99526     5  0.6304   0.470406 0.000 0.000 0.376 0.116 0.456 0.052
#> GSM99528     4  0.6311   0.437520 0.000 0.000 0.252 0.448 0.016 0.284
#> GSM99530     3  0.3438   0.529455 0.000 0.000 0.788 0.020 0.184 0.008
#> GSM99532     3  0.1714   0.706154 0.000 0.000 0.936 0.024 0.024 0.016
#> GSM99534     4  0.6446   0.450187 0.036 0.140 0.000 0.472 0.008 0.344
#> GSM99536     1  0.0000   0.805918 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99538     4  0.4158   0.688435 0.000 0.024 0.056 0.776 0.004 0.140
#> GSM99540     1  0.0865   0.800073 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM99542     2  0.5394   0.315770 0.036 0.552 0.000 0.040 0.004 0.368
#> GSM99544     4  0.2416   0.700967 0.000 0.156 0.000 0.844 0.000 0.000
#> GSM99546     4  0.5956   0.163777 0.000 0.000 0.048 0.480 0.392 0.080
#> GSM99548     2  0.2394   0.864097 0.000 0.900 0.008 0.052 0.004 0.036
#> GSM99550     5  0.6496  -0.460868 0.080 0.000 0.048 0.024 0.444 0.404
#> GSM99552     3  0.4912   0.344207 0.000 0.000 0.680 0.148 0.008 0.164
#> GSM99554     4  0.3240   0.658962 0.000 0.244 0.000 0.752 0.000 0.004
#> GSM99556     2  0.0603   0.931185 0.000 0.980 0.000 0.016 0.000 0.004
#> GSM99558     4  0.5245   0.593179 0.000 0.000 0.192 0.636 0.008 0.164
#> GSM99560     4  0.4978   0.588173 0.000 0.008 0.020 0.700 0.184 0.088
#> GSM99562     3  0.1194   0.711230 0.000 0.000 0.956 0.004 0.032 0.008
#> GSM99564     4  0.2520   0.702035 0.000 0.152 0.000 0.844 0.004 0.000
#> GSM99572     2  0.0806   0.926178 0.000 0.972 0.000 0.020 0.000 0.008
#> GSM99576     6  0.4290   0.833079 0.260 0.000 0.028 0.000 0.016 0.696
#> GSM99578     4  0.5976   0.612052 0.000 0.096 0.028 0.616 0.032 0.228
#> GSM99580     3  0.1265   0.709299 0.000 0.000 0.948 0.000 0.008 0.044
#> GSM99582     3  0.5881   0.000291 0.000 0.000 0.572 0.140 0.256 0.032
#> GSM99584     4  0.2631   0.701756 0.000 0.152 0.000 0.840 0.008 0.000
#> GSM99586     1  0.3896   0.640530 0.748 0.000 0.000 0.000 0.196 0.056
#> GSM99588     4  0.6070   0.624352 0.000 0.084 0.048 0.616 0.028 0.224
#> GSM99590     2  0.0363   0.934461 0.000 0.988 0.000 0.012 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-mclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) cell.type(p) k
#> ATC:mclust 84         2.10e-01      0.40818 2
#> ATC:mclust 83         3.19e-04      0.00790 3
#> ATC:mclust 79         7.25e-05      0.00552 4
#> ATC:mclust 64         2.38e-05      0.00339 5
#> ATC:mclust 68         7.73e-05      0.02820 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


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 21168 rows and 85 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-NMF-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-NMF-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.962       0.984         0.4946 0.506   0.506
#> 3 3 1.000           0.979       0.990         0.3611 0.759   0.552
#> 4 4 0.819           0.804       0.899         0.1020 0.887   0.674
#> 5 5 0.752           0.695       0.843         0.0441 0.956   0.835
#> 6 6 0.745           0.666       0.807         0.0360 0.939   0.761

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
#> GSM99496     1  0.0000      0.983 1.000 0.000
#> GSM99502     1  0.0000      0.983 1.000 0.000
#> GSM99504     1  0.0000      0.983 1.000 0.000
#> GSM99506     1  0.0000      0.983 1.000 0.000
#> GSM99566     1  0.0000      0.983 1.000 0.000
#> GSM99574     1  0.0000      0.983 1.000 0.000
#> GSM99592     1  0.0376      0.980 0.996 0.004
#> GSM99594     1  0.0000      0.983 1.000 0.000
#> GSM99468     1  0.0000      0.983 1.000 0.000
#> GSM99498     1  0.0000      0.983 1.000 0.000
#> GSM99500     1  0.0000      0.983 1.000 0.000
#> GSM99508     1  0.0000      0.983 1.000 0.000
#> GSM99568     1  0.0000      0.983 1.000 0.000
#> GSM99596     1  0.0000      0.983 1.000 0.000
#> GSM99600     2  0.0000      0.983 0.000 1.000
#> GSM99458     1  0.0000      0.983 1.000 0.000
#> GSM99460     1  0.0000      0.983 1.000 0.000
#> GSM99510     1  0.0938      0.973 0.988 0.012
#> GSM99512     1  0.5519      0.847 0.872 0.128
#> GSM99514     1  0.0000      0.983 1.000 0.000
#> GSM99516     1  0.0000      0.983 1.000 0.000
#> GSM99518     1  0.0000      0.983 1.000 0.000
#> GSM99520     1  0.0000      0.983 1.000 0.000
#> GSM99522     1  0.0000      0.983 1.000 0.000
#> GSM99570     1  0.0000      0.983 1.000 0.000
#> GSM99598     1  0.0000      0.983 1.000 0.000
#> GSM99432     2  0.0000      0.983 0.000 1.000
#> GSM99434     1  0.7602      0.716 0.780 0.220
#> GSM99436     2  0.0000      0.983 0.000 1.000
#> GSM99438     2  0.0000      0.983 0.000 1.000
#> GSM99440     1  0.0000      0.983 1.000 0.000
#> GSM99442     2  0.0000      0.983 0.000 1.000
#> GSM99444     2  0.0000      0.983 0.000 1.000
#> GSM99446     2  0.0000      0.983 0.000 1.000
#> GSM99448     2  0.0000      0.983 0.000 1.000
#> GSM99450     1  0.0000      0.983 1.000 0.000
#> GSM99452     1  0.0000      0.983 1.000 0.000
#> GSM99454     1  0.0000      0.983 1.000 0.000
#> GSM99456     1  0.0000      0.983 1.000 0.000
#> GSM99462     2  0.0000      0.983 0.000 1.000
#> GSM99464     1  0.0000      0.983 1.000 0.000
#> GSM99466     2  0.0000      0.983 0.000 1.000
#> GSM99470     1  0.9732      0.318 0.596 0.404
#> GSM99472     1  0.0000      0.983 1.000 0.000
#> GSM99474     1  0.0000      0.983 1.000 0.000
#> GSM99476     2  0.0000      0.983 0.000 1.000
#> GSM99478     2  0.0000      0.983 0.000 1.000
#> GSM99480     1  0.0000      0.983 1.000 0.000
#> GSM99482     1  0.0000      0.983 1.000 0.000
#> GSM99484     2  0.0000      0.983 0.000 1.000
#> GSM99486     2  0.0000      0.983 0.000 1.000
#> GSM99488     2  0.0000      0.983 0.000 1.000
#> GSM99490     2  0.0000      0.983 0.000 1.000
#> GSM99492     1  0.0000      0.983 1.000 0.000
#> GSM99494     2  0.0000      0.983 0.000 1.000
#> GSM99524     1  0.0000      0.983 1.000 0.000
#> GSM99526     2  0.9044      0.525 0.320 0.680
#> GSM99528     2  0.0938      0.973 0.012 0.988
#> GSM99530     1  0.0000      0.983 1.000 0.000
#> GSM99532     1  0.0000      0.983 1.000 0.000
#> GSM99534     2  0.0000      0.983 0.000 1.000
#> GSM99536     1  0.0000      0.983 1.000 0.000
#> GSM99538     2  0.0000      0.983 0.000 1.000
#> GSM99540     1  0.0000      0.983 1.000 0.000
#> GSM99542     2  0.0000      0.983 0.000 1.000
#> GSM99544     2  0.0000      0.983 0.000 1.000
#> GSM99546     2  0.3431      0.922 0.064 0.936
#> GSM99548     2  0.0000      0.983 0.000 1.000
#> GSM99550     1  0.0000      0.983 1.000 0.000
#> GSM99552     2  0.6623      0.790 0.172 0.828
#> GSM99554     2  0.0000      0.983 0.000 1.000
#> GSM99556     2  0.0000      0.983 0.000 1.000
#> GSM99558     2  0.0000      0.983 0.000 1.000
#> GSM99560     2  0.0000      0.983 0.000 1.000
#> GSM99562     1  0.0000      0.983 1.000 0.000
#> GSM99564     2  0.0000      0.983 0.000 1.000
#> GSM99572     2  0.0000      0.983 0.000 1.000
#> GSM99576     1  0.0000      0.983 1.000 0.000
#> GSM99578     2  0.0000      0.983 0.000 1.000
#> GSM99580     1  0.1843      0.958 0.972 0.028
#> GSM99582     1  0.0000      0.983 1.000 0.000
#> GSM99584     2  0.0000      0.983 0.000 1.000
#> GSM99586     1  0.0000      0.983 1.000 0.000
#> GSM99588     2  0.0000      0.983 0.000 1.000
#> GSM99590     2  0.0000      0.983 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
#> GSM99496     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99502     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99504     1  0.0747      0.979 0.984 0.000 0.016
#> GSM99506     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99566     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99574     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99592     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99594     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99468     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99498     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99500     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99508     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99568     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99596     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99600     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99458     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99460     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99510     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99512     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99514     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99516     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99518     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99520     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99522     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99570     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99598     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99432     2  0.1289      0.963 0.000 0.968 0.032
#> GSM99434     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99436     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99438     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99440     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99442     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99444     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99446     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99448     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99450     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99452     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99454     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99456     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99462     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99464     3  0.0747      0.973 0.016 0.000 0.984
#> GSM99466     2  0.0237      0.987 0.000 0.996 0.004
#> GSM99470     1  0.3551      0.848 0.868 0.132 0.000
#> GSM99472     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99474     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99476     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99478     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99480     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99482     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99484     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99486     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99488     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99490     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99492     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99494     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99524     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99526     3  0.1643      0.946 0.000 0.044 0.956
#> GSM99528     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99530     3  0.3116      0.884 0.108 0.000 0.892
#> GSM99532     3  0.1753      0.946 0.048 0.000 0.952
#> GSM99534     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99536     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99538     2  0.1163      0.966 0.000 0.972 0.028
#> GSM99540     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99542     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99544     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99546     2  0.5109      0.723 0.008 0.780 0.212
#> GSM99548     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99550     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99552     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99554     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99556     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99558     3  0.0237      0.981 0.000 0.004 0.996
#> GSM99560     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99562     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99564     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99572     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99576     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99578     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99580     3  0.0000      0.984 0.000 0.000 1.000
#> GSM99582     3  0.4555      0.763 0.200 0.000 0.800
#> GSM99584     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99586     1  0.0000      0.994 1.000 0.000 0.000
#> GSM99588     2  0.0000      0.991 0.000 1.000 0.000
#> GSM99590     2  0.0000      0.991 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM99496     3  0.0188     0.8626 0.000 0.000 0.996 0.004
#> GSM99502     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99504     3  0.4996     0.0545 0.484 0.000 0.516 0.000
#> GSM99506     3  0.0336     0.8658 0.000 0.000 0.992 0.008
#> GSM99566     3  0.1022     0.8675 0.000 0.000 0.968 0.032
#> GSM99574     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99592     3  0.4431     0.6207 0.000 0.000 0.696 0.304
#> GSM99594     3  0.0592     0.8658 0.000 0.000 0.984 0.016
#> GSM99468     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99498     1  0.1389     0.9217 0.952 0.000 0.048 0.000
#> GSM99500     1  0.0469     0.9526 0.988 0.000 0.012 0.000
#> GSM99508     3  0.2281     0.8505 0.000 0.000 0.904 0.096
#> GSM99568     3  0.2081     0.8545 0.000 0.000 0.916 0.084
#> GSM99596     3  0.1211     0.8485 0.000 0.000 0.960 0.040
#> GSM99600     2  0.0817     0.9227 0.000 0.976 0.000 0.024
#> GSM99458     1  0.0188     0.9584 0.996 0.000 0.000 0.004
#> GSM99460     1  0.3123     0.8132 0.844 0.000 0.000 0.156
#> GSM99510     4  0.4989    -0.1025 0.000 0.000 0.472 0.528
#> GSM99512     3  0.2814     0.8293 0.000 0.000 0.868 0.132
#> GSM99514     3  0.0921     0.8676 0.000 0.000 0.972 0.028
#> GSM99516     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99518     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99520     3  0.1118     0.8667 0.000 0.000 0.964 0.036
#> GSM99522     3  0.3448     0.7989 0.004 0.000 0.828 0.168
#> GSM99570     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99598     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99432     4  0.3266     0.7051 0.000 0.168 0.000 0.832
#> GSM99434     4  0.3569     0.5898 0.000 0.000 0.196 0.804
#> GSM99436     4  0.4933     0.3813 0.000 0.432 0.000 0.568
#> GSM99438     2  0.0188     0.9281 0.000 0.996 0.000 0.004
#> GSM99440     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99442     2  0.0921     0.9206 0.000 0.972 0.000 0.028
#> GSM99444     2  0.0336     0.9276 0.000 0.992 0.000 0.008
#> GSM99446     2  0.1389     0.9065 0.000 0.952 0.000 0.048
#> GSM99448     3  0.5097     0.3137 0.000 0.004 0.568 0.428
#> GSM99450     4  0.3975     0.5348 0.000 0.000 0.240 0.760
#> GSM99452     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99456     1  0.1209     0.9428 0.964 0.000 0.004 0.032
#> GSM99462     2  0.0000     0.9279 0.000 1.000 0.000 0.000
#> GSM99464     4  0.3245     0.6536 0.028 0.000 0.100 0.872
#> GSM99466     2  0.0921     0.9206 0.000 0.972 0.000 0.028
#> GSM99470     1  0.4898     0.2749 0.584 0.416 0.000 0.000
#> GSM99472     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99474     3  0.1211     0.8677 0.000 0.000 0.960 0.040
#> GSM99476     4  0.2589     0.6547 0.000 0.000 0.116 0.884
#> GSM99478     2  0.0188     0.9280 0.000 0.996 0.000 0.004
#> GSM99480     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99482     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99484     2  0.0817     0.9215 0.000 0.976 0.000 0.024
#> GSM99486     4  0.4977     0.3102 0.000 0.460 0.000 0.540
#> GSM99488     2  0.1022     0.9177 0.000 0.968 0.000 0.032
#> GSM99490     2  0.0188     0.9281 0.000 0.996 0.000 0.004
#> GSM99492     1  0.0921     0.9473 0.972 0.000 0.000 0.028
#> GSM99494     2  0.0188     0.9278 0.000 0.996 0.000 0.004
#> GSM99524     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99526     4  0.2759     0.6948 0.000 0.052 0.044 0.904
#> GSM99528     2  0.5798     0.5791 0.000 0.696 0.208 0.096
#> GSM99530     3  0.3863     0.7537 0.028 0.000 0.828 0.144
#> GSM99532     3  0.2976     0.8382 0.008 0.000 0.872 0.120
#> GSM99534     2  0.0817     0.9227 0.000 0.976 0.000 0.024
#> GSM99536     1  0.0000     0.9599 1.000 0.000 0.000 0.000
#> GSM99538     2  0.3652     0.8166 0.000 0.856 0.052 0.092
#> GSM99540     1  0.0188     0.9584 0.996 0.000 0.000 0.004
#> GSM99542     2  0.1118     0.9155 0.000 0.964 0.000 0.036
#> GSM99544     2  0.4624     0.3405 0.000 0.660 0.000 0.340
#> GSM99546     4  0.3142     0.7182 0.000 0.132 0.008 0.860
#> GSM99548     2  0.0921     0.9208 0.000 0.972 0.000 0.028
#> GSM99550     1  0.3806     0.8167 0.824 0.000 0.020 0.156
#> GSM99552     3  0.0921     0.8537 0.000 0.000 0.972 0.028
#> GSM99554     2  0.3172     0.7626 0.000 0.840 0.000 0.160
#> GSM99556     2  0.0336     0.9273 0.000 0.992 0.000 0.008
#> GSM99558     3  0.1182     0.8540 0.000 0.016 0.968 0.016
#> GSM99560     4  0.4564     0.5571 0.000 0.328 0.000 0.672
#> GSM99562     3  0.3074     0.8157 0.000 0.000 0.848 0.152
#> GSM99564     4  0.4697     0.5290 0.000 0.356 0.000 0.644
#> GSM99572     2  0.0188     0.9281 0.000 0.996 0.000 0.004
#> GSM99576     1  0.1022     0.9452 0.968 0.000 0.000 0.032
#> GSM99578     2  0.1824     0.8970 0.000 0.936 0.004 0.060
#> GSM99580     3  0.0921     0.8557 0.000 0.000 0.972 0.028
#> GSM99582     4  0.6812     0.4250 0.076 0.024 0.288 0.612
#> GSM99584     4  0.3942     0.6595 0.000 0.236 0.000 0.764
#> GSM99586     1  0.1022     0.9452 0.968 0.000 0.000 0.032
#> GSM99588     2  0.1661     0.9027 0.000 0.944 0.004 0.052
#> GSM99590     2  0.0817     0.9227 0.000 0.976 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
#> GSM99496     3  0.3010     0.6226 0.000 0.000 0.824 0.004 0.172
#> GSM99502     1  0.0000     0.9276 1.000 0.000 0.000 0.000 0.000
#> GSM99504     1  0.5299     0.1156 0.520 0.000 0.436 0.004 0.040
#> GSM99506     3  0.1410     0.7071 0.000 0.000 0.940 0.000 0.060
#> GSM99566     3  0.1704     0.7053 0.000 0.000 0.928 0.004 0.068
#> GSM99574     1  0.0290     0.9277 0.992 0.000 0.000 0.000 0.008
#> GSM99592     3  0.4522     0.5949 0.000 0.000 0.744 0.176 0.080
#> GSM99594     3  0.1571     0.7129 0.000 0.000 0.936 0.004 0.060
#> GSM99468     1  0.0404     0.9267 0.988 0.000 0.000 0.000 0.012
#> GSM99498     1  0.1270     0.8932 0.948 0.000 0.052 0.000 0.000
#> GSM99500     1  0.0162     0.9271 0.996 0.000 0.004 0.000 0.000
#> GSM99508     3  0.2209     0.7056 0.000 0.000 0.912 0.032 0.056
#> GSM99568     3  0.2331     0.7100 0.000 0.000 0.900 0.020 0.080
#> GSM99596     3  0.4101     0.3843 0.000 0.000 0.664 0.004 0.332
#> GSM99600     2  0.1082     0.8670 0.000 0.964 0.000 0.028 0.008
#> GSM99458     1  0.0324     0.9275 0.992 0.000 0.000 0.004 0.004
#> GSM99460     1  0.2707     0.8259 0.860 0.000 0.000 0.132 0.008
#> GSM99510     3  0.6436     0.1034 0.000 0.000 0.428 0.396 0.176
#> GSM99512     3  0.4444     0.6109 0.000 0.000 0.756 0.088 0.156
#> GSM99514     3  0.1831     0.7018 0.000 0.000 0.920 0.004 0.076
#> GSM99516     1  0.0000     0.9276 1.000 0.000 0.000 0.000 0.000
#> GSM99518     1  0.0162     0.9276 0.996 0.000 0.000 0.000 0.004
#> GSM99520     3  0.2017     0.7041 0.000 0.000 0.912 0.008 0.080
#> GSM99522     3  0.3710     0.6533 0.000 0.000 0.808 0.048 0.144
#> GSM99570     1  0.0162     0.9270 0.996 0.000 0.000 0.000 0.004
#> GSM99598     1  0.0000     0.9276 1.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.2295     0.6277 0.000 0.088 0.004 0.900 0.008
#> GSM99434     4  0.5282     0.3631 0.000 0.000 0.268 0.644 0.088
#> GSM99436     4  0.4585     0.4582 0.000 0.352 0.000 0.628 0.020
#> GSM99438     2  0.0566     0.8705 0.000 0.984 0.000 0.004 0.012
#> GSM99440     1  0.0162     0.9276 0.996 0.000 0.000 0.000 0.004
#> GSM99442     2  0.2069     0.8353 0.000 0.912 0.000 0.076 0.012
#> GSM99444     2  0.0290     0.8703 0.000 0.992 0.000 0.008 0.000
#> GSM99446     2  0.1877     0.8532 0.000 0.924 0.000 0.064 0.012
#> GSM99448     3  0.7007     0.1661 0.000 0.044 0.468 0.356 0.132
#> GSM99450     4  0.5353     0.3627 0.000 0.000 0.272 0.636 0.092
#> GSM99452     1  0.0000     0.9276 1.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000     0.9276 1.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.3953     0.7752 0.792 0.000 0.000 0.060 0.148
#> GSM99462     2  0.0324     0.8702 0.000 0.992 0.000 0.004 0.004
#> GSM99464     4  0.4031     0.4966 0.004 0.000 0.048 0.788 0.160
#> GSM99466     2  0.5418     0.5749 0.000 0.684 0.016 0.208 0.092
#> GSM99470     1  0.4325     0.5743 0.724 0.240 0.000 0.000 0.036
#> GSM99472     1  0.0771     0.9199 0.976 0.000 0.000 0.004 0.020
#> GSM99474     3  0.1331     0.7164 0.000 0.000 0.952 0.008 0.040
#> GSM99476     4  0.1901     0.5976 0.000 0.004 0.024 0.932 0.040
#> GSM99478     2  0.1914     0.8605 0.000 0.928 0.008 0.008 0.056
#> GSM99480     1  0.0510     0.9255 0.984 0.000 0.000 0.000 0.016
#> GSM99482     1  0.0510     0.9231 0.984 0.000 0.000 0.000 0.016
#> GSM99484     2  0.0898     0.8694 0.000 0.972 0.000 0.008 0.020
#> GSM99486     4  0.5435     0.2435 0.000 0.428 0.000 0.512 0.060
#> GSM99488     2  0.1638     0.8487 0.000 0.932 0.000 0.004 0.064
#> GSM99490     2  0.2305     0.8391 0.000 0.896 0.000 0.012 0.092
#> GSM99492     1  0.1956     0.8862 0.916 0.000 0.000 0.008 0.076
#> GSM99494     2  0.0290     0.8696 0.000 0.992 0.000 0.000 0.008
#> GSM99524     1  0.0794     0.9181 0.972 0.000 0.000 0.000 0.028
#> GSM99526     4  0.1774     0.5895 0.000 0.000 0.016 0.932 0.052
#> GSM99528     5  0.5841     0.4928 0.000 0.256 0.148 0.000 0.596
#> GSM99530     5  0.5197     0.2900 0.000 0.000 0.316 0.064 0.620
#> GSM99532     3  0.5161     0.5849 0.016 0.000 0.716 0.092 0.176
#> GSM99534     2  0.1522     0.8575 0.000 0.944 0.000 0.044 0.012
#> GSM99536     1  0.0290     0.9273 0.992 0.000 0.000 0.000 0.008
#> GSM99538     2  0.6306     0.2482 0.000 0.568 0.052 0.064 0.316
#> GSM99540     1  0.0693     0.9240 0.980 0.000 0.000 0.008 0.012
#> GSM99542     2  0.1638     0.8487 0.000 0.932 0.000 0.004 0.064
#> GSM99544     2  0.4288     0.4425 0.000 0.664 0.000 0.324 0.012
#> GSM99546     4  0.3289     0.6267 0.016 0.088 0.000 0.860 0.036
#> GSM99548     2  0.3550     0.6864 0.000 0.760 0.000 0.004 0.236
#> GSM99550     4  0.7346    -0.0413 0.312 0.008 0.012 0.376 0.292
#> GSM99552     3  0.4009     0.4443 0.000 0.000 0.684 0.004 0.312
#> GSM99554     2  0.4157     0.5664 0.000 0.716 0.000 0.264 0.020
#> GSM99556     2  0.0955     0.8685 0.000 0.968 0.000 0.004 0.028
#> GSM99558     3  0.5137     0.4101 0.000 0.108 0.684 0.000 0.208
#> GSM99560     4  0.5631     0.4812 0.000 0.200 0.000 0.636 0.164
#> GSM99562     3  0.3543     0.6683 0.000 0.000 0.828 0.060 0.112
#> GSM99564     4  0.4040     0.5757 0.000 0.260 0.000 0.724 0.016
#> GSM99572     2  0.0671     0.8705 0.000 0.980 0.000 0.004 0.016
#> GSM99576     1  0.2411     0.8640 0.884 0.000 0.000 0.008 0.108
#> GSM99578     2  0.2561     0.7961 0.000 0.856 0.000 0.000 0.144
#> GSM99580     3  0.3353     0.6288 0.000 0.000 0.796 0.008 0.196
#> GSM99582     4  0.7415     0.4697 0.072 0.044 0.144 0.596 0.144
#> GSM99584     4  0.4157     0.5761 0.000 0.264 0.000 0.716 0.020
#> GSM99586     1  0.3284     0.8140 0.828 0.000 0.000 0.024 0.148
#> GSM99588     2  0.2068     0.8286 0.000 0.904 0.000 0.004 0.092
#> GSM99590     2  0.0609     0.8682 0.000 0.980 0.000 0.020 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM99496     6  0.3534   0.584262 0.000 0.000 0.276 0.000 0.008 0.716
#> GSM99502     1  0.0146   0.920039 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM99504     1  0.5617   0.314639 0.584 0.000 0.148 0.004 0.008 0.256
#> GSM99506     3  0.3668   0.482546 0.000 0.000 0.668 0.004 0.000 0.328
#> GSM99566     3  0.3997   0.511794 0.000 0.000 0.688 0.004 0.020 0.288
#> GSM99574     1  0.0260   0.920447 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM99592     3  0.3952   0.652643 0.000 0.000 0.788 0.108 0.016 0.088
#> GSM99594     3  0.3109   0.625447 0.000 0.000 0.772 0.004 0.000 0.224
#> GSM99468     1  0.0363   0.919334 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99498     1  0.1624   0.885945 0.936 0.000 0.020 0.004 0.000 0.040
#> GSM99500     1  0.0717   0.917494 0.976 0.000 0.000 0.000 0.008 0.016
#> GSM99508     3  0.2823   0.647928 0.000 0.000 0.796 0.000 0.000 0.204
#> GSM99568     3  0.2632   0.668276 0.000 0.000 0.832 0.000 0.004 0.164
#> GSM99596     6  0.3370   0.656730 0.000 0.000 0.148 0.000 0.048 0.804
#> GSM99600     2  0.3398   0.730629 0.000 0.768 0.000 0.216 0.012 0.004
#> GSM99458     1  0.0146   0.920590 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM99460     1  0.2784   0.834579 0.880 0.000 0.064 0.020 0.032 0.004
#> GSM99510     3  0.2505   0.645709 0.000 0.000 0.888 0.040 0.064 0.008
#> GSM99512     3  0.1426   0.674952 0.000 0.000 0.948 0.008 0.016 0.028
#> GSM99514     6  0.4513   0.294079 0.000 0.000 0.396 0.004 0.028 0.572
#> GSM99516     1  0.0458   0.917986 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM99518     1  0.0000   0.920232 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99520     3  0.4067   0.148919 0.000 0.000 0.548 0.000 0.008 0.444
#> GSM99522     3  0.1623   0.684075 0.004 0.000 0.940 0.004 0.020 0.032
#> GSM99570     1  0.0458   0.917986 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM99598     1  0.0000   0.920232 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99432     4  0.3620   0.602889 0.000 0.036 0.020 0.804 0.140 0.000
#> GSM99434     3  0.5515   0.248789 0.000 0.000 0.596 0.204 0.192 0.008
#> GSM99436     4  0.2985   0.668975 0.000 0.116 0.000 0.844 0.036 0.004
#> GSM99438     2  0.0935   0.824133 0.000 0.964 0.000 0.032 0.004 0.000
#> GSM99440     1  0.0260   0.919754 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM99442     2  0.4506   0.497042 0.000 0.616 0.000 0.344 0.036 0.004
#> GSM99444     2  0.2094   0.815725 0.000 0.900 0.000 0.080 0.020 0.000
#> GSM99446     2  0.3284   0.747865 0.000 0.784 0.000 0.196 0.020 0.000
#> GSM99448     3  0.3484   0.638825 0.000 0.020 0.844 0.040 0.076 0.020
#> GSM99450     3  0.5275   0.099889 0.000 0.000 0.532 0.372 0.092 0.004
#> GSM99452     1  0.0000   0.920232 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99454     1  0.0000   0.920232 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM99456     1  0.3240   0.695785 0.752 0.000 0.000 0.004 0.244 0.000
#> GSM99462     2  0.0622   0.822879 0.000 0.980 0.000 0.008 0.012 0.000
#> GSM99464     5  0.6090   0.089822 0.004 0.000 0.224 0.368 0.404 0.000
#> GSM99466     4  0.6123   0.484088 0.000 0.080 0.000 0.568 0.096 0.256
#> GSM99470     1  0.4450   0.734207 0.788 0.056 0.000 0.024 0.068 0.064
#> GSM99472     1  0.0891   0.912162 0.968 0.000 0.000 0.000 0.024 0.008
#> GSM99474     3  0.2920   0.672328 0.000 0.000 0.820 0.004 0.008 0.168
#> GSM99476     4  0.3381   0.531583 0.000 0.000 0.040 0.808 0.148 0.004
#> GSM99478     2  0.6757   0.327667 0.000 0.460 0.000 0.148 0.084 0.308
#> GSM99480     1  0.0363   0.919334 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99482     1  0.0632   0.915179 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM99484     2  0.4262   0.743422 0.000 0.760 0.000 0.148 0.068 0.024
#> GSM99486     4  0.3883   0.657139 0.000 0.088 0.000 0.800 0.088 0.024
#> GSM99488     2  0.1075   0.812462 0.000 0.952 0.000 0.000 0.048 0.000
#> GSM99490     2  0.3063   0.796059 0.000 0.840 0.000 0.068 0.092 0.000
#> GSM99492     1  0.1863   0.861768 0.896 0.000 0.000 0.000 0.104 0.000
#> GSM99494     2  0.0547   0.820215 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM99524     1  0.1794   0.885500 0.924 0.000 0.000 0.000 0.036 0.040
#> GSM99526     4  0.5926  -0.050087 0.000 0.000 0.232 0.496 0.268 0.004
#> GSM99528     6  0.5700   0.054690 0.000 0.132 0.012 0.000 0.324 0.532
#> GSM99530     5  0.6226   0.000692 0.020 0.000 0.108 0.024 0.516 0.332
#> GSM99532     3  0.4126   0.630945 0.012 0.000 0.788 0.020 0.124 0.056
#> GSM99534     2  0.3571   0.787547 0.016 0.812 0.000 0.124 0.048 0.000
#> GSM99536     1  0.0363   0.919334 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM99538     2  0.5778   0.382625 0.000 0.544 0.060 0.020 0.352 0.024
#> GSM99540     1  0.0993   0.912953 0.964 0.000 0.012 0.000 0.024 0.000
#> GSM99542     2  0.1267   0.809293 0.000 0.940 0.000 0.000 0.060 0.000
#> GSM99544     2  0.5251   0.609276 0.000 0.656 0.048 0.248 0.036 0.012
#> GSM99546     4  0.4968   0.500957 0.008 0.020 0.108 0.728 0.128 0.008
#> GSM99548     2  0.3782   0.688054 0.000 0.740 0.000 0.036 0.224 0.000
#> GSM99550     5  0.6035   0.327410 0.184 0.012 0.000 0.216 0.572 0.016
#> GSM99552     6  0.2579   0.618766 0.000 0.000 0.088 0.004 0.032 0.876
#> GSM99554     4  0.4867   0.524862 0.000 0.256 0.000 0.660 0.068 0.016
#> GSM99556     2  0.0725   0.823502 0.000 0.976 0.000 0.012 0.012 0.000
#> GSM99558     6  0.4490   0.639709 0.000 0.108 0.172 0.000 0.004 0.716
#> GSM99560     4  0.4554   0.592514 0.000 0.104 0.000 0.716 0.172 0.008
#> GSM99562     3  0.0806   0.689902 0.000 0.000 0.972 0.000 0.008 0.020
#> GSM99564     4  0.2402   0.676911 0.000 0.084 0.000 0.888 0.020 0.008
#> GSM99572     2  0.1913   0.816886 0.000 0.908 0.000 0.080 0.012 0.000
#> GSM99576     1  0.2146   0.849650 0.880 0.004 0.000 0.000 0.116 0.000
#> GSM99578     2  0.1707   0.813468 0.000 0.928 0.000 0.004 0.056 0.012
#> GSM99580     3  0.3514   0.613652 0.000 0.000 0.752 0.000 0.020 0.228
#> GSM99582     4  0.5756   0.457329 0.024 0.012 0.000 0.608 0.108 0.248
#> GSM99584     4  0.3322   0.666176 0.000 0.088 0.020 0.848 0.032 0.012
#> GSM99586     1  0.3215   0.700760 0.756 0.000 0.000 0.004 0.240 0.000
#> GSM99588     2  0.1700   0.801821 0.000 0.916 0.000 0.000 0.080 0.004
#> GSM99590     2  0.1700   0.816079 0.000 0.916 0.000 0.080 0.004 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-NMF-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) cell.type(p) k
#> ATC:NMF 84         4.25e-06     2.72e-05 2
#> ATC:NMF 85         1.76e-04     4.87e-03 3
#> ATC:NMF 77         3.63e-05     1.57e-03 4
#> ATC:NMF 67         5.28e-05     1.68e-03 5
#> ATC:NMF 69         1.53e-03     3.53e-02 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.

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