cola Report for GDS3919

Date: 2019-12-25 21:04:46 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 19175 rows and 81 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] 19175    81

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:kmeans 2 1.000 0.999 1.000 **
CV:kmeans 2 1.000 0.990 0.996 **
CV:skmeans 2 1.000 0.984 0.994 **
CV:NMF 2 1.000 0.998 0.999 **
MAD:kmeans 2 1.000 0.974 0.990 **
MAD:skmeans 2 1.000 0.987 0.995 **
ATC:kmeans 2 1.000 1.000 1.000 **
SD:skmeans 4 0.989 0.962 0.979 ** 2,3
MAD:mclust 4 0.988 0.958 0.971 ** 2,3
ATC:NMF 3 0.953 0.942 0.976 ** 2
SD:pam 2 0.948 0.943 0.978 *
ATC:mclust 3 0.928 0.962 0.979 * 2
MAD:pam 2 0.924 0.960 0.982 *
ATC:skmeans 4 0.920 0.922 0.957 * 2,3
SD:mclust 4 0.920 0.899 0.952 * 2
ATC:hclust 3 0.908 0.928 0.960 *
SD:NMF 4 0.907 0.876 0.941 * 2
ATC:pam 6 0.905 0.811 0.909 * 2
MAD:NMF 4 0.904 0.902 0.945 * 2
MAD:hclust 6 0.887 0.844 0.905
CV:mclust 2 0.860 0.978 0.988
CV:pam 2 0.737 0.848 0.938
SD:hclust 4 0.685 0.836 0.854
CV:hclust 2 0.547 0.863 0.927

**: 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.9999       1.000          0.507 0.494   0.494
#> CV:NMF      2 1.000          0.9977       0.999          0.506 0.494   0.494
#> MAD:NMF     2 1.000          0.9953       0.998          0.507 0.494   0.494
#> ATC:NMF     2 1.000          0.9697       0.987          0.503 0.496   0.496
#> SD:skmeans  2 1.000          0.9973       0.999          0.507 0.494   0.494
#> CV:skmeans  2 1.000          0.9844       0.994          0.506 0.494   0.494
#> MAD:skmeans 2 1.000          0.9870       0.995          0.507 0.494   0.494
#> ATC:skmeans 2 1.000          1.0000       1.000          0.507 0.494   0.494
#> SD:mclust   2 1.000          1.0000       1.000          0.501 0.500   0.500
#> CV:mclust   2 0.860          0.9780       0.988          0.494 0.503   0.503
#> MAD:mclust  2 1.000          1.0000       1.000          0.501 0.500   0.500
#> ATC:mclust  2 1.000          1.0000       1.000          0.501 0.500   0.500
#> SD:kmeans   2 1.000          0.9992       1.000          0.507 0.494   0.494
#> CV:kmeans   2 1.000          0.9896       0.996          0.506 0.494   0.494
#> MAD:kmeans  2 1.000          0.9744       0.990          0.506 0.494   0.494
#> ATC:kmeans  2 1.000          1.0000       1.000          0.507 0.494   0.494
#> SD:pam      2 0.948          0.9434       0.978          0.505 0.494   0.494
#> CV:pam      2 0.737          0.8476       0.938          0.497 0.498   0.498
#> MAD:pam     2 0.924          0.9602       0.982          0.505 0.494   0.494
#> ATC:pam     2 1.000          0.9989       0.999          0.507 0.494   0.494
#> SD:hclust   2 0.502          0.6191       0.829          0.443 0.650   0.650
#> CV:hclust   2 0.547          0.8627       0.927          0.485 0.494   0.494
#> MAD:hclust  2 0.497          0.0676       0.621          0.453 0.568   0.568
#> ATC:hclust  2 0.664          0.8963       0.932          0.482 0.494   0.494
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.830           0.860       0.939          0.289 0.797   0.609
#> CV:NMF      3 0.718           0.814       0.903          0.253 0.819   0.649
#> MAD:NMF     3 0.764           0.822       0.916          0.286 0.800   0.615
#> ATC:NMF     3 0.953           0.942       0.976          0.279 0.811   0.635
#> SD:skmeans  3 0.975           0.956       0.970          0.264 0.805   0.627
#> CV:skmeans  3 0.866           0.863       0.939          0.277 0.805   0.625
#> MAD:skmeans 3 0.859           0.923       0.932          0.261 0.800   0.618
#> ATC:skmeans 3 1.000           0.970       0.986          0.210 0.898   0.794
#> SD:mclust   3 0.822           0.778       0.905          0.299 0.861   0.722
#> CV:mclust   3 0.621           0.812       0.879          0.300 0.832   0.673
#> MAD:mclust  3 0.901           0.973       0.983          0.287 0.857   0.714
#> ATC:mclust  3 0.928           0.962       0.979          0.301 0.844   0.689
#> SD:kmeans   3 0.725           0.563       0.727          0.244 0.794   0.606
#> CV:kmeans   3 0.708           0.821       0.846          0.264 0.810   0.637
#> MAD:kmeans  3 0.652           0.457       0.765          0.247 0.966   0.931
#> ATC:kmeans  3 0.695           0.792       0.828          0.234 0.880   0.756
#> SD:pam      3 0.646           0.730       0.840          0.259 0.863   0.729
#> CV:pam      3 0.563           0.542       0.768          0.311 0.765   0.560
#> MAD:pam     3 0.785           0.828       0.886          0.290 0.794   0.606
#> ATC:pam     3 0.867           0.852       0.905          0.235 0.809   0.638
#> SD:hclust   3 0.535           0.569       0.760          0.437 0.666   0.495
#> CV:hclust   3 0.447           0.778       0.840          0.255 0.883   0.763
#> MAD:hclust  3 0.549           0.550       0.760          0.411 0.514   0.300
#> ATC:hclust  3 0.908           0.928       0.960          0.254 0.896   0.790
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.907           0.876       0.941         0.1331 0.771   0.447
#> CV:NMF      4 0.741           0.803       0.888         0.1750 0.799   0.498
#> MAD:NMF     4 0.904           0.902       0.945         0.1382 0.760   0.430
#> ATC:NMF     4 0.733           0.738       0.854         0.1256 0.822   0.571
#> SD:skmeans  4 0.989           0.962       0.979         0.1643 0.870   0.647
#> CV:skmeans  4 0.754           0.855       0.917         0.1587 0.845   0.587
#> MAD:skmeans 4 0.883           0.928       0.957         0.1509 0.864   0.635
#> ATC:skmeans 4 0.920           0.922       0.957         0.1299 0.895   0.735
#> SD:mclust   4 0.920           0.899       0.952         0.0944 0.921   0.786
#> CV:mclust   4 0.782           0.851       0.908         0.0938 0.941   0.837
#> MAD:mclust  4 0.988           0.958       0.971         0.0864 0.934   0.817
#> ATC:mclust  4 0.789           0.839       0.889         0.0894 0.911   0.748
#> SD:kmeans   4 0.701           0.773       0.797         0.1469 0.858   0.626
#> CV:kmeans   4 0.815           0.805       0.871         0.1403 0.859   0.625
#> MAD:kmeans  4 0.710           0.716       0.783         0.1457 0.767   0.508
#> ATC:kmeans  4 0.808           0.681       0.839         0.1397 0.819   0.558
#> SD:pam      4 0.688           0.571       0.723         0.1388 0.956   0.883
#> CV:pam      4 0.564           0.569       0.776         0.1248 0.853   0.600
#> MAD:pam     4 0.669           0.771       0.852         0.1450 0.903   0.717
#> ATC:pam     4 0.894           0.870       0.939         0.0989 0.862   0.668
#> SD:hclust   4 0.685           0.836       0.854         0.1485 0.815   0.521
#> CV:hclust   4 0.600           0.656       0.787         0.1680 0.841   0.591
#> MAD:hclust  4 0.768           0.842       0.850         0.1603 0.868   0.628
#> ATC:hclust  4 0.809           0.843       0.898         0.1441 0.944   0.858
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.809           0.788       0.884         0.0598 0.921   0.714
#> CV:NMF      5 0.717           0.642       0.797         0.0566 0.976   0.901
#> MAD:NMF     5 0.866           0.844       0.917         0.0572 0.919   0.707
#> ATC:NMF     5 0.864           0.868       0.922         0.0861 0.881   0.625
#> SD:skmeans  5 0.846           0.815       0.893         0.0564 0.921   0.708
#> CV:skmeans  5 0.740           0.717       0.849         0.0588 0.923   0.708
#> MAD:skmeans 5 0.846           0.818       0.899         0.0704 0.914   0.691
#> ATC:skmeans 5 0.857           0.876       0.925         0.1137 0.869   0.590
#> SD:mclust   5 0.835           0.894       0.923         0.0876 0.920   0.733
#> CV:mclust   5 0.681           0.701       0.798         0.0763 0.917   0.735
#> MAD:mclust  5 0.837           0.822       0.893         0.0821 0.905   0.699
#> ATC:mclust  5 0.776           0.799       0.864         0.0716 0.922   0.724
#> SD:kmeans   5 0.665           0.735       0.816         0.0684 0.930   0.749
#> CV:kmeans   5 0.788           0.792       0.838         0.0631 0.911   0.677
#> MAD:kmeans  5 0.680           0.777       0.833         0.0663 0.931   0.743
#> ATC:kmeans  5 0.725           0.668       0.751         0.0779 0.885   0.625
#> SD:pam      5 0.834           0.791       0.904         0.0961 0.814   0.489
#> CV:pam      5 0.734           0.663       0.796         0.0827 0.899   0.635
#> MAD:pam     5 0.827           0.832       0.917         0.0667 0.867   0.540
#> ATC:pam     5 0.862           0.925       0.935         0.1419 0.868   0.596
#> SD:hclust   5 0.813           0.790       0.875         0.0803 0.963   0.853
#> CV:hclust   5 0.686           0.630       0.819         0.0753 0.909   0.671
#> MAD:hclust  5 0.815           0.789       0.851         0.0635 0.972   0.886
#> ATC:hclust  5 0.857           0.403       0.681         0.0754 0.821   0.498
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.857           0.830       0.909         0.0357 0.959   0.815
#> CV:NMF      6 0.756           0.716       0.841         0.0364 0.932   0.707
#> MAD:NMF     6 0.851           0.785       0.893         0.0330 0.949   0.776
#> ATC:NMF     6 0.771           0.768       0.859         0.0194 0.954   0.794
#> SD:skmeans  6 0.824           0.748       0.852         0.0341 0.965   0.840
#> CV:skmeans  6 0.721           0.630       0.807         0.0340 0.968   0.852
#> MAD:skmeans 6 0.825           0.744       0.850         0.0350 0.974   0.876
#> ATC:skmeans 6 0.849           0.874       0.914         0.0428 0.965   0.840
#> SD:mclust   6 0.759           0.779       0.834         0.0296 0.961   0.827
#> CV:mclust   6 0.667           0.715       0.765         0.0434 0.958   0.827
#> MAD:mclust  6 0.781           0.757       0.817         0.0439 0.952   0.808
#> ATC:mclust  6 0.880           0.861       0.906         0.0396 0.962   0.838
#> SD:kmeans   6 0.717           0.666       0.759         0.0478 1.000   1.000
#> CV:kmeans   6 0.759           0.689       0.816         0.0430 0.966   0.844
#> MAD:kmeans  6 0.780           0.714       0.790         0.0470 0.982   0.919
#> ATC:kmeans  6 0.701           0.652       0.778         0.0458 0.940   0.751
#> SD:pam      6 0.869           0.799       0.902         0.0391 0.952   0.775
#> CV:pam      6 0.791           0.690       0.837         0.0325 0.945   0.746
#> MAD:pam     6 0.865           0.834       0.920         0.0312 0.973   0.864
#> ATC:pam     6 0.905           0.811       0.909         0.0543 0.887   0.529
#> SD:hclust   6 0.834           0.767       0.825         0.0327 0.967   0.844
#> CV:hclust   6 0.766           0.701       0.834         0.0339 0.963   0.836
#> MAD:hclust  6 0.887           0.844       0.905         0.0325 0.943   0.752
#> ATC:hclust  6 0.801           0.769       0.879         0.0442 0.841   0.448

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)  time(p) k
#> SD:NMF      81         8.31e-15 6.68e-12 2
#> CV:NMF      81         2.66e-14 3.66e-11 2
#> MAD:NMF     81         8.31e-15 6.68e-12 2
#> ATC:NMF     81         3.67e-13 7.52e-11 2
#> SD:skmeans  81         8.31e-15 6.68e-12 2
#> CV:skmeans  80         1.27e-14 1.07e-11 2
#> MAD:skmeans 80         3.52e-15 2.80e-12 2
#> ATC:skmeans 81         2.25e-15 1.79e-12 2
#> SD:mclust   81         2.58e-18 2.22e-15 2
#> CV:mclust   81         1.87e-17 1.38e-14 2
#> MAD:mclust  81         2.58e-18 2.22e-15 2
#> ATC:mclust  81         2.58e-18 2.22e-15 2
#> SD:kmeans   81         8.31e-15 6.68e-12 2
#> CV:kmeans   80         1.27e-14 1.07e-11 2
#> MAD:kmeans  80         3.52e-15 2.80e-12 2
#> ATC:kmeans  81         2.25e-15 1.79e-12 2
#> SD:pam      79         1.34e-15 8.94e-13 2
#> CV:pam      74         3.66e-13 6.07e-10 2
#> MAD:pam     80         3.52e-15 2.13e-12 2
#> ATC:pam     81         2.25e-15 1.79e-12 2
#> SD:hclust   57         9.39e-10 2.44e-07 2
#> CV:hclust   79         5.88e-14 9.17e-11 2
#> MAD:hclust   0               NA       NA 2
#> ATC:hclust  81         8.31e-15 6.68e-12 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p)  time(p) k
#> SD:NMF      74         1.13e-14 2.50e-06 3
#> CV:NMF      73         9.31e-17 1.77e-07 3
#> MAD:NMF     75         7.19e-11 5.22e-07 3
#> ATC:NMF     79         1.35e-17 1.03e-07 3
#> SD:skmeans  81         3.60e-27 5.71e-12 3
#> CV:skmeans  75         2.83e-28 3.27e-12 3
#> MAD:skmeans 80         2.62e-29 2.47e-12 3
#> ATC:skmeans 79         2.34e-21 2.10e-09 3
#> SD:mclust   64         2.57e-22 2.07e-09 3
#> CV:mclust   74         6.00e-28 2.93e-11 3
#> MAD:mclust  81         3.91e-20 4.99e-13 3
#> ATC:mclust  81         2.64e-23 5.91e-13 3
#> SD:kmeans   53         3.10e-12 1.17e-09 3
#> CV:kmeans   76         3.75e-26 3.41e-11 3
#> MAD:kmeans  50         2.49e-15 1.53e-10 3
#> ATC:kmeans  71         3.57e-20 1.36e-08 3
#> SD:pam      70         1.75e-20 1.23e-10 3
#> CV:pam      49         2.29e-11 7.46e-09 3
#> MAD:pam     80         1.31e-16 5.09e-13 3
#> ATC:pam     77         9.00e-19 3.70e-12 3
#> SD:hclust   70         1.89e-11 4.80e-03 3
#> CV:hclust   75         1.31e-21 3.11e-08 3
#> MAD:hclust  52         1.47e-14 5.95e-05 3
#> ATC:hclust  81         1.14e-20 2.30e-09 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p)  time(p) k
#> SD:NMF      75         1.29e-22 1.20e-07 4
#> CV:NMF      75         6.77e-23 6.06e-07 4
#> MAD:NMF     78         2.10e-23 5.21e-08 4
#> ATC:NMF     70         7.81e-25 5.24e-09 4
#> SD:skmeans  80         7.58e-24 3.57e-08 4
#> CV:skmeans  77         1.32e-22 1.20e-07 4
#> MAD:skmeans 80         2.81e-24 4.12e-08 4
#> ATC:skmeans 79         5.71e-21 3.22e-08 4
#> SD:mclust   79         4.89e-26 5.11e-10 4
#> CV:mclust   78         2.73e-28 7.14e-10 4
#> MAD:mclust  81         7.80e-27 1.38e-10 4
#> ATC:mclust  78         9.56e-22 1.24e-10 4
#> SD:kmeans   74         7.74e-25 4.80e-09 4
#> CV:kmeans   74         5.68e-25 3.30e-09 4
#> MAD:kmeans  68         8.55e-24 5.14e-08 4
#> ATC:kmeans  60         6.88e-22 6.36e-09 4
#> SD:pam      63         1.66e-21 3.09e-08 4
#> CV:pam      58         6.50e-21 1.04e-06 4
#> MAD:pam     77         7.44e-15 4.55e-10 4
#> ATC:pam     76         8.89e-23 1.89e-10 4
#> SD:hclust   75         7.84e-23 6.00e-07 4
#> CV:hclust   64         9.97e-20 2.41e-07 4
#> MAD:hclust  80         7.11e-22 1.39e-07 4
#> ATC:hclust  76         1.33e-22 6.02e-10 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p)  time(p) k
#> SD:NMF      76         1.35e-20 2.64e-07 5
#> CV:NMF      66         2.10e-19 1.51e-06 5
#> MAD:NMF     78         5.39e-22 4.75e-09 5
#> ATC:NMF     78         9.09e-22 1.39e-08 5
#> SD:skmeans  77         5.28e-24 3.07e-08 5
#> CV:skmeans  70         2.73e-22 2.97e-07 5
#> MAD:skmeans 75         1.82e-24 5.75e-08 5
#> ATC:skmeans 74         1.51e-23 7.66e-08 5
#> SD:mclust   80         4.92e-25 2.60e-08 5
#> CV:mclust   67         3.26e-22 1.19e-06 5
#> MAD:mclust  74         1.01e-23 6.87e-08 5
#> ATC:mclust  70         1.20e-21 1.07e-09 5
#> SD:kmeans   68         1.52e-19 5.08e-07 5
#> CV:kmeans   74         1.78e-25 1.10e-07 5
#> MAD:kmeans  71         1.83e-22 3.13e-07 5
#> ATC:kmeans  61         4.93e-17 7.00e-06 5
#> SD:pam      71         2.84e-22 2.95e-08 5
#> CV:pam      63         7.92e-21 1.07e-06 5
#> MAD:pam     74         1.78e-25 1.42e-07 5
#> ATC:pam     79         2.36e-19 7.35e-07 5
#> SD:hclust   75         3.58e-20 1.09e-07 5
#> CV:hclust   58         1.31e-15 7.82e-07 5
#> MAD:hclust  74         4.64e-18 1.27e-07 5
#> ATC:hclust  42         9.88e-06 7.67e-01 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p)  time(p) k
#> SD:NMF      78         2.64e-21 4.13e-07 6
#> CV:NMF      70         6.40e-19 3.29e-06 6
#> MAD:NMF     72         4.21e-20 1.81e-06 6
#> ATC:NMF     75         2.99e-20 1.72e-06 6
#> SD:skmeans  74         3.62e-24 3.66e-06 6
#> CV:skmeans  67         2.20e-22 1.81e-06 6
#> MAD:skmeans 72         2.18e-23 5.08e-06 6
#> ATC:skmeans 78         2.39e-23 3.26e-08 6
#> SD:mclust   75         4.06e-22 4.91e-08 6
#> CV:mclust   71         1.15e-22 4.08e-07 6
#> MAD:mclust  73         4.00e-22 1.78e-08 6
#> ATC:mclust  77         1.48e-22 1.54e-08 6
#> SD:kmeans   69         3.74e-20 4.80e-07 6
#> CV:kmeans   68         7.82e-23 6.70e-07 6
#> MAD:kmeans  71         1.83e-22 3.13e-07 6
#> ATC:kmeans  64         7.33e-19 6.72e-06 6
#> SD:pam      73         5.87e-20 4.16e-08 6
#> CV:pam      69         1.30e-23 5.06e-05 6
#> MAD:pam     75         1.15e-24 2.15e-06 6
#> ATC:pam     69         1.16e-19 3.70e-07 6
#> SD:hclust   79         5.29e-24 2.24e-08 6
#> CV:hclust   69         7.90e-20 6.23e-06 6
#> MAD:hclust  77         1.36e-22 3.65e-08 6
#> ATC:hclust  69         1.28e-19 8.02e-07 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 19175 rows and 81 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.502           0.619       0.829         0.4433 0.650   0.650
#> 3 3 0.535           0.569       0.760         0.4368 0.666   0.495
#> 4 4 0.685           0.836       0.854         0.1485 0.815   0.521
#> 5 5 0.813           0.790       0.875         0.0803 0.963   0.853
#> 6 6 0.834           0.767       0.825         0.0327 0.967   0.844

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
#> GSM509706     1  0.9922      0.754 0.552 0.448
#> GSM509711     1  0.9286      0.713 0.656 0.344
#> GSM509714     1  0.7528      0.165 0.784 0.216
#> GSM509719     1  0.9922      0.754 0.552 0.448
#> GSM509724     1  0.9922      0.754 0.552 0.448
#> GSM509729     1  0.9909      0.755 0.556 0.444
#> GSM509707     1  0.9922      0.754 0.552 0.448
#> GSM509712     1  0.9286      0.713 0.656 0.344
#> GSM509715     2  0.9933      0.955 0.452 0.548
#> GSM509720     1  0.9922      0.754 0.552 0.448
#> GSM509725     1  0.9922      0.754 0.552 0.448
#> GSM509730     1  0.9909      0.755 0.556 0.444
#> GSM509708     1  0.9922      0.754 0.552 0.448
#> GSM509713     1  0.9286      0.713 0.656 0.344
#> GSM509716     2  0.9933      0.955 0.452 0.548
#> GSM509721     1  0.9922      0.754 0.552 0.448
#> GSM509726     1  0.9922      0.754 0.552 0.448
#> GSM509731     2  1.0000      0.901 0.496 0.504
#> GSM509709     1  0.9922      0.754 0.552 0.448
#> GSM509717     2  0.9933      0.955 0.452 0.548
#> GSM509722     1  0.9922      0.754 0.552 0.448
#> GSM509727     1  0.9909      0.755 0.556 0.444
#> GSM509710     1  0.9922      0.754 0.552 0.448
#> GSM509718     1  0.9993     -0.876 0.516 0.484
#> GSM509723     1  0.9922      0.754 0.552 0.448
#> GSM509728     1  0.9909      0.755 0.556 0.444
#> GSM509732     1  0.9922      0.754 0.552 0.448
#> GSM509736     1  0.9896      0.754 0.560 0.440
#> GSM509741     1  0.9922      0.754 0.552 0.448
#> GSM509746     1  0.9922      0.754 0.552 0.448
#> GSM509733     1  0.9922      0.754 0.552 0.448
#> GSM509737     1  0.9896      0.754 0.560 0.440
#> GSM509742     1  0.9922      0.754 0.552 0.448
#> GSM509747     1  0.9922      0.754 0.552 0.448
#> GSM509734     1  0.9922      0.754 0.552 0.448
#> GSM509738     1  0.9896      0.754 0.560 0.440
#> GSM509743     1  0.9909      0.755 0.556 0.444
#> GSM509748     1  0.9909      0.755 0.556 0.444
#> GSM509735     1  0.9922      0.754 0.552 0.448
#> GSM509739     1  0.9922      0.754 0.552 0.448
#> GSM509744     1  0.9909      0.755 0.556 0.444
#> GSM509749     1  0.9909      0.755 0.556 0.444
#> GSM509740     1  0.9552      0.710 0.624 0.376
#> GSM509745     1  0.9491      0.714 0.632 0.368
#> GSM509750     1  0.9896      0.754 0.560 0.440
#> GSM509751     1  0.0000      0.417 1.000 0.000
#> GSM509753     1  0.0000      0.417 1.000 0.000
#> GSM509755     1  0.0000      0.417 1.000 0.000
#> GSM509757     1  0.0000      0.417 1.000 0.000
#> GSM509759     1  0.0000      0.417 1.000 0.000
#> GSM509761     1  0.0376      0.410 0.996 0.004
#> GSM509763     2  0.9993      0.951 0.484 0.516
#> GSM509765     2  0.9998      0.941 0.492 0.508
#> GSM509767     1  0.0376      0.409 0.996 0.004
#> GSM509769     1  0.6887     -0.162 0.816 0.184
#> GSM509771     1  0.0000      0.417 1.000 0.000
#> GSM509773     1  0.8955     -0.559 0.688 0.312
#> GSM509775     1  0.9209     -0.619 0.664 0.336
#> GSM509777     2  0.9922      0.975 0.448 0.552
#> GSM509779     2  0.9922      0.975 0.448 0.552
#> GSM509781     2  0.9922      0.975 0.448 0.552
#> GSM509783     2  0.9922      0.975 0.448 0.552
#> GSM509785     2  0.9922      0.975 0.448 0.552
#> GSM509752     1  0.0000      0.417 1.000 0.000
#> GSM509754     1  0.0000      0.417 1.000 0.000
#> GSM509756     1  0.0000      0.417 1.000 0.000
#> GSM509758     1  0.0376      0.409 0.996 0.004
#> GSM509760     1  0.0000      0.417 1.000 0.000
#> GSM509762     1  0.0376      0.410 0.996 0.004
#> GSM509764     1  0.0000      0.417 1.000 0.000
#> GSM509766     2  0.9998      0.941 0.492 0.508
#> GSM509768     1  0.9815     -0.801 0.580 0.420
#> GSM509770     1  0.0000      0.417 1.000 0.000
#> GSM509772     1  0.0000      0.417 1.000 0.000
#> GSM509774     2  0.9922      0.975 0.448 0.552
#> GSM509776     1  0.9087     -0.589 0.676 0.324
#> GSM509778     2  0.9922      0.975 0.448 0.552
#> GSM509780     2  0.9922      0.975 0.448 0.552
#> GSM509782     2  0.9922      0.975 0.448 0.552
#> GSM509784     2  0.9922      0.975 0.448 0.552
#> GSM509786     2  0.9922      0.975 0.448 0.552

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1  0.8494     0.7387 0.556 0.336 0.108
#> GSM509711     1  0.6476     0.6858 0.548 0.448 0.004
#> GSM509714     1  0.5929    -0.0493 0.676 0.320 0.004
#> GSM509719     1  0.8683     0.7365 0.540 0.340 0.120
#> GSM509724     1  0.8494     0.7387 0.556 0.336 0.108
#> GSM509729     1  0.8666     0.7363 0.544 0.336 0.120
#> GSM509707     1  0.8494     0.7387 0.556 0.336 0.108
#> GSM509712     1  0.6476     0.6858 0.548 0.448 0.004
#> GSM509715     2  0.6104     0.7926 0.348 0.648 0.004
#> GSM509720     1  0.8683     0.7365 0.540 0.340 0.120
#> GSM509725     1  0.8610     0.7367 0.548 0.336 0.116
#> GSM509730     1  0.8666     0.7363 0.544 0.336 0.120
#> GSM509708     1  0.8494     0.7387 0.556 0.336 0.108
#> GSM509713     1  0.6476     0.6858 0.548 0.448 0.004
#> GSM509716     2  0.6104     0.7926 0.348 0.648 0.004
#> GSM509721     1  0.8683     0.7365 0.540 0.340 0.120
#> GSM509726     1  0.8610     0.7367 0.548 0.336 0.116
#> GSM509731     2  0.6298     0.7534 0.388 0.608 0.004
#> GSM509709     1  0.8494     0.7387 0.556 0.336 0.108
#> GSM509717     2  0.6104     0.7926 0.348 0.648 0.004
#> GSM509722     1  0.8683     0.7365 0.540 0.340 0.120
#> GSM509727     1  0.9961     0.5011 0.372 0.296 0.332
#> GSM509710     1  0.8494     0.7387 0.556 0.336 0.108
#> GSM509718     2  0.7459     0.7497 0.372 0.584 0.044
#> GSM509723     1  0.8683     0.7365 0.540 0.340 0.120
#> GSM509728     1  0.9961     0.5011 0.372 0.296 0.332
#> GSM509732     3  0.0237     0.6296 0.004 0.000 0.996
#> GSM509736     3  0.4609     0.4798 0.128 0.028 0.844
#> GSM509741     3  0.0424     0.6276 0.008 0.000 0.992
#> GSM509746     3  0.0237     0.6296 0.004 0.000 0.996
#> GSM509733     3  0.0237     0.6296 0.004 0.000 0.996
#> GSM509737     3  0.4609     0.4798 0.128 0.028 0.844
#> GSM509742     3  0.0424     0.6276 0.008 0.000 0.992
#> GSM509747     3  0.0237     0.6296 0.004 0.000 0.996
#> GSM509734     3  0.0237     0.6296 0.004 0.000 0.996
#> GSM509738     3  0.4609     0.4798 0.128 0.028 0.844
#> GSM509743     3  0.0475     0.6295 0.004 0.004 0.992
#> GSM509748     3  0.0237     0.6297 0.004 0.000 0.996
#> GSM509735     1  0.8494     0.7387 0.556 0.336 0.108
#> GSM509739     1  0.8494     0.7387 0.556 0.336 0.108
#> GSM509744     3  0.0829     0.6272 0.004 0.012 0.984
#> GSM509749     3  0.0237     0.6297 0.004 0.000 0.996
#> GSM509740     2  0.9894    -0.5401 0.324 0.400 0.276
#> GSM509745     3  0.9757    -0.2276 0.228 0.380 0.392
#> GSM509750     3  0.0848     0.6299 0.008 0.008 0.984
#> GSM509751     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509753     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509755     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509757     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509759     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509761     3  0.6468     0.5558 0.444 0.004 0.552
#> GSM509763     2  0.7466     0.8435 0.444 0.520 0.036
#> GSM509765     2  0.7652     0.8325 0.444 0.512 0.044
#> GSM509767     3  0.6468     0.5555 0.444 0.004 0.552
#> GSM509769     1  0.9465    -0.5205 0.444 0.184 0.372
#> GSM509771     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509773     1  0.9713    -0.6470 0.444 0.316 0.240
#> GSM509775     1  0.9633    -0.6737 0.444 0.340 0.216
#> GSM509777     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509779     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509781     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509783     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509785     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509752     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509754     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509756     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509758     3  0.6468     0.5556 0.444 0.004 0.552
#> GSM509760     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509762     3  0.6468     0.5558 0.444 0.004 0.552
#> GSM509764     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509766     2  0.7652     0.8325 0.444 0.512 0.044
#> GSM509768     1  0.9068    -0.7736 0.444 0.420 0.136
#> GSM509770     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509772     3  0.6252     0.5624 0.444 0.000 0.556
#> GSM509774     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509776     1  0.9678    -0.6592 0.444 0.328 0.228
#> GSM509778     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509780     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509782     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509784     2  0.6252     0.8759 0.444 0.556 0.000
#> GSM509786     2  0.6252     0.8759 0.444 0.556 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0000     0.8801 1.000 0.000 0.000 0.000
#> GSM509711     1  0.5897     0.7996 0.756 0.068 0.068 0.108
#> GSM509714     4  0.6537    -0.0212 0.392 0.004 0.068 0.536
#> GSM509719     1  0.2652     0.8769 0.912 0.028 0.056 0.004
#> GSM509724     1  0.0000     0.8801 1.000 0.000 0.000 0.000
#> GSM509729     1  0.2652     0.8769 0.912 0.028 0.056 0.004
#> GSM509707     1  0.0000     0.8801 1.000 0.000 0.000 0.000
#> GSM509712     1  0.5897     0.7996 0.756 0.068 0.068 0.108
#> GSM509715     4  0.1356     0.7753 0.000 0.008 0.032 0.960
#> GSM509720     1  0.2652     0.8769 0.912 0.028 0.056 0.004
#> GSM509725     1  0.0336     0.8788 0.992 0.000 0.008 0.000
#> GSM509730     1  0.2652     0.8769 0.912 0.028 0.056 0.004
#> GSM509708     1  0.0000     0.8801 1.000 0.000 0.000 0.000
#> GSM509713     1  0.5897     0.7996 0.756 0.068 0.068 0.108
#> GSM509716     4  0.1356     0.7753 0.000 0.008 0.032 0.960
#> GSM509721     1  0.2652     0.8769 0.912 0.028 0.056 0.004
#> GSM509726     1  0.0336     0.8788 0.992 0.000 0.008 0.000
#> GSM509731     4  0.2125     0.7497 0.000 0.004 0.076 0.920
#> GSM509709     1  0.0000     0.8801 1.000 0.000 0.000 0.000
#> GSM509717     4  0.1356     0.7753 0.000 0.008 0.032 0.960
#> GSM509722     1  0.2652     0.8769 0.912 0.028 0.056 0.004
#> GSM509727     1  0.6560     0.5656 0.616 0.088 0.288 0.008
#> GSM509710     1  0.0000     0.8801 1.000 0.000 0.000 0.000
#> GSM509718     4  0.2908     0.7496 0.000 0.040 0.064 0.896
#> GSM509723     1  0.2652     0.8769 0.912 0.028 0.056 0.004
#> GSM509728     1  0.6560     0.5656 0.616 0.088 0.288 0.008
#> GSM509732     3  0.2654     0.9357 0.004 0.108 0.888 0.000
#> GSM509736     3  0.5186     0.8454 0.076 0.128 0.780 0.016
#> GSM509741     3  0.2831     0.9409 0.004 0.120 0.876 0.000
#> GSM509746     3  0.2654     0.9357 0.004 0.108 0.888 0.000
#> GSM509733     3  0.2654     0.9357 0.004 0.108 0.888 0.000
#> GSM509737     3  0.5186     0.8454 0.076 0.128 0.780 0.016
#> GSM509742     3  0.2831     0.9409 0.004 0.120 0.876 0.000
#> GSM509747     3  0.2654     0.9357 0.004 0.108 0.888 0.000
#> GSM509734     3  0.2654     0.9357 0.004 0.108 0.888 0.000
#> GSM509738     3  0.5186     0.8454 0.076 0.128 0.780 0.016
#> GSM509743     3  0.3105     0.9375 0.000 0.140 0.856 0.004
#> GSM509748     3  0.2921     0.9379 0.000 0.140 0.860 0.000
#> GSM509735     1  0.0188     0.8800 0.996 0.000 0.004 0.000
#> GSM509739     1  0.0000     0.8801 1.000 0.000 0.000 0.000
#> GSM509744     3  0.3208     0.9360 0.000 0.148 0.848 0.004
#> GSM509749     3  0.2921     0.9379 0.000 0.140 0.860 0.000
#> GSM509740     1  0.9093     0.4143 0.452 0.156 0.268 0.124
#> GSM509745     1  0.9221     0.2223 0.408 0.192 0.296 0.104
#> GSM509750     3  0.3208     0.9348 0.000 0.148 0.848 0.004
#> GSM509751     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509753     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509755     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509757     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509759     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509761     2  0.1940     0.9803 0.000 0.924 0.000 0.076
#> GSM509763     4  0.3219     0.8271 0.000 0.164 0.000 0.836
#> GSM509765     4  0.3649     0.7942 0.000 0.204 0.000 0.796
#> GSM509767     2  0.1940     0.9796 0.000 0.924 0.000 0.076
#> GSM509769     2  0.4103     0.6690 0.000 0.744 0.000 0.256
#> GSM509771     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509773     4  0.4916     0.4298 0.000 0.424 0.000 0.576
#> GSM509775     4  0.4907     0.4470 0.000 0.420 0.000 0.580
#> GSM509777     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509779     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509781     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509783     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509785     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509752     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509754     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509756     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509758     2  0.1940     0.9802 0.000 0.924 0.000 0.076
#> GSM509760     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509762     2  0.1940     0.9803 0.000 0.924 0.000 0.076
#> GSM509764     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509766     4  0.3649     0.7942 0.000 0.204 0.000 0.796
#> GSM509768     4  0.4585     0.6323 0.000 0.332 0.000 0.668
#> GSM509770     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509772     2  0.1867     0.9836 0.000 0.928 0.000 0.072
#> GSM509774     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509776     4  0.4941     0.4022 0.000 0.436 0.000 0.564
#> GSM509778     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509780     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509782     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509784     4  0.2647     0.8504 0.000 0.120 0.000 0.880
#> GSM509786     4  0.2647     0.8504 0.000 0.120 0.000 0.880

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000     0.8166 1.000 0.000 0.000 0.000 0.000
#> GSM509711     5  0.4264     0.4931 0.376 0.000 0.000 0.004 0.620
#> GSM509714     4  0.6749    -0.0717 0.268 0.000 0.000 0.396 0.336
#> GSM509719     1  0.3774     0.6739 0.704 0.000 0.000 0.000 0.296
#> GSM509724     1  0.0000     0.8166 1.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.3684     0.6859 0.720 0.000 0.000 0.000 0.280
#> GSM509707     1  0.0000     0.8166 1.000 0.000 0.000 0.000 0.000
#> GSM509712     5  0.4264     0.4931 0.376 0.000 0.000 0.004 0.620
#> GSM509715     4  0.2929     0.7627 0.000 0.000 0.000 0.820 0.180
#> GSM509720     1  0.3774     0.6739 0.704 0.000 0.000 0.000 0.296
#> GSM509725     1  0.0290     0.8106 0.992 0.000 0.008 0.000 0.000
#> GSM509730     1  0.3684     0.6859 0.720 0.000 0.000 0.000 0.280
#> GSM509708     1  0.0000     0.8166 1.000 0.000 0.000 0.000 0.000
#> GSM509713     5  0.4264     0.4931 0.376 0.000 0.000 0.004 0.620
#> GSM509716     4  0.2929     0.7627 0.000 0.000 0.000 0.820 0.180
#> GSM509721     1  0.3774     0.6739 0.704 0.000 0.000 0.000 0.296
#> GSM509726     1  0.0290     0.8106 0.992 0.000 0.008 0.000 0.000
#> GSM509731     4  0.3336     0.7271 0.000 0.000 0.000 0.772 0.228
#> GSM509709     1  0.0000     0.8166 1.000 0.000 0.000 0.000 0.000
#> GSM509717     4  0.2929     0.7627 0.000 0.000 0.000 0.820 0.180
#> GSM509722     1  0.3774     0.6739 0.704 0.000 0.000 0.000 0.296
#> GSM509727     5  0.5918     0.6492 0.168 0.000 0.240 0.000 0.592
#> GSM509710     1  0.0000     0.8166 1.000 0.000 0.000 0.000 0.000
#> GSM509718     4  0.3993     0.7153 0.000 0.000 0.028 0.756 0.216
#> GSM509723     1  0.3774     0.6739 0.704 0.000 0.000 0.000 0.296
#> GSM509728     5  0.5918     0.6492 0.168 0.000 0.240 0.000 0.592
#> GSM509732     3  0.2930     0.8167 0.000 0.004 0.832 0.000 0.164
#> GSM509736     3  0.3398     0.7174 0.000 0.004 0.780 0.000 0.216
#> GSM509741     3  0.0609     0.8588 0.000 0.000 0.980 0.000 0.020
#> GSM509746     3  0.2930     0.8167 0.000 0.004 0.832 0.000 0.164
#> GSM509733     3  0.2930     0.8167 0.000 0.004 0.832 0.000 0.164
#> GSM509737     3  0.3398     0.7174 0.000 0.004 0.780 0.000 0.216
#> GSM509742     3  0.0609     0.8588 0.000 0.000 0.980 0.000 0.020
#> GSM509747     3  0.2930     0.8167 0.000 0.004 0.832 0.000 0.164
#> GSM509734     3  0.2930     0.8167 0.000 0.004 0.832 0.000 0.164
#> GSM509738     3  0.3398     0.7174 0.000 0.004 0.780 0.000 0.216
#> GSM509743     3  0.0955     0.8583 0.000 0.004 0.968 0.000 0.028
#> GSM509748     3  0.0955     0.8582 0.000 0.004 0.968 0.000 0.028
#> GSM509735     1  0.0162     0.8139 0.996 0.000 0.004 0.000 0.000
#> GSM509739     1  0.0000     0.8166 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.1357     0.8509 0.000 0.004 0.948 0.000 0.048
#> GSM509749     3  0.0955     0.8582 0.000 0.004 0.968 0.000 0.028
#> GSM509740     5  0.3366     0.5841 0.000 0.004 0.212 0.000 0.784
#> GSM509745     5  0.4151     0.4706 0.000 0.004 0.344 0.000 0.652
#> GSM509750     3  0.1282     0.8531 0.000 0.004 0.952 0.000 0.044
#> GSM509751     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0162     0.9811 0.000 0.996 0.000 0.004 0.000
#> GSM509763     4  0.1197     0.8332 0.000 0.048 0.000 0.952 0.000
#> GSM509765     4  0.2020     0.8055 0.000 0.100 0.000 0.900 0.000
#> GSM509767     2  0.0404     0.9729 0.000 0.988 0.000 0.012 0.000
#> GSM509769     2  0.3074     0.7191 0.000 0.804 0.000 0.196 0.000
#> GSM509771     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509773     4  0.3857     0.5927 0.000 0.312 0.000 0.688 0.000
#> GSM509775     4  0.3966     0.5585 0.000 0.336 0.000 0.664 0.000
#> GSM509777     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509779     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509781     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509783     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509785     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509752     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0162     0.9810 0.000 0.996 0.000 0.004 0.000
#> GSM509760     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509762     2  0.0162     0.9811 0.000 0.996 0.000 0.004 0.000
#> GSM509764     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509766     4  0.2020     0.8055 0.000 0.100 0.000 0.900 0.000
#> GSM509768     4  0.4101     0.4920 0.000 0.372 0.000 0.628 0.000
#> GSM509770     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509772     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509776     4  0.4030     0.5275 0.000 0.352 0.000 0.648 0.000
#> GSM509778     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509780     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509782     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509784     4  0.0162     0.8466 0.000 0.004 0.000 0.996 0.000
#> GSM509786     4  0.0162     0.8466 0.000 0.004 0.000 0.996 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
#> GSM509706     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     6  0.5471      0.553 0.336 0.000 0.000 0.000 0.140 0.524
#> GSM509714     5  0.6573      0.219 0.224 0.000 0.000 0.128 0.536 0.112
#> GSM509719     1  0.5672      0.542 0.528 0.000 0.000 0.000 0.212 0.260
#> GSM509724     1  0.0146      0.730 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM509729     1  0.5611      0.554 0.544 0.000 0.000 0.000 0.232 0.224
#> GSM509707     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     6  0.5471      0.553 0.336 0.000 0.000 0.000 0.140 0.524
#> GSM509715     5  0.3244      0.853 0.000 0.000 0.000 0.268 0.732 0.000
#> GSM509720     1  0.5672      0.542 0.528 0.000 0.000 0.000 0.212 0.260
#> GSM509725     1  0.0692      0.716 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM509730     1  0.5611      0.554 0.544 0.000 0.000 0.000 0.232 0.224
#> GSM509708     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     6  0.5471      0.553 0.336 0.000 0.000 0.000 0.140 0.524
#> GSM509716     5  0.3244      0.853 0.000 0.000 0.000 0.268 0.732 0.000
#> GSM509721     1  0.5672      0.542 0.528 0.000 0.000 0.000 0.212 0.260
#> GSM509726     1  0.0692      0.716 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM509731     5  0.2883      0.819 0.000 0.000 0.000 0.212 0.788 0.000
#> GSM509709     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.3244      0.853 0.000 0.000 0.000 0.268 0.732 0.000
#> GSM509722     1  0.5672      0.542 0.528 0.000 0.000 0.000 0.212 0.260
#> GSM509727     6  0.2377      0.664 0.124 0.000 0.004 0.000 0.004 0.868
#> GSM509710     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.4215      0.812 0.000 0.000 0.000 0.244 0.700 0.056
#> GSM509723     1  0.5672      0.542 0.528 0.000 0.000 0.000 0.212 0.260
#> GSM509728     6  0.2377      0.664 0.124 0.000 0.004 0.000 0.004 0.868
#> GSM509732     3  0.0000      0.744 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     3  0.4685      0.665 0.000 0.000 0.520 0.000 0.044 0.436
#> GSM509741     3  0.2883      0.804 0.000 0.000 0.788 0.000 0.000 0.212
#> GSM509746     3  0.0000      0.744 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000      0.744 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     3  0.4685      0.665 0.000 0.000 0.520 0.000 0.044 0.436
#> GSM509742     3  0.2883      0.804 0.000 0.000 0.788 0.000 0.000 0.212
#> GSM509747     3  0.0000      0.744 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.0000      0.744 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509738     3  0.4685      0.665 0.000 0.000 0.520 0.000 0.044 0.436
#> GSM509743     3  0.3409      0.805 0.000 0.000 0.700 0.000 0.000 0.300
#> GSM509748     3  0.3428      0.804 0.000 0.000 0.696 0.000 0.000 0.304
#> GSM509735     1  0.0146      0.730 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.733 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.3515      0.796 0.000 0.000 0.676 0.000 0.000 0.324
#> GSM509749     3  0.3428      0.804 0.000 0.000 0.696 0.000 0.000 0.304
#> GSM509740     6  0.2491      0.576 0.000 0.000 0.000 0.000 0.164 0.836
#> GSM509745     6  0.3792      0.515 0.000 0.000 0.108 0.000 0.112 0.780
#> GSM509750     3  0.3619      0.798 0.000 0.000 0.680 0.000 0.004 0.316
#> GSM509751     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509761     2  0.0146      0.981 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509763     4  0.1007      0.824 0.000 0.044 0.000 0.956 0.000 0.000
#> GSM509765     4  0.1765      0.788 0.000 0.096 0.000 0.904 0.000 0.000
#> GSM509767     2  0.0363      0.973 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM509769     2  0.2762      0.716 0.000 0.804 0.000 0.196 0.000 0.000
#> GSM509771     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509773     4  0.3446      0.558 0.000 0.308 0.000 0.692 0.000 0.000
#> GSM509775     4  0.3547      0.539 0.000 0.332 0.000 0.668 0.000 0.000
#> GSM509777     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509779     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509781     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509783     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509785     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509752     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0146      0.981 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509760     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509762     2  0.0146      0.981 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509764     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509766     4  0.1765      0.788 0.000 0.096 0.000 0.904 0.000 0.000
#> GSM509768     4  0.3684      0.461 0.000 0.372 0.000 0.628 0.000 0.000
#> GSM509770     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509772     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509774     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509776     4  0.3607      0.516 0.000 0.348 0.000 0.652 0.000 0.000
#> GSM509778     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509780     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509782     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509784     4  0.0000      0.846 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509786     4  0.0000      0.846 0.000 0.000 0.000 1.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-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)  time(p) k
#> SD:hclust 57         9.39e-10 2.44e-07 2
#> SD:hclust 70         1.89e-11 4.80e-03 3
#> SD:hclust 75         7.84e-23 6.00e-07 4
#> SD:hclust 75         3.58e-20 1.09e-07 5
#> SD:hclust 79         5.29e-24 2.24e-08 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 19175 rows and 81 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.999       1.000         0.5067 0.494   0.494
#> 3 3 0.725           0.563       0.727         0.2440 0.794   0.606
#> 4 4 0.701           0.773       0.797         0.1469 0.858   0.626
#> 5 5 0.665           0.735       0.816         0.0684 0.930   0.749
#> 6 6 0.717           0.666       0.759         0.0478 1.000   1.000

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1   0.000      1.000 1.000 0.000
#> GSM509711     1   0.000      1.000 1.000 0.000
#> GSM509714     1   0.000      1.000 1.000 0.000
#> GSM509719     1   0.000      1.000 1.000 0.000
#> GSM509724     1   0.000      1.000 1.000 0.000
#> GSM509729     1   0.000      1.000 1.000 0.000
#> GSM509707     1   0.000      1.000 1.000 0.000
#> GSM509712     1   0.000      1.000 1.000 0.000
#> GSM509715     2   0.000      0.999 0.000 1.000
#> GSM509720     1   0.000      1.000 1.000 0.000
#> GSM509725     1   0.000      1.000 1.000 0.000
#> GSM509730     1   0.000      1.000 1.000 0.000
#> GSM509708     1   0.000      1.000 1.000 0.000
#> GSM509713     1   0.000      1.000 1.000 0.000
#> GSM509716     2   0.000      0.999 0.000 1.000
#> GSM509721     1   0.000      1.000 1.000 0.000
#> GSM509726     1   0.000      1.000 1.000 0.000
#> GSM509731     2   0.204      0.967 0.032 0.968
#> GSM509709     1   0.000      1.000 1.000 0.000
#> GSM509717     2   0.000      0.999 0.000 1.000
#> GSM509722     1   0.000      1.000 1.000 0.000
#> GSM509727     1   0.000      1.000 1.000 0.000
#> GSM509710     1   0.000      1.000 1.000 0.000
#> GSM509718     2   0.000      0.999 0.000 1.000
#> GSM509723     1   0.000      1.000 1.000 0.000
#> GSM509728     1   0.000      1.000 1.000 0.000
#> GSM509732     1   0.000      1.000 1.000 0.000
#> GSM509736     1   0.000      1.000 1.000 0.000
#> GSM509741     1   0.000      1.000 1.000 0.000
#> GSM509746     1   0.000      1.000 1.000 0.000
#> GSM509733     1   0.000      1.000 1.000 0.000
#> GSM509737     1   0.000      1.000 1.000 0.000
#> GSM509742     1   0.000      1.000 1.000 0.000
#> GSM509747     1   0.000      1.000 1.000 0.000
#> GSM509734     1   0.000      1.000 1.000 0.000
#> GSM509738     1   0.000      1.000 1.000 0.000
#> GSM509743     1   0.000      1.000 1.000 0.000
#> GSM509748     1   0.000      1.000 1.000 0.000
#> GSM509735     1   0.000      1.000 1.000 0.000
#> GSM509739     1   0.000      1.000 1.000 0.000
#> GSM509744     1   0.000      1.000 1.000 0.000
#> GSM509749     1   0.000      1.000 1.000 0.000
#> GSM509740     1   0.000      1.000 1.000 0.000
#> GSM509745     1   0.000      1.000 1.000 0.000
#> GSM509750     1   0.000      1.000 1.000 0.000
#> GSM509751     2   0.000      0.999 0.000 1.000
#> GSM509753     2   0.000      0.999 0.000 1.000
#> GSM509755     2   0.000      0.999 0.000 1.000
#> GSM509757     2   0.000      0.999 0.000 1.000
#> GSM509759     2   0.000      0.999 0.000 1.000
#> GSM509761     2   0.000      0.999 0.000 1.000
#> GSM509763     2   0.000      0.999 0.000 1.000
#> GSM509765     2   0.000      0.999 0.000 1.000
#> GSM509767     2   0.000      0.999 0.000 1.000
#> GSM509769     2   0.000      0.999 0.000 1.000
#> GSM509771     2   0.000      0.999 0.000 1.000
#> GSM509773     2   0.000      0.999 0.000 1.000
#> GSM509775     2   0.000      0.999 0.000 1.000
#> GSM509777     2   0.000      0.999 0.000 1.000
#> GSM509779     2   0.000      0.999 0.000 1.000
#> GSM509781     2   0.000      0.999 0.000 1.000
#> GSM509783     2   0.000      0.999 0.000 1.000
#> GSM509785     2   0.000      0.999 0.000 1.000
#> GSM509752     2   0.000      0.999 0.000 1.000
#> GSM509754     2   0.000      0.999 0.000 1.000
#> GSM509756     2   0.000      0.999 0.000 1.000
#> GSM509758     2   0.000      0.999 0.000 1.000
#> GSM509760     2   0.000      0.999 0.000 1.000
#> GSM509762     2   0.000      0.999 0.000 1.000
#> GSM509764     2   0.000      0.999 0.000 1.000
#> GSM509766     2   0.000      0.999 0.000 1.000
#> GSM509768     2   0.000      0.999 0.000 1.000
#> GSM509770     2   0.000      0.999 0.000 1.000
#> GSM509772     2   0.000      0.999 0.000 1.000
#> GSM509774     2   0.000      0.999 0.000 1.000
#> GSM509776     2   0.000      0.999 0.000 1.000
#> GSM509778     2   0.000      0.999 0.000 1.000
#> GSM509780     2   0.000      0.999 0.000 1.000
#> GSM509782     2   0.000      0.999 0.000 1.000
#> GSM509784     2   0.000      0.999 0.000 1.000
#> GSM509786     2   0.000      0.999 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509711     1  0.6154      0.355 0.592 0.000 0.408
#> GSM509714     1  0.5497      0.265 0.708 0.000 0.292
#> GSM509719     3  0.6309     -0.317 0.496 0.000 0.504
#> GSM509724     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509729     1  0.6299      0.361 0.524 0.000 0.476
#> GSM509707     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509712     1  0.6192      0.343 0.580 0.000 0.420
#> GSM509715     1  0.7292     -0.513 0.500 0.472 0.028
#> GSM509720     3  0.6309     -0.317 0.496 0.000 0.504
#> GSM509725     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509730     3  0.6299     -0.320 0.476 0.000 0.524
#> GSM509708     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509713     1  0.6140      0.357 0.596 0.000 0.404
#> GSM509716     1  0.7292     -0.513 0.500 0.472 0.028
#> GSM509721     3  0.6309     -0.317 0.496 0.000 0.504
#> GSM509726     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509731     1  0.4677      0.176 0.840 0.132 0.028
#> GSM509709     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509717     1  0.7292     -0.513 0.500 0.472 0.028
#> GSM509722     1  0.6274      0.289 0.544 0.000 0.456
#> GSM509727     1  0.6295      0.316 0.528 0.000 0.472
#> GSM509710     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509718     1  0.7292     -0.513 0.500 0.472 0.028
#> GSM509723     3  0.6309     -0.317 0.496 0.000 0.504
#> GSM509728     3  0.2066      0.737 0.060 0.000 0.940
#> GSM509732     3  0.0237      0.782 0.004 0.000 0.996
#> GSM509736     3  0.0747      0.778 0.016 0.000 0.984
#> GSM509741     3  0.0000      0.783 0.000 0.000 1.000
#> GSM509746     3  0.0237      0.782 0.004 0.000 0.996
#> GSM509733     3  0.0237      0.782 0.004 0.000 0.996
#> GSM509737     3  0.1163      0.770 0.028 0.000 0.972
#> GSM509742     3  0.0000      0.783 0.000 0.000 1.000
#> GSM509747     3  0.0237      0.782 0.004 0.000 0.996
#> GSM509734     3  0.0237      0.782 0.004 0.000 0.996
#> GSM509738     3  0.2537      0.731 0.080 0.000 0.920
#> GSM509743     3  0.0000      0.783 0.000 0.000 1.000
#> GSM509748     3  0.0000      0.783 0.000 0.000 1.000
#> GSM509735     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509739     1  0.6308      0.361 0.508 0.000 0.492
#> GSM509744     3  0.0237      0.781 0.004 0.000 0.996
#> GSM509749     3  0.0000      0.783 0.000 0.000 1.000
#> GSM509740     1  0.6305      0.231 0.516 0.000 0.484
#> GSM509745     3  0.3116      0.697 0.108 0.000 0.892
#> GSM509750     3  0.1529      0.753 0.040 0.000 0.960
#> GSM509751     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509753     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509755     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509757     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509759     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509761     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509763     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509765     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509767     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509769     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509771     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509773     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509775     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509777     2  0.5431      0.733 0.284 0.716 0.000
#> GSM509779     2  0.6140      0.652 0.404 0.596 0.000
#> GSM509781     2  0.6140      0.652 0.404 0.596 0.000
#> GSM509783     2  0.6140      0.652 0.404 0.596 0.000
#> GSM509785     2  0.6140      0.652 0.404 0.596 0.000
#> GSM509752     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509754     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509756     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509758     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509760     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509762     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509764     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509766     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509768     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509770     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509772     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509774     2  0.5948      0.683 0.360 0.640 0.000
#> GSM509776     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509778     2  0.6140      0.652 0.404 0.596 0.000
#> GSM509780     2  0.0000      0.892 0.000 1.000 0.000
#> GSM509782     2  0.6140      0.652 0.404 0.596 0.000
#> GSM509784     2  0.6126      0.655 0.400 0.600 0.000
#> GSM509786     2  0.6140      0.652 0.404 0.596 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.7293     0.5766 0.536 0.248 0.216 0.000
#> GSM509711     1  0.2611     0.5704 0.896 0.096 0.008 0.000
#> GSM509714     1  0.3581     0.5346 0.852 0.116 0.000 0.032
#> GSM509719     1  0.3311     0.5898 0.828 0.000 0.172 0.000
#> GSM509724     1  0.7315     0.5751 0.532 0.252 0.216 0.000
#> GSM509729     1  0.6049     0.5969 0.684 0.132 0.184 0.000
#> GSM509707     1  0.7293     0.5766 0.536 0.248 0.216 0.000
#> GSM509712     1  0.2342     0.5653 0.912 0.080 0.008 0.000
#> GSM509715     1  0.7003     0.0537 0.460 0.116 0.000 0.424
#> GSM509720     1  0.3311     0.5898 0.828 0.000 0.172 0.000
#> GSM509725     1  0.7315     0.5751 0.532 0.252 0.216 0.000
#> GSM509730     1  0.5432     0.5798 0.716 0.068 0.216 0.000
#> GSM509708     1  0.7293     0.5766 0.536 0.248 0.216 0.000
#> GSM509713     1  0.4228     0.6034 0.760 0.232 0.008 0.000
#> GSM509716     1  0.7003     0.0537 0.460 0.116 0.000 0.424
#> GSM509721     1  0.3311     0.5898 0.828 0.000 0.172 0.000
#> GSM509726     1  0.7315     0.5751 0.532 0.252 0.216 0.000
#> GSM509731     1  0.6998     0.0741 0.468 0.116 0.000 0.416
#> GSM509709     1  0.7293     0.5766 0.536 0.248 0.216 0.000
#> GSM509717     1  0.7003     0.0537 0.460 0.116 0.000 0.424
#> GSM509722     1  0.1389     0.5844 0.952 0.000 0.048 0.000
#> GSM509727     1  0.5874     0.5570 0.700 0.176 0.124 0.000
#> GSM509710     1  0.7293     0.5766 0.536 0.248 0.216 0.000
#> GSM509718     1  0.7040     0.0608 0.460 0.120 0.000 0.420
#> GSM509723     1  0.3311     0.5898 0.828 0.000 0.172 0.000
#> GSM509728     3  0.3820     0.8024 0.064 0.088 0.848 0.000
#> GSM509732     3  0.0000     0.9055 0.000 0.000 1.000 0.000
#> GSM509736     3  0.3128     0.8487 0.076 0.040 0.884 0.000
#> GSM509741     3  0.0000     0.9055 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000     0.9055 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000     0.9055 0.000 0.000 1.000 0.000
#> GSM509737     3  0.3463     0.8304 0.096 0.040 0.864 0.000
#> GSM509742     3  0.0000     0.9055 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000     0.9055 0.000 0.000 1.000 0.000
#> GSM509734     3  0.0000     0.9055 0.000 0.000 1.000 0.000
#> GSM509738     3  0.5949     0.5490 0.288 0.068 0.644 0.000
#> GSM509743     3  0.0469     0.9031 0.000 0.012 0.988 0.000
#> GSM509748     3  0.0000     0.9055 0.000 0.000 1.000 0.000
#> GSM509735     1  0.7293     0.5766 0.536 0.248 0.216 0.000
#> GSM509739     1  0.7267     0.5784 0.540 0.248 0.212 0.000
#> GSM509744     3  0.1452     0.8924 0.008 0.036 0.956 0.000
#> GSM509749     3  0.0336     0.9041 0.000 0.008 0.992 0.000
#> GSM509740     1  0.5714     0.3886 0.716 0.128 0.156 0.000
#> GSM509745     3  0.6554     0.3972 0.376 0.084 0.540 0.000
#> GSM509750     3  0.3056     0.8456 0.072 0.040 0.888 0.000
#> GSM509751     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509753     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509755     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509757     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509759     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509761     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509763     2  0.4916     0.9426 0.000 0.576 0.000 0.424
#> GSM509765     2  0.4916     0.9426 0.000 0.576 0.000 0.424
#> GSM509767     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509769     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509771     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509773     2  0.4830     0.9807 0.000 0.608 0.000 0.392
#> GSM509775     2  0.4830     0.9807 0.000 0.608 0.000 0.392
#> GSM509777     4  0.2011     0.8367 0.000 0.080 0.000 0.920
#> GSM509779     4  0.0000     0.9758 0.000 0.000 0.000 1.000
#> GSM509781     4  0.0336     0.9791 0.008 0.000 0.000 0.992
#> GSM509783     4  0.0336     0.9791 0.008 0.000 0.000 0.992
#> GSM509785     4  0.0336     0.9791 0.008 0.000 0.000 0.992
#> GSM509752     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509754     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509756     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509758     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509760     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509762     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509764     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509766     2  0.4916     0.9426 0.000 0.576 0.000 0.424
#> GSM509768     2  0.4830     0.9807 0.000 0.608 0.000 0.392
#> GSM509770     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509772     2  0.4804     0.9862 0.000 0.616 0.000 0.384
#> GSM509774     4  0.0336     0.9675 0.000 0.008 0.000 0.992
#> GSM509776     2  0.4830     0.9807 0.000 0.608 0.000 0.392
#> GSM509778     4  0.0336     0.9791 0.008 0.000 0.000 0.992
#> GSM509780     2  0.4977     0.8818 0.000 0.540 0.000 0.460
#> GSM509782     4  0.0336     0.9791 0.008 0.000 0.000 0.992
#> GSM509784     4  0.0000     0.9758 0.000 0.000 0.000 1.000
#> GSM509786     4  0.0336     0.9791 0.008 0.000 0.000 0.992

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.2471     0.8748 0.864 0.000 0.136 0.000 0.000
#> GSM509711     5  0.4747     0.4636 0.284 0.000 0.004 0.036 0.676
#> GSM509714     5  0.2624     0.5645 0.116 0.000 0.000 0.012 0.872
#> GSM509719     5  0.7235    -0.0116 0.408 0.000 0.092 0.088 0.412
#> GSM509724     1  0.2753     0.8700 0.856 0.000 0.136 0.000 0.008
#> GSM509729     1  0.7096     0.3686 0.536 0.000 0.104 0.092 0.268
#> GSM509707     1  0.2471     0.8748 0.864 0.000 0.136 0.000 0.000
#> GSM509712     5  0.4451     0.4958 0.236 0.000 0.004 0.036 0.724
#> GSM509715     5  0.2891     0.5290 0.000 0.000 0.000 0.176 0.824
#> GSM509720     5  0.7235    -0.0116 0.408 0.000 0.092 0.088 0.412
#> GSM509725     1  0.2753     0.8700 0.856 0.000 0.136 0.000 0.008
#> GSM509730     1  0.7351     0.1630 0.464 0.000 0.104 0.096 0.336
#> GSM509708     1  0.2471     0.8748 0.864 0.000 0.136 0.000 0.000
#> GSM509713     1  0.4506     0.4880 0.716 0.000 0.004 0.036 0.244
#> GSM509716     5  0.2891     0.5290 0.000 0.000 0.000 0.176 0.824
#> GSM509721     5  0.7235    -0.0116 0.408 0.000 0.092 0.088 0.412
#> GSM509726     1  0.3681     0.8492 0.820 0.000 0.136 0.036 0.008
#> GSM509731     5  0.2690     0.5396 0.000 0.000 0.000 0.156 0.844
#> GSM509709     1  0.2471     0.8748 0.864 0.000 0.136 0.000 0.000
#> GSM509717     5  0.2891     0.5290 0.000 0.000 0.000 0.176 0.824
#> GSM509722     5  0.6095     0.1746 0.404 0.000 0.012 0.088 0.496
#> GSM509727     5  0.6793     0.3903 0.160 0.000 0.132 0.100 0.608
#> GSM509710     1  0.2471     0.8748 0.864 0.000 0.136 0.000 0.000
#> GSM509718     5  0.2891     0.5290 0.000 0.000 0.000 0.176 0.824
#> GSM509723     5  0.7235    -0.0116 0.408 0.000 0.092 0.088 0.412
#> GSM509728     3  0.4733     0.8093 0.040 0.000 0.776 0.108 0.076
#> GSM509732     3  0.0290     0.9034 0.000 0.000 0.992 0.000 0.008
#> GSM509736     3  0.3898     0.8241 0.000 0.000 0.804 0.080 0.116
#> GSM509741     3  0.0000     0.9035 0.000 0.000 1.000 0.000 0.000
#> GSM509746     3  0.0290     0.9034 0.000 0.000 0.992 0.000 0.008
#> GSM509733     3  0.0290     0.9034 0.000 0.000 0.992 0.000 0.008
#> GSM509737     3  0.3898     0.8241 0.000 0.000 0.804 0.080 0.116
#> GSM509742     3  0.0000     0.9035 0.000 0.000 1.000 0.000 0.000
#> GSM509747     3  0.0290     0.9034 0.000 0.000 0.992 0.000 0.008
#> GSM509734     3  0.0290     0.9034 0.000 0.000 0.992 0.000 0.008
#> GSM509738     3  0.5576     0.3459 0.000 0.000 0.536 0.076 0.388
#> GSM509743     3  0.1907     0.8936 0.000 0.000 0.928 0.044 0.028
#> GSM509748     3  0.0290     0.9034 0.000 0.000 0.992 0.000 0.008
#> GSM509735     1  0.2629     0.8732 0.860 0.000 0.136 0.004 0.000
#> GSM509739     1  0.2471     0.8748 0.864 0.000 0.136 0.000 0.000
#> GSM509744     3  0.2438     0.8843 0.000 0.000 0.900 0.060 0.040
#> GSM509749     3  0.1741     0.8955 0.000 0.000 0.936 0.040 0.024
#> GSM509740     5  0.3999     0.5530 0.048 0.000 0.048 0.076 0.828
#> GSM509745     5  0.5854    -0.1880 0.000 0.000 0.436 0.096 0.468
#> GSM509750     3  0.3119     0.8668 0.000 0.000 0.860 0.072 0.068
#> GSM509751     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0324     0.8936 0.004 0.992 0.000 0.000 0.004
#> GSM509761     2  0.0162     0.8951 0.004 0.996 0.000 0.000 0.000
#> GSM509763     2  0.4926     0.7175 0.132 0.716 0.000 0.152 0.000
#> GSM509765     2  0.4926     0.7175 0.132 0.716 0.000 0.152 0.000
#> GSM509767     2  0.1831     0.8792 0.076 0.920 0.000 0.000 0.004
#> GSM509769     2  0.2069     0.8755 0.076 0.912 0.000 0.012 0.000
#> GSM509771     2  0.1952     0.8771 0.084 0.912 0.000 0.000 0.004
#> GSM509773     2  0.3966     0.8082 0.132 0.796 0.000 0.072 0.000
#> GSM509775     2  0.3966     0.8082 0.132 0.796 0.000 0.072 0.000
#> GSM509777     4  0.4613     0.8769 0.072 0.200 0.000 0.728 0.000
#> GSM509779     4  0.4136     0.9009 0.048 0.188 0.000 0.764 0.000
#> GSM509781     4  0.4514     0.9326 0.000 0.188 0.000 0.740 0.072
#> GSM509783     4  0.4514     0.9326 0.000 0.188 0.000 0.740 0.072
#> GSM509785     4  0.4514     0.9326 0.000 0.188 0.000 0.740 0.072
#> GSM509752     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509760     2  0.0162     0.8941 0.000 0.996 0.000 0.000 0.004
#> GSM509762     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000     0.8952 0.000 1.000 0.000 0.000 0.000
#> GSM509766     2  0.4926     0.7175 0.132 0.716 0.000 0.152 0.000
#> GSM509768     2  0.4123     0.8072 0.132 0.792 0.000 0.072 0.004
#> GSM509770     2  0.1831     0.8793 0.076 0.920 0.000 0.000 0.004
#> GSM509772     2  0.0324     0.8936 0.004 0.992 0.000 0.000 0.004
#> GSM509774     4  0.4571     0.8873 0.076 0.188 0.000 0.736 0.000
#> GSM509776     2  0.3966     0.8082 0.132 0.796 0.000 0.072 0.000
#> GSM509778     4  0.4514     0.9326 0.000 0.188 0.000 0.740 0.072
#> GSM509780     2  0.5602     0.5981 0.132 0.648 0.000 0.216 0.004
#> GSM509782     4  0.4514     0.9326 0.000 0.188 0.000 0.740 0.072
#> GSM509784     4  0.4514     0.8898 0.072 0.188 0.000 0.740 0.000
#> GSM509786     4  0.4514     0.9326 0.000 0.188 0.000 0.740 0.072

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM509706     1  0.1141    0.84216 0.948 0.000 0.052 0.000 0.000 NA
#> GSM509711     5  0.5096    0.47904 0.204 0.000 0.000 0.032 0.676 NA
#> GSM509714     5  0.1536    0.59099 0.016 0.000 0.000 0.004 0.940 NA
#> GSM509719     5  0.7160    0.25181 0.288 0.000 0.028 0.028 0.376 NA
#> GSM509724     1  0.1686    0.83584 0.932 0.000 0.052 0.004 0.004 NA
#> GSM509729     1  0.7299   -0.00363 0.412 0.000 0.028 0.048 0.240 NA
#> GSM509707     1  0.1141    0.84216 0.948 0.000 0.052 0.000 0.000 NA
#> GSM509712     5  0.4744    0.53569 0.124 0.000 0.000 0.032 0.728 NA
#> GSM509715     5  0.2669    0.55570 0.000 0.000 0.000 0.156 0.836 NA
#> GSM509720     5  0.7160    0.25181 0.288 0.000 0.028 0.028 0.376 NA
#> GSM509725     1  0.1799    0.83573 0.928 0.000 0.052 0.008 0.004 NA
#> GSM509730     1  0.7438   -0.20916 0.332 0.000 0.028 0.048 0.296 NA
#> GSM509708     1  0.1141    0.84216 0.948 0.000 0.052 0.000 0.000 NA
#> GSM509713     1  0.4970    0.54981 0.696 0.000 0.000 0.032 0.180 NA
#> GSM509716     5  0.2669    0.55570 0.000 0.000 0.000 0.156 0.836 NA
#> GSM509721     5  0.7160    0.25181 0.288 0.000 0.028 0.028 0.376 NA
#> GSM509726     1  0.3734    0.77240 0.836 0.000 0.052 0.036 0.028 NA
#> GSM509731     5  0.2859    0.55361 0.000 0.000 0.000 0.156 0.828 NA
#> GSM509709     1  0.1141    0.84216 0.948 0.000 0.052 0.000 0.000 NA
#> GSM509717     5  0.2669    0.55570 0.000 0.000 0.000 0.156 0.836 NA
#> GSM509722     5  0.6812    0.27582 0.288 0.000 0.008 0.028 0.396 NA
#> GSM509727     5  0.6742    0.42511 0.112 0.000 0.040 0.040 0.508 NA
#> GSM509710     1  0.1141    0.84216 0.948 0.000 0.052 0.000 0.000 NA
#> GSM509718     5  0.2859    0.55355 0.000 0.000 0.000 0.156 0.828 NA
#> GSM509723     5  0.7160    0.25181 0.288 0.000 0.028 0.028 0.376 NA
#> GSM509728     3  0.6252    0.59538 0.052 0.000 0.548 0.036 0.052 NA
#> GSM509732     3  0.0146    0.83195 0.000 0.000 0.996 0.000 0.004 NA
#> GSM509736     3  0.4817    0.65968 0.004 0.000 0.612 0.000 0.064 NA
#> GSM509741     3  0.0000    0.83269 0.000 0.000 1.000 0.000 0.000 NA
#> GSM509746     3  0.0405    0.83208 0.000 0.000 0.988 0.008 0.004 NA
#> GSM509733     3  0.0146    0.83195 0.000 0.000 0.996 0.000 0.004 NA
#> GSM509737     3  0.4817    0.65968 0.004 0.000 0.612 0.000 0.064 NA
#> GSM509742     3  0.0000    0.83269 0.000 0.000 1.000 0.000 0.000 NA
#> GSM509747     3  0.0405    0.83208 0.000 0.000 0.988 0.008 0.004 NA
#> GSM509734     3  0.0405    0.83208 0.000 0.000 0.988 0.008 0.004 NA
#> GSM509738     3  0.6220    0.19088 0.004 0.000 0.376 0.000 0.288 NA
#> GSM509743     3  0.2488    0.81073 0.000 0.000 0.864 0.008 0.004 NA
#> GSM509748     3  0.0508    0.83218 0.000 0.000 0.984 0.012 0.004 NA
#> GSM509735     1  0.1285    0.84153 0.944 0.000 0.052 0.004 0.000 NA
#> GSM509739     1  0.1285    0.84153 0.944 0.000 0.052 0.004 0.000 NA
#> GSM509744     3  0.3507    0.77156 0.000 0.000 0.764 0.008 0.012 NA
#> GSM509749     3  0.2203    0.82056 0.000 0.000 0.896 0.016 0.004 NA
#> GSM509740     5  0.3894    0.51406 0.008 0.000 0.004 0.000 0.664 NA
#> GSM509745     5  0.6114   -0.10113 0.000 0.000 0.304 0.000 0.368 NA
#> GSM509750     3  0.4273    0.73604 0.000 0.000 0.696 0.012 0.032 NA
#> GSM509751     2  0.0000    0.80422 0.000 1.000 0.000 0.000 0.000 NA
#> GSM509753     2  0.0146    0.80399 0.000 0.996 0.000 0.000 0.004 NA
#> GSM509755     2  0.0405    0.80334 0.008 0.988 0.000 0.000 0.004 NA
#> GSM509757     2  0.0146    0.80399 0.000 0.996 0.000 0.000 0.004 NA
#> GSM509759     2  0.0862    0.79904 0.016 0.972 0.000 0.000 0.004 NA
#> GSM509761     2  0.0146    0.80457 0.000 0.996 0.000 0.000 0.000 NA
#> GSM509763     2  0.5197    0.51272 0.008 0.504 0.000 0.068 0.000 NA
#> GSM509765     2  0.4975    0.51661 0.000 0.504 0.000 0.068 0.000 NA
#> GSM509767     2  0.2809    0.76607 0.004 0.824 0.000 0.000 0.004 NA
#> GSM509769     2  0.3281    0.74826 0.012 0.784 0.000 0.000 0.004 NA
#> GSM509771     2  0.2879    0.76382 0.004 0.816 0.000 0.000 0.004 NA
#> GSM509773     2  0.4063    0.60894 0.004 0.572 0.000 0.000 0.004 NA
#> GSM509775     2  0.3810    0.60801 0.000 0.572 0.000 0.000 0.000 NA
#> GSM509777     4  0.5405    0.73108 0.008 0.112 0.000 0.568 0.000 NA
#> GSM509779     4  0.4845    0.80883 0.016 0.100 0.000 0.692 0.000 NA
#> GSM509781     4  0.1958    0.85941 0.004 0.100 0.000 0.896 0.000 NA
#> GSM509783     4  0.2070    0.85878 0.008 0.100 0.000 0.892 0.000 NA
#> GSM509785     4  0.1958    0.85941 0.004 0.100 0.000 0.896 0.000 NA
#> GSM509752     2  0.0000    0.80422 0.000 1.000 0.000 0.000 0.000 NA
#> GSM509754     2  0.0000    0.80422 0.000 1.000 0.000 0.000 0.000 NA
#> GSM509756     2  0.0260    0.80328 0.008 0.992 0.000 0.000 0.000 NA
#> GSM509758     2  0.0000    0.80422 0.000 1.000 0.000 0.000 0.000 NA
#> GSM509760     2  0.0603    0.80059 0.016 0.980 0.000 0.000 0.000 NA
#> GSM509762     2  0.0000    0.80422 0.000 1.000 0.000 0.000 0.000 NA
#> GSM509764     2  0.0000    0.80422 0.000 1.000 0.000 0.000 0.000 NA
#> GSM509766     2  0.4975    0.51661 0.000 0.504 0.000 0.068 0.000 NA
#> GSM509768     2  0.3810    0.60801 0.000 0.572 0.000 0.000 0.000 NA
#> GSM509770     2  0.3343    0.75739 0.024 0.796 0.000 0.000 0.004 NA
#> GSM509772     2  0.0436    0.80216 0.004 0.988 0.000 0.000 0.004 NA
#> GSM509774     4  0.5278    0.75181 0.008 0.100 0.000 0.584 0.000 NA
#> GSM509776     2  0.3810    0.60801 0.000 0.572 0.000 0.000 0.000 NA
#> GSM509778     4  0.2070    0.85878 0.008 0.100 0.000 0.892 0.000 NA
#> GSM509780     2  0.5613    0.42116 0.008 0.456 0.000 0.112 0.000 NA
#> GSM509782     4  0.1958    0.85941 0.004 0.100 0.000 0.896 0.000 NA
#> GSM509784     4  0.5360    0.76738 0.016 0.100 0.000 0.600 0.000 NA
#> GSM509786     4  0.1958    0.85941 0.004 0.100 0.000 0.896 0.000 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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)  time(p) k
#> SD:kmeans 81         8.31e-15 6.68e-12 2
#> SD:kmeans 53         3.10e-12 1.17e-09 3
#> SD:kmeans 74         7.74e-25 4.80e-09 4
#> SD:kmeans 68         1.52e-19 5.08e-07 5
#> SD:kmeans 69         3.74e-20 4.80e-07 6

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


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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.997       0.999         0.5067 0.494   0.494
#> 3 3 0.975           0.956       0.970         0.2641 0.805   0.627
#> 4 4 0.989           0.962       0.979         0.1643 0.870   0.647
#> 5 5 0.846           0.815       0.893         0.0564 0.921   0.708
#> 6 6 0.824           0.748       0.852         0.0341 0.965   0.840

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
#> GSM509706     1   0.000      1.000 1.000 0.000
#> GSM509711     1   0.000      1.000 1.000 0.000
#> GSM509714     1   0.000      1.000 1.000 0.000
#> GSM509719     1   0.000      1.000 1.000 0.000
#> GSM509724     1   0.000      1.000 1.000 0.000
#> GSM509729     1   0.000      1.000 1.000 0.000
#> GSM509707     1   0.000      1.000 1.000 0.000
#> GSM509712     1   0.000      1.000 1.000 0.000
#> GSM509715     2   0.000      0.997 0.000 1.000
#> GSM509720     1   0.000      1.000 1.000 0.000
#> GSM509725     1   0.000      1.000 1.000 0.000
#> GSM509730     1   0.000      1.000 1.000 0.000
#> GSM509708     1   0.000      1.000 1.000 0.000
#> GSM509713     1   0.000      1.000 1.000 0.000
#> GSM509716     2   0.000      0.997 0.000 1.000
#> GSM509721     1   0.000      1.000 1.000 0.000
#> GSM509726     1   0.000      1.000 1.000 0.000
#> GSM509731     2   0.482      0.884 0.104 0.896
#> GSM509709     1   0.000      1.000 1.000 0.000
#> GSM509717     2   0.000      0.997 0.000 1.000
#> GSM509722     1   0.000      1.000 1.000 0.000
#> GSM509727     1   0.000      1.000 1.000 0.000
#> GSM509710     1   0.000      1.000 1.000 0.000
#> GSM509718     2   0.000      0.997 0.000 1.000
#> GSM509723     1   0.000      1.000 1.000 0.000
#> GSM509728     1   0.000      1.000 1.000 0.000
#> GSM509732     1   0.000      1.000 1.000 0.000
#> GSM509736     1   0.000      1.000 1.000 0.000
#> GSM509741     1   0.000      1.000 1.000 0.000
#> GSM509746     1   0.000      1.000 1.000 0.000
#> GSM509733     1   0.000      1.000 1.000 0.000
#> GSM509737     1   0.000      1.000 1.000 0.000
#> GSM509742     1   0.000      1.000 1.000 0.000
#> GSM509747     1   0.000      1.000 1.000 0.000
#> GSM509734     1   0.000      1.000 1.000 0.000
#> GSM509738     1   0.000      1.000 1.000 0.000
#> GSM509743     1   0.000      1.000 1.000 0.000
#> GSM509748     1   0.000      1.000 1.000 0.000
#> GSM509735     1   0.000      1.000 1.000 0.000
#> GSM509739     1   0.000      1.000 1.000 0.000
#> GSM509744     1   0.000      1.000 1.000 0.000
#> GSM509749     1   0.000      1.000 1.000 0.000
#> GSM509740     1   0.000      1.000 1.000 0.000
#> GSM509745     1   0.000      1.000 1.000 0.000
#> GSM509750     1   0.000      1.000 1.000 0.000
#> GSM509751     2   0.000      0.997 0.000 1.000
#> GSM509753     2   0.000      0.997 0.000 1.000
#> GSM509755     2   0.000      0.997 0.000 1.000
#> GSM509757     2   0.000      0.997 0.000 1.000
#> GSM509759     2   0.000      0.997 0.000 1.000
#> GSM509761     2   0.000      0.997 0.000 1.000
#> GSM509763     2   0.000      0.997 0.000 1.000
#> GSM509765     2   0.000      0.997 0.000 1.000
#> GSM509767     2   0.000      0.997 0.000 1.000
#> GSM509769     2   0.000      0.997 0.000 1.000
#> GSM509771     2   0.000      0.997 0.000 1.000
#> GSM509773     2   0.000      0.997 0.000 1.000
#> GSM509775     2   0.000      0.997 0.000 1.000
#> GSM509777     2   0.000      0.997 0.000 1.000
#> GSM509779     2   0.000      0.997 0.000 1.000
#> GSM509781     2   0.000      0.997 0.000 1.000
#> GSM509783     2   0.000      0.997 0.000 1.000
#> GSM509785     2   0.000      0.997 0.000 1.000
#> GSM509752     2   0.000      0.997 0.000 1.000
#> GSM509754     2   0.000      0.997 0.000 1.000
#> GSM509756     2   0.000      0.997 0.000 1.000
#> GSM509758     2   0.000      0.997 0.000 1.000
#> GSM509760     2   0.000      0.997 0.000 1.000
#> GSM509762     2   0.000      0.997 0.000 1.000
#> GSM509764     2   0.000      0.997 0.000 1.000
#> GSM509766     2   0.000      0.997 0.000 1.000
#> GSM509768     2   0.000      0.997 0.000 1.000
#> GSM509770     2   0.000      0.997 0.000 1.000
#> GSM509772     2   0.000      0.997 0.000 1.000
#> GSM509774     2   0.000      0.997 0.000 1.000
#> GSM509776     2   0.000      0.997 0.000 1.000
#> GSM509778     2   0.000      0.997 0.000 1.000
#> GSM509780     2   0.000      0.997 0.000 1.000
#> GSM509782     2   0.000      0.997 0.000 1.000
#> GSM509784     2   0.000      0.997 0.000 1.000
#> GSM509786     2   0.000      0.997 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
#> GSM509706     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509711     1  0.0747      0.920 0.984 0.000 0.016
#> GSM509714     1  0.0000      0.910 1.000 0.000 0.000
#> GSM509719     1  0.1860      0.937 0.948 0.000 0.052
#> GSM509724     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509729     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509707     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509712     1  0.0747      0.920 0.984 0.000 0.016
#> GSM509715     1  0.5560      0.570 0.700 0.300 0.000
#> GSM509720     1  0.1860      0.937 0.948 0.000 0.052
#> GSM509725     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509730     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509708     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509713     1  0.0892      0.922 0.980 0.000 0.020
#> GSM509716     1  0.5216      0.644 0.740 0.260 0.000
#> GSM509721     1  0.1860      0.937 0.948 0.000 0.052
#> GSM509726     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509731     1  0.1643      0.881 0.956 0.044 0.000
#> GSM509709     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509717     1  0.5138      0.656 0.748 0.252 0.000
#> GSM509722     1  0.1753      0.936 0.952 0.000 0.048
#> GSM509727     1  0.2711      0.915 0.912 0.000 0.088
#> GSM509710     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509718     2  0.4235      0.802 0.176 0.824 0.000
#> GSM509723     1  0.1860      0.937 0.948 0.000 0.052
#> GSM509728     3  0.0237      0.994 0.004 0.000 0.996
#> GSM509732     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509736     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509741     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509746     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509733     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509737     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509742     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509747     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509734     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509738     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509743     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509748     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509735     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509739     1  0.1964      0.937 0.944 0.000 0.056
#> GSM509744     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509749     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509740     1  0.4062      0.795 0.836 0.000 0.164
#> GSM509745     3  0.1411      0.960 0.036 0.000 0.964
#> GSM509750     3  0.0000      0.997 0.000 0.000 1.000
#> GSM509751     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509753     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509755     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509757     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509759     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509761     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509763     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509765     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509767     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509769     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509771     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509773     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509775     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509777     2  0.0592      0.987 0.012 0.988 0.000
#> GSM509779     2  0.0747      0.985 0.016 0.984 0.000
#> GSM509781     2  0.0747      0.985 0.016 0.984 0.000
#> GSM509783     2  0.0747      0.985 0.016 0.984 0.000
#> GSM509785     2  0.0747      0.985 0.016 0.984 0.000
#> GSM509752     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509754     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509756     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509758     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509760     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509762     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509764     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509766     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509768     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509770     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509772     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509774     2  0.0592      0.987 0.012 0.988 0.000
#> GSM509776     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509778     2  0.0747      0.985 0.016 0.984 0.000
#> GSM509780     2  0.0000      0.992 0.000 1.000 0.000
#> GSM509782     2  0.0747      0.985 0.016 0.984 0.000
#> GSM509784     2  0.0747      0.985 0.016 0.984 0.000
#> GSM509786     2  0.0747      0.985 0.016 0.984 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509711     1  0.0921      0.955 0.972 0.000 0.000 0.028
#> GSM509714     1  0.1637      0.934 0.940 0.000 0.000 0.060
#> GSM509719     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM509724     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509729     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509707     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509712     1  0.0921      0.955 0.972 0.000 0.000 0.028
#> GSM509715     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM509720     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM509725     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509730     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509708     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509713     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509716     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM509721     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM509726     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509731     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM509709     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509717     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM509722     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM509727     1  0.1890      0.920 0.936 0.000 0.056 0.008
#> GSM509710     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509718     4  0.0000      0.947 0.000 0.000 0.000 1.000
#> GSM509723     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM509728     3  0.2011      0.908 0.080 0.000 0.920 0.000
#> GSM509732     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509736     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509741     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509737     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509742     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509734     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509738     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509743     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509735     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM509744     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509749     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509740     1  0.6265      0.114 0.500 0.000 0.444 0.056
#> GSM509745     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509750     3  0.0000      0.994 0.000 0.000 1.000 0.000
#> GSM509751     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0188      0.987 0.000 0.996 0.000 0.004
#> GSM509765     2  0.0817      0.968 0.000 0.976 0.000 0.024
#> GSM509767     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509775     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509777     4  0.2345      0.934 0.000 0.100 0.000 0.900
#> GSM509779     4  0.1637      0.968 0.000 0.060 0.000 0.940
#> GSM509781     4  0.1557      0.970 0.000 0.056 0.000 0.944
#> GSM509783     4  0.1557      0.970 0.000 0.056 0.000 0.944
#> GSM509785     4  0.1557      0.970 0.000 0.056 0.000 0.944
#> GSM509752     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509766     2  0.0188      0.987 0.000 0.996 0.000 0.004
#> GSM509768     2  0.0188      0.987 0.000 0.996 0.000 0.004
#> GSM509770     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509774     4  0.1940      0.957 0.000 0.076 0.000 0.924
#> GSM509776     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM509778     4  0.1557      0.970 0.000 0.056 0.000 0.944
#> GSM509780     2  0.3610      0.736 0.000 0.800 0.000 0.200
#> GSM509782     4  0.1557      0.970 0.000 0.056 0.000 0.944
#> GSM509784     4  0.1867      0.960 0.000 0.072 0.000 0.928
#> GSM509786     4  0.1557      0.970 0.000 0.056 0.000 0.944

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.3684      0.573 0.720 0.000 0.000 0.000 0.280
#> GSM509714     5  0.2763      0.610 0.148 0.000 0.000 0.004 0.848
#> GSM509719     1  0.3897      0.791 0.768 0.000 0.000 0.028 0.204
#> GSM509724     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.2900      0.834 0.864 0.000 0.000 0.028 0.108
#> GSM509707     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.3752      0.559 0.708 0.000 0.000 0.000 0.292
#> GSM509715     5  0.3707      0.849 0.000 0.000 0.000 0.284 0.716
#> GSM509720     1  0.3897      0.791 0.768 0.000 0.000 0.028 0.204
#> GSM509725     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.3454      0.814 0.816 0.000 0.000 0.028 0.156
#> GSM509708     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0703      0.862 0.976 0.000 0.000 0.000 0.024
#> GSM509716     5  0.3636      0.849 0.000 0.000 0.000 0.272 0.728
#> GSM509721     1  0.3897      0.791 0.768 0.000 0.000 0.028 0.204
#> GSM509726     1  0.0510      0.866 0.984 0.000 0.000 0.000 0.016
#> GSM509731     5  0.3684      0.850 0.000 0.000 0.000 0.280 0.720
#> GSM509709     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.3707      0.849 0.000 0.000 0.000 0.284 0.716
#> GSM509722     1  0.3897      0.791 0.768 0.000 0.000 0.028 0.204
#> GSM509727     1  0.5387      0.553 0.688 0.000 0.136 0.008 0.168
#> GSM509710     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.3707      0.847 0.000 0.000 0.000 0.284 0.716
#> GSM509723     1  0.3897      0.791 0.768 0.000 0.000 0.028 0.204
#> GSM509728     3  0.5297      0.581 0.260 0.000 0.660 0.008 0.072
#> GSM509732     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509736     3  0.1697      0.937 0.000 0.000 0.932 0.008 0.060
#> GSM509741     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509746     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509733     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509737     3  0.1697      0.937 0.000 0.000 0.932 0.008 0.060
#> GSM509742     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509747     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509734     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509738     3  0.1956      0.930 0.000 0.000 0.916 0.008 0.076
#> GSM509743     3  0.0609      0.950 0.000 0.000 0.980 0.000 0.020
#> GSM509748     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509735     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.1697      0.937 0.000 0.000 0.932 0.008 0.060
#> GSM509749     3  0.0000      0.953 0.000 0.000 1.000 0.000 0.000
#> GSM509740     5  0.4439      0.608 0.176 0.000 0.056 0.008 0.760
#> GSM509745     3  0.2358      0.910 0.000 0.000 0.888 0.008 0.104
#> GSM509750     3  0.1408      0.943 0.000 0.000 0.948 0.008 0.044
#> GSM509751     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> GSM509753     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> GSM509755     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> GSM509757     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> GSM509759     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> GSM509761     2  0.0609      0.925 0.000 0.980 0.000 0.020 0.000
#> GSM509763     4  0.4088      0.525 0.000 0.368 0.000 0.632 0.000
#> GSM509765     4  0.4060      0.541 0.000 0.360 0.000 0.640 0.000
#> GSM509767     2  0.0671      0.929 0.000 0.980 0.000 0.016 0.004
#> GSM509769     2  0.0609      0.924 0.000 0.980 0.000 0.020 0.000
#> GSM509771     2  0.0771      0.926 0.000 0.976 0.000 0.020 0.004
#> GSM509773     2  0.2929      0.728 0.000 0.820 0.000 0.180 0.000
#> GSM509775     2  0.4182      0.158 0.000 0.600 0.000 0.400 0.000
#> GSM509777     4  0.2127      0.754 0.000 0.108 0.000 0.892 0.000
#> GSM509779     4  0.1124      0.758 0.000 0.036 0.000 0.960 0.004
#> GSM509781     4  0.1836      0.754 0.000 0.036 0.000 0.932 0.032
#> GSM509783     4  0.1918      0.752 0.000 0.036 0.000 0.928 0.036
#> GSM509785     4  0.1918      0.752 0.000 0.036 0.000 0.928 0.036
#> GSM509752     2  0.0000      0.934 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0162      0.934 0.000 0.996 0.000 0.000 0.004
#> GSM509756     2  0.0000      0.934 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.934 0.000 1.000 0.000 0.000 0.000
#> GSM509760     2  0.0290      0.932 0.000 0.992 0.000 0.008 0.000
#> GSM509762     2  0.0162      0.934 0.000 0.996 0.000 0.000 0.004
#> GSM509764     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> GSM509766     4  0.4219      0.425 0.000 0.416 0.000 0.584 0.000
#> GSM509768     2  0.3999      0.358 0.000 0.656 0.000 0.344 0.000
#> GSM509770     2  0.0290      0.932 0.000 0.992 0.000 0.008 0.000
#> GSM509772     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> GSM509774     4  0.1952      0.761 0.000 0.084 0.000 0.912 0.004
#> GSM509776     4  0.4302      0.240 0.000 0.480 0.000 0.520 0.000
#> GSM509778     4  0.1918      0.752 0.000 0.036 0.000 0.928 0.036
#> GSM509780     4  0.3430      0.696 0.000 0.220 0.000 0.776 0.004
#> GSM509782     4  0.1836      0.754 0.000 0.036 0.000 0.932 0.032
#> GSM509784     4  0.1197      0.762 0.000 0.048 0.000 0.952 0.000
#> GSM509786     4  0.1918      0.752 0.000 0.036 0.000 0.928 0.036

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM509706     1  0.0000     0.7842 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.3513     0.6330 0.796 0.000 0.000 0.000 0.144 0.060
#> GSM509714     5  0.3994     0.6430 0.048 0.000 0.000 0.008 0.752 0.192
#> GSM509719     6  0.4037     0.9937 0.380 0.000 0.000 0.000 0.012 0.608
#> GSM509724     1  0.0260     0.7831 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM509729     1  0.3769    -0.3073 0.640 0.000 0.000 0.000 0.004 0.356
#> GSM509707     1  0.0000     0.7842 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.3928     0.5986 0.760 0.000 0.000 0.000 0.160 0.080
#> GSM509715     5  0.2135     0.8597 0.000 0.000 0.000 0.128 0.872 0.000
#> GSM509720     6  0.4037     0.9937 0.380 0.000 0.000 0.000 0.012 0.608
#> GSM509725     1  0.0260     0.7831 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM509730     1  0.4222    -0.7039 0.516 0.000 0.008 0.000 0.004 0.472
#> GSM509708     1  0.0000     0.7842 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.1829     0.7458 0.920 0.000 0.000 0.000 0.024 0.056
#> GSM509716     5  0.2092     0.8608 0.000 0.000 0.000 0.124 0.876 0.000
#> GSM509721     6  0.4037     0.9937 0.380 0.000 0.000 0.000 0.012 0.608
#> GSM509726     1  0.0935     0.7710 0.964 0.000 0.000 0.000 0.004 0.032
#> GSM509731     5  0.2821     0.8440 0.000 0.000 0.000 0.152 0.832 0.016
#> GSM509709     1  0.0000     0.7842 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.2048     0.8606 0.000 0.000 0.000 0.120 0.880 0.000
#> GSM509722     6  0.4312     0.9751 0.368 0.000 0.000 0.000 0.028 0.604
#> GSM509727     1  0.4491     0.5673 0.744 0.000 0.048 0.000 0.048 0.160
#> GSM509710     1  0.0000     0.7842 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.2404     0.8545 0.000 0.000 0.000 0.112 0.872 0.016
#> GSM509723     6  0.4037     0.9937 0.380 0.000 0.000 0.000 0.012 0.608
#> GSM509728     1  0.5859     0.3288 0.576 0.000 0.216 0.000 0.024 0.184
#> GSM509732     3  0.0000     0.8639 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     3  0.5205     0.7403 0.000 0.000 0.644 0.020 0.100 0.236
#> GSM509741     3  0.0000     0.8639 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509746     3  0.0000     0.8639 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000     0.8639 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     3  0.5205     0.7403 0.000 0.000 0.644 0.020 0.100 0.236
#> GSM509742     3  0.0000     0.8639 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509747     3  0.0000     0.8639 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.0000     0.8639 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509738     3  0.5371     0.7204 0.000 0.000 0.616 0.020 0.104 0.260
#> GSM509743     3  0.2201     0.8432 0.000 0.000 0.904 0.004 0.036 0.056
#> GSM509748     3  0.0000     0.8639 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509735     1  0.0000     0.7842 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000     0.7842 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.4948     0.7547 0.000 0.000 0.668 0.016 0.088 0.228
#> GSM509749     3  0.0291     0.8630 0.000 0.000 0.992 0.004 0.004 0.000
#> GSM509740     5  0.6210     0.4432 0.080 0.000 0.048 0.020 0.556 0.296
#> GSM509745     3  0.5811     0.6743 0.004 0.000 0.572 0.020 0.132 0.272
#> GSM509750     3  0.3958     0.7978 0.000 0.000 0.768 0.012 0.052 0.168
#> GSM509751     2  0.0260     0.8996 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM509753     2  0.0547     0.8988 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM509755     2  0.0603     0.8975 0.000 0.980 0.000 0.000 0.004 0.016
#> GSM509757     2  0.0508     0.8977 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM509759     2  0.0891     0.8976 0.000 0.968 0.000 0.000 0.008 0.024
#> GSM509761     2  0.1769     0.8778 0.000 0.924 0.000 0.060 0.004 0.012
#> GSM509763     4  0.4002     0.6391 0.000 0.260 0.000 0.704 0.000 0.036
#> GSM509765     4  0.4024     0.6293 0.000 0.264 0.000 0.700 0.000 0.036
#> GSM509767     2  0.2000     0.8840 0.000 0.916 0.000 0.048 0.004 0.032
#> GSM509769     2  0.2279     0.8705 0.000 0.900 0.000 0.048 0.004 0.048
#> GSM509771     2  0.2384     0.8766 0.000 0.896 0.000 0.056 0.008 0.040
#> GSM509773     2  0.4131     0.5526 0.000 0.688 0.000 0.272 0.000 0.040
#> GSM509775     2  0.4780    -0.0925 0.000 0.484 0.000 0.472 0.004 0.040
#> GSM509777     4  0.2094     0.7939 0.000 0.068 0.000 0.908 0.008 0.016
#> GSM509779     4  0.1408     0.8001 0.000 0.020 0.000 0.944 0.036 0.000
#> GSM509781     4  0.2069     0.7929 0.000 0.020 0.000 0.908 0.068 0.004
#> GSM509783     4  0.2126     0.7902 0.000 0.020 0.000 0.904 0.072 0.004
#> GSM509785     4  0.2126     0.7902 0.000 0.020 0.000 0.904 0.072 0.004
#> GSM509752     2  0.0000     0.9001 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0508     0.9004 0.000 0.984 0.000 0.012 0.000 0.004
#> GSM509756     2  0.0363     0.9006 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM509758     2  0.1168     0.8970 0.000 0.956 0.000 0.016 0.000 0.028
#> GSM509760     2  0.1478     0.8943 0.000 0.944 0.000 0.020 0.004 0.032
#> GSM509762     2  0.0508     0.9005 0.000 0.984 0.000 0.004 0.000 0.012
#> GSM509764     2  0.0260     0.9007 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM509766     4  0.4302     0.5222 0.000 0.324 0.000 0.644 0.004 0.028
#> GSM509768     2  0.4759     0.2262 0.000 0.556 0.000 0.396 0.004 0.044
#> GSM509770     2  0.2209     0.8760 0.000 0.904 0.000 0.040 0.004 0.052
#> GSM509772     2  0.0806     0.8978 0.000 0.972 0.000 0.000 0.008 0.020
#> GSM509774     4  0.1542     0.8005 0.000 0.052 0.000 0.936 0.008 0.004
#> GSM509776     4  0.4508     0.3286 0.000 0.396 0.000 0.568 0.000 0.036
#> GSM509778     4  0.2011     0.7946 0.000 0.020 0.000 0.912 0.064 0.004
#> GSM509780     4  0.3053     0.7511 0.000 0.144 0.000 0.828 0.004 0.024
#> GSM509782     4  0.2069     0.7929 0.000 0.020 0.000 0.908 0.068 0.004
#> GSM509784     4  0.1478     0.8028 0.000 0.032 0.000 0.944 0.020 0.004
#> GSM509786     4  0.2011     0.7940 0.000 0.020 0.000 0.912 0.064 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p)  time(p) k
#> SD:skmeans 81         8.31e-15 6.68e-12 2
#> SD:skmeans 81         3.60e-27 5.71e-12 3
#> SD:skmeans 80         7.58e-24 3.57e-08 4
#> SD:skmeans 77         5.28e-24 3.07e-08 5
#> SD:skmeans 74         3.62e-24 3.66e-06 6

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


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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.948           0.943       0.978         0.5048 0.494   0.494
#> 3 3 0.646           0.730       0.840         0.2593 0.863   0.729
#> 4 4 0.688           0.571       0.723         0.1388 0.956   0.883
#> 5 5 0.834           0.791       0.904         0.0961 0.814   0.489
#> 6 6 0.869           0.799       0.902         0.0391 0.952   0.775

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1   0.000      0.976 1.000 0.000
#> GSM509711     1   0.000      0.976 1.000 0.000
#> GSM509714     1   0.552      0.837 0.872 0.128
#> GSM509719     1   0.000      0.976 1.000 0.000
#> GSM509724     1   0.000      0.976 1.000 0.000
#> GSM509729     1   0.000      0.976 1.000 0.000
#> GSM509707     1   0.000      0.976 1.000 0.000
#> GSM509712     1   0.000      0.976 1.000 0.000
#> GSM509715     2   0.839      0.634 0.268 0.732
#> GSM509720     1   0.000      0.976 1.000 0.000
#> GSM509725     1   0.000      0.976 1.000 0.000
#> GSM509730     1   0.000      0.976 1.000 0.000
#> GSM509708     1   0.000      0.976 1.000 0.000
#> GSM509713     1   0.000      0.976 1.000 0.000
#> GSM509716     2   0.850      0.620 0.276 0.724
#> GSM509721     1   0.000      0.976 1.000 0.000
#> GSM509726     1   0.000      0.976 1.000 0.000
#> GSM509731     1   0.971      0.321 0.600 0.400
#> GSM509709     1   0.000      0.976 1.000 0.000
#> GSM509717     2   0.904      0.532 0.320 0.680
#> GSM509722     1   0.000      0.976 1.000 0.000
#> GSM509727     1   0.000      0.976 1.000 0.000
#> GSM509710     1   0.000      0.976 1.000 0.000
#> GSM509718     1   0.980      0.270 0.584 0.416
#> GSM509723     1   0.000      0.976 1.000 0.000
#> GSM509728     1   0.000      0.976 1.000 0.000
#> GSM509732     1   0.000      0.976 1.000 0.000
#> GSM509736     1   0.000      0.976 1.000 0.000
#> GSM509741     1   0.000      0.976 1.000 0.000
#> GSM509746     1   0.000      0.976 1.000 0.000
#> GSM509733     1   0.000      0.976 1.000 0.000
#> GSM509737     1   0.000      0.976 1.000 0.000
#> GSM509742     1   0.000      0.976 1.000 0.000
#> GSM509747     1   0.000      0.976 1.000 0.000
#> GSM509734     1   0.000      0.976 1.000 0.000
#> GSM509738     1   0.000      0.976 1.000 0.000
#> GSM509743     1   0.000      0.976 1.000 0.000
#> GSM509748     1   0.000      0.976 1.000 0.000
#> GSM509735     1   0.000      0.976 1.000 0.000
#> GSM509739     1   0.000      0.976 1.000 0.000
#> GSM509744     1   0.000      0.976 1.000 0.000
#> GSM509749     1   0.000      0.976 1.000 0.000
#> GSM509740     1   0.000      0.976 1.000 0.000
#> GSM509745     1   0.000      0.976 1.000 0.000
#> GSM509750     1   0.000      0.976 1.000 0.000
#> GSM509751     2   0.000      0.976 0.000 1.000
#> GSM509753     2   0.000      0.976 0.000 1.000
#> GSM509755     2   0.000      0.976 0.000 1.000
#> GSM509757     2   0.000      0.976 0.000 1.000
#> GSM509759     2   0.000      0.976 0.000 1.000
#> GSM509761     2   0.000      0.976 0.000 1.000
#> GSM509763     2   0.000      0.976 0.000 1.000
#> GSM509765     2   0.000      0.976 0.000 1.000
#> GSM509767     2   0.000      0.976 0.000 1.000
#> GSM509769     2   0.000      0.976 0.000 1.000
#> GSM509771     2   0.000      0.976 0.000 1.000
#> GSM509773     2   0.000      0.976 0.000 1.000
#> GSM509775     2   0.000      0.976 0.000 1.000
#> GSM509777     2   0.000      0.976 0.000 1.000
#> GSM509779     2   0.000      0.976 0.000 1.000
#> GSM509781     2   0.000      0.976 0.000 1.000
#> GSM509783     2   0.000      0.976 0.000 1.000
#> GSM509785     2   0.000      0.976 0.000 1.000
#> GSM509752     2   0.000      0.976 0.000 1.000
#> GSM509754     2   0.000      0.976 0.000 1.000
#> GSM509756     2   0.000      0.976 0.000 1.000
#> GSM509758     2   0.000      0.976 0.000 1.000
#> GSM509760     2   0.000      0.976 0.000 1.000
#> GSM509762     2   0.000      0.976 0.000 1.000
#> GSM509764     2   0.000      0.976 0.000 1.000
#> GSM509766     2   0.000      0.976 0.000 1.000
#> GSM509768     2   0.000      0.976 0.000 1.000
#> GSM509770     2   0.000      0.976 0.000 1.000
#> GSM509772     2   0.000      0.976 0.000 1.000
#> GSM509774     2   0.000      0.976 0.000 1.000
#> GSM509776     2   0.000      0.976 0.000 1.000
#> GSM509778     2   0.000      0.976 0.000 1.000
#> GSM509780     2   0.000      0.976 0.000 1.000
#> GSM509782     2   0.000      0.976 0.000 1.000
#> GSM509784     2   0.000      0.976 0.000 1.000
#> GSM509786     2   0.000      0.976 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
#> GSM509706     1  0.4178    0.93361 0.828 0.000 0.172
#> GSM509711     1  0.5926    0.62209 0.644 0.000 0.356
#> GSM509714     3  0.8606    0.12069 0.364 0.108 0.528
#> GSM509719     3  0.5397    0.50142 0.280 0.000 0.720
#> GSM509724     1  0.4178    0.93361 0.828 0.000 0.172
#> GSM509729     1  0.4235    0.93200 0.824 0.000 0.176
#> GSM509707     1  0.4178    0.93361 0.828 0.000 0.172
#> GSM509712     3  0.6154    0.16611 0.408 0.000 0.592
#> GSM509715     2  0.8312    0.30909 0.100 0.576 0.324
#> GSM509720     3  0.5363    0.50196 0.276 0.000 0.724
#> GSM509725     1  0.4931    0.86275 0.768 0.000 0.232
#> GSM509730     3  0.5706    0.46230 0.320 0.000 0.680
#> GSM509708     1  0.4178    0.93361 0.828 0.000 0.172
#> GSM509713     1  0.4346    0.92505 0.816 0.000 0.184
#> GSM509716     2  0.9836   -0.07054 0.252 0.404 0.344
#> GSM509721     3  0.5588    0.50374 0.276 0.004 0.720
#> GSM509726     1  0.5810    0.67665 0.664 0.000 0.336
#> GSM509731     2  0.9776   -0.06216 0.244 0.424 0.332
#> GSM509709     1  0.4178    0.93361 0.828 0.000 0.172
#> GSM509717     2  0.9690    0.00592 0.232 0.444 0.324
#> GSM509722     3  0.5588    0.49934 0.276 0.004 0.720
#> GSM509727     3  0.4750    0.55757 0.216 0.000 0.784
#> GSM509710     1  0.4235    0.93127 0.824 0.000 0.176
#> GSM509718     3  0.6941    0.05858 0.016 0.464 0.520
#> GSM509723     3  0.5497    0.48170 0.292 0.000 0.708
#> GSM509728     3  0.5591    0.45988 0.304 0.000 0.696
#> GSM509732     3  0.3551    0.67769 0.132 0.000 0.868
#> GSM509736     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509741     3  0.3340    0.68795 0.120 0.000 0.880
#> GSM509746     3  0.3340    0.68795 0.120 0.000 0.880
#> GSM509733     3  0.3551    0.67784 0.132 0.000 0.868
#> GSM509737     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509742     3  0.3340    0.68795 0.120 0.000 0.880
#> GSM509747     3  0.4605    0.58352 0.204 0.000 0.796
#> GSM509734     3  0.4974    0.52524 0.236 0.000 0.764
#> GSM509738     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509743     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509748     3  0.3340    0.68795 0.120 0.000 0.880
#> GSM509735     1  0.4750    0.89404 0.784 0.000 0.216
#> GSM509739     1  0.4178    0.93361 0.828 0.000 0.172
#> GSM509744     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509749     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509740     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509745     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509750     3  0.0000    0.73071 0.000 0.000 1.000
#> GSM509751     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509753     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509755     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509757     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509759     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509761     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509763     2  0.0892    0.86834 0.020 0.980 0.000
#> GSM509765     2  0.1411    0.86510 0.036 0.964 0.000
#> GSM509767     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509769     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509771     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509773     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509775     2  0.1411    0.87432 0.036 0.964 0.000
#> GSM509777     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509779     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509781     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509783     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509785     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509752     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509754     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509756     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509758     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509760     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509762     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509764     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509766     2  0.0892    0.86831 0.020 0.980 0.000
#> GSM509768     2  0.2066    0.87448 0.060 0.940 0.000
#> GSM509770     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509772     2  0.3551    0.87835 0.132 0.868 0.000
#> GSM509774     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509776     2  0.1031    0.86779 0.024 0.976 0.000
#> GSM509778     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509780     2  0.1411    0.86510 0.036 0.964 0.000
#> GSM509782     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509784     2  0.1529    0.86414 0.040 0.960 0.000
#> GSM509786     2  0.1529    0.86414 0.040 0.960 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0000   0.894586 1.000 0.000 0.000 0.000
#> GSM509711     1  0.7241   0.166668 0.536 0.000 0.188 0.276
#> GSM509714     3  0.8175  -0.304900 0.272 0.012 0.416 0.300
#> GSM509719     3  0.7239  -0.087231 0.128 0.016 0.576 0.280
#> GSM509724     1  0.0000   0.894586 1.000 0.000 0.000 0.000
#> GSM509729     1  0.4313   0.636935 0.736 0.000 0.004 0.260
#> GSM509707     1  0.0000   0.894586 1.000 0.000 0.000 0.000
#> GSM509712     3  0.7784  -0.252009 0.292 0.000 0.428 0.280
#> GSM509715     4  0.6136   0.796085 0.000 0.060 0.356 0.584
#> GSM509720     3  0.6876  -0.079702 0.144 0.000 0.576 0.280
#> GSM509725     1  0.0336   0.888940 0.992 0.000 0.008 0.000
#> GSM509730     3  0.7289  -0.018207 0.212 0.000 0.536 0.252
#> GSM509708     1  0.0000   0.894586 1.000 0.000 0.000 0.000
#> GSM509713     1  0.3495   0.780072 0.844 0.000 0.016 0.140
#> GSM509716     4  0.7156   0.818952 0.080 0.024 0.356 0.540
#> GSM509721     3  0.7295  -0.089977 0.124 0.020 0.576 0.280
#> GSM509726     1  0.3219   0.802833 0.868 0.000 0.112 0.020
#> GSM509731     4  0.6054   0.859562 0.056 0.000 0.352 0.592
#> GSM509709     1  0.0000   0.894586 1.000 0.000 0.000 0.000
#> GSM509717     4  0.5182   0.862667 0.004 0.008 0.356 0.632
#> GSM509722     3  0.7174  -0.085306 0.132 0.012 0.576 0.280
#> GSM509727     3  0.6305   0.000977 0.424 0.000 0.516 0.060
#> GSM509710     1  0.0000   0.894586 1.000 0.000 0.000 0.000
#> GSM509718     3  0.5924  -0.555310 0.000 0.040 0.556 0.404
#> GSM509723     3  0.7064  -0.108405 0.164 0.000 0.556 0.280
#> GSM509728     3  0.4999  -0.019334 0.492 0.000 0.508 0.000
#> GSM509732     3  0.6025   0.529934 0.096 0.000 0.668 0.236
#> GSM509736     3  0.0000   0.496247 0.000 0.000 1.000 0.000
#> GSM509741     3  0.6025   0.529934 0.096 0.000 0.668 0.236
#> GSM509746     3  0.6025   0.529934 0.096 0.000 0.668 0.236
#> GSM509733     3  0.6025   0.529934 0.096 0.000 0.668 0.236
#> GSM509737     3  0.0000   0.496247 0.000 0.000 1.000 0.000
#> GSM509742     3  0.6025   0.529934 0.096 0.000 0.668 0.236
#> GSM509747     3  0.6025   0.529934 0.096 0.000 0.668 0.236
#> GSM509734     3  0.6025   0.529934 0.096 0.000 0.668 0.236
#> GSM509738     3  0.0000   0.496247 0.000 0.000 1.000 0.000
#> GSM509743     3  0.3726   0.522211 0.000 0.000 0.788 0.212
#> GSM509748     3  0.6025   0.529934 0.096 0.000 0.668 0.236
#> GSM509735     1  0.1716   0.855120 0.936 0.000 0.064 0.000
#> GSM509739     1  0.0000   0.894586 1.000 0.000 0.000 0.000
#> GSM509744     3  0.2921   0.521715 0.000 0.000 0.860 0.140
#> GSM509749     3  0.1211   0.507760 0.000 0.000 0.960 0.040
#> GSM509740     3  0.1716   0.438740 0.000 0.000 0.936 0.064
#> GSM509745     3  0.0000   0.496247 0.000 0.000 1.000 0.000
#> GSM509750     3  0.0000   0.496247 0.000 0.000 1.000 0.000
#> GSM509751     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509763     2  0.4877   0.655177 0.000 0.592 0.000 0.408
#> GSM509765     2  0.4948   0.638622 0.000 0.560 0.000 0.440
#> GSM509767     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0921   0.763546 0.000 0.972 0.000 0.028
#> GSM509775     2  0.3486   0.727145 0.000 0.812 0.000 0.188
#> GSM509777     2  0.4992   0.615891 0.000 0.524 0.000 0.476
#> GSM509779     2  0.4996   0.610206 0.000 0.516 0.000 0.484
#> GSM509781     2  0.4996   0.610206 0.000 0.516 0.000 0.484
#> GSM509783     2  0.4999   0.599534 0.000 0.508 0.000 0.492
#> GSM509785     2  0.4996   0.610206 0.000 0.516 0.000 0.484
#> GSM509752     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509766     2  0.4746   0.672048 0.000 0.632 0.000 0.368
#> GSM509768     2  0.4164   0.706846 0.000 0.736 0.000 0.264
#> GSM509770     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000   0.768958 0.000 1.000 0.000 0.000
#> GSM509774     2  0.4996   0.610206 0.000 0.516 0.000 0.484
#> GSM509776     2  0.4843   0.659830 0.000 0.604 0.000 0.396
#> GSM509778     2  0.4996   0.610206 0.000 0.516 0.000 0.484
#> GSM509780     2  0.4955   0.636165 0.000 0.556 0.000 0.444
#> GSM509782     2  0.4996   0.610206 0.000 0.516 0.000 0.484
#> GSM509784     2  0.4996   0.610206 0.000 0.516 0.000 0.484
#> GSM509786     2  0.4996   0.610206 0.000 0.516 0.000 0.484

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000     0.9137 1.000 0.000 0.000 0.000 0.000
#> GSM509711     5  0.4350    -0.0174 0.408 0.000 0.000 0.004 0.588
#> GSM509714     5  0.0162     0.7563 0.000 0.000 0.000 0.004 0.996
#> GSM509719     5  0.0162     0.7563 0.000 0.000 0.000 0.004 0.996
#> GSM509724     1  0.0000     0.9137 1.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.4538     0.4105 0.564 0.000 0.004 0.004 0.428
#> GSM509707     1  0.0000     0.9137 1.000 0.000 0.000 0.000 0.000
#> GSM509712     5  0.0162     0.7563 0.000 0.000 0.000 0.004 0.996
#> GSM509715     5  0.3003     0.6823 0.000 0.000 0.000 0.188 0.812
#> GSM509720     5  0.0162     0.7563 0.000 0.000 0.000 0.004 0.996
#> GSM509725     1  0.0162     0.9118 0.996 0.000 0.004 0.000 0.000
#> GSM509730     5  0.0854     0.7525 0.008 0.000 0.012 0.004 0.976
#> GSM509708     1  0.0000     0.9137 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.3456     0.7475 0.788 0.000 0.004 0.004 0.204
#> GSM509716     5  0.0290     0.7555 0.000 0.000 0.000 0.008 0.992
#> GSM509721     5  0.0162     0.7563 0.000 0.000 0.000 0.004 0.996
#> GSM509726     1  0.2843     0.8065 0.848 0.000 0.008 0.000 0.144
#> GSM509731     5  0.1851     0.7342 0.000 0.000 0.000 0.088 0.912
#> GSM509709     1  0.0000     0.9137 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.2690     0.7029 0.000 0.000 0.000 0.156 0.844
#> GSM509722     5  0.0162     0.7563 0.000 0.000 0.000 0.004 0.996
#> GSM509727     5  0.5156     0.5018 0.320 0.000 0.060 0.000 0.620
#> GSM509710     1  0.0000     0.9137 1.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.4400     0.6500 0.000 0.000 0.196 0.060 0.744
#> GSM509723     5  0.0162     0.7563 0.000 0.000 0.000 0.004 0.996
#> GSM509728     5  0.6023     0.5094 0.260 0.000 0.168 0.000 0.572
#> GSM509732     3  0.0000     0.9013 0.000 0.000 1.000 0.000 0.000
#> GSM509736     5  0.4219     0.4206 0.000 0.000 0.416 0.000 0.584
#> GSM509741     3  0.0000     0.9013 0.000 0.000 1.000 0.000 0.000
#> GSM509746     3  0.0000     0.9013 0.000 0.000 1.000 0.000 0.000
#> GSM509733     3  0.0000     0.9013 0.000 0.000 1.000 0.000 0.000
#> GSM509737     5  0.4219     0.4206 0.000 0.000 0.416 0.000 0.584
#> GSM509742     3  0.0000     0.9013 0.000 0.000 1.000 0.000 0.000
#> GSM509747     3  0.0000     0.9013 0.000 0.000 1.000 0.000 0.000
#> GSM509734     3  0.0000     0.9013 0.000 0.000 1.000 0.000 0.000
#> GSM509738     5  0.4219     0.4206 0.000 0.000 0.416 0.000 0.584
#> GSM509743     3  0.0963     0.8720 0.000 0.000 0.964 0.000 0.036
#> GSM509748     3  0.0000     0.9013 0.000 0.000 1.000 0.000 0.000
#> GSM509735     1  0.2124     0.8477 0.900 0.000 0.004 0.000 0.096
#> GSM509739     1  0.0000     0.9137 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.3561     0.5243 0.000 0.000 0.740 0.000 0.260
#> GSM509749     3  0.4262    -0.0771 0.000 0.000 0.560 0.000 0.440
#> GSM509740     5  0.3932     0.5458 0.000 0.000 0.328 0.000 0.672
#> GSM509745     5  0.4219     0.4206 0.000 0.000 0.416 0.000 0.584
#> GSM509750     5  0.4219     0.4206 0.000 0.000 0.416 0.000 0.584
#> GSM509751     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509763     4  0.2929     0.8211 0.000 0.180 0.000 0.820 0.000
#> GSM509765     4  0.1908     0.8979 0.000 0.092 0.000 0.908 0.000
#> GSM509767     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509769     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509771     2  0.0162     0.9525 0.000 0.996 0.000 0.004 0.000
#> GSM509773     2  0.1043     0.9197 0.000 0.960 0.000 0.040 0.000
#> GSM509775     2  0.3913     0.4702 0.000 0.676 0.000 0.324 0.000
#> GSM509777     4  0.1197     0.9189 0.000 0.048 0.000 0.952 0.000
#> GSM509779     4  0.0162     0.9308 0.000 0.004 0.000 0.996 0.000
#> GSM509781     4  0.0162     0.9308 0.000 0.004 0.000 0.996 0.000
#> GSM509783     4  0.0162     0.9308 0.000 0.004 0.000 0.996 0.000
#> GSM509785     4  0.0162     0.9308 0.000 0.004 0.000 0.996 0.000
#> GSM509752     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509760     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509762     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509766     4  0.3336     0.7551 0.000 0.228 0.000 0.772 0.000
#> GSM509768     2  0.4249     0.1582 0.000 0.568 0.000 0.432 0.000
#> GSM509770     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509772     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.0404     0.9302 0.000 0.012 0.000 0.988 0.000
#> GSM509776     4  0.3210     0.7802 0.000 0.212 0.000 0.788 0.000
#> GSM509778     4  0.0162     0.9308 0.000 0.004 0.000 0.996 0.000
#> GSM509780     4  0.1792     0.9021 0.000 0.084 0.000 0.916 0.000
#> GSM509782     4  0.0162     0.9308 0.000 0.004 0.000 0.996 0.000
#> GSM509784     4  0.0290     0.9308 0.000 0.008 0.000 0.992 0.000
#> GSM509786     4  0.0162     0.9308 0.000 0.004 0.000 0.996 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
#> GSM509706     1  0.0000     0.8378 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     5  0.5803     0.2948 0.184 0.000 0.000 0.000 0.444 0.372
#> GSM509714     5  0.3515     0.5897 0.000 0.000 0.000 0.000 0.676 0.324
#> GSM509719     5  0.1075     0.8531 0.000 0.000 0.000 0.000 0.952 0.048
#> GSM509724     1  0.0000     0.8378 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509729     5  0.0000     0.8602 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509707     1  0.0000     0.8378 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     6  0.3961     0.0608 0.004 0.000 0.000 0.000 0.440 0.556
#> GSM509715     6  0.1644     0.6734 0.000 0.000 0.000 0.004 0.076 0.920
#> GSM509720     5  0.0937     0.8577 0.000 0.000 0.000 0.000 0.960 0.040
#> GSM509725     1  0.0000     0.8378 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509730     5  0.1387     0.8357 0.000 0.000 0.000 0.000 0.932 0.068
#> GSM509708     1  0.0000     0.8378 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.5871     0.1534 0.468 0.000 0.000 0.000 0.312 0.220
#> GSM509716     6  0.1644     0.6734 0.000 0.000 0.000 0.004 0.076 0.920
#> GSM509721     5  0.0713     0.8609 0.000 0.000 0.000 0.000 0.972 0.028
#> GSM509726     1  0.3995     0.0815 0.516 0.000 0.004 0.000 0.000 0.480
#> GSM509731     6  0.2214     0.6512 0.000 0.000 0.000 0.016 0.096 0.888
#> GSM509709     1  0.0000     0.8378 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     6  0.1644     0.6734 0.000 0.000 0.000 0.004 0.076 0.920
#> GSM509722     5  0.0000     0.8602 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509727     6  0.4307     0.6467 0.172 0.000 0.068 0.000 0.016 0.744
#> GSM509710     1  0.0000     0.8378 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     6  0.1296     0.6902 0.000 0.000 0.004 0.004 0.044 0.948
#> GSM509723     5  0.0000     0.8602 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509728     6  0.4605     0.6760 0.124 0.000 0.184 0.000 0.000 0.692
#> GSM509732     3  0.0000     0.9548 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     6  0.3528     0.6773 0.000 0.000 0.296 0.000 0.004 0.700
#> GSM509741     3  0.0000     0.9548 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509746     3  0.0000     0.9548 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000     0.9548 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     6  0.3528     0.6773 0.000 0.000 0.296 0.000 0.004 0.700
#> GSM509742     3  0.0000     0.9548 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509747     3  0.0000     0.9548 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.0000     0.9548 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509738     6  0.3528     0.6773 0.000 0.000 0.296 0.000 0.004 0.700
#> GSM509743     3  0.1267     0.9050 0.000 0.000 0.940 0.000 0.000 0.060
#> GSM509748     3  0.0632     0.9394 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM509735     1  0.5605     0.2010 0.488 0.000 0.000 0.000 0.360 0.152
#> GSM509739     1  0.0000     0.8378 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.3050     0.6044 0.000 0.000 0.764 0.000 0.000 0.236
#> GSM509749     6  0.3847     0.4169 0.000 0.000 0.456 0.000 0.000 0.544
#> GSM509740     6  0.2416     0.7254 0.000 0.000 0.156 0.000 0.000 0.844
#> GSM509745     6  0.3390     0.6781 0.000 0.000 0.296 0.000 0.000 0.704
#> GSM509750     6  0.3409     0.6742 0.000 0.000 0.300 0.000 0.000 0.700
#> GSM509751     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509759     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509761     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509763     4  0.2454     0.8245 0.000 0.160 0.000 0.840 0.000 0.000
#> GSM509765     4  0.1267     0.9119 0.000 0.060 0.000 0.940 0.000 0.000
#> GSM509767     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509769     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509771     2  0.0146     0.9493 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509773     2  0.0937     0.9168 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM509775     2  0.3607     0.4276 0.000 0.652 0.000 0.348 0.000 0.000
#> GSM509777     4  0.0260     0.9406 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM509779     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509781     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509783     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509785     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509752     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509760     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509762     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509764     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509766     4  0.2762     0.7809 0.000 0.196 0.000 0.804 0.000 0.000
#> GSM509768     2  0.3838     0.1331 0.000 0.552 0.000 0.448 0.000 0.000
#> GSM509770     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509772     2  0.0000     0.9525 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509774     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509776     4  0.2664     0.7969 0.000 0.184 0.000 0.816 0.000 0.000
#> GSM509778     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509780     4  0.0937     0.9245 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM509782     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509784     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509786     4  0.0000     0.9433 0.000 0.000 0.000 1.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p)  time(p) k
#> SD:pam 79         1.34e-15 8.94e-13 2
#> SD:pam 70         1.75e-20 1.23e-10 3
#> SD:pam 63         1.66e-21 3.09e-08 4
#> SD:pam 71         2.84e-22 2.95e-08 5
#> SD:pam 73         5.87e-20 4.16e-08 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 19175 rows and 81 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5005 0.500   0.500
#> 3 3 0.822           0.778       0.905         0.2994 0.861   0.722
#> 4 4 0.920           0.899       0.952         0.0944 0.921   0.786
#> 5 5 0.835           0.894       0.923         0.0876 0.920   0.733
#> 6 6 0.759           0.779       0.834         0.0296 0.961   0.827

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
#> GSM509706     1       0          1  1  0
#> GSM509711     1       0          1  1  0
#> GSM509714     1       0          1  1  0
#> GSM509719     1       0          1  1  0
#> GSM509724     1       0          1  1  0
#> GSM509729     1       0          1  1  0
#> GSM509707     1       0          1  1  0
#> GSM509712     1       0          1  1  0
#> GSM509715     1       0          1  1  0
#> GSM509720     1       0          1  1  0
#> GSM509725     1       0          1  1  0
#> GSM509730     1       0          1  1  0
#> GSM509708     1       0          1  1  0
#> GSM509713     1       0          1  1  0
#> GSM509716     1       0          1  1  0
#> GSM509721     1       0          1  1  0
#> GSM509726     1       0          1  1  0
#> GSM509731     1       0          1  1  0
#> GSM509709     1       0          1  1  0
#> GSM509717     1       0          1  1  0
#> GSM509722     1       0          1  1  0
#> GSM509727     1       0          1  1  0
#> GSM509710     1       0          1  1  0
#> GSM509718     1       0          1  1  0
#> GSM509723     1       0          1  1  0
#> GSM509728     1       0          1  1  0
#> GSM509732     1       0          1  1  0
#> GSM509736     1       0          1  1  0
#> GSM509741     1       0          1  1  0
#> GSM509746     1       0          1  1  0
#> GSM509733     1       0          1  1  0
#> GSM509737     1       0          1  1  0
#> GSM509742     1       0          1  1  0
#> GSM509747     1       0          1  1  0
#> GSM509734     1       0          1  1  0
#> GSM509738     1       0          1  1  0
#> GSM509743     1       0          1  1  0
#> GSM509748     1       0          1  1  0
#> GSM509735     1       0          1  1  0
#> GSM509739     1       0          1  1  0
#> GSM509744     1       0          1  1  0
#> GSM509749     1       0          1  1  0
#> GSM509740     1       0          1  1  0
#> GSM509745     1       0          1  1  0
#> GSM509750     1       0          1  1  0
#> GSM509751     2       0          1  0  1
#> GSM509753     2       0          1  0  1
#> GSM509755     2       0          1  0  1
#> GSM509757     2       0          1  0  1
#> GSM509759     2       0          1  0  1
#> GSM509761     2       0          1  0  1
#> GSM509763     2       0          1  0  1
#> GSM509765     2       0          1  0  1
#> GSM509767     2       0          1  0  1
#> GSM509769     2       0          1  0  1
#> GSM509771     2       0          1  0  1
#> GSM509773     2       0          1  0  1
#> GSM509775     2       0          1  0  1
#> GSM509777     2       0          1  0  1
#> GSM509779     2       0          1  0  1
#> GSM509781     2       0          1  0  1
#> GSM509783     2       0          1  0  1
#> GSM509785     2       0          1  0  1
#> GSM509752     2       0          1  0  1
#> GSM509754     2       0          1  0  1
#> GSM509756     2       0          1  0  1
#> GSM509758     2       0          1  0  1
#> GSM509760     2       0          1  0  1
#> GSM509762     2       0          1  0  1
#> GSM509764     2       0          1  0  1
#> GSM509766     2       0          1  0  1
#> GSM509768     2       0          1  0  1
#> GSM509770     2       0          1  0  1
#> GSM509772     2       0          1  0  1
#> GSM509774     2       0          1  0  1
#> GSM509776     2       0          1  0  1
#> GSM509778     2       0          1  0  1
#> GSM509780     2       0          1  0  1
#> GSM509782     2       0          1  0  1
#> GSM509784     2       0          1  0  1
#> GSM509786     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509711     3  0.0000      0.439 0.000 0.000 1.000
#> GSM509714     3  0.0000      0.439 0.000 0.000 1.000
#> GSM509719     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509724     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509729     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509707     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509712     3  0.0000      0.439 0.000 0.000 1.000
#> GSM509715     3  0.0000      0.439 0.000 0.000 1.000
#> GSM509720     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509725     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509730     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509708     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509713     3  0.0424      0.423 0.008 0.000 0.992
#> GSM509716     3  0.0000      0.439 0.000 0.000 1.000
#> GSM509721     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509726     3  0.3267      0.132 0.116 0.000 0.884
#> GSM509731     3  0.0000      0.439 0.000 0.000 1.000
#> GSM509709     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509717     3  0.0000      0.439 0.000 0.000 1.000
#> GSM509722     1  0.6225      0.995 0.568 0.000 0.432
#> GSM509727     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509710     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509718     3  0.0000      0.439 0.000 0.000 1.000
#> GSM509723     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509728     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509732     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509736     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509741     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509746     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509733     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509737     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509742     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509747     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509734     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509738     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509743     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509748     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509735     3  0.6168     -0.748 0.412 0.000 0.588
#> GSM509739     1  0.6215      1.000 0.572 0.000 0.428
#> GSM509744     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509749     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509740     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509745     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509750     3  0.6215      0.792 0.428 0.000 0.572
#> GSM509751     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509753     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509755     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509757     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509759     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509761     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509763     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509765     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509767     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509769     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509771     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509773     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509775     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509777     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509779     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509781     2  0.6168      0.341 0.000 0.588 0.412
#> GSM509783     2  0.6180      0.330 0.000 0.584 0.416
#> GSM509785     2  0.6168      0.341 0.000 0.588 0.412
#> GSM509752     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509754     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509756     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509758     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509760     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509762     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509764     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509766     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509768     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509770     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509772     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509774     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509776     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509778     2  0.6126      0.367 0.000 0.600 0.400
#> GSM509780     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509782     2  0.6180      0.330 0.000 0.584 0.416
#> GSM509784     2  0.0000      0.920 0.000 1.000 0.000
#> GSM509786     2  0.6168      0.341 0.000 0.588 0.412

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> GSM509711     4  0.2197      0.859 0.080 0.000 0.004 0.916
#> GSM509714     4  0.0817      0.888 0.024 0.000 0.000 0.976
#> GSM509719     1  0.0336      0.980 0.992 0.000 0.000 0.008
#> GSM509724     1  0.1022      0.959 0.968 0.000 0.000 0.032
#> GSM509729     1  0.0336      0.980 0.992 0.000 0.000 0.008
#> GSM509707     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> GSM509712     4  0.4304      0.646 0.284 0.000 0.000 0.716
#> GSM509715     4  0.0188      0.893 0.004 0.000 0.000 0.996
#> GSM509720     1  0.0336      0.980 0.992 0.000 0.000 0.008
#> GSM509725     1  0.0592      0.972 0.984 0.000 0.000 0.016
#> GSM509730     1  0.0336      0.980 0.992 0.000 0.000 0.008
#> GSM509708     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> GSM509713     4  0.5147      0.268 0.460 0.000 0.004 0.536
#> GSM509716     4  0.0188      0.893 0.004 0.000 0.000 0.996
#> GSM509721     1  0.0336      0.980 0.992 0.000 0.000 0.008
#> GSM509726     1  0.2197      0.903 0.916 0.000 0.004 0.080
#> GSM509731     4  0.0188      0.893 0.004 0.000 0.000 0.996
#> GSM509709     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> GSM509717     4  0.0188      0.893 0.004 0.000 0.000 0.996
#> GSM509722     1  0.0336      0.980 0.992 0.000 0.000 0.008
#> GSM509727     3  0.3858      0.852 0.056 0.000 0.844 0.100
#> GSM509710     1  0.0592      0.972 0.984 0.000 0.000 0.016
#> GSM509718     4  0.0188      0.893 0.004 0.000 0.000 0.996
#> GSM509723     1  0.0336      0.980 0.992 0.000 0.000 0.008
#> GSM509728     3  0.2675      0.904 0.008 0.000 0.892 0.100
#> GSM509732     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509736     3  0.0469      0.965 0.000 0.000 0.988 0.012
#> GSM509741     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509737     3  0.1940      0.928 0.000 0.000 0.924 0.076
#> GSM509742     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509734     3  0.2197      0.923 0.004 0.000 0.916 0.080
#> GSM509738     3  0.0469      0.965 0.000 0.000 0.988 0.012
#> GSM509743     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509735     1  0.1940      0.912 0.924 0.000 0.000 0.076
#> GSM509739     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> GSM509744     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509749     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509740     3  0.2675      0.903 0.008 0.000 0.892 0.100
#> GSM509745     3  0.0469      0.965 0.000 0.000 0.988 0.012
#> GSM509750     3  0.0592      0.964 0.000 0.000 0.984 0.016
#> GSM509751     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509765     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509767     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509775     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509777     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509779     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509781     2  0.4679      0.527 0.000 0.648 0.000 0.352
#> GSM509783     2  0.4713      0.512 0.000 0.640 0.000 0.360
#> GSM509785     2  0.4679      0.527 0.000 0.648 0.000 0.352
#> GSM509752     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509766     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509768     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509770     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509774     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509776     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509778     2  0.4564      0.567 0.000 0.672 0.000 0.328
#> GSM509780     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> GSM509782     2  0.4804      0.464 0.000 0.616 0.000 0.384
#> GSM509784     2  0.0188      0.932 0.000 0.996 0.000 0.004
#> GSM509786     2  0.4679      0.527 0.000 0.648 0.000 0.352

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000      0.974 1.000 0.000 0.000 0.000 0.000
#> GSM509711     5  0.1522      0.855 0.044 0.000 0.012 0.000 0.944
#> GSM509714     5  0.0703      0.867 0.024 0.000 0.000 0.000 0.976
#> GSM509719     1  0.0609      0.973 0.980 0.000 0.000 0.000 0.020
#> GSM509724     1  0.0000      0.974 1.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.0609      0.973 0.980 0.000 0.000 0.000 0.020
#> GSM509707     1  0.0000      0.974 1.000 0.000 0.000 0.000 0.000
#> GSM509712     5  0.4046      0.596 0.296 0.000 0.008 0.000 0.696
#> GSM509715     5  0.0162      0.870 0.004 0.000 0.000 0.000 0.996
#> GSM509720     1  0.0609      0.973 0.980 0.000 0.000 0.000 0.020
#> GSM509725     1  0.0000      0.974 1.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.0609      0.973 0.980 0.000 0.000 0.000 0.020
#> GSM509708     1  0.0000      0.974 1.000 0.000 0.000 0.000 0.000
#> GSM509713     5  0.4656      0.165 0.480 0.000 0.012 0.000 0.508
#> GSM509716     5  0.0162      0.870 0.004 0.000 0.000 0.000 0.996
#> GSM509721     1  0.0609      0.973 0.980 0.000 0.000 0.000 0.020
#> GSM509726     1  0.2470      0.839 0.884 0.000 0.012 0.000 0.104
#> GSM509731     5  0.0404      0.871 0.012 0.000 0.000 0.000 0.988
#> GSM509709     1  0.0000      0.974 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.0162      0.870 0.004 0.000 0.000 0.000 0.996
#> GSM509722     1  0.0609      0.973 0.980 0.000 0.000 0.000 0.020
#> GSM509727     3  0.4252      0.856 0.020 0.000 0.796 0.056 0.128
#> GSM509710     1  0.0000      0.974 1.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.0162      0.870 0.004 0.000 0.000 0.000 0.996
#> GSM509723     1  0.0609      0.973 0.980 0.000 0.000 0.000 0.020
#> GSM509728     3  0.3948      0.867 0.008 0.000 0.808 0.056 0.128
#> GSM509732     3  0.0880      0.897 0.000 0.000 0.968 0.032 0.000
#> GSM509736     3  0.3375      0.884 0.000 0.000 0.840 0.056 0.104
#> GSM509741     3  0.0963      0.896 0.000 0.000 0.964 0.036 0.000
#> GSM509746     3  0.0880      0.897 0.000 0.000 0.968 0.032 0.000
#> GSM509733     3  0.0880      0.897 0.000 0.000 0.968 0.032 0.000
#> GSM509737     3  0.3622      0.874 0.000 0.000 0.820 0.056 0.124
#> GSM509742     3  0.0963      0.896 0.000 0.000 0.964 0.036 0.000
#> GSM509747     3  0.0290      0.900 0.000 0.000 0.992 0.008 0.000
#> GSM509734     3  0.3575      0.877 0.000 0.000 0.824 0.056 0.120
#> GSM509738     3  0.3527      0.879 0.000 0.000 0.828 0.056 0.116
#> GSM509743     3  0.0963      0.896 0.000 0.000 0.964 0.036 0.000
#> GSM509748     3  0.0510      0.900 0.000 0.000 0.984 0.016 0.000
#> GSM509735     1  0.1608      0.901 0.928 0.000 0.000 0.000 0.072
#> GSM509739     1  0.0000      0.974 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.0963      0.896 0.000 0.000 0.964 0.036 0.000
#> GSM509749     3  0.0510      0.899 0.000 0.000 0.984 0.016 0.000
#> GSM509740     3  0.4057      0.863 0.012 0.000 0.804 0.056 0.128
#> GSM509745     3  0.3323      0.885 0.000 0.000 0.844 0.056 0.100
#> GSM509750     3  0.3090      0.889 0.000 0.000 0.860 0.052 0.088
#> GSM509751     2  0.0510      0.943 0.000 0.984 0.000 0.016 0.000
#> GSM509753     2  0.0162      0.943 0.000 0.996 0.000 0.004 0.000
#> GSM509755     2  0.0404      0.940 0.000 0.988 0.000 0.012 0.000
#> GSM509757     2  0.0404      0.940 0.000 0.988 0.000 0.012 0.000
#> GSM509759     2  0.0404      0.940 0.000 0.988 0.000 0.012 0.000
#> GSM509761     2  0.0609      0.943 0.000 0.980 0.000 0.020 0.000
#> GSM509763     2  0.3480      0.672 0.000 0.752 0.000 0.248 0.000
#> GSM509765     2  0.3274      0.718 0.000 0.780 0.000 0.220 0.000
#> GSM509767     2  0.0404      0.943 0.000 0.988 0.000 0.012 0.000
#> GSM509769     2  0.0609      0.943 0.000 0.980 0.000 0.020 0.000
#> GSM509771     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000
#> GSM509773     2  0.2127      0.879 0.000 0.892 0.000 0.108 0.000
#> GSM509775     2  0.0703      0.942 0.000 0.976 0.000 0.024 0.000
#> GSM509777     4  0.3884      0.752 0.000 0.288 0.000 0.708 0.004
#> GSM509779     4  0.2970      0.906 0.000 0.168 0.000 0.828 0.004
#> GSM509781     4  0.2612      0.916 0.000 0.124 0.000 0.868 0.008
#> GSM509783     4  0.4219      0.867 0.000 0.116 0.000 0.780 0.104
#> GSM509785     4  0.3012      0.915 0.000 0.124 0.000 0.852 0.024
#> GSM509752     2  0.1410      0.923 0.000 0.940 0.000 0.060 0.000
#> GSM509754     2  0.0609      0.943 0.000 0.980 0.000 0.020 0.000
#> GSM509756     2  0.0404      0.940 0.000 0.988 0.000 0.012 0.000
#> GSM509758     2  0.0963      0.937 0.000 0.964 0.000 0.036 0.000
#> GSM509760     2  0.0404      0.940 0.000 0.988 0.000 0.012 0.000
#> GSM509762     2  0.0404      0.940 0.000 0.988 0.000 0.012 0.000
#> GSM509764     2  0.2966      0.784 0.000 0.816 0.000 0.184 0.000
#> GSM509766     2  0.2020      0.896 0.000 0.900 0.000 0.100 0.000
#> GSM509768     2  0.1671      0.913 0.000 0.924 0.000 0.076 0.000
#> GSM509770     2  0.0404      0.940 0.000 0.988 0.000 0.012 0.000
#> GSM509772     2  0.0404      0.940 0.000 0.988 0.000 0.012 0.000
#> GSM509774     4  0.3048      0.901 0.000 0.176 0.000 0.820 0.004
#> GSM509776     2  0.1270      0.931 0.000 0.948 0.000 0.052 0.000
#> GSM509778     4  0.2612      0.916 0.000 0.124 0.000 0.868 0.008
#> GSM509780     2  0.0609      0.943 0.000 0.980 0.000 0.020 0.000
#> GSM509782     4  0.4768      0.768 0.000 0.096 0.000 0.724 0.180
#> GSM509784     4  0.2848      0.914 0.000 0.156 0.000 0.840 0.004
#> GSM509786     4  0.3002      0.912 0.000 0.116 0.000 0.856 0.028

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM509706     1  0.0000     0.9442 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     5  0.3967     0.7943 0.148 0.000 0.000 0.000 0.760 0.092
#> GSM509714     5  0.2482     0.8325 0.148 0.000 0.000 0.000 0.848 0.004
#> GSM509719     1  0.0632     0.9509 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM509724     1  0.1714     0.9005 0.908 0.000 0.000 0.000 0.000 0.092
#> GSM509729     1  0.0632     0.9509 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM509707     1  0.0000     0.9442 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     5  0.4705     0.7067 0.260 0.000 0.000 0.000 0.652 0.088
#> GSM509715     5  0.1152     0.8435 0.044 0.000 0.000 0.000 0.952 0.004
#> GSM509720     1  0.0632     0.9509 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM509725     1  0.2060     0.9056 0.900 0.000 0.000 0.000 0.016 0.084
#> GSM509730     1  0.0632     0.9509 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM509708     1  0.0000     0.9442 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     5  0.5307     0.4514 0.380 0.000 0.000 0.000 0.512 0.108
#> GSM509716     5  0.1152     0.8435 0.044 0.000 0.000 0.000 0.952 0.004
#> GSM509721     1  0.0632     0.9509 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM509726     1  0.3269     0.7794 0.792 0.000 0.000 0.000 0.024 0.184
#> GSM509731     5  0.1908     0.8469 0.096 0.000 0.000 0.000 0.900 0.004
#> GSM509709     1  0.0000     0.9442 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.1152     0.8435 0.044 0.000 0.000 0.000 0.952 0.004
#> GSM509722     1  0.0632     0.9509 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM509727     6  0.1749     0.8026 0.036 0.000 0.008 0.000 0.024 0.932
#> GSM509710     1  0.1327     0.9201 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM509718     5  0.1152     0.8435 0.044 0.000 0.000 0.000 0.952 0.004
#> GSM509723     1  0.0632     0.9509 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM509728     6  0.2333     0.8200 0.000 0.000 0.092 0.000 0.024 0.884
#> GSM509732     3  0.1007     0.8459 0.000 0.000 0.956 0.000 0.000 0.044
#> GSM509736     6  0.3789     0.6861 0.000 0.000 0.260 0.000 0.024 0.716
#> GSM509741     3  0.0713     0.8372 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM509746     3  0.1007     0.8459 0.000 0.000 0.956 0.000 0.000 0.044
#> GSM509733     3  0.1007     0.8459 0.000 0.000 0.956 0.000 0.000 0.044
#> GSM509737     6  0.3719     0.6978 0.000 0.000 0.248 0.000 0.024 0.728
#> GSM509742     3  0.0713     0.8372 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM509747     3  0.3531     0.4961 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM509734     6  0.3668     0.5774 0.000 0.000 0.328 0.000 0.004 0.668
#> GSM509738     6  0.1261     0.8237 0.000 0.000 0.024 0.000 0.024 0.952
#> GSM509743     3  0.0713     0.8372 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM509748     3  0.3620     0.4474 0.000 0.000 0.648 0.000 0.000 0.352
#> GSM509735     1  0.2432     0.8882 0.876 0.000 0.000 0.000 0.024 0.100
#> GSM509739     1  0.0146     0.9459 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509744     3  0.2121     0.7903 0.000 0.000 0.892 0.000 0.012 0.096
#> GSM509749     3  0.2697     0.7434 0.000 0.000 0.812 0.000 0.000 0.188
#> GSM509740     6  0.1700     0.8113 0.028 0.000 0.012 0.000 0.024 0.936
#> GSM509745     6  0.1176     0.8217 0.000 0.000 0.020 0.000 0.024 0.956
#> GSM509750     6  0.2613     0.7772 0.000 0.000 0.140 0.000 0.012 0.848
#> GSM509751     2  0.0865     0.8139 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM509753     2  0.1003     0.7987 0.000 0.964 0.000 0.004 0.004 0.028
#> GSM509755     2  0.1642     0.7813 0.000 0.936 0.000 0.032 0.004 0.028
#> GSM509757     2  0.1408     0.7865 0.000 0.944 0.000 0.036 0.000 0.020
#> GSM509759     2  0.1788     0.7757 0.000 0.928 0.000 0.040 0.004 0.028
#> GSM509761     2  0.2454     0.7563 0.000 0.840 0.000 0.160 0.000 0.000
#> GSM509763     2  0.3695     0.4416 0.000 0.624 0.000 0.376 0.000 0.000
#> GSM509765     4  0.3838    -0.0191 0.000 0.448 0.000 0.552 0.000 0.000
#> GSM509767     2  0.0713     0.8133 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM509769     2  0.1267     0.8064 0.000 0.940 0.000 0.060 0.000 0.000
#> GSM509771     2  0.0000     0.8090 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509773     2  0.3428     0.5730 0.000 0.696 0.000 0.304 0.000 0.000
#> GSM509775     2  0.2664     0.7533 0.000 0.816 0.000 0.184 0.000 0.000
#> GSM509777     4  0.3727     0.6251 0.000 0.388 0.000 0.612 0.000 0.000
#> GSM509779     4  0.3330     0.8019 0.000 0.284 0.000 0.716 0.000 0.000
#> GSM509781     4  0.4497     0.8284 0.000 0.260 0.000 0.676 0.060 0.004
#> GSM509783     4  0.4653     0.8235 0.000 0.260 0.000 0.664 0.072 0.004
#> GSM509785     4  0.4454     0.8272 0.000 0.252 0.000 0.684 0.060 0.004
#> GSM509752     2  0.2378     0.7589 0.000 0.848 0.000 0.152 0.000 0.000
#> GSM509754     2  0.1556     0.8015 0.000 0.920 0.000 0.080 0.000 0.000
#> GSM509756     2  0.1387     0.8010 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM509758     2  0.3198     0.6901 0.000 0.740 0.000 0.260 0.000 0.000
#> GSM509760     2  0.1387     0.8017 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM509762     2  0.0146     0.8097 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509764     2  0.3967     0.4548 0.012 0.632 0.000 0.356 0.000 0.000
#> GSM509766     2  0.3634     0.5539 0.000 0.644 0.000 0.356 0.000 0.000
#> GSM509768     2  0.3023     0.6825 0.000 0.768 0.000 0.232 0.000 0.000
#> GSM509770     2  0.0622     0.8100 0.000 0.980 0.000 0.012 0.000 0.008
#> GSM509772     2  0.2113     0.7586 0.000 0.908 0.000 0.060 0.004 0.028
#> GSM509774     4  0.3309     0.7579 0.000 0.280 0.000 0.720 0.000 0.000
#> GSM509776     2  0.3371     0.6435 0.000 0.708 0.000 0.292 0.000 0.000
#> GSM509778     4  0.4497     0.8284 0.000 0.260 0.000 0.676 0.060 0.004
#> GSM509780     2  0.2219     0.7787 0.000 0.864 0.000 0.136 0.000 0.000
#> GSM509782     4  0.3767     0.6367 0.000 0.080 0.000 0.788 0.128 0.004
#> GSM509784     4  0.3371     0.8016 0.000 0.292 0.000 0.708 0.000 0.000
#> GSM509786     4  0.4497     0.8284 0.000 0.260 0.000 0.676 0.060 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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)  time(p) k
#> SD:mclust 81         2.58e-18 2.22e-15 2
#> SD:mclust 64         2.57e-22 2.07e-09 3
#> SD:mclust 79         4.89e-26 5.11e-10 4
#> SD:mclust 80         4.92e-25 2.60e-08 5
#> SD:mclust 75         4.06e-22 4.91e-08 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 19175 rows and 81 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5067 0.494   0.494
#> 3 3 0.830           0.860       0.939         0.2887 0.797   0.609
#> 4 4 0.907           0.876       0.941         0.1331 0.771   0.447
#> 5 5 0.809           0.788       0.884         0.0598 0.921   0.714
#> 6 6 0.857           0.830       0.909         0.0357 0.959   0.815

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
#> GSM509706     1  0.0000      1.000 1.000 0.000
#> GSM509711     1  0.0000      1.000 1.000 0.000
#> GSM509714     1  0.0376      0.996 0.996 0.004
#> GSM509719     1  0.0000      1.000 1.000 0.000
#> GSM509724     1  0.0000      1.000 1.000 0.000
#> GSM509729     1  0.0000      1.000 1.000 0.000
#> GSM509707     1  0.0000      1.000 1.000 0.000
#> GSM509712     1  0.0000      1.000 1.000 0.000
#> GSM509715     2  0.0000      1.000 0.000 1.000
#> GSM509720     1  0.0000      1.000 1.000 0.000
#> GSM509725     1  0.0000      1.000 1.000 0.000
#> GSM509730     1  0.0000      1.000 1.000 0.000
#> GSM509708     1  0.0000      1.000 1.000 0.000
#> GSM509713     1  0.0000      1.000 1.000 0.000
#> GSM509716     2  0.0000      1.000 0.000 1.000
#> GSM509721     1  0.0000      1.000 1.000 0.000
#> GSM509726     1  0.0000      1.000 1.000 0.000
#> GSM509731     2  0.0000      1.000 0.000 1.000
#> GSM509709     1  0.0000      1.000 1.000 0.000
#> GSM509717     2  0.0000      1.000 0.000 1.000
#> GSM509722     1  0.0000      1.000 1.000 0.000
#> GSM509727     1  0.0000      1.000 1.000 0.000
#> GSM509710     1  0.0000      1.000 1.000 0.000
#> GSM509718     2  0.0000      1.000 0.000 1.000
#> GSM509723     1  0.0000      1.000 1.000 0.000
#> GSM509728     1  0.0000      1.000 1.000 0.000
#> GSM509732     1  0.0000      1.000 1.000 0.000
#> GSM509736     1  0.0000      1.000 1.000 0.000
#> GSM509741     1  0.0000      1.000 1.000 0.000
#> GSM509746     1  0.0000      1.000 1.000 0.000
#> GSM509733     1  0.0000      1.000 1.000 0.000
#> GSM509737     1  0.0000      1.000 1.000 0.000
#> GSM509742     1  0.0000      1.000 1.000 0.000
#> GSM509747     1  0.0000      1.000 1.000 0.000
#> GSM509734     1  0.0000      1.000 1.000 0.000
#> GSM509738     1  0.0000      1.000 1.000 0.000
#> GSM509743     1  0.0000      1.000 1.000 0.000
#> GSM509748     1  0.0000      1.000 1.000 0.000
#> GSM509735     1  0.0000      1.000 1.000 0.000
#> GSM509739     1  0.0000      1.000 1.000 0.000
#> GSM509744     1  0.0000      1.000 1.000 0.000
#> GSM509749     1  0.0000      1.000 1.000 0.000
#> GSM509740     1  0.0000      1.000 1.000 0.000
#> GSM509745     1  0.0000      1.000 1.000 0.000
#> GSM509750     1  0.0000      1.000 1.000 0.000
#> GSM509751     2  0.0000      1.000 0.000 1.000
#> GSM509753     2  0.0000      1.000 0.000 1.000
#> GSM509755     2  0.0000      1.000 0.000 1.000
#> GSM509757     2  0.0000      1.000 0.000 1.000
#> GSM509759     2  0.0000      1.000 0.000 1.000
#> GSM509761     2  0.0000      1.000 0.000 1.000
#> GSM509763     2  0.0000      1.000 0.000 1.000
#> GSM509765     2  0.0000      1.000 0.000 1.000
#> GSM509767     2  0.0000      1.000 0.000 1.000
#> GSM509769     2  0.0000      1.000 0.000 1.000
#> GSM509771     2  0.0000      1.000 0.000 1.000
#> GSM509773     2  0.0000      1.000 0.000 1.000
#> GSM509775     2  0.0000      1.000 0.000 1.000
#> GSM509777     2  0.0000      1.000 0.000 1.000
#> GSM509779     2  0.0000      1.000 0.000 1.000
#> GSM509781     2  0.0000      1.000 0.000 1.000
#> GSM509783     2  0.0000      1.000 0.000 1.000
#> GSM509785     2  0.0000      1.000 0.000 1.000
#> GSM509752     2  0.0000      1.000 0.000 1.000
#> GSM509754     2  0.0000      1.000 0.000 1.000
#> GSM509756     2  0.0000      1.000 0.000 1.000
#> GSM509758     2  0.0000      1.000 0.000 1.000
#> GSM509760     2  0.0000      1.000 0.000 1.000
#> GSM509762     2  0.0000      1.000 0.000 1.000
#> GSM509764     2  0.0000      1.000 0.000 1.000
#> GSM509766     2  0.0000      1.000 0.000 1.000
#> GSM509768     2  0.0000      1.000 0.000 1.000
#> GSM509770     2  0.0000      1.000 0.000 1.000
#> GSM509772     2  0.0000      1.000 0.000 1.000
#> GSM509774     2  0.0000      1.000 0.000 1.000
#> GSM509776     2  0.0000      1.000 0.000 1.000
#> GSM509778     2  0.0000      1.000 0.000 1.000
#> GSM509780     2  0.0000      1.000 0.000 1.000
#> GSM509782     2  0.0000      1.000 0.000 1.000
#> GSM509784     2  0.0000      1.000 0.000 1.000
#> GSM509786     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
#> GSM509706     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509711     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509714     1  0.1031     0.9541 0.976 0.024 0.000
#> GSM509719     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509724     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509729     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509707     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509712     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509715     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509720     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509725     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509730     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509708     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509713     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509716     2  0.1031     0.9182 0.024 0.976 0.000
#> GSM509721     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509726     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509731     2  0.5098     0.6244 0.248 0.752 0.000
#> GSM509709     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509717     2  0.0237     0.9344 0.004 0.996 0.000
#> GSM509722     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509727     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509710     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509718     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509723     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509728     1  0.0237     0.9775 0.996 0.000 0.004
#> GSM509732     3  0.0000     0.8411 0.000 0.000 1.000
#> GSM509736     3  0.6309     0.0214 0.496 0.000 0.504
#> GSM509741     3  0.1753     0.8264 0.048 0.000 0.952
#> GSM509746     3  0.0000     0.8411 0.000 0.000 1.000
#> GSM509733     3  0.0000     0.8411 0.000 0.000 1.000
#> GSM509737     1  0.1411     0.9453 0.964 0.000 0.036
#> GSM509742     3  0.0592     0.8412 0.012 0.000 0.988
#> GSM509747     3  0.0424     0.8416 0.008 0.000 0.992
#> GSM509734     1  0.6140     0.2781 0.596 0.000 0.404
#> GSM509738     1  0.0424     0.9741 0.992 0.000 0.008
#> GSM509743     3  0.0237     0.8416 0.004 0.000 0.996
#> GSM509748     3  0.2356     0.8127 0.072 0.000 0.928
#> GSM509735     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509739     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509744     3  0.5733     0.4826 0.324 0.000 0.676
#> GSM509749     3  0.2625     0.8042 0.084 0.000 0.916
#> GSM509740     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509745     1  0.0000     0.9807 1.000 0.000 0.000
#> GSM509750     3  0.3267     0.7762 0.116 0.000 0.884
#> GSM509751     3  0.6168     0.2568 0.000 0.412 0.588
#> GSM509753     3  0.2165     0.8066 0.000 0.064 0.936
#> GSM509755     3  0.4504     0.6785 0.000 0.196 0.804
#> GSM509757     3  0.5785     0.4602 0.000 0.332 0.668
#> GSM509759     3  0.0000     0.8411 0.000 0.000 1.000
#> GSM509761     2  0.0237     0.9361 0.000 0.996 0.004
#> GSM509763     2  0.0237     0.9361 0.000 0.996 0.004
#> GSM509765     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509767     2  0.5905     0.4888 0.000 0.648 0.352
#> GSM509769     2  0.2959     0.8771 0.000 0.900 0.100
#> GSM509771     2  0.5785     0.5328 0.000 0.668 0.332
#> GSM509773     2  0.2356     0.8985 0.000 0.928 0.072
#> GSM509775     2  0.0237     0.9361 0.000 0.996 0.004
#> GSM509777     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509779     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509781     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509783     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509785     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509752     2  0.3879     0.8263 0.000 0.848 0.152
#> GSM509754     2  0.4346     0.7892 0.000 0.816 0.184
#> GSM509756     2  0.1643     0.9166 0.000 0.956 0.044
#> GSM509758     2  0.1411     0.9212 0.000 0.964 0.036
#> GSM509760     2  0.0747     0.9312 0.000 0.984 0.016
#> GSM509762     2  0.3038     0.8731 0.000 0.896 0.104
#> GSM509764     3  0.6126     0.2970 0.000 0.400 0.600
#> GSM509766     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509768     2  0.0237     0.9361 0.000 0.996 0.004
#> GSM509770     2  0.4452     0.7818 0.000 0.808 0.192
#> GSM509772     3  0.0000     0.8411 0.000 0.000 1.000
#> GSM509774     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509776     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509778     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509780     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509782     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509784     2  0.0000     0.9369 0.000 1.000 0.000
#> GSM509786     2  0.0000     0.9369 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
#> GSM509706     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509711     1  0.0336      0.990 0.992 0.000 0.000 0.008
#> GSM509714     1  0.1637      0.943 0.940 0.000 0.000 0.060
#> GSM509719     1  0.0188      0.992 0.996 0.000 0.004 0.000
#> GSM509724     1  0.0188      0.992 0.996 0.000 0.004 0.000
#> GSM509729     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509707     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509712     1  0.0524      0.988 0.988 0.000 0.004 0.008
#> GSM509715     4  0.0000      0.835 0.000 0.000 0.000 1.000
#> GSM509720     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509725     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509730     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509708     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509713     1  0.0188      0.992 0.996 0.000 0.004 0.000
#> GSM509716     4  0.0188      0.837 0.000 0.004 0.000 0.996
#> GSM509721     1  0.0188      0.992 0.996 0.000 0.004 0.000
#> GSM509726     1  0.0469      0.987 0.988 0.000 0.012 0.000
#> GSM509731     4  0.0469      0.841 0.000 0.012 0.000 0.988
#> GSM509709     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509717     4  0.0188      0.837 0.000 0.004 0.000 0.996
#> GSM509722     1  0.0188      0.992 0.996 0.000 0.004 0.000
#> GSM509727     3  0.5987      0.198 0.440 0.000 0.520 0.040
#> GSM509710     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509718     4  0.0188      0.832 0.000 0.000 0.004 0.996
#> GSM509723     1  0.0188      0.992 0.996 0.000 0.004 0.000
#> GSM509728     3  0.2623      0.891 0.064 0.000 0.908 0.028
#> GSM509732     3  0.0921      0.933 0.000 0.028 0.972 0.000
#> GSM509736     3  0.0657      0.941 0.004 0.000 0.984 0.012
#> GSM509741     3  0.0188      0.943 0.000 0.004 0.996 0.000
#> GSM509746     3  0.0817      0.935 0.000 0.024 0.976 0.000
#> GSM509733     3  0.0592      0.939 0.000 0.016 0.984 0.000
#> GSM509737     3  0.0927      0.940 0.008 0.000 0.976 0.016
#> GSM509742     3  0.0188      0.943 0.000 0.004 0.996 0.000
#> GSM509747     3  0.1022      0.930 0.000 0.032 0.968 0.000
#> GSM509734     3  0.0592      0.940 0.016 0.000 0.984 0.000
#> GSM509738     3  0.1807      0.922 0.008 0.000 0.940 0.052
#> GSM509743     3  0.0376      0.943 0.000 0.004 0.992 0.004
#> GSM509748     3  0.0469      0.941 0.000 0.012 0.988 0.000
#> GSM509735     1  0.0469      0.987 0.988 0.000 0.012 0.000
#> GSM509739     1  0.0000      0.994 1.000 0.000 0.000 0.000
#> GSM509744     3  0.1004      0.938 0.004 0.000 0.972 0.024
#> GSM509749     3  0.0188      0.943 0.000 0.004 0.996 0.000
#> GSM509740     4  0.5604     -0.152 0.020 0.000 0.476 0.504
#> GSM509745     3  0.2480      0.896 0.008 0.000 0.904 0.088
#> GSM509750     3  0.0779      0.941 0.004 0.000 0.980 0.016
#> GSM509751     2  0.0469      0.920 0.000 0.988 0.012 0.000
#> GSM509753     2  0.0817      0.913 0.000 0.976 0.024 0.000
#> GSM509755     2  0.0592      0.920 0.000 0.984 0.016 0.000
#> GSM509757     2  0.0336      0.922 0.000 0.992 0.008 0.000
#> GSM509759     2  0.1867      0.870 0.000 0.928 0.072 0.000
#> GSM509761     2  0.1743      0.907 0.000 0.940 0.004 0.056
#> GSM509763     2  0.2530      0.869 0.000 0.888 0.000 0.112
#> GSM509765     2  0.3024      0.831 0.000 0.852 0.000 0.148
#> GSM509767     2  0.0188      0.923 0.000 0.996 0.004 0.000
#> GSM509769     2  0.0469      0.925 0.000 0.988 0.000 0.012
#> GSM509771     2  0.0188      0.923 0.000 0.996 0.004 0.000
#> GSM509773     2  0.0469      0.925 0.000 0.988 0.000 0.012
#> GSM509775     2  0.1211      0.915 0.000 0.960 0.000 0.040
#> GSM509777     2  0.4624      0.492 0.000 0.660 0.000 0.340
#> GSM509779     4  0.4746      0.422 0.000 0.368 0.000 0.632
#> GSM509781     4  0.2281      0.846 0.000 0.096 0.000 0.904
#> GSM509783     4  0.1940      0.852 0.000 0.076 0.000 0.924
#> GSM509785     4  0.1867      0.853 0.000 0.072 0.000 0.928
#> GSM509752     2  0.0188      0.925 0.000 0.996 0.000 0.004
#> GSM509754     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0524      0.925 0.000 0.988 0.004 0.008
#> GSM509758     2  0.0469      0.925 0.000 0.988 0.000 0.012
#> GSM509760     2  0.0657      0.924 0.000 0.984 0.004 0.012
#> GSM509762     2  0.0336      0.925 0.000 0.992 0.000 0.008
#> GSM509764     2  0.0707      0.916 0.000 0.980 0.020 0.000
#> GSM509766     2  0.2345      0.879 0.000 0.900 0.000 0.100
#> GSM509768     2  0.1940      0.895 0.000 0.924 0.000 0.076
#> GSM509770     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM509772     2  0.1118      0.903 0.000 0.964 0.036 0.000
#> GSM509774     2  0.4877      0.302 0.000 0.592 0.000 0.408
#> GSM509776     2  0.2408      0.876 0.000 0.896 0.000 0.104
#> GSM509778     4  0.2281      0.846 0.000 0.096 0.000 0.904
#> GSM509780     2  0.3024      0.831 0.000 0.852 0.000 0.148
#> GSM509782     4  0.2149      0.849 0.000 0.088 0.000 0.912
#> GSM509784     4  0.4916      0.263 0.000 0.424 0.000 0.576
#> GSM509786     4  0.2345      0.843 0.000 0.100 0.000 0.900

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000     0.8580 1.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.0162     0.8576 0.996 0.000 0.000 0.000 0.004
#> GSM509714     1  0.5954     0.4962 0.576 0.000 0.000 0.152 0.272
#> GSM509719     1  0.4731     0.6606 0.640 0.032 0.000 0.000 0.328
#> GSM509724     1  0.0000     0.8580 1.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.1697     0.8376 0.932 0.000 0.008 0.000 0.060
#> GSM509707     1  0.0000     0.8580 1.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.0000     0.8580 1.000 0.000 0.000 0.000 0.000
#> GSM509715     5  0.3816     0.6917 0.000 0.000 0.000 0.304 0.696
#> GSM509720     1  0.4310     0.6093 0.604 0.004 0.000 0.000 0.392
#> GSM509725     1  0.0000     0.8580 1.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.3988     0.7624 0.768 0.000 0.036 0.000 0.196
#> GSM509708     1  0.0000     0.8580 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0000     0.8580 1.000 0.000 0.000 0.000 0.000
#> GSM509716     5  0.3816     0.6852 0.000 0.000 0.000 0.304 0.696
#> GSM509721     1  0.5658     0.5847 0.572 0.096 0.000 0.000 0.332
#> GSM509726     1  0.0162     0.8576 0.996 0.000 0.000 0.000 0.004
#> GSM509731     4  0.1478     0.7563 0.000 0.000 0.000 0.936 0.064
#> GSM509709     1  0.0000     0.8580 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.4375     0.5391 0.000 0.000 0.004 0.420 0.576
#> GSM509722     1  0.4135     0.6690 0.656 0.004 0.000 0.000 0.340
#> GSM509727     1  0.5968    -0.1329 0.452 0.000 0.108 0.000 0.440
#> GSM509710     1  0.0162     0.8576 0.996 0.000 0.000 0.000 0.004
#> GSM509718     5  0.3885     0.7161 0.000 0.000 0.008 0.268 0.724
#> GSM509723     1  0.3910     0.7245 0.720 0.008 0.000 0.000 0.272
#> GSM509728     3  0.4378     0.6070 0.036 0.000 0.716 0.000 0.248
#> GSM509732     3  0.0865     0.9264 0.000 0.004 0.972 0.000 0.024
#> GSM509736     5  0.2966     0.7038 0.000 0.000 0.184 0.000 0.816
#> GSM509741     3  0.0510     0.9315 0.000 0.000 0.984 0.000 0.016
#> GSM509746     3  0.0671     0.9297 0.000 0.004 0.980 0.000 0.016
#> GSM509733     3  0.0566     0.9313 0.000 0.004 0.984 0.000 0.012
#> GSM509737     5  0.2929     0.7043 0.000 0.000 0.180 0.000 0.820
#> GSM509742     3  0.0404     0.9325 0.000 0.000 0.988 0.000 0.012
#> GSM509747     3  0.0865     0.9264 0.000 0.004 0.972 0.000 0.024
#> GSM509734     3  0.0290     0.9323 0.008 0.000 0.992 0.000 0.000
#> GSM509738     5  0.2648     0.7200 0.000 0.000 0.152 0.000 0.848
#> GSM509743     3  0.1671     0.8956 0.000 0.000 0.924 0.000 0.076
#> GSM509748     3  0.0566     0.9318 0.000 0.004 0.984 0.000 0.012
#> GSM509735     1  0.0451     0.8528 0.988 0.000 0.008 0.000 0.004
#> GSM509739     1  0.0162     0.8576 0.996 0.000 0.000 0.000 0.004
#> GSM509744     3  0.2471     0.8313 0.000 0.000 0.864 0.000 0.136
#> GSM509749     3  0.0510     0.9333 0.000 0.000 0.984 0.000 0.016
#> GSM509740     5  0.3002     0.7431 0.008 0.000 0.048 0.068 0.876
#> GSM509745     5  0.4561     0.0765 0.000 0.000 0.488 0.008 0.504
#> GSM509750     3  0.1341     0.9108 0.000 0.000 0.944 0.000 0.056
#> GSM509751     2  0.0000     0.9118 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000     0.9118 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0162     0.9100 0.000 0.996 0.000 0.000 0.004
#> GSM509757     2  0.0000     0.9118 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0290     0.9078 0.000 0.992 0.000 0.000 0.008
#> GSM509761     2  0.1341     0.8964 0.000 0.944 0.000 0.056 0.000
#> GSM509763     2  0.4210     0.3142 0.000 0.588 0.000 0.412 0.000
#> GSM509765     2  0.3876     0.5716 0.000 0.684 0.000 0.316 0.000
#> GSM509767     2  0.1205     0.9026 0.000 0.956 0.004 0.040 0.000
#> GSM509769     2  0.0609     0.9105 0.000 0.980 0.000 0.020 0.000
#> GSM509771     2  0.1956     0.8824 0.000 0.916 0.008 0.076 0.000
#> GSM509773     2  0.1965     0.8714 0.000 0.904 0.000 0.096 0.000
#> GSM509775     2  0.2852     0.8029 0.000 0.828 0.000 0.172 0.000
#> GSM509777     4  0.3480     0.6967 0.000 0.248 0.000 0.752 0.000
#> GSM509779     4  0.2280     0.7999 0.000 0.120 0.000 0.880 0.000
#> GSM509781     4  0.0510     0.8228 0.000 0.016 0.000 0.984 0.000
#> GSM509783     4  0.0000     0.8060 0.000 0.000 0.000 1.000 0.000
#> GSM509785     4  0.0290     0.8167 0.000 0.008 0.000 0.992 0.000
#> GSM509752     2  0.0162     0.9124 0.000 0.996 0.000 0.004 0.000
#> GSM509754     2  0.0290     0.9126 0.000 0.992 0.000 0.008 0.000
#> GSM509756     2  0.0000     0.9118 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0404     0.9124 0.000 0.988 0.000 0.012 0.000
#> GSM509760     2  0.0404     0.9123 0.000 0.988 0.000 0.012 0.000
#> GSM509762     2  0.0000     0.9118 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000     0.9118 0.000 1.000 0.000 0.000 0.000
#> GSM509766     2  0.3508     0.6922 0.000 0.748 0.000 0.252 0.000
#> GSM509768     2  0.3039     0.7789 0.000 0.808 0.000 0.192 0.000
#> GSM509770     2  0.0290     0.9126 0.000 0.992 0.000 0.008 0.000
#> GSM509772     2  0.0162     0.9101 0.000 0.996 0.000 0.000 0.004
#> GSM509774     4  0.3424     0.7086 0.000 0.240 0.000 0.760 0.000
#> GSM509776     2  0.2605     0.8272 0.000 0.852 0.000 0.148 0.000
#> GSM509778     4  0.0703     0.8240 0.000 0.024 0.000 0.976 0.000
#> GSM509780     4  0.4299     0.3778 0.000 0.388 0.000 0.608 0.004
#> GSM509782     4  0.0404     0.8205 0.000 0.012 0.000 0.988 0.000
#> GSM509784     4  0.2424     0.7939 0.000 0.132 0.000 0.868 0.000
#> GSM509786     4  0.0510     0.8230 0.000 0.016 0.000 0.984 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
#> GSM509706     1  0.0146      0.971 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509711     1  0.0260      0.970 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509714     5  0.6014      0.352 0.028 0.000 0.000 0.144 0.528 0.300
#> GSM509719     5  0.1401      0.820 0.004 0.020 0.000 0.000 0.948 0.028
#> GSM509724     1  0.0000      0.970 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509729     5  0.4303      0.357 0.392 0.000 0.012 0.000 0.588 0.008
#> GSM509707     1  0.0146      0.971 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509712     1  0.0858      0.954 0.968 0.000 0.000 0.000 0.028 0.004
#> GSM509715     6  0.2301      0.752 0.000 0.000 0.000 0.096 0.020 0.884
#> GSM509720     5  0.1719      0.817 0.008 0.008 0.000 0.000 0.928 0.056
#> GSM509725     1  0.0000      0.970 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509730     5  0.3513      0.729 0.072 0.000 0.104 0.000 0.816 0.008
#> GSM509708     1  0.0260      0.969 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509713     1  0.0146      0.971 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509716     6  0.3472      0.699 0.000 0.000 0.000 0.100 0.092 0.808
#> GSM509721     5  0.1977      0.817 0.008 0.032 0.000 0.000 0.920 0.040
#> GSM509726     1  0.0260      0.966 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM509731     4  0.3925      0.532 0.000 0.000 0.000 0.724 0.236 0.040
#> GSM509709     1  0.0146      0.971 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509717     6  0.3709      0.651 0.000 0.000 0.000 0.204 0.040 0.756
#> GSM509722     5  0.1542      0.818 0.008 0.004 0.000 0.000 0.936 0.052
#> GSM509727     1  0.3368      0.658 0.756 0.000 0.012 0.000 0.000 0.232
#> GSM509710     1  0.0146      0.969 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM509718     6  0.1010      0.776 0.000 0.000 0.000 0.036 0.004 0.960
#> GSM509723     5  0.1353      0.821 0.012 0.012 0.000 0.000 0.952 0.024
#> GSM509728     6  0.6059      0.227 0.312 0.000 0.280 0.000 0.000 0.408
#> GSM509732     3  0.0146      0.924 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM509736     6  0.2905      0.756 0.008 0.000 0.088 0.004 0.036 0.864
#> GSM509741     3  0.0713      0.922 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM509746     3  0.0000      0.925 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0146      0.924 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM509737     6  0.3232      0.750 0.008 0.000 0.088 0.004 0.056 0.844
#> GSM509742     3  0.0632      0.923 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM509747     3  0.0790      0.909 0.000 0.000 0.968 0.000 0.032 0.000
#> GSM509734     3  0.0363      0.926 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM509738     6  0.1485      0.778 0.000 0.000 0.028 0.004 0.024 0.944
#> GSM509743     3  0.3250      0.747 0.000 0.000 0.788 0.004 0.012 0.196
#> GSM509748     3  0.0458      0.921 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM509735     1  0.0777      0.955 0.972 0.000 0.004 0.000 0.024 0.000
#> GSM509739     1  0.0146      0.971 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509744     3  0.3563      0.503 0.000 0.000 0.664 0.000 0.000 0.336
#> GSM509749     3  0.0260      0.926 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM509740     6  0.1080      0.773 0.004 0.000 0.004 0.000 0.032 0.960
#> GSM509745     6  0.3595      0.540 0.000 0.000 0.288 0.000 0.008 0.704
#> GSM509750     3  0.1556      0.888 0.000 0.000 0.920 0.000 0.000 0.080
#> GSM509751     2  0.0146      0.921 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM509753     2  0.0146      0.919 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509755     2  0.0146      0.920 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM509757     2  0.0000      0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509759     2  0.0922      0.911 0.000 0.968 0.000 0.004 0.024 0.004
#> GSM509761     2  0.0790      0.922 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM509763     2  0.3584      0.624 0.000 0.688 0.000 0.308 0.000 0.004
#> GSM509765     2  0.3309      0.681 0.000 0.720 0.000 0.280 0.000 0.000
#> GSM509767     2  0.1226      0.919 0.000 0.952 0.000 0.040 0.004 0.004
#> GSM509769     2  0.1194      0.920 0.000 0.956 0.000 0.032 0.008 0.004
#> GSM509771     2  0.1732      0.904 0.000 0.920 0.000 0.072 0.004 0.004
#> GSM509773     2  0.2051      0.888 0.000 0.896 0.000 0.096 0.004 0.004
#> GSM509775     2  0.2632      0.834 0.000 0.832 0.000 0.164 0.000 0.004
#> GSM509777     4  0.2631      0.744 0.000 0.180 0.000 0.820 0.000 0.000
#> GSM509779     4  0.0713      0.859 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM509781     4  0.0405      0.862 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM509783     4  0.0436      0.858 0.000 0.004 0.000 0.988 0.004 0.004
#> GSM509785     4  0.0436      0.858 0.000 0.004 0.000 0.988 0.004 0.004
#> GSM509752     2  0.0260      0.923 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509754     2  0.0363      0.923 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM509756     2  0.0000      0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0632      0.923 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM509760     2  0.1088      0.922 0.000 0.960 0.000 0.024 0.016 0.000
#> GSM509762     2  0.0146      0.922 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509764     2  0.0291      0.919 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM509766     2  0.2996      0.759 0.000 0.772 0.000 0.228 0.000 0.000
#> GSM509768     2  0.2838      0.808 0.000 0.808 0.000 0.188 0.000 0.004
#> GSM509770     2  0.0508      0.924 0.000 0.984 0.000 0.012 0.004 0.000
#> GSM509772     2  0.0665      0.921 0.000 0.980 0.000 0.008 0.008 0.004
#> GSM509774     4  0.3290      0.662 0.000 0.252 0.000 0.744 0.004 0.000
#> GSM509776     2  0.2416      0.843 0.000 0.844 0.000 0.156 0.000 0.000
#> GSM509778     4  0.0260      0.862 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM509780     4  0.3531      0.500 0.000 0.328 0.000 0.672 0.000 0.000
#> GSM509782     4  0.0363      0.862 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM509784     4  0.0865      0.855 0.000 0.036 0.000 0.964 0.000 0.000
#> GSM509786     4  0.0405      0.862 0.000 0.008 0.000 0.988 0.004 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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)  time(p) k
#> SD:NMF 81         8.31e-15 6.68e-12 2
#> SD:NMF 74         1.13e-14 2.50e-06 3
#> SD:NMF 75         1.29e-22 1.20e-07 4
#> SD:NMF 76         1.35e-20 2.64e-07 5
#> SD:NMF 78         2.64e-21 4.13e-07 6

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


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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.547           0.863       0.927         0.4845 0.494   0.494
#> 3 3 0.447           0.778       0.840         0.2546 0.883   0.763
#> 4 4 0.600           0.656       0.787         0.1680 0.841   0.591
#> 5 5 0.686           0.630       0.819         0.0753 0.909   0.671
#> 6 6 0.766           0.701       0.834         0.0339 0.963   0.836

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1  0.0000      0.901 1.000 0.000
#> GSM509711     1  0.8386      0.647 0.732 0.268
#> GSM509714     2  0.7950      0.635 0.240 0.760
#> GSM509719     1  0.9129      0.551 0.672 0.328
#> GSM509724     1  0.0000      0.901 1.000 0.000
#> GSM509729     1  0.9795      0.324 0.584 0.416
#> GSM509707     1  0.0000      0.901 1.000 0.000
#> GSM509712     1  0.8386      0.647 0.732 0.268
#> GSM509715     2  0.1843      0.924 0.028 0.972
#> GSM509720     1  0.9129      0.551 0.672 0.328
#> GSM509725     1  0.0000      0.901 1.000 0.000
#> GSM509730     1  0.9795      0.324 0.584 0.416
#> GSM509708     1  0.0000      0.901 1.000 0.000
#> GSM509713     1  0.8386      0.647 0.732 0.268
#> GSM509716     2  0.2043      0.922 0.032 0.968
#> GSM509721     1  0.9129      0.551 0.672 0.328
#> GSM509726     1  0.0000      0.901 1.000 0.000
#> GSM509731     2  0.0672      0.927 0.008 0.992
#> GSM509709     1  0.0000      0.901 1.000 0.000
#> GSM509717     2  0.2236      0.920 0.036 0.964
#> GSM509722     1  0.9129      0.551 0.672 0.328
#> GSM509727     1  0.0000      0.901 1.000 0.000
#> GSM509710     1  0.0000      0.901 1.000 0.000
#> GSM509718     2  0.1633      0.933 0.024 0.976
#> GSM509723     1  0.9129      0.551 0.672 0.328
#> GSM509728     1  0.0000      0.901 1.000 0.000
#> GSM509732     1  0.0000      0.901 1.000 0.000
#> GSM509736     1  0.0000      0.901 1.000 0.000
#> GSM509741     1  0.0000      0.901 1.000 0.000
#> GSM509746     1  0.0000      0.901 1.000 0.000
#> GSM509733     1  0.0000      0.901 1.000 0.000
#> GSM509737     1  0.0000      0.901 1.000 0.000
#> GSM509742     1  0.0000      0.901 1.000 0.000
#> GSM509747     1  0.0000      0.901 1.000 0.000
#> GSM509734     1  0.0000      0.901 1.000 0.000
#> GSM509738     1  0.0376      0.899 0.996 0.004
#> GSM509743     1  0.0000      0.901 1.000 0.000
#> GSM509748     1  0.0000      0.901 1.000 0.000
#> GSM509735     1  0.0000      0.901 1.000 0.000
#> GSM509739     1  0.0000      0.901 1.000 0.000
#> GSM509744     1  0.0000      0.901 1.000 0.000
#> GSM509749     1  0.0000      0.901 1.000 0.000
#> GSM509740     1  0.1843      0.885 0.972 0.028
#> GSM509745     1  0.0938      0.895 0.988 0.012
#> GSM509750     1  0.0376      0.899 0.996 0.004
#> GSM509751     2  0.5408      0.908 0.124 0.876
#> GSM509753     2  0.5408      0.908 0.124 0.876
#> GSM509755     2  0.5408      0.908 0.124 0.876
#> GSM509757     2  0.5408      0.908 0.124 0.876
#> GSM509759     2  0.5408      0.908 0.124 0.876
#> GSM509761     2  0.5178      0.913 0.116 0.884
#> GSM509763     2  0.0938      0.931 0.012 0.988
#> GSM509765     2  0.0672      0.930 0.008 0.992
#> GSM509767     2  0.4022      0.926 0.080 0.920
#> GSM509769     2  0.2948      0.933 0.052 0.948
#> GSM509771     2  0.4298      0.924 0.088 0.912
#> GSM509773     2  0.2778      0.933 0.048 0.952
#> GSM509775     2  0.2948      0.932 0.052 0.948
#> GSM509777     2  0.0672      0.930 0.008 0.992
#> GSM509779     2  0.0000      0.926 0.000 1.000
#> GSM509781     2  0.0000      0.926 0.000 1.000
#> GSM509783     2  0.0000      0.926 0.000 1.000
#> GSM509785     2  0.0000      0.926 0.000 1.000
#> GSM509752     2  0.5408      0.908 0.124 0.876
#> GSM509754     2  0.5178      0.913 0.116 0.884
#> GSM509756     2  0.5408      0.908 0.124 0.876
#> GSM509758     2  0.4939      0.917 0.108 0.892
#> GSM509760     2  0.5294      0.911 0.120 0.880
#> GSM509762     2  0.5178      0.913 0.116 0.884
#> GSM509764     2  0.5408      0.908 0.124 0.876
#> GSM509766     2  0.1633      0.933 0.024 0.976
#> GSM509768     2  0.1414      0.933 0.020 0.980
#> GSM509770     2  0.5294      0.911 0.120 0.880
#> GSM509772     2  0.5408      0.908 0.124 0.876
#> GSM509774     2  0.0376      0.928 0.004 0.996
#> GSM509776     2  0.1633      0.934 0.024 0.976
#> GSM509778     2  0.0000      0.926 0.000 1.000
#> GSM509780     2  0.0672      0.930 0.008 0.992
#> GSM509782     2  0.0000      0.926 0.000 1.000
#> GSM509784     2  0.0672      0.930 0.008 0.992
#> GSM509786     2  0.0000      0.926 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
#> GSM509706     1  0.5291      0.610 0.732 0.000 0.268
#> GSM509711     1  0.4195      0.612 0.852 0.136 0.012
#> GSM509714     2  0.6026      0.349 0.376 0.624 0.000
#> GSM509719     1  0.8940      0.573 0.568 0.232 0.200
#> GSM509724     1  0.5397      0.601 0.720 0.000 0.280
#> GSM509729     1  0.9713      0.437 0.444 0.316 0.240
#> GSM509707     1  0.5291      0.610 0.732 0.000 0.268
#> GSM509712     1  0.4195      0.612 0.852 0.136 0.012
#> GSM509715     2  0.3619      0.810 0.136 0.864 0.000
#> GSM509720     1  0.8940      0.573 0.568 0.232 0.200
#> GSM509725     1  0.6260      0.316 0.552 0.000 0.448
#> GSM509730     1  0.9713      0.437 0.444 0.316 0.240
#> GSM509708     1  0.5291      0.610 0.732 0.000 0.268
#> GSM509713     1  0.4195      0.612 0.852 0.136 0.012
#> GSM509716     2  0.3816      0.799 0.148 0.852 0.000
#> GSM509721     1  0.8940      0.573 0.568 0.232 0.200
#> GSM509726     1  0.6305      0.208 0.516 0.000 0.484
#> GSM509731     2  0.4842      0.759 0.224 0.776 0.000
#> GSM509709     1  0.5291      0.610 0.732 0.000 0.268
#> GSM509717     2  0.4178      0.773 0.172 0.828 0.000
#> GSM509722     1  0.8940      0.573 0.568 0.232 0.200
#> GSM509727     3  0.3941      0.806 0.156 0.000 0.844
#> GSM509710     1  0.5291      0.610 0.732 0.000 0.268
#> GSM509718     2  0.2383      0.869 0.044 0.940 0.016
#> GSM509723     1  0.8940      0.573 0.568 0.232 0.200
#> GSM509728     3  0.3941      0.806 0.156 0.000 0.844
#> GSM509732     3  0.0000      0.928 0.000 0.000 1.000
#> GSM509736     3  0.0829      0.925 0.012 0.004 0.984
#> GSM509741     3  0.0000      0.928 0.000 0.000 1.000
#> GSM509746     3  0.0000      0.928 0.000 0.000 1.000
#> GSM509733     3  0.0000      0.928 0.000 0.000 1.000
#> GSM509737     3  0.0829      0.925 0.012 0.004 0.984
#> GSM509742     3  0.0000      0.928 0.000 0.000 1.000
#> GSM509747     3  0.0000      0.928 0.000 0.000 1.000
#> GSM509734     3  0.0000      0.928 0.000 0.000 1.000
#> GSM509738     3  0.3607      0.859 0.112 0.008 0.880
#> GSM509743     3  0.0237      0.925 0.000 0.004 0.996
#> GSM509748     3  0.0892      0.924 0.020 0.000 0.980
#> GSM509735     1  0.6111      0.463 0.604 0.000 0.396
#> GSM509739     1  0.5397      0.601 0.720 0.000 0.280
#> GSM509744     3  0.0983      0.926 0.016 0.004 0.980
#> GSM509749     3  0.0892      0.924 0.020 0.000 0.980
#> GSM509740     3  0.4799      0.810 0.132 0.032 0.836
#> GSM509745     3  0.4059      0.834 0.128 0.012 0.860
#> GSM509750     3  0.3573      0.850 0.120 0.004 0.876
#> GSM509751     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509753     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509755     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509757     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509759     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509761     2  0.4121      0.862 0.024 0.868 0.108
#> GSM509763     2  0.2229      0.869 0.044 0.944 0.012
#> GSM509765     2  0.2280      0.863 0.052 0.940 0.008
#> GSM509767     2  0.2939      0.873 0.012 0.916 0.072
#> GSM509769     2  0.2063      0.877 0.008 0.948 0.044
#> GSM509771     2  0.2955      0.872 0.008 0.912 0.080
#> GSM509773     2  0.1950      0.876 0.008 0.952 0.040
#> GSM509775     2  0.2527      0.877 0.020 0.936 0.044
#> GSM509777     2  0.2774      0.857 0.072 0.920 0.008
#> GSM509779     2  0.3619      0.823 0.136 0.864 0.000
#> GSM509781     2  0.3619      0.823 0.136 0.864 0.000
#> GSM509783     2  0.3619      0.823 0.136 0.864 0.000
#> GSM509785     2  0.3619      0.823 0.136 0.864 0.000
#> GSM509752     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509754     2  0.4121      0.862 0.024 0.868 0.108
#> GSM509756     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509758     2  0.3966      0.865 0.024 0.876 0.100
#> GSM509760     2  0.4196      0.860 0.024 0.864 0.112
#> GSM509762     2  0.4121      0.862 0.024 0.868 0.108
#> GSM509764     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509766     2  0.2297      0.871 0.036 0.944 0.020
#> GSM509768     2  0.1774      0.872 0.024 0.960 0.016
#> GSM509770     2  0.3771      0.862 0.012 0.876 0.112
#> GSM509772     2  0.4270      0.857 0.024 0.860 0.116
#> GSM509774     2  0.2590      0.856 0.072 0.924 0.004
#> GSM509776     2  0.2414      0.874 0.040 0.940 0.020
#> GSM509778     2  0.3619      0.823 0.136 0.864 0.000
#> GSM509780     2  0.2774      0.858 0.072 0.920 0.008
#> GSM509782     2  0.3619      0.823 0.136 0.864 0.000
#> GSM509784     2  0.2866      0.856 0.076 0.916 0.008
#> GSM509786     2  0.3619      0.823 0.136 0.864 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.2011      0.747 0.920 0.000 0.080 0.000
#> GSM509711     1  0.3764      0.699 0.784 0.216 0.000 0.000
#> GSM509714     4  0.7853      0.245 0.292 0.308 0.000 0.400
#> GSM509719     1  0.5751      0.564 0.592 0.380 0.016 0.012
#> GSM509724     1  0.2281      0.741 0.904 0.000 0.096 0.000
#> GSM509729     2  0.6010     -0.542 0.472 0.488 0.040 0.000
#> GSM509707     1  0.2011      0.747 0.920 0.000 0.080 0.000
#> GSM509712     1  0.3764      0.699 0.784 0.216 0.000 0.000
#> GSM509715     4  0.6443      0.439 0.076 0.376 0.000 0.548
#> GSM509720     1  0.5751      0.564 0.592 0.380 0.016 0.012
#> GSM509725     1  0.4643      0.426 0.656 0.000 0.344 0.000
#> GSM509730     2  0.6010     -0.542 0.472 0.488 0.040 0.000
#> GSM509708     1  0.2011      0.747 0.920 0.000 0.080 0.000
#> GSM509713     1  0.3764      0.699 0.784 0.216 0.000 0.000
#> GSM509716     4  0.6532      0.444 0.084 0.368 0.000 0.548
#> GSM509721     1  0.5751      0.564 0.592 0.380 0.016 0.012
#> GSM509726     1  0.4866      0.278 0.596 0.000 0.404 0.000
#> GSM509731     4  0.5720      0.464 0.052 0.296 0.000 0.652
#> GSM509709     1  0.2011      0.747 0.920 0.000 0.080 0.000
#> GSM509717     4  0.6617      0.440 0.088 0.380 0.000 0.532
#> GSM509722     1  0.5751      0.564 0.592 0.380 0.016 0.012
#> GSM509727     3  0.3311      0.821 0.172 0.000 0.828 0.000
#> GSM509710     1  0.2011      0.747 0.920 0.000 0.080 0.000
#> GSM509718     4  0.5526      0.293 0.020 0.416 0.000 0.564
#> GSM509723     1  0.5751      0.564 0.592 0.380 0.016 0.012
#> GSM509728     3  0.3311      0.821 0.172 0.000 0.828 0.000
#> GSM509732     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509736     3  0.1042      0.926 0.008 0.020 0.972 0.000
#> GSM509741     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509737     3  0.1042      0.926 0.008 0.020 0.972 0.000
#> GSM509742     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509734     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509738     3  0.3335      0.865 0.120 0.020 0.860 0.000
#> GSM509743     3  0.0469      0.926 0.000 0.012 0.988 0.000
#> GSM509748     3  0.0817      0.927 0.024 0.000 0.976 0.000
#> GSM509735     1  0.4008      0.609 0.756 0.000 0.244 0.000
#> GSM509739     1  0.2216      0.742 0.908 0.000 0.092 0.000
#> GSM509744     3  0.1059      0.928 0.016 0.012 0.972 0.000
#> GSM509749     3  0.0817      0.927 0.024 0.000 0.976 0.000
#> GSM509740     3  0.4324      0.824 0.140 0.036 0.816 0.008
#> GSM509745     3  0.3659      0.844 0.136 0.024 0.840 0.000
#> GSM509750     3  0.3280      0.862 0.124 0.016 0.860 0.000
#> GSM509751     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509753     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509755     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509757     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509759     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509761     2  0.4134      0.795 0.000 0.740 0.000 0.260
#> GSM509763     4  0.4761      0.341 0.000 0.372 0.000 0.628
#> GSM509765     4  0.4382      0.494 0.000 0.296 0.000 0.704
#> GSM509767     2  0.4564      0.702 0.000 0.672 0.000 0.328
#> GSM509769     2  0.4817      0.573 0.000 0.612 0.000 0.388
#> GSM509771     2  0.4543      0.712 0.000 0.676 0.000 0.324
#> GSM509773     2  0.4948      0.411 0.000 0.560 0.000 0.440
#> GSM509775     2  0.4941      0.433 0.000 0.564 0.000 0.436
#> GSM509777     4  0.3688      0.607 0.000 0.208 0.000 0.792
#> GSM509779     4  0.0921      0.655 0.000 0.028 0.000 0.972
#> GSM509781     4  0.0000      0.655 0.000 0.000 0.000 1.000
#> GSM509783     4  0.0000      0.655 0.000 0.000 0.000 1.000
#> GSM509785     4  0.0000      0.655 0.000 0.000 0.000 1.000
#> GSM509752     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509754     2  0.4103      0.798 0.000 0.744 0.000 0.256
#> GSM509756     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509758     2  0.4222      0.781 0.000 0.728 0.000 0.272
#> GSM509760     2  0.4072      0.800 0.000 0.748 0.000 0.252
#> GSM509762     2  0.4103      0.798 0.000 0.744 0.000 0.256
#> GSM509764     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509766     4  0.4776      0.326 0.000 0.376 0.000 0.624
#> GSM509768     4  0.4877      0.229 0.000 0.408 0.000 0.592
#> GSM509770     2  0.4193      0.788 0.000 0.732 0.000 0.268
#> GSM509772     2  0.4040      0.802 0.000 0.752 0.000 0.248
#> GSM509774     4  0.3528      0.618 0.000 0.192 0.000 0.808
#> GSM509776     4  0.4916      0.124 0.000 0.424 0.000 0.576
#> GSM509778     4  0.0000      0.655 0.000 0.000 0.000 1.000
#> GSM509780     4  0.3837      0.593 0.000 0.224 0.000 0.776
#> GSM509782     4  0.0000      0.655 0.000 0.000 0.000 1.000
#> GSM509784     4  0.3528      0.619 0.000 0.192 0.000 0.808
#> GSM509786     4  0.0000      0.655 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000     0.6518 1.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.4419     0.4997 0.668 0.020 0.000 0.000 0.312
#> GSM509714     5  0.7858     0.3824 0.188 0.116 0.000 0.240 0.456
#> GSM509719     1  0.6504     0.2786 0.448 0.196 0.000 0.000 0.356
#> GSM509724     1  0.0510     0.6487 0.984 0.000 0.016 0.000 0.000
#> GSM509729     5  0.6170    -0.1771 0.336 0.132 0.004 0.000 0.528
#> GSM509707     1  0.0000     0.6518 1.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.4419     0.4997 0.668 0.020 0.000 0.000 0.312
#> GSM509715     5  0.7001     0.3700 0.008 0.320 0.000 0.280 0.392
#> GSM509720     1  0.6504     0.2786 0.448 0.196 0.000 0.000 0.356
#> GSM509725     1  0.4046     0.4402 0.696 0.000 0.296 0.000 0.008
#> GSM509730     5  0.6170    -0.1771 0.336 0.132 0.004 0.000 0.528
#> GSM509708     1  0.0000     0.6518 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.4419     0.4997 0.668 0.020 0.000 0.000 0.312
#> GSM509716     5  0.6976     0.3937 0.008 0.304 0.000 0.280 0.408
#> GSM509721     1  0.6504     0.2786 0.448 0.196 0.000 0.000 0.356
#> GSM509726     1  0.4313     0.3121 0.636 0.000 0.356 0.000 0.008
#> GSM509731     5  0.4192     0.1294 0.000 0.000 0.000 0.404 0.596
#> GSM509709     1  0.0000     0.6518 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.6898     0.4157 0.008 0.284 0.000 0.268 0.440
#> GSM509722     1  0.6504     0.2786 0.448 0.196 0.000 0.000 0.356
#> GSM509727     3  0.3667     0.8370 0.140 0.000 0.812 0.000 0.048
#> GSM509710     1  0.0000     0.6518 1.000 0.000 0.000 0.000 0.000
#> GSM509718     2  0.6578    -0.0206 0.000 0.500 0.004 0.228 0.268
#> GSM509723     1  0.6504     0.2786 0.448 0.196 0.000 0.000 0.356
#> GSM509728     3  0.3667     0.8370 0.140 0.000 0.812 0.000 0.048
#> GSM509732     3  0.0162     0.9350 0.004 0.000 0.996 0.000 0.000
#> GSM509736     3  0.0794     0.9311 0.000 0.000 0.972 0.000 0.028
#> GSM509741     3  0.0162     0.9350 0.004 0.000 0.996 0.000 0.000
#> GSM509746     3  0.0162     0.9350 0.004 0.000 0.996 0.000 0.000
#> GSM509733     3  0.0162     0.9350 0.004 0.000 0.996 0.000 0.000
#> GSM509737     3  0.0794     0.9311 0.000 0.000 0.972 0.000 0.028
#> GSM509742     3  0.0162     0.9350 0.004 0.000 0.996 0.000 0.000
#> GSM509747     3  0.0162     0.9350 0.004 0.000 0.996 0.000 0.000
#> GSM509734     3  0.0162     0.9350 0.004 0.000 0.996 0.000 0.000
#> GSM509738     3  0.3176     0.8829 0.064 0.000 0.856 0.000 0.080
#> GSM509743     3  0.0404     0.9318 0.000 0.000 0.988 0.000 0.012
#> GSM509748     3  0.1168     0.9291 0.032 0.000 0.960 0.000 0.008
#> GSM509735     1  0.3209     0.5536 0.812 0.000 0.180 0.000 0.008
#> GSM509739     1  0.0404     0.6495 0.988 0.000 0.012 0.000 0.000
#> GSM509744     3  0.0898     0.9330 0.008 0.000 0.972 0.000 0.020
#> GSM509749     3  0.1168     0.9291 0.032 0.000 0.960 0.000 0.008
#> GSM509740     3  0.4187     0.8469 0.080 0.016 0.804 0.000 0.100
#> GSM509745     3  0.3805     0.8622 0.084 0.004 0.820 0.000 0.092
#> GSM509750     3  0.3420     0.8762 0.076 0.000 0.840 0.000 0.084
#> GSM509751     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0404     0.8214 0.000 0.988 0.000 0.012 0.000
#> GSM509763     2  0.4304    -0.0544 0.000 0.516 0.000 0.484 0.000
#> GSM509765     4  0.4256     0.2647 0.000 0.436 0.000 0.564 0.000
#> GSM509767     2  0.1732     0.7912 0.000 0.920 0.000 0.080 0.000
#> GSM509769     2  0.2852     0.7185 0.000 0.828 0.000 0.172 0.000
#> GSM509771     2  0.1671     0.7941 0.000 0.924 0.000 0.076 0.000
#> GSM509773     2  0.3305     0.6557 0.000 0.776 0.000 0.224 0.000
#> GSM509775     2  0.3366     0.6422 0.000 0.768 0.000 0.232 0.000
#> GSM509777     4  0.3932     0.5560 0.000 0.328 0.000 0.672 0.000
#> GSM509779     4  0.1197     0.6904 0.000 0.048 0.000 0.952 0.000
#> GSM509781     4  0.0000     0.6979 0.000 0.000 0.000 1.000 0.000
#> GSM509783     4  0.0000     0.6979 0.000 0.000 0.000 1.000 0.000
#> GSM509785     4  0.0000     0.6979 0.000 0.000 0.000 1.000 0.000
#> GSM509752     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0290     0.8219 0.000 0.992 0.000 0.008 0.000
#> GSM509756     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0703     0.8180 0.000 0.976 0.000 0.024 0.000
#> GSM509760     2  0.0290     0.8217 0.000 0.992 0.000 0.008 0.000
#> GSM509762     2  0.0290     0.8219 0.000 0.992 0.000 0.008 0.000
#> GSM509764     2  0.0162     0.8201 0.000 0.996 0.000 0.000 0.004
#> GSM509766     2  0.4294     0.0241 0.000 0.532 0.000 0.468 0.000
#> GSM509768     2  0.4262     0.1280 0.000 0.560 0.000 0.440 0.000
#> GSM509770     2  0.0703     0.8180 0.000 0.976 0.000 0.024 0.000
#> GSM509772     2  0.0000     0.8209 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.3752     0.5962 0.000 0.292 0.000 0.708 0.000
#> GSM509776     2  0.4182     0.2742 0.000 0.600 0.000 0.400 0.000
#> GSM509778     4  0.0000     0.6979 0.000 0.000 0.000 1.000 0.000
#> GSM509780     4  0.4030     0.5073 0.000 0.352 0.000 0.648 0.000
#> GSM509782     4  0.0000     0.6979 0.000 0.000 0.000 1.000 0.000
#> GSM509784     4  0.3796     0.5910 0.000 0.300 0.000 0.700 0.000
#> GSM509786     4  0.0000     0.6979 0.000 0.000 0.000 1.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
#> GSM509706     1  0.0000     0.7183 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.4493     0.4097 0.612 0.000 0.000 0.000 0.044 0.344
#> GSM509714     6  0.5444     0.3961 0.144 0.036 0.000 0.064 0.052 0.704
#> GSM509719     5  0.6677     0.6909 0.316 0.044 0.000 0.000 0.424 0.216
#> GSM509724     1  0.0547     0.7139 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM509729     5  0.3888     0.5347 0.204 0.028 0.004 0.000 0.756 0.008
#> GSM509707     1  0.0000     0.7183 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.4493     0.4097 0.612 0.000 0.000 0.000 0.044 0.344
#> GSM509715     6  0.3886     0.7636 0.000 0.140 0.000 0.080 0.004 0.776
#> GSM509720     5  0.6677     0.6909 0.316 0.044 0.000 0.000 0.424 0.216
#> GSM509725     1  0.4202     0.4366 0.668 0.000 0.300 0.000 0.028 0.004
#> GSM509730     5  0.3888     0.5347 0.204 0.028 0.004 0.000 0.756 0.008
#> GSM509708     1  0.0260     0.7151 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM509713     1  0.4493     0.4097 0.612 0.000 0.000 0.000 0.044 0.344
#> GSM509716     6  0.3726     0.7675 0.000 0.124 0.000 0.080 0.004 0.792
#> GSM509721     5  0.6677     0.6909 0.316 0.044 0.000 0.000 0.424 0.216
#> GSM509726     1  0.4490     0.3670 0.604 0.000 0.360 0.000 0.032 0.004
#> GSM509731     5  0.4936    -0.3537 0.000 0.000 0.000 0.064 0.500 0.436
#> GSM509709     1  0.0000     0.7183 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     6  0.3118     0.7403 0.000 0.092 0.000 0.072 0.000 0.836
#> GSM509722     5  0.6677     0.6909 0.316 0.044 0.000 0.000 0.424 0.216
#> GSM509727     3  0.3782     0.8453 0.088 0.000 0.808 0.000 0.080 0.024
#> GSM509710     1  0.0000     0.7183 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     6  0.4800     0.5526 0.000 0.304 0.000 0.032 0.028 0.636
#> GSM509723     5  0.6677     0.6909 0.316 0.044 0.000 0.000 0.424 0.216
#> GSM509728     3  0.3782     0.8453 0.088 0.000 0.808 0.000 0.080 0.024
#> GSM509732     3  0.0146     0.9339 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM509736     3  0.1049     0.9304 0.000 0.000 0.960 0.000 0.032 0.008
#> GSM509741     3  0.0146     0.9339 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM509746     3  0.0146     0.9339 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM509733     3  0.0146     0.9339 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM509737     3  0.1049     0.9304 0.000 0.000 0.960 0.000 0.032 0.008
#> GSM509742     3  0.0146     0.9339 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM509747     3  0.0146     0.9339 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM509734     3  0.0000     0.9341 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509738     3  0.3140     0.8854 0.024 0.000 0.844 0.000 0.108 0.024
#> GSM509743     3  0.0458     0.9318 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM509748     3  0.1074     0.9299 0.012 0.000 0.960 0.000 0.028 0.000
#> GSM509735     1  0.3667     0.5473 0.776 0.000 0.184 0.000 0.032 0.008
#> GSM509739     1  0.0363     0.7166 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM509744     3  0.1074     0.9313 0.000 0.000 0.960 0.000 0.028 0.012
#> GSM509749     3  0.1074     0.9299 0.012 0.000 0.960 0.000 0.028 0.000
#> GSM509740     3  0.3934     0.8522 0.036 0.000 0.792 0.000 0.128 0.044
#> GSM509745     3  0.3573     0.8668 0.036 0.000 0.816 0.000 0.120 0.028
#> GSM509750     3  0.3226     0.8804 0.028 0.000 0.836 0.000 0.116 0.020
#> GSM509751     2  0.0000     0.8498 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000     0.8498 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000     0.8498 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0000     0.8498 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509759     2  0.0000     0.8498 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509761     2  0.0363     0.8505 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM509763     2  0.3866    -0.0561 0.000 0.516 0.000 0.484 0.000 0.000
#> GSM509765     4  0.3823     0.2668 0.000 0.436 0.000 0.564 0.000 0.000
#> GSM509767     2  0.1556     0.8177 0.000 0.920 0.000 0.080 0.000 0.000
#> GSM509769     2  0.2562     0.7319 0.000 0.828 0.000 0.172 0.000 0.000
#> GSM509771     2  0.1501     0.8210 0.000 0.924 0.000 0.076 0.000 0.000
#> GSM509773     2  0.2969     0.6685 0.000 0.776 0.000 0.224 0.000 0.000
#> GSM509775     2  0.3023     0.6537 0.000 0.768 0.000 0.232 0.000 0.000
#> GSM509777     4  0.3531     0.5596 0.000 0.328 0.000 0.672 0.000 0.000
#> GSM509779     4  0.1075     0.7278 0.000 0.048 0.000 0.952 0.000 0.000
#> GSM509781     4  0.0000     0.7327 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509783     4  0.0000     0.7327 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509785     4  0.0000     0.7327 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509752     2  0.0000     0.8498 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0260     0.8508 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509756     2  0.0000     0.8498 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0632     0.8474 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM509760     2  0.0260     0.8508 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509762     2  0.0260     0.8508 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509764     2  0.0146     0.8490 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM509766     2  0.3857     0.0239 0.000 0.532 0.000 0.468 0.000 0.000
#> GSM509768     2  0.3828     0.1278 0.000 0.560 0.000 0.440 0.000 0.000
#> GSM509770     2  0.0632     0.8475 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM509772     2  0.0000     0.8498 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509774     4  0.3371     0.6127 0.000 0.292 0.000 0.708 0.000 0.000
#> GSM509776     2  0.3756     0.2747 0.000 0.600 0.000 0.400 0.000 0.000
#> GSM509778     4  0.0000     0.7327 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509780     4  0.3620     0.5113 0.000 0.352 0.000 0.648 0.000 0.000
#> GSM509782     4  0.0000     0.7327 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509784     4  0.3409     0.6036 0.000 0.300 0.000 0.700 0.000 0.000
#> GSM509786     4  0.0000     0.7327 0.000 0.000 0.000 1.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-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)  time(p) k
#> CV:hclust 79         5.88e-14 9.17e-11 2
#> CV:hclust 75         1.31e-21 3.11e-08 3
#> CV:hclust 64         9.97e-20 2.41e-07 4
#> CV:hclust 58         1.31e-15 7.82e-07 5
#> CV:hclust 69         7.90e-20 6.23e-06 6

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


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

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.990       0.996         0.5063 0.494   0.494
#> 3 3 0.708           0.821       0.846         0.2644 0.810   0.637
#> 4 4 0.815           0.805       0.871         0.1403 0.859   0.625
#> 5 5 0.788           0.792       0.838         0.0631 0.911   0.677
#> 6 6 0.759           0.689       0.816         0.0430 0.966   0.844

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1   0.000      1.000 1.000 0.000
#> GSM509711     1   0.000      1.000 1.000 0.000
#> GSM509714     2   0.921      0.494 0.336 0.664
#> GSM509719     1   0.000      1.000 1.000 0.000
#> GSM509724     1   0.000      1.000 1.000 0.000
#> GSM509729     1   0.000      1.000 1.000 0.000
#> GSM509707     1   0.000      1.000 1.000 0.000
#> GSM509712     1   0.000      1.000 1.000 0.000
#> GSM509715     2   0.000      0.992 0.000 1.000
#> GSM509720     1   0.000      1.000 1.000 0.000
#> GSM509725     1   0.000      1.000 1.000 0.000
#> GSM509730     1   0.000      1.000 1.000 0.000
#> GSM509708     1   0.000      1.000 1.000 0.000
#> GSM509713     1   0.000      1.000 1.000 0.000
#> GSM509716     2   0.000      0.992 0.000 1.000
#> GSM509721     1   0.000      1.000 1.000 0.000
#> GSM509726     1   0.000      1.000 1.000 0.000
#> GSM509731     2   0.000      0.992 0.000 1.000
#> GSM509709     1   0.000      1.000 1.000 0.000
#> GSM509717     2   0.000      0.992 0.000 1.000
#> GSM509722     1   0.000      1.000 1.000 0.000
#> GSM509727     1   0.000      1.000 1.000 0.000
#> GSM509710     1   0.000      1.000 1.000 0.000
#> GSM509718     2   0.000      0.992 0.000 1.000
#> GSM509723     1   0.000      1.000 1.000 0.000
#> GSM509728     1   0.000      1.000 1.000 0.000
#> GSM509732     1   0.000      1.000 1.000 0.000
#> GSM509736     1   0.000      1.000 1.000 0.000
#> GSM509741     1   0.000      1.000 1.000 0.000
#> GSM509746     1   0.000      1.000 1.000 0.000
#> GSM509733     1   0.000      1.000 1.000 0.000
#> GSM509737     1   0.000      1.000 1.000 0.000
#> GSM509742     1   0.000      1.000 1.000 0.000
#> GSM509747     1   0.000      1.000 1.000 0.000
#> GSM509734     1   0.000      1.000 1.000 0.000
#> GSM509738     1   0.000      1.000 1.000 0.000
#> GSM509743     1   0.000      1.000 1.000 0.000
#> GSM509748     1   0.000      1.000 1.000 0.000
#> GSM509735     1   0.000      1.000 1.000 0.000
#> GSM509739     1   0.000      1.000 1.000 0.000
#> GSM509744     1   0.000      1.000 1.000 0.000
#> GSM509749     1   0.000      1.000 1.000 0.000
#> GSM509740     1   0.000      1.000 1.000 0.000
#> GSM509745     1   0.000      1.000 1.000 0.000
#> GSM509750     1   0.000      1.000 1.000 0.000
#> GSM509751     2   0.000      0.992 0.000 1.000
#> GSM509753     2   0.000      0.992 0.000 1.000
#> GSM509755     2   0.000      0.992 0.000 1.000
#> GSM509757     2   0.000      0.992 0.000 1.000
#> GSM509759     2   0.000      0.992 0.000 1.000
#> GSM509761     2   0.000      0.992 0.000 1.000
#> GSM509763     2   0.000      0.992 0.000 1.000
#> GSM509765     2   0.000      0.992 0.000 1.000
#> GSM509767     2   0.000      0.992 0.000 1.000
#> GSM509769     2   0.000      0.992 0.000 1.000
#> GSM509771     2   0.000      0.992 0.000 1.000
#> GSM509773     2   0.000      0.992 0.000 1.000
#> GSM509775     2   0.000      0.992 0.000 1.000
#> GSM509777     2   0.000      0.992 0.000 1.000
#> GSM509779     2   0.000      0.992 0.000 1.000
#> GSM509781     2   0.000      0.992 0.000 1.000
#> GSM509783     2   0.000      0.992 0.000 1.000
#> GSM509785     2   0.000      0.992 0.000 1.000
#> GSM509752     2   0.000      0.992 0.000 1.000
#> GSM509754     2   0.000      0.992 0.000 1.000
#> GSM509756     2   0.000      0.992 0.000 1.000
#> GSM509758     2   0.000      0.992 0.000 1.000
#> GSM509760     2   0.000      0.992 0.000 1.000
#> GSM509762     2   0.000      0.992 0.000 1.000
#> GSM509764     2   0.000      0.992 0.000 1.000
#> GSM509766     2   0.000      0.992 0.000 1.000
#> GSM509768     2   0.000      0.992 0.000 1.000
#> GSM509770     2   0.000      0.992 0.000 1.000
#> GSM509772     2   0.000      0.992 0.000 1.000
#> GSM509774     2   0.000      0.992 0.000 1.000
#> GSM509776     2   0.000      0.992 0.000 1.000
#> GSM509778     2   0.000      0.992 0.000 1.000
#> GSM509780     2   0.000      0.992 0.000 1.000
#> GSM509782     2   0.000      0.992 0.000 1.000
#> GSM509784     2   0.000      0.992 0.000 1.000
#> GSM509786     2   0.000      0.992 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
#> GSM509706     1  0.2261      0.781 0.932 0.000 0.068
#> GSM509711     1  0.0424      0.789 0.992 0.000 0.008
#> GSM509714     1  0.6143      0.562 0.720 0.024 0.256
#> GSM509719     1  0.1753      0.774 0.952 0.048 0.000
#> GSM509724     1  0.3412      0.735 0.876 0.000 0.124
#> GSM509729     1  0.0424      0.788 0.992 0.008 0.000
#> GSM509707     1  0.2261      0.781 0.932 0.000 0.068
#> GSM509712     1  0.0237      0.789 0.996 0.000 0.004
#> GSM509715     2  0.9884      0.135 0.364 0.376 0.260
#> GSM509720     1  0.1753      0.774 0.952 0.048 0.000
#> GSM509725     1  0.3482      0.731 0.872 0.000 0.128
#> GSM509730     1  0.0424      0.788 0.992 0.008 0.000
#> GSM509708     1  0.2261      0.781 0.932 0.000 0.068
#> GSM509713     1  0.1529      0.787 0.960 0.000 0.040
#> GSM509716     1  0.9560      0.216 0.484 0.260 0.256
#> GSM509721     1  0.1753      0.774 0.952 0.048 0.000
#> GSM509726     1  0.3482      0.731 0.872 0.000 0.128
#> GSM509731     1  0.9150      0.355 0.536 0.192 0.272
#> GSM509709     1  0.2261      0.781 0.932 0.000 0.068
#> GSM509717     1  0.9182      0.356 0.536 0.204 0.260
#> GSM509722     1  0.1753      0.774 0.952 0.048 0.000
#> GSM509727     1  0.3482      0.731 0.872 0.000 0.128
#> GSM509710     1  0.3482      0.731 0.872 0.000 0.128
#> GSM509718     2  0.9072      0.564 0.192 0.548 0.260
#> GSM509723     1  0.1753      0.774 0.952 0.048 0.000
#> GSM509728     3  0.6111      0.781 0.396 0.000 0.604
#> GSM509732     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509736     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509741     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509746     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509733     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509737     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509742     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509747     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509734     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509738     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509743     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509748     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509735     1  0.3482      0.731 0.872 0.000 0.128
#> GSM509739     1  0.2448      0.776 0.924 0.000 0.076
#> GSM509744     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509749     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509740     1  0.5098      0.485 0.752 0.000 0.248
#> GSM509745     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509750     3  0.5397      0.989 0.280 0.000 0.720
#> GSM509751     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509753     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509755     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509757     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509759     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509761     2  0.0000      0.895 0.000 1.000 0.000
#> GSM509763     2  0.1163      0.891 0.000 0.972 0.028
#> GSM509765     2  0.2711      0.877 0.000 0.912 0.088
#> GSM509767     2  0.0237      0.895 0.004 0.996 0.000
#> GSM509769     2  0.0424      0.894 0.000 0.992 0.008
#> GSM509771     2  0.0237      0.895 0.004 0.996 0.000
#> GSM509773     2  0.0747      0.893 0.000 0.984 0.016
#> GSM509775     2  0.0592      0.894 0.000 0.988 0.012
#> GSM509777     2  0.5291      0.803 0.000 0.732 0.268
#> GSM509779     2  0.5397      0.797 0.000 0.720 0.280
#> GSM509781     2  0.5797      0.792 0.008 0.712 0.280
#> GSM509783     2  0.5797      0.792 0.008 0.712 0.280
#> GSM509785     2  0.5797      0.792 0.008 0.712 0.280
#> GSM509752     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509754     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509756     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509758     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509760     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509762     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509764     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509766     2  0.1860      0.886 0.000 0.948 0.052
#> GSM509768     2  0.1163      0.891 0.000 0.972 0.028
#> GSM509770     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509772     2  0.0424      0.895 0.008 0.992 0.000
#> GSM509774     2  0.5397      0.797 0.000 0.720 0.280
#> GSM509776     2  0.1031      0.892 0.000 0.976 0.024
#> GSM509778     2  0.5797      0.792 0.008 0.712 0.280
#> GSM509780     2  0.3192      0.869 0.000 0.888 0.112
#> GSM509782     2  0.5797      0.792 0.008 0.712 0.280
#> GSM509784     2  0.5397      0.797 0.000 0.720 0.280
#> GSM509786     2  0.5797      0.792 0.008 0.712 0.280

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.1022    0.80810 0.968 0.000 0.032 0.000
#> GSM509711     1  0.3801    0.77702 0.780 0.000 0.000 0.220
#> GSM509714     1  0.4950    0.71530 0.620 0.004 0.000 0.376
#> GSM509719     1  0.5148    0.73468 0.640 0.008 0.004 0.348
#> GSM509724     1  0.2149    0.78575 0.912 0.000 0.088 0.000
#> GSM509729     1  0.4995    0.73947 0.648 0.004 0.004 0.344
#> GSM509707     1  0.1022    0.80810 0.968 0.000 0.032 0.000
#> GSM509712     1  0.3942    0.77338 0.764 0.000 0.000 0.236
#> GSM509715     4  0.3495    0.35550 0.140 0.016 0.000 0.844
#> GSM509720     1  0.5148    0.73468 0.640 0.008 0.004 0.348
#> GSM509725     1  0.2149    0.78575 0.912 0.000 0.088 0.000
#> GSM509730     1  0.4995    0.73947 0.648 0.004 0.004 0.344
#> GSM509708     1  0.1022    0.80810 0.968 0.000 0.032 0.000
#> GSM509713     1  0.1452    0.80415 0.956 0.000 0.008 0.036
#> GSM509716     4  0.3495    0.35550 0.140 0.016 0.000 0.844
#> GSM509721     1  0.5148    0.73468 0.640 0.008 0.004 0.348
#> GSM509726     1  0.2149    0.78575 0.912 0.000 0.088 0.000
#> GSM509731     4  0.2546    0.41234 0.092 0.008 0.000 0.900
#> GSM509709     1  0.1022    0.80810 0.968 0.000 0.032 0.000
#> GSM509717     4  0.3428    0.34528 0.144 0.012 0.000 0.844
#> GSM509722     1  0.5148    0.73468 0.640 0.008 0.004 0.348
#> GSM509727     1  0.2401    0.78139 0.904 0.000 0.092 0.004
#> GSM509710     1  0.2149    0.78575 0.912 0.000 0.088 0.000
#> GSM509718     4  0.4017    0.40264 0.128 0.044 0.000 0.828
#> GSM509723     1  0.5148    0.73468 0.640 0.008 0.004 0.348
#> GSM509728     3  0.4313    0.63536 0.260 0.000 0.736 0.004
#> GSM509732     3  0.0000    0.94516 0.000 0.000 1.000 0.000
#> GSM509736     3  0.0817    0.94170 0.000 0.000 0.976 0.024
#> GSM509741     3  0.0188    0.94489 0.000 0.000 0.996 0.004
#> GSM509746     3  0.0000    0.94516 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000    0.94516 0.000 0.000 1.000 0.000
#> GSM509737     3  0.1004    0.94068 0.004 0.000 0.972 0.024
#> GSM509742     3  0.0188    0.94489 0.000 0.000 0.996 0.004
#> GSM509747     3  0.0000    0.94516 0.000 0.000 1.000 0.000
#> GSM509734     3  0.0000    0.94516 0.000 0.000 1.000 0.000
#> GSM509738     3  0.1004    0.94068 0.004 0.000 0.972 0.024
#> GSM509743     3  0.0817    0.94170 0.000 0.000 0.976 0.024
#> GSM509748     3  0.0000    0.94516 0.000 0.000 1.000 0.000
#> GSM509735     1  0.2149    0.78575 0.912 0.000 0.088 0.000
#> GSM509739     1  0.1118    0.80734 0.964 0.000 0.036 0.000
#> GSM509744     3  0.0817    0.94170 0.000 0.000 0.976 0.024
#> GSM509749     3  0.0000    0.94516 0.000 0.000 1.000 0.000
#> GSM509740     3  0.7531    0.00794 0.316 0.000 0.476 0.208
#> GSM509745     3  0.1004    0.94068 0.004 0.000 0.972 0.024
#> GSM509750     3  0.0188    0.94494 0.000 0.000 0.996 0.004
#> GSM509751     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509753     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509755     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509757     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509759     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509761     2  0.0000    0.95880 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0469    0.95154 0.000 0.988 0.000 0.012
#> GSM509765     2  0.3837    0.58770 0.000 0.776 0.000 0.224
#> GSM509767     2  0.0000    0.95880 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0188    0.95650 0.000 0.996 0.000 0.004
#> GSM509771     2  0.0000    0.95880 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0336    0.95431 0.000 0.992 0.000 0.008
#> GSM509775     2  0.0336    0.95431 0.000 0.992 0.000 0.008
#> GSM509777     4  0.4888    0.65702 0.000 0.412 0.000 0.588
#> GSM509779     4  0.4855    0.68007 0.000 0.400 0.000 0.600
#> GSM509781     4  0.4855    0.68007 0.000 0.400 0.000 0.600
#> GSM509783     4  0.4855    0.68007 0.000 0.400 0.000 0.600
#> GSM509785     4  0.4855    0.68007 0.000 0.400 0.000 0.600
#> GSM509752     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509754     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509756     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509758     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509760     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509762     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509764     2  0.0469    0.95167 0.000 0.988 0.000 0.012
#> GSM509766     2  0.2149    0.85516 0.000 0.912 0.000 0.088
#> GSM509768     2  0.0469    0.95154 0.000 0.988 0.000 0.012
#> GSM509770     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509772     2  0.0188    0.95995 0.000 0.996 0.000 0.004
#> GSM509774     4  0.4855    0.68007 0.000 0.400 0.000 0.600
#> GSM509776     2  0.0469    0.95154 0.000 0.988 0.000 0.012
#> GSM509778     4  0.4855    0.68007 0.000 0.400 0.000 0.600
#> GSM509780     2  0.4356    0.38677 0.000 0.708 0.000 0.292
#> GSM509782     4  0.4855    0.68007 0.000 0.400 0.000 0.600
#> GSM509784     4  0.4855    0.68007 0.000 0.400 0.000 0.600
#> GSM509786     4  0.4855    0.68007 0.000 0.400 0.000 0.600

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.4666     0.9354 0.596 0.000 0.012 0.004 0.388
#> GSM509711     5  0.4907    -0.1740 0.292 0.000 0.000 0.052 0.656
#> GSM509714     5  0.4599     0.5848 0.272 0.000 0.000 0.040 0.688
#> GSM509719     5  0.0000     0.5640 0.000 0.000 0.000 0.000 1.000
#> GSM509724     1  0.5203     0.9331 0.600 0.000 0.032 0.012 0.356
#> GSM509729     5  0.1117     0.5341 0.020 0.000 0.000 0.016 0.964
#> GSM509707     1  0.4666     0.9354 0.596 0.000 0.012 0.004 0.388
#> GSM509712     5  0.4689    -0.0617 0.264 0.000 0.000 0.048 0.688
#> GSM509715     5  0.6374     0.5508 0.300 0.000 0.000 0.196 0.504
#> GSM509720     5  0.0000     0.5640 0.000 0.000 0.000 0.000 1.000
#> GSM509725     1  0.5203     0.9330 0.600 0.000 0.032 0.012 0.356
#> GSM509730     5  0.1117     0.5341 0.020 0.000 0.000 0.016 0.964
#> GSM509708     1  0.4666     0.9354 0.596 0.000 0.012 0.004 0.388
#> GSM509713     1  0.5103     0.8069 0.512 0.000 0.000 0.036 0.452
#> GSM509716     5  0.6374     0.5508 0.300 0.000 0.000 0.196 0.504
#> GSM509721     5  0.0000     0.5640 0.000 0.000 0.000 0.000 1.000
#> GSM509726     1  0.6033     0.9015 0.560 0.000 0.032 0.060 0.348
#> GSM509731     5  0.6597     0.5126 0.296 0.000 0.000 0.244 0.460
#> GSM509709     1  0.4666     0.9354 0.596 0.000 0.012 0.004 0.388
#> GSM509717     5  0.6374     0.5508 0.300 0.000 0.000 0.196 0.504
#> GSM509722     5  0.0290     0.5670 0.008 0.000 0.000 0.000 0.992
#> GSM509727     1  0.6273     0.8778 0.532 0.000 0.032 0.076 0.360
#> GSM509710     1  0.4986     0.9341 0.608 0.000 0.032 0.004 0.356
#> GSM509718     5  0.7161     0.5004 0.332 0.024 0.000 0.220 0.424
#> GSM509723     5  0.0000     0.5640 0.000 0.000 0.000 0.000 1.000
#> GSM509728     3  0.6770     0.4435 0.248 0.000 0.576 0.076 0.100
#> GSM509732     3  0.0162     0.9265 0.004 0.000 0.996 0.000 0.000
#> GSM509736     3  0.2645     0.9081 0.044 0.000 0.888 0.068 0.000
#> GSM509741     3  0.0000     0.9262 0.000 0.000 1.000 0.000 0.000
#> GSM509746     3  0.0162     0.9265 0.004 0.000 0.996 0.000 0.000
#> GSM509733     3  0.0162     0.9265 0.004 0.000 0.996 0.000 0.000
#> GSM509737     3  0.2645     0.9081 0.044 0.000 0.888 0.068 0.000
#> GSM509742     3  0.0000     0.9262 0.000 0.000 1.000 0.000 0.000
#> GSM509747     3  0.0162     0.9265 0.004 0.000 0.996 0.000 0.000
#> GSM509734     3  0.0162     0.9265 0.004 0.000 0.996 0.000 0.000
#> GSM509738     3  0.3714     0.8831 0.056 0.000 0.832 0.100 0.012
#> GSM509743     3  0.2438     0.9106 0.040 0.000 0.900 0.060 0.000
#> GSM509748     3  0.0162     0.9265 0.004 0.000 0.996 0.000 0.000
#> GSM509735     1  0.5616     0.9270 0.580 0.000 0.032 0.032 0.356
#> GSM509739     1  0.4655     0.9364 0.600 0.000 0.012 0.004 0.384
#> GSM509744     3  0.2843     0.9046 0.048 0.000 0.876 0.076 0.000
#> GSM509749     3  0.0451     0.9255 0.004 0.000 0.988 0.008 0.000
#> GSM509740     5  0.7780    -0.0318 0.112 0.000 0.372 0.136 0.380
#> GSM509745     3  0.3867     0.8756 0.056 0.000 0.820 0.112 0.012
#> GSM509750     3  0.3089     0.8988 0.040 0.000 0.872 0.076 0.012
#> GSM509751     2  0.0451     0.9311 0.008 0.988 0.000 0.000 0.004
#> GSM509753     2  0.0451     0.9311 0.008 0.988 0.000 0.000 0.004
#> GSM509755     2  0.0451     0.9311 0.008 0.988 0.000 0.000 0.004
#> GSM509757     2  0.0451     0.9311 0.008 0.988 0.000 0.000 0.004
#> GSM509759     2  0.0451     0.9311 0.008 0.988 0.000 0.000 0.004
#> GSM509761     2  0.0404     0.9314 0.012 0.988 0.000 0.000 0.000
#> GSM509763     2  0.1997     0.8966 0.036 0.924 0.000 0.040 0.000
#> GSM509765     2  0.5103    -0.2371 0.036 0.512 0.000 0.452 0.000
#> GSM509767     2  0.0451     0.9299 0.008 0.988 0.000 0.004 0.000
#> GSM509769     2  0.1493     0.9125 0.028 0.948 0.000 0.024 0.000
#> GSM509771     2  0.0451     0.9299 0.008 0.988 0.000 0.004 0.000
#> GSM509773     2  0.1836     0.9025 0.032 0.932 0.000 0.036 0.000
#> GSM509775     2  0.1753     0.9052 0.032 0.936 0.000 0.032 0.000
#> GSM509777     4  0.3795     0.9116 0.028 0.192 0.000 0.780 0.000
#> GSM509779     4  0.3280     0.9279 0.012 0.176 0.000 0.812 0.000
#> GSM509781     4  0.3732     0.9347 0.032 0.176 0.000 0.792 0.000
#> GSM509783     4  0.3732     0.9347 0.032 0.176 0.000 0.792 0.000
#> GSM509785     4  0.3732     0.9347 0.032 0.176 0.000 0.792 0.000
#> GSM509752     2  0.0290     0.9316 0.008 0.992 0.000 0.000 0.000
#> GSM509754     2  0.0290     0.9316 0.008 0.992 0.000 0.000 0.000
#> GSM509756     2  0.0451     0.9311 0.008 0.988 0.000 0.000 0.004
#> GSM509758     2  0.0162     0.9320 0.004 0.996 0.000 0.000 0.000
#> GSM509760     2  0.0451     0.9316 0.008 0.988 0.000 0.004 0.000
#> GSM509762     2  0.0162     0.9320 0.004 0.996 0.000 0.000 0.000
#> GSM509764     2  0.0854     0.9216 0.008 0.976 0.000 0.012 0.004
#> GSM509766     2  0.4479     0.4943 0.036 0.700 0.000 0.264 0.000
#> GSM509768     2  0.1997     0.8966 0.036 0.924 0.000 0.040 0.000
#> GSM509770     2  0.0912     0.9242 0.012 0.972 0.000 0.016 0.000
#> GSM509772     2  0.0451     0.9311 0.008 0.988 0.000 0.000 0.004
#> GSM509774     4  0.3687     0.9212 0.028 0.180 0.000 0.792 0.000
#> GSM509776     2  0.1997     0.8966 0.036 0.924 0.000 0.040 0.000
#> GSM509778     4  0.3732     0.9347 0.032 0.176 0.000 0.792 0.000
#> GSM509780     4  0.5088     0.4227 0.036 0.436 0.000 0.528 0.000
#> GSM509782     4  0.3732     0.9347 0.032 0.176 0.000 0.792 0.000
#> GSM509784     4  0.3565     0.9249 0.024 0.176 0.000 0.800 0.000
#> GSM509786     4  0.3650     0.9347 0.028 0.176 0.000 0.796 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
#> GSM509706     1  0.1053     0.8594 0.964 0.000 0.012 0.004 0.020 0.000
#> GSM509711     1  0.5967     0.3801 0.568 0.000 0.000 0.044 0.264 0.124
#> GSM509714     5  0.3593     0.3936 0.016 0.000 0.000 0.020 0.784 0.180
#> GSM509719     5  0.2597     0.6376 0.176 0.000 0.000 0.000 0.824 0.000
#> GSM509724     1  0.1078     0.8579 0.964 0.000 0.012 0.008 0.000 0.016
#> GSM509729     5  0.5343     0.5390 0.184 0.000 0.000 0.040 0.664 0.112
#> GSM509707     1  0.1053     0.8594 0.964 0.000 0.012 0.004 0.020 0.000
#> GSM509712     1  0.6094     0.3025 0.540 0.000 0.000 0.044 0.288 0.128
#> GSM509715     5  0.4812     0.2778 0.008 0.000 0.000 0.080 0.660 0.252
#> GSM509720     5  0.2597     0.6376 0.176 0.000 0.000 0.000 0.824 0.000
#> GSM509725     1  0.1448     0.8560 0.948 0.000 0.012 0.016 0.000 0.024
#> GSM509730     5  0.5284     0.5464 0.176 0.000 0.000 0.040 0.672 0.112
#> GSM509708     1  0.1053     0.8594 0.964 0.000 0.012 0.004 0.020 0.000
#> GSM509713     1  0.3988     0.7786 0.804 0.000 0.004 0.040 0.060 0.092
#> GSM509716     5  0.4812     0.2778 0.008 0.000 0.000 0.080 0.660 0.252
#> GSM509721     5  0.2597     0.6376 0.176 0.000 0.000 0.000 0.824 0.000
#> GSM509726     1  0.3444     0.7959 0.812 0.000 0.012 0.036 0.000 0.140
#> GSM509731     5  0.5749     0.1341 0.008 0.000 0.000 0.144 0.504 0.344
#> GSM509709     1  0.1053     0.8594 0.964 0.000 0.012 0.004 0.020 0.000
#> GSM509717     5  0.4812     0.2778 0.008 0.000 0.000 0.080 0.660 0.252
#> GSM509722     5  0.2562     0.6367 0.172 0.000 0.000 0.000 0.828 0.000
#> GSM509727     1  0.3943     0.7654 0.772 0.000 0.012 0.040 0.004 0.172
#> GSM509710     1  0.0798     0.8600 0.976 0.000 0.012 0.004 0.004 0.004
#> GSM509718     6  0.5218    -0.2433 0.008 0.000 0.000 0.068 0.460 0.464
#> GSM509723     5  0.2597     0.6376 0.176 0.000 0.000 0.000 0.824 0.000
#> GSM509728     3  0.6521     0.0857 0.320 0.000 0.464 0.036 0.004 0.176
#> GSM509732     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     3  0.3524     0.7130 0.008 0.000 0.756 0.004 0.004 0.228
#> GSM509741     3  0.0146     0.8097 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM509746     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     3  0.3524     0.7130 0.008 0.000 0.756 0.004 0.004 0.228
#> GSM509742     3  0.0146     0.8097 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM509747     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509738     3  0.4315     0.5701 0.024 0.000 0.624 0.000 0.004 0.348
#> GSM509743     3  0.3104     0.7282 0.000 0.000 0.788 0.004 0.004 0.204
#> GSM509748     3  0.0000     0.8099 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509735     1  0.2644     0.8373 0.884 0.000 0.012 0.028 0.004 0.072
#> GSM509739     1  0.0508     0.8613 0.984 0.000 0.012 0.000 0.000 0.004
#> GSM509744     3  0.3290     0.7069 0.000 0.000 0.744 0.000 0.004 0.252
#> GSM509749     3  0.0547     0.8043 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM509740     6  0.6931    -0.0196 0.100 0.000 0.312 0.000 0.152 0.436
#> GSM509745     3  0.4341     0.5572 0.024 0.000 0.616 0.000 0.004 0.356
#> GSM509750     3  0.3430     0.6854 0.016 0.000 0.772 0.000 0.004 0.208
#> GSM509751     2  0.0291     0.8573 0.004 0.992 0.000 0.000 0.004 0.000
#> GSM509753     2  0.0291     0.8573 0.004 0.992 0.000 0.000 0.004 0.000
#> GSM509755     2  0.0291     0.8573 0.004 0.992 0.000 0.000 0.004 0.000
#> GSM509757     2  0.0291     0.8573 0.004 0.992 0.000 0.000 0.004 0.000
#> GSM509759     2  0.0551     0.8549 0.004 0.984 0.000 0.000 0.004 0.008
#> GSM509761     2  0.1531     0.8511 0.000 0.928 0.000 0.004 0.000 0.068
#> GSM509763     2  0.4614     0.7082 0.000 0.684 0.000 0.208 0.000 0.108
#> GSM509765     4  0.5173     0.2817 0.000 0.324 0.000 0.568 0.000 0.108
#> GSM509767     2  0.1895     0.8469 0.000 0.912 0.000 0.016 0.000 0.072
#> GSM509769     2  0.4209     0.7535 0.000 0.736 0.000 0.160 0.000 0.104
#> GSM509771     2  0.2060     0.8433 0.000 0.900 0.000 0.016 0.000 0.084
#> GSM509773     2  0.4518     0.7208 0.000 0.696 0.000 0.200 0.000 0.104
#> GSM509775     2  0.4490     0.7245 0.000 0.700 0.000 0.196 0.000 0.104
#> GSM509777     4  0.3045     0.7396 0.000 0.100 0.000 0.840 0.000 0.060
#> GSM509779     4  0.4338     0.8117 0.000 0.100 0.000 0.732 0.004 0.164
#> GSM509781     4  0.4584     0.8148 0.000 0.100 0.000 0.700 0.004 0.196
#> GSM509783     4  0.4584     0.8148 0.000 0.100 0.000 0.700 0.004 0.196
#> GSM509785     4  0.4584     0.8148 0.000 0.100 0.000 0.700 0.004 0.196
#> GSM509752     2  0.0000     0.8581 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000     0.8581 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0000     0.8581 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0508     0.8591 0.000 0.984 0.000 0.004 0.000 0.012
#> GSM509760     2  0.1845     0.8483 0.000 0.920 0.000 0.052 0.000 0.028
#> GSM509762     2  0.0260     0.8591 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM509764     2  0.0982     0.8398 0.004 0.968 0.000 0.004 0.004 0.020
#> GSM509766     2  0.5355     0.1959 0.000 0.468 0.000 0.424 0.000 0.108
#> GSM509768     2  0.4614     0.7082 0.000 0.684 0.000 0.208 0.000 0.108
#> GSM509770     2  0.3686     0.7905 0.000 0.788 0.000 0.124 0.000 0.088
#> GSM509772     2  0.0291     0.8573 0.004 0.992 0.000 0.000 0.004 0.000
#> GSM509774     4  0.2728     0.7556 0.000 0.100 0.000 0.860 0.000 0.040
#> GSM509776     2  0.4614     0.7082 0.000 0.684 0.000 0.208 0.000 0.108
#> GSM509778     4  0.4584     0.8148 0.000 0.100 0.000 0.700 0.004 0.196
#> GSM509780     4  0.4972     0.4297 0.000 0.272 0.000 0.620 0.000 0.108
#> GSM509782     4  0.4584     0.8148 0.000 0.100 0.000 0.700 0.004 0.196
#> GSM509784     4  0.2350     0.7615 0.000 0.100 0.000 0.880 0.000 0.020
#> GSM509786     4  0.4584     0.8148 0.000 0.100 0.000 0.700 0.004 0.196

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)  time(p) k
#> CV:kmeans 80         1.27e-14 1.07e-11 2
#> CV:kmeans 76         3.75e-26 3.41e-11 3
#> CV:kmeans 74         5.68e-25 3.30e-09 4
#> CV:kmeans 74         1.78e-25 1.10e-07 5
#> CV:kmeans 68         7.82e-23 6.70e-07 6

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


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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.984       0.994         0.5064 0.494   0.494
#> 3 3 0.866           0.863       0.939         0.2773 0.805   0.625
#> 4 4 0.754           0.855       0.917         0.1587 0.845   0.587
#> 5 5 0.740           0.717       0.849         0.0588 0.923   0.708
#> 6 6 0.721           0.630       0.807         0.0340 0.968   0.852

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1   0.000      0.988 1.000 0.000
#> GSM509711     1   0.000      0.988 1.000 0.000
#> GSM509714     1   0.992      0.188 0.552 0.448
#> GSM509719     1   0.000      0.988 1.000 0.000
#> GSM509724     1   0.000      0.988 1.000 0.000
#> GSM509729     1   0.000      0.988 1.000 0.000
#> GSM509707     1   0.000      0.988 1.000 0.000
#> GSM509712     1   0.000      0.988 1.000 0.000
#> GSM509715     2   0.000      1.000 0.000 1.000
#> GSM509720     1   0.000      0.988 1.000 0.000
#> GSM509725     1   0.000      0.988 1.000 0.000
#> GSM509730     1   0.000      0.988 1.000 0.000
#> GSM509708     1   0.000      0.988 1.000 0.000
#> GSM509713     1   0.000      0.988 1.000 0.000
#> GSM509716     2   0.000      1.000 0.000 1.000
#> GSM509721     1   0.000      0.988 1.000 0.000
#> GSM509726     1   0.000      0.988 1.000 0.000
#> GSM509731     2   0.000      1.000 0.000 1.000
#> GSM509709     1   0.000      0.988 1.000 0.000
#> GSM509717     2   0.000      1.000 0.000 1.000
#> GSM509722     1   0.000      0.988 1.000 0.000
#> GSM509727     1   0.000      0.988 1.000 0.000
#> GSM509710     1   0.000      0.988 1.000 0.000
#> GSM509718     2   0.000      1.000 0.000 1.000
#> GSM509723     1   0.000      0.988 1.000 0.000
#> GSM509728     1   0.000      0.988 1.000 0.000
#> GSM509732     1   0.000      0.988 1.000 0.000
#> GSM509736     1   0.000      0.988 1.000 0.000
#> GSM509741     1   0.000      0.988 1.000 0.000
#> GSM509746     1   0.000      0.988 1.000 0.000
#> GSM509733     1   0.000      0.988 1.000 0.000
#> GSM509737     1   0.000      0.988 1.000 0.000
#> GSM509742     1   0.000      0.988 1.000 0.000
#> GSM509747     1   0.000      0.988 1.000 0.000
#> GSM509734     1   0.000      0.988 1.000 0.000
#> GSM509738     1   0.000      0.988 1.000 0.000
#> GSM509743     1   0.000      0.988 1.000 0.000
#> GSM509748     1   0.000      0.988 1.000 0.000
#> GSM509735     1   0.000      0.988 1.000 0.000
#> GSM509739     1   0.000      0.988 1.000 0.000
#> GSM509744     1   0.000      0.988 1.000 0.000
#> GSM509749     1   0.000      0.988 1.000 0.000
#> GSM509740     1   0.000      0.988 1.000 0.000
#> GSM509745     1   0.000      0.988 1.000 0.000
#> GSM509750     1   0.000      0.988 1.000 0.000
#> GSM509751     2   0.000      1.000 0.000 1.000
#> GSM509753     2   0.000      1.000 0.000 1.000
#> GSM509755     2   0.000      1.000 0.000 1.000
#> GSM509757     2   0.000      1.000 0.000 1.000
#> GSM509759     2   0.000      1.000 0.000 1.000
#> GSM509761     2   0.000      1.000 0.000 1.000
#> GSM509763     2   0.000      1.000 0.000 1.000
#> GSM509765     2   0.000      1.000 0.000 1.000
#> GSM509767     2   0.000      1.000 0.000 1.000
#> GSM509769     2   0.000      1.000 0.000 1.000
#> GSM509771     2   0.000      1.000 0.000 1.000
#> GSM509773     2   0.000      1.000 0.000 1.000
#> GSM509775     2   0.000      1.000 0.000 1.000
#> GSM509777     2   0.000      1.000 0.000 1.000
#> GSM509779     2   0.000      1.000 0.000 1.000
#> GSM509781     2   0.000      1.000 0.000 1.000
#> GSM509783     2   0.000      1.000 0.000 1.000
#> GSM509785     2   0.000      1.000 0.000 1.000
#> GSM509752     2   0.000      1.000 0.000 1.000
#> GSM509754     2   0.000      1.000 0.000 1.000
#> GSM509756     2   0.000      1.000 0.000 1.000
#> GSM509758     2   0.000      1.000 0.000 1.000
#> GSM509760     2   0.000      1.000 0.000 1.000
#> GSM509762     2   0.000      1.000 0.000 1.000
#> GSM509764     2   0.000      1.000 0.000 1.000
#> GSM509766     2   0.000      1.000 0.000 1.000
#> GSM509768     2   0.000      1.000 0.000 1.000
#> GSM509770     2   0.000      1.000 0.000 1.000
#> GSM509772     2   0.000      1.000 0.000 1.000
#> GSM509774     2   0.000      1.000 0.000 1.000
#> GSM509776     2   0.000      1.000 0.000 1.000
#> GSM509778     2   0.000      1.000 0.000 1.000
#> GSM509780     2   0.000      1.000 0.000 1.000
#> GSM509782     2   0.000      1.000 0.000 1.000
#> GSM509784     2   0.000      1.000 0.000 1.000
#> GSM509786     2   0.000      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
#> GSM509706     1  0.1643     0.8263 0.956 0.000 0.044
#> GSM509711     1  0.0424     0.8261 0.992 0.000 0.008
#> GSM509714     1  0.0000     0.8215 1.000 0.000 0.000
#> GSM509719     1  0.0892     0.8301 0.980 0.000 0.020
#> GSM509724     1  0.5650     0.5647 0.688 0.000 0.312
#> GSM509729     1  0.0892     0.8301 0.980 0.000 0.020
#> GSM509707     1  0.1753     0.8244 0.952 0.000 0.048
#> GSM509712     1  0.1163     0.8299 0.972 0.000 0.028
#> GSM509715     1  0.5431     0.5559 0.716 0.284 0.000
#> GSM509720     1  0.0747     0.8294 0.984 0.000 0.016
#> GSM509725     1  0.6309     0.1454 0.500 0.000 0.500
#> GSM509730     1  0.1031     0.8303 0.976 0.000 0.024
#> GSM509708     1  0.1529     0.8276 0.960 0.000 0.040
#> GSM509713     1  0.1411     0.8286 0.964 0.000 0.036
#> GSM509716     1  0.4605     0.6716 0.796 0.204 0.000
#> GSM509721     1  0.0892     0.8301 0.980 0.000 0.020
#> GSM509726     1  0.6309     0.1452 0.500 0.000 0.500
#> GSM509731     1  0.4452     0.6837 0.808 0.192 0.000
#> GSM509709     1  0.1643     0.8263 0.956 0.000 0.044
#> GSM509717     1  0.4346     0.6909 0.816 0.184 0.000
#> GSM509722     1  0.0592     0.8280 0.988 0.000 0.012
#> GSM509727     3  0.6280    -0.0947 0.460 0.000 0.540
#> GSM509710     1  0.6307     0.1826 0.512 0.000 0.488
#> GSM509718     2  0.8610     0.2749 0.336 0.548 0.116
#> GSM509723     1  0.0747     0.8294 0.984 0.000 0.016
#> GSM509728     3  0.1163     0.9360 0.028 0.000 0.972
#> GSM509732     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509736     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509741     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509746     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509733     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509737     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509742     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509747     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509734     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509738     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509743     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509748     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509735     1  0.6204     0.3563 0.576 0.000 0.424
#> GSM509739     1  0.5178     0.6422 0.744 0.000 0.256
#> GSM509744     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509749     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509740     3  0.0237     0.9632 0.004 0.000 0.996
#> GSM509745     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509750     3  0.0000     0.9671 0.000 0.000 1.000
#> GSM509751     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509753     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509755     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509757     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509759     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509761     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509763     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509765     2  0.0237     0.9813 0.004 0.996 0.000
#> GSM509767     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509769     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509771     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509773     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509775     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509777     2  0.0747     0.9770 0.016 0.984 0.000
#> GSM509779     2  0.0892     0.9754 0.020 0.980 0.000
#> GSM509781     2  0.0892     0.9754 0.020 0.980 0.000
#> GSM509783     2  0.0892     0.9754 0.020 0.980 0.000
#> GSM509785     2  0.0892     0.9754 0.020 0.980 0.000
#> GSM509752     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509754     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509756     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509758     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509760     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509762     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509764     2  0.0592     0.9739 0.000 0.988 0.012
#> GSM509766     2  0.0237     0.9813 0.004 0.996 0.000
#> GSM509768     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509770     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509772     2  0.0000     0.9822 0.000 1.000 0.000
#> GSM509774     2  0.0892     0.9754 0.020 0.980 0.000
#> GSM509776     2  0.0237     0.9813 0.004 0.996 0.000
#> GSM509778     2  0.0892     0.9754 0.020 0.980 0.000
#> GSM509780     2  0.0424     0.9801 0.008 0.992 0.000
#> GSM509782     2  0.0892     0.9754 0.020 0.980 0.000
#> GSM509784     2  0.0892     0.9754 0.020 0.980 0.000
#> GSM509786     2  0.0892     0.9754 0.020 0.980 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.1022     0.8994 0.968 0.000 0.032 0.000
#> GSM509711     1  0.0921     0.8979 0.972 0.000 0.000 0.028
#> GSM509714     1  0.4304     0.6798 0.716 0.000 0.000 0.284
#> GSM509719     1  0.2011     0.8855 0.920 0.000 0.000 0.080
#> GSM509724     1  0.2469     0.8707 0.892 0.000 0.108 0.000
#> GSM509729     1  0.1584     0.9008 0.952 0.000 0.012 0.036
#> GSM509707     1  0.1022     0.8994 0.968 0.000 0.032 0.000
#> GSM509712     1  0.0804     0.9009 0.980 0.000 0.008 0.012
#> GSM509715     4  0.1118     0.8274 0.036 0.000 0.000 0.964
#> GSM509720     1  0.2216     0.8807 0.908 0.000 0.000 0.092
#> GSM509725     1  0.3649     0.7921 0.796 0.000 0.204 0.000
#> GSM509730     1  0.1820     0.9010 0.944 0.000 0.020 0.036
#> GSM509708     1  0.0895     0.9016 0.976 0.000 0.020 0.004
#> GSM509713     1  0.0895     0.9020 0.976 0.000 0.020 0.004
#> GSM509716     4  0.1389     0.8207 0.048 0.000 0.000 0.952
#> GSM509721     1  0.2081     0.8839 0.916 0.000 0.000 0.084
#> GSM509726     1  0.3837     0.7681 0.776 0.000 0.224 0.000
#> GSM509731     4  0.1302     0.8256 0.044 0.000 0.000 0.956
#> GSM509709     1  0.0817     0.9004 0.976 0.000 0.024 0.000
#> GSM509717     4  0.1557     0.8153 0.056 0.000 0.000 0.944
#> GSM509722     1  0.2081     0.8839 0.916 0.000 0.000 0.084
#> GSM509727     1  0.4605     0.5791 0.664 0.000 0.336 0.000
#> GSM509710     1  0.3074     0.8438 0.848 0.000 0.152 0.000
#> GSM509718     4  0.2901     0.8275 0.016 0.040 0.036 0.908
#> GSM509723     1  0.2011     0.8855 0.920 0.000 0.000 0.080
#> GSM509728     3  0.2647     0.8545 0.120 0.000 0.880 0.000
#> GSM509732     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509736     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509741     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509737     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509742     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509734     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509738     3  0.0188     0.9841 0.004 0.000 0.996 0.000
#> GSM509743     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509735     1  0.3486     0.8108 0.812 0.000 0.188 0.000
#> GSM509739     1  0.2469     0.8713 0.892 0.000 0.108 0.000
#> GSM509744     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509749     3  0.0000     0.9867 0.000 0.000 1.000 0.000
#> GSM509740     3  0.2053     0.9155 0.072 0.000 0.924 0.004
#> GSM509745     3  0.0188     0.9841 0.004 0.000 0.996 0.000
#> GSM509750     3  0.0188     0.9841 0.004 0.000 0.996 0.000
#> GSM509751     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509761     2  0.1389     0.8809 0.000 0.952 0.000 0.048
#> GSM509763     2  0.4713     0.4007 0.000 0.640 0.000 0.360
#> GSM509765     4  0.4222     0.7035 0.000 0.272 0.000 0.728
#> GSM509767     2  0.0188     0.8981 0.000 0.996 0.000 0.004
#> GSM509769     2  0.1716     0.8722 0.000 0.936 0.000 0.064
#> GSM509771     2  0.0707     0.8934 0.000 0.980 0.000 0.020
#> GSM509773     2  0.2973     0.7995 0.000 0.856 0.000 0.144
#> GSM509775     2  0.2469     0.8366 0.000 0.892 0.000 0.108
#> GSM509777     4  0.2973     0.8704 0.000 0.144 0.000 0.856
#> GSM509779     4  0.2469     0.8948 0.000 0.108 0.000 0.892
#> GSM509781     4  0.2408     0.8961 0.000 0.104 0.000 0.896
#> GSM509783     4  0.2408     0.8961 0.000 0.104 0.000 0.896
#> GSM509785     4  0.2408     0.8961 0.000 0.104 0.000 0.896
#> GSM509752     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0188     0.8981 0.000 0.996 0.000 0.004
#> GSM509760     2  0.3172     0.7775 0.000 0.840 0.000 0.160
#> GSM509762     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0188     0.8965 0.000 0.996 0.004 0.000
#> GSM509766     4  0.4933     0.3060 0.000 0.432 0.000 0.568
#> GSM509768     2  0.4967     0.0935 0.000 0.548 0.000 0.452
#> GSM509770     2  0.1940     0.8649 0.000 0.924 0.000 0.076
#> GSM509772     2  0.0000     0.8988 0.000 1.000 0.000 0.000
#> GSM509774     4  0.2530     0.8930 0.000 0.112 0.000 0.888
#> GSM509776     2  0.4992    -0.0125 0.000 0.524 0.000 0.476
#> GSM509778     4  0.2408     0.8961 0.000 0.104 0.000 0.896
#> GSM509780     4  0.3610     0.8125 0.000 0.200 0.000 0.800
#> GSM509782     4  0.2408     0.8961 0.000 0.104 0.000 0.896
#> GSM509784     4  0.2589     0.8908 0.000 0.116 0.000 0.884
#> GSM509786     4  0.2408     0.8961 0.000 0.104 0.000 0.896

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0290     0.7934 0.992 0.000 0.000 0.000 0.008
#> GSM509711     1  0.3109     0.6779 0.800 0.000 0.000 0.000 0.200
#> GSM509714     5  0.4238     0.5994 0.164 0.000 0.000 0.068 0.768
#> GSM509719     5  0.3999     0.6286 0.344 0.000 0.000 0.000 0.656
#> GSM509724     1  0.1211     0.7980 0.960 0.000 0.024 0.000 0.016
#> GSM509729     1  0.4074     0.1737 0.636 0.000 0.000 0.000 0.364
#> GSM509707     1  0.0162     0.7926 0.996 0.000 0.000 0.000 0.004
#> GSM509712     1  0.2966     0.6883 0.816 0.000 0.000 0.000 0.184
#> GSM509715     4  0.4748    -0.0749 0.016 0.000 0.000 0.492 0.492
#> GSM509720     5  0.3966     0.6365 0.336 0.000 0.000 0.000 0.664
#> GSM509725     1  0.2573     0.7681 0.880 0.000 0.104 0.000 0.016
#> GSM509730     1  0.5250    -0.0840 0.536 0.000 0.048 0.000 0.416
#> GSM509708     1  0.0880     0.7861 0.968 0.000 0.000 0.000 0.032
#> GSM509713     1  0.1544     0.7808 0.932 0.000 0.000 0.000 0.068
#> GSM509716     5  0.4658     0.1836 0.016 0.000 0.000 0.408 0.576
#> GSM509721     5  0.4166     0.6225 0.348 0.000 0.004 0.000 0.648
#> GSM509726     1  0.2712     0.7730 0.880 0.000 0.088 0.000 0.032
#> GSM509731     4  0.5006     0.3155 0.048 0.000 0.000 0.624 0.328
#> GSM509709     1  0.0609     0.7895 0.980 0.000 0.000 0.000 0.020
#> GSM509717     5  0.4808     0.1980 0.024 0.000 0.000 0.400 0.576
#> GSM509722     5  0.3895     0.6399 0.320 0.000 0.000 0.000 0.680
#> GSM509727     1  0.4647     0.6289 0.732 0.000 0.184 0.000 0.084
#> GSM509710     1  0.2540     0.7747 0.888 0.000 0.088 0.000 0.024
#> GSM509718     4  0.6847     0.1132 0.072 0.044 0.012 0.464 0.408
#> GSM509723     5  0.4060     0.6083 0.360 0.000 0.000 0.000 0.640
#> GSM509728     3  0.4276     0.6310 0.244 0.000 0.724 0.000 0.032
#> GSM509732     3  0.0000     0.9371 0.000 0.000 1.000 0.000 0.000
#> GSM509736     3  0.1924     0.9245 0.008 0.000 0.924 0.004 0.064
#> GSM509741     3  0.0290     0.9373 0.000 0.000 0.992 0.000 0.008
#> GSM509746     3  0.0000     0.9371 0.000 0.000 1.000 0.000 0.000
#> GSM509733     3  0.0000     0.9371 0.000 0.000 1.000 0.000 0.000
#> GSM509737     3  0.1990     0.9230 0.008 0.000 0.920 0.004 0.068
#> GSM509742     3  0.0162     0.9374 0.000 0.000 0.996 0.000 0.004
#> GSM509747     3  0.0000     0.9371 0.000 0.000 1.000 0.000 0.000
#> GSM509734     3  0.0000     0.9371 0.000 0.000 1.000 0.000 0.000
#> GSM509738     3  0.2464     0.9148 0.012 0.000 0.892 0.004 0.092
#> GSM509743     3  0.1571     0.9277 0.004 0.000 0.936 0.000 0.060
#> GSM509748     3  0.0162     0.9376 0.000 0.000 0.996 0.000 0.004
#> GSM509735     1  0.3527     0.6809 0.792 0.000 0.192 0.000 0.016
#> GSM509739     1  0.1668     0.7967 0.940 0.000 0.028 0.000 0.032
#> GSM509744     3  0.1864     0.9255 0.004 0.000 0.924 0.004 0.068
#> GSM509749     3  0.0404     0.9366 0.000 0.000 0.988 0.000 0.012
#> GSM509740     3  0.5587     0.6554 0.188 0.000 0.656 0.004 0.152
#> GSM509745     3  0.2729     0.9085 0.028 0.000 0.884 0.004 0.084
#> GSM509750     3  0.1638     0.9149 0.004 0.000 0.932 0.000 0.064
#> GSM509751     2  0.0510     0.8613 0.000 0.984 0.000 0.000 0.016
#> GSM509753     2  0.0609     0.8616 0.000 0.980 0.000 0.000 0.020
#> GSM509755     2  0.0609     0.8623 0.000 0.980 0.000 0.000 0.020
#> GSM509757     2  0.0290     0.8618 0.000 0.992 0.000 0.000 0.008
#> GSM509759     2  0.0609     0.8613 0.000 0.980 0.000 0.000 0.020
#> GSM509761     2  0.3639     0.7482 0.000 0.792 0.000 0.184 0.024
#> GSM509763     4  0.4682     0.3846 0.000 0.356 0.000 0.620 0.024
#> GSM509765     4  0.3106     0.7430 0.000 0.140 0.000 0.840 0.020
#> GSM509767     2  0.2300     0.8393 0.000 0.904 0.000 0.072 0.024
#> GSM509769     2  0.4428     0.6349 0.000 0.700 0.000 0.268 0.032
#> GSM509771     2  0.2795     0.8218 0.000 0.872 0.000 0.100 0.028
#> GSM509773     2  0.5071     0.2556 0.000 0.540 0.000 0.424 0.036
#> GSM509775     2  0.5077     0.3644 0.000 0.568 0.000 0.392 0.040
#> GSM509777     4  0.1697     0.7942 0.000 0.060 0.000 0.932 0.008
#> GSM509779     4  0.1012     0.8010 0.000 0.020 0.000 0.968 0.012
#> GSM509781     4  0.1012     0.8007 0.000 0.020 0.000 0.968 0.012
#> GSM509783     4  0.1117     0.7992 0.000 0.020 0.000 0.964 0.016
#> GSM509785     4  0.1012     0.8007 0.000 0.020 0.000 0.968 0.012
#> GSM509752     2  0.0566     0.8630 0.000 0.984 0.000 0.004 0.012
#> GSM509754     2  0.0798     0.8633 0.000 0.976 0.000 0.016 0.008
#> GSM509756     2  0.0912     0.8628 0.000 0.972 0.000 0.016 0.012
#> GSM509758     2  0.1725     0.8523 0.000 0.936 0.000 0.044 0.020
#> GSM509760     2  0.4758     0.5819 0.000 0.676 0.000 0.276 0.048
#> GSM509762     2  0.0566     0.8636 0.000 0.984 0.000 0.004 0.012
#> GSM509764     2  0.0880     0.8604 0.000 0.968 0.000 0.000 0.032
#> GSM509766     4  0.4248     0.6272 0.000 0.240 0.000 0.728 0.032
#> GSM509768     4  0.4354     0.5946 0.000 0.256 0.000 0.712 0.032
#> GSM509770     2  0.4404     0.6435 0.000 0.704 0.000 0.264 0.032
#> GSM509772     2  0.0404     0.8617 0.000 0.988 0.000 0.000 0.012
#> GSM509774     4  0.1041     0.8022 0.000 0.032 0.000 0.964 0.004
#> GSM509776     4  0.4642     0.4806 0.000 0.308 0.000 0.660 0.032
#> GSM509778     4  0.0898     0.8010 0.000 0.020 0.000 0.972 0.008
#> GSM509780     4  0.2795     0.7773 0.000 0.100 0.000 0.872 0.028
#> GSM509782     4  0.1012     0.8007 0.000 0.020 0.000 0.968 0.012
#> GSM509784     4  0.1300     0.8020 0.000 0.028 0.000 0.956 0.016
#> GSM509786     4  0.0898     0.8012 0.000 0.020 0.000 0.972 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM509706     1  0.0405     0.8476 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM509711     1  0.4585     0.6252 0.692 0.000 0.000 0.000 0.192 0.116
#> GSM509714     5  0.4657     0.3392 0.040 0.000 0.000 0.032 0.692 0.236
#> GSM509719     5  0.2572     0.5860 0.136 0.000 0.000 0.000 0.852 0.012
#> GSM509724     1  0.0405     0.8478 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM509729     1  0.4666     0.1648 0.536 0.000 0.000 0.000 0.420 0.044
#> GSM509707     1  0.0291     0.8478 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM509712     1  0.4506     0.6641 0.704 0.000 0.000 0.000 0.176 0.120
#> GSM509715     5  0.6414    -0.5335 0.012 0.000 0.000 0.332 0.348 0.308
#> GSM509720     5  0.2357     0.5868 0.116 0.000 0.000 0.000 0.872 0.012
#> GSM509725     1  0.1369     0.8469 0.952 0.000 0.016 0.000 0.016 0.016
#> GSM509730     5  0.5293     0.1873 0.372 0.000 0.024 0.000 0.548 0.056
#> GSM509708     1  0.1563     0.8383 0.932 0.000 0.000 0.000 0.056 0.012
#> GSM509713     1  0.2966     0.7977 0.848 0.000 0.000 0.000 0.076 0.076
#> GSM509716     5  0.6125    -0.3678 0.004 0.000 0.000 0.264 0.432 0.300
#> GSM509721     5  0.2680     0.5834 0.124 0.000 0.004 0.000 0.856 0.016
#> GSM509726     1  0.2295     0.8266 0.904 0.000 0.028 0.000 0.016 0.052
#> GSM509731     4  0.6756    -0.5207 0.060 0.000 0.000 0.460 0.228 0.252
#> GSM509709     1  0.1151     0.8460 0.956 0.000 0.000 0.000 0.032 0.012
#> GSM509717     5  0.6276    -0.4050 0.008 0.000 0.000 0.276 0.400 0.316
#> GSM509722     5  0.2383     0.5729 0.096 0.000 0.000 0.000 0.880 0.024
#> GSM509727     1  0.5227     0.6308 0.688 0.000 0.144 0.000 0.048 0.120
#> GSM509710     1  0.0951     0.8492 0.968 0.000 0.008 0.000 0.004 0.020
#> GSM509718     6  0.7595     0.0000 0.024 0.040 0.040 0.304 0.156 0.436
#> GSM509723     5  0.2790     0.5823 0.140 0.000 0.000 0.000 0.840 0.020
#> GSM509728     3  0.5245     0.4990 0.268 0.000 0.616 0.000 0.012 0.104
#> GSM509732     3  0.0603     0.8681 0.004 0.000 0.980 0.000 0.000 0.016
#> GSM509736     3  0.3133     0.8156 0.008 0.000 0.804 0.000 0.008 0.180
#> GSM509741     3  0.1296     0.8662 0.004 0.000 0.948 0.000 0.004 0.044
#> GSM509746     3  0.0603     0.8681 0.004 0.000 0.980 0.000 0.000 0.016
#> GSM509733     3  0.0603     0.8681 0.004 0.000 0.980 0.000 0.000 0.016
#> GSM509737     3  0.3065     0.8189 0.008 0.000 0.812 0.000 0.008 0.172
#> GSM509742     3  0.0692     0.8692 0.004 0.000 0.976 0.000 0.000 0.020
#> GSM509747     3  0.0653     0.8684 0.004 0.000 0.980 0.000 0.004 0.012
#> GSM509734     3  0.0717     0.8685 0.008 0.000 0.976 0.000 0.000 0.016
#> GSM509738     3  0.3693     0.7973 0.012 0.000 0.756 0.000 0.016 0.216
#> GSM509743     3  0.2473     0.8385 0.000 0.000 0.856 0.000 0.008 0.136
#> GSM509748     3  0.0508     0.8694 0.004 0.000 0.984 0.000 0.000 0.012
#> GSM509735     1  0.2975     0.7500 0.840 0.000 0.132 0.000 0.012 0.016
#> GSM509739     1  0.0964     0.8488 0.968 0.000 0.004 0.000 0.012 0.016
#> GSM509744     3  0.2234     0.8483 0.000 0.000 0.872 0.000 0.004 0.124
#> GSM509749     3  0.1010     0.8679 0.004 0.000 0.960 0.000 0.000 0.036
#> GSM509740     3  0.6866     0.3564 0.168 0.000 0.456 0.000 0.088 0.288
#> GSM509745     3  0.4112     0.7695 0.048 0.000 0.724 0.000 0.004 0.224
#> GSM509750     3  0.2275     0.8416 0.008 0.000 0.888 0.000 0.008 0.096
#> GSM509751     2  0.1152     0.7922 0.000 0.952 0.000 0.000 0.004 0.044
#> GSM509753     2  0.1152     0.7929 0.000 0.952 0.000 0.000 0.004 0.044
#> GSM509755     2  0.1010     0.7888 0.000 0.960 0.000 0.000 0.004 0.036
#> GSM509757     2  0.1082     0.7945 0.000 0.956 0.000 0.000 0.004 0.040
#> GSM509759     2  0.1686     0.7830 0.000 0.924 0.000 0.000 0.012 0.064
#> GSM509761     2  0.5031     0.6358 0.000 0.644 0.000 0.228 0.004 0.124
#> GSM509763     4  0.4923     0.5387 0.000 0.236 0.000 0.652 0.004 0.108
#> GSM509765     4  0.3611     0.6692 0.000 0.096 0.000 0.796 0.000 0.108
#> GSM509767     2  0.4196     0.7384 0.000 0.740 0.000 0.116 0.000 0.144
#> GSM509769     2  0.5775     0.4020 0.000 0.496 0.000 0.296 0.000 0.208
#> GSM509771     2  0.3962     0.7480 0.000 0.764 0.000 0.120 0.000 0.116
#> GSM509773     4  0.5722    -0.0675 0.000 0.404 0.000 0.432 0.000 0.164
#> GSM509775     2  0.5782     0.1138 0.000 0.424 0.000 0.400 0.000 0.176
#> GSM509777     4  0.1984     0.7229 0.000 0.032 0.000 0.912 0.000 0.056
#> GSM509779     4  0.0806     0.7294 0.000 0.008 0.000 0.972 0.000 0.020
#> GSM509781     4  0.1036     0.7185 0.000 0.008 0.000 0.964 0.004 0.024
#> GSM509783     4  0.0951     0.7210 0.000 0.008 0.000 0.968 0.004 0.020
#> GSM509785     4  0.0922     0.7180 0.000 0.004 0.000 0.968 0.004 0.024
#> GSM509752     2  0.1524     0.7959 0.000 0.932 0.000 0.008 0.000 0.060
#> GSM509754     2  0.2309     0.7977 0.000 0.888 0.000 0.028 0.000 0.084
#> GSM509756     2  0.2971     0.7827 0.000 0.844 0.000 0.052 0.000 0.104
#> GSM509758     2  0.4013     0.7611 0.000 0.768 0.000 0.104 0.004 0.124
#> GSM509760     2  0.6099     0.4292 0.000 0.520 0.000 0.292 0.028 0.160
#> GSM509762     2  0.2452     0.7942 0.000 0.884 0.000 0.028 0.004 0.084
#> GSM509764     2  0.1644     0.7870 0.000 0.920 0.000 0.000 0.004 0.076
#> GSM509766     4  0.4736     0.5879 0.000 0.164 0.000 0.692 0.004 0.140
#> GSM509768     4  0.4902     0.5716 0.000 0.172 0.000 0.672 0.004 0.152
#> GSM509770     2  0.5932     0.5430 0.000 0.532 0.000 0.232 0.012 0.224
#> GSM509772     2  0.1285     0.7953 0.000 0.944 0.000 0.004 0.000 0.052
#> GSM509774     4  0.1168     0.7303 0.000 0.016 0.000 0.956 0.000 0.028
#> GSM509776     4  0.5227     0.5006 0.000 0.232 0.000 0.620 0.004 0.144
#> GSM509778     4  0.0951     0.7210 0.000 0.008 0.000 0.968 0.004 0.020
#> GSM509780     4  0.2994     0.6980 0.000 0.080 0.000 0.852 0.004 0.064
#> GSM509782     4  0.1194     0.7212 0.000 0.008 0.000 0.956 0.004 0.032
#> GSM509784     4  0.1453     0.7291 0.000 0.008 0.000 0.944 0.008 0.040
#> GSM509786     4  0.0862     0.7247 0.000 0.008 0.000 0.972 0.004 0.016

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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)  time(p) k
#> CV:skmeans 80         1.27e-14 1.07e-11 2
#> CV:skmeans 75         2.83e-28 3.27e-12 3
#> CV:skmeans 77         1.32e-22 1.20e-07 4
#> CV:skmeans 70         2.73e-22 2.97e-07 5
#> CV:skmeans 67         2.20e-22 1.81e-06 6

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


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

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.737           0.848       0.938         0.4973 0.498   0.498
#> 3 3 0.563           0.542       0.768         0.3106 0.765   0.560
#> 4 4 0.564           0.569       0.776         0.1248 0.853   0.600
#> 5 5 0.734           0.663       0.796         0.0827 0.899   0.635
#> 6 6 0.791           0.690       0.837         0.0325 0.945   0.746

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1  0.0376     0.9261 0.996 0.004
#> GSM509711     1  0.9323     0.4603 0.652 0.348
#> GSM509714     2  0.8016     0.6744 0.244 0.756
#> GSM509719     1  0.9661     0.3573 0.608 0.392
#> GSM509724     1  0.0000     0.9277 1.000 0.000
#> GSM509729     1  0.4431     0.8503 0.908 0.092
#> GSM509707     1  0.0376     0.9261 0.996 0.004
#> GSM509712     1  0.9286     0.4761 0.656 0.344
#> GSM509715     2  0.8081     0.6734 0.248 0.752
#> GSM509720     2  0.9754     0.3170 0.408 0.592
#> GSM509725     1  0.0000     0.9277 1.000 0.000
#> GSM509730     1  0.9087     0.5189 0.676 0.324
#> GSM509708     1  0.1184     0.9185 0.984 0.016
#> GSM509713     1  0.1184     0.9184 0.984 0.016
#> GSM509716     2  0.7453     0.7194 0.212 0.788
#> GSM509721     1  0.9552     0.4012 0.624 0.376
#> GSM509726     1  0.0000     0.9277 1.000 0.000
#> GSM509731     2  0.7950     0.6823 0.240 0.760
#> GSM509709     1  0.0938     0.9211 0.988 0.012
#> GSM509717     2  0.8016     0.6744 0.244 0.756
#> GSM509722     2  0.9087     0.5284 0.324 0.676
#> GSM509727     1  0.0376     0.9261 0.996 0.004
#> GSM509710     1  0.0000     0.9277 1.000 0.000
#> GSM509718     1  0.9815     0.2622 0.580 0.420
#> GSM509723     2  1.0000    -0.0194 0.500 0.500
#> GSM509728     1  0.0000     0.9277 1.000 0.000
#> GSM509732     1  0.0000     0.9277 1.000 0.000
#> GSM509736     1  0.0000     0.9277 1.000 0.000
#> GSM509741     1  0.0000     0.9277 1.000 0.000
#> GSM509746     1  0.0000     0.9277 1.000 0.000
#> GSM509733     1  0.0000     0.9277 1.000 0.000
#> GSM509737     1  0.0000     0.9277 1.000 0.000
#> GSM509742     1  0.0000     0.9277 1.000 0.000
#> GSM509747     1  0.0000     0.9277 1.000 0.000
#> GSM509734     1  0.0000     0.9277 1.000 0.000
#> GSM509738     1  0.0000     0.9277 1.000 0.000
#> GSM509743     1  0.0000     0.9277 1.000 0.000
#> GSM509748     1  0.0000     0.9277 1.000 0.000
#> GSM509735     1  0.0000     0.9277 1.000 0.000
#> GSM509739     1  0.0000     0.9277 1.000 0.000
#> GSM509744     1  0.0000     0.9277 1.000 0.000
#> GSM509749     1  0.0000     0.9277 1.000 0.000
#> GSM509740     1  0.0376     0.9260 0.996 0.004
#> GSM509745     1  0.0000     0.9277 1.000 0.000
#> GSM509750     1  0.0376     0.9261 0.996 0.004
#> GSM509751     2  0.0000     0.9312 0.000 1.000
#> GSM509753     2  0.0000     0.9312 0.000 1.000
#> GSM509755     2  0.0000     0.9312 0.000 1.000
#> GSM509757     2  0.0000     0.9312 0.000 1.000
#> GSM509759     2  0.0000     0.9312 0.000 1.000
#> GSM509761     2  0.0000     0.9312 0.000 1.000
#> GSM509763     2  0.0000     0.9312 0.000 1.000
#> GSM509765     2  0.0000     0.9312 0.000 1.000
#> GSM509767     2  0.0000     0.9312 0.000 1.000
#> GSM509769     2  0.0000     0.9312 0.000 1.000
#> GSM509771     2  0.0000     0.9312 0.000 1.000
#> GSM509773     2  0.0000     0.9312 0.000 1.000
#> GSM509775     2  0.0000     0.9312 0.000 1.000
#> GSM509777     2  0.0000     0.9312 0.000 1.000
#> GSM509779     2  0.0000     0.9312 0.000 1.000
#> GSM509781     2  0.0000     0.9312 0.000 1.000
#> GSM509783     2  0.0000     0.9312 0.000 1.000
#> GSM509785     2  0.0000     0.9312 0.000 1.000
#> GSM509752     2  0.0000     0.9312 0.000 1.000
#> GSM509754     2  0.0000     0.9312 0.000 1.000
#> GSM509756     2  0.0000     0.9312 0.000 1.000
#> GSM509758     2  0.0000     0.9312 0.000 1.000
#> GSM509760     2  0.0000     0.9312 0.000 1.000
#> GSM509762     2  0.0000     0.9312 0.000 1.000
#> GSM509764     2  0.7528     0.6923 0.216 0.784
#> GSM509766     2  0.0000     0.9312 0.000 1.000
#> GSM509768     2  0.0000     0.9312 0.000 1.000
#> GSM509770     2  0.0000     0.9312 0.000 1.000
#> GSM509772     2  0.0000     0.9312 0.000 1.000
#> GSM509774     2  0.0000     0.9312 0.000 1.000
#> GSM509776     2  0.0000     0.9312 0.000 1.000
#> GSM509778     2  0.0000     0.9312 0.000 1.000
#> GSM509780     2  0.0000     0.9312 0.000 1.000
#> GSM509782     2  0.0000     0.9312 0.000 1.000
#> GSM509784     2  0.0000     0.9312 0.000 1.000
#> GSM509786     2  0.0000     0.9312 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
#> GSM509706     3  0.7236     0.6081 0.392 0.032 0.576
#> GSM509711     1  0.9257    -0.1049 0.520 0.196 0.284
#> GSM509714     1  0.6955     0.0721 0.636 0.332 0.032
#> GSM509719     2  0.7690     0.1762 0.416 0.536 0.048
#> GSM509724     3  0.4346     0.8043 0.184 0.000 0.816
#> GSM509729     1  0.9541    -0.2602 0.452 0.200 0.348
#> GSM509707     3  0.6264     0.6480 0.380 0.004 0.616
#> GSM509712     1  0.9098    -0.0664 0.456 0.404 0.140
#> GSM509715     1  0.4811     0.3984 0.828 0.148 0.024
#> GSM509720     2  0.7353     0.1702 0.436 0.532 0.032
#> GSM509725     3  0.2356     0.8493 0.072 0.000 0.928
#> GSM509730     1  0.9836    -0.0562 0.420 0.312 0.268
#> GSM509708     3  0.7181     0.5222 0.468 0.024 0.508
#> GSM509713     3  0.6669     0.5449 0.468 0.008 0.524
#> GSM509716     1  0.4897     0.3382 0.812 0.172 0.016
#> GSM509721     2  0.7652     0.1494 0.444 0.512 0.044
#> GSM509726     3  0.3192     0.8404 0.112 0.000 0.888
#> GSM509731     1  0.5098     0.4205 0.752 0.248 0.000
#> GSM509709     3  0.7054     0.5441 0.456 0.020 0.524
#> GSM509717     1  0.4799     0.3509 0.836 0.132 0.032
#> GSM509722     2  0.7619     0.1680 0.424 0.532 0.044
#> GSM509727     3  0.6247     0.6480 0.376 0.004 0.620
#> GSM509710     3  0.1643     0.8496 0.044 0.000 0.956
#> GSM509718     3  0.8902     0.0946 0.320 0.144 0.536
#> GSM509723     2  0.7647     0.1539 0.440 0.516 0.044
#> GSM509728     3  0.3038     0.8432 0.104 0.000 0.896
#> GSM509732     3  0.0237     0.8499 0.004 0.000 0.996
#> GSM509736     3  0.0000     0.8493 0.000 0.000 1.000
#> GSM509741     3  0.0000     0.8493 0.000 0.000 1.000
#> GSM509746     3  0.0237     0.8499 0.004 0.000 0.996
#> GSM509733     3  0.0237     0.8499 0.004 0.000 0.996
#> GSM509737     3  0.0000     0.8493 0.000 0.000 1.000
#> GSM509742     3  0.0237     0.8499 0.004 0.000 0.996
#> GSM509747     3  0.0237     0.8499 0.004 0.000 0.996
#> GSM509734     3  0.0237     0.8499 0.004 0.000 0.996
#> GSM509738     3  0.2165     0.8494 0.064 0.000 0.936
#> GSM509743     3  0.0000     0.8493 0.000 0.000 1.000
#> GSM509748     3  0.0000     0.8493 0.000 0.000 1.000
#> GSM509735     3  0.5905     0.6739 0.352 0.000 0.648
#> GSM509739     3  0.3412     0.8371 0.124 0.000 0.876
#> GSM509744     3  0.0000     0.8493 0.000 0.000 1.000
#> GSM509749     3  0.2165     0.8496 0.064 0.000 0.936
#> GSM509740     3  0.3370     0.8413 0.072 0.024 0.904
#> GSM509745     3  0.2066     0.8496 0.060 0.000 0.940
#> GSM509750     3  0.4068     0.8272 0.120 0.016 0.864
#> GSM509751     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509753     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509755     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509757     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509759     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509761     2  0.0237     0.7119 0.004 0.996 0.000
#> GSM509763     2  0.4346     0.4556 0.184 0.816 0.000
#> GSM509765     1  0.6309     0.3697 0.504 0.496 0.000
#> GSM509767     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509769     2  0.0237     0.7118 0.004 0.996 0.000
#> GSM509771     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509773     2  0.1643     0.6748 0.044 0.956 0.000
#> GSM509775     2  0.0892     0.7002 0.020 0.980 0.000
#> GSM509777     1  0.6302     0.3966 0.520 0.480 0.000
#> GSM509779     1  0.6291     0.4147 0.532 0.468 0.000
#> GSM509781     1  0.6225     0.4471 0.568 0.432 0.000
#> GSM509783     1  0.6215     0.4483 0.572 0.428 0.000
#> GSM509785     1  0.6225     0.4473 0.568 0.432 0.000
#> GSM509752     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509754     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509756     2  0.0592     0.7056 0.012 0.988 0.000
#> GSM509758     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509760     2  0.2796     0.6071 0.092 0.908 0.000
#> GSM509762     2  0.0237     0.7119 0.004 0.996 0.000
#> GSM509764     2  0.5465     0.3387 0.000 0.712 0.288
#> GSM509766     2  0.6252    -0.2835 0.444 0.556 0.000
#> GSM509768     2  0.5098     0.3029 0.248 0.752 0.000
#> GSM509770     2  0.0237     0.7120 0.004 0.996 0.000
#> GSM509772     2  0.0000     0.7138 0.000 1.000 0.000
#> GSM509774     1  0.6291     0.4147 0.532 0.468 0.000
#> GSM509776     2  0.6280    -0.3251 0.460 0.540 0.000
#> GSM509778     1  0.6215     0.4483 0.572 0.428 0.000
#> GSM509780     2  0.6260    -0.3016 0.448 0.552 0.000
#> GSM509782     1  0.6235     0.4450 0.564 0.436 0.000
#> GSM509784     1  0.6291     0.4147 0.532 0.468 0.000
#> GSM509786     1  0.6274     0.4278 0.544 0.456 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.2530     0.5417 0.896 0.000 0.100 0.004
#> GSM509711     1  0.5922     0.5689 0.736 0.056 0.044 0.164
#> GSM509714     1  0.7816     0.1850 0.412 0.272 0.000 0.316
#> GSM509719     2  0.7665     0.0235 0.380 0.448 0.008 0.164
#> GSM509724     1  0.4428     0.2246 0.720 0.000 0.276 0.004
#> GSM509729     1  0.7734     0.4397 0.580 0.216 0.040 0.164
#> GSM509707     1  0.3105     0.5397 0.856 0.000 0.140 0.004
#> GSM509712     1  0.7919     0.2557 0.496 0.316 0.024 0.164
#> GSM509715     4  0.5559     0.4830 0.240 0.064 0.000 0.696
#> GSM509720     2  0.7450    -0.0382 0.404 0.424 0.000 0.172
#> GSM509725     1  0.5028    -0.1106 0.596 0.000 0.400 0.004
#> GSM509730     1  0.8254     0.2256 0.472 0.332 0.044 0.152
#> GSM509708     1  0.3557     0.5857 0.856 0.000 0.036 0.108
#> GSM509713     1  0.4297     0.5846 0.820 0.000 0.096 0.084
#> GSM509716     4  0.7220    -0.0138 0.384 0.144 0.000 0.472
#> GSM509721     2  0.7728    -0.0156 0.388 0.432 0.008 0.172
#> GSM509726     3  0.5296     0.0886 0.492 0.000 0.500 0.008
#> GSM509731     4  0.4542     0.7138 0.088 0.108 0.000 0.804
#> GSM509709     1  0.2335     0.5913 0.920 0.000 0.020 0.060
#> GSM509717     4  0.6637     0.1133 0.368 0.092 0.000 0.540
#> GSM509722     2  0.7736    -0.0578 0.404 0.416 0.008 0.172
#> GSM509727     1  0.2973     0.5238 0.856 0.000 0.144 0.000
#> GSM509710     3  0.5126     0.1616 0.444 0.000 0.552 0.004
#> GSM509718     3  0.6858     0.2666 0.008 0.100 0.576 0.316
#> GSM509723     2  0.7609    -0.0258 0.396 0.428 0.004 0.172
#> GSM509728     1  0.4981    -0.2072 0.536 0.000 0.464 0.000
#> GSM509732     3  0.3311     0.7506 0.172 0.000 0.828 0.000
#> GSM509736     3  0.1389     0.7680 0.048 0.000 0.952 0.000
#> GSM509741     3  0.1211     0.7754 0.040 0.000 0.960 0.000
#> GSM509746     3  0.3356     0.7498 0.176 0.000 0.824 0.000
#> GSM509733     3  0.3311     0.7506 0.172 0.000 0.828 0.000
#> GSM509737     3  0.1389     0.7680 0.048 0.000 0.952 0.000
#> GSM509742     3  0.1022     0.7737 0.032 0.000 0.968 0.000
#> GSM509747     3  0.3311     0.7506 0.172 0.000 0.828 0.000
#> GSM509734     3  0.3311     0.7506 0.172 0.000 0.828 0.000
#> GSM509738     3  0.3142     0.7264 0.132 0.000 0.860 0.008
#> GSM509743     3  0.1389     0.7680 0.048 0.000 0.952 0.000
#> GSM509748     3  0.1940     0.7734 0.076 0.000 0.924 0.000
#> GSM509735     1  0.3494     0.4886 0.824 0.000 0.172 0.004
#> GSM509739     1  0.5000    -0.0986 0.504 0.000 0.496 0.000
#> GSM509744     3  0.1389     0.7680 0.048 0.000 0.952 0.000
#> GSM509749     3  0.4072     0.7000 0.252 0.000 0.748 0.000
#> GSM509740     3  0.3142     0.7222 0.132 0.000 0.860 0.008
#> GSM509745     3  0.2760     0.7313 0.128 0.000 0.872 0.000
#> GSM509750     3  0.5252     0.6158 0.336 0.020 0.644 0.000
#> GSM509751     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0336     0.7849 0.000 0.992 0.000 0.008
#> GSM509763     2  0.4331     0.3417 0.000 0.712 0.000 0.288
#> GSM509765     4  0.4134     0.7683 0.000 0.260 0.000 0.740
#> GSM509767     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0336     0.7856 0.000 0.992 0.000 0.008
#> GSM509771     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509773     2  0.1716     0.7327 0.000 0.936 0.000 0.064
#> GSM509775     2  0.1118     0.7653 0.000 0.964 0.000 0.036
#> GSM509777     4  0.3649     0.8074 0.000 0.204 0.000 0.796
#> GSM509779     4  0.3356     0.8186 0.000 0.176 0.000 0.824
#> GSM509781     4  0.3172     0.8193 0.000 0.160 0.000 0.840
#> GSM509783     4  0.3172     0.8193 0.000 0.160 0.000 0.840
#> GSM509785     4  0.3172     0.8193 0.000 0.160 0.000 0.840
#> GSM509752     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0469     0.7815 0.000 0.988 0.000 0.012
#> GSM509758     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509760     2  0.2530     0.6632 0.000 0.888 0.000 0.112
#> GSM509762     2  0.0188     0.7870 0.000 0.996 0.000 0.004
#> GSM509764     2  0.4500     0.4436 0.000 0.684 0.316 0.000
#> GSM509766     4  0.4855     0.5950 0.000 0.400 0.000 0.600
#> GSM509768     2  0.4643     0.1504 0.000 0.656 0.000 0.344
#> GSM509770     2  0.0336     0.7857 0.000 0.992 0.000 0.008
#> GSM509772     2  0.0000     0.7890 0.000 1.000 0.000 0.000
#> GSM509774     4  0.3356     0.8186 0.000 0.176 0.000 0.824
#> GSM509776     4  0.4855     0.5981 0.000 0.400 0.000 0.600
#> GSM509778     4  0.3172     0.8193 0.000 0.160 0.000 0.840
#> GSM509780     4  0.4866     0.5934 0.000 0.404 0.000 0.596
#> GSM509782     4  0.3219     0.8196 0.000 0.164 0.000 0.836
#> GSM509784     4  0.3486     0.8150 0.000 0.188 0.000 0.812
#> GSM509786     4  0.3356     0.8186 0.000 0.176 0.000 0.824

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0798    0.59070 0.976 0.000 0.016 0.000 0.008
#> GSM509711     5  0.3388    0.69889 0.200 0.000 0.000 0.008 0.792
#> GSM509714     5  0.1822    0.86256 0.004 0.024 0.000 0.036 0.936
#> GSM509719     5  0.2230    0.86831 0.000 0.116 0.000 0.000 0.884
#> GSM509724     1  0.0404    0.58821 0.988 0.000 0.012 0.000 0.000
#> GSM509729     5  0.2945    0.86605 0.056 0.056 0.008 0.000 0.880
#> GSM509707     1  0.2707    0.56494 0.860 0.000 0.132 0.000 0.008
#> GSM509712     5  0.3142    0.85150 0.056 0.068 0.000 0.008 0.868
#> GSM509715     4  0.4744    0.24815 0.000 0.020 0.000 0.572 0.408
#> GSM509720     5  0.1671    0.88780 0.000 0.076 0.000 0.000 0.924
#> GSM509725     1  0.0290    0.58278 0.992 0.000 0.008 0.000 0.000
#> GSM509730     5  0.2604    0.88082 0.020 0.072 0.012 0.000 0.896
#> GSM509708     1  0.4294   -0.00366 0.532 0.000 0.000 0.000 0.468
#> GSM509713     1  0.5345    0.27113 0.540 0.000 0.056 0.000 0.404
#> GSM509716     5  0.2773    0.81226 0.000 0.020 0.000 0.112 0.868
#> GSM509721     5  0.2179    0.87217 0.000 0.112 0.000 0.000 0.888
#> GSM509726     1  0.5382    0.40746 0.592 0.000 0.336 0.000 0.072
#> GSM509731     4  0.3612    0.57323 0.000 0.000 0.000 0.732 0.268
#> GSM509709     1  0.4310    0.21589 0.604 0.000 0.004 0.000 0.392
#> GSM509717     5  0.4284    0.66451 0.000 0.040 0.000 0.224 0.736
#> GSM509722     5  0.1608    0.88775 0.000 0.072 0.000 0.000 0.928
#> GSM509727     1  0.3669    0.54522 0.816 0.000 0.056 0.000 0.128
#> GSM509710     1  0.4305    0.18869 0.512 0.000 0.488 0.000 0.000
#> GSM509718     3  0.6289    0.24963 0.020 0.056 0.592 0.304 0.028
#> GSM509723     5  0.1908    0.88469 0.000 0.092 0.000 0.000 0.908
#> GSM509728     1  0.4036    0.48689 0.788 0.000 0.144 0.000 0.068
#> GSM509732     3  0.5250    0.44473 0.416 0.000 0.536 0.000 0.048
#> GSM509736     3  0.1478    0.60743 0.064 0.000 0.936 0.000 0.000
#> GSM509741     3  0.3289    0.60914 0.108 0.000 0.844 0.000 0.048
#> GSM509746     3  0.5365    0.43792 0.416 0.000 0.528 0.000 0.056
#> GSM509733     3  0.5250    0.44473 0.416 0.000 0.536 0.000 0.048
#> GSM509737     3  0.1478    0.60743 0.064 0.000 0.936 0.000 0.000
#> GSM509742     3  0.2645    0.61477 0.068 0.000 0.888 0.000 0.044
#> GSM509747     3  0.5250    0.44473 0.416 0.000 0.536 0.000 0.048
#> GSM509734     3  0.5250    0.44473 0.416 0.000 0.536 0.000 0.048
#> GSM509738     3  0.3569    0.54009 0.068 0.000 0.828 0.000 0.104
#> GSM509743     3  0.1478    0.60743 0.064 0.000 0.936 0.000 0.000
#> GSM509748     3  0.3835    0.59409 0.156 0.000 0.796 0.000 0.048
#> GSM509735     1  0.2770    0.56785 0.880 0.000 0.044 0.000 0.076
#> GSM509739     1  0.5452    0.26646 0.492 0.000 0.448 0.000 0.060
#> GSM509744     3  0.1478    0.60743 0.064 0.000 0.936 0.000 0.000
#> GSM509749     3  0.6028    0.36281 0.416 0.000 0.468 0.000 0.116
#> GSM509740     3  0.3861    0.51031 0.068 0.000 0.804 0.000 0.128
#> GSM509745     3  0.3056    0.56374 0.068 0.000 0.864 0.000 0.068
#> GSM509750     1  0.5985   -0.32552 0.480 0.000 0.408 0.000 0.112
#> GSM509751     2  0.0000    0.91439 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000    0.91439 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000    0.91439 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0290    0.91477 0.000 0.992 0.000 0.008 0.000
#> GSM509759     2  0.0000    0.91439 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0880    0.90649 0.000 0.968 0.000 0.032 0.000
#> GSM509763     2  0.4161    0.30792 0.000 0.608 0.000 0.392 0.000
#> GSM509765     4  0.2852    0.77042 0.000 0.172 0.000 0.828 0.000
#> GSM509767     2  0.0000    0.91439 0.000 1.000 0.000 0.000 0.000
#> GSM509769     2  0.1608    0.88297 0.000 0.928 0.000 0.072 0.000
#> GSM509771     2  0.0404    0.91413 0.000 0.988 0.000 0.012 0.000
#> GSM509773     2  0.2280    0.84278 0.000 0.880 0.000 0.120 0.000
#> GSM509775     2  0.2377    0.83024 0.000 0.872 0.000 0.128 0.000
#> GSM509777     4  0.1792    0.83275 0.000 0.084 0.000 0.916 0.000
#> GSM509779     4  0.0510    0.85693 0.000 0.016 0.000 0.984 0.000
#> GSM509781     4  0.0404    0.85430 0.000 0.012 0.000 0.988 0.000
#> GSM509783     4  0.0510    0.85693 0.000 0.016 0.000 0.984 0.000
#> GSM509785     4  0.0290    0.85091 0.000 0.008 0.000 0.992 0.000
#> GSM509752     2  0.0162    0.91511 0.000 0.996 0.000 0.004 0.000
#> GSM509754     2  0.0162    0.91490 0.000 0.996 0.000 0.004 0.000
#> GSM509756     2  0.0290    0.91482 0.000 0.992 0.000 0.008 0.000
#> GSM509758     2  0.0290    0.91488 0.000 0.992 0.000 0.008 0.000
#> GSM509760     2  0.1732    0.87035 0.000 0.920 0.000 0.080 0.000
#> GSM509762     2  0.0162    0.91511 0.000 0.996 0.000 0.004 0.000
#> GSM509764     2  0.3039    0.73068 0.000 0.808 0.192 0.000 0.000
#> GSM509766     4  0.3932    0.54764 0.000 0.328 0.000 0.672 0.000
#> GSM509768     2  0.4294    0.04307 0.000 0.532 0.000 0.468 0.000
#> GSM509770     2  0.1270    0.89568 0.000 0.948 0.000 0.052 0.000
#> GSM509772     2  0.0000    0.91439 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.0609    0.85671 0.000 0.020 0.000 0.980 0.000
#> GSM509776     4  0.3816    0.59985 0.000 0.304 0.000 0.696 0.000
#> GSM509778     4  0.0510    0.85693 0.000 0.016 0.000 0.984 0.000
#> GSM509780     4  0.3857    0.57466 0.000 0.312 0.000 0.688 0.000
#> GSM509782     4  0.0510    0.85693 0.000 0.016 0.000 0.984 0.000
#> GSM509784     4  0.0794    0.85509 0.000 0.028 0.000 0.972 0.000
#> GSM509786     4  0.0510    0.85693 0.000 0.016 0.000 0.984 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
#> GSM509706     1  0.0260   0.819514 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM509711     5  0.4281   0.742393 0.132 0.000 0.000 0.000 0.732 0.136
#> GSM509714     5  0.3023   0.809700 0.008 0.000 0.000 0.004 0.808 0.180
#> GSM509719     5  0.0632   0.867763 0.000 0.024 0.000 0.000 0.976 0.000
#> GSM509724     1  0.1124   0.794958 0.956 0.000 0.036 0.000 0.000 0.008
#> GSM509729     5  0.0767   0.869139 0.008 0.004 0.012 0.000 0.976 0.000
#> GSM509707     1  0.0260   0.819514 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM509712     5  0.4619   0.749795 0.048 0.052 0.000 0.000 0.732 0.168
#> GSM509715     4  0.6776  -0.033460 0.008 0.028 0.000 0.404 0.312 0.248
#> GSM509720     5  0.0405   0.872801 0.000 0.008 0.000 0.000 0.988 0.004
#> GSM509725     3  0.4407   0.129005 0.484 0.000 0.492 0.000 0.000 0.024
#> GSM509730     5  0.1053   0.864298 0.000 0.012 0.020 0.000 0.964 0.004
#> GSM509708     1  0.0000   0.817161 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.6963   0.104783 0.396 0.000 0.116 0.000 0.360 0.128
#> GSM509716     5  0.3900   0.787884 0.008 0.004 0.000 0.032 0.760 0.196
#> GSM509721     5  0.0692   0.869410 0.000 0.020 0.000 0.000 0.976 0.004
#> GSM509726     3  0.6112   0.250806 0.300 0.000 0.368 0.000 0.000 0.332
#> GSM509731     4  0.4851   0.552177 0.008 0.000 0.000 0.672 0.100 0.220
#> GSM509709     1  0.0291   0.819019 0.992 0.000 0.004 0.000 0.004 0.000
#> GSM509717     5  0.5932   0.631055 0.008 0.032 0.000 0.120 0.588 0.252
#> GSM509722     5  0.0260   0.873059 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM509727     3  0.5796   0.417746 0.296 0.000 0.564 0.000 0.036 0.104
#> GSM509710     1  0.3468   0.527643 0.712 0.000 0.004 0.000 0.000 0.284
#> GSM509718     6  0.4783   0.445610 0.000 0.020 0.072 0.184 0.008 0.716
#> GSM509723     5  0.0260   0.873059 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM509728     3  0.5348   0.471251 0.272 0.000 0.576 0.000 0.000 0.152
#> GSM509732     3  0.0458   0.612013 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM509736     6  0.3266   0.761810 0.000 0.000 0.272 0.000 0.000 0.728
#> GSM509741     6  0.3860   0.566013 0.000 0.000 0.472 0.000 0.000 0.528
#> GSM509746     3  0.0146   0.621648 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM509733     3  0.0713   0.603009 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM509737     6  0.3266   0.761810 0.000 0.000 0.272 0.000 0.000 0.728
#> GSM509742     6  0.3864   0.553712 0.000 0.000 0.480 0.000 0.000 0.520
#> GSM509747     3  0.0000   0.620599 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.0000   0.620599 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509738     6  0.3602   0.716073 0.000 0.000 0.208 0.000 0.032 0.760
#> GSM509743     6  0.3330   0.759131 0.000 0.000 0.284 0.000 0.000 0.716
#> GSM509748     3  0.3737  -0.397811 0.000 0.000 0.608 0.000 0.000 0.392
#> GSM509735     3  0.5766   0.401853 0.292 0.000 0.520 0.000 0.004 0.184
#> GSM509739     6  0.4084   0.060472 0.400 0.000 0.012 0.000 0.000 0.588
#> GSM509744     6  0.3330   0.759131 0.000 0.000 0.284 0.000 0.000 0.716
#> GSM509749     3  0.1501   0.615054 0.000 0.000 0.924 0.000 0.000 0.076
#> GSM509740     6  0.3377   0.726292 0.000 0.000 0.188 0.000 0.028 0.784
#> GSM509745     6  0.3109   0.724766 0.004 0.000 0.224 0.000 0.000 0.772
#> GSM509750     3  0.3384   0.519374 0.004 0.000 0.760 0.000 0.008 0.228
#> GSM509751     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0260   0.907041 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509759     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509761     2  0.0865   0.896735 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM509763     2  0.3804   0.221560 0.000 0.576 0.000 0.424 0.000 0.000
#> GSM509765     4  0.2597   0.746622 0.000 0.176 0.000 0.824 0.000 0.000
#> GSM509767     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509769     2  0.1610   0.866964 0.000 0.916 0.000 0.084 0.000 0.000
#> GSM509771     2  0.0547   0.903499 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM509773     2  0.2092   0.832524 0.000 0.876 0.000 0.124 0.000 0.000
#> GSM509775     2  0.2178   0.819866 0.000 0.868 0.000 0.132 0.000 0.000
#> GSM509777     4  0.1556   0.808109 0.000 0.080 0.000 0.920 0.000 0.000
#> GSM509779     4  0.0146   0.836401 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509781     4  0.0146   0.836401 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509783     4  0.0146   0.836401 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509785     4  0.0000   0.833031 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509752     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0146   0.907595 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509758     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509760     2  0.1327   0.876660 0.000 0.936 0.000 0.064 0.000 0.000
#> GSM509762     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509764     2  0.3920   0.607730 0.000 0.736 0.048 0.000 0.000 0.216
#> GSM509766     4  0.3531   0.526826 0.000 0.328 0.000 0.672 0.000 0.000
#> GSM509768     2  0.3866   0.000598 0.000 0.516 0.000 0.484 0.000 0.000
#> GSM509770     2  0.1267   0.884161 0.000 0.940 0.000 0.060 0.000 0.000
#> GSM509772     2  0.0000   0.908524 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509774     4  0.0260   0.836108 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM509776     4  0.3428   0.573791 0.000 0.304 0.000 0.696 0.000 0.000
#> GSM509778     4  0.0146   0.836401 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509780     4  0.3446   0.559679 0.000 0.308 0.000 0.692 0.000 0.000
#> GSM509782     4  0.0146   0.836401 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509784     4  0.0458   0.834372 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM509786     4  0.0146   0.836401 0.000 0.004 0.000 0.996 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)  time(p) k
#> CV:pam 74         3.66e-13 6.07e-10 2
#> CV:pam 49         2.29e-11 7.46e-09 3
#> CV:pam 58         6.50e-21 1.04e-06 4
#> CV:pam 63         7.92e-21 1.07e-06 5
#> CV:pam 69         1.30e-23 5.06e-05 6

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


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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.860           0.978       0.988         0.4938 0.503   0.503
#> 3 3 0.621           0.812       0.879         0.3000 0.832   0.673
#> 4 4 0.782           0.851       0.908         0.0938 0.941   0.837
#> 5 5 0.681           0.701       0.798         0.0763 0.917   0.735
#> 6 6 0.667           0.715       0.765         0.0434 0.958   0.827

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1  0.0000      0.995 1.000 0.000
#> GSM509711     1  0.0000      0.995 1.000 0.000
#> GSM509714     1  0.0376      0.993 0.996 0.004
#> GSM509719     1  0.0376      0.993 0.996 0.004
#> GSM509724     1  0.0000      0.995 1.000 0.000
#> GSM509729     1  0.0376      0.993 0.996 0.004
#> GSM509707     1  0.0000      0.995 1.000 0.000
#> GSM509712     1  0.0000      0.995 1.000 0.000
#> GSM509715     1  0.0376      0.993 0.996 0.004
#> GSM509720     1  0.0376      0.993 0.996 0.004
#> GSM509725     1  0.0000      0.995 1.000 0.000
#> GSM509730     1  0.0376      0.993 0.996 0.004
#> GSM509708     1  0.0000      0.995 1.000 0.000
#> GSM509713     1  0.0000      0.995 1.000 0.000
#> GSM509716     1  0.0376      0.993 0.996 0.004
#> GSM509721     1  0.0376      0.993 0.996 0.004
#> GSM509726     1  0.0000      0.995 1.000 0.000
#> GSM509731     1  0.0376      0.993 0.996 0.004
#> GSM509709     1  0.0000      0.995 1.000 0.000
#> GSM509717     1  0.0376      0.993 0.996 0.004
#> GSM509722     1  0.0376      0.993 0.996 0.004
#> GSM509727     1  0.0000      0.995 1.000 0.000
#> GSM509710     1  0.0000      0.995 1.000 0.000
#> GSM509718     1  0.0376      0.993 0.996 0.004
#> GSM509723     1  0.0376      0.993 0.996 0.004
#> GSM509728     1  0.0000      0.995 1.000 0.000
#> GSM509732     1  0.0000      0.995 1.000 0.000
#> GSM509736     1  0.0000      0.995 1.000 0.000
#> GSM509741     1  0.0000      0.995 1.000 0.000
#> GSM509746     1  0.0000      0.995 1.000 0.000
#> GSM509733     1  0.0000      0.995 1.000 0.000
#> GSM509737     1  0.0000      0.995 1.000 0.000
#> GSM509742     1  0.0000      0.995 1.000 0.000
#> GSM509747     1  0.0000      0.995 1.000 0.000
#> GSM509734     1  0.0000      0.995 1.000 0.000
#> GSM509738     1  0.0000      0.995 1.000 0.000
#> GSM509743     1  0.0000      0.995 1.000 0.000
#> GSM509748     1  0.0000      0.995 1.000 0.000
#> GSM509735     1  0.0000      0.995 1.000 0.000
#> GSM509739     1  0.0000      0.995 1.000 0.000
#> GSM509744     1  0.0000      0.995 1.000 0.000
#> GSM509749     1  0.0000      0.995 1.000 0.000
#> GSM509740     1  0.0000      0.995 1.000 0.000
#> GSM509745     1  0.0000      0.995 1.000 0.000
#> GSM509750     1  0.0000      0.995 1.000 0.000
#> GSM509751     2  0.0000      0.978 0.000 1.000
#> GSM509753     2  0.0000      0.978 0.000 1.000
#> GSM509755     2  0.0000      0.978 0.000 1.000
#> GSM509757     2  0.0000      0.978 0.000 1.000
#> GSM509759     2  0.0000      0.978 0.000 1.000
#> GSM509761     2  0.0000      0.978 0.000 1.000
#> GSM509763     2  0.0000      0.978 0.000 1.000
#> GSM509765     2  0.0000      0.978 0.000 1.000
#> GSM509767     2  0.0000      0.978 0.000 1.000
#> GSM509769     2  0.0000      0.978 0.000 1.000
#> GSM509771     2  0.0000      0.978 0.000 1.000
#> GSM509773     2  0.0000      0.978 0.000 1.000
#> GSM509775     2  0.0000      0.978 0.000 1.000
#> GSM509777     2  0.0000      0.978 0.000 1.000
#> GSM509779     2  0.0000      0.978 0.000 1.000
#> GSM509781     2  0.4690      0.908 0.100 0.900
#> GSM509783     2  0.4690      0.908 0.100 0.900
#> GSM509785     2  0.4690      0.908 0.100 0.900
#> GSM509752     2  0.0000      0.978 0.000 1.000
#> GSM509754     2  0.0000      0.978 0.000 1.000
#> GSM509756     2  0.0000      0.978 0.000 1.000
#> GSM509758     2  0.0000      0.978 0.000 1.000
#> GSM509760     2  0.0000      0.978 0.000 1.000
#> GSM509762     2  0.0000      0.978 0.000 1.000
#> GSM509764     1  0.6801      0.774 0.820 0.180
#> GSM509766     2  0.0000      0.978 0.000 1.000
#> GSM509768     2  0.0000      0.978 0.000 1.000
#> GSM509770     2  0.0000      0.978 0.000 1.000
#> GSM509772     2  0.0000      0.978 0.000 1.000
#> GSM509774     2  0.4690      0.908 0.100 0.900
#> GSM509776     2  0.0000      0.978 0.000 1.000
#> GSM509778     2  0.4690      0.908 0.100 0.900
#> GSM509780     2  0.0000      0.978 0.000 1.000
#> GSM509782     2  0.5178      0.891 0.116 0.884
#> GSM509784     2  0.1414      0.966 0.020 0.980
#> GSM509786     2  0.4690      0.908 0.100 0.900

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1  0.1964     0.7922 0.944 0.000 0.056
#> GSM509711     1  0.2066     0.7919 0.940 0.000 0.060
#> GSM509714     1  0.3112     0.7564 0.900 0.004 0.096
#> GSM509719     1  0.6228     0.3232 0.624 0.004 0.372
#> GSM509724     1  0.2066     0.7918 0.940 0.000 0.060
#> GSM509729     1  0.3349     0.7476 0.888 0.004 0.108
#> GSM509707     1  0.1964     0.7922 0.944 0.000 0.056
#> GSM509712     1  0.1753     0.7866 0.952 0.000 0.048
#> GSM509715     1  0.3500     0.7517 0.880 0.004 0.116
#> GSM509720     1  0.6228     0.3232 0.624 0.004 0.372
#> GSM509725     1  0.2448     0.7915 0.924 0.000 0.076
#> GSM509730     1  0.6264     0.3244 0.616 0.004 0.380
#> GSM509708     1  0.1964     0.7922 0.944 0.000 0.056
#> GSM509713     1  0.2537     0.7907 0.920 0.000 0.080
#> GSM509716     1  0.3500     0.7517 0.880 0.004 0.116
#> GSM509721     1  0.6228     0.3232 0.624 0.004 0.372
#> GSM509726     1  0.2537     0.7907 0.920 0.000 0.080
#> GSM509731     1  0.3500     0.7517 0.880 0.004 0.116
#> GSM509709     1  0.1964     0.7922 0.944 0.000 0.056
#> GSM509717     1  0.3500     0.7517 0.880 0.004 0.116
#> GSM509722     1  0.6228     0.3232 0.624 0.004 0.372
#> GSM509727     1  0.5397     0.5415 0.720 0.000 0.280
#> GSM509710     1  0.2625     0.7916 0.916 0.000 0.084
#> GSM509718     1  0.2711     0.7647 0.912 0.000 0.088
#> GSM509723     1  0.6228     0.3232 0.624 0.004 0.372
#> GSM509728     1  0.5397     0.5434 0.720 0.000 0.280
#> GSM509732     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509736     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509741     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509746     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509733     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509737     3  0.3551     0.9550 0.132 0.000 0.868
#> GSM509742     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509747     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509734     3  0.5216     0.7731 0.260 0.000 0.740
#> GSM509738     3  0.3941     0.9307 0.156 0.000 0.844
#> GSM509743     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509748     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509735     1  0.2066     0.7918 0.940 0.000 0.060
#> GSM509739     1  0.2537     0.7907 0.920 0.000 0.080
#> GSM509744     3  0.3551     0.9550 0.132 0.000 0.868
#> GSM509749     3  0.3482     0.9571 0.128 0.000 0.872
#> GSM509740     1  0.6309    -0.0843 0.504 0.000 0.496
#> GSM509745     3  0.5859     0.5586 0.344 0.000 0.656
#> GSM509750     3  0.4002     0.9258 0.160 0.000 0.840
#> GSM509751     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509753     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509755     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509757     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509759     2  0.0237     0.9445 0.000 0.996 0.004
#> GSM509761     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509763     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509765     2  0.0237     0.9450 0.000 0.996 0.004
#> GSM509767     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509769     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509771     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509773     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509775     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509777     2  0.1753     0.9273 0.000 0.952 0.048
#> GSM509779     2  0.2959     0.9033 0.000 0.900 0.100
#> GSM509781     2  0.6486     0.7961 0.096 0.760 0.144
#> GSM509783     2  0.8408     0.5749 0.244 0.612 0.144
#> GSM509785     2  0.6975     0.7635 0.124 0.732 0.144
#> GSM509752     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509754     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509756     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509758     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509760     2  0.0424     0.9442 0.000 0.992 0.008
#> GSM509762     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509764     2  0.3713     0.8639 0.076 0.892 0.032
#> GSM509766     2  0.0237     0.9450 0.000 0.996 0.004
#> GSM509768     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509770     2  0.0237     0.9445 0.000 0.996 0.004
#> GSM509772     2  0.0237     0.9445 0.000 0.996 0.004
#> GSM509774     2  0.3267     0.8943 0.000 0.884 0.116
#> GSM509776     2  0.0000     0.9458 0.000 1.000 0.000
#> GSM509778     2  0.6634     0.7873 0.104 0.752 0.144
#> GSM509780     2  0.0237     0.9450 0.000 0.996 0.004
#> GSM509782     2  0.7163     0.7481 0.136 0.720 0.144
#> GSM509784     2  0.3528     0.8994 0.016 0.892 0.092
#> GSM509786     2  0.6486     0.7961 0.096 0.760 0.144

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.4904      0.671 0.744 0.000 0.040 0.216
#> GSM509711     4  0.5420      0.771 0.272 0.000 0.044 0.684
#> GSM509714     4  0.4955      0.798 0.268 0.000 0.024 0.708
#> GSM509719     1  0.0000      0.838 1.000 0.000 0.000 0.000
#> GSM509724     1  0.2036      0.854 0.936 0.000 0.032 0.032
#> GSM509729     1  0.2224      0.849 0.928 0.000 0.032 0.040
#> GSM509707     1  0.3372      0.815 0.868 0.000 0.036 0.096
#> GSM509712     1  0.5807      0.403 0.612 0.000 0.044 0.344
#> GSM509715     4  0.3196      0.885 0.136 0.000 0.008 0.856
#> GSM509720     1  0.0000      0.838 1.000 0.000 0.000 0.000
#> GSM509725     1  0.2214      0.851 0.928 0.000 0.044 0.028
#> GSM509730     1  0.1209      0.851 0.964 0.000 0.032 0.004
#> GSM509708     1  0.3279      0.816 0.872 0.000 0.032 0.096
#> GSM509713     1  0.5830      0.432 0.620 0.000 0.048 0.332
#> GSM509716     4  0.3401      0.885 0.152 0.000 0.008 0.840
#> GSM509721     1  0.0000      0.838 1.000 0.000 0.000 0.000
#> GSM509726     1  0.2483      0.847 0.916 0.000 0.052 0.032
#> GSM509731     4  0.3196      0.885 0.136 0.000 0.008 0.856
#> GSM509709     1  0.3372      0.815 0.868 0.000 0.036 0.096
#> GSM509717     4  0.3196      0.885 0.136 0.000 0.008 0.856
#> GSM509722     1  0.0000      0.838 1.000 0.000 0.000 0.000
#> GSM509727     1  0.6005      0.453 0.616 0.000 0.324 0.060
#> GSM509710     1  0.2214      0.851 0.928 0.000 0.044 0.028
#> GSM509718     4  0.5457      0.811 0.184 0.000 0.088 0.728
#> GSM509723     1  0.0000      0.838 1.000 0.000 0.000 0.000
#> GSM509728     1  0.5172      0.587 0.704 0.000 0.260 0.036
#> GSM509732     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509736     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509741     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509737     3  0.0188      0.935 0.004 0.000 0.996 0.000
#> GSM509742     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509734     3  0.3300      0.801 0.144 0.000 0.848 0.008
#> GSM509738     3  0.1970      0.892 0.060 0.000 0.932 0.008
#> GSM509743     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509735     1  0.2131      0.852 0.932 0.000 0.036 0.032
#> GSM509739     1  0.2300      0.850 0.924 0.000 0.048 0.028
#> GSM509744     3  0.0376      0.933 0.004 0.000 0.992 0.004
#> GSM509749     3  0.0000      0.936 0.000 0.000 1.000 0.000
#> GSM509740     3  0.3852      0.748 0.180 0.000 0.808 0.012
#> GSM509745     3  0.2676      0.859 0.092 0.000 0.896 0.012
#> GSM509750     3  0.4360      0.642 0.248 0.000 0.744 0.008
#> GSM509751     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0336      0.931 0.000 0.992 0.000 0.008
#> GSM509755     2  0.1022      0.923 0.000 0.968 0.000 0.032
#> GSM509757     2  0.0921      0.925 0.000 0.972 0.000 0.028
#> GSM509759     2  0.1305      0.920 0.004 0.960 0.000 0.036
#> GSM509761     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509765     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509767     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509775     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509777     2  0.0817      0.925 0.000 0.976 0.000 0.024
#> GSM509779     2  0.2704      0.871 0.000 0.876 0.000 0.124
#> GSM509781     2  0.4193      0.746 0.000 0.732 0.000 0.268
#> GSM509783     2  0.4830      0.560 0.000 0.608 0.000 0.392
#> GSM509785     2  0.4331      0.723 0.000 0.712 0.000 0.288
#> GSM509752     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0707      0.928 0.000 0.980 0.000 0.020
#> GSM509758     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0921      0.925 0.000 0.972 0.000 0.028
#> GSM509762     2  0.0469      0.930 0.000 0.988 0.000 0.012
#> GSM509764     2  0.3295      0.867 0.008 0.884 0.072 0.036
#> GSM509766     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509768     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509770     2  0.0921      0.925 0.000 0.972 0.000 0.028
#> GSM509772     2  0.1118      0.921 0.000 0.964 0.000 0.036
#> GSM509774     2  0.2345      0.887 0.000 0.900 0.000 0.100
#> GSM509776     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509778     2  0.4193      0.746 0.000 0.732 0.000 0.268
#> GSM509780     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM509782     2  0.4564      0.668 0.000 0.672 0.000 0.328
#> GSM509784     2  0.2408      0.884 0.000 0.896 0.000 0.104
#> GSM509786     2  0.4250      0.737 0.000 0.724 0.000 0.276

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.3059     0.5481 0.860 0.000 0.028 0.004 0.108
#> GSM509711     1  0.5134    -0.0784 0.664 0.000 0.020 0.036 0.280
#> GSM509714     5  0.5161     0.8555 0.432 0.000 0.004 0.032 0.532
#> GSM509719     1  0.4730     0.1757 0.568 0.000 0.004 0.012 0.416
#> GSM509724     1  0.1808     0.6027 0.936 0.000 0.044 0.008 0.012
#> GSM509729     1  0.4240     0.2191 0.684 0.000 0.004 0.008 0.304
#> GSM509707     1  0.2846     0.5858 0.884 0.000 0.028 0.012 0.076
#> GSM509712     1  0.5269    -0.1976 0.608 0.000 0.028 0.020 0.344
#> GSM509715     5  0.5591     0.9322 0.396 0.000 0.000 0.076 0.528
#> GSM509720     1  0.4730     0.1757 0.568 0.000 0.004 0.012 0.416
#> GSM509725     1  0.1197     0.6021 0.952 0.000 0.048 0.000 0.000
#> GSM509730     1  0.4502     0.2038 0.668 0.000 0.012 0.008 0.312
#> GSM509708     1  0.2727     0.5804 0.888 0.000 0.020 0.012 0.080
#> GSM509713     1  0.4251     0.3636 0.784 0.000 0.028 0.028 0.160
#> GSM509716     5  0.5550     0.9294 0.400 0.000 0.000 0.072 0.528
#> GSM509721     1  0.4722     0.1750 0.572 0.000 0.004 0.012 0.412
#> GSM509726     1  0.1557     0.5978 0.940 0.000 0.052 0.000 0.008
#> GSM509731     5  0.5591     0.9322 0.396 0.000 0.000 0.076 0.528
#> GSM509709     1  0.2727     0.5803 0.888 0.000 0.020 0.012 0.080
#> GSM509717     5  0.5591     0.9322 0.396 0.000 0.000 0.076 0.528
#> GSM509722     1  0.4730     0.1757 0.568 0.000 0.004 0.012 0.416
#> GSM509727     1  0.3934     0.4443 0.796 0.000 0.160 0.008 0.036
#> GSM509710     1  0.1270     0.6011 0.948 0.000 0.052 0.000 0.000
#> GSM509718     5  0.6617     0.7817 0.392 0.000 0.084 0.044 0.480
#> GSM509723     1  0.4730     0.1757 0.568 0.000 0.004 0.012 0.416
#> GSM509728     1  0.3183     0.4796 0.828 0.000 0.156 0.000 0.016
#> GSM509732     3  0.1836     0.8694 0.036 0.000 0.932 0.000 0.032
#> GSM509736     3  0.0290     0.8664 0.008 0.000 0.992 0.000 0.000
#> GSM509741     3  0.0324     0.8651 0.004 0.000 0.992 0.000 0.004
#> GSM509746     3  0.1918     0.8686 0.036 0.000 0.928 0.000 0.036
#> GSM509733     3  0.1836     0.8694 0.036 0.000 0.932 0.000 0.032
#> GSM509737     3  0.0290     0.8664 0.008 0.000 0.992 0.000 0.000
#> GSM509742     3  0.0324     0.8651 0.004 0.000 0.992 0.000 0.004
#> GSM509747     3  0.2078     0.8675 0.036 0.000 0.924 0.004 0.036
#> GSM509734     3  0.2787     0.8151 0.136 0.000 0.856 0.004 0.004
#> GSM509738     3  0.3766     0.6084 0.268 0.000 0.728 0.000 0.004
#> GSM509743     3  0.0324     0.8651 0.004 0.000 0.992 0.000 0.004
#> GSM509748     3  0.1836     0.8688 0.036 0.000 0.932 0.000 0.032
#> GSM509735     1  0.1357     0.6016 0.948 0.000 0.048 0.000 0.004
#> GSM509739     1  0.1430     0.6000 0.944 0.000 0.052 0.000 0.004
#> GSM509744     3  0.0451     0.8659 0.008 0.000 0.988 0.000 0.004
#> GSM509749     3  0.2067     0.8664 0.048 0.000 0.920 0.000 0.032
#> GSM509740     3  0.4366     0.4995 0.320 0.000 0.664 0.000 0.016
#> GSM509745     3  0.3814     0.5966 0.276 0.000 0.720 0.000 0.004
#> GSM509750     3  0.4425     0.3810 0.392 0.000 0.600 0.000 0.008
#> GSM509751     2  0.2249     0.8519 0.000 0.896 0.000 0.008 0.096
#> GSM509753     2  0.2074     0.8524 0.000 0.896 0.000 0.000 0.104
#> GSM509755     2  0.2707     0.8420 0.000 0.876 0.000 0.024 0.100
#> GSM509757     2  0.2505     0.8491 0.000 0.888 0.000 0.020 0.092
#> GSM509759     2  0.3569     0.8008 0.000 0.828 0.000 0.068 0.104
#> GSM509761     2  0.1282     0.8709 0.000 0.952 0.000 0.004 0.044
#> GSM509763     2  0.2674     0.8229 0.000 0.856 0.000 0.004 0.140
#> GSM509765     2  0.3039     0.8120 0.000 0.836 0.000 0.012 0.152
#> GSM509767     2  0.1043     0.8755 0.000 0.960 0.000 0.000 0.040
#> GSM509769     2  0.0324     0.8776 0.000 0.992 0.000 0.004 0.004
#> GSM509771     2  0.1043     0.8755 0.000 0.960 0.000 0.000 0.040
#> GSM509773     2  0.1195     0.8736 0.000 0.960 0.000 0.012 0.028
#> GSM509775     2  0.1282     0.8709 0.000 0.952 0.000 0.004 0.044
#> GSM509777     2  0.4569     0.6942 0.000 0.748 0.000 0.104 0.148
#> GSM509779     4  0.5915     0.6673 0.000 0.324 0.000 0.552 0.124
#> GSM509781     4  0.2813     0.8793 0.000 0.168 0.000 0.832 0.000
#> GSM509783     4  0.4293     0.8416 0.028 0.156 0.000 0.784 0.032
#> GSM509785     4  0.2930     0.8766 0.000 0.164 0.000 0.832 0.004
#> GSM509752     2  0.1357     0.8749 0.000 0.948 0.000 0.004 0.048
#> GSM509754     2  0.1043     0.8755 0.000 0.960 0.000 0.000 0.040
#> GSM509756     2  0.1082     0.8771 0.000 0.964 0.000 0.008 0.028
#> GSM509758     2  0.0451     0.8775 0.000 0.988 0.000 0.008 0.004
#> GSM509760     2  0.2825     0.8345 0.000 0.860 0.000 0.016 0.124
#> GSM509762     2  0.1331     0.8744 0.000 0.952 0.000 0.008 0.040
#> GSM509764     2  0.6070     0.6021 0.048 0.672 0.016 0.200 0.064
#> GSM509766     2  0.2929     0.8113 0.000 0.840 0.000 0.008 0.152
#> GSM509768     2  0.2929     0.8113 0.000 0.840 0.000 0.008 0.152
#> GSM509770     2  0.0798     0.8783 0.000 0.976 0.000 0.016 0.008
#> GSM509772     2  0.3012     0.8306 0.000 0.860 0.000 0.036 0.104
#> GSM509774     4  0.5720     0.7481 0.000 0.276 0.000 0.600 0.124
#> GSM509776     2  0.2886     0.8131 0.000 0.844 0.000 0.008 0.148
#> GSM509778     4  0.2852     0.8782 0.000 0.172 0.000 0.828 0.000
#> GSM509780     2  0.3098     0.8066 0.000 0.836 0.000 0.016 0.148
#> GSM509782     4  0.3863     0.8512 0.000 0.152 0.000 0.796 0.052
#> GSM509784     4  0.5834     0.7317 0.000 0.284 0.000 0.584 0.132
#> GSM509786     4  0.2813     0.8793 0.000 0.168 0.000 0.832 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
#> GSM509706     1  0.4505      0.843 0.612 0.000 0.008 0.004 0.356 0.020
#> GSM509711     1  0.5674      0.674 0.536 0.000 0.004 0.012 0.340 0.108
#> GSM509714     5  0.4923      0.311 0.200 0.000 0.000 0.008 0.672 0.120
#> GSM509719     5  0.0260      0.624 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM509724     1  0.4410      0.867 0.640 0.000 0.008 0.004 0.328 0.020
#> GSM509729     5  0.3758      0.397 0.284 0.000 0.000 0.000 0.700 0.016
#> GSM509707     1  0.4344      0.802 0.568 0.000 0.008 0.000 0.412 0.012
#> GSM509712     5  0.5071      0.221 0.340 0.000 0.004 0.008 0.588 0.060
#> GSM509715     6  0.6659      1.000 0.336 0.000 0.000 0.028 0.292 0.344
#> GSM509720     5  0.0000      0.629 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509725     1  0.3634      0.875 0.696 0.000 0.008 0.000 0.296 0.000
#> GSM509730     5  0.3420      0.485 0.240 0.000 0.000 0.000 0.748 0.012
#> GSM509708     1  0.4158      0.799 0.572 0.000 0.004 0.000 0.416 0.008
#> GSM509713     1  0.4736      0.835 0.644 0.000 0.004 0.012 0.300 0.040
#> GSM509716     6  0.6659      1.000 0.336 0.000 0.000 0.028 0.292 0.344
#> GSM509721     5  0.0363      0.621 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM509726     1  0.3690      0.874 0.700 0.000 0.012 0.000 0.288 0.000
#> GSM509731     6  0.6659      1.000 0.336 0.000 0.000 0.028 0.292 0.344
#> GSM509709     1  0.4242      0.801 0.572 0.000 0.004 0.000 0.412 0.012
#> GSM509717     6  0.6659      1.000 0.336 0.000 0.000 0.028 0.292 0.344
#> GSM509722     5  0.0000      0.629 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509727     1  0.4405      0.842 0.688 0.000 0.036 0.004 0.264 0.008
#> GSM509710     1  0.3972      0.874 0.680 0.000 0.016 0.004 0.300 0.000
#> GSM509718     5  0.7316     -0.694 0.296 0.000 0.048 0.020 0.344 0.292
#> GSM509723     5  0.0000      0.629 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509728     1  0.4191      0.800 0.704 0.000 0.056 0.000 0.240 0.000
#> GSM509732     3  0.1391      0.757 0.040 0.000 0.944 0.000 0.000 0.016
#> GSM509736     3  0.4639      0.755 0.132 0.000 0.748 0.004 0.040 0.076
#> GSM509741     3  0.3605      0.753 0.108 0.000 0.804 0.004 0.000 0.084
#> GSM509746     3  0.1536      0.755 0.040 0.000 0.940 0.004 0.000 0.016
#> GSM509733     3  0.1367      0.760 0.044 0.000 0.944 0.000 0.000 0.012
#> GSM509737     3  0.4787      0.753 0.128 0.000 0.740 0.004 0.052 0.076
#> GSM509742     3  0.3605      0.753 0.108 0.000 0.804 0.004 0.000 0.084
#> GSM509747     3  0.1268      0.757 0.036 0.000 0.952 0.004 0.000 0.008
#> GSM509734     3  0.4340      0.664 0.200 0.000 0.712 0.000 0.088 0.000
#> GSM509738     3  0.5700      0.449 0.220 0.000 0.564 0.008 0.208 0.000
#> GSM509743     3  0.3649      0.754 0.112 0.000 0.800 0.004 0.000 0.084
#> GSM509748     3  0.1734      0.760 0.048 0.000 0.932 0.004 0.008 0.008
#> GSM509735     1  0.3595      0.874 0.704 0.000 0.008 0.000 0.288 0.000
#> GSM509739     1  0.3690      0.874 0.700 0.000 0.012 0.000 0.288 0.000
#> GSM509744     3  0.4715      0.754 0.140 0.000 0.740 0.004 0.040 0.076
#> GSM509749     3  0.2308      0.760 0.056 0.000 0.904 0.004 0.028 0.008
#> GSM509740     3  0.6013      0.260 0.260 0.000 0.496 0.008 0.236 0.000
#> GSM509745     3  0.5780      0.420 0.236 0.000 0.548 0.008 0.208 0.000
#> GSM509750     3  0.5757      0.401 0.244 0.000 0.536 0.004 0.216 0.000
#> GSM509751     2  0.3531      0.678 0.000 0.672 0.000 0.000 0.000 0.328
#> GSM509753     2  0.3647      0.656 0.000 0.640 0.000 0.000 0.000 0.360
#> GSM509755     2  0.3807      0.649 0.000 0.628 0.000 0.004 0.000 0.368
#> GSM509757     2  0.3795      0.652 0.000 0.632 0.000 0.004 0.000 0.364
#> GSM509759     2  0.4964      0.569 0.000 0.540 0.000 0.072 0.000 0.388
#> GSM509761     2  0.0935      0.789 0.000 0.964 0.000 0.004 0.000 0.032
#> GSM509763     2  0.2520      0.736 0.000 0.844 0.000 0.004 0.000 0.152
#> GSM509765     2  0.3017      0.718 0.000 0.816 0.000 0.020 0.000 0.164
#> GSM509767     2  0.1387      0.792 0.000 0.932 0.000 0.000 0.000 0.068
#> GSM509769     2  0.0260      0.791 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM509771     2  0.1075      0.794 0.000 0.952 0.000 0.000 0.000 0.048
#> GSM509773     2  0.1007      0.786 0.000 0.956 0.000 0.000 0.000 0.044
#> GSM509775     2  0.1327      0.780 0.000 0.936 0.000 0.000 0.000 0.064
#> GSM509777     2  0.5028      0.519 0.004 0.656 0.000 0.176 0.000 0.164
#> GSM509779     4  0.5135      0.739 0.004 0.216 0.000 0.636 0.000 0.144
#> GSM509781     4  0.1957      0.913 0.000 0.112 0.000 0.888 0.000 0.000
#> GSM509783     4  0.2101      0.904 0.004 0.100 0.000 0.892 0.000 0.004
#> GSM509785     4  0.2006      0.909 0.004 0.104 0.000 0.892 0.000 0.000
#> GSM509752     2  0.1910      0.785 0.000 0.892 0.000 0.000 0.000 0.108
#> GSM509754     2  0.1141      0.794 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM509756     2  0.2597      0.762 0.000 0.824 0.000 0.000 0.000 0.176
#> GSM509758     2  0.0603      0.795 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM509760     2  0.2454      0.779 0.000 0.840 0.000 0.000 0.000 0.160
#> GSM509762     2  0.2340      0.773 0.000 0.852 0.000 0.000 0.000 0.148
#> GSM509764     2  0.6942      0.417 0.016 0.436 0.024 0.204 0.008 0.312
#> GSM509766     2  0.2743      0.727 0.000 0.828 0.000 0.008 0.000 0.164
#> GSM509768     2  0.2558      0.733 0.000 0.840 0.000 0.004 0.000 0.156
#> GSM509770     2  0.1663      0.791 0.000 0.912 0.000 0.000 0.000 0.088
#> GSM509772     2  0.4131      0.626 0.000 0.600 0.000 0.016 0.000 0.384
#> GSM509774     4  0.4490      0.844 0.004 0.148 0.000 0.720 0.000 0.128
#> GSM509776     2  0.2491      0.732 0.000 0.836 0.000 0.000 0.000 0.164
#> GSM509778     4  0.1957      0.913 0.000 0.112 0.000 0.888 0.000 0.000
#> GSM509780     2  0.2743      0.725 0.000 0.828 0.000 0.008 0.000 0.164
#> GSM509782     4  0.2070      0.905 0.008 0.100 0.000 0.892 0.000 0.000
#> GSM509784     4  0.4771      0.815 0.004 0.164 0.000 0.688 0.000 0.144
#> GSM509786     4  0.1957      0.913 0.000 0.112 0.000 0.888 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)  time(p) k
#> CV:mclust 81         1.87e-17 1.38e-14 2
#> CV:mclust 74         6.00e-28 2.93e-11 3
#> CV:mclust 78         2.73e-28 7.14e-10 4
#> CV:mclust 67         3.26e-22 1.19e-06 5
#> CV:mclust 71         1.15e-22 4.08e-07 6

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


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

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.998       0.999         0.5061 0.494   0.494
#> 3 3 0.718           0.814       0.903         0.2527 0.819   0.649
#> 4 4 0.741           0.803       0.888         0.1750 0.799   0.498
#> 5 5 0.717           0.642       0.797         0.0566 0.976   0.901
#> 6 6 0.756           0.716       0.841         0.0364 0.932   0.707

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1  0.0000      1.000 1.000 0.000
#> GSM509711     1  0.0000      1.000 1.000 0.000
#> GSM509714     2  0.3431      0.932 0.064 0.936
#> GSM509719     1  0.0000      1.000 1.000 0.000
#> GSM509724     1  0.0000      1.000 1.000 0.000
#> GSM509729     1  0.0000      1.000 1.000 0.000
#> GSM509707     1  0.0000      1.000 1.000 0.000
#> GSM509712     1  0.0000      1.000 1.000 0.000
#> GSM509715     2  0.0000      0.998 0.000 1.000
#> GSM509720     1  0.0000      1.000 1.000 0.000
#> GSM509725     1  0.0000      1.000 1.000 0.000
#> GSM509730     1  0.0000      1.000 1.000 0.000
#> GSM509708     1  0.0000      1.000 1.000 0.000
#> GSM509713     1  0.0000      1.000 1.000 0.000
#> GSM509716     2  0.0000      0.998 0.000 1.000
#> GSM509721     1  0.0000      1.000 1.000 0.000
#> GSM509726     1  0.0000      1.000 1.000 0.000
#> GSM509731     2  0.0000      0.998 0.000 1.000
#> GSM509709     1  0.0000      1.000 1.000 0.000
#> GSM509717     2  0.0000      0.998 0.000 1.000
#> GSM509722     1  0.1184      0.984 0.984 0.016
#> GSM509727     1  0.0000      1.000 1.000 0.000
#> GSM509710     1  0.0000      1.000 1.000 0.000
#> GSM509718     2  0.0672      0.991 0.008 0.992
#> GSM509723     1  0.0000      1.000 1.000 0.000
#> GSM509728     1  0.0000      1.000 1.000 0.000
#> GSM509732     1  0.0000      1.000 1.000 0.000
#> GSM509736     1  0.0000      1.000 1.000 0.000
#> GSM509741     1  0.0000      1.000 1.000 0.000
#> GSM509746     1  0.0000      1.000 1.000 0.000
#> GSM509733     1  0.0000      1.000 1.000 0.000
#> GSM509737     1  0.0000      1.000 1.000 0.000
#> GSM509742     1  0.0000      1.000 1.000 0.000
#> GSM509747     1  0.0000      1.000 1.000 0.000
#> GSM509734     1  0.0000      1.000 1.000 0.000
#> GSM509738     1  0.0000      1.000 1.000 0.000
#> GSM509743     1  0.0000      1.000 1.000 0.000
#> GSM509748     1  0.0000      1.000 1.000 0.000
#> GSM509735     1  0.0000      1.000 1.000 0.000
#> GSM509739     1  0.0000      1.000 1.000 0.000
#> GSM509744     1  0.0000      1.000 1.000 0.000
#> GSM509749     1  0.0000      1.000 1.000 0.000
#> GSM509740     1  0.0000      1.000 1.000 0.000
#> GSM509745     1  0.0000      1.000 1.000 0.000
#> GSM509750     1  0.0000      1.000 1.000 0.000
#> GSM509751     2  0.0000      0.998 0.000 1.000
#> GSM509753     2  0.0000      0.998 0.000 1.000
#> GSM509755     2  0.0000      0.998 0.000 1.000
#> GSM509757     2  0.0000      0.998 0.000 1.000
#> GSM509759     2  0.0376      0.995 0.004 0.996
#> GSM509761     2  0.0000      0.998 0.000 1.000
#> GSM509763     2  0.0000      0.998 0.000 1.000
#> GSM509765     2  0.0000      0.998 0.000 1.000
#> GSM509767     2  0.0000      0.998 0.000 1.000
#> GSM509769     2  0.0000      0.998 0.000 1.000
#> GSM509771     2  0.0000      0.998 0.000 1.000
#> GSM509773     2  0.0000      0.998 0.000 1.000
#> GSM509775     2  0.0000      0.998 0.000 1.000
#> GSM509777     2  0.0000      0.998 0.000 1.000
#> GSM509779     2  0.0000      0.998 0.000 1.000
#> GSM509781     2  0.0000      0.998 0.000 1.000
#> GSM509783     2  0.0000      0.998 0.000 1.000
#> GSM509785     2  0.0000      0.998 0.000 1.000
#> GSM509752     2  0.0000      0.998 0.000 1.000
#> GSM509754     2  0.0000      0.998 0.000 1.000
#> GSM509756     2  0.0000      0.998 0.000 1.000
#> GSM509758     2  0.0000      0.998 0.000 1.000
#> GSM509760     2  0.0000      0.998 0.000 1.000
#> GSM509762     2  0.0000      0.998 0.000 1.000
#> GSM509764     2  0.0000      0.998 0.000 1.000
#> GSM509766     2  0.0000      0.998 0.000 1.000
#> GSM509768     2  0.0000      0.998 0.000 1.000
#> GSM509770     2  0.0000      0.998 0.000 1.000
#> GSM509772     2  0.0000      0.998 0.000 1.000
#> GSM509774     2  0.0000      0.998 0.000 1.000
#> GSM509776     2  0.0000      0.998 0.000 1.000
#> GSM509778     2  0.0000      0.998 0.000 1.000
#> GSM509780     2  0.0000      0.998 0.000 1.000
#> GSM509782     2  0.0000      0.998 0.000 1.000
#> GSM509784     2  0.0000      0.998 0.000 1.000
#> GSM509786     2  0.0000      0.998 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1  0.0424      0.931 0.992 0.000 0.008
#> GSM509711     1  0.0661      0.927 0.988 0.004 0.008
#> GSM509714     1  0.3965      0.733 0.860 0.132 0.008
#> GSM509719     1  0.0237      0.934 0.996 0.000 0.004
#> GSM509724     1  0.0237      0.934 0.996 0.000 0.004
#> GSM509729     1  0.0424      0.931 0.992 0.000 0.008
#> GSM509707     1  0.0237      0.934 0.996 0.000 0.004
#> GSM509712     1  0.0424      0.931 0.992 0.000 0.008
#> GSM509715     2  0.2774      0.864 0.072 0.920 0.008
#> GSM509720     1  0.0424      0.931 0.992 0.000 0.008
#> GSM509725     1  0.1031      0.923 0.976 0.000 0.024
#> GSM509730     1  0.0237      0.934 0.996 0.000 0.004
#> GSM509708     1  0.0000      0.934 1.000 0.000 0.000
#> GSM509713     1  0.0424      0.931 0.992 0.000 0.008
#> GSM509716     2  0.4353      0.770 0.156 0.836 0.008
#> GSM509721     1  0.0237      0.934 0.996 0.000 0.004
#> GSM509726     1  0.0237      0.934 0.996 0.000 0.004
#> GSM509731     2  0.5420      0.651 0.240 0.752 0.008
#> GSM509709     1  0.0000      0.934 1.000 0.000 0.000
#> GSM509717     2  0.5580      0.625 0.256 0.736 0.008
#> GSM509722     1  0.0848      0.923 0.984 0.008 0.008
#> GSM509727     1  0.0237      0.934 0.996 0.000 0.004
#> GSM509710     1  0.0592      0.931 0.988 0.000 0.012
#> GSM509718     2  0.0000      0.926 0.000 1.000 0.000
#> GSM509723     1  0.0000      0.934 1.000 0.000 0.000
#> GSM509728     1  0.1860      0.897 0.948 0.000 0.052
#> GSM509732     3  0.5138      0.721 0.252 0.000 0.748
#> GSM509736     3  0.3941      0.717 0.156 0.000 0.844
#> GSM509741     3  0.4062      0.733 0.164 0.000 0.836
#> GSM509746     3  0.4702      0.734 0.212 0.000 0.788
#> GSM509733     3  0.4842      0.732 0.224 0.000 0.776
#> GSM509737     3  0.6225      0.450 0.432 0.000 0.568
#> GSM509742     3  0.5138      0.721 0.252 0.000 0.748
#> GSM509747     3  0.5431      0.690 0.284 0.000 0.716
#> GSM509734     1  0.5810      0.346 0.664 0.000 0.336
#> GSM509738     1  0.4002      0.751 0.840 0.000 0.160
#> GSM509743     3  0.1031      0.690 0.024 0.000 0.976
#> GSM509748     3  0.5216      0.715 0.260 0.000 0.740
#> GSM509735     1  0.0892      0.926 0.980 0.000 0.020
#> GSM509739     1  0.0237      0.934 0.996 0.000 0.004
#> GSM509744     3  0.6291      0.352 0.468 0.000 0.532
#> GSM509749     3  0.6126      0.514 0.400 0.000 0.600
#> GSM509740     1  0.0892      0.926 0.980 0.000 0.020
#> GSM509745     1  0.2959      0.839 0.900 0.000 0.100
#> GSM509750     1  0.5968      0.263 0.636 0.000 0.364
#> GSM509751     2  0.6111      0.478 0.000 0.604 0.396
#> GSM509753     3  0.5058      0.467 0.000 0.244 0.756
#> GSM509755     2  0.6267      0.345 0.000 0.548 0.452
#> GSM509757     2  0.4346      0.802 0.000 0.816 0.184
#> GSM509759     3  0.4842      0.506 0.000 0.224 0.776
#> GSM509761     2  0.0892      0.924 0.000 0.980 0.020
#> GSM509763     2  0.0892      0.924 0.000 0.980 0.020
#> GSM509765     2  0.0000      0.926 0.000 1.000 0.000
#> GSM509767     2  0.1753      0.913 0.000 0.952 0.048
#> GSM509769     2  0.1031      0.923 0.000 0.976 0.024
#> GSM509771     2  0.2625      0.891 0.000 0.916 0.084
#> GSM509773     2  0.1031      0.923 0.000 0.976 0.024
#> GSM509775     2  0.1031      0.923 0.000 0.976 0.024
#> GSM509777     2  0.0000      0.926 0.000 1.000 0.000
#> GSM509779     2  0.0000      0.926 0.000 1.000 0.000
#> GSM509781     2  0.0237      0.925 0.000 0.996 0.004
#> GSM509783     2  0.0661      0.921 0.004 0.988 0.008
#> GSM509785     2  0.0237      0.925 0.000 0.996 0.004
#> GSM509752     2  0.4931      0.747 0.000 0.768 0.232
#> GSM509754     2  0.2066      0.907 0.000 0.940 0.060
#> GSM509756     2  0.1643      0.915 0.000 0.956 0.044
#> GSM509758     2  0.1031      0.923 0.000 0.976 0.024
#> GSM509760     2  0.0000      0.926 0.000 1.000 0.000
#> GSM509762     2  0.2625      0.891 0.000 0.916 0.084
#> GSM509764     3  0.1964      0.671 0.000 0.056 0.944
#> GSM509766     2  0.0424      0.926 0.000 0.992 0.008
#> GSM509768     2  0.0424      0.926 0.000 0.992 0.008
#> GSM509770     2  0.1031      0.923 0.000 0.976 0.024
#> GSM509772     3  0.5948      0.199 0.000 0.360 0.640
#> GSM509774     2  0.0000      0.926 0.000 1.000 0.000
#> GSM509776     2  0.0424      0.926 0.000 0.992 0.008
#> GSM509778     2  0.0237      0.925 0.000 0.996 0.004
#> GSM509780     2  0.0000      0.926 0.000 1.000 0.000
#> GSM509782     2  0.0237      0.925 0.000 0.996 0.004
#> GSM509784     2  0.0000      0.926 0.000 1.000 0.000
#> GSM509786     2  0.0237      0.925 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
#> GSM509706     1  0.1109     0.9161 0.968 0.000 0.028 0.004
#> GSM509711     1  0.0672     0.9168 0.984 0.000 0.008 0.008
#> GSM509714     1  0.1059     0.9143 0.972 0.000 0.012 0.016
#> GSM509719     1  0.2402     0.8778 0.912 0.076 0.012 0.000
#> GSM509724     1  0.2266     0.8997 0.912 0.000 0.084 0.004
#> GSM509729     1  0.1004     0.9172 0.972 0.000 0.024 0.004
#> GSM509707     1  0.0524     0.9164 0.988 0.000 0.008 0.004
#> GSM509712     1  0.2441     0.9084 0.916 0.004 0.068 0.012
#> GSM509715     4  0.1256     0.8161 0.008 0.000 0.028 0.964
#> GSM509720     1  0.1674     0.9060 0.952 0.032 0.012 0.004
#> GSM509725     1  0.2773     0.8811 0.880 0.000 0.116 0.004
#> GSM509730     1  0.1247     0.9136 0.968 0.012 0.016 0.004
#> GSM509708     1  0.0188     0.9148 0.996 0.000 0.000 0.004
#> GSM509713     1  0.2382     0.9025 0.912 0.004 0.080 0.004
#> GSM509716     4  0.1489     0.8114 0.044 0.000 0.004 0.952
#> GSM509721     1  0.2610     0.8669 0.900 0.088 0.012 0.000
#> GSM509726     1  0.3765     0.8111 0.812 0.004 0.180 0.004
#> GSM509731     4  0.0779     0.8340 0.016 0.004 0.000 0.980
#> GSM509709     1  0.0376     0.9157 0.992 0.000 0.004 0.004
#> GSM509717     4  0.1209     0.8210 0.032 0.000 0.004 0.964
#> GSM509722     1  0.1575     0.9075 0.956 0.028 0.012 0.004
#> GSM509727     1  0.5138     0.3946 0.600 0.000 0.392 0.008
#> GSM509710     1  0.2197     0.9025 0.916 0.000 0.080 0.004
#> GSM509718     4  0.3798     0.7268 0.016 0.016 0.120 0.848
#> GSM509723     1  0.1488     0.9062 0.956 0.032 0.012 0.000
#> GSM509728     3  0.4877     0.2754 0.408 0.000 0.592 0.000
#> GSM509732     3  0.2402     0.9080 0.012 0.076 0.912 0.000
#> GSM509736     3  0.0672     0.9115 0.008 0.008 0.984 0.000
#> GSM509741     3  0.1302     0.9142 0.000 0.044 0.956 0.000
#> GSM509746     3  0.3088     0.8713 0.008 0.128 0.864 0.000
#> GSM509733     3  0.2053     0.9098 0.004 0.072 0.924 0.000
#> GSM509737     3  0.0895     0.9096 0.020 0.004 0.976 0.000
#> GSM509742     3  0.1576     0.9150 0.004 0.048 0.948 0.000
#> GSM509747     3  0.2813     0.9042 0.024 0.080 0.896 0.000
#> GSM509734     3  0.2814     0.8408 0.132 0.000 0.868 0.000
#> GSM509738     3  0.1930     0.8977 0.056 0.004 0.936 0.004
#> GSM509743     3  0.1211     0.9135 0.000 0.040 0.960 0.000
#> GSM509748     3  0.2053     0.9098 0.004 0.072 0.924 0.000
#> GSM509735     1  0.2760     0.8774 0.872 0.000 0.128 0.000
#> GSM509739     1  0.3355     0.8441 0.836 0.000 0.160 0.004
#> GSM509744     3  0.0779     0.9122 0.004 0.016 0.980 0.000
#> GSM509749     3  0.2385     0.9125 0.028 0.052 0.920 0.000
#> GSM509740     3  0.4239     0.7972 0.152 0.004 0.812 0.032
#> GSM509745     3  0.1953     0.9000 0.044 0.004 0.940 0.012
#> GSM509750     3  0.2412     0.8849 0.084 0.008 0.908 0.000
#> GSM509751     2  0.1022     0.8312 0.000 0.968 0.000 0.032
#> GSM509753     2  0.0592     0.8231 0.000 0.984 0.000 0.016
#> GSM509755     2  0.1004     0.8277 0.004 0.972 0.000 0.024
#> GSM509757     2  0.1022     0.8312 0.000 0.968 0.000 0.032
#> GSM509759     2  0.0524     0.8101 0.008 0.988 0.004 0.000
#> GSM509761     2  0.4877     0.4018 0.000 0.592 0.000 0.408
#> GSM509763     4  0.4776     0.3902 0.000 0.376 0.000 0.624
#> GSM509765     4  0.4250     0.6227 0.000 0.276 0.000 0.724
#> GSM509767     2  0.2281     0.8417 0.000 0.904 0.000 0.096
#> GSM509769     2  0.3801     0.7588 0.000 0.780 0.000 0.220
#> GSM509771     2  0.2216     0.8423 0.000 0.908 0.000 0.092
#> GSM509773     2  0.4999     0.0883 0.000 0.508 0.000 0.492
#> GSM509775     2  0.4679     0.5475 0.000 0.648 0.000 0.352
#> GSM509777     4  0.2760     0.7885 0.000 0.128 0.000 0.872
#> GSM509779     4  0.1637     0.8340 0.000 0.060 0.000 0.940
#> GSM509781     4  0.0592     0.8450 0.000 0.016 0.000 0.984
#> GSM509783     4  0.0592     0.8450 0.000 0.016 0.000 0.984
#> GSM509785     4  0.0592     0.8450 0.000 0.016 0.000 0.984
#> GSM509752     2  0.1940     0.8413 0.000 0.924 0.000 0.076
#> GSM509754     2  0.3528     0.7883 0.000 0.808 0.000 0.192
#> GSM509756     2  0.2530     0.8372 0.000 0.888 0.000 0.112
#> GSM509758     2  0.3356     0.8013 0.000 0.824 0.000 0.176
#> GSM509760     2  0.4677     0.6136 0.004 0.680 0.000 0.316
#> GSM509762     2  0.2216     0.8427 0.000 0.908 0.000 0.092
#> GSM509764     2  0.2466     0.7382 0.000 0.900 0.096 0.004
#> GSM509766     4  0.4522     0.5395 0.000 0.320 0.000 0.680
#> GSM509768     4  0.4356     0.5956 0.000 0.292 0.000 0.708
#> GSM509770     2  0.2704     0.8327 0.000 0.876 0.000 0.124
#> GSM509772     2  0.0336     0.8172 0.000 0.992 0.000 0.008
#> GSM509774     4  0.1211     0.8417 0.000 0.040 0.000 0.960
#> GSM509776     4  0.4624     0.4923 0.000 0.340 0.000 0.660
#> GSM509778     4  0.0592     0.8450 0.000 0.016 0.000 0.984
#> GSM509780     4  0.4164     0.6410 0.000 0.264 0.000 0.736
#> GSM509782     4  0.0592     0.8450 0.000 0.016 0.000 0.984
#> GSM509784     4  0.1389     0.8393 0.000 0.048 0.000 0.952
#> GSM509786     4  0.0592     0.8450 0.000 0.016 0.000 0.984

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.4127     0.6197 0.680 0.000 0.008 0.000 0.312
#> GSM509711     1  0.3796     0.6294 0.700 0.000 0.000 0.000 0.300
#> GSM509714     1  0.4565     0.4782 0.752 0.008 0.000 0.064 0.176
#> GSM509719     1  0.4390     0.4984 0.760 0.084 0.000 0.000 0.156
#> GSM509724     1  0.4268     0.5981 0.648 0.000 0.008 0.000 0.344
#> GSM509729     1  0.0932     0.5957 0.972 0.004 0.020 0.000 0.004
#> GSM509707     1  0.4200     0.6159 0.672 0.004 0.004 0.000 0.320
#> GSM509712     1  0.4552     0.6001 0.632 0.000 0.004 0.012 0.352
#> GSM509715     4  0.4026     0.5727 0.020 0.000 0.000 0.736 0.244
#> GSM509720     1  0.4138     0.5091 0.776 0.064 0.000 0.000 0.160
#> GSM509725     1  0.4467     0.5897 0.640 0.000 0.016 0.000 0.344
#> GSM509730     1  0.3756     0.5397 0.836 0.032 0.036 0.000 0.096
#> GSM509708     1  0.3452     0.6354 0.756 0.000 0.000 0.000 0.244
#> GSM509713     1  0.4310     0.5543 0.604 0.000 0.004 0.000 0.392
#> GSM509716     4  0.4527     0.5868 0.064 0.000 0.000 0.732 0.204
#> GSM509721     1  0.4417     0.4986 0.760 0.092 0.000 0.000 0.148
#> GSM509726     1  0.4713     0.4707 0.544 0.000 0.016 0.000 0.440
#> GSM509731     4  0.2236     0.7416 0.024 0.000 0.000 0.908 0.068
#> GSM509709     1  0.3861     0.6298 0.712 0.000 0.004 0.000 0.284
#> GSM509717     4  0.4066     0.6203 0.032 0.004 0.000 0.768 0.196
#> GSM509722     1  0.4010     0.5185 0.784 0.056 0.000 0.000 0.160
#> GSM509727     1  0.6635     0.2172 0.484 0.000 0.284 0.004 0.228
#> GSM509710     1  0.4706     0.3925 0.500 0.008 0.004 0.000 0.488
#> GSM509718     5  0.5286     0.1332 0.004 0.028 0.016 0.332 0.620
#> GSM509723     1  0.3994     0.5208 0.792 0.068 0.000 0.000 0.140
#> GSM509728     3  0.4678     0.5001 0.224 0.000 0.712 0.000 0.064
#> GSM509732     3  0.0740     0.8453 0.008 0.004 0.980 0.000 0.008
#> GSM509736     3  0.4561     0.0532 0.000 0.008 0.504 0.000 0.488
#> GSM509741     3  0.0703     0.8449 0.000 0.000 0.976 0.000 0.024
#> GSM509746     3  0.1153     0.8397 0.008 0.004 0.964 0.000 0.024
#> GSM509733     3  0.0162     0.8466 0.000 0.000 0.996 0.000 0.004
#> GSM509737     5  0.4294    -0.1847 0.000 0.000 0.468 0.000 0.532
#> GSM509742     3  0.0609     0.8454 0.000 0.000 0.980 0.000 0.020
#> GSM509747     3  0.0451     0.8471 0.008 0.000 0.988 0.000 0.004
#> GSM509734     3  0.1892     0.7968 0.080 0.000 0.916 0.000 0.004
#> GSM509738     3  0.3826     0.6920 0.004 0.000 0.752 0.008 0.236
#> GSM509743     3  0.3750     0.6648 0.000 0.012 0.756 0.000 0.232
#> GSM509748     3  0.0324     0.8471 0.000 0.004 0.992 0.000 0.004
#> GSM509735     1  0.4748     0.5801 0.728 0.000 0.100 0.000 0.172
#> GSM509739     5  0.4659    -0.5370 0.488 0.000 0.012 0.000 0.500
#> GSM509744     3  0.2424     0.7954 0.000 0.000 0.868 0.000 0.132
#> GSM509749     3  0.0898     0.8443 0.020 0.000 0.972 0.000 0.008
#> GSM509740     5  0.5389     0.2422 0.040 0.000 0.300 0.024 0.636
#> GSM509745     3  0.3360     0.7593 0.004 0.000 0.816 0.012 0.168
#> GSM509750     3  0.2067     0.8219 0.048 0.000 0.920 0.000 0.032
#> GSM509751     2  0.0613     0.8705 0.000 0.984 0.004 0.004 0.008
#> GSM509753     2  0.1012     0.8659 0.000 0.968 0.012 0.000 0.020
#> GSM509755     2  0.0932     0.8679 0.000 0.972 0.004 0.004 0.020
#> GSM509757     2  0.0898     0.8695 0.000 0.972 0.000 0.008 0.020
#> GSM509759     2  0.2131     0.8452 0.016 0.920 0.008 0.000 0.056
#> GSM509761     2  0.4213     0.5642 0.000 0.680 0.000 0.308 0.012
#> GSM509763     4  0.4610     0.2439 0.000 0.432 0.000 0.556 0.012
#> GSM509765     4  0.3689     0.6413 0.000 0.256 0.000 0.740 0.004
#> GSM509767     2  0.2139     0.8738 0.000 0.916 0.000 0.052 0.032
#> GSM509769     2  0.3278     0.8041 0.000 0.824 0.000 0.156 0.020
#> GSM509771     2  0.1628     0.8724 0.000 0.936 0.000 0.056 0.008
#> GSM509773     2  0.4410     0.1822 0.000 0.556 0.000 0.440 0.004
#> GSM509775     2  0.3967     0.6520 0.000 0.724 0.000 0.264 0.012
#> GSM509777     4  0.2127     0.7780 0.000 0.108 0.000 0.892 0.000
#> GSM509779     4  0.1197     0.7951 0.000 0.048 0.000 0.952 0.000
#> GSM509781     4  0.0451     0.7913 0.000 0.008 0.000 0.988 0.004
#> GSM509783     4  0.0451     0.7873 0.000 0.004 0.000 0.988 0.008
#> GSM509785     4  0.0451     0.7913 0.000 0.008 0.000 0.988 0.004
#> GSM509752     2  0.1579     0.8716 0.000 0.944 0.000 0.032 0.024
#> GSM509754     2  0.2046     0.8644 0.000 0.916 0.000 0.068 0.016
#> GSM509756     2  0.1012     0.8738 0.000 0.968 0.000 0.020 0.012
#> GSM509758     2  0.1956     0.8648 0.000 0.916 0.000 0.076 0.008
#> GSM509760     2  0.5184     0.6816 0.024 0.704 0.000 0.212 0.060
#> GSM509762     2  0.1408     0.8734 0.000 0.948 0.000 0.044 0.008
#> GSM509764     2  0.3077     0.8198 0.000 0.872 0.024 0.020 0.084
#> GSM509766     4  0.4182     0.4769 0.000 0.352 0.000 0.644 0.004
#> GSM509768     4  0.3969     0.5715 0.000 0.304 0.000 0.692 0.004
#> GSM509770     2  0.3133     0.8492 0.004 0.864 0.000 0.080 0.052
#> GSM509772     2  0.1492     0.8635 0.000 0.948 0.004 0.008 0.040
#> GSM509774     4  0.1571     0.7937 0.000 0.060 0.000 0.936 0.004
#> GSM509776     4  0.4341     0.3445 0.000 0.404 0.000 0.592 0.004
#> GSM509778     4  0.0324     0.7890 0.000 0.004 0.000 0.992 0.004
#> GSM509780     4  0.3395     0.6675 0.000 0.236 0.000 0.764 0.000
#> GSM509782     4  0.0162     0.7868 0.000 0.000 0.000 0.996 0.004
#> GSM509784     4  0.1043     0.7951 0.000 0.040 0.000 0.960 0.000
#> GSM509786     4  0.0451     0.7913 0.000 0.008 0.000 0.988 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
#> GSM509706     1  0.0806      0.895 0.972 0.000 0.000 0.000 0.020 0.008
#> GSM509711     1  0.2604      0.850 0.872 0.000 0.000 0.008 0.100 0.020
#> GSM509714     5  0.3874      0.709 0.064 0.004 0.000 0.060 0.816 0.056
#> GSM509719     5  0.2420      0.759 0.076 0.040 0.000 0.000 0.884 0.000
#> GSM509724     1  0.0363      0.896 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM509729     1  0.5024      0.376 0.588 0.000 0.012 0.008 0.352 0.040
#> GSM509707     1  0.0820      0.897 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM509712     1  0.3103      0.834 0.848 0.000 0.000 0.016 0.100 0.036
#> GSM509715     6  0.5835      0.126 0.000 0.004 0.000 0.204 0.280 0.512
#> GSM509720     5  0.2515      0.765 0.072 0.024 0.000 0.000 0.888 0.016
#> GSM509725     1  0.0260      0.896 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509730     5  0.6068      0.425 0.272 0.004 0.072 0.008 0.584 0.060
#> GSM509708     1  0.1802      0.879 0.916 0.000 0.000 0.000 0.072 0.012
#> GSM509713     1  0.1418      0.893 0.944 0.000 0.000 0.000 0.024 0.032
#> GSM509716     5  0.5805      0.294 0.000 0.008 0.000 0.176 0.528 0.288
#> GSM509721     5  0.2591      0.752 0.064 0.052 0.004 0.000 0.880 0.000
#> GSM509726     1  0.1152      0.887 0.952 0.000 0.000 0.000 0.004 0.044
#> GSM509731     4  0.3770      0.550 0.000 0.000 0.000 0.776 0.148 0.076
#> GSM509709     1  0.0891      0.894 0.968 0.000 0.000 0.000 0.024 0.008
#> GSM509717     5  0.5832      0.263 0.000 0.004 0.000 0.196 0.508 0.292
#> GSM509722     5  0.2195      0.763 0.068 0.012 0.000 0.000 0.904 0.016
#> GSM509727     1  0.4359      0.638 0.724 0.000 0.212 0.000 0.040 0.024
#> GSM509710     1  0.1010      0.888 0.960 0.000 0.000 0.000 0.004 0.036
#> GSM509718     6  0.3371      0.599 0.020 0.008 0.012 0.084 0.024 0.852
#> GSM509723     5  0.2393      0.760 0.092 0.020 0.000 0.000 0.884 0.004
#> GSM509728     3  0.4429      0.587 0.192 0.000 0.732 0.000 0.036 0.040
#> GSM509732     3  0.0777      0.839 0.000 0.004 0.972 0.000 0.000 0.024
#> GSM509736     6  0.4607      0.618 0.044 0.028 0.208 0.000 0.004 0.716
#> GSM509741     3  0.1663      0.830 0.000 0.000 0.912 0.000 0.000 0.088
#> GSM509746     3  0.0692      0.841 0.000 0.004 0.976 0.000 0.000 0.020
#> GSM509733     3  0.0508      0.848 0.000 0.004 0.984 0.000 0.000 0.012
#> GSM509737     6  0.4848      0.613 0.072 0.020 0.208 0.000 0.004 0.696
#> GSM509742     3  0.1444      0.838 0.000 0.000 0.928 0.000 0.000 0.072
#> GSM509747     3  0.0508      0.848 0.000 0.004 0.984 0.000 0.000 0.012
#> GSM509734     3  0.1074      0.843 0.028 0.000 0.960 0.000 0.000 0.012
#> GSM509738     6  0.5038      0.167 0.008 0.000 0.428 0.004 0.044 0.516
#> GSM509743     3  0.4779      0.290 0.016 0.016 0.576 0.000 0.008 0.384
#> GSM509748     3  0.1075      0.847 0.000 0.000 0.952 0.000 0.000 0.048
#> GSM509735     1  0.2585      0.853 0.880 0.000 0.024 0.000 0.084 0.012
#> GSM509739     1  0.1471      0.876 0.932 0.000 0.000 0.000 0.004 0.064
#> GSM509744     3  0.3702      0.620 0.012 0.000 0.720 0.004 0.000 0.264
#> GSM509749     3  0.0260      0.850 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM509740     6  0.4545      0.633 0.048 0.000 0.072 0.024 0.076 0.780
#> GSM509745     3  0.3673      0.651 0.016 0.000 0.736 0.004 0.000 0.244
#> GSM509750     3  0.1624      0.845 0.000 0.000 0.936 0.004 0.020 0.040
#> GSM509751     2  0.1148      0.839 0.000 0.960 0.000 0.004 0.020 0.016
#> GSM509753     2  0.1173      0.843 0.000 0.960 0.000 0.008 0.016 0.016
#> GSM509755     2  0.1461      0.831 0.000 0.940 0.000 0.000 0.044 0.016
#> GSM509757     2  0.1297      0.836 0.000 0.948 0.000 0.000 0.040 0.012
#> GSM509759     2  0.2821      0.801 0.000 0.860 0.000 0.004 0.096 0.040
#> GSM509761     2  0.3493      0.697 0.000 0.756 0.000 0.228 0.008 0.008
#> GSM509763     4  0.4303      0.184 0.000 0.460 0.000 0.524 0.012 0.004
#> GSM509765     4  0.3559      0.684 0.000 0.240 0.000 0.744 0.012 0.004
#> GSM509767     2  0.2807      0.832 0.000 0.868 0.000 0.088 0.016 0.028
#> GSM509769     2  0.3831      0.700 0.000 0.744 0.000 0.224 0.012 0.020
#> GSM509771     2  0.2617      0.830 0.000 0.872 0.000 0.100 0.012 0.016
#> GSM509773     2  0.4447      0.178 0.000 0.556 0.000 0.420 0.012 0.012
#> GSM509775     2  0.3774      0.488 0.000 0.664 0.000 0.328 0.008 0.000
#> GSM509777     4  0.2362      0.774 0.000 0.136 0.000 0.860 0.004 0.000
#> GSM509779     4  0.1007      0.804 0.000 0.044 0.000 0.956 0.000 0.000
#> GSM509781     4  0.0458      0.796 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM509783     4  0.0622      0.786 0.000 0.008 0.000 0.980 0.012 0.000
#> GSM509785     4  0.0508      0.793 0.000 0.012 0.000 0.984 0.004 0.000
#> GSM509752     2  0.1321      0.844 0.000 0.952 0.000 0.024 0.004 0.020
#> GSM509754     2  0.2306      0.834 0.000 0.888 0.000 0.092 0.004 0.016
#> GSM509756     2  0.1401      0.848 0.000 0.948 0.000 0.028 0.004 0.020
#> GSM509758     2  0.1901      0.842 0.000 0.912 0.000 0.076 0.008 0.004
#> GSM509760     2  0.4930      0.744 0.000 0.712 0.000 0.120 0.132 0.036
#> GSM509762     2  0.1332      0.848 0.000 0.952 0.000 0.028 0.008 0.012
#> GSM509764     2  0.3332      0.729 0.000 0.808 0.004 0.012 0.012 0.164
#> GSM509766     4  0.3955      0.576 0.000 0.316 0.000 0.668 0.012 0.004
#> GSM509768     4  0.4009      0.593 0.000 0.304 0.000 0.676 0.012 0.008
#> GSM509770     2  0.3835      0.811 0.000 0.808 0.004 0.112 0.044 0.032
#> GSM509772     2  0.2100      0.835 0.000 0.916 0.004 0.008 0.048 0.024
#> GSM509774     4  0.1204      0.804 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM509776     4  0.4229      0.269 0.000 0.436 0.000 0.548 0.016 0.000
#> GSM509778     4  0.0862      0.781 0.000 0.008 0.000 0.972 0.016 0.004
#> GSM509780     4  0.3103      0.719 0.000 0.208 0.000 0.784 0.008 0.000
#> GSM509782     4  0.0767      0.784 0.000 0.008 0.000 0.976 0.012 0.004
#> GSM509784     4  0.0937      0.804 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM509786     4  0.0713      0.800 0.000 0.028 0.000 0.972 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-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)  time(p) k
#> CV:NMF 81         2.66e-14 3.66e-11 2
#> CV:NMF 73         9.31e-17 1.77e-07 3
#> CV:NMF 75         6.77e-23 6.06e-07 4
#> CV:NMF 66         2.10e-19 1.51e-06 5
#> CV:NMF 70         6.40e-19 3.29e-06 6

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


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

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.497          0.0676       0.621         0.4535 0.568   0.568
#> 3 3 0.549          0.5497       0.760         0.4114 0.514   0.300
#> 4 4 0.768          0.8424       0.850         0.1603 0.868   0.628
#> 5 5 0.815          0.7893       0.851         0.0635 0.972   0.886
#> 6 6 0.887          0.8437       0.905         0.0325 0.943   0.752

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
#> GSM509706     2  1.0000   -0.03669 0.500 0.500
#> GSM509711     2  0.9635    0.10274 0.388 0.612
#> GSM509714     2  0.8327    0.18407 0.264 0.736
#> GSM509719     2  1.0000   -0.03669 0.500 0.500
#> GSM509724     1  1.0000   -0.02123 0.500 0.500
#> GSM509729     1  1.0000   -0.02123 0.500 0.500
#> GSM509707     1  1.0000   -0.02123 0.500 0.500
#> GSM509712     2  0.9635    0.10274 0.388 0.612
#> GSM509715     1  0.9044    0.08483 0.680 0.320
#> GSM509720     2  1.0000   -0.03669 0.500 0.500
#> GSM509725     1  1.0000   -0.02123 0.500 0.500
#> GSM509730     2  1.0000   -0.03669 0.500 0.500
#> GSM509708     1  1.0000   -0.02123 0.500 0.500
#> GSM509713     2  0.9635    0.10274 0.388 0.612
#> GSM509716     1  0.9044    0.08483 0.680 0.320
#> GSM509721     2  1.0000   -0.03669 0.500 0.500
#> GSM509726     1  1.0000   -0.02123 0.500 0.500
#> GSM509731     1  0.9044    0.08483 0.680 0.320
#> GSM509709     1  1.0000   -0.02123 0.500 0.500
#> GSM509717     1  0.9044    0.08483 0.680 0.320
#> GSM509722     1  1.0000   -0.02123 0.500 0.500
#> GSM509727     2  0.9998   -0.02230 0.492 0.508
#> GSM509710     2  1.0000   -0.03669 0.500 0.500
#> GSM509718     1  0.9044    0.08483 0.680 0.320
#> GSM509723     1  1.0000   -0.02123 0.500 0.500
#> GSM509728     2  0.9998   -0.02230 0.492 0.508
#> GSM509732     1  1.0000   -0.02123 0.500 0.500
#> GSM509736     2  0.9983    0.00353 0.476 0.524
#> GSM509741     1  1.0000   -0.02123 0.500 0.500
#> GSM509746     1  1.0000   -0.02123 0.500 0.500
#> GSM509733     2  1.0000   -0.03669 0.500 0.500
#> GSM509737     2  0.9983    0.00353 0.476 0.524
#> GSM509742     2  1.0000   -0.03669 0.500 0.500
#> GSM509747     1  1.0000   -0.02123 0.500 0.500
#> GSM509734     2  1.0000   -0.03669 0.500 0.500
#> GSM509738     2  0.9983    0.00353 0.476 0.524
#> GSM509743     2  1.0000   -0.03669 0.500 0.500
#> GSM509748     2  1.0000   -0.03669 0.500 0.500
#> GSM509735     1  1.0000   -0.02123 0.500 0.500
#> GSM509739     2  1.0000   -0.03669 0.500 0.500
#> GSM509744     2  1.0000   -0.03669 0.500 0.500
#> GSM509749     2  1.0000   -0.03669 0.500 0.500
#> GSM509740     2  0.9795    0.07567 0.416 0.584
#> GSM509745     2  0.9833    0.06773 0.424 0.576
#> GSM509750     2  0.9983    0.00350 0.476 0.524
#> GSM509751     2  0.0000    0.33036 0.000 1.000
#> GSM509753     2  0.0000    0.33036 0.000 1.000
#> GSM509755     2  0.0000    0.33036 0.000 1.000
#> GSM509757     2  0.0000    0.33036 0.000 1.000
#> GSM509759     2  0.0000    0.33036 0.000 1.000
#> GSM509761     2  0.0000    0.33036 0.000 1.000
#> GSM509763     2  1.0000   -0.07072 0.496 0.504
#> GSM509765     2  1.0000   -0.07072 0.496 0.504
#> GSM509767     2  0.0000    0.33036 0.000 1.000
#> GSM509769     2  0.0376    0.32691 0.004 0.996
#> GSM509771     2  0.0000    0.33036 0.000 1.000
#> GSM509773     2  0.9996   -0.06698 0.488 0.512
#> GSM509775     2  0.9850   -0.03668 0.428 0.572
#> GSM509777     2  1.0000   -0.07356 0.500 0.500
#> GSM509779     2  1.0000   -0.07356 0.500 0.500
#> GSM509781     2  1.0000   -0.07356 0.500 0.500
#> GSM509783     1  1.0000    0.01741 0.500 0.500
#> GSM509785     1  1.0000    0.01741 0.500 0.500
#> GSM509752     2  0.0000    0.33036 0.000 1.000
#> GSM509754     2  0.0000    0.33036 0.000 1.000
#> GSM509756     2  0.0000    0.33036 0.000 1.000
#> GSM509758     2  0.0000    0.33036 0.000 1.000
#> GSM509760     2  0.0000    0.33036 0.000 1.000
#> GSM509762     2  0.0000    0.33036 0.000 1.000
#> GSM509764     2  0.0000    0.33036 0.000 1.000
#> GSM509766     2  1.0000   -0.07072 0.496 0.504
#> GSM509768     2  1.0000   -0.07072 0.496 0.504
#> GSM509770     2  0.0000    0.33036 0.000 1.000
#> GSM509772     2  0.0000    0.33036 0.000 1.000
#> GSM509774     1  1.0000    0.01741 0.500 0.500
#> GSM509776     2  0.9850   -0.03668 0.428 0.572
#> GSM509778     1  1.0000    0.01741 0.500 0.500
#> GSM509780     1  1.0000    0.01741 0.500 0.500
#> GSM509782     2  1.0000   -0.07356 0.500 0.500
#> GSM509784     2  1.0000   -0.07356 0.500 0.500
#> GSM509786     1  1.0000    0.01741 0.500 0.500

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509711     1  0.0237      0.647 0.996 0.000 0.004
#> GSM509714     1  0.3784      0.523 0.864 0.132 0.004
#> GSM509719     1  0.5835      0.897 0.660 0.000 0.340
#> GSM509724     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509729     1  0.5835      0.897 0.660 0.000 0.340
#> GSM509707     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509712     1  0.0237      0.647 0.996 0.000 0.004
#> GSM509715     2  0.5733      0.513 0.324 0.676 0.000
#> GSM509720     1  0.5835      0.897 0.660 0.000 0.340
#> GSM509725     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509730     1  0.5835      0.897 0.660 0.000 0.340
#> GSM509708     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509713     1  0.0237      0.647 0.996 0.000 0.004
#> GSM509716     2  0.5733      0.513 0.324 0.676 0.000
#> GSM509721     1  0.5835      0.897 0.660 0.000 0.340
#> GSM509726     1  0.5882      0.900 0.652 0.000 0.348
#> GSM509731     2  0.5733      0.513 0.324 0.676 0.000
#> GSM509709     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509717     2  0.5733      0.513 0.324 0.676 0.000
#> GSM509722     1  0.5835      0.897 0.660 0.000 0.340
#> GSM509727     3  0.6204      0.343 0.424 0.000 0.576
#> GSM509710     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509718     2  0.5733      0.513 0.324 0.676 0.000
#> GSM509723     1  0.5835      0.897 0.660 0.000 0.340
#> GSM509728     3  0.6204      0.343 0.424 0.000 0.576
#> GSM509732     3  0.0000      0.517 0.000 0.000 1.000
#> GSM509736     3  0.5968      0.399 0.364 0.000 0.636
#> GSM509741     3  0.0000      0.517 0.000 0.000 1.000
#> GSM509746     3  0.0000      0.517 0.000 0.000 1.000
#> GSM509733     3  0.0000      0.517 0.000 0.000 1.000
#> GSM509737     3  0.5968      0.399 0.364 0.000 0.636
#> GSM509742     3  0.0000      0.517 0.000 0.000 1.000
#> GSM509747     3  0.0000      0.517 0.000 0.000 1.000
#> GSM509734     3  0.0000      0.517 0.000 0.000 1.000
#> GSM509738     3  0.5968      0.399 0.364 0.000 0.636
#> GSM509743     3  0.0237      0.519 0.004 0.000 0.996
#> GSM509748     3  0.1031      0.493 0.024 0.000 0.976
#> GSM509735     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509739     1  0.5905      0.901 0.648 0.000 0.352
#> GSM509744     3  0.4062      0.487 0.164 0.000 0.836
#> GSM509749     3  0.1031      0.493 0.024 0.000 0.976
#> GSM509740     3  0.6520      0.368 0.488 0.004 0.508
#> GSM509745     3  0.6468      0.416 0.444 0.004 0.552
#> GSM509750     3  0.5178      0.496 0.256 0.000 0.744
#> GSM509751     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509753     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509755     2  0.6309     -0.298 0.000 0.500 0.500
#> GSM509757     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509759     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509761     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509763     2  0.0237      0.766 0.000 0.996 0.004
#> GSM509765     2  0.0237      0.766 0.000 0.996 0.004
#> GSM509767     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509769     2  0.6309     -0.289 0.000 0.504 0.496
#> GSM509771     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509773     2  0.0592      0.761 0.000 0.988 0.012
#> GSM509775     2  0.2356      0.703 0.000 0.928 0.072
#> GSM509777     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509779     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509781     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509783     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509785     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509752     2  0.6309     -0.298 0.000 0.500 0.500
#> GSM509754     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509756     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509758     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509760     2  0.6309     -0.298 0.000 0.500 0.500
#> GSM509762     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509764     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509766     2  0.0237      0.766 0.000 0.996 0.004
#> GSM509768     2  0.0237      0.766 0.000 0.996 0.004
#> GSM509770     2  0.6309     -0.298 0.000 0.500 0.500
#> GSM509772     3  0.6309      0.249 0.000 0.500 0.500
#> GSM509774     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509776     2  0.2356      0.703 0.000 0.928 0.072
#> GSM509778     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509780     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509782     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509784     2  0.0000      0.768 0.000 1.000 0.000
#> GSM509786     2  0.0000      0.768 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
#> GSM509706     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509711     1  0.5857      0.541 0.636 0.000 0.308 0.056
#> GSM509714     1  0.7216      0.429 0.548 0.000 0.244 0.208
#> GSM509719     1  0.1302      0.869 0.956 0.000 0.044 0.000
#> GSM509724     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509729     1  0.1302      0.869 0.956 0.000 0.044 0.000
#> GSM509707     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509712     1  0.5857      0.541 0.636 0.000 0.308 0.056
#> GSM509715     4  0.4008      0.689 0.000 0.000 0.244 0.756
#> GSM509720     1  0.1302      0.869 0.956 0.000 0.044 0.000
#> GSM509725     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509730     1  0.1302      0.869 0.956 0.000 0.044 0.000
#> GSM509708     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509713     1  0.5857      0.541 0.636 0.000 0.308 0.056
#> GSM509716     4  0.4008      0.689 0.000 0.000 0.244 0.756
#> GSM509721     1  0.1302      0.869 0.956 0.000 0.044 0.000
#> GSM509726     1  0.0188      0.873 0.996 0.000 0.004 0.000
#> GSM509731     4  0.4008      0.689 0.000 0.000 0.244 0.756
#> GSM509709     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509717     4  0.4008      0.689 0.000 0.000 0.244 0.756
#> GSM509722     1  0.1302      0.869 0.956 0.000 0.044 0.000
#> GSM509727     3  0.5227      0.651 0.256 0.000 0.704 0.040
#> GSM509710     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509718     4  0.4008      0.689 0.000 0.000 0.244 0.756
#> GSM509723     1  0.1302      0.869 0.956 0.000 0.044 0.000
#> GSM509728     3  0.5227      0.651 0.256 0.000 0.704 0.040
#> GSM509732     3  0.4908      0.793 0.292 0.016 0.692 0.000
#> GSM509736     3  0.5179      0.706 0.220 0.000 0.728 0.052
#> GSM509741     3  0.4908      0.793 0.292 0.016 0.692 0.000
#> GSM509746     3  0.4908      0.793 0.292 0.016 0.692 0.000
#> GSM509733     3  0.4908      0.793 0.292 0.016 0.692 0.000
#> GSM509737     3  0.5179      0.706 0.220 0.000 0.728 0.052
#> GSM509742     3  0.4908      0.793 0.292 0.016 0.692 0.000
#> GSM509747     3  0.4908      0.793 0.292 0.016 0.692 0.000
#> GSM509734     3  0.4908      0.793 0.292 0.016 0.692 0.000
#> GSM509738     3  0.5179      0.706 0.220 0.000 0.728 0.052
#> GSM509743     3  0.4883      0.794 0.288 0.016 0.696 0.000
#> GSM509748     3  0.5047      0.784 0.316 0.016 0.668 0.000
#> GSM509735     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.874 1.000 0.000 0.000 0.000
#> GSM509744     3  0.5533      0.772 0.272 0.016 0.688 0.024
#> GSM509749     3  0.5047      0.784 0.316 0.016 0.668 0.000
#> GSM509740     3  0.4852      0.606 0.152 0.000 0.776 0.072
#> GSM509745     3  0.5050      0.644 0.152 0.016 0.780 0.052
#> GSM509750     3  0.4359      0.749 0.164 0.016 0.804 0.016
#> GSM509751     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509763     4  0.2149      0.901 0.000 0.088 0.000 0.912
#> GSM509765     4  0.2149      0.901 0.000 0.088 0.000 0.912
#> GSM509767     2  0.0188      0.996 0.000 0.996 0.000 0.004
#> GSM509769     2  0.0188      0.995 0.000 0.996 0.000 0.004
#> GSM509771     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509773     4  0.2281      0.896 0.000 0.096 0.000 0.904
#> GSM509775     4  0.3801      0.788 0.000 0.220 0.000 0.780
#> GSM509777     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509779     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509781     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509783     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509785     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509752     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0336      0.991 0.000 0.992 0.000 0.008
#> GSM509760     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509766     4  0.2149      0.901 0.000 0.088 0.000 0.912
#> GSM509768     4  0.4103      0.749 0.000 0.256 0.000 0.744
#> GSM509770     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509774     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509776     4  0.3837      0.784 0.000 0.224 0.000 0.776
#> GSM509778     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509780     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509782     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509784     4  0.2081      0.902 0.000 0.084 0.000 0.916
#> GSM509786     4  0.2081      0.902 0.000 0.084 0.000 0.916

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000      0.857 1.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.4288      0.525 0.612 0.000 0.004 0.000 0.384
#> GSM509714     1  0.6261      0.360 0.464 0.000 0.004 0.128 0.404
#> GSM509719     1  0.2605      0.830 0.852 0.000 0.000 0.000 0.148
#> GSM509724     1  0.0162      0.856 0.996 0.000 0.004 0.000 0.000
#> GSM509729     1  0.2605      0.830 0.852 0.000 0.000 0.000 0.148
#> GSM509707     1  0.0000      0.857 1.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.4288      0.525 0.612 0.000 0.004 0.000 0.384
#> GSM509715     4  0.4331      0.578 0.000 0.000 0.004 0.596 0.400
#> GSM509720     1  0.2605      0.830 0.852 0.000 0.000 0.000 0.148
#> GSM509725     1  0.0162      0.856 0.996 0.000 0.004 0.000 0.000
#> GSM509730     1  0.2605      0.830 0.852 0.000 0.000 0.000 0.148
#> GSM509708     1  0.0000      0.857 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.4288      0.525 0.612 0.000 0.004 0.000 0.384
#> GSM509716     4  0.4331      0.578 0.000 0.000 0.004 0.596 0.400
#> GSM509721     1  0.2605      0.830 0.852 0.000 0.000 0.000 0.148
#> GSM509726     1  0.0671      0.851 0.980 0.000 0.016 0.000 0.004
#> GSM509731     4  0.4331      0.578 0.000 0.000 0.004 0.596 0.400
#> GSM509709     1  0.0000      0.857 1.000 0.000 0.000 0.000 0.000
#> GSM509717     4  0.4331      0.578 0.000 0.000 0.004 0.596 0.400
#> GSM509722     1  0.2605      0.830 0.852 0.000 0.000 0.000 0.148
#> GSM509727     5  0.4489      0.759 0.068 0.000 0.192 0.000 0.740
#> GSM509710     1  0.0000      0.857 1.000 0.000 0.000 0.000 0.000
#> GSM509718     4  0.4331      0.578 0.000 0.000 0.004 0.596 0.400
#> GSM509723     1  0.2605      0.830 0.852 0.000 0.000 0.000 0.148
#> GSM509728     5  0.4489      0.759 0.068 0.000 0.192 0.000 0.740
#> GSM509732     3  0.0290      0.638 0.008 0.000 0.992 0.000 0.000
#> GSM509736     5  0.3521      0.795 0.004 0.000 0.232 0.000 0.764
#> GSM509741     3  0.4310      0.390 0.004 0.000 0.604 0.000 0.392
#> GSM509746     3  0.0290      0.638 0.008 0.000 0.992 0.000 0.000
#> GSM509733     3  0.0290      0.638 0.008 0.000 0.992 0.000 0.000
#> GSM509737     5  0.3521      0.795 0.004 0.000 0.232 0.000 0.764
#> GSM509742     3  0.4310      0.390 0.004 0.000 0.604 0.000 0.392
#> GSM509747     3  0.0290      0.638 0.008 0.000 0.992 0.000 0.000
#> GSM509734     3  0.0609      0.625 0.020 0.000 0.980 0.000 0.000
#> GSM509738     5  0.3521      0.795 0.004 0.000 0.232 0.000 0.764
#> GSM509743     3  0.4171      0.382 0.000 0.000 0.604 0.000 0.396
#> GSM509748     3  0.4375      0.319 0.004 0.000 0.576 0.000 0.420
#> GSM509735     1  0.0000      0.857 1.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.857 1.000 0.000 0.000 0.000 0.000
#> GSM509744     5  0.4249      0.318 0.000 0.000 0.432 0.000 0.568
#> GSM509749     3  0.4375      0.319 0.004 0.000 0.576 0.000 0.420
#> GSM509740     5  0.2233      0.733 0.004 0.000 0.104 0.000 0.892
#> GSM509745     5  0.2605      0.759 0.000 0.000 0.148 0.000 0.852
#> GSM509750     5  0.3983      0.600 0.000 0.000 0.340 0.000 0.660
#> GSM509751     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509763     4  0.0162      0.881 0.000 0.004 0.000 0.996 0.000
#> GSM509765     4  0.0162      0.881 0.000 0.004 0.000 0.996 0.000
#> GSM509767     2  0.0162      0.995 0.000 0.996 0.000 0.004 0.000
#> GSM509769     2  0.0162      0.995 0.000 0.996 0.000 0.004 0.000
#> GSM509771     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509773     4  0.0404      0.877 0.000 0.012 0.000 0.988 0.000
#> GSM509775     4  0.2690      0.773 0.000 0.156 0.000 0.844 0.000
#> GSM509777     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509779     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509781     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509783     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509785     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509752     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0404      0.986 0.000 0.988 0.000 0.012 0.000
#> GSM509760     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509766     4  0.0162      0.881 0.000 0.004 0.000 0.996 0.000
#> GSM509768     4  0.3109      0.730 0.000 0.200 0.000 0.800 0.000
#> GSM509770     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509772     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509776     4  0.2773      0.767 0.000 0.164 0.000 0.836 0.000
#> GSM509778     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509780     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509782     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509784     4  0.0000      0.881 0.000 0.000 0.000 1.000 0.000
#> GSM509786     4  0.0000      0.881 0.000 0.000 0.000 1.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
#> GSM509706     1  0.0000      0.856 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.5238      0.412 0.604 0.000 0.000 0.000 0.236 0.160
#> GSM509714     5  0.5190     -0.230 0.452 0.000 0.000 0.000 0.460 0.088
#> GSM509719     1  0.2669      0.820 0.836 0.000 0.000 0.000 0.008 0.156
#> GSM509724     1  0.0146      0.855 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM509729     1  0.2669      0.820 0.836 0.000 0.000 0.000 0.008 0.156
#> GSM509707     1  0.0000      0.856 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.5238      0.412 0.604 0.000 0.000 0.000 0.236 0.160
#> GSM509715     5  0.0260      0.843 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM509720     1  0.2669      0.820 0.836 0.000 0.000 0.000 0.008 0.156
#> GSM509725     1  0.0146      0.855 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM509730     1  0.2669      0.820 0.836 0.000 0.000 0.000 0.008 0.156
#> GSM509708     1  0.0000      0.856 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.5238      0.412 0.604 0.000 0.000 0.000 0.236 0.160
#> GSM509716     5  0.0260      0.843 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM509721     1  0.2669      0.820 0.836 0.000 0.000 0.000 0.008 0.156
#> GSM509726     1  0.0603      0.849 0.980 0.000 0.004 0.000 0.000 0.016
#> GSM509731     5  0.0260      0.843 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM509709     1  0.0000      0.856 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.0260      0.843 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM509722     1  0.2669      0.820 0.836 0.000 0.000 0.000 0.008 0.156
#> GSM509727     6  0.1563      0.698 0.056 0.000 0.012 0.000 0.000 0.932
#> GSM509710     1  0.0000      0.856 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.0717      0.833 0.000 0.000 0.000 0.008 0.976 0.016
#> GSM509723     1  0.2669      0.820 0.836 0.000 0.000 0.000 0.008 0.156
#> GSM509728     6  0.1563      0.698 0.056 0.000 0.012 0.000 0.000 0.932
#> GSM509732     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     6  0.2474      0.741 0.000 0.000 0.080 0.000 0.040 0.880
#> GSM509741     6  0.3843      0.525 0.000 0.000 0.452 0.000 0.000 0.548
#> GSM509746     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     6  0.2474      0.741 0.000 0.000 0.080 0.000 0.040 0.880
#> GSM509742     6  0.3843      0.525 0.000 0.000 0.452 0.000 0.000 0.548
#> GSM509747     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.0820      0.966 0.016 0.000 0.972 0.000 0.000 0.012
#> GSM509738     6  0.2474      0.741 0.000 0.000 0.080 0.000 0.040 0.880
#> GSM509743     6  0.3838      0.531 0.000 0.000 0.448 0.000 0.000 0.552
#> GSM509748     6  0.3756      0.594 0.000 0.000 0.400 0.000 0.000 0.600
#> GSM509735     1  0.0000      0.856 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.856 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     6  0.3151      0.700 0.000 0.000 0.252 0.000 0.000 0.748
#> GSM509749     6  0.3756      0.594 0.000 0.000 0.400 0.000 0.000 0.600
#> GSM509740     6  0.1765      0.680 0.000 0.000 0.000 0.000 0.096 0.904
#> GSM509745     6  0.2221      0.702 0.000 0.000 0.032 0.000 0.072 0.896
#> GSM509750     6  0.3269      0.728 0.000 0.000 0.184 0.000 0.024 0.792
#> GSM509751     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509763     4  0.0146      0.959 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509765     4  0.0146      0.959 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509767     2  0.0146      0.995 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509769     2  0.0146      0.995 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509771     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509773     4  0.0363      0.953 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM509775     4  0.2416      0.810 0.000 0.156 0.000 0.844 0.000 0.000
#> GSM509777     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509779     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509781     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509783     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509785     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509752     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0363      0.986 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM509760     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509766     4  0.0146      0.959 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509768     4  0.2793      0.746 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM509770     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509772     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509774     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509776     4  0.2491      0.801 0.000 0.164 0.000 0.836 0.000 0.000
#> GSM509778     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509780     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509782     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509784     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509786     4  0.0000      0.960 0.000 0.000 0.000 1.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-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)  time(p) k
#> MAD:hclust  0               NA       NA 2
#> MAD:hclust 52         1.47e-14 5.95e-05 3
#> MAD:hclust 80         7.11e-22 1.39e-07 4
#> MAD:hclust 74         4.64e-18 1.27e-07 5
#> MAD:hclust 77         1.36e-22 3.65e-08 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 19175 rows and 81 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.974       0.990         0.5061 0.494   0.494
#> 3 3 0.652           0.457       0.765         0.2470 0.966   0.931
#> 4 4 0.710           0.716       0.783         0.1457 0.767   0.508
#> 5 5 0.680           0.777       0.833         0.0663 0.931   0.743
#> 6 6 0.780           0.714       0.790         0.0470 0.982   0.919

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1    0.00     1.0000 1.000 0.000
#> GSM509711     1    0.00     1.0000 1.000 0.000
#> GSM509714     1    0.00     1.0000 1.000 0.000
#> GSM509719     1    0.00     1.0000 1.000 0.000
#> GSM509724     1    0.00     1.0000 1.000 0.000
#> GSM509729     1    0.00     1.0000 1.000 0.000
#> GSM509707     1    0.00     1.0000 1.000 0.000
#> GSM509712     1    0.00     1.0000 1.000 0.000
#> GSM509715     2    0.43     0.9016 0.088 0.912
#> GSM509720     1    0.00     1.0000 1.000 0.000
#> GSM509725     1    0.00     1.0000 1.000 0.000
#> GSM509730     1    0.00     1.0000 1.000 0.000
#> GSM509708     1    0.00     1.0000 1.000 0.000
#> GSM509713     1    0.00     1.0000 1.000 0.000
#> GSM509716     2    0.43     0.9016 0.088 0.912
#> GSM509721     1    0.00     1.0000 1.000 0.000
#> GSM509726     1    0.00     1.0000 1.000 0.000
#> GSM509731     2    1.00     0.0767 0.488 0.512
#> GSM509709     1    0.00     1.0000 1.000 0.000
#> GSM509717     2    0.43     0.9016 0.088 0.912
#> GSM509722     1    0.00     1.0000 1.000 0.000
#> GSM509727     1    0.00     1.0000 1.000 0.000
#> GSM509710     1    0.00     1.0000 1.000 0.000
#> GSM509718     2    0.43     0.9016 0.088 0.912
#> GSM509723     1    0.00     1.0000 1.000 0.000
#> GSM509728     1    0.00     1.0000 1.000 0.000
#> GSM509732     1    0.00     1.0000 1.000 0.000
#> GSM509736     1    0.00     1.0000 1.000 0.000
#> GSM509741     1    0.00     1.0000 1.000 0.000
#> GSM509746     1    0.00     1.0000 1.000 0.000
#> GSM509733     1    0.00     1.0000 1.000 0.000
#> GSM509737     1    0.00     1.0000 1.000 0.000
#> GSM509742     1    0.00     1.0000 1.000 0.000
#> GSM509747     1    0.00     1.0000 1.000 0.000
#> GSM509734     1    0.00     1.0000 1.000 0.000
#> GSM509738     1    0.00     1.0000 1.000 0.000
#> GSM509743     1    0.00     1.0000 1.000 0.000
#> GSM509748     1    0.00     1.0000 1.000 0.000
#> GSM509735     1    0.00     1.0000 1.000 0.000
#> GSM509739     1    0.00     1.0000 1.000 0.000
#> GSM509744     1    0.00     1.0000 1.000 0.000
#> GSM509749     1    0.00     1.0000 1.000 0.000
#> GSM509740     1    0.00     1.0000 1.000 0.000
#> GSM509745     1    0.00     1.0000 1.000 0.000
#> GSM509750     1    0.00     1.0000 1.000 0.000
#> GSM509751     2    0.00     0.9789 0.000 1.000
#> GSM509753     2    0.00     0.9789 0.000 1.000
#> GSM509755     2    0.00     0.9789 0.000 1.000
#> GSM509757     2    0.00     0.9789 0.000 1.000
#> GSM509759     2    0.00     0.9789 0.000 1.000
#> GSM509761     2    0.00     0.9789 0.000 1.000
#> GSM509763     2    0.00     0.9789 0.000 1.000
#> GSM509765     2    0.00     0.9789 0.000 1.000
#> GSM509767     2    0.00     0.9789 0.000 1.000
#> GSM509769     2    0.00     0.9789 0.000 1.000
#> GSM509771     2    0.00     0.9789 0.000 1.000
#> GSM509773     2    0.00     0.9789 0.000 1.000
#> GSM509775     2    0.00     0.9789 0.000 1.000
#> GSM509777     2    0.00     0.9789 0.000 1.000
#> GSM509779     2    0.00     0.9789 0.000 1.000
#> GSM509781     2    0.00     0.9789 0.000 1.000
#> GSM509783     2    0.00     0.9789 0.000 1.000
#> GSM509785     2    0.00     0.9789 0.000 1.000
#> GSM509752     2    0.00     0.9789 0.000 1.000
#> GSM509754     2    0.00     0.9789 0.000 1.000
#> GSM509756     2    0.00     0.9789 0.000 1.000
#> GSM509758     2    0.00     0.9789 0.000 1.000
#> GSM509760     2    0.00     0.9789 0.000 1.000
#> GSM509762     2    0.00     0.9789 0.000 1.000
#> GSM509764     2    0.00     0.9789 0.000 1.000
#> GSM509766     2    0.00     0.9789 0.000 1.000
#> GSM509768     2    0.00     0.9789 0.000 1.000
#> GSM509770     2    0.00     0.9789 0.000 1.000
#> GSM509772     2    0.00     0.9789 0.000 1.000
#> GSM509774     2    0.00     0.9789 0.000 1.000
#> GSM509776     2    0.00     0.9789 0.000 1.000
#> GSM509778     2    0.00     0.9789 0.000 1.000
#> GSM509780     2    0.00     0.9789 0.000 1.000
#> GSM509782     2    0.00     0.9789 0.000 1.000
#> GSM509784     2    0.00     0.9789 0.000 1.000
#> GSM509786     2    0.00     0.9789 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
#> GSM509706     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509711     1  0.4235      0.379 0.824 0.000 0.176
#> GSM509714     1  0.7556      0.226 0.676 0.100 0.224
#> GSM509719     1  0.3941      0.434 0.844 0.000 0.156
#> GSM509724     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509729     1  0.0592      0.503 0.988 0.000 0.012
#> GSM509707     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509712     1  0.4654      0.367 0.792 0.000 0.208
#> GSM509715     2  0.6940      0.336 0.068 0.708 0.224
#> GSM509720     1  0.3941      0.434 0.844 0.000 0.156
#> GSM509725     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509730     1  0.2625      0.454 0.916 0.000 0.084
#> GSM509708     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509713     1  0.4235      0.379 0.824 0.000 0.176
#> GSM509716     2  0.6940      0.336 0.068 0.708 0.224
#> GSM509721     1  0.3941      0.434 0.844 0.000 0.156
#> GSM509726     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509731     2  0.9684     -0.240 0.340 0.436 0.224
#> GSM509709     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509717     2  0.6940      0.336 0.068 0.708 0.224
#> GSM509722     1  0.4452      0.403 0.808 0.000 0.192
#> GSM509727     1  0.4750      0.364 0.784 0.000 0.216
#> GSM509710     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509718     2  0.6940      0.336 0.068 0.708 0.224
#> GSM509723     1  0.3941      0.434 0.844 0.000 0.156
#> GSM509728     1  0.2796      0.424 0.908 0.000 0.092
#> GSM509732     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509736     1  0.6252     -0.500 0.556 0.000 0.444
#> GSM509741     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509746     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509733     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509737     1  0.6252     -0.500 0.556 0.000 0.444
#> GSM509742     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509747     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509734     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509738     3  0.6260      0.921 0.448 0.000 0.552
#> GSM509743     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509748     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509735     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509739     1  0.0000      0.506 1.000 0.000 0.000
#> GSM509744     1  0.6309     -0.699 0.500 0.000 0.500
#> GSM509749     1  0.6235     -0.474 0.564 0.000 0.436
#> GSM509740     1  0.5098      0.336 0.752 0.000 0.248
#> GSM509745     3  0.6204      0.900 0.424 0.000 0.576
#> GSM509750     3  0.6215      0.906 0.428 0.000 0.572
#> GSM509751     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509753     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509755     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509757     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509759     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509761     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509763     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509765     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509767     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509769     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509771     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509773     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509775     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509777     2  0.5016      0.792 0.000 0.760 0.240
#> GSM509779     2  0.0000      0.686 0.000 1.000 0.000
#> GSM509781     2  0.0000      0.686 0.000 1.000 0.000
#> GSM509783     2  0.0000      0.686 0.000 1.000 0.000
#> GSM509785     2  0.0000      0.686 0.000 1.000 0.000
#> GSM509752     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509754     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509756     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509758     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509760     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509762     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509764     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509766     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509768     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509770     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509772     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509774     2  0.3340      0.742 0.000 0.880 0.120
#> GSM509776     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509778     2  0.0000      0.686 0.000 1.000 0.000
#> GSM509780     2  0.6079      0.845 0.000 0.612 0.388
#> GSM509782     2  0.0000      0.686 0.000 1.000 0.000
#> GSM509784     2  0.0000      0.686 0.000 1.000 0.000
#> GSM509786     2  0.0000      0.686 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
#> GSM509706     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509711     1  0.5056      0.447 0.732 0.000 0.044 0.224
#> GSM509714     1  0.4795      0.349 0.696 0.000 0.012 0.292
#> GSM509719     1  0.7198      0.577 0.520 0.000 0.320 0.160
#> GSM509724     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509729     1  0.4964      0.638 0.616 0.000 0.380 0.004
#> GSM509707     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509712     1  0.5123      0.440 0.724 0.000 0.044 0.232
#> GSM509715     4  0.4990      0.384 0.352 0.000 0.008 0.640
#> GSM509720     1  0.7184      0.577 0.524 0.000 0.316 0.160
#> GSM509725     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509730     1  0.5620      0.596 0.560 0.000 0.416 0.024
#> GSM509708     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509713     1  0.1820      0.534 0.944 0.000 0.036 0.020
#> GSM509716     4  0.4990      0.384 0.352 0.000 0.008 0.640
#> GSM509721     1  0.7184      0.577 0.524 0.000 0.316 0.160
#> GSM509726     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509731     4  0.5007      0.382 0.356 0.000 0.008 0.636
#> GSM509709     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509717     4  0.4990      0.384 0.352 0.000 0.008 0.640
#> GSM509722     1  0.6429      0.542 0.648 0.000 0.192 0.160
#> GSM509727     1  0.5632      0.482 0.712 0.000 0.092 0.196
#> GSM509710     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509718     4  0.4990      0.384 0.352 0.000 0.008 0.640
#> GSM509723     1  0.7184      0.577 0.524 0.000 0.316 0.160
#> GSM509728     3  0.5827     -0.432 0.436 0.000 0.532 0.032
#> GSM509732     3  0.0469      0.829 0.012 0.000 0.988 0.000
#> GSM509736     3  0.1545      0.812 0.008 0.000 0.952 0.040
#> GSM509741     3  0.0000      0.832 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0469      0.829 0.012 0.000 0.988 0.000
#> GSM509733     3  0.0469      0.829 0.012 0.000 0.988 0.000
#> GSM509737     3  0.1545      0.812 0.008 0.000 0.952 0.040
#> GSM509742     3  0.0000      0.832 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0469      0.829 0.012 0.000 0.988 0.000
#> GSM509734     3  0.0469      0.829 0.012 0.000 0.988 0.000
#> GSM509738     3  0.6001      0.521 0.184 0.000 0.688 0.128
#> GSM509743     3  0.0188      0.831 0.000 0.000 0.996 0.004
#> GSM509748     3  0.0469      0.829 0.012 0.000 0.988 0.000
#> GSM509735     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509739     1  0.4817      0.638 0.612 0.000 0.388 0.000
#> GSM509744     3  0.3182      0.739 0.096 0.000 0.876 0.028
#> GSM509749     3  0.0188      0.831 0.000 0.000 0.996 0.004
#> GSM509740     1  0.5837      0.404 0.668 0.000 0.072 0.260
#> GSM509745     3  0.7098      0.312 0.312 0.000 0.536 0.152
#> GSM509750     3  0.4679      0.626 0.184 0.000 0.772 0.044
#> GSM509751     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509763     2  0.2943      0.887 0.032 0.892 0.000 0.076
#> GSM509765     2  0.2644      0.906 0.032 0.908 0.000 0.060
#> GSM509767     2  0.0921      0.962 0.028 0.972 0.000 0.000
#> GSM509769     2  0.0188      0.971 0.004 0.996 0.000 0.000
#> GSM509771     2  0.0921      0.962 0.028 0.972 0.000 0.000
#> GSM509773     2  0.1022      0.960 0.032 0.968 0.000 0.000
#> GSM509775     2  0.1022      0.960 0.032 0.968 0.000 0.000
#> GSM509777     4  0.5838      0.306 0.032 0.444 0.000 0.524
#> GSM509779     4  0.5085      0.675 0.032 0.260 0.000 0.708
#> GSM509781     4  0.4134      0.692 0.000 0.260 0.000 0.740
#> GSM509783     4  0.4134      0.692 0.000 0.260 0.000 0.740
#> GSM509785     4  0.4134      0.692 0.000 0.260 0.000 0.740
#> GSM509752     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509766     2  0.2565      0.911 0.032 0.912 0.000 0.056
#> GSM509768     2  0.1022      0.960 0.032 0.968 0.000 0.000
#> GSM509770     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM509774     4  0.5432      0.598 0.032 0.316 0.000 0.652
#> GSM509776     2  0.1022      0.960 0.032 0.968 0.000 0.000
#> GSM509778     4  0.4134      0.692 0.000 0.260 0.000 0.740
#> GSM509780     2  0.3523      0.838 0.032 0.856 0.000 0.112
#> GSM509782     4  0.4134      0.692 0.000 0.260 0.000 0.740
#> GSM509784     4  0.5085      0.675 0.032 0.260 0.000 0.708
#> GSM509786     4  0.4134      0.692 0.000 0.260 0.000 0.740

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0162     0.7679 0.996 0.000 0.004 0.000 0.000
#> GSM509711     5  0.4180     0.6078 0.220 0.000 0.000 0.036 0.744
#> GSM509714     5  0.2305     0.7319 0.092 0.000 0.000 0.012 0.896
#> GSM509719     1  0.6570     0.4439 0.528 0.000 0.040 0.096 0.336
#> GSM509724     1  0.0671     0.7637 0.980 0.000 0.004 0.016 0.000
#> GSM509729     1  0.3579     0.7116 0.828 0.000 0.000 0.100 0.072
#> GSM509707     1  0.0162     0.7679 0.996 0.000 0.004 0.000 0.000
#> GSM509712     5  0.3954     0.6314 0.192 0.000 0.000 0.036 0.772
#> GSM509715     5  0.2124     0.7812 0.004 0.000 0.000 0.096 0.900
#> GSM509720     1  0.6570     0.4439 0.528 0.000 0.040 0.096 0.336
#> GSM509725     1  0.0671     0.7637 0.980 0.000 0.004 0.016 0.000
#> GSM509730     1  0.5056     0.6723 0.752 0.000 0.040 0.100 0.108
#> GSM509708     1  0.0162     0.7679 0.996 0.000 0.004 0.000 0.000
#> GSM509713     1  0.4479     0.4950 0.700 0.000 0.000 0.036 0.264
#> GSM509716     5  0.2124     0.7812 0.004 0.000 0.000 0.096 0.900
#> GSM509721     1  0.6570     0.4439 0.528 0.000 0.040 0.096 0.336
#> GSM509726     1  0.1041     0.7597 0.964 0.000 0.004 0.032 0.000
#> GSM509731     5  0.1892     0.7814 0.004 0.000 0.000 0.080 0.916
#> GSM509709     1  0.0162     0.7679 0.996 0.000 0.004 0.000 0.000
#> GSM509717     5  0.2124     0.7812 0.004 0.000 0.000 0.096 0.900
#> GSM509722     1  0.6595     0.3585 0.492 0.000 0.036 0.096 0.376
#> GSM509727     5  0.5564     0.4523 0.284 0.000 0.004 0.092 0.620
#> GSM509710     1  0.0162     0.7679 0.996 0.000 0.004 0.000 0.000
#> GSM509718     5  0.2338     0.7774 0.004 0.000 0.000 0.112 0.884
#> GSM509723     1  0.6570     0.4439 0.528 0.000 0.040 0.096 0.336
#> GSM509728     1  0.7225    -0.1915 0.436 0.000 0.384 0.092 0.088
#> GSM509732     3  0.2286     0.9075 0.108 0.000 0.888 0.004 0.000
#> GSM509736     3  0.5531     0.8538 0.108 0.000 0.724 0.080 0.088
#> GSM509741     3  0.2127     0.9074 0.108 0.000 0.892 0.000 0.000
#> GSM509746     3  0.2286     0.9075 0.108 0.000 0.888 0.004 0.000
#> GSM509733     3  0.2286     0.9075 0.108 0.000 0.888 0.004 0.000
#> GSM509737     3  0.5531     0.8538 0.108 0.000 0.724 0.080 0.088
#> GSM509742     3  0.2127     0.9074 0.108 0.000 0.892 0.000 0.000
#> GSM509747     3  0.2286     0.9075 0.108 0.000 0.888 0.004 0.000
#> GSM509734     3  0.2286     0.9075 0.108 0.000 0.888 0.004 0.000
#> GSM509738     3  0.6837     0.4172 0.068 0.000 0.496 0.080 0.356
#> GSM509743     3  0.4461     0.8851 0.108 0.000 0.792 0.068 0.032
#> GSM509748     3  0.2286     0.9075 0.108 0.000 0.888 0.004 0.000
#> GSM509735     1  0.0162     0.7679 0.996 0.000 0.004 0.000 0.000
#> GSM509739     1  0.0324     0.7669 0.992 0.000 0.004 0.004 0.000
#> GSM509744     3  0.5325     0.8471 0.084 0.000 0.740 0.076 0.100
#> GSM509749     3  0.3654     0.8979 0.108 0.000 0.836 0.036 0.020
#> GSM509740     5  0.2983     0.7281 0.056 0.000 0.000 0.076 0.868
#> GSM509745     5  0.6357    -0.0356 0.024 0.000 0.384 0.092 0.500
#> GSM509750     3  0.5466     0.8175 0.068 0.000 0.724 0.076 0.132
#> GSM509751     2  0.0290     0.9128 0.000 0.992 0.008 0.000 0.000
#> GSM509753     2  0.0290     0.9128 0.000 0.992 0.008 0.000 0.000
#> GSM509755     2  0.0290     0.9128 0.000 0.992 0.008 0.000 0.000
#> GSM509757     2  0.0404     0.9118 0.000 0.988 0.012 0.000 0.000
#> GSM509759     2  0.0609     0.9083 0.000 0.980 0.020 0.000 0.000
#> GSM509761     2  0.0404     0.9127 0.000 0.988 0.012 0.000 0.000
#> GSM509763     2  0.4675     0.7001 0.000 0.744 0.088 0.164 0.004
#> GSM509765     2  0.4675     0.7001 0.000 0.744 0.088 0.164 0.004
#> GSM509767     2  0.1757     0.9001 0.000 0.936 0.048 0.012 0.004
#> GSM509769     2  0.0932     0.9077 0.000 0.972 0.020 0.004 0.004
#> GSM509771     2  0.1757     0.9001 0.000 0.936 0.048 0.012 0.004
#> GSM509773     2  0.3178     0.8451 0.000 0.860 0.088 0.048 0.004
#> GSM509775     2  0.3178     0.8451 0.000 0.860 0.088 0.048 0.004
#> GSM509777     4  0.5279     0.7970 0.000 0.268 0.076 0.652 0.004
#> GSM509779     4  0.4021     0.9130 0.000 0.200 0.036 0.764 0.000
#> GSM509781     4  0.4237     0.9361 0.000 0.200 0.000 0.752 0.048
#> GSM509783     4  0.4237     0.9361 0.000 0.200 0.000 0.752 0.048
#> GSM509785     4  0.4237     0.9361 0.000 0.200 0.000 0.752 0.048
#> GSM509752     2  0.0000     0.9140 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0162     0.9136 0.000 0.996 0.004 0.000 0.000
#> GSM509756     2  0.0000     0.9140 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0000     0.9140 0.000 1.000 0.000 0.000 0.000
#> GSM509760     2  0.0162     0.9136 0.000 0.996 0.004 0.000 0.000
#> GSM509762     2  0.0000     0.9140 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000     0.9140 0.000 1.000 0.000 0.000 0.000
#> GSM509766     2  0.4559     0.7193 0.000 0.756 0.088 0.152 0.004
#> GSM509768     2  0.3178     0.8451 0.000 0.860 0.088 0.048 0.004
#> GSM509770     2  0.0404     0.9139 0.000 0.988 0.012 0.000 0.000
#> GSM509772     2  0.0609     0.9083 0.000 0.980 0.020 0.000 0.000
#> GSM509774     4  0.5004     0.8642 0.000 0.224 0.076 0.696 0.004
#> GSM509776     2  0.3178     0.8451 0.000 0.860 0.088 0.048 0.004
#> GSM509778     4  0.4168     0.9358 0.000 0.200 0.000 0.756 0.044
#> GSM509780     2  0.5067     0.6196 0.000 0.700 0.092 0.204 0.004
#> GSM509782     4  0.4237     0.9361 0.000 0.200 0.000 0.752 0.048
#> GSM509784     4  0.4459     0.9032 0.000 0.200 0.052 0.744 0.004
#> GSM509786     4  0.4237     0.9361 0.000 0.200 0.000 0.752 0.048

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM509706     1  0.0653      0.738 0.980 0.000 0.012 0.004 0.000 NA
#> GSM509711     5  0.5159      0.576 0.188 0.000 0.000 0.032 0.676 NA
#> GSM509714     5  0.1794      0.749 0.036 0.000 0.000 0.000 0.924 NA
#> GSM509719     1  0.6332      0.442 0.424 0.000 0.016 0.000 0.232 NA
#> GSM509724     1  0.0912      0.733 0.972 0.000 0.012 0.004 0.008 NA
#> GSM509729     1  0.5044      0.609 0.616 0.000 0.004 0.016 0.052 NA
#> GSM509707     1  0.0653      0.738 0.980 0.000 0.012 0.004 0.000 NA
#> GSM509712     5  0.5082      0.594 0.172 0.000 0.000 0.032 0.688 NA
#> GSM509715     5  0.1863      0.792 0.000 0.000 0.000 0.104 0.896 NA
#> GSM509720     1  0.6332      0.442 0.424 0.000 0.016 0.000 0.232 NA
#> GSM509725     1  0.0912      0.733 0.972 0.000 0.012 0.004 0.008 NA
#> GSM509730     1  0.5624      0.581 0.568 0.000 0.020 0.016 0.064 NA
#> GSM509708     1  0.0653      0.738 0.980 0.000 0.012 0.004 0.000 NA
#> GSM509713     1  0.5295      0.479 0.656 0.000 0.000 0.032 0.208 NA
#> GSM509716     5  0.1863      0.792 0.000 0.000 0.000 0.104 0.896 NA
#> GSM509721     1  0.6332      0.442 0.424 0.000 0.016 0.000 0.232 NA
#> GSM509726     1  0.2911      0.688 0.880 0.000 0.012 0.028 0.032 NA
#> GSM509731     5  0.2006      0.791 0.000 0.000 0.000 0.104 0.892 NA
#> GSM509709     1  0.0653      0.738 0.980 0.000 0.012 0.004 0.000 NA
#> GSM509717     5  0.1863      0.792 0.000 0.000 0.000 0.104 0.896 NA
#> GSM509722     1  0.6381      0.413 0.408 0.000 0.016 0.000 0.248 NA
#> GSM509727     5  0.6706      0.453 0.184 0.000 0.004 0.060 0.492 NA
#> GSM509710     1  0.0653      0.738 0.980 0.000 0.012 0.004 0.000 NA
#> GSM509718     5  0.2006      0.791 0.000 0.000 0.000 0.104 0.892 NA
#> GSM509723     1  0.6332      0.442 0.424 0.000 0.016 0.000 0.232 NA
#> GSM509728     3  0.8001      0.269 0.300 0.000 0.304 0.064 0.068 NA
#> GSM509732     3  0.1477      0.784 0.048 0.000 0.940 0.004 0.000 NA
#> GSM509736     3  0.5880      0.715 0.048 0.000 0.612 0.036 0.044 NA
#> GSM509741     3  0.1219      0.785 0.048 0.000 0.948 0.000 0.000 NA
#> GSM509746     3  0.1477      0.784 0.048 0.000 0.940 0.004 0.000 NA
#> GSM509733     3  0.1477      0.784 0.048 0.000 0.940 0.004 0.000 NA
#> GSM509737     3  0.5880      0.715 0.048 0.000 0.612 0.036 0.044 NA
#> GSM509742     3  0.1219      0.785 0.048 0.000 0.948 0.000 0.000 NA
#> GSM509747     3  0.1477      0.784 0.048 0.000 0.940 0.004 0.000 NA
#> GSM509734     3  0.1477      0.784 0.048 0.000 0.940 0.004 0.000 NA
#> GSM509738     3  0.7173      0.400 0.020 0.000 0.396 0.044 0.236 NA
#> GSM509743     3  0.4722      0.758 0.048 0.000 0.732 0.028 0.016 NA
#> GSM509748     3  0.1333      0.784 0.048 0.000 0.944 0.000 0.000 NA
#> GSM509735     1  0.0363      0.738 0.988 0.000 0.012 0.000 0.000 NA
#> GSM509739     1  0.0363      0.738 0.988 0.000 0.012 0.000 0.000 NA
#> GSM509744     3  0.5621      0.725 0.036 0.000 0.652 0.036 0.052 NA
#> GSM509749     3  0.3912      0.773 0.048 0.000 0.808 0.024 0.012 NA
#> GSM509740     5  0.4686      0.589 0.008 0.000 0.004 0.044 0.648 NA
#> GSM509745     3  0.7072      0.218 0.008 0.000 0.336 0.044 0.312 NA
#> GSM509750     3  0.6040      0.680 0.020 0.000 0.604 0.044 0.092 NA
#> GSM509751     2  0.0508      0.837 0.000 0.984 0.012 0.000 0.000 NA
#> GSM509753     2  0.0653      0.837 0.000 0.980 0.012 0.000 0.004 NA
#> GSM509755     2  0.0653      0.837 0.000 0.980 0.012 0.000 0.004 NA
#> GSM509757     2  0.0767      0.836 0.000 0.976 0.012 0.000 0.004 NA
#> GSM509759     2  0.1478      0.825 0.000 0.944 0.020 0.000 0.004 NA
#> GSM509761     2  0.1219      0.838 0.000 0.948 0.004 0.000 0.000 NA
#> GSM509763     2  0.5195      0.587 0.000 0.568 0.016 0.064 0.000 NA
#> GSM509765     2  0.4717      0.611 0.000 0.580 0.000 0.056 0.000 NA
#> GSM509767     2  0.2783      0.807 0.000 0.836 0.016 0.000 0.000 NA
#> GSM509769     2  0.2361      0.818 0.000 0.880 0.012 0.000 0.004 NA
#> GSM509771     2  0.2783      0.807 0.000 0.836 0.016 0.000 0.000 NA
#> GSM509773     2  0.3769      0.682 0.000 0.640 0.004 0.000 0.000 NA
#> GSM509775     2  0.3861      0.683 0.000 0.640 0.008 0.000 0.000 NA
#> GSM509777     4  0.5714      0.688 0.000 0.128 0.016 0.544 0.000 NA
#> GSM509779     4  0.4341      0.819 0.000 0.084 0.016 0.748 0.000 NA
#> GSM509781     4  0.1610      0.864 0.000 0.084 0.000 0.916 0.000 NA
#> GSM509783     4  0.1610      0.864 0.000 0.084 0.000 0.916 0.000 NA
#> GSM509785     4  0.1610      0.864 0.000 0.084 0.000 0.916 0.000 NA
#> GSM509752     2  0.0260      0.840 0.000 0.992 0.000 0.000 0.000 NA
#> GSM509754     2  0.0000      0.839 0.000 1.000 0.000 0.000 0.000 NA
#> GSM509756     2  0.0665      0.840 0.000 0.980 0.008 0.000 0.004 NA
#> GSM509758     2  0.0363      0.841 0.000 0.988 0.000 0.000 0.000 NA
#> GSM509760     2  0.0665      0.839 0.000 0.980 0.008 0.000 0.004 NA
#> GSM509762     2  0.0603      0.841 0.000 0.980 0.004 0.000 0.000 NA
#> GSM509764     2  0.0665      0.840 0.000 0.980 0.008 0.000 0.004 NA
#> GSM509766     2  0.4717      0.611 0.000 0.580 0.000 0.056 0.000 NA
#> GSM509768     2  0.3861      0.683 0.000 0.640 0.008 0.000 0.000 NA
#> GSM509770     2  0.1578      0.836 0.000 0.936 0.012 0.000 0.004 NA
#> GSM509772     2  0.1485      0.828 0.000 0.944 0.024 0.000 0.004 NA
#> GSM509774     4  0.5452      0.722 0.000 0.100 0.016 0.576 0.000 NA
#> GSM509776     2  0.3969      0.685 0.000 0.644 0.008 0.000 0.004 NA
#> GSM509778     4  0.1897      0.862 0.004 0.084 0.000 0.908 0.000 NA
#> GSM509780     2  0.5597      0.516 0.000 0.524 0.016 0.100 0.000 NA
#> GSM509782     4  0.1610      0.864 0.000 0.084 0.000 0.916 0.000 NA
#> GSM509784     4  0.4995      0.774 0.000 0.084 0.016 0.656 0.000 NA
#> GSM509786     4  0.1610      0.864 0.000 0.084 0.000 0.916 0.000 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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)  time(p) k
#> MAD:kmeans 80         3.52e-15 2.80e-12 2
#> MAD:kmeans 50         2.49e-15 1.53e-10 3
#> MAD:kmeans 68         8.55e-24 5.14e-08 4
#> MAD:kmeans 71         1.83e-22 3.13e-07 5
#> MAD:kmeans 71         1.83e-22 3.13e-07 6

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


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

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.987       0.995         0.5067 0.494   0.494
#> 3 3 0.859           0.923       0.932         0.2613 0.800   0.618
#> 4 4 0.883           0.928       0.957         0.1509 0.864   0.635
#> 5 5 0.846           0.818       0.899         0.0704 0.914   0.691
#> 6 6 0.825           0.744       0.850         0.0350 0.974   0.876

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1   0.000      0.990 1.000 0.000
#> GSM509711     1   0.000      0.990 1.000 0.000
#> GSM509714     1   0.000      0.990 1.000 0.000
#> GSM509719     1   0.000      0.990 1.000 0.000
#> GSM509724     1   0.000      0.990 1.000 0.000
#> GSM509729     1   0.000      0.990 1.000 0.000
#> GSM509707     1   0.000      0.990 1.000 0.000
#> GSM509712     1   0.000      0.990 1.000 0.000
#> GSM509715     2   0.000      1.000 0.000 1.000
#> GSM509720     1   0.000      0.990 1.000 0.000
#> GSM509725     1   0.000      0.990 1.000 0.000
#> GSM509730     1   0.000      0.990 1.000 0.000
#> GSM509708     1   0.000      0.990 1.000 0.000
#> GSM509713     1   0.000      0.990 1.000 0.000
#> GSM509716     2   0.000      1.000 0.000 1.000
#> GSM509721     1   0.000      0.990 1.000 0.000
#> GSM509726     1   0.000      0.990 1.000 0.000
#> GSM509731     1   0.969      0.344 0.604 0.396
#> GSM509709     1   0.000      0.990 1.000 0.000
#> GSM509717     2   0.000      1.000 0.000 1.000
#> GSM509722     1   0.000      0.990 1.000 0.000
#> GSM509727     1   0.000      0.990 1.000 0.000
#> GSM509710     1   0.000      0.990 1.000 0.000
#> GSM509718     2   0.000      1.000 0.000 1.000
#> GSM509723     1   0.000      0.990 1.000 0.000
#> GSM509728     1   0.000      0.990 1.000 0.000
#> GSM509732     1   0.000      0.990 1.000 0.000
#> GSM509736     1   0.000      0.990 1.000 0.000
#> GSM509741     1   0.000      0.990 1.000 0.000
#> GSM509746     1   0.000      0.990 1.000 0.000
#> GSM509733     1   0.000      0.990 1.000 0.000
#> GSM509737     1   0.000      0.990 1.000 0.000
#> GSM509742     1   0.000      0.990 1.000 0.000
#> GSM509747     1   0.000      0.990 1.000 0.000
#> GSM509734     1   0.000      0.990 1.000 0.000
#> GSM509738     1   0.000      0.990 1.000 0.000
#> GSM509743     1   0.000      0.990 1.000 0.000
#> GSM509748     1   0.000      0.990 1.000 0.000
#> GSM509735     1   0.000      0.990 1.000 0.000
#> GSM509739     1   0.000      0.990 1.000 0.000
#> GSM509744     1   0.000      0.990 1.000 0.000
#> GSM509749     1   0.000      0.990 1.000 0.000
#> GSM509740     1   0.000      0.990 1.000 0.000
#> GSM509745     1   0.000      0.990 1.000 0.000
#> GSM509750     1   0.000      0.990 1.000 0.000
#> GSM509751     2   0.000      1.000 0.000 1.000
#> GSM509753     2   0.000      1.000 0.000 1.000
#> GSM509755     2   0.000      1.000 0.000 1.000
#> GSM509757     2   0.000      1.000 0.000 1.000
#> GSM509759     2   0.000      1.000 0.000 1.000
#> GSM509761     2   0.000      1.000 0.000 1.000
#> GSM509763     2   0.000      1.000 0.000 1.000
#> GSM509765     2   0.000      1.000 0.000 1.000
#> GSM509767     2   0.000      1.000 0.000 1.000
#> GSM509769     2   0.000      1.000 0.000 1.000
#> GSM509771     2   0.000      1.000 0.000 1.000
#> GSM509773     2   0.000      1.000 0.000 1.000
#> GSM509775     2   0.000      1.000 0.000 1.000
#> GSM509777     2   0.000      1.000 0.000 1.000
#> GSM509779     2   0.000      1.000 0.000 1.000
#> GSM509781     2   0.000      1.000 0.000 1.000
#> GSM509783     2   0.000      1.000 0.000 1.000
#> GSM509785     2   0.000      1.000 0.000 1.000
#> GSM509752     2   0.000      1.000 0.000 1.000
#> GSM509754     2   0.000      1.000 0.000 1.000
#> GSM509756     2   0.000      1.000 0.000 1.000
#> GSM509758     2   0.000      1.000 0.000 1.000
#> GSM509760     2   0.000      1.000 0.000 1.000
#> GSM509762     2   0.000      1.000 0.000 1.000
#> GSM509764     2   0.000      1.000 0.000 1.000
#> GSM509766     2   0.000      1.000 0.000 1.000
#> GSM509768     2   0.000      1.000 0.000 1.000
#> GSM509770     2   0.000      1.000 0.000 1.000
#> GSM509772     2   0.000      1.000 0.000 1.000
#> GSM509774     2   0.000      1.000 0.000 1.000
#> GSM509776     2   0.000      1.000 0.000 1.000
#> GSM509778     2   0.000      1.000 0.000 1.000
#> GSM509780     2   0.000      1.000 0.000 1.000
#> GSM509782     2   0.000      1.000 0.000 1.000
#> GSM509784     2   0.000      1.000 0.000 1.000
#> GSM509786     2   0.000      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
#> GSM509706     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509711     1  0.1860      0.821 0.948 0.000 0.052
#> GSM509714     1  0.0000      0.790 1.000 0.000 0.000
#> GSM509719     1  0.4931      0.886 0.768 0.000 0.232
#> GSM509724     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509729     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509707     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509712     1  0.1860      0.821 0.948 0.000 0.052
#> GSM509715     1  0.0424      0.785 0.992 0.008 0.000
#> GSM509720     1  0.4931      0.886 0.768 0.000 0.232
#> GSM509725     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509730     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509708     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509713     1  0.1860      0.821 0.948 0.000 0.052
#> GSM509716     1  0.0000      0.790 1.000 0.000 0.000
#> GSM509721     1  0.4931      0.886 0.768 0.000 0.232
#> GSM509726     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509731     1  0.0000      0.790 1.000 0.000 0.000
#> GSM509709     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509717     1  0.0237      0.788 0.996 0.004 0.000
#> GSM509722     1  0.4931      0.886 0.768 0.000 0.232
#> GSM509727     1  0.4796      0.882 0.780 0.000 0.220
#> GSM509710     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509718     1  0.3686      0.638 0.860 0.140 0.000
#> GSM509723     1  0.4931      0.886 0.768 0.000 0.232
#> GSM509728     3  0.5560      0.378 0.300 0.000 0.700
#> GSM509732     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509736     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509741     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509746     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509733     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509737     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509742     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509747     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509734     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509738     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509743     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509748     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509735     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509739     1  0.5016      0.885 0.760 0.000 0.240
#> GSM509744     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509749     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509740     1  0.1964      0.820 0.944 0.000 0.056
#> GSM509745     3  0.4291      0.747 0.180 0.000 0.820
#> GSM509750     3  0.0000      0.961 0.000 0.000 1.000
#> GSM509751     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509753     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509755     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509757     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509759     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509761     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509763     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509765     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509767     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509769     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509771     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509773     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509775     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509777     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509779     2  0.1860      0.962 0.052 0.948 0.000
#> GSM509781     2  0.1860      0.962 0.052 0.948 0.000
#> GSM509783     2  0.1860      0.962 0.052 0.948 0.000
#> GSM509785     2  0.1860      0.962 0.052 0.948 0.000
#> GSM509752     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509754     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509756     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509758     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509760     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509762     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509764     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509766     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509768     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509770     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509772     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509774     2  0.0237      0.987 0.004 0.996 0.000
#> GSM509776     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509778     2  0.1860      0.962 0.052 0.948 0.000
#> GSM509780     2  0.0000      0.989 0.000 1.000 0.000
#> GSM509782     2  0.1860      0.962 0.052 0.948 0.000
#> GSM509784     2  0.1860      0.962 0.052 0.948 0.000
#> GSM509786     2  0.1860      0.962 0.052 0.948 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509711     1  0.3219     0.8448 0.836 0.000 0.000 0.164
#> GSM509714     1  0.3486     0.8240 0.812 0.000 0.000 0.188
#> GSM509719     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509724     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509729     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509707     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509712     1  0.3219     0.8448 0.836 0.000 0.000 0.164
#> GSM509715     4  0.0000     0.8208 0.000 0.000 0.000 1.000
#> GSM509720     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509725     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509730     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509708     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509713     1  0.0336     0.9532 0.992 0.000 0.000 0.008
#> GSM509716     4  0.0000     0.8208 0.000 0.000 0.000 1.000
#> GSM509721     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509726     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509731     4  0.0336     0.8160 0.008 0.000 0.000 0.992
#> GSM509709     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509717     4  0.0000     0.8208 0.000 0.000 0.000 1.000
#> GSM509722     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509727     1  0.0336     0.9533 0.992 0.000 0.000 0.008
#> GSM509710     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509718     4  0.0000     0.8208 0.000 0.000 0.000 1.000
#> GSM509723     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509728     1  0.3649     0.7479 0.796 0.000 0.204 0.000
#> GSM509732     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509736     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509741     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509737     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509742     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509734     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509738     3  0.0188     0.9903 0.000 0.000 0.996 0.004
#> GSM509743     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509735     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509739     1  0.0000     0.9570 1.000 0.000 0.000 0.000
#> GSM509744     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509749     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509740     1  0.6260     0.6735 0.664 0.000 0.144 0.192
#> GSM509745     3  0.2408     0.8964 0.000 0.000 0.896 0.104
#> GSM509750     3  0.0000     0.9933 0.000 0.000 1.000 0.000
#> GSM509751     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0188     0.9738 0.000 0.996 0.000 0.004
#> GSM509765     2  0.0336     0.9698 0.000 0.992 0.000 0.008
#> GSM509767     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509775     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509777     2  0.4955    -0.0793 0.000 0.556 0.000 0.444
#> GSM509779     4  0.3569     0.8888 0.000 0.196 0.000 0.804
#> GSM509781     4  0.3528     0.8918 0.000 0.192 0.000 0.808
#> GSM509783     4  0.3528     0.8918 0.000 0.192 0.000 0.808
#> GSM509785     4  0.3528     0.8918 0.000 0.192 0.000 0.808
#> GSM509752     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509766     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509768     2  0.0188     0.9738 0.000 0.996 0.000 0.004
#> GSM509770     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509774     4  0.4193     0.7964 0.000 0.268 0.000 0.732
#> GSM509776     2  0.0000     0.9772 0.000 1.000 0.000 0.000
#> GSM509778     4  0.3528     0.8918 0.000 0.192 0.000 0.808
#> GSM509780     2  0.1118     0.9386 0.000 0.964 0.000 0.036
#> GSM509782     4  0.3528     0.8918 0.000 0.192 0.000 0.808
#> GSM509784     4  0.3569     0.8888 0.000 0.196 0.000 0.804
#> GSM509786     4  0.3528     0.8918 0.000 0.192 0.000 0.808

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.4341      0.286 0.592 0.000 0.000 0.004 0.404
#> GSM509714     5  0.2377      0.695 0.128 0.000 0.000 0.000 0.872
#> GSM509719     1  0.3650      0.796 0.796 0.000 0.000 0.028 0.176
#> GSM509724     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.2079      0.847 0.916 0.000 0.000 0.020 0.064
#> GSM509707     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.4367      0.260 0.580 0.000 0.000 0.004 0.416
#> GSM509715     5  0.3210      0.891 0.000 0.000 0.000 0.212 0.788
#> GSM509720     1  0.3650      0.796 0.796 0.000 0.000 0.028 0.176
#> GSM509725     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.2616      0.834 0.880 0.000 0.000 0.020 0.100
#> GSM509708     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0771      0.858 0.976 0.000 0.000 0.004 0.020
#> GSM509716     5  0.3177      0.891 0.000 0.000 0.000 0.208 0.792
#> GSM509721     1  0.3650      0.796 0.796 0.000 0.000 0.028 0.176
#> GSM509726     1  0.0162      0.867 0.996 0.000 0.000 0.004 0.000
#> GSM509731     5  0.3210      0.891 0.000 0.000 0.000 0.212 0.788
#> GSM509709     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.3210      0.891 0.000 0.000 0.000 0.212 0.788
#> GSM509722     1  0.3724      0.790 0.788 0.000 0.000 0.028 0.184
#> GSM509727     1  0.2563      0.789 0.872 0.000 0.000 0.008 0.120
#> GSM509710     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.3177      0.891 0.000 0.000 0.000 0.208 0.792
#> GSM509723     1  0.3650      0.796 0.796 0.000 0.000 0.028 0.176
#> GSM509728     1  0.5036      0.460 0.648 0.000 0.304 0.008 0.040
#> GSM509732     3  0.0000      0.966 0.000 0.000 1.000 0.000 0.000
#> GSM509736     3  0.1809      0.949 0.000 0.000 0.928 0.012 0.060
#> GSM509741     3  0.0000      0.966 0.000 0.000 1.000 0.000 0.000
#> GSM509746     3  0.0000      0.966 0.000 0.000 1.000 0.000 0.000
#> GSM509733     3  0.0000      0.966 0.000 0.000 1.000 0.000 0.000
#> GSM509737     3  0.1877      0.948 0.000 0.000 0.924 0.012 0.064
#> GSM509742     3  0.0000      0.966 0.000 0.000 1.000 0.000 0.000
#> GSM509747     3  0.0000      0.966 0.000 0.000 1.000 0.000 0.000
#> GSM509734     3  0.0000      0.966 0.000 0.000 1.000 0.000 0.000
#> GSM509738     3  0.1981      0.945 0.000 0.000 0.920 0.016 0.064
#> GSM509743     3  0.1124      0.959 0.000 0.000 0.960 0.004 0.036
#> GSM509748     3  0.0000      0.966 0.000 0.000 1.000 0.000 0.000
#> GSM509735     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.1877      0.948 0.000 0.000 0.924 0.012 0.064
#> GSM509749     3  0.0162      0.965 0.000 0.000 0.996 0.000 0.004
#> GSM509740     5  0.4375      0.688 0.136 0.000 0.064 0.016 0.784
#> GSM509745     3  0.3419      0.825 0.000 0.000 0.804 0.016 0.180
#> GSM509750     3  0.1430      0.955 0.000 0.000 0.944 0.004 0.052
#> GSM509751     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.1197      0.894 0.000 0.952 0.000 0.048 0.000
#> GSM509763     4  0.3837      0.647 0.000 0.308 0.000 0.692 0.000
#> GSM509765     4  0.3857      0.640 0.000 0.312 0.000 0.688 0.000
#> GSM509767     2  0.0290      0.927 0.000 0.992 0.000 0.008 0.000
#> GSM509769     2  0.0963      0.910 0.000 0.964 0.000 0.036 0.000
#> GSM509771     2  0.0404      0.925 0.000 0.988 0.000 0.012 0.000
#> GSM509773     2  0.2583      0.794 0.000 0.864 0.000 0.132 0.004
#> GSM509775     2  0.4294     -0.133 0.000 0.532 0.000 0.468 0.000
#> GSM509777     4  0.2280      0.798 0.000 0.120 0.000 0.880 0.000
#> GSM509779     4  0.1408      0.808 0.000 0.044 0.000 0.948 0.008
#> GSM509781     4  0.1725      0.806 0.000 0.044 0.000 0.936 0.020
#> GSM509783     4  0.1725      0.806 0.000 0.044 0.000 0.936 0.020
#> GSM509785     4  0.1725      0.806 0.000 0.044 0.000 0.936 0.020
#> GSM509752     2  0.0162      0.928 0.000 0.996 0.000 0.004 0.000
#> GSM509754     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0290      0.927 0.000 0.992 0.000 0.008 0.000
#> GSM509760     2  0.0671      0.923 0.000 0.980 0.000 0.016 0.004
#> GSM509762     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509766     4  0.4126      0.515 0.000 0.380 0.000 0.620 0.000
#> GSM509768     2  0.4350      0.121 0.000 0.588 0.000 0.408 0.004
#> GSM509770     2  0.0771      0.920 0.000 0.976 0.000 0.020 0.004
#> GSM509772     2  0.0000      0.929 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.1908      0.806 0.000 0.092 0.000 0.908 0.000
#> GSM509776     4  0.4450      0.199 0.000 0.488 0.000 0.508 0.004
#> GSM509778     4  0.1725      0.806 0.000 0.044 0.000 0.936 0.020
#> GSM509780     4  0.3333      0.754 0.000 0.208 0.000 0.788 0.004
#> GSM509782     4  0.1725      0.806 0.000 0.044 0.000 0.936 0.020
#> GSM509784     4  0.1430      0.810 0.000 0.052 0.000 0.944 0.004
#> GSM509786     4  0.1725      0.806 0.000 0.044 0.000 0.936 0.020

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM509706     1  0.0000     0.7605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.4530     0.4834 0.692 0.000 0.000 0.000 0.208 0.100
#> GSM509714     5  0.3758     0.6767 0.048 0.000 0.000 0.004 0.772 0.176
#> GSM509719     6  0.4175     0.9898 0.464 0.000 0.000 0.000 0.012 0.524
#> GSM509724     1  0.0291     0.7579 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM509729     1  0.3428    -0.2702 0.696 0.000 0.000 0.000 0.000 0.304
#> GSM509707     1  0.0000     0.7605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.4791     0.4258 0.652 0.000 0.000 0.000 0.244 0.104
#> GSM509715     5  0.2003     0.8654 0.000 0.000 0.000 0.116 0.884 0.000
#> GSM509720     6  0.4175     0.9898 0.464 0.000 0.000 0.000 0.012 0.524
#> GSM509725     1  0.0146     0.7585 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509730     1  0.3890    -0.6482 0.596 0.000 0.004 0.000 0.000 0.400
#> GSM509708     1  0.0000     0.7605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.2647     0.6749 0.868 0.000 0.000 0.000 0.044 0.088
#> GSM509716     5  0.2100     0.8662 0.000 0.000 0.000 0.112 0.884 0.004
#> GSM509721     6  0.4175     0.9898 0.464 0.000 0.000 0.000 0.012 0.524
#> GSM509726     1  0.1049     0.7433 0.960 0.000 0.000 0.000 0.008 0.032
#> GSM509731     5  0.2312     0.8627 0.000 0.000 0.000 0.112 0.876 0.012
#> GSM509709     1  0.0000     0.7605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.1957     0.8664 0.000 0.000 0.000 0.112 0.888 0.000
#> GSM509722     6  0.4314     0.9597 0.444 0.000 0.000 0.000 0.020 0.536
#> GSM509727     1  0.3481     0.5879 0.776 0.000 0.000 0.000 0.032 0.192
#> GSM509710     1  0.0000     0.7605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.2070     0.8581 0.000 0.000 0.000 0.100 0.892 0.008
#> GSM509723     6  0.4175     0.9898 0.464 0.000 0.000 0.000 0.012 0.524
#> GSM509728     1  0.4575     0.4869 0.728 0.000 0.088 0.000 0.020 0.164
#> GSM509732     3  0.0000     0.8603 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     3  0.4733     0.7441 0.000 0.000 0.648 0.004 0.072 0.276
#> GSM509741     3  0.0260     0.8603 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM509746     3  0.0000     0.8603 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000     0.8603 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     3  0.4733     0.7441 0.000 0.000 0.648 0.004 0.072 0.276
#> GSM509742     3  0.0405     0.8602 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM509747     3  0.0000     0.8603 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.0000     0.8603 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509738     3  0.4886     0.7223 0.000 0.000 0.620 0.004 0.076 0.300
#> GSM509743     3  0.2908     0.8297 0.000 0.000 0.848 0.000 0.048 0.104
#> GSM509748     3  0.0000     0.8603 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509735     1  0.0000     0.7605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000     0.7605 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.4637     0.7587 0.000 0.000 0.672 0.004 0.076 0.248
#> GSM509749     3  0.0405     0.8606 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM509740     5  0.6128     0.4041 0.092 0.000 0.044 0.004 0.484 0.376
#> GSM509745     3  0.5648     0.6039 0.004 0.000 0.516 0.004 0.124 0.352
#> GSM509750     3  0.3424     0.8118 0.000 0.000 0.800 0.004 0.036 0.160
#> GSM509751     2  0.0405     0.9024 0.000 0.988 0.000 0.000 0.004 0.008
#> GSM509753     2  0.0508     0.9015 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM509755     2  0.0603     0.9011 0.000 0.980 0.000 0.000 0.004 0.016
#> GSM509757     2  0.0837     0.9016 0.000 0.972 0.000 0.004 0.004 0.020
#> GSM509759     2  0.1297     0.8909 0.000 0.948 0.000 0.000 0.012 0.040
#> GSM509761     2  0.1471     0.8754 0.000 0.932 0.000 0.064 0.000 0.004
#> GSM509763     4  0.3807     0.6768 0.000 0.228 0.000 0.740 0.004 0.028
#> GSM509765     4  0.3878     0.6711 0.000 0.228 0.000 0.736 0.004 0.032
#> GSM509767     2  0.2164     0.8859 0.000 0.912 0.000 0.028 0.016 0.044
#> GSM509769     2  0.1565     0.8914 0.000 0.940 0.000 0.028 0.004 0.028
#> GSM509771     2  0.2186     0.8809 0.000 0.908 0.000 0.024 0.012 0.056
#> GSM509773     2  0.3770     0.6640 0.000 0.752 0.000 0.212 0.004 0.032
#> GSM509775     2  0.4723    -0.0736 0.000 0.488 0.000 0.472 0.004 0.036
#> GSM509777     4  0.1267     0.8070 0.000 0.060 0.000 0.940 0.000 0.000
#> GSM509779     4  0.0972     0.8195 0.000 0.008 0.000 0.964 0.028 0.000
#> GSM509781     4  0.1477     0.8147 0.000 0.004 0.000 0.940 0.048 0.008
#> GSM509783     4  0.1477     0.8147 0.000 0.004 0.000 0.940 0.048 0.008
#> GSM509785     4  0.1477     0.8147 0.000 0.004 0.000 0.940 0.048 0.008
#> GSM509752     2  0.0603     0.9029 0.000 0.980 0.000 0.016 0.000 0.004
#> GSM509754     2  0.0146     0.9038 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509756     2  0.0405     0.9037 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM509758     2  0.0363     0.9037 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM509760     2  0.1138     0.9002 0.000 0.960 0.000 0.012 0.004 0.024
#> GSM509762     2  0.0260     0.9041 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509764     2  0.0291     0.9036 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM509766     4  0.4065     0.5669 0.000 0.300 0.000 0.672 0.000 0.028
#> GSM509768     2  0.4594    -0.0827 0.000 0.488 0.000 0.476 0.000 0.036
#> GSM509770     2  0.1370     0.8971 0.000 0.948 0.000 0.012 0.004 0.036
#> GSM509772     2  0.1461     0.8895 0.000 0.940 0.000 0.000 0.016 0.044
#> GSM509774     4  0.0858     0.8152 0.000 0.028 0.000 0.968 0.000 0.004
#> GSM509776     4  0.4860     0.1603 0.000 0.436 0.000 0.516 0.008 0.040
#> GSM509778     4  0.1410     0.8159 0.000 0.004 0.000 0.944 0.044 0.008
#> GSM509780     4  0.2466     0.7761 0.000 0.112 0.000 0.872 0.008 0.008
#> GSM509782     4  0.1477     0.8147 0.000 0.004 0.000 0.940 0.048 0.008
#> GSM509784     4  0.0862     0.8195 0.000 0.008 0.000 0.972 0.016 0.004
#> GSM509786     4  0.1477     0.8147 0.000 0.004 0.000 0.940 0.048 0.008

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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)  time(p) k
#> MAD:skmeans 80         3.52e-15 2.80e-12 2
#> MAD:skmeans 80         2.62e-29 2.47e-12 3
#> MAD:skmeans 80         2.81e-24 4.12e-08 4
#> MAD:skmeans 75         1.82e-24 5.75e-08 5
#> MAD:skmeans 72         2.18e-23 5.08e-06 6

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


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

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.924           0.960       0.982         0.5054 0.494   0.494
#> 3 3 0.785           0.828       0.886         0.2904 0.794   0.606
#> 4 4 0.669           0.771       0.852         0.1450 0.903   0.717
#> 5 5 0.827           0.832       0.917         0.0667 0.867   0.540
#> 6 6 0.865           0.834       0.920         0.0312 0.973   0.864

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1   0.000      0.996 1.000 0.000
#> GSM509711     1   0.000      0.996 1.000 0.000
#> GSM509714     1   0.615      0.809 0.848 0.152
#> GSM509719     1   0.000      0.996 1.000 0.000
#> GSM509724     1   0.000      0.996 1.000 0.000
#> GSM509729     1   0.000      0.996 1.000 0.000
#> GSM509707     1   0.000      0.996 1.000 0.000
#> GSM509712     1   0.000      0.996 1.000 0.000
#> GSM509715     2   0.689      0.783 0.184 0.816
#> GSM509720     1   0.000      0.996 1.000 0.000
#> GSM509725     1   0.000      0.996 1.000 0.000
#> GSM509730     1   0.000      0.996 1.000 0.000
#> GSM509708     1   0.000      0.996 1.000 0.000
#> GSM509713     1   0.000      0.996 1.000 0.000
#> GSM509716     2   0.706      0.773 0.192 0.808
#> GSM509721     1   0.000      0.996 1.000 0.000
#> GSM509726     1   0.000      0.996 1.000 0.000
#> GSM509731     2   0.921      0.529 0.336 0.664
#> GSM509709     1   0.000      0.996 1.000 0.000
#> GSM509717     2   0.689      0.783 0.184 0.816
#> GSM509722     1   0.000      0.996 1.000 0.000
#> GSM509727     1   0.000      0.996 1.000 0.000
#> GSM509710     1   0.000      0.996 1.000 0.000
#> GSM509718     2   0.958      0.429 0.380 0.620
#> GSM509723     1   0.000      0.996 1.000 0.000
#> GSM509728     1   0.000      0.996 1.000 0.000
#> GSM509732     1   0.000      0.996 1.000 0.000
#> GSM509736     1   0.000      0.996 1.000 0.000
#> GSM509741     1   0.000      0.996 1.000 0.000
#> GSM509746     1   0.000      0.996 1.000 0.000
#> GSM509733     1   0.000      0.996 1.000 0.000
#> GSM509737     1   0.000      0.996 1.000 0.000
#> GSM509742     1   0.000      0.996 1.000 0.000
#> GSM509747     1   0.000      0.996 1.000 0.000
#> GSM509734     1   0.000      0.996 1.000 0.000
#> GSM509738     1   0.000      0.996 1.000 0.000
#> GSM509743     1   0.000      0.996 1.000 0.000
#> GSM509748     1   0.000      0.996 1.000 0.000
#> GSM509735     1   0.000      0.996 1.000 0.000
#> GSM509739     1   0.000      0.996 1.000 0.000
#> GSM509744     1   0.000      0.996 1.000 0.000
#> GSM509749     1   0.000      0.996 1.000 0.000
#> GSM509740     1   0.000      0.996 1.000 0.000
#> GSM509745     1   0.000      0.996 1.000 0.000
#> GSM509750     1   0.000      0.996 1.000 0.000
#> GSM509751     2   0.000      0.968 0.000 1.000
#> GSM509753     2   0.000      0.968 0.000 1.000
#> GSM509755     2   0.000      0.968 0.000 1.000
#> GSM509757     2   0.000      0.968 0.000 1.000
#> GSM509759     2   0.000      0.968 0.000 1.000
#> GSM509761     2   0.000      0.968 0.000 1.000
#> GSM509763     2   0.000      0.968 0.000 1.000
#> GSM509765     2   0.000      0.968 0.000 1.000
#> GSM509767     2   0.000      0.968 0.000 1.000
#> GSM509769     2   0.000      0.968 0.000 1.000
#> GSM509771     2   0.000      0.968 0.000 1.000
#> GSM509773     2   0.000      0.968 0.000 1.000
#> GSM509775     2   0.000      0.968 0.000 1.000
#> GSM509777     2   0.000      0.968 0.000 1.000
#> GSM509779     2   0.000      0.968 0.000 1.000
#> GSM509781     2   0.000      0.968 0.000 1.000
#> GSM509783     2   0.000      0.968 0.000 1.000
#> GSM509785     2   0.000      0.968 0.000 1.000
#> GSM509752     2   0.000      0.968 0.000 1.000
#> GSM509754     2   0.000      0.968 0.000 1.000
#> GSM509756     2   0.000      0.968 0.000 1.000
#> GSM509758     2   0.000      0.968 0.000 1.000
#> GSM509760     2   0.000      0.968 0.000 1.000
#> GSM509762     2   0.000      0.968 0.000 1.000
#> GSM509764     2   0.000      0.968 0.000 1.000
#> GSM509766     2   0.000      0.968 0.000 1.000
#> GSM509768     2   0.000      0.968 0.000 1.000
#> GSM509770     2   0.000      0.968 0.000 1.000
#> GSM509772     2   0.000      0.968 0.000 1.000
#> GSM509774     2   0.000      0.968 0.000 1.000
#> GSM509776     2   0.000      0.968 0.000 1.000
#> GSM509778     2   0.000      0.968 0.000 1.000
#> GSM509780     2   0.000      0.968 0.000 1.000
#> GSM509782     2   0.000      0.968 0.000 1.000
#> GSM509784     2   0.000      0.968 0.000 1.000
#> GSM509786     2   0.000      0.968 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
#> GSM509706     1  0.0000      0.752 1.000 0.000 0.000
#> GSM509711     3  0.5650      0.715 0.312 0.000 0.688
#> GSM509714     3  0.5845      0.717 0.308 0.004 0.688
#> GSM509719     3  0.5291      0.736 0.268 0.000 0.732
#> GSM509724     1  0.2878      0.786 0.904 0.000 0.096
#> GSM509729     1  0.4178      0.525 0.828 0.000 0.172
#> GSM509707     1  0.0000      0.752 1.000 0.000 0.000
#> GSM509712     3  0.5650      0.715 0.312 0.000 0.688
#> GSM509715     3  0.7147      0.668 0.156 0.124 0.720
#> GSM509720     3  0.5291      0.736 0.268 0.000 0.732
#> GSM509725     1  0.4121      0.794 0.832 0.000 0.168
#> GSM509730     1  0.4346      0.580 0.816 0.000 0.184
#> GSM509708     1  0.0424      0.745 0.992 0.000 0.008
#> GSM509713     1  0.4399      0.497 0.812 0.000 0.188
#> GSM509716     3  0.6578      0.708 0.224 0.052 0.724
#> GSM509721     3  0.5291      0.736 0.268 0.000 0.732
#> GSM509726     1  0.4605      0.790 0.796 0.000 0.204
#> GSM509731     3  0.6565      0.707 0.232 0.048 0.720
#> GSM509709     1  0.0000      0.752 1.000 0.000 0.000
#> GSM509717     3  0.7097      0.679 0.172 0.108 0.720
#> GSM509722     3  0.5327      0.735 0.272 0.000 0.728
#> GSM509727     3  0.3412      0.697 0.124 0.000 0.876
#> GSM509710     1  0.3482      0.792 0.872 0.000 0.128
#> GSM509718     3  0.2947      0.695 0.020 0.060 0.920
#> GSM509723     3  0.5363      0.734 0.276 0.000 0.724
#> GSM509728     1  0.4887      0.783 0.772 0.000 0.228
#> GSM509732     1  0.5363      0.777 0.724 0.000 0.276
#> GSM509736     3  0.4842      0.547 0.224 0.000 0.776
#> GSM509741     1  0.5397      0.775 0.720 0.000 0.280
#> GSM509746     1  0.5397      0.775 0.720 0.000 0.280
#> GSM509733     1  0.5363      0.777 0.724 0.000 0.276
#> GSM509737     3  0.4842      0.547 0.224 0.000 0.776
#> GSM509742     1  0.5397      0.775 0.720 0.000 0.280
#> GSM509747     1  0.5363      0.777 0.724 0.000 0.276
#> GSM509734     1  0.5363      0.777 0.724 0.000 0.276
#> GSM509738     3  0.2625      0.678 0.084 0.000 0.916
#> GSM509743     3  0.4887      0.539 0.228 0.000 0.772
#> GSM509748     1  0.5397      0.775 0.720 0.000 0.280
#> GSM509735     1  0.0000      0.752 1.000 0.000 0.000
#> GSM509739     1  0.0000      0.752 1.000 0.000 0.000
#> GSM509744     3  0.4842      0.547 0.224 0.000 0.776
#> GSM509749     3  0.4842      0.547 0.224 0.000 0.776
#> GSM509740     3  0.1411      0.699 0.036 0.000 0.964
#> GSM509745     3  0.2165      0.689 0.064 0.000 0.936
#> GSM509750     3  0.4842      0.547 0.224 0.000 0.776
#> GSM509751     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509753     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509755     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509757     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509759     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509761     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509763     2  0.0237      0.990 0.000 0.996 0.004
#> GSM509765     2  0.0237      0.990 0.000 0.996 0.004
#> GSM509767     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509769     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509771     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509773     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509775     2  0.0237      0.990 0.000 0.996 0.004
#> GSM509777     2  0.1289      0.979 0.000 0.968 0.032
#> GSM509779     2  0.1411      0.978 0.000 0.964 0.036
#> GSM509781     2  0.1411      0.978 0.000 0.964 0.036
#> GSM509783     2  0.1411      0.978 0.000 0.964 0.036
#> GSM509785     2  0.1411      0.978 0.000 0.964 0.036
#> GSM509752     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509754     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509756     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509758     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509760     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509762     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509764     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509766     2  0.0237      0.990 0.000 0.996 0.004
#> GSM509768     2  0.0424      0.989 0.000 0.992 0.008
#> GSM509770     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509772     2  0.0000      0.990 0.000 1.000 0.000
#> GSM509774     2  0.1411      0.978 0.000 0.964 0.036
#> GSM509776     2  0.0424      0.989 0.000 0.992 0.008
#> GSM509778     2  0.1411      0.978 0.000 0.964 0.036
#> GSM509780     2  0.0424      0.989 0.000 0.992 0.008
#> GSM509782     2  0.1411      0.978 0.000 0.964 0.036
#> GSM509784     2  0.1411      0.978 0.000 0.964 0.036
#> GSM509786     2  0.1411      0.978 0.000 0.964 0.036

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0000      0.755 1.000 0.000 0.000 0.000
#> GSM509711     3  0.5136      0.730 0.224 0.000 0.728 0.048
#> GSM509714     3  0.5318      0.738 0.196 0.000 0.732 0.072
#> GSM509719     3  0.4957      0.741 0.204 0.000 0.748 0.048
#> GSM509724     1  0.1867      0.778 0.928 0.000 0.072 0.000
#> GSM509729     1  0.4472      0.480 0.760 0.000 0.220 0.020
#> GSM509707     1  0.0000      0.755 1.000 0.000 0.000 0.000
#> GSM509712     3  0.5102      0.733 0.220 0.000 0.732 0.048
#> GSM509715     3  0.5563      0.705 0.076 0.004 0.724 0.196
#> GSM509720     3  0.4957      0.741 0.204 0.000 0.748 0.048
#> GSM509725     1  0.2704      0.782 0.876 0.000 0.124 0.000
#> GSM509730     1  0.4501      0.528 0.764 0.000 0.212 0.024
#> GSM509708     1  0.0469      0.746 0.988 0.000 0.012 0.000
#> GSM509713     1  0.4610      0.451 0.744 0.000 0.236 0.020
#> GSM509716     3  0.5591      0.736 0.168 0.004 0.732 0.096
#> GSM509721     3  0.4957      0.741 0.204 0.000 0.748 0.048
#> GSM509726     1  0.3625      0.779 0.828 0.000 0.160 0.012
#> GSM509731     3  0.5619      0.725 0.124 0.000 0.724 0.152
#> GSM509709     1  0.0000      0.755 1.000 0.000 0.000 0.000
#> GSM509717     3  0.5569      0.719 0.104 0.000 0.724 0.172
#> GSM509722     3  0.4957      0.741 0.204 0.000 0.748 0.048
#> GSM509727     3  0.2814      0.701 0.132 0.000 0.868 0.000
#> GSM509710     1  0.2281      0.781 0.904 0.000 0.096 0.000
#> GSM509718     3  0.1716      0.710 0.000 0.000 0.936 0.064
#> GSM509723     3  0.5031      0.737 0.212 0.000 0.740 0.048
#> GSM509728     1  0.4920      0.768 0.756 0.000 0.192 0.052
#> GSM509732     1  0.5573      0.748 0.676 0.000 0.272 0.052
#> GSM509736     3  0.4880      0.503 0.188 0.000 0.760 0.052
#> GSM509741     1  0.5599      0.746 0.672 0.000 0.276 0.052
#> GSM509746     1  0.5599      0.746 0.672 0.000 0.276 0.052
#> GSM509733     1  0.5573      0.748 0.676 0.000 0.272 0.052
#> GSM509737     3  0.4880      0.503 0.188 0.000 0.760 0.052
#> GSM509742     1  0.5599      0.746 0.672 0.000 0.276 0.052
#> GSM509747     1  0.5573      0.748 0.676 0.000 0.272 0.052
#> GSM509734     1  0.5573      0.748 0.676 0.000 0.272 0.052
#> GSM509738     3  0.1975      0.671 0.048 0.000 0.936 0.016
#> GSM509743     3  0.4920      0.496 0.192 0.000 0.756 0.052
#> GSM509748     1  0.5599      0.746 0.672 0.000 0.276 0.052
#> GSM509735     1  0.0188      0.757 0.996 0.000 0.004 0.000
#> GSM509739     1  0.0188      0.752 0.996 0.000 0.004 0.000
#> GSM509744     3  0.4880      0.503 0.188 0.000 0.760 0.052
#> GSM509749     3  0.4880      0.503 0.188 0.000 0.760 0.052
#> GSM509740     3  0.0779      0.698 0.004 0.000 0.980 0.016
#> GSM509745     3  0.1406      0.686 0.024 0.000 0.960 0.016
#> GSM509750     3  0.4880      0.503 0.188 0.000 0.760 0.052
#> GSM509751     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509763     4  0.4103      0.810 0.000 0.256 0.000 0.744
#> GSM509765     4  0.4431      0.753 0.000 0.304 0.000 0.696
#> GSM509767     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0469      0.944 0.000 0.988 0.000 0.012
#> GSM509775     2  0.3688      0.642 0.000 0.792 0.000 0.208
#> GSM509777     4  0.2589      0.905 0.000 0.116 0.000 0.884
#> GSM509779     4  0.2345      0.911 0.000 0.100 0.000 0.900
#> GSM509781     4  0.2345      0.911 0.000 0.100 0.000 0.900
#> GSM509783     4  0.2345      0.911 0.000 0.100 0.000 0.900
#> GSM509785     4  0.2345      0.911 0.000 0.100 0.000 0.900
#> GSM509752     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509766     4  0.4382      0.765 0.000 0.296 0.000 0.704
#> GSM509768     2  0.4992     -0.264 0.000 0.524 0.000 0.476
#> GSM509770     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000      0.956 0.000 1.000 0.000 0.000
#> GSM509774     4  0.2345      0.911 0.000 0.100 0.000 0.900
#> GSM509776     4  0.4898      0.534 0.000 0.416 0.000 0.584
#> GSM509778     4  0.2345      0.911 0.000 0.100 0.000 0.900
#> GSM509780     4  0.3975      0.827 0.000 0.240 0.000 0.760
#> GSM509782     4  0.2345      0.911 0.000 0.100 0.000 0.900
#> GSM509784     4  0.2345      0.911 0.000 0.100 0.000 0.900
#> GSM509786     4  0.2345      0.911 0.000 0.100 0.000 0.900

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509711     5  0.2329      0.775 0.124 0.000 0.000 0.000 0.876
#> GSM509714     5  0.0000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM509719     5  0.0000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM509724     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509729     5  0.4283      0.481 0.348 0.000 0.008 0.000 0.644
#> GSM509707     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509712     5  0.0162      0.846 0.000 0.000 0.000 0.004 0.996
#> GSM509715     5  0.2127      0.804 0.000 0.000 0.000 0.108 0.892
#> GSM509720     5  0.0000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM509725     1  0.0404      0.976 0.988 0.000 0.012 0.000 0.000
#> GSM509730     5  0.3060      0.768 0.128 0.000 0.024 0.000 0.848
#> GSM509708     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509713     5  0.4700      0.200 0.472 0.000 0.008 0.004 0.516
#> GSM509716     5  0.0162      0.846 0.000 0.000 0.000 0.004 0.996
#> GSM509721     5  0.0000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM509726     1  0.3012      0.852 0.872 0.000 0.052 0.004 0.072
#> GSM509731     5  0.1608      0.825 0.000 0.000 0.000 0.072 0.928
#> GSM509709     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.1851      0.816 0.000 0.000 0.000 0.088 0.912
#> GSM509722     5  0.0000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM509727     5  0.4576      0.275 0.456 0.000 0.004 0.004 0.536
#> GSM509710     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.4697      0.145 0.000 0.000 0.388 0.020 0.592
#> GSM509723     5  0.0000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM509728     3  0.6153      0.457 0.300 0.000 0.552 0.004 0.144
#> GSM509732     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> GSM509736     3  0.2890      0.819 0.000 0.000 0.836 0.004 0.160
#> GSM509741     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> GSM509746     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> GSM509733     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> GSM509737     3  0.2890      0.819 0.000 0.000 0.836 0.004 0.160
#> GSM509742     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> GSM509747     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> GSM509734     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> GSM509738     3  0.3906      0.674 0.000 0.000 0.704 0.004 0.292
#> GSM509743     3  0.2561      0.827 0.000 0.000 0.856 0.000 0.144
#> GSM509748     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> GSM509735     1  0.0404      0.976 0.988 0.000 0.012 0.000 0.000
#> GSM509739     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.2648      0.824 0.000 0.000 0.848 0.000 0.152
#> GSM509749     3  0.1282      0.847 0.000 0.000 0.952 0.004 0.044
#> GSM509740     3  0.4390      0.399 0.000 0.000 0.568 0.004 0.428
#> GSM509745     3  0.4211      0.557 0.000 0.000 0.636 0.004 0.360
#> GSM509750     3  0.2890      0.819 0.000 0.000 0.836 0.004 0.160
#> GSM509751     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509763     4  0.2813      0.812 0.000 0.168 0.000 0.832 0.000
#> GSM509765     4  0.3336      0.758 0.000 0.228 0.000 0.772 0.000
#> GSM509767     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509769     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509771     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509773     2  0.0404      0.972 0.000 0.988 0.000 0.012 0.000
#> GSM509775     2  0.3424      0.613 0.000 0.760 0.000 0.240 0.000
#> GSM509777     4  0.0794      0.870 0.000 0.028 0.000 0.972 0.000
#> GSM509779     4  0.0162      0.875 0.000 0.004 0.000 0.996 0.000
#> GSM509781     4  0.0162      0.875 0.000 0.004 0.000 0.996 0.000
#> GSM509783     4  0.0162      0.875 0.000 0.004 0.000 0.996 0.000
#> GSM509785     4  0.0162      0.875 0.000 0.004 0.000 0.996 0.000
#> GSM509752     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509760     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509766     4  0.3242      0.771 0.000 0.216 0.000 0.784 0.000
#> GSM509768     4  0.4297      0.269 0.000 0.472 0.000 0.528 0.000
#> GSM509770     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509772     2  0.0000      0.984 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.0290      0.874 0.000 0.008 0.000 0.992 0.000
#> GSM509776     4  0.4060      0.555 0.000 0.360 0.000 0.640 0.000
#> GSM509778     4  0.0162      0.875 0.000 0.004 0.000 0.996 0.000
#> GSM509780     4  0.2648      0.825 0.000 0.152 0.000 0.848 0.000
#> GSM509782     4  0.0162      0.875 0.000 0.004 0.000 0.996 0.000
#> GSM509784     4  0.0162      0.875 0.000 0.004 0.000 0.996 0.000
#> GSM509786     4  0.0162      0.875 0.000 0.004 0.000 0.996 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
#> GSM509706     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     6  0.4202      0.600 0.064 0.000 0.000 0.000 0.224 0.712
#> GSM509714     6  0.2823      0.639 0.000 0.000 0.000 0.000 0.204 0.796
#> GSM509719     5  0.0000      0.985 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509724     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509729     5  0.1285      0.927 0.052 0.000 0.000 0.000 0.944 0.004
#> GSM509707     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     6  0.3862      0.184 0.000 0.000 0.000 0.000 0.476 0.524
#> GSM509715     6  0.0000      0.797 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509720     5  0.0000      0.985 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509725     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509730     5  0.0146      0.985 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM509708     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.4668      0.340 0.620 0.000 0.000 0.000 0.064 0.316
#> GSM509716     6  0.0146      0.797 0.000 0.000 0.000 0.000 0.004 0.996
#> GSM509721     5  0.0000      0.985 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509726     1  0.3549      0.723 0.808 0.000 0.032 0.000 0.020 0.140
#> GSM509731     6  0.0405      0.795 0.000 0.000 0.000 0.004 0.008 0.988
#> GSM509709     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     6  0.0000      0.797 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509722     5  0.0146      0.985 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM509727     6  0.4452      0.134 0.428 0.000 0.016 0.000 0.008 0.548
#> GSM509710     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     6  0.0458      0.788 0.000 0.000 0.016 0.000 0.000 0.984
#> GSM509723     5  0.0146      0.985 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM509728     3  0.5820      0.421 0.288 0.000 0.512 0.000 0.004 0.196
#> GSM509732     3  0.0000      0.839 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     3  0.2933      0.790 0.000 0.000 0.796 0.000 0.004 0.200
#> GSM509741     3  0.0000      0.839 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509746     3  0.0000      0.839 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000      0.839 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     3  0.2933      0.790 0.000 0.000 0.796 0.000 0.004 0.200
#> GSM509742     3  0.0000      0.839 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509747     3  0.0000      0.839 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.0000      0.839 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509738     3  0.4769      0.663 0.000 0.000 0.644 0.000 0.092 0.264
#> GSM509743     3  0.2146      0.823 0.000 0.000 0.880 0.000 0.004 0.116
#> GSM509748     3  0.0000      0.839 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509735     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.2362      0.818 0.000 0.000 0.860 0.000 0.004 0.136
#> GSM509749     3  0.1327      0.833 0.000 0.000 0.936 0.000 0.000 0.064
#> GSM509740     3  0.3982      0.410 0.000 0.000 0.536 0.000 0.004 0.460
#> GSM509745     3  0.3890      0.540 0.000 0.000 0.596 0.000 0.004 0.400
#> GSM509750     3  0.2933      0.790 0.000 0.000 0.796 0.000 0.004 0.200
#> GSM509751     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509763     4  0.2135      0.827 0.000 0.128 0.000 0.872 0.000 0.000
#> GSM509765     4  0.2823      0.770 0.000 0.204 0.000 0.796 0.000 0.000
#> GSM509767     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509769     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509771     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509773     2  0.0363      0.973 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM509775     2  0.3076      0.621 0.000 0.760 0.000 0.240 0.000 0.000
#> GSM509777     4  0.0632      0.869 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM509779     4  0.0000      0.874 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509781     4  0.0000      0.874 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509783     4  0.0000      0.874 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509785     4  0.0000      0.874 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509752     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509760     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509766     4  0.2697      0.785 0.000 0.188 0.000 0.812 0.000 0.000
#> GSM509768     4  0.3847      0.299 0.000 0.456 0.000 0.544 0.000 0.000
#> GSM509770     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509772     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509774     4  0.0146      0.874 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM509776     4  0.3620      0.558 0.000 0.352 0.000 0.648 0.000 0.000
#> GSM509778     4  0.0000      0.874 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509780     4  0.2178      0.826 0.000 0.132 0.000 0.868 0.000 0.000
#> GSM509782     4  0.0000      0.874 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509784     4  0.0000      0.874 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509786     4  0.0000      0.874 0.000 0.000 0.000 1.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)  time(p) k
#> MAD:pam 80         3.52e-15 2.13e-12 2
#> MAD:pam 80         1.31e-16 5.09e-13 3
#> MAD:pam 77         7.44e-15 4.55e-10 4
#> MAD:pam 74         1.78e-25 1.42e-07 5
#> MAD:pam 75         1.15e-24 2.15e-06 6

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


MAD:mclust**

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5005 0.500   0.500
#> 3 3 0.901           0.973       0.983         0.2874 0.857   0.714
#> 4 4 0.988           0.958       0.971         0.0864 0.934   0.817
#> 5 5 0.837           0.822       0.893         0.0821 0.905   0.699
#> 6 6 0.781           0.757       0.817         0.0439 0.952   0.808

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

suggest_best_k(res)
#> [1] 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
#> GSM509706     1       0          1  1  0
#> GSM509711     1       0          1  1  0
#> GSM509714     1       0          1  1  0
#> GSM509719     1       0          1  1  0
#> GSM509724     1       0          1  1  0
#> GSM509729     1       0          1  1  0
#> GSM509707     1       0          1  1  0
#> GSM509712     1       0          1  1  0
#> GSM509715     1       0          1  1  0
#> GSM509720     1       0          1  1  0
#> GSM509725     1       0          1  1  0
#> GSM509730     1       0          1  1  0
#> GSM509708     1       0          1  1  0
#> GSM509713     1       0          1  1  0
#> GSM509716     1       0          1  1  0
#> GSM509721     1       0          1  1  0
#> GSM509726     1       0          1  1  0
#> GSM509731     1       0          1  1  0
#> GSM509709     1       0          1  1  0
#> GSM509717     1       0          1  1  0
#> GSM509722     1       0          1  1  0
#> GSM509727     1       0          1  1  0
#> GSM509710     1       0          1  1  0
#> GSM509718     1       0          1  1  0
#> GSM509723     1       0          1  1  0
#> GSM509728     1       0          1  1  0
#> GSM509732     1       0          1  1  0
#> GSM509736     1       0          1  1  0
#> GSM509741     1       0          1  1  0
#> GSM509746     1       0          1  1  0
#> GSM509733     1       0          1  1  0
#> GSM509737     1       0          1  1  0
#> GSM509742     1       0          1  1  0
#> GSM509747     1       0          1  1  0
#> GSM509734     1       0          1  1  0
#> GSM509738     1       0          1  1  0
#> GSM509743     1       0          1  1  0
#> GSM509748     1       0          1  1  0
#> GSM509735     1       0          1  1  0
#> GSM509739     1       0          1  1  0
#> GSM509744     1       0          1  1  0
#> GSM509749     1       0          1  1  0
#> GSM509740     1       0          1  1  0
#> GSM509745     1       0          1  1  0
#> GSM509750     1       0          1  1  0
#> GSM509751     2       0          1  0  1
#> GSM509753     2       0          1  0  1
#> GSM509755     2       0          1  0  1
#> GSM509757     2       0          1  0  1
#> GSM509759     2       0          1  0  1
#> GSM509761     2       0          1  0  1
#> GSM509763     2       0          1  0  1
#> GSM509765     2       0          1  0  1
#> GSM509767     2       0          1  0  1
#> GSM509769     2       0          1  0  1
#> GSM509771     2       0          1  0  1
#> GSM509773     2       0          1  0  1
#> GSM509775     2       0          1  0  1
#> GSM509777     2       0          1  0  1
#> GSM509779     2       0          1  0  1
#> GSM509781     2       0          1  0  1
#> GSM509783     2       0          1  0  1
#> GSM509785     2       0          1  0  1
#> GSM509752     2       0          1  0  1
#> GSM509754     2       0          1  0  1
#> GSM509756     2       0          1  0  1
#> GSM509758     2       0          1  0  1
#> GSM509760     2       0          1  0  1
#> GSM509762     2       0          1  0  1
#> GSM509764     2       0          1  0  1
#> GSM509766     2       0          1  0  1
#> GSM509768     2       0          1  0  1
#> GSM509770     2       0          1  0  1
#> GSM509772     2       0          1  0  1
#> GSM509774     2       0          1  0  1
#> GSM509776     2       0          1  0  1
#> GSM509778     2       0          1  0  1
#> GSM509780     2       0          1  0  1
#> GSM509782     2       0          1  0  1
#> GSM509784     2       0          1  0  1
#> GSM509786     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1 p2    p3
#> GSM509706     1   0.000      0.990 1.000  0 0.000
#> GSM509711     3   0.334      0.903 0.120  0 0.880
#> GSM509714     3   0.334      0.903 0.120  0 0.880
#> GSM509719     1   0.000      0.990 1.000  0 0.000
#> GSM509724     1   0.000      0.990 1.000  0 0.000
#> GSM509729     1   0.000      0.990 1.000  0 0.000
#> GSM509707     1   0.000      0.990 1.000  0 0.000
#> GSM509712     3   0.334      0.903 0.120  0 0.880
#> GSM509715     3   0.319      0.909 0.112  0 0.888
#> GSM509720     1   0.000      0.990 1.000  0 0.000
#> GSM509725     1   0.000      0.990 1.000  0 0.000
#> GSM509730     1   0.000      0.990 1.000  0 0.000
#> GSM509708     1   0.000      0.990 1.000  0 0.000
#> GSM509713     3   0.334      0.903 0.120  0 0.880
#> GSM509716     3   0.319      0.909 0.112  0 0.888
#> GSM509721     1   0.000      0.990 1.000  0 0.000
#> GSM509726     3   0.429      0.838 0.180  0 0.820
#> GSM509731     3   0.319      0.909 0.112  0 0.888
#> GSM509709     1   0.000      0.990 1.000  0 0.000
#> GSM509717     3   0.319      0.909 0.112  0 0.888
#> GSM509722     1   0.355      0.834 0.868  0 0.132
#> GSM509727     3   0.000      0.954 0.000  0 1.000
#> GSM509710     1   0.000      0.990 1.000  0 0.000
#> GSM509718     3   0.319      0.909 0.112  0 0.888
#> GSM509723     1   0.000      0.990 1.000  0 0.000
#> GSM509728     3   0.000      0.954 0.000  0 1.000
#> GSM509732     3   0.000      0.954 0.000  0 1.000
#> GSM509736     3   0.000      0.954 0.000  0 1.000
#> GSM509741     3   0.000      0.954 0.000  0 1.000
#> GSM509746     3   0.000      0.954 0.000  0 1.000
#> GSM509733     3   0.000      0.954 0.000  0 1.000
#> GSM509737     3   0.000      0.954 0.000  0 1.000
#> GSM509742     3   0.000      0.954 0.000  0 1.000
#> GSM509747     3   0.000      0.954 0.000  0 1.000
#> GSM509734     3   0.000      0.954 0.000  0 1.000
#> GSM509738     3   0.000      0.954 0.000  0 1.000
#> GSM509743     3   0.000      0.954 0.000  0 1.000
#> GSM509748     3   0.000      0.954 0.000  0 1.000
#> GSM509735     1   0.000      0.990 1.000  0 0.000
#> GSM509739     1   0.000      0.990 1.000  0 0.000
#> GSM509744     3   0.000      0.954 0.000  0 1.000
#> GSM509749     3   0.000      0.954 0.000  0 1.000
#> GSM509740     3   0.000      0.954 0.000  0 1.000
#> GSM509745     3   0.000      0.954 0.000  0 1.000
#> GSM509750     3   0.000      0.954 0.000  0 1.000
#> GSM509751     2   0.000      1.000 0.000  1 0.000
#> GSM509753     2   0.000      1.000 0.000  1 0.000
#> GSM509755     2   0.000      1.000 0.000  1 0.000
#> GSM509757     2   0.000      1.000 0.000  1 0.000
#> GSM509759     2   0.000      1.000 0.000  1 0.000
#> GSM509761     2   0.000      1.000 0.000  1 0.000
#> GSM509763     2   0.000      1.000 0.000  1 0.000
#> GSM509765     2   0.000      1.000 0.000  1 0.000
#> GSM509767     2   0.000      1.000 0.000  1 0.000
#> GSM509769     2   0.000      1.000 0.000  1 0.000
#> GSM509771     2   0.000      1.000 0.000  1 0.000
#> GSM509773     2   0.000      1.000 0.000  1 0.000
#> GSM509775     2   0.000      1.000 0.000  1 0.000
#> GSM509777     2   0.000      1.000 0.000  1 0.000
#> GSM509779     2   0.000      1.000 0.000  1 0.000
#> GSM509781     2   0.000      1.000 0.000  1 0.000
#> GSM509783     2   0.000      1.000 0.000  1 0.000
#> GSM509785     2   0.000      1.000 0.000  1 0.000
#> GSM509752     2   0.000      1.000 0.000  1 0.000
#> GSM509754     2   0.000      1.000 0.000  1 0.000
#> GSM509756     2   0.000      1.000 0.000  1 0.000
#> GSM509758     2   0.000      1.000 0.000  1 0.000
#> GSM509760     2   0.000      1.000 0.000  1 0.000
#> GSM509762     2   0.000      1.000 0.000  1 0.000
#> GSM509764     2   0.000      1.000 0.000  1 0.000
#> GSM509766     2   0.000      1.000 0.000  1 0.000
#> GSM509768     2   0.000      1.000 0.000  1 0.000
#> GSM509770     2   0.000      1.000 0.000  1 0.000
#> GSM509772     2   0.000      1.000 0.000  1 0.000
#> GSM509774     2   0.000      1.000 0.000  1 0.000
#> GSM509776     2   0.000      1.000 0.000  1 0.000
#> GSM509778     2   0.000      1.000 0.000  1 0.000
#> GSM509780     2   0.000      1.000 0.000  1 0.000
#> GSM509782     2   0.000      1.000 0.000  1 0.000
#> GSM509784     2   0.000      1.000 0.000  1 0.000
#> GSM509786     2   0.000      1.000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509711     4  0.2589      0.904 0.116 0.000 0.000 0.884
#> GSM509714     4  0.2589      0.904 0.116 0.000 0.000 0.884
#> GSM509719     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509724     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509729     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509707     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509712     4  0.4193      0.760 0.268 0.000 0.000 0.732
#> GSM509715     4  0.1716      0.918 0.064 0.000 0.000 0.936
#> GSM509720     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509725     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509730     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509708     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509713     4  0.4697      0.617 0.356 0.000 0.000 0.644
#> GSM509716     4  0.1716      0.918 0.064 0.000 0.000 0.936
#> GSM509721     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509726     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM509731     4  0.1716      0.918 0.064 0.000 0.000 0.936
#> GSM509709     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509717     4  0.1716      0.918 0.064 0.000 0.000 0.936
#> GSM509722     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509727     3  0.5494      0.615 0.208 0.000 0.716 0.076
#> GSM509710     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509718     4  0.1716      0.918 0.064 0.000 0.000 0.936
#> GSM509723     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509728     3  0.1743      0.915 0.056 0.000 0.940 0.004
#> GSM509732     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509736     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509741     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509737     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509742     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509734     3  0.1211      0.932 0.040 0.000 0.960 0.000
#> GSM509738     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509743     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509735     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM509744     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509749     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509740     3  0.3885      0.806 0.064 0.000 0.844 0.092
#> GSM509745     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509750     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM509751     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509765     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509767     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509775     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509777     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509779     2  0.1716      0.949 0.000 0.936 0.000 0.064
#> GSM509781     2  0.2011      0.938 0.000 0.920 0.000 0.080
#> GSM509783     2  0.2081      0.935 0.000 0.916 0.000 0.084
#> GSM509785     2  0.2081      0.935 0.000 0.916 0.000 0.084
#> GSM509752     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509766     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509768     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509770     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509774     2  0.0188      0.982 0.000 0.996 0.000 0.004
#> GSM509776     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509778     2  0.1867      0.944 0.000 0.928 0.000 0.072
#> GSM509780     2  0.0000      0.984 0.000 1.000 0.000 0.000
#> GSM509782     2  0.2149      0.932 0.000 0.912 0.000 0.088
#> GSM509784     2  0.1716      0.949 0.000 0.936 0.000 0.064
#> GSM509786     2  0.2081      0.935 0.000 0.916 0.000 0.084

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0290     0.8823 0.992 0.000 0.000 0.000 0.008
#> GSM509711     5  0.4300     0.2985 0.476 0.000 0.000 0.000 0.524
#> GSM509714     5  0.4446     0.2940 0.476 0.000 0.000 0.004 0.520
#> GSM509719     1  0.0000     0.8828 1.000 0.000 0.000 0.000 0.000
#> GSM509724     1  0.0404     0.8772 0.988 0.000 0.000 0.000 0.012
#> GSM509729     1  0.0290     0.8823 0.992 0.000 0.000 0.000 0.008
#> GSM509707     1  0.0290     0.8823 0.992 0.000 0.000 0.000 0.008
#> GSM509712     1  0.4448    -0.2991 0.516 0.000 0.000 0.004 0.480
#> GSM509715     5  0.1410     0.7757 0.060 0.000 0.000 0.000 0.940
#> GSM509720     1  0.0324     0.8821 0.992 0.000 0.000 0.004 0.004
#> GSM509725     1  0.0000     0.8828 1.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.0000     0.8828 1.000 0.000 0.000 0.000 0.000
#> GSM509708     1  0.0290     0.8823 0.992 0.000 0.000 0.000 0.008
#> GSM509713     1  0.4425    -0.2055 0.544 0.000 0.000 0.004 0.452
#> GSM509716     5  0.1410     0.7757 0.060 0.000 0.000 0.000 0.940
#> GSM509721     1  0.0000     0.8828 1.000 0.000 0.000 0.000 0.000
#> GSM509726     1  0.0693     0.8739 0.980 0.000 0.000 0.008 0.012
#> GSM509731     5  0.3210     0.7103 0.212 0.000 0.000 0.000 0.788
#> GSM509709     1  0.0290     0.8823 0.992 0.000 0.000 0.000 0.008
#> GSM509717     5  0.1410     0.7757 0.060 0.000 0.000 0.000 0.940
#> GSM509722     1  0.0671     0.8749 0.980 0.000 0.000 0.004 0.016
#> GSM509727     1  0.6639    -0.0841 0.424 0.000 0.412 0.152 0.012
#> GSM509710     1  0.0000     0.8828 1.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.2703     0.7564 0.060 0.000 0.024 0.020 0.896
#> GSM509723     1  0.0000     0.8828 1.000 0.000 0.000 0.000 0.000
#> GSM509728     3  0.3512     0.8643 0.012 0.000 0.816 0.160 0.012
#> GSM509732     3  0.0290     0.9356 0.000 0.000 0.992 0.008 0.000
#> GSM509736     3  0.0880     0.9326 0.000 0.000 0.968 0.032 0.000
#> GSM509741     3  0.0162     0.9351 0.000 0.000 0.996 0.004 0.000
#> GSM509746     3  0.0290     0.9356 0.000 0.000 0.992 0.008 0.000
#> GSM509733     3  0.0290     0.9356 0.000 0.000 0.992 0.008 0.000
#> GSM509737     3  0.1410     0.9254 0.000 0.000 0.940 0.060 0.000
#> GSM509742     3  0.0162     0.9351 0.000 0.000 0.996 0.004 0.000
#> GSM509747     3  0.0290     0.9356 0.000 0.000 0.992 0.008 0.000
#> GSM509734     3  0.1043     0.9318 0.000 0.000 0.960 0.040 0.000
#> GSM509738     3  0.2605     0.8826 0.000 0.000 0.852 0.148 0.000
#> GSM509743     3  0.0162     0.9351 0.000 0.000 0.996 0.004 0.000
#> GSM509748     3  0.0290     0.9356 0.000 0.000 0.992 0.008 0.000
#> GSM509735     1  0.0404     0.8772 0.988 0.000 0.000 0.000 0.012
#> GSM509739     1  0.0000     0.8828 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.0963     0.9315 0.000 0.000 0.964 0.036 0.000
#> GSM509749     3  0.0290     0.9356 0.000 0.000 0.992 0.008 0.000
#> GSM509740     3  0.6164     0.4725 0.248 0.000 0.592 0.148 0.012
#> GSM509745     3  0.2605     0.8826 0.000 0.000 0.852 0.148 0.000
#> GSM509750     3  0.2471     0.8887 0.000 0.000 0.864 0.136 0.000
#> GSM509751     2  0.0703     0.9187 0.000 0.976 0.000 0.024 0.000
#> GSM509753     2  0.0510     0.9189 0.000 0.984 0.000 0.016 0.000
#> GSM509755     2  0.0609     0.9110 0.000 0.980 0.000 0.020 0.000
#> GSM509757     2  0.0609     0.9110 0.000 0.980 0.000 0.020 0.000
#> GSM509759     2  0.0794     0.9064 0.000 0.972 0.000 0.028 0.000
#> GSM509761     2  0.2012     0.9082 0.000 0.920 0.000 0.020 0.060
#> GSM509763     2  0.2853     0.8770 0.000 0.876 0.000 0.072 0.052
#> GSM509765     2  0.2438     0.8993 0.000 0.900 0.000 0.040 0.060
#> GSM509767     2  0.0000     0.9171 0.000 1.000 0.000 0.000 0.000
#> GSM509769     2  0.1117     0.9206 0.000 0.964 0.000 0.020 0.016
#> GSM509771     2  0.0609     0.9110 0.000 0.980 0.000 0.020 0.000
#> GSM509773     2  0.1197     0.9114 0.000 0.952 0.000 0.048 0.000
#> GSM509775     2  0.2012     0.9082 0.000 0.920 0.000 0.020 0.060
#> GSM509777     2  0.4433     0.6565 0.000 0.740 0.000 0.200 0.060
#> GSM509779     4  0.4780     0.8719 0.000 0.248 0.000 0.692 0.060
#> GSM509781     4  0.3074     0.9544 0.000 0.196 0.000 0.804 0.000
#> GSM509783     4  0.3550     0.9441 0.000 0.184 0.000 0.796 0.020
#> GSM509785     4  0.3074     0.9544 0.000 0.196 0.000 0.804 0.000
#> GSM509752     2  0.0794     0.9183 0.000 0.972 0.000 0.028 0.000
#> GSM509754     2  0.0794     0.9183 0.000 0.972 0.000 0.028 0.000
#> GSM509756     2  0.1725     0.9135 0.000 0.936 0.000 0.020 0.044
#> GSM509758     2  0.1399     0.9186 0.000 0.952 0.000 0.028 0.020
#> GSM509760     2  0.2012     0.9084 0.000 0.920 0.000 0.020 0.060
#> GSM509762     2  0.0510     0.9127 0.000 0.984 0.000 0.016 0.000
#> GSM509764     2  0.1270     0.9002 0.000 0.948 0.000 0.052 0.000
#> GSM509766     2  0.2438     0.8990 0.000 0.900 0.000 0.040 0.060
#> GSM509768     2  0.2278     0.9036 0.000 0.908 0.000 0.032 0.060
#> GSM509770     2  0.0609     0.9110 0.000 0.980 0.000 0.020 0.000
#> GSM509772     2  0.0880     0.9036 0.000 0.968 0.000 0.032 0.000
#> GSM509774     2  0.5401    -0.0622 0.000 0.536 0.000 0.404 0.060
#> GSM509776     2  0.2193     0.9054 0.000 0.912 0.000 0.028 0.060
#> GSM509778     4  0.3074     0.9544 0.000 0.196 0.000 0.804 0.000
#> GSM509780     2  0.2193     0.9110 0.000 0.912 0.000 0.028 0.060
#> GSM509782     4  0.3353     0.9527 0.000 0.196 0.000 0.796 0.008
#> GSM509784     4  0.4806     0.8753 0.000 0.252 0.000 0.688 0.060
#> GSM509786     4  0.3492     0.9480 0.000 0.188 0.000 0.796 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
#> GSM509706     1  0.0260     0.8899 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509711     1  0.4810     0.4222 0.660 0.000 0.000 0.000 0.220 0.120
#> GSM509714     1  0.3578     0.3133 0.660 0.000 0.000 0.000 0.340 0.000
#> GSM509719     1  0.0000     0.8896 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509724     1  0.0972     0.8736 0.964 0.000 0.028 0.000 0.000 0.008
#> GSM509729     1  0.0260     0.8899 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509707     1  0.0260     0.8899 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509712     1  0.4653     0.4704 0.684 0.000 0.000 0.000 0.196 0.120
#> GSM509715     5  0.3136     0.9370 0.228 0.000 0.000 0.004 0.768 0.000
#> GSM509720     1  0.0146     0.8899 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509725     1  0.0972     0.8736 0.964 0.000 0.028 0.000 0.000 0.008
#> GSM509730     1  0.0000     0.8896 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509708     1  0.0260     0.8899 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509713     1  0.4536     0.5065 0.700 0.000 0.000 0.000 0.180 0.120
#> GSM509716     5  0.3136     0.9370 0.228 0.000 0.000 0.004 0.768 0.000
#> GSM509721     1  0.0000     0.8896 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509726     1  0.2586     0.7826 0.868 0.000 0.032 0.000 0.000 0.100
#> GSM509731     5  0.3819     0.7155 0.372 0.000 0.000 0.004 0.624 0.000
#> GSM509709     1  0.0260     0.8899 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509717     5  0.3136     0.9370 0.228 0.000 0.000 0.004 0.768 0.000
#> GSM509722     1  0.0260     0.8899 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509727     6  0.3975     0.0754 0.392 0.000 0.008 0.000 0.000 0.600
#> GSM509710     1  0.0972     0.8736 0.964 0.000 0.028 0.000 0.000 0.008
#> GSM509718     5  0.3599     0.9200 0.220 0.000 0.000 0.004 0.756 0.020
#> GSM509723     1  0.0000     0.8896 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509728     6  0.0547     0.6789 0.000 0.000 0.020 0.000 0.000 0.980
#> GSM509732     3  0.2178     0.8770 0.000 0.000 0.868 0.000 0.000 0.132
#> GSM509736     6  0.2260     0.6231 0.000 0.000 0.140 0.000 0.000 0.860
#> GSM509741     3  0.3428     0.7912 0.000 0.000 0.696 0.000 0.000 0.304
#> GSM509746     3  0.2178     0.8770 0.000 0.000 0.868 0.000 0.000 0.132
#> GSM509733     3  0.2178     0.8770 0.000 0.000 0.868 0.000 0.000 0.132
#> GSM509737     6  0.1610     0.6613 0.000 0.000 0.084 0.000 0.000 0.916
#> GSM509742     3  0.3409     0.7956 0.000 0.000 0.700 0.000 0.000 0.300
#> GSM509747     3  0.2219     0.8748 0.000 0.000 0.864 0.000 0.000 0.136
#> GSM509734     6  0.3244     0.4661 0.000 0.000 0.268 0.000 0.000 0.732
#> GSM509738     6  0.0458     0.6823 0.000 0.000 0.016 0.000 0.000 0.984
#> GSM509743     3  0.3428     0.7912 0.000 0.000 0.696 0.000 0.000 0.304
#> GSM509748     3  0.2416     0.8749 0.000 0.000 0.844 0.000 0.000 0.156
#> GSM509735     1  0.0972     0.8736 0.964 0.000 0.028 0.000 0.000 0.008
#> GSM509739     1  0.0000     0.8896 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     6  0.3810    -0.1533 0.000 0.000 0.428 0.000 0.000 0.572
#> GSM509749     3  0.3221     0.8120 0.000 0.000 0.736 0.000 0.000 0.264
#> GSM509740     6  0.3168     0.5293 0.192 0.000 0.016 0.000 0.000 0.792
#> GSM509745     6  0.0458     0.6823 0.000 0.000 0.016 0.000 0.000 0.984
#> GSM509750     6  0.3175     0.4136 0.000 0.000 0.256 0.000 0.000 0.744
#> GSM509751     2  0.4340     0.7976 0.000 0.708 0.064 0.004 0.224 0.000
#> GSM509753     2  0.4454     0.7894 0.000 0.692 0.084 0.000 0.224 0.000
#> GSM509755     2  0.4637     0.7864 0.000 0.684 0.088 0.004 0.224 0.000
#> GSM509757     2  0.4744     0.7867 0.000 0.684 0.080 0.012 0.224 0.000
#> GSM509759     2  0.5637     0.7512 0.000 0.628 0.088 0.060 0.224 0.000
#> GSM509761     2  0.1340     0.7586 0.000 0.948 0.040 0.004 0.008 0.000
#> GSM509763     2  0.2709     0.7529 0.000 0.884 0.040 0.044 0.032 0.000
#> GSM509765     2  0.1737     0.7544 0.000 0.932 0.040 0.020 0.008 0.000
#> GSM509767     2  0.4147     0.7981 0.000 0.716 0.060 0.000 0.224 0.000
#> GSM509769     2  0.2416     0.8118 0.000 0.844 0.000 0.000 0.156 0.000
#> GSM509771     2  0.4340     0.7976 0.000 0.708 0.064 0.004 0.224 0.000
#> GSM509773     2  0.3728     0.8021 0.000 0.772 0.004 0.044 0.180 0.000
#> GSM509775     2  0.1116     0.7649 0.000 0.960 0.028 0.004 0.008 0.000
#> GSM509777     2  0.3706     0.5368 0.000 0.780 0.040 0.172 0.008 0.000
#> GSM509779     4  0.4572     0.7062 0.000 0.316 0.040 0.636 0.008 0.000
#> GSM509781     4  0.1501     0.9037 0.000 0.076 0.000 0.924 0.000 0.000
#> GSM509783     4  0.1501     0.9037 0.000 0.076 0.000 0.924 0.000 0.000
#> GSM509785     4  0.1501     0.9037 0.000 0.076 0.000 0.924 0.000 0.000
#> GSM509752     2  0.3081     0.8109 0.000 0.776 0.000 0.004 0.220 0.000
#> GSM509754     2  0.3426     0.8099 0.000 0.764 0.012 0.004 0.220 0.000
#> GSM509756     2  0.1296     0.7911 0.000 0.952 0.032 0.004 0.012 0.000
#> GSM509758     2  0.2278     0.8093 0.000 0.868 0.004 0.000 0.128 0.000
#> GSM509760     2  0.0551     0.7764 0.000 0.984 0.004 0.004 0.008 0.000
#> GSM509762     2  0.3612     0.8091 0.000 0.764 0.036 0.000 0.200 0.000
#> GSM509764     2  0.5644     0.7498 0.000 0.628 0.064 0.084 0.224 0.000
#> GSM509766     2  0.1340     0.7586 0.000 0.948 0.040 0.004 0.008 0.000
#> GSM509768     2  0.1226     0.7610 0.000 0.952 0.040 0.004 0.004 0.000
#> GSM509770     2  0.4253     0.8034 0.000 0.728 0.072 0.004 0.196 0.000
#> GSM509772     2  0.5787     0.7412 0.000 0.616 0.088 0.072 0.224 0.000
#> GSM509774     2  0.4414     0.2762 0.000 0.672 0.040 0.280 0.008 0.000
#> GSM509776     2  0.1340     0.7586 0.000 0.948 0.040 0.004 0.008 0.000
#> GSM509778     4  0.1501     0.9037 0.000 0.076 0.000 0.924 0.000 0.000
#> GSM509780     2  0.1340     0.7586 0.000 0.948 0.040 0.004 0.008 0.000
#> GSM509782     4  0.1501     0.9037 0.000 0.076 0.000 0.924 0.000 0.000
#> GSM509784     4  0.4572     0.7078 0.000 0.316 0.040 0.636 0.008 0.000
#> GSM509786     4  0.1501     0.9037 0.000 0.076 0.000 0.924 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)  time(p) k
#> MAD:mclust 81         2.58e-18 2.22e-15 2
#> MAD:mclust 81         3.91e-20 4.99e-13 3
#> MAD:mclust 81         7.80e-27 1.38e-10 4
#> MAD:mclust 74         1.01e-23 6.87e-08 5
#> MAD:mclust 73         4.00e-22 1.78e-08 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 19175 rows and 81 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.995       0.998         0.5067 0.494   0.494
#> 3 3 0.764           0.822       0.916         0.2860 0.800   0.615
#> 4 4 0.904           0.902       0.945         0.1382 0.760   0.430
#> 5 5 0.866           0.844       0.917         0.0572 0.919   0.707
#> 6 6 0.851           0.785       0.893         0.0330 0.949   0.776

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
#> GSM509706     1   0.000      1.000 1.000 0.000
#> GSM509711     1   0.000      1.000 1.000 0.000
#> GSM509714     1   0.000      1.000 1.000 0.000
#> GSM509719     1   0.000      1.000 1.000 0.000
#> GSM509724     1   0.000      1.000 1.000 0.000
#> GSM509729     1   0.000      1.000 1.000 0.000
#> GSM509707     1   0.000      1.000 1.000 0.000
#> GSM509712     1   0.000      1.000 1.000 0.000
#> GSM509715     2   0.000      0.996 0.000 1.000
#> GSM509720     1   0.000      1.000 1.000 0.000
#> GSM509725     1   0.000      1.000 1.000 0.000
#> GSM509730     1   0.000      1.000 1.000 0.000
#> GSM509708     1   0.000      1.000 1.000 0.000
#> GSM509713     1   0.000      1.000 1.000 0.000
#> GSM509716     2   0.000      0.996 0.000 1.000
#> GSM509721     1   0.000      1.000 1.000 0.000
#> GSM509726     1   0.000      1.000 1.000 0.000
#> GSM509731     2   0.662      0.792 0.172 0.828
#> GSM509709     1   0.000      1.000 1.000 0.000
#> GSM509717     2   0.000      0.996 0.000 1.000
#> GSM509722     1   0.000      1.000 1.000 0.000
#> GSM509727     1   0.000      1.000 1.000 0.000
#> GSM509710     1   0.000      1.000 1.000 0.000
#> GSM509718     2   0.000      0.996 0.000 1.000
#> GSM509723     1   0.000      1.000 1.000 0.000
#> GSM509728     1   0.000      1.000 1.000 0.000
#> GSM509732     1   0.000      1.000 1.000 0.000
#> GSM509736     1   0.000      1.000 1.000 0.000
#> GSM509741     1   0.000      1.000 1.000 0.000
#> GSM509746     1   0.000      1.000 1.000 0.000
#> GSM509733     1   0.000      1.000 1.000 0.000
#> GSM509737     1   0.000      1.000 1.000 0.000
#> GSM509742     1   0.000      1.000 1.000 0.000
#> GSM509747     1   0.000      1.000 1.000 0.000
#> GSM509734     1   0.000      1.000 1.000 0.000
#> GSM509738     1   0.000      1.000 1.000 0.000
#> GSM509743     1   0.000      1.000 1.000 0.000
#> GSM509748     1   0.000      1.000 1.000 0.000
#> GSM509735     1   0.000      1.000 1.000 0.000
#> GSM509739     1   0.000      1.000 1.000 0.000
#> GSM509744     1   0.000      1.000 1.000 0.000
#> GSM509749     1   0.000      1.000 1.000 0.000
#> GSM509740     1   0.000      1.000 1.000 0.000
#> GSM509745     1   0.000      1.000 1.000 0.000
#> GSM509750     1   0.000      1.000 1.000 0.000
#> GSM509751     2   0.000      0.996 0.000 1.000
#> GSM509753     2   0.000      0.996 0.000 1.000
#> GSM509755     2   0.000      0.996 0.000 1.000
#> GSM509757     2   0.000      0.996 0.000 1.000
#> GSM509759     2   0.000      0.996 0.000 1.000
#> GSM509761     2   0.000      0.996 0.000 1.000
#> GSM509763     2   0.000      0.996 0.000 1.000
#> GSM509765     2   0.000      0.996 0.000 1.000
#> GSM509767     2   0.000      0.996 0.000 1.000
#> GSM509769     2   0.000      0.996 0.000 1.000
#> GSM509771     2   0.000      0.996 0.000 1.000
#> GSM509773     2   0.000      0.996 0.000 1.000
#> GSM509775     2   0.000      0.996 0.000 1.000
#> GSM509777     2   0.000      0.996 0.000 1.000
#> GSM509779     2   0.000      0.996 0.000 1.000
#> GSM509781     2   0.000      0.996 0.000 1.000
#> GSM509783     2   0.000      0.996 0.000 1.000
#> GSM509785     2   0.000      0.996 0.000 1.000
#> GSM509752     2   0.000      0.996 0.000 1.000
#> GSM509754     2   0.000      0.996 0.000 1.000
#> GSM509756     2   0.000      0.996 0.000 1.000
#> GSM509758     2   0.000      0.996 0.000 1.000
#> GSM509760     2   0.000      0.996 0.000 1.000
#> GSM509762     2   0.000      0.996 0.000 1.000
#> GSM509764     2   0.000      0.996 0.000 1.000
#> GSM509766     2   0.000      0.996 0.000 1.000
#> GSM509768     2   0.000      0.996 0.000 1.000
#> GSM509770     2   0.000      0.996 0.000 1.000
#> GSM509772     2   0.000      0.996 0.000 1.000
#> GSM509774     2   0.000      0.996 0.000 1.000
#> GSM509776     2   0.000      0.996 0.000 1.000
#> GSM509778     2   0.000      0.996 0.000 1.000
#> GSM509780     2   0.000      0.996 0.000 1.000
#> GSM509782     2   0.000      0.996 0.000 1.000
#> GSM509784     2   0.000      0.996 0.000 1.000
#> GSM509786     2   0.000      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
#> GSM509706     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509711     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509714     1  0.1753      0.923 0.952 0.048 0.000
#> GSM509719     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509724     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509729     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509707     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509712     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509715     2  0.0892      0.875 0.020 0.980 0.000
#> GSM509720     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509725     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509730     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509708     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509713     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509716     2  0.1529      0.858 0.040 0.960 0.000
#> GSM509721     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509726     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509731     2  0.5327      0.549 0.272 0.728 0.000
#> GSM509709     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509717     2  0.0892      0.875 0.020 0.980 0.000
#> GSM509722     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509727     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509710     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509718     2  0.0592      0.880 0.012 0.988 0.000
#> GSM509723     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509728     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509732     3  0.1031      0.777 0.024 0.000 0.976
#> GSM509736     1  0.3267      0.859 0.884 0.000 0.116
#> GSM509741     3  0.6260      0.258 0.448 0.000 0.552
#> GSM509746     3  0.1031      0.777 0.024 0.000 0.976
#> GSM509733     3  0.0747      0.777 0.016 0.000 0.984
#> GSM509737     1  0.1163      0.955 0.972 0.000 0.028
#> GSM509742     3  0.5650      0.551 0.312 0.000 0.688
#> GSM509747     3  0.3482      0.747 0.128 0.000 0.872
#> GSM509734     1  0.2356      0.913 0.928 0.000 0.072
#> GSM509738     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509743     3  0.5216      0.626 0.260 0.000 0.740
#> GSM509748     3  0.6008      0.445 0.372 0.000 0.628
#> GSM509735     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509739     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509744     1  0.2711      0.895 0.912 0.000 0.088
#> GSM509749     3  0.6309      0.102 0.496 0.000 0.504
#> GSM509740     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509745     1  0.0000      0.978 1.000 0.000 0.000
#> GSM509750     1  0.4605      0.722 0.796 0.000 0.204
#> GSM509751     3  0.4452      0.616 0.000 0.192 0.808
#> GSM509753     3  0.1411      0.764 0.000 0.036 0.964
#> GSM509755     3  0.1411      0.764 0.000 0.036 0.964
#> GSM509757     3  0.1643      0.760 0.000 0.044 0.956
#> GSM509759     3  0.0000      0.772 0.000 0.000 1.000
#> GSM509761     2  0.1411      0.878 0.000 0.964 0.036
#> GSM509763     2  0.1753      0.874 0.000 0.952 0.048
#> GSM509765     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509767     3  0.5291      0.478 0.000 0.268 0.732
#> GSM509769     2  0.5497      0.669 0.000 0.708 0.292
#> GSM509771     3  0.4931      0.552 0.000 0.232 0.768
#> GSM509773     2  0.4796      0.752 0.000 0.780 0.220
#> GSM509775     2  0.2066      0.869 0.000 0.940 0.060
#> GSM509777     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509779     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509781     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509783     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509785     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509752     2  0.5968      0.554 0.000 0.636 0.364
#> GSM509754     2  0.6204      0.433 0.000 0.576 0.424
#> GSM509756     2  0.5058      0.726 0.000 0.756 0.244
#> GSM509758     2  0.4842      0.748 0.000 0.776 0.224
#> GSM509760     2  0.3038      0.844 0.000 0.896 0.104
#> GSM509762     2  0.5560      0.647 0.000 0.700 0.300
#> GSM509764     3  0.3941      0.669 0.000 0.156 0.844
#> GSM509766     2  0.0747      0.884 0.000 0.984 0.016
#> GSM509768     2  0.1860      0.873 0.000 0.948 0.052
#> GSM509770     2  0.6280      0.342 0.000 0.540 0.460
#> GSM509772     3  0.0000      0.772 0.000 0.000 1.000
#> GSM509774     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509776     2  0.0424      0.885 0.000 0.992 0.008
#> GSM509778     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509780     2  0.0424      0.885 0.000 0.992 0.008
#> GSM509782     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509784     2  0.0000      0.886 0.000 1.000 0.000
#> GSM509786     2  0.0000      0.886 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
#> GSM509706     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509711     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509714     1  0.0707      0.972 0.980 0.000 0.000 0.020
#> GSM509719     1  0.0188      0.984 0.996 0.004 0.000 0.000
#> GSM509724     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509729     1  0.0188      0.984 0.996 0.000 0.004 0.000
#> GSM509707     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509712     1  0.0376      0.983 0.992 0.000 0.004 0.004
#> GSM509715     4  0.0524      0.906 0.004 0.000 0.008 0.988
#> GSM509720     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509725     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509730     1  0.0188      0.984 0.996 0.000 0.004 0.000
#> GSM509708     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509713     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509716     4  0.0376      0.913 0.004 0.004 0.000 0.992
#> GSM509721     1  0.0188      0.984 0.996 0.004 0.000 0.000
#> GSM509726     1  0.0592      0.975 0.984 0.000 0.016 0.000
#> GSM509731     4  0.0672      0.915 0.008 0.008 0.000 0.984
#> GSM509709     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509717     4  0.0657      0.908 0.000 0.004 0.012 0.984
#> GSM509722     1  0.0188      0.984 0.996 0.004 0.000 0.000
#> GSM509727     1  0.4054      0.743 0.796 0.000 0.188 0.016
#> GSM509710     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509718     4  0.0921      0.890 0.000 0.000 0.028 0.972
#> GSM509723     1  0.0188      0.984 0.996 0.004 0.000 0.000
#> GSM509728     3  0.3933      0.750 0.200 0.000 0.792 0.008
#> GSM509732     3  0.1118      0.921 0.000 0.036 0.964 0.000
#> GSM509736     3  0.1174      0.929 0.012 0.000 0.968 0.020
#> GSM509741     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM509746     3  0.1022      0.923 0.000 0.032 0.968 0.000
#> GSM509733     3  0.1022      0.923 0.000 0.032 0.968 0.000
#> GSM509737     3  0.1488      0.925 0.012 0.000 0.956 0.032
#> GSM509742     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM509747     3  0.1118      0.921 0.000 0.036 0.964 0.000
#> GSM509734     3  0.1389      0.915 0.048 0.000 0.952 0.000
#> GSM509738     3  0.2089      0.916 0.020 0.000 0.932 0.048
#> GSM509743     3  0.0000      0.931 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0895      0.927 0.004 0.020 0.976 0.000
#> GSM509735     1  0.0336      0.982 0.992 0.000 0.008 0.000
#> GSM509739     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM509744     3  0.1305      0.926 0.004 0.000 0.960 0.036
#> GSM509749     3  0.0188      0.931 0.004 0.000 0.996 0.000
#> GSM509740     3  0.6332      0.206 0.060 0.000 0.488 0.452
#> GSM509745     3  0.2376      0.907 0.016 0.000 0.916 0.068
#> GSM509750     3  0.1209      0.927 0.004 0.000 0.964 0.032
#> GSM509751     2  0.0592      0.915 0.000 0.984 0.016 0.000
#> GSM509753     2  0.0921      0.908 0.000 0.972 0.028 0.000
#> GSM509755     2  0.0469      0.916 0.000 0.988 0.012 0.000
#> GSM509757     2  0.0592      0.915 0.000 0.984 0.016 0.000
#> GSM509759     2  0.1389      0.889 0.000 0.952 0.048 0.000
#> GSM509761     2  0.1716      0.909 0.000 0.936 0.000 0.064
#> GSM509763     2  0.2814      0.865 0.000 0.868 0.000 0.132
#> GSM509765     2  0.3172      0.837 0.000 0.840 0.000 0.160
#> GSM509767     2  0.0469      0.917 0.000 0.988 0.012 0.000
#> GSM509769     2  0.0707      0.922 0.000 0.980 0.000 0.020
#> GSM509771     2  0.0469      0.917 0.000 0.988 0.012 0.000
#> GSM509773     2  0.1022      0.920 0.000 0.968 0.000 0.032
#> GSM509775     2  0.1940      0.904 0.000 0.924 0.000 0.076
#> GSM509777     2  0.4761      0.465 0.000 0.628 0.000 0.372
#> GSM509779     4  0.3400      0.802 0.000 0.180 0.000 0.820
#> GSM509781     4  0.1716      0.928 0.000 0.064 0.000 0.936
#> GSM509783     4  0.1557      0.931 0.000 0.056 0.000 0.944
#> GSM509785     4  0.1557      0.931 0.000 0.056 0.000 0.944
#> GSM509752     2  0.0707      0.922 0.000 0.980 0.000 0.020
#> GSM509754     2  0.0376      0.920 0.000 0.992 0.004 0.004
#> GSM509756     2  0.0817      0.921 0.000 0.976 0.000 0.024
#> GSM509758     2  0.0817      0.921 0.000 0.976 0.000 0.024
#> GSM509760     2  0.0921      0.921 0.000 0.972 0.000 0.028
#> GSM509762     2  0.0707      0.922 0.000 0.980 0.000 0.020
#> GSM509764     2  0.0895      0.916 0.000 0.976 0.020 0.004
#> GSM509766     2  0.2589      0.878 0.000 0.884 0.000 0.116
#> GSM509768     2  0.2149      0.897 0.000 0.912 0.000 0.088
#> GSM509770     2  0.0188      0.920 0.000 0.996 0.000 0.004
#> GSM509772     2  0.1211      0.899 0.000 0.960 0.040 0.000
#> GSM509774     2  0.4877      0.367 0.000 0.592 0.000 0.408
#> GSM509776     2  0.2589      0.879 0.000 0.884 0.000 0.116
#> GSM509778     4  0.1637      0.931 0.000 0.060 0.000 0.940
#> GSM509780     2  0.3123      0.842 0.000 0.844 0.000 0.156
#> GSM509782     4  0.1637      0.931 0.000 0.060 0.000 0.940
#> GSM509784     4  0.4222      0.643 0.000 0.272 0.000 0.728
#> GSM509786     4  0.1637      0.931 0.000 0.060 0.000 0.940

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0451     0.9624 0.988 0.000 0.008 0.000 0.004
#> GSM509711     1  0.0671     0.9594 0.980 0.000 0.004 0.000 0.016
#> GSM509714     1  0.3142     0.8774 0.864 0.000 0.004 0.076 0.056
#> GSM509719     1  0.2271     0.9254 0.904 0.004 0.004 0.004 0.084
#> GSM509724     1  0.0579     0.9616 0.984 0.000 0.008 0.000 0.008
#> GSM509729     1  0.1753     0.9436 0.936 0.000 0.032 0.000 0.032
#> GSM509707     1  0.0451     0.9622 0.988 0.000 0.004 0.000 0.008
#> GSM509712     1  0.0290     0.9619 0.992 0.000 0.000 0.000 0.008
#> GSM509715     5  0.3684     0.5777 0.000 0.000 0.000 0.280 0.720
#> GSM509720     1  0.2233     0.9187 0.892 0.000 0.004 0.000 0.104
#> GSM509725     1  0.0451     0.9622 0.988 0.000 0.008 0.000 0.004
#> GSM509730     1  0.2632     0.9060 0.888 0.000 0.072 0.000 0.040
#> GSM509708     1  0.0451     0.9622 0.988 0.000 0.004 0.000 0.008
#> GSM509713     1  0.0290     0.9625 0.992 0.000 0.008 0.000 0.000
#> GSM509716     5  0.4109     0.5397 0.012 0.000 0.000 0.288 0.700
#> GSM509721     1  0.2151     0.9306 0.912 0.004 0.004 0.004 0.076
#> GSM509726     1  0.0693     0.9610 0.980 0.000 0.008 0.000 0.012
#> GSM509731     4  0.0865     0.8479 0.000 0.000 0.004 0.972 0.024
#> GSM509709     1  0.0324     0.9625 0.992 0.000 0.004 0.000 0.004
#> GSM509717     4  0.4227     0.0920 0.000 0.000 0.000 0.580 0.420
#> GSM509722     1  0.1892     0.9344 0.916 0.000 0.004 0.000 0.080
#> GSM509727     5  0.4232     0.5281 0.312 0.000 0.012 0.000 0.676
#> GSM509710     1  0.0451     0.9620 0.988 0.000 0.004 0.000 0.008
#> GSM509718     5  0.3010     0.7019 0.000 0.000 0.004 0.172 0.824
#> GSM509723     1  0.1430     0.9478 0.944 0.000 0.004 0.000 0.052
#> GSM509728     5  0.5104     0.5607 0.068 0.000 0.284 0.000 0.648
#> GSM509732     3  0.0671     0.9318 0.004 0.000 0.980 0.000 0.016
#> GSM509736     5  0.1671     0.7513 0.000 0.000 0.076 0.000 0.924
#> GSM509741     3  0.1121     0.9332 0.000 0.000 0.956 0.000 0.044
#> GSM509746     3  0.0324     0.9391 0.004 0.000 0.992 0.000 0.004
#> GSM509733     3  0.0162     0.9403 0.004 0.000 0.996 0.000 0.000
#> GSM509737     5  0.1908     0.7464 0.000 0.000 0.092 0.000 0.908
#> GSM509742     3  0.0963     0.9375 0.000 0.000 0.964 0.000 0.036
#> GSM509747     3  0.0671     0.9321 0.004 0.000 0.980 0.000 0.016
#> GSM509734     3  0.0671     0.9414 0.004 0.000 0.980 0.000 0.016
#> GSM509738     5  0.1544     0.7523 0.000 0.000 0.068 0.000 0.932
#> GSM509743     3  0.3305     0.6972 0.000 0.000 0.776 0.000 0.224
#> GSM509748     3  0.0451     0.9408 0.004 0.000 0.988 0.000 0.008
#> GSM509735     1  0.0510     0.9608 0.984 0.000 0.016 0.000 0.000
#> GSM509739     1  0.0324     0.9624 0.992 0.000 0.004 0.000 0.004
#> GSM509744     5  0.4300     0.1611 0.000 0.000 0.476 0.000 0.524
#> GSM509749     3  0.0963     0.9376 0.000 0.000 0.964 0.000 0.036
#> GSM509740     5  0.1815     0.7492 0.020 0.000 0.024 0.016 0.940
#> GSM509745     5  0.3969     0.5658 0.000 0.000 0.304 0.004 0.692
#> GSM509750     3  0.2127     0.8709 0.000 0.000 0.892 0.000 0.108
#> GSM509751     2  0.0000     0.9320 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0162     0.9307 0.000 0.996 0.000 0.004 0.000
#> GSM509755     2  0.0324     0.9290 0.000 0.992 0.000 0.004 0.004
#> GSM509757     2  0.0000     0.9320 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0324     0.9303 0.000 0.992 0.000 0.004 0.004
#> GSM509761     2  0.1041     0.9261 0.000 0.964 0.000 0.032 0.004
#> GSM509763     2  0.4304     0.0926 0.000 0.516 0.000 0.484 0.000
#> GSM509765     2  0.3424     0.7179 0.000 0.760 0.000 0.240 0.000
#> GSM509767     2  0.1116     0.9263 0.000 0.964 0.004 0.028 0.004
#> GSM509769     2  0.0290     0.9325 0.000 0.992 0.000 0.008 0.000
#> GSM509771     2  0.2037     0.9044 0.000 0.920 0.012 0.064 0.004
#> GSM509773     2  0.1205     0.9221 0.000 0.956 0.000 0.040 0.004
#> GSM509775     2  0.2536     0.8588 0.000 0.868 0.000 0.128 0.004
#> GSM509777     4  0.1965     0.8157 0.000 0.096 0.000 0.904 0.000
#> GSM509779     4  0.0609     0.8722 0.000 0.020 0.000 0.980 0.000
#> GSM509781     4  0.0290     0.8757 0.000 0.008 0.000 0.992 0.000
#> GSM509783     4  0.0162     0.8731 0.000 0.004 0.000 0.996 0.000
#> GSM509785     4  0.0162     0.8731 0.000 0.004 0.000 0.996 0.000
#> GSM509752     2  0.0324     0.9325 0.000 0.992 0.000 0.004 0.004
#> GSM509754     2  0.0451     0.9324 0.000 0.988 0.000 0.008 0.004
#> GSM509756     2  0.0324     0.9304 0.000 0.992 0.000 0.004 0.004
#> GSM509758     2  0.0566     0.9319 0.000 0.984 0.000 0.012 0.004
#> GSM509760     2  0.0290     0.9325 0.000 0.992 0.000 0.008 0.000
#> GSM509762     2  0.0162     0.9318 0.000 0.996 0.000 0.000 0.004
#> GSM509764     2  0.0566     0.9267 0.000 0.984 0.000 0.004 0.012
#> GSM509766     2  0.3074     0.7812 0.000 0.804 0.000 0.196 0.000
#> GSM509768     2  0.2719     0.8424 0.000 0.852 0.000 0.144 0.004
#> GSM509770     2  0.0451     0.9320 0.000 0.988 0.000 0.008 0.004
#> GSM509772     2  0.0162     0.9317 0.000 0.996 0.000 0.000 0.004
#> GSM509774     4  0.3003     0.7191 0.000 0.188 0.000 0.812 0.000
#> GSM509776     2  0.1952     0.8952 0.000 0.912 0.000 0.084 0.004
#> GSM509778     4  0.0290     0.8757 0.000 0.008 0.000 0.992 0.000
#> GSM509780     4  0.4009     0.5124 0.000 0.312 0.000 0.684 0.004
#> GSM509782     4  0.0290     0.8757 0.000 0.008 0.000 0.992 0.000
#> GSM509784     4  0.0963     0.8636 0.000 0.036 0.000 0.964 0.000
#> GSM509786     4  0.0290     0.8757 0.000 0.008 0.000 0.992 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
#> GSM509706     1  0.0260     0.8907 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509711     1  0.0858     0.8836 0.968 0.000 0.000 0.004 0.028 0.000
#> GSM509714     5  0.5192     0.6867 0.048 0.000 0.000 0.140 0.692 0.120
#> GSM509719     5  0.2278     0.8668 0.044 0.004 0.000 0.000 0.900 0.052
#> GSM509724     1  0.0146     0.8901 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM509729     1  0.4706    -0.0709 0.500 0.000 0.016 0.004 0.468 0.012
#> GSM509707     1  0.0547     0.8881 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM509712     1  0.1826     0.8614 0.924 0.000 0.000 0.020 0.052 0.004
#> GSM509715     6  0.4769     0.5610 0.000 0.000 0.000 0.240 0.104 0.656
#> GSM509720     5  0.2558     0.8471 0.028 0.000 0.000 0.000 0.868 0.104
#> GSM509725     1  0.0000     0.8907 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509730     5  0.5522     0.6331 0.168 0.000 0.148 0.008 0.652 0.024
#> GSM509708     1  0.0865     0.8806 0.964 0.000 0.000 0.000 0.036 0.000
#> GSM509713     1  0.0458     0.8902 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM509716     6  0.5468     0.3337 0.000 0.000 0.000 0.156 0.296 0.548
#> GSM509721     5  0.2314     0.8647 0.036 0.008 0.000 0.000 0.900 0.056
#> GSM509726     1  0.0291     0.8888 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM509731     4  0.3534     0.5626 0.004 0.000 0.000 0.772 0.200 0.024
#> GSM509709     1  0.0146     0.8907 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM509717     6  0.5561     0.2680 0.000 0.000 0.000 0.428 0.136 0.436
#> GSM509722     5  0.2604     0.8647 0.044 0.004 0.000 0.004 0.884 0.064
#> GSM509727     1  0.3604     0.6581 0.760 0.000 0.012 0.000 0.012 0.216
#> GSM509710     1  0.0291     0.8888 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM509718     6  0.2889     0.6760 0.000 0.000 0.000 0.108 0.044 0.848
#> GSM509723     5  0.1141     0.8518 0.052 0.000 0.000 0.000 0.948 0.000
#> GSM509728     1  0.5793     0.0416 0.472 0.000 0.128 0.000 0.012 0.388
#> GSM509732     3  0.0436     0.9022 0.004 0.000 0.988 0.000 0.004 0.004
#> GSM509736     6  0.1588     0.6969 0.000 0.000 0.072 0.000 0.004 0.924
#> GSM509741     3  0.1327     0.8867 0.000 0.000 0.936 0.000 0.000 0.064
#> GSM509746     3  0.0291     0.9027 0.004 0.000 0.992 0.000 0.000 0.004
#> GSM509733     3  0.0146     0.9037 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM509737     6  0.2445     0.6873 0.000 0.000 0.108 0.000 0.020 0.872
#> GSM509742     3  0.1267     0.8897 0.000 0.000 0.940 0.000 0.000 0.060
#> GSM509747     3  0.1116     0.8859 0.004 0.000 0.960 0.000 0.028 0.008
#> GSM509734     3  0.1418     0.8949 0.024 0.000 0.944 0.000 0.000 0.032
#> GSM509738     6  0.1434     0.6917 0.000 0.000 0.012 0.000 0.048 0.940
#> GSM509743     3  0.4195     0.1759 0.004 0.000 0.548 0.000 0.008 0.440
#> GSM509748     3  0.0260     0.9034 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM509735     1  0.0713     0.8846 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM509739     1  0.0000     0.8907 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     6  0.3634     0.3309 0.000 0.000 0.356 0.000 0.000 0.644
#> GSM509749     3  0.0717     0.9041 0.000 0.000 0.976 0.000 0.008 0.016
#> GSM509740     6  0.1584     0.6843 0.000 0.000 0.008 0.000 0.064 0.928
#> GSM509745     6  0.3933     0.4539 0.000 0.000 0.308 0.008 0.008 0.676
#> GSM509750     3  0.2482     0.8061 0.000 0.000 0.848 0.000 0.004 0.148
#> GSM509751     2  0.0260     0.9468 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM509753     2  0.0547     0.9427 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM509755     2  0.0790     0.9364 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM509757     2  0.0547     0.9447 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM509759     2  0.1285     0.9205 0.000 0.944 0.000 0.004 0.052 0.000
#> GSM509761     2  0.0363     0.9468 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM509763     2  0.3265     0.6799 0.000 0.748 0.000 0.248 0.004 0.000
#> GSM509765     2  0.2454     0.8278 0.000 0.840 0.000 0.160 0.000 0.000
#> GSM509767     2  0.0820     0.9439 0.000 0.972 0.000 0.016 0.012 0.000
#> GSM509769     2  0.0146     0.9477 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM509771     2  0.1578     0.9270 0.000 0.936 0.004 0.048 0.012 0.000
#> GSM509773     2  0.1082     0.9357 0.000 0.956 0.000 0.040 0.004 0.000
#> GSM509775     2  0.1714     0.9014 0.000 0.908 0.000 0.092 0.000 0.000
#> GSM509777     4  0.2915     0.6959 0.000 0.184 0.000 0.808 0.008 0.000
#> GSM509779     4  0.0858     0.8160 0.000 0.028 0.000 0.968 0.004 0.000
#> GSM509781     4  0.0363     0.8164 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM509783     4  0.0436     0.8079 0.000 0.004 0.000 0.988 0.004 0.004
#> GSM509785     4  0.0260     0.8143 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM509752     2  0.0146     0.9479 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM509754     2  0.0000     0.9473 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0508     0.9460 0.000 0.984 0.000 0.000 0.012 0.004
#> GSM509758     2  0.0000     0.9473 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509760     2  0.0508     0.9478 0.000 0.984 0.000 0.000 0.012 0.004
#> GSM509762     2  0.0291     0.9475 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM509764     2  0.0458     0.9458 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM509766     2  0.2048     0.8744 0.000 0.880 0.000 0.120 0.000 0.000
#> GSM509768     2  0.1910     0.8864 0.000 0.892 0.000 0.108 0.000 0.000
#> GSM509770     2  0.0291     0.9482 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM509772     2  0.0692     0.9424 0.000 0.976 0.000 0.004 0.020 0.000
#> GSM509774     4  0.3717     0.4094 0.000 0.384 0.000 0.616 0.000 0.000
#> GSM509776     2  0.1556     0.9112 0.000 0.920 0.000 0.080 0.000 0.000
#> GSM509778     4  0.0622     0.8147 0.000 0.012 0.000 0.980 0.008 0.000
#> GSM509780     4  0.3966     0.2321 0.000 0.444 0.000 0.552 0.004 0.000
#> GSM509782     4  0.0363     0.8166 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM509784     4  0.1267     0.8001 0.000 0.060 0.000 0.940 0.000 0.000
#> GSM509786     4  0.0547     0.8176 0.000 0.020 0.000 0.980 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)  time(p) k
#> MAD:NMF 81         8.31e-15 6.68e-12 2
#> MAD:NMF 75         7.19e-11 5.22e-07 3
#> MAD:NMF 78         2.10e-23 5.21e-08 4
#> MAD:NMF 78         5.39e-22 4.75e-09 5
#> MAD:NMF 72         4.21e-20 1.81e-06 6

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


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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.664           0.896       0.932         0.4824 0.494   0.494
#> 3 3 0.908           0.928       0.960         0.2544 0.896   0.790
#> 4 4 0.809           0.843       0.898         0.1441 0.944   0.858
#> 5 5 0.857           0.403       0.681         0.0754 0.821   0.498
#> 6 6 0.801           0.769       0.879         0.0442 0.841   0.448

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM509706     1  0.0000      0.857 1.000 0.000
#> GSM509711     1  0.0000      0.857 1.000 0.000
#> GSM509714     1  0.1843      0.860 0.972 0.028
#> GSM509719     1  0.2043      0.860 0.968 0.032
#> GSM509724     1  0.0000      0.857 1.000 0.000
#> GSM509729     1  0.0000      0.857 1.000 0.000
#> GSM509707     1  0.0000      0.857 1.000 0.000
#> GSM509712     1  0.1843      0.860 0.972 0.028
#> GSM509715     2  0.2778      0.943 0.048 0.952
#> GSM509720     1  0.2043      0.860 0.968 0.032
#> GSM509725     1  0.0000      0.857 1.000 0.000
#> GSM509730     1  0.0376      0.857 0.996 0.004
#> GSM509708     1  0.0000      0.857 1.000 0.000
#> GSM509713     1  0.0000      0.857 1.000 0.000
#> GSM509716     2  0.2778      0.943 0.048 0.952
#> GSM509721     1  0.2043      0.860 0.968 0.032
#> GSM509726     1  0.0000      0.857 1.000 0.000
#> GSM509731     2  0.2778      0.943 0.048 0.952
#> GSM509709     1  0.0000      0.857 1.000 0.000
#> GSM509717     2  0.2778      0.943 0.048 0.952
#> GSM509722     1  0.2043      0.860 0.968 0.032
#> GSM509727     1  0.7815      0.755 0.768 0.232
#> GSM509710     1  0.0000      0.857 1.000 0.000
#> GSM509718     2  0.2778      0.943 0.048 0.952
#> GSM509723     1  0.2043      0.860 0.968 0.032
#> GSM509728     1  0.7815      0.755 0.768 0.232
#> GSM509732     1  0.8608      0.742 0.716 0.284
#> GSM509736     1  0.8267      0.738 0.740 0.260
#> GSM509741     1  0.8608      0.742 0.716 0.284
#> GSM509746     1  0.8608      0.742 0.716 0.284
#> GSM509733     1  0.8608      0.742 0.716 0.284
#> GSM509737     1  0.8443      0.727 0.728 0.272
#> GSM509742     1  0.8608      0.742 0.716 0.284
#> GSM509747     1  0.8608      0.742 0.716 0.284
#> GSM509734     1  0.6973      0.804 0.812 0.188
#> GSM509738     1  0.8267      0.738 0.740 0.260
#> GSM509743     1  0.8713      0.734 0.708 0.292
#> GSM509748     1  0.8608      0.742 0.716 0.284
#> GSM509735     1  0.0000      0.857 1.000 0.000
#> GSM509739     1  0.0000      0.857 1.000 0.000
#> GSM509744     1  0.8713      0.734 0.708 0.292
#> GSM509749     1  0.8608      0.742 0.716 0.284
#> GSM509740     1  0.7883      0.753 0.764 0.236
#> GSM509745     1  0.8267      0.738 0.740 0.260
#> GSM509750     1  0.8713      0.734 0.708 0.292
#> GSM509751     2  0.0000      0.992 0.000 1.000
#> GSM509753     2  0.0000      0.992 0.000 1.000
#> GSM509755     2  0.0000      0.992 0.000 1.000
#> GSM509757     2  0.0000      0.992 0.000 1.000
#> GSM509759     2  0.0000      0.992 0.000 1.000
#> GSM509761     2  0.0000      0.992 0.000 1.000
#> GSM509763     2  0.0000      0.992 0.000 1.000
#> GSM509765     2  0.0000      0.992 0.000 1.000
#> GSM509767     2  0.0000      0.992 0.000 1.000
#> GSM509769     2  0.0000      0.992 0.000 1.000
#> GSM509771     2  0.0000      0.992 0.000 1.000
#> GSM509773     2  0.0000      0.992 0.000 1.000
#> GSM509775     2  0.0000      0.992 0.000 1.000
#> GSM509777     2  0.0000      0.992 0.000 1.000
#> GSM509779     2  0.0000      0.992 0.000 1.000
#> GSM509781     2  0.0000      0.992 0.000 1.000
#> GSM509783     2  0.0000      0.992 0.000 1.000
#> GSM509785     2  0.0000      0.992 0.000 1.000
#> GSM509752     2  0.0000      0.992 0.000 1.000
#> GSM509754     2  0.0000      0.992 0.000 1.000
#> GSM509756     2  0.0000      0.992 0.000 1.000
#> GSM509758     2  0.0000      0.992 0.000 1.000
#> GSM509760     2  0.0000      0.992 0.000 1.000
#> GSM509762     2  0.0000      0.992 0.000 1.000
#> GSM509764     2  0.0000      0.992 0.000 1.000
#> GSM509766     2  0.0000      0.992 0.000 1.000
#> GSM509768     2  0.0000      0.992 0.000 1.000
#> GSM509770     2  0.0000      0.992 0.000 1.000
#> GSM509772     2  0.0000      0.992 0.000 1.000
#> GSM509774     2  0.0000      0.992 0.000 1.000
#> GSM509776     2  0.0000      0.992 0.000 1.000
#> GSM509778     2  0.0000      0.992 0.000 1.000
#> GSM509780     2  0.0000      0.992 0.000 1.000
#> GSM509782     2  0.0000      0.992 0.000 1.000
#> GSM509784     2  0.0000      0.992 0.000 1.000
#> GSM509786     2  0.0000      0.992 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
#> GSM509706     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509711     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509714     1  0.2356      0.874 0.928 0.000 0.072
#> GSM509719     1  0.2448      0.873 0.924 0.000 0.076
#> GSM509724     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509729     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509707     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509712     1  0.2356      0.874 0.928 0.000 0.072
#> GSM509715     2  0.2878      0.895 0.000 0.904 0.096
#> GSM509720     1  0.2448      0.873 0.924 0.000 0.076
#> GSM509725     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509730     1  0.0237      0.888 0.996 0.000 0.004
#> GSM509708     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509713     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509716     2  0.2878      0.895 0.000 0.904 0.096
#> GSM509721     1  0.2448      0.873 0.924 0.000 0.076
#> GSM509726     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509731     2  0.2878      0.895 0.000 0.904 0.096
#> GSM509709     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509717     2  0.2878      0.895 0.000 0.904 0.096
#> GSM509722     1  0.2448      0.873 0.924 0.000 0.076
#> GSM509727     1  0.7108      0.721 0.716 0.184 0.100
#> GSM509710     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509718     2  0.2878      0.895 0.000 0.904 0.096
#> GSM509723     1  0.2448      0.873 0.924 0.000 0.076
#> GSM509728     1  0.7108      0.721 0.716 0.184 0.100
#> GSM509732     3  0.0000      0.986 0.000 0.000 1.000
#> GSM509736     1  0.7572      0.700 0.688 0.184 0.128
#> GSM509741     3  0.0000      0.986 0.000 0.000 1.000
#> GSM509746     3  0.0000      0.986 0.000 0.000 1.000
#> GSM509733     3  0.0000      0.986 0.000 0.000 1.000
#> GSM509737     1  0.7750      0.688 0.676 0.184 0.140
#> GSM509742     3  0.0000      0.986 0.000 0.000 1.000
#> GSM509747     3  0.0000      0.986 0.000 0.000 1.000
#> GSM509734     3  0.3340      0.861 0.120 0.000 0.880
#> GSM509738     1  0.7572      0.700 0.688 0.184 0.128
#> GSM509743     3  0.0424      0.981 0.000 0.008 0.992
#> GSM509748     3  0.0000      0.986 0.000 0.000 1.000
#> GSM509735     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509739     1  0.0000      0.889 1.000 0.000 0.000
#> GSM509744     3  0.0424      0.981 0.000 0.008 0.992
#> GSM509749     3  0.0000      0.986 0.000 0.000 1.000
#> GSM509740     1  0.7179      0.719 0.712 0.184 0.104
#> GSM509745     1  0.7572      0.700 0.688 0.184 0.128
#> GSM509750     3  0.0424      0.981 0.000 0.008 0.992
#> GSM509751     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509753     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509755     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509757     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509759     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509761     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509763     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509765     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509767     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509769     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509771     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509773     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509775     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509777     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509779     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509781     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509783     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509785     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509752     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509754     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509756     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509758     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509760     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509762     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509764     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509766     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509768     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509770     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509772     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509774     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509776     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509778     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509780     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509782     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509784     2  0.0000      0.987 0.000 1.000 0.000
#> GSM509786     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
#> GSM509706     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509711     1  0.2589      0.826 0.884 0.000 0.000 0.116
#> GSM509714     1  0.1867      0.823 0.928 0.000 0.000 0.072
#> GSM509719     1  0.2053      0.823 0.924 0.000 0.004 0.072
#> GSM509724     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509729     1  0.0000      0.829 1.000 0.000 0.000 0.000
#> GSM509707     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509712     1  0.1867      0.823 0.928 0.000 0.000 0.072
#> GSM509715     4  0.3074      1.000 0.000 0.152 0.000 0.848
#> GSM509720     1  0.2053      0.823 0.924 0.000 0.004 0.072
#> GSM509725     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509730     1  0.0188      0.829 0.996 0.000 0.000 0.004
#> GSM509708     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509713     1  0.2589      0.826 0.884 0.000 0.000 0.116
#> GSM509716     4  0.3074      1.000 0.000 0.152 0.000 0.848
#> GSM509721     1  0.2053      0.823 0.924 0.000 0.004 0.072
#> GSM509726     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509731     4  0.3074      1.000 0.000 0.152 0.000 0.848
#> GSM509709     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509717     4  0.3074      1.000 0.000 0.152 0.000 0.848
#> GSM509722     1  0.2053      0.823 0.924 0.000 0.004 0.072
#> GSM509727     1  0.4828      0.680 0.716 0.008 0.008 0.268
#> GSM509710     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509718     4  0.3074      1.000 0.000 0.152 0.000 0.848
#> GSM509723     1  0.2053      0.823 0.924 0.000 0.004 0.072
#> GSM509728     1  0.4828      0.680 0.716 0.008 0.008 0.268
#> GSM509732     3  0.0000      0.971 0.000 0.000 1.000 0.000
#> GSM509736     1  0.5652      0.656 0.688 0.008 0.044 0.260
#> GSM509741     3  0.0469      0.972 0.000 0.000 0.988 0.012
#> GSM509746     3  0.0188      0.971 0.000 0.000 0.996 0.004
#> GSM509733     3  0.0000      0.971 0.000 0.000 1.000 0.000
#> GSM509737     1  0.5879      0.647 0.676 0.008 0.056 0.260
#> GSM509742     3  0.0469      0.972 0.000 0.000 0.988 0.012
#> GSM509747     3  0.0188      0.971 0.000 0.000 0.996 0.004
#> GSM509734     3  0.3105      0.834 0.120 0.000 0.868 0.012
#> GSM509738     1  0.5652      0.656 0.688 0.008 0.044 0.260
#> GSM509743     3  0.1256      0.962 0.000 0.008 0.964 0.028
#> GSM509748     3  0.0000      0.971 0.000 0.000 1.000 0.000
#> GSM509735     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509739     1  0.3074      0.821 0.848 0.000 0.000 0.152
#> GSM509744     3  0.1256      0.962 0.000 0.008 0.964 0.028
#> GSM509749     3  0.0336      0.972 0.000 0.000 0.992 0.008
#> GSM509740     1  0.4952      0.678 0.712 0.008 0.012 0.268
#> GSM509745     1  0.5600      0.661 0.688 0.008 0.040 0.264
#> GSM509750     3  0.1256      0.962 0.000 0.008 0.964 0.028
#> GSM509751     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509765     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509767     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509775     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509777     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509779     2  0.0592      0.909 0.000 0.984 0.000 0.016
#> GSM509781     2  0.4804      0.315 0.000 0.616 0.000 0.384
#> GSM509783     2  0.4790      0.326 0.000 0.620 0.000 0.380
#> GSM509785     2  0.4804      0.315 0.000 0.616 0.000 0.384
#> GSM509752     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509766     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509768     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509770     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509774     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509776     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509778     2  0.4790      0.326 0.000 0.620 0.000 0.380
#> GSM509780     2  0.0000      0.923 0.000 1.000 0.000 0.000
#> GSM509782     2  0.3907      0.636 0.000 0.768 0.000 0.232
#> GSM509784     2  0.0707      0.906 0.000 0.980 0.000 0.020
#> GSM509786     2  0.4804      0.315 0.000 0.616 0.000 0.384

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509711     2  0.6695     -0.712 0.368 0.392 0.000 0.000 0.240
#> GSM509714     1  0.0000      0.560 1.000 0.000 0.000 0.000 0.000
#> GSM509719     1  0.0162      0.560 0.996 0.000 0.004 0.000 0.000
#> GSM509724     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509729     1  0.2020      0.613 0.900 0.100 0.000 0.000 0.000
#> GSM509707     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509712     1  0.4847      0.178 0.692 0.068 0.000 0.000 0.240
#> GSM509715     5  0.4201      0.501 0.000 0.008 0.000 0.328 0.664
#> GSM509720     1  0.0162      0.560 0.996 0.000 0.004 0.000 0.000
#> GSM509725     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509730     1  0.1965      0.611 0.904 0.096 0.000 0.000 0.000
#> GSM509708     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509713     2  0.6693     -0.712 0.364 0.396 0.000 0.000 0.240
#> GSM509716     5  0.4201      0.501 0.000 0.008 0.000 0.328 0.664
#> GSM509721     1  0.0162      0.560 0.996 0.000 0.004 0.000 0.000
#> GSM509726     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509731     5  0.4201      0.501 0.000 0.008 0.000 0.328 0.664
#> GSM509709     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509717     5  0.4201      0.501 0.000 0.008 0.000 0.328 0.664
#> GSM509722     1  0.0162      0.560 0.996 0.000 0.004 0.000 0.000
#> GSM509727     5  0.4294      0.550 0.468 0.000 0.000 0.000 0.532
#> GSM509710     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509718     5  0.4201      0.501 0.000 0.008 0.000 0.328 0.664
#> GSM509723     1  0.0162      0.560 0.996 0.000 0.004 0.000 0.000
#> GSM509728     5  0.4294      0.550 0.468 0.000 0.000 0.000 0.532
#> GSM509732     3  0.0000      0.970 0.000 0.000 1.000 0.000 0.000
#> GSM509736     5  0.5083      0.561 0.432 0.000 0.036 0.000 0.532
#> GSM509741     3  0.0579      0.971 0.008 0.000 0.984 0.000 0.008
#> GSM509746     3  0.0162      0.971 0.004 0.000 0.996 0.000 0.000
#> GSM509733     3  0.0000      0.970 0.000 0.000 1.000 0.000 0.000
#> GSM509737     5  0.5256      0.558 0.420 0.000 0.048 0.000 0.532
#> GSM509742     3  0.0579      0.971 0.008 0.000 0.984 0.000 0.008
#> GSM509747     3  0.0162      0.971 0.004 0.000 0.996 0.000 0.000
#> GSM509734     3  0.2957      0.845 0.120 0.012 0.860 0.000 0.008
#> GSM509738     5  0.5083      0.561 0.432 0.000 0.036 0.000 0.532
#> GSM509743     3  0.1251      0.960 0.008 0.000 0.956 0.000 0.036
#> GSM509748     3  0.0000      0.970 0.000 0.000 1.000 0.000 0.000
#> GSM509735     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509739     1  0.4305      0.726 0.512 0.488 0.000 0.000 0.000
#> GSM509744     3  0.1251      0.960 0.008 0.000 0.956 0.000 0.036
#> GSM509749     3  0.0290      0.971 0.008 0.000 0.992 0.000 0.000
#> GSM509740     5  0.4437      0.551 0.464 0.000 0.004 0.000 0.532
#> GSM509745     5  0.5019      0.561 0.436 0.000 0.032 0.000 0.532
#> GSM509750     3  0.1251      0.960 0.008 0.000 0.956 0.000 0.036
#> GSM509751     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509753     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509755     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509757     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509759     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509761     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509763     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509765     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509767     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509769     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509771     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509773     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509775     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509777     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509779     4  0.4300     -0.333 0.000 0.476 0.000 0.524 0.000
#> GSM509781     4  0.1341      0.300 0.000 0.000 0.000 0.944 0.056
#> GSM509783     4  0.1502      0.301 0.000 0.004 0.000 0.940 0.056
#> GSM509785     4  0.1341      0.300 0.000 0.000 0.000 0.944 0.056
#> GSM509752     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509754     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509756     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509758     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509760     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509762     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509764     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509766     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509768     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509770     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509772     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509774     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509776     2  0.4307      0.390 0.000 0.504 0.000 0.496 0.000
#> GSM509778     4  0.1502      0.301 0.000 0.004 0.000 0.940 0.056
#> GSM509780     4  0.4307     -0.396 0.000 0.496 0.000 0.504 0.000
#> GSM509782     4  0.3929      0.219 0.000 0.208 0.000 0.764 0.028
#> GSM509784     4  0.4297     -0.319 0.000 0.472 0.000 0.528 0.000
#> GSM509786     4  0.1341      0.300 0.000 0.000 0.000 0.944 0.056

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM509706     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.3883      0.414 0.656 0.000 0.000 0.012 0.000 0.332
#> GSM509714     6  0.5300      0.332 0.400 0.000 0.000 0.104 0.000 0.496
#> GSM509719     6  0.5265      0.338 0.400 0.000 0.000 0.100 0.000 0.500
#> GSM509724     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.5462     -0.206 0.476 0.000 0.000 0.124 0.000 0.400
#> GSM509707     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     6  0.5081      0.335 0.308 0.000 0.000 0.104 0.000 0.588
#> GSM509715     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509720     6  0.5265      0.338 0.400 0.000 0.000 0.100 0.000 0.500
#> GSM509725     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.5492     -0.214 0.472 0.000 0.000 0.128 0.000 0.400
#> GSM509708     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.3789      0.417 0.660 0.000 0.000 0.008 0.000 0.332
#> GSM509716     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509721     6  0.5265      0.338 0.400 0.000 0.000 0.100 0.000 0.500
#> GSM509726     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509731     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509709     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509722     6  0.5265      0.338 0.400 0.000 0.000 0.100 0.000 0.500
#> GSM509727     6  0.2006      0.570 0.000 0.000 0.000 0.004 0.104 0.892
#> GSM509710     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509723     6  0.5265      0.338 0.400 0.000 0.000 0.100 0.000 0.500
#> GSM509728     6  0.2118      0.570 0.000 0.000 0.000 0.008 0.104 0.888
#> GSM509732     3  0.0790      0.951 0.000 0.000 0.968 0.032 0.000 0.000
#> GSM509736     6  0.2776      0.560 0.000 0.000 0.032 0.004 0.104 0.860
#> GSM509741     3  0.0603      0.964 0.000 0.000 0.980 0.004 0.000 0.016
#> GSM509746     3  0.0260      0.963 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM509733     3  0.0790      0.951 0.000 0.000 0.968 0.032 0.000 0.000
#> GSM509737     6  0.2984      0.549 0.000 0.000 0.044 0.004 0.104 0.848
#> GSM509742     3  0.0603      0.964 0.000 0.000 0.980 0.004 0.000 0.016
#> GSM509747     3  0.0260      0.963 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM509734     3  0.2998      0.850 0.008 0.000 0.856 0.064 0.000 0.072
#> GSM509738     6  0.2776      0.560 0.000 0.000 0.032 0.004 0.104 0.860
#> GSM509743     3  0.1152      0.954 0.000 0.000 0.952 0.004 0.000 0.044
#> GSM509748     3  0.0146      0.962 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM509735     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.824 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.1152      0.954 0.000 0.000 0.952 0.004 0.000 0.044
#> GSM509749     3  0.0260      0.964 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM509740     6  0.1863      0.571 0.000 0.000 0.000 0.000 0.104 0.896
#> GSM509745     6  0.2633      0.560 0.000 0.000 0.032 0.000 0.104 0.864
#> GSM509750     3  0.1152      0.954 0.000 0.000 0.952 0.004 0.000 0.044
#> GSM509751     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509763     2  0.2597      0.815 0.000 0.824 0.000 0.176 0.000 0.000
#> GSM509765     2  0.2491      0.825 0.000 0.836 0.000 0.164 0.000 0.000
#> GSM509767     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509769     2  0.0547      0.898 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM509771     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509773     2  0.2597      0.815 0.000 0.824 0.000 0.176 0.000 0.000
#> GSM509775     2  0.1910      0.860 0.000 0.892 0.000 0.108 0.000 0.000
#> GSM509777     2  0.2631      0.811 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM509779     2  0.2793      0.785 0.000 0.800 0.000 0.200 0.000 0.000
#> GSM509781     4  0.2668      0.908 0.000 0.168 0.000 0.828 0.004 0.000
#> GSM509783     4  0.2562      0.906 0.000 0.172 0.000 0.828 0.000 0.000
#> GSM509785     4  0.2668      0.908 0.000 0.168 0.000 0.828 0.004 0.000
#> GSM509752     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509760     2  0.0260      0.901 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509762     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509766     2  0.2491      0.825 0.000 0.836 0.000 0.164 0.000 0.000
#> GSM509768     2  0.2597      0.815 0.000 0.824 0.000 0.176 0.000 0.000
#> GSM509770     2  0.0260      0.901 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509772     2  0.0000      0.902 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509774     2  0.2631      0.811 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM509776     2  0.1814      0.864 0.000 0.900 0.000 0.100 0.000 0.000
#> GSM509778     4  0.2562      0.906 0.000 0.172 0.000 0.828 0.000 0.000
#> GSM509780     2  0.2631      0.811 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM509782     4  0.3810      0.420 0.000 0.428 0.000 0.572 0.000 0.000
#> GSM509784     2  0.2912      0.760 0.000 0.784 0.000 0.216 0.000 0.000
#> GSM509786     4  0.2668      0.908 0.000 0.168 0.000 0.828 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-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)  time(p) k
#> ATC:hclust 81         8.31e-15 6.68e-12 2
#> ATC:hclust 81         1.14e-20 2.30e-09 3
#> ATC:hclust 76         1.33e-22 6.02e-10 4
#> ATC:hclust 42         9.88e-06 7.67e-01 5
#> ATC:hclust 69         1.28e-19 8.02e-07 6

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


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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5067 0.494   0.494
#> 3 3 0.695           0.792       0.828         0.2336 0.880   0.756
#> 4 4 0.808           0.681       0.839         0.1397 0.819   0.558
#> 5 5 0.725           0.668       0.751         0.0779 0.885   0.625
#> 6 6 0.701           0.652       0.778         0.0458 0.940   0.751

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette p1 p2
#> GSM509706     1       0          1  1  0
#> GSM509711     1       0          1  1  0
#> GSM509714     1       0          1  1  0
#> GSM509719     1       0          1  1  0
#> GSM509724     1       0          1  1  0
#> GSM509729     1       0          1  1  0
#> GSM509707     1       0          1  1  0
#> GSM509712     1       0          1  1  0
#> GSM509715     2       0          1  0  1
#> GSM509720     1       0          1  1  0
#> GSM509725     1       0          1  1  0
#> GSM509730     1       0          1  1  0
#> GSM509708     1       0          1  1  0
#> GSM509713     1       0          1  1  0
#> GSM509716     2       0          1  0  1
#> GSM509721     1       0          1  1  0
#> GSM509726     1       0          1  1  0
#> GSM509731     1       0          1  1  0
#> GSM509709     1       0          1  1  0
#> GSM509717     2       0          1  0  1
#> GSM509722     1       0          1  1  0
#> GSM509727     1       0          1  1  0
#> GSM509710     1       0          1  1  0
#> GSM509718     2       0          1  0  1
#> GSM509723     1       0          1  1  0
#> GSM509728     1       0          1  1  0
#> GSM509732     1       0          1  1  0
#> GSM509736     1       0          1  1  0
#> GSM509741     1       0          1  1  0
#> GSM509746     1       0          1  1  0
#> GSM509733     1       0          1  1  0
#> GSM509737     1       0          1  1  0
#> GSM509742     1       0          1  1  0
#> GSM509747     1       0          1  1  0
#> GSM509734     1       0          1  1  0
#> GSM509738     1       0          1  1  0
#> GSM509743     1       0          1  1  0
#> GSM509748     1       0          1  1  0
#> GSM509735     1       0          1  1  0
#> GSM509739     1       0          1  1  0
#> GSM509744     1       0          1  1  0
#> GSM509749     1       0          1  1  0
#> GSM509740     1       0          1  1  0
#> GSM509745     1       0          1  1  0
#> GSM509750     1       0          1  1  0
#> GSM509751     2       0          1  0  1
#> GSM509753     2       0          1  0  1
#> GSM509755     2       0          1  0  1
#> GSM509757     2       0          1  0  1
#> GSM509759     2       0          1  0  1
#> GSM509761     2       0          1  0  1
#> GSM509763     2       0          1  0  1
#> GSM509765     2       0          1  0  1
#> GSM509767     2       0          1  0  1
#> GSM509769     2       0          1  0  1
#> GSM509771     2       0          1  0  1
#> GSM509773     2       0          1  0  1
#> GSM509775     2       0          1  0  1
#> GSM509777     2       0          1  0  1
#> GSM509779     2       0          1  0  1
#> GSM509781     2       0          1  0  1
#> GSM509783     2       0          1  0  1
#> GSM509785     2       0          1  0  1
#> GSM509752     2       0          1  0  1
#> GSM509754     2       0          1  0  1
#> GSM509756     2       0          1  0  1
#> GSM509758     2       0          1  0  1
#> GSM509760     2       0          1  0  1
#> GSM509762     2       0          1  0  1
#> GSM509764     2       0          1  0  1
#> GSM509766     2       0          1  0  1
#> GSM509768     2       0          1  0  1
#> GSM509770     2       0          1  0  1
#> GSM509772     2       0          1  0  1
#> GSM509774     2       0          1  0  1
#> GSM509776     2       0          1  0  1
#> GSM509778     2       0          1  0  1
#> GSM509780     2       0          1  0  1
#> GSM509782     2       0          1  0  1
#> GSM509784     2       0          1  0  1
#> GSM509786     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509711     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509714     3  0.6260      0.150 0.448 0.000 0.552
#> GSM509719     3  0.5968      0.441 0.364 0.000 0.636
#> GSM509724     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509729     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509707     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509712     1  0.6215      0.353 0.572 0.000 0.428
#> GSM509715     2  0.8758      0.575 0.192 0.588 0.220
#> GSM509720     3  0.5968      0.441 0.364 0.000 0.636
#> GSM509725     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509730     3  0.6026      0.411 0.376 0.000 0.624
#> GSM509708     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509713     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509716     2  0.8758      0.575 0.192 0.588 0.220
#> GSM509721     3  0.5968      0.441 0.364 0.000 0.636
#> GSM509726     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509731     1  0.6896     -0.103 0.588 0.020 0.392
#> GSM509709     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509717     2  0.8758      0.575 0.192 0.588 0.220
#> GSM509722     3  0.5968      0.441 0.364 0.000 0.636
#> GSM509727     3  0.6154      0.275 0.408 0.000 0.592
#> GSM509710     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509718     2  0.8758      0.575 0.192 0.588 0.220
#> GSM509723     3  0.5968      0.441 0.364 0.000 0.636
#> GSM509728     3  0.5678      0.523 0.316 0.000 0.684
#> GSM509732     3  0.0237      0.775 0.000 0.004 0.996
#> GSM509736     3  0.3116      0.741 0.108 0.000 0.892
#> GSM509741     3  0.0237      0.775 0.000 0.004 0.996
#> GSM509746     3  0.0237      0.775 0.000 0.004 0.996
#> GSM509733     3  0.0237      0.775 0.000 0.004 0.996
#> GSM509737     3  0.3619      0.724 0.136 0.000 0.864
#> GSM509742     3  0.0237      0.775 0.000 0.004 0.996
#> GSM509747     3  0.0237      0.775 0.004 0.000 0.996
#> GSM509734     3  0.2165      0.754 0.064 0.000 0.936
#> GSM509738     3  0.2066      0.763 0.060 0.000 0.940
#> GSM509743     3  0.0237      0.775 0.000 0.004 0.996
#> GSM509748     3  0.0237      0.775 0.004 0.000 0.996
#> GSM509735     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509739     1  0.4504      0.920 0.804 0.000 0.196
#> GSM509744     3  0.0000      0.774 0.000 0.000 1.000
#> GSM509749     3  0.0237      0.775 0.000 0.004 0.996
#> GSM509740     3  0.3116      0.741 0.108 0.000 0.892
#> GSM509745     3  0.0424      0.775 0.008 0.000 0.992
#> GSM509750     3  0.0475      0.771 0.004 0.004 0.992
#> GSM509751     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509753     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509755     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509757     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509759     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509761     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509763     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509765     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509767     2  0.0000      0.934 0.000 1.000 0.000
#> GSM509769     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509771     2  0.0000      0.934 0.000 1.000 0.000
#> GSM509773     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509775     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509777     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509779     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509781     2  0.4682      0.831 0.192 0.804 0.004
#> GSM509783     2  0.4682      0.831 0.192 0.804 0.004
#> GSM509785     2  0.4682      0.831 0.192 0.804 0.004
#> GSM509752     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509754     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509756     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509758     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509760     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509762     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509764     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509766     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509768     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509770     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509772     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509774     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509776     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509778     2  0.4629      0.833 0.188 0.808 0.004
#> GSM509780     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509782     2  0.4521      0.838 0.180 0.816 0.004
#> GSM509784     2  0.0237      0.934 0.004 0.996 0.000
#> GSM509786     2  0.4682      0.831 0.192 0.804 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509711     1  0.0469    0.77746 0.988 0.000 0.012 0.000
#> GSM509714     4  0.7661   -0.34909 0.376 0.000 0.212 0.412
#> GSM509719     1  0.7693    0.19845 0.432 0.000 0.340 0.228
#> GSM509724     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509729     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509707     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509712     1  0.6617    0.48551 0.608 0.000 0.128 0.264
#> GSM509715     4  0.2861    0.35150 0.000 0.016 0.096 0.888
#> GSM509720     1  0.7693    0.19845 0.432 0.000 0.340 0.228
#> GSM509725     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509730     1  0.6140    0.38480 0.596 0.000 0.340 0.064
#> GSM509708     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509713     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509716     4  0.2861    0.35150 0.000 0.016 0.096 0.888
#> GSM509721     1  0.7693    0.19845 0.432 0.000 0.340 0.228
#> GSM509726     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509731     4  0.2480    0.31711 0.008 0.000 0.088 0.904
#> GSM509709     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509717     4  0.2861    0.35150 0.000 0.016 0.096 0.888
#> GSM509722     1  0.7693    0.19845 0.432 0.000 0.340 0.228
#> GSM509727     4  0.7679   -0.30976 0.356 0.000 0.220 0.424
#> GSM509710     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509718     4  0.2861    0.35150 0.000 0.016 0.096 0.888
#> GSM509723     1  0.7693    0.19845 0.432 0.000 0.340 0.228
#> GSM509728     3  0.7816    0.00825 0.340 0.000 0.400 0.260
#> GSM509732     3  0.0376    0.81203 0.004 0.000 0.992 0.004
#> GSM509736     3  0.6314    0.57560 0.068 0.000 0.560 0.372
#> GSM509741     3  0.0188    0.81339 0.004 0.000 0.996 0.000
#> GSM509746     3  0.0376    0.81203 0.004 0.000 0.992 0.004
#> GSM509733     3  0.0376    0.81203 0.004 0.000 0.992 0.004
#> GSM509737     3  0.6868    0.52846 0.152 0.000 0.584 0.264
#> GSM509742     3  0.0188    0.81339 0.004 0.000 0.996 0.000
#> GSM509747     3  0.0376    0.81293 0.004 0.000 0.992 0.004
#> GSM509734     3  0.3156    0.75935 0.068 0.000 0.884 0.048
#> GSM509738     3  0.5138    0.59939 0.008 0.000 0.600 0.392
#> GSM509743     3  0.0000    0.81229 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0376    0.81293 0.004 0.000 0.992 0.004
#> GSM509735     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509739     1  0.0336    0.78092 0.992 0.000 0.008 0.000
#> GSM509744     3  0.3024    0.76360 0.000 0.000 0.852 0.148
#> GSM509749     3  0.0188    0.81339 0.004 0.000 0.996 0.000
#> GSM509740     3  0.6392    0.54220 0.068 0.000 0.528 0.404
#> GSM509745     3  0.4564    0.65824 0.000 0.000 0.672 0.328
#> GSM509750     3  0.1302    0.80348 0.000 0.000 0.956 0.044
#> GSM509751     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509753     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509755     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509757     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509759     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509761     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509763     2  0.2271    0.92732 0.008 0.916 0.000 0.076
#> GSM509765     2  0.2342    0.92473 0.008 0.912 0.000 0.080
#> GSM509767     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509769     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509773     2  0.1389    0.94245 0.000 0.952 0.000 0.048
#> GSM509775     2  0.2198    0.92968 0.008 0.920 0.000 0.072
#> GSM509777     2  0.2342    0.92473 0.008 0.912 0.000 0.080
#> GSM509779     2  0.2342    0.92473 0.008 0.912 0.000 0.080
#> GSM509781     4  0.5292    0.19863 0.008 0.480 0.000 0.512
#> GSM509783     4  0.5292    0.19863 0.008 0.480 0.000 0.512
#> GSM509785     4  0.5292    0.19863 0.008 0.480 0.000 0.512
#> GSM509752     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509766     2  0.1792    0.93505 0.000 0.932 0.000 0.068
#> GSM509768     2  0.2198    0.92968 0.008 0.920 0.000 0.072
#> GSM509770     2  0.0000    0.95610 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0188    0.95503 0.000 0.996 0.000 0.004
#> GSM509774     2  0.2342    0.92473 0.008 0.912 0.000 0.080
#> GSM509776     2  0.2198    0.92968 0.008 0.920 0.000 0.072
#> GSM509778     4  0.5292    0.19863 0.008 0.480 0.000 0.512
#> GSM509780     2  0.2342    0.92473 0.008 0.912 0.000 0.080
#> GSM509782     4  0.5295    0.17299 0.008 0.488 0.000 0.504
#> GSM509784     2  0.2342    0.92473 0.008 0.912 0.000 0.080
#> GSM509786     4  0.5292    0.19863 0.008 0.480 0.000 0.512

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0794      0.978 0.972 0.000 0.000 0.028 0.000
#> GSM509711     1  0.0693      0.977 0.980 0.000 0.000 0.012 0.008
#> GSM509714     5  0.3800      0.561 0.052 0.000 0.084 0.028 0.836
#> GSM509719     5  0.6891      0.533 0.284 0.000 0.204 0.020 0.492
#> GSM509724     1  0.0671      0.982 0.980 0.000 0.000 0.016 0.004
#> GSM509729     1  0.1117      0.953 0.964 0.000 0.000 0.016 0.020
#> GSM509707     1  0.0794      0.978 0.972 0.000 0.000 0.028 0.000
#> GSM509712     5  0.6347      0.418 0.372 0.000 0.080 0.032 0.516
#> GSM509715     5  0.4551      0.348 0.000 0.004 0.004 0.436 0.556
#> GSM509720     5  0.6891      0.533 0.284 0.000 0.204 0.020 0.492
#> GSM509725     1  0.0324      0.981 0.992 0.000 0.000 0.004 0.004
#> GSM509730     5  0.6975      0.446 0.360 0.000 0.204 0.016 0.420
#> GSM509708     1  0.0404      0.982 0.988 0.000 0.000 0.012 0.000
#> GSM509713     1  0.0566      0.979 0.984 0.000 0.000 0.012 0.004
#> GSM509716     5  0.4551      0.348 0.000 0.004 0.004 0.436 0.556
#> GSM509721     5  0.6891      0.533 0.284 0.000 0.204 0.020 0.492
#> GSM509726     1  0.0579      0.979 0.984 0.000 0.000 0.008 0.008
#> GSM509731     5  0.4060      0.408 0.000 0.000 0.000 0.360 0.640
#> GSM509709     1  0.0794      0.978 0.972 0.000 0.000 0.028 0.000
#> GSM509717     5  0.4551      0.348 0.000 0.004 0.004 0.436 0.556
#> GSM509722     5  0.6891      0.533 0.284 0.000 0.204 0.020 0.492
#> GSM509727     5  0.3970      0.537 0.016 0.000 0.084 0.080 0.820
#> GSM509710     1  0.0794      0.978 0.972 0.000 0.000 0.028 0.000
#> GSM509718     5  0.4551      0.348 0.000 0.004 0.004 0.436 0.556
#> GSM509723     5  0.6891      0.533 0.284 0.000 0.204 0.020 0.492
#> GSM509728     5  0.6367      0.520 0.228 0.000 0.204 0.008 0.560
#> GSM509732     3  0.0404      0.897 0.000 0.000 0.988 0.012 0.000
#> GSM509736     5  0.4031      0.515 0.004 0.000 0.160 0.048 0.788
#> GSM509741     3  0.0609      0.896 0.000 0.000 0.980 0.000 0.020
#> GSM509746     3  0.0404      0.897 0.000 0.000 0.988 0.012 0.000
#> GSM509733     3  0.0404      0.897 0.000 0.000 0.988 0.012 0.000
#> GSM509737     5  0.6592      0.489 0.196 0.000 0.244 0.016 0.544
#> GSM509742     3  0.0609      0.896 0.000 0.000 0.980 0.000 0.020
#> GSM509747     3  0.0404      0.897 0.000 0.000 0.988 0.012 0.000
#> GSM509734     3  0.5275      0.329 0.084 0.000 0.640 0.000 0.276
#> GSM509738     5  0.3622      0.520 0.000 0.000 0.136 0.048 0.816
#> GSM509743     3  0.1197      0.883 0.000 0.000 0.952 0.000 0.048
#> GSM509748     3  0.0404      0.897 0.000 0.000 0.988 0.012 0.000
#> GSM509735     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.982 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.4197      0.625 0.000 0.000 0.728 0.028 0.244
#> GSM509749     3  0.0609      0.896 0.000 0.000 0.980 0.000 0.020
#> GSM509740     5  0.3497      0.530 0.004 0.000 0.112 0.048 0.836
#> GSM509745     5  0.4223      0.448 0.000 0.000 0.248 0.028 0.724
#> GSM509750     3  0.3152      0.787 0.000 0.000 0.840 0.024 0.136
#> GSM509751     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509763     2  0.4030      0.337 0.000 0.648 0.000 0.352 0.000
#> GSM509765     2  0.4045      0.327 0.000 0.644 0.000 0.356 0.000
#> GSM509767     2  0.0290      0.777 0.000 0.992 0.000 0.008 0.000
#> GSM509769     2  0.0510      0.773 0.000 0.984 0.000 0.016 0.000
#> GSM509771     2  0.0290      0.777 0.000 0.992 0.000 0.008 0.000
#> GSM509773     2  0.2377      0.680 0.000 0.872 0.000 0.128 0.000
#> GSM509775     2  0.4030      0.337 0.000 0.648 0.000 0.352 0.000
#> GSM509777     2  0.4302     -0.189 0.000 0.520 0.000 0.480 0.000
#> GSM509779     2  0.4307     -0.256 0.000 0.504 0.000 0.496 0.000
#> GSM509781     4  0.3779      0.910 0.000 0.236 0.000 0.752 0.012
#> GSM509783     4  0.3671      0.910 0.000 0.236 0.000 0.756 0.008
#> GSM509785     4  0.3779      0.910 0.000 0.236 0.000 0.752 0.012
#> GSM509752     2  0.0162      0.778 0.000 0.996 0.000 0.004 0.000
#> GSM509754     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509760     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509766     2  0.3561      0.510 0.000 0.740 0.000 0.260 0.000
#> GSM509768     2  0.4030      0.337 0.000 0.648 0.000 0.352 0.000
#> GSM509770     2  0.0404      0.775 0.000 0.988 0.000 0.012 0.000
#> GSM509772     2  0.0000      0.779 0.000 1.000 0.000 0.000 0.000
#> GSM509774     2  0.4307     -0.256 0.000 0.504 0.000 0.496 0.000
#> GSM509776     2  0.4045      0.327 0.000 0.644 0.000 0.356 0.000
#> GSM509778     4  0.3424      0.905 0.000 0.240 0.000 0.760 0.000
#> GSM509780     2  0.4088      0.290 0.000 0.632 0.000 0.368 0.000
#> GSM509782     4  0.3452      0.901 0.000 0.244 0.000 0.756 0.000
#> GSM509784     4  0.4300      0.250 0.000 0.476 0.000 0.524 0.000
#> GSM509786     4  0.3779      0.910 0.000 0.236 0.000 0.752 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
#> GSM509706     1  0.1245     0.9409 0.952 0.000 0.000 0.016 0.032 0.000
#> GSM509711     1  0.2007     0.9288 0.920 0.000 0.000 0.036 0.012 0.032
#> GSM509714     6  0.4551     0.4540 0.012 0.000 0.028 0.008 0.280 0.672
#> GSM509719     6  0.5037     0.7779 0.160 0.000 0.120 0.000 0.028 0.692
#> GSM509724     1  0.0806     0.9454 0.972 0.000 0.000 0.008 0.020 0.000
#> GSM509729     1  0.3245     0.7757 0.796 0.000 0.000 0.016 0.004 0.184
#> GSM509707     1  0.1245     0.9409 0.952 0.000 0.000 0.016 0.032 0.000
#> GSM509712     6  0.5700     0.6360 0.216 0.000 0.028 0.036 0.072 0.648
#> GSM509715     5  0.3134     0.6785 0.000 0.000 0.004 0.208 0.784 0.004
#> GSM509720     6  0.5037     0.7779 0.160 0.000 0.120 0.000 0.028 0.692
#> GSM509725     1  0.0777     0.9445 0.972 0.000 0.000 0.004 0.000 0.024
#> GSM509730     6  0.4741     0.7586 0.180 0.000 0.116 0.000 0.008 0.696
#> GSM509708     1  0.0692     0.9451 0.976 0.000 0.000 0.004 0.020 0.000
#> GSM509713     1  0.1755     0.9341 0.932 0.000 0.000 0.028 0.008 0.032
#> GSM509716     5  0.3134     0.6785 0.000 0.000 0.004 0.208 0.784 0.004
#> GSM509721     6  0.5037     0.7779 0.160 0.000 0.120 0.000 0.028 0.692
#> GSM509726     1  0.1592     0.9372 0.940 0.000 0.000 0.020 0.008 0.032
#> GSM509731     5  0.3578     0.6527 0.000 0.000 0.000 0.164 0.784 0.052
#> GSM509709     1  0.1245     0.9409 0.952 0.000 0.000 0.016 0.032 0.000
#> GSM509717     5  0.3134     0.6785 0.000 0.000 0.004 0.208 0.784 0.004
#> GSM509722     6  0.5037     0.7779 0.160 0.000 0.120 0.000 0.028 0.692
#> GSM509727     5  0.5000     0.0290 0.000 0.000 0.028 0.032 0.576 0.364
#> GSM509710     1  0.1245     0.9409 0.952 0.000 0.000 0.016 0.032 0.000
#> GSM509718     5  0.3134     0.6785 0.000 0.000 0.004 0.208 0.784 0.004
#> GSM509723     6  0.5037     0.7779 0.160 0.000 0.120 0.000 0.028 0.692
#> GSM509728     6  0.7066     0.6535 0.128 0.000 0.132 0.028 0.172 0.540
#> GSM509732     3  0.1268     0.8408 0.000 0.000 0.952 0.036 0.004 0.008
#> GSM509736     6  0.5634     0.1444 0.000 0.000 0.104 0.012 0.424 0.460
#> GSM509741     3  0.1296     0.8409 0.000 0.000 0.952 0.004 0.032 0.012
#> GSM509746     3  0.1268     0.8408 0.000 0.000 0.952 0.036 0.004 0.008
#> GSM509733     3  0.1268     0.8408 0.000 0.000 0.952 0.036 0.004 0.008
#> GSM509737     6  0.6524     0.6707 0.112 0.000 0.152 0.008 0.148 0.580
#> GSM509742     3  0.1296     0.8409 0.000 0.000 0.952 0.004 0.032 0.012
#> GSM509747     3  0.1268     0.8408 0.000 0.000 0.952 0.036 0.004 0.008
#> GSM509734     3  0.5484    -0.0669 0.048 0.000 0.524 0.020 0.012 0.396
#> GSM509738     5  0.5378    -0.2235 0.000 0.000 0.084 0.008 0.460 0.448
#> GSM509743     3  0.3240     0.7693 0.000 0.000 0.820 0.008 0.144 0.028
#> GSM509748     3  0.0909     0.8431 0.000 0.000 0.968 0.020 0.000 0.012
#> GSM509735     1  0.0777     0.9444 0.972 0.000 0.000 0.000 0.004 0.024
#> GSM509739     1  0.1313     0.9398 0.952 0.000 0.000 0.016 0.004 0.028
#> GSM509744     3  0.4499     0.5604 0.000 0.000 0.636 0.012 0.324 0.028
#> GSM509749     3  0.1503     0.8392 0.000 0.000 0.944 0.008 0.032 0.016
#> GSM509740     5  0.4932    -0.2289 0.000 0.000 0.044 0.008 0.480 0.468
#> GSM509745     6  0.5929     0.2882 0.000 0.000 0.168 0.008 0.360 0.464
#> GSM509750     3  0.4039     0.6781 0.000 0.000 0.716 0.008 0.248 0.028
#> GSM509751     2  0.0260     0.7637 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM509753     2  0.0000     0.7660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0146     0.7648 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM509757     2  0.1398     0.7423 0.000 0.940 0.000 0.000 0.008 0.052
#> GSM509759     2  0.1398     0.7423 0.000 0.940 0.000 0.000 0.008 0.052
#> GSM509761     2  0.0000     0.7660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509763     2  0.5624     0.1863 0.000 0.524 0.000 0.296 0.000 0.180
#> GSM509765     2  0.5660     0.1444 0.000 0.512 0.000 0.308 0.000 0.180
#> GSM509767     2  0.2431     0.7262 0.000 0.860 0.000 0.000 0.008 0.132
#> GSM509769     2  0.2932     0.6779 0.000 0.820 0.000 0.016 0.000 0.164
#> GSM509771     2  0.2431     0.7262 0.000 0.860 0.000 0.000 0.008 0.132
#> GSM509773     2  0.4283     0.5780 0.000 0.724 0.000 0.096 0.000 0.180
#> GSM509775     2  0.5624     0.1863 0.000 0.524 0.000 0.296 0.000 0.180
#> GSM509777     4  0.5757     0.3962 0.000 0.352 0.000 0.468 0.000 0.180
#> GSM509779     4  0.5580     0.4942 0.000 0.324 0.000 0.516 0.000 0.160
#> GSM509781     4  0.2581     0.7341 0.000 0.120 0.000 0.860 0.020 0.000
#> GSM509783     4  0.2302     0.7436 0.000 0.120 0.000 0.872 0.000 0.008
#> GSM509785     4  0.2581     0.7341 0.000 0.120 0.000 0.860 0.020 0.000
#> GSM509752     2  0.0000     0.7660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000     0.7660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0146     0.7648 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM509758     2  0.0000     0.7660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509760     2  0.0146     0.7648 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM509762     2  0.0000     0.7660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509764     2  0.0146     0.7648 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM509766     2  0.5198     0.4024 0.000 0.616 0.000 0.204 0.000 0.180
#> GSM509768     2  0.5624     0.1863 0.000 0.524 0.000 0.296 0.000 0.180
#> GSM509770     2  0.2932     0.6779 0.000 0.820 0.000 0.016 0.000 0.164
#> GSM509772     2  0.1563     0.7396 0.000 0.932 0.000 0.000 0.012 0.056
#> GSM509774     4  0.5702     0.4702 0.000 0.324 0.000 0.496 0.000 0.180
#> GSM509776     2  0.5648     0.1617 0.000 0.516 0.000 0.304 0.000 0.180
#> GSM509778     4  0.2389     0.7479 0.000 0.128 0.000 0.864 0.000 0.008
#> GSM509780     2  0.5896     0.0555 0.000 0.480 0.000 0.324 0.004 0.192
#> GSM509782     4  0.2135     0.7488 0.000 0.128 0.000 0.872 0.000 0.000
#> GSM509784     4  0.5558     0.5085 0.000 0.316 0.000 0.524 0.000 0.160
#> GSM509786     4  0.2581     0.7341 0.000 0.120 0.000 0.860 0.020 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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)  time(p) k
#> ATC:kmeans 81         2.25e-15 1.79e-12 2
#> ATC:kmeans 71         3.57e-20 1.36e-08 3
#> ATC:kmeans 60         6.88e-22 6.36e-09 4
#> ATC:kmeans 61         4.93e-17 7.00e-06 5
#> ATC:kmeans 64         7.33e-19 6.72e-06 6

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


ATC:skmeans*

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 19175 rows and 81 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           1.000       1.000         0.5067 0.494   0.494
#> 3 3 1.000           0.970       0.986         0.2096 0.898   0.794
#> 4 4 0.920           0.922       0.957         0.1299 0.895   0.735
#> 5 5 0.857           0.876       0.925         0.1137 0.869   0.590
#> 6 6 0.849           0.874       0.914         0.0428 0.965   0.840

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
#> GSM509706     1       0          1  1  0
#> GSM509711     1       0          1  1  0
#> GSM509714     1       0          1  1  0
#> GSM509719     1       0          1  1  0
#> GSM509724     1       0          1  1  0
#> GSM509729     1       0          1  1  0
#> GSM509707     1       0          1  1  0
#> GSM509712     1       0          1  1  0
#> GSM509715     2       0          1  0  1
#> GSM509720     1       0          1  1  0
#> GSM509725     1       0          1  1  0
#> GSM509730     1       0          1  1  0
#> GSM509708     1       0          1  1  0
#> GSM509713     1       0          1  1  0
#> GSM509716     2       0          1  0  1
#> GSM509721     1       0          1  1  0
#> GSM509726     1       0          1  1  0
#> GSM509731     1       0          1  1  0
#> GSM509709     1       0          1  1  0
#> GSM509717     2       0          1  0  1
#> GSM509722     1       0          1  1  0
#> GSM509727     1       0          1  1  0
#> GSM509710     1       0          1  1  0
#> GSM509718     2       0          1  0  1
#> GSM509723     1       0          1  1  0
#> GSM509728     1       0          1  1  0
#> GSM509732     1       0          1  1  0
#> GSM509736     1       0          1  1  0
#> GSM509741     1       0          1  1  0
#> GSM509746     1       0          1  1  0
#> GSM509733     1       0          1  1  0
#> GSM509737     1       0          1  1  0
#> GSM509742     1       0          1  1  0
#> GSM509747     1       0          1  1  0
#> GSM509734     1       0          1  1  0
#> GSM509738     1       0          1  1  0
#> GSM509743     1       0          1  1  0
#> GSM509748     1       0          1  1  0
#> GSM509735     1       0          1  1  0
#> GSM509739     1       0          1  1  0
#> GSM509744     1       0          1  1  0
#> GSM509749     1       0          1  1  0
#> GSM509740     1       0          1  1  0
#> GSM509745     1       0          1  1  0
#> GSM509750     1       0          1  1  0
#> GSM509751     2       0          1  0  1
#> GSM509753     2       0          1  0  1
#> GSM509755     2       0          1  0  1
#> GSM509757     2       0          1  0  1
#> GSM509759     2       0          1  0  1
#> GSM509761     2       0          1  0  1
#> GSM509763     2       0          1  0  1
#> GSM509765     2       0          1  0  1
#> GSM509767     2       0          1  0  1
#> GSM509769     2       0          1  0  1
#> GSM509771     2       0          1  0  1
#> GSM509773     2       0          1  0  1
#> GSM509775     2       0          1  0  1
#> GSM509777     2       0          1  0  1
#> GSM509779     2       0          1  0  1
#> GSM509781     2       0          1  0  1
#> GSM509783     2       0          1  0  1
#> GSM509785     2       0          1  0  1
#> GSM509752     2       0          1  0  1
#> GSM509754     2       0          1  0  1
#> GSM509756     2       0          1  0  1
#> GSM509758     2       0          1  0  1
#> GSM509760     2       0          1  0  1
#> GSM509762     2       0          1  0  1
#> GSM509764     2       0          1  0  1
#> GSM509766     2       0          1  0  1
#> GSM509768     2       0          1  0  1
#> GSM509770     2       0          1  0  1
#> GSM509772     2       0          1  0  1
#> GSM509774     2       0          1  0  1
#> GSM509776     2       0          1  0  1
#> GSM509778     2       0          1  0  1
#> GSM509780     2       0          1  0  1
#> GSM509782     2       0          1  0  1
#> GSM509784     2       0          1  0  1
#> GSM509786     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509711     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509714     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509719     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509724     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509729     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509707     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509712     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509715     2  0.0592      0.991 0.000 0.988 0.012
#> GSM509720     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509725     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509730     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509708     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509713     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509716     2  0.0592      0.991 0.000 0.988 0.012
#> GSM509721     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509726     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509731     1  0.0592      0.958 0.988 0.000 0.012
#> GSM509709     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509717     2  0.0592      0.991 0.000 0.988 0.012
#> GSM509722     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509727     1  0.0237      0.965 0.996 0.000 0.004
#> GSM509710     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509718     2  0.0592      0.991 0.000 0.988 0.012
#> GSM509723     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509728     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509732     3  0.0592      0.997 0.012 0.000 0.988
#> GSM509736     1  0.0237      0.965 0.996 0.000 0.004
#> GSM509741     3  0.0424      0.998 0.008 0.000 0.992
#> GSM509746     3  0.0592      0.997 0.012 0.000 0.988
#> GSM509733     3  0.0592      0.997 0.012 0.000 0.988
#> GSM509737     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509742     3  0.0424      0.998 0.008 0.000 0.992
#> GSM509747     3  0.0592      0.997 0.012 0.000 0.988
#> GSM509734     1  0.6095      0.378 0.608 0.000 0.392
#> GSM509738     1  0.3038      0.868 0.896 0.000 0.104
#> GSM509743     3  0.0424      0.998 0.008 0.000 0.992
#> GSM509748     3  0.0592      0.997 0.012 0.000 0.988
#> GSM509735     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509739     1  0.0000      0.968 1.000 0.000 0.000
#> GSM509744     3  0.0424      0.998 0.008 0.000 0.992
#> GSM509749     3  0.0424      0.998 0.008 0.000 0.992
#> GSM509740     1  0.0237      0.965 0.996 0.000 0.004
#> GSM509745     1  0.6111      0.373 0.604 0.000 0.396
#> GSM509750     3  0.0424      0.998 0.008 0.000 0.992
#> GSM509751     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509753     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509755     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509757     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509759     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509761     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509763     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509765     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509767     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509769     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509771     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509773     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509775     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509777     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509779     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509781     2  0.0237      0.996 0.000 0.996 0.004
#> GSM509783     2  0.0237      0.996 0.000 0.996 0.004
#> GSM509785     2  0.0237      0.996 0.000 0.996 0.004
#> GSM509752     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509754     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509756     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509758     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509760     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509762     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509764     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509766     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509768     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509770     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509772     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509774     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509776     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509778     2  0.0237      0.996 0.000 0.996 0.004
#> GSM509780     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509782     2  0.0237      0.996 0.000 0.996 0.004
#> GSM509784     2  0.0000      0.998 0.000 1.000 0.000
#> GSM509786     2  0.0237      0.996 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
#> GSM509706     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509711     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509714     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509719     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509724     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509729     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509707     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509712     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509715     4  0.0000      0.630 0.000 0.000 0.000 1.000
#> GSM509720     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509725     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509730     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509708     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509713     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509716     4  0.0000      0.630 0.000 0.000 0.000 1.000
#> GSM509721     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509726     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509731     4  0.0000      0.630 0.000 0.000 0.000 1.000
#> GSM509709     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509717     4  0.0000      0.630 0.000 0.000 0.000 1.000
#> GSM509722     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509727     1  0.0592      0.955 0.984 0.000 0.000 0.016
#> GSM509710     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509718     4  0.0000      0.630 0.000 0.000 0.000 1.000
#> GSM509723     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509728     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509732     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509736     1  0.0592      0.955 0.984 0.000 0.000 0.016
#> GSM509741     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509737     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509742     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509734     1  0.4713      0.472 0.640 0.000 0.360 0.000
#> GSM509738     1  0.3790      0.786 0.820 0.000 0.164 0.016
#> GSM509743     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509735     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.965 1.000 0.000 0.000 0.000
#> GSM509744     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509749     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509740     1  0.0592      0.955 0.984 0.000 0.000 0.016
#> GSM509745     1  0.4830      0.400 0.608 0.000 0.392 0.000
#> GSM509750     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM509751     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509765     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509767     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509775     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509777     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509779     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509781     4  0.4888      0.648 0.000 0.412 0.000 0.588
#> GSM509783     4  0.4888      0.648 0.000 0.412 0.000 0.588
#> GSM509785     4  0.4888      0.648 0.000 0.412 0.000 0.588
#> GSM509752     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509766     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509768     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509770     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509772     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509774     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509776     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509778     4  0.4888      0.648 0.000 0.412 0.000 0.588
#> GSM509780     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM509782     4  0.4898      0.640 0.000 0.416 0.000 0.584
#> GSM509784     2  0.0592      0.978 0.000 0.984 0.000 0.016
#> GSM509786     4  0.4888      0.648 0.000 0.412 0.000 0.588

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509714     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509719     1  0.0898      0.923 0.972 0.000 0.000 0.020 0.008
#> GSM509724     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.0162      0.934 0.996 0.000 0.000 0.000 0.004
#> GSM509707     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509715     5  0.2074      0.685 0.000 0.000 0.000 0.104 0.896
#> GSM509720     1  0.0898      0.923 0.972 0.000 0.000 0.020 0.008
#> GSM509725     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.0162      0.934 0.996 0.000 0.000 0.000 0.004
#> GSM509708     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509716     5  0.2074      0.685 0.000 0.000 0.000 0.104 0.896
#> GSM509721     1  0.0898      0.923 0.972 0.000 0.000 0.020 0.008
#> GSM509726     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509731     5  0.2074      0.685 0.000 0.000 0.000 0.104 0.896
#> GSM509709     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.2074      0.685 0.000 0.000 0.000 0.104 0.896
#> GSM509722     1  0.0898      0.923 0.972 0.000 0.000 0.020 0.008
#> GSM509727     5  0.4640      0.467 0.400 0.000 0.000 0.016 0.584
#> GSM509710     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.2074      0.685 0.000 0.000 0.000 0.104 0.896
#> GSM509723     1  0.0898      0.923 0.972 0.000 0.000 0.020 0.008
#> GSM509728     1  0.2464      0.825 0.888 0.000 0.000 0.016 0.096
#> GSM509732     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509736     5  0.5052      0.416 0.412 0.000 0.000 0.036 0.552
#> GSM509741     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509746     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509733     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509737     1  0.2959      0.807 0.864 0.000 0.000 0.036 0.100
#> GSM509742     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509747     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509734     1  0.4126      0.363 0.620 0.000 0.380 0.000 0.000
#> GSM509738     5  0.4969      0.486 0.376 0.000 0.000 0.036 0.588
#> GSM509743     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509748     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509735     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.2136      0.896 0.000 0.000 0.904 0.008 0.088
#> GSM509749     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509740     5  0.5077      0.457 0.392 0.000 0.000 0.040 0.568
#> GSM509745     1  0.6408      0.204 0.524 0.000 0.352 0.028 0.096
#> GSM509750     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509751     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509763     4  0.3210      0.860 0.000 0.212 0.000 0.788 0.000
#> GSM509765     4  0.2732      0.898 0.000 0.160 0.000 0.840 0.000
#> GSM509767     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509769     2  0.0290      0.985 0.000 0.992 0.000 0.008 0.000
#> GSM509771     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509773     2  0.0963      0.955 0.000 0.964 0.000 0.036 0.000
#> GSM509775     4  0.2929      0.886 0.000 0.180 0.000 0.820 0.000
#> GSM509777     4  0.2561      0.904 0.000 0.144 0.000 0.856 0.000
#> GSM509779     4  0.2561      0.904 0.000 0.144 0.000 0.856 0.000
#> GSM509781     4  0.1043      0.861 0.000 0.040 0.000 0.960 0.000
#> GSM509783     4  0.1043      0.861 0.000 0.040 0.000 0.960 0.000
#> GSM509785     4  0.1043      0.861 0.000 0.040 0.000 0.960 0.000
#> GSM509752     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509760     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509766     4  0.4287      0.399 0.000 0.460 0.000 0.540 0.000
#> GSM509768     4  0.3534      0.811 0.000 0.256 0.000 0.744 0.000
#> GSM509770     2  0.1608      0.909 0.000 0.928 0.000 0.072 0.000
#> GSM509772     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.2561      0.904 0.000 0.144 0.000 0.856 0.000
#> GSM509776     4  0.2690      0.900 0.000 0.156 0.000 0.844 0.000
#> GSM509778     4  0.1043      0.861 0.000 0.040 0.000 0.960 0.000
#> GSM509780     4  0.2561      0.904 0.000 0.144 0.000 0.856 0.000
#> GSM509782     4  0.1121      0.864 0.000 0.044 0.000 0.956 0.000
#> GSM509784     4  0.2516      0.903 0.000 0.140 0.000 0.860 0.000
#> GSM509786     4  0.1043      0.861 0.000 0.040 0.000 0.960 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
#> GSM509706     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.0458      0.883 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM509714     1  0.0458      0.883 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM509719     1  0.4193      0.729 0.736 0.000 0.000 0.004 0.072 0.188
#> GSM509724     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.0858      0.878 0.968 0.000 0.000 0.000 0.004 0.028
#> GSM509707     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.0458      0.883 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM509715     5  0.1444      0.995 0.000 0.000 0.000 0.072 0.928 0.000
#> GSM509720     1  0.4193      0.729 0.736 0.000 0.000 0.004 0.072 0.188
#> GSM509725     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.2594      0.831 0.880 0.000 0.000 0.004 0.056 0.060
#> GSM509708     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0146      0.889 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM509716     5  0.1444      0.995 0.000 0.000 0.000 0.072 0.928 0.000
#> GSM509721     1  0.4193      0.729 0.736 0.000 0.000 0.004 0.072 0.188
#> GSM509726     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509731     5  0.2066      0.979 0.000 0.000 0.000 0.072 0.904 0.024
#> GSM509709     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.1444      0.995 0.000 0.000 0.000 0.072 0.928 0.000
#> GSM509722     1  0.4193      0.729 0.736 0.000 0.000 0.004 0.072 0.188
#> GSM509727     6  0.4107      0.795 0.256 0.000 0.000 0.000 0.044 0.700
#> GSM509710     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.1444      0.995 0.000 0.000 0.000 0.072 0.928 0.000
#> GSM509723     1  0.4193      0.729 0.736 0.000 0.000 0.004 0.072 0.188
#> GSM509728     6  0.3620      0.716 0.352 0.000 0.000 0.000 0.000 0.648
#> GSM509732     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     6  0.3352      0.832 0.176 0.000 0.000 0.000 0.032 0.792
#> GSM509741     3  0.0363      0.986 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM509746     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     6  0.3076      0.819 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM509742     3  0.0363      0.986 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM509747     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     1  0.4141      0.277 0.596 0.000 0.388 0.000 0.000 0.016
#> GSM509738     6  0.3041      0.807 0.128 0.000 0.000 0.000 0.040 0.832
#> GSM509743     3  0.0935      0.976 0.000 0.000 0.964 0.004 0.000 0.032
#> GSM509748     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509735     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.891 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     6  0.3714      0.377 0.000 0.000 0.340 0.004 0.000 0.656
#> GSM509749     3  0.0777      0.980 0.000 0.000 0.972 0.004 0.000 0.024
#> GSM509740     6  0.3054      0.796 0.136 0.000 0.000 0.000 0.036 0.828
#> GSM509745     6  0.3422      0.830 0.168 0.000 0.040 0.000 0.000 0.792
#> GSM509750     3  0.1349      0.958 0.000 0.000 0.940 0.004 0.000 0.056
#> GSM509751     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0146      0.969 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM509759     2  0.0260      0.967 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM509761     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509763     4  0.2631      0.821 0.000 0.180 0.000 0.820 0.000 0.000
#> GSM509765     4  0.2135      0.861 0.000 0.128 0.000 0.872 0.000 0.000
#> GSM509767     2  0.1049      0.951 0.000 0.960 0.000 0.032 0.000 0.008
#> GSM509769     2  0.1556      0.911 0.000 0.920 0.000 0.080 0.000 0.000
#> GSM509771     2  0.1049      0.951 0.000 0.960 0.000 0.032 0.000 0.008
#> GSM509773     2  0.2219      0.844 0.000 0.864 0.000 0.136 0.000 0.000
#> GSM509775     4  0.2416      0.842 0.000 0.156 0.000 0.844 0.000 0.000
#> GSM509777     4  0.1556      0.879 0.000 0.080 0.000 0.920 0.000 0.000
#> GSM509779     4  0.1812      0.879 0.000 0.080 0.000 0.912 0.000 0.008
#> GSM509781     4  0.1390      0.835 0.000 0.004 0.000 0.948 0.016 0.032
#> GSM509783     4  0.1296      0.837 0.000 0.004 0.000 0.952 0.012 0.032
#> GSM509785     4  0.1390      0.835 0.000 0.004 0.000 0.948 0.016 0.032
#> GSM509752     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509760     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.970 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509766     4  0.3782      0.421 0.000 0.412 0.000 0.588 0.000 0.000
#> GSM509768     4  0.3330      0.697 0.000 0.284 0.000 0.716 0.000 0.000
#> GSM509770     2  0.2562      0.791 0.000 0.828 0.000 0.172 0.000 0.000
#> GSM509772     2  0.0260      0.967 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM509774     4  0.1556      0.879 0.000 0.080 0.000 0.920 0.000 0.000
#> GSM509776     4  0.2003      0.867 0.000 0.116 0.000 0.884 0.000 0.000
#> GSM509778     4  0.1049      0.844 0.000 0.008 0.000 0.960 0.000 0.032
#> GSM509780     4  0.1556      0.879 0.000 0.080 0.000 0.920 0.000 0.000
#> GSM509782     4  0.1151      0.847 0.000 0.012 0.000 0.956 0.000 0.032
#> GSM509784     4  0.2255      0.876 0.000 0.080 0.000 0.892 0.000 0.028
#> GSM509786     4  0.1390      0.835 0.000 0.004 0.000 0.948 0.016 0.032

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)  time(p) k
#> ATC:skmeans 81         2.25e-15 1.79e-12 2
#> ATC:skmeans 79         2.34e-21 2.10e-09 3
#> ATC:skmeans 79         5.71e-21 3.22e-08 4
#> ATC:skmeans 74         1.51e-23 7.66e-08 5
#> ATC:skmeans 78         2.39e-23 3.26e-08 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 19175 rows and 81 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.999       0.999         0.5066 0.494   0.494
#> 3 3 0.867           0.852       0.905         0.2354 0.809   0.638
#> 4 4 0.894           0.870       0.939         0.0989 0.862   0.668
#> 5 5 0.862           0.925       0.935         0.1419 0.868   0.596
#> 6 6 0.905           0.811       0.909         0.0543 0.887   0.529

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

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

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
#> GSM509706     1    0.00      1.000 1.000 0.000
#> GSM509711     1    0.00      1.000 1.000 0.000
#> GSM509714     1    0.00      1.000 1.000 0.000
#> GSM509719     1    0.00      1.000 1.000 0.000
#> GSM509724     1    0.00      1.000 1.000 0.000
#> GSM509729     1    0.00      1.000 1.000 0.000
#> GSM509707     1    0.00      1.000 1.000 0.000
#> GSM509712     1    0.00      1.000 1.000 0.000
#> GSM509715     2    0.00      0.999 0.000 1.000
#> GSM509720     1    0.00      1.000 1.000 0.000
#> GSM509725     1    0.00      1.000 1.000 0.000
#> GSM509730     1    0.00      1.000 1.000 0.000
#> GSM509708     1    0.00      1.000 1.000 0.000
#> GSM509713     1    0.00      1.000 1.000 0.000
#> GSM509716     2    0.26      0.954 0.044 0.956
#> GSM509721     1    0.00      1.000 1.000 0.000
#> GSM509726     1    0.00      1.000 1.000 0.000
#> GSM509731     1    0.00      1.000 1.000 0.000
#> GSM509709     1    0.00      1.000 1.000 0.000
#> GSM509717     2    0.00      0.999 0.000 1.000
#> GSM509722     1    0.00      1.000 1.000 0.000
#> GSM509727     1    0.00      1.000 1.000 0.000
#> GSM509710     1    0.00      1.000 1.000 0.000
#> GSM509718     2    0.00      0.999 0.000 1.000
#> GSM509723     1    0.00      1.000 1.000 0.000
#> GSM509728     1    0.00      1.000 1.000 0.000
#> GSM509732     1    0.00      1.000 1.000 0.000
#> GSM509736     1    0.00      1.000 1.000 0.000
#> GSM509741     1    0.00      1.000 1.000 0.000
#> GSM509746     1    0.00      1.000 1.000 0.000
#> GSM509733     1    0.00      1.000 1.000 0.000
#> GSM509737     1    0.00      1.000 1.000 0.000
#> GSM509742     1    0.00      1.000 1.000 0.000
#> GSM509747     1    0.00      1.000 1.000 0.000
#> GSM509734     1    0.00      1.000 1.000 0.000
#> GSM509738     1    0.00      1.000 1.000 0.000
#> GSM509743     1    0.00      1.000 1.000 0.000
#> GSM509748     1    0.00      1.000 1.000 0.000
#> GSM509735     1    0.00      1.000 1.000 0.000
#> GSM509739     1    0.00      1.000 1.000 0.000
#> GSM509744     1    0.00      1.000 1.000 0.000
#> GSM509749     1    0.00      1.000 1.000 0.000
#> GSM509740     1    0.00      1.000 1.000 0.000
#> GSM509745     1    0.00      1.000 1.000 0.000
#> GSM509750     1    0.00      1.000 1.000 0.000
#> GSM509751     2    0.00      0.999 0.000 1.000
#> GSM509753     2    0.00      0.999 0.000 1.000
#> GSM509755     2    0.00      0.999 0.000 1.000
#> GSM509757     2    0.00      0.999 0.000 1.000
#> GSM509759     2    0.00      0.999 0.000 1.000
#> GSM509761     2    0.00      0.999 0.000 1.000
#> GSM509763     2    0.00      0.999 0.000 1.000
#> GSM509765     2    0.00      0.999 0.000 1.000
#> GSM509767     2    0.00      0.999 0.000 1.000
#> GSM509769     2    0.00      0.999 0.000 1.000
#> GSM509771     2    0.00      0.999 0.000 1.000
#> GSM509773     2    0.00      0.999 0.000 1.000
#> GSM509775     2    0.00      0.999 0.000 1.000
#> GSM509777     2    0.00      0.999 0.000 1.000
#> GSM509779     2    0.00      0.999 0.000 1.000
#> GSM509781     2    0.00      0.999 0.000 1.000
#> GSM509783     2    0.00      0.999 0.000 1.000
#> GSM509785     2    0.00      0.999 0.000 1.000
#> GSM509752     2    0.00      0.999 0.000 1.000
#> GSM509754     2    0.00      0.999 0.000 1.000
#> GSM509756     2    0.00      0.999 0.000 1.000
#> GSM509758     2    0.00      0.999 0.000 1.000
#> GSM509760     2    0.00      0.999 0.000 1.000
#> GSM509762     2    0.00      0.999 0.000 1.000
#> GSM509764     2    0.00      0.999 0.000 1.000
#> GSM509766     2    0.00      0.999 0.000 1.000
#> GSM509768     2    0.00      0.999 0.000 1.000
#> GSM509770     2    0.00      0.999 0.000 1.000
#> GSM509772     2    0.00      0.999 0.000 1.000
#> GSM509774     2    0.00      0.999 0.000 1.000
#> GSM509776     2    0.00      0.999 0.000 1.000
#> GSM509778     2    0.00      0.999 0.000 1.000
#> GSM509780     2    0.00      0.999 0.000 1.000
#> GSM509782     2    0.00      0.999 0.000 1.000
#> GSM509784     2    0.00      0.999 0.000 1.000
#> GSM509786     2    0.00      0.999 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM509706     1   0.000      1.000 1.000 0.000 0.000
#> GSM509711     1   0.000      1.000 1.000 0.000 0.000
#> GSM509714     3   0.611      0.627 0.396 0.000 0.604
#> GSM509719     3   0.611      0.627 0.396 0.000 0.604
#> GSM509724     1   0.000      1.000 1.000 0.000 0.000
#> GSM509729     1   0.000      1.000 1.000 0.000 0.000
#> GSM509707     1   0.000      1.000 1.000 0.000 0.000
#> GSM509712     3   0.625      0.554 0.444 0.000 0.556
#> GSM509715     3   0.611      0.436 0.000 0.396 0.604
#> GSM509720     3   0.611      0.627 0.396 0.000 0.604
#> GSM509725     1   0.000      1.000 1.000 0.000 0.000
#> GSM509730     3   0.629      0.516 0.464 0.000 0.536
#> GSM509708     1   0.000      1.000 1.000 0.000 0.000
#> GSM509713     1   0.000      1.000 1.000 0.000 0.000
#> GSM509716     3   0.744      0.496 0.048 0.348 0.604
#> GSM509721     3   0.611      0.627 0.396 0.000 0.604
#> GSM509726     1   0.000      1.000 1.000 0.000 0.000
#> GSM509731     3   0.611      0.627 0.396 0.000 0.604
#> GSM509709     1   0.000      1.000 1.000 0.000 0.000
#> GSM509717     3   0.631      0.444 0.004 0.392 0.604
#> GSM509722     3   0.611      0.627 0.396 0.000 0.604
#> GSM509727     3   0.611      0.627 0.396 0.000 0.604
#> GSM509710     1   0.000      1.000 1.000 0.000 0.000
#> GSM509718     3   0.611      0.436 0.000 0.396 0.604
#> GSM509723     3   0.611      0.627 0.396 0.000 0.604
#> GSM509728     3   0.000      0.695 0.000 0.000 1.000
#> GSM509732     3   0.000      0.695 0.000 0.000 1.000
#> GSM509736     3   0.611      0.627 0.396 0.000 0.604
#> GSM509741     3   0.000      0.695 0.000 0.000 1.000
#> GSM509746     3   0.000      0.695 0.000 0.000 1.000
#> GSM509733     3   0.000      0.695 0.000 0.000 1.000
#> GSM509737     3   0.611      0.627 0.396 0.000 0.604
#> GSM509742     3   0.000      0.695 0.000 0.000 1.000
#> GSM509747     3   0.000      0.695 0.000 0.000 1.000
#> GSM509734     3   0.175      0.665 0.048 0.000 0.952
#> GSM509738     3   0.610      0.629 0.392 0.000 0.608
#> GSM509743     3   0.000      0.695 0.000 0.000 1.000
#> GSM509748     3   0.000      0.695 0.000 0.000 1.000
#> GSM509735     1   0.000      1.000 1.000 0.000 0.000
#> GSM509739     1   0.000      1.000 1.000 0.000 0.000
#> GSM509744     3   0.000      0.695 0.000 0.000 1.000
#> GSM509749     3   0.000      0.695 0.000 0.000 1.000
#> GSM509740     3   0.611      0.627 0.396 0.000 0.604
#> GSM509745     3   0.610      0.629 0.392 0.000 0.608
#> GSM509750     3   0.000      0.695 0.000 0.000 1.000
#> GSM509751     2   0.000      1.000 0.000 1.000 0.000
#> GSM509753     2   0.000      1.000 0.000 1.000 0.000
#> GSM509755     2   0.000      1.000 0.000 1.000 0.000
#> GSM509757     2   0.000      1.000 0.000 1.000 0.000
#> GSM509759     2   0.000      1.000 0.000 1.000 0.000
#> GSM509761     2   0.000      1.000 0.000 1.000 0.000
#> GSM509763     2   0.000      1.000 0.000 1.000 0.000
#> GSM509765     2   0.000      1.000 0.000 1.000 0.000
#> GSM509767     2   0.000      1.000 0.000 1.000 0.000
#> GSM509769     2   0.000      1.000 0.000 1.000 0.000
#> GSM509771     2   0.000      1.000 0.000 1.000 0.000
#> GSM509773     2   0.000      1.000 0.000 1.000 0.000
#> GSM509775     2   0.000      1.000 0.000 1.000 0.000
#> GSM509777     2   0.000      1.000 0.000 1.000 0.000
#> GSM509779     2   0.000      1.000 0.000 1.000 0.000
#> GSM509781     2   0.000      1.000 0.000 1.000 0.000
#> GSM509783     2   0.000      1.000 0.000 1.000 0.000
#> GSM509785     2   0.000      1.000 0.000 1.000 0.000
#> GSM509752     2   0.000      1.000 0.000 1.000 0.000
#> GSM509754     2   0.000      1.000 0.000 1.000 0.000
#> GSM509756     2   0.000      1.000 0.000 1.000 0.000
#> GSM509758     2   0.000      1.000 0.000 1.000 0.000
#> GSM509760     2   0.000      1.000 0.000 1.000 0.000
#> GSM509762     2   0.000      1.000 0.000 1.000 0.000
#> GSM509764     2   0.000      1.000 0.000 1.000 0.000
#> GSM509766     2   0.000      1.000 0.000 1.000 0.000
#> GSM509768     2   0.000      1.000 0.000 1.000 0.000
#> GSM509770     2   0.000      1.000 0.000 1.000 0.000
#> GSM509772     2   0.000      1.000 0.000 1.000 0.000
#> GSM509774     2   0.000      1.000 0.000 1.000 0.000
#> GSM509776     2   0.000      1.000 0.000 1.000 0.000
#> GSM509778     2   0.000      1.000 0.000 1.000 0.000
#> GSM509780     2   0.000      1.000 0.000 1.000 0.000
#> GSM509782     2   0.000      1.000 0.000 1.000 0.000
#> GSM509784     2   0.000      1.000 0.000 1.000 0.000
#> GSM509786     2   0.000      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
#> GSM509706     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509711     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509714     4  0.0188      0.901 0.004 0.000 0.000 0.996
#> GSM509719     4  0.0188      0.902 0.000 0.000 0.004 0.996
#> GSM509724     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509729     1  0.4250      0.624 0.724 0.000 0.000 0.276
#> GSM509707     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509712     4  0.0188      0.901 0.004 0.000 0.000 0.996
#> GSM509715     2  0.6060      0.441 0.012 0.612 0.036 0.340
#> GSM509720     4  0.0188      0.902 0.000 0.000 0.004 0.996
#> GSM509725     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509730     4  0.4934      0.572 0.028 0.000 0.252 0.720
#> GSM509708     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509713     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509716     2  0.6296      0.237 0.012 0.532 0.036 0.420
#> GSM509721     4  0.0188      0.902 0.000 0.000 0.004 0.996
#> GSM509726     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509731     4  0.0336      0.901 0.000 0.000 0.008 0.992
#> GSM509709     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509717     2  0.6060      0.441 0.012 0.612 0.036 0.340
#> GSM509722     4  0.0188      0.902 0.000 0.000 0.004 0.996
#> GSM509727     4  0.1305      0.887 0.004 0.000 0.036 0.960
#> GSM509710     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509718     2  0.6060      0.441 0.012 0.612 0.036 0.340
#> GSM509723     4  0.3610      0.689 0.000 0.000 0.200 0.800
#> GSM509728     4  0.2944      0.788 0.004 0.000 0.128 0.868
#> GSM509732     3  0.0592      0.869 0.000 0.000 0.984 0.016
#> GSM509736     4  0.4817      0.276 0.000 0.000 0.388 0.612
#> GSM509741     3  0.0469      0.871 0.000 0.000 0.988 0.012
#> GSM509746     3  0.0336      0.870 0.000 0.000 0.992 0.008
#> GSM509733     3  0.0336      0.870 0.000 0.000 0.992 0.008
#> GSM509737     4  0.0469      0.902 0.000 0.000 0.012 0.988
#> GSM509742     3  0.0469      0.871 0.000 0.000 0.988 0.012
#> GSM509747     3  0.1302      0.859 0.000 0.000 0.956 0.044
#> GSM509734     3  0.2401      0.828 0.004 0.000 0.904 0.092
#> GSM509738     4  0.1940      0.866 0.000 0.000 0.076 0.924
#> GSM509743     3  0.4134      0.646 0.000 0.000 0.740 0.260
#> GSM509748     3  0.1389      0.858 0.000 0.000 0.952 0.048
#> GSM509735     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509739     1  0.0469      0.975 0.988 0.000 0.000 0.012
#> GSM509744     3  0.4605      0.522 0.000 0.000 0.664 0.336
#> GSM509749     3  0.1792      0.845 0.000 0.000 0.932 0.068
#> GSM509740     4  0.0469      0.902 0.000 0.000 0.012 0.988
#> GSM509745     4  0.1557      0.879 0.000 0.000 0.056 0.944
#> GSM509750     3  0.4605      0.522 0.000 0.000 0.664 0.336
#> GSM509751     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509757     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509759     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509761     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0469      0.947 0.012 0.988 0.000 0.000
#> GSM509765     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509767     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509775     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509777     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509779     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509781     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509783     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509785     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509752     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509760     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509762     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509766     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509768     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509770     2  0.0524      0.947 0.000 0.988 0.008 0.004
#> GSM509772     2  0.0000      0.948 0.000 1.000 0.000 0.000
#> GSM509774     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509776     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509778     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509780     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509782     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509784     2  0.0992      0.946 0.012 0.976 0.008 0.004
#> GSM509786     2  0.0992      0.946 0.012 0.976 0.008 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
#> GSM509706     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509714     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000
#> GSM509719     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000
#> GSM509724     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509729     5  0.4171      0.369 0.396 0.000 0.000 0.000 0.604
#> GSM509707     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509712     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000
#> GSM509715     4  0.0000      0.762 0.000 0.000 0.000 1.000 0.000
#> GSM509720     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000
#> GSM509725     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509730     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000
#> GSM509708     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509716     4  0.0000      0.762 0.000 0.000 0.000 1.000 0.000
#> GSM509721     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000
#> GSM509726     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509731     5  0.3242      0.780 0.000 0.000 0.000 0.216 0.784
#> GSM509709     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509717     4  0.0000      0.762 0.000 0.000 0.000 1.000 0.000
#> GSM509722     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000
#> GSM509727     5  0.0290      0.918 0.000 0.000 0.000 0.008 0.992
#> GSM509710     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509718     4  0.0000      0.762 0.000 0.000 0.000 1.000 0.000
#> GSM509723     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000
#> GSM509728     5  0.3551      0.691 0.000 0.000 0.220 0.008 0.772
#> GSM509732     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509736     5  0.4392      0.405 0.000 0.000 0.380 0.008 0.612
#> GSM509741     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509746     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509733     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509737     5  0.0290      0.918 0.000 0.000 0.000 0.008 0.992
#> GSM509742     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509747     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509734     3  0.1608      0.925 0.000 0.000 0.928 0.000 0.072
#> GSM509738     5  0.0898      0.910 0.000 0.000 0.020 0.008 0.972
#> GSM509743     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509748     3  0.0510      0.979 0.000 0.000 0.984 0.000 0.016
#> GSM509735     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.0290      0.986 0.000 0.000 0.992 0.008 0.000
#> GSM509749     3  0.0000      0.990 0.000 0.000 1.000 0.000 0.000
#> GSM509740     5  0.0290      0.918 0.000 0.000 0.000 0.008 0.992
#> GSM509745     5  0.0898      0.910 0.000 0.000 0.020 0.008 0.972
#> GSM509750     3  0.0290      0.986 0.000 0.000 0.992 0.008 0.000
#> GSM509751     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509763     4  0.3857      0.808 0.000 0.312 0.000 0.688 0.000
#> GSM509765     4  0.4074      0.723 0.000 0.364 0.000 0.636 0.000
#> GSM509767     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509769     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509771     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509773     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509775     4  0.3210      0.911 0.000 0.212 0.000 0.788 0.000
#> GSM509777     4  0.3210      0.911 0.000 0.212 0.000 0.788 0.000
#> GSM509779     4  0.3177      0.912 0.000 0.208 0.000 0.792 0.000
#> GSM509781     4  0.3177      0.912 0.000 0.208 0.000 0.792 0.000
#> GSM509783     4  0.3109      0.908 0.000 0.200 0.000 0.800 0.000
#> GSM509785     4  0.3177      0.912 0.000 0.208 0.000 0.792 0.000
#> GSM509752     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509760     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509766     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509768     4  0.4126      0.694 0.000 0.380 0.000 0.620 0.000
#> GSM509770     2  0.1197      0.934 0.000 0.952 0.000 0.048 0.000
#> GSM509772     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM509774     4  0.3210      0.911 0.000 0.212 0.000 0.788 0.000
#> GSM509776     4  0.3210      0.911 0.000 0.212 0.000 0.788 0.000
#> GSM509778     4  0.3177      0.912 0.000 0.208 0.000 0.792 0.000
#> GSM509780     4  0.3210      0.911 0.000 0.212 0.000 0.788 0.000
#> GSM509782     4  0.3177      0.912 0.000 0.208 0.000 0.792 0.000
#> GSM509784     4  0.3177      0.912 0.000 0.208 0.000 0.792 0.000
#> GSM509786     4  0.3177      0.912 0.000 0.208 0.000 0.792 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
#> GSM509706     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509714     5  0.0000      0.920 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509719     5  0.0000      0.920 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509724     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509729     5  0.3765      0.238 0.404 0.000 0.000 0.000 0.596 0.000
#> GSM509707     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     5  0.0000      0.920 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509715     6  0.0000      0.645 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509720     5  0.0000      0.920 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509725     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509730     5  0.0000      0.920 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509708     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509716     6  0.0000      0.645 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509721     5  0.0000      0.920 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509726     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509731     6  0.0000      0.645 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509709     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     6  0.0000      0.645 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509722     5  0.0000      0.920 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509727     6  0.3659      0.556 0.000 0.000 0.000 0.000 0.364 0.636
#> GSM509710     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     6  0.0000      0.645 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509723     5  0.0000      0.920 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM509728     6  0.3862      0.482 0.000 0.000 0.000 0.000 0.476 0.524
#> GSM509732     3  0.0000      0.940 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509736     6  0.5337      0.398 0.000 0.000 0.360 0.000 0.116 0.524
#> GSM509741     3  0.0000      0.940 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509746     3  0.0000      0.940 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509733     3  0.0000      0.940 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509737     6  0.3862      0.482 0.000 0.000 0.000 0.000 0.476 0.524
#> GSM509742     3  0.0000      0.940 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509747     3  0.0000      0.940 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM509734     3  0.1501      0.872 0.000 0.000 0.924 0.000 0.076 0.000
#> GSM509738     6  0.4393      0.502 0.000 0.000 0.024 0.000 0.452 0.524
#> GSM509743     3  0.2527      0.765 0.000 0.000 0.832 0.000 0.000 0.168
#> GSM509748     3  0.0458      0.930 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM509735     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     6  0.3862      0.195 0.000 0.000 0.476 0.000 0.000 0.524
#> GSM509749     3  0.2378      0.789 0.000 0.000 0.848 0.000 0.000 0.152
#> GSM509740     6  0.3862      0.482 0.000 0.000 0.000 0.000 0.476 0.524
#> GSM509745     6  0.4393      0.502 0.000 0.000 0.024 0.000 0.452 0.524
#> GSM509750     6  0.3862      0.195 0.000 0.000 0.476 0.000 0.000 0.524
#> GSM509751     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509757     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509759     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509761     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509763     4  0.1610      0.832 0.000 0.084 0.000 0.916 0.000 0.000
#> GSM509765     4  0.0790      0.864 0.000 0.032 0.000 0.968 0.000 0.000
#> GSM509767     4  0.3817      0.373 0.000 0.432 0.000 0.568 0.000 0.000
#> GSM509769     2  0.0458      0.947 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM509771     4  0.3847      0.311 0.000 0.456 0.000 0.544 0.000 0.000
#> GSM509773     4  0.3782      0.416 0.000 0.412 0.000 0.588 0.000 0.000
#> GSM509775     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509777     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509779     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509781     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509783     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509785     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509752     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509754     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509756     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509758     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509760     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509762     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509764     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509766     4  0.3782      0.416 0.000 0.412 0.000 0.588 0.000 0.000
#> GSM509768     4  0.1075      0.856 0.000 0.048 0.000 0.952 0.000 0.000
#> GSM509770     2  0.1327      0.899 0.000 0.936 0.000 0.064 0.000 0.000
#> GSM509772     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM509774     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509776     2  0.3847      0.136 0.000 0.544 0.000 0.456 0.000 0.000
#> GSM509778     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509780     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509782     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509784     4  0.0000      0.878 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM509786     4  0.0000      0.878 0.000 0.000 0.000 1.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)  time(p) k
#> ATC:pam 81         2.25e-15 1.79e-12 2
#> ATC:pam 77         9.00e-19 3.70e-12 3
#> ATC:pam 76         8.89e-23 1.89e-10 4
#> ATC:pam 79         2.36e-19 7.35e-07 5
#> ATC:pam 69         1.16e-19 3.70e-07 6

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


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 19175 rows and 81 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 1.000           1.000       1.000         0.5005 0.500   0.500
#> 3 3 0.928           0.962       0.979         0.3014 0.844   0.689
#> 4 4 0.789           0.839       0.889         0.0894 0.911   0.748
#> 5 5 0.776           0.799       0.864         0.0716 0.922   0.724
#> 6 6 0.880           0.861       0.906         0.0396 0.962   0.838

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
#> GSM509706     1       0          1  1  0
#> GSM509711     1       0          1  1  0
#> GSM509714     1       0          1  1  0
#> GSM509719     1       0          1  1  0
#> GSM509724     1       0          1  1  0
#> GSM509729     1       0          1  1  0
#> GSM509707     1       0          1  1  0
#> GSM509712     1       0          1  1  0
#> GSM509715     1       0          1  1  0
#> GSM509720     1       0          1  1  0
#> GSM509725     1       0          1  1  0
#> GSM509730     1       0          1  1  0
#> GSM509708     1       0          1  1  0
#> GSM509713     1       0          1  1  0
#> GSM509716     1       0          1  1  0
#> GSM509721     1       0          1  1  0
#> GSM509726     1       0          1  1  0
#> GSM509731     1       0          1  1  0
#> GSM509709     1       0          1  1  0
#> GSM509717     1       0          1  1  0
#> GSM509722     1       0          1  1  0
#> GSM509727     1       0          1  1  0
#> GSM509710     1       0          1  1  0
#> GSM509718     1       0          1  1  0
#> GSM509723     1       0          1  1  0
#> GSM509728     1       0          1  1  0
#> GSM509732     1       0          1  1  0
#> GSM509736     1       0          1  1  0
#> GSM509741     1       0          1  1  0
#> GSM509746     1       0          1  1  0
#> GSM509733     1       0          1  1  0
#> GSM509737     1       0          1  1  0
#> GSM509742     1       0          1  1  0
#> GSM509747     1       0          1  1  0
#> GSM509734     1       0          1  1  0
#> GSM509738     1       0          1  1  0
#> GSM509743     1       0          1  1  0
#> GSM509748     1       0          1  1  0
#> GSM509735     1       0          1  1  0
#> GSM509739     1       0          1  1  0
#> GSM509744     1       0          1  1  0
#> GSM509749     1       0          1  1  0
#> GSM509740     1       0          1  1  0
#> GSM509745     1       0          1  1  0
#> GSM509750     1       0          1  1  0
#> GSM509751     2       0          1  0  1
#> GSM509753     2       0          1  0  1
#> GSM509755     2       0          1  0  1
#> GSM509757     2       0          1  0  1
#> GSM509759     2       0          1  0  1
#> GSM509761     2       0          1  0  1
#> GSM509763     2       0          1  0  1
#> GSM509765     2       0          1  0  1
#> GSM509767     2       0          1  0  1
#> GSM509769     2       0          1  0  1
#> GSM509771     2       0          1  0  1
#> GSM509773     2       0          1  0  1
#> GSM509775     2       0          1  0  1
#> GSM509777     2       0          1  0  1
#> GSM509779     2       0          1  0  1
#> GSM509781     2       0          1  0  1
#> GSM509783     2       0          1  0  1
#> GSM509785     2       0          1  0  1
#> GSM509752     2       0          1  0  1
#> GSM509754     2       0          1  0  1
#> GSM509756     2       0          1  0  1
#> GSM509758     2       0          1  0  1
#> GSM509760     2       0          1  0  1
#> GSM509762     2       0          1  0  1
#> GSM509764     2       0          1  0  1
#> GSM509766     2       0          1  0  1
#> GSM509768     2       0          1  0  1
#> GSM509770     2       0          1  0  1
#> GSM509772     2       0          1  0  1
#> GSM509774     2       0          1  0  1
#> GSM509776     2       0          1  0  1
#> GSM509778     2       0          1  0  1
#> GSM509780     2       0          1  0  1
#> GSM509782     2       0          1  0  1
#> GSM509784     2       0          1  0  1
#> GSM509786     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1 p2    p3
#> GSM509706     1   0.000      0.912 1.000  0 0.000
#> GSM509711     1   0.533      0.657 0.728  0 0.272
#> GSM509714     1   0.606      0.509 0.616  0 0.384
#> GSM509719     1   0.319      0.878 0.888  0 0.112
#> GSM509724     1   0.000      0.912 1.000  0 0.000
#> GSM509729     1   0.000      0.912 1.000  0 0.000
#> GSM509707     1   0.000      0.912 1.000  0 0.000
#> GSM509712     1   0.606      0.509 0.616  0 0.384
#> GSM509715     3   0.000      1.000 0.000  0 1.000
#> GSM509720     1   0.319      0.878 0.888  0 0.112
#> GSM509725     1   0.000      0.912 1.000  0 0.000
#> GSM509730     1   0.319      0.878 0.888  0 0.112
#> GSM509708     1   0.000      0.912 1.000  0 0.000
#> GSM509713     1   0.000      0.912 1.000  0 0.000
#> GSM509716     3   0.000      1.000 0.000  0 1.000
#> GSM509721     1   0.319      0.878 0.888  0 0.112
#> GSM509726     1   0.000      0.912 1.000  0 0.000
#> GSM509731     3   0.000      1.000 0.000  0 1.000
#> GSM509709     1   0.000      0.912 1.000  0 0.000
#> GSM509717     3   0.000      1.000 0.000  0 1.000
#> GSM509722     1   0.319      0.878 0.888  0 0.112
#> GSM509727     3   0.000      1.000 0.000  0 1.000
#> GSM509710     1   0.000      0.912 1.000  0 0.000
#> GSM509718     3   0.000      1.000 0.000  0 1.000
#> GSM509723     1   0.319      0.878 0.888  0 0.112
#> GSM509728     3   0.000      1.000 0.000  0 1.000
#> GSM509732     3   0.000      1.000 0.000  0 1.000
#> GSM509736     3   0.000      1.000 0.000  0 1.000
#> GSM509741     3   0.000      1.000 0.000  0 1.000
#> GSM509746     3   0.000      1.000 0.000  0 1.000
#> GSM509733     3   0.000      1.000 0.000  0 1.000
#> GSM509737     3   0.000      1.000 0.000  0 1.000
#> GSM509742     3   0.000      1.000 0.000  0 1.000
#> GSM509747     3   0.000      1.000 0.000  0 1.000
#> GSM509734     3   0.000      1.000 0.000  0 1.000
#> GSM509738     3   0.000      1.000 0.000  0 1.000
#> GSM509743     3   0.000      1.000 0.000  0 1.000
#> GSM509748     3   0.000      1.000 0.000  0 1.000
#> GSM509735     1   0.000      0.912 1.000  0 0.000
#> GSM509739     1   0.000      0.912 1.000  0 0.000
#> GSM509744     3   0.000      1.000 0.000  0 1.000
#> GSM509749     3   0.000      1.000 0.000  0 1.000
#> GSM509740     3   0.000      1.000 0.000  0 1.000
#> GSM509745     3   0.000      1.000 0.000  0 1.000
#> GSM509750     3   0.000      1.000 0.000  0 1.000
#> GSM509751     2   0.000      1.000 0.000  1 0.000
#> GSM509753     2   0.000      1.000 0.000  1 0.000
#> GSM509755     2   0.000      1.000 0.000  1 0.000
#> GSM509757     2   0.000      1.000 0.000  1 0.000
#> GSM509759     2   0.000      1.000 0.000  1 0.000
#> GSM509761     2   0.000      1.000 0.000  1 0.000
#> GSM509763     2   0.000      1.000 0.000  1 0.000
#> GSM509765     2   0.000      1.000 0.000  1 0.000
#> GSM509767     2   0.000      1.000 0.000  1 0.000
#> GSM509769     2   0.000      1.000 0.000  1 0.000
#> GSM509771     2   0.000      1.000 0.000  1 0.000
#> GSM509773     2   0.000      1.000 0.000  1 0.000
#> GSM509775     2   0.000      1.000 0.000  1 0.000
#> GSM509777     2   0.000      1.000 0.000  1 0.000
#> GSM509779     2   0.000      1.000 0.000  1 0.000
#> GSM509781     2   0.000      1.000 0.000  1 0.000
#> GSM509783     2   0.000      1.000 0.000  1 0.000
#> GSM509785     2   0.000      1.000 0.000  1 0.000
#> GSM509752     2   0.000      1.000 0.000  1 0.000
#> GSM509754     2   0.000      1.000 0.000  1 0.000
#> GSM509756     2   0.000      1.000 0.000  1 0.000
#> GSM509758     2   0.000      1.000 0.000  1 0.000
#> GSM509760     2   0.000      1.000 0.000  1 0.000
#> GSM509762     2   0.000      1.000 0.000  1 0.000
#> GSM509764     2   0.000      1.000 0.000  1 0.000
#> GSM509766     2   0.000      1.000 0.000  1 0.000
#> GSM509768     2   0.000      1.000 0.000  1 0.000
#> GSM509770     2   0.000      1.000 0.000  1 0.000
#> GSM509772     2   0.000      1.000 0.000  1 0.000
#> GSM509774     2   0.000      1.000 0.000  1 0.000
#> GSM509776     2   0.000      1.000 0.000  1 0.000
#> GSM509778     2   0.000      1.000 0.000  1 0.000
#> GSM509780     2   0.000      1.000 0.000  1 0.000
#> GSM509782     2   0.000      1.000 0.000  1 0.000
#> GSM509784     2   0.000      1.000 0.000  1 0.000
#> GSM509786     2   0.000      1.000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM509706     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM509711     1  0.0469      0.909 0.988 0.000 0.012 0.000
#> GSM509714     1  0.3311      0.860 0.828 0.000 0.172 0.000
#> GSM509719     1  0.3311      0.860 0.828 0.000 0.172 0.000
#> GSM509724     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM509729     1  0.1118      0.905 0.964 0.000 0.036 0.000
#> GSM509707     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM509712     1  0.3311      0.860 0.828 0.000 0.172 0.000
#> GSM509715     3  0.4941      0.631 0.000 0.000 0.564 0.436
#> GSM509720     1  0.3311      0.860 0.828 0.000 0.172 0.000
#> GSM509725     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM509730     1  0.3311      0.860 0.828 0.000 0.172 0.000
#> GSM509708     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM509713     1  0.0336      0.909 0.992 0.000 0.008 0.000
#> GSM509716     3  0.4941      0.631 0.000 0.000 0.564 0.436
#> GSM509721     1  0.3311      0.860 0.828 0.000 0.172 0.000
#> GSM509726     1  0.0592      0.905 0.984 0.000 0.016 0.000
#> GSM509731     1  0.4356      0.687 0.708 0.000 0.292 0.000
#> GSM509709     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM509717     3  0.4941      0.631 0.000 0.000 0.564 0.436
#> GSM509722     1  0.3311      0.860 0.828 0.000 0.172 0.000
#> GSM509727     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509710     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM509718     3  0.4941      0.631 0.000 0.000 0.564 0.436
#> GSM509723     1  0.3311      0.860 0.828 0.000 0.172 0.000
#> GSM509728     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509732     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509736     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509741     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509746     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509733     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509737     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509742     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509747     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509734     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509738     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509743     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509748     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509735     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM509739     1  0.0336      0.909 0.992 0.000 0.008 0.000
#> GSM509744     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509749     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509740     3  0.1867      0.864 0.072 0.000 0.928 0.000
#> GSM509745     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509750     3  0.0000      0.930 0.000 0.000 1.000 0.000
#> GSM509751     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509753     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509755     2  0.0336      0.893 0.000 0.992 0.000 0.008
#> GSM509757     2  0.0336      0.893 0.000 0.992 0.000 0.008
#> GSM509759     2  0.0336      0.893 0.000 0.992 0.000 0.008
#> GSM509761     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509763     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509765     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509767     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509769     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509771     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509773     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509775     2  0.3074      0.593 0.000 0.848 0.000 0.152
#> GSM509777     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509779     2  0.4977     -0.773 0.000 0.540 0.000 0.460
#> GSM509781     4  0.4955      0.995 0.000 0.444 0.000 0.556
#> GSM509783     4  0.4955      0.995 0.000 0.444 0.000 0.556
#> GSM509785     4  0.4955      0.995 0.000 0.444 0.000 0.556
#> GSM509752     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509754     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509756     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509758     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509760     4  0.4977      0.968 0.000 0.460 0.000 0.540
#> GSM509762     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509764     2  0.0336      0.893 0.000 0.992 0.000 0.008
#> GSM509766     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509768     2  0.4697     -0.409 0.000 0.644 0.000 0.356
#> GSM509770     4  0.4961      0.990 0.000 0.448 0.000 0.552
#> GSM509772     2  0.0336      0.893 0.000 0.992 0.000 0.008
#> GSM509774     2  0.4804     -0.522 0.000 0.616 0.000 0.384
#> GSM509776     4  0.4955      0.995 0.000 0.444 0.000 0.556
#> GSM509778     2  0.0469      0.885 0.000 0.988 0.000 0.012
#> GSM509780     2  0.0000      0.900 0.000 1.000 0.000 0.000
#> GSM509782     4  0.4955      0.995 0.000 0.444 0.000 0.556
#> GSM509784     4  0.4955      0.995 0.000 0.444 0.000 0.556
#> GSM509786     4  0.4955      0.995 0.000 0.444 0.000 0.556

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509714     1  0.2891      0.870 0.824 0.000 0.176 0.000 0.000
#> GSM509719     1  0.2891      0.870 0.824 0.000 0.176 0.000 0.000
#> GSM509724     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509707     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.2891      0.870 0.824 0.000 0.176 0.000 0.000
#> GSM509715     5  0.6551      0.275 0.000 0.000 0.384 0.200 0.416
#> GSM509720     1  0.2891      0.870 0.824 0.000 0.176 0.000 0.000
#> GSM509725     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.2891      0.870 0.824 0.000 0.176 0.000 0.000
#> GSM509708     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509716     5  0.6551      0.275 0.000 0.000 0.384 0.200 0.416
#> GSM509721     1  0.2891      0.870 0.824 0.000 0.176 0.000 0.000
#> GSM509726     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509731     1  0.3988      0.787 0.776 0.000 0.024 0.192 0.008
#> GSM509709     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.6551      0.275 0.000 0.000 0.384 0.200 0.416
#> GSM509722     1  0.2891      0.870 0.824 0.000 0.176 0.000 0.000
#> GSM509727     3  0.0000      0.787 0.000 0.000 1.000 0.000 0.000
#> GSM509710     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.6551      0.275 0.000 0.000 0.384 0.200 0.416
#> GSM509723     1  0.2891      0.870 0.824 0.000 0.176 0.000 0.000
#> GSM509728     3  0.0000      0.787 0.000 0.000 1.000 0.000 0.000
#> GSM509732     5  0.4219      0.258 0.000 0.000 0.416 0.000 0.584
#> GSM509736     3  0.0290      0.780 0.008 0.000 0.992 0.000 0.000
#> GSM509741     3  0.3039      0.717 0.000 0.000 0.808 0.000 0.192
#> GSM509746     5  0.4219      0.258 0.000 0.000 0.416 0.000 0.584
#> GSM509733     5  0.4235      0.247 0.000 0.000 0.424 0.000 0.576
#> GSM509737     3  0.0162      0.785 0.004 0.000 0.996 0.000 0.000
#> GSM509742     3  0.3039      0.717 0.000 0.000 0.808 0.000 0.192
#> GSM509747     5  0.4256      0.249 0.000 0.000 0.436 0.000 0.564
#> GSM509734     3  0.2127      0.598 0.108 0.000 0.892 0.000 0.000
#> GSM509738     3  0.0000      0.787 0.000 0.000 1.000 0.000 0.000
#> GSM509743     3  0.3039      0.717 0.000 0.000 0.808 0.000 0.192
#> GSM509748     5  0.4256      0.249 0.000 0.000 0.436 0.000 0.564
#> GSM509735     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.920 1.000 0.000 0.000 0.000 0.000
#> GSM509744     3  0.3039      0.717 0.000 0.000 0.808 0.000 0.192
#> GSM509749     3  0.3039      0.717 0.000 0.000 0.808 0.000 0.192
#> GSM509740     3  0.0963      0.742 0.036 0.000 0.964 0.000 0.000
#> GSM509745     3  0.0000      0.787 0.000 0.000 1.000 0.000 0.000
#> GSM509750     3  0.3039      0.717 0.000 0.000 0.808 0.000 0.192
#> GSM509751     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM509753     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0290      0.931 0.000 0.992 0.000 0.008 0.000
#> GSM509757     2  0.0404      0.929 0.000 0.988 0.000 0.012 0.000
#> GSM509759     2  0.0404      0.929 0.000 0.988 0.000 0.012 0.000
#> GSM509761     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509763     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509765     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509767     2  0.0290      0.931 0.000 0.992 0.000 0.008 0.000
#> GSM509769     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509771     2  0.0290      0.931 0.000 0.992 0.000 0.008 0.000
#> GSM509773     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509775     2  0.2605      0.766 0.000 0.852 0.000 0.148 0.000
#> GSM509777     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509779     4  0.3242      0.989 0.000 0.216 0.000 0.784 0.000
#> GSM509781     4  0.3210      0.992 0.000 0.212 0.000 0.788 0.000
#> GSM509783     4  0.3210      0.992 0.000 0.212 0.000 0.788 0.000
#> GSM509785     4  0.3210      0.992 0.000 0.212 0.000 0.788 0.000
#> GSM509752     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509754     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509756     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509758     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509760     2  0.4302     -0.323 0.000 0.520 0.000 0.480 0.000
#> GSM509762     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509764     2  0.0404      0.929 0.000 0.988 0.000 0.012 0.000
#> GSM509766     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509768     4  0.3534      0.938 0.000 0.256 0.000 0.744 0.000
#> GSM509770     4  0.3210      0.992 0.000 0.212 0.000 0.788 0.000
#> GSM509772     2  0.0404      0.929 0.000 0.988 0.000 0.012 0.000
#> GSM509774     4  0.3274      0.986 0.000 0.220 0.000 0.780 0.000
#> GSM509776     4  0.3210      0.992 0.000 0.212 0.000 0.788 0.000
#> GSM509778     2  0.3837      0.398 0.000 0.692 0.000 0.308 0.000
#> GSM509780     2  0.0510      0.939 0.000 0.984 0.000 0.016 0.000
#> GSM509782     4  0.3210      0.992 0.000 0.212 0.000 0.788 0.000
#> GSM509784     4  0.3210      0.992 0.000 0.212 0.000 0.788 0.000
#> GSM509786     4  0.3210      0.992 0.000 0.212 0.000 0.788 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
#> GSM509706     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509711     1  0.0146      0.931 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM509714     1  0.1501      0.914 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM509719     1  0.1444      0.916 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM509724     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509729     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509707     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509712     1  0.1501      0.914 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM509715     5  0.3240      1.000 0.000 0.000 0.000 0.004 0.752 0.244
#> GSM509720     1  0.1444      0.916 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM509725     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509730     1  0.1444      0.916 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM509708     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509713     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509716     5  0.3240      1.000 0.000 0.000 0.000 0.004 0.752 0.244
#> GSM509721     1  0.1444      0.916 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM509726     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509731     1  0.4962      0.420 0.628 0.000 0.000 0.004 0.092 0.276
#> GSM509709     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509717     5  0.3240      1.000 0.000 0.000 0.000 0.004 0.752 0.244
#> GSM509722     1  0.1444      0.916 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM509727     6  0.0146      0.862 0.000 0.000 0.000 0.000 0.004 0.996
#> GSM509710     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509718     5  0.3240      1.000 0.000 0.000 0.000 0.004 0.752 0.244
#> GSM509723     1  0.1444      0.916 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM509728     6  0.0000      0.864 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509732     3  0.1327      0.966 0.000 0.000 0.936 0.000 0.000 0.064
#> GSM509736     6  0.0000      0.864 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509741     6  0.1714      0.864 0.000 0.000 0.092 0.000 0.000 0.908
#> GSM509746     3  0.1327      0.966 0.000 0.000 0.936 0.000 0.000 0.064
#> GSM509733     3  0.1863      0.936 0.000 0.000 0.896 0.000 0.000 0.104
#> GSM509737     6  0.1411      0.790 0.060 0.000 0.004 0.000 0.000 0.936
#> GSM509742     6  0.1714      0.864 0.000 0.000 0.092 0.000 0.000 0.908
#> GSM509747     3  0.1753      0.959 0.004 0.000 0.912 0.000 0.000 0.084
#> GSM509734     6  0.3707      0.367 0.312 0.000 0.008 0.000 0.000 0.680
#> GSM509738     6  0.0000      0.864 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509743     6  0.1714      0.864 0.000 0.000 0.092 0.000 0.000 0.908
#> GSM509748     3  0.1663      0.961 0.000 0.000 0.912 0.000 0.000 0.088
#> GSM509735     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509739     1  0.0000      0.932 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM509744     6  0.1714      0.864 0.000 0.000 0.092 0.000 0.000 0.908
#> GSM509749     6  0.1714      0.864 0.000 0.000 0.092 0.000 0.000 0.908
#> GSM509740     1  0.3804      0.362 0.576 0.000 0.000 0.000 0.000 0.424
#> GSM509745     6  0.0000      0.864 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM509750     6  0.1714      0.864 0.000 0.000 0.092 0.000 0.000 0.908
#> GSM509751     2  0.0603      0.880 0.000 0.980 0.000 0.016 0.004 0.000
#> GSM509753     2  0.0291      0.876 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM509755     2  0.3227      0.783 0.000 0.824 0.060 0.000 0.116 0.000
#> GSM509757     2  0.4294      0.677 0.000 0.692 0.060 0.000 0.248 0.000
#> GSM509759     2  0.4294      0.677 0.000 0.692 0.060 0.000 0.248 0.000
#> GSM509761     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509763     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509765     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509767     2  0.0405      0.878 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM509769     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509771     2  0.0405      0.878 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM509773     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509775     2  0.2883      0.762 0.000 0.788 0.000 0.212 0.000 0.000
#> GSM509777     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509779     4  0.0865      0.904 0.000 0.036 0.000 0.964 0.000 0.000
#> GSM509781     4  0.0632      0.905 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM509783     4  0.0632      0.905 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM509785     4  0.0632      0.905 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM509752     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509754     2  0.1387      0.895 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM509756     2  0.2941      0.868 0.000 0.868 0.024 0.060 0.048 0.000
#> GSM509758     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509760     4  0.3076      0.698 0.000 0.240 0.000 0.760 0.000 0.000
#> GSM509762     2  0.1387      0.895 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM509764     2  0.4537      0.683 0.000 0.684 0.060 0.008 0.248 0.000
#> GSM509766     2  0.1444      0.895 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM509768     4  0.2340      0.806 0.000 0.148 0.000 0.852 0.000 0.000
#> GSM509770     4  0.1007      0.900 0.000 0.044 0.000 0.956 0.000 0.000
#> GSM509772     2  0.4294      0.677 0.000 0.692 0.060 0.000 0.248 0.000
#> GSM509774     4  0.1007      0.901 0.000 0.044 0.000 0.956 0.000 0.000
#> GSM509776     4  0.0713      0.905 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM509778     4  0.3857      0.120 0.000 0.468 0.000 0.532 0.000 0.000
#> GSM509780     2  0.1501      0.893 0.000 0.924 0.000 0.076 0.000 0.000
#> GSM509782     4  0.0632      0.905 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM509784     4  0.0713      0.905 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM509786     4  0.0632      0.905 0.000 0.024 0.000 0.976 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)  time(p) k
#> ATC:mclust 81         2.58e-18 2.22e-15 2
#> ATC:mclust 81         2.64e-23 5.91e-13 3
#> ATC:mclust 78         9.56e-22 1.24e-10 4
#> ATC:mclust 70         1.20e-21 1.07e-09 5
#> ATC:mclust 77         1.48e-22 1.54e-08 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 19175 rows and 81 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.970       0.987         0.5032 0.496   0.496
#> 3 3 0.953           0.942       0.976         0.2792 0.811   0.635
#> 4 4 0.733           0.738       0.854         0.1256 0.822   0.571
#> 5 5 0.864           0.868       0.922         0.0861 0.881   0.625
#> 6 6 0.771           0.768       0.859         0.0194 0.954   0.794

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
#> GSM509706     1   0.000      0.978 1.000 0.000
#> GSM509711     1   0.000      0.978 1.000 0.000
#> GSM509714     1   0.000      0.978 1.000 0.000
#> GSM509719     1   0.000      0.978 1.000 0.000
#> GSM509724     1   0.000      0.978 1.000 0.000
#> GSM509729     1   0.000      0.978 1.000 0.000
#> GSM509707     1   0.000      0.978 1.000 0.000
#> GSM509712     1   0.000      0.978 1.000 0.000
#> GSM509715     2   0.000      0.993 0.000 1.000
#> GSM509720     1   0.000      0.978 1.000 0.000
#> GSM509725     1   0.000      0.978 1.000 0.000
#> GSM509730     1   0.000      0.978 1.000 0.000
#> GSM509708     1   0.000      0.978 1.000 0.000
#> GSM509713     1   0.000      0.978 1.000 0.000
#> GSM509716     2   0.000      0.993 0.000 1.000
#> GSM509721     1   0.000      0.978 1.000 0.000
#> GSM509726     1   0.000      0.978 1.000 0.000
#> GSM509731     1   0.469      0.885 0.900 0.100
#> GSM509709     1   0.000      0.978 1.000 0.000
#> GSM509717     2   0.000      0.993 0.000 1.000
#> GSM509722     1   0.000      0.978 1.000 0.000
#> GSM509727     1   0.000      0.978 1.000 0.000
#> GSM509710     1   0.000      0.978 1.000 0.000
#> GSM509718     2   0.000      0.993 0.000 1.000
#> GSM509723     1   0.000      0.978 1.000 0.000
#> GSM509728     1   0.000      0.978 1.000 0.000
#> GSM509732     1   0.141      0.963 0.980 0.020
#> GSM509736     1   0.000      0.978 1.000 0.000
#> GSM509741     1   0.000      0.978 1.000 0.000
#> GSM509746     1   0.141      0.963 0.980 0.020
#> GSM509733     2   0.788      0.680 0.236 0.764
#> GSM509737     1   0.000      0.978 1.000 0.000
#> GSM509742     1   0.861      0.620 0.716 0.284
#> GSM509747     1   0.000      0.978 1.000 0.000
#> GSM509734     1   0.000      0.978 1.000 0.000
#> GSM509738     1   0.000      0.978 1.000 0.000
#> GSM509743     2   0.295      0.939 0.052 0.948
#> GSM509748     1   0.000      0.978 1.000 0.000
#> GSM509735     1   0.000      0.978 1.000 0.000
#> GSM509739     1   0.000      0.978 1.000 0.000
#> GSM509744     1   0.891      0.573 0.692 0.308
#> GSM509749     1   0.358      0.919 0.932 0.068
#> GSM509740     1   0.000      0.978 1.000 0.000
#> GSM509745     1   0.000      0.978 1.000 0.000
#> GSM509750     2   0.000      0.993 0.000 1.000
#> GSM509751     2   0.000      0.993 0.000 1.000
#> GSM509753     2   0.000      0.993 0.000 1.000
#> GSM509755     2   0.000      0.993 0.000 1.000
#> GSM509757     2   0.000      0.993 0.000 1.000
#> GSM509759     2   0.000      0.993 0.000 1.000
#> GSM509761     2   0.000      0.993 0.000 1.000
#> GSM509763     2   0.000      0.993 0.000 1.000
#> GSM509765     2   0.000      0.993 0.000 1.000
#> GSM509767     2   0.000      0.993 0.000 1.000
#> GSM509769     2   0.000      0.993 0.000 1.000
#> GSM509771     2   0.000      0.993 0.000 1.000
#> GSM509773     2   0.000      0.993 0.000 1.000
#> GSM509775     2   0.000      0.993 0.000 1.000
#> GSM509777     2   0.000      0.993 0.000 1.000
#> GSM509779     2   0.000      0.993 0.000 1.000
#> GSM509781     2   0.000      0.993 0.000 1.000
#> GSM509783     2   0.000      0.993 0.000 1.000
#> GSM509785     2   0.000      0.993 0.000 1.000
#> GSM509752     2   0.000      0.993 0.000 1.000
#> GSM509754     2   0.000      0.993 0.000 1.000
#> GSM509756     2   0.000      0.993 0.000 1.000
#> GSM509758     2   0.000      0.993 0.000 1.000
#> GSM509760     2   0.000      0.993 0.000 1.000
#> GSM509762     2   0.000      0.993 0.000 1.000
#> GSM509764     2   0.000      0.993 0.000 1.000
#> GSM509766     2   0.000      0.993 0.000 1.000
#> GSM509768     2   0.000      0.993 0.000 1.000
#> GSM509770     2   0.000      0.993 0.000 1.000
#> GSM509772     2   0.000      0.993 0.000 1.000
#> GSM509774     2   0.000      0.993 0.000 1.000
#> GSM509776     2   0.000      0.993 0.000 1.000
#> GSM509778     2   0.000      0.993 0.000 1.000
#> GSM509780     2   0.000      0.993 0.000 1.000
#> GSM509782     2   0.000      0.993 0.000 1.000
#> GSM509784     2   0.000      0.993 0.000 1.000
#> GSM509786     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
#> GSM509706     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509711     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509714     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509719     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509724     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509729     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509707     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509712     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509715     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509720     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509725     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509730     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509708     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509713     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509716     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509721     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509726     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509731     1  0.4399      0.740 0.812 0.188 0.000
#> GSM509709     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509717     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509722     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509727     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509710     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509718     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509723     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509728     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509732     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509736     1  0.0237      0.988 0.996 0.000 0.004
#> GSM509741     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509746     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509733     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509737     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509742     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509747     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509734     3  0.5216      0.613 0.260 0.000 0.740
#> GSM509738     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509743     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509748     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509735     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509739     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509744     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509749     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509740     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509745     1  0.0000      0.992 1.000 0.000 0.000
#> GSM509750     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509751     2  0.4291      0.776 0.000 0.820 0.180
#> GSM509753     2  0.2711      0.900 0.000 0.912 0.088
#> GSM509755     2  0.2165      0.926 0.000 0.936 0.064
#> GSM509757     3  0.4121      0.767 0.000 0.168 0.832
#> GSM509759     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509761     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509763     2  0.0237      0.983 0.000 0.996 0.004
#> GSM509765     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509767     3  0.6295      0.141 0.000 0.472 0.528
#> GSM509769     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509771     3  0.6026      0.419 0.000 0.376 0.624
#> GSM509773     2  0.0237      0.983 0.000 0.996 0.004
#> GSM509775     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509777     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509779     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509781     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509783     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509785     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509752     2  0.0237      0.983 0.000 0.996 0.004
#> GSM509754     2  0.0237      0.983 0.000 0.996 0.004
#> GSM509756     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509758     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509760     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509762     2  0.0237      0.983 0.000 0.996 0.004
#> GSM509764     2  0.3340      0.861 0.000 0.880 0.120
#> GSM509766     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509768     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509770     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509772     3  0.0000      0.915 0.000 0.000 1.000
#> GSM509774     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509776     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509778     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509780     2  0.0237      0.983 0.000 0.996 0.004
#> GSM509782     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509784     2  0.0000      0.985 0.000 1.000 0.000
#> GSM509786     2  0.0000      0.985 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
#> GSM509706     1  0.0188     0.9850 0.996 0.000 0.000 0.004
#> GSM509711     1  0.0817     0.9735 0.976 0.000 0.000 0.024
#> GSM509714     1  0.0592     0.9802 0.984 0.000 0.000 0.016
#> GSM509719     1  0.0336     0.9850 0.992 0.000 0.000 0.008
#> GSM509724     1  0.0469     0.9826 0.988 0.000 0.000 0.012
#> GSM509729     1  0.1022     0.9680 0.968 0.000 0.000 0.032
#> GSM509707     1  0.0592     0.9800 0.984 0.000 0.000 0.016
#> GSM509712     1  0.0336     0.9842 0.992 0.000 0.000 0.008
#> GSM509715     4  0.3257     0.6163 0.000 0.152 0.004 0.844
#> GSM509720     1  0.0336     0.9842 0.992 0.000 0.000 0.008
#> GSM509725     1  0.0336     0.9842 0.992 0.000 0.000 0.008
#> GSM509730     1  0.1118     0.9656 0.964 0.000 0.000 0.036
#> GSM509708     1  0.0336     0.9854 0.992 0.000 0.000 0.008
#> GSM509713     1  0.0188     0.9850 0.996 0.000 0.000 0.004
#> GSM509716     4  0.3377     0.6255 0.012 0.140 0.000 0.848
#> GSM509721     1  0.1297     0.9607 0.964 0.020 0.000 0.016
#> GSM509726     1  0.0592     0.9802 0.984 0.000 0.000 0.016
#> GSM509731     4  0.5532     0.5670 0.228 0.068 0.000 0.704
#> GSM509709     1  0.0336     0.9853 0.992 0.000 0.000 0.008
#> GSM509717     4  0.3123     0.6113 0.000 0.156 0.000 0.844
#> GSM509722     1  0.0188     0.9848 0.996 0.000 0.000 0.004
#> GSM509727     4  0.5936     0.4699 0.324 0.000 0.056 0.620
#> GSM509710     1  0.0469     0.9823 0.988 0.000 0.000 0.012
#> GSM509718     4  0.3257     0.6173 0.004 0.152 0.000 0.844
#> GSM509723     1  0.0707     0.9785 0.980 0.000 0.000 0.020
#> GSM509728     3  0.7042     0.2912 0.132 0.000 0.516 0.352
#> GSM509732     3  0.1022     0.8217 0.000 0.000 0.968 0.032
#> GSM509736     4  0.7602    -0.0484 0.200 0.000 0.380 0.420
#> GSM509741     3  0.0817     0.8280 0.000 0.000 0.976 0.024
#> GSM509746     3  0.1022     0.8217 0.000 0.000 0.968 0.032
#> GSM509733     3  0.0921     0.8236 0.000 0.000 0.972 0.028
#> GSM509737     3  0.5056     0.6959 0.076 0.000 0.760 0.164
#> GSM509742     3  0.0469     0.8293 0.000 0.000 0.988 0.012
#> GSM509747     3  0.2076     0.8084 0.008 0.004 0.932 0.056
#> GSM509734     3  0.2214     0.8033 0.044 0.000 0.928 0.028
#> GSM509738     4  0.6011    -0.2841 0.040 0.000 0.480 0.480
#> GSM509743     3  0.2921     0.7791 0.000 0.000 0.860 0.140
#> GSM509748     3  0.0921     0.8236 0.000 0.000 0.972 0.028
#> GSM509735     1  0.0188     0.9850 0.996 0.000 0.000 0.004
#> GSM509739     1  0.0336     0.9836 0.992 0.000 0.000 0.008
#> GSM509744     3  0.4564     0.5673 0.000 0.000 0.672 0.328
#> GSM509749     3  0.0336     0.8292 0.000 0.000 0.992 0.008
#> GSM509740     4  0.6400     0.3309 0.408 0.000 0.068 0.524
#> GSM509745     3  0.5699     0.4407 0.032 0.000 0.588 0.380
#> GSM509750     3  0.2973     0.7763 0.000 0.000 0.856 0.144
#> GSM509751     2  0.3587     0.7205 0.000 0.856 0.040 0.104
#> GSM509753     2  0.3634     0.7205 0.000 0.856 0.048 0.096
#> GSM509755     2  0.3612     0.7204 0.000 0.856 0.044 0.100
#> GSM509757     2  0.4389     0.6861 0.000 0.812 0.072 0.116
#> GSM509759     2  0.6928     0.2053 0.000 0.512 0.372 0.116
#> GSM509761     2  0.0336     0.7891 0.000 0.992 0.000 0.008
#> GSM509763     2  0.2589     0.7855 0.000 0.884 0.000 0.116
#> GSM509765     2  0.2216     0.7907 0.000 0.908 0.000 0.092
#> GSM509767     2  0.3958     0.7383 0.000 0.836 0.052 0.112
#> GSM509769     2  0.0188     0.7897 0.000 0.996 0.000 0.004
#> GSM509771     2  0.4356     0.7254 0.000 0.812 0.064 0.124
#> GSM509773     2  0.1557     0.7943 0.000 0.944 0.000 0.056
#> GSM509775     2  0.2704     0.7830 0.000 0.876 0.000 0.124
#> GSM509777     2  0.2760     0.7818 0.000 0.872 0.000 0.128
#> GSM509779     2  0.4454     0.6481 0.000 0.692 0.000 0.308
#> GSM509781     2  0.4972     0.4329 0.000 0.544 0.000 0.456
#> GSM509783     2  0.4916     0.4931 0.000 0.576 0.000 0.424
#> GSM509785     2  0.4977     0.4242 0.000 0.540 0.000 0.460
#> GSM509752     2  0.0895     0.7829 0.000 0.976 0.004 0.020
#> GSM509754     2  0.0188     0.7881 0.000 0.996 0.000 0.004
#> GSM509756     2  0.0592     0.7849 0.000 0.984 0.000 0.016
#> GSM509758     2  0.0817     0.7922 0.000 0.976 0.000 0.024
#> GSM509760     2  0.1389     0.7940 0.000 0.952 0.000 0.048
#> GSM509762     2  0.0817     0.7824 0.000 0.976 0.000 0.024
#> GSM509764     2  0.2714     0.7388 0.000 0.884 0.004 0.112
#> GSM509766     2  0.1792     0.7937 0.000 0.932 0.000 0.068
#> GSM509768     2  0.2647     0.7848 0.000 0.880 0.000 0.120
#> GSM509770     2  0.2216     0.7918 0.000 0.908 0.000 0.092
#> GSM509772     2  0.6134     0.5138 0.000 0.668 0.216 0.116
#> GSM509774     2  0.3569     0.7449 0.000 0.804 0.000 0.196
#> GSM509776     2  0.3764     0.7304 0.000 0.784 0.000 0.216
#> GSM509778     2  0.4790     0.5603 0.000 0.620 0.000 0.380
#> GSM509780     2  0.2814     0.7810 0.000 0.868 0.000 0.132
#> GSM509782     2  0.4877     0.5191 0.000 0.592 0.000 0.408
#> GSM509784     2  0.4643     0.6069 0.000 0.656 0.000 0.344
#> GSM509786     2  0.4967     0.4410 0.000 0.548 0.000 0.452

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM509706     1  0.0404      0.964 0.988 0.000 0.000 0.000 0.012
#> GSM509711     1  0.1270      0.956 0.948 0.000 0.000 0.000 0.052
#> GSM509714     1  0.1043      0.960 0.960 0.000 0.000 0.000 0.040
#> GSM509719     1  0.1364      0.951 0.952 0.036 0.000 0.000 0.012
#> GSM509724     1  0.1544      0.947 0.932 0.000 0.000 0.000 0.068
#> GSM509729     1  0.1282      0.951 0.952 0.000 0.004 0.000 0.044
#> GSM509707     1  0.0703      0.962 0.976 0.000 0.000 0.000 0.024
#> GSM509712     1  0.0290      0.965 0.992 0.000 0.000 0.000 0.008
#> GSM509715     5  0.2561      0.816 0.000 0.000 0.000 0.144 0.856
#> GSM509720     1  0.0963      0.961 0.964 0.000 0.000 0.000 0.036
#> GSM509725     1  0.1197      0.957 0.952 0.000 0.000 0.000 0.048
#> GSM509730     1  0.2304      0.920 0.908 0.000 0.048 0.000 0.044
#> GSM509708     1  0.0290      0.966 0.992 0.000 0.000 0.000 0.008
#> GSM509713     1  0.0703      0.962 0.976 0.000 0.000 0.000 0.024
#> GSM509716     5  0.2424      0.819 0.000 0.000 0.000 0.132 0.868
#> GSM509721     1  0.2329      0.865 0.876 0.124 0.000 0.000 0.000
#> GSM509726     1  0.1732      0.939 0.920 0.000 0.000 0.000 0.080
#> GSM509731     4  0.1444      0.875 0.040 0.000 0.000 0.948 0.012
#> GSM509709     1  0.0609      0.965 0.980 0.000 0.000 0.000 0.020
#> GSM509717     5  0.2561      0.816 0.000 0.000 0.000 0.144 0.856
#> GSM509722     1  0.0162      0.966 0.996 0.000 0.000 0.000 0.004
#> GSM509727     5  0.1205      0.817 0.040 0.000 0.004 0.000 0.956
#> GSM509710     1  0.0510      0.966 0.984 0.000 0.000 0.000 0.016
#> GSM509718     5  0.2773      0.800 0.000 0.000 0.000 0.164 0.836
#> GSM509723     1  0.0955      0.959 0.968 0.004 0.000 0.000 0.028
#> GSM509728     5  0.1952      0.824 0.004 0.000 0.084 0.000 0.912
#> GSM509732     3  0.0290      0.949 0.000 0.008 0.992 0.000 0.000
#> GSM509736     5  0.1564      0.823 0.024 0.004 0.024 0.000 0.948
#> GSM509741     3  0.1410      0.941 0.000 0.000 0.940 0.000 0.060
#> GSM509746     3  0.0404      0.949 0.000 0.012 0.988 0.000 0.000
#> GSM509733     3  0.0510      0.947 0.000 0.016 0.984 0.000 0.000
#> GSM509737     5  0.4727      0.233 0.016 0.000 0.452 0.000 0.532
#> GSM509742     3  0.1410      0.941 0.000 0.000 0.940 0.000 0.060
#> GSM509747     3  0.0451      0.947 0.000 0.008 0.988 0.000 0.004
#> GSM509734     3  0.0566      0.948 0.004 0.000 0.984 0.000 0.012
#> GSM509738     5  0.1965      0.820 0.000 0.000 0.096 0.000 0.904
#> GSM509743     5  0.3395      0.706 0.000 0.000 0.236 0.000 0.764
#> GSM509748     3  0.0290      0.949 0.000 0.008 0.992 0.000 0.000
#> GSM509735     1  0.0404      0.966 0.988 0.000 0.000 0.000 0.012
#> GSM509739     1  0.0510      0.964 0.984 0.000 0.000 0.000 0.016
#> GSM509744     5  0.2561      0.796 0.000 0.000 0.144 0.000 0.856
#> GSM509749     3  0.1270      0.944 0.000 0.000 0.948 0.000 0.052
#> GSM509740     5  0.3300      0.673 0.204 0.000 0.004 0.000 0.792
#> GSM509745     3  0.1732      0.927 0.000 0.000 0.920 0.000 0.080
#> GSM509750     3  0.2929      0.799 0.000 0.000 0.820 0.000 0.180
#> GSM509751     2  0.0162      0.891 0.000 0.996 0.000 0.004 0.000
#> GSM509753     2  0.0000      0.890 0.000 1.000 0.000 0.000 0.000
#> GSM509755     2  0.0000      0.890 0.000 1.000 0.000 0.000 0.000
#> GSM509757     2  0.0162      0.891 0.000 0.996 0.000 0.004 0.000
#> GSM509759     2  0.0000      0.890 0.000 1.000 0.000 0.000 0.000
#> GSM509761     2  0.1270      0.880 0.000 0.948 0.000 0.052 0.000
#> GSM509763     4  0.3913      0.451 0.000 0.324 0.000 0.676 0.000
#> GSM509765     2  0.3661      0.696 0.000 0.724 0.000 0.276 0.000
#> GSM509767     2  0.3381      0.796 0.000 0.808 0.016 0.176 0.000
#> GSM509769     2  0.0880      0.888 0.000 0.968 0.000 0.032 0.000
#> GSM509771     2  0.6410      0.396 0.000 0.504 0.284 0.212 0.000
#> GSM509773     2  0.2648      0.821 0.000 0.848 0.000 0.152 0.000
#> GSM509775     2  0.3966      0.596 0.000 0.664 0.000 0.336 0.000
#> GSM509777     4  0.1410      0.912 0.000 0.060 0.000 0.940 0.000
#> GSM509779     4  0.0880      0.925 0.000 0.032 0.000 0.968 0.000
#> GSM509781     4  0.0000      0.924 0.000 0.000 0.000 1.000 0.000
#> GSM509783     4  0.0000      0.924 0.000 0.000 0.000 1.000 0.000
#> GSM509785     4  0.0000      0.924 0.000 0.000 0.000 1.000 0.000
#> GSM509752     2  0.0162      0.891 0.000 0.996 0.000 0.004 0.000
#> GSM509754     2  0.0290      0.892 0.000 0.992 0.000 0.008 0.000
#> GSM509756     2  0.0290      0.892 0.000 0.992 0.000 0.008 0.000
#> GSM509758     2  0.0963      0.887 0.000 0.964 0.000 0.036 0.000
#> GSM509760     2  0.0404      0.892 0.000 0.988 0.000 0.012 0.000
#> GSM509762     2  0.0290      0.892 0.000 0.992 0.000 0.008 0.000
#> GSM509764     2  0.0000      0.890 0.000 1.000 0.000 0.000 0.000
#> GSM509766     2  0.3242      0.767 0.000 0.784 0.000 0.216 0.000
#> GSM509768     2  0.3480      0.732 0.000 0.752 0.000 0.248 0.000
#> GSM509770     2  0.0510      0.891 0.000 0.984 0.000 0.016 0.000
#> GSM509772     2  0.0162      0.891 0.000 0.996 0.000 0.004 0.000
#> GSM509774     4  0.1732      0.896 0.000 0.080 0.000 0.920 0.000
#> GSM509776     2  0.3816      0.653 0.000 0.696 0.000 0.304 0.000
#> GSM509778     4  0.0000      0.924 0.000 0.000 0.000 1.000 0.000
#> GSM509780     4  0.1608      0.904 0.000 0.072 0.000 0.928 0.000
#> GSM509782     4  0.0510      0.926 0.000 0.016 0.000 0.984 0.000
#> GSM509784     4  0.1121      0.921 0.000 0.044 0.000 0.956 0.000
#> GSM509786     4  0.0000      0.924 0.000 0.000 0.000 1.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
#> GSM509706     1  0.0458      0.889 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM509711     1  0.1391      0.876 0.944 0.000 0.000 0.000 0.040 0.016
#> GSM509714     1  0.6588     -0.436 0.416 0.000 0.000 0.056 0.376 0.152
#> GSM509719     5  0.4237      0.839 0.244 0.004 0.000 0.000 0.704 0.048
#> GSM509724     1  0.1334      0.877 0.948 0.000 0.000 0.000 0.032 0.020
#> GSM509729     1  0.3074      0.596 0.792 0.000 0.004 0.000 0.200 0.004
#> GSM509707     1  0.0458      0.889 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM509712     1  0.1364      0.864 0.944 0.000 0.000 0.004 0.048 0.004
#> GSM509715     6  0.1921      0.795 0.000 0.000 0.000 0.052 0.032 0.916
#> GSM509720     5  0.5155      0.799 0.188 0.004 0.004 0.000 0.652 0.152
#> GSM509725     1  0.1257      0.879 0.952 0.000 0.000 0.000 0.028 0.020
#> GSM509730     5  0.5140      0.486 0.424 0.000 0.052 0.008 0.512 0.004
#> GSM509708     1  0.0291      0.893 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM509713     1  0.0260      0.892 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM509716     6  0.1719      0.795 0.004 0.000 0.000 0.032 0.032 0.932
#> GSM509721     5  0.4914      0.823 0.176 0.056 0.000 0.000 0.708 0.060
#> GSM509726     1  0.1341      0.877 0.948 0.000 0.000 0.000 0.028 0.024
#> GSM509731     4  0.2401      0.604 0.048 0.000 0.000 0.900 0.028 0.024
#> GSM509709     1  0.0508      0.892 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM509717     6  0.2277      0.787 0.000 0.000 0.000 0.076 0.032 0.892
#> GSM509722     5  0.4177      0.852 0.216 0.000 0.004 0.000 0.724 0.056
#> GSM509727     6  0.1821      0.786 0.040 0.000 0.008 0.000 0.024 0.928
#> GSM509710     1  0.0363      0.891 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM509718     6  0.3387      0.736 0.000 0.000 0.000 0.164 0.040 0.796
#> GSM509723     5  0.3560      0.841 0.204 0.004 0.008 0.000 0.772 0.012
#> GSM509728     6  0.5664      0.534 0.136 0.000 0.232 0.000 0.028 0.604
#> GSM509732     3  0.1500      0.848 0.000 0.012 0.936 0.000 0.052 0.000
#> GSM509736     6  0.2265      0.793 0.012 0.000 0.056 0.000 0.028 0.904
#> GSM509741     3  0.1890      0.858 0.000 0.000 0.916 0.000 0.024 0.060
#> GSM509746     3  0.1426      0.861 0.000 0.016 0.948 0.000 0.028 0.008
#> GSM509733     3  0.0862      0.861 0.000 0.016 0.972 0.000 0.008 0.004
#> GSM509737     6  0.4912      0.379 0.060 0.000 0.368 0.000 0.004 0.568
#> GSM509742     3  0.2094      0.857 0.000 0.004 0.908 0.000 0.024 0.064
#> GSM509747     3  0.1829      0.841 0.000 0.012 0.920 0.000 0.064 0.004
#> GSM509734     3  0.2170      0.848 0.044 0.000 0.916 0.008 0.016 0.016
#> GSM509738     6  0.1349      0.796 0.000 0.000 0.056 0.000 0.004 0.940
#> GSM509743     3  0.4449      0.127 0.000 0.000 0.532 0.000 0.028 0.440
#> GSM509748     3  0.2308      0.817 0.000 0.000 0.880 0.008 0.108 0.004
#> GSM509735     1  0.0820      0.890 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM509739     1  0.0713      0.881 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM509744     6  0.3758      0.484 0.000 0.000 0.324 0.000 0.008 0.668
#> GSM509749     3  0.2066      0.860 0.000 0.000 0.908 0.000 0.040 0.052
#> GSM509740     6  0.3053      0.705 0.020 0.000 0.000 0.000 0.168 0.812
#> GSM509745     3  0.3065      0.800 0.000 0.000 0.820 0.000 0.028 0.152
#> GSM509750     3  0.3587      0.751 0.000 0.000 0.772 0.000 0.040 0.188
#> GSM509751     2  0.0909      0.875 0.000 0.968 0.012 0.000 0.020 0.000
#> GSM509753     2  0.0717      0.878 0.000 0.976 0.008 0.000 0.016 0.000
#> GSM509755     2  0.0972      0.872 0.000 0.964 0.008 0.000 0.028 0.000
#> GSM509757     2  0.1333      0.863 0.000 0.944 0.008 0.000 0.048 0.000
#> GSM509759     2  0.1858      0.828 0.000 0.912 0.012 0.000 0.076 0.000
#> GSM509761     2  0.1049      0.887 0.000 0.960 0.000 0.032 0.008 0.000
#> GSM509763     2  0.3729      0.538 0.000 0.692 0.000 0.296 0.012 0.000
#> GSM509765     2  0.2912      0.787 0.000 0.816 0.000 0.172 0.012 0.000
#> GSM509767     2  0.2349      0.862 0.000 0.892 0.020 0.080 0.008 0.000
#> GSM509769     2  0.1333      0.881 0.000 0.944 0.000 0.048 0.008 0.000
#> GSM509771     2  0.3993      0.779 0.000 0.788 0.060 0.124 0.028 0.000
#> GSM509773     2  0.2118      0.854 0.000 0.888 0.000 0.104 0.008 0.000
#> GSM509775     2  0.2877      0.792 0.000 0.820 0.000 0.168 0.012 0.000
#> GSM509777     4  0.3717      0.552 0.000 0.384 0.000 0.616 0.000 0.000
#> GSM509779     4  0.2969      0.762 0.000 0.224 0.000 0.776 0.000 0.000
#> GSM509781     4  0.2135      0.784 0.000 0.128 0.000 0.872 0.000 0.000
#> GSM509783     4  0.0405      0.702 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM509785     4  0.1663      0.771 0.000 0.088 0.000 0.912 0.000 0.000
#> GSM509752     2  0.0767      0.888 0.000 0.976 0.004 0.012 0.008 0.000
#> GSM509754     2  0.0260      0.888 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM509756     2  0.0891      0.884 0.000 0.968 0.000 0.008 0.024 0.000
#> GSM509758     2  0.0632      0.887 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM509760     2  0.0508      0.887 0.000 0.984 0.000 0.004 0.012 0.000
#> GSM509762     2  0.0508      0.885 0.000 0.984 0.000 0.004 0.012 0.000
#> GSM509764     2  0.3533      0.646 0.000 0.748 0.012 0.000 0.236 0.004
#> GSM509766     2  0.2191      0.844 0.000 0.876 0.000 0.120 0.004 0.000
#> GSM509768     2  0.2680      0.835 0.000 0.856 0.000 0.124 0.016 0.004
#> GSM509770     2  0.1894      0.881 0.000 0.928 0.004 0.040 0.016 0.012
#> GSM509772     2  0.0405      0.886 0.000 0.988 0.008 0.000 0.004 0.000
#> GSM509774     4  0.4157      0.379 0.000 0.444 0.000 0.544 0.012 0.000
#> GSM509776     2  0.3000      0.802 0.000 0.824 0.000 0.156 0.016 0.004
#> GSM509778     4  0.1088      0.697 0.000 0.016 0.000 0.960 0.024 0.000
#> GSM509780     4  0.4066      0.526 0.000 0.392 0.000 0.596 0.012 0.000
#> GSM509782     4  0.2454      0.787 0.000 0.160 0.000 0.840 0.000 0.000
#> GSM509784     4  0.3244      0.725 0.000 0.268 0.000 0.732 0.000 0.000
#> GSM509786     4  0.1663      0.771 0.000 0.088 0.000 0.912 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-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)  time(p) k
#> ATC:NMF 81         3.67e-13 7.52e-11 2
#> ATC:NMF 79         1.35e-17 1.03e-07 3
#> ATC:NMF 70         7.81e-25 5.24e-09 4
#> ATC:NMF 78         9.09e-22 1.39e-08 5
#> ATC:NMF 75         2.99e-20 1.72e-06 6

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

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