cola Report for GDS4198

Date: 2019-12-25 21:17:57 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 51941 rows and 70 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] 51941    70

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:skmeans 3 1.000 0.947 0.980 **
CV:skmeans 3 1.000 0.946 0.978 ** 2
MAD:skmeans 3 1.000 0.965 0.986 **
ATC:kmeans 2 1.000 0.994 0.997 **
ATC:pam 2 1.000 0.991 0.995 **
CV:NMF 3 0.999 0.937 0.976 ** 2
SD:NMF 3 0.980 0.927 0.971 ** 2
ATC:mclust 4 0.965 0.918 0.972 ** 2,3
MAD:NMF 3 0.960 0.935 0.973 ** 2
CV:pam 2 0.940 0.956 0.981 *
CV:kmeans 3 0.923 0.938 0.972 *
MAD:kmeans 3 0.922 0.887 0.953 *
MAD:pam 4 0.918 0.917 0.963 * 3
ATC:skmeans 4 0.904 0.939 0.950 * 2,3
SD:pam 6 0.903 0.824 0.923 * 2
MAD:mclust 3 0.857 0.925 0.958
CV:mclust 3 0.854 0.877 0.945
ATC:NMF 2 0.853 0.891 0.956
SD:mclust 3 0.792 0.871 0.933
SD:kmeans 2 0.742 0.929 0.958
CV:hclust 3 0.738 0.820 0.915
SD:hclust 3 0.712 0.833 0.915
MAD:hclust 3 0.690 0.836 0.915
ATC:hclust 2 0.492 0.711 0.871

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 0.939           0.927       0.972          0.501 0.499   0.499
#> CV:NMF      2 0.939           0.926       0.971          0.503 0.496   0.496
#> MAD:NMF     2 0.939           0.920       0.970          0.501 0.499   0.499
#> ATC:NMF     2 0.853           0.891       0.956          0.497 0.499   0.499
#> SD:skmeans  2 0.857           0.896       0.958          0.500 0.496   0.496
#> CV:skmeans  2 0.941           0.951       0.979          0.505 0.496   0.496
#> MAD:skmeans 2 0.854           0.873       0.952          0.499 0.503   0.503
#> ATC:skmeans 2 1.000           0.955       0.982          0.496 0.499   0.499
#> SD:mclust   2 0.396           0.660       0.812          0.359 0.675   0.675
#> CV:mclust   2 0.352           0.616       0.798          0.357 0.675   0.675
#> MAD:mclust  2 0.258           0.345       0.619          0.344 0.543   0.543
#> ATC:mclust  2 1.000           0.987       0.991          0.475 0.526   0.526
#> SD:kmeans   2 0.742           0.929       0.958          0.485 0.519   0.519
#> CV:kmeans   2 0.731           0.873       0.943          0.489 0.519   0.519
#> MAD:kmeans  2 0.885           0.945       0.973          0.486 0.519   0.519
#> ATC:kmeans  2 1.000           0.994       0.997          0.476 0.526   0.526
#> SD:pam      2 0.940           0.950       0.979          0.465 0.543   0.543
#> CV:pam      2 0.940           0.956       0.981          0.460 0.543   0.543
#> MAD:pam     2 0.856           0.919       0.965          0.470 0.543   0.543
#> ATC:pam     2 1.000           0.991       0.995          0.480 0.519   0.519
#> SD:hclust   2 0.446           0.858       0.863          0.439 0.552   0.552
#> CV:hclust   2 0.578           0.871       0.909          0.461 0.552   0.552
#> MAD:hclust  2 0.649           0.911       0.932          0.454 0.543   0.543
#> ATC:hclust  2 0.492           0.711       0.871          0.457 0.519   0.519
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.980           0.927       0.971          0.347 0.713   0.484
#> CV:NMF      3 0.999           0.937       0.976          0.342 0.740   0.520
#> MAD:NMF     3 0.960           0.935       0.973          0.346 0.721   0.496
#> ATC:NMF     3 0.706           0.790       0.908          0.264 0.814   0.649
#> SD:skmeans  3 1.000           0.947       0.980          0.349 0.741   0.522
#> CV:skmeans  3 1.000           0.946       0.978          0.332 0.761   0.552
#> MAD:skmeans 3 1.000           0.965       0.986          0.349 0.751   0.539
#> ATC:skmeans 3 1.000           0.995       0.998          0.282 0.839   0.687
#> SD:mclust   3 0.792           0.871       0.933          0.784 0.590   0.436
#> CV:mclust   3 0.854           0.877       0.945          0.792 0.583   0.431
#> MAD:mclust  3 0.857           0.925       0.958          0.855 0.602   0.395
#> ATC:mclust  3 0.959           0.938       0.973          0.402 0.721   0.511
#> SD:kmeans   3 0.885           0.861       0.943          0.387 0.758   0.554
#> CV:kmeans   3 0.923           0.938       0.972          0.381 0.736   0.524
#> MAD:kmeans  3 0.922           0.887       0.953          0.385 0.738   0.527
#> ATC:kmeans  3 0.704           0.851       0.905          0.383 0.755   0.554
#> SD:pam      3 0.752           0.871       0.922          0.426 0.725   0.519
#> CV:pam      3 0.727           0.694       0.872          0.397 0.803   0.646
#> MAD:pam     3 0.924           0.917       0.964          0.434 0.762   0.569
#> ATC:pam     3 0.899           0.909       0.963          0.391 0.716   0.500
#> SD:hclust   3 0.712           0.833       0.915          0.511 0.774   0.591
#> CV:hclust   3 0.738           0.820       0.915          0.433 0.784   0.609
#> MAD:hclust  3 0.690           0.836       0.915          0.462 0.783   0.600
#> ATC:hclust  3 0.360           0.384       0.740          0.283 0.725   0.556
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.799           0.853       0.920         0.1020 0.906   0.722
#> CV:NMF      4 0.770           0.816       0.898         0.1033 0.916   0.748
#> MAD:NMF     4 0.818           0.837       0.924         0.1032 0.910   0.733
#> ATC:NMF     4 0.589           0.614       0.790         0.1272 0.876   0.690
#> SD:skmeans  4 0.798           0.823       0.897         0.1069 0.878   0.654
#> CV:skmeans  4 0.798           0.827       0.894         0.1083 0.887   0.678
#> MAD:skmeans 4 0.815           0.794       0.893         0.1054 0.853   0.595
#> ATC:skmeans 4 0.904           0.939       0.950         0.1109 0.923   0.791
#> SD:mclust   4 0.805           0.832       0.899         0.1217 0.757   0.451
#> CV:mclust   4 0.877           0.828       0.915         0.1557 0.765   0.457
#> MAD:mclust  4 0.700           0.769       0.844         0.1176 0.836   0.621
#> ATC:mclust  4 0.965           0.918       0.972         0.0330 0.978   0.933
#> SD:kmeans   4 0.699           0.720       0.835         0.0919 0.895   0.697
#> CV:kmeans   4 0.725           0.754       0.860         0.0914 0.921   0.762
#> MAD:kmeans  4 0.684           0.524       0.730         0.0934 0.864   0.648
#> ATC:kmeans  4 0.639           0.517       0.774         0.1137 0.935   0.817
#> SD:pam      4 0.848           0.870       0.900         0.1077 0.934   0.799
#> CV:pam      4 0.766           0.851       0.930         0.1471 0.824   0.566
#> MAD:pam     4 0.918           0.917       0.963         0.0892 0.934   0.799
#> ATC:pam     4 0.841           0.806       0.900         0.0631 0.924   0.774
#> SD:hclust   4 0.673           0.626       0.824         0.0823 0.992   0.975
#> CV:hclust   4 0.703           0.570       0.801         0.0942 0.877   0.663
#> MAD:hclust  4 0.683           0.747       0.869         0.0531 0.990   0.971
#> ATC:hclust  4 0.566           0.715       0.802         0.1796 0.763   0.523
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.785           0.759       0.884         0.0478 0.895   0.640
#> CV:NMF      5 0.763           0.730       0.862         0.0524 0.937   0.769
#> MAD:NMF     5 0.804           0.790       0.906         0.0440 0.901   0.657
#> ATC:NMF     5 0.738           0.729       0.855         0.0817 0.900   0.690
#> SD:skmeans  5 0.809           0.786       0.839         0.0615 0.939   0.769
#> CV:skmeans  5 0.735           0.717       0.796         0.0619 0.954   0.826
#> MAD:skmeans 5 0.777           0.704       0.823         0.0646 0.918   0.702
#> ATC:skmeans 5 0.793           0.815       0.855         0.0666 1.000   1.000
#> SD:mclust   5 0.843           0.840       0.908         0.0646 0.867   0.582
#> CV:mclust   5 0.802           0.767       0.861         0.0473 0.861   0.558
#> MAD:mclust  5 0.687           0.708       0.799         0.0812 0.842   0.550
#> ATC:mclust  5 0.779           0.735       0.886         0.0687 0.962   0.881
#> SD:kmeans   5 0.716           0.638       0.731         0.0645 0.907   0.703
#> CV:kmeans   5 0.693           0.671       0.749         0.0647 0.904   0.663
#> MAD:kmeans  5 0.681           0.557       0.771         0.0655 0.827   0.525
#> ATC:kmeans  5 0.632           0.566       0.679         0.0561 0.848   0.545
#> SD:pam      5 0.793           0.716       0.875         0.0791 0.854   0.529
#> CV:pam      5 0.800           0.767       0.881         0.0817 0.877   0.579
#> MAD:pam     5 0.763           0.680       0.832         0.0708 0.887   0.623
#> ATC:pam     5 0.861           0.846       0.923         0.0662 0.937   0.784
#> SD:hclust   5 0.639           0.641       0.774         0.0333 0.954   0.855
#> CV:hclust   5 0.665           0.670       0.772         0.0443 0.866   0.597
#> MAD:hclust  5 0.645           0.565       0.774         0.0409 0.947   0.836
#> ATC:hclust  5 0.654           0.478       0.784         0.0781 0.971   0.908
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.755           0.684       0.839         0.0398 0.901   0.610
#> CV:NMF      6 0.766           0.675       0.835         0.0406 0.919   0.673
#> MAD:NMF     6 0.750           0.585       0.806         0.0345 0.935   0.741
#> ATC:NMF     6 0.715           0.618       0.809         0.0517 0.920   0.692
#> SD:skmeans  6 0.752           0.604       0.756         0.0435 0.923   0.661
#> CV:skmeans  6 0.739           0.688       0.801         0.0411 0.945   0.760
#> MAD:skmeans 6 0.813           0.787       0.864         0.0465 0.918   0.645
#> ATC:skmeans 6 0.752           0.754       0.835         0.0492 0.889   0.630
#> SD:mclust   6 0.784           0.812       0.879         0.0470 0.968   0.863
#> CV:mclust   6 0.826           0.813       0.884         0.0421 0.939   0.755
#> MAD:mclust  6 0.712           0.603       0.799         0.0598 0.904   0.601
#> ATC:mclust  6 0.816           0.831       0.893         0.0952 0.854   0.531
#> SD:kmeans   6 0.735           0.626       0.804         0.0447 0.905   0.658
#> CV:kmeans   6 0.731           0.628       0.794         0.0432 0.946   0.768
#> MAD:kmeans  6 0.744           0.572       0.772         0.0417 0.911   0.666
#> ATC:kmeans  6 0.683           0.571       0.733         0.0468 0.894   0.577
#> SD:pam      6 0.903           0.824       0.923         0.0426 0.929   0.686
#> CV:pam      6 0.831           0.750       0.878         0.0386 0.942   0.727
#> MAD:pam     6 0.817           0.802       0.897         0.0505 0.914   0.641
#> ATC:pam     6 0.803           0.657       0.803         0.0618 0.937   0.760
#> SD:hclust   6 0.680           0.632       0.749         0.0342 0.968   0.886
#> CV:hclust   6 0.727           0.707       0.816         0.0356 0.941   0.779
#> MAD:hclust  6 0.694           0.635       0.745         0.0513 0.949   0.835
#> ATC:hclust  6 0.661           0.591       0.779         0.0281 0.926   0.761

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) k
#> SD:NMF      67         2.39e-12 2
#> CV:NMF      67         2.39e-12 2
#> MAD:NMF     66         1.48e-12 2
#> ATC:NMF     67         3.15e-09 2
#> SD:skmeans  65         7.29e-13 2
#> CV:skmeans  69         1.89e-12 2
#> MAD:skmeans 63         1.31e-13 2
#> ATC:skmeans 67         8.69e-14 2
#> SD:mclust   61         3.75e-10 2
#> CV:mclust   49         1.67e-09 2
#> MAD:mclust  10               NA 2
#> ATC:mclust  70         3.65e-14 2
#> SD:kmeans   70         4.52e-15 2
#> CV:kmeans   65         5.10e-14 2
#> MAD:kmeans  70         4.52e-15 2
#> ATC:kmeans  70         3.65e-14 2
#> SD:pam      69         1.08e-10 2
#> CV:pam      70         7.18e-11 2
#> MAD:pam     67         4.94e-11 2
#> ATC:pam     70         4.52e-15 2
#> SD:hclust   70         2.58e-13 2
#> CV:hclust   70         2.58e-13 2
#> MAD:hclust  69         4.07e-13 2
#> ATC:hclust  61         5.68e-14 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) k
#> SD:NMF      67         4.86e-17 3
#> CV:NMF      68         2.11e-17 3
#> MAD:NMF     68         2.04e-18 3
#> ATC:NMF     65         5.59e-17 3
#> SD:skmeans  67         4.19e-20 3
#> CV:skmeans  67         6.59e-20 3
#> MAD:skmeans 69         7.95e-21 3
#> ATC:skmeans 70         5.61e-20 3
#> SD:mclust   68         7.71e-21 3
#> CV:mclust   68         7.71e-21 3
#> MAD:mclust  70         1.47e-21 3
#> ATC:mclust  68         5.56e-15 3
#> SD:kmeans   63         9.58e-19 3
#> CV:kmeans   69         6.20e-19 3
#> MAD:kmeans  64         5.50e-19 3
#> ATC:kmeans  66         1.15e-15 3
#> SD:pam      67         2.09e-15 3
#> CV:pam      51         9.16e-13 3
#> MAD:pam     66         4.47e-16 3
#> ATC:pam     66         3.39e-13 3
#> SD:hclust   66         3.20e-16 3
#> CV:hclust   65         7.83e-18 3
#> MAD:hclust  65         8.17e-16 3
#> ATC:hclust  35         1.74e-11 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) k
#> SD:NMF      66         2.01e-16 4
#> CV:NMF      64         9.73e-16 4
#> MAD:NMF     66         3.97e-17 4
#> ATC:NMF     52         1.93e-18 4
#> SD:skmeans  65         2.72e-20 4
#> CV:skmeans  64         4.80e-20 4
#> MAD:skmeans 63         8.03e-20 4
#> ATC:skmeans 70         6.30e-20 4
#> SD:mclust   66         3.94e-17 4
#> CV:mclust   64         9.28e-17 4
#> MAD:mclust  66         1.33e-18 4
#> ATC:mclust  68         7.55e-17 4
#> SD:kmeans   59         1.06e-14 4
#> CV:kmeans   60         2.38e-17 4
#> MAD:kmeans  36         1.61e-08 4
#> ATC:kmeans  46         1.78e-11 4
#> SD:pam      68         1.34e-15 4
#> CV:pam      65         8.42e-16 4
#> MAD:pam     69         6.18e-16 4
#> ATC:pam     60         3.06e-12 4
#> SD:hclust   56         2.47e-15 4
#> CV:hclust   40         1.46e-08 4
#> MAD:hclust  64         1.66e-15 4
#> ATC:hclust  62         8.16e-15 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) k
#> SD:NMF      63         2.87e-14 5
#> CV:NMF      62         9.95e-15 5
#> MAD:NMF     63         1.14e-12 5
#> ATC:NMF     63         4.17e-22 5
#> SD:skmeans  65         4.83e-19 5
#> CV:skmeans  60         4.36e-17 5
#> MAD:skmeans 59         6.95e-17 5
#> ATC:skmeans 70         6.30e-20 5
#> SD:mclust   65         3.12e-18 5
#> CV:mclust   62         1.83e-18 5
#> MAD:mclust  60         3.09e-16 5
#> ATC:mclust  62         1.87e-14 5
#> SD:kmeans   51         3.89e-16 5
#> CV:kmeans   60         3.77e-17 5
#> MAD:kmeans  54         3.98e-15 5
#> ATC:kmeans  44         7.63e-10 5
#> SD:pam      59         5.79e-17 5
#> CV:pam      60         3.26e-17 5
#> MAD:pam     57         1.81e-16 5
#> ATC:pam     67         1.02e-14 5
#> SD:hclust   56         1.95e-15 5
#> CV:hclust   51         4.58e-13 5
#> MAD:hclust  46         6.98e-10 5
#> ATC:hclust  45         1.46e-13 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) k
#> SD:NMF      57         1.45e-11 6
#> CV:NMF      57         4.68e-12 6
#> MAD:NMF     48         5.85e-13 6
#> ATC:NMF     50         5.95e-17 6
#> SD:skmeans  47         2.62e-12 6
#> CV:skmeans  57         2.37e-15 6
#> MAD:skmeans 67         5.96e-19 6
#> ATC:skmeans 65         5.43e-17 6
#> SD:mclust   68         1.64e-16 6
#> CV:mclust   67         3.88e-17 6
#> MAD:mclust  50         6.91e-13 6
#> ATC:mclust  68         2.12e-19 6
#> SD:kmeans   51         6.10e-13 6
#> CV:kmeans   52         2.45e-14 6
#> MAD:kmeans  48         7.73e-13 6
#> ATC:kmeans  50         6.82e-13 6
#> SD:pam      63         2.14e-15 6
#> CV:pam      59         1.50e-13 6
#> MAD:pam     63         3.20e-13 6
#> ATC:pam     53         3.46e-10 6
#> SD:hclust   50         2.58e-12 6
#> CV:hclust   57         8.96e-14 6
#> MAD:hclust  59         5.69e-13 6
#> ATC:hclust  47         2.93e-14 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 51941 rows and 70 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.446           0.858       0.863         0.4391 0.552   0.552
#> 3 3 0.712           0.833       0.915         0.5106 0.774   0.591
#> 4 4 0.673           0.626       0.824         0.0823 0.992   0.975
#> 5 5 0.639           0.641       0.774         0.0333 0.954   0.855
#> 6 6 0.680           0.632       0.749         0.0342 0.968   0.886

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
#> GSM875413     1  0.1184      0.975 0.984 0.016
#> GSM875415     1  0.0000      0.989 1.000 0.000
#> GSM875416     1  0.1184      0.980 0.984 0.016
#> GSM875417     2  0.9170      0.784 0.332 0.668
#> GSM875418     1  0.0000      0.989 1.000 0.000
#> GSM875423     1  0.0672      0.985 0.992 0.008
#> GSM875424     1  0.1633      0.972 0.976 0.024
#> GSM875425     1  0.1184      0.980 0.984 0.016
#> GSM875430     1  0.0000      0.989 1.000 0.000
#> GSM875432     1  0.0000      0.989 1.000 0.000
#> GSM875435     1  0.0000      0.989 1.000 0.000
#> GSM875436     2  0.8267      0.802 0.260 0.740
#> GSM875437     1  0.0672      0.985 0.992 0.008
#> GSM875447     1  0.0000      0.989 1.000 0.000
#> GSM875451     1  0.0000      0.989 1.000 0.000
#> GSM875456     1  0.0000      0.989 1.000 0.000
#> GSM875461     1  0.0000      0.989 1.000 0.000
#> GSM875462     1  0.1633      0.965 0.976 0.024
#> GSM875465     1  0.2236      0.957 0.964 0.036
#> GSM875469     1  0.0000      0.989 1.000 0.000
#> GSM875470     1  0.1414      0.977 0.980 0.020
#> GSM875471     1  0.1414      0.977 0.980 0.020
#> GSM875472     1  0.0000      0.989 1.000 0.000
#> GSM875475     1  0.0000      0.989 1.000 0.000
#> GSM875476     2  0.8267      0.802 0.260 0.740
#> GSM875477     1  0.0000      0.989 1.000 0.000
#> GSM875414     2  0.8081      0.830 0.248 0.752
#> GSM875427     2  0.8861      0.807 0.304 0.696
#> GSM875431     2  0.8327      0.827 0.264 0.736
#> GSM875433     2  0.8327      0.826 0.264 0.736
#> GSM875443     2  0.9933      0.579 0.452 0.548
#> GSM875444     2  0.9286      0.771 0.344 0.656
#> GSM875445     2  0.8861      0.807 0.304 0.696
#> GSM875449     2  0.9170      0.784 0.332 0.668
#> GSM875450     2  0.9286      0.771 0.344 0.656
#> GSM875452     2  0.8861      0.807 0.304 0.696
#> GSM875454     2  0.8813      0.810 0.300 0.700
#> GSM875457     2  0.9170      0.784 0.332 0.668
#> GSM875458     2  0.9170      0.784 0.332 0.668
#> GSM875467     2  0.9000      0.798 0.316 0.684
#> GSM875468     2  0.9170      0.784 0.332 0.668
#> GSM875412     2  0.2778      0.803 0.048 0.952
#> GSM875419     2  0.5294      0.817 0.120 0.880
#> GSM875420     2  0.0376      0.790 0.004 0.996
#> GSM875421     2  0.8713      0.815 0.292 0.708
#> GSM875422     2  0.8713      0.815 0.292 0.708
#> GSM875426     2  0.8207      0.828 0.256 0.744
#> GSM875428     2  0.8081      0.830 0.248 0.752
#> GSM875429     2  0.0000      0.787 0.000 1.000
#> GSM875434     2  0.5946      0.821 0.144 0.856
#> GSM875438     2  0.0376      0.790 0.004 0.996
#> GSM875439     2  0.0000      0.787 0.000 1.000
#> GSM875440     2  0.8081      0.830 0.248 0.752
#> GSM875441     2  0.0376      0.790 0.004 0.996
#> GSM875442     2  0.4815      0.818 0.104 0.896
#> GSM875446     2  0.0000      0.787 0.000 1.000
#> GSM875448     2  0.0672      0.791 0.008 0.992
#> GSM875453     2  0.0672      0.791 0.008 0.992
#> GSM875455     2  0.0000      0.787 0.000 1.000
#> GSM875459     2  0.0000      0.787 0.000 1.000
#> GSM875460     2  0.6973      0.830 0.188 0.812
#> GSM875463     2  0.0672      0.791 0.008 0.992
#> GSM875464     2  0.0000      0.787 0.000 1.000
#> GSM875466     2  0.8267      0.828 0.260 0.740
#> GSM875473     2  0.8861      0.807 0.304 0.696
#> GSM875474     2  0.0000      0.787 0.000 1.000
#> GSM875478     2  0.0000      0.787 0.000 1.000
#> GSM875479     2  0.0000      0.787 0.000 1.000
#> GSM875480     2  0.8443      0.825 0.272 0.728
#> GSM875481     2  0.8207      0.829 0.256 0.744

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM875413     1  0.0747     0.9679 0.984 0.016 0.000
#> GSM875415     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875416     1  0.2261     0.9374 0.932 0.000 0.068
#> GSM875417     3  0.3412     0.8081 0.124 0.000 0.876
#> GSM875418     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875423     1  0.0747     0.9699 0.984 0.000 0.016
#> GSM875424     1  0.2356     0.9344 0.928 0.000 0.072
#> GSM875425     1  0.2261     0.9374 0.932 0.000 0.068
#> GSM875430     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875432     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875435     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875436     2  0.6798     0.6405 0.256 0.696 0.048
#> GSM875437     1  0.0424     0.9725 0.992 0.008 0.000
#> GSM875447     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875451     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875456     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875461     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875462     1  0.1267     0.9606 0.972 0.024 0.004
#> GSM875465     1  0.2173     0.9498 0.944 0.008 0.048
#> GSM875469     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875470     1  0.2356     0.9339 0.928 0.000 0.072
#> GSM875471     1  0.2356     0.9339 0.928 0.000 0.072
#> GSM875472     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875475     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875476     2  0.6798     0.6405 0.256 0.696 0.048
#> GSM875477     1  0.0000     0.9763 1.000 0.000 0.000
#> GSM875414     3  0.4346     0.7880 0.000 0.184 0.816
#> GSM875427     3  0.0000     0.8598 0.000 0.000 1.000
#> GSM875431     3  0.4033     0.8259 0.008 0.136 0.856
#> GSM875433     3  0.3816     0.8162 0.000 0.148 0.852
#> GSM875443     3  0.4842     0.6984 0.224 0.000 0.776
#> GSM875444     3  0.3412     0.8074 0.124 0.000 0.876
#> GSM875445     3  0.0000     0.8598 0.000 0.000 1.000
#> GSM875449     3  0.1289     0.8588 0.032 0.000 0.968
#> GSM875450     3  0.3267     0.8129 0.116 0.000 0.884
#> GSM875452     3  0.0000     0.8598 0.000 0.000 1.000
#> GSM875454     3  0.1643     0.8625 0.000 0.044 0.956
#> GSM875457     3  0.1289     0.8588 0.032 0.000 0.968
#> GSM875458     3  0.1289     0.8588 0.032 0.000 0.968
#> GSM875467     3  0.0592     0.8604 0.012 0.000 0.988
#> GSM875468     3  0.1289     0.8588 0.032 0.000 0.968
#> GSM875412     2  0.6460     0.0967 0.004 0.556 0.440
#> GSM875419     2  0.7601     0.1973 0.044 0.540 0.416
#> GSM875420     2  0.3192     0.7961 0.000 0.888 0.112
#> GSM875421     3  0.1753     0.8617 0.000 0.048 0.952
#> GSM875422     3  0.1753     0.8617 0.000 0.048 0.952
#> GSM875426     3  0.3941     0.8131 0.000 0.156 0.844
#> GSM875428     3  0.4121     0.8012 0.000 0.168 0.832
#> GSM875429     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875434     2  0.8705     0.2767 0.116 0.524 0.360
#> GSM875438     2  0.3267     0.7928 0.000 0.884 0.116
#> GSM875439     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875440     3  0.5926     0.5140 0.000 0.356 0.644
#> GSM875441     2  0.0237     0.8683 0.000 0.996 0.004
#> GSM875442     2  0.4745     0.7897 0.080 0.852 0.068
#> GSM875446     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875448     2  0.0475     0.8679 0.004 0.992 0.004
#> GSM875453     2  0.0475     0.8679 0.004 0.992 0.004
#> GSM875455     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875459     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875460     3  0.6527     0.3340 0.008 0.404 0.588
#> GSM875463     2  0.0475     0.8679 0.004 0.992 0.004
#> GSM875464     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875466     3  0.6102     0.5687 0.008 0.320 0.672
#> GSM875473     3  0.3039     0.8592 0.036 0.044 0.920
#> GSM875474     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875478     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875479     2  0.0000     0.8693 0.000 1.000 0.000
#> GSM875480     3  0.2772     0.8556 0.004 0.080 0.916
#> GSM875481     3  0.3941     0.8142 0.000 0.156 0.844

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.4564     0.6962 0.672 0.000 0.000 0.328
#> GSM875415     1  0.0188     0.9200 0.996 0.000 0.000 0.004
#> GSM875416     1  0.2867     0.8865 0.884 0.000 0.012 0.104
#> GSM875417     3  0.4401     0.6454 0.076 0.000 0.812 0.112
#> GSM875418     1  0.0592     0.9192 0.984 0.000 0.000 0.016
#> GSM875423     1  0.1792     0.9102 0.932 0.000 0.000 0.068
#> GSM875424     1  0.3099     0.8831 0.876 0.000 0.020 0.104
#> GSM875425     1  0.2928     0.8845 0.880 0.000 0.012 0.108
#> GSM875430     1  0.0707     0.9197 0.980 0.000 0.000 0.020
#> GSM875432     1  0.2149     0.8938 0.912 0.000 0.000 0.088
#> GSM875435     1  0.0592     0.9192 0.984 0.000 0.000 0.016
#> GSM875436     2  0.7016     0.2715 0.172 0.628 0.016 0.184
#> GSM875437     1  0.2266     0.9078 0.912 0.004 0.000 0.084
#> GSM875447     1  0.0188     0.9200 0.996 0.000 0.000 0.004
#> GSM875451     1  0.0707     0.9190 0.980 0.000 0.000 0.020
#> GSM875456     1  0.0469     0.9191 0.988 0.000 0.000 0.012
#> GSM875461     1  0.1474     0.9191 0.948 0.000 0.000 0.052
#> GSM875462     1  0.2987     0.8962 0.880 0.016 0.000 0.104
#> GSM875465     1  0.2457     0.9039 0.912 0.004 0.008 0.076
#> GSM875469     1  0.1389     0.9155 0.952 0.000 0.000 0.048
#> GSM875470     1  0.3048     0.8819 0.876 0.000 0.016 0.108
#> GSM875471     1  0.3048     0.8819 0.876 0.000 0.016 0.108
#> GSM875472     1  0.3649     0.8158 0.796 0.000 0.000 0.204
#> GSM875475     1  0.1211     0.9136 0.960 0.000 0.000 0.040
#> GSM875476     2  0.7016     0.2715 0.172 0.628 0.016 0.184
#> GSM875477     1  0.3837     0.8004 0.776 0.000 0.000 0.224
#> GSM875414     3  0.5384     0.5756 0.000 0.076 0.728 0.196
#> GSM875427     3  0.0000     0.7322 0.000 0.000 1.000 0.000
#> GSM875431     3  0.4860     0.6448 0.004 0.044 0.768 0.184
#> GSM875433     3  0.4916     0.6151 0.000 0.056 0.760 0.184
#> GSM875443     3  0.5705     0.4902 0.180 0.000 0.712 0.108
#> GSM875444     3  0.4419     0.6408 0.084 0.000 0.812 0.104
#> GSM875445     3  0.0000     0.7322 0.000 0.000 1.000 0.000
#> GSM875449     3  0.2593     0.7138 0.016 0.000 0.904 0.080
#> GSM875450     3  0.4285     0.6480 0.076 0.000 0.820 0.104
#> GSM875452     3  0.0000     0.7322 0.000 0.000 1.000 0.000
#> GSM875454     3  0.2530     0.7155 0.000 0.000 0.888 0.112
#> GSM875457     3  0.2593     0.7138 0.016 0.000 0.904 0.080
#> GSM875458     3  0.2593     0.7138 0.016 0.000 0.904 0.080
#> GSM875467     3  0.0524     0.7317 0.004 0.000 0.988 0.008
#> GSM875468     3  0.2593     0.7138 0.016 0.000 0.904 0.080
#> GSM875412     2  0.7808    -0.5926 0.000 0.400 0.344 0.256
#> GSM875419     2  0.8443    -0.8591 0.020 0.368 0.316 0.296
#> GSM875420     2  0.5384     0.2343 0.000 0.648 0.028 0.324
#> GSM875421     3  0.2859     0.7117 0.000 0.008 0.880 0.112
#> GSM875422     3  0.2859     0.7117 0.000 0.008 0.880 0.112
#> GSM875426     3  0.4979     0.6151 0.000 0.064 0.760 0.176
#> GSM875428     3  0.5147     0.5901 0.000 0.060 0.740 0.200
#> GSM875429     2  0.0336     0.6552 0.000 0.992 0.000 0.008
#> GSM875434     4  0.8692     0.0000 0.036 0.348 0.260 0.356
#> GSM875438     2  0.5473     0.2226 0.000 0.644 0.032 0.324
#> GSM875439     2  0.4304     0.4639 0.000 0.716 0.000 0.284
#> GSM875440     3  0.7164     0.0996 0.000 0.240 0.556 0.204
#> GSM875441     2  0.3208     0.6391 0.000 0.848 0.004 0.148
#> GSM875442     2  0.4821     0.4698 0.008 0.768 0.032 0.192
#> GSM875446     2  0.4304     0.4639 0.000 0.716 0.000 0.284
#> GSM875448     2  0.3123     0.6385 0.000 0.844 0.000 0.156
#> GSM875453     2  0.3123     0.6385 0.000 0.844 0.000 0.156
#> GSM875455     2  0.0707     0.6546 0.000 0.980 0.000 0.020
#> GSM875459     2  0.0707     0.6546 0.000 0.980 0.000 0.020
#> GSM875460     3  0.7706    -0.3974 0.004 0.248 0.488 0.260
#> GSM875463     2  0.3123     0.6385 0.000 0.844 0.000 0.156
#> GSM875464     2  0.2469     0.6480 0.000 0.892 0.000 0.108
#> GSM875466     3  0.7254     0.1731 0.004 0.184 0.560 0.252
#> GSM875473     3  0.3953     0.7175 0.020 0.024 0.848 0.108
#> GSM875474     2  0.0707     0.6546 0.000 0.980 0.000 0.020
#> GSM875478     2  0.0707     0.6546 0.000 0.980 0.000 0.020
#> GSM875479     2  0.2469     0.6480 0.000 0.892 0.000 0.108
#> GSM875480     3  0.3994     0.7070 0.004 0.028 0.828 0.140
#> GSM875481     3  0.4979     0.6192 0.000 0.064 0.760 0.176

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     5  0.3814     0.0000 0.276 0.000 0.000 0.004 0.720
#> GSM875415     1  0.0566     0.8812 0.984 0.000 0.000 0.004 0.012
#> GSM875416     1  0.2664     0.8304 0.892 0.000 0.004 0.040 0.064
#> GSM875417     3  0.4517     0.6824 0.084 0.000 0.796 0.056 0.064
#> GSM875418     1  0.0898     0.8789 0.972 0.000 0.000 0.008 0.020
#> GSM875423     1  0.1668     0.8663 0.940 0.000 0.000 0.028 0.032
#> GSM875424     1  0.2864     0.8243 0.884 0.000 0.008 0.044 0.064
#> GSM875425     1  0.2728     0.8271 0.888 0.000 0.004 0.040 0.068
#> GSM875430     1  0.0992     0.8799 0.968 0.000 0.000 0.008 0.024
#> GSM875432     1  0.2580     0.8232 0.892 0.000 0.000 0.044 0.064
#> GSM875435     1  0.0898     0.8789 0.972 0.000 0.000 0.008 0.020
#> GSM875436     2  0.6616     0.3106 0.168 0.540 0.000 0.272 0.020
#> GSM875437     1  0.2267     0.8499 0.916 0.008 0.000 0.028 0.048
#> GSM875447     1  0.0566     0.8812 0.984 0.000 0.000 0.004 0.012
#> GSM875451     1  0.0992     0.8781 0.968 0.000 0.000 0.008 0.024
#> GSM875456     1  0.0865     0.8799 0.972 0.000 0.000 0.004 0.024
#> GSM875461     1  0.1168     0.8784 0.960 0.000 0.000 0.008 0.032
#> GSM875462     1  0.2819     0.8264 0.884 0.004 0.000 0.060 0.052
#> GSM875465     1  0.2297     0.8557 0.920 0.008 0.008 0.020 0.044
#> GSM875469     1  0.1211     0.8740 0.960 0.000 0.000 0.016 0.024
#> GSM875470     1  0.2853     0.8230 0.884 0.000 0.008 0.040 0.068
#> GSM875471     1  0.2853     0.8230 0.884 0.000 0.008 0.040 0.068
#> GSM875472     1  0.4028     0.6234 0.768 0.000 0.000 0.040 0.192
#> GSM875475     1  0.1579     0.8660 0.944 0.000 0.000 0.024 0.032
#> GSM875476     2  0.6616     0.3106 0.168 0.540 0.000 0.272 0.020
#> GSM875477     1  0.4193     0.5807 0.748 0.000 0.000 0.040 0.212
#> GSM875414     3  0.4229     0.6473 0.000 0.020 0.704 0.276 0.000
#> GSM875427     3  0.0000     0.7583 0.000 0.000 1.000 0.000 0.000
#> GSM875431     3  0.4283     0.6996 0.004 0.020 0.748 0.220 0.008
#> GSM875433     3  0.3861     0.6621 0.000 0.008 0.728 0.264 0.000
#> GSM875443     3  0.5412     0.5475 0.192 0.000 0.704 0.048 0.056
#> GSM875444     3  0.4431     0.6784 0.092 0.000 0.800 0.052 0.056
#> GSM875445     3  0.0000     0.7583 0.000 0.000 1.000 0.000 0.000
#> GSM875449     3  0.2919     0.7371 0.024 0.000 0.888 0.044 0.044
#> GSM875450     3  0.4252     0.6871 0.084 0.000 0.812 0.048 0.056
#> GSM875452     3  0.0000     0.7583 0.000 0.000 1.000 0.000 0.000
#> GSM875454     3  0.2445     0.7503 0.000 0.004 0.884 0.108 0.004
#> GSM875457     3  0.2919     0.7371 0.024 0.000 0.888 0.044 0.044
#> GSM875458     3  0.2919     0.7371 0.024 0.000 0.888 0.044 0.044
#> GSM875467     3  0.0451     0.7574 0.008 0.000 0.988 0.000 0.004
#> GSM875468     3  0.2919     0.7371 0.024 0.000 0.888 0.044 0.044
#> GSM875412     4  0.6710     0.2008 0.000 0.264 0.316 0.420 0.000
#> GSM875419     4  0.7389     0.3748 0.020 0.320 0.280 0.376 0.004
#> GSM875420     4  0.6066     0.2491 0.000 0.436 0.020 0.476 0.068
#> GSM875421     3  0.2536     0.7458 0.000 0.004 0.868 0.128 0.000
#> GSM875422     3  0.2488     0.7467 0.000 0.004 0.872 0.124 0.000
#> GSM875426     3  0.4003     0.6727 0.000 0.008 0.740 0.244 0.008
#> GSM875428     3  0.3934     0.6569 0.000 0.008 0.716 0.276 0.000
#> GSM875429     2  0.4629     0.6202 0.000 0.704 0.000 0.244 0.052
#> GSM875434     4  0.7779     0.3749 0.032 0.296 0.232 0.420 0.020
#> GSM875438     4  0.6140     0.2569 0.000 0.432 0.024 0.476 0.068
#> GSM875439     4  0.6394     0.0937 0.000 0.292 0.000 0.504 0.204
#> GSM875440     3  0.6021     0.3383 0.000 0.128 0.524 0.348 0.000
#> GSM875441     2  0.0963     0.6263 0.000 0.964 0.000 0.036 0.000
#> GSM875442     2  0.5185     0.3933 0.004 0.588 0.004 0.372 0.032
#> GSM875446     4  0.6394     0.0937 0.000 0.292 0.000 0.504 0.204
#> GSM875448     2  0.1041     0.6303 0.000 0.964 0.000 0.032 0.004
#> GSM875453     2  0.1041     0.6303 0.000 0.964 0.000 0.032 0.004
#> GSM875455     2  0.4840     0.6120 0.000 0.676 0.000 0.268 0.056
#> GSM875459     2  0.4840     0.6120 0.000 0.676 0.000 0.268 0.056
#> GSM875460     3  0.6666     0.0119 0.004 0.208 0.456 0.332 0.000
#> GSM875463     2  0.1041     0.6303 0.000 0.964 0.000 0.032 0.004
#> GSM875464     2  0.2361     0.6171 0.000 0.892 0.000 0.096 0.012
#> GSM875466     3  0.6173     0.3922 0.004 0.096 0.520 0.372 0.008
#> GSM875473     3  0.4037     0.7477 0.028 0.004 0.820 0.112 0.036
#> GSM875474     2  0.4840     0.6120 0.000 0.676 0.000 0.268 0.056
#> GSM875478     2  0.4840     0.6120 0.000 0.676 0.000 0.268 0.056
#> GSM875479     2  0.2361     0.6171 0.000 0.892 0.000 0.096 0.012
#> GSM875480     3  0.3831     0.7428 0.004 0.016 0.808 0.156 0.016
#> GSM875481     3  0.4110     0.6726 0.000 0.012 0.736 0.244 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
#> GSM875413     5  0.0937     0.0000 0.040 0.000 0.000 0.000 0.960 0.000
#> GSM875415     1  0.0508     0.9070 0.984 0.004 0.000 0.000 0.012 0.000
#> GSM875416     1  0.2516     0.8682 0.884 0.084 0.004 0.004 0.024 0.000
#> GSM875417     3  0.4090     0.6451 0.076 0.104 0.792 0.008 0.020 0.000
#> GSM875418     1  0.0820     0.9055 0.972 0.016 0.000 0.000 0.012 0.000
#> GSM875423     1  0.1606     0.8947 0.932 0.056 0.000 0.004 0.008 0.000
#> GSM875424     1  0.2679     0.8647 0.876 0.088 0.004 0.008 0.024 0.000
#> GSM875425     1  0.2568     0.8659 0.880 0.088 0.004 0.004 0.024 0.000
#> GSM875430     1  0.0909     0.9062 0.968 0.020 0.000 0.000 0.012 0.000
#> GSM875432     1  0.2456     0.8657 0.888 0.076 0.000 0.008 0.028 0.000
#> GSM875435     1  0.0820     0.9055 0.972 0.016 0.000 0.000 0.012 0.000
#> GSM875436     2  0.4671     0.3811 0.160 0.688 0.000 0.152 0.000 0.000
#> GSM875437     1  0.2103     0.8842 0.912 0.056 0.000 0.012 0.020 0.000
#> GSM875447     1  0.0508     0.9070 0.984 0.004 0.000 0.000 0.012 0.000
#> GSM875451     1  0.0914     0.9051 0.968 0.016 0.000 0.000 0.016 0.000
#> GSM875456     1  0.0909     0.9057 0.968 0.020 0.000 0.000 0.012 0.000
#> GSM875461     1  0.1138     0.9056 0.960 0.024 0.000 0.004 0.012 0.000
#> GSM875462     1  0.2797     0.8669 0.876 0.064 0.000 0.036 0.024 0.000
#> GSM875465     1  0.2213     0.8874 0.912 0.048 0.008 0.008 0.024 0.000
#> GSM875469     1  0.1152     0.9004 0.952 0.044 0.000 0.000 0.004 0.000
#> GSM875470     1  0.2679     0.8628 0.876 0.088 0.008 0.004 0.024 0.000
#> GSM875471     1  0.2679     0.8628 0.876 0.088 0.008 0.004 0.024 0.000
#> GSM875472     1  0.4125     0.7277 0.756 0.076 0.000 0.008 0.160 0.000
#> GSM875475     1  0.1511     0.8952 0.940 0.044 0.000 0.004 0.012 0.000
#> GSM875476     2  0.4671     0.3811 0.160 0.688 0.000 0.152 0.000 0.000
#> GSM875477     1  0.4290     0.7047 0.736 0.076 0.000 0.008 0.180 0.000
#> GSM875414     3  0.6118     0.6123 0.000 0.172 0.592 0.192 0.016 0.028
#> GSM875427     3  0.0146     0.7274 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM875431     3  0.5504     0.6622 0.004 0.144 0.652 0.176 0.020 0.004
#> GSM875433     3  0.5511     0.6274 0.000 0.196 0.624 0.164 0.008 0.008
#> GSM875443     3  0.4960     0.5047 0.184 0.080 0.704 0.008 0.024 0.000
#> GSM875444     3  0.4084     0.6414 0.084 0.088 0.796 0.008 0.024 0.000
#> GSM875445     3  0.0291     0.7280 0.000 0.004 0.992 0.004 0.000 0.000
#> GSM875449     3  0.2683     0.7025 0.024 0.060 0.888 0.008 0.020 0.000
#> GSM875450     3  0.3931     0.6499 0.076 0.084 0.808 0.008 0.024 0.000
#> GSM875452     3  0.0146     0.7274 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM875454     3  0.3505     0.7194 0.000 0.068 0.824 0.092 0.016 0.000
#> GSM875457     3  0.2683     0.7025 0.024 0.060 0.888 0.008 0.020 0.000
#> GSM875458     3  0.2683     0.7025 0.024 0.060 0.888 0.008 0.020 0.000
#> GSM875467     3  0.0405     0.7254 0.008 0.000 0.988 0.000 0.004 0.000
#> GSM875468     3  0.2742     0.7009 0.024 0.064 0.884 0.008 0.020 0.000
#> GSM875412     4  0.7551    -0.0584 0.000 0.316 0.232 0.332 0.008 0.112
#> GSM875419     4  0.7099     0.0280 0.012 0.228 0.260 0.452 0.012 0.036
#> GSM875420     6  0.5883     0.4102 0.000 0.088 0.016 0.424 0.012 0.460
#> GSM875421     3  0.3910     0.7128 0.000 0.092 0.792 0.100 0.016 0.000
#> GSM875422     3  0.3816     0.7144 0.000 0.092 0.800 0.092 0.016 0.000
#> GSM875426     3  0.5735     0.6310 0.000 0.180 0.624 0.164 0.008 0.024
#> GSM875428     3  0.5978     0.6176 0.000 0.180 0.600 0.184 0.016 0.020
#> GSM875429     2  0.4833     0.6263 0.000 0.516 0.000 0.056 0.000 0.428
#> GSM875434     4  0.7065     0.0315 0.024 0.260 0.216 0.464 0.028 0.008
#> GSM875438     6  0.5955     0.4076 0.000 0.088 0.020 0.424 0.012 0.456
#> GSM875439     6  0.0000     0.4152 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM875440     3  0.6452     0.3567 0.000 0.336 0.416 0.224 0.000 0.024
#> GSM875441     4  0.4104     0.4427 0.000 0.148 0.000 0.748 0.000 0.104
#> GSM875442     2  0.5153     0.3739 0.000 0.656 0.000 0.220 0.020 0.104
#> GSM875446     6  0.0000     0.4152 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM875448     4  0.3943     0.4689 0.000 0.156 0.000 0.760 0.000 0.084
#> GSM875453     4  0.3943     0.4689 0.000 0.156 0.000 0.760 0.000 0.084
#> GSM875455     2  0.4587     0.6371 0.000 0.508 0.000 0.036 0.000 0.456
#> GSM875459     2  0.4587     0.6371 0.000 0.508 0.000 0.036 0.000 0.456
#> GSM875460     3  0.6405     0.2264 0.000 0.164 0.416 0.392 0.012 0.016
#> GSM875463     4  0.3893     0.4691 0.000 0.156 0.000 0.764 0.000 0.080
#> GSM875464     4  0.5196     0.3502 0.000 0.144 0.000 0.604 0.000 0.252
#> GSM875466     3  0.6426     0.4007 0.004 0.320 0.428 0.236 0.008 0.004
#> GSM875473     3  0.4280     0.7202 0.028 0.084 0.792 0.076 0.020 0.000
#> GSM875474     2  0.4587     0.6371 0.000 0.508 0.000 0.036 0.000 0.456
#> GSM875478     2  0.4587     0.6371 0.000 0.508 0.000 0.036 0.000 0.456
#> GSM875479     4  0.5196     0.3502 0.000 0.144 0.000 0.604 0.000 0.252
#> GSM875480     3  0.4869     0.7080 0.004 0.108 0.728 0.132 0.024 0.004
#> GSM875481     3  0.5583     0.6370 0.000 0.172 0.632 0.172 0.008 0.016

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) k
#> SD:hclust 70         2.58e-13 2
#> SD:hclust 66         3.20e-16 3
#> SD:hclust 56         2.47e-15 4
#> SD:hclust 56         1.95e-15 5
#> SD:hclust 50         2.58e-12 6

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


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

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.742           0.929       0.958         0.4848 0.519   0.519
#> 3 3 0.885           0.861       0.943         0.3875 0.758   0.554
#> 4 4 0.699           0.720       0.835         0.0919 0.895   0.697
#> 5 5 0.716           0.638       0.731         0.0645 0.907   0.703
#> 6 6 0.735           0.626       0.804         0.0447 0.905   0.658

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
#> GSM875413     1  0.0376      0.984 0.996 0.004
#> GSM875415     1  0.0000      0.988 1.000 0.000
#> GSM875416     1  0.0376      0.987 0.996 0.004
#> GSM875417     1  0.0672      0.984 0.992 0.008
#> GSM875418     1  0.0000      0.988 1.000 0.000
#> GSM875423     1  0.0376      0.987 0.996 0.004
#> GSM875424     1  0.0376      0.987 0.996 0.004
#> GSM875425     1  0.0376      0.987 0.996 0.004
#> GSM875430     1  0.0000      0.988 1.000 0.000
#> GSM875432     1  0.0000      0.988 1.000 0.000
#> GSM875435     1  0.0000      0.988 1.000 0.000
#> GSM875436     1  0.7745      0.662 0.772 0.228
#> GSM875437     1  0.0000      0.988 1.000 0.000
#> GSM875447     1  0.0000      0.988 1.000 0.000
#> GSM875451     1  0.0000      0.988 1.000 0.000
#> GSM875456     1  0.0000      0.988 1.000 0.000
#> GSM875461     1  0.0000      0.988 1.000 0.000
#> GSM875462     1  0.0000      0.988 1.000 0.000
#> GSM875465     1  0.0376      0.987 0.996 0.004
#> GSM875469     1  0.0376      0.987 0.996 0.004
#> GSM875470     1  0.0672      0.984 0.992 0.008
#> GSM875471     1  0.0672      0.984 0.992 0.008
#> GSM875472     1  0.0000      0.988 1.000 0.000
#> GSM875475     1  0.0000      0.988 1.000 0.000
#> GSM875476     1  0.0000      0.988 1.000 0.000
#> GSM875477     1  0.0000      0.988 1.000 0.000
#> GSM875414     2  0.0000      0.937 0.000 1.000
#> GSM875427     2  0.5294      0.882 0.120 0.880
#> GSM875431     2  0.3733      0.909 0.072 0.928
#> GSM875433     2  0.0000      0.937 0.000 1.000
#> GSM875443     1  0.0672      0.984 0.992 0.008
#> GSM875444     2  0.8713      0.677 0.292 0.708
#> GSM875445     2  0.5294      0.882 0.120 0.880
#> GSM875449     2  0.5294      0.882 0.120 0.880
#> GSM875450     2  0.8713      0.677 0.292 0.708
#> GSM875452     2  0.5842      0.866 0.140 0.860
#> GSM875454     2  0.0000      0.937 0.000 1.000
#> GSM875457     2  0.5737      0.870 0.136 0.864
#> GSM875458     2  0.8207      0.733 0.256 0.744
#> GSM875467     2  0.5842      0.866 0.140 0.860
#> GSM875468     2  0.8267      0.727 0.260 0.740
#> GSM875412     2  0.0376      0.937 0.004 0.996
#> GSM875419     2  0.0672      0.937 0.008 0.992
#> GSM875420     2  0.0672      0.937 0.008 0.992
#> GSM875421     2  0.0000      0.937 0.000 1.000
#> GSM875422     2  0.0000      0.937 0.000 1.000
#> GSM875426     2  0.0000      0.937 0.000 1.000
#> GSM875428     2  0.0000      0.937 0.000 1.000
#> GSM875429     2  0.0672      0.937 0.008 0.992
#> GSM875434     2  0.7528      0.796 0.216 0.784
#> GSM875438     2  0.0376      0.937 0.004 0.996
#> GSM875439     2  0.0672      0.937 0.008 0.992
#> GSM875440     2  0.0000      0.937 0.000 1.000
#> GSM875441     2  0.0672      0.937 0.008 0.992
#> GSM875442     2  0.0672      0.937 0.008 0.992
#> GSM875446     2  0.0376      0.937 0.004 0.996
#> GSM875448     2  0.0672      0.937 0.008 0.992
#> GSM875453     2  0.0672      0.937 0.008 0.992
#> GSM875455     2  0.0672      0.937 0.008 0.992
#> GSM875459     2  0.0672      0.937 0.008 0.992
#> GSM875460     2  0.0376      0.937 0.004 0.996
#> GSM875463     2  0.0672      0.937 0.008 0.992
#> GSM875464     2  0.0672      0.937 0.008 0.992
#> GSM875466     2  0.5294      0.882 0.120 0.880
#> GSM875473     2  0.5294      0.882 0.120 0.880
#> GSM875474     2  0.0672      0.937 0.008 0.992
#> GSM875478     2  0.0672      0.937 0.008 0.992
#> GSM875479     2  0.0672      0.937 0.008 0.992
#> GSM875480     2  0.3584      0.911 0.068 0.932
#> GSM875481     2  0.0000      0.937 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
#> GSM875413     1  0.0661      0.949 0.988 0.004 0.008
#> GSM875415     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875417     3  0.0424      0.955 0.008 0.000 0.992
#> GSM875418     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875423     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875424     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875425     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875430     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875436     1  0.6280      0.105 0.540 0.460 0.000
#> GSM875437     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875465     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875469     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875470     1  0.6286      0.127 0.536 0.000 0.464
#> GSM875471     3  0.5497      0.552 0.292 0.000 0.708
#> GSM875472     1  0.0424      0.952 0.992 0.000 0.008
#> GSM875475     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875476     1  0.0000      0.957 1.000 0.000 0.000
#> GSM875477     1  0.0424      0.952 0.992 0.000 0.008
#> GSM875414     2  0.5882      0.497 0.000 0.652 0.348
#> GSM875427     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875431     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875433     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875443     3  0.0424      0.955 0.008 0.000 0.992
#> GSM875444     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875445     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875449     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875450     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875452     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875454     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875457     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875458     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875467     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875468     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875412     2  0.0747      0.899 0.000 0.984 0.016
#> GSM875419     2  0.0747      0.899 0.000 0.984 0.016
#> GSM875420     2  0.0747      0.899 0.000 0.984 0.016
#> GSM875421     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875422     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875426     2  0.6307      0.150 0.000 0.512 0.488
#> GSM875428     2  0.6302      0.177 0.000 0.520 0.480
#> GSM875429     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875434     2  0.6769      0.318 0.392 0.592 0.016
#> GSM875438     2  0.0747      0.899 0.000 0.984 0.016
#> GSM875439     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875440     2  0.4452      0.747 0.000 0.808 0.192
#> GSM875441     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875448     2  0.0747      0.899 0.000 0.984 0.016
#> GSM875453     2  0.0747      0.899 0.000 0.984 0.016
#> GSM875455     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875460     2  0.3816      0.795 0.000 0.852 0.148
#> GSM875463     2  0.0747      0.899 0.000 0.984 0.016
#> GSM875464     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875466     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875473     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875474     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.901 0.000 1.000 0.000
#> GSM875480     3  0.0424      0.963 0.000 0.008 0.992
#> GSM875481     3  0.5926      0.338 0.000 0.356 0.644

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.4059     0.8517 0.788 0.200 0.000 0.012
#> GSM875415     1  0.0000     0.9388 1.000 0.000 0.000 0.000
#> GSM875416     1  0.1389     0.9299 0.952 0.048 0.000 0.000
#> GSM875417     3  0.1576     0.7684 0.004 0.048 0.948 0.000
#> GSM875418     1  0.0000     0.9388 1.000 0.000 0.000 0.000
#> GSM875423     1  0.2739     0.9103 0.904 0.060 0.036 0.000
#> GSM875424     1  0.2282     0.9191 0.924 0.052 0.024 0.000
#> GSM875425     1  0.2983     0.9059 0.892 0.068 0.040 0.000
#> GSM875430     1  0.0000     0.9388 1.000 0.000 0.000 0.000
#> GSM875432     1  0.1940     0.9236 0.924 0.076 0.000 0.000
#> GSM875435     1  0.0000     0.9388 1.000 0.000 0.000 0.000
#> GSM875436     4  0.7187    -0.0183 0.424 0.136 0.000 0.440
#> GSM875437     1  0.2345     0.9251 0.900 0.100 0.000 0.000
#> GSM875447     1  0.0000     0.9388 1.000 0.000 0.000 0.000
#> GSM875451     1  0.1109     0.9338 0.968 0.028 0.000 0.004
#> GSM875456     1  0.0000     0.9388 1.000 0.000 0.000 0.000
#> GSM875461     1  0.1211     0.9380 0.960 0.040 0.000 0.000
#> GSM875462     1  0.2944     0.9127 0.868 0.128 0.000 0.004
#> GSM875465     1  0.2943     0.9092 0.892 0.076 0.032 0.000
#> GSM875469     1  0.1824     0.9305 0.936 0.060 0.000 0.004
#> GSM875470     3  0.6383     0.2595 0.356 0.076 0.568 0.000
#> GSM875471     3  0.4100     0.6696 0.092 0.076 0.832 0.000
#> GSM875472     1  0.4284     0.8516 0.764 0.224 0.000 0.012
#> GSM875475     1  0.0921     0.9374 0.972 0.028 0.000 0.000
#> GSM875476     1  0.2859     0.9089 0.880 0.112 0.000 0.008
#> GSM875477     1  0.3681     0.8692 0.816 0.176 0.000 0.008
#> GSM875414     4  0.3542     0.6004 0.000 0.028 0.120 0.852
#> GSM875427     3  0.0188     0.7953 0.000 0.000 0.996 0.004
#> GSM875431     3  0.4746     0.5711 0.000 0.000 0.632 0.368
#> GSM875433     3  0.4972     0.4053 0.000 0.000 0.544 0.456
#> GSM875443     3  0.1661     0.7659 0.004 0.052 0.944 0.000
#> GSM875444     3  0.0000     0.7957 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0188     0.7953 0.000 0.000 0.996 0.004
#> GSM875449     3  0.0000     0.7957 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000     0.7957 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0188     0.7953 0.000 0.000 0.996 0.004
#> GSM875454     3  0.4500     0.6291 0.000 0.000 0.684 0.316
#> GSM875457     3  0.0000     0.7957 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000     0.7957 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000     0.7957 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000     0.7957 0.000 0.000 1.000 0.000
#> GSM875412     4  0.0376     0.6255 0.000 0.004 0.004 0.992
#> GSM875419     4  0.1489     0.6248 0.000 0.044 0.004 0.952
#> GSM875420     4  0.3052     0.5419 0.000 0.136 0.004 0.860
#> GSM875421     3  0.4790     0.5540 0.000 0.000 0.620 0.380
#> GSM875422     3  0.4790     0.5540 0.000 0.000 0.620 0.380
#> GSM875426     4  0.6100     0.3575 0.000 0.084 0.272 0.644
#> GSM875428     4  0.2921     0.5980 0.000 0.000 0.140 0.860
#> GSM875429     2  0.4193     0.9482 0.000 0.732 0.000 0.268
#> GSM875434     4  0.5655     0.4817 0.144 0.120 0.004 0.732
#> GSM875438     4  0.1489     0.6118 0.000 0.044 0.004 0.952
#> GSM875439     2  0.4193     0.9482 0.000 0.732 0.000 0.268
#> GSM875440     4  0.3245     0.6114 0.000 0.028 0.100 0.872
#> GSM875441     4  0.3837     0.3950 0.000 0.224 0.000 0.776
#> GSM875442     2  0.4661     0.7659 0.000 0.652 0.000 0.348
#> GSM875446     2  0.4193     0.9482 0.000 0.732 0.000 0.268
#> GSM875448     4  0.3791     0.4495 0.000 0.200 0.004 0.796
#> GSM875453     4  0.3870     0.4353 0.000 0.208 0.004 0.788
#> GSM875455     2  0.3873     0.9098 0.000 0.772 0.000 0.228
#> GSM875459     2  0.4193     0.9482 0.000 0.732 0.000 0.268
#> GSM875460     4  0.1938     0.6318 0.000 0.012 0.052 0.936
#> GSM875463     4  0.3831     0.4507 0.000 0.204 0.004 0.792
#> GSM875464     4  0.4907    -0.2773 0.000 0.420 0.000 0.580
#> GSM875466     3  0.4661     0.5940 0.000 0.000 0.652 0.348
#> GSM875473     3  0.4304     0.6520 0.000 0.000 0.716 0.284
#> GSM875474     2  0.4164     0.9472 0.000 0.736 0.000 0.264
#> GSM875478     2  0.4164     0.9472 0.000 0.736 0.000 0.264
#> GSM875479     2  0.4643     0.8517 0.000 0.656 0.000 0.344
#> GSM875480     3  0.4679     0.5899 0.000 0.000 0.648 0.352
#> GSM875481     4  0.6633    -0.1090 0.000 0.084 0.416 0.500

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4 p5
#> GSM875413     1  0.5439    0.66316 0.612 0.024 0.000 0.036 NA
#> GSM875415     1  0.0000    0.86281 1.000 0.000 0.000 0.000 NA
#> GSM875416     1  0.2471    0.82830 0.864 0.000 0.000 0.000 NA
#> GSM875417     3  0.1608    0.80871 0.000 0.000 0.928 0.000 NA
#> GSM875418     1  0.0000    0.86281 1.000 0.000 0.000 0.000 NA
#> GSM875423     1  0.4404    0.76683 0.760 0.000 0.088 0.000 NA
#> GSM875424     1  0.4212    0.77706 0.776 0.000 0.080 0.000 NA
#> GSM875425     1  0.4767    0.74867 0.720 0.000 0.088 0.000 NA
#> GSM875430     1  0.0000    0.86281 1.000 0.000 0.000 0.000 NA
#> GSM875432     1  0.2516    0.83068 0.860 0.000 0.000 0.000 NA
#> GSM875435     1  0.0000    0.86281 1.000 0.000 0.000 0.000 NA
#> GSM875436     4  0.7156   -0.12895 0.352 0.032 0.000 0.432 NA
#> GSM875437     1  0.2966    0.83473 0.816 0.000 0.000 0.000 NA
#> GSM875447     1  0.0000    0.86281 1.000 0.000 0.000 0.000 NA
#> GSM875451     1  0.0880    0.85772 0.968 0.000 0.000 0.000 NA
#> GSM875456     1  0.0000    0.86281 1.000 0.000 0.000 0.000 NA
#> GSM875461     1  0.1671    0.85731 0.924 0.000 0.000 0.000 NA
#> GSM875462     1  0.3715    0.80949 0.736 0.004 0.000 0.000 NA
#> GSM875465     1  0.4832    0.74752 0.712 0.000 0.088 0.000 NA
#> GSM875469     1  0.2583    0.83679 0.864 0.004 0.000 0.000 NA
#> GSM875470     3  0.6512    0.00125 0.348 0.000 0.452 0.000 NA
#> GSM875471     3  0.4462    0.65807 0.064 0.000 0.740 0.000 NA
#> GSM875472     1  0.5227    0.66747 0.556 0.008 0.000 0.032 NA
#> GSM875475     1  0.1197    0.85915 0.952 0.000 0.000 0.000 NA
#> GSM875476     1  0.3917    0.79878 0.784 0.024 0.000 0.008 NA
#> GSM875477     1  0.4346    0.72799 0.680 0.012 0.000 0.004 NA
#> GSM875414     4  0.5602    0.55882 0.000 0.028 0.060 0.648 NA
#> GSM875427     3  0.1768    0.80502 0.000 0.000 0.924 0.004 NA
#> GSM875431     4  0.6712    0.39756 0.000 0.000 0.300 0.424 NA
#> GSM875433     4  0.6785    0.45262 0.000 0.008 0.240 0.472 NA
#> GSM875443     3  0.1671    0.80603 0.000 0.000 0.924 0.000 NA
#> GSM875444     3  0.0162    0.84440 0.000 0.000 0.996 0.000 NA
#> GSM875445     3  0.1768    0.80502 0.000 0.000 0.924 0.004 NA
#> GSM875449     3  0.0162    0.84414 0.000 0.000 0.996 0.000 NA
#> GSM875450     3  0.0000    0.84494 0.000 0.000 1.000 0.000 NA
#> GSM875452     3  0.1768    0.80502 0.000 0.000 0.924 0.004 NA
#> GSM875454     4  0.6749    0.38532 0.000 0.000 0.304 0.408 NA
#> GSM875457     3  0.0162    0.84440 0.000 0.000 0.996 0.000 NA
#> GSM875458     3  0.0000    0.84494 0.000 0.000 1.000 0.000 NA
#> GSM875467     3  0.0703    0.83727 0.000 0.000 0.976 0.000 NA
#> GSM875468     3  0.0000    0.84494 0.000 0.000 1.000 0.000 NA
#> GSM875412     4  0.0693    0.51816 0.000 0.008 0.000 0.980 NA
#> GSM875419     4  0.1469    0.50203 0.000 0.016 0.000 0.948 NA
#> GSM875420     4  0.4671    0.33978 0.000 0.116 0.000 0.740 NA
#> GSM875421     4  0.6695    0.40885 0.000 0.000 0.288 0.432 NA
#> GSM875422     4  0.6715    0.40464 0.000 0.000 0.288 0.424 NA
#> GSM875426     4  0.7014    0.50794 0.000 0.056 0.136 0.524 NA
#> GSM875428     4  0.4775    0.56243 0.000 0.008 0.036 0.688 NA
#> GSM875429     2  0.1399    0.90622 0.000 0.952 0.000 0.028 NA
#> GSM875434     4  0.5090    0.38509 0.092 0.016 0.000 0.724 NA
#> GSM875438     4  0.2069    0.47350 0.000 0.076 0.000 0.912 NA
#> GSM875439     2  0.2036    0.89462 0.000 0.920 0.000 0.024 NA
#> GSM875440     4  0.5058    0.55470 0.000 0.028 0.028 0.680 NA
#> GSM875441     4  0.5375    0.23077 0.000 0.176 0.000 0.668 NA
#> GSM875442     2  0.4025    0.77687 0.000 0.792 0.000 0.132 NA
#> GSM875446     2  0.2036    0.89462 0.000 0.920 0.000 0.024 NA
#> GSM875448     4  0.4889    0.31128 0.000 0.144 0.000 0.720 NA
#> GSM875453     4  0.5079    0.29075 0.000 0.164 0.000 0.700 NA
#> GSM875455     2  0.1300    0.89986 0.000 0.956 0.000 0.016 NA
#> GSM875459     2  0.0865    0.90666 0.000 0.972 0.000 0.024 NA
#> GSM875460     4  0.1369    0.52348 0.000 0.008 0.008 0.956 NA
#> GSM875463     4  0.4848    0.31425 0.000 0.144 0.000 0.724 NA
#> GSM875464     4  0.6401   -0.21588 0.000 0.380 0.000 0.448 NA
#> GSM875466     4  0.6694    0.34228 0.000 0.000 0.348 0.408 NA
#> GSM875473     3  0.6564   -0.27581 0.000 0.000 0.420 0.376 NA
#> GSM875474     2  0.1216    0.90480 0.000 0.960 0.000 0.020 NA
#> GSM875478     2  0.0865    0.90700 0.000 0.972 0.000 0.024 NA
#> GSM875479     2  0.5980    0.52833 0.000 0.584 0.000 0.240 NA
#> GSM875480     4  0.6714    0.38340 0.000 0.000 0.312 0.420 NA
#> GSM875481     4  0.7409    0.44729 0.000 0.044 0.228 0.444 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     6  0.5459    0.65382 0.416 0.000 0.000 0.064 0.024 0.496
#> GSM875415     1  0.0000    0.60649 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.4006    0.49623 0.772 0.000 0.084 0.008 0.000 0.136
#> GSM875417     3  0.1148    0.78685 0.000 0.000 0.960 0.016 0.004 0.020
#> GSM875418     1  0.0000    0.60649 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.5523    0.37559 0.628 0.000 0.184 0.024 0.000 0.164
#> GSM875424     1  0.5065    0.42114 0.680 0.000 0.168 0.020 0.000 0.132
#> GSM875425     1  0.6048    0.30054 0.548 0.000 0.184 0.028 0.000 0.240
#> GSM875430     1  0.0000    0.60649 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.3500    0.30529 0.768 0.000 0.000 0.028 0.000 0.204
#> GSM875435     1  0.0000    0.60649 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875436     4  0.6665   -0.22157 0.256 0.032 0.000 0.364 0.000 0.348
#> GSM875437     1  0.4488    0.22680 0.652 0.000 0.012 0.032 0.000 0.304
#> GSM875447     1  0.0000    0.60649 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0937    0.57161 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM875456     1  0.0146    0.60597 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM875461     1  0.2968    0.45593 0.816 0.000 0.000 0.016 0.000 0.168
#> GSM875462     1  0.4753    0.09437 0.576 0.000 0.016 0.028 0.000 0.380
#> GSM875465     1  0.5980    0.30543 0.552 0.000 0.184 0.024 0.000 0.240
#> GSM875469     1  0.3685    0.49517 0.800 0.000 0.056 0.012 0.000 0.132
#> GSM875470     3  0.6440   -0.01012 0.244 0.000 0.480 0.024 0.004 0.248
#> GSM875471     3  0.4935    0.46942 0.056 0.000 0.672 0.024 0.004 0.244
#> GSM875472     6  0.4122    0.67821 0.292 0.000 0.000 0.020 0.008 0.680
#> GSM875475     1  0.1967    0.52766 0.904 0.000 0.000 0.012 0.000 0.084
#> GSM875476     1  0.5225   -0.00258 0.612 0.040 0.000 0.048 0.000 0.300
#> GSM875477     1  0.4227   -0.66929 0.496 0.000 0.000 0.004 0.008 0.492
#> GSM875414     5  0.2734    0.81142 0.000 0.020 0.000 0.088 0.872 0.020
#> GSM875427     3  0.3521    0.81343 0.000 0.000 0.804 0.012 0.148 0.036
#> GSM875431     5  0.1528    0.87825 0.000 0.000 0.048 0.000 0.936 0.016
#> GSM875433     5  0.2345    0.87490 0.000 0.000 0.036 0.024 0.904 0.036
#> GSM875443     3  0.1334    0.78896 0.000 0.000 0.948 0.020 0.000 0.032
#> GSM875444     3  0.2163    0.85917 0.000 0.000 0.892 0.008 0.096 0.004
#> GSM875445     3  0.3521    0.81477 0.000 0.000 0.804 0.012 0.148 0.036
#> GSM875449     3  0.1814    0.86097 0.000 0.000 0.900 0.000 0.100 0.000
#> GSM875450     3  0.2163    0.85991 0.000 0.000 0.892 0.008 0.096 0.004
#> GSM875452     3  0.3483    0.81711 0.000 0.000 0.808 0.012 0.144 0.036
#> GSM875454     5  0.2164    0.86904 0.000 0.000 0.060 0.012 0.908 0.020
#> GSM875457     3  0.2163    0.85917 0.000 0.000 0.892 0.008 0.096 0.004
#> GSM875458     3  0.1814    0.86097 0.000 0.000 0.900 0.000 0.100 0.000
#> GSM875467     3  0.2786    0.85284 0.000 0.000 0.864 0.012 0.100 0.024
#> GSM875468     3  0.1765    0.86097 0.000 0.000 0.904 0.000 0.096 0.000
#> GSM875412     4  0.5010    0.45892 0.000 0.012 0.000 0.564 0.372 0.052
#> GSM875419     4  0.4797    0.57115 0.000 0.012 0.000 0.640 0.292 0.056
#> GSM875420     4  0.3490    0.70456 0.000 0.072 0.000 0.832 0.068 0.028
#> GSM875421     5  0.1152    0.87833 0.000 0.000 0.044 0.000 0.952 0.004
#> GSM875422     5  0.1826    0.87728 0.000 0.000 0.052 0.004 0.924 0.020
#> GSM875426     5  0.2629    0.84579 0.000 0.024 0.004 0.040 0.892 0.040
#> GSM875428     5  0.2346    0.77941 0.000 0.000 0.000 0.124 0.868 0.008
#> GSM875429     2  0.1411    0.91988 0.000 0.936 0.000 0.004 0.000 0.060
#> GSM875434     4  0.6637    0.40520 0.048 0.004 0.000 0.472 0.176 0.300
#> GSM875438     4  0.5293    0.57303 0.000 0.036 0.000 0.612 0.292 0.060
#> GSM875439     2  0.1950    0.91411 0.000 0.924 0.000 0.028 0.016 0.032
#> GSM875440     5  0.3440    0.76685 0.000 0.020 0.000 0.116 0.824 0.040
#> GSM875441     4  0.2608    0.69320 0.000 0.080 0.000 0.872 0.048 0.000
#> GSM875442     2  0.3563    0.79128 0.000 0.800 0.000 0.108 0.000 0.092
#> GSM875446     2  0.1950    0.91411 0.000 0.924 0.000 0.028 0.016 0.032
#> GSM875448     4  0.3151    0.70393 0.000 0.076 0.000 0.848 0.064 0.012
#> GSM875453     4  0.3376    0.69821 0.000 0.072 0.000 0.840 0.060 0.028
#> GSM875455     2  0.0937    0.92768 0.000 0.960 0.000 0.000 0.000 0.040
#> GSM875459     2  0.1180    0.92501 0.000 0.960 0.000 0.012 0.012 0.016
#> GSM875460     4  0.4531    0.40566 0.000 0.000 0.000 0.556 0.408 0.036
#> GSM875463     4  0.3151    0.70393 0.000 0.076 0.000 0.848 0.064 0.012
#> GSM875464     4  0.3852    0.57485 0.000 0.192 0.000 0.764 0.020 0.024
#> GSM875466     5  0.2830    0.81565 0.000 0.000 0.144 0.000 0.836 0.020
#> GSM875473     5  0.4432    0.66253 0.000 0.000 0.224 0.012 0.708 0.056
#> GSM875474     2  0.1082    0.92695 0.000 0.956 0.000 0.004 0.000 0.040
#> GSM875478     2  0.0405    0.92949 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM875479     4  0.4764    0.11415 0.000 0.408 0.000 0.548 0.008 0.036
#> GSM875480     5  0.1958    0.85329 0.000 0.000 0.100 0.000 0.896 0.004
#> GSM875481     5  0.2014    0.87232 0.000 0.016 0.024 0.004 0.924 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-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) k
#> SD:kmeans 70         4.52e-15 2
#> SD:kmeans 63         9.58e-19 3
#> SD:kmeans 59         1.06e-14 4
#> SD:kmeans 51         3.89e-16 5
#> SD:kmeans 51         6.10e-13 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 51941 rows and 70 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.857           0.896       0.958         0.4995 0.496   0.496
#> 3 3 1.000           0.947       0.980         0.3488 0.741   0.522
#> 4 4 0.798           0.823       0.897         0.1069 0.878   0.654
#> 5 5 0.809           0.786       0.839         0.0615 0.939   0.769
#> 6 6 0.752           0.604       0.756         0.0435 0.923   0.661

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
#> GSM875413     1  0.0672      0.927 0.992 0.008
#> GSM875415     1  0.0000      0.933 1.000 0.000
#> GSM875416     1  0.0000      0.933 1.000 0.000
#> GSM875417     1  0.0000      0.933 1.000 0.000
#> GSM875418     1  0.0000      0.933 1.000 0.000
#> GSM875423     1  0.0000      0.933 1.000 0.000
#> GSM875424     1  0.0000      0.933 1.000 0.000
#> GSM875425     1  0.0000      0.933 1.000 0.000
#> GSM875430     1  0.0000      0.933 1.000 0.000
#> GSM875432     1  0.0000      0.933 1.000 0.000
#> GSM875435     1  0.0000      0.933 1.000 0.000
#> GSM875436     1  0.2236      0.905 0.964 0.036
#> GSM875437     1  0.0000      0.933 1.000 0.000
#> GSM875447     1  0.0000      0.933 1.000 0.000
#> GSM875451     1  0.0000      0.933 1.000 0.000
#> GSM875456     1  0.0000      0.933 1.000 0.000
#> GSM875461     1  0.0000      0.933 1.000 0.000
#> GSM875462     1  0.0000      0.933 1.000 0.000
#> GSM875465     1  0.0000      0.933 1.000 0.000
#> GSM875469     1  0.0000      0.933 1.000 0.000
#> GSM875470     1  0.0000      0.933 1.000 0.000
#> GSM875471     1  0.0000      0.933 1.000 0.000
#> GSM875472     1  0.0000      0.933 1.000 0.000
#> GSM875475     1  0.0000      0.933 1.000 0.000
#> GSM875476     1  0.0000      0.933 1.000 0.000
#> GSM875477     1  0.0000      0.933 1.000 0.000
#> GSM875414     2  0.0000      0.970 0.000 1.000
#> GSM875427     2  0.1184      0.958 0.016 0.984
#> GSM875431     2  0.0000      0.970 0.000 1.000
#> GSM875433     2  0.0000      0.970 0.000 1.000
#> GSM875443     1  0.0000      0.933 1.000 0.000
#> GSM875444     1  0.9129      0.529 0.672 0.328
#> GSM875445     2  0.0672      0.965 0.008 0.992
#> GSM875449     2  0.0672      0.965 0.008 0.992
#> GSM875450     1  0.9129      0.529 0.672 0.328
#> GSM875452     2  0.7056      0.743 0.192 0.808
#> GSM875454     2  0.0000      0.970 0.000 1.000
#> GSM875457     2  0.4815      0.864 0.104 0.896
#> GSM875458     1  0.9866      0.281 0.568 0.432
#> GSM875467     2  0.9170      0.468 0.332 0.668
#> GSM875468     1  0.9833      0.304 0.576 0.424
#> GSM875412     2  0.0000      0.970 0.000 1.000
#> GSM875419     2  0.0000      0.970 0.000 1.000
#> GSM875420     2  0.0000      0.970 0.000 1.000
#> GSM875421     2  0.0000      0.970 0.000 1.000
#> GSM875422     2  0.0000      0.970 0.000 1.000
#> GSM875426     2  0.0000      0.970 0.000 1.000
#> GSM875428     2  0.0000      0.970 0.000 1.000
#> GSM875429     2  0.0000      0.970 0.000 1.000
#> GSM875434     1  0.9635      0.388 0.612 0.388
#> GSM875438     2  0.0000      0.970 0.000 1.000
#> GSM875439     2  0.0000      0.970 0.000 1.000
#> GSM875440     2  0.0000      0.970 0.000 1.000
#> GSM875441     2  0.0000      0.970 0.000 1.000
#> GSM875442     2  0.0000      0.970 0.000 1.000
#> GSM875446     2  0.0000      0.970 0.000 1.000
#> GSM875448     2  0.0000      0.970 0.000 1.000
#> GSM875453     2  0.0000      0.970 0.000 1.000
#> GSM875455     2  0.9129      0.473 0.328 0.672
#> GSM875459     2  0.0000      0.970 0.000 1.000
#> GSM875460     2  0.0000      0.970 0.000 1.000
#> GSM875463     2  0.0000      0.970 0.000 1.000
#> GSM875464     2  0.0000      0.970 0.000 1.000
#> GSM875466     2  0.0672      0.965 0.008 0.992
#> GSM875473     2  0.0376      0.967 0.004 0.996
#> GSM875474     2  0.0000      0.970 0.000 1.000
#> GSM875478     2  0.0000      0.970 0.000 1.000
#> GSM875479     2  0.0000      0.970 0.000 1.000
#> GSM875480     2  0.0000      0.970 0.000 1.000
#> GSM875481     2  0.0000      0.970 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
#> GSM875413     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875415     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875417     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875418     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875423     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875424     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875425     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875430     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875436     1  0.6140      0.284 0.596 0.404 0.000
#> GSM875437     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875465     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875469     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875470     1  0.0424      0.959 0.992 0.000 0.008
#> GSM875471     1  0.5948      0.421 0.640 0.000 0.360
#> GSM875472     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875475     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875476     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875477     1  0.0000      0.966 1.000 0.000 0.000
#> GSM875414     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875427     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875431     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875433     3  0.1529      0.958 0.000 0.040 0.960
#> GSM875443     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875454     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875457     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875421     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875422     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875426     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875428     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875429     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875434     2  0.6111      0.333 0.396 0.604 0.000
#> GSM875438     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875455     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875460     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875463     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875473     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875474     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.974 0.000 1.000 0.000
#> GSM875480     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875481     2  0.4605      0.736 0.000 0.796 0.204

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.1940     0.8877 0.924 0.076 0.000 0.000
#> GSM875415     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0657     0.9460 0.984 0.000 0.012 0.004
#> GSM875417     3  0.0188     0.9370 0.000 0.000 0.996 0.004
#> GSM875418     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875423     1  0.1576     0.9265 0.948 0.000 0.048 0.004
#> GSM875424     1  0.1398     0.9317 0.956 0.000 0.040 0.004
#> GSM875425     1  0.1824     0.9169 0.936 0.000 0.060 0.004
#> GSM875430     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875436     1  0.5165     0.0863 0.512 0.484 0.000 0.004
#> GSM875437     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875462     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875465     1  0.1489     0.9293 0.952 0.000 0.044 0.004
#> GSM875469     1  0.0657     0.9460 0.984 0.000 0.012 0.004
#> GSM875470     1  0.4252     0.6626 0.744 0.000 0.252 0.004
#> GSM875471     3  0.4677     0.4853 0.316 0.000 0.680 0.004
#> GSM875472     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875475     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875476     1  0.1211     0.9268 0.960 0.040 0.000 0.000
#> GSM875477     1  0.0000     0.9513 1.000 0.000 0.000 0.000
#> GSM875414     4  0.0707     0.7953 0.000 0.020 0.000 0.980
#> GSM875427     3  0.1302     0.9263 0.000 0.000 0.956 0.044
#> GSM875431     4  0.2859     0.8295 0.000 0.008 0.112 0.880
#> GSM875433     4  0.2805     0.7661 0.000 0.100 0.012 0.888
#> GSM875443     3  0.0188     0.9370 0.000 0.000 0.996 0.004
#> GSM875444     3  0.0336     0.9448 0.000 0.000 0.992 0.008
#> GSM875445     3  0.1211     0.9306 0.000 0.000 0.960 0.040
#> GSM875449     3  0.0707     0.9446 0.000 0.000 0.980 0.020
#> GSM875450     3  0.0469     0.9464 0.000 0.000 0.988 0.012
#> GSM875452     3  0.1118     0.9341 0.000 0.000 0.964 0.036
#> GSM875454     4  0.2814     0.8259 0.000 0.000 0.132 0.868
#> GSM875457     3  0.0469     0.9464 0.000 0.000 0.988 0.012
#> GSM875458     3  0.0469     0.9464 0.000 0.000 0.988 0.012
#> GSM875467     3  0.0707     0.9446 0.000 0.000 0.980 0.020
#> GSM875468     3  0.0469     0.9464 0.000 0.000 0.988 0.012
#> GSM875412     2  0.4888     0.4027 0.000 0.588 0.000 0.412
#> GSM875419     2  0.4164     0.6906 0.000 0.736 0.000 0.264
#> GSM875420     2  0.4134     0.6954 0.000 0.740 0.000 0.260
#> GSM875421     4  0.2647     0.8312 0.000 0.000 0.120 0.880
#> GSM875422     4  0.2647     0.8303 0.000 0.000 0.120 0.880
#> GSM875426     4  0.2408     0.7594 0.000 0.104 0.000 0.896
#> GSM875428     4  0.2408     0.7711 0.000 0.104 0.000 0.896
#> GSM875429     2  0.2530     0.7986 0.000 0.888 0.000 0.112
#> GSM875434     2  0.7504     0.3181 0.344 0.464 0.000 0.192
#> GSM875438     2  0.3172     0.7680 0.000 0.840 0.000 0.160
#> GSM875439     2  0.2530     0.7986 0.000 0.888 0.000 0.112
#> GSM875440     4  0.1118     0.7912 0.000 0.036 0.000 0.964
#> GSM875441     2  0.2973     0.7870 0.000 0.856 0.000 0.144
#> GSM875442     2  0.2530     0.7986 0.000 0.888 0.000 0.112
#> GSM875446     2  0.3074     0.7975 0.000 0.848 0.000 0.152
#> GSM875448     2  0.3074     0.7848 0.000 0.848 0.000 0.152
#> GSM875453     2  0.3074     0.7844 0.000 0.848 0.000 0.152
#> GSM875455     2  0.2530     0.7986 0.000 0.888 0.000 0.112
#> GSM875459     2  0.2530     0.7986 0.000 0.888 0.000 0.112
#> GSM875460     4  0.4193     0.5607 0.000 0.268 0.000 0.732
#> GSM875463     2  0.3123     0.7828 0.000 0.844 0.000 0.156
#> GSM875464     2  0.2814     0.7904 0.000 0.868 0.000 0.132
#> GSM875466     4  0.4643     0.5806 0.000 0.000 0.344 0.656
#> GSM875473     4  0.4843     0.4888 0.000 0.000 0.396 0.604
#> GSM875474     2  0.2530     0.7986 0.000 0.888 0.000 0.112
#> GSM875478     2  0.2530     0.7986 0.000 0.888 0.000 0.112
#> GSM875479     2  0.0921     0.8000 0.000 0.972 0.000 0.028
#> GSM875480     4  0.2973     0.8189 0.000 0.000 0.144 0.856
#> GSM875481     4  0.2714     0.7518 0.000 0.112 0.004 0.884

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.3343      0.811 0.812 0.016 0.000 0.172 0.000
#> GSM875415     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.3343      0.820 0.812 0.000 0.000 0.172 0.016
#> GSM875417     3  0.1195      0.924 0.000 0.000 0.960 0.028 0.012
#> GSM875418     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.3660      0.813 0.800 0.000 0.008 0.176 0.016
#> GSM875424     1  0.3461      0.819 0.812 0.000 0.004 0.168 0.016
#> GSM875425     1  0.4323      0.782 0.744 0.000 0.012 0.220 0.024
#> GSM875430     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.2690      0.825 0.844 0.000 0.000 0.156 0.000
#> GSM875435     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM875436     4  0.6191      0.180 0.308 0.164 0.000 0.528 0.000
#> GSM875437     1  0.1792      0.859 0.916 0.000 0.000 0.084 0.000
#> GSM875447     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.876 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.1043      0.872 0.960 0.000 0.000 0.040 0.000
#> GSM875462     1  0.3318      0.833 0.800 0.000 0.000 0.192 0.008
#> GSM875465     1  0.4033      0.793 0.760 0.000 0.004 0.212 0.024
#> GSM875469     1  0.3280      0.824 0.824 0.000 0.004 0.160 0.012
#> GSM875470     1  0.5526      0.723 0.676 0.000 0.080 0.220 0.024
#> GSM875471     3  0.6794      0.346 0.224 0.000 0.532 0.220 0.024
#> GSM875472     1  0.3700      0.798 0.752 0.000 0.000 0.240 0.008
#> GSM875475     1  0.1197      0.868 0.952 0.000 0.000 0.048 0.000
#> GSM875476     1  0.5237      0.674 0.684 0.160 0.000 0.156 0.000
#> GSM875477     1  0.2813      0.818 0.832 0.000 0.000 0.168 0.000
#> GSM875414     5  0.0771      0.902 0.000 0.020 0.000 0.004 0.976
#> GSM875427     3  0.1043      0.920 0.000 0.000 0.960 0.000 0.040
#> GSM875431     5  0.1205      0.905 0.000 0.000 0.040 0.004 0.956
#> GSM875433     5  0.1768      0.892 0.000 0.072 0.004 0.000 0.924
#> GSM875443     3  0.1106      0.927 0.000 0.000 0.964 0.024 0.012
#> GSM875444     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.0609      0.936 0.000 0.000 0.980 0.000 0.020
#> GSM875449     3  0.0162      0.945 0.000 0.000 0.996 0.000 0.004
#> GSM875450     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM875452     3  0.0162      0.945 0.000 0.000 0.996 0.000 0.004
#> GSM875454     5  0.1043      0.906 0.000 0.000 0.040 0.000 0.960
#> GSM875457     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM875458     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0162      0.945 0.000 0.000 0.996 0.000 0.004
#> GSM875468     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM875412     4  0.6452      0.526 0.000 0.232 0.000 0.500 0.268
#> GSM875419     4  0.5316      0.672 0.000 0.284 0.000 0.632 0.084
#> GSM875420     4  0.5300      0.677 0.000 0.328 0.000 0.604 0.068
#> GSM875421     5  0.0955      0.908 0.000 0.004 0.028 0.000 0.968
#> GSM875422     5  0.0955      0.908 0.000 0.004 0.028 0.000 0.968
#> GSM875426     5  0.1732      0.888 0.000 0.080 0.000 0.000 0.920
#> GSM875428     5  0.0771      0.897 0.000 0.004 0.000 0.020 0.976
#> GSM875429     2  0.0000      0.874 0.000 1.000 0.000 0.000 0.000
#> GSM875434     4  0.5170      0.450 0.144 0.060 0.000 0.740 0.056
#> GSM875438     4  0.5992      0.512 0.000 0.416 0.000 0.472 0.112
#> GSM875439     2  0.0404      0.871 0.000 0.988 0.000 0.012 0.000
#> GSM875440     5  0.2006      0.888 0.000 0.072 0.000 0.012 0.916
#> GSM875441     4  0.4849      0.669 0.000 0.360 0.000 0.608 0.032
#> GSM875442     2  0.0703      0.850 0.000 0.976 0.000 0.024 0.000
#> GSM875446     2  0.3176      0.704 0.000 0.856 0.000 0.064 0.080
#> GSM875448     4  0.4908      0.672 0.000 0.356 0.000 0.608 0.036
#> GSM875453     4  0.4862      0.666 0.000 0.364 0.000 0.604 0.032
#> GSM875455     2  0.0162      0.871 0.000 0.996 0.000 0.004 0.000
#> GSM875459     2  0.0290      0.874 0.000 0.992 0.000 0.008 0.000
#> GSM875460     4  0.5652      0.460 0.000 0.088 0.000 0.552 0.360
#> GSM875463     4  0.4921      0.669 0.000 0.360 0.000 0.604 0.036
#> GSM875464     4  0.4930      0.581 0.000 0.424 0.000 0.548 0.028
#> GSM875466     5  0.3790      0.680 0.000 0.000 0.272 0.004 0.724
#> GSM875473     5  0.5211      0.635 0.000 0.000 0.232 0.100 0.668
#> GSM875474     2  0.0000      0.874 0.000 1.000 0.000 0.000 0.000
#> GSM875478     2  0.0290      0.874 0.000 0.992 0.000 0.008 0.000
#> GSM875479     2  0.4415     -0.354 0.000 0.552 0.000 0.444 0.004
#> GSM875480     5  0.1478      0.895 0.000 0.000 0.064 0.000 0.936
#> GSM875481     5  0.2233      0.872 0.000 0.104 0.004 0.000 0.892

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     6  0.5569      0.530 0.400 0.064 0.000 0.032 0.000 0.504
#> GSM875415     1  0.3817     -0.140 0.568 0.000 0.000 0.000 0.000 0.432
#> GSM875416     1  0.1075      0.321 0.952 0.000 0.000 0.000 0.000 0.048
#> GSM875417     3  0.2515      0.877 0.104 0.000 0.876 0.008 0.004 0.008
#> GSM875418     1  0.3810     -0.138 0.572 0.000 0.000 0.000 0.000 0.428
#> GSM875423     1  0.0622      0.325 0.980 0.000 0.008 0.000 0.000 0.012
#> GSM875424     1  0.1531      0.312 0.928 0.000 0.000 0.004 0.000 0.068
#> GSM875425     1  0.3952      0.267 0.740 0.004 0.000 0.024 0.008 0.224
#> GSM875430     1  0.3828     -0.155 0.560 0.000 0.000 0.000 0.000 0.440
#> GSM875432     6  0.3976      0.575 0.380 0.000 0.000 0.004 0.004 0.612
#> GSM875435     1  0.3828     -0.163 0.560 0.000 0.000 0.000 0.000 0.440
#> GSM875436     6  0.6069      0.393 0.100 0.120 0.000 0.152 0.004 0.624
#> GSM875437     6  0.3907      0.515 0.408 0.000 0.000 0.000 0.004 0.588
#> GSM875447     1  0.3828     -0.163 0.560 0.000 0.000 0.000 0.000 0.440
#> GSM875451     1  0.3817     -0.140 0.568 0.000 0.000 0.000 0.000 0.432
#> GSM875456     1  0.3810     -0.138 0.572 0.000 0.000 0.000 0.000 0.428
#> GSM875461     1  0.3991     -0.372 0.524 0.000 0.000 0.004 0.000 0.472
#> GSM875462     6  0.4008      0.369 0.308 0.000 0.000 0.016 0.004 0.672
#> GSM875465     1  0.2837      0.298 0.840 0.004 0.000 0.008 0.004 0.144
#> GSM875469     1  0.1663      0.296 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM875470     1  0.4791      0.248 0.692 0.012 0.020 0.024 0.008 0.244
#> GSM875471     1  0.6461      0.163 0.544 0.012 0.172 0.024 0.008 0.240
#> GSM875472     6  0.4606      0.437 0.344 0.000 0.000 0.052 0.000 0.604
#> GSM875475     6  0.3851      0.413 0.460 0.000 0.000 0.000 0.000 0.540
#> GSM875476     6  0.5105      0.549 0.240 0.100 0.000 0.008 0.004 0.648
#> GSM875477     6  0.4481      0.562 0.400 0.008 0.000 0.020 0.000 0.572
#> GSM875414     5  0.1666      0.853 0.000 0.036 0.000 0.008 0.936 0.020
#> GSM875427     3  0.2697      0.914 0.000 0.012 0.888 0.012 0.056 0.032
#> GSM875431     5  0.1894      0.852 0.000 0.004 0.040 0.012 0.928 0.016
#> GSM875433     5  0.2367      0.844 0.000 0.064 0.004 0.012 0.900 0.020
#> GSM875443     3  0.3679      0.862 0.092 0.012 0.832 0.016 0.008 0.040
#> GSM875444     3  0.0260      0.946 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM875445     3  0.2415      0.923 0.000 0.012 0.904 0.012 0.048 0.024
#> GSM875449     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875450     3  0.0870      0.946 0.000 0.012 0.972 0.012 0.000 0.004
#> GSM875452     3  0.1895      0.938 0.000 0.012 0.932 0.012 0.020 0.024
#> GSM875454     5  0.2405      0.838 0.000 0.004 0.080 0.008 0.892 0.016
#> GSM875457     3  0.0146      0.947 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM875458     3  0.0146      0.947 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM875467     3  0.1713      0.941 0.000 0.012 0.940 0.012 0.012 0.024
#> GSM875468     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     4  0.4686      0.655 0.000 0.048 0.000 0.692 0.232 0.028
#> GSM875419     4  0.2550      0.794 0.000 0.048 0.000 0.892 0.024 0.036
#> GSM875420     4  0.2508      0.808 0.000 0.084 0.000 0.884 0.016 0.016
#> GSM875421     5  0.1036      0.856 0.000 0.000 0.024 0.004 0.964 0.008
#> GSM875422     5  0.0935      0.857 0.000 0.000 0.032 0.004 0.964 0.000
#> GSM875426     5  0.2114      0.838 0.000 0.076 0.000 0.008 0.904 0.012
#> GSM875428     5  0.1155      0.847 0.000 0.004 0.000 0.036 0.956 0.004
#> GSM875429     2  0.1398      0.947 0.000 0.940 0.000 0.052 0.000 0.008
#> GSM875434     4  0.5480      0.416 0.012 0.036 0.000 0.544 0.032 0.376
#> GSM875438     4  0.5659      0.605 0.000 0.208 0.000 0.620 0.136 0.036
#> GSM875439     2  0.1686      0.935 0.000 0.924 0.000 0.064 0.000 0.012
#> GSM875440     5  0.3111      0.814 0.000 0.088 0.000 0.040 0.852 0.020
#> GSM875441     4  0.2400      0.809 0.000 0.116 0.000 0.872 0.004 0.008
#> GSM875442     2  0.1391      0.925 0.000 0.944 0.000 0.040 0.000 0.016
#> GSM875446     2  0.3500      0.815 0.000 0.816 0.000 0.120 0.052 0.012
#> GSM875448     4  0.2051      0.812 0.000 0.096 0.000 0.896 0.004 0.004
#> GSM875453     4  0.2146      0.809 0.000 0.116 0.000 0.880 0.004 0.000
#> GSM875455     2  0.0547      0.946 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM875459     2  0.1196      0.952 0.000 0.952 0.000 0.040 0.000 0.008
#> GSM875460     4  0.3386      0.715 0.000 0.012 0.000 0.796 0.176 0.016
#> GSM875463     4  0.2006      0.811 0.000 0.104 0.000 0.892 0.004 0.000
#> GSM875464     4  0.2793      0.758 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM875466     5  0.4379      0.471 0.000 0.004 0.376 0.004 0.600 0.016
#> GSM875473     5  0.7899      0.295 0.096 0.012 0.296 0.052 0.420 0.124
#> GSM875474     2  0.0713      0.950 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM875478     2  0.0937      0.952 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM875479     4  0.3874      0.529 0.000 0.356 0.000 0.636 0.000 0.008
#> GSM875480     5  0.2592      0.837 0.000 0.004 0.080 0.012 0.884 0.020
#> GSM875481     5  0.3032      0.804 0.000 0.128 0.004 0.004 0.840 0.024

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) k
#> SD:skmeans 65         7.29e-13 2
#> SD:skmeans 67         4.19e-20 3
#> SD:skmeans 65         2.72e-20 4
#> SD:skmeans 65         4.83e-19 5
#> SD:skmeans 47         2.62e-12 6

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


SD:pam*

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

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

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

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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.940           0.950       0.979         0.4653 0.543   0.543
#> 3 3 0.752           0.871       0.922         0.4258 0.725   0.519
#> 4 4 0.848           0.870       0.900         0.1077 0.934   0.799
#> 5 5 0.793           0.716       0.875         0.0791 0.854   0.529
#> 6 6 0.903           0.824       0.923         0.0426 0.929   0.686

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
#> GSM875413     1  0.0000      0.988 1.000 0.000
#> GSM875415     1  0.0000      0.988 1.000 0.000
#> GSM875416     1  0.0000      0.988 1.000 0.000
#> GSM875417     2  0.7219      0.756 0.200 0.800
#> GSM875418     1  0.0000      0.988 1.000 0.000
#> GSM875423     1  0.0000      0.988 1.000 0.000
#> GSM875424     1  0.0000      0.988 1.000 0.000
#> GSM875425     1  0.0000      0.988 1.000 0.000
#> GSM875430     1  0.0000      0.988 1.000 0.000
#> GSM875432     1  0.0000      0.988 1.000 0.000
#> GSM875435     1  0.0000      0.988 1.000 0.000
#> GSM875436     1  0.0376      0.985 0.996 0.004
#> GSM875437     1  0.0000      0.988 1.000 0.000
#> GSM875447     1  0.0000      0.988 1.000 0.000
#> GSM875451     1  0.0000      0.988 1.000 0.000
#> GSM875456     1  0.0000      0.988 1.000 0.000
#> GSM875461     1  0.0000      0.988 1.000 0.000
#> GSM875462     1  0.0000      0.988 1.000 0.000
#> GSM875465     2  0.8861      0.583 0.304 0.696
#> GSM875469     1  0.0000      0.988 1.000 0.000
#> GSM875470     2  0.6712      0.789 0.176 0.824
#> GSM875471     2  0.0376      0.969 0.004 0.996
#> GSM875472     1  0.0000      0.988 1.000 0.000
#> GSM875475     1  0.0000      0.988 1.000 0.000
#> GSM875476     1  0.0000      0.988 1.000 0.000
#> GSM875477     1  0.0000      0.988 1.000 0.000
#> GSM875414     2  0.0000      0.972 0.000 1.000
#> GSM875427     2  0.0000      0.972 0.000 1.000
#> GSM875431     2  0.0000      0.972 0.000 1.000
#> GSM875433     2  0.0000      0.972 0.000 1.000
#> GSM875443     2  0.0672      0.966 0.008 0.992
#> GSM875444     2  0.0000      0.972 0.000 1.000
#> GSM875445     2  0.0000      0.972 0.000 1.000
#> GSM875449     2  0.0000      0.972 0.000 1.000
#> GSM875450     2  0.0000      0.972 0.000 1.000
#> GSM875452     2  0.0000      0.972 0.000 1.000
#> GSM875454     2  0.0000      0.972 0.000 1.000
#> GSM875457     2  0.0000      0.972 0.000 1.000
#> GSM875458     2  0.0000      0.972 0.000 1.000
#> GSM875467     2  0.0000      0.972 0.000 1.000
#> GSM875468     2  0.0000      0.972 0.000 1.000
#> GSM875412     2  0.0000      0.972 0.000 1.000
#> GSM875419     2  0.0000      0.972 0.000 1.000
#> GSM875420     2  0.0000      0.972 0.000 1.000
#> GSM875421     2  0.0000      0.972 0.000 1.000
#> GSM875422     2  0.0000      0.972 0.000 1.000
#> GSM875426     2  0.0000      0.972 0.000 1.000
#> GSM875428     2  0.0000      0.972 0.000 1.000
#> GSM875429     2  0.9833      0.267 0.424 0.576
#> GSM875434     1  0.7139      0.746 0.804 0.196
#> GSM875438     2  0.0000      0.972 0.000 1.000
#> GSM875439     2  0.0000      0.972 0.000 1.000
#> GSM875440     2  0.0000      0.972 0.000 1.000
#> GSM875441     2  0.0000      0.972 0.000 1.000
#> GSM875442     2  0.5059      0.865 0.112 0.888
#> GSM875446     2  0.0000      0.972 0.000 1.000
#> GSM875448     2  0.0000      0.972 0.000 1.000
#> GSM875453     2  0.0000      0.972 0.000 1.000
#> GSM875455     1  0.3114      0.934 0.944 0.056
#> GSM875459     2  0.0000      0.972 0.000 1.000
#> GSM875460     2  0.0000      0.972 0.000 1.000
#> GSM875463     2  0.0000      0.972 0.000 1.000
#> GSM875464     2  0.0000      0.972 0.000 1.000
#> GSM875466     2  0.0000      0.972 0.000 1.000
#> GSM875473     2  0.0000      0.972 0.000 1.000
#> GSM875474     2  0.0000      0.972 0.000 1.000
#> GSM875478     2  0.0000      0.972 0.000 1.000
#> GSM875479     2  0.0000      0.972 0.000 1.000
#> GSM875480     2  0.0000      0.972 0.000 1.000
#> GSM875481     2  0.0000      0.972 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
#> GSM875413     1  0.0592      0.947 0.988 0.012 0.000
#> GSM875415     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875417     3  0.4346      0.748 0.184 0.000 0.816
#> GSM875418     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875423     1  0.0892      0.939 0.980 0.000 0.020
#> GSM875424     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875425     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875430     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875436     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875437     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875462     1  0.0237      0.952 0.996 0.004 0.000
#> GSM875465     1  0.0592      0.944 0.988 0.000 0.012
#> GSM875469     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875470     3  0.4178      0.764 0.172 0.000 0.828
#> GSM875471     3  0.1289      0.927 0.032 0.000 0.968
#> GSM875472     1  0.5882      0.443 0.652 0.348 0.000
#> GSM875475     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875476     1  0.0424      0.950 0.992 0.008 0.000
#> GSM875477     1  0.0000      0.954 1.000 0.000 0.000
#> GSM875414     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875427     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875431     2  0.4931      0.835 0.000 0.768 0.232
#> GSM875433     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875443     3  0.1643      0.915 0.044 0.000 0.956
#> GSM875444     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875454     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875457     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875412     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875419     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875420     2  0.0592      0.821 0.000 0.988 0.012
#> GSM875421     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875422     3  0.5016      0.578 0.000 0.240 0.760
#> GSM875426     3  0.0892      0.937 0.000 0.020 0.980
#> GSM875428     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875429     1  0.6126      0.477 0.600 0.400 0.000
#> GSM875434     2  0.5852      0.779 0.152 0.788 0.060
#> GSM875438     2  0.4452      0.854 0.000 0.808 0.192
#> GSM875439     2  0.0000      0.817 0.000 1.000 0.000
#> GSM875440     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875441     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875442     2  0.4179      0.832 0.052 0.876 0.072
#> GSM875446     2  0.0000      0.817 0.000 1.000 0.000
#> GSM875448     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875453     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875455     1  0.5560      0.654 0.700 0.300 0.000
#> GSM875459     2  0.0000      0.817 0.000 1.000 0.000
#> GSM875460     2  0.4702      0.854 0.000 0.788 0.212
#> GSM875463     2  0.4555      0.855 0.000 0.800 0.200
#> GSM875464     2  0.0000      0.817 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875473     3  0.0000      0.955 0.000 0.000 1.000
#> GSM875474     2  0.6126      0.230 0.352 0.644 0.004
#> GSM875478     2  0.0000      0.817 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.817 0.000 1.000 0.000
#> GSM875480     2  0.6180      0.522 0.000 0.584 0.416
#> GSM875481     3  0.0747      0.941 0.000 0.016 0.984

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.3123      0.822 0.844 0.000 0.000 0.156
#> GSM875415     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875417     3  0.1211      0.910 0.040 0.000 0.960 0.000
#> GSM875418     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875423     1  0.3400      0.757 0.820 0.000 0.180 0.000
#> GSM875424     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875425     1  0.0336      0.930 0.992 0.000 0.008 0.000
#> GSM875430     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875436     1  0.2704      0.850 0.876 0.000 0.000 0.124
#> GSM875437     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875462     1  0.3123      0.822 0.844 0.000 0.000 0.156
#> GSM875465     1  0.0469      0.928 0.988 0.000 0.012 0.000
#> GSM875469     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875470     3  0.2704      0.833 0.124 0.000 0.876 0.000
#> GSM875471     3  0.3421      0.869 0.088 0.000 0.868 0.044
#> GSM875472     1  0.4998      0.147 0.512 0.000 0.000 0.488
#> GSM875475     1  0.0000      0.934 1.000 0.000 0.000 0.000
#> GSM875476     1  0.3168      0.863 0.884 0.056 0.000 0.060
#> GSM875477     1  0.1792      0.893 0.932 0.000 0.000 0.068
#> GSM875414     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875427     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875431     4  0.3726      0.692 0.000 0.000 0.212 0.788
#> GSM875433     3  0.1557      0.919 0.000 0.000 0.944 0.056
#> GSM875443     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875449     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875454     3  0.1302      0.923 0.000 0.000 0.956 0.044
#> GSM875457     3  0.1302      0.923 0.000 0.000 0.956 0.044
#> GSM875458     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM875412     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875419     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875420     4  0.1302      0.877 0.000 0.044 0.000 0.956
#> GSM875421     3  0.1302      0.923 0.000 0.000 0.956 0.044
#> GSM875422     3  0.4605      0.524 0.000 0.000 0.664 0.336
#> GSM875426     3  0.5677      0.703 0.000 0.140 0.720 0.140
#> GSM875428     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875429     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM875434     4  0.1302      0.867 0.044 0.000 0.000 0.956
#> GSM875438     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875439     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM875440     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875441     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875442     2  0.4632      0.543 0.004 0.688 0.000 0.308
#> GSM875446     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM875448     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875453     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875455     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM875459     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM875460     4  0.0000      0.910 0.000 0.000 0.000 1.000
#> GSM875463     4  0.0188      0.908 0.000 0.004 0.000 0.996
#> GSM875464     4  0.3172      0.771 0.000 0.160 0.000 0.840
#> GSM875466     3  0.1302      0.923 0.000 0.000 0.956 0.044
#> GSM875473     3  0.1716      0.915 0.000 0.000 0.936 0.064
#> GSM875474     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM875478     2  0.0000      0.952 0.000 1.000 0.000 0.000
#> GSM875479     4  0.4500      0.543 0.000 0.316 0.000 0.684
#> GSM875480     4  0.4855      0.321 0.000 0.000 0.400 0.600
#> GSM875481     3  0.4297      0.825 0.000 0.096 0.820 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
#> GSM875413     1  0.3109    0.74608 0.800 0.000 0.000 0.200 0.000
#> GSM875415     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0404    0.96152 0.988 0.000 0.000 0.000 0.012
#> GSM875417     5  0.4644    0.22871 0.012 0.000 0.460 0.000 0.528
#> GSM875418     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875423     3  0.4306    0.31835 0.328 0.000 0.660 0.000 0.012
#> GSM875424     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875425     5  0.3582    0.60450 0.224 0.000 0.008 0.000 0.768
#> GSM875430     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875435     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.1608    0.91004 0.928 0.000 0.000 0.072 0.000
#> GSM875437     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875447     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0404    0.96152 0.988 0.000 0.000 0.000 0.012
#> GSM875461     1  0.0162    0.96557 0.996 0.000 0.000 0.000 0.004
#> GSM875462     5  0.3944    0.55128 0.032 0.000 0.000 0.200 0.768
#> GSM875465     5  0.3690    0.60714 0.224 0.000 0.012 0.000 0.764
#> GSM875469     1  0.0404    0.96152 0.988 0.000 0.000 0.000 0.012
#> GSM875470     5  0.4258    0.63625 0.072 0.000 0.160 0.000 0.768
#> GSM875471     5  0.3888    0.64227 0.064 0.000 0.136 0.000 0.800
#> GSM875472     4  0.5159    0.13667 0.044 0.000 0.000 0.556 0.400
#> GSM875475     1  0.0000    0.96720 1.000 0.000 0.000 0.000 0.000
#> GSM875476     1  0.1478    0.91754 0.936 0.000 0.000 0.064 0.000
#> GSM875477     1  0.1608    0.91004 0.928 0.000 0.000 0.072 0.000
#> GSM875414     4  0.3849    0.71883 0.000 0.000 0.016 0.752 0.232
#> GSM875427     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875431     3  0.4756    0.41637 0.000 0.000 0.668 0.288 0.044
#> GSM875433     3  0.3109    0.64163 0.000 0.000 0.800 0.000 0.200
#> GSM875443     3  0.4227   -0.03184 0.000 0.000 0.580 0.000 0.420
#> GSM875444     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875449     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875450     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875452     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875454     3  0.3366    0.60731 0.000 0.000 0.768 0.000 0.232
#> GSM875457     3  0.4256   -0.00388 0.000 0.000 0.564 0.000 0.436
#> GSM875458     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875468     3  0.0000    0.77955 0.000 0.000 1.000 0.000 0.000
#> GSM875412     4  0.0000    0.84816 0.000 0.000 0.000 1.000 0.000
#> GSM875419     4  0.0000    0.84816 0.000 0.000 0.000 1.000 0.000
#> GSM875420     4  0.0000    0.84816 0.000 0.000 0.000 1.000 0.000
#> GSM875421     5  0.4302   -0.18519 0.000 0.000 0.480 0.000 0.520
#> GSM875422     4  0.6535    0.26717 0.000 0.000 0.292 0.476 0.232
#> GSM875426     2  0.6467    0.22639 0.000 0.496 0.272 0.000 0.232
#> GSM875428     4  0.3366    0.72882 0.000 0.000 0.000 0.768 0.232
#> GSM875429     2  0.0000    0.87407 0.000 1.000 0.000 0.000 0.000
#> GSM875434     4  0.0162    0.84677 0.004 0.000 0.000 0.996 0.000
#> GSM875438     4  0.0000    0.84816 0.000 0.000 0.000 1.000 0.000
#> GSM875439     2  0.0000    0.87407 0.000 1.000 0.000 0.000 0.000
#> GSM875440     4  0.3074    0.75335 0.000 0.000 0.000 0.804 0.196
#> GSM875441     4  0.0404    0.84542 0.000 0.000 0.000 0.988 0.012
#> GSM875442     2  0.3983    0.47739 0.000 0.660 0.000 0.340 0.000
#> GSM875446     2  0.0000    0.87407 0.000 1.000 0.000 0.000 0.000
#> GSM875448     4  0.0000    0.84816 0.000 0.000 0.000 1.000 0.000
#> GSM875453     4  0.1270    0.83154 0.000 0.000 0.000 0.948 0.052
#> GSM875455     2  0.0000    0.87407 0.000 1.000 0.000 0.000 0.000
#> GSM875459     2  0.0000    0.87407 0.000 1.000 0.000 0.000 0.000
#> GSM875460     4  0.0000    0.84816 0.000 0.000 0.000 1.000 0.000
#> GSM875463     4  0.0000    0.84816 0.000 0.000 0.000 1.000 0.000
#> GSM875464     4  0.2690    0.75374 0.000 0.156 0.000 0.844 0.000
#> GSM875466     3  0.2773    0.67503 0.000 0.000 0.836 0.000 0.164
#> GSM875473     5  0.3266    0.59384 0.000 0.000 0.200 0.004 0.796
#> GSM875474     2  0.0000    0.87407 0.000 1.000 0.000 0.000 0.000
#> GSM875478     2  0.0000    0.87407 0.000 1.000 0.000 0.000 0.000
#> GSM875479     4  0.3966    0.52347 0.000 0.336 0.000 0.664 0.000
#> GSM875480     3  0.5002    0.50130 0.000 0.000 0.708 0.160 0.132
#> GSM875481     5  0.6540    0.11418 0.000 0.236 0.288 0.000 0.476

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.2902     0.7587 0.800 0.000 0.000 0.196 0.000 0.004
#> GSM875415     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875417     3  0.3961     0.0433 0.004 0.000 0.556 0.000 0.000 0.440
#> GSM875418     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875423     3  0.1714     0.7723 0.092 0.000 0.908 0.000 0.000 0.000
#> GSM875424     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875425     6  0.0547     0.8234 0.020 0.000 0.000 0.000 0.000 0.980
#> GSM875430     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0260     0.9744 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875435     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.0520     0.9699 0.984 0.000 0.000 0.008 0.000 0.008
#> GSM875437     1  0.0260     0.9744 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875447     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.2048     0.8730 0.880 0.000 0.000 0.000 0.000 0.120
#> GSM875462     6  0.0363     0.8156 0.000 0.000 0.000 0.012 0.000 0.988
#> GSM875465     6  0.0547     0.8234 0.020 0.000 0.000 0.000 0.000 0.980
#> GSM875469     1  0.0000     0.9766 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875470     6  0.0603     0.8250 0.016 0.000 0.004 0.000 0.000 0.980
#> GSM875471     6  0.0603     0.8250 0.016 0.000 0.004 0.000 0.000 0.980
#> GSM875472     4  0.4641     0.2066 0.044 0.000 0.000 0.552 0.000 0.404
#> GSM875475     1  0.0260     0.9744 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875476     1  0.0520     0.9705 0.984 0.008 0.000 0.000 0.000 0.008
#> GSM875477     1  0.0520     0.9699 0.984 0.000 0.000 0.008 0.000 0.008
#> GSM875414     5  0.0790     0.9408 0.000 0.000 0.000 0.032 0.968 0.000
#> GSM875427     3  0.3854     0.0816 0.000 0.000 0.536 0.000 0.464 0.000
#> GSM875431     3  0.2527     0.7935 0.000 0.000 0.876 0.040 0.084 0.000
#> GSM875433     3  0.3351     0.5760 0.000 0.000 0.712 0.000 0.288 0.000
#> GSM875443     6  0.3869     0.1351 0.000 0.000 0.500 0.000 0.000 0.500
#> GSM875444     3  0.0000     0.8502 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875445     3  0.0000     0.8502 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875449     3  0.0000     0.8502 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875450     3  0.0000     0.8502 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.0000     0.8502 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875454     5  0.1075     0.9453 0.000 0.000 0.048 0.000 0.952 0.000
#> GSM875457     6  0.4348     0.3344 0.000 0.000 0.416 0.000 0.024 0.560
#> GSM875458     3  0.0000     0.8502 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875467     3  0.0000     0.8502 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875468     3  0.0000     0.8502 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     4  0.0000     0.8949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875419     4  0.0000     0.8949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875420     4  0.0000     0.8949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875421     5  0.1983     0.9216 0.000 0.000 0.072 0.000 0.908 0.020
#> GSM875422     5  0.1720     0.9434 0.000 0.000 0.040 0.032 0.928 0.000
#> GSM875426     5  0.0891     0.9473 0.000 0.008 0.024 0.000 0.968 0.000
#> GSM875428     5  0.0790     0.9408 0.000 0.000 0.000 0.032 0.968 0.000
#> GSM875429     2  0.0000     0.9282 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875434     4  0.0405     0.8904 0.004 0.000 0.000 0.988 0.000 0.008
#> GSM875438     4  0.0000     0.8949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875439     2  0.1049     0.9148 0.000 0.960 0.000 0.000 0.032 0.008
#> GSM875440     5  0.1765     0.8919 0.000 0.000 0.000 0.096 0.904 0.000
#> GSM875441     4  0.0363     0.8899 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM875442     2  0.3684     0.3735 0.000 0.628 0.000 0.372 0.000 0.000
#> GSM875446     2  0.1049     0.9148 0.000 0.960 0.000 0.000 0.032 0.008
#> GSM875448     4  0.0547     0.8870 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM875453     4  0.2135     0.8118 0.000 0.000 0.000 0.872 0.128 0.000
#> GSM875455     2  0.0000     0.9282 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875459     2  0.0000     0.9282 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875460     4  0.0000     0.8949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875463     4  0.0000     0.8949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875464     4  0.2340     0.7683 0.000 0.148 0.000 0.852 0.000 0.000
#> GSM875466     3  0.3333     0.7093 0.000 0.000 0.784 0.000 0.192 0.024
#> GSM875473     6  0.2672     0.7675 0.000 0.000 0.052 0.000 0.080 0.868
#> GSM875474     2  0.0000     0.9282 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875478     2  0.0000     0.9282 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875479     4  0.4370     0.3829 0.000 0.356 0.000 0.616 0.020 0.008
#> GSM875480     3  0.2209     0.8085 0.000 0.000 0.900 0.024 0.072 0.004
#> GSM875481     5  0.1737     0.9412 0.000 0.020 0.040 0.000 0.932 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-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) k
#> SD:pam 69         1.08e-10 2
#> SD:pam 67         2.09e-15 3
#> SD:pam 68         1.34e-15 4
#> SD:pam 59         5.79e-17 5
#> SD:pam 63         2.14e-15 6

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


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

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.396           0.660       0.812         0.3590 0.675   0.675
#> 3 3 0.792           0.871       0.933         0.7840 0.590   0.436
#> 4 4 0.805           0.832       0.899         0.1217 0.757   0.451
#> 5 5 0.843           0.840       0.908         0.0646 0.867   0.582
#> 6 6 0.784           0.812       0.879         0.0470 0.968   0.863

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
#> GSM875413     2  0.8499      0.065 0.276 0.724
#> GSM875415     1  0.9552      0.978 0.624 0.376
#> GSM875416     1  0.9552      0.978 0.624 0.376
#> GSM875417     2  0.9552      0.545 0.376 0.624
#> GSM875418     1  0.9552      0.978 0.624 0.376
#> GSM875423     2  0.9850     -0.563 0.428 0.572
#> GSM875424     2  1.0000     -0.761 0.500 0.500
#> GSM875425     2  0.9881     -0.557 0.436 0.564
#> GSM875430     1  0.9552      0.978 0.624 0.376
#> GSM875432     1  0.9552      0.978 0.624 0.376
#> GSM875435     1  0.9552      0.978 0.624 0.376
#> GSM875436     2  0.6623      0.500 0.172 0.828
#> GSM875437     1  0.9710      0.946 0.600 0.400
#> GSM875447     1  0.9552      0.978 0.624 0.376
#> GSM875451     1  0.9552      0.978 0.624 0.376
#> GSM875456     1  0.9552      0.978 0.624 0.376
#> GSM875461     1  0.9998      0.757 0.508 0.492
#> GSM875462     1  0.9710      0.949 0.600 0.400
#> GSM875465     2  0.6712      0.456 0.176 0.824
#> GSM875469     2  0.9850     -0.563 0.428 0.572
#> GSM875470     2  0.2043      0.755 0.032 0.968
#> GSM875471     2  0.4298      0.748 0.088 0.912
#> GSM875472     2  0.2948      0.710 0.052 0.948
#> GSM875475     1  0.9552      0.978 0.624 0.376
#> GSM875476     2  0.6973      0.463 0.188 0.812
#> GSM875477     1  0.9552      0.978 0.624 0.376
#> GSM875414     2  0.0000      0.762 0.000 1.000
#> GSM875427     2  0.9552      0.545 0.376 0.624
#> GSM875431     2  0.4161      0.750 0.084 0.916
#> GSM875433     2  0.1633      0.761 0.024 0.976
#> GSM875443     2  0.9552      0.545 0.376 0.624
#> GSM875444     2  0.9552      0.545 0.376 0.624
#> GSM875445     2  0.8713      0.604 0.292 0.708
#> GSM875449     2  0.9552      0.545 0.376 0.624
#> GSM875450     2  0.9552      0.545 0.376 0.624
#> GSM875452     2  0.9552      0.545 0.376 0.624
#> GSM875454     2  0.4298      0.748 0.088 0.912
#> GSM875457     2  0.5178      0.733 0.116 0.884
#> GSM875458     2  0.9552      0.545 0.376 0.624
#> GSM875467     2  0.9552      0.545 0.376 0.624
#> GSM875468     2  0.9552      0.545 0.376 0.624
#> GSM875412     2  0.0000      0.762 0.000 1.000
#> GSM875419     2  0.0000      0.762 0.000 1.000
#> GSM875420     2  0.0000      0.762 0.000 1.000
#> GSM875421     2  0.4298      0.748 0.088 0.912
#> GSM875422     2  0.4815      0.740 0.104 0.896
#> GSM875426     2  0.3584      0.754 0.068 0.932
#> GSM875428     2  0.3879      0.752 0.076 0.924
#> GSM875429     2  0.0000      0.762 0.000 1.000
#> GSM875434     2  0.6623      0.500 0.172 0.828
#> GSM875438     2  0.0000      0.762 0.000 1.000
#> GSM875439     2  0.0000      0.762 0.000 1.000
#> GSM875440     2  0.0376      0.762 0.004 0.996
#> GSM875441     2  0.0000      0.762 0.000 1.000
#> GSM875442     2  0.0000      0.762 0.000 1.000
#> GSM875446     2  0.0000      0.762 0.000 1.000
#> GSM875448     2  0.0000      0.762 0.000 1.000
#> GSM875453     2  0.0000      0.762 0.000 1.000
#> GSM875455     2  0.0000      0.762 0.000 1.000
#> GSM875459     2  0.0000      0.762 0.000 1.000
#> GSM875460     2  0.0000      0.762 0.000 1.000
#> GSM875463     2  0.0000      0.762 0.000 1.000
#> GSM875464     2  0.0000      0.762 0.000 1.000
#> GSM875466     2  0.4161      0.750 0.084 0.916
#> GSM875473     2  0.0000      0.762 0.000 1.000
#> GSM875474     2  0.0000      0.762 0.000 1.000
#> GSM875478     2  0.0000      0.762 0.000 1.000
#> GSM875479     2  0.0000      0.762 0.000 1.000
#> GSM875480     2  0.4298      0.748 0.088 0.912
#> GSM875481     2  0.4022      0.751 0.080 0.920

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM875413     1  0.0592      0.957 0.988 0.012 0.000
#> GSM875415     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875417     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875418     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875423     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875424     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875425     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875430     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875436     2  0.5529      0.628 0.296 0.704 0.000
#> GSM875437     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875465     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875469     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875470     1  0.4555      0.687 0.800 0.000 0.200
#> GSM875471     3  0.6192      0.287 0.420 0.000 0.580
#> GSM875472     1  0.0237      0.964 0.996 0.004 0.000
#> GSM875475     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875476     1  0.5760      0.442 0.672 0.328 0.000
#> GSM875477     1  0.0000      0.968 1.000 0.000 0.000
#> GSM875414     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875427     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875431     2  0.5529      0.717 0.000 0.704 0.296
#> GSM875433     2  0.5529      0.717 0.000 0.704 0.296
#> GSM875443     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875454     2  0.5529      0.717 0.000 0.704 0.296
#> GSM875457     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875421     2  0.5529      0.717 0.000 0.704 0.296
#> GSM875422     2  0.5529      0.717 0.000 0.704 0.296
#> GSM875426     2  0.4702      0.781 0.000 0.788 0.212
#> GSM875428     2  0.4796      0.776 0.000 0.780 0.220
#> GSM875429     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875434     2  0.4842      0.714 0.224 0.776 0.000
#> GSM875438     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875440     2  0.3340      0.830 0.000 0.880 0.120
#> GSM875441     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875455     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875460     2  0.0892      0.870 0.000 0.980 0.020
#> GSM875463     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875466     2  0.5529      0.717 0.000 0.704 0.296
#> GSM875473     2  0.5529      0.717 0.000 0.704 0.296
#> GSM875474     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.875 0.000 1.000 0.000
#> GSM875480     2  0.5529      0.717 0.000 0.704 0.296
#> GSM875481     2  0.5529      0.717 0.000 0.704 0.296

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.5249     0.6819 0.708 0.044 0.000 0.248
#> GSM875415     1  0.0000     0.9672 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0188     0.9663 0.996 0.000 0.000 0.004
#> GSM875417     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875418     1  0.0000     0.9672 1.000 0.000 0.000 0.000
#> GSM875423     1  0.0592     0.9615 0.984 0.000 0.000 0.016
#> GSM875424     1  0.0188     0.9663 0.996 0.000 0.000 0.004
#> GSM875425     1  0.0376     0.9645 0.992 0.000 0.004 0.004
#> GSM875430     1  0.0000     0.9672 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0469     0.9643 0.988 0.000 0.000 0.012
#> GSM875435     1  0.0000     0.9672 1.000 0.000 0.000 0.000
#> GSM875436     1  0.4719     0.7271 0.772 0.180 0.000 0.048
#> GSM875437     1  0.0469     0.9643 0.988 0.000 0.000 0.012
#> GSM875447     1  0.0000     0.9672 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9672 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9672 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000     0.9672 1.000 0.000 0.000 0.000
#> GSM875462     1  0.0469     0.9643 0.988 0.000 0.000 0.012
#> GSM875465     1  0.0188     0.9663 0.996 0.000 0.000 0.004
#> GSM875469     1  0.0592     0.9615 0.984 0.000 0.000 0.016
#> GSM875470     3  0.4907     0.2782 0.420 0.000 0.580 0.000
#> GSM875471     3  0.1118     0.9023 0.036 0.000 0.964 0.000
#> GSM875472     1  0.2921     0.8497 0.860 0.000 0.000 0.140
#> GSM875475     1  0.0188     0.9665 0.996 0.000 0.000 0.004
#> GSM875476     1  0.0469     0.9643 0.988 0.000 0.000 0.012
#> GSM875477     1  0.0469     0.9643 0.988 0.000 0.000 0.012
#> GSM875414     4  0.7260     0.4656 0.000 0.188 0.280 0.532
#> GSM875427     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875431     3  0.1940     0.8860 0.000 0.000 0.924 0.076
#> GSM875433     3  0.3958     0.8183 0.000 0.052 0.836 0.112
#> GSM875443     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875449     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875454     3  0.1302     0.9085 0.000 0.000 0.956 0.044
#> GSM875457     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000     0.9212 0.000 0.000 1.000 0.000
#> GSM875412     4  0.5889     0.6766 0.000 0.212 0.100 0.688
#> GSM875419     4  0.5486     0.7196 0.000 0.200 0.080 0.720
#> GSM875420     4  0.3569     0.7582 0.000 0.196 0.000 0.804
#> GSM875421     3  0.2469     0.8723 0.000 0.000 0.892 0.108
#> GSM875422     3  0.2469     0.8723 0.000 0.000 0.892 0.108
#> GSM875426     3  0.6414     0.5146 0.000 0.240 0.636 0.124
#> GSM875428     4  0.6157     0.5756 0.000 0.108 0.232 0.660
#> GSM875429     2  0.0000     0.8513 0.000 1.000 0.000 0.000
#> GSM875434     4  0.6318     0.3836 0.352 0.036 0.020 0.592
#> GSM875438     4  0.5827     0.6504 0.000 0.316 0.052 0.632
#> GSM875439     2  0.1118     0.8447 0.000 0.964 0.000 0.036
#> GSM875440     2  0.7811    -0.0416 0.000 0.380 0.368 0.252
#> GSM875441     4  0.3569     0.7582 0.000 0.196 0.000 0.804
#> GSM875442     2  0.0188     0.8520 0.000 0.996 0.000 0.004
#> GSM875446     2  0.2647     0.7373 0.000 0.880 0.000 0.120
#> GSM875448     4  0.3569     0.7582 0.000 0.196 0.000 0.804
#> GSM875453     4  0.3610     0.7559 0.000 0.200 0.000 0.800
#> GSM875455     2  0.0000     0.8513 0.000 1.000 0.000 0.000
#> GSM875459     2  0.1118     0.8447 0.000 0.964 0.000 0.036
#> GSM875460     4  0.6119     0.6578 0.000 0.168 0.152 0.680
#> GSM875463     4  0.3569     0.7582 0.000 0.196 0.000 0.804
#> GSM875464     4  0.3569     0.7547 0.000 0.196 0.000 0.804
#> GSM875466     3  0.1118     0.9108 0.000 0.000 0.964 0.036
#> GSM875473     3  0.1118     0.9108 0.000 0.000 0.964 0.036
#> GSM875474     2  0.0188     0.8520 0.000 0.996 0.000 0.004
#> GSM875478     2  0.0817     0.8509 0.000 0.976 0.000 0.024
#> GSM875479     4  0.3400     0.7314 0.000 0.180 0.000 0.820
#> GSM875480     3  0.1118     0.9108 0.000 0.000 0.964 0.036
#> GSM875481     3  0.4805     0.7649 0.000 0.084 0.784 0.132

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.3461   8.32e-01 0.812 0.016 0.000 0.168 0.004
#> GSM875415     1  0.0162   9.49e-01 0.996 0.000 0.000 0.004 0.000
#> GSM875416     1  0.0404   9.47e-01 0.988 0.000 0.000 0.012 0.000
#> GSM875417     3  0.0000   8.48e-01 0.000 0.000 1.000 0.000 0.000
#> GSM875418     1  0.0162   9.49e-01 0.996 0.000 0.000 0.004 0.000
#> GSM875423     1  0.1331   9.34e-01 0.952 0.000 0.008 0.040 0.000
#> GSM875424     1  0.0798   9.43e-01 0.976 0.000 0.008 0.016 0.000
#> GSM875425     1  0.1106   9.39e-01 0.964 0.000 0.012 0.024 0.000
#> GSM875430     1  0.0162   9.49e-01 0.996 0.000 0.000 0.004 0.000
#> GSM875432     1  0.0880   9.42e-01 0.968 0.000 0.000 0.032 0.000
#> GSM875435     1  0.0162   9.49e-01 0.996 0.000 0.000 0.004 0.000
#> GSM875436     1  0.4132   7.30e-01 0.760 0.204 0.000 0.032 0.004
#> GSM875437     1  0.0794   9.43e-01 0.972 0.000 0.000 0.028 0.000
#> GSM875447     1  0.0162   9.49e-01 0.996 0.000 0.000 0.004 0.000
#> GSM875451     1  0.0000   9.48e-01 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0162   9.49e-01 0.996 0.000 0.000 0.004 0.000
#> GSM875461     1  0.0162   9.49e-01 0.996 0.000 0.000 0.004 0.000
#> GSM875462     1  0.0880   9.42e-01 0.968 0.000 0.000 0.032 0.000
#> GSM875465     1  0.0992   9.41e-01 0.968 0.000 0.008 0.024 0.000
#> GSM875469     1  0.1205   9.36e-01 0.956 0.000 0.004 0.040 0.000
#> GSM875470     1  0.4192   2.91e-01 0.596 0.000 0.404 0.000 0.000
#> GSM875471     3  0.4294   5.41e-02 0.468 0.000 0.532 0.000 0.000
#> GSM875472     1  0.1282   9.37e-01 0.952 0.000 0.000 0.044 0.004
#> GSM875475     1  0.0290   9.49e-01 0.992 0.000 0.000 0.008 0.000
#> GSM875476     1  0.1168   9.40e-01 0.960 0.008 0.000 0.032 0.000
#> GSM875477     1  0.0880   9.42e-01 0.968 0.000 0.000 0.032 0.000
#> GSM875414     5  0.0865   8.47e-01 0.000 0.024 0.000 0.004 0.972
#> GSM875427     3  0.0290   8.46e-01 0.000 0.000 0.992 0.000 0.008
#> GSM875431     5  0.3143   7.44e-01 0.000 0.000 0.204 0.000 0.796
#> GSM875433     5  0.0162   8.50e-01 0.000 0.000 0.004 0.000 0.996
#> GSM875443     3  0.0000   8.48e-01 0.000 0.000 1.000 0.000 0.000
#> GSM875444     3  0.0000   8.48e-01 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.4300   6.17e-06 0.000 0.000 0.524 0.000 0.476
#> GSM875449     3  0.2605   7.31e-01 0.000 0.000 0.852 0.000 0.148
#> GSM875450     3  0.0000   8.48e-01 0.000 0.000 1.000 0.000 0.000
#> GSM875452     3  0.0290   8.46e-01 0.000 0.000 0.992 0.000 0.008
#> GSM875454     5  0.2966   7.60e-01 0.000 0.000 0.184 0.000 0.816
#> GSM875457     3  0.3857   4.68e-01 0.000 0.000 0.688 0.000 0.312
#> GSM875458     3  0.0000   8.48e-01 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0290   8.46e-01 0.000 0.000 0.992 0.000 0.008
#> GSM875468     3  0.0000   8.48e-01 0.000 0.000 1.000 0.000 0.000
#> GSM875412     5  0.2361   8.10e-01 0.000 0.096 0.000 0.012 0.892
#> GSM875419     5  0.3710   7.48e-01 0.000 0.144 0.000 0.048 0.808
#> GSM875420     4  0.3318   9.82e-01 0.000 0.192 0.000 0.800 0.008
#> GSM875421     5  0.0510   8.49e-01 0.000 0.000 0.016 0.000 0.984
#> GSM875422     5  0.0162   8.50e-01 0.000 0.000 0.004 0.000 0.996
#> GSM875426     5  0.0324   8.49e-01 0.000 0.004 0.000 0.004 0.992
#> GSM875428     5  0.0162   8.49e-01 0.000 0.000 0.000 0.004 0.996
#> GSM875429     2  0.0290   9.81e-01 0.000 0.992 0.000 0.008 0.000
#> GSM875434     5  0.5227   1.48e-01 0.448 0.000 0.000 0.044 0.508
#> GSM875438     5  0.3487   7.12e-01 0.000 0.212 0.000 0.008 0.780
#> GSM875439     2  0.0290   9.80e-01 0.000 0.992 0.000 0.000 0.008
#> GSM875440     5  0.0324   8.49e-01 0.000 0.004 0.000 0.004 0.992
#> GSM875441     4  0.3318   9.82e-01 0.000 0.192 0.000 0.800 0.008
#> GSM875442     2  0.0290   9.81e-01 0.000 0.992 0.000 0.008 0.000
#> GSM875446     2  0.1121   9.36e-01 0.000 0.956 0.000 0.000 0.044
#> GSM875448     4  0.3318   9.82e-01 0.000 0.192 0.000 0.800 0.008
#> GSM875453     4  0.3388   9.79e-01 0.000 0.200 0.000 0.792 0.008
#> GSM875455     2  0.0404   9.79e-01 0.000 0.988 0.000 0.012 0.000
#> GSM875459     2  0.0290   9.80e-01 0.000 0.992 0.000 0.000 0.008
#> GSM875460     5  0.1300   8.44e-01 0.000 0.028 0.000 0.016 0.956
#> GSM875463     4  0.3318   9.82e-01 0.000 0.192 0.000 0.800 0.008
#> GSM875464     4  0.3388   9.79e-01 0.000 0.200 0.000 0.792 0.008
#> GSM875466     5  0.3336   7.16e-01 0.000 0.000 0.228 0.000 0.772
#> GSM875473     5  0.3707   6.31e-01 0.000 0.000 0.284 0.000 0.716
#> GSM875474     2  0.0290   9.81e-01 0.000 0.992 0.000 0.008 0.000
#> GSM875478     2  0.0290   9.80e-01 0.000 0.992 0.000 0.000 0.008
#> GSM875479     4  0.2798   9.14e-01 0.000 0.140 0.000 0.852 0.008
#> GSM875480     5  0.3143   7.44e-01 0.000 0.000 0.204 0.000 0.796
#> GSM875481     5  0.0324   8.49e-01 0.000 0.004 0.000 0.004 0.992

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     6  0.3747     0.8008 0.104 0.000 0.000 0.112 0.000 0.784
#> GSM875415     1  0.1152     0.8278 0.952 0.000 0.000 0.004 0.000 0.044
#> GSM875416     1  0.1219     0.8205 0.948 0.000 0.000 0.048 0.000 0.004
#> GSM875417     3  0.0000     0.9398 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875418     1  0.1152     0.8278 0.952 0.000 0.000 0.004 0.000 0.044
#> GSM875423     1  0.2905     0.7652 0.852 0.000 0.000 0.084 0.000 0.064
#> GSM875424     1  0.1700     0.8034 0.916 0.000 0.000 0.080 0.000 0.004
#> GSM875425     1  0.3017     0.7590 0.844 0.000 0.000 0.084 0.000 0.072
#> GSM875430     1  0.1007     0.8283 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM875432     1  0.3050     0.6440 0.764 0.000 0.000 0.000 0.000 0.236
#> GSM875435     1  0.1152     0.8278 0.952 0.000 0.000 0.004 0.000 0.044
#> GSM875436     1  0.5882    -0.0406 0.476 0.280 0.000 0.000 0.000 0.244
#> GSM875437     1  0.2003     0.7701 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM875447     1  0.1152     0.8278 0.952 0.000 0.000 0.004 0.000 0.044
#> GSM875451     1  0.0000     0.8258 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.1152     0.8278 0.952 0.000 0.000 0.004 0.000 0.044
#> GSM875461     1  0.1141     0.8246 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM875462     1  0.2823     0.6848 0.796 0.000 0.000 0.000 0.000 0.204
#> GSM875465     1  0.2962     0.7654 0.848 0.000 0.000 0.084 0.000 0.068
#> GSM875469     1  0.2905     0.7654 0.852 0.000 0.000 0.084 0.000 0.064
#> GSM875470     3  0.4507     0.5135 0.236 0.000 0.696 0.056 0.000 0.012
#> GSM875471     3  0.2333     0.8044 0.120 0.000 0.872 0.004 0.000 0.004
#> GSM875472     6  0.3394     0.8109 0.200 0.000 0.000 0.024 0.000 0.776
#> GSM875475     1  0.1806     0.8156 0.908 0.000 0.000 0.004 0.000 0.088
#> GSM875476     1  0.3534     0.6192 0.740 0.016 0.000 0.000 0.000 0.244
#> GSM875477     1  0.3076     0.6380 0.760 0.000 0.000 0.000 0.000 0.240
#> GSM875414     5  0.0790     0.8129 0.000 0.032 0.000 0.000 0.968 0.000
#> GSM875427     3  0.0146     0.9380 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM875431     5  0.2793     0.7744 0.000 0.000 0.200 0.000 0.800 0.000
#> GSM875433     5  0.1493     0.7993 0.000 0.056 0.004 0.000 0.936 0.004
#> GSM875443     3  0.0000     0.9398 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875444     3  0.0000     0.9398 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875445     3  0.1610     0.8705 0.000 0.000 0.916 0.000 0.084 0.000
#> GSM875449     3  0.0632     0.9261 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM875450     3  0.0000     0.9398 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.0146     0.9380 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM875454     5  0.2762     0.7776 0.000 0.000 0.196 0.000 0.804 0.000
#> GSM875457     3  0.1204     0.8990 0.000 0.000 0.944 0.000 0.056 0.000
#> GSM875458     3  0.0000     0.9398 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875467     3  0.0000     0.9398 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875468     3  0.0000     0.9398 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     5  0.2346     0.7912 0.000 0.124 0.000 0.000 0.868 0.008
#> GSM875419     5  0.3455     0.7353 0.000 0.180 0.000 0.036 0.784 0.000
#> GSM875420     4  0.2793     0.9371 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM875421     5  0.1765     0.8141 0.000 0.000 0.096 0.000 0.904 0.000
#> GSM875422     5  0.2003     0.8100 0.000 0.000 0.116 0.000 0.884 0.000
#> GSM875426     5  0.2197     0.7817 0.000 0.056 0.000 0.000 0.900 0.044
#> GSM875428     5  0.0146     0.8080 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM875429     2  0.0000     0.9791 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875434     5  0.6015     0.0307 0.256 0.000 0.000 0.008 0.496 0.240
#> GSM875438     5  0.3243     0.7329 0.000 0.208 0.000 0.004 0.780 0.008
#> GSM875439     2  0.0260     0.9765 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM875440     5  0.1657     0.7954 0.000 0.056 0.000 0.000 0.928 0.016
#> GSM875441     4  0.2793     0.9371 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM875442     2  0.0000     0.9791 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875446     2  0.1787     0.8821 0.000 0.920 0.000 0.004 0.068 0.008
#> GSM875448     4  0.2793     0.9371 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM875453     4  0.2300     0.9155 0.000 0.144 0.000 0.856 0.000 0.000
#> GSM875455     2  0.0260     0.9730 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM875459     2  0.0260     0.9765 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM875460     5  0.1644     0.8089 0.000 0.076 0.000 0.004 0.920 0.000
#> GSM875463     4  0.2793     0.9371 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM875464     4  0.2378     0.9214 0.000 0.152 0.000 0.848 0.000 0.000
#> GSM875466     5  0.3023     0.7418 0.000 0.000 0.232 0.000 0.768 0.000
#> GSM875473     5  0.4921     0.6884 0.000 0.000 0.192 0.056 0.700 0.052
#> GSM875474     2  0.0000     0.9791 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875478     2  0.0000     0.9791 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875479     4  0.2331     0.7719 0.000 0.032 0.000 0.888 0.000 0.080
#> GSM875480     5  0.2793     0.7744 0.000 0.000 0.200 0.000 0.800 0.000
#> GSM875481     5  0.2197     0.7817 0.000 0.056 0.000 0.000 0.900 0.044

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) k
#> SD:mclust 61         3.75e-10 2
#> SD:mclust 68         7.71e-21 3
#> SD:mclust 66         3.94e-17 4
#> SD:mclust 65         3.12e-18 5
#> SD:mclust 68         1.64e-16 6

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


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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.939           0.927       0.972         0.5008 0.499   0.499
#> 3 3 0.980           0.927       0.971         0.3472 0.713   0.484
#> 4 4 0.799           0.853       0.920         0.1020 0.906   0.722
#> 5 5 0.785           0.759       0.884         0.0478 0.895   0.640
#> 6 6 0.755           0.684       0.839         0.0398 0.901   0.610

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
#> GSM875413     1  0.0000     0.9703 1.000 0.000
#> GSM875415     1  0.0000     0.9703 1.000 0.000
#> GSM875416     1  0.0000     0.9703 1.000 0.000
#> GSM875417     1  0.0000     0.9703 1.000 0.000
#> GSM875418     1  0.0000     0.9703 1.000 0.000
#> GSM875423     1  0.0000     0.9703 1.000 0.000
#> GSM875424     1  0.0000     0.9703 1.000 0.000
#> GSM875425     1  0.0000     0.9703 1.000 0.000
#> GSM875430     1  0.0000     0.9703 1.000 0.000
#> GSM875432     1  0.0000     0.9703 1.000 0.000
#> GSM875435     1  0.0000     0.9703 1.000 0.000
#> GSM875436     1  0.9580     0.3688 0.620 0.380
#> GSM875437     1  0.0000     0.9703 1.000 0.000
#> GSM875447     1  0.0000     0.9703 1.000 0.000
#> GSM875451     1  0.0000     0.9703 1.000 0.000
#> GSM875456     1  0.0000     0.9703 1.000 0.000
#> GSM875461     1  0.0000     0.9703 1.000 0.000
#> GSM875462     1  0.0000     0.9703 1.000 0.000
#> GSM875465     1  0.0000     0.9703 1.000 0.000
#> GSM875469     1  0.0000     0.9703 1.000 0.000
#> GSM875470     1  0.0000     0.9703 1.000 0.000
#> GSM875471     1  0.0000     0.9703 1.000 0.000
#> GSM875472     1  0.0000     0.9703 1.000 0.000
#> GSM875475     1  0.0000     0.9703 1.000 0.000
#> GSM875476     1  0.0000     0.9703 1.000 0.000
#> GSM875477     1  0.0000     0.9703 1.000 0.000
#> GSM875414     2  0.0000     0.9698 0.000 1.000
#> GSM875427     2  0.0000     0.9698 0.000 1.000
#> GSM875431     2  0.0376     0.9664 0.004 0.996
#> GSM875433     2  0.0000     0.9698 0.000 1.000
#> GSM875443     1  0.0000     0.9703 1.000 0.000
#> GSM875444     1  0.6712     0.7788 0.824 0.176
#> GSM875445     2  0.0000     0.9698 0.000 1.000
#> GSM875449     2  0.0000     0.9698 0.000 1.000
#> GSM875450     1  0.3584     0.9106 0.932 0.068
#> GSM875452     2  0.0000     0.9698 0.000 1.000
#> GSM875454     2  0.0000     0.9698 0.000 1.000
#> GSM875457     2  0.0000     0.9698 0.000 1.000
#> GSM875458     1  0.7219     0.7481 0.800 0.200
#> GSM875467     2  0.2778     0.9249 0.048 0.952
#> GSM875468     1  0.1633     0.9512 0.976 0.024
#> GSM875412     2  0.0000     0.9698 0.000 1.000
#> GSM875419     2  0.0000     0.9698 0.000 1.000
#> GSM875420     2  0.0000     0.9698 0.000 1.000
#> GSM875421     2  0.0000     0.9698 0.000 1.000
#> GSM875422     2  0.0000     0.9698 0.000 1.000
#> GSM875426     2  0.0000     0.9698 0.000 1.000
#> GSM875428     2  0.0000     0.9698 0.000 1.000
#> GSM875429     2  0.0000     0.9698 0.000 1.000
#> GSM875434     2  0.9996     0.0354 0.488 0.512
#> GSM875438     2  0.0000     0.9698 0.000 1.000
#> GSM875439     2  0.0000     0.9698 0.000 1.000
#> GSM875440     2  0.0000     0.9698 0.000 1.000
#> GSM875441     2  0.0000     0.9698 0.000 1.000
#> GSM875442     2  0.0000     0.9698 0.000 1.000
#> GSM875446     2  0.0000     0.9698 0.000 1.000
#> GSM875448     2  0.0000     0.9698 0.000 1.000
#> GSM875453     2  0.0000     0.9698 0.000 1.000
#> GSM875455     2  0.5059     0.8553 0.112 0.888
#> GSM875459     2  0.0000     0.9698 0.000 1.000
#> GSM875460     2  0.0000     0.9698 0.000 1.000
#> GSM875463     2  0.0000     0.9698 0.000 1.000
#> GSM875464     2  0.0000     0.9698 0.000 1.000
#> GSM875466     2  0.0000     0.9698 0.000 1.000
#> GSM875473     2  0.9922     0.1728 0.448 0.552
#> GSM875474     2  0.0000     0.9698 0.000 1.000
#> GSM875478     2  0.0000     0.9698 0.000 1.000
#> GSM875479     2  0.0000     0.9698 0.000 1.000
#> GSM875480     2  0.0000     0.9698 0.000 1.000
#> GSM875481     2  0.0000     0.9698 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
#> GSM875413     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875415     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875417     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875418     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875423     1  0.0892      0.967 0.980 0.000 0.020
#> GSM875424     1  0.2165      0.924 0.936 0.000 0.064
#> GSM875425     1  0.5363      0.620 0.724 0.000 0.276
#> GSM875430     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875436     2  0.5733      0.528 0.324 0.676 0.000
#> GSM875437     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875465     1  0.0424      0.976 0.992 0.000 0.008
#> GSM875469     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875470     3  0.1031      0.956 0.024 0.000 0.976
#> GSM875471     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875472     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875475     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875476     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875477     1  0.0000      0.982 1.000 0.000 0.000
#> GSM875414     2  0.0424      0.944 0.000 0.992 0.008
#> GSM875427     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875431     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875433     3  0.6095      0.336 0.000 0.392 0.608
#> GSM875443     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875454     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875457     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875421     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875422     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875426     2  0.0237      0.947 0.000 0.996 0.004
#> GSM875428     2  0.0237      0.947 0.000 0.996 0.004
#> GSM875429     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875434     2  0.6267      0.215 0.452 0.548 0.000
#> GSM875438     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875455     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875460     2  0.0424      0.944 0.000 0.992 0.008
#> GSM875463     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875473     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875474     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875480     3  0.0000      0.979 0.000 0.000 1.000
#> GSM875481     2  0.6192      0.266 0.000 0.580 0.420

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875415     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875417     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875418     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875423     1  0.3172      0.804 0.840 0.000 0.160 0.000
#> GSM875424     1  0.2921      0.824 0.860 0.000 0.140 0.000
#> GSM875425     1  0.4040      0.689 0.752 0.000 0.248 0.000
#> GSM875430     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875436     1  0.1629      0.896 0.952 0.024 0.000 0.024
#> GSM875437     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875462     1  0.0592      0.918 0.984 0.000 0.000 0.016
#> GSM875465     1  0.2921      0.821 0.860 0.000 0.140 0.000
#> GSM875469     1  0.0188      0.923 0.996 0.000 0.004 0.000
#> GSM875470     3  0.2466      0.873 0.096 0.000 0.900 0.004
#> GSM875471     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875472     1  0.4500      0.531 0.684 0.000 0.000 0.316
#> GSM875475     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875476     1  0.4916      0.250 0.576 0.424 0.000 0.000
#> GSM875477     1  0.0000      0.925 1.000 0.000 0.000 0.000
#> GSM875414     4  0.5478      0.485 0.000 0.344 0.028 0.628
#> GSM875427     3  0.1389      0.932 0.000 0.000 0.952 0.048
#> GSM875431     3  0.1211      0.941 0.000 0.000 0.960 0.040
#> GSM875433     2  0.2799      0.861 0.000 0.884 0.008 0.108
#> GSM875443     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875449     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0188      0.958 0.000 0.000 0.996 0.004
#> GSM875454     3  0.1118      0.942 0.000 0.000 0.964 0.036
#> GSM875457     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM875412     4  0.0921      0.816 0.000 0.028 0.000 0.972
#> GSM875419     4  0.1867      0.848 0.000 0.072 0.000 0.928
#> GSM875420     4  0.0707      0.831 0.000 0.020 0.000 0.980
#> GSM875421     3  0.0469      0.954 0.000 0.000 0.988 0.012
#> GSM875422     3  0.3306      0.843 0.000 0.004 0.840 0.156
#> GSM875426     2  0.1867      0.889 0.000 0.928 0.000 0.072
#> GSM875428     4  0.2976      0.805 0.000 0.120 0.008 0.872
#> GSM875429     2  0.0817      0.919 0.000 0.976 0.000 0.024
#> GSM875434     4  0.5550      0.238 0.428 0.020 0.000 0.552
#> GSM875438     4  0.2973      0.752 0.000 0.144 0.000 0.856
#> GSM875439     2  0.0469      0.922 0.000 0.988 0.000 0.012
#> GSM875440     4  0.5000      0.181 0.000 0.500 0.000 0.500
#> GSM875441     4  0.2345      0.851 0.000 0.100 0.000 0.900
#> GSM875442     2  0.0469      0.922 0.000 0.988 0.000 0.012
#> GSM875446     2  0.1211      0.910 0.000 0.960 0.000 0.040
#> GSM875448     4  0.2281      0.852 0.000 0.096 0.000 0.904
#> GSM875453     4  0.2281      0.852 0.000 0.096 0.000 0.904
#> GSM875455     2  0.1059      0.917 0.012 0.972 0.000 0.016
#> GSM875459     2  0.1716      0.894 0.000 0.936 0.000 0.064
#> GSM875460     4  0.2281      0.852 0.000 0.096 0.000 0.904
#> GSM875463     4  0.2281      0.852 0.000 0.096 0.000 0.904
#> GSM875464     4  0.2408      0.850 0.000 0.104 0.000 0.896
#> GSM875466     3  0.0188      0.958 0.000 0.000 0.996 0.004
#> GSM875473     3  0.2760      0.860 0.000 0.000 0.872 0.128
#> GSM875474     2  0.0469      0.921 0.000 0.988 0.000 0.012
#> GSM875478     2  0.2216      0.866 0.000 0.908 0.000 0.092
#> GSM875479     4  0.2469      0.848 0.000 0.108 0.000 0.892
#> GSM875480     3  0.4103      0.670 0.000 0.000 0.744 0.256
#> GSM875481     2  0.3649      0.713 0.000 0.796 0.204 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875415     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0162     0.9095 0.996 0.000 0.000 0.000 0.004
#> GSM875417     3  0.0162     0.8856 0.000 0.000 0.996 0.004 0.000
#> GSM875418     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.4251     0.4132 0.624 0.000 0.372 0.004 0.000
#> GSM875424     1  0.1831     0.8505 0.920 0.000 0.076 0.004 0.000
#> GSM875425     3  0.4696     0.3061 0.400 0.000 0.584 0.004 0.012
#> GSM875430     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0162     0.9094 0.996 0.000 0.000 0.000 0.004
#> GSM875435     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.4268     0.5816 0.708 0.004 0.000 0.016 0.272
#> GSM875437     1  0.0609     0.9029 0.980 0.000 0.000 0.000 0.020
#> GSM875447     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.0162     0.9095 0.996 0.000 0.000 0.000 0.004
#> GSM875462     1  0.2439     0.8343 0.876 0.004 0.000 0.000 0.120
#> GSM875465     1  0.4025     0.5738 0.700 0.000 0.292 0.008 0.000
#> GSM875469     1  0.0162     0.9091 0.996 0.000 0.000 0.004 0.000
#> GSM875470     3  0.4429     0.6198 0.192 0.000 0.744 0.000 0.064
#> GSM875471     3  0.1502     0.8592 0.004 0.000 0.940 0.000 0.056
#> GSM875472     4  0.3086     0.7033 0.180 0.000 0.000 0.816 0.004
#> GSM875475     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875476     1  0.1544     0.8656 0.932 0.068 0.000 0.000 0.000
#> GSM875477     1  0.0000     0.9105 1.000 0.000 0.000 0.000 0.000
#> GSM875414     5  0.4743     0.5802 0.000 0.184 0.012 0.064 0.740
#> GSM875427     3  0.3561     0.6391 0.000 0.000 0.740 0.000 0.260
#> GSM875431     5  0.4425     0.2421 0.000 0.000 0.452 0.004 0.544
#> GSM875433     5  0.3003     0.5516 0.000 0.188 0.000 0.000 0.812
#> GSM875443     3  0.0162     0.8848 0.000 0.000 0.996 0.000 0.004
#> GSM875444     3  0.0162     0.8856 0.000 0.000 0.996 0.004 0.000
#> GSM875445     3  0.0880     0.8740 0.000 0.000 0.968 0.000 0.032
#> GSM875449     3  0.0162     0.8856 0.000 0.000 0.996 0.004 0.000
#> GSM875450     3  0.0162     0.8856 0.000 0.000 0.996 0.004 0.000
#> GSM875452     3  0.0609     0.8803 0.000 0.000 0.980 0.000 0.020
#> GSM875454     3  0.2909     0.7686 0.000 0.000 0.848 0.012 0.140
#> GSM875457     3  0.0162     0.8856 0.000 0.000 0.996 0.004 0.000
#> GSM875458     3  0.0000     0.8848 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0162     0.8842 0.000 0.000 0.996 0.000 0.004
#> GSM875468     3  0.0162     0.8856 0.000 0.000 0.996 0.004 0.000
#> GSM875412     5  0.2648     0.5308 0.000 0.000 0.000 0.152 0.848
#> GSM875419     4  0.3612     0.6948 0.000 0.000 0.000 0.732 0.268
#> GSM875420     4  0.3508     0.7392 0.000 0.000 0.000 0.748 0.252
#> GSM875421     3  0.0880     0.8725 0.000 0.000 0.968 0.000 0.032
#> GSM875422     5  0.4561    -0.0708 0.000 0.000 0.488 0.008 0.504
#> GSM875426     5  0.4437     0.1241 0.000 0.464 0.004 0.000 0.532
#> GSM875428     5  0.5272     0.5309 0.000 0.104 0.004 0.212 0.680
#> GSM875429     2  0.0290     0.9048 0.000 0.992 0.000 0.008 0.000
#> GSM875434     1  0.5429     0.3462 0.564 0.000 0.000 0.068 0.368
#> GSM875438     5  0.1469     0.5824 0.000 0.016 0.000 0.036 0.948
#> GSM875439     2  0.0865     0.8965 0.000 0.972 0.000 0.004 0.024
#> GSM875440     5  0.5164     0.5350 0.000 0.232 0.000 0.096 0.672
#> GSM875441     4  0.1205     0.8900 0.000 0.004 0.000 0.956 0.040
#> GSM875442     2  0.1121     0.8870 0.000 0.956 0.000 0.000 0.044
#> GSM875446     2  0.3300     0.6802 0.000 0.792 0.000 0.004 0.204
#> GSM875448     4  0.1408     0.8885 0.000 0.008 0.000 0.948 0.044
#> GSM875453     4  0.1124     0.8914 0.000 0.004 0.000 0.960 0.036
#> GSM875455     2  0.0693     0.9041 0.000 0.980 0.000 0.012 0.008
#> GSM875459     2  0.0794     0.9016 0.000 0.972 0.000 0.028 0.000
#> GSM875460     4  0.1282     0.8862 0.000 0.000 0.004 0.952 0.044
#> GSM875463     4  0.0451     0.8893 0.000 0.004 0.000 0.988 0.008
#> GSM875464     4  0.0693     0.8842 0.000 0.008 0.000 0.980 0.012
#> GSM875466     5  0.4300     0.2220 0.000 0.000 0.476 0.000 0.524
#> GSM875473     3  0.3561     0.5843 0.000 0.000 0.740 0.260 0.000
#> GSM875474     2  0.0290     0.9047 0.000 0.992 0.000 0.008 0.000
#> GSM875478     2  0.2136     0.8510 0.000 0.904 0.000 0.088 0.008
#> GSM875479     4  0.0771     0.8817 0.000 0.020 0.000 0.976 0.004
#> GSM875480     3  0.2171     0.8339 0.000 0.000 0.912 0.064 0.024
#> GSM875481     2  0.3326     0.7065 0.000 0.824 0.152 0.000 0.024

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.1096     0.8851 0.964 0.004 0.000 0.004 0.008 0.020
#> GSM875415     1  0.0291     0.8931 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM875416     1  0.1410     0.8845 0.944 0.004 0.000 0.000 0.008 0.044
#> GSM875417     3  0.0405     0.8059 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM875418     1  0.1230     0.8899 0.956 0.008 0.000 0.000 0.008 0.028
#> GSM875423     3  0.3863     0.5224 0.244 0.000 0.728 0.000 0.008 0.020
#> GSM875424     1  0.2941     0.6539 0.780 0.000 0.220 0.000 0.000 0.000
#> GSM875425     1  0.5540     0.2707 0.556 0.004 0.324 0.000 0.008 0.108
#> GSM875430     1  0.0717     0.8894 0.976 0.000 0.000 0.000 0.008 0.016
#> GSM875432     1  0.0508     0.8939 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM875435     1  0.0291     0.8944 0.992 0.004 0.000 0.000 0.004 0.000
#> GSM875436     5  0.4357     0.1926 0.420 0.000 0.000 0.008 0.560 0.012
#> GSM875437     1  0.2377     0.8226 0.868 0.004 0.000 0.000 0.004 0.124
#> GSM875447     1  0.0405     0.8945 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM875451     1  0.0508     0.8918 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM875456     1  0.1065     0.8910 0.964 0.008 0.000 0.000 0.008 0.020
#> GSM875461     1  0.1196     0.8873 0.952 0.000 0.000 0.000 0.008 0.040
#> GSM875462     6  0.4794     0.4205 0.268 0.036 0.000 0.020 0.008 0.668
#> GSM875465     3  0.4702     0.1545 0.436 0.012 0.532 0.000 0.008 0.012
#> GSM875469     1  0.0508     0.8918 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM875470     6  0.5408     0.5025 0.084 0.008 0.268 0.004 0.012 0.624
#> GSM875471     3  0.4593     0.3772 0.020 0.012 0.636 0.000 0.008 0.324
#> GSM875472     4  0.3114     0.7416 0.136 0.004 0.000 0.832 0.004 0.024
#> GSM875475     1  0.1268     0.8871 0.952 0.008 0.000 0.000 0.004 0.036
#> GSM875476     1  0.2402     0.8378 0.888 0.084 0.000 0.000 0.008 0.020
#> GSM875477     1  0.0912     0.8924 0.972 0.008 0.000 0.004 0.004 0.012
#> GSM875414     5  0.1307     0.6085 0.000 0.032 0.000 0.008 0.952 0.008
#> GSM875427     6  0.3394     0.5757 0.000 0.000 0.236 0.000 0.012 0.752
#> GSM875431     3  0.5241    -0.0141 0.000 0.000 0.472 0.004 0.444 0.080
#> GSM875433     6  0.4697     0.2694 0.000 0.048 0.000 0.004 0.348 0.600
#> GSM875443     3  0.1714     0.7709 0.000 0.000 0.908 0.000 0.000 0.092
#> GSM875444     3  0.0000     0.8069 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875445     3  0.1267     0.7879 0.000 0.000 0.940 0.000 0.000 0.060
#> GSM875449     3  0.0260     0.8062 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM875450     3  0.0000     0.8069 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.2730     0.6645 0.000 0.000 0.808 0.000 0.000 0.192
#> GSM875454     3  0.4832     0.5048 0.000 0.000 0.680 0.012 0.092 0.216
#> GSM875457     3  0.0000     0.8069 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875458     3  0.0000     0.8069 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875467     3  0.0632     0.8020 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM875468     3  0.0000     0.8069 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     5  0.3755     0.4626 0.000 0.000 0.000 0.036 0.744 0.220
#> GSM875419     4  0.5085     0.6913 0.000 0.004 0.000 0.644 0.208 0.144
#> GSM875420     4  0.4091     0.7487 0.000 0.000 0.000 0.732 0.068 0.200
#> GSM875421     3  0.2174     0.7599 0.000 0.000 0.896 0.008 0.088 0.008
#> GSM875422     6  0.5458     0.4598 0.000 0.000 0.236 0.004 0.172 0.588
#> GSM875426     5  0.4495     0.3073 0.000 0.256 0.000 0.000 0.672 0.072
#> GSM875428     5  0.2214     0.5851 0.000 0.012 0.000 0.092 0.892 0.004
#> GSM875429     2  0.2361     0.8096 0.000 0.880 0.000 0.004 0.104 0.012
#> GSM875434     1  0.4946     0.1976 0.556 0.000 0.000 0.008 0.052 0.384
#> GSM875438     6  0.2170     0.5131 0.000 0.000 0.000 0.012 0.100 0.888
#> GSM875439     2  0.3407     0.7798 0.000 0.800 0.000 0.016 0.168 0.016
#> GSM875440     5  0.1257     0.6109 0.000 0.028 0.000 0.020 0.952 0.000
#> GSM875441     4  0.2062     0.8558 0.000 0.008 0.000 0.900 0.088 0.004
#> GSM875442     2  0.3628     0.6928 0.000 0.720 0.000 0.004 0.268 0.008
#> GSM875446     2  0.5104     0.4618 0.000 0.560 0.000 0.012 0.368 0.060
#> GSM875448     4  0.2805     0.8181 0.000 0.000 0.000 0.812 0.184 0.004
#> GSM875453     4  0.2513     0.8405 0.000 0.000 0.000 0.852 0.140 0.008
#> GSM875455     2  0.0912     0.8145 0.004 0.972 0.000 0.012 0.008 0.004
#> GSM875459     2  0.1913     0.8176 0.000 0.924 0.000 0.044 0.016 0.016
#> GSM875460     4  0.2356     0.8577 0.000 0.004 0.004 0.900 0.044 0.048
#> GSM875463     4  0.1765     0.8580 0.000 0.000 0.000 0.904 0.096 0.000
#> GSM875464     4  0.1003     0.8447 0.000 0.020 0.000 0.964 0.000 0.016
#> GSM875466     5  0.4293     0.0123 0.000 0.000 0.448 0.012 0.536 0.004
#> GSM875473     3  0.2877     0.6789 0.000 0.000 0.820 0.168 0.012 0.000
#> GSM875474     2  0.0653     0.8169 0.000 0.980 0.000 0.004 0.012 0.004
#> GSM875478     2  0.1700     0.8000 0.000 0.916 0.000 0.080 0.004 0.000
#> GSM875479     4  0.1408     0.8371 0.000 0.036 0.000 0.944 0.000 0.020
#> GSM875480     3  0.1780     0.7821 0.000 0.000 0.924 0.048 0.028 0.000
#> GSM875481     2  0.5020     0.6180 0.000 0.700 0.108 0.000 0.036 0.156

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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.578           0.871       0.909         0.4612 0.552   0.552
#> 3 3 0.738           0.820       0.915         0.4330 0.784   0.609
#> 4 4 0.703           0.570       0.801         0.0942 0.877   0.663
#> 5 5 0.665           0.670       0.772         0.0443 0.866   0.597
#> 6 6 0.727           0.707       0.816         0.0356 0.941   0.779

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
#> GSM875413     1  0.0000      0.995 1.000 0.000
#> GSM875415     1  0.0000      0.995 1.000 0.000
#> GSM875416     1  0.0672      0.992 0.992 0.008
#> GSM875417     2  0.9170      0.714 0.332 0.668
#> GSM875418     1  0.0000      0.995 1.000 0.000
#> GSM875423     1  0.0672      0.991 0.992 0.008
#> GSM875424     1  0.0672      0.992 0.992 0.008
#> GSM875425     1  0.0672      0.992 0.992 0.008
#> GSM875430     1  0.0000      0.995 1.000 0.000
#> GSM875432     1  0.0672      0.991 0.992 0.008
#> GSM875435     1  0.0000      0.995 1.000 0.000
#> GSM875436     2  0.8555      0.680 0.280 0.720
#> GSM875437     1  0.0938      0.987 0.988 0.012
#> GSM875447     1  0.0000      0.995 1.000 0.000
#> GSM875451     1  0.0000      0.995 1.000 0.000
#> GSM875456     1  0.0000      0.995 1.000 0.000
#> GSM875461     1  0.0000      0.995 1.000 0.000
#> GSM875462     1  0.0000      0.995 1.000 0.000
#> GSM875465     1  0.1184      0.983 0.984 0.016
#> GSM875469     1  0.0000      0.995 1.000 0.000
#> GSM875470     1  0.0672      0.992 0.992 0.008
#> GSM875471     1  0.0672      0.992 0.992 0.008
#> GSM875472     1  0.0000      0.995 1.000 0.000
#> GSM875475     1  0.0000      0.995 1.000 0.000
#> GSM875476     2  0.8608      0.677 0.284 0.716
#> GSM875477     1  0.0000      0.995 1.000 0.000
#> GSM875414     2  0.1414      0.858 0.020 0.980
#> GSM875427     2  0.8813      0.752 0.300 0.700
#> GSM875431     2  0.5737      0.838 0.136 0.864
#> GSM875433     2  0.2423      0.857 0.040 0.960
#> GSM875443     2  0.9000      0.735 0.316 0.684
#> GSM875444     2  0.8909      0.745 0.308 0.692
#> GSM875445     2  0.8861      0.749 0.304 0.696
#> GSM875449     2  0.8861      0.749 0.304 0.696
#> GSM875450     2  0.8909      0.745 0.308 0.692
#> GSM875452     2  0.8813      0.752 0.300 0.700
#> GSM875454     2  0.8661      0.762 0.288 0.712
#> GSM875457     2  0.8763      0.756 0.296 0.704
#> GSM875458     2  0.8861      0.749 0.304 0.696
#> GSM875467     2  0.8861      0.749 0.304 0.696
#> GSM875468     2  0.8861      0.749 0.304 0.696
#> GSM875412     2  0.0000      0.855 0.000 1.000
#> GSM875419     2  0.3584      0.851 0.068 0.932
#> GSM875420     2  0.0000      0.855 0.000 1.000
#> GSM875421     2  0.7883      0.795 0.236 0.764
#> GSM875422     2  0.8016      0.791 0.244 0.756
#> GSM875426     2  0.1414      0.858 0.020 0.980
#> GSM875428     2  0.1414      0.858 0.020 0.980
#> GSM875429     2  0.0000      0.855 0.000 1.000
#> GSM875434     2  0.3879      0.849 0.076 0.924
#> GSM875438     2  0.0000      0.855 0.000 1.000
#> GSM875439     2  0.0000      0.855 0.000 1.000
#> GSM875440     2  0.1414      0.858 0.020 0.980
#> GSM875441     2  0.0376      0.855 0.004 0.996
#> GSM875442     2  0.3274      0.853 0.060 0.940
#> GSM875446     2  0.0000      0.855 0.000 1.000
#> GSM875448     2  0.0000      0.855 0.000 1.000
#> GSM875453     2  0.0000      0.855 0.000 1.000
#> GSM875455     2  0.0000      0.855 0.000 1.000
#> GSM875459     2  0.0000      0.855 0.000 1.000
#> GSM875460     2  0.1633      0.856 0.024 0.976
#> GSM875463     2  0.0000      0.855 0.000 1.000
#> GSM875464     2  0.0000      0.855 0.000 1.000
#> GSM875466     2  0.6531      0.828 0.168 0.832
#> GSM875473     2  0.8386      0.777 0.268 0.732
#> GSM875474     2  0.0000      0.855 0.000 1.000
#> GSM875478     2  0.0000      0.855 0.000 1.000
#> GSM875479     2  0.0000      0.855 0.000 1.000
#> GSM875480     2  0.7453      0.807 0.212 0.788
#> GSM875481     2  0.5519      0.840 0.128 0.872

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM875413     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875415     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875416     1  0.0424      0.991 0.992 0.000 0.008
#> GSM875417     3  0.3038      0.803 0.104 0.000 0.896
#> GSM875418     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875423     1  0.0424      0.990 0.992 0.000 0.008
#> GSM875424     1  0.0424      0.991 0.992 0.000 0.008
#> GSM875425     1  0.0424      0.991 0.992 0.000 0.008
#> GSM875430     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875432     1  0.0424      0.990 0.992 0.000 0.008
#> GSM875435     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875436     2  0.5953      0.583 0.280 0.708 0.012
#> GSM875437     1  0.0661      0.988 0.988 0.004 0.008
#> GSM875447     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875465     1  0.0829      0.986 0.984 0.004 0.012
#> GSM875469     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875470     1  0.1289      0.970 0.968 0.000 0.032
#> GSM875471     1  0.1289      0.970 0.968 0.000 0.032
#> GSM875472     1  0.0237      0.992 0.996 0.000 0.004
#> GSM875475     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875476     2  0.5986      0.578 0.284 0.704 0.012
#> GSM875477     1  0.0000      0.994 1.000 0.000 0.000
#> GSM875414     2  0.6062      0.468 0.000 0.616 0.384
#> GSM875427     3  0.0000      0.882 0.000 0.000 1.000
#> GSM875431     3  0.6309     -0.173 0.000 0.496 0.504
#> GSM875433     2  0.5905      0.520 0.000 0.648 0.352
#> GSM875443     3  0.0747      0.876 0.016 0.000 0.984
#> GSM875444     3  0.0424      0.882 0.008 0.000 0.992
#> GSM875445     3  0.0237      0.883 0.004 0.000 0.996
#> GSM875449     3  0.0237      0.883 0.004 0.000 0.996
#> GSM875450     3  0.0424      0.882 0.008 0.000 0.992
#> GSM875452     3  0.0000      0.882 0.000 0.000 1.000
#> GSM875454     3  0.3551      0.800 0.000 0.132 0.868
#> GSM875457     3  0.0829      0.880 0.004 0.012 0.984
#> GSM875458     3  0.0237      0.883 0.004 0.000 0.996
#> GSM875467     3  0.0237      0.883 0.004 0.000 0.996
#> GSM875468     3  0.0237      0.883 0.004 0.000 0.996
#> GSM875412     2  0.3816      0.763 0.000 0.852 0.148
#> GSM875419     2  0.6447      0.697 0.060 0.744 0.196
#> GSM875420     2  0.1031      0.822 0.000 0.976 0.024
#> GSM875421     3  0.4702      0.712 0.000 0.212 0.788
#> GSM875422     3  0.4555      0.727 0.000 0.200 0.800
#> GSM875426     2  0.5760      0.563 0.000 0.672 0.328
#> GSM875428     2  0.6079      0.458 0.000 0.612 0.388
#> GSM875429     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875434     2  0.6576      0.696 0.068 0.740 0.192
#> GSM875438     2  0.1031      0.822 0.000 0.976 0.024
#> GSM875439     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875440     2  0.4654      0.709 0.000 0.792 0.208
#> GSM875441     2  0.0424      0.827 0.000 0.992 0.008
#> GSM875442     2  0.3237      0.798 0.056 0.912 0.032
#> GSM875446     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875455     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875460     2  0.5864      0.622 0.008 0.704 0.288
#> GSM875463     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875466     2  0.6126      0.407 0.000 0.600 0.400
#> GSM875473     3  0.4514      0.779 0.012 0.156 0.832
#> GSM875474     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.828 0.000 1.000 0.000
#> GSM875480     3  0.4974      0.678 0.000 0.236 0.764
#> GSM875481     2  0.6235      0.310 0.000 0.564 0.436

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.2647    0.91522 0.880 0.000 0.000 0.120
#> GSM875415     1  0.0000    0.97365 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0524    0.97218 0.988 0.000 0.004 0.008
#> GSM875417     3  0.2861    0.68414 0.096 0.000 0.888 0.016
#> GSM875418     1  0.0000    0.97365 1.000 0.000 0.000 0.000
#> GSM875423     1  0.0657    0.97171 0.984 0.000 0.004 0.012
#> GSM875424     1  0.0672    0.97137 0.984 0.000 0.008 0.008
#> GSM875425     1  0.0657    0.97103 0.984 0.000 0.004 0.012
#> GSM875430     1  0.0000    0.97365 1.000 0.000 0.000 0.000
#> GSM875432     1  0.2081    0.93877 0.916 0.000 0.000 0.084
#> GSM875435     1  0.0000    0.97365 1.000 0.000 0.000 0.000
#> GSM875436     2  0.7536    0.05826 0.220 0.484 0.000 0.296
#> GSM875437     1  0.1824    0.95121 0.936 0.004 0.000 0.060
#> GSM875447     1  0.0188    0.97307 0.996 0.000 0.000 0.004
#> GSM875451     1  0.0000    0.97365 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000    0.97365 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0188    0.97335 0.996 0.000 0.000 0.004
#> GSM875462     1  0.1637    0.95237 0.940 0.000 0.000 0.060
#> GSM875465     1  0.0712    0.97135 0.984 0.004 0.008 0.004
#> GSM875469     1  0.0336    0.97275 0.992 0.000 0.000 0.008
#> GSM875470     1  0.1388    0.95709 0.960 0.000 0.028 0.012
#> GSM875471     1  0.1388    0.95709 0.960 0.000 0.028 0.012
#> GSM875472     1  0.2266    0.93831 0.912 0.000 0.004 0.084
#> GSM875475     1  0.0469    0.97180 0.988 0.000 0.000 0.012
#> GSM875476     2  0.7544    0.05935 0.224 0.484 0.000 0.292
#> GSM875477     1  0.2281    0.93207 0.904 0.000 0.000 0.096
#> GSM875414     3  0.7896   -0.23888 0.000 0.292 0.356 0.352
#> GSM875427     3  0.0336    0.75937 0.000 0.000 0.992 0.008
#> GSM875431     3  0.7571    0.11334 0.000 0.272 0.484 0.244
#> GSM875433     2  0.7763   -0.11164 0.000 0.420 0.332 0.248
#> GSM875443     3  0.0592    0.75429 0.016 0.000 0.984 0.000
#> GSM875444     3  0.0336    0.75872 0.008 0.000 0.992 0.000
#> GSM875445     3  0.0524    0.75984 0.004 0.000 0.988 0.008
#> GSM875449     3  0.0524    0.75824 0.004 0.000 0.988 0.008
#> GSM875450     3  0.0336    0.75872 0.008 0.000 0.992 0.000
#> GSM875452     3  0.0336    0.75937 0.000 0.000 0.992 0.008
#> GSM875454     3  0.3024    0.70386 0.000 0.000 0.852 0.148
#> GSM875457     3  0.0967    0.75777 0.004 0.004 0.976 0.016
#> GSM875458     3  0.0524    0.75824 0.004 0.000 0.988 0.008
#> GSM875467     3  0.0524    0.75984 0.004 0.000 0.988 0.008
#> GSM875468     3  0.0524    0.75824 0.004 0.000 0.988 0.008
#> GSM875412     2  0.7084   -0.15658 0.000 0.520 0.140 0.340
#> GSM875419     4  0.7559    0.27308 0.004 0.356 0.172 0.468
#> GSM875420     2  0.5130    0.19438 0.000 0.652 0.016 0.332
#> GSM875421     3  0.4801    0.64524 0.000 0.048 0.764 0.188
#> GSM875422     3  0.4595    0.65515 0.000 0.040 0.776 0.184
#> GSM875426     2  0.7799   -0.11972 0.000 0.420 0.308 0.272
#> GSM875428     3  0.7884   -0.22045 0.000 0.284 0.360 0.356
#> GSM875429     2  0.1118    0.43973 0.000 0.964 0.000 0.036
#> GSM875434     4  0.7656    0.26805 0.008 0.356 0.168 0.468
#> GSM875438     2  0.5130    0.19438 0.000 0.652 0.016 0.332
#> GSM875439     2  0.2760    0.42248 0.000 0.872 0.000 0.128
#> GSM875440     2  0.7278    0.00479 0.000 0.528 0.188 0.284
#> GSM875441     4  0.4697    0.45893 0.000 0.356 0.000 0.644
#> GSM875442     2  0.5285    0.12240 0.004 0.632 0.012 0.352
#> GSM875446     2  0.2760    0.42248 0.000 0.872 0.000 0.128
#> GSM875448     4  0.4564    0.49251 0.000 0.328 0.000 0.672
#> GSM875453     4  0.4543    0.49501 0.000 0.324 0.000 0.676
#> GSM875455     2  0.0336    0.45302 0.000 0.992 0.000 0.008
#> GSM875459     2  0.0188    0.45284 0.000 0.996 0.000 0.004
#> GSM875460     4  0.7832    0.20796 0.000 0.344 0.264 0.392
#> GSM875463     4  0.4543    0.49501 0.000 0.324 0.000 0.676
#> GSM875464     2  0.4948   -0.00443 0.000 0.560 0.000 0.440
#> GSM875466     3  0.7850   -0.19595 0.000 0.340 0.388 0.272
#> GSM875473     3  0.3926    0.68929 0.004 0.016 0.820 0.160
#> GSM875474     2  0.0336    0.45302 0.000 0.992 0.000 0.008
#> GSM875478     2  0.0336    0.45302 0.000 0.992 0.000 0.008
#> GSM875479     2  0.4948   -0.00443 0.000 0.560 0.000 0.440
#> GSM875480     3  0.4959    0.63021 0.000 0.052 0.752 0.196
#> GSM875481     3  0.7424   -0.05950 0.000 0.408 0.424 0.168

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.6494      0.449 0.532 0.088 0.000 0.040 0.340
#> GSM875415     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0566      0.942 0.984 0.000 0.004 0.000 0.012
#> GSM875417     3  0.2568      0.788 0.092 0.004 0.888 0.000 0.016
#> GSM875418     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.0833      0.941 0.976 0.004 0.004 0.000 0.016
#> GSM875424     1  0.0693      0.941 0.980 0.000 0.008 0.000 0.012
#> GSM875425     1  0.0671      0.941 0.980 0.000 0.004 0.000 0.016
#> GSM875430     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.2901      0.893 0.888 0.020 0.000 0.044 0.048
#> GSM875435     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000
#> GSM875436     4  0.6627      0.246 0.200 0.100 0.000 0.612 0.088
#> GSM875437     1  0.2400      0.910 0.912 0.020 0.000 0.048 0.020
#> GSM875447     1  0.0579      0.941 0.984 0.000 0.000 0.008 0.008
#> GSM875451     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.944 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.0404      0.942 0.988 0.000 0.000 0.000 0.012
#> GSM875462     1  0.2165      0.914 0.924 0.016 0.000 0.024 0.036
#> GSM875465     1  0.0775      0.942 0.980 0.004 0.008 0.004 0.004
#> GSM875469     1  0.0510      0.942 0.984 0.000 0.000 0.000 0.016
#> GSM875470     1  0.1300      0.929 0.956 0.000 0.028 0.000 0.016
#> GSM875471     1  0.1300      0.929 0.956 0.000 0.028 0.000 0.016
#> GSM875472     1  0.4000      0.829 0.808 0.028 0.000 0.028 0.136
#> GSM875475     1  0.1012      0.937 0.968 0.000 0.000 0.012 0.020
#> GSM875476     4  0.6654      0.241 0.204 0.100 0.000 0.608 0.088
#> GSM875477     1  0.4192      0.823 0.800 0.028 0.000 0.040 0.132
#> GSM875414     4  0.4811      0.464 0.000 0.020 0.296 0.668 0.016
#> GSM875427     3  0.0290      0.889 0.000 0.000 0.992 0.008 0.000
#> GSM875431     4  0.4855      0.196 0.000 0.016 0.436 0.544 0.004
#> GSM875433     4  0.6122      0.482 0.000 0.144 0.292 0.560 0.004
#> GSM875443     3  0.0510      0.884 0.016 0.000 0.984 0.000 0.000
#> GSM875444     3  0.0290      0.890 0.008 0.000 0.992 0.000 0.000
#> GSM875445     3  0.0451      0.890 0.004 0.000 0.988 0.008 0.000
#> GSM875449     3  0.0486      0.889 0.004 0.004 0.988 0.000 0.004
#> GSM875450     3  0.0290      0.890 0.008 0.000 0.992 0.000 0.000
#> GSM875452     3  0.0290      0.889 0.000 0.000 0.992 0.008 0.000
#> GSM875454     3  0.2852      0.771 0.000 0.000 0.828 0.172 0.000
#> GSM875457     3  0.0889      0.888 0.004 0.004 0.976 0.012 0.004
#> GSM875458     3  0.0486      0.889 0.004 0.004 0.988 0.000 0.004
#> GSM875467     3  0.0451      0.890 0.004 0.000 0.988 0.008 0.000
#> GSM875468     3  0.0486      0.889 0.004 0.004 0.988 0.000 0.004
#> GSM875412     4  0.4935      0.469 0.000 0.160 0.112 0.724 0.004
#> GSM875419     4  0.4817      0.506 0.004 0.024 0.152 0.760 0.060
#> GSM875420     4  0.6001     -0.246 0.000 0.432 0.000 0.456 0.112
#> GSM875421     3  0.3863      0.666 0.000 0.012 0.740 0.248 0.000
#> GSM875422     3  0.3779      0.681 0.000 0.012 0.752 0.236 0.000
#> GSM875426     4  0.6211      0.494 0.000 0.144 0.264 0.580 0.012
#> GSM875428     4  0.4940      0.452 0.000 0.020 0.304 0.656 0.020
#> GSM875429     2  0.3399      0.814 0.000 0.812 0.000 0.168 0.020
#> GSM875434     4  0.4900      0.503 0.004 0.024 0.148 0.756 0.068
#> GSM875438     4  0.6001     -0.246 0.000 0.432 0.000 0.456 0.112
#> GSM875439     2  0.4914      0.623 0.000 0.712 0.000 0.108 0.180
#> GSM875440     4  0.6120      0.417 0.000 0.204 0.144 0.628 0.024
#> GSM875441     4  0.6017     -0.204 0.000 0.116 0.000 0.480 0.404
#> GSM875442     4  0.5237      0.261 0.000 0.272 0.012 0.660 0.056
#> GSM875446     2  0.4914      0.623 0.000 0.712 0.000 0.108 0.180
#> GSM875448     4  0.5931     -0.231 0.000 0.104 0.000 0.460 0.436
#> GSM875453     4  0.5893     -0.226 0.000 0.100 0.000 0.464 0.436
#> GSM875455     2  0.2648      0.853 0.000 0.848 0.000 0.152 0.000
#> GSM875459     2  0.2674      0.847 0.000 0.856 0.000 0.140 0.004
#> GSM875460     4  0.5176      0.529 0.000 0.044 0.236 0.692 0.028
#> GSM875463     4  0.5891     -0.219 0.000 0.100 0.000 0.468 0.432
#> GSM875464     5  0.5486      1.000 0.000 0.352 0.000 0.076 0.572
#> GSM875466     4  0.5241      0.366 0.000 0.040 0.356 0.596 0.008
#> GSM875473     3  0.3612      0.748 0.004 0.000 0.796 0.184 0.016
#> GSM875474     2  0.2648      0.853 0.000 0.848 0.000 0.152 0.000
#> GSM875478     2  0.2648      0.853 0.000 0.848 0.000 0.152 0.000
#> GSM875479     5  0.5486      1.000 0.000 0.352 0.000 0.076 0.572
#> GSM875480     3  0.4070      0.644 0.000 0.012 0.728 0.256 0.004
#> GSM875481     4  0.6199      0.314 0.000 0.140 0.392 0.468 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
#> GSM875413     6  0.2135      0.000 0.128 0.000 0.000 0.000 0.000 0.872
#> GSM875415     1  0.0260      0.940 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM875416     1  0.0520      0.938 0.984 0.000 0.008 0.000 0.000 0.008
#> GSM875417     3  0.2214      0.764 0.092 0.000 0.892 0.000 0.004 0.012
#> GSM875418     1  0.0260      0.940 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM875423     1  0.0748      0.937 0.976 0.000 0.004 0.000 0.004 0.016
#> GSM875424     1  0.0622      0.937 0.980 0.000 0.008 0.000 0.000 0.012
#> GSM875425     1  0.0622      0.936 0.980 0.000 0.008 0.000 0.000 0.012
#> GSM875430     1  0.0260      0.940 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM875432     1  0.3318      0.843 0.848 0.000 0.004 0.052 0.024 0.072
#> GSM875435     1  0.0260      0.940 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM875436     5  0.7565      0.194 0.160 0.040 0.004 0.356 0.376 0.064
#> GSM875437     1  0.2608      0.877 0.888 0.004 0.004 0.008 0.024 0.072
#> GSM875447     1  0.1268      0.925 0.952 0.000 0.004 0.008 0.000 0.036
#> GSM875451     1  0.0260      0.940 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM875456     1  0.0000      0.939 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.0405      0.938 0.988 0.000 0.000 0.008 0.000 0.004
#> GSM875462     1  0.1950      0.903 0.924 0.000 0.000 0.032 0.016 0.028
#> GSM875465     1  0.0696      0.938 0.980 0.004 0.008 0.000 0.004 0.004
#> GSM875469     1  0.0458      0.938 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM875470     1  0.1151      0.921 0.956 0.000 0.032 0.000 0.000 0.012
#> GSM875471     1  0.1151      0.921 0.956 0.000 0.032 0.000 0.000 0.012
#> GSM875472     1  0.3750      0.717 0.764 0.000 0.004 0.028 0.004 0.200
#> GSM875475     1  0.1410      0.918 0.944 0.000 0.004 0.008 0.000 0.044
#> GSM875476     5  0.7582      0.192 0.164 0.040 0.004 0.352 0.376 0.064
#> GSM875477     1  0.4125      0.710 0.752 0.000 0.004 0.036 0.016 0.192
#> GSM875414     5  0.2755      0.606 0.000 0.012 0.140 0.004 0.844 0.000
#> GSM875427     3  0.0458      0.864 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM875431     5  0.4103      0.489 0.000 0.012 0.304 0.012 0.672 0.000
#> GSM875433     5  0.4856      0.598 0.000 0.108 0.188 0.008 0.692 0.004
#> GSM875443     3  0.0603      0.860 0.016 0.000 0.980 0.000 0.004 0.000
#> GSM875444     3  0.0405      0.865 0.008 0.000 0.988 0.000 0.004 0.000
#> GSM875445     3  0.0508      0.866 0.004 0.000 0.984 0.000 0.012 0.000
#> GSM875449     3  0.0291      0.865 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM875450     3  0.0405      0.865 0.008 0.000 0.988 0.000 0.004 0.000
#> GSM875452     3  0.0458      0.864 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM875454     3  0.3101      0.679 0.000 0.000 0.756 0.000 0.244 0.000
#> GSM875457     3  0.0653      0.863 0.004 0.000 0.980 0.004 0.012 0.000
#> GSM875458     3  0.0291      0.865 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM875467     3  0.0508      0.866 0.004 0.000 0.984 0.000 0.012 0.000
#> GSM875468     3  0.0291      0.865 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM875412     5  0.5469      0.463 0.000 0.132 0.028 0.184 0.652 0.004
#> GSM875419     5  0.5661      0.490 0.000 0.012 0.108 0.244 0.616 0.020
#> GSM875420     2  0.6000      0.258 0.000 0.528 0.000 0.204 0.252 0.016
#> GSM875421     3  0.3910      0.539 0.000 0.008 0.660 0.004 0.328 0.000
#> GSM875422     3  0.3741      0.558 0.000 0.008 0.672 0.000 0.320 0.000
#> GSM875426     5  0.4315      0.590 0.000 0.108 0.136 0.004 0.748 0.004
#> GSM875428     5  0.3053      0.606 0.000 0.020 0.168 0.000 0.812 0.000
#> GSM875429     2  0.3151      0.721 0.000 0.848 0.000 0.076 0.064 0.012
#> GSM875434     5  0.5786      0.487 0.000 0.016 0.108 0.252 0.604 0.020
#> GSM875438     2  0.6000      0.258 0.000 0.528 0.000 0.204 0.252 0.016
#> GSM875439     2  0.3099      0.646 0.000 0.848 0.000 0.096 0.012 0.044
#> GSM875440     5  0.5183      0.492 0.000 0.172 0.060 0.068 0.696 0.004
#> GSM875441     4  0.3912      0.696 0.000 0.076 0.000 0.760 0.164 0.000
#> GSM875442     5  0.6257      0.274 0.000 0.216 0.000 0.288 0.476 0.020
#> GSM875446     2  0.3099      0.646 0.000 0.848 0.000 0.096 0.012 0.044
#> GSM875448     4  0.2790      0.740 0.000 0.024 0.000 0.844 0.132 0.000
#> GSM875453     4  0.2750      0.739 0.000 0.020 0.000 0.844 0.136 0.000
#> GSM875455     2  0.2263      0.749 0.000 0.896 0.000 0.048 0.056 0.000
#> GSM875459     2  0.2213      0.748 0.000 0.904 0.000 0.044 0.048 0.004
#> GSM875460     5  0.6189      0.535 0.000 0.040 0.180 0.192 0.580 0.008
#> GSM875463     4  0.2790      0.736 0.000 0.020 0.000 0.840 0.140 0.000
#> GSM875464     4  0.4346      0.385 0.000 0.336 0.000 0.632 0.004 0.028
#> GSM875466     5  0.5260      0.527 0.000 0.004 0.276 0.108 0.608 0.004
#> GSM875473     3  0.3736      0.675 0.004 0.000 0.756 0.016 0.216 0.008
#> GSM875474     2  0.2263      0.749 0.000 0.896 0.000 0.048 0.056 0.000
#> GSM875478     2  0.2263      0.749 0.000 0.896 0.000 0.048 0.056 0.000
#> GSM875479     4  0.4346      0.385 0.000 0.336 0.000 0.632 0.004 0.028
#> GSM875480     3  0.4194      0.536 0.000 0.008 0.664 0.020 0.308 0.000
#> GSM875481     5  0.5603      0.521 0.000 0.108 0.292 0.016 0.580 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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) k
#> CV:hclust 70         2.58e-13 2
#> CV:hclust 65         7.83e-18 3
#> CV:hclust 40         1.46e-08 4
#> CV:hclust 51         4.58e-13 5
#> CV:hclust 57         8.96e-14 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 51941 rows and 70 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.731           0.873       0.943         0.4886 0.519   0.519
#> 3 3 0.923           0.938       0.972         0.3808 0.736   0.524
#> 4 4 0.725           0.754       0.860         0.0914 0.921   0.762
#> 5 5 0.693           0.671       0.749         0.0647 0.904   0.663
#> 6 6 0.731           0.628       0.794         0.0432 0.946   0.768

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
#> GSM875413     1  0.0000      0.977 1.000 0.000
#> GSM875415     1  0.0000      0.977 1.000 0.000
#> GSM875416     1  0.0000      0.977 1.000 0.000
#> GSM875417     1  0.0672      0.972 0.992 0.008
#> GSM875418     1  0.0000      0.977 1.000 0.000
#> GSM875423     1  0.0376      0.975 0.996 0.004
#> GSM875424     1  0.0376      0.975 0.996 0.004
#> GSM875425     1  0.0376      0.975 0.996 0.004
#> GSM875430     1  0.0000      0.977 1.000 0.000
#> GSM875432     1  0.0000      0.977 1.000 0.000
#> GSM875435     1  0.0000      0.977 1.000 0.000
#> GSM875436     2  0.9815      0.391 0.420 0.580
#> GSM875437     1  0.0000      0.977 1.000 0.000
#> GSM875447     1  0.0000      0.977 1.000 0.000
#> GSM875451     1  0.0000      0.977 1.000 0.000
#> GSM875456     1  0.0000      0.977 1.000 0.000
#> GSM875461     1  0.0000      0.977 1.000 0.000
#> GSM875462     1  0.0000      0.977 1.000 0.000
#> GSM875465     1  0.0000      0.977 1.000 0.000
#> GSM875469     1  0.0000      0.977 1.000 0.000
#> GSM875470     1  0.0672      0.972 0.992 0.008
#> GSM875471     1  0.0672      0.972 0.992 0.008
#> GSM875472     1  0.0000      0.977 1.000 0.000
#> GSM875475     1  0.0000      0.977 1.000 0.000
#> GSM875476     1  0.0000      0.977 1.000 0.000
#> GSM875477     1  0.0000      0.977 1.000 0.000
#> GSM875414     2  0.0000      0.915 0.000 1.000
#> GSM875427     2  0.6148      0.820 0.152 0.848
#> GSM875431     2  0.0000      0.915 0.000 1.000
#> GSM875433     2  0.0000      0.915 0.000 1.000
#> GSM875443     1  0.0672      0.972 0.992 0.008
#> GSM875444     2  0.9661      0.449 0.392 0.608
#> GSM875445     2  0.6148      0.820 0.152 0.848
#> GSM875449     2  0.6148      0.820 0.152 0.848
#> GSM875450     1  0.9988     -0.112 0.520 0.480
#> GSM875452     2  0.7950      0.722 0.240 0.760
#> GSM875454     2  0.0000      0.915 0.000 1.000
#> GSM875457     2  0.6148      0.820 0.152 0.848
#> GSM875458     2  0.9996      0.173 0.488 0.512
#> GSM875467     2  0.8016      0.716 0.244 0.756
#> GSM875468     2  1.0000      0.131 0.500 0.500
#> GSM875412     2  0.0672      0.916 0.008 0.992
#> GSM875419     2  0.0672      0.916 0.008 0.992
#> GSM875420     2  0.0672      0.916 0.008 0.992
#> GSM875421     2  0.0000      0.915 0.000 1.000
#> GSM875422     2  0.0000      0.915 0.000 1.000
#> GSM875426     2  0.0000      0.915 0.000 1.000
#> GSM875428     2  0.0000      0.915 0.000 1.000
#> GSM875429     2  0.0672      0.916 0.008 0.992
#> GSM875434     2  0.7219      0.782 0.200 0.800
#> GSM875438     2  0.0672      0.916 0.008 0.992
#> GSM875439     2  0.0672      0.916 0.008 0.992
#> GSM875440     2  0.0000      0.915 0.000 1.000
#> GSM875441     2  0.0672      0.916 0.008 0.992
#> GSM875442     2  0.0672      0.916 0.008 0.992
#> GSM875446     2  0.0672      0.916 0.008 0.992
#> GSM875448     2  0.0672      0.916 0.008 0.992
#> GSM875453     2  0.0672      0.916 0.008 0.992
#> GSM875455     2  0.0672      0.916 0.008 0.992
#> GSM875459     2  0.0672      0.916 0.008 0.992
#> GSM875460     2  0.0376      0.915 0.004 0.996
#> GSM875463     2  0.0672      0.916 0.008 0.992
#> GSM875464     2  0.0672      0.916 0.008 0.992
#> GSM875466     2  0.4815      0.857 0.104 0.896
#> GSM875473     2  0.4939      0.854 0.108 0.892
#> GSM875474     2  0.0672      0.916 0.008 0.992
#> GSM875478     2  0.0672      0.916 0.008 0.992
#> GSM875479     2  0.0672      0.916 0.008 0.992
#> GSM875480     2  0.0000      0.915 0.000 1.000
#> GSM875481     2  0.0000      0.915 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
#> GSM875413     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875415     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875416     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875417     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875418     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875423     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875424     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875425     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875430     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875432     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875435     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875436     2  0.5859      0.500 0.344 0.656 0.000
#> GSM875437     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875447     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875451     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875456     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875461     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875462     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875465     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875469     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875470     3  0.5810      0.513 0.336 0.000 0.664
#> GSM875471     3  0.4605      0.741 0.204 0.000 0.796
#> GSM875472     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875475     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875476     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875477     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875414     2  0.2878      0.878 0.000 0.904 0.096
#> GSM875427     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875431     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875433     3  0.4605      0.723 0.000 0.204 0.796
#> GSM875443     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875454     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875457     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875419     2  0.0237      0.948 0.000 0.996 0.004
#> GSM875420     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875421     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875422     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875426     2  0.3116      0.868 0.000 0.892 0.108
#> GSM875428     2  0.3116      0.868 0.000 0.892 0.108
#> GSM875429     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875434     2  0.5291      0.645 0.268 0.732 0.000
#> GSM875438     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875440     2  0.0424      0.946 0.000 0.992 0.008
#> GSM875441     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875455     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875460     2  0.0424      0.946 0.000 0.992 0.008
#> GSM875463     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875473     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875474     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.950 0.000 1.000 0.000
#> GSM875480     3  0.0000      0.963 0.000 0.000 1.000
#> GSM875481     2  0.5254      0.666 0.000 0.736 0.264

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.3392     0.9090 0.856 0.124 0.000 0.020
#> GSM875415     1  0.0000     0.9558 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0469     0.9541 0.988 0.012 0.000 0.000
#> GSM875417     3  0.0469     0.8022 0.000 0.012 0.988 0.000
#> GSM875418     1  0.0000     0.9558 1.000 0.000 0.000 0.000
#> GSM875423     1  0.1059     0.9488 0.972 0.012 0.016 0.000
#> GSM875424     1  0.0937     0.9504 0.976 0.012 0.012 0.000
#> GSM875425     1  0.1584     0.9471 0.952 0.036 0.012 0.000
#> GSM875430     1  0.0000     0.9558 1.000 0.000 0.000 0.000
#> GSM875432     1  0.1716     0.9463 0.936 0.064 0.000 0.000
#> GSM875435     1  0.0000     0.9558 1.000 0.000 0.000 0.000
#> GSM875436     4  0.6860     0.3489 0.244 0.164 0.000 0.592
#> GSM875437     1  0.2466     0.9370 0.900 0.096 0.000 0.004
#> GSM875447     1  0.0000     0.9558 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0592     0.9537 0.984 0.016 0.000 0.000
#> GSM875456     1  0.0000     0.9558 1.000 0.000 0.000 0.000
#> GSM875461     1  0.1867     0.9459 0.928 0.072 0.000 0.000
#> GSM875462     1  0.3182     0.9253 0.876 0.096 0.000 0.028
#> GSM875465     1  0.2075     0.9419 0.936 0.044 0.016 0.004
#> GSM875469     1  0.0707     0.9535 0.980 0.020 0.000 0.000
#> GSM875470     3  0.6141     0.2310 0.392 0.044 0.560 0.004
#> GSM875471     3  0.4598     0.6423 0.160 0.044 0.792 0.004
#> GSM875472     1  0.4057     0.8904 0.812 0.160 0.000 0.028
#> GSM875475     1  0.1474     0.9494 0.948 0.052 0.000 0.000
#> GSM875476     1  0.3051     0.9279 0.884 0.088 0.000 0.028
#> GSM875477     1  0.3161     0.9140 0.864 0.124 0.000 0.012
#> GSM875414     4  0.2480     0.7075 0.000 0.088 0.008 0.904
#> GSM875427     3  0.0592     0.8037 0.000 0.000 0.984 0.016
#> GSM875431     3  0.4898     0.4637 0.000 0.000 0.584 0.416
#> GSM875433     4  0.5883     0.0369 0.000 0.040 0.388 0.572
#> GSM875443     3  0.0592     0.8002 0.000 0.016 0.984 0.000
#> GSM875444     3  0.0000     0.8068 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0469     0.8048 0.000 0.000 0.988 0.012
#> GSM875449     3  0.0000     0.8068 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000     0.8068 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0469     0.8048 0.000 0.000 0.988 0.012
#> GSM875454     3  0.4277     0.6437 0.000 0.000 0.720 0.280
#> GSM875457     3  0.0000     0.8068 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000     0.8068 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000     0.8068 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000     0.8068 0.000 0.000 1.000 0.000
#> GSM875412     4  0.1022     0.7337 0.000 0.032 0.000 0.968
#> GSM875419     4  0.0817     0.7328 0.000 0.024 0.000 0.976
#> GSM875420     4  0.2868     0.6843 0.000 0.136 0.000 0.864
#> GSM875421     3  0.4961     0.3962 0.000 0.000 0.552 0.448
#> GSM875422     3  0.4948     0.4150 0.000 0.000 0.560 0.440
#> GSM875426     4  0.5527     0.5468 0.000 0.168 0.104 0.728
#> GSM875428     4  0.1174     0.7255 0.000 0.012 0.020 0.968
#> GSM875429     2  0.3266     0.9319 0.000 0.832 0.000 0.168
#> GSM875434     4  0.4458     0.6216 0.076 0.116 0.000 0.808
#> GSM875438     4  0.1474     0.7317 0.000 0.052 0.000 0.948
#> GSM875439     2  0.3266     0.9319 0.000 0.832 0.000 0.168
#> GSM875440     4  0.2473     0.7082 0.000 0.080 0.012 0.908
#> GSM875441     4  0.3688     0.6051 0.000 0.208 0.000 0.792
#> GSM875442     4  0.4981    -0.1196 0.000 0.464 0.000 0.536
#> GSM875446     2  0.3266     0.9319 0.000 0.832 0.000 0.168
#> GSM875448     4  0.3074     0.6631 0.000 0.152 0.000 0.848
#> GSM875453     4  0.3311     0.6380 0.000 0.172 0.000 0.828
#> GSM875455     2  0.3311     0.9223 0.000 0.828 0.000 0.172
#> GSM875459     2  0.3266     0.9319 0.000 0.832 0.000 0.168
#> GSM875460     4  0.0895     0.7333 0.000 0.020 0.004 0.976
#> GSM875463     4  0.3024     0.6649 0.000 0.148 0.000 0.852
#> GSM875464     2  0.4977     0.4262 0.000 0.540 0.000 0.460
#> GSM875466     3  0.4866     0.4806 0.000 0.000 0.596 0.404
#> GSM875473     3  0.4164     0.6513 0.000 0.000 0.736 0.264
#> GSM875474     2  0.3266     0.9319 0.000 0.832 0.000 0.168
#> GSM875478     2  0.3266     0.9319 0.000 0.832 0.000 0.168
#> GSM875479     2  0.4008     0.8522 0.000 0.756 0.000 0.244
#> GSM875480     3  0.4790     0.5226 0.000 0.000 0.620 0.380
#> GSM875481     4  0.6808     0.4188 0.000 0.164 0.236 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
#> GSM875413     1  0.4780     0.7370 0.660 0.016 0.000 0.016 0.308
#> GSM875415     1  0.0000     0.8472 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.1732     0.8356 0.920 0.000 0.000 0.000 0.080
#> GSM875417     3  0.1877     0.8345 0.000 0.012 0.924 0.000 0.064
#> GSM875418     1  0.0000     0.8472 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.3395     0.8093 0.852 0.012 0.044 0.000 0.092
#> GSM875424     1  0.2824     0.8219 0.880 0.008 0.024 0.000 0.088
#> GSM875425     1  0.4268     0.7830 0.776 0.012 0.044 0.000 0.168
#> GSM875430     1  0.0000     0.8472 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.3010     0.8187 0.824 0.004 0.000 0.000 0.172
#> GSM875435     1  0.0000     0.8472 1.000 0.000 0.000 0.000 0.000
#> GSM875436     4  0.6857     0.3536 0.172 0.044 0.000 0.556 0.228
#> GSM875437     1  0.3980     0.7937 0.708 0.008 0.000 0.000 0.284
#> GSM875447     1  0.0000     0.8472 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0703     0.8435 0.976 0.000 0.000 0.000 0.024
#> GSM875456     1  0.0000     0.8472 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.3048     0.8248 0.820 0.004 0.000 0.000 0.176
#> GSM875462     1  0.4724     0.7711 0.652 0.008 0.000 0.020 0.320
#> GSM875465     1  0.4584     0.7792 0.752 0.016 0.048 0.000 0.184
#> GSM875469     1  0.1410     0.8418 0.940 0.000 0.000 0.000 0.060
#> GSM875470     1  0.6901     0.1590 0.400 0.016 0.400 0.000 0.184
#> GSM875471     3  0.5722     0.5549 0.136 0.016 0.664 0.000 0.184
#> GSM875472     1  0.5384     0.6659 0.512 0.012 0.000 0.032 0.444
#> GSM875475     1  0.2536     0.8312 0.868 0.004 0.000 0.000 0.128
#> GSM875476     1  0.4406     0.7909 0.740 0.012 0.000 0.028 0.220
#> GSM875477     1  0.4568     0.7420 0.672 0.012 0.000 0.012 0.304
#> GSM875414     4  0.4900    -0.3217 0.000 0.024 0.000 0.512 0.464
#> GSM875427     3  0.1484     0.8495 0.000 0.008 0.944 0.000 0.048
#> GSM875431     5  0.6562     0.8133 0.000 0.000 0.284 0.244 0.472
#> GSM875433     5  0.6644     0.7076 0.000 0.016 0.144 0.376 0.464
#> GSM875443     3  0.1914     0.8403 0.000 0.016 0.924 0.000 0.060
#> GSM875444     3  0.0807     0.8692 0.000 0.012 0.976 0.000 0.012
#> GSM875445     3  0.1484     0.8495 0.000 0.008 0.944 0.000 0.048
#> GSM875449     3  0.0162     0.8740 0.000 0.000 0.996 0.000 0.004
#> GSM875450     3  0.0324     0.8731 0.000 0.004 0.992 0.000 0.004
#> GSM875452     3  0.1484     0.8495 0.000 0.008 0.944 0.000 0.048
#> GSM875454     5  0.6714     0.7407 0.000 0.008 0.344 0.192 0.456
#> GSM875457     3  0.0404     0.8733 0.000 0.000 0.988 0.000 0.012
#> GSM875458     3  0.0162     0.8740 0.000 0.000 0.996 0.000 0.004
#> GSM875467     3  0.0798     0.8690 0.000 0.008 0.976 0.000 0.016
#> GSM875468     3  0.0404     0.8733 0.000 0.000 0.988 0.000 0.012
#> GSM875412     4  0.3013     0.5127 0.000 0.008 0.000 0.832 0.160
#> GSM875419     4  0.2806     0.5228 0.000 0.004 0.000 0.844 0.152
#> GSM875420     4  0.2625     0.6067 0.000 0.108 0.000 0.876 0.016
#> GSM875421     5  0.6718     0.8143 0.000 0.004 0.236 0.300 0.460
#> GSM875422     5  0.6804     0.8170 0.000 0.008 0.236 0.292 0.464
#> GSM875426     5  0.6526     0.4934 0.000 0.064 0.052 0.420 0.464
#> GSM875428     4  0.4425    -0.2872 0.000 0.004 0.000 0.544 0.452
#> GSM875429     2  0.1408     0.8933 0.000 0.948 0.000 0.044 0.008
#> GSM875434     4  0.5251     0.4293 0.032 0.012 0.000 0.584 0.372
#> GSM875438     4  0.3488     0.5242 0.000 0.024 0.000 0.808 0.168
#> GSM875439     2  0.1484     0.8918 0.000 0.944 0.000 0.048 0.008
#> GSM875440     4  0.4882    -0.2942 0.000 0.024 0.000 0.532 0.444
#> GSM875441     4  0.2806     0.5575 0.000 0.152 0.000 0.844 0.004
#> GSM875442     2  0.4613     0.4096 0.000 0.620 0.000 0.360 0.020
#> GSM875446     2  0.1484     0.8918 0.000 0.944 0.000 0.048 0.008
#> GSM875448     4  0.2519     0.6123 0.000 0.100 0.000 0.884 0.016
#> GSM875453     4  0.2624     0.5995 0.000 0.116 0.000 0.872 0.012
#> GSM875455     2  0.1469     0.8877 0.000 0.948 0.000 0.036 0.016
#> GSM875459     2  0.1043     0.8944 0.000 0.960 0.000 0.040 0.000
#> GSM875460     4  0.2970     0.5111 0.000 0.004 0.000 0.828 0.168
#> GSM875463     4  0.2519     0.6123 0.000 0.100 0.000 0.884 0.016
#> GSM875464     4  0.4833    -0.0667 0.000 0.412 0.000 0.564 0.024
#> GSM875466     5  0.6717     0.7817 0.000 0.000 0.320 0.264 0.416
#> GSM875473     3  0.6547    -0.5758 0.000 0.008 0.424 0.152 0.416
#> GSM875474     2  0.1408     0.8933 0.000 0.948 0.000 0.044 0.008
#> GSM875478     2  0.1205     0.8942 0.000 0.956 0.000 0.040 0.004
#> GSM875479     2  0.4371     0.5397 0.000 0.644 0.000 0.344 0.012
#> GSM875480     5  0.6589     0.7983 0.000 0.000 0.312 0.232 0.456
#> GSM875481     5  0.7254     0.7024 0.000 0.064 0.132 0.344 0.460

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.5697     0.1195 0.536 0.000 0.000 0.100 0.024 0.340
#> GSM875415     1  0.0000     0.6553 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.2445     0.5892 0.868 0.000 0.008 0.004 0.000 0.120
#> GSM875417     3  0.1655     0.8443 0.000 0.000 0.932 0.008 0.008 0.052
#> GSM875418     1  0.0000     0.6553 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.4451     0.4110 0.732 0.000 0.092 0.012 0.000 0.164
#> GSM875424     1  0.3892     0.4757 0.788 0.000 0.080 0.012 0.000 0.120
#> GSM875425     1  0.5343     0.0832 0.572 0.000 0.092 0.012 0.000 0.324
#> GSM875430     1  0.0291     0.6549 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM875432     1  0.3455     0.5253 0.776 0.000 0.000 0.020 0.004 0.200
#> GSM875435     1  0.0291     0.6549 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM875436     4  0.6288     0.3502 0.084 0.016 0.000 0.460 0.040 0.400
#> GSM875437     1  0.4209     0.2421 0.588 0.000 0.000 0.012 0.004 0.396
#> GSM875447     1  0.0291     0.6549 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM875451     1  0.1049     0.6375 0.960 0.000 0.000 0.008 0.000 0.032
#> GSM875456     1  0.0000     0.6553 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.3390     0.4595 0.704 0.000 0.000 0.000 0.000 0.296
#> GSM875462     1  0.4322     0.1082 0.528 0.000 0.000 0.020 0.000 0.452
#> GSM875465     1  0.5634    -0.0369 0.520 0.000 0.104 0.016 0.000 0.360
#> GSM875469     1  0.2313     0.6090 0.884 0.000 0.004 0.012 0.000 0.100
#> GSM875470     6  0.6639     0.2118 0.272 0.000 0.348 0.020 0.004 0.356
#> GSM875471     3  0.6080    -0.2624 0.136 0.000 0.488 0.020 0.004 0.352
#> GSM875472     6  0.5565    -0.0160 0.308 0.000 0.000 0.112 0.016 0.564
#> GSM875475     1  0.3011     0.5479 0.800 0.000 0.000 0.004 0.004 0.192
#> GSM875476     1  0.4946     0.3114 0.612 0.020 0.000 0.036 0.004 0.328
#> GSM875477     1  0.5228     0.2335 0.600 0.000 0.000 0.080 0.016 0.304
#> GSM875414     5  0.2639     0.8275 0.000 0.016 0.008 0.044 0.892 0.040
#> GSM875427     3  0.2613     0.8397 0.000 0.000 0.884 0.016 0.068 0.032
#> GSM875431     5  0.2563     0.8518 0.000 0.000 0.084 0.008 0.880 0.028
#> GSM875433     5  0.2295     0.8511 0.000 0.008 0.032 0.028 0.912 0.020
#> GSM875443     3  0.1257     0.8632 0.000 0.000 0.952 0.020 0.000 0.028
#> GSM875444     3  0.1148     0.8838 0.000 0.000 0.960 0.004 0.020 0.016
#> GSM875445     3  0.2613     0.8397 0.000 0.000 0.884 0.016 0.068 0.032
#> GSM875449     3  0.0692     0.8872 0.000 0.000 0.976 0.000 0.020 0.004
#> GSM875450     3  0.0725     0.8847 0.000 0.000 0.976 0.012 0.012 0.000
#> GSM875452     3  0.2613     0.8397 0.000 0.000 0.884 0.016 0.068 0.032
#> GSM875454     5  0.3386     0.8113 0.000 0.000 0.124 0.020 0.824 0.032
#> GSM875457     3  0.1148     0.8838 0.000 0.000 0.960 0.004 0.020 0.016
#> GSM875458     3  0.0692     0.8872 0.000 0.000 0.976 0.000 0.020 0.004
#> GSM875467     3  0.1710     0.8713 0.000 0.000 0.936 0.016 0.020 0.028
#> GSM875468     3  0.1053     0.8851 0.000 0.000 0.964 0.004 0.020 0.012
#> GSM875412     4  0.5253     0.5714 0.000 0.008 0.000 0.540 0.372 0.080
#> GSM875419     4  0.5092     0.6396 0.000 0.008 0.000 0.588 0.328 0.076
#> GSM875420     4  0.4408     0.7098 0.000 0.052 0.000 0.764 0.120 0.064
#> GSM875421     5  0.1728     0.8565 0.000 0.000 0.064 0.008 0.924 0.004
#> GSM875422     5  0.2586     0.8471 0.000 0.000 0.080 0.008 0.880 0.032
#> GSM875426     5  0.2451     0.8326 0.000 0.036 0.008 0.024 0.904 0.028
#> GSM875428     5  0.2126     0.8031 0.000 0.004 0.000 0.072 0.904 0.020
#> GSM875429     2  0.1625     0.8437 0.000 0.928 0.000 0.012 0.000 0.060
#> GSM875434     4  0.6155     0.4306 0.012 0.004 0.000 0.412 0.164 0.408
#> GSM875438     4  0.5297     0.5955 0.000 0.012 0.000 0.556 0.352 0.080
#> GSM875439     2  0.2490     0.8343 0.000 0.892 0.000 0.044 0.012 0.052
#> GSM875440     5  0.3063     0.7816 0.000 0.016 0.000 0.076 0.856 0.052
#> GSM875441     4  0.3796     0.6851 0.000 0.068 0.000 0.808 0.096 0.028
#> GSM875442     2  0.5354     0.4973 0.000 0.656 0.000 0.212 0.048 0.084
#> GSM875446     2  0.2490     0.8343 0.000 0.892 0.000 0.044 0.012 0.052
#> GSM875448     4  0.4267     0.7216 0.000 0.044 0.000 0.760 0.156 0.040
#> GSM875453     4  0.4218     0.7083 0.000 0.068 0.000 0.772 0.128 0.032
#> GSM875455     2  0.0777     0.8563 0.000 0.972 0.000 0.004 0.000 0.024
#> GSM875459     2  0.0405     0.8575 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM875460     4  0.4824     0.6106 0.000 0.008 0.000 0.588 0.356 0.048
#> GSM875463     4  0.4058     0.7220 0.000 0.044 0.000 0.776 0.148 0.032
#> GSM875464     4  0.4634     0.4136 0.000 0.244 0.000 0.688 0.028 0.040
#> GSM875466     5  0.3534     0.7922 0.000 0.000 0.168 0.008 0.792 0.032
#> GSM875473     5  0.5652     0.5103 0.000 0.000 0.260 0.012 0.572 0.156
#> GSM875474     2  0.0777     0.8563 0.000 0.972 0.000 0.004 0.000 0.024
#> GSM875478     2  0.0146     0.8582 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM875479     2  0.5071     0.3335 0.000 0.536 0.000 0.396 0.008 0.060
#> GSM875480     5  0.2278     0.8318 0.000 0.000 0.128 0.000 0.868 0.004
#> GSM875481     5  0.2228     0.8501 0.000 0.032 0.024 0.012 0.916 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-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) k
#> CV:kmeans 65         5.10e-14 2
#> CV:kmeans 69         6.20e-19 3
#> CV:kmeans 60         2.38e-17 4
#> CV:kmeans 60         3.77e-17 5
#> CV:kmeans 52         2.45e-14 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 51941 rows and 70 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.941           0.951       0.979         0.5048 0.496   0.496
#> 3 3 1.000           0.946       0.978         0.3316 0.761   0.552
#> 4 4 0.798           0.827       0.894         0.1083 0.887   0.678
#> 5 5 0.735           0.717       0.796         0.0619 0.954   0.826
#> 6 6 0.739           0.688       0.801         0.0411 0.945   0.760

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

suggest_best_k(res)
#> [1] 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
#> GSM875413     1  0.0000     0.9864 1.000 0.000
#> GSM875415     1  0.0000     0.9864 1.000 0.000
#> GSM875416     1  0.0000     0.9864 1.000 0.000
#> GSM875417     1  0.0000     0.9864 1.000 0.000
#> GSM875418     1  0.0000     0.9864 1.000 0.000
#> GSM875423     1  0.0000     0.9864 1.000 0.000
#> GSM875424     1  0.0000     0.9864 1.000 0.000
#> GSM875425     1  0.0000     0.9864 1.000 0.000
#> GSM875430     1  0.0000     0.9864 1.000 0.000
#> GSM875432     1  0.0000     0.9864 1.000 0.000
#> GSM875435     1  0.0000     0.9864 1.000 0.000
#> GSM875436     2  1.0000     0.0472 0.496 0.504
#> GSM875437     1  0.0000     0.9864 1.000 0.000
#> GSM875447     1  0.0000     0.9864 1.000 0.000
#> GSM875451     1  0.0000     0.9864 1.000 0.000
#> GSM875456     1  0.0000     0.9864 1.000 0.000
#> GSM875461     1  0.0000     0.9864 1.000 0.000
#> GSM875462     1  0.0000     0.9864 1.000 0.000
#> GSM875465     1  0.0000     0.9864 1.000 0.000
#> GSM875469     1  0.0000     0.9864 1.000 0.000
#> GSM875470     1  0.0000     0.9864 1.000 0.000
#> GSM875471     1  0.0000     0.9864 1.000 0.000
#> GSM875472     1  0.0000     0.9864 1.000 0.000
#> GSM875475     1  0.0000     0.9864 1.000 0.000
#> GSM875476     1  0.0376     0.9835 0.996 0.004
#> GSM875477     1  0.0000     0.9864 1.000 0.000
#> GSM875414     2  0.0000     0.9707 0.000 1.000
#> GSM875427     2  0.3114     0.9260 0.056 0.944
#> GSM875431     2  0.0000     0.9707 0.000 1.000
#> GSM875433     2  0.0000     0.9707 0.000 1.000
#> GSM875443     1  0.0000     0.9864 1.000 0.000
#> GSM875444     1  0.0376     0.9837 0.996 0.004
#> GSM875445     2  0.3114     0.9260 0.056 0.944
#> GSM875449     2  0.3114     0.9260 0.056 0.944
#> GSM875450     1  0.0376     0.9837 0.996 0.004
#> GSM875452     1  0.5737     0.8467 0.864 0.136
#> GSM875454     2  0.0000     0.9707 0.000 1.000
#> GSM875457     2  0.6048     0.8236 0.148 0.852
#> GSM875458     1  0.5059     0.8760 0.888 0.112
#> GSM875467     1  0.5408     0.8617 0.876 0.124
#> GSM875468     1  0.1184     0.9737 0.984 0.016
#> GSM875412     2  0.0000     0.9707 0.000 1.000
#> GSM875419     2  0.0000     0.9707 0.000 1.000
#> GSM875420     2  0.0000     0.9707 0.000 1.000
#> GSM875421     2  0.0000     0.9707 0.000 1.000
#> GSM875422     2  0.0000     0.9707 0.000 1.000
#> GSM875426     2  0.0000     0.9707 0.000 1.000
#> GSM875428     2  0.0000     0.9707 0.000 1.000
#> GSM875429     2  0.0000     0.9707 0.000 1.000
#> GSM875434     2  0.8081     0.6767 0.248 0.752
#> GSM875438     2  0.0000     0.9707 0.000 1.000
#> GSM875439     2  0.0000     0.9707 0.000 1.000
#> GSM875440     2  0.0000     0.9707 0.000 1.000
#> GSM875441     2  0.0000     0.9707 0.000 1.000
#> GSM875442     2  0.0000     0.9707 0.000 1.000
#> GSM875446     2  0.0000     0.9707 0.000 1.000
#> GSM875448     2  0.0000     0.9707 0.000 1.000
#> GSM875453     2  0.0000     0.9707 0.000 1.000
#> GSM875455     2  0.0000     0.9707 0.000 1.000
#> GSM875459     2  0.0000     0.9707 0.000 1.000
#> GSM875460     2  0.0000     0.9707 0.000 1.000
#> GSM875463     2  0.0000     0.9707 0.000 1.000
#> GSM875464     2  0.0000     0.9707 0.000 1.000
#> GSM875466     2  0.0000     0.9707 0.000 1.000
#> GSM875473     2  0.0672     0.9650 0.008 0.992
#> GSM875474     2  0.0000     0.9707 0.000 1.000
#> GSM875478     2  0.0000     0.9707 0.000 1.000
#> GSM875479     2  0.0000     0.9707 0.000 1.000
#> GSM875480     2  0.0000     0.9707 0.000 1.000
#> GSM875481     2  0.0000     0.9707 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
#> GSM875413     1   0.000      0.987 1.000 0.000 0.000
#> GSM875415     1   0.000      0.987 1.000 0.000 0.000
#> GSM875416     1   0.000      0.987 1.000 0.000 0.000
#> GSM875417     3   0.000      1.000 0.000 0.000 1.000
#> GSM875418     1   0.000      0.987 1.000 0.000 0.000
#> GSM875423     1   0.000      0.987 1.000 0.000 0.000
#> GSM875424     1   0.000      0.987 1.000 0.000 0.000
#> GSM875425     1   0.000      0.987 1.000 0.000 0.000
#> GSM875430     1   0.000      0.987 1.000 0.000 0.000
#> GSM875432     1   0.000      0.987 1.000 0.000 0.000
#> GSM875435     1   0.000      0.987 1.000 0.000 0.000
#> GSM875436     2   0.617      0.327 0.412 0.588 0.000
#> GSM875437     1   0.000      0.987 1.000 0.000 0.000
#> GSM875447     1   0.000      0.987 1.000 0.000 0.000
#> GSM875451     1   0.000      0.987 1.000 0.000 0.000
#> GSM875456     1   0.000      0.987 1.000 0.000 0.000
#> GSM875461     1   0.000      0.987 1.000 0.000 0.000
#> GSM875462     1   0.000      0.987 1.000 0.000 0.000
#> GSM875465     1   0.000      0.987 1.000 0.000 0.000
#> GSM875469     1   0.000      0.987 1.000 0.000 0.000
#> GSM875470     1   0.271      0.900 0.912 0.000 0.088
#> GSM875471     1   0.460      0.746 0.796 0.000 0.204
#> GSM875472     1   0.000      0.987 1.000 0.000 0.000
#> GSM875475     1   0.000      0.987 1.000 0.000 0.000
#> GSM875476     1   0.000      0.987 1.000 0.000 0.000
#> GSM875477     1   0.000      0.987 1.000 0.000 0.000
#> GSM875414     2   0.000      0.951 0.000 1.000 0.000
#> GSM875427     3   0.000      1.000 0.000 0.000 1.000
#> GSM875431     3   0.000      1.000 0.000 0.000 1.000
#> GSM875433     2   0.614      0.309 0.000 0.596 0.404
#> GSM875443     3   0.000      1.000 0.000 0.000 1.000
#> GSM875444     3   0.000      1.000 0.000 0.000 1.000
#> GSM875445     3   0.000      1.000 0.000 0.000 1.000
#> GSM875449     3   0.000      1.000 0.000 0.000 1.000
#> GSM875450     3   0.000      1.000 0.000 0.000 1.000
#> GSM875452     3   0.000      1.000 0.000 0.000 1.000
#> GSM875454     3   0.000      1.000 0.000 0.000 1.000
#> GSM875457     3   0.000      1.000 0.000 0.000 1.000
#> GSM875458     3   0.000      1.000 0.000 0.000 1.000
#> GSM875467     3   0.000      1.000 0.000 0.000 1.000
#> GSM875468     3   0.000      1.000 0.000 0.000 1.000
#> GSM875412     2   0.000      0.951 0.000 1.000 0.000
#> GSM875419     2   0.000      0.951 0.000 1.000 0.000
#> GSM875420     2   0.000      0.951 0.000 1.000 0.000
#> GSM875421     3   0.000      1.000 0.000 0.000 1.000
#> GSM875422     3   0.000      1.000 0.000 0.000 1.000
#> GSM875426     2   0.000      0.951 0.000 1.000 0.000
#> GSM875428     2   0.000      0.951 0.000 1.000 0.000
#> GSM875429     2   0.000      0.951 0.000 1.000 0.000
#> GSM875434     2   0.586      0.490 0.344 0.656 0.000
#> GSM875438     2   0.000      0.951 0.000 1.000 0.000
#> GSM875439     2   0.000      0.951 0.000 1.000 0.000
#> GSM875440     2   0.000      0.951 0.000 1.000 0.000
#> GSM875441     2   0.000      0.951 0.000 1.000 0.000
#> GSM875442     2   0.000      0.951 0.000 1.000 0.000
#> GSM875446     2   0.000      0.951 0.000 1.000 0.000
#> GSM875448     2   0.000      0.951 0.000 1.000 0.000
#> GSM875453     2   0.000      0.951 0.000 1.000 0.000
#> GSM875455     2   0.000      0.951 0.000 1.000 0.000
#> GSM875459     2   0.000      0.951 0.000 1.000 0.000
#> GSM875460     2   0.000      0.951 0.000 1.000 0.000
#> GSM875463     2   0.000      0.951 0.000 1.000 0.000
#> GSM875464     2   0.000      0.951 0.000 1.000 0.000
#> GSM875466     3   0.000      1.000 0.000 0.000 1.000
#> GSM875473     3   0.000      1.000 0.000 0.000 1.000
#> GSM875474     2   0.000      0.951 0.000 1.000 0.000
#> GSM875478     2   0.000      0.951 0.000 1.000 0.000
#> GSM875479     2   0.000      0.951 0.000 1.000 0.000
#> GSM875480     3   0.000      1.000 0.000 0.000 1.000
#> GSM875481     2   0.216      0.894 0.000 0.936 0.064

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.1109      0.948 0.968 0.004 0.000 0.028
#> GSM875415     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0592      0.950 0.984 0.000 0.000 0.016
#> GSM875417     3  0.0592      0.977 0.000 0.000 0.984 0.016
#> GSM875418     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875423     1  0.1297      0.941 0.964 0.000 0.020 0.016
#> GSM875424     1  0.1059      0.945 0.972 0.000 0.012 0.016
#> GSM875425     1  0.1297      0.941 0.964 0.000 0.020 0.016
#> GSM875430     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0921      0.949 0.972 0.000 0.000 0.028
#> GSM875435     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875436     2  0.6790      0.470 0.296 0.576 0.000 0.128
#> GSM875437     1  0.0921      0.949 0.972 0.000 0.000 0.028
#> GSM875447     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0469      0.953 0.988 0.000 0.000 0.012
#> GSM875462     1  0.0921      0.949 0.972 0.000 0.000 0.028
#> GSM875465     1  0.1182      0.943 0.968 0.000 0.016 0.016
#> GSM875469     1  0.0592      0.950 0.984 0.000 0.000 0.016
#> GSM875470     1  0.4012      0.759 0.800 0.000 0.184 0.016
#> GSM875471     1  0.5506      0.117 0.512 0.000 0.472 0.016
#> GSM875472     1  0.0921      0.949 0.972 0.000 0.000 0.028
#> GSM875475     1  0.0592      0.952 0.984 0.000 0.000 0.016
#> GSM875476     1  0.1624      0.938 0.952 0.020 0.000 0.028
#> GSM875477     1  0.0921      0.949 0.972 0.000 0.000 0.028
#> GSM875414     4  0.2868      0.746 0.000 0.136 0.000 0.864
#> GSM875427     3  0.0469      0.987 0.000 0.000 0.988 0.012
#> GSM875431     4  0.2921      0.789 0.000 0.000 0.140 0.860
#> GSM875433     4  0.4675      0.724 0.000 0.244 0.020 0.736
#> GSM875443     3  0.0592      0.977 0.000 0.000 0.984 0.016
#> GSM875444     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0469      0.987 0.000 0.000 0.988 0.012
#> GSM875449     3  0.0188      0.991 0.000 0.000 0.996 0.004
#> GSM875450     3  0.0188      0.991 0.000 0.000 0.996 0.004
#> GSM875452     3  0.0469      0.987 0.000 0.000 0.988 0.012
#> GSM875454     4  0.3528      0.769 0.000 0.000 0.192 0.808
#> GSM875457     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0336      0.989 0.000 0.000 0.992 0.008
#> GSM875468     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM875412     2  0.5000      0.352 0.000 0.500 0.000 0.500
#> GSM875419     2  0.4605      0.709 0.000 0.664 0.000 0.336
#> GSM875420     2  0.4356      0.749 0.000 0.708 0.000 0.292
#> GSM875421     4  0.3074      0.788 0.000 0.000 0.152 0.848
#> GSM875422     4  0.3074      0.788 0.000 0.000 0.152 0.848
#> GSM875426     4  0.4164      0.706 0.000 0.264 0.000 0.736
#> GSM875428     4  0.1557      0.726 0.000 0.056 0.000 0.944
#> GSM875429     2  0.0188      0.803 0.000 0.996 0.000 0.004
#> GSM875434     2  0.7519      0.499 0.208 0.480 0.000 0.312
#> GSM875438     2  0.3688      0.760 0.000 0.792 0.000 0.208
#> GSM875439     2  0.0188      0.803 0.000 0.996 0.000 0.004
#> GSM875440     4  0.3942      0.699 0.000 0.236 0.000 0.764
#> GSM875441     2  0.3610      0.796 0.000 0.800 0.000 0.200
#> GSM875442     2  0.0188      0.803 0.000 0.996 0.000 0.004
#> GSM875446     2  0.0921      0.804 0.000 0.972 0.000 0.028
#> GSM875448     2  0.3975      0.782 0.000 0.760 0.000 0.240
#> GSM875453     2  0.3975      0.782 0.000 0.760 0.000 0.240
#> GSM875455     2  0.0188      0.803 0.000 0.996 0.000 0.004
#> GSM875459     2  0.0188      0.803 0.000 0.996 0.000 0.004
#> GSM875460     4  0.4103      0.389 0.000 0.256 0.000 0.744
#> GSM875463     2  0.4103      0.776 0.000 0.744 0.000 0.256
#> GSM875464     2  0.3801      0.787 0.000 0.780 0.000 0.220
#> GSM875466     4  0.4817      0.515 0.000 0.000 0.388 0.612
#> GSM875473     4  0.4866      0.488 0.000 0.000 0.404 0.596
#> GSM875474     2  0.0188      0.803 0.000 0.996 0.000 0.004
#> GSM875478     2  0.0188      0.803 0.000 0.996 0.000 0.004
#> GSM875479     2  0.2704      0.805 0.000 0.876 0.000 0.124
#> GSM875480     4  0.3688      0.755 0.000 0.000 0.208 0.792
#> GSM875481     4  0.4567      0.723 0.000 0.244 0.016 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
#> GSM875413     1  0.2690      0.825 0.844 0.156 0.000 0.000 0.000
#> GSM875415     1  0.0290      0.858 0.992 0.008 0.000 0.000 0.000
#> GSM875416     1  0.2424      0.827 0.868 0.132 0.000 0.000 0.000
#> GSM875417     3  0.1571      0.945 0.000 0.060 0.936 0.000 0.004
#> GSM875418     1  0.0000      0.858 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.3132      0.807 0.820 0.172 0.008 0.000 0.000
#> GSM875424     1  0.2561      0.823 0.856 0.144 0.000 0.000 0.000
#> GSM875425     1  0.4016      0.751 0.716 0.272 0.012 0.000 0.000
#> GSM875430     1  0.0404      0.858 0.988 0.012 0.000 0.000 0.000
#> GSM875432     1  0.2891      0.811 0.824 0.176 0.000 0.000 0.000
#> GSM875435     1  0.0510      0.857 0.984 0.016 0.000 0.000 0.000
#> GSM875436     4  0.6884      0.191 0.260 0.360 0.000 0.376 0.004
#> GSM875437     1  0.2773      0.825 0.836 0.164 0.000 0.000 0.000
#> GSM875447     1  0.0510      0.857 0.984 0.016 0.000 0.000 0.000
#> GSM875451     1  0.0290      0.858 0.992 0.008 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.858 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.1608      0.856 0.928 0.072 0.000 0.000 0.000
#> GSM875462     1  0.3661      0.792 0.724 0.276 0.000 0.000 0.000
#> GSM875465     1  0.3508      0.772 0.748 0.252 0.000 0.000 0.000
#> GSM875469     1  0.2230      0.832 0.884 0.116 0.000 0.000 0.000
#> GSM875470     1  0.5425      0.688 0.632 0.268 0.100 0.000 0.000
#> GSM875471     1  0.6649      0.383 0.448 0.268 0.284 0.000 0.000
#> GSM875472     1  0.4250      0.779 0.720 0.252 0.000 0.028 0.000
#> GSM875475     1  0.1965      0.844 0.904 0.096 0.000 0.000 0.000
#> GSM875476     1  0.4030      0.642 0.648 0.352 0.000 0.000 0.000
#> GSM875477     1  0.2648      0.822 0.848 0.152 0.000 0.000 0.000
#> GSM875414     5  0.1168      0.845 0.000 0.008 0.000 0.032 0.960
#> GSM875427     3  0.1357      0.945 0.000 0.004 0.948 0.000 0.048
#> GSM875431     5  0.2166      0.852 0.000 0.004 0.072 0.012 0.912
#> GSM875433     5  0.1911      0.836 0.000 0.028 0.004 0.036 0.932
#> GSM875443     3  0.1121      0.954 0.000 0.044 0.956 0.000 0.000
#> GSM875444     3  0.0451      0.977 0.000 0.008 0.988 0.000 0.004
#> GSM875445     3  0.0865      0.966 0.000 0.004 0.972 0.000 0.024
#> GSM875449     3  0.0451      0.977 0.000 0.008 0.988 0.000 0.004
#> GSM875450     3  0.0324      0.976 0.000 0.004 0.992 0.000 0.004
#> GSM875452     3  0.0671      0.970 0.000 0.004 0.980 0.000 0.016
#> GSM875454     5  0.2629      0.826 0.000 0.000 0.136 0.004 0.860
#> GSM875457     3  0.0451      0.977 0.000 0.008 0.988 0.000 0.004
#> GSM875458     3  0.0451      0.977 0.000 0.008 0.988 0.000 0.004
#> GSM875467     3  0.0324      0.975 0.000 0.004 0.992 0.000 0.004
#> GSM875468     3  0.0451      0.977 0.000 0.008 0.988 0.000 0.004
#> GSM875412     4  0.4640      0.367 0.000 0.016 0.000 0.584 0.400
#> GSM875419     4  0.3841      0.536 0.000 0.032 0.000 0.780 0.188
#> GSM875420     4  0.2464      0.542 0.000 0.016 0.000 0.888 0.096
#> GSM875421     5  0.1364      0.855 0.000 0.000 0.036 0.012 0.952
#> GSM875422     5  0.1444      0.855 0.000 0.000 0.040 0.012 0.948
#> GSM875426     5  0.1753      0.829 0.000 0.032 0.000 0.032 0.936
#> GSM875428     5  0.1197      0.835 0.000 0.000 0.000 0.048 0.952
#> GSM875429     2  0.5103      0.986 0.000 0.512 0.000 0.452 0.036
#> GSM875434     4  0.7021      0.376 0.112 0.264 0.000 0.544 0.080
#> GSM875438     4  0.5137      0.367 0.000 0.096 0.000 0.676 0.228
#> GSM875439     4  0.5178     -0.934 0.000 0.476 0.000 0.484 0.040
#> GSM875440     5  0.2905      0.790 0.000 0.036 0.000 0.096 0.868
#> GSM875441     4  0.1597      0.510 0.000 0.012 0.000 0.940 0.048
#> GSM875442     2  0.5223      0.970 0.000 0.512 0.000 0.444 0.044
#> GSM875446     4  0.5723     -0.746 0.000 0.392 0.000 0.520 0.088
#> GSM875448     4  0.2077      0.539 0.000 0.008 0.000 0.908 0.084
#> GSM875453     4  0.1981      0.519 0.000 0.016 0.000 0.920 0.064
#> GSM875455     2  0.5039      0.985 0.000 0.512 0.000 0.456 0.032
#> GSM875459     2  0.5173      0.972 0.000 0.500 0.000 0.460 0.040
#> GSM875460     4  0.4238      0.396 0.000 0.004 0.000 0.628 0.368
#> GSM875463     4  0.2233      0.545 0.000 0.004 0.000 0.892 0.104
#> GSM875464     4  0.3012      0.269 0.000 0.124 0.000 0.852 0.024
#> GSM875466     5  0.4501      0.670 0.000 0.008 0.276 0.020 0.696
#> GSM875473     5  0.6360      0.507 0.000 0.140 0.284 0.016 0.560
#> GSM875474     2  0.5103      0.986 0.000 0.512 0.000 0.452 0.036
#> GSM875478     2  0.5039      0.985 0.000 0.512 0.000 0.456 0.032
#> GSM875479     4  0.3642     -0.162 0.000 0.232 0.000 0.760 0.008
#> GSM875480     5  0.3044      0.816 0.000 0.004 0.148 0.008 0.840
#> GSM875481     5  0.3113      0.786 0.000 0.080 0.008 0.044 0.868

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.3662     0.6691 0.808 0.008 0.000 0.060 0.004 0.120
#> GSM875415     1  0.0000     0.7310 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.3050     0.3868 0.764 0.000 0.000 0.000 0.000 0.236
#> GSM875417     3  0.2003     0.8759 0.000 0.000 0.884 0.000 0.000 0.116
#> GSM875418     1  0.0260     0.7291 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875423     1  0.3615     0.1917 0.700 0.000 0.008 0.000 0.000 0.292
#> GSM875424     1  0.3050     0.3845 0.764 0.000 0.000 0.000 0.000 0.236
#> GSM875425     6  0.3684     0.7532 0.372 0.000 0.000 0.000 0.000 0.628
#> GSM875430     1  0.0146     0.7312 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM875432     1  0.3358     0.6739 0.824 0.000 0.000 0.052 0.008 0.116
#> GSM875435     1  0.0146     0.7312 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM875436     4  0.7601     0.0823 0.296 0.116 0.000 0.328 0.008 0.252
#> GSM875437     1  0.3461     0.6621 0.804 0.000 0.000 0.036 0.008 0.152
#> GSM875447     1  0.0260     0.7308 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875451     1  0.0260     0.7305 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875456     1  0.0458     0.7280 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM875461     1  0.2971     0.6876 0.832 0.000 0.000 0.020 0.004 0.144
#> GSM875462     1  0.4922    -0.0220 0.504 0.000 0.000 0.044 0.008 0.444
#> GSM875465     6  0.3998     0.5067 0.492 0.000 0.004 0.000 0.000 0.504
#> GSM875469     1  0.2697     0.5003 0.812 0.000 0.000 0.000 0.000 0.188
#> GSM875470     6  0.4184     0.7781 0.296 0.000 0.028 0.000 0.004 0.672
#> GSM875471     6  0.4787     0.7066 0.220 0.000 0.104 0.000 0.004 0.672
#> GSM875472     1  0.5502     0.1823 0.508 0.000 0.000 0.104 0.008 0.380
#> GSM875475     1  0.1802     0.7194 0.916 0.000 0.000 0.012 0.000 0.072
#> GSM875476     1  0.5804     0.4341 0.628 0.112 0.000 0.044 0.008 0.208
#> GSM875477     1  0.3411     0.6745 0.816 0.000 0.000 0.060 0.004 0.120
#> GSM875414     5  0.2002     0.8118 0.000 0.020 0.000 0.056 0.916 0.008
#> GSM875427     3  0.3194     0.8714 0.000 0.000 0.840 0.012 0.104 0.044
#> GSM875431     5  0.1622     0.8165 0.000 0.000 0.028 0.016 0.940 0.016
#> GSM875433     5  0.3157     0.8013 0.000 0.056 0.008 0.036 0.864 0.036
#> GSM875443     3  0.2566     0.9016 0.000 0.000 0.868 0.008 0.012 0.112
#> GSM875444     3  0.0146     0.9406 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM875445     3  0.2291     0.9260 0.000 0.000 0.904 0.012 0.044 0.040
#> GSM875449     3  0.0291     0.9406 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM875450     3  0.1251     0.9396 0.000 0.000 0.956 0.008 0.012 0.024
#> GSM875452     3  0.2147     0.9304 0.000 0.000 0.912 0.012 0.032 0.044
#> GSM875454     5  0.2898     0.7893 0.000 0.000 0.088 0.024 0.864 0.024
#> GSM875457     3  0.0665     0.9364 0.000 0.000 0.980 0.008 0.004 0.008
#> GSM875458     3  0.0291     0.9406 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM875467     3  0.1922     0.9341 0.000 0.000 0.924 0.012 0.024 0.040
#> GSM875468     3  0.0291     0.9406 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM875412     4  0.5622     0.5684 0.000 0.096 0.000 0.632 0.216 0.056
#> GSM875419     4  0.3615     0.7033 0.000 0.080 0.000 0.824 0.064 0.032
#> GSM875420     4  0.3816     0.6983 0.000 0.160 0.000 0.784 0.032 0.024
#> GSM875421     5  0.0964     0.8176 0.000 0.000 0.012 0.016 0.968 0.004
#> GSM875422     5  0.1710     0.8191 0.000 0.000 0.028 0.020 0.936 0.016
#> GSM875426     5  0.3065     0.7867 0.000 0.096 0.000 0.048 0.848 0.008
#> GSM875428     5  0.1858     0.7999 0.000 0.000 0.000 0.092 0.904 0.004
#> GSM875429     2  0.0865     0.8745 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM875434     4  0.6387     0.4824 0.112 0.052 0.000 0.608 0.040 0.188
#> GSM875438     4  0.5917     0.4524 0.000 0.308 0.000 0.536 0.128 0.028
#> GSM875439     2  0.1152     0.8671 0.000 0.952 0.000 0.044 0.004 0.000
#> GSM875440     5  0.4567     0.7128 0.000 0.096 0.000 0.128 0.744 0.032
#> GSM875441     4  0.3568     0.6894 0.000 0.188 0.000 0.780 0.012 0.020
#> GSM875442     2  0.1321     0.8680 0.000 0.952 0.000 0.020 0.004 0.024
#> GSM875446     2  0.2575     0.8030 0.000 0.880 0.000 0.072 0.044 0.004
#> GSM875448     4  0.3603     0.7024 0.000 0.136 0.000 0.804 0.012 0.048
#> GSM875453     4  0.3966     0.6804 0.000 0.184 0.000 0.760 0.012 0.044
#> GSM875455     2  0.0363     0.8828 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM875459     2  0.0508     0.8831 0.000 0.984 0.000 0.012 0.004 0.000
#> GSM875460     4  0.4210     0.6600 0.000 0.052 0.000 0.756 0.168 0.024
#> GSM875463     4  0.3823     0.7049 0.000 0.124 0.000 0.800 0.032 0.044
#> GSM875464     4  0.4358     0.4301 0.000 0.380 0.000 0.596 0.008 0.016
#> GSM875466     5  0.5434     0.4104 0.000 0.000 0.376 0.056 0.536 0.032
#> GSM875473     5  0.6633     0.2920 0.000 0.000 0.288 0.032 0.408 0.272
#> GSM875474     2  0.0508     0.8830 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM875478     2  0.0405     0.8844 0.000 0.988 0.000 0.008 0.000 0.004
#> GSM875479     2  0.4062    -0.0767 0.000 0.552 0.000 0.440 0.000 0.008
#> GSM875480     5  0.2936     0.7817 0.000 0.000 0.112 0.020 0.852 0.016
#> GSM875481     5  0.3350     0.7508 0.000 0.156 0.004 0.016 0.812 0.012

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) k
#> CV:skmeans 69         1.89e-12 2
#> CV:skmeans 67         6.59e-20 3
#> CV:skmeans 64         4.80e-20 4
#> CV:skmeans 60         4.36e-17 5
#> CV:skmeans 57         2.37e-15 6

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


CV: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 51941 rows and 70 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.940           0.956       0.981         0.4596 0.543   0.543
#> 3 3 0.727           0.694       0.872         0.3974 0.803   0.646
#> 4 4 0.766           0.851       0.930         0.1471 0.824   0.566
#> 5 5 0.800           0.767       0.881         0.0817 0.877   0.579
#> 6 6 0.831           0.750       0.878         0.0386 0.942   0.727

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
#> GSM875413     1  0.0000      0.976 1.000 0.000
#> GSM875415     1  0.0000      0.976 1.000 0.000
#> GSM875416     1  0.0000      0.976 1.000 0.000
#> GSM875417     2  0.6623      0.795 0.172 0.828
#> GSM875418     1  0.0000      0.976 1.000 0.000
#> GSM875423     1  0.0000      0.976 1.000 0.000
#> GSM875424     1  0.0000      0.976 1.000 0.000
#> GSM875425     1  0.0000      0.976 1.000 0.000
#> GSM875430     1  0.0000      0.976 1.000 0.000
#> GSM875432     1  0.0000      0.976 1.000 0.000
#> GSM875435     1  0.0000      0.976 1.000 0.000
#> GSM875436     1  0.0376      0.973 0.996 0.004
#> GSM875437     1  0.0000      0.976 1.000 0.000
#> GSM875447     1  0.0000      0.976 1.000 0.000
#> GSM875451     1  0.0000      0.976 1.000 0.000
#> GSM875456     1  0.0000      0.976 1.000 0.000
#> GSM875461     1  0.0000      0.976 1.000 0.000
#> GSM875462     1  0.0376      0.973 0.996 0.004
#> GSM875465     2  0.9087      0.530 0.324 0.676
#> GSM875469     1  0.0000      0.976 1.000 0.000
#> GSM875470     2  0.6048      0.826 0.148 0.852
#> GSM875471     2  0.0672      0.975 0.008 0.992
#> GSM875472     1  0.0000      0.976 1.000 0.000
#> GSM875475     1  0.0000      0.976 1.000 0.000
#> GSM875476     1  0.0000      0.976 1.000 0.000
#> GSM875477     1  0.0000      0.976 1.000 0.000
#> GSM875414     2  0.0000      0.981 0.000 1.000
#> GSM875427     2  0.0000      0.981 0.000 1.000
#> GSM875431     2  0.0000      0.981 0.000 1.000
#> GSM875433     2  0.0000      0.981 0.000 1.000
#> GSM875443     2  0.0376      0.978 0.004 0.996
#> GSM875444     2  0.0000      0.981 0.000 1.000
#> GSM875445     2  0.0000      0.981 0.000 1.000
#> GSM875449     2  0.0000      0.981 0.000 1.000
#> GSM875450     2  0.0000      0.981 0.000 1.000
#> GSM875452     2  0.0000      0.981 0.000 1.000
#> GSM875454     2  0.0000      0.981 0.000 1.000
#> GSM875457     2  0.0000      0.981 0.000 1.000
#> GSM875458     2  0.0000      0.981 0.000 1.000
#> GSM875467     2  0.0000      0.981 0.000 1.000
#> GSM875468     2  0.0000      0.981 0.000 1.000
#> GSM875412     2  0.0000      0.981 0.000 1.000
#> GSM875419     2  0.0000      0.981 0.000 1.000
#> GSM875420     2  0.0000      0.981 0.000 1.000
#> GSM875421     2  0.0000      0.981 0.000 1.000
#> GSM875422     2  0.0000      0.981 0.000 1.000
#> GSM875426     2  0.0000      0.981 0.000 1.000
#> GSM875428     2  0.0000      0.981 0.000 1.000
#> GSM875429     2  0.6438      0.805 0.164 0.836
#> GSM875434     1  0.8144      0.662 0.748 0.252
#> GSM875438     2  0.0000      0.981 0.000 1.000
#> GSM875439     2  0.0000      0.981 0.000 1.000
#> GSM875440     2  0.0000      0.981 0.000 1.000
#> GSM875441     2  0.0000      0.981 0.000 1.000
#> GSM875442     2  0.1184      0.967 0.016 0.984
#> GSM875446     2  0.0000      0.981 0.000 1.000
#> GSM875448     2  0.0000      0.981 0.000 1.000
#> GSM875453     2  0.0000      0.981 0.000 1.000
#> GSM875455     1  0.8386      0.631 0.732 0.268
#> GSM875459     2  0.0000      0.981 0.000 1.000
#> GSM875460     2  0.0000      0.981 0.000 1.000
#> GSM875463     2  0.0000      0.981 0.000 1.000
#> GSM875464     2  0.0000      0.981 0.000 1.000
#> GSM875466     2  0.0000      0.981 0.000 1.000
#> GSM875473     2  0.0000      0.981 0.000 1.000
#> GSM875474     2  0.0000      0.981 0.000 1.000
#> GSM875478     2  0.0000      0.981 0.000 1.000
#> GSM875479     2  0.0000      0.981 0.000 1.000
#> GSM875480     2  0.0000      0.981 0.000 1.000
#> GSM875481     2  0.0000      0.981 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM875413     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875415     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875416     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875417     3  0.3116     0.6468 0.108 0.000 0.892
#> GSM875418     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875423     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875424     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875425     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875430     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875432     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875435     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875436     1  0.0983     0.9278 0.980 0.004 0.016
#> GSM875437     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875447     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875451     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875456     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875461     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875462     1  0.0237     0.9436 0.996 0.000 0.004
#> GSM875465     1  0.5948     0.3499 0.640 0.000 0.360
#> GSM875469     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875470     3  0.3551     0.6199 0.132 0.000 0.868
#> GSM875471     3  0.0892     0.7381 0.020 0.000 0.980
#> GSM875472     1  0.1031     0.9236 0.976 0.024 0.000
#> GSM875475     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875476     1  0.0592     0.9377 0.988 0.012 0.000
#> GSM875477     1  0.0000     0.9473 1.000 0.000 0.000
#> GSM875414     3  0.6286     0.4077 0.000 0.464 0.536
#> GSM875427     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875431     3  0.6286     0.4077 0.000 0.464 0.536
#> GSM875433     3  0.1031     0.7360 0.000 0.024 0.976
#> GSM875443     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875444     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875445     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875449     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875450     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875452     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875454     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875457     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875458     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875467     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875468     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875412     3  0.6302     0.3761 0.000 0.480 0.520
#> GSM875419     3  0.6286     0.4077 0.000 0.464 0.536
#> GSM875420     2  0.1031     0.7634 0.000 0.976 0.024
#> GSM875421     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875422     3  0.6140     0.4690 0.000 0.404 0.596
#> GSM875426     3  0.0747     0.7412 0.000 0.016 0.984
#> GSM875428     3  0.6286     0.4077 0.000 0.464 0.536
#> GSM875429     2  0.6062     0.2404 0.384 0.616 0.000
#> GSM875434     1  0.7581    -0.1522 0.496 0.464 0.040
#> GSM875438     2  0.5529     0.3009 0.000 0.704 0.296
#> GSM875439     2  0.0000     0.7758 0.000 1.000 0.000
#> GSM875440     3  0.6307     0.3570 0.000 0.488 0.512
#> GSM875441     3  0.6286     0.4077 0.000 0.464 0.536
#> GSM875442     2  0.5706     0.2239 0.000 0.680 0.320
#> GSM875446     2  0.0000     0.7758 0.000 1.000 0.000
#> GSM875448     3  0.6286     0.4077 0.000 0.464 0.536
#> GSM875453     3  0.6295     0.3923 0.000 0.472 0.528
#> GSM875455     2  0.6260     0.0454 0.448 0.552 0.000
#> GSM875459     2  0.0000     0.7758 0.000 1.000 0.000
#> GSM875460     3  0.6286     0.4077 0.000 0.464 0.536
#> GSM875463     3  0.6302     0.3761 0.000 0.480 0.520
#> GSM875464     2  0.2066     0.7337 0.000 0.940 0.060
#> GSM875466     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875473     3  0.0000     0.7512 0.000 0.000 1.000
#> GSM875474     2  0.4859     0.6632 0.044 0.840 0.116
#> GSM875478     2  0.0000     0.7758 0.000 1.000 0.000
#> GSM875479     2  0.0000     0.7758 0.000 1.000 0.000
#> GSM875480     3  0.6260     0.4261 0.000 0.448 0.552
#> GSM875481     3  0.0424     0.7466 0.000 0.008 0.992

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875415     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875417     3  0.1792      0.846 0.068 0.000 0.932 0.000
#> GSM875418     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875423     1  0.3486      0.770 0.812 0.000 0.188 0.000
#> GSM875424     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875425     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875430     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875436     1  0.2760      0.839 0.872 0.000 0.000 0.128
#> GSM875437     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875462     1  0.2675      0.891 0.908 0.000 0.044 0.048
#> GSM875465     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875469     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875470     3  0.2814      0.782 0.132 0.000 0.868 0.000
#> GSM875471     3  0.5560      0.768 0.116 0.000 0.728 0.156
#> GSM875472     1  0.3528      0.762 0.808 0.000 0.000 0.192
#> GSM875475     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875476     1  0.2530      0.860 0.888 0.112 0.000 0.000
#> GSM875477     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM875414     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875427     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875431     4  0.2216      0.807 0.000 0.000 0.092 0.908
#> GSM875433     3  0.3591      0.835 0.000 0.008 0.824 0.168
#> GSM875443     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875449     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875454     3  0.3123      0.846 0.000 0.000 0.844 0.156
#> GSM875457     3  0.3123      0.846 0.000 0.000 0.844 0.156
#> GSM875458     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000      0.893 0.000 0.000 1.000 0.000
#> GSM875412     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875419     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875420     4  0.3123      0.739 0.000 0.156 0.000 0.844
#> GSM875421     3  0.3123      0.846 0.000 0.000 0.844 0.156
#> GSM875422     4  0.4431      0.488 0.000 0.000 0.304 0.696
#> GSM875426     2  0.6848      0.395 0.000 0.592 0.248 0.160
#> GSM875428     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875429     2  0.0000      0.893 0.000 1.000 0.000 0.000
#> GSM875434     4  0.3074      0.714 0.152 0.000 0.000 0.848
#> GSM875438     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875439     2  0.0000      0.893 0.000 1.000 0.000 0.000
#> GSM875440     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875441     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875442     2  0.4761      0.419 0.000 0.628 0.000 0.372
#> GSM875446     2  0.0000      0.893 0.000 1.000 0.000 0.000
#> GSM875448     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875453     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875455     2  0.0000      0.893 0.000 1.000 0.000 0.000
#> GSM875459     2  0.0000      0.893 0.000 1.000 0.000 0.000
#> GSM875460     4  0.0000      0.877 0.000 0.000 0.000 1.000
#> GSM875463     4  0.0469      0.871 0.000 0.012 0.000 0.988
#> GSM875464     4  0.3610      0.697 0.000 0.200 0.000 0.800
#> GSM875466     3  0.3123      0.846 0.000 0.000 0.844 0.156
#> GSM875473     3  0.3486      0.824 0.000 0.000 0.812 0.188
#> GSM875474     2  0.0000      0.893 0.000 1.000 0.000 0.000
#> GSM875478     2  0.0000      0.893 0.000 1.000 0.000 0.000
#> GSM875479     4  0.4830      0.397 0.000 0.392 0.000 0.608
#> GSM875480     4  0.4543      0.466 0.000 0.000 0.324 0.676
#> GSM875481     3  0.5811      0.726 0.000 0.116 0.704 0.180

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875415     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875417     5  0.2629     0.6375 0.004 0.000 0.136 0.000 0.860
#> GSM875418     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875423     3  0.4114     0.3466 0.376 0.000 0.624 0.000 0.000
#> GSM875424     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875425     5  0.3816     0.5496 0.304 0.000 0.000 0.000 0.696
#> GSM875430     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875435     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.0404     0.9844 0.988 0.000 0.000 0.012 0.000
#> GSM875437     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875447     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875462     5  0.5222     0.6377 0.100 0.000 0.008 0.196 0.696
#> GSM875465     5  0.2230     0.6755 0.116 0.000 0.000 0.000 0.884
#> GSM875469     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875470     5  0.4181     0.6207 0.020 0.000 0.268 0.000 0.712
#> GSM875471     5  0.3628     0.6382 0.012 0.000 0.216 0.000 0.772
#> GSM875472     5  0.4969     0.5576 0.056 0.000 0.000 0.292 0.652
#> GSM875475     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875476     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875477     1  0.0000     0.9991 1.000 0.000 0.000 0.000 0.000
#> GSM875414     4  0.3305     0.7274 0.000 0.000 0.000 0.776 0.224
#> GSM875427     3  0.1410     0.7060 0.000 0.000 0.940 0.000 0.060
#> GSM875431     3  0.6406     0.4359 0.000 0.000 0.512 0.248 0.240
#> GSM875433     3  0.2733     0.7062 0.000 0.012 0.872 0.004 0.112
#> GSM875443     3  0.4015     0.0914 0.000 0.000 0.652 0.000 0.348
#> GSM875444     3  0.3003     0.7251 0.000 0.000 0.812 0.000 0.188
#> GSM875445     3  0.0000     0.7413 0.000 0.000 1.000 0.000 0.000
#> GSM875449     3  0.3003     0.7251 0.000 0.000 0.812 0.000 0.188
#> GSM875450     3  0.0000     0.7413 0.000 0.000 1.000 0.000 0.000
#> GSM875452     3  0.0000     0.7413 0.000 0.000 1.000 0.000 0.000
#> GSM875454     3  0.2230     0.7101 0.000 0.000 0.884 0.000 0.116
#> GSM875457     5  0.3336     0.4693 0.000 0.000 0.228 0.000 0.772
#> GSM875458     3  0.3003     0.7251 0.000 0.000 0.812 0.000 0.188
#> GSM875467     3  0.0000     0.7413 0.000 0.000 1.000 0.000 0.000
#> GSM875468     3  0.3003     0.7251 0.000 0.000 0.812 0.000 0.188
#> GSM875412     4  0.0000     0.8918 0.000 0.000 0.000 1.000 0.000
#> GSM875419     4  0.0000     0.8918 0.000 0.000 0.000 1.000 0.000
#> GSM875420     4  0.0000     0.8918 0.000 0.000 0.000 1.000 0.000
#> GSM875421     5  0.3796     0.2296 0.000 0.000 0.300 0.000 0.700
#> GSM875422     4  0.5697     0.4752 0.000 0.000 0.288 0.596 0.116
#> GSM875426     2  0.5880     0.4178 0.000 0.568 0.128 0.000 0.304
#> GSM875428     4  0.2230     0.8335 0.000 0.000 0.000 0.884 0.116
#> GSM875429     2  0.0000     0.8349 0.000 1.000 0.000 0.000 0.000
#> GSM875434     4  0.0162     0.8896 0.004 0.000 0.000 0.996 0.000
#> GSM875438     4  0.0000     0.8918 0.000 0.000 0.000 1.000 0.000
#> GSM875439     2  0.0000     0.8349 0.000 1.000 0.000 0.000 0.000
#> GSM875440     4  0.1544     0.8674 0.000 0.000 0.000 0.932 0.068
#> GSM875441     4  0.0703     0.8860 0.000 0.000 0.000 0.976 0.024
#> GSM875442     2  0.4299     0.3794 0.000 0.608 0.000 0.388 0.004
#> GSM875446     2  0.0000     0.8349 0.000 1.000 0.000 0.000 0.000
#> GSM875448     4  0.0000     0.8918 0.000 0.000 0.000 1.000 0.000
#> GSM875453     4  0.1341     0.8718 0.000 0.000 0.000 0.944 0.056
#> GSM875455     2  0.0000     0.8349 0.000 1.000 0.000 0.000 0.000
#> GSM875459     2  0.0000     0.8349 0.000 1.000 0.000 0.000 0.000
#> GSM875460     4  0.0000     0.8918 0.000 0.000 0.000 1.000 0.000
#> GSM875463     4  0.0000     0.8918 0.000 0.000 0.000 1.000 0.000
#> GSM875464     4  0.3074     0.7389 0.000 0.196 0.000 0.804 0.000
#> GSM875466     3  0.3816     0.6614 0.000 0.000 0.696 0.000 0.304
#> GSM875473     5  0.0000     0.6577 0.000 0.000 0.000 0.000 1.000
#> GSM875474     2  0.0000     0.8349 0.000 1.000 0.000 0.000 0.000
#> GSM875478     2  0.0000     0.8349 0.000 1.000 0.000 0.000 0.000
#> GSM875479     4  0.4161     0.4376 0.000 0.392 0.000 0.608 0.000
#> GSM875480     3  0.5019     0.5320 0.000 0.000 0.568 0.036 0.396
#> GSM875481     2  0.6342     0.3544 0.000 0.520 0.208 0.000 0.272

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875415     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875417     6  0.3679     0.5924 0.000 0.000 0.200 0.000 0.040 0.760
#> GSM875418     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875423     3  0.2969     0.5805 0.224 0.000 0.776 0.000 0.000 0.000
#> GSM875424     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875425     6  0.2219     0.6882 0.136 0.000 0.000 0.000 0.000 0.864
#> GSM875430     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875435     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875437     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875447     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.0547     0.9797 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM875462     6  0.2219     0.7230 0.000 0.000 0.000 0.136 0.000 0.864
#> GSM875465     6  0.0000     0.7477 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM875469     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875470     6  0.2219     0.7415 0.000 0.000 0.136 0.000 0.000 0.864
#> GSM875471     6  0.2219     0.7415 0.000 0.000 0.136 0.000 0.000 0.864
#> GSM875472     6  0.3652     0.6239 0.016 0.000 0.000 0.264 0.000 0.720
#> GSM875475     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875476     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875477     1  0.0000     0.9988 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875414     5  0.0458     0.6617 0.000 0.000 0.000 0.016 0.984 0.000
#> GSM875427     3  0.1524     0.7200 0.000 0.000 0.932 0.000 0.008 0.060
#> GSM875431     5  0.6086     0.2402 0.000 0.000 0.336 0.060 0.516 0.088
#> GSM875433     3  0.3843    -0.0134 0.000 0.000 0.548 0.000 0.452 0.000
#> GSM875443     3  0.3647     0.1206 0.000 0.000 0.640 0.000 0.000 0.360
#> GSM875444     3  0.3123     0.7476 0.000 0.000 0.824 0.000 0.040 0.136
#> GSM875445     3  0.0000     0.7507 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875449     3  0.3123     0.7476 0.000 0.000 0.824 0.000 0.040 0.136
#> GSM875450     3  0.0000     0.7507 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.0000     0.7507 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875454     5  0.3774     0.3451 0.000 0.000 0.408 0.000 0.592 0.000
#> GSM875457     6  0.4276     0.5899 0.000 0.000 0.168 0.000 0.104 0.728
#> GSM875458     3  0.3123     0.7476 0.000 0.000 0.824 0.000 0.040 0.136
#> GSM875467     3  0.0000     0.7507 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875468     3  0.3123     0.7476 0.000 0.000 0.824 0.000 0.040 0.136
#> GSM875412     4  0.0000     0.8798 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875419     4  0.0000     0.8798 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875420     4  0.0000     0.8798 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875421     5  0.4299     0.4107 0.000 0.000 0.040 0.000 0.652 0.308
#> GSM875422     5  0.5451     0.3933 0.000 0.000 0.136 0.340 0.524 0.000
#> GSM875426     5  0.0000     0.6573 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM875428     5  0.0937     0.6600 0.000 0.000 0.000 0.040 0.960 0.000
#> GSM875429     2  0.0000     0.9293 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875434     4  0.0000     0.8798 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875438     4  0.0000     0.8798 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875439     2  0.0000     0.9293 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875440     5  0.2730     0.5548 0.000 0.000 0.000 0.192 0.808 0.000
#> GSM875441     4  0.0547     0.8635 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM875442     2  0.3756     0.2955 0.000 0.600 0.000 0.400 0.000 0.000
#> GSM875446     2  0.0000     0.9293 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875448     4  0.3634     0.4073 0.000 0.000 0.000 0.644 0.356 0.000
#> GSM875453     5  0.3409     0.3840 0.000 0.000 0.000 0.300 0.700 0.000
#> GSM875455     2  0.0000     0.9293 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875459     2  0.0000     0.9293 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875460     4  0.0146     0.8773 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM875463     4  0.0000     0.8798 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875464     4  0.2762     0.7069 0.000 0.196 0.000 0.804 0.000 0.000
#> GSM875466     3  0.5187     0.5027 0.000 0.000 0.600 0.000 0.264 0.136
#> GSM875473     6  0.2793     0.6061 0.000 0.000 0.000 0.000 0.200 0.800
#> GSM875474     2  0.0000     0.9293 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875478     2  0.0000     0.9293 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875479     4  0.3756     0.3390 0.000 0.400 0.000 0.600 0.000 0.000
#> GSM875480     3  0.5317     0.5937 0.000 0.000 0.640 0.016 0.200 0.144
#> GSM875481     5  0.5887     0.4093 0.000 0.312 0.056 0.000 0.552 0.080

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.352           0.616       0.798         0.3567 0.675   0.675
#> 3 3 0.854           0.877       0.945         0.7925 0.583   0.431
#> 4 4 0.877           0.828       0.915         0.1557 0.765   0.457
#> 5 5 0.802           0.767       0.861         0.0473 0.861   0.558
#> 6 6 0.826           0.813       0.884         0.0421 0.939   0.755

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
#> GSM875413     2  0.9129     -0.278 0.328 0.672
#> GSM875415     1  0.9754      0.976 0.592 0.408
#> GSM875416     1  0.9754      0.976 0.592 0.408
#> GSM875417     2  0.9775      0.479 0.412 0.588
#> GSM875418     1  0.9754      0.976 0.592 0.408
#> GSM875423     2  0.9795     -0.588 0.416 0.584
#> GSM875424     2  0.9795     -0.588 0.416 0.584
#> GSM875425     2  0.9795     -0.588 0.416 0.584
#> GSM875430     1  0.9754      0.976 0.592 0.408
#> GSM875432     1  0.9815      0.968 0.580 0.420
#> GSM875435     1  0.9754      0.976 0.592 0.408
#> GSM875436     2  0.7139      0.378 0.196 0.804
#> GSM875437     1  0.9896      0.945 0.560 0.440
#> GSM875447     1  0.9754      0.976 0.592 0.408
#> GSM875451     1  0.9754      0.976 0.592 0.408
#> GSM875456     1  0.9754      0.976 0.592 0.408
#> GSM875461     1  0.9850      0.961 0.572 0.428
#> GSM875462     1  0.9983      0.875 0.524 0.476
#> GSM875465     2  0.7299      0.313 0.204 0.796
#> GSM875469     2  0.9795     -0.588 0.416 0.584
#> GSM875470     2  0.2603      0.678 0.044 0.956
#> GSM875471     2  0.2603      0.694 0.044 0.956
#> GSM875472     2  0.7299      0.355 0.204 0.796
#> GSM875475     1  0.9754      0.976 0.592 0.408
#> GSM875476     2  0.7299      0.355 0.204 0.796
#> GSM875477     1  0.9896      0.945 0.560 0.440
#> GSM875414     2  0.0000      0.731 0.000 1.000
#> GSM875427     2  0.9754      0.482 0.408 0.592
#> GSM875431     2  0.1633      0.722 0.024 0.976
#> GSM875433     2  0.0000      0.731 0.000 1.000
#> GSM875443     2  0.9754      0.482 0.408 0.592
#> GSM875444     2  0.9754      0.482 0.408 0.592
#> GSM875445     2  0.9754      0.482 0.408 0.592
#> GSM875449     2  0.9754      0.482 0.408 0.592
#> GSM875450     2  0.9754      0.482 0.408 0.592
#> GSM875452     2  0.9732      0.484 0.404 0.596
#> GSM875454     2  0.5178      0.675 0.116 0.884
#> GSM875457     2  0.6247      0.648 0.156 0.844
#> GSM875458     2  0.9754      0.482 0.408 0.592
#> GSM875467     2  0.9754      0.482 0.408 0.592
#> GSM875468     2  0.9754      0.482 0.408 0.592
#> GSM875412     2  0.0000      0.731 0.000 1.000
#> GSM875419     2  0.0000      0.731 0.000 1.000
#> GSM875420     2  0.0000      0.731 0.000 1.000
#> GSM875421     2  0.5178      0.675 0.116 0.884
#> GSM875422     2  0.5178      0.675 0.116 0.884
#> GSM875426     2  0.0376      0.730 0.004 0.996
#> GSM875428     2  0.0000      0.731 0.000 1.000
#> GSM875429     2  0.0000      0.731 0.000 1.000
#> GSM875434     2  0.7139      0.378 0.196 0.804
#> GSM875438     2  0.0000      0.731 0.000 1.000
#> GSM875439     2  0.0000      0.731 0.000 1.000
#> GSM875440     2  0.0000      0.731 0.000 1.000
#> GSM875441     2  0.0000      0.731 0.000 1.000
#> GSM875442     2  0.0000      0.731 0.000 1.000
#> GSM875446     2  0.0000      0.731 0.000 1.000
#> GSM875448     2  0.0000      0.731 0.000 1.000
#> GSM875453     2  0.0000      0.731 0.000 1.000
#> GSM875455     2  0.0000      0.731 0.000 1.000
#> GSM875459     2  0.0000      0.731 0.000 1.000
#> GSM875460     2  0.0000      0.731 0.000 1.000
#> GSM875463     2  0.0000      0.731 0.000 1.000
#> GSM875464     2  0.0000      0.731 0.000 1.000
#> GSM875466     2  0.1184      0.726 0.016 0.984
#> GSM875473     2  0.0000      0.731 0.000 1.000
#> GSM875474     2  0.0000      0.731 0.000 1.000
#> GSM875478     2  0.0000      0.731 0.000 1.000
#> GSM875479     2  0.0000      0.731 0.000 1.000
#> GSM875480     2  0.5178      0.675 0.116 0.884
#> GSM875481     2  0.0000      0.731 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
#> GSM875413     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875415     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875416     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875417     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875418     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875423     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875424     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875425     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875430     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875432     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875435     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875436     2   0.540     0.6379 0.280 0.720 0.000
#> GSM875437     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875447     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875451     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875456     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875461     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875462     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875465     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875469     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875470     1   0.550     0.5374 0.708 0.000 0.292
#> GSM875471     1   0.595     0.4017 0.640 0.000 0.360
#> GSM875472     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875475     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875476     1   0.630    -0.0217 0.528 0.472 0.000
#> GSM875477     1   0.000     0.9417 1.000 0.000 0.000
#> GSM875414     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875427     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875431     2   0.559     0.6585 0.000 0.696 0.304
#> GSM875433     2   0.288     0.8528 0.000 0.904 0.096
#> GSM875443     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875444     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875445     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875449     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875450     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875452     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875454     2   0.559     0.6585 0.000 0.696 0.304
#> GSM875457     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875458     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875467     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875468     3   0.000     1.0000 0.000 0.000 1.000
#> GSM875412     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875419     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875420     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875421     2   0.559     0.6585 0.000 0.696 0.304
#> GSM875422     2   0.559     0.6585 0.000 0.696 0.304
#> GSM875426     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875428     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875429     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875434     2   0.418     0.7740 0.172 0.828 0.000
#> GSM875438     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875439     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875440     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875441     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875442     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875446     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875448     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875453     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875455     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875459     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875460     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875463     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875464     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875466     2   0.559     0.6585 0.000 0.696 0.304
#> GSM875473     2   0.559     0.6585 0.000 0.696 0.304
#> GSM875474     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875478     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875479     2   0.000     0.9109 0.000 1.000 0.000
#> GSM875480     2   0.559     0.6585 0.000 0.696 0.304
#> GSM875481     2   0.207     0.8780 0.000 0.940 0.060

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.0921     0.9532 0.972 0.000 0.000 0.028
#> GSM875415     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875417     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875418     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875423     1  0.0188     0.9726 0.996 0.000 0.000 0.004
#> GSM875424     1  0.0188     0.9726 0.996 0.000 0.000 0.004
#> GSM875425     1  0.0188     0.9726 0.996 0.000 0.000 0.004
#> GSM875430     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875436     1  0.4941     0.2204 0.564 0.436 0.000 0.000
#> GSM875437     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875462     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875465     1  0.0188     0.9726 0.996 0.000 0.000 0.004
#> GSM875469     1  0.0188     0.9726 0.996 0.000 0.000 0.004
#> GSM875470     3  0.4500     0.5283 0.316 0.000 0.684 0.000
#> GSM875471     3  0.0188     0.9532 0.004 0.000 0.996 0.000
#> GSM875472     1  0.0921     0.9532 0.972 0.000 0.000 0.028
#> GSM875475     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875476     1  0.0336     0.9663 0.992 0.008 0.000 0.000
#> GSM875477     1  0.0000     0.9739 1.000 0.000 0.000 0.000
#> GSM875414     2  0.5368     0.1381 0.000 0.636 0.024 0.340
#> GSM875427     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875431     3  0.1042     0.9368 0.000 0.008 0.972 0.020
#> GSM875433     2  0.4972     0.0112 0.000 0.544 0.456 0.000
#> GSM875443     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875449     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875454     3  0.0336     0.9516 0.000 0.008 0.992 0.000
#> GSM875457     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM875412     2  0.4436     0.4525 0.000 0.764 0.020 0.216
#> GSM875419     4  0.5186     0.6059 0.000 0.344 0.016 0.640
#> GSM875420     4  0.0921     0.7832 0.000 0.028 0.000 0.972
#> GSM875421     3  0.3649     0.7527 0.000 0.204 0.796 0.000
#> GSM875422     3  0.3528     0.7681 0.000 0.192 0.808 0.000
#> GSM875426     2  0.0336     0.7164 0.000 0.992 0.008 0.000
#> GSM875428     4  0.5724     0.4635 0.000 0.424 0.028 0.548
#> GSM875429     2  0.3569     0.7794 0.000 0.804 0.000 0.196
#> GSM875434     4  0.7259     0.3430 0.384 0.076 0.028 0.512
#> GSM875438     2  0.2149     0.6594 0.000 0.912 0.000 0.088
#> GSM875439     2  0.3569     0.7794 0.000 0.804 0.000 0.196
#> GSM875440     2  0.0188     0.7181 0.000 0.996 0.004 0.000
#> GSM875441     4  0.1211     0.7734 0.000 0.040 0.000 0.960
#> GSM875442     2  0.3569     0.7794 0.000 0.804 0.000 0.196
#> GSM875446     2  0.3569     0.7794 0.000 0.804 0.000 0.196
#> GSM875448     4  0.1474     0.7829 0.000 0.052 0.000 0.948
#> GSM875453     4  0.0469     0.7815 0.000 0.012 0.000 0.988
#> GSM875455     2  0.3569     0.7794 0.000 0.804 0.000 0.196
#> GSM875459     2  0.3569     0.7794 0.000 0.804 0.000 0.196
#> GSM875460     4  0.5546     0.6524 0.000 0.268 0.052 0.680
#> GSM875463     4  0.2973     0.7464 0.000 0.144 0.000 0.856
#> GSM875464     4  0.0469     0.7815 0.000 0.012 0.000 0.988
#> GSM875466     3  0.0336     0.9516 0.000 0.008 0.992 0.000
#> GSM875473     3  0.0336     0.9516 0.000 0.008 0.992 0.000
#> GSM875474     2  0.3569     0.7794 0.000 0.804 0.000 0.196
#> GSM875478     2  0.3569     0.7794 0.000 0.804 0.000 0.196
#> GSM875479     4  0.0592     0.7821 0.000 0.016 0.000 0.984
#> GSM875480     3  0.0336     0.9516 0.000 0.008 0.992 0.000
#> GSM875481     2  0.0188     0.7181 0.000 0.996 0.004 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.2390     0.8695 0.896 0.084 0.000 0.020 0.000
#> GSM875415     1  0.0000     0.9075 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0510     0.9038 0.984 0.016 0.000 0.000 0.000
#> GSM875417     3  0.0000     0.8725 0.000 0.000 1.000 0.000 0.000
#> GSM875418     1  0.0000     0.9075 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.3242     0.8268 0.852 0.072 0.076 0.000 0.000
#> GSM875424     1  0.1638     0.8831 0.932 0.064 0.004 0.000 0.000
#> GSM875425     1  0.2580     0.8599 0.892 0.064 0.044 0.000 0.000
#> GSM875430     1  0.0000     0.9075 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0609     0.9058 0.980 0.020 0.000 0.000 0.000
#> GSM875435     1  0.0000     0.9075 1.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.6396     0.0412 0.508 0.212 0.000 0.000 0.280
#> GSM875437     1  0.0609     0.9058 0.980 0.020 0.000 0.000 0.000
#> GSM875447     1  0.0000     0.9075 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9075 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9075 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.0510     0.9065 0.984 0.016 0.000 0.000 0.000
#> GSM875462     1  0.0609     0.9058 0.980 0.020 0.000 0.000 0.000
#> GSM875465     1  0.2504     0.8628 0.896 0.064 0.040 0.000 0.000
#> GSM875469     1  0.1851     0.8772 0.912 0.088 0.000 0.000 0.000
#> GSM875470     1  0.4445     0.5308 0.676 0.024 0.300 0.000 0.000
#> GSM875471     3  0.4827    -0.0306 0.476 0.020 0.504 0.000 0.000
#> GSM875472     1  0.1410     0.8925 0.940 0.060 0.000 0.000 0.000
#> GSM875475     1  0.0510     0.9065 0.984 0.016 0.000 0.000 0.000
#> GSM875476     1  0.0609     0.9058 0.980 0.020 0.000 0.000 0.000
#> GSM875477     1  0.0609     0.9058 0.980 0.020 0.000 0.000 0.000
#> GSM875414     5  0.3395     0.6960 0.000 0.236 0.000 0.000 0.764
#> GSM875427     3  0.1908     0.8414 0.000 0.092 0.908 0.000 0.000
#> GSM875431     5  0.6385     0.6374 0.000 0.296 0.200 0.000 0.504
#> GSM875433     5  0.1908     0.4049 0.000 0.092 0.000 0.000 0.908
#> GSM875443     3  0.0000     0.8725 0.000 0.000 1.000 0.000 0.000
#> GSM875444     3  0.0000     0.8725 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.4401     0.7473 0.000 0.132 0.764 0.000 0.104
#> GSM875449     3  0.2770     0.7968 0.000 0.044 0.880 0.000 0.076
#> GSM875450     3  0.0000     0.8725 0.000 0.000 1.000 0.000 0.000
#> GSM875452     3  0.1908     0.8414 0.000 0.092 0.908 0.000 0.000
#> GSM875454     5  0.6248     0.6165 0.000 0.384 0.148 0.000 0.468
#> GSM875457     3  0.3780     0.7150 0.000 0.072 0.812 0.000 0.116
#> GSM875458     3  0.0000     0.8725 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.1851     0.8433 0.000 0.088 0.912 0.000 0.000
#> GSM875468     3  0.0000     0.8725 0.000 0.000 1.000 0.000 0.000
#> GSM875412     5  0.0671     0.5056 0.000 0.016 0.000 0.004 0.980
#> GSM875419     5  0.4245     0.7062 0.000 0.236 0.020 0.008 0.736
#> GSM875420     4  0.0510     0.9147 0.000 0.000 0.000 0.984 0.016
#> GSM875421     5  0.4863     0.7082 0.000 0.296 0.048 0.000 0.656
#> GSM875422     5  0.5682     0.6731 0.000 0.372 0.088 0.000 0.540
#> GSM875426     5  0.1965     0.3974 0.000 0.096 0.000 0.000 0.904
#> GSM875428     5  0.4492     0.7086 0.000 0.296 0.020 0.004 0.680
#> GSM875429     2  0.6491     1.0000 0.000 0.464 0.000 0.200 0.336
#> GSM875434     1  0.6589    -0.1617 0.424 0.212 0.000 0.000 0.364
#> GSM875438     5  0.3455     0.0627 0.000 0.208 0.000 0.008 0.784
#> GSM875439     2  0.6491     1.0000 0.000 0.464 0.000 0.200 0.336
#> GSM875440     5  0.1965     0.3974 0.000 0.096 0.000 0.000 0.904
#> GSM875441     4  0.2017     0.8219 0.000 0.008 0.000 0.912 0.080
#> GSM875442     2  0.6491     1.0000 0.000 0.464 0.000 0.200 0.336
#> GSM875446     2  0.6491     1.0000 0.000 0.464 0.000 0.200 0.336
#> GSM875448     4  0.1608     0.8788 0.000 0.000 0.000 0.928 0.072
#> GSM875453     4  0.0000     0.9154 0.000 0.000 0.000 1.000 0.000
#> GSM875455     2  0.6491     1.0000 0.000 0.464 0.000 0.200 0.336
#> GSM875459     2  0.6491     1.0000 0.000 0.464 0.000 0.200 0.336
#> GSM875460     5  0.4492     0.7086 0.000 0.296 0.020 0.004 0.680
#> GSM875463     4  0.2773     0.7756 0.000 0.000 0.000 0.836 0.164
#> GSM875464     4  0.0000     0.9154 0.000 0.000 0.000 1.000 0.000
#> GSM875466     5  0.6471     0.6238 0.000 0.296 0.216 0.000 0.488
#> GSM875473     5  0.6514     0.6142 0.000 0.304 0.220 0.000 0.476
#> GSM875474     2  0.6491     1.0000 0.000 0.464 0.000 0.200 0.336
#> GSM875478     2  0.6491     1.0000 0.000 0.464 0.000 0.200 0.336
#> GSM875479     4  0.0000     0.9154 0.000 0.000 0.000 1.000 0.000
#> GSM875480     5  0.6547     0.6069 0.000 0.296 0.232 0.000 0.472
#> GSM875481     5  0.1478     0.4487 0.000 0.064 0.000 0.000 0.936

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     6  0.2474      0.934 0.080 0.000 0.000 0.040 0.000 0.880
#> GSM875415     1  0.1444      0.838 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM875416     1  0.0260      0.854 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875417     3  0.0000      0.900 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875418     1  0.1444      0.838 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM875423     1  0.1483      0.840 0.944 0.000 0.012 0.008 0.000 0.036
#> GSM875424     1  0.1036      0.848 0.964 0.000 0.004 0.008 0.000 0.024
#> GSM875425     1  0.1194      0.845 0.956 0.000 0.004 0.008 0.000 0.032
#> GSM875430     1  0.0547      0.854 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM875432     1  0.3288      0.648 0.724 0.000 0.000 0.000 0.000 0.276
#> GSM875435     1  0.1387      0.840 0.932 0.000 0.000 0.000 0.000 0.068
#> GSM875436     2  0.5764     -0.130 0.216 0.504 0.000 0.000 0.000 0.280
#> GSM875437     1  0.3076      0.691 0.760 0.000 0.000 0.000 0.000 0.240
#> GSM875447     1  0.1444      0.838 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM875451     1  0.0000      0.853 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.1444      0.838 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM875461     1  0.1910      0.809 0.892 0.000 0.000 0.000 0.000 0.108
#> GSM875462     1  0.3288      0.648 0.724 0.000 0.000 0.000 0.000 0.276
#> GSM875465     1  0.1503      0.843 0.944 0.000 0.016 0.008 0.000 0.032
#> GSM875469     1  0.1477      0.839 0.940 0.000 0.004 0.008 0.000 0.048
#> GSM875470     3  0.4306      0.309 0.344 0.000 0.624 0.000 0.000 0.032
#> GSM875471     3  0.2066      0.821 0.072 0.000 0.904 0.000 0.000 0.024
#> GSM875472     6  0.2003      0.935 0.116 0.000 0.000 0.000 0.000 0.884
#> GSM875475     1  0.2340      0.818 0.852 0.000 0.000 0.000 0.000 0.148
#> GSM875476     1  0.3650      0.625 0.708 0.012 0.000 0.000 0.000 0.280
#> GSM875477     1  0.3309      0.642 0.720 0.000 0.000 0.000 0.000 0.280
#> GSM875414     5  0.0458      0.857 0.000 0.016 0.000 0.000 0.984 0.000
#> GSM875427     3  0.2553      0.827 0.000 0.000 0.848 0.144 0.000 0.008
#> GSM875431     5  0.2697      0.776 0.000 0.000 0.188 0.000 0.812 0.000
#> GSM875433     5  0.1387      0.848 0.000 0.068 0.000 0.000 0.932 0.000
#> GSM875443     3  0.0405      0.898 0.000 0.000 0.988 0.008 0.000 0.004
#> GSM875444     3  0.0000      0.900 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875445     3  0.2501      0.852 0.000 0.000 0.872 0.108 0.016 0.004
#> GSM875449     3  0.0547      0.893 0.000 0.000 0.980 0.000 0.020 0.000
#> GSM875450     3  0.0000      0.900 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.2553      0.827 0.000 0.000 0.848 0.144 0.000 0.008
#> GSM875454     5  0.3508      0.774 0.000 0.000 0.068 0.132 0.800 0.000
#> GSM875457     3  0.0547      0.891 0.000 0.000 0.980 0.000 0.020 0.000
#> GSM875458     3  0.0000      0.900 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875467     3  0.2212      0.851 0.000 0.000 0.880 0.112 0.000 0.008
#> GSM875468     3  0.0000      0.900 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     5  0.1333      0.853 0.000 0.048 0.000 0.008 0.944 0.000
#> GSM875419     5  0.0717      0.857 0.000 0.016 0.000 0.008 0.976 0.000
#> GSM875420     4  0.2838      0.933 0.000 0.188 0.000 0.808 0.004 0.000
#> GSM875421     5  0.0363      0.854 0.000 0.000 0.012 0.000 0.988 0.000
#> GSM875422     5  0.2887      0.799 0.000 0.000 0.036 0.120 0.844 0.000
#> GSM875426     5  0.1387      0.848 0.000 0.068 0.000 0.000 0.932 0.000
#> GSM875428     5  0.0000      0.855 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM875429     2  0.0260      0.904 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM875434     5  0.5967      0.220 0.156 0.012 0.000 0.008 0.544 0.280
#> GSM875438     5  0.2915      0.745 0.000 0.184 0.000 0.008 0.808 0.000
#> GSM875439     2  0.0363      0.905 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM875440     5  0.1501      0.844 0.000 0.076 0.000 0.000 0.924 0.000
#> GSM875441     4  0.2941      0.920 0.000 0.220 0.000 0.780 0.000 0.000
#> GSM875442     2  0.0260      0.896 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM875446     2  0.0363      0.905 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM875448     4  0.3307      0.906 0.000 0.148 0.000 0.808 0.044 0.000
#> GSM875453     4  0.2793      0.933 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM875455     2  0.0777      0.880 0.000 0.972 0.000 0.024 0.000 0.004
#> GSM875459     2  0.0363      0.905 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM875460     5  0.0260      0.855 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM875463     4  0.3332      0.763 0.000 0.048 0.000 0.808 0.144 0.000
#> GSM875464     4  0.2793      0.933 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM875466     5  0.2793      0.769 0.000 0.000 0.200 0.000 0.800 0.000
#> GSM875473     5  0.3221      0.764 0.000 0.000 0.188 0.000 0.792 0.020
#> GSM875474     2  0.0260      0.904 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM875478     2  0.0363      0.905 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM875479     4  0.2703      0.921 0.000 0.172 0.000 0.824 0.000 0.004
#> GSM875480     5  0.2823      0.764 0.000 0.000 0.204 0.000 0.796 0.000
#> GSM875481     5  0.1327      0.850 0.000 0.064 0.000 0.000 0.936 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) k
#> CV:mclust 49         1.67e-09 2
#> CV:mclust 68         7.71e-21 3
#> CV:mclust 64         9.28e-17 4
#> CV:mclust 62         1.83e-18 5
#> CV:mclust 67         3.88e-17 6

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


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

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.939           0.926       0.971         0.5026 0.496   0.496
#> 3 3 0.999           0.937       0.976         0.3421 0.740   0.520
#> 4 4 0.770           0.816       0.898         0.1033 0.916   0.748
#> 5 5 0.763           0.730       0.862         0.0524 0.937   0.769
#> 6 6 0.766           0.675       0.835         0.0406 0.919   0.673

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
#> GSM875413     1  0.0000      0.964 1.000 0.000
#> GSM875415     1  0.0000      0.964 1.000 0.000
#> GSM875416     1  0.0000      0.964 1.000 0.000
#> GSM875417     1  0.0000      0.964 1.000 0.000
#> GSM875418     1  0.0000      0.964 1.000 0.000
#> GSM875423     1  0.0000      0.964 1.000 0.000
#> GSM875424     1  0.0000      0.964 1.000 0.000
#> GSM875425     1  0.0000      0.964 1.000 0.000
#> GSM875430     1  0.0000      0.964 1.000 0.000
#> GSM875432     1  0.0000      0.964 1.000 0.000
#> GSM875435     1  0.0000      0.964 1.000 0.000
#> GSM875436     2  0.9522      0.404 0.372 0.628
#> GSM875437     1  0.0000      0.964 1.000 0.000
#> GSM875447     1  0.0000      0.964 1.000 0.000
#> GSM875451     1  0.0000      0.964 1.000 0.000
#> GSM875456     1  0.0000      0.964 1.000 0.000
#> GSM875461     1  0.0000      0.964 1.000 0.000
#> GSM875462     1  0.0000      0.964 1.000 0.000
#> GSM875465     1  0.0000      0.964 1.000 0.000
#> GSM875469     1  0.0000      0.964 1.000 0.000
#> GSM875470     1  0.0000      0.964 1.000 0.000
#> GSM875471     1  0.0000      0.964 1.000 0.000
#> GSM875472     1  0.0000      0.964 1.000 0.000
#> GSM875475     1  0.0000      0.964 1.000 0.000
#> GSM875476     1  0.0376      0.961 0.996 0.004
#> GSM875477     1  0.0000      0.964 1.000 0.000
#> GSM875414     2  0.0000      0.972 0.000 1.000
#> GSM875427     2  0.0000      0.972 0.000 1.000
#> GSM875431     2  0.0672      0.967 0.008 0.992
#> GSM875433     2  0.0000      0.972 0.000 1.000
#> GSM875443     1  0.0376      0.961 0.996 0.004
#> GSM875444     1  0.2423      0.929 0.960 0.040
#> GSM875445     2  0.0000      0.972 0.000 1.000
#> GSM875449     2  0.0376      0.970 0.004 0.996
#> GSM875450     1  0.0672      0.958 0.992 0.008
#> GSM875452     2  0.3584      0.913 0.068 0.932
#> GSM875454     2  0.0000      0.972 0.000 1.000
#> GSM875457     2  0.4298      0.892 0.088 0.912
#> GSM875458     1  0.5178      0.847 0.884 0.116
#> GSM875467     2  0.8763      0.575 0.296 0.704
#> GSM875468     1  0.0000      0.964 1.000 0.000
#> GSM875412     2  0.0000      0.972 0.000 1.000
#> GSM875419     2  0.0000      0.972 0.000 1.000
#> GSM875420     2  0.0000      0.972 0.000 1.000
#> GSM875421     2  0.0000      0.972 0.000 1.000
#> GSM875422     2  0.0000      0.972 0.000 1.000
#> GSM875426     2  0.0000      0.972 0.000 1.000
#> GSM875428     2  0.0000      0.972 0.000 1.000
#> GSM875429     2  0.0000      0.972 0.000 1.000
#> GSM875434     1  0.9850      0.233 0.572 0.428
#> GSM875438     2  0.0000      0.972 0.000 1.000
#> GSM875439     2  0.0000      0.972 0.000 1.000
#> GSM875440     2  0.0000      0.972 0.000 1.000
#> GSM875441     2  0.0000      0.972 0.000 1.000
#> GSM875442     2  0.0000      0.972 0.000 1.000
#> GSM875446     2  0.0000      0.972 0.000 1.000
#> GSM875448     2  0.0000      0.972 0.000 1.000
#> GSM875453     2  0.0000      0.972 0.000 1.000
#> GSM875455     2  0.5629      0.838 0.132 0.868
#> GSM875459     2  0.0000      0.972 0.000 1.000
#> GSM875460     2  0.0000      0.972 0.000 1.000
#> GSM875463     2  0.0000      0.972 0.000 1.000
#> GSM875464     2  0.0000      0.972 0.000 1.000
#> GSM875466     2  0.0376      0.970 0.004 0.996
#> GSM875473     1  0.9963      0.123 0.536 0.464
#> GSM875474     2  0.0000      0.972 0.000 1.000
#> GSM875478     2  0.0000      0.972 0.000 1.000
#> GSM875479     2  0.0000      0.972 0.000 1.000
#> GSM875480     2  0.0000      0.972 0.000 1.000
#> GSM875481     2  0.0000      0.972 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
#> GSM875413     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875415     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875416     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875417     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875418     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875423     1  0.1163    0.95080 0.972 0.000 0.028
#> GSM875424     1  0.1031    0.95410 0.976 0.000 0.024
#> GSM875425     1  0.1643    0.93540 0.956 0.000 0.044
#> GSM875430     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875432     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875435     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875436     2  0.4504    0.73685 0.196 0.804 0.000
#> GSM875437     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875447     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875451     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875456     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875461     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875462     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875465     1  0.0592    0.96336 0.988 0.000 0.012
#> GSM875469     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875470     3  0.2537    0.91192 0.080 0.000 0.920
#> GSM875471     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875472     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875475     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875476     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875477     1  0.0000    0.97149 1.000 0.000 0.000
#> GSM875414     2  0.0237    0.95474 0.000 0.996 0.004
#> GSM875427     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875431     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875433     2  0.6244    0.22740 0.000 0.560 0.440
#> GSM875443     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875444     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875445     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875449     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875450     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875452     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875454     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875457     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875458     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875467     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875468     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875412     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875419     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875420     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875421     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875422     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875426     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875428     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875429     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875434     1  0.6307    0.00551 0.512 0.488 0.000
#> GSM875438     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875439     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875440     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875441     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875442     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875446     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875448     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875453     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875455     2  0.1753    0.91546 0.048 0.952 0.000
#> GSM875459     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875460     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875463     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875464     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875466     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875473     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875474     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875478     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875479     2  0.0000    0.95775 0.000 1.000 0.000
#> GSM875480     3  0.0000    0.99592 0.000 0.000 1.000
#> GSM875481     2  0.5835    0.50382 0.000 0.660 0.340

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875415     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875417     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875418     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875423     1  0.3569     0.7529 0.804 0.000 0.196 0.000
#> GSM875424     1  0.2589     0.8348 0.884 0.000 0.116 0.000
#> GSM875425     1  0.1867     0.8667 0.928 0.000 0.072 0.000
#> GSM875430     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875436     1  0.3166     0.8131 0.868 0.116 0.000 0.016
#> GSM875437     1  0.0188     0.9049 0.996 0.000 0.000 0.004
#> GSM875447     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875462     1  0.3105     0.8236 0.856 0.004 0.000 0.140
#> GSM875465     1  0.2589     0.8342 0.884 0.000 0.116 0.000
#> GSM875469     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875470     3  0.5144     0.6858 0.216 0.000 0.732 0.052
#> GSM875471     3  0.0188     0.9348 0.004 0.000 0.996 0.000
#> GSM875472     1  0.5119     0.2251 0.556 0.004 0.000 0.440
#> GSM875475     1  0.0000     0.9063 1.000 0.000 0.000 0.000
#> GSM875476     1  0.4830     0.3640 0.608 0.392 0.000 0.000
#> GSM875477     1  0.0336     0.9028 0.992 0.000 0.000 0.008
#> GSM875414     2  0.5590    -0.0675 0.000 0.524 0.020 0.456
#> GSM875427     3  0.3123     0.8357 0.000 0.000 0.844 0.156
#> GSM875431     3  0.1635     0.9186 0.000 0.008 0.948 0.044
#> GSM875433     2  0.3895     0.7078 0.000 0.804 0.012 0.184
#> GSM875443     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0188     0.9355 0.000 0.000 0.996 0.004
#> GSM875449     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875452     3  0.1211     0.9204 0.000 0.000 0.960 0.040
#> GSM875454     3  0.1474     0.9167 0.000 0.000 0.948 0.052
#> GSM875457     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000     0.9361 0.000 0.000 1.000 0.000
#> GSM875412     4  0.2149     0.7361 0.000 0.088 0.000 0.912
#> GSM875419     4  0.2921     0.8774 0.000 0.140 0.000 0.860
#> GSM875420     4  0.1389     0.7814 0.000 0.048 0.000 0.952
#> GSM875421     3  0.0592     0.9322 0.000 0.000 0.984 0.016
#> GSM875422     3  0.3942     0.7686 0.000 0.000 0.764 0.236
#> GSM875426     2  0.1022     0.8485 0.000 0.968 0.000 0.032
#> GSM875428     4  0.3356     0.8781 0.000 0.176 0.000 0.824
#> GSM875429     2  0.0592     0.8570 0.000 0.984 0.000 0.016
#> GSM875434     1  0.4907     0.3103 0.580 0.000 0.000 0.420
#> GSM875438     4  0.4643     0.2499 0.000 0.344 0.000 0.656
#> GSM875439     2  0.0469     0.8557 0.000 0.988 0.000 0.012
#> GSM875440     2  0.4585     0.3604 0.000 0.668 0.000 0.332
#> GSM875441     4  0.3649     0.8791 0.000 0.204 0.000 0.796
#> GSM875442     2  0.1211     0.8502 0.000 0.960 0.000 0.040
#> GSM875446     2  0.0817     0.8521 0.000 0.976 0.000 0.024
#> GSM875448     4  0.3311     0.8879 0.000 0.172 0.000 0.828
#> GSM875453     4  0.3356     0.8876 0.000 0.176 0.000 0.824
#> GSM875455     2  0.1042     0.8522 0.008 0.972 0.000 0.020
#> GSM875459     2  0.0469     0.8578 0.000 0.988 0.000 0.012
#> GSM875460     4  0.3400     0.8885 0.000 0.180 0.000 0.820
#> GSM875463     4  0.3311     0.8879 0.000 0.172 0.000 0.828
#> GSM875464     4  0.3569     0.8837 0.000 0.196 0.000 0.804
#> GSM875466     3  0.0927     0.9296 0.000 0.008 0.976 0.016
#> GSM875473     3  0.4500     0.5519 0.000 0.000 0.684 0.316
#> GSM875474     2  0.0469     0.8578 0.000 0.988 0.000 0.012
#> GSM875478     2  0.0817     0.8535 0.000 0.976 0.000 0.024
#> GSM875479     4  0.3801     0.8647 0.000 0.220 0.000 0.780
#> GSM875480     3  0.2589     0.8554 0.000 0.000 0.884 0.116
#> GSM875481     2  0.3311     0.6808 0.000 0.828 0.172 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.0324    0.89816 0.992 0.000 0.000 0.004 0.004
#> GSM875415     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875417     3  0.0000    0.84738 0.000 0.000 1.000 0.000 0.000
#> GSM875418     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.4375    0.46961 0.628 0.000 0.364 0.004 0.004
#> GSM875424     1  0.2329    0.81100 0.876 0.000 0.124 0.000 0.000
#> GSM875425     1  0.3266    0.71495 0.796 0.000 0.200 0.000 0.004
#> GSM875430     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875435     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875436     5  0.5552    0.08368 0.472 0.036 0.000 0.016 0.476
#> GSM875437     1  0.0162    0.89946 0.996 0.000 0.000 0.000 0.004
#> GSM875447     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875462     1  0.3914    0.70380 0.760 0.004 0.000 0.016 0.220
#> GSM875465     1  0.3855    0.66443 0.748 0.000 0.240 0.008 0.004
#> GSM875469     1  0.0324    0.89816 0.992 0.000 0.000 0.004 0.004
#> GSM875470     3  0.5282    0.54249 0.220 0.004 0.676 0.000 0.100
#> GSM875471     3  0.0703    0.84247 0.000 0.000 0.976 0.000 0.024
#> GSM875472     4  0.2629    0.77966 0.136 0.000 0.000 0.860 0.004
#> GSM875475     1  0.0000    0.90107 1.000 0.000 0.000 0.000 0.000
#> GSM875476     1  0.2462    0.81628 0.880 0.112 0.000 0.000 0.008
#> GSM875477     1  0.1124    0.88044 0.960 0.000 0.000 0.036 0.004
#> GSM875414     5  0.4658    0.60768 0.000 0.124 0.004 0.120 0.752
#> GSM875427     3  0.4264    0.51506 0.000 0.000 0.620 0.004 0.376
#> GSM875431     3  0.4702    0.13927 0.000 0.004 0.512 0.008 0.476
#> GSM875433     5  0.2068    0.61318 0.004 0.092 0.000 0.000 0.904
#> GSM875443     3  0.0000    0.84738 0.000 0.000 1.000 0.000 0.000
#> GSM875444     3  0.0000    0.84738 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.0880    0.83939 0.000 0.000 0.968 0.000 0.032
#> GSM875449     3  0.0000    0.84738 0.000 0.000 1.000 0.000 0.000
#> GSM875450     3  0.0000    0.84738 0.000 0.000 1.000 0.000 0.000
#> GSM875452     3  0.2377    0.78306 0.000 0.000 0.872 0.000 0.128
#> GSM875454     3  0.3354    0.76270 0.000 0.000 0.844 0.068 0.088
#> GSM875457     3  0.0000    0.84738 0.000 0.000 1.000 0.000 0.000
#> GSM875458     3  0.0000    0.84738 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0290    0.84601 0.000 0.000 0.992 0.000 0.008
#> GSM875468     3  0.0000    0.84738 0.000 0.000 1.000 0.000 0.000
#> GSM875412     5  0.2260    0.64029 0.000 0.028 0.000 0.064 0.908
#> GSM875419     4  0.1965    0.85489 0.000 0.000 0.000 0.904 0.096
#> GSM875420     4  0.3932    0.82626 0.000 0.064 0.000 0.796 0.140
#> GSM875421     3  0.2086    0.81325 0.000 0.008 0.924 0.048 0.020
#> GSM875422     3  0.5507    0.21954 0.000 0.000 0.480 0.064 0.456
#> GSM875426     2  0.5768    0.07140 0.000 0.484 0.000 0.088 0.428
#> GSM875428     5  0.5569    0.50432 0.000 0.076 0.004 0.332 0.588
#> GSM875429     2  0.1082    0.81325 0.000 0.964 0.000 0.028 0.008
#> GSM875434     1  0.5447    0.27027 0.572 0.000 0.000 0.072 0.356
#> GSM875438     5  0.1281    0.61789 0.000 0.012 0.000 0.032 0.956
#> GSM875439     2  0.1216    0.80527 0.000 0.960 0.000 0.020 0.020
#> GSM875440     5  0.5460    0.56413 0.000 0.148 0.000 0.196 0.656
#> GSM875441     4  0.2189    0.89074 0.000 0.084 0.000 0.904 0.012
#> GSM875442     2  0.5516    0.50997 0.000 0.640 0.000 0.128 0.232
#> GSM875446     2  0.4354    0.57110 0.000 0.712 0.000 0.032 0.256
#> GSM875448     4  0.0693    0.90186 0.000 0.008 0.000 0.980 0.012
#> GSM875453     4  0.0566    0.90252 0.000 0.004 0.000 0.984 0.012
#> GSM875455     2  0.1764    0.79226 0.008 0.928 0.000 0.064 0.000
#> GSM875459     2  0.0794    0.81213 0.000 0.972 0.000 0.028 0.000
#> GSM875460     4  0.1310    0.90631 0.000 0.024 0.000 0.956 0.020
#> GSM875463     4  0.0798    0.90134 0.000 0.008 0.000 0.976 0.016
#> GSM875464     4  0.1671    0.89414 0.000 0.076 0.000 0.924 0.000
#> GSM875466     5  0.4562    0.16865 0.000 0.004 0.444 0.004 0.548
#> GSM875473     3  0.4450    0.00773 0.000 0.000 0.508 0.488 0.004
#> GSM875474     2  0.0451    0.81181 0.000 0.988 0.000 0.008 0.004
#> GSM875478     2  0.1671    0.79017 0.000 0.924 0.000 0.076 0.000
#> GSM875479     4  0.2230    0.87022 0.000 0.116 0.000 0.884 0.000
#> GSM875480     3  0.0703    0.83957 0.000 0.000 0.976 0.024 0.000
#> GSM875481     2  0.2270    0.75986 0.000 0.904 0.076 0.000 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
#> GSM875413     1  0.0767    0.91097 0.976 0.000 0.000 0.008 0.004 0.012
#> GSM875415     1  0.0146    0.91535 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM875416     1  0.1297    0.90584 0.948 0.012 0.000 0.000 0.000 0.040
#> GSM875417     3  0.0291    0.77000 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM875418     1  0.0632    0.91544 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM875423     3  0.3808    0.47527 0.284 0.000 0.700 0.000 0.004 0.012
#> GSM875424     1  0.2730    0.71383 0.808 0.000 0.192 0.000 0.000 0.000
#> GSM875425     1  0.3980    0.74652 0.788 0.012 0.120 0.000 0.004 0.076
#> GSM875430     1  0.0436    0.91431 0.988 0.000 0.000 0.004 0.004 0.004
#> GSM875432     1  0.0653    0.91604 0.980 0.000 0.000 0.004 0.004 0.012
#> GSM875435     1  0.0260    0.91647 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875436     5  0.4317    0.27842 0.380 0.008 0.000 0.004 0.600 0.008
#> GSM875437     1  0.2006    0.86232 0.892 0.000 0.000 0.000 0.004 0.104
#> GSM875447     1  0.0363    0.91633 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM875451     1  0.0291    0.91498 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM875456     1  0.0820    0.91387 0.972 0.012 0.000 0.000 0.000 0.016
#> GSM875461     1  0.0806    0.91465 0.972 0.008 0.000 0.000 0.000 0.020
#> GSM875462     6  0.3791    0.58720 0.168 0.016 0.000 0.036 0.000 0.780
#> GSM875465     3  0.4443    0.05026 0.480 0.004 0.500 0.012 0.000 0.004
#> GSM875469     1  0.0291    0.91498 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM875470     6  0.4802    0.53883 0.048 0.012 0.260 0.004 0.004 0.672
#> GSM875471     3  0.4408    0.35550 0.012 0.012 0.624 0.000 0.004 0.348
#> GSM875472     4  0.2431    0.73494 0.132 0.000 0.000 0.860 0.000 0.008
#> GSM875475     1  0.1036    0.91288 0.964 0.008 0.000 0.000 0.004 0.024
#> GSM875476     1  0.2568    0.84958 0.876 0.096 0.000 0.000 0.012 0.016
#> GSM875477     1  0.1225    0.89823 0.952 0.000 0.000 0.036 0.000 0.012
#> GSM875414     5  0.1065    0.60301 0.000 0.008 0.000 0.008 0.964 0.020
#> GSM875427     6  0.2968    0.67288 0.000 0.000 0.168 0.016 0.000 0.816
#> GSM875431     3  0.6156   -0.03805 0.004 0.000 0.420 0.000 0.300 0.276
#> GSM875433     6  0.4444    0.52482 0.004 0.072 0.000 0.000 0.224 0.700
#> GSM875443     3  0.0865    0.76232 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM875444     3  0.0000    0.77117 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875445     3  0.1610    0.73692 0.000 0.000 0.916 0.000 0.000 0.084
#> GSM875449     3  0.0000    0.77117 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875450     3  0.0000    0.77117 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.3713    0.50004 0.000 0.008 0.704 0.000 0.004 0.284
#> GSM875454     3  0.6637   -0.02581 0.000 0.000 0.460 0.056 0.180 0.304
#> GSM875457     3  0.0000    0.77117 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875458     3  0.0000    0.77117 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875467     3  0.0972    0.76208 0.000 0.008 0.964 0.000 0.000 0.028
#> GSM875468     3  0.0000    0.77117 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     5  0.3863    0.46399 0.000 0.016 0.000 0.016 0.740 0.228
#> GSM875419     4  0.4174    0.72800 0.000 0.000 0.000 0.736 0.092 0.172
#> GSM875420     4  0.4293    0.71551 0.000 0.036 0.000 0.728 0.024 0.212
#> GSM875421     3  0.3328    0.62319 0.000 0.000 0.788 0.012 0.192 0.008
#> GSM875422     6  0.5025    0.57051 0.000 0.000 0.080 0.044 0.180 0.696
#> GSM875426     5  0.5062    0.29288 0.000 0.340 0.000 0.032 0.592 0.036
#> GSM875428     5  0.2949    0.56716 0.000 0.000 0.000 0.140 0.832 0.028
#> GSM875429     2  0.0777    0.84873 0.000 0.972 0.000 0.000 0.024 0.004
#> GSM875434     1  0.4700   -0.00473 0.492 0.000 0.000 0.008 0.028 0.472
#> GSM875438     6  0.1984    0.65640 0.000 0.000 0.000 0.032 0.056 0.912
#> GSM875439     2  0.2311    0.80427 0.000 0.880 0.000 0.000 0.104 0.016
#> GSM875440     5  0.1477    0.60322 0.000 0.004 0.000 0.048 0.940 0.008
#> GSM875441     4  0.3321    0.79093 0.000 0.080 0.000 0.820 0.100 0.000
#> GSM875442     5  0.4769    0.23335 0.000 0.364 0.000 0.060 0.576 0.000
#> GSM875446     2  0.4653    0.36391 0.000 0.588 0.000 0.000 0.360 0.052
#> GSM875448     4  0.3136    0.73240 0.000 0.000 0.000 0.768 0.228 0.004
#> GSM875453     4  0.2838    0.76691 0.000 0.000 0.000 0.808 0.188 0.004
#> GSM875455     2  0.1610    0.83296 0.000 0.916 0.000 0.084 0.000 0.000
#> GSM875459     2  0.1116    0.85101 0.000 0.960 0.000 0.028 0.004 0.008
#> GSM875460     4  0.2164    0.82039 0.000 0.016 0.000 0.912 0.028 0.044
#> GSM875463     4  0.2219    0.79267 0.000 0.000 0.000 0.864 0.136 0.000
#> GSM875464     4  0.2282    0.80211 0.000 0.088 0.000 0.888 0.000 0.024
#> GSM875466     5  0.4480    0.18932 0.004 0.004 0.392 0.008 0.584 0.008
#> GSM875473     3  0.3742    0.42495 0.000 0.000 0.648 0.348 0.000 0.004
#> GSM875474     2  0.0146    0.84974 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM875478     2  0.1663    0.83110 0.000 0.912 0.000 0.088 0.000 0.000
#> GSM875479     4  0.2165    0.79117 0.000 0.108 0.000 0.884 0.000 0.008
#> GSM875480     3  0.0692    0.76422 0.000 0.000 0.976 0.020 0.004 0.000
#> GSM875481     2  0.4129    0.70153 0.000 0.772 0.092 0.000 0.016 0.120

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) k
#> CV:NMF 67         2.39e-12 2
#> CV:NMF 68         2.11e-17 3
#> CV:NMF 64         9.73e-16 4
#> CV:NMF 62         9.95e-15 5
#> CV:NMF 57         4.68e-12 6

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


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

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.649           0.911       0.932         0.4542 0.543   0.543
#> 3 3 0.690           0.836       0.915         0.4621 0.783   0.600
#> 4 4 0.683           0.747       0.869         0.0531 0.990   0.971
#> 5 5 0.645           0.565       0.774         0.0409 0.947   0.836
#> 6 6 0.694           0.635       0.745         0.0513 0.949   0.835

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM875413     1  0.0000      0.969 1.000 0.000
#> GSM875415     1  0.0000      0.969 1.000 0.000
#> GSM875416     1  0.0000      0.969 1.000 0.000
#> GSM875417     2  0.7219      0.860 0.200 0.800
#> GSM875418     1  0.0000      0.969 1.000 0.000
#> GSM875423     1  0.0938      0.961 0.988 0.012
#> GSM875424     1  0.1184      0.958 0.984 0.016
#> GSM875425     1  0.0000      0.969 1.000 0.000
#> GSM875430     1  0.0000      0.969 1.000 0.000
#> GSM875432     1  0.0000      0.969 1.000 0.000
#> GSM875435     1  0.0000      0.969 1.000 0.000
#> GSM875436     2  0.7674      0.822 0.224 0.776
#> GSM875437     1  0.0000      0.969 1.000 0.000
#> GSM875447     1  0.0000      0.969 1.000 0.000
#> GSM875451     1  0.0000      0.969 1.000 0.000
#> GSM875456     1  0.0000      0.969 1.000 0.000
#> GSM875461     1  0.0000      0.969 1.000 0.000
#> GSM875462     1  0.0376      0.966 0.996 0.004
#> GSM875465     1  0.4022      0.897 0.920 0.080
#> GSM875469     1  0.0000      0.969 1.000 0.000
#> GSM875470     1  0.3733      0.905 0.928 0.072
#> GSM875471     1  0.3733      0.905 0.928 0.072
#> GSM875472     1  0.0000      0.969 1.000 0.000
#> GSM875475     1  0.0000      0.969 1.000 0.000
#> GSM875476     2  0.7674      0.822 0.224 0.776
#> GSM875477     1  0.0000      0.969 1.000 0.000
#> GSM875414     2  0.3114      0.924 0.056 0.944
#> GSM875427     2  0.4690      0.921 0.100 0.900
#> GSM875431     2  0.4562      0.922 0.096 0.904
#> GSM875433     2  0.4298      0.924 0.088 0.912
#> GSM875443     1  0.9491      0.313 0.632 0.368
#> GSM875444     2  0.7219      0.860 0.200 0.800
#> GSM875445     2  0.4562      0.922 0.096 0.904
#> GSM875449     2  0.6887      0.874 0.184 0.816
#> GSM875450     2  0.7219      0.860 0.200 0.800
#> GSM875452     2  0.4690      0.921 0.100 0.900
#> GSM875454     2  0.4562      0.922 0.096 0.904
#> GSM875457     2  0.6887      0.874 0.184 0.816
#> GSM875458     2  0.6887      0.874 0.184 0.816
#> GSM875467     2  0.6343      0.891 0.160 0.840
#> GSM875468     2  0.6887      0.874 0.184 0.816
#> GSM875412     2  0.2778      0.924 0.048 0.952
#> GSM875419     2  0.5294      0.911 0.120 0.880
#> GSM875420     2  0.0672      0.914 0.008 0.992
#> GSM875421     2  0.3879      0.925 0.076 0.924
#> GSM875422     2  0.3879      0.925 0.076 0.924
#> GSM875426     2  0.3114      0.924 0.056 0.944
#> GSM875428     2  0.3114      0.924 0.056 0.944
#> GSM875429     2  0.0000      0.910 0.000 1.000
#> GSM875434     2  0.7299      0.846 0.204 0.796
#> GSM875438     2  0.0672      0.914 0.008 0.992
#> GSM875439     2  0.0000      0.910 0.000 1.000
#> GSM875440     2  0.3114      0.924 0.056 0.944
#> GSM875441     2  0.0672      0.913 0.008 0.992
#> GSM875442     2  0.5629      0.900 0.132 0.868
#> GSM875446     2  0.0000      0.910 0.000 1.000
#> GSM875448     2  0.0376      0.911 0.004 0.996
#> GSM875453     2  0.0376      0.911 0.004 0.996
#> GSM875455     2  0.0376      0.912 0.004 0.996
#> GSM875459     2  0.0000      0.910 0.000 1.000
#> GSM875460     2  0.6148      0.898 0.152 0.848
#> GSM875463     2  0.0672      0.911 0.008 0.992
#> GSM875464     2  0.0376      0.911 0.004 0.996
#> GSM875466     2  0.4431      0.924 0.092 0.908
#> GSM875473     2  0.8327      0.781 0.264 0.736
#> GSM875474     2  0.0376      0.912 0.004 0.996
#> GSM875478     2  0.0000      0.910 0.000 1.000
#> GSM875479     2  0.0376      0.911 0.004 0.996
#> GSM875480     2  0.4562      0.922 0.096 0.904
#> GSM875481     2  0.4431      0.923 0.092 0.908

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM875413     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875415     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875416     1  0.1031      0.943 0.976 0.000 0.024
#> GSM875417     3  0.3340      0.839 0.120 0.000 0.880
#> GSM875418     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875423     1  0.1289      0.938 0.968 0.000 0.032
#> GSM875424     1  0.1860      0.925 0.948 0.000 0.052
#> GSM875425     1  0.1163      0.941 0.972 0.000 0.028
#> GSM875430     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875436     2  0.5687      0.716 0.224 0.756 0.020
#> GSM875437     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875462     1  0.0237      0.951 0.996 0.000 0.004
#> GSM875465     1  0.3619      0.842 0.864 0.000 0.136
#> GSM875469     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875470     1  0.3482      0.851 0.872 0.000 0.128
#> GSM875471     1  0.3482      0.851 0.872 0.000 0.128
#> GSM875472     1  0.0237      0.950 0.996 0.004 0.000
#> GSM875475     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875476     2  0.5687      0.716 0.224 0.756 0.020
#> GSM875477     1  0.0000      0.953 1.000 0.000 0.000
#> GSM875414     3  0.3340      0.841 0.000 0.120 0.880
#> GSM875427     3  0.0000      0.875 0.000 0.000 1.000
#> GSM875431     3  0.1753      0.878 0.000 0.048 0.952
#> GSM875433     3  0.2448      0.866 0.000 0.076 0.924
#> GSM875443     1  0.6260      0.183 0.552 0.000 0.448
#> GSM875444     3  0.3340      0.839 0.120 0.000 0.880
#> GSM875445     3  0.0592      0.877 0.000 0.012 0.988
#> GSM875449     3  0.2625      0.861 0.084 0.000 0.916
#> GSM875450     3  0.3340      0.839 0.120 0.000 0.880
#> GSM875452     3  0.0000      0.875 0.000 0.000 1.000
#> GSM875454     3  0.1411      0.878 0.000 0.036 0.964
#> GSM875457     3  0.2625      0.861 0.084 0.000 0.916
#> GSM875458     3  0.2625      0.861 0.084 0.000 0.916
#> GSM875467     3  0.2066      0.868 0.060 0.000 0.940
#> GSM875468     3  0.2625      0.861 0.084 0.000 0.916
#> GSM875412     3  0.6460      0.221 0.004 0.440 0.556
#> GSM875419     2  0.7533      0.408 0.052 0.600 0.348
#> GSM875420     2  0.2066      0.859 0.000 0.940 0.060
#> GSM875421     3  0.1860      0.876 0.000 0.052 0.948
#> GSM875422     3  0.1860      0.876 0.000 0.052 0.948
#> GSM875426     3  0.3116      0.849 0.000 0.108 0.892
#> GSM875428     3  0.3192      0.847 0.000 0.112 0.888
#> GSM875429     2  0.0592      0.884 0.000 0.988 0.012
#> GSM875434     2  0.9122      0.409 0.184 0.536 0.280
#> GSM875438     2  0.2261      0.854 0.000 0.932 0.068
#> GSM875439     2  0.0237      0.884 0.000 0.996 0.004
#> GSM875440     3  0.5810      0.515 0.000 0.336 0.664
#> GSM875441     2  0.0424      0.884 0.000 0.992 0.008
#> GSM875442     2  0.5780      0.774 0.120 0.800 0.080
#> GSM875446     2  0.0237      0.884 0.000 0.996 0.004
#> GSM875448     2  0.0237      0.884 0.000 0.996 0.004
#> GSM875453     2  0.0237      0.884 0.000 0.996 0.004
#> GSM875455     2  0.0829      0.883 0.004 0.984 0.012
#> GSM875459     2  0.0592      0.884 0.000 0.988 0.012
#> GSM875460     2  0.7948      0.210 0.060 0.520 0.420
#> GSM875463     2  0.0983      0.880 0.004 0.980 0.016
#> GSM875464     2  0.0000      0.884 0.000 1.000 0.000
#> GSM875466     3  0.5115      0.695 0.004 0.228 0.768
#> GSM875473     3  0.4634      0.797 0.164 0.012 0.824
#> GSM875474     2  0.0829      0.883 0.004 0.984 0.012
#> GSM875478     2  0.0592      0.884 0.000 0.988 0.012
#> GSM875479     2  0.0000      0.884 0.000 1.000 0.000
#> GSM875480     3  0.1411      0.878 0.000 0.036 0.964
#> GSM875481     3  0.2356      0.868 0.000 0.072 0.928

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     4  0.4624     0.0000 0.340 0.000 0.000 0.660
#> GSM875415     1  0.0707     0.8496 0.980 0.000 0.000 0.020
#> GSM875416     1  0.1356     0.8367 0.960 0.000 0.008 0.032
#> GSM875417     3  0.4071     0.8027 0.104 0.000 0.832 0.064
#> GSM875418     1  0.0707     0.8496 0.980 0.000 0.000 0.020
#> GSM875423     1  0.1677     0.8335 0.948 0.000 0.012 0.040
#> GSM875424     1  0.2111     0.8162 0.932 0.000 0.024 0.044
#> GSM875425     1  0.1488     0.8341 0.956 0.000 0.012 0.032
#> GSM875430     1  0.0707     0.8496 0.980 0.000 0.000 0.020
#> GSM875432     1  0.2408     0.7787 0.896 0.000 0.000 0.104
#> GSM875435     1  0.0707     0.8496 0.980 0.000 0.000 0.020
#> GSM875436     2  0.6837     0.5280 0.112 0.576 0.004 0.308
#> GSM875437     1  0.1474     0.8266 0.948 0.000 0.000 0.052
#> GSM875447     1  0.0592     0.8497 0.984 0.000 0.000 0.016
#> GSM875451     1  0.0707     0.8496 0.980 0.000 0.000 0.020
#> GSM875456     1  0.0707     0.8496 0.980 0.000 0.000 0.020
#> GSM875461     1  0.0188     0.8499 0.996 0.000 0.000 0.004
#> GSM875462     1  0.1661     0.8267 0.944 0.000 0.004 0.052
#> GSM875465     1  0.3818     0.6919 0.844 0.000 0.108 0.048
#> GSM875469     1  0.0921     0.8477 0.972 0.000 0.000 0.028
#> GSM875470     1  0.3647     0.7024 0.852 0.000 0.108 0.040
#> GSM875471     1  0.3647     0.7024 0.852 0.000 0.108 0.040
#> GSM875472     1  0.3157     0.7073 0.852 0.004 0.000 0.144
#> GSM875475     1  0.1637     0.8252 0.940 0.000 0.000 0.060
#> GSM875476     2  0.6837     0.5280 0.112 0.576 0.004 0.308
#> GSM875477     1  0.3311     0.6747 0.828 0.000 0.000 0.172
#> GSM875414     3  0.3088     0.8366 0.000 0.052 0.888 0.060
#> GSM875427     3  0.0707     0.8614 0.000 0.000 0.980 0.020
#> GSM875431     3  0.1256     0.8636 0.000 0.028 0.964 0.008
#> GSM875433     3  0.2174     0.8559 0.000 0.020 0.928 0.052
#> GSM875443     1  0.6324     0.0524 0.536 0.000 0.400 0.064
#> GSM875444     3  0.4071     0.8027 0.104 0.000 0.832 0.064
#> GSM875445     3  0.1059     0.8643 0.000 0.012 0.972 0.016
#> GSM875449     3  0.3474     0.8288 0.068 0.000 0.868 0.064
#> GSM875450     3  0.4071     0.8027 0.104 0.000 0.832 0.064
#> GSM875452     3  0.0707     0.8614 0.000 0.000 0.980 0.020
#> GSM875454     3  0.0927     0.8640 0.000 0.016 0.976 0.008
#> GSM875457     3  0.3474     0.8288 0.068 0.000 0.868 0.064
#> GSM875458     3  0.3474     0.8288 0.068 0.000 0.868 0.064
#> GSM875467     3  0.2844     0.8431 0.052 0.000 0.900 0.048
#> GSM875468     3  0.3474     0.8288 0.068 0.000 0.868 0.064
#> GSM875412     3  0.6302     0.2543 0.000 0.368 0.564 0.068
#> GSM875419     2  0.7145     0.3903 0.048 0.544 0.360 0.048
#> GSM875420     2  0.3474     0.7679 0.000 0.868 0.068 0.064
#> GSM875421     3  0.1510     0.8620 0.000 0.028 0.956 0.016
#> GSM875422     3  0.1510     0.8620 0.000 0.028 0.956 0.016
#> GSM875426     3  0.2844     0.8414 0.000 0.048 0.900 0.052
#> GSM875428     3  0.2919     0.8403 0.000 0.044 0.896 0.060
#> GSM875429     2  0.3668     0.7609 0.000 0.808 0.004 0.188
#> GSM875434     2  0.8906     0.3906 0.076 0.444 0.280 0.200
#> GSM875438     2  0.3834     0.7620 0.000 0.848 0.076 0.076
#> GSM875439     2  0.2222     0.7926 0.000 0.924 0.016 0.060
#> GSM875440     3  0.5772     0.5343 0.000 0.260 0.672 0.068
#> GSM875441     2  0.1004     0.8056 0.000 0.972 0.004 0.024
#> GSM875442     2  0.5927     0.6860 0.012 0.688 0.060 0.240
#> GSM875446     2  0.2222     0.7926 0.000 0.924 0.016 0.060
#> GSM875448     2  0.0524     0.8059 0.000 0.988 0.004 0.008
#> GSM875453     2  0.0376     0.8056 0.000 0.992 0.004 0.004
#> GSM875455     2  0.2654     0.7948 0.000 0.888 0.004 0.108
#> GSM875459     2  0.2593     0.7955 0.000 0.892 0.004 0.104
#> GSM875460     2  0.7853     0.2090 0.056 0.436 0.428 0.080
#> GSM875463     2  0.1114     0.8061 0.004 0.972 0.016 0.008
#> GSM875464     2  0.0336     0.8045 0.000 0.992 0.000 0.008
#> GSM875466     3  0.4669     0.7018 0.000 0.168 0.780 0.052
#> GSM875473     3  0.4548     0.7557 0.144 0.008 0.804 0.044
#> GSM875474     2  0.2654     0.7948 0.000 0.888 0.004 0.108
#> GSM875478     2  0.2593     0.7955 0.000 0.892 0.004 0.104
#> GSM875479     2  0.0336     0.8045 0.000 0.992 0.000 0.008
#> GSM875480     3  0.0927     0.8640 0.000 0.016 0.976 0.008
#> GSM875481     3  0.1929     0.8569 0.000 0.024 0.940 0.036

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     5  0.2795     0.0000 0.100 0.028 0.000 0.000 0.872
#> GSM875415     1  0.0510     0.8895 0.984 0.000 0.000 0.000 0.016
#> GSM875416     1  0.1270     0.8787 0.948 0.000 0.000 0.000 0.052
#> GSM875417     3  0.3649     0.7721 0.088 0.000 0.824 0.000 0.088
#> GSM875418     1  0.0510     0.8895 0.984 0.000 0.000 0.000 0.016
#> GSM875423     1  0.1484     0.8774 0.944 0.000 0.008 0.000 0.048
#> GSM875424     1  0.2006     0.8616 0.916 0.000 0.012 0.000 0.072
#> GSM875425     1  0.1430     0.8769 0.944 0.000 0.004 0.000 0.052
#> GSM875430     1  0.0510     0.8895 0.984 0.000 0.000 0.000 0.016
#> GSM875432     1  0.2628     0.8434 0.884 0.088 0.000 0.000 0.028
#> GSM875435     1  0.0510     0.8895 0.984 0.000 0.000 0.000 0.016
#> GSM875436     2  0.5477     0.4033 0.100 0.672 0.000 0.216 0.012
#> GSM875437     1  0.1502     0.8744 0.940 0.056 0.000 0.000 0.004
#> GSM875447     1  0.0404     0.8895 0.988 0.000 0.000 0.000 0.012
#> GSM875451     1  0.0510     0.8895 0.984 0.000 0.000 0.000 0.016
#> GSM875456     1  0.0510     0.8895 0.984 0.000 0.000 0.000 0.016
#> GSM875461     1  0.0000     0.8896 1.000 0.000 0.000 0.000 0.000
#> GSM875462     1  0.1857     0.8718 0.928 0.060 0.004 0.000 0.008
#> GSM875465     1  0.3738     0.7778 0.832 0.012 0.092 0.000 0.064
#> GSM875469     1  0.0703     0.8883 0.976 0.000 0.000 0.000 0.024
#> GSM875470     1  0.3607     0.7856 0.840 0.012 0.092 0.000 0.056
#> GSM875471     1  0.3607     0.7856 0.840 0.012 0.092 0.000 0.056
#> GSM875472     1  0.3481     0.7986 0.840 0.056 0.000 0.004 0.100
#> GSM875475     1  0.1774     0.8735 0.932 0.052 0.000 0.000 0.016
#> GSM875476     2  0.5477     0.4033 0.100 0.672 0.000 0.216 0.012
#> GSM875477     1  0.3780     0.7778 0.812 0.072 0.000 0.000 0.116
#> GSM875414     3  0.3561     0.7900 0.000 0.084 0.844 0.060 0.012
#> GSM875427     3  0.0703     0.8271 0.000 0.000 0.976 0.000 0.024
#> GSM875431     3  0.1285     0.8280 0.000 0.004 0.956 0.036 0.004
#> GSM875433     3  0.2930     0.8117 0.000 0.076 0.880 0.032 0.012
#> GSM875443     1  0.5759     0.2004 0.520 0.000 0.388 0.000 0.092
#> GSM875444     3  0.3704     0.7706 0.088 0.000 0.820 0.000 0.092
#> GSM875445     3  0.0960     0.8288 0.000 0.008 0.972 0.004 0.016
#> GSM875449     3  0.3248     0.7957 0.052 0.004 0.856 0.000 0.088
#> GSM875450     3  0.3704     0.7706 0.088 0.000 0.820 0.000 0.092
#> GSM875452     3  0.0703     0.8271 0.000 0.000 0.976 0.000 0.024
#> GSM875454     3  0.1026     0.8279 0.000 0.004 0.968 0.024 0.004
#> GSM875457     3  0.3248     0.7957 0.052 0.004 0.856 0.000 0.088
#> GSM875458     3  0.3248     0.7957 0.052 0.004 0.856 0.000 0.088
#> GSM875467     3  0.2569     0.8092 0.040 0.000 0.892 0.000 0.068
#> GSM875468     3  0.3248     0.7957 0.052 0.004 0.856 0.000 0.088
#> GSM875412     3  0.5351     0.3696 0.000 0.060 0.560 0.380 0.000
#> GSM875419     4  0.6741     0.0684 0.048 0.096 0.356 0.500 0.000
#> GSM875420     4  0.1857     0.1913 0.000 0.004 0.060 0.928 0.008
#> GSM875421     3  0.2116     0.8205 0.000 0.028 0.924 0.040 0.008
#> GSM875422     3  0.2116     0.8205 0.000 0.028 0.924 0.040 0.008
#> GSM875426     3  0.3340     0.7934 0.000 0.088 0.856 0.044 0.012
#> GSM875428     3  0.3426     0.7920 0.000 0.084 0.852 0.052 0.012
#> GSM875429     2  0.4219     0.1965 0.000 0.584 0.000 0.416 0.000
#> GSM875434     4  0.7998    -0.0171 0.060 0.288 0.236 0.404 0.012
#> GSM875438     4  0.2476     0.1885 0.000 0.012 0.064 0.904 0.020
#> GSM875439     4  0.4086     0.1356 0.000 0.240 0.000 0.736 0.024
#> GSM875440     3  0.5702     0.5655 0.000 0.092 0.628 0.268 0.012
#> GSM875441     4  0.4252     0.0108 0.000 0.340 0.008 0.652 0.000
#> GSM875442     2  0.4734     0.3012 0.000 0.632 0.016 0.344 0.008
#> GSM875446     4  0.4086     0.1356 0.000 0.240 0.000 0.736 0.024
#> GSM875448     4  0.4490    -0.0362 0.000 0.404 0.004 0.588 0.004
#> GSM875453     4  0.4499    -0.0391 0.000 0.408 0.004 0.584 0.004
#> GSM875455     4  0.4307    -0.1628 0.000 0.496 0.000 0.504 0.000
#> GSM875459     4  0.4306    -0.1563 0.000 0.492 0.000 0.508 0.000
#> GSM875460     3  0.7322    -0.1319 0.052 0.136 0.424 0.384 0.004
#> GSM875463     4  0.4908    -0.0253 0.004 0.388 0.016 0.588 0.004
#> GSM875464     2  0.4650     0.0271 0.000 0.520 0.000 0.468 0.012
#> GSM875466     3  0.4088     0.7037 0.000 0.056 0.776 0.168 0.000
#> GSM875473     3  0.4290     0.7304 0.136 0.012 0.796 0.008 0.048
#> GSM875474     4  0.4307    -0.1628 0.000 0.496 0.000 0.504 0.000
#> GSM875478     4  0.4306    -0.1563 0.000 0.492 0.000 0.508 0.000
#> GSM875479     2  0.4650     0.0271 0.000 0.520 0.000 0.468 0.012
#> GSM875480     3  0.1153     0.8278 0.000 0.008 0.964 0.024 0.004
#> GSM875481     3  0.1960     0.8213 0.000 0.048 0.928 0.020 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
#> GSM875413     6  0.0790    0.00000 0.032 0.000 0.000 0.000 NA 0.968
#> GSM875415     1  0.0260    0.89001 0.992 0.000 0.000 0.000 NA 0.008
#> GSM875416     1  0.1327    0.87995 0.936 0.000 0.000 0.000 NA 0.000
#> GSM875417     3  0.4384    0.61114 0.036 0.000 0.616 0.000 NA 0.000
#> GSM875418     1  0.0260    0.89001 0.992 0.000 0.000 0.000 NA 0.008
#> GSM875423     1  0.1588    0.87458 0.924 0.000 0.004 0.000 NA 0.000
#> GSM875424     1  0.1958    0.85976 0.896 0.000 0.004 0.000 NA 0.000
#> GSM875425     1  0.1387    0.87809 0.932 0.000 0.000 0.000 NA 0.000
#> GSM875430     1  0.0260    0.89001 0.992 0.000 0.000 0.000 NA 0.008
#> GSM875432     1  0.2488    0.83685 0.864 0.124 0.000 0.000 NA 0.008
#> GSM875435     1  0.0260    0.89001 0.992 0.000 0.000 0.000 NA 0.008
#> GSM875436     2  0.1946    0.56108 0.072 0.912 0.000 0.004 NA 0.000
#> GSM875437     1  0.1967    0.86613 0.904 0.084 0.000 0.000 NA 0.000
#> GSM875447     1  0.0146    0.88997 0.996 0.000 0.000 0.000 NA 0.004
#> GSM875451     1  0.0260    0.89001 0.992 0.000 0.000 0.000 NA 0.008
#> GSM875456     1  0.0260    0.89001 0.992 0.000 0.000 0.000 NA 0.008
#> GSM875461     1  0.0260    0.88986 0.992 0.000 0.000 0.000 NA 0.000
#> GSM875462     1  0.2342    0.86225 0.888 0.088 0.004 0.000 NA 0.000
#> GSM875465     1  0.3710    0.79065 0.804 0.012 0.076 0.000 NA 0.000
#> GSM875469     1  0.0972    0.88806 0.964 0.000 0.000 0.000 NA 0.008
#> GSM875470     1  0.3523    0.80489 0.820 0.012 0.076 0.000 NA 0.000
#> GSM875471     1  0.3523    0.80489 0.820 0.012 0.076 0.000 NA 0.000
#> GSM875472     1  0.3992    0.78557 0.796 0.088 0.000 0.004 NA 0.092
#> GSM875475     1  0.1843    0.86531 0.912 0.080 0.000 0.000 NA 0.004
#> GSM875476     2  0.1946    0.56108 0.072 0.912 0.000 0.004 NA 0.000
#> GSM875477     1  0.3913    0.77437 0.788 0.104 0.000 0.000 NA 0.096
#> GSM875414     3  0.4026    0.62762 0.000 0.036 0.776 0.024 NA 0.004
#> GSM875427     3  0.2631    0.68753 0.000 0.000 0.820 0.000 NA 0.000
#> GSM875431     3  0.1232    0.69789 0.000 0.004 0.956 0.016 NA 0.000
#> GSM875433     3  0.3407    0.65750 0.000 0.036 0.820 0.008 NA 0.004
#> GSM875443     1  0.5787    0.24869 0.504 0.000 0.252 0.000 NA 0.000
#> GSM875444     3  0.4396    0.60959 0.036 0.000 0.612 0.000 NA 0.000
#> GSM875445     3  0.2573    0.69806 0.000 0.008 0.856 0.004 NA 0.000
#> GSM875449     3  0.3672    0.62500 0.000 0.000 0.632 0.000 NA 0.000
#> GSM875450     3  0.4396    0.60959 0.036 0.000 0.612 0.000 NA 0.000
#> GSM875452     3  0.2631    0.68753 0.000 0.000 0.820 0.000 NA 0.000
#> GSM875454     3  0.0653    0.69945 0.000 0.004 0.980 0.004 NA 0.000
#> GSM875457     3  0.3672    0.62500 0.000 0.000 0.632 0.000 NA 0.000
#> GSM875458     3  0.3672    0.62500 0.000 0.000 0.632 0.000 NA 0.000
#> GSM875467     3  0.3446    0.65248 0.000 0.000 0.692 0.000 NA 0.000
#> GSM875468     3  0.3672    0.62500 0.000 0.000 0.632 0.000 NA 0.000
#> GSM875412     3  0.6739    0.28793 0.000 0.088 0.524 0.180 NA 0.004
#> GSM875419     3  0.7964   -0.17740 0.044 0.168 0.360 0.320 NA 0.004
#> GSM875420     4  0.6294    0.45099 0.000 0.088 0.080 0.564 NA 0.008
#> GSM875421     3  0.1555    0.69513 0.000 0.012 0.940 0.008 NA 0.000
#> GSM875422     3  0.1555    0.69513 0.000 0.012 0.940 0.008 NA 0.000
#> GSM875426     3  0.3839    0.62892 0.000 0.040 0.784 0.012 NA 0.004
#> GSM875428     3  0.3826    0.62730 0.000 0.036 0.788 0.016 NA 0.004
#> GSM875429     2  0.2980    0.62116 0.000 0.800 0.000 0.192 NA 0.000
#> GSM875434     2  0.8323   -0.04308 0.052 0.344 0.236 0.248 NA 0.008
#> GSM875438     4  0.6449    0.43288 0.000 0.080 0.088 0.544 NA 0.012
#> GSM875439     4  0.4937    0.38709 0.000 0.024 0.000 0.500 NA 0.024
#> GSM875440     3  0.6374    0.39259 0.000 0.084 0.564 0.116 NA 0.004
#> GSM875441     4  0.4349    0.57682 0.000 0.184 0.016 0.736 NA 0.000
#> GSM875442     2  0.2893    0.59298 0.000 0.864 0.004 0.080 NA 0.004
#> GSM875446     4  0.4937    0.38709 0.000 0.024 0.000 0.500 NA 0.024
#> GSM875448     4  0.3014    0.58291 0.000 0.184 0.012 0.804 NA 0.000
#> GSM875453     4  0.3046    0.58205 0.000 0.188 0.012 0.800 NA 0.000
#> GSM875455     2  0.3266    0.62696 0.000 0.728 0.000 0.272 NA 0.000
#> GSM875459     2  0.3288    0.62369 0.000 0.724 0.000 0.276 NA 0.000
#> GSM875460     3  0.7832   -0.00547 0.044 0.208 0.416 0.244 NA 0.004
#> GSM875463     4  0.3343    0.58367 0.004 0.176 0.024 0.796 NA 0.000
#> GSM875464     4  0.4213    0.55412 0.000 0.160 0.000 0.744 NA 0.004
#> GSM875466     3  0.5000    0.56249 0.000 0.072 0.728 0.084 NA 0.004
#> GSM875473     3  0.4879    0.61178 0.100 0.008 0.700 0.004 NA 0.004
#> GSM875474     2  0.3266    0.62696 0.000 0.728 0.000 0.272 NA 0.000
#> GSM875478     2  0.3288    0.62369 0.000 0.724 0.000 0.276 NA 0.000
#> GSM875479     4  0.4213    0.55412 0.000 0.160 0.000 0.744 NA 0.004
#> GSM875480     3  0.0291    0.69913 0.000 0.000 0.992 0.004 NA 0.000
#> GSM875481     3  0.2380    0.67352 0.000 0.020 0.892 0.004 NA 0.004

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.885           0.945       0.973         0.4863 0.519   0.519
#> 3 3 0.922           0.887       0.953         0.3849 0.738   0.527
#> 4 4 0.684           0.524       0.730         0.0934 0.864   0.648
#> 5 5 0.681           0.557       0.771         0.0655 0.827   0.525
#> 6 6 0.744           0.572       0.772         0.0417 0.911   0.666

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
#> GSM875413     1   0.000      0.990 1.000 0.000
#> GSM875415     1   0.000      0.990 1.000 0.000
#> GSM875416     1   0.000      0.990 1.000 0.000
#> GSM875417     1   0.000      0.990 1.000 0.000
#> GSM875418     1   0.000      0.990 1.000 0.000
#> GSM875423     1   0.000      0.990 1.000 0.000
#> GSM875424     1   0.000      0.990 1.000 0.000
#> GSM875425     1   0.000      0.990 1.000 0.000
#> GSM875430     1   0.000      0.990 1.000 0.000
#> GSM875432     1   0.000      0.990 1.000 0.000
#> GSM875435     1   0.000      0.990 1.000 0.000
#> GSM875436     1   0.795      0.659 0.760 0.240
#> GSM875437     1   0.000      0.990 1.000 0.000
#> GSM875447     1   0.000      0.990 1.000 0.000
#> GSM875451     1   0.000      0.990 1.000 0.000
#> GSM875456     1   0.000      0.990 1.000 0.000
#> GSM875461     1   0.000      0.990 1.000 0.000
#> GSM875462     1   0.000      0.990 1.000 0.000
#> GSM875465     1   0.000      0.990 1.000 0.000
#> GSM875469     1   0.000      0.990 1.000 0.000
#> GSM875470     1   0.000      0.990 1.000 0.000
#> GSM875471     1   0.000      0.990 1.000 0.000
#> GSM875472     1   0.000      0.990 1.000 0.000
#> GSM875475     1   0.000      0.990 1.000 0.000
#> GSM875476     1   0.000      0.990 1.000 0.000
#> GSM875477     1   0.000      0.990 1.000 0.000
#> GSM875414     2   0.000      0.961 0.000 1.000
#> GSM875427     2   0.118      0.953 0.016 0.984
#> GSM875431     2   0.000      0.961 0.000 1.000
#> GSM875433     2   0.000      0.961 0.000 1.000
#> GSM875443     1   0.000      0.990 1.000 0.000
#> GSM875444     2   0.850      0.666 0.276 0.724
#> GSM875445     2   0.118      0.953 0.016 0.984
#> GSM875449     2   0.118      0.953 0.016 0.984
#> GSM875450     2   0.850      0.666 0.276 0.724
#> GSM875452     2   0.482      0.881 0.104 0.896
#> GSM875454     2   0.000      0.961 0.000 1.000
#> GSM875457     2   0.163      0.948 0.024 0.976
#> GSM875458     2   0.850      0.666 0.276 0.724
#> GSM875467     2   0.518      0.869 0.116 0.884
#> GSM875468     2   0.855      0.659 0.280 0.720
#> GSM875412     2   0.000      0.961 0.000 1.000
#> GSM875419     2   0.000      0.961 0.000 1.000
#> GSM875420     2   0.000      0.961 0.000 1.000
#> GSM875421     2   0.000      0.961 0.000 1.000
#> GSM875422     2   0.000      0.961 0.000 1.000
#> GSM875426     2   0.000      0.961 0.000 1.000
#> GSM875428     2   0.000      0.961 0.000 1.000
#> GSM875429     2   0.000      0.961 0.000 1.000
#> GSM875434     2   0.697      0.791 0.188 0.812
#> GSM875438     2   0.000      0.961 0.000 1.000
#> GSM875439     2   0.000      0.961 0.000 1.000
#> GSM875440     2   0.000      0.961 0.000 1.000
#> GSM875441     2   0.000      0.961 0.000 1.000
#> GSM875442     2   0.000      0.961 0.000 1.000
#> GSM875446     2   0.000      0.961 0.000 1.000
#> GSM875448     2   0.000      0.961 0.000 1.000
#> GSM875453     2   0.000      0.961 0.000 1.000
#> GSM875455     2   0.000      0.961 0.000 1.000
#> GSM875459     2   0.000      0.961 0.000 1.000
#> GSM875460     2   0.000      0.961 0.000 1.000
#> GSM875463     2   0.000      0.961 0.000 1.000
#> GSM875464     2   0.000      0.961 0.000 1.000
#> GSM875466     2   0.118      0.953 0.016 0.984
#> GSM875473     2   0.118      0.953 0.016 0.984
#> GSM875474     2   0.000      0.961 0.000 1.000
#> GSM875478     2   0.000      0.961 0.000 1.000
#> GSM875479     2   0.000      0.961 0.000 1.000
#> GSM875480     2   0.000      0.961 0.000 1.000
#> GSM875481     2   0.000      0.961 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
#> GSM875413     1  0.0424      0.977 0.992 0.000 0.008
#> GSM875415     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875417     3  0.0424      0.946 0.008 0.000 0.992
#> GSM875418     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875423     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875424     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875425     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875430     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875436     2  0.6126      0.338 0.400 0.600 0.000
#> GSM875437     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875451     1  0.0237      0.979 0.996 0.000 0.004
#> GSM875456     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875465     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875469     1  0.0237      0.979 0.996 0.000 0.004
#> GSM875470     1  0.6045      0.377 0.620 0.000 0.380
#> GSM875471     3  0.6045      0.338 0.380 0.000 0.620
#> GSM875472     1  0.0237      0.979 0.996 0.000 0.004
#> GSM875475     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875476     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875477     1  0.0237      0.979 0.996 0.000 0.004
#> GSM875414     2  0.5733      0.529 0.000 0.676 0.324
#> GSM875427     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875431     3  0.0747      0.949 0.000 0.016 0.984
#> GSM875433     3  0.0747      0.949 0.000 0.016 0.984
#> GSM875443     3  0.0424      0.946 0.008 0.000 0.992
#> GSM875444     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875445     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875449     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875450     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875452     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875454     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875457     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875458     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875467     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875468     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875412     2  0.0424      0.917 0.000 0.992 0.008
#> GSM875419     2  0.0424      0.917 0.000 0.992 0.008
#> GSM875420     2  0.0424      0.917 0.000 0.992 0.008
#> GSM875421     3  0.0747      0.949 0.000 0.016 0.984
#> GSM875422     3  0.0747      0.949 0.000 0.016 0.984
#> GSM875426     2  0.6126      0.368 0.000 0.600 0.400
#> GSM875428     2  0.6062      0.408 0.000 0.616 0.384
#> GSM875429     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875434     2  0.5012      0.715 0.204 0.788 0.008
#> GSM875438     2  0.0424      0.917 0.000 0.992 0.008
#> GSM875439     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875440     2  0.1289      0.903 0.000 0.968 0.032
#> GSM875441     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875448     2  0.0424      0.917 0.000 0.992 0.008
#> GSM875453     2  0.0424      0.917 0.000 0.992 0.008
#> GSM875455     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875460     2  0.1529      0.897 0.000 0.960 0.040
#> GSM875463     2  0.0424      0.917 0.000 0.992 0.008
#> GSM875464     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875466     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875473     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875474     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.918 0.000 1.000 0.000
#> GSM875480     3  0.0424      0.953 0.000 0.008 0.992
#> GSM875481     3  0.6235      0.111 0.000 0.436 0.564

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.3528    0.78924 0.808 0.000 0.000 0.192
#> GSM875415     1  0.0000    0.89111 1.000 0.000 0.000 0.000
#> GSM875416     1  0.1557    0.87663 0.944 0.000 0.000 0.056
#> GSM875417     3  0.5151    0.42226 0.004 0.000 0.532 0.464
#> GSM875418     1  0.0000    0.89111 1.000 0.000 0.000 0.000
#> GSM875423     1  0.2081    0.86231 0.916 0.000 0.000 0.084
#> GSM875424     1  0.2081    0.86231 0.916 0.000 0.000 0.084
#> GSM875425     1  0.2216    0.85898 0.908 0.000 0.000 0.092
#> GSM875430     1  0.0000    0.89111 1.000 0.000 0.000 0.000
#> GSM875432     1  0.2647    0.83873 0.880 0.000 0.000 0.120
#> GSM875435     1  0.0000    0.89111 1.000 0.000 0.000 0.000
#> GSM875436     4  0.8623    0.04024 0.356 0.180 0.052 0.412
#> GSM875437     1  0.2081    0.86602 0.916 0.000 0.000 0.084
#> GSM875447     1  0.0000    0.89111 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0592    0.88837 0.984 0.000 0.000 0.016
#> GSM875456     1  0.0000    0.89111 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000    0.89111 1.000 0.000 0.000 0.000
#> GSM875462     1  0.3074    0.84262 0.848 0.000 0.000 0.152
#> GSM875465     1  0.2345    0.85836 0.900 0.000 0.000 0.100
#> GSM875469     1  0.1792    0.87769 0.932 0.000 0.000 0.068
#> GSM875470     1  0.7535   -0.02644 0.464 0.000 0.200 0.336
#> GSM875471     4  0.7363   -0.35591 0.176 0.000 0.332 0.492
#> GSM875472     1  0.3688    0.80472 0.792 0.000 0.000 0.208
#> GSM875475     1  0.0336    0.89023 0.992 0.000 0.000 0.008
#> GSM875476     1  0.3812    0.80197 0.832 0.028 0.000 0.140
#> GSM875477     1  0.3266    0.81141 0.832 0.000 0.000 0.168
#> GSM875414     3  0.7093   -0.00727 0.000 0.220 0.568 0.212
#> GSM875427     3  0.4843    0.47598 0.000 0.000 0.604 0.396
#> GSM875431     3  0.3300    0.34219 0.000 0.008 0.848 0.144
#> GSM875433     3  0.1406    0.46049 0.000 0.016 0.960 0.024
#> GSM875443     3  0.5858    0.37764 0.032 0.000 0.500 0.468
#> GSM875444     3  0.4907    0.47083 0.000 0.000 0.580 0.420
#> GSM875445     3  0.4843    0.47598 0.000 0.000 0.604 0.396
#> GSM875449     3  0.4898    0.47199 0.000 0.000 0.584 0.416
#> GSM875450     3  0.4907    0.47083 0.000 0.000 0.580 0.420
#> GSM875452     3  0.4855    0.47543 0.000 0.000 0.600 0.400
#> GSM875454     3  0.1302    0.46886 0.000 0.000 0.956 0.044
#> GSM875457     3  0.4907    0.47083 0.000 0.000 0.580 0.420
#> GSM875458     3  0.4907    0.47083 0.000 0.000 0.580 0.420
#> GSM875467     3  0.4907    0.47083 0.000 0.000 0.580 0.420
#> GSM875468     3  0.4907    0.47083 0.000 0.000 0.580 0.420
#> GSM875412     3  0.7814   -0.33659 0.000 0.280 0.416 0.304
#> GSM875419     3  0.7866   -0.36955 0.000 0.284 0.388 0.328
#> GSM875420     2  0.7659    0.45393 0.000 0.460 0.244 0.296
#> GSM875421     3  0.0927    0.45175 0.000 0.008 0.976 0.016
#> GSM875422     3  0.0927    0.45175 0.000 0.008 0.976 0.016
#> GSM875426     3  0.4644    0.25981 0.000 0.228 0.748 0.024
#> GSM875428     3  0.6567    0.08053 0.000 0.128 0.616 0.256
#> GSM875429     2  0.0817    0.66089 0.000 0.976 0.000 0.024
#> GSM875434     4  0.9111   -0.16493 0.124 0.144 0.304 0.428
#> GSM875438     2  0.7782    0.40026 0.000 0.428 0.276 0.296
#> GSM875439     2  0.0469    0.66929 0.000 0.988 0.000 0.012
#> GSM875440     3  0.7301   -0.08890 0.000 0.236 0.536 0.228
#> GSM875441     2  0.7138    0.55385 0.000 0.540 0.164 0.296
#> GSM875442     2  0.2469    0.59799 0.000 0.892 0.000 0.108
#> GSM875446     2  0.1297    0.67058 0.000 0.964 0.020 0.016
#> GSM875448     2  0.7172    0.55031 0.000 0.536 0.168 0.296
#> GSM875453     2  0.7189    0.55045 0.000 0.532 0.168 0.300
#> GSM875455     2  0.2921    0.56313 0.000 0.860 0.000 0.140
#> GSM875459     2  0.0000    0.66619 0.000 1.000 0.000 0.000
#> GSM875460     3  0.7453   -0.16482 0.000 0.204 0.496 0.300
#> GSM875463     2  0.7205    0.54877 0.000 0.528 0.168 0.304
#> GSM875464     2  0.6323    0.59363 0.000 0.628 0.100 0.272
#> GSM875466     3  0.0817    0.46591 0.000 0.000 0.976 0.024
#> GSM875473     3  0.3873    0.46943 0.000 0.000 0.772 0.228
#> GSM875474     2  0.0817    0.66089 0.000 0.976 0.000 0.024
#> GSM875478     2  0.0336    0.66496 0.000 0.992 0.000 0.008
#> GSM875479     2  0.4079    0.64563 0.000 0.800 0.020 0.180
#> GSM875480     3  0.1042    0.44937 0.000 0.008 0.972 0.020
#> GSM875481     3  0.3852    0.31523 0.000 0.192 0.800 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.4739     0.6524 0.652 0.016 0.000 0.320 0.012
#> GSM875415     1  0.0000     0.8247 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.3586     0.7606 0.792 0.000 0.020 0.188 0.000
#> GSM875417     3  0.1851     0.7875 0.000 0.000 0.912 0.088 0.000
#> GSM875418     1  0.0162     0.8247 0.996 0.000 0.000 0.004 0.000
#> GSM875423     1  0.4851     0.7113 0.712 0.000 0.092 0.196 0.000
#> GSM875424     1  0.4605     0.7240 0.732 0.000 0.076 0.192 0.000
#> GSM875425     1  0.5088     0.6945 0.680 0.000 0.092 0.228 0.000
#> GSM875430     1  0.0000     0.8247 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.2732     0.7658 0.840 0.000 0.000 0.160 0.000
#> GSM875435     1  0.0000     0.8247 1.000 0.000 0.000 0.000 0.000
#> GSM875436     4  0.7253    -0.0136 0.344 0.120 0.000 0.464 0.072
#> GSM875437     1  0.2690     0.7806 0.844 0.000 0.000 0.156 0.000
#> GSM875447     1  0.0000     0.8247 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.1197     0.8175 0.952 0.000 0.000 0.048 0.000
#> GSM875456     1  0.0162     0.8247 0.996 0.000 0.000 0.004 0.000
#> GSM875461     1  0.0880     0.8235 0.968 0.000 0.000 0.032 0.000
#> GSM875462     1  0.4178     0.7450 0.696 0.008 0.000 0.292 0.004
#> GSM875465     1  0.5141     0.6915 0.672 0.000 0.092 0.236 0.000
#> GSM875469     1  0.3849     0.7550 0.752 0.000 0.016 0.232 0.000
#> GSM875470     3  0.6695    -0.1348 0.368 0.000 0.392 0.240 0.000
#> GSM875471     3  0.5141     0.5791 0.092 0.000 0.672 0.236 0.000
#> GSM875472     1  0.4743     0.6545 0.568 0.008 0.000 0.416 0.008
#> GSM875475     1  0.0794     0.8221 0.972 0.000 0.000 0.028 0.000
#> GSM875476     1  0.5342     0.5945 0.664 0.096 0.000 0.236 0.004
#> GSM875477     1  0.4109     0.7111 0.724 0.008 0.000 0.260 0.008
#> GSM875414     5  0.2450     0.5557 0.000 0.052 0.048 0.000 0.900
#> GSM875427     3  0.1952     0.8022 0.000 0.000 0.912 0.004 0.084
#> GSM875431     5  0.2891     0.5809 0.000 0.000 0.176 0.000 0.824
#> GSM875433     5  0.3790     0.5418 0.000 0.004 0.248 0.004 0.744
#> GSM875443     3  0.2179     0.7782 0.004 0.000 0.896 0.100 0.000
#> GSM875444     3  0.0510     0.8433 0.000 0.000 0.984 0.000 0.016
#> GSM875445     3  0.1952     0.8022 0.000 0.000 0.912 0.004 0.084
#> GSM875449     3  0.0609     0.8434 0.000 0.000 0.980 0.000 0.020
#> GSM875450     3  0.0609     0.8434 0.000 0.000 0.980 0.000 0.020
#> GSM875452     3  0.1952     0.8022 0.000 0.000 0.912 0.004 0.084
#> GSM875454     5  0.3715     0.5306 0.000 0.000 0.260 0.004 0.736
#> GSM875457     3  0.0609     0.8434 0.000 0.000 0.980 0.000 0.020
#> GSM875458     3  0.0510     0.8433 0.000 0.000 0.984 0.000 0.016
#> GSM875467     3  0.0609     0.8434 0.000 0.000 0.980 0.000 0.020
#> GSM875468     3  0.0510     0.8433 0.000 0.000 0.984 0.000 0.016
#> GSM875412     5  0.3988     0.3307 0.000 0.036 0.000 0.196 0.768
#> GSM875419     5  0.4708     0.1639 0.000 0.040 0.000 0.292 0.668
#> GSM875420     5  0.6581    -0.4329 0.000 0.212 0.000 0.356 0.432
#> GSM875421     5  0.3274     0.5775 0.000 0.000 0.220 0.000 0.780
#> GSM875422     5  0.3430     0.5766 0.000 0.000 0.220 0.004 0.776
#> GSM875426     5  0.4220     0.5480 0.000 0.116 0.092 0.004 0.788
#> GSM875428     5  0.1444     0.5505 0.000 0.012 0.040 0.000 0.948
#> GSM875429     2  0.2325     0.7983 0.000 0.904 0.000 0.068 0.028
#> GSM875434     5  0.6214    -0.1403 0.048 0.044 0.000 0.448 0.460
#> GSM875438     5  0.6092    -0.1109 0.000 0.180 0.000 0.256 0.564
#> GSM875439     2  0.2491     0.7692 0.000 0.896 0.000 0.068 0.036
#> GSM875440     5  0.2214     0.5449 0.000 0.052 0.028 0.004 0.916
#> GSM875441     4  0.6748     0.3215 0.000 0.260 0.000 0.372 0.368
#> GSM875442     2  0.3359     0.7216 0.000 0.816 0.000 0.164 0.020
#> GSM875446     2  0.2790     0.7569 0.000 0.880 0.000 0.068 0.052
#> GSM875448     5  0.6717    -0.5276 0.000 0.248 0.000 0.364 0.388
#> GSM875453     5  0.6738    -0.5324 0.000 0.256 0.000 0.364 0.380
#> GSM875455     2  0.3055     0.7324 0.000 0.840 0.000 0.144 0.016
#> GSM875459     2  0.1386     0.7998 0.000 0.952 0.000 0.016 0.032
#> GSM875460     5  0.3880     0.3336 0.000 0.020 0.004 0.204 0.772
#> GSM875463     5  0.6727    -0.5298 0.000 0.252 0.000 0.364 0.384
#> GSM875464     4  0.6802     0.3547 0.000 0.352 0.000 0.356 0.292
#> GSM875466     5  0.3816     0.4688 0.000 0.000 0.304 0.000 0.696
#> GSM875473     3  0.4917     0.1138 0.000 0.000 0.556 0.028 0.416
#> GSM875474     2  0.2450     0.7958 0.000 0.896 0.000 0.076 0.028
#> GSM875478     2  0.0703     0.8029 0.000 0.976 0.000 0.000 0.024
#> GSM875479     2  0.6030    -0.1020 0.000 0.544 0.000 0.316 0.140
#> GSM875480     5  0.3305     0.5740 0.000 0.000 0.224 0.000 0.776
#> GSM875481     5  0.4557     0.5559 0.000 0.104 0.132 0.004 0.760

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.6134    0.02798 0.520 0.080 0.000 0.028 0.024 0.348
#> GSM875415     1  0.0000    0.56716 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.4173    0.22416 0.688 0.000 0.044 0.000 0.000 0.268
#> GSM875417     3  0.0713    0.82848 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM875418     1  0.0291    0.56636 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM875423     1  0.5306    0.00846 0.588 0.000 0.124 0.000 0.004 0.284
#> GSM875424     1  0.4972    0.08809 0.620 0.000 0.108 0.000 0.000 0.272
#> GSM875425     1  0.5555   -0.17854 0.500 0.000 0.124 0.000 0.004 0.372
#> GSM875430     1  0.0260    0.56765 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875432     1  0.3280    0.43466 0.808 0.028 0.000 0.004 0.000 0.160
#> GSM875435     1  0.0260    0.56722 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875436     1  0.7976   -0.14000 0.276 0.268 0.000 0.212 0.012 0.232
#> GSM875437     1  0.3564    0.40192 0.768 0.024 0.000 0.004 0.000 0.204
#> GSM875447     1  0.0405    0.56669 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM875451     1  0.1082    0.55028 0.956 0.000 0.000 0.004 0.000 0.040
#> GSM875456     1  0.0405    0.56666 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM875461     1  0.1080    0.56267 0.960 0.000 0.000 0.004 0.004 0.032
#> GSM875462     1  0.4528    0.05849 0.564 0.028 0.000 0.004 0.000 0.404
#> GSM875465     1  0.5458   -0.20679 0.480 0.000 0.124 0.000 0.000 0.396
#> GSM875469     1  0.4381    0.23512 0.676 0.000 0.036 0.004 0.004 0.280
#> GSM875470     6  0.6089    0.15393 0.304 0.000 0.304 0.000 0.000 0.392
#> GSM875471     3  0.4806   -0.00290 0.060 0.000 0.560 0.000 0.000 0.380
#> GSM875472     6  0.5475   -0.07738 0.340 0.072 0.000 0.028 0.000 0.560
#> GSM875475     1  0.1219    0.55405 0.948 0.000 0.000 0.004 0.000 0.048
#> GSM875476     1  0.5720    0.12807 0.560 0.252 0.000 0.004 0.004 0.180
#> GSM875477     1  0.5165    0.16926 0.600 0.072 0.000 0.016 0.000 0.312
#> GSM875414     5  0.2257    0.79065 0.000 0.020 0.000 0.060 0.904 0.016
#> GSM875427     3  0.2547    0.86579 0.000 0.004 0.868 0.000 0.112 0.016
#> GSM875431     5  0.2601    0.82028 0.000 0.008 0.028 0.040 0.896 0.028
#> GSM875433     5  0.1950    0.82593 0.000 0.000 0.064 0.000 0.912 0.024
#> GSM875443     3  0.1610    0.77919 0.000 0.000 0.916 0.000 0.000 0.084
#> GSM875444     3  0.1141    0.89788 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM875445     3  0.2592    0.86153 0.000 0.004 0.864 0.000 0.116 0.016
#> GSM875449     3  0.1327    0.90383 0.000 0.000 0.936 0.000 0.064 0.000
#> GSM875450     3  0.1471    0.90353 0.000 0.000 0.932 0.000 0.064 0.004
#> GSM875452     3  0.2454    0.87147 0.000 0.004 0.876 0.000 0.104 0.016
#> GSM875454     5  0.2239    0.82410 0.000 0.008 0.072 0.000 0.900 0.020
#> GSM875457     3  0.1327    0.90383 0.000 0.000 0.936 0.000 0.064 0.000
#> GSM875458     3  0.1327    0.90383 0.000 0.000 0.936 0.000 0.064 0.000
#> GSM875467     3  0.1471    0.90353 0.000 0.000 0.932 0.000 0.064 0.004
#> GSM875468     3  0.1327    0.90383 0.000 0.000 0.936 0.000 0.064 0.000
#> GSM875412     5  0.4891    0.15744 0.000 0.016 0.000 0.384 0.564 0.036
#> GSM875419     4  0.5685    0.35967 0.000 0.056 0.000 0.532 0.360 0.052
#> GSM875420     4  0.2182    0.77001 0.000 0.008 0.000 0.904 0.068 0.020
#> GSM875421     5  0.1951    0.82917 0.000 0.004 0.060 0.000 0.916 0.020
#> GSM875422     5  0.1769    0.82913 0.000 0.004 0.060 0.000 0.924 0.012
#> GSM875426     5  0.2478    0.81497 0.000 0.024 0.032 0.012 0.904 0.028
#> GSM875428     5  0.2001    0.77217 0.000 0.004 0.000 0.092 0.900 0.004
#> GSM875429     2  0.2520    0.82955 0.000 0.872 0.000 0.108 0.008 0.012
#> GSM875434     4  0.7750    0.42370 0.024 0.152 0.000 0.416 0.192 0.216
#> GSM875438     4  0.4822    0.49051 0.000 0.016 0.000 0.608 0.336 0.040
#> GSM875439     2  0.5611    0.76663 0.000 0.600 0.000 0.256 0.028 0.116
#> GSM875440     5  0.2682    0.76304 0.000 0.020 0.000 0.084 0.876 0.020
#> GSM875441     4  0.1196    0.75782 0.000 0.008 0.000 0.952 0.040 0.000
#> GSM875442     2  0.1801    0.79310 0.000 0.924 0.000 0.056 0.004 0.016
#> GSM875446     2  0.5838    0.75620 0.000 0.584 0.000 0.256 0.040 0.120
#> GSM875448     4  0.2340    0.77318 0.000 0.016 0.000 0.900 0.060 0.024
#> GSM875453     4  0.2034    0.77280 0.000 0.004 0.000 0.912 0.060 0.024
#> GSM875455     2  0.1349    0.80782 0.000 0.940 0.000 0.056 0.000 0.004
#> GSM875459     2  0.5031    0.81442 0.000 0.680 0.000 0.196 0.024 0.100
#> GSM875460     5  0.5347   -0.01335 0.000 0.020 0.000 0.420 0.500 0.060
#> GSM875463     4  0.2340    0.77318 0.000 0.016 0.000 0.900 0.060 0.024
#> GSM875464     4  0.1710    0.73093 0.000 0.020 0.000 0.936 0.028 0.016
#> GSM875466     5  0.2678    0.80003 0.000 0.004 0.116 0.000 0.860 0.020
#> GSM875473     5  0.5215    0.50246 0.000 0.004 0.284 0.004 0.608 0.100
#> GSM875474     2  0.1908    0.83139 0.000 0.900 0.000 0.096 0.004 0.000
#> GSM875478     2  0.4527    0.82458 0.000 0.716 0.000 0.192 0.012 0.080
#> GSM875479     4  0.3910    0.48129 0.000 0.092 0.000 0.792 0.016 0.100
#> GSM875480     5  0.2119    0.82845 0.000 0.008 0.060 0.004 0.912 0.016
#> GSM875481     5  0.2145    0.82208 0.000 0.012 0.040 0.004 0.916 0.028

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-kmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) k
#> MAD:kmeans 70         4.52e-15 2
#> MAD:kmeans 64         5.50e-19 3
#> MAD:kmeans 36         1.61e-08 4
#> MAD:kmeans 54         3.98e-15 5
#> MAD:kmeans 48         7.73e-13 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 51941 rows and 70 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.854           0.873       0.952         0.4986 0.503   0.503
#> 3 3 1.000           0.965       0.986         0.3494 0.751   0.539
#> 4 4 0.815           0.794       0.893         0.1054 0.853   0.595
#> 5 5 0.777           0.704       0.823         0.0646 0.918   0.702
#> 6 6 0.813           0.787       0.864         0.0465 0.918   0.645

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
#> GSM875413     1  0.0000      0.954 1.000 0.000
#> GSM875415     1  0.0000      0.954 1.000 0.000
#> GSM875416     1  0.0000      0.954 1.000 0.000
#> GSM875417     1  0.0000      0.954 1.000 0.000
#> GSM875418     1  0.0000      0.954 1.000 0.000
#> GSM875423     1  0.0000      0.954 1.000 0.000
#> GSM875424     1  0.0000      0.954 1.000 0.000
#> GSM875425     1  0.0000      0.954 1.000 0.000
#> GSM875430     1  0.0000      0.954 1.000 0.000
#> GSM875432     1  0.0000      0.954 1.000 0.000
#> GSM875435     1  0.0000      0.954 1.000 0.000
#> GSM875436     1  0.0376      0.951 0.996 0.004
#> GSM875437     1  0.0000      0.954 1.000 0.000
#> GSM875447     1  0.0000      0.954 1.000 0.000
#> GSM875451     1  0.0000      0.954 1.000 0.000
#> GSM875456     1  0.0000      0.954 1.000 0.000
#> GSM875461     1  0.0000      0.954 1.000 0.000
#> GSM875462     1  0.0000      0.954 1.000 0.000
#> GSM875465     1  0.0000      0.954 1.000 0.000
#> GSM875469     1  0.0000      0.954 1.000 0.000
#> GSM875470     1  0.0000      0.954 1.000 0.000
#> GSM875471     1  0.0000      0.954 1.000 0.000
#> GSM875472     1  0.0000      0.954 1.000 0.000
#> GSM875475     1  0.0000      0.954 1.000 0.000
#> GSM875476     1  0.0000      0.954 1.000 0.000
#> GSM875477     1  0.0000      0.954 1.000 0.000
#> GSM875414     2  0.0000      0.941 0.000 1.000
#> GSM875427     2  0.0000      0.941 0.000 1.000
#> GSM875431     2  0.0000      0.941 0.000 1.000
#> GSM875433     2  0.0000      0.941 0.000 1.000
#> GSM875443     1  0.0000      0.954 1.000 0.000
#> GSM875444     2  0.9896      0.242 0.440 0.560
#> GSM875445     2  0.0000      0.941 0.000 1.000
#> GSM875449     2  0.0000      0.941 0.000 1.000
#> GSM875450     2  0.9896      0.242 0.440 0.560
#> GSM875452     2  0.8909      0.551 0.308 0.692
#> GSM875454     2  0.0000      0.941 0.000 1.000
#> GSM875457     2  0.5294      0.825 0.120 0.880
#> GSM875458     1  0.9427      0.391 0.640 0.360
#> GSM875467     2  0.9881      0.253 0.436 0.564
#> GSM875468     1  0.9661      0.304 0.608 0.392
#> GSM875412     2  0.0000      0.941 0.000 1.000
#> GSM875419     2  0.0000      0.941 0.000 1.000
#> GSM875420     2  0.0000      0.941 0.000 1.000
#> GSM875421     2  0.0000      0.941 0.000 1.000
#> GSM875422     2  0.0000      0.941 0.000 1.000
#> GSM875426     2  0.0000      0.941 0.000 1.000
#> GSM875428     2  0.0000      0.941 0.000 1.000
#> GSM875429     2  0.0000      0.941 0.000 1.000
#> GSM875434     2  0.9635      0.382 0.388 0.612
#> GSM875438     2  0.0000      0.941 0.000 1.000
#> GSM875439     2  0.0000      0.941 0.000 1.000
#> GSM875440     2  0.0000      0.941 0.000 1.000
#> GSM875441     2  0.0000      0.941 0.000 1.000
#> GSM875442     2  0.0000      0.941 0.000 1.000
#> GSM875446     2  0.0000      0.941 0.000 1.000
#> GSM875448     2  0.0000      0.941 0.000 1.000
#> GSM875453     2  0.0000      0.941 0.000 1.000
#> GSM875455     1  0.9896      0.187 0.560 0.440
#> GSM875459     2  0.0000      0.941 0.000 1.000
#> GSM875460     2  0.0000      0.941 0.000 1.000
#> GSM875463     2  0.0000      0.941 0.000 1.000
#> GSM875464     2  0.0000      0.941 0.000 1.000
#> GSM875466     2  0.0000      0.941 0.000 1.000
#> GSM875473     2  0.0000      0.941 0.000 1.000
#> GSM875474     2  0.0000      0.941 0.000 1.000
#> GSM875478     2  0.0000      0.941 0.000 1.000
#> GSM875479     2  0.0000      0.941 0.000 1.000
#> GSM875480     2  0.0000      0.941 0.000 1.000
#> GSM875481     2  0.0000      0.941 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
#> GSM875413     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875415     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875417     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875418     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875423     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875424     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875425     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875430     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875436     1  0.6168      0.276 0.588 0.412 0.000
#> GSM875437     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875465     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875469     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875470     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875471     1  0.1529      0.940 0.960 0.000 0.040
#> GSM875472     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875475     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875476     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875477     1  0.0000      0.980 1.000 0.000 0.000
#> GSM875414     2  0.0237      0.979 0.000 0.996 0.004
#> GSM875427     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875431     3  0.2165      0.936 0.000 0.064 0.936
#> GSM875433     3  0.1163      0.973 0.000 0.028 0.972
#> GSM875443     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875454     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875457     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875421     3  0.0747      0.984 0.000 0.016 0.984
#> GSM875422     3  0.0747      0.984 0.000 0.016 0.984
#> GSM875426     2  0.0592      0.973 0.000 0.988 0.012
#> GSM875428     2  0.0424      0.976 0.000 0.992 0.008
#> GSM875429     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875434     2  0.4555      0.746 0.200 0.800 0.000
#> GSM875438     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875455     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875460     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875463     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875473     3  0.0000      0.993 0.000 0.000 1.000
#> GSM875474     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.982 0.000 1.000 0.000
#> GSM875480     3  0.0747      0.984 0.000 0.016 0.984
#> GSM875481     2  0.4504      0.758 0.000 0.804 0.196

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.0188      0.985 0.996 0.000 0.000 0.004
#> GSM875415     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0524      0.982 0.988 0.000 0.008 0.004
#> GSM875417     3  0.0188      0.937 0.000 0.000 0.996 0.004
#> GSM875418     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875423     1  0.0779      0.978 0.980 0.000 0.016 0.004
#> GSM875424     1  0.0779      0.978 0.980 0.000 0.016 0.004
#> GSM875425     1  0.0779      0.978 0.980 0.000 0.016 0.004
#> GSM875430     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0188      0.985 0.996 0.000 0.000 0.004
#> GSM875435     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875436     2  0.5700      0.164 0.412 0.560 0.000 0.028
#> GSM875437     1  0.0188      0.985 0.996 0.000 0.000 0.004
#> GSM875447     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875462     1  0.0188      0.985 0.996 0.000 0.000 0.004
#> GSM875465     1  0.0779      0.978 0.980 0.000 0.016 0.004
#> GSM875469     1  0.0524      0.982 0.988 0.000 0.008 0.004
#> GSM875470     1  0.1661      0.945 0.944 0.000 0.052 0.004
#> GSM875471     3  0.5097      0.221 0.428 0.000 0.568 0.004
#> GSM875472     1  0.0188      0.985 0.996 0.000 0.000 0.004
#> GSM875475     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM875476     1  0.3052      0.850 0.860 0.136 0.000 0.004
#> GSM875477     1  0.0188      0.985 0.996 0.000 0.000 0.004
#> GSM875414     4  0.1474      0.762 0.000 0.052 0.000 0.948
#> GSM875427     3  0.0707      0.937 0.000 0.000 0.980 0.020
#> GSM875431     4  0.0921      0.776 0.000 0.000 0.028 0.972
#> GSM875433     4  0.4808      0.646 0.000 0.236 0.028 0.736
#> GSM875443     3  0.0376      0.934 0.004 0.000 0.992 0.004
#> GSM875444     3  0.0000      0.940 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0592      0.940 0.000 0.000 0.984 0.016
#> GSM875449     3  0.0592      0.940 0.000 0.000 0.984 0.016
#> GSM875450     3  0.0336      0.943 0.000 0.000 0.992 0.008
#> GSM875452     3  0.0592      0.940 0.000 0.000 0.984 0.016
#> GSM875454     4  0.2149      0.768 0.000 0.000 0.088 0.912
#> GSM875457     3  0.0336      0.943 0.000 0.000 0.992 0.008
#> GSM875458     3  0.0336      0.943 0.000 0.000 0.992 0.008
#> GSM875467     3  0.0336      0.943 0.000 0.000 0.992 0.008
#> GSM875468     3  0.0336      0.943 0.000 0.000 0.992 0.008
#> GSM875412     4  0.4843     -0.134 0.000 0.396 0.000 0.604
#> GSM875419     2  0.4925      0.560 0.000 0.572 0.000 0.428
#> GSM875420     2  0.4925      0.560 0.000 0.572 0.000 0.428
#> GSM875421     4  0.1389      0.781 0.000 0.000 0.048 0.952
#> GSM875422     4  0.1389      0.781 0.000 0.000 0.048 0.952
#> GSM875426     4  0.3123      0.729 0.000 0.156 0.000 0.844
#> GSM875428     4  0.0336      0.764 0.000 0.008 0.000 0.992
#> GSM875429     2  0.0336      0.726 0.000 0.992 0.000 0.008
#> GSM875434     2  0.7550      0.411 0.192 0.436 0.000 0.372
#> GSM875438     2  0.4713      0.604 0.000 0.640 0.000 0.360
#> GSM875439     2  0.1389      0.732 0.000 0.952 0.000 0.048
#> GSM875440     4  0.2760      0.746 0.000 0.128 0.000 0.872
#> GSM875441     2  0.4304      0.726 0.000 0.716 0.000 0.284
#> GSM875442     2  0.0469      0.724 0.000 0.988 0.000 0.012
#> GSM875446     2  0.3801      0.696 0.000 0.780 0.000 0.220
#> GSM875448     2  0.4304      0.726 0.000 0.716 0.000 0.284
#> GSM875453     2  0.4304      0.726 0.000 0.716 0.000 0.284
#> GSM875455     2  0.0469      0.724 0.000 0.988 0.000 0.012
#> GSM875459     2  0.0592      0.727 0.000 0.984 0.000 0.016
#> GSM875460     4  0.3837      0.460 0.000 0.224 0.000 0.776
#> GSM875463     2  0.4277      0.728 0.000 0.720 0.000 0.280
#> GSM875464     2  0.4250      0.729 0.000 0.724 0.000 0.276
#> GSM875466     4  0.4679      0.450 0.000 0.000 0.352 0.648
#> GSM875473     4  0.4994      0.145 0.000 0.000 0.480 0.520
#> GSM875474     2  0.0336      0.726 0.000 0.992 0.000 0.008
#> GSM875478     2  0.0336      0.726 0.000 0.992 0.000 0.008
#> GSM875479     2  0.3975      0.738 0.000 0.760 0.000 0.240
#> GSM875480     4  0.1211      0.780 0.000 0.000 0.040 0.960
#> GSM875481     4  0.3257      0.731 0.000 0.152 0.004 0.844

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.4383    0.75158 0.572 0.424 0.000 0.004 0.000
#> GSM875415     1  0.3684    0.82355 0.720 0.280 0.000 0.000 0.000
#> GSM875416     1  0.0000    0.74027 1.000 0.000 0.000 0.000 0.000
#> GSM875417     3  0.1478    0.92483 0.064 0.000 0.936 0.000 0.000
#> GSM875418     1  0.3684    0.82355 0.720 0.280 0.000 0.000 0.000
#> GSM875423     1  0.0324    0.73602 0.992 0.004 0.004 0.000 0.000
#> GSM875424     1  0.0290    0.74342 0.992 0.008 0.000 0.000 0.000
#> GSM875425     1  0.1282    0.71350 0.952 0.044 0.004 0.000 0.000
#> GSM875430     1  0.3684    0.82355 0.720 0.280 0.000 0.000 0.000
#> GSM875432     1  0.4242    0.75216 0.572 0.428 0.000 0.000 0.000
#> GSM875435     1  0.3684    0.82355 0.720 0.280 0.000 0.000 0.000
#> GSM875436     2  0.4960    0.04674 0.112 0.708 0.000 0.180 0.000
#> GSM875437     1  0.4045    0.79637 0.644 0.356 0.000 0.000 0.000
#> GSM875447     1  0.3684    0.82355 0.720 0.280 0.000 0.000 0.000
#> GSM875451     1  0.3684    0.82355 0.720 0.280 0.000 0.000 0.000
#> GSM875456     1  0.3661    0.82328 0.724 0.276 0.000 0.000 0.000
#> GSM875461     1  0.3774    0.81998 0.704 0.296 0.000 0.000 0.000
#> GSM875462     1  0.3966    0.78585 0.664 0.336 0.000 0.000 0.000
#> GSM875465     1  0.1205    0.71605 0.956 0.040 0.004 0.000 0.000
#> GSM875469     1  0.0290    0.74072 0.992 0.008 0.000 0.000 0.000
#> GSM875470     1  0.2514    0.66379 0.896 0.044 0.060 0.000 0.000
#> GSM875471     1  0.4453    0.44057 0.724 0.048 0.228 0.000 0.000
#> GSM875472     1  0.4321    0.74593 0.600 0.396 0.000 0.004 0.000
#> GSM875475     1  0.3913    0.81070 0.676 0.324 0.000 0.000 0.000
#> GSM875476     2  0.3913   -0.43255 0.324 0.676 0.000 0.000 0.000
#> GSM875477     1  0.4242    0.75216 0.572 0.428 0.000 0.000 0.000
#> GSM875414     5  0.1197    0.86706 0.000 0.000 0.000 0.048 0.952
#> GSM875427     3  0.0671    0.96431 0.000 0.004 0.980 0.000 0.016
#> GSM875431     5  0.2139    0.87363 0.000 0.000 0.032 0.052 0.916
#> GSM875433     5  0.1018    0.85189 0.000 0.016 0.016 0.000 0.968
#> GSM875443     3  0.3013    0.82993 0.160 0.008 0.832 0.000 0.000
#> GSM875444     3  0.0000    0.97354 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.0671    0.96347 0.000 0.004 0.980 0.000 0.016
#> GSM875449     3  0.0000    0.97354 0.000 0.000 1.000 0.000 0.000
#> GSM875450     3  0.0162    0.97303 0.000 0.004 0.996 0.000 0.000
#> GSM875452     3  0.0324    0.97147 0.000 0.004 0.992 0.000 0.004
#> GSM875454     5  0.2370    0.87207 0.000 0.000 0.056 0.040 0.904
#> GSM875457     3  0.0000    0.97354 0.000 0.000 1.000 0.000 0.000
#> GSM875458     3  0.0000    0.97354 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0162    0.97303 0.000 0.004 0.996 0.000 0.000
#> GSM875468     3  0.0000    0.97354 0.000 0.000 1.000 0.000 0.000
#> GSM875412     4  0.4030    0.47984 0.000 0.000 0.000 0.648 0.352
#> GSM875419     4  0.1671    0.71048 0.000 0.000 0.000 0.924 0.076
#> GSM875420     4  0.1792    0.70945 0.000 0.000 0.000 0.916 0.084
#> GSM875421     5  0.2153    0.87621 0.000 0.000 0.044 0.040 0.916
#> GSM875422     5  0.2153    0.87621 0.000 0.000 0.044 0.040 0.916
#> GSM875426     5  0.0771    0.84668 0.000 0.020 0.000 0.004 0.976
#> GSM875428     5  0.1792    0.85145 0.000 0.000 0.000 0.084 0.916
#> GSM875429     2  0.5678    0.55776 0.000 0.524 0.000 0.392 0.084
#> GSM875434     4  0.5275    0.41059 0.004 0.288 0.000 0.640 0.068
#> GSM875438     4  0.3550    0.64242 0.000 0.020 0.000 0.796 0.184
#> GSM875439     4  0.5757   -0.46942 0.000 0.416 0.000 0.496 0.088
#> GSM875440     5  0.1300    0.86033 0.000 0.016 0.000 0.028 0.956
#> GSM875441     4  0.0609    0.71700 0.000 0.000 0.000 0.980 0.020
#> GSM875442     2  0.5654    0.55963 0.000 0.536 0.000 0.380 0.084
#> GSM875446     4  0.6493    0.00798 0.000 0.248 0.000 0.492 0.260
#> GSM875448     4  0.0510    0.71507 0.000 0.000 0.000 0.984 0.016
#> GSM875453     4  0.0609    0.71700 0.000 0.000 0.000 0.980 0.020
#> GSM875455     2  0.5654    0.55963 0.000 0.536 0.000 0.380 0.084
#> GSM875459     2  0.5737    0.47588 0.000 0.464 0.000 0.452 0.084
#> GSM875460     4  0.3932    0.47872 0.000 0.000 0.000 0.672 0.328
#> GSM875463     4  0.0510    0.71507 0.000 0.000 0.000 0.984 0.016
#> GSM875464     4  0.0798    0.70842 0.000 0.008 0.000 0.976 0.016
#> GSM875466     5  0.3730    0.63542 0.000 0.000 0.288 0.000 0.712
#> GSM875473     5  0.7214    0.15519 0.052 0.036 0.420 0.056 0.436
#> GSM875474     2  0.5678    0.55776 0.000 0.524 0.000 0.392 0.084
#> GSM875478     2  0.5733    0.49810 0.000 0.476 0.000 0.440 0.084
#> GSM875479     4  0.1408    0.65541 0.000 0.044 0.000 0.948 0.008
#> GSM875480     5  0.2228    0.87512 0.000 0.000 0.040 0.048 0.912
#> GSM875481     5  0.0771    0.84668 0.000 0.020 0.000 0.004 0.976

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.2263     0.7818 0.900 0.060 0.000 0.000 0.004 0.036
#> GSM875415     1  0.2048     0.8225 0.880 0.000 0.000 0.000 0.000 0.120
#> GSM875416     6  0.3446     0.7482 0.308 0.000 0.000 0.000 0.000 0.692
#> GSM875417     3  0.1753     0.8932 0.000 0.004 0.912 0.000 0.000 0.084
#> GSM875418     1  0.2135     0.8187 0.872 0.000 0.000 0.000 0.000 0.128
#> GSM875423     6  0.3351     0.7611 0.288 0.000 0.000 0.000 0.000 0.712
#> GSM875424     6  0.3592     0.7019 0.344 0.000 0.000 0.000 0.000 0.656
#> GSM875425     6  0.1806     0.7885 0.088 0.004 0.000 0.000 0.000 0.908
#> GSM875430     1  0.2003     0.8247 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM875432     1  0.0909     0.7937 0.968 0.020 0.000 0.000 0.000 0.012
#> GSM875435     1  0.2003     0.8247 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM875436     1  0.4776     0.5573 0.712 0.184 0.000 0.068 0.000 0.036
#> GSM875437     1  0.1802     0.8192 0.916 0.012 0.000 0.000 0.000 0.072
#> GSM875447     1  0.2003     0.8235 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM875451     1  0.2003     0.8247 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM875456     1  0.2092     0.8210 0.876 0.000 0.000 0.000 0.000 0.124
#> GSM875461     1  0.2191     0.8192 0.876 0.000 0.000 0.000 0.004 0.120
#> GSM875462     1  0.4008     0.5053 0.672 0.016 0.000 0.000 0.004 0.308
#> GSM875465     6  0.2003     0.7949 0.116 0.000 0.000 0.000 0.000 0.884
#> GSM875469     6  0.3756     0.6811 0.352 0.000 0.000 0.000 0.004 0.644
#> GSM875470     6  0.1732     0.7813 0.072 0.004 0.004 0.000 0.000 0.920
#> GSM875471     6  0.2437     0.7192 0.036 0.004 0.072 0.000 0.000 0.888
#> GSM875472     1  0.5167     0.4016 0.620 0.060 0.000 0.020 0.004 0.296
#> GSM875475     1  0.1701     0.8245 0.920 0.008 0.000 0.000 0.000 0.072
#> GSM875476     1  0.2744     0.6954 0.840 0.144 0.000 0.000 0.000 0.016
#> GSM875477     1  0.1844     0.7863 0.924 0.048 0.000 0.000 0.004 0.024
#> GSM875414     5  0.1401     0.8560 0.000 0.020 0.000 0.028 0.948 0.004
#> GSM875427     3  0.1398     0.9209 0.000 0.000 0.940 0.000 0.052 0.008
#> GSM875431     5  0.1364     0.8601 0.000 0.020 0.000 0.016 0.952 0.012
#> GSM875433     5  0.1769     0.8475 0.000 0.060 0.004 0.000 0.924 0.012
#> GSM875443     3  0.3508     0.6224 0.000 0.004 0.704 0.000 0.000 0.292
#> GSM875444     3  0.0000     0.9531 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875445     3  0.1268     0.9315 0.000 0.004 0.952 0.000 0.036 0.008
#> GSM875449     3  0.0146     0.9533 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875450     3  0.0000     0.9531 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.0520     0.9490 0.000 0.000 0.984 0.000 0.008 0.008
#> GSM875454     5  0.1579     0.8560 0.000 0.020 0.024 0.008 0.944 0.004
#> GSM875457     3  0.0146     0.9533 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875458     3  0.0146     0.9533 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875467     3  0.0146     0.9524 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM875468     3  0.0146     0.9533 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875412     4  0.4380     0.5440 0.000 0.012 0.000 0.652 0.312 0.024
#> GSM875419     4  0.1679     0.8335 0.000 0.016 0.000 0.936 0.036 0.012
#> GSM875420     4  0.1194     0.8366 0.000 0.004 0.000 0.956 0.032 0.008
#> GSM875421     5  0.0146     0.8647 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM875422     5  0.0291     0.8649 0.000 0.004 0.004 0.000 0.992 0.000
#> GSM875426     5  0.1745     0.8438 0.000 0.068 0.000 0.000 0.920 0.012
#> GSM875428     5  0.0603     0.8634 0.000 0.004 0.000 0.016 0.980 0.000
#> GSM875429     2  0.2219     0.8808 0.000 0.864 0.000 0.136 0.000 0.000
#> GSM875434     4  0.6059     0.5385 0.172 0.128 0.000 0.628 0.016 0.056
#> GSM875438     4  0.4589     0.6326 0.000 0.088 0.000 0.720 0.176 0.016
#> GSM875439     2  0.3716     0.7944 0.000 0.732 0.000 0.248 0.012 0.008
#> GSM875440     5  0.2282     0.8367 0.000 0.068 0.000 0.020 0.900 0.012
#> GSM875441     4  0.0551     0.8390 0.000 0.004 0.000 0.984 0.008 0.004
#> GSM875442     2  0.1663     0.8705 0.000 0.912 0.000 0.088 0.000 0.000
#> GSM875446     2  0.5781     0.5179 0.000 0.524 0.000 0.304 0.164 0.008
#> GSM875448     4  0.0291     0.8367 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM875453     4  0.0405     0.8367 0.000 0.008 0.000 0.988 0.000 0.004
#> GSM875455     2  0.1501     0.8609 0.000 0.924 0.000 0.076 0.000 0.000
#> GSM875459     2  0.2989     0.8674 0.000 0.812 0.000 0.176 0.004 0.008
#> GSM875460     4  0.3486     0.7155 0.000 0.024 0.000 0.788 0.180 0.008
#> GSM875463     4  0.0146     0.8370 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM875464     4  0.1219     0.8208 0.000 0.048 0.000 0.948 0.004 0.000
#> GSM875466     5  0.4312     0.3519 0.000 0.008 0.396 0.000 0.584 0.012
#> GSM875473     5  0.7216     0.0492 0.000 0.036 0.336 0.024 0.344 0.260
#> GSM875474     2  0.1765     0.8744 0.000 0.904 0.000 0.096 0.000 0.000
#> GSM875478     2  0.2491     0.8759 0.000 0.836 0.000 0.164 0.000 0.000
#> GSM875479     4  0.2053     0.7674 0.000 0.108 0.000 0.888 0.004 0.000
#> GSM875480     5  0.1312     0.8620 0.000 0.020 0.004 0.008 0.956 0.012
#> GSM875481     5  0.1802     0.8413 0.000 0.072 0.000 0.000 0.916 0.012

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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) k
#> MAD:skmeans 63         1.31e-13 2
#> MAD:skmeans 69         7.95e-21 3
#> MAD:skmeans 63         8.03e-20 4
#> MAD:skmeans 59         6.95e-17 5
#> MAD:skmeans 67         5.96e-19 6

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


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

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.856           0.919       0.965         0.4699 0.543   0.543
#> 3 3 0.924           0.917       0.964         0.4344 0.762   0.569
#> 4 4 0.918           0.917       0.963         0.0892 0.934   0.799
#> 5 5 0.763           0.680       0.832         0.0708 0.887   0.623
#> 6 6 0.817           0.802       0.897         0.0505 0.914   0.641

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM875413     1  0.0000      0.981 1.000 0.000
#> GSM875415     1  0.0000      0.981 1.000 0.000
#> GSM875416     1  0.0000      0.981 1.000 0.000
#> GSM875417     2  0.8144      0.687 0.252 0.748
#> GSM875418     1  0.0000      0.981 1.000 0.000
#> GSM875423     1  0.0000      0.981 1.000 0.000
#> GSM875424     1  0.0000      0.981 1.000 0.000
#> GSM875425     1  0.0000      0.981 1.000 0.000
#> GSM875430     1  0.0000      0.981 1.000 0.000
#> GSM875432     1  0.0000      0.981 1.000 0.000
#> GSM875435     1  0.0000      0.981 1.000 0.000
#> GSM875436     1  0.0000      0.981 1.000 0.000
#> GSM875437     1  0.0000      0.981 1.000 0.000
#> GSM875447     1  0.0000      0.981 1.000 0.000
#> GSM875451     1  0.0000      0.981 1.000 0.000
#> GSM875456     1  0.0000      0.981 1.000 0.000
#> GSM875461     1  0.0000      0.981 1.000 0.000
#> GSM875462     1  0.0000      0.981 1.000 0.000
#> GSM875465     2  0.9661      0.415 0.392 0.608
#> GSM875469     1  0.0000      0.981 1.000 0.000
#> GSM875470     2  0.7950      0.705 0.240 0.760
#> GSM875471     2  0.5629      0.834 0.132 0.868
#> GSM875472     1  0.0672      0.974 0.992 0.008
#> GSM875475     1  0.0000      0.981 1.000 0.000
#> GSM875476     1  0.0000      0.981 1.000 0.000
#> GSM875477     1  0.0000      0.981 1.000 0.000
#> GSM875414     2  0.0000      0.954 0.000 1.000
#> GSM875427     2  0.0000      0.954 0.000 1.000
#> GSM875431     2  0.0000      0.954 0.000 1.000
#> GSM875433     2  0.0000      0.954 0.000 1.000
#> GSM875443     2  0.6712      0.788 0.176 0.824
#> GSM875444     2  0.0672      0.948 0.008 0.992
#> GSM875445     2  0.0000      0.954 0.000 1.000
#> GSM875449     2  0.0000      0.954 0.000 1.000
#> GSM875450     2  0.0000      0.954 0.000 1.000
#> GSM875452     2  0.0000      0.954 0.000 1.000
#> GSM875454     2  0.0000      0.954 0.000 1.000
#> GSM875457     2  0.0000      0.954 0.000 1.000
#> GSM875458     2  0.0000      0.954 0.000 1.000
#> GSM875467     2  0.0000      0.954 0.000 1.000
#> GSM875468     2  0.0000      0.954 0.000 1.000
#> GSM875412     2  0.0000      0.954 0.000 1.000
#> GSM875419     2  0.0000      0.954 0.000 1.000
#> GSM875420     2  0.0000      0.954 0.000 1.000
#> GSM875421     2  0.0000      0.954 0.000 1.000
#> GSM875422     2  0.0000      0.954 0.000 1.000
#> GSM875426     2  0.0000      0.954 0.000 1.000
#> GSM875428     2  0.0000      0.954 0.000 1.000
#> GSM875429     1  0.8608      0.597 0.716 0.284
#> GSM875434     2  0.9944      0.200 0.456 0.544
#> GSM875438     2  0.0000      0.954 0.000 1.000
#> GSM875439     2  0.0000      0.954 0.000 1.000
#> GSM875440     2  0.0000      0.954 0.000 1.000
#> GSM875441     2  0.0000      0.954 0.000 1.000
#> GSM875442     2  0.9286      0.489 0.344 0.656
#> GSM875446     2  0.0000      0.954 0.000 1.000
#> GSM875448     2  0.0000      0.954 0.000 1.000
#> GSM875453     2  0.0000      0.954 0.000 1.000
#> GSM875455     1  0.5294      0.852 0.880 0.120
#> GSM875459     2  0.0000      0.954 0.000 1.000
#> GSM875460     2  0.0000      0.954 0.000 1.000
#> GSM875463     2  0.0000      0.954 0.000 1.000
#> GSM875464     2  0.0000      0.954 0.000 1.000
#> GSM875466     2  0.0000      0.954 0.000 1.000
#> GSM875473     2  0.0000      0.954 0.000 1.000
#> GSM875474     2  0.0672      0.948 0.008 0.992
#> GSM875478     2  0.0000      0.954 0.000 1.000
#> GSM875479     2  0.0000      0.954 0.000 1.000
#> GSM875480     2  0.0000      0.954 0.000 1.000
#> GSM875481     2  0.0000      0.954 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
#> GSM875413     1  0.2796      0.874 0.908 0.092 0.000
#> GSM875415     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875417     3  0.1753      0.944 0.048 0.000 0.952
#> GSM875418     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875423     1  0.0592      0.922 0.988 0.000 0.012
#> GSM875424     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875425     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875430     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875436     1  0.2959      0.866 0.900 0.100 0.000
#> GSM875437     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875462     1  0.1031      0.917 0.976 0.024 0.000
#> GSM875465     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875469     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875470     3  0.2959      0.892 0.100 0.000 0.900
#> GSM875471     3  0.0237      0.979 0.004 0.000 0.996
#> GSM875472     1  0.6235      0.315 0.564 0.436 0.000
#> GSM875475     1  0.0000      0.929 1.000 0.000 0.000
#> GSM875476     1  0.2796      0.873 0.908 0.092 0.000
#> GSM875477     1  0.2356      0.888 0.928 0.072 0.000
#> GSM875414     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875427     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875431     2  0.0424      0.966 0.000 0.992 0.008
#> GSM875433     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875443     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875454     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875457     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875421     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875422     3  0.4555      0.752 0.000 0.200 0.800
#> GSM875426     3  0.1163      0.960 0.000 0.028 0.972
#> GSM875428     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875429     1  0.6126      0.413 0.600 0.400 0.000
#> GSM875434     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875438     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875455     1  0.6126      0.413 0.600 0.400 0.000
#> GSM875459     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875460     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875463     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.981 0.000 0.000 1.000
#> GSM875473     3  0.0237      0.979 0.000 0.004 0.996
#> GSM875474     2  0.5678      0.460 0.316 0.684 0.000
#> GSM875478     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.973 0.000 1.000 0.000
#> GSM875480     2  0.4555      0.732 0.000 0.800 0.200
#> GSM875481     3  0.0747      0.970 0.000 0.016 0.984

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.2216      0.889 0.908 0.000 0.000 0.092
#> GSM875415     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875417     3  0.1389      0.923 0.048 0.000 0.952 0.000
#> GSM875418     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875423     1  0.1389      0.912 0.952 0.000 0.048 0.000
#> GSM875424     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875425     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875430     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875436     1  0.2530      0.869 0.888 0.000 0.000 0.112
#> GSM875437     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875462     1  0.0817      0.940 0.976 0.000 0.000 0.024
#> GSM875465     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875469     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875470     3  0.2530      0.853 0.112 0.000 0.888 0.000
#> GSM875471     3  0.0592      0.951 0.016 0.000 0.984 0.000
#> GSM875472     1  0.4941      0.290 0.564 0.000 0.000 0.436
#> GSM875475     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM875476     1  0.2676      0.880 0.896 0.012 0.000 0.092
#> GSM875477     1  0.1867      0.905 0.928 0.000 0.000 0.072
#> GSM875414     4  0.0592      0.942 0.000 0.000 0.016 0.984
#> GSM875427     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875431     4  0.1474      0.908 0.000 0.000 0.052 0.948
#> GSM875433     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875443     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875449     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875454     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875457     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875412     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875419     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875420     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875421     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875422     3  0.3907      0.690 0.000 0.000 0.768 0.232
#> GSM875426     3  0.4284      0.730 0.000 0.200 0.780 0.020
#> GSM875428     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875429     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM875434     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875438     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875439     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM875440     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875441     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875442     2  0.3610      0.752 0.000 0.800 0.000 0.200
#> GSM875446     2  0.3123      0.801 0.000 0.844 0.000 0.156
#> GSM875448     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875453     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875455     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM875459     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM875460     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875463     4  0.0000      0.954 0.000 0.000 0.000 1.000
#> GSM875464     4  0.2345      0.867 0.000 0.100 0.000 0.900
#> GSM875466     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM875473     3  0.0188      0.961 0.000 0.000 0.996 0.004
#> GSM875474     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM875478     2  0.0000      0.945 0.000 1.000 0.000 0.000
#> GSM875479     4  0.3610      0.741 0.000 0.200 0.000 0.800
#> GSM875480     4  0.4040      0.650 0.000 0.000 0.248 0.752
#> GSM875481     3  0.1975      0.916 0.000 0.048 0.936 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.2074      0.799 0.896 0.000 0.000 0.104 0.000
#> GSM875415     1  0.0000      0.883 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.1851      0.812 0.912 0.000 0.000 0.000 0.088
#> GSM875417     3  0.0898      0.811 0.020 0.000 0.972 0.000 0.008
#> GSM875418     1  0.0162      0.881 0.996 0.000 0.000 0.000 0.004
#> GSM875423     1  0.5778     -0.160 0.460 0.000 0.452 0.000 0.088
#> GSM875424     1  0.0000      0.883 1.000 0.000 0.000 0.000 0.000
#> GSM875425     5  0.4294      0.393 0.468 0.000 0.000 0.000 0.532
#> GSM875430     1  0.0000      0.883 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0880      0.874 0.968 0.000 0.000 0.000 0.032
#> GSM875435     1  0.0000      0.883 1.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.2824      0.785 0.872 0.000 0.000 0.096 0.032
#> GSM875437     1  0.0880      0.874 0.968 0.000 0.000 0.000 0.032
#> GSM875447     1  0.0000      0.883 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.883 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.1851      0.812 0.912 0.000 0.000 0.000 0.088
#> GSM875461     1  0.0510      0.876 0.984 0.000 0.000 0.000 0.016
#> GSM875462     5  0.4682      0.417 0.420 0.000 0.000 0.016 0.564
#> GSM875465     5  0.4297      0.388 0.472 0.000 0.000 0.000 0.528
#> GSM875469     1  0.1851      0.812 0.912 0.000 0.000 0.000 0.088
#> GSM875470     5  0.6089      0.396 0.144 0.000 0.324 0.000 0.532
#> GSM875471     5  0.5700      0.281 0.088 0.000 0.380 0.000 0.532
#> GSM875472     5  0.4709     -0.295 0.024 0.000 0.000 0.364 0.612
#> GSM875475     1  0.0880      0.874 0.968 0.000 0.000 0.000 0.032
#> GSM875476     1  0.2712      0.796 0.880 0.000 0.000 0.088 0.032
#> GSM875477     1  0.2473      0.815 0.896 0.000 0.000 0.072 0.032
#> GSM875414     4  0.4058      0.599 0.000 0.000 0.064 0.784 0.152
#> GSM875427     3  0.2426      0.785 0.000 0.000 0.900 0.036 0.064
#> GSM875431     3  0.5102      0.442 0.000 0.000 0.580 0.376 0.044
#> GSM875433     3  0.2377      0.768 0.000 0.000 0.872 0.000 0.128
#> GSM875443     3  0.4268      0.091 0.000 0.000 0.556 0.000 0.444
#> GSM875444     3  0.0000      0.827 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.0000      0.827 0.000 0.000 1.000 0.000 0.000
#> GSM875449     3  0.0000      0.827 0.000 0.000 1.000 0.000 0.000
#> GSM875450     3  0.0000      0.827 0.000 0.000 1.000 0.000 0.000
#> GSM875452     3  0.0000      0.827 0.000 0.000 1.000 0.000 0.000
#> GSM875454     3  0.6023      0.504 0.000 0.000 0.572 0.260 0.168
#> GSM875457     3  0.0162      0.825 0.000 0.000 0.996 0.000 0.004
#> GSM875458     3  0.0000      0.827 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0000      0.827 0.000 0.000 1.000 0.000 0.000
#> GSM875468     3  0.0000      0.827 0.000 0.000 1.000 0.000 0.000
#> GSM875412     4  0.0000      0.738 0.000 0.000 0.000 1.000 0.000
#> GSM875419     4  0.0000      0.738 0.000 0.000 0.000 1.000 0.000
#> GSM875420     4  0.0000      0.738 0.000 0.000 0.000 1.000 0.000
#> GSM875421     3  0.6337      0.469 0.000 0.000 0.524 0.260 0.216
#> GSM875422     4  0.6023      0.293 0.000 0.000 0.248 0.576 0.176
#> GSM875426     2  0.7600      0.433 0.000 0.476 0.088 0.260 0.176
#> GSM875428     4  0.2891      0.637 0.000 0.000 0.000 0.824 0.176
#> GSM875429     2  0.0162      0.799 0.000 0.996 0.000 0.000 0.004
#> GSM875434     4  0.4555      0.695 0.068 0.000 0.000 0.732 0.200
#> GSM875438     4  0.0000      0.738 0.000 0.000 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.800 0.000 1.000 0.000 0.000 0.000
#> GSM875440     4  0.2648      0.652 0.000 0.000 0.000 0.848 0.152
#> GSM875441     4  0.3561      0.736 0.000 0.000 0.000 0.740 0.260
#> GSM875442     2  0.3109      0.655 0.000 0.800 0.000 0.200 0.000
#> GSM875446     2  0.3906      0.595 0.000 0.704 0.000 0.292 0.004
#> GSM875448     4  0.3561      0.736 0.000 0.000 0.000 0.740 0.260
#> GSM875453     4  0.3707      0.735 0.000 0.000 0.000 0.716 0.284
#> GSM875455     2  0.0000      0.800 0.000 1.000 0.000 0.000 0.000
#> GSM875459     2  0.0000      0.800 0.000 1.000 0.000 0.000 0.000
#> GSM875460     4  0.3561      0.736 0.000 0.000 0.000 0.740 0.260
#> GSM875463     4  0.3561      0.736 0.000 0.000 0.000 0.740 0.260
#> GSM875464     4  0.5382      0.695 0.000 0.100 0.000 0.640 0.260
#> GSM875466     3  0.1544      0.805 0.000 0.000 0.932 0.000 0.068
#> GSM875473     3  0.2732      0.738 0.000 0.000 0.840 0.000 0.160
#> GSM875474     2  0.0000      0.800 0.000 1.000 0.000 0.000 0.000
#> GSM875478     2  0.0000      0.800 0.000 1.000 0.000 0.000 0.000
#> GSM875479     4  0.6244      0.601 0.000 0.200 0.000 0.540 0.260
#> GSM875480     3  0.5036      0.537 0.000 0.000 0.628 0.320 0.052
#> GSM875481     2  0.8057      0.230 0.000 0.352 0.124 0.352 0.172

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.2092      0.830 0.876 0.000 0.000 0.124 0.000 0.000
#> GSM875415     1  0.0146      0.903 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM875416     1  0.1501      0.860 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM875417     3  0.0508      0.894 0.012 0.000 0.984 0.000 0.000 0.004
#> GSM875418     1  0.0146      0.903 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM875423     3  0.4166      0.590 0.196 0.000 0.728 0.000 0.000 0.076
#> GSM875424     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875425     6  0.2491      0.869 0.164 0.000 0.000 0.000 0.000 0.836
#> GSM875430     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.2491      0.856 0.836 0.000 0.000 0.000 0.000 0.164
#> GSM875435     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.2491      0.856 0.836 0.000 0.000 0.000 0.000 0.164
#> GSM875437     1  0.2491      0.856 0.836 0.000 0.000 0.000 0.000 0.164
#> GSM875447     1  0.0260      0.902 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875451     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.1501      0.860 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM875461     1  0.0547      0.897 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM875462     6  0.0146      0.739 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM875465     6  0.2527      0.868 0.168 0.000 0.000 0.000 0.000 0.832
#> GSM875469     1  0.1501      0.860 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM875470     6  0.2491      0.869 0.164 0.000 0.000 0.000 0.000 0.836
#> GSM875471     6  0.2949      0.864 0.140 0.000 0.028 0.000 0.000 0.832
#> GSM875472     4  0.3979      0.360 0.012 0.000 0.000 0.628 0.000 0.360
#> GSM875475     1  0.2491      0.856 0.836 0.000 0.000 0.000 0.000 0.164
#> GSM875476     1  0.2491      0.856 0.836 0.000 0.000 0.000 0.000 0.164
#> GSM875477     1  0.2491      0.856 0.836 0.000 0.000 0.000 0.000 0.164
#> GSM875414     5  0.0632      0.955 0.000 0.000 0.000 0.024 0.976 0.000
#> GSM875427     5  0.2092      0.846 0.000 0.000 0.124 0.000 0.876 0.000
#> GSM875431     3  0.3520      0.732 0.000 0.000 0.776 0.036 0.188 0.000
#> GSM875433     3  0.3151      0.691 0.000 0.000 0.748 0.000 0.252 0.000
#> GSM875443     6  0.3244      0.599 0.000 0.000 0.268 0.000 0.000 0.732
#> GSM875444     3  0.0000      0.902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875445     3  0.0000      0.902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875449     3  0.0000      0.902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875450     3  0.0000      0.902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.0000      0.902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875454     5  0.0363      0.965 0.000 0.000 0.012 0.000 0.988 0.000
#> GSM875457     3  0.0146      0.900 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM875458     3  0.0000      0.902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875467     3  0.0000      0.902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875468     3  0.0000      0.902 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     4  0.3737      0.463 0.000 0.000 0.000 0.608 0.392 0.000
#> GSM875419     4  0.3737      0.463 0.000 0.000 0.000 0.608 0.392 0.000
#> GSM875420     4  0.3737      0.463 0.000 0.000 0.000 0.608 0.392 0.000
#> GSM875421     5  0.0458      0.963 0.000 0.000 0.016 0.000 0.984 0.000
#> GSM875422     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM875426     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM875428     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM875429     2  0.0146      0.891 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM875434     4  0.4334      0.317 0.024 0.000 0.000 0.568 0.000 0.408
#> GSM875438     4  0.3737      0.463 0.000 0.000 0.000 0.608 0.392 0.000
#> GSM875439     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875440     5  0.0865      0.943 0.000 0.000 0.000 0.036 0.964 0.000
#> GSM875441     4  0.0000      0.731 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875442     2  0.2793      0.680 0.000 0.800 0.000 0.200 0.000 0.000
#> GSM875446     2  0.3890      0.266 0.000 0.596 0.000 0.004 0.400 0.000
#> GSM875448     4  0.0000      0.731 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875453     4  0.0865      0.723 0.000 0.000 0.000 0.964 0.036 0.000
#> GSM875455     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875459     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875460     4  0.0000      0.731 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875463     4  0.0000      0.731 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM875464     4  0.1814      0.682 0.000 0.100 0.000 0.900 0.000 0.000
#> GSM875466     3  0.1444      0.865 0.000 0.000 0.928 0.000 0.072 0.000
#> GSM875473     3  0.3802      0.673 0.000 0.000 0.748 0.000 0.044 0.208
#> GSM875474     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875478     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM875479     4  0.2793      0.582 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM875480     3  0.2912      0.739 0.000 0.000 0.784 0.000 0.216 0.000
#> GSM875481     5  0.0146      0.966 0.000 0.000 0.004 0.000 0.996 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) k
#> MAD:pam 67         4.94e-11 2
#> MAD:pam 66         4.47e-16 3
#> MAD:pam 69         6.18e-16 4
#> MAD:pam 57         1.81e-16 5
#> MAD:pam 63         3.20e-13 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 51941 rows and 70 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.258           0.345       0.619         0.3439 0.543   0.543
#> 3 3 0.857           0.925       0.958         0.8546 0.602   0.395
#> 4 4 0.700           0.769       0.844         0.1176 0.836   0.621
#> 5 5 0.687           0.708       0.799         0.0812 0.842   0.550
#> 6 6 0.712           0.603       0.799         0.0598 0.904   0.601

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
#> GSM875413     1  0.7674     0.4812 0.776 0.224
#> GSM875415     1  0.1414     0.4768 0.980 0.020
#> GSM875416     1  0.2043     0.4736 0.968 0.032
#> GSM875417     2  0.0376     0.5333 0.004 0.996
#> GSM875418     1  0.1633     0.4761 0.976 0.024
#> GSM875423     1  0.8144     0.4701 0.748 0.252
#> GSM875424     1  0.5519     0.4944 0.872 0.128
#> GSM875425     1  0.8144     0.4701 0.748 0.252
#> GSM875430     1  0.1414     0.4768 0.980 0.020
#> GSM875432     1  0.0000     0.4714 1.000 0.000
#> GSM875435     1  0.1184     0.4767 0.984 0.016
#> GSM875436     1  0.9248     0.4299 0.660 0.340
#> GSM875437     1  0.4690     0.4948 0.900 0.100
#> GSM875447     1  0.2043     0.4736 0.968 0.032
#> GSM875451     1  0.0000     0.4714 1.000 0.000
#> GSM875456     1  0.1184     0.4767 0.984 0.016
#> GSM875461     1  0.5737     0.4729 0.864 0.136
#> GSM875462     1  0.2603     0.4862 0.956 0.044
#> GSM875465     1  0.9710     0.3880 0.600 0.400
#> GSM875469     1  0.8144     0.4701 0.748 0.252
#> GSM875470     1  0.9996     0.2781 0.512 0.488
#> GSM875471     2  0.9815     0.0762 0.420 0.580
#> GSM875472     1  0.9944     0.3350 0.544 0.456
#> GSM875475     1  0.1184     0.4767 0.984 0.016
#> GSM875476     1  0.9170     0.4357 0.668 0.332
#> GSM875477     1  0.1633     0.4838 0.976 0.024
#> GSM875414     1  1.0000     0.2503 0.500 0.500
#> GSM875427     2  0.0000     0.5365 0.000 1.000
#> GSM875431     2  0.9775     0.1003 0.412 0.588
#> GSM875433     1  0.9983     0.3042 0.524 0.476
#> GSM875443     2  0.0000     0.5365 0.000 1.000
#> GSM875444     2  0.0000     0.5365 0.000 1.000
#> GSM875445     2  0.6973     0.4431 0.188 0.812
#> GSM875449     2  0.0000     0.5365 0.000 1.000
#> GSM875450     2  0.0000     0.5365 0.000 1.000
#> GSM875452     2  0.2603     0.5237 0.044 0.956
#> GSM875454     2  0.9754     0.1145 0.408 0.592
#> GSM875457     2  0.7139     0.4363 0.196 0.804
#> GSM875458     2  0.0000     0.5365 0.000 1.000
#> GSM875467     2  0.0376     0.5360 0.004 0.996
#> GSM875468     2  0.0000     0.5365 0.000 1.000
#> GSM875412     1  1.0000     0.2503 0.500 0.500
#> GSM875419     1  0.9996     0.2869 0.512 0.488
#> GSM875420     1  0.9970     0.3194 0.532 0.468
#> GSM875421     2  0.9754     0.1145 0.408 0.592
#> GSM875422     2  0.9732     0.1220 0.404 0.596
#> GSM875426     2  0.9977    -0.1826 0.472 0.528
#> GSM875428     2  0.9850     0.0320 0.428 0.572
#> GSM875429     1  0.9580     0.4119 0.620 0.380
#> GSM875434     1  0.9580     0.4173 0.620 0.380
#> GSM875438     1  0.9996     0.2869 0.512 0.488
#> GSM875439     1  0.9970     0.3194 0.532 0.468
#> GSM875440     2  1.0000    -0.2971 0.500 0.500
#> GSM875441     1  0.9970     0.3194 0.532 0.468
#> GSM875442     1  0.9580     0.4119 0.620 0.380
#> GSM875446     1  0.9970     0.3194 0.532 0.468
#> GSM875448     1  0.9970     0.3194 0.532 0.468
#> GSM875453     1  0.9970     0.3194 0.532 0.468
#> GSM875455     1  0.9552     0.4162 0.624 0.376
#> GSM875459     1  0.9970     0.3194 0.532 0.468
#> GSM875460     1  1.0000     0.2503 0.500 0.500
#> GSM875463     1  0.9970     0.3194 0.532 0.468
#> GSM875464     1  0.9970     0.3194 0.532 0.468
#> GSM875466     2  0.9963    -0.1481 0.464 0.536
#> GSM875473     2  1.0000    -0.2971 0.500 0.500
#> GSM875474     1  0.9580     0.4119 0.620 0.380
#> GSM875478     1  0.9970     0.3194 0.532 0.468
#> GSM875479     1  0.9970     0.3194 0.532 0.468
#> GSM875480     2  0.9754     0.1145 0.408 0.592
#> GSM875481     2  0.9866     0.0124 0.432 0.568

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM875413     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875415     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875417     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875418     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875423     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875424     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875425     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875430     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875436     2  0.4842      0.733 0.224 0.776 0.000
#> GSM875437     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875465     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875469     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875470     1  0.0747      0.971 0.984 0.000 0.016
#> GSM875471     1  0.5058      0.637 0.756 0.000 0.244
#> GSM875472     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875475     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875476     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875477     1  0.0000      0.987 1.000 0.000 0.000
#> GSM875414     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875427     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875431     2  0.4931      0.779 0.000 0.768 0.232
#> GSM875433     2  0.4974      0.775 0.000 0.764 0.236
#> GSM875443     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875445     3  0.1031      0.972 0.000 0.024 0.976
#> GSM875449     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875454     2  0.4974      0.775 0.000 0.764 0.236
#> GSM875457     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.997 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875421     2  0.4974      0.775 0.000 0.764 0.236
#> GSM875422     2  0.4974      0.775 0.000 0.764 0.236
#> GSM875426     2  0.2537      0.880 0.000 0.920 0.080
#> GSM875428     2  0.1289      0.902 0.000 0.968 0.032
#> GSM875429     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875434     2  0.4555      0.759 0.200 0.800 0.000
#> GSM875438     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875455     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875460     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875463     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875466     2  0.4974      0.775 0.000 0.764 0.236
#> GSM875473     2  0.4974      0.775 0.000 0.764 0.236
#> GSM875474     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.915 0.000 1.000 0.000
#> GSM875480     2  0.4974      0.775 0.000 0.764 0.236
#> GSM875481     2  0.4605      0.801 0.000 0.796 0.204

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.3764      0.794 0.784 0.000 0.000 0.216
#> GSM875415     1  0.1637      0.907 0.940 0.000 0.000 0.060
#> GSM875416     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM875417     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875418     1  0.1637      0.907 0.940 0.000 0.000 0.060
#> GSM875423     1  0.0336      0.917 0.992 0.000 0.000 0.008
#> GSM875424     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM875425     1  0.0336      0.917 0.992 0.000 0.000 0.008
#> GSM875430     1  0.0921      0.914 0.972 0.000 0.000 0.028
#> GSM875432     1  0.0592      0.915 0.984 0.000 0.000 0.016
#> GSM875435     1  0.1637      0.907 0.940 0.000 0.000 0.060
#> GSM875436     1  0.7731      0.187 0.428 0.240 0.000 0.332
#> GSM875437     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM875447     1  0.1637      0.907 0.940 0.000 0.000 0.060
#> GSM875451     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM875456     1  0.1637      0.907 0.940 0.000 0.000 0.060
#> GSM875461     1  0.0000      0.918 1.000 0.000 0.000 0.000
#> GSM875462     1  0.0336      0.917 0.992 0.000 0.000 0.008
#> GSM875465     1  0.0188      0.917 0.996 0.000 0.000 0.004
#> GSM875469     1  0.0336      0.917 0.992 0.000 0.000 0.008
#> GSM875470     1  0.4781      0.456 0.660 0.000 0.336 0.004
#> GSM875471     3  0.4018      0.687 0.224 0.000 0.772 0.004
#> GSM875472     1  0.3528      0.813 0.808 0.000 0.000 0.192
#> GSM875475     1  0.1637      0.907 0.940 0.000 0.000 0.060
#> GSM875476     1  0.4522      0.664 0.680 0.000 0.000 0.320
#> GSM875477     1  0.0592      0.915 0.984 0.000 0.000 0.016
#> GSM875414     2  0.4057      0.687 0.000 0.816 0.152 0.032
#> GSM875427     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875431     3  0.5310      0.384 0.000 0.412 0.576 0.012
#> GSM875433     3  0.4697      0.658 0.000 0.296 0.696 0.008
#> GSM875443     3  0.0188      0.848 0.000 0.000 0.996 0.004
#> GSM875444     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0336      0.848 0.000 0.000 0.992 0.008
#> GSM875449     3  0.0188      0.849 0.000 0.000 0.996 0.004
#> GSM875450     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875454     3  0.4194      0.735 0.000 0.228 0.764 0.008
#> GSM875457     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> GSM875412     2  0.0707      0.768 0.000 0.980 0.000 0.020
#> GSM875419     2  0.3942      0.756 0.000 0.764 0.000 0.236
#> GSM875420     2  0.4761      0.725 0.000 0.628 0.000 0.372
#> GSM875421     3  0.4228      0.732 0.000 0.232 0.760 0.008
#> GSM875422     3  0.4792      0.621 0.000 0.312 0.680 0.008
#> GSM875426     2  0.2988      0.694 0.000 0.876 0.112 0.012
#> GSM875428     2  0.5427      0.666 0.000 0.736 0.164 0.100
#> GSM875429     2  0.4800      0.585 0.004 0.656 0.000 0.340
#> GSM875434     2  0.6822      0.674 0.140 0.608 0.004 0.248
#> GSM875438     2  0.0921      0.768 0.000 0.972 0.000 0.028
#> GSM875439     2  0.0921      0.762 0.000 0.972 0.000 0.028
#> GSM875440     2  0.0927      0.759 0.000 0.976 0.008 0.016
#> GSM875441     2  0.4624      0.735 0.000 0.660 0.000 0.340
#> GSM875442     2  0.4781      0.584 0.004 0.660 0.000 0.336
#> GSM875446     2  0.0469      0.765 0.000 0.988 0.000 0.012
#> GSM875448     2  0.4761      0.727 0.000 0.628 0.000 0.372
#> GSM875453     2  0.4877      0.710 0.000 0.592 0.000 0.408
#> GSM875455     2  0.4781      0.587 0.004 0.660 0.000 0.336
#> GSM875459     2  0.0817      0.761 0.000 0.976 0.000 0.024
#> GSM875460     2  0.4220      0.754 0.000 0.748 0.004 0.248
#> GSM875463     2  0.4761      0.725 0.000 0.628 0.000 0.372
#> GSM875464     2  0.4855      0.713 0.000 0.600 0.000 0.400
#> GSM875466     3  0.4319      0.734 0.000 0.228 0.760 0.012
#> GSM875473     3  0.4194      0.735 0.000 0.228 0.764 0.008
#> GSM875474     2  0.4781      0.584 0.004 0.660 0.000 0.336
#> GSM875478     2  0.0817      0.762 0.000 0.976 0.000 0.024
#> GSM875479     2  0.4898      0.706 0.000 0.584 0.000 0.416
#> GSM875480     3  0.4621      0.667 0.000 0.284 0.708 0.008
#> GSM875481     2  0.4690      0.439 0.000 0.712 0.276 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.5214     0.7717 0.748 0.076 0.000 0.100 0.076
#> GSM875415     1  0.2448     0.8505 0.892 0.088 0.000 0.020 0.000
#> GSM875416     1  0.0898     0.8711 0.972 0.020 0.000 0.000 0.008
#> GSM875417     3  0.0000     0.8905 0.000 0.000 1.000 0.000 0.000
#> GSM875418     1  0.2505     0.8499 0.888 0.092 0.000 0.020 0.000
#> GSM875423     1  0.3215     0.8354 0.852 0.092 0.000 0.000 0.056
#> GSM875424     1  0.0898     0.8716 0.972 0.020 0.000 0.000 0.008
#> GSM875425     1  0.3547     0.8286 0.836 0.100 0.000 0.004 0.060
#> GSM875430     1  0.0898     0.8701 0.972 0.020 0.000 0.008 0.000
#> GSM875432     1  0.1121     0.8654 0.956 0.044 0.000 0.000 0.000
#> GSM875435     1  0.2505     0.8499 0.888 0.092 0.000 0.020 0.000
#> GSM875436     2  0.4968     0.3888 0.300 0.652 0.000 0.004 0.044
#> GSM875437     1  0.0510     0.8703 0.984 0.016 0.000 0.000 0.000
#> GSM875447     1  0.2448     0.8505 0.892 0.088 0.000 0.020 0.000
#> GSM875451     1  0.0000     0.8702 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.2448     0.8505 0.892 0.088 0.000 0.020 0.000
#> GSM875461     1  0.1915     0.8629 0.928 0.040 0.000 0.000 0.032
#> GSM875462     1  0.0794     0.8690 0.972 0.028 0.000 0.000 0.000
#> GSM875465     1  0.2974     0.8419 0.868 0.080 0.000 0.000 0.052
#> GSM875469     1  0.3547     0.8286 0.836 0.100 0.000 0.004 0.060
#> GSM875470     1  0.6581     0.0720 0.456 0.056 0.424 0.000 0.064
#> GSM875471     3  0.4615     0.6213 0.208 0.012 0.736 0.000 0.044
#> GSM875472     1  0.5325     0.7661 0.740 0.076 0.000 0.100 0.084
#> GSM875475     1  0.2505     0.8499 0.888 0.092 0.000 0.020 0.000
#> GSM875476     1  0.4074     0.4776 0.636 0.364 0.000 0.000 0.000
#> GSM875477     1  0.1121     0.8654 0.956 0.044 0.000 0.000 0.000
#> GSM875414     5  0.2929     0.6365 0.000 0.000 0.008 0.152 0.840
#> GSM875427     3  0.0290     0.8901 0.000 0.000 0.992 0.000 0.008
#> GSM875431     5  0.5254     0.6430 0.000 0.000 0.272 0.084 0.644
#> GSM875433     5  0.5197     0.6719 0.000 0.072 0.156 0.040 0.732
#> GSM875443     3  0.0703     0.8747 0.000 0.000 0.976 0.000 0.024
#> GSM875444     3  0.0000     0.8905 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.1908     0.8207 0.000 0.000 0.908 0.000 0.092
#> GSM875449     3  0.0510     0.8875 0.000 0.000 0.984 0.000 0.016
#> GSM875450     3  0.0000     0.8905 0.000 0.000 1.000 0.000 0.000
#> GSM875452     3  0.0290     0.8901 0.000 0.000 0.992 0.000 0.008
#> GSM875454     5  0.5037     0.5595 0.000 0.000 0.336 0.048 0.616
#> GSM875457     3  0.0510     0.8871 0.000 0.000 0.984 0.000 0.016
#> GSM875458     3  0.0000     0.8905 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0162     0.8903 0.000 0.000 0.996 0.000 0.004
#> GSM875468     3  0.0000     0.8905 0.000 0.000 1.000 0.000 0.000
#> GSM875412     5  0.3602     0.5834 0.000 0.024 0.000 0.180 0.796
#> GSM875419     4  0.4794     0.4474 0.000 0.032 0.000 0.624 0.344
#> GSM875420     4  0.2280     0.8121 0.000 0.000 0.000 0.880 0.120
#> GSM875421     5  0.4768     0.6044 0.000 0.000 0.304 0.040 0.656
#> GSM875422     5  0.4342     0.6747 0.000 0.000 0.232 0.040 0.728
#> GSM875426     5  0.3643     0.6556 0.000 0.036 0.044 0.072 0.848
#> GSM875428     5  0.3918     0.6953 0.000 0.000 0.100 0.096 0.804
#> GSM875429     2  0.4693     0.7376 0.000 0.724 0.000 0.080 0.196
#> GSM875434     4  0.7861     0.2354 0.096 0.188 0.000 0.416 0.300
#> GSM875438     5  0.5400     0.3176 0.000 0.096 0.000 0.272 0.632
#> GSM875439     2  0.6721     0.5116 0.000 0.420 0.000 0.276 0.304
#> GSM875440     5  0.3361     0.6361 0.000 0.036 0.024 0.080 0.860
#> GSM875441     4  0.2074     0.8285 0.000 0.000 0.000 0.896 0.104
#> GSM875442     2  0.4581     0.7349 0.000 0.732 0.000 0.072 0.196
#> GSM875446     5  0.6374    -0.0647 0.000 0.208 0.000 0.280 0.512
#> GSM875448     4  0.1908     0.8335 0.000 0.000 0.000 0.908 0.092
#> GSM875453     4  0.1270     0.8237 0.000 0.000 0.000 0.948 0.052
#> GSM875455     2  0.4527     0.7330 0.000 0.732 0.000 0.064 0.204
#> GSM875459     2  0.6710     0.5180 0.000 0.424 0.000 0.272 0.304
#> GSM875460     5  0.3932     0.4150 0.000 0.000 0.000 0.328 0.672
#> GSM875463     4  0.1851     0.8343 0.000 0.000 0.000 0.912 0.088
#> GSM875464     4  0.1410     0.8287 0.000 0.000 0.000 0.940 0.060
#> GSM875466     3  0.5535    -0.0269 0.000 0.000 0.536 0.072 0.392
#> GSM875473     3  0.6174     0.3551 0.000 0.064 0.600 0.052 0.284
#> GSM875474     2  0.4693     0.7376 0.000 0.724 0.000 0.080 0.196
#> GSM875478     2  0.6423     0.5665 0.000 0.504 0.000 0.276 0.220
#> GSM875479     4  0.1557     0.8168 0.000 0.008 0.000 0.940 0.052
#> GSM875480     5  0.5002     0.5532 0.000 0.000 0.344 0.044 0.612
#> GSM875481     5  0.3553     0.6782 0.000 0.020 0.084 0.048 0.848

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     6  0.5343     0.2944 0.280 0.020 0.000 0.080 0.004 0.616
#> GSM875415     1  0.0000     0.7133 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.3867    -0.1513 0.512 0.000 0.000 0.000 0.000 0.488
#> GSM875417     3  0.0000     0.8785 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875418     1  0.0000     0.7133 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875423     6  0.3737     0.3845 0.392 0.000 0.000 0.000 0.000 0.608
#> GSM875424     1  0.3860    -0.0959 0.528 0.000 0.000 0.000 0.000 0.472
#> GSM875425     6  0.3309     0.5381 0.280 0.000 0.000 0.000 0.000 0.720
#> GSM875430     1  0.1910     0.7183 0.892 0.000 0.000 0.000 0.000 0.108
#> GSM875432     1  0.3715     0.6758 0.764 0.048 0.000 0.000 0.000 0.188
#> GSM875435     1  0.0000     0.7133 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875436     2  0.4271     0.4145 0.072 0.744 0.000 0.012 0.000 0.172
#> GSM875437     1  0.3520     0.6844 0.776 0.036 0.000 0.000 0.000 0.188
#> GSM875447     1  0.0000     0.7133 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.2664     0.6878 0.816 0.000 0.000 0.000 0.000 0.184
#> GSM875456     1  0.0000     0.7133 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.2912     0.6592 0.784 0.000 0.000 0.000 0.000 0.216
#> GSM875462     1  0.3555     0.6849 0.776 0.040 0.000 0.000 0.000 0.184
#> GSM875465     6  0.3937     0.3119 0.424 0.000 0.004 0.000 0.000 0.572
#> GSM875469     6  0.3288     0.5399 0.276 0.000 0.000 0.000 0.000 0.724
#> GSM875470     6  0.4239     0.4335 0.056 0.000 0.248 0.000 0.000 0.696
#> GSM875471     3  0.3867     0.0724 0.000 0.000 0.512 0.000 0.000 0.488
#> GSM875472     6  0.5288     0.3071 0.268 0.020 0.000 0.080 0.004 0.628
#> GSM875475     1  0.0146     0.7143 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM875476     2  0.5556    -0.0608 0.264 0.548 0.000 0.000 0.000 0.188
#> GSM875477     1  0.3715     0.6758 0.764 0.048 0.000 0.000 0.000 0.188
#> GSM875414     5  0.1257     0.7765 0.000 0.028 0.000 0.020 0.952 0.000
#> GSM875427     3  0.0000     0.8785 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875431     5  0.3607     0.7643 0.000 0.000 0.112 0.092 0.796 0.000
#> GSM875433     5  0.3371     0.7816 0.000 0.080 0.076 0.012 0.832 0.000
#> GSM875443     3  0.0260     0.8738 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM875444     3  0.0000     0.8785 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875445     3  0.3817     0.0829 0.000 0.000 0.568 0.000 0.432 0.000
#> GSM875449     3  0.0865     0.8521 0.000 0.000 0.964 0.000 0.036 0.000
#> GSM875450     3  0.0000     0.8785 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.0000     0.8785 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875454     5  0.5120     0.4220 0.000 0.000 0.380 0.088 0.532 0.000
#> GSM875457     3  0.3126     0.5592 0.000 0.000 0.752 0.000 0.248 0.000
#> GSM875458     3  0.0000     0.8785 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875467     3  0.0000     0.8785 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875468     3  0.0000     0.8785 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     5  0.4041     0.5798 0.000 0.096 0.000 0.136 0.764 0.004
#> GSM875419     4  0.5454     0.4522 0.000 0.192 0.000 0.572 0.236 0.000
#> GSM875420     4  0.1644     0.7450 0.000 0.028 0.000 0.932 0.040 0.000
#> GSM875421     5  0.2513     0.7791 0.000 0.000 0.140 0.008 0.852 0.000
#> GSM875422     5  0.1444     0.8001 0.000 0.000 0.072 0.000 0.928 0.000
#> GSM875426     5  0.1440     0.7754 0.000 0.044 0.004 0.004 0.944 0.004
#> GSM875428     5  0.1075     0.7984 0.000 0.000 0.048 0.000 0.952 0.000
#> GSM875429     2  0.1387     0.6716 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM875434     4  0.7199     0.1622 0.044 0.316 0.000 0.440 0.044 0.156
#> GSM875438     4  0.5896     0.3026 0.000 0.192 0.000 0.480 0.324 0.004
#> GSM875439     2  0.5767     0.4201 0.000 0.572 0.000 0.268 0.136 0.024
#> GSM875440     5  0.1851     0.7637 0.000 0.056 0.004 0.012 0.924 0.004
#> GSM875441     4  0.1616     0.7417 0.000 0.048 0.000 0.932 0.020 0.000
#> GSM875442     2  0.1204     0.6705 0.000 0.944 0.000 0.056 0.000 0.000
#> GSM875446     4  0.6346     0.2184 0.000 0.272 0.000 0.472 0.232 0.024
#> GSM875448     4  0.1341     0.7491 0.000 0.028 0.000 0.948 0.024 0.000
#> GSM875453     4  0.0717     0.7371 0.000 0.000 0.000 0.976 0.016 0.008
#> GSM875455     2  0.1411     0.6715 0.004 0.936 0.000 0.060 0.000 0.000
#> GSM875459     2  0.5767     0.4201 0.000 0.572 0.000 0.268 0.136 0.024
#> GSM875460     5  0.2872     0.7307 0.000 0.024 0.000 0.140 0.836 0.000
#> GSM875463     4  0.1168     0.7491 0.000 0.028 0.000 0.956 0.016 0.000
#> GSM875464     4  0.0508     0.7439 0.000 0.004 0.000 0.984 0.012 0.000
#> GSM875466     5  0.3446     0.5815 0.000 0.000 0.308 0.000 0.692 0.000
#> GSM875473     5  0.5974     0.3977 0.000 0.000 0.336 0.092 0.524 0.048
#> GSM875474     2  0.1387     0.6716 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM875478     2  0.5190     0.4247 0.000 0.592 0.000 0.280 0.128 0.000
#> GSM875479     4  0.0976     0.7321 0.000 0.008 0.000 0.968 0.016 0.008
#> GSM875480     5  0.4094     0.7374 0.000 0.000 0.168 0.088 0.744 0.000
#> GSM875481     5  0.0748     0.7851 0.000 0.016 0.004 0.000 0.976 0.004

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.939           0.920       0.970         0.5007 0.499   0.499
#> 3 3 0.960           0.935       0.973         0.3464 0.721   0.496
#> 4 4 0.818           0.837       0.924         0.1032 0.910   0.733
#> 5 5 0.804           0.790       0.906         0.0440 0.901   0.657
#> 6 6 0.750           0.585       0.806         0.0345 0.935   0.741

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
#> GSM875413     1   0.000      0.970 1.000 0.000
#> GSM875415     1   0.000      0.970 1.000 0.000
#> GSM875416     1   0.000      0.970 1.000 0.000
#> GSM875417     1   0.000      0.970 1.000 0.000
#> GSM875418     1   0.000      0.970 1.000 0.000
#> GSM875423     1   0.000      0.970 1.000 0.000
#> GSM875424     1   0.000      0.970 1.000 0.000
#> GSM875425     1   0.000      0.970 1.000 0.000
#> GSM875430     1   0.000      0.970 1.000 0.000
#> GSM875432     1   0.000      0.970 1.000 0.000
#> GSM875435     1   0.000      0.970 1.000 0.000
#> GSM875436     1   0.802      0.667 0.756 0.244
#> GSM875437     1   0.000      0.970 1.000 0.000
#> GSM875447     1   0.000      0.970 1.000 0.000
#> GSM875451     1   0.000      0.970 1.000 0.000
#> GSM875456     1   0.000      0.970 1.000 0.000
#> GSM875461     1   0.000      0.970 1.000 0.000
#> GSM875462     1   0.000      0.970 1.000 0.000
#> GSM875465     1   0.000      0.970 1.000 0.000
#> GSM875469     1   0.000      0.970 1.000 0.000
#> GSM875470     1   0.000      0.970 1.000 0.000
#> GSM875471     1   0.000      0.970 1.000 0.000
#> GSM875472     1   0.000      0.970 1.000 0.000
#> GSM875475     1   0.000      0.970 1.000 0.000
#> GSM875476     1   0.000      0.970 1.000 0.000
#> GSM875477     1   0.000      0.970 1.000 0.000
#> GSM875414     2   0.000      0.965 0.000 1.000
#> GSM875427     2   0.000      0.965 0.000 1.000
#> GSM875431     2   0.000      0.965 0.000 1.000
#> GSM875433     2   0.000      0.965 0.000 1.000
#> GSM875443     1   0.000      0.970 1.000 0.000
#> GSM875444     1   0.983      0.242 0.576 0.424
#> GSM875445     2   0.000      0.965 0.000 1.000
#> GSM875449     2   0.000      0.965 0.000 1.000
#> GSM875450     1   0.552      0.839 0.872 0.128
#> GSM875452     2   0.000      0.965 0.000 1.000
#> GSM875454     2   0.000      0.965 0.000 1.000
#> GSM875457     2   0.000      0.965 0.000 1.000
#> GSM875458     1   0.343      0.911 0.936 0.064
#> GSM875467     2   0.242      0.928 0.040 0.960
#> GSM875468     1   0.000      0.970 1.000 0.000
#> GSM875412     2   0.000      0.965 0.000 1.000
#> GSM875419     2   0.000      0.965 0.000 1.000
#> GSM875420     2   0.000      0.965 0.000 1.000
#> GSM875421     2   0.000      0.965 0.000 1.000
#> GSM875422     2   0.000      0.965 0.000 1.000
#> GSM875426     2   0.000      0.965 0.000 1.000
#> GSM875428     2   0.000      0.965 0.000 1.000
#> GSM875429     2   0.000      0.965 0.000 1.000
#> GSM875434     2   0.955      0.391 0.376 0.624
#> GSM875438     2   0.000      0.965 0.000 1.000
#> GSM875439     2   0.000      0.965 0.000 1.000
#> GSM875440     2   0.000      0.965 0.000 1.000
#> GSM875441     2   0.000      0.965 0.000 1.000
#> GSM875442     2   0.000      0.965 0.000 1.000
#> GSM875446     2   0.000      0.965 0.000 1.000
#> GSM875448     2   0.000      0.965 0.000 1.000
#> GSM875453     2   0.000      0.965 0.000 1.000
#> GSM875455     2   0.996      0.122 0.464 0.536
#> GSM875459     2   0.000      0.965 0.000 1.000
#> GSM875460     2   0.000      0.965 0.000 1.000
#> GSM875463     2   0.000      0.965 0.000 1.000
#> GSM875464     2   0.000      0.965 0.000 1.000
#> GSM875466     2   0.000      0.965 0.000 1.000
#> GSM875473     2   0.963      0.361 0.388 0.612
#> GSM875474     2   0.000      0.965 0.000 1.000
#> GSM875478     2   0.000      0.965 0.000 1.000
#> GSM875479     2   0.000      0.965 0.000 1.000
#> GSM875480     2   0.000      0.965 0.000 1.000
#> GSM875481     2   0.000      0.965 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
#> GSM875413     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875415     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875417     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875418     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875423     1  0.1031      0.970 0.976 0.000 0.024
#> GSM875424     1  0.1529      0.954 0.960 0.000 0.040
#> GSM875425     1  0.4121      0.802 0.832 0.000 0.168
#> GSM875430     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875436     2  0.6295      0.161 0.472 0.528 0.000
#> GSM875437     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875462     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875465     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875469     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875470     3  0.1643      0.952 0.044 0.000 0.956
#> GSM875471     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875472     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875475     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875476     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875477     1  0.0000      0.989 1.000 0.000 0.000
#> GSM875414     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875427     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875431     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875433     2  0.6291      0.164 0.000 0.532 0.468
#> GSM875443     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875454     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875457     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875421     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875422     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875426     2  0.0237      0.934 0.000 0.996 0.004
#> GSM875428     2  0.0892      0.923 0.000 0.980 0.020
#> GSM875429     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875434     2  0.5216      0.653 0.260 0.740 0.000
#> GSM875438     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875455     2  0.3686      0.812 0.140 0.860 0.000
#> GSM875459     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875460     2  0.0424      0.932 0.000 0.992 0.008
#> GSM875463     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875473     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875474     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.937 0.000 1.000 0.000
#> GSM875480     3  0.0000      0.998 0.000 0.000 1.000
#> GSM875481     2  0.5254      0.645 0.000 0.736 0.264

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875415     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875417     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875418     1  0.0188     0.9388 0.996 0.004 0.000 0.000
#> GSM875423     1  0.2469     0.8581 0.892 0.000 0.108 0.000
#> GSM875424     1  0.2334     0.8781 0.908 0.004 0.088 0.000
#> GSM875425     1  0.3610     0.7444 0.800 0.000 0.200 0.000
#> GSM875430     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0188     0.9388 0.996 0.004 0.000 0.000
#> GSM875435     1  0.0188     0.9388 0.996 0.004 0.000 0.000
#> GSM875436     1  0.2843     0.8542 0.892 0.088 0.000 0.020
#> GSM875437     1  0.0188     0.9388 0.996 0.004 0.000 0.000
#> GSM875447     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875462     1  0.0188     0.9388 0.996 0.004 0.000 0.000
#> GSM875465     1  0.1474     0.9050 0.948 0.000 0.052 0.000
#> GSM875469     1  0.0000     0.9391 1.000 0.000 0.000 0.000
#> GSM875470     3  0.2053     0.8861 0.072 0.000 0.924 0.004
#> GSM875471     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875472     1  0.4500     0.5543 0.684 0.000 0.000 0.316
#> GSM875475     1  0.0188     0.9388 0.996 0.004 0.000 0.000
#> GSM875476     1  0.4605     0.4979 0.664 0.336 0.000 0.000
#> GSM875477     1  0.0188     0.9388 0.996 0.004 0.000 0.000
#> GSM875414     2  0.6192     0.0502 0.000 0.512 0.052 0.436
#> GSM875427     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875431     3  0.3024     0.8342 0.000 0.000 0.852 0.148
#> GSM875433     2  0.1488     0.8241 0.000 0.956 0.032 0.012
#> GSM875443     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0469     0.9422 0.000 0.000 0.988 0.012
#> GSM875449     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875454     3  0.1474     0.9240 0.000 0.000 0.948 0.052
#> GSM875457     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000     0.9460 0.000 0.000 1.000 0.000
#> GSM875412     4  0.3486     0.7324 0.000 0.188 0.000 0.812
#> GSM875419     4  0.2149     0.8260 0.000 0.088 0.000 0.912
#> GSM875420     4  0.0336     0.8669 0.000 0.008 0.000 0.992
#> GSM875421     3  0.1389     0.9262 0.000 0.000 0.952 0.048
#> GSM875422     3  0.2334     0.8956 0.000 0.004 0.908 0.088
#> GSM875426     2  0.1109     0.8297 0.000 0.968 0.004 0.028
#> GSM875428     4  0.5213     0.6527 0.000 0.224 0.052 0.724
#> GSM875429     2  0.0707     0.8315 0.000 0.980 0.000 0.020
#> GSM875434     4  0.5600     0.3732 0.376 0.028 0.000 0.596
#> GSM875438     4  0.4304     0.6069 0.000 0.284 0.000 0.716
#> GSM875439     2  0.1302     0.8305 0.000 0.956 0.000 0.044
#> GSM875440     2  0.3873     0.6672 0.000 0.772 0.000 0.228
#> GSM875441     4  0.0000     0.8676 0.000 0.000 0.000 1.000
#> GSM875442     2  0.0376     0.8296 0.004 0.992 0.000 0.004
#> GSM875446     2  0.3837     0.6680 0.000 0.776 0.000 0.224
#> GSM875448     4  0.0000     0.8676 0.000 0.000 0.000 1.000
#> GSM875453     4  0.0000     0.8676 0.000 0.000 0.000 1.000
#> GSM875455     2  0.3638     0.7382 0.120 0.848 0.000 0.032
#> GSM875459     2  0.3400     0.7574 0.000 0.820 0.000 0.180
#> GSM875460     4  0.0469     0.8673 0.000 0.012 0.000 0.988
#> GSM875463     4  0.0188     0.8669 0.000 0.004 0.000 0.996
#> GSM875464     4  0.0336     0.8652 0.000 0.008 0.000 0.992
#> GSM875466     3  0.1488     0.9284 0.000 0.012 0.956 0.032
#> GSM875473     3  0.2647     0.8692 0.000 0.000 0.880 0.120
#> GSM875474     2  0.0188     0.8296 0.000 0.996 0.000 0.004
#> GSM875478     2  0.3726     0.7206 0.000 0.788 0.000 0.212
#> GSM875479     4  0.0817     0.8557 0.000 0.024 0.000 0.976
#> GSM875480     3  0.4925     0.2800 0.000 0.000 0.572 0.428
#> GSM875481     2  0.3257     0.7338 0.000 0.844 0.152 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
#> GSM875413     1  0.0162     0.9264 0.996 0.000 0.000 0.000 0.004
#> GSM875415     1  0.0162     0.9264 0.996 0.000 0.000 0.000 0.004
#> GSM875416     1  0.0451     0.9230 0.988 0.000 0.008 0.000 0.004
#> GSM875417     3  0.0000     0.9274 0.000 0.000 1.000 0.000 0.000
#> GSM875418     1  0.0000     0.9264 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.2798     0.8032 0.852 0.000 0.140 0.000 0.008
#> GSM875424     1  0.2570     0.8371 0.880 0.008 0.108 0.000 0.004
#> GSM875425     3  0.3647     0.6445 0.228 0.000 0.764 0.004 0.004
#> GSM875430     1  0.0162     0.9264 0.996 0.000 0.000 0.000 0.004
#> GSM875432     1  0.0162     0.9259 0.996 0.000 0.000 0.004 0.000
#> GSM875435     1  0.0162     0.9264 0.996 0.000 0.000 0.000 0.004
#> GSM875436     1  0.4321     0.3698 0.600 0.000 0.000 0.004 0.396
#> GSM875437     1  0.0000     0.9264 1.000 0.000 0.000 0.000 0.000
#> GSM875447     1  0.0162     0.9264 0.996 0.000 0.000 0.000 0.004
#> GSM875451     1  0.0162     0.9264 0.996 0.000 0.000 0.000 0.004
#> GSM875456     1  0.0162     0.9260 0.996 0.000 0.000 0.000 0.004
#> GSM875461     1  0.0162     0.9260 0.996 0.000 0.000 0.000 0.004
#> GSM875462     1  0.1256     0.9126 0.964 0.012 0.008 0.012 0.004
#> GSM875465     1  0.3812     0.7116 0.780 0.000 0.196 0.020 0.004
#> GSM875469     1  0.0579     0.9234 0.984 0.000 0.008 0.000 0.008
#> GSM875470     3  0.1865     0.8885 0.032 0.000 0.936 0.024 0.008
#> GSM875471     3  0.0613     0.9213 0.004 0.000 0.984 0.004 0.008
#> GSM875472     4  0.2753     0.7559 0.136 0.000 0.000 0.856 0.008
#> GSM875475     1  0.0000     0.9264 1.000 0.000 0.000 0.000 0.000
#> GSM875476     1  0.0510     0.9210 0.984 0.016 0.000 0.000 0.000
#> GSM875477     1  0.0162     0.9258 0.996 0.000 0.000 0.004 0.000
#> GSM875414     5  0.1798     0.7113 0.000 0.064 0.004 0.004 0.928
#> GSM875427     3  0.0703     0.9198 0.000 0.000 0.976 0.000 0.024
#> GSM875431     5  0.4449     0.0217 0.000 0.000 0.484 0.004 0.512
#> GSM875433     5  0.1571     0.7072 0.000 0.060 0.004 0.000 0.936
#> GSM875443     3  0.0000     0.9274 0.000 0.000 1.000 0.000 0.000
#> GSM875444     3  0.0000     0.9274 0.000 0.000 1.000 0.000 0.000
#> GSM875445     3  0.0510     0.9222 0.000 0.000 0.984 0.000 0.016
#> GSM875449     3  0.0000     0.9274 0.000 0.000 1.000 0.000 0.000
#> GSM875450     3  0.0162     0.9264 0.000 0.000 0.996 0.000 0.004
#> GSM875452     3  0.0162     0.9264 0.000 0.000 0.996 0.000 0.004
#> GSM875454     3  0.0703     0.9172 0.000 0.000 0.976 0.000 0.024
#> GSM875457     3  0.0000     0.9274 0.000 0.000 1.000 0.000 0.000
#> GSM875458     3  0.0000     0.9274 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0000     0.9274 0.000 0.000 1.000 0.000 0.000
#> GSM875468     3  0.0000     0.9274 0.000 0.000 1.000 0.000 0.000
#> GSM875412     5  0.0963     0.7113 0.000 0.000 0.000 0.036 0.964
#> GSM875419     4  0.4276     0.4017 0.000 0.004 0.000 0.616 0.380
#> GSM875420     4  0.2929     0.7585 0.000 0.000 0.000 0.820 0.180
#> GSM875421     3  0.0609     0.9201 0.000 0.000 0.980 0.000 0.020
#> GSM875422     3  0.3196     0.7386 0.000 0.000 0.804 0.004 0.192
#> GSM875426     5  0.4367     0.2184 0.000 0.416 0.004 0.000 0.580
#> GSM875428     5  0.1041     0.7135 0.000 0.004 0.000 0.032 0.964
#> GSM875429     2  0.1872     0.8395 0.000 0.928 0.000 0.052 0.020
#> GSM875434     1  0.6163     0.2549 0.536 0.000 0.000 0.300 0.164
#> GSM875438     5  0.2629     0.6494 0.000 0.004 0.000 0.136 0.860
#> GSM875439     2  0.3628     0.6565 0.000 0.772 0.000 0.012 0.216
#> GSM875440     5  0.1704     0.7092 0.000 0.068 0.000 0.004 0.928
#> GSM875441     4  0.1124     0.8915 0.000 0.004 0.000 0.960 0.036
#> GSM875442     2  0.0510     0.8360 0.000 0.984 0.000 0.000 0.016
#> GSM875446     5  0.4902     0.0481 0.000 0.468 0.000 0.024 0.508
#> GSM875448     4  0.0880     0.8935 0.000 0.000 0.000 0.968 0.032
#> GSM875453     4  0.0703     0.8949 0.000 0.000 0.000 0.976 0.024
#> GSM875455     2  0.0771     0.8386 0.004 0.976 0.000 0.020 0.000
#> GSM875459     2  0.2471     0.8101 0.000 0.864 0.000 0.136 0.000
#> GSM875460     4  0.0324     0.8942 0.000 0.004 0.004 0.992 0.000
#> GSM875463     4  0.0000     0.8949 0.000 0.000 0.000 1.000 0.000
#> GSM875464     4  0.0162     0.8943 0.000 0.004 0.000 0.996 0.000
#> GSM875466     5  0.3636     0.5274 0.000 0.000 0.272 0.000 0.728
#> GSM875473     3  0.3969     0.5774 0.000 0.000 0.692 0.304 0.004
#> GSM875474     2  0.0162     0.8374 0.000 0.996 0.000 0.000 0.004
#> GSM875478     2  0.2690     0.7914 0.000 0.844 0.000 0.156 0.000
#> GSM875479     4  0.0290     0.8926 0.000 0.008 0.000 0.992 0.000
#> GSM875480     3  0.4080     0.6422 0.000 0.000 0.728 0.252 0.020
#> GSM875481     2  0.5673     0.4544 0.000 0.628 0.216 0.000 0.156

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.1327     0.8350 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM875415     1  0.0858     0.8458 0.968 0.000 0.000 0.000 0.004 0.028
#> GSM875416     1  0.1075     0.8385 0.952 0.000 0.000 0.000 0.000 0.048
#> GSM875417     3  0.0260     0.7805 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM875418     1  0.1075     0.8406 0.952 0.000 0.000 0.000 0.000 0.048
#> GSM875423     3  0.4624     0.1088 0.432 0.000 0.528 0.000 0.000 0.040
#> GSM875424     1  0.2924     0.7533 0.840 0.012 0.136 0.000 0.000 0.012
#> GSM875425     1  0.5209     0.3028 0.564 0.000 0.324 0.000 0.000 0.112
#> GSM875430     1  0.1007     0.8435 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM875432     1  0.0405     0.8493 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM875435     1  0.0508     0.8489 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM875436     1  0.5848     0.0397 0.428 0.000 0.000 0.000 0.380 0.192
#> GSM875437     1  0.1644     0.8257 0.920 0.000 0.000 0.000 0.004 0.076
#> GSM875447     1  0.0508     0.8493 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM875451     1  0.0713     0.8459 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM875456     1  0.0260     0.8483 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875461     1  0.0713     0.8468 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM875462     1  0.4595     0.5706 0.676 0.040 0.000 0.020 0.000 0.264
#> GSM875465     1  0.4330     0.5792 0.708 0.000 0.232 0.052 0.000 0.008
#> GSM875469     1  0.0909     0.8469 0.968 0.000 0.012 0.000 0.000 0.020
#> GSM875470     6  0.6140    -0.1059 0.136 0.000 0.404 0.028 0.000 0.432
#> GSM875471     3  0.4382     0.4837 0.032 0.016 0.688 0.000 0.000 0.264
#> GSM875472     4  0.2996     0.5878 0.228 0.000 0.000 0.772 0.000 0.000
#> GSM875475     1  0.0777     0.8473 0.972 0.000 0.000 0.000 0.004 0.024
#> GSM875476     1  0.3291     0.7572 0.828 0.064 0.000 0.000 0.004 0.104
#> GSM875477     1  0.0622     0.8491 0.980 0.008 0.000 0.000 0.000 0.012
#> GSM875414     5  0.2101     0.4845 0.000 0.004 0.000 0.004 0.892 0.100
#> GSM875427     3  0.3804     0.2311 0.000 0.000 0.576 0.000 0.000 0.424
#> GSM875431     5  0.5159    -0.0747 0.000 0.000 0.428 0.008 0.500 0.064
#> GSM875433     6  0.4097     0.0967 0.000 0.008 0.000 0.000 0.492 0.500
#> GSM875443     3  0.0865     0.7734 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM875444     3  0.0291     0.7799 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM875445     3  0.0363     0.7798 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM875449     3  0.0725     0.7745 0.000 0.000 0.976 0.000 0.012 0.012
#> GSM875450     3  0.0000     0.7803 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875452     3  0.1531     0.7571 0.000 0.004 0.928 0.000 0.000 0.068
#> GSM875454     3  0.3020     0.6733 0.000 0.000 0.824 0.008 0.012 0.156
#> GSM875457     3  0.0146     0.7803 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM875458     3  0.0000     0.7803 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875467     3  0.0632     0.7765 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM875468     3  0.0000     0.7803 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM875412     5  0.2039     0.4507 0.000 0.000 0.000 0.020 0.904 0.076
#> GSM875419     5  0.5034     0.1523 0.000 0.000 0.000 0.404 0.520 0.076
#> GSM875420     4  0.4219     0.4085 0.000 0.000 0.000 0.660 0.304 0.036
#> GSM875421     3  0.1408     0.7690 0.000 0.000 0.944 0.000 0.020 0.036
#> GSM875422     3  0.6543    -0.3444 0.000 0.000 0.356 0.020 0.324 0.300
#> GSM875426     5  0.5244     0.1872 0.000 0.336 0.000 0.000 0.552 0.112
#> GSM875428     5  0.1049     0.4875 0.000 0.000 0.000 0.008 0.960 0.032
#> GSM875429     2  0.5243     0.6132 0.000 0.664 0.000 0.024 0.140 0.172
#> GSM875434     1  0.6819    -0.1165 0.412 0.000 0.000 0.056 0.216 0.316
#> GSM875438     6  0.5087     0.1275 0.000 0.000 0.000 0.080 0.412 0.508
#> GSM875439     2  0.4704     0.4978 0.000 0.644 0.000 0.008 0.292 0.056
#> GSM875440     5  0.2520     0.4528 0.000 0.000 0.000 0.004 0.844 0.152
#> GSM875441     4  0.4382     0.7307 0.000 0.004 0.000 0.716 0.080 0.200
#> GSM875442     2  0.1341     0.7501 0.000 0.948 0.000 0.000 0.024 0.028
#> GSM875446     5  0.5507     0.2804 0.000 0.288 0.000 0.048 0.600 0.064
#> GSM875448     4  0.3123     0.7936 0.000 0.000 0.000 0.832 0.056 0.112
#> GSM875453     4  0.3649     0.7679 0.000 0.000 0.000 0.764 0.040 0.196
#> GSM875455     2  0.0363     0.7504 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM875459     2  0.3385     0.7180 0.000 0.812 0.000 0.144 0.008 0.036
#> GSM875460     4  0.1080     0.8076 0.000 0.004 0.000 0.960 0.004 0.032
#> GSM875463     4  0.0405     0.8173 0.000 0.000 0.000 0.988 0.004 0.008
#> GSM875464     4  0.0260     0.8158 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM875466     3  0.5765    -0.0952 0.000 0.000 0.416 0.000 0.412 0.172
#> GSM875473     3  0.3244     0.5352 0.000 0.000 0.732 0.268 0.000 0.000
#> GSM875474     2  0.0260     0.7513 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM875478     2  0.2821     0.7154 0.000 0.832 0.000 0.152 0.000 0.016
#> GSM875479     4  0.1297     0.8129 0.000 0.012 0.000 0.948 0.000 0.040
#> GSM875480     3  0.3485     0.6180 0.000 0.000 0.784 0.184 0.028 0.004
#> GSM875481     2  0.6704    -0.0161 0.000 0.432 0.056 0.000 0.328 0.184

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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.492           0.711       0.871         0.4566 0.519   0.519
#> 3 3 0.360           0.384       0.740         0.2832 0.725   0.556
#> 4 4 0.566           0.715       0.802         0.1796 0.763   0.523
#> 5 5 0.654           0.478       0.784         0.0781 0.971   0.908
#> 6 6 0.661           0.591       0.779         0.0281 0.926   0.761

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
#> GSM875413     1  0.0000      0.861 1.000 0.000
#> GSM875415     1  0.0000      0.861 1.000 0.000
#> GSM875416     1  0.0000      0.861 1.000 0.000
#> GSM875417     1  0.9129      0.433 0.672 0.328
#> GSM875418     1  0.0000      0.861 1.000 0.000
#> GSM875423     1  0.0000      0.861 1.000 0.000
#> GSM875424     1  0.0000      0.861 1.000 0.000
#> GSM875425     1  0.0000      0.861 1.000 0.000
#> GSM875430     1  0.0000      0.861 1.000 0.000
#> GSM875432     1  0.0000      0.861 1.000 0.000
#> GSM875435     1  0.0000      0.861 1.000 0.000
#> GSM875436     2  0.9896      0.384 0.440 0.560
#> GSM875437     1  0.4815      0.772 0.896 0.104
#> GSM875447     1  0.0000      0.861 1.000 0.000
#> GSM875451     1  0.0000      0.861 1.000 0.000
#> GSM875456     1  0.0000      0.861 1.000 0.000
#> GSM875461     1  0.0000      0.861 1.000 0.000
#> GSM875462     1  0.0000      0.861 1.000 0.000
#> GSM875465     1  0.8861      0.483 0.696 0.304
#> GSM875469     1  0.0000      0.861 1.000 0.000
#> GSM875470     1  0.9129      0.433 0.672 0.328
#> GSM875471     1  0.9129      0.433 0.672 0.328
#> GSM875472     1  0.0000      0.861 1.000 0.000
#> GSM875475     1  0.0000      0.861 1.000 0.000
#> GSM875476     2  0.9963      0.312 0.464 0.536
#> GSM875477     1  0.0000      0.861 1.000 0.000
#> GSM875414     2  0.0000      0.813 0.000 1.000
#> GSM875427     2  0.8955      0.623 0.312 0.688
#> GSM875431     2  0.0000      0.813 0.000 1.000
#> GSM875433     2  0.8955      0.623 0.312 0.688
#> GSM875443     1  0.9129      0.433 0.672 0.328
#> GSM875444     2  0.9608      0.525 0.384 0.616
#> GSM875445     2  0.9608      0.525 0.384 0.616
#> GSM875449     2  0.9608      0.525 0.384 0.616
#> GSM875450     2  0.9608      0.525 0.384 0.616
#> GSM875452     2  0.9209      0.599 0.336 0.664
#> GSM875454     2  0.0000      0.813 0.000 1.000
#> GSM875457     2  0.9608      0.525 0.384 0.616
#> GSM875458     1  0.9993     -0.129 0.516 0.484
#> GSM875467     2  0.9661      0.508 0.392 0.608
#> GSM875468     1  0.9993     -0.129 0.516 0.484
#> GSM875412     2  0.0000      0.813 0.000 1.000
#> GSM875419     2  0.4022      0.801 0.080 0.920
#> GSM875420     2  0.0000      0.813 0.000 1.000
#> GSM875421     2  0.4815      0.794 0.104 0.896
#> GSM875422     2  0.0000      0.813 0.000 1.000
#> GSM875426     2  0.0000      0.813 0.000 1.000
#> GSM875428     2  0.0000      0.813 0.000 1.000
#> GSM875429     2  0.3431      0.808 0.064 0.936
#> GSM875434     2  0.9552      0.527 0.376 0.624
#> GSM875438     2  0.0000      0.813 0.000 1.000
#> GSM875439     2  0.0000      0.813 0.000 1.000
#> GSM875440     2  0.0000      0.813 0.000 1.000
#> GSM875441     2  0.0000      0.813 0.000 1.000
#> GSM875442     2  0.5842      0.772 0.140 0.860
#> GSM875446     2  0.0000      0.813 0.000 1.000
#> GSM875448     2  0.3584      0.808 0.068 0.932
#> GSM875453     2  0.2236      0.811 0.036 0.964
#> GSM875455     2  0.3431      0.810 0.064 0.936
#> GSM875459     2  0.0000      0.813 0.000 1.000
#> GSM875460     2  0.8207      0.685 0.256 0.744
#> GSM875463     2  0.4022      0.804 0.080 0.920
#> GSM875464     2  0.0000      0.813 0.000 1.000
#> GSM875466     2  0.9522      0.545 0.372 0.628
#> GSM875473     2  0.9209      0.599 0.336 0.664
#> GSM875474     2  0.0376      0.813 0.004 0.996
#> GSM875478     2  0.3431      0.810 0.064 0.936
#> GSM875479     2  0.1843      0.811 0.028 0.972
#> GSM875480     2  0.4022      0.801 0.080 0.920
#> GSM875481     2  0.0000      0.813 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
#> GSM875413     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875415     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875416     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875417     3  0.6905     0.1831 0.440 0.016 0.544
#> GSM875418     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875423     1  0.4261     0.8114 0.848 0.012 0.140
#> GSM875424     1  0.4261     0.8114 0.848 0.012 0.140
#> GSM875425     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875430     1  0.0237     0.9595 0.996 0.000 0.004
#> GSM875432     1  0.0829     0.9508 0.984 0.004 0.012
#> GSM875435     1  0.0237     0.9595 0.996 0.000 0.004
#> GSM875436     3  0.5366     0.5039 0.208 0.016 0.776
#> GSM875437     1  0.6129     0.5762 0.700 0.016 0.284
#> GSM875447     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875451     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875456     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875461     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875462     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875465     3  0.6941     0.1227 0.464 0.016 0.520
#> GSM875469     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875470     3  0.6905     0.1831 0.440 0.016 0.544
#> GSM875471     3  0.6905     0.1831 0.440 0.016 0.544
#> GSM875472     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875475     1  0.0237     0.9595 0.996 0.000 0.004
#> GSM875476     3  0.5639     0.4954 0.232 0.016 0.752
#> GSM875477     1  0.0000     0.9613 1.000 0.000 0.000
#> GSM875414     2  0.1643     0.4238 0.000 0.956 0.044
#> GSM875427     3  0.7381     0.4842 0.164 0.132 0.704
#> GSM875431     2  0.1643     0.4238 0.000 0.956 0.044
#> GSM875433     3  0.7381     0.4842 0.164 0.132 0.704
#> GSM875443     3  0.6905     0.1831 0.440 0.016 0.544
#> GSM875444     3  0.4121     0.5159 0.168 0.000 0.832
#> GSM875445     3  0.4121     0.5159 0.168 0.000 0.832
#> GSM875449     3  0.4351     0.5155 0.168 0.004 0.828
#> GSM875450     3  0.4121     0.5159 0.168 0.000 0.832
#> GSM875452     3  0.5988     0.5032 0.168 0.056 0.776
#> GSM875454     3  0.6308    -0.6354 0.000 0.492 0.508
#> GSM875457     3  0.4351     0.5155 0.168 0.004 0.828
#> GSM875458     3  0.7718     0.3906 0.320 0.068 0.612
#> GSM875467     3  0.4235     0.5150 0.176 0.000 0.824
#> GSM875468     3  0.7718     0.3906 0.320 0.068 0.612
#> GSM875412     3  0.6308    -0.6252 0.000 0.492 0.508
#> GSM875419     3  0.5254    -0.0154 0.000 0.264 0.736
#> GSM875420     2  0.6305     0.6279 0.000 0.516 0.484
#> GSM875421     3  0.7022     0.2044 0.056 0.260 0.684
#> GSM875422     2  0.6305     0.6279 0.000 0.516 0.484
#> GSM875426     3  0.6309    -0.6421 0.000 0.500 0.500
#> GSM875428     2  0.6305     0.6279 0.000 0.516 0.484
#> GSM875429     3  0.7559     0.0254 0.056 0.336 0.608
#> GSM875434     3  0.6677     0.4953 0.168 0.088 0.744
#> GSM875438     3  0.6308    -0.6252 0.000 0.492 0.508
#> GSM875439     2  0.6302     0.6308 0.000 0.520 0.480
#> GSM875440     3  0.6309    -0.6421 0.000 0.500 0.500
#> GSM875441     3  0.6305    -0.6111 0.000 0.484 0.516
#> GSM875442     3  0.6496     0.2800 0.056 0.208 0.736
#> GSM875446     2  0.6302     0.6308 0.000 0.520 0.480
#> GSM875448     3  0.6621     0.0170 0.032 0.284 0.684
#> GSM875453     3  0.5431    -0.0924 0.000 0.284 0.716
#> GSM875455     3  0.6621     0.0229 0.032 0.284 0.684
#> GSM875459     3  0.6309    -0.6421 0.000 0.500 0.500
#> GSM875460     3  0.1878     0.4366 0.044 0.004 0.952
#> GSM875463     3  0.6936     0.0534 0.044 0.284 0.672
#> GSM875464     2  0.5291     0.5503 0.000 0.732 0.268
#> GSM875466     3  0.3941     0.5135 0.156 0.000 0.844
#> GSM875473     3  0.3644     0.4994 0.124 0.004 0.872
#> GSM875474     3  0.6126    -0.3911 0.000 0.400 0.600
#> GSM875478     3  0.6653     0.0120 0.032 0.288 0.680
#> GSM875479     3  0.6026    -0.3662 0.000 0.376 0.624
#> GSM875480     3  0.5254    -0.0154 0.000 0.264 0.736
#> GSM875481     3  0.6309    -0.6421 0.000 0.500 0.500

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.3587     0.8044 0.860 0.000 0.088 0.052
#> GSM875415     1  0.0336     0.9291 0.992 0.000 0.000 0.008
#> GSM875416     1  0.0336     0.9291 0.992 0.000 0.000 0.008
#> GSM875417     3  0.5993     0.6008 0.248 0.004 0.672 0.076
#> GSM875418     1  0.0336     0.9291 0.992 0.000 0.000 0.008
#> GSM875423     1  0.4057     0.7720 0.816 0.000 0.152 0.032
#> GSM875424     1  0.4057     0.7720 0.816 0.000 0.152 0.032
#> GSM875425     1  0.0707     0.9273 0.980 0.000 0.000 0.020
#> GSM875430     1  0.0779     0.9274 0.980 0.000 0.004 0.016
#> GSM875432     1  0.2060     0.8984 0.932 0.000 0.052 0.016
#> GSM875435     1  0.0779     0.9274 0.980 0.000 0.004 0.016
#> GSM875436     3  0.5357     0.7579 0.040 0.108 0.784 0.068
#> GSM875437     1  0.6172     0.4722 0.632 0.000 0.284 0.084
#> GSM875447     1  0.0672     0.9279 0.984 0.000 0.008 0.008
#> GSM875451     1  0.0336     0.9291 0.992 0.000 0.000 0.008
#> GSM875456     1  0.0336     0.9291 0.992 0.000 0.000 0.008
#> GSM875461     1  0.0707     0.9273 0.980 0.000 0.000 0.020
#> GSM875462     1  0.0707     0.9273 0.980 0.000 0.000 0.020
#> GSM875465     3  0.6224     0.5701 0.264 0.004 0.648 0.084
#> GSM875469     1  0.0336     0.9291 0.992 0.000 0.000 0.008
#> GSM875470     3  0.5993     0.6008 0.248 0.004 0.672 0.076
#> GSM875471     3  0.5993     0.6008 0.248 0.004 0.672 0.076
#> GSM875472     1  0.0000     0.9294 1.000 0.000 0.000 0.000
#> GSM875475     1  0.1610     0.9118 0.952 0.000 0.032 0.016
#> GSM875476     3  0.5889     0.7478 0.056 0.104 0.756 0.084
#> GSM875477     1  0.0336     0.9291 0.992 0.000 0.000 0.008
#> GSM875414     4  0.3726     1.0000 0.000 0.212 0.000 0.788
#> GSM875427     3  0.5272     0.7058 0.000 0.136 0.752 0.112
#> GSM875431     4  0.3726     1.0000 0.000 0.212 0.000 0.788
#> GSM875433     3  0.5272     0.7058 0.000 0.136 0.752 0.112
#> GSM875443     3  0.5993     0.6008 0.248 0.004 0.672 0.076
#> GSM875444     3  0.2530     0.7831 0.004 0.100 0.896 0.000
#> GSM875445     3  0.2530     0.7831 0.004 0.100 0.896 0.000
#> GSM875449     3  0.2715     0.7835 0.004 0.100 0.892 0.004
#> GSM875450     3  0.2530     0.7831 0.004 0.100 0.896 0.000
#> GSM875452     3  0.4059     0.7454 0.004 0.124 0.832 0.040
#> GSM875454     2  0.2759     0.6688 0.000 0.904 0.044 0.052
#> GSM875457     3  0.2715     0.7835 0.004 0.100 0.892 0.004
#> GSM875458     3  0.3610     0.6769 0.028 0.004 0.856 0.112
#> GSM875467     3  0.2867     0.7827 0.012 0.104 0.884 0.000
#> GSM875468     3  0.3610     0.6769 0.028 0.004 0.856 0.112
#> GSM875412     2  0.0927     0.6976 0.000 0.976 0.016 0.008
#> GSM875419     2  0.5328     0.6059 0.000 0.704 0.248 0.048
#> GSM875420     2  0.1022     0.6816 0.000 0.968 0.000 0.032
#> GSM875421     2  0.6658     0.3829 0.000 0.532 0.376 0.092
#> GSM875422     2  0.1302     0.6759 0.000 0.956 0.000 0.044
#> GSM875426     2  0.1256     0.6892 0.000 0.964 0.008 0.028
#> GSM875428     2  0.1557     0.6689 0.000 0.944 0.000 0.056
#> GSM875429     2  0.6681     0.5419 0.000 0.588 0.292 0.120
#> GSM875434     3  0.5025     0.7543 0.004 0.108 0.780 0.108
#> GSM875438     2  0.0927     0.6982 0.000 0.976 0.016 0.008
#> GSM875439     2  0.1637     0.6646 0.000 0.940 0.000 0.060
#> GSM875440     2  0.0927     0.6917 0.000 0.976 0.008 0.016
#> GSM875441     2  0.1510     0.6984 0.000 0.956 0.028 0.016
#> GSM875442     2  0.6788     0.2451 0.000 0.480 0.424 0.096
#> GSM875446     2  0.1637     0.6646 0.000 0.940 0.000 0.060
#> GSM875448     2  0.6215     0.5356 0.000 0.600 0.328 0.072
#> GSM875453     2  0.5990     0.5970 0.000 0.644 0.284 0.072
#> GSM875455     2  0.6302     0.4736 0.000 0.564 0.368 0.068
#> GSM875459     2  0.1452     0.6861 0.000 0.956 0.008 0.036
#> GSM875460     3  0.4608     0.4513 0.000 0.304 0.692 0.004
#> GSM875463     2  0.6374     0.4522 0.000 0.556 0.372 0.072
#> GSM875464     2  0.4877    -0.0514 0.000 0.592 0.000 0.408
#> GSM875466     3  0.2888     0.7703 0.004 0.124 0.872 0.000
#> GSM875473     3  0.4012     0.6705 0.004 0.204 0.788 0.004
#> GSM875474     2  0.4010     0.6801 0.000 0.836 0.100 0.064
#> GSM875478     2  0.6350     0.4774 0.000 0.564 0.364 0.072
#> GSM875479     2  0.4719     0.6601 0.000 0.772 0.180 0.048
#> GSM875480     2  0.5328     0.6059 0.000 0.704 0.248 0.048
#> GSM875481     2  0.1452     0.6861 0.000 0.956 0.008 0.036

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.4342      0.647 0.728 0.232 0.000 0.000 0.040
#> GSM875415     1  0.0693      0.911 0.980 0.012 0.000 0.000 0.008
#> GSM875416     1  0.0290      0.913 0.992 0.000 0.000 0.000 0.008
#> GSM875417     3  0.7447      0.433 0.204 0.228 0.496 0.000 0.072
#> GSM875418     1  0.0798      0.910 0.976 0.016 0.000 0.000 0.008
#> GSM875423     1  0.4617      0.751 0.776 0.132 0.060 0.000 0.032
#> GSM875424     1  0.4617      0.751 0.776 0.132 0.060 0.000 0.032
#> GSM875425     1  0.0865      0.911 0.972 0.004 0.000 0.000 0.024
#> GSM875430     1  0.1399      0.909 0.952 0.028 0.000 0.000 0.020
#> GSM875432     1  0.2515      0.879 0.908 0.032 0.040 0.000 0.020
#> GSM875435     1  0.1399      0.909 0.952 0.028 0.000 0.000 0.020
#> GSM875436     3  0.5525      0.449 0.008 0.284 0.640 0.008 0.060
#> GSM875437     1  0.6949      0.478 0.584 0.164 0.168 0.000 0.084
#> GSM875447     1  0.0579      0.913 0.984 0.000 0.008 0.000 0.008
#> GSM875451     1  0.0290      0.913 0.992 0.000 0.000 0.000 0.008
#> GSM875456     1  0.0290      0.913 0.992 0.000 0.000 0.000 0.008
#> GSM875461     1  0.1310      0.911 0.956 0.020 0.000 0.000 0.024
#> GSM875462     1  0.0865      0.911 0.972 0.004 0.000 0.000 0.024
#> GSM875465     3  0.7646      0.411 0.216 0.228 0.472 0.000 0.084
#> GSM875469     1  0.0798      0.910 0.976 0.016 0.000 0.000 0.008
#> GSM875470     3  0.7447      0.433 0.204 0.228 0.496 0.000 0.072
#> GSM875471     3  0.7447      0.433 0.204 0.228 0.496 0.000 0.072
#> GSM875472     1  0.0000      0.914 1.000 0.000 0.000 0.000 0.000
#> GSM875475     1  0.1989      0.893 0.932 0.016 0.032 0.000 0.020
#> GSM875476     3  0.5928      0.442 0.020 0.276 0.620 0.004 0.080
#> GSM875477     1  0.0290      0.913 0.992 0.000 0.000 0.000 0.008
#> GSM875414     5  0.2329      1.000 0.000 0.000 0.000 0.124 0.876
#> GSM875427     3  0.4066      0.488 0.000 0.188 0.768 0.044 0.000
#> GSM875431     5  0.2329      1.000 0.000 0.000 0.000 0.124 0.876
#> GSM875433     3  0.4066      0.488 0.000 0.188 0.768 0.044 0.000
#> GSM875443     3  0.7447      0.433 0.204 0.228 0.496 0.000 0.072
#> GSM875444     3  0.0290      0.617 0.000 0.000 0.992 0.008 0.000
#> GSM875445     3  0.0290      0.617 0.000 0.000 0.992 0.008 0.000
#> GSM875449     3  0.0451      0.618 0.000 0.004 0.988 0.008 0.000
#> GSM875450     3  0.0290      0.617 0.000 0.000 0.992 0.008 0.000
#> GSM875452     3  0.2046      0.558 0.000 0.068 0.916 0.016 0.000
#> GSM875454     4  0.2901      0.567 0.000 0.044 0.048 0.888 0.020
#> GSM875457     3  0.0451      0.618 0.000 0.004 0.988 0.008 0.000
#> GSM875458     3  0.3636      0.524 0.000 0.272 0.728 0.000 0.000
#> GSM875467     3  0.1983      0.598 0.008 0.060 0.924 0.008 0.000
#> GSM875468     3  0.3636      0.524 0.000 0.272 0.728 0.000 0.000
#> GSM875412     4  0.1251      0.574 0.000 0.036 0.008 0.956 0.000
#> GSM875419     4  0.5577      0.222 0.000 0.120 0.256 0.624 0.000
#> GSM875420     4  0.1522      0.585 0.000 0.044 0.000 0.944 0.012
#> GSM875421     4  0.6459     -0.297 0.000 0.180 0.400 0.420 0.000
#> GSM875422     4  0.1568      0.584 0.000 0.036 0.000 0.944 0.020
#> GSM875426     4  0.1095      0.585 0.000 0.012 0.008 0.968 0.012
#> GSM875428     4  0.1750      0.581 0.000 0.036 0.000 0.936 0.028
#> GSM875429     4  0.6655     -0.558 0.000 0.368 0.228 0.404 0.000
#> GSM875434     3  0.4679      0.568 0.004 0.148 0.772 0.036 0.040
#> GSM875438     4  0.1251      0.575 0.000 0.036 0.008 0.956 0.000
#> GSM875439     4  0.3099      0.530 0.000 0.124 0.000 0.848 0.028
#> GSM875440     4  0.0693      0.582 0.000 0.012 0.008 0.980 0.000
#> GSM875441     4  0.2446      0.534 0.000 0.056 0.044 0.900 0.000
#> GSM875442     3  0.6593     -0.393 0.000 0.220 0.440 0.340 0.000
#> GSM875446     4  0.3099      0.530 0.000 0.124 0.000 0.848 0.028
#> GSM875448     4  0.6728     -0.866 0.000 0.368 0.252 0.380 0.000
#> GSM875453     4  0.6647     -0.735 0.000 0.344 0.232 0.424 0.000
#> GSM875455     4  0.6819     -0.876 0.000 0.312 0.340 0.348 0.000
#> GSM875459     4  0.1087      0.585 0.000 0.008 0.008 0.968 0.016
#> GSM875460     3  0.4808      0.179 0.000 0.108 0.724 0.168 0.000
#> GSM875463     2  0.6802      0.000 0.000 0.368 0.296 0.336 0.000
#> GSM875464     4  0.5925     -0.248 0.000 0.104 0.000 0.472 0.424
#> GSM875466     3  0.2208      0.585 0.000 0.072 0.908 0.020 0.000
#> GSM875473     3  0.3648      0.457 0.000 0.084 0.824 0.092 0.000
#> GSM875474     4  0.3994      0.391 0.000 0.188 0.040 0.772 0.000
#> GSM875478     4  0.6821     -0.881 0.000 0.316 0.336 0.348 0.000
#> GSM875479     4  0.5841     -0.186 0.000 0.212 0.180 0.608 0.000
#> GSM875480     4  0.5577      0.222 0.000 0.120 0.256 0.624 0.000
#> GSM875481     4  0.0960      0.586 0.000 0.004 0.008 0.972 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
#> GSM875413     6  0.4630      0.000 0.280 0.012 0.000 0.048 0.000 0.660
#> GSM875415     1  0.0935      0.876 0.964 0.000 0.000 0.004 0.000 0.032
#> GSM875416     1  0.0291      0.883 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM875417     3  0.6809      0.312 0.192 0.064 0.428 0.000 0.000 0.316
#> GSM875418     1  0.1010      0.873 0.960 0.000 0.000 0.004 0.000 0.036
#> GSM875423     1  0.3314      0.649 0.764 0.000 0.012 0.000 0.000 0.224
#> GSM875424     1  0.3314      0.649 0.764 0.000 0.012 0.000 0.000 0.224
#> GSM875425     1  0.0865      0.880 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM875430     1  0.1327      0.877 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM875432     1  0.2129      0.838 0.904 0.000 0.040 0.000 0.000 0.056
#> GSM875435     1  0.1327      0.877 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM875436     3  0.5539      0.354 0.004 0.136 0.572 0.000 0.004 0.284
#> GSM875437     1  0.5192      0.315 0.576 0.000 0.116 0.000 0.000 0.308
#> GSM875447     1  0.0551      0.883 0.984 0.000 0.008 0.004 0.000 0.004
#> GSM875451     1  0.0291      0.883 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM875456     1  0.0291      0.883 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM875461     1  0.1387      0.877 0.932 0.000 0.000 0.000 0.000 0.068
#> GSM875462     1  0.0865      0.880 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM875465     3  0.6886      0.273 0.208 0.064 0.404 0.000 0.000 0.324
#> GSM875469     1  0.1010      0.873 0.960 0.000 0.000 0.004 0.000 0.036
#> GSM875470     3  0.6809      0.312 0.192 0.064 0.428 0.000 0.000 0.316
#> GSM875471     3  0.6809      0.312 0.192 0.064 0.428 0.000 0.000 0.316
#> GSM875472     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875475     1  0.1649      0.861 0.932 0.000 0.032 0.000 0.000 0.036
#> GSM875476     3  0.5738      0.349 0.020 0.128 0.556 0.000 0.000 0.296
#> GSM875477     1  0.0291      0.883 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM875414     4  0.1075      0.626 0.000 0.000 0.000 0.952 0.048 0.000
#> GSM875427     3  0.4159      0.420 0.000 0.216 0.732 0.000 0.036 0.016
#> GSM875431     4  0.1075      0.626 0.000 0.000 0.000 0.952 0.048 0.000
#> GSM875433     3  0.4159      0.420 0.000 0.216 0.732 0.000 0.036 0.016
#> GSM875443     3  0.6809      0.312 0.192 0.064 0.428 0.000 0.000 0.316
#> GSM875444     3  0.0260      0.564 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM875445     3  0.0260      0.564 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM875449     3  0.0405      0.564 0.000 0.004 0.988 0.000 0.008 0.000
#> GSM875450     3  0.0260      0.564 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM875452     3  0.1757      0.507 0.000 0.076 0.916 0.000 0.008 0.000
#> GSM875454     5  0.1844      0.763 0.000 0.024 0.048 0.004 0.924 0.000
#> GSM875457     3  0.0405      0.564 0.000 0.004 0.988 0.000 0.008 0.000
#> GSM875458     3  0.4110      0.457 0.000 0.268 0.692 0.000 0.000 0.040
#> GSM875467     3  0.2198      0.542 0.008 0.064 0.908 0.000 0.008 0.012
#> GSM875468     3  0.4110      0.457 0.000 0.268 0.692 0.000 0.000 0.040
#> GSM875412     5  0.1812      0.778 0.000 0.080 0.008 0.000 0.912 0.000
#> GSM875419     5  0.4968      0.307 0.000 0.120 0.248 0.000 0.632 0.000
#> GSM875420     5  0.0935      0.787 0.000 0.032 0.000 0.004 0.964 0.000
#> GSM875421     3  0.6070     -0.329 0.000 0.216 0.392 0.000 0.388 0.004
#> GSM875422     5  0.0603      0.784 0.000 0.016 0.000 0.004 0.980 0.000
#> GSM875426     5  0.1265      0.791 0.000 0.044 0.008 0.000 0.948 0.000
#> GSM875428     5  0.0806      0.777 0.000 0.020 0.000 0.008 0.972 0.000
#> GSM875429     2  0.5812      0.672 0.000 0.536 0.192 0.000 0.264 0.008
#> GSM875434     3  0.4704      0.496 0.000 0.140 0.732 0.000 0.036 0.092
#> GSM875438     5  0.1812      0.779 0.000 0.080 0.008 0.000 0.912 0.000
#> GSM875439     5  0.2431      0.634 0.000 0.132 0.000 0.008 0.860 0.000
#> GSM875440     5  0.1462      0.788 0.000 0.056 0.008 0.000 0.936 0.000
#> GSM875441     5  0.2979      0.713 0.000 0.116 0.044 0.000 0.840 0.000
#> GSM875442     3  0.6236     -0.349 0.000 0.264 0.420 0.000 0.308 0.008
#> GSM875446     5  0.2431      0.634 0.000 0.132 0.000 0.008 0.860 0.000
#> GSM875448     2  0.5554      0.857 0.000 0.576 0.216 0.000 0.204 0.004
#> GSM875453     2  0.5534      0.814 0.000 0.556 0.196 0.000 0.248 0.000
#> GSM875455     2  0.5647      0.851 0.000 0.520 0.296 0.000 0.184 0.000
#> GSM875459     5  0.1340      0.791 0.000 0.040 0.008 0.004 0.948 0.000
#> GSM875460     3  0.4634      0.168 0.000 0.156 0.704 0.000 0.136 0.004
#> GSM875463     2  0.5451      0.833 0.000 0.584 0.252 0.000 0.160 0.004
#> GSM875464     4  0.5458      0.295 0.000 0.124 0.000 0.480 0.396 0.000
#> GSM875466     3  0.2308      0.531 0.000 0.076 0.896 0.000 0.016 0.012
#> GSM875473     3  0.3469      0.407 0.000 0.104 0.808 0.000 0.088 0.000
#> GSM875474     5  0.4078      0.376 0.000 0.340 0.020 0.000 0.640 0.000
#> GSM875478     2  0.5635      0.855 0.000 0.524 0.292 0.000 0.184 0.000
#> GSM875479     5  0.5659     -0.279 0.000 0.336 0.168 0.000 0.496 0.000
#> GSM875480     5  0.4968      0.307 0.000 0.120 0.248 0.000 0.632 0.000
#> GSM875481     5  0.1268      0.792 0.000 0.036 0.008 0.004 0.952 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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) k
#> ATC:hclust 61         5.68e-14 2
#> ATC:hclust 35         1.74e-11 3
#> ATC:hclust 62         8.16e-15 4
#> ATC:hclust 45         1.46e-13 5
#> ATC:hclust 47         2.93e-14 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 51941 rows and 70 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           0.994       0.997         0.4756 0.526   0.526
#> 3 3 0.704           0.851       0.905         0.3833 0.755   0.554
#> 4 4 0.639           0.517       0.774         0.1137 0.935   0.817
#> 5 5 0.632           0.566       0.679         0.0561 0.848   0.545
#> 6 6 0.683           0.571       0.733         0.0468 0.894   0.577

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette  p1  p2
#> GSM875413     1   0.000      1.000 1.0 0.0
#> GSM875415     1   0.000      1.000 1.0 0.0
#> GSM875416     1   0.000      1.000 1.0 0.0
#> GSM875417     1   0.000      1.000 1.0 0.0
#> GSM875418     1   0.000      1.000 1.0 0.0
#> GSM875423     1   0.000      1.000 1.0 0.0
#> GSM875424     1   0.000      1.000 1.0 0.0
#> GSM875425     1   0.000      1.000 1.0 0.0
#> GSM875430     1   0.000      1.000 1.0 0.0
#> GSM875432     1   0.000      1.000 1.0 0.0
#> GSM875435     1   0.000      1.000 1.0 0.0
#> GSM875436     2   0.722      0.750 0.2 0.8
#> GSM875437     1   0.000      1.000 1.0 0.0
#> GSM875447     1   0.000      1.000 1.0 0.0
#> GSM875451     1   0.000      1.000 1.0 0.0
#> GSM875456     1   0.000      1.000 1.0 0.0
#> GSM875461     1   0.000      1.000 1.0 0.0
#> GSM875462     1   0.000      1.000 1.0 0.0
#> GSM875465     1   0.000      1.000 1.0 0.0
#> GSM875469     1   0.000      1.000 1.0 0.0
#> GSM875470     1   0.000      1.000 1.0 0.0
#> GSM875471     1   0.000      1.000 1.0 0.0
#> GSM875472     1   0.000      1.000 1.0 0.0
#> GSM875475     1   0.000      1.000 1.0 0.0
#> GSM875476     1   0.000      1.000 1.0 0.0
#> GSM875477     1   0.000      1.000 1.0 0.0
#> GSM875414     2   0.000      0.995 0.0 1.0
#> GSM875427     2   0.000      0.995 0.0 1.0
#> GSM875431     2   0.000      0.995 0.0 1.0
#> GSM875433     2   0.000      0.995 0.0 1.0
#> GSM875443     1   0.000      1.000 1.0 0.0
#> GSM875444     2   0.000      0.995 0.0 1.0
#> GSM875445     2   0.000      0.995 0.0 1.0
#> GSM875449     2   0.000      0.995 0.0 1.0
#> GSM875450     2   0.000      0.995 0.0 1.0
#> GSM875452     2   0.000      0.995 0.0 1.0
#> GSM875454     2   0.000      0.995 0.0 1.0
#> GSM875457     2   0.000      0.995 0.0 1.0
#> GSM875458     2   0.000      0.995 0.0 1.0
#> GSM875467     2   0.000      0.995 0.0 1.0
#> GSM875468     2   0.000      0.995 0.0 1.0
#> GSM875412     2   0.000      0.995 0.0 1.0
#> GSM875419     2   0.000      0.995 0.0 1.0
#> GSM875420     2   0.000      0.995 0.0 1.0
#> GSM875421     2   0.000      0.995 0.0 1.0
#> GSM875422     2   0.000      0.995 0.0 1.0
#> GSM875426     2   0.000      0.995 0.0 1.0
#> GSM875428     2   0.000      0.995 0.0 1.0
#> GSM875429     2   0.000      0.995 0.0 1.0
#> GSM875434     2   0.000      0.995 0.0 1.0
#> GSM875438     2   0.000      0.995 0.0 1.0
#> GSM875439     2   0.000      0.995 0.0 1.0
#> GSM875440     2   0.000      0.995 0.0 1.0
#> GSM875441     2   0.000      0.995 0.0 1.0
#> GSM875442     2   0.000      0.995 0.0 1.0
#> GSM875446     2   0.000      0.995 0.0 1.0
#> GSM875448     2   0.000      0.995 0.0 1.0
#> GSM875453     2   0.000      0.995 0.0 1.0
#> GSM875455     2   0.000      0.995 0.0 1.0
#> GSM875459     2   0.000      0.995 0.0 1.0
#> GSM875460     2   0.000      0.995 0.0 1.0
#> GSM875463     2   0.000      0.995 0.0 1.0
#> GSM875464     2   0.000      0.995 0.0 1.0
#> GSM875466     2   0.000      0.995 0.0 1.0
#> GSM875473     2   0.000      0.995 0.0 1.0
#> GSM875474     2   0.000      0.995 0.0 1.0
#> GSM875478     2   0.000      0.995 0.0 1.0
#> GSM875479     2   0.000      0.995 0.0 1.0
#> GSM875480     2   0.000      0.995 0.0 1.0
#> GSM875481     2   0.000      0.995 0.0 1.0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM875413     1  0.1529      0.905 0.960 0.000 0.040
#> GSM875415     1  0.0892      0.913 0.980 0.000 0.020
#> GSM875416     1  0.0000      0.917 1.000 0.000 0.000
#> GSM875417     3  0.5760      0.385 0.328 0.000 0.672
#> GSM875418     1  0.1411      0.907 0.964 0.000 0.036
#> GSM875423     1  0.1753      0.910 0.952 0.000 0.048
#> GSM875424     1  0.1753      0.910 0.952 0.000 0.048
#> GSM875425     1  0.2165      0.911 0.936 0.000 0.064
#> GSM875430     1  0.0892      0.917 0.980 0.000 0.020
#> GSM875432     1  0.1411      0.913 0.964 0.000 0.036
#> GSM875435     1  0.0000      0.917 1.000 0.000 0.000
#> GSM875436     3  0.2096      0.886 0.004 0.052 0.944
#> GSM875437     1  0.3619      0.840 0.864 0.000 0.136
#> GSM875447     1  0.0000      0.917 1.000 0.000 0.000
#> GSM875451     1  0.0424      0.916 0.992 0.000 0.008
#> GSM875456     1  0.0000      0.917 1.000 0.000 0.000
#> GSM875461     1  0.2625      0.906 0.916 0.000 0.084
#> GSM875462     1  0.1860      0.910 0.948 0.000 0.052
#> GSM875465     1  0.5760      0.570 0.672 0.000 0.328
#> GSM875469     1  0.1411      0.907 0.964 0.000 0.036
#> GSM875470     1  0.6307      0.179 0.512 0.000 0.488
#> GSM875471     3  0.6126      0.164 0.400 0.000 0.600
#> GSM875472     1  0.0000      0.917 1.000 0.000 0.000
#> GSM875475     1  0.0892      0.917 0.980 0.000 0.020
#> GSM875476     1  0.6280      0.266 0.540 0.000 0.460
#> GSM875477     1  0.0000      0.917 1.000 0.000 0.000
#> GSM875414     2  0.0747      0.903 0.000 0.984 0.016
#> GSM875427     3  0.3340      0.890 0.000 0.120 0.880
#> GSM875431     2  0.0747      0.903 0.000 0.984 0.016
#> GSM875433     2  0.5650      0.665 0.000 0.688 0.312
#> GSM875443     3  0.4062      0.693 0.164 0.000 0.836
#> GSM875444     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875445     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875449     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875450     3  0.2711      0.915 0.000 0.088 0.912
#> GSM875452     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875454     2  0.0892      0.918 0.000 0.980 0.020
#> GSM875457     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875458     3  0.2448      0.910 0.000 0.076 0.924
#> GSM875467     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875468     3  0.2066      0.899 0.000 0.060 0.940
#> GSM875412     2  0.0892      0.918 0.000 0.980 0.020
#> GSM875419     2  0.3752      0.846 0.000 0.856 0.144
#> GSM875420     2  0.0000      0.911 0.000 1.000 0.000
#> GSM875421     2  0.3816      0.850 0.000 0.852 0.148
#> GSM875422     2  0.0892      0.918 0.000 0.980 0.020
#> GSM875426     2  0.0892      0.918 0.000 0.980 0.020
#> GSM875428     2  0.0000      0.911 0.000 1.000 0.000
#> GSM875429     2  0.4974      0.763 0.000 0.764 0.236
#> GSM875434     3  0.2711      0.915 0.000 0.088 0.912
#> GSM875438     2  0.3192      0.875 0.000 0.888 0.112
#> GSM875439     2  0.0000      0.911 0.000 1.000 0.000
#> GSM875440     2  0.0892      0.918 0.000 0.980 0.020
#> GSM875441     2  0.0892      0.918 0.000 0.980 0.020
#> GSM875442     2  0.5058      0.752 0.000 0.756 0.244
#> GSM875446     2  0.0000      0.911 0.000 1.000 0.000
#> GSM875448     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875453     2  0.5016      0.758 0.000 0.760 0.240
#> GSM875455     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875459     2  0.0892      0.918 0.000 0.980 0.020
#> GSM875460     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875463     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875464     2  0.0747      0.903 0.000 0.984 0.016
#> GSM875466     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875473     3  0.3038      0.922 0.000 0.104 0.896
#> GSM875474     2  0.4931      0.768 0.000 0.768 0.232
#> GSM875478     2  0.3551      0.862 0.000 0.868 0.132
#> GSM875479     2  0.0892      0.918 0.000 0.980 0.020
#> GSM875480     2  0.1031      0.917 0.000 0.976 0.024
#> GSM875481     2  0.0892      0.918 0.000 0.980 0.020

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.1940      0.861 0.924 0.000 0.000 0.076
#> GSM875415     1  0.1211      0.869 0.960 0.000 0.000 0.040
#> GSM875416     1  0.0592      0.877 0.984 0.000 0.000 0.016
#> GSM875417     3  0.7551      0.259 0.228 0.000 0.484 0.288
#> GSM875418     1  0.1637      0.865 0.940 0.000 0.000 0.060
#> GSM875423     1  0.4053      0.817 0.768 0.000 0.004 0.228
#> GSM875424     1  0.3870      0.822 0.788 0.000 0.004 0.208
#> GSM875425     1  0.3668      0.845 0.808 0.000 0.004 0.188
#> GSM875430     1  0.1474      0.879 0.948 0.000 0.000 0.052
#> GSM875432     1  0.3356      0.841 0.824 0.000 0.000 0.176
#> GSM875435     1  0.0188      0.877 0.996 0.000 0.000 0.004
#> GSM875436     3  0.4343      0.550 0.000 0.004 0.732 0.264
#> GSM875437     1  0.7185      0.509 0.540 0.000 0.176 0.284
#> GSM875447     1  0.1474      0.877 0.948 0.000 0.000 0.052
#> GSM875451     1  0.1557      0.868 0.944 0.000 0.000 0.056
#> GSM875456     1  0.0592      0.877 0.984 0.000 0.000 0.016
#> GSM875461     1  0.3908      0.844 0.784 0.000 0.004 0.212
#> GSM875462     1  0.4155      0.809 0.756 0.000 0.004 0.240
#> GSM875465     1  0.7672      0.326 0.460 0.000 0.256 0.284
#> GSM875469     1  0.1637      0.865 0.940 0.000 0.000 0.060
#> GSM875470     3  0.7796      0.106 0.288 0.000 0.424 0.288
#> GSM875471     3  0.7651      0.213 0.248 0.000 0.464 0.288
#> GSM875472     1  0.1792      0.878 0.932 0.000 0.000 0.068
#> GSM875475     1  0.1637      0.876 0.940 0.000 0.000 0.060
#> GSM875476     3  0.7871     -0.027 0.332 0.000 0.384 0.284
#> GSM875477     1  0.0592      0.877 0.984 0.000 0.000 0.016
#> GSM875414     2  0.4624      0.297 0.000 0.660 0.000 0.340
#> GSM875427     3  0.5309      0.357 0.000 0.044 0.700 0.256
#> GSM875431     2  0.4643      0.291 0.000 0.656 0.000 0.344
#> GSM875433     3  0.7285     -0.338 0.000 0.180 0.520 0.300
#> GSM875443     3  0.5522      0.503 0.044 0.000 0.668 0.288
#> GSM875444     3  0.0376      0.673 0.000 0.004 0.992 0.004
#> GSM875445     3  0.2976      0.593 0.000 0.008 0.872 0.120
#> GSM875449     3  0.2773      0.601 0.000 0.004 0.880 0.116
#> GSM875450     3  0.0000      0.674 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0657      0.672 0.000 0.004 0.984 0.012
#> GSM875454     2  0.1584      0.554 0.000 0.952 0.012 0.036
#> GSM875457     3  0.0188      0.674 0.000 0.004 0.996 0.000
#> GSM875458     3  0.0895      0.671 0.000 0.004 0.976 0.020
#> GSM875467     3  0.0188      0.674 0.000 0.004 0.996 0.000
#> GSM875468     3  0.2888      0.595 0.000 0.004 0.872 0.124
#> GSM875412     2  0.4511      0.456 0.000 0.724 0.008 0.268
#> GSM875419     2  0.6317      0.213 0.000 0.624 0.096 0.280
#> GSM875420     2  0.0921      0.568 0.000 0.972 0.000 0.028
#> GSM875421     2  0.7416     -0.629 0.000 0.516 0.244 0.240
#> GSM875422     2  0.0188      0.574 0.000 0.996 0.004 0.000
#> GSM875426     2  0.3450      0.545 0.000 0.836 0.008 0.156
#> GSM875428     2  0.1637      0.557 0.000 0.940 0.000 0.060
#> GSM875429     4  0.7836      0.000 0.000 0.328 0.272 0.400
#> GSM875434     3  0.2773      0.598 0.000 0.004 0.880 0.116
#> GSM875438     2  0.5131      0.405 0.000 0.692 0.028 0.280
#> GSM875439     2  0.1637      0.557 0.000 0.940 0.000 0.060
#> GSM875440     2  0.3450      0.545 0.000 0.836 0.008 0.156
#> GSM875441     2  0.4567      0.448 0.000 0.716 0.008 0.276
#> GSM875442     2  0.7811     -0.768 0.000 0.416 0.276 0.308
#> GSM875446     2  0.1637      0.557 0.000 0.940 0.000 0.060
#> GSM875448     3  0.5878      0.175 0.000 0.056 0.632 0.312
#> GSM875453     2  0.6422      0.178 0.000 0.616 0.104 0.280
#> GSM875455     3  0.4248      0.505 0.000 0.012 0.768 0.220
#> GSM875459     2  0.2773      0.559 0.000 0.880 0.004 0.116
#> GSM875460     3  0.2944      0.594 0.000 0.004 0.868 0.128
#> GSM875463     3  0.4690      0.410 0.000 0.012 0.712 0.276
#> GSM875464     2  0.4624      0.297 0.000 0.660 0.000 0.340
#> GSM875466     3  0.0188      0.674 0.000 0.004 0.996 0.000
#> GSM875473     3  0.0779      0.672 0.000 0.004 0.980 0.016
#> GSM875474     2  0.6422      0.178 0.000 0.616 0.104 0.280
#> GSM875478     2  0.6262      0.225 0.000 0.628 0.092 0.280
#> GSM875479     2  0.4594      0.443 0.000 0.712 0.008 0.280
#> GSM875480     2  0.5291      0.338 0.000 0.740 0.080 0.180
#> GSM875481     2  0.0188      0.574 0.000 0.996 0.004 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.4541    0.68171 0.760 0.140 0.000 0.096 0.004
#> GSM875415     1  0.2388    0.74446 0.900 0.072 0.000 0.028 0.000
#> GSM875416     1  0.1012    0.76644 0.968 0.012 0.000 0.020 0.000
#> GSM875417     2  0.6080    0.71372 0.200 0.572 0.228 0.000 0.000
#> GSM875418     1  0.3432    0.71843 0.828 0.132 0.000 0.040 0.000
#> GSM875423     1  0.4508    0.43271 0.648 0.332 0.000 0.020 0.000
#> GSM875424     1  0.4584    0.44695 0.660 0.312 0.000 0.028 0.000
#> GSM875425     1  0.4946    0.56531 0.648 0.300 0.000 0.052 0.000
#> GSM875430     1  0.2676    0.73314 0.884 0.080 0.000 0.036 0.000
#> GSM875432     1  0.4269    0.56958 0.732 0.232 0.000 0.036 0.000
#> GSM875435     1  0.0912    0.76797 0.972 0.016 0.000 0.012 0.000
#> GSM875436     2  0.6642    0.25979 0.000 0.444 0.308 0.248 0.000
#> GSM875437     2  0.6048    0.48201 0.400 0.516 0.048 0.036 0.000
#> GSM875447     1  0.1579    0.76304 0.944 0.024 0.000 0.032 0.000
#> GSM875451     1  0.2331    0.74402 0.900 0.080 0.000 0.020 0.000
#> GSM875456     1  0.0898    0.76576 0.972 0.008 0.000 0.020 0.000
#> GSM875461     1  0.5246    0.56602 0.596 0.344 0.000 0.060 0.000
#> GSM875462     1  0.4961    0.18123 0.524 0.448 0.000 0.028 0.000
#> GSM875465     2  0.6164    0.60811 0.356 0.540 0.080 0.024 0.000
#> GSM875469     1  0.3506    0.71776 0.824 0.132 0.000 0.044 0.000
#> GSM875470     2  0.5957    0.70720 0.280 0.572 0.148 0.000 0.000
#> GSM875471     2  0.6066    0.72402 0.240 0.572 0.188 0.000 0.000
#> GSM875472     1  0.1894    0.75666 0.920 0.072 0.000 0.008 0.000
#> GSM875475     1  0.2850    0.72534 0.872 0.092 0.000 0.036 0.000
#> GSM875476     2  0.6775    0.67826 0.304 0.536 0.108 0.052 0.000
#> GSM875477     1  0.0898    0.76576 0.972 0.008 0.000 0.020 0.000
#> GSM875414     5  0.3662    0.33460 0.000 0.252 0.004 0.000 0.744
#> GSM875427     3  0.3034    0.80021 0.000 0.040 0.880 0.020 0.060
#> GSM875431     5  0.3689    0.33230 0.000 0.256 0.004 0.000 0.740
#> GSM875433     3  0.5090    0.64733 0.000 0.048 0.752 0.112 0.088
#> GSM875443     2  0.5571    0.57220 0.084 0.568 0.348 0.000 0.000
#> GSM875444     3  0.0609    0.86024 0.000 0.020 0.980 0.000 0.000
#> GSM875445     3  0.1026    0.85339 0.000 0.004 0.968 0.024 0.004
#> GSM875449     3  0.0404    0.86042 0.000 0.000 0.988 0.012 0.000
#> GSM875450     3  0.0609    0.86024 0.000 0.020 0.980 0.000 0.000
#> GSM875452     3  0.0000    0.86132 0.000 0.000 1.000 0.000 0.000
#> GSM875454     5  0.5340    0.53674 0.000 0.012 0.060 0.280 0.648
#> GSM875457     3  0.0510    0.86116 0.000 0.016 0.984 0.000 0.000
#> GSM875458     3  0.0609    0.86024 0.000 0.020 0.980 0.000 0.000
#> GSM875467     3  0.1671    0.82665 0.000 0.076 0.924 0.000 0.000
#> GSM875468     3  0.2153    0.84093 0.000 0.044 0.916 0.000 0.040
#> GSM875412     4  0.4856   -0.05270 0.000 0.004 0.020 0.584 0.392
#> GSM875419     4  0.5243    0.38140 0.000 0.004 0.084 0.668 0.244
#> GSM875420     5  0.3949    0.61133 0.000 0.000 0.004 0.300 0.696
#> GSM875421     4  0.7210    0.37318 0.000 0.020 0.324 0.396 0.260
#> GSM875422     5  0.4318    0.58116 0.000 0.004 0.004 0.348 0.644
#> GSM875426     5  0.4596    0.33995 0.000 0.004 0.004 0.492 0.500
#> GSM875428     5  0.4169    0.61849 0.000 0.016 0.004 0.256 0.724
#> GSM875429     4  0.6559    0.44682 0.000 0.028 0.300 0.544 0.128
#> GSM875434     3  0.2459    0.83651 0.000 0.052 0.904 0.004 0.040
#> GSM875438     4  0.4423    0.36592 0.000 0.004 0.036 0.728 0.232
#> GSM875439     5  0.4169    0.61849 0.000 0.016 0.004 0.256 0.724
#> GSM875440     5  0.4596    0.33995 0.000 0.004 0.004 0.492 0.500
#> GSM875441     4  0.4264    0.00328 0.000 0.000 0.004 0.620 0.376
#> GSM875442     4  0.7571    0.35738 0.000 0.044 0.352 0.356 0.248
#> GSM875446     5  0.4194    0.61833 0.000 0.016 0.004 0.260 0.720
#> GSM875448     4  0.5838    0.13491 0.000 0.112 0.336 0.552 0.000
#> GSM875453     4  0.3950    0.49410 0.000 0.020 0.076 0.824 0.080
#> GSM875455     3  0.6137    0.22186 0.000 0.132 0.476 0.392 0.000
#> GSM875459     5  0.4684    0.44230 0.000 0.008 0.004 0.452 0.536
#> GSM875460     3  0.5141    0.59583 0.000 0.092 0.672 0.236 0.000
#> GSM875463     4  0.5976   -0.07658 0.000 0.112 0.400 0.488 0.000
#> GSM875464     5  0.4116    0.33648 0.000 0.248 0.004 0.016 0.732
#> GSM875466     3  0.1410    0.83350 0.000 0.060 0.940 0.000 0.000
#> GSM875473     3  0.3888    0.73525 0.000 0.120 0.804 0.076 0.000
#> GSM875474     4  0.4690    0.47228 0.000 0.004 0.092 0.744 0.160
#> GSM875478     4  0.3908    0.49202 0.000 0.016 0.072 0.824 0.088
#> GSM875479     4  0.3340    0.40191 0.000 0.016 0.004 0.824 0.156
#> GSM875480     4  0.5896    0.04266 0.000 0.008 0.080 0.516 0.396
#> GSM875481     5  0.4318    0.58116 0.000 0.004 0.004 0.348 0.644

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.4448    0.60107 0.704 0.036 0.000 0.236 0.000 0.024
#> GSM875415     1  0.0632    0.73904 0.976 0.000 0.000 0.024 0.000 0.000
#> GSM875416     1  0.2527    0.75051 0.876 0.000 0.000 0.040 0.000 0.084
#> GSM875417     6  0.3172    0.70922 0.040 0.000 0.100 0.016 0.000 0.844
#> GSM875418     1  0.2312    0.70767 0.876 0.000 0.000 0.112 0.000 0.012
#> GSM875423     6  0.5042    0.00773 0.412 0.004 0.000 0.064 0.000 0.520
#> GSM875424     6  0.4828   -0.01109 0.452 0.004 0.000 0.044 0.000 0.500
#> GSM875425     1  0.5890    0.02759 0.420 0.004 0.000 0.172 0.000 0.404
#> GSM875430     1  0.3886    0.69460 0.776 0.004 0.000 0.080 0.000 0.140
#> GSM875432     1  0.5007    0.38723 0.596 0.004 0.000 0.080 0.000 0.320
#> GSM875435     1  0.2773    0.74566 0.868 0.004 0.000 0.064 0.000 0.064
#> GSM875436     6  0.5927    0.28708 0.000 0.012 0.168 0.180 0.028 0.612
#> GSM875437     6  0.3964    0.68978 0.128 0.008 0.024 0.044 0.000 0.796
#> GSM875447     1  0.3063    0.74009 0.840 0.000 0.000 0.068 0.000 0.092
#> GSM875451     1  0.1434    0.73566 0.940 0.000 0.000 0.048 0.000 0.012
#> GSM875456     1  0.2474    0.75029 0.880 0.000 0.000 0.040 0.000 0.080
#> GSM875461     1  0.5823    0.21601 0.508 0.004 0.000 0.192 0.000 0.296
#> GSM875462     6  0.5611    0.24101 0.308 0.004 0.000 0.152 0.000 0.536
#> GSM875465     6  0.3327    0.71319 0.108 0.008 0.040 0.008 0.000 0.836
#> GSM875469     1  0.2266    0.70564 0.880 0.000 0.000 0.108 0.000 0.012
#> GSM875470     6  0.3220    0.71802 0.088 0.000 0.052 0.016 0.000 0.844
#> GSM875471     6  0.3246    0.71987 0.072 0.000 0.068 0.016 0.000 0.844
#> GSM875472     1  0.4518    0.62170 0.688 0.004 0.000 0.072 0.000 0.236
#> GSM875475     1  0.3886    0.69460 0.776 0.004 0.000 0.080 0.000 0.140
#> GSM875476     6  0.3953    0.69182 0.064 0.012 0.044 0.064 0.000 0.816
#> GSM875477     1  0.2474    0.75029 0.880 0.000 0.000 0.040 0.000 0.080
#> GSM875414     2  0.2103    0.97836 0.000 0.912 0.000 0.020 0.056 0.012
#> GSM875427     3  0.1768    0.83884 0.000 0.044 0.932 0.008 0.012 0.004
#> GSM875431     2  0.2103    0.97836 0.000 0.912 0.000 0.020 0.056 0.012
#> GSM875433     3  0.4466    0.66676 0.000 0.044 0.764 0.012 0.140 0.040
#> GSM875443     6  0.2846    0.68042 0.004 0.000 0.140 0.016 0.000 0.840
#> GSM875444     3  0.0260    0.86810 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM875445     3  0.0551    0.86528 0.000 0.000 0.984 0.004 0.008 0.004
#> GSM875449     3  0.0146    0.86782 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM875450     3  0.0260    0.86810 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM875452     3  0.0405    0.86732 0.000 0.000 0.988 0.008 0.004 0.000
#> GSM875454     5  0.4684    0.48601 0.000 0.276 0.060 0.008 0.656 0.000
#> GSM875457     3  0.0520    0.86776 0.000 0.000 0.984 0.008 0.000 0.008
#> GSM875458     3  0.0520    0.86796 0.000 0.000 0.984 0.008 0.000 0.008
#> GSM875467     3  0.1957    0.79921 0.000 0.000 0.888 0.000 0.000 0.112
#> GSM875468     3  0.1149    0.86102 0.000 0.024 0.960 0.008 0.000 0.008
#> GSM875412     5  0.1218    0.52014 0.000 0.000 0.004 0.028 0.956 0.012
#> GSM875419     5  0.3803    0.26064 0.000 0.000 0.040 0.172 0.776 0.012
#> GSM875420     5  0.3426    0.52750 0.000 0.276 0.000 0.000 0.720 0.004
#> GSM875421     5  0.7253   -0.11508 0.000 0.064 0.328 0.132 0.436 0.040
#> GSM875422     5  0.3198    0.54190 0.000 0.260 0.000 0.000 0.740 0.000
#> GSM875426     5  0.2420    0.59702 0.000 0.108 0.000 0.008 0.876 0.008
#> GSM875428     5  0.3969    0.45656 0.000 0.332 0.000 0.000 0.652 0.016
#> GSM875429     5  0.7563   -0.32163 0.000 0.032 0.296 0.236 0.372 0.064
#> GSM875434     3  0.2767    0.82639 0.000 0.028 0.880 0.044 0.000 0.048
#> GSM875438     5  0.3533    0.24699 0.000 0.000 0.008 0.196 0.776 0.020
#> GSM875439     5  0.4252    0.43845 0.000 0.344 0.000 0.008 0.632 0.016
#> GSM875440     5  0.2420    0.59702 0.000 0.108 0.000 0.008 0.876 0.008
#> GSM875441     5  0.1863    0.49786 0.000 0.004 0.000 0.060 0.920 0.016
#> GSM875442     5  0.7687   -0.18637 0.000 0.088 0.344 0.148 0.372 0.048
#> GSM875446     5  0.4252    0.43845 0.000 0.344 0.000 0.008 0.632 0.016
#> GSM875448     4  0.6281    0.70683 0.000 0.000 0.128 0.572 0.212 0.088
#> GSM875453     4  0.4979    0.61353 0.000 0.000 0.024 0.524 0.424 0.028
#> GSM875455     4  0.6747    0.58244 0.000 0.004 0.220 0.528 0.112 0.136
#> GSM875459     5  0.3419    0.56729 0.000 0.180 0.000 0.012 0.792 0.016
#> GSM875460     3  0.5242    0.07903 0.000 0.000 0.492 0.412 0.000 0.096
#> GSM875463     4  0.6488    0.68626 0.000 0.000 0.144 0.564 0.160 0.132
#> GSM875464     2  0.1524    0.95585 0.000 0.932 0.000 0.008 0.060 0.000
#> GSM875466     3  0.2357    0.79121 0.000 0.000 0.872 0.012 0.000 0.116
#> GSM875473     3  0.5288    0.41854 0.000 0.000 0.596 0.240 0.000 0.164
#> GSM875474     5  0.4864    0.00148 0.000 0.004 0.032 0.248 0.676 0.040
#> GSM875478     4  0.4450    0.62969 0.000 0.004 0.016 0.568 0.408 0.004
#> GSM875479     4  0.4103    0.57505 0.000 0.004 0.000 0.544 0.448 0.004
#> GSM875480     5  0.3428    0.50360 0.000 0.068 0.044 0.040 0.844 0.004
#> GSM875481     5  0.3198    0.54190 0.000 0.260 0.000 0.000 0.740 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) k
#> ATC:kmeans 70         3.65e-14 2
#> ATC:kmeans 66         1.15e-15 3
#> ATC:kmeans 46         1.78e-11 4
#> ATC:kmeans 44         7.63e-10 5
#> ATC:kmeans 50         6.82e-13 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 51941 rows and 70 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.955       0.982         0.4957 0.499   0.499
#> 3 3 1.000           0.995       0.998         0.2818 0.839   0.687
#> 4 4 0.904           0.939       0.950         0.1109 0.923   0.791
#> 5 5 0.793           0.815       0.855         0.0666 1.000   1.000
#> 6 6 0.752           0.754       0.835         0.0492 0.889   0.630

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
#> GSM875413     1  0.0000      0.958 1.000 0.000
#> GSM875415     1  0.0000      0.958 1.000 0.000
#> GSM875416     1  0.0000      0.958 1.000 0.000
#> GSM875417     1  0.0000      0.958 1.000 0.000
#> GSM875418     1  0.0000      0.958 1.000 0.000
#> GSM875423     1  0.0000      0.958 1.000 0.000
#> GSM875424     1  0.0000      0.958 1.000 0.000
#> GSM875425     1  0.0000      0.958 1.000 0.000
#> GSM875430     1  0.0000      0.958 1.000 0.000
#> GSM875432     1  0.0000      0.958 1.000 0.000
#> GSM875435     1  0.0000      0.958 1.000 0.000
#> GSM875436     1  0.0000      0.958 1.000 0.000
#> GSM875437     1  0.0000      0.958 1.000 0.000
#> GSM875447     1  0.0000      0.958 1.000 0.000
#> GSM875451     1  0.0000      0.958 1.000 0.000
#> GSM875456     1  0.0000      0.958 1.000 0.000
#> GSM875461     1  0.0000      0.958 1.000 0.000
#> GSM875462     1  0.0000      0.958 1.000 0.000
#> GSM875465     1  0.0000      0.958 1.000 0.000
#> GSM875469     1  0.0000      0.958 1.000 0.000
#> GSM875470     1  0.0000      0.958 1.000 0.000
#> GSM875471     1  0.0000      0.958 1.000 0.000
#> GSM875472     1  0.0000      0.958 1.000 0.000
#> GSM875475     1  0.0000      0.958 1.000 0.000
#> GSM875476     1  0.0000      0.958 1.000 0.000
#> GSM875477     1  0.0000      0.958 1.000 0.000
#> GSM875414     2  0.0000      0.999 0.000 1.000
#> GSM875427     2  0.0000      0.999 0.000 1.000
#> GSM875431     2  0.0000      0.999 0.000 1.000
#> GSM875433     2  0.0000      0.999 0.000 1.000
#> GSM875443     1  0.0000      0.958 1.000 0.000
#> GSM875444     2  0.0000      0.999 0.000 1.000
#> GSM875445     2  0.0000      0.999 0.000 1.000
#> GSM875449     2  0.0000      0.999 0.000 1.000
#> GSM875450     1  0.2236      0.927 0.964 0.036
#> GSM875452     2  0.0000      0.999 0.000 1.000
#> GSM875454     2  0.0000      0.999 0.000 1.000
#> GSM875457     2  0.0000      0.999 0.000 1.000
#> GSM875458     1  0.9710      0.381 0.600 0.400
#> GSM875467     1  0.9710      0.381 0.600 0.400
#> GSM875468     1  0.9686      0.391 0.604 0.396
#> GSM875412     2  0.0000      0.999 0.000 1.000
#> GSM875419     2  0.0000      0.999 0.000 1.000
#> GSM875420     2  0.0000      0.999 0.000 1.000
#> GSM875421     2  0.0000      0.999 0.000 1.000
#> GSM875422     2  0.0000      0.999 0.000 1.000
#> GSM875426     2  0.0000      0.999 0.000 1.000
#> GSM875428     2  0.0000      0.999 0.000 1.000
#> GSM875429     2  0.0000      0.999 0.000 1.000
#> GSM875434     2  0.2423      0.956 0.040 0.960
#> GSM875438     2  0.0000      0.999 0.000 1.000
#> GSM875439     2  0.0000      0.999 0.000 1.000
#> GSM875440     2  0.0000      0.999 0.000 1.000
#> GSM875441     2  0.0000      0.999 0.000 1.000
#> GSM875442     2  0.0000      0.999 0.000 1.000
#> GSM875446     2  0.0000      0.999 0.000 1.000
#> GSM875448     2  0.0000      0.999 0.000 1.000
#> GSM875453     2  0.0000      0.999 0.000 1.000
#> GSM875455     2  0.0000      0.999 0.000 1.000
#> GSM875459     2  0.0000      0.999 0.000 1.000
#> GSM875460     2  0.0000      0.999 0.000 1.000
#> GSM875463     2  0.0000      0.999 0.000 1.000
#> GSM875464     2  0.0000      0.999 0.000 1.000
#> GSM875466     2  0.0000      0.999 0.000 1.000
#> GSM875473     2  0.0938      0.987 0.012 0.988
#> GSM875474     2  0.0000      0.999 0.000 1.000
#> GSM875478     2  0.0000      0.999 0.000 1.000
#> GSM875479     2  0.0000      0.999 0.000 1.000
#> GSM875480     2  0.0000      0.999 0.000 1.000
#> GSM875481     2  0.0000      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
#> GSM875413     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875415     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875416     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875417     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875418     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875423     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875424     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875425     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875430     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875432     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875435     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875436     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875437     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875447     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875451     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875456     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875461     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875462     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875465     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875469     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875470     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875471     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875472     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875475     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875476     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875477     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875414     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875427     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875431     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875433     2  0.0237      0.993 0.000 0.996 0.004
#> GSM875443     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875444     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875454     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875457     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875421     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875422     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875426     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875428     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875429     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875434     2  0.0983      0.976 0.016 0.980 0.004
#> GSM875438     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875448     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875453     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875455     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875460     2  0.2711      0.903 0.000 0.912 0.088
#> GSM875463     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.995 0.000 0.000 1.000
#> GSM875473     3  0.1964      0.940 0.000 0.056 0.944
#> GSM875474     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875478     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875479     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875480     2  0.0000      0.996 0.000 1.000 0.000
#> GSM875481     2  0.0000      0.996 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
#> GSM875413     1  0.0188      0.992 0.996 0.000 0.000 0.004
#> GSM875415     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0188      0.992 0.996 0.000 0.000 0.004
#> GSM875417     1  0.0817      0.984 0.976 0.000 0.000 0.024
#> GSM875418     1  0.0188      0.992 0.996 0.000 0.000 0.004
#> GSM875423     1  0.0188      0.992 0.996 0.000 0.000 0.004
#> GSM875424     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875425     1  0.0592      0.988 0.984 0.000 0.000 0.016
#> GSM875430     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875436     1  0.2053      0.920 0.924 0.004 0.000 0.072
#> GSM875437     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0188      0.992 0.996 0.000 0.000 0.004
#> GSM875462     1  0.0592      0.988 0.984 0.000 0.000 0.016
#> GSM875465     1  0.0336      0.990 0.992 0.000 0.000 0.008
#> GSM875469     1  0.0188      0.992 0.996 0.000 0.000 0.004
#> GSM875470     1  0.0707      0.986 0.980 0.000 0.000 0.020
#> GSM875471     1  0.0707      0.986 0.980 0.000 0.000 0.020
#> GSM875472     1  0.0469      0.989 0.988 0.000 0.000 0.012
#> GSM875475     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875476     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875477     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> GSM875414     2  0.2469      0.883 0.000 0.892 0.000 0.108
#> GSM875427     3  0.3308      0.855 0.000 0.036 0.872 0.092
#> GSM875431     2  0.2654      0.880 0.000 0.888 0.004 0.108
#> GSM875433     2  0.2654      0.880 0.000 0.888 0.004 0.108
#> GSM875443     1  0.0817      0.984 0.976 0.000 0.000 0.024
#> GSM875444     3  0.0000      0.971 0.000 0.000 1.000 0.000
#> GSM875445     3  0.1022      0.946 0.000 0.032 0.968 0.000
#> GSM875449     3  0.0336      0.969 0.000 0.000 0.992 0.008
#> GSM875450     3  0.0188      0.970 0.000 0.000 0.996 0.004
#> GSM875452     3  0.0000      0.971 0.000 0.000 1.000 0.000
#> GSM875454     2  0.0921      0.918 0.000 0.972 0.000 0.028
#> GSM875457     3  0.1792      0.926 0.000 0.000 0.932 0.068
#> GSM875458     3  0.0000      0.971 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0188      0.970 0.000 0.000 0.996 0.004
#> GSM875468     3  0.0000      0.971 0.000 0.000 1.000 0.000
#> GSM875412     2  0.1557      0.909 0.000 0.944 0.000 0.056
#> GSM875419     2  0.1557      0.909 0.000 0.944 0.000 0.056
#> GSM875420     2  0.0188      0.923 0.000 0.996 0.000 0.004
#> GSM875421     2  0.1716      0.905 0.000 0.936 0.000 0.064
#> GSM875422     2  0.0188      0.923 0.000 0.996 0.000 0.004
#> GSM875426     2  0.1637      0.906 0.000 0.940 0.000 0.060
#> GSM875428     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM875429     2  0.2868      0.871 0.000 0.864 0.000 0.136
#> GSM875434     2  0.3995      0.826 0.004 0.824 0.024 0.148
#> GSM875438     2  0.1792      0.901 0.000 0.932 0.000 0.068
#> GSM875439     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM875440     2  0.1637      0.906 0.000 0.940 0.000 0.060
#> GSM875441     2  0.1716      0.904 0.000 0.936 0.000 0.064
#> GSM875442     2  0.2469      0.883 0.000 0.892 0.000 0.108
#> GSM875446     2  0.0921      0.918 0.000 0.972 0.000 0.028
#> GSM875448     4  0.3074      0.915 0.000 0.152 0.000 0.848
#> GSM875453     4  0.4008      0.866 0.000 0.244 0.000 0.756
#> GSM875455     4  0.3123      0.916 0.000 0.156 0.000 0.844
#> GSM875459     2  0.1557      0.908 0.000 0.944 0.000 0.056
#> GSM875460     4  0.3545      0.914 0.000 0.164 0.008 0.828
#> GSM875463     4  0.3024      0.912 0.000 0.148 0.000 0.852
#> GSM875464     2  0.2469      0.883 0.000 0.892 0.000 0.108
#> GSM875466     3  0.1109      0.957 0.000 0.004 0.968 0.028
#> GSM875473     4  0.4253      0.631 0.000 0.016 0.208 0.776
#> GSM875474     2  0.1792      0.902 0.000 0.932 0.000 0.068
#> GSM875478     4  0.3528      0.910 0.000 0.192 0.000 0.808
#> GSM875479     4  0.3975      0.872 0.000 0.240 0.000 0.760
#> GSM875480     2  0.0000      0.924 0.000 1.000 0.000 0.000
#> GSM875481     2  0.0188      0.923 0.000 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1 p2    p3    p4    p5
#> GSM875413     1  0.0963      0.877 0.964 NA 0.000 0.000 0.000
#> GSM875415     1  0.0703      0.871 0.976 NA 0.000 0.000 0.000
#> GSM875416     1  0.2179      0.865 0.888 NA 0.000 0.000 0.000
#> GSM875417     1  0.4430      0.730 0.628 NA 0.000 0.012 0.000
#> GSM875418     1  0.0963      0.877 0.964 NA 0.000 0.000 0.000
#> GSM875423     1  0.2719      0.854 0.852 NA 0.000 0.004 0.000
#> GSM875424     1  0.1341      0.875 0.944 NA 0.000 0.000 0.000
#> GSM875425     1  0.4268      0.738 0.648 NA 0.000 0.008 0.000
#> GSM875430     1  0.0703      0.871 0.976 NA 0.000 0.000 0.000
#> GSM875432     1  0.0880      0.870 0.968 NA 0.000 0.000 0.000
#> GSM875435     1  0.0609      0.871 0.980 NA 0.000 0.000 0.000
#> GSM875436     1  0.4869      0.555 0.656 NA 0.000 0.020 0.016
#> GSM875437     1  0.1410      0.872 0.940 NA 0.000 0.000 0.000
#> GSM875447     1  0.1043      0.869 0.960 NA 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.875 1.000 NA 0.000 0.000 0.000
#> GSM875456     1  0.0794      0.877 0.972 NA 0.000 0.000 0.000
#> GSM875461     1  0.1121      0.877 0.956 NA 0.000 0.000 0.000
#> GSM875462     1  0.4268      0.738 0.648 NA 0.000 0.008 0.000
#> GSM875465     1  0.3282      0.831 0.804 NA 0.000 0.008 0.000
#> GSM875469     1  0.0963      0.877 0.964 NA 0.000 0.000 0.000
#> GSM875470     1  0.4416      0.734 0.632 NA 0.000 0.012 0.000
#> GSM875471     1  0.4416      0.733 0.632 NA 0.000 0.012 0.000
#> GSM875472     1  0.3353      0.831 0.796 NA 0.000 0.008 0.000
#> GSM875475     1  0.0794      0.869 0.972 NA 0.000 0.000 0.000
#> GSM875476     1  0.1851      0.848 0.912 NA 0.000 0.000 0.000
#> GSM875477     1  0.0609      0.877 0.980 NA 0.000 0.000 0.000
#> GSM875414     5  0.4040      0.715 0.000 NA 0.000 0.016 0.724
#> GSM875427     3  0.4348      0.769 0.000 NA 0.768 0.020 0.032
#> GSM875431     5  0.4181      0.707 0.000 NA 0.000 0.020 0.712
#> GSM875433     5  0.4243      0.707 0.000 NA 0.000 0.024 0.712
#> GSM875443     1  0.4430      0.730 0.628 NA 0.000 0.012 0.000
#> GSM875444     3  0.0162      0.925 0.000 NA 0.996 0.004 0.000
#> GSM875445     3  0.1483      0.911 0.000 NA 0.952 0.008 0.028
#> GSM875449     3  0.0609      0.924 0.000 NA 0.980 0.000 0.000
#> GSM875450     3  0.0451      0.924 0.000 NA 0.988 0.004 0.000
#> GSM875452     3  0.0162      0.925 0.000 NA 0.996 0.004 0.000
#> GSM875454     5  0.0963      0.830 0.000 NA 0.000 0.000 0.964
#> GSM875457     3  0.2659      0.881 0.000 NA 0.888 0.060 0.000
#> GSM875458     3  0.1502      0.914 0.000 NA 0.940 0.004 0.000
#> GSM875467     3  0.0693      0.923 0.000 NA 0.980 0.008 0.000
#> GSM875468     3  0.1571      0.913 0.000 NA 0.936 0.004 0.000
#> GSM875412     5  0.3051      0.796 0.000 NA 0.000 0.028 0.852
#> GSM875419     5  0.2540      0.812 0.000 NA 0.000 0.024 0.888
#> GSM875420     5  0.0000      0.836 0.000 NA 0.000 0.000 1.000
#> GSM875421     5  0.2017      0.814 0.000 NA 0.000 0.008 0.912
#> GSM875422     5  0.0000      0.836 0.000 NA 0.000 0.000 1.000
#> GSM875426     5  0.2964      0.797 0.000 NA 0.000 0.024 0.856
#> GSM875428     5  0.0000      0.836 0.000 NA 0.000 0.000 1.000
#> GSM875429     5  0.4948      0.707 0.000 NA 0.000 0.068 0.676
#> GSM875434     5  0.5529      0.507 0.012 NA 0.008 0.028 0.540
#> GSM875438     5  0.3214      0.791 0.000 NA 0.000 0.036 0.844
#> GSM875439     5  0.0000      0.836 0.000 NA 0.000 0.000 1.000
#> GSM875440     5  0.3051      0.796 0.000 NA 0.000 0.028 0.852
#> GSM875441     5  0.3291      0.789 0.000 NA 0.000 0.040 0.840
#> GSM875442     5  0.3906      0.729 0.000 NA 0.000 0.016 0.744
#> GSM875446     5  0.0992      0.829 0.000 NA 0.000 0.024 0.968
#> GSM875448     4  0.1907      0.862 0.000 NA 0.000 0.928 0.044
#> GSM875453     4  0.5758      0.548 0.000 NA 0.000 0.592 0.284
#> GSM875455     4  0.1965      0.863 0.000 NA 0.000 0.924 0.052
#> GSM875459     5  0.2915      0.799 0.000 NA 0.000 0.024 0.860
#> GSM875460     4  0.2535      0.859 0.000 NA 0.000 0.892 0.076
#> GSM875463     4  0.1121      0.860 0.000 NA 0.000 0.956 0.044
#> GSM875464     5  0.4026      0.725 0.000 NA 0.000 0.020 0.736
#> GSM875466     3  0.4900      0.728 0.000 NA 0.748 0.044 0.044
#> GSM875473     4  0.3511      0.762 0.000 NA 0.068 0.848 0.012
#> GSM875474     5  0.3734      0.770 0.000 NA 0.000 0.060 0.812
#> GSM875478     4  0.2522      0.857 0.000 NA 0.000 0.880 0.108
#> GSM875479     4  0.3940      0.762 0.000 NA 0.000 0.756 0.220
#> GSM875480     5  0.0404      0.834 0.000 NA 0.000 0.000 0.988
#> GSM875481     5  0.0000      0.836 0.000 NA 0.000 0.000 1.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
#> GSM875413     1  0.1663      0.805 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM875415     1  0.0260      0.821 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875416     1  0.2762      0.681 0.804 0.000 0.000 0.000 0.000 0.196
#> GSM875417     6  0.3448      0.967 0.280 0.004 0.000 0.000 0.000 0.716
#> GSM875418     1  0.1663      0.805 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM875423     1  0.3050      0.610 0.764 0.000 0.000 0.000 0.000 0.236
#> GSM875424     1  0.1910      0.789 0.892 0.000 0.000 0.000 0.000 0.108
#> GSM875425     6  0.3446      0.938 0.308 0.000 0.000 0.000 0.000 0.692
#> GSM875430     1  0.0260      0.821 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM875432     1  0.0777      0.812 0.972 0.000 0.000 0.004 0.000 0.024
#> GSM875435     1  0.0000      0.821 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.6674      0.281 0.552 0.164 0.000 0.020 0.060 0.204
#> GSM875437     1  0.2062      0.792 0.900 0.008 0.000 0.004 0.000 0.088
#> GSM875447     1  0.0777      0.812 0.972 0.000 0.000 0.004 0.000 0.024
#> GSM875451     1  0.0547      0.823 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM875456     1  0.1471      0.812 0.932 0.000 0.000 0.004 0.000 0.064
#> GSM875461     1  0.2003      0.785 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM875462     6  0.3446      0.938 0.308 0.000 0.000 0.000 0.000 0.692
#> GSM875465     1  0.3820      0.347 0.660 0.004 0.000 0.004 0.000 0.332
#> GSM875469     1  0.1663      0.805 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM875470     6  0.3266      0.961 0.272 0.000 0.000 0.000 0.000 0.728
#> GSM875471     6  0.3448      0.967 0.280 0.004 0.000 0.000 0.000 0.716
#> GSM875472     1  0.3592      0.312 0.656 0.000 0.000 0.000 0.000 0.344
#> GSM875475     1  0.0777      0.812 0.972 0.000 0.000 0.004 0.000 0.024
#> GSM875476     1  0.3521      0.639 0.804 0.036 0.000 0.012 0.000 0.148
#> GSM875477     1  0.1152      0.821 0.952 0.000 0.000 0.004 0.000 0.044
#> GSM875414     2  0.3647      0.838 0.000 0.640 0.000 0.000 0.360 0.000
#> GSM875427     3  0.4915      0.551 0.000 0.336 0.608 0.004 0.028 0.024
#> GSM875431     2  0.3607      0.838 0.000 0.652 0.000 0.000 0.348 0.000
#> GSM875433     2  0.3620      0.840 0.000 0.648 0.000 0.000 0.352 0.000
#> GSM875443     6  0.3448      0.967 0.280 0.004 0.000 0.000 0.000 0.716
#> GSM875444     3  0.0260      0.863 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM875445     3  0.2755      0.783 0.000 0.012 0.856 0.000 0.120 0.012
#> GSM875449     3  0.2100      0.855 0.000 0.016 0.916 0.032 0.000 0.036
#> GSM875450     3  0.0909      0.861 0.000 0.020 0.968 0.000 0.000 0.012
#> GSM875452     3  0.0520      0.864 0.000 0.008 0.984 0.000 0.000 0.008
#> GSM875454     5  0.2762      0.674 0.000 0.196 0.000 0.000 0.804 0.000
#> GSM875457     3  0.3791      0.782 0.000 0.044 0.800 0.128 0.000 0.028
#> GSM875458     3  0.2069      0.853 0.000 0.068 0.908 0.004 0.000 0.020
#> GSM875467     3  0.1053      0.859 0.000 0.020 0.964 0.004 0.000 0.012
#> GSM875468     3  0.2069      0.853 0.000 0.068 0.908 0.004 0.000 0.020
#> GSM875412     5  0.1074      0.789 0.000 0.012 0.000 0.000 0.960 0.028
#> GSM875419     5  0.1411      0.812 0.000 0.060 0.000 0.000 0.936 0.004
#> GSM875420     5  0.2278      0.787 0.000 0.128 0.000 0.000 0.868 0.004
#> GSM875421     5  0.3175      0.501 0.000 0.256 0.000 0.000 0.744 0.000
#> GSM875422     5  0.1863      0.803 0.000 0.104 0.000 0.000 0.896 0.000
#> GSM875426     5  0.0405      0.802 0.000 0.004 0.000 0.000 0.988 0.008
#> GSM875428     5  0.2048      0.792 0.000 0.120 0.000 0.000 0.880 0.000
#> GSM875429     2  0.5283      0.620 0.000 0.488 0.000 0.048 0.440 0.024
#> GSM875434     2  0.2312      0.581 0.000 0.876 0.012 0.000 0.112 0.000
#> GSM875438     5  0.1138      0.788 0.000 0.012 0.000 0.004 0.960 0.024
#> GSM875439     5  0.1910      0.800 0.000 0.108 0.000 0.000 0.892 0.000
#> GSM875440     5  0.0622      0.799 0.000 0.008 0.000 0.000 0.980 0.012
#> GSM875441     5  0.1542      0.771 0.000 0.016 0.000 0.024 0.944 0.016
#> GSM875442     2  0.3782      0.776 0.000 0.588 0.000 0.000 0.412 0.000
#> GSM875446     5  0.1610      0.810 0.000 0.084 0.000 0.000 0.916 0.000
#> GSM875448     4  0.2220      0.817 0.000 0.012 0.000 0.908 0.044 0.036
#> GSM875453     5  0.5549     -0.161 0.000 0.036 0.000 0.412 0.496 0.056
#> GSM875455     4  0.2898      0.822 0.000 0.056 0.000 0.868 0.060 0.016
#> GSM875459     5  0.0146      0.804 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM875460     4  0.2228      0.821 0.000 0.024 0.004 0.908 0.056 0.008
#> GSM875463     4  0.1262      0.818 0.000 0.008 0.000 0.956 0.016 0.020
#> GSM875464     2  0.3706      0.821 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM875466     3  0.6848      0.535 0.000 0.068 0.584 0.064 0.148 0.136
#> GSM875473     4  0.3813      0.737 0.000 0.060 0.064 0.820 0.004 0.052
#> GSM875474     5  0.2032      0.747 0.000 0.036 0.000 0.020 0.920 0.024
#> GSM875478     4  0.3181      0.773 0.000 0.020 0.000 0.824 0.144 0.012
#> GSM875479     4  0.4502      0.358 0.000 0.016 0.000 0.568 0.404 0.012
#> GSM875480     5  0.2048      0.793 0.000 0.120 0.000 0.000 0.880 0.000
#> GSM875481     5  0.1814      0.806 0.000 0.100 0.000 0.000 0.900 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-skmeans-collect-classes

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

test_to_known_factors(res)
#>              n disease.state(p) k
#> ATC:skmeans 67         8.69e-14 2
#> ATC:skmeans 70         5.61e-20 3
#> ATC:skmeans 70         6.30e-20 4
#> ATC:skmeans 70         6.30e-20 5
#> ATC:skmeans 65         5.43e-17 6

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


ATC: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 51941 rows and 70 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 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-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.991       0.995         0.4803 0.519   0.519
#> 3 3 0.899           0.909       0.963         0.3909 0.716   0.500
#> 4 4 0.841           0.806       0.900         0.0631 0.924   0.774
#> 5 5 0.861           0.846       0.923         0.0662 0.937   0.784
#> 6 6 0.803           0.657       0.803         0.0618 0.937   0.760

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
#> GSM875413     1  0.0000      0.992 1.000 0.000
#> GSM875415     1  0.0000      0.992 1.000 0.000
#> GSM875416     1  0.0000      0.992 1.000 0.000
#> GSM875417     1  0.2423      0.962 0.960 0.040
#> GSM875418     1  0.0000      0.992 1.000 0.000
#> GSM875423     1  0.0000      0.992 1.000 0.000
#> GSM875424     1  0.0000      0.992 1.000 0.000
#> GSM875425     1  0.0000      0.992 1.000 0.000
#> GSM875430     1  0.0000      0.992 1.000 0.000
#> GSM875432     1  0.0000      0.992 1.000 0.000
#> GSM875435     1  0.0000      0.992 1.000 0.000
#> GSM875436     1  0.2778      0.955 0.952 0.048
#> GSM875437     1  0.0000      0.992 1.000 0.000
#> GSM875447     1  0.0000      0.992 1.000 0.000
#> GSM875451     1  0.0000      0.992 1.000 0.000
#> GSM875456     1  0.0000      0.992 1.000 0.000
#> GSM875461     1  0.0000      0.992 1.000 0.000
#> GSM875462     1  0.0000      0.992 1.000 0.000
#> GSM875465     1  0.0000      0.992 1.000 0.000
#> GSM875469     1  0.0000      0.992 1.000 0.000
#> GSM875470     1  0.0938      0.984 0.988 0.012
#> GSM875471     1  0.2236      0.966 0.964 0.036
#> GSM875472     1  0.0000      0.992 1.000 0.000
#> GSM875475     1  0.0000      0.992 1.000 0.000
#> GSM875476     1  0.0000      0.992 1.000 0.000
#> GSM875477     1  0.0000      0.992 1.000 0.000
#> GSM875414     2  0.0000      0.997 0.000 1.000
#> GSM875427     2  0.0000      0.997 0.000 1.000
#> GSM875431     2  0.0000      0.997 0.000 1.000
#> GSM875433     2  0.0000      0.997 0.000 1.000
#> GSM875443     1  0.3584      0.934 0.932 0.068
#> GSM875444     2  0.0000      0.997 0.000 1.000
#> GSM875445     2  0.0000      0.997 0.000 1.000
#> GSM875449     2  0.0000      0.997 0.000 1.000
#> GSM875450     2  0.0000      0.997 0.000 1.000
#> GSM875452     2  0.0000      0.997 0.000 1.000
#> GSM875454     2  0.0000      0.997 0.000 1.000
#> GSM875457     2  0.0000      0.997 0.000 1.000
#> GSM875458     2  0.4690      0.888 0.100 0.900
#> GSM875467     2  0.0938      0.986 0.012 0.988
#> GSM875468     2  0.0000      0.997 0.000 1.000
#> GSM875412     2  0.0000      0.997 0.000 1.000
#> GSM875419     2  0.0000      0.997 0.000 1.000
#> GSM875420     2  0.0000      0.997 0.000 1.000
#> GSM875421     2  0.0000      0.997 0.000 1.000
#> GSM875422     2  0.0000      0.997 0.000 1.000
#> GSM875426     2  0.0000      0.997 0.000 1.000
#> GSM875428     2  0.0000      0.997 0.000 1.000
#> GSM875429     2  0.0000      0.997 0.000 1.000
#> GSM875434     2  0.0000      0.997 0.000 1.000
#> GSM875438     2  0.0000      0.997 0.000 1.000
#> GSM875439     2  0.0000      0.997 0.000 1.000
#> GSM875440     2  0.0000      0.997 0.000 1.000
#> GSM875441     2  0.0000      0.997 0.000 1.000
#> GSM875442     2  0.0000      0.997 0.000 1.000
#> GSM875446     2  0.0000      0.997 0.000 1.000
#> GSM875448     2  0.0000      0.997 0.000 1.000
#> GSM875453     2  0.0000      0.997 0.000 1.000
#> GSM875455     2  0.0000      0.997 0.000 1.000
#> GSM875459     2  0.0000      0.997 0.000 1.000
#> GSM875460     2  0.0000      0.997 0.000 1.000
#> GSM875463     2  0.0000      0.997 0.000 1.000
#> GSM875464     2  0.0000      0.997 0.000 1.000
#> GSM875466     2  0.0000      0.997 0.000 1.000
#> GSM875473     2  0.0000      0.997 0.000 1.000
#> GSM875474     2  0.0000      0.997 0.000 1.000
#> GSM875478     2  0.0000      0.997 0.000 1.000
#> GSM875479     2  0.0000      0.997 0.000 1.000
#> GSM875480     2  0.0000      0.997 0.000 1.000
#> GSM875481     2  0.0000      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
#> GSM875413     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875415     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875416     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875417     3  0.3192      0.839 0.112 0.000 0.888
#> GSM875418     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875423     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875424     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875425     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875430     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875432     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875435     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875436     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875437     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875447     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875451     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875456     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875461     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875462     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875465     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875469     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875470     3  0.3192      0.843 0.112 0.000 0.888
#> GSM875471     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875472     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875475     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875476     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875477     1  0.0000      1.000 1.000 0.000 0.000
#> GSM875414     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875427     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875431     2  0.5760      0.528 0.000 0.672 0.328
#> GSM875433     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875443     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875454     2  0.6192      0.312 0.000 0.580 0.420
#> GSM875457     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875419     2  0.5098      0.654 0.000 0.752 0.248
#> GSM875420     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875421     3  0.5760      0.474 0.000 0.328 0.672
#> GSM875422     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875426     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875428     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875429     3  0.1529      0.914 0.000 0.040 0.960
#> GSM875434     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875438     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875442     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875446     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875448     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875453     3  0.5905      0.426 0.000 0.352 0.648
#> GSM875455     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875459     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875460     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875463     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875464     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875466     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875473     3  0.0000      0.948 0.000 0.000 1.000
#> GSM875474     2  0.0424      0.916 0.000 0.992 0.008
#> GSM875478     3  0.5529      0.566 0.000 0.296 0.704
#> GSM875479     2  0.0000      0.922 0.000 1.000 0.000
#> GSM875480     2  0.5926      0.474 0.000 0.644 0.356
#> GSM875481     2  0.0000      0.922 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
#> GSM875413     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875415     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875417     4  0.6831      0.514 0.112 0.000 0.352 0.536
#> GSM875418     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875423     1  0.0707      0.959 0.980 0.000 0.000 0.020
#> GSM875424     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875425     4  0.4992      0.331 0.476 0.000 0.000 0.524
#> GSM875430     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0469      0.970 0.988 0.000 0.000 0.012
#> GSM875435     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875436     3  0.1022      0.904 0.000 0.000 0.968 0.032
#> GSM875437     4  0.4967      0.380 0.452 0.000 0.000 0.548
#> GSM875447     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875462     4  0.4967      0.380 0.452 0.000 0.000 0.548
#> GSM875465     4  0.4967      0.380 0.452 0.000 0.000 0.548
#> GSM875469     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875470     4  0.6574      0.491 0.088 0.000 0.364 0.548
#> GSM875471     4  0.4967      0.317 0.000 0.000 0.452 0.548
#> GSM875472     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875475     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875476     1  0.3610      0.658 0.800 0.000 0.000 0.200
#> GSM875477     1  0.0000      0.982 1.000 0.000 0.000 0.000
#> GSM875414     2  0.4967      0.522 0.000 0.548 0.000 0.452
#> GSM875427     3  0.0336      0.928 0.000 0.008 0.992 0.000
#> GSM875431     2  0.4967      0.522 0.000 0.548 0.000 0.452
#> GSM875433     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875443     4  0.4985      0.285 0.000 0.000 0.468 0.532
#> GSM875444     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875449     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875454     2  0.4941      0.220 0.000 0.564 0.436 0.000
#> GSM875457     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875412     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875419     2  0.4193      0.588 0.000 0.732 0.268 0.000
#> GSM875420     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875421     3  0.3907      0.612 0.000 0.232 0.768 0.000
#> GSM875422     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875426     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875428     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875429     3  0.0707      0.915 0.000 0.020 0.980 0.000
#> GSM875434     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875438     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875439     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875440     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875441     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875442     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875448     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875453     3  0.4967      0.108 0.000 0.452 0.548 0.000
#> GSM875455     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875459     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875460     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875463     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875464     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875466     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875473     3  0.0000      0.935 0.000 0.000 1.000 0.000
#> GSM875474     2  0.0469      0.870 0.000 0.988 0.012 0.000
#> GSM875478     3  0.4250      0.554 0.000 0.276 0.724 0.000
#> GSM875479     2  0.0000      0.879 0.000 1.000 0.000 0.000
#> GSM875480     2  0.4972      0.163 0.000 0.544 0.456 0.000
#> GSM875481     2  0.0000      0.879 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875415     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875417     2  0.0510      0.913 0.000 0.984 0.016 0.000 0.000
#> GSM875418     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.0703      0.959 0.976 0.024 0.000 0.000 0.000
#> GSM875424     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875425     2  0.0794      0.897 0.028 0.972 0.000 0.000 0.000
#> GSM875430     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0510      0.967 0.984 0.016 0.000 0.000 0.000
#> GSM875435     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875436     3  0.1043      0.867 0.000 0.040 0.960 0.000 0.000
#> GSM875437     2  0.0000      0.926 0.000 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875461     1  0.0162      0.976 0.996 0.004 0.000 0.000 0.000
#> GSM875462     2  0.0000      0.926 0.000 1.000 0.000 0.000 0.000
#> GSM875465     2  0.0000      0.926 0.000 1.000 0.000 0.000 0.000
#> GSM875469     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875470     2  0.0000      0.926 0.000 1.000 0.000 0.000 0.000
#> GSM875471     2  0.0000      0.926 0.000 1.000 0.000 0.000 0.000
#> GSM875472     1  0.1792      0.895 0.916 0.084 0.000 0.000 0.000
#> GSM875475     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875476     1  0.3109      0.749 0.800 0.200 0.000 0.000 0.000
#> GSM875477     1  0.0000      0.978 1.000 0.000 0.000 0.000 0.000
#> GSM875414     5  0.0404      0.993 0.000 0.000 0.000 0.012 0.988
#> GSM875427     3  0.0290      0.885 0.000 0.000 0.992 0.000 0.008
#> GSM875431     5  0.0290      0.993 0.000 0.000 0.000 0.008 0.992
#> GSM875433     3  0.0807      0.881 0.000 0.000 0.976 0.012 0.012
#> GSM875443     2  0.3561      0.515 0.000 0.740 0.260 0.000 0.000
#> GSM875444     3  0.0290      0.885 0.000 0.000 0.992 0.000 0.008
#> GSM875445     3  0.0290      0.885 0.000 0.000 0.992 0.000 0.008
#> GSM875449     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> GSM875450     3  0.0290      0.885 0.000 0.000 0.992 0.000 0.008
#> GSM875452     3  0.0290      0.885 0.000 0.000 0.992 0.000 0.008
#> GSM875454     3  0.5874      0.376 0.000 0.000 0.604 0.208 0.188
#> GSM875457     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> GSM875458     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> GSM875467     3  0.0290      0.885 0.000 0.000 0.992 0.000 0.008
#> GSM875468     3  0.0290      0.885 0.000 0.000 0.992 0.000 0.008
#> GSM875412     4  0.0162      0.806 0.000 0.000 0.000 0.996 0.004
#> GSM875419     4  0.3884      0.388 0.000 0.000 0.288 0.708 0.004
#> GSM875420     4  0.0290      0.808 0.000 0.000 0.000 0.992 0.008
#> GSM875421     3  0.3692      0.741 0.000 0.000 0.812 0.052 0.136
#> GSM875422     4  0.3003      0.834 0.000 0.000 0.000 0.812 0.188
#> GSM875426     4  0.3003      0.834 0.000 0.000 0.000 0.812 0.188
#> GSM875428     4  0.3003      0.834 0.000 0.000 0.000 0.812 0.188
#> GSM875429     3  0.3160      0.736 0.000 0.000 0.808 0.188 0.004
#> GSM875434     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> GSM875438     4  0.0290      0.808 0.000 0.000 0.000 0.992 0.008
#> GSM875439     4  0.3003      0.834 0.000 0.000 0.000 0.812 0.188
#> GSM875440     4  0.0510      0.811 0.000 0.000 0.000 0.984 0.016
#> GSM875441     4  0.0000      0.808 0.000 0.000 0.000 1.000 0.000
#> GSM875442     3  0.0807      0.881 0.000 0.000 0.976 0.012 0.012
#> GSM875446     4  0.3003      0.834 0.000 0.000 0.000 0.812 0.188
#> GSM875448     3  0.0451      0.882 0.000 0.000 0.988 0.008 0.004
#> GSM875453     4  0.3123      0.572 0.000 0.000 0.184 0.812 0.004
#> GSM875455     3  0.3395      0.675 0.000 0.236 0.764 0.000 0.000
#> GSM875459     4  0.3003      0.834 0.000 0.000 0.000 0.812 0.188
#> GSM875460     3  0.0451      0.882 0.000 0.000 0.988 0.008 0.004
#> GSM875463     3  0.3883      0.663 0.000 0.244 0.744 0.008 0.004
#> GSM875464     4  0.3003      0.834 0.000 0.000 0.000 0.812 0.188
#> GSM875466     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> GSM875473     3  0.3424      0.670 0.000 0.240 0.760 0.000 0.000
#> GSM875474     4  0.0290      0.803 0.000 0.000 0.000 0.992 0.008
#> GSM875478     3  0.6262      0.223 0.000 0.000 0.520 0.304 0.176
#> GSM875479     4  0.2648      0.834 0.000 0.000 0.000 0.848 0.152
#> GSM875480     3  0.4593      0.632 0.000 0.000 0.736 0.080 0.184
#> GSM875481     4  0.3003      0.834 0.000 0.000 0.000 0.812 0.188

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM875413     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875415     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.1865     0.9357 0.920 0.040 0.000 0.000 0.040 0.000
#> GSM875417     6  0.0363     0.9252 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM875418     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875423     1  0.1492     0.9430 0.940 0.000 0.000 0.000 0.036 0.024
#> GSM875424     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875425     6  0.2016     0.8677 0.016 0.024 0.000 0.000 0.040 0.920
#> GSM875430     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875432     1  0.0363     0.9531 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM875435     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875436     3  0.4236     0.7525 0.000 0.000 0.656 0.000 0.308 0.036
#> GSM875437     6  0.0000     0.9345 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM875447     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.1865     0.9357 0.920 0.040 0.000 0.000 0.040 0.000
#> GSM875456     1  0.1865     0.9357 0.920 0.040 0.000 0.000 0.040 0.000
#> GSM875461     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875462     6  0.0000     0.9345 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM875465     6  0.0000     0.9345 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM875469     1  0.1865     0.9357 0.920 0.040 0.000 0.000 0.040 0.000
#> GSM875470     6  0.0000     0.9345 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM875471     6  0.0000     0.9345 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM875472     1  0.2728     0.8812 0.872 0.008 0.000 0.000 0.040 0.080
#> GSM875475     1  0.0000     0.9572 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875476     1  0.2793     0.7556 0.800 0.000 0.000 0.000 0.000 0.200
#> GSM875477     1  0.1245     0.9467 0.952 0.016 0.000 0.000 0.032 0.000
#> GSM875414     2  0.1075     0.9878 0.000 0.952 0.000 0.000 0.048 0.000
#> GSM875427     3  0.0146     0.7396 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875431     2  0.1349     0.9877 0.000 0.940 0.000 0.004 0.056 0.000
#> GSM875433     3  0.0922     0.7376 0.000 0.004 0.968 0.004 0.024 0.000
#> GSM875443     6  0.2912     0.6249 0.000 0.000 0.216 0.000 0.000 0.784
#> GSM875444     3  0.0146     0.7396 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875445     3  0.0146     0.7396 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875449     3  0.3619     0.7602 0.000 0.004 0.680 0.000 0.316 0.000
#> GSM875450     3  0.0146     0.7396 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875452     3  0.0146     0.7396 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875454     5  0.4187     0.4025 0.000 0.124 0.080 0.024 0.772 0.000
#> GSM875457     3  0.3619     0.7602 0.000 0.004 0.680 0.000 0.316 0.000
#> GSM875458     3  0.3446     0.7614 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM875467     3  0.2703     0.7558 0.000 0.004 0.824 0.000 0.172 0.000
#> GSM875468     3  0.0146     0.7396 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875412     4  0.1501     0.5078 0.000 0.000 0.000 0.924 0.076 0.000
#> GSM875419     4  0.3221     0.3899 0.000 0.000 0.000 0.736 0.264 0.000
#> GSM875420     4  0.3828     0.2286 0.000 0.000 0.000 0.560 0.440 0.000
#> GSM875421     5  0.4993     0.1145 0.000 0.000 0.344 0.084 0.572 0.000
#> GSM875422     5  0.5219     0.1441 0.000 0.124 0.000 0.296 0.580 0.000
#> GSM875426     4  0.5458     0.1255 0.000 0.124 0.000 0.480 0.396 0.000
#> GSM875428     5  0.5322     0.1332 0.000 0.128 0.000 0.316 0.556 0.000
#> GSM875429     3  0.3966     0.2128 0.000 0.000 0.552 0.444 0.004 0.000
#> GSM875434     3  0.3619     0.7602 0.000 0.004 0.680 0.000 0.316 0.000
#> GSM875438     4  0.1219     0.5192 0.000 0.004 0.000 0.948 0.048 0.000
#> GSM875439     4  0.5560     0.1284 0.000 0.140 0.000 0.476 0.384 0.000
#> GSM875440     4  0.1866     0.5080 0.000 0.008 0.000 0.908 0.084 0.000
#> GSM875441     4  0.0865     0.5257 0.000 0.000 0.000 0.964 0.036 0.000
#> GSM875442     3  0.4908     0.5777 0.000 0.004 0.596 0.068 0.332 0.000
#> GSM875446     4  0.5513     0.1250 0.000 0.132 0.000 0.476 0.392 0.000
#> GSM875448     3  0.3772     0.7583 0.000 0.004 0.672 0.004 0.320 0.000
#> GSM875453     4  0.3245     0.4080 0.000 0.000 0.008 0.764 0.228 0.000
#> GSM875455     3  0.6185     0.6197 0.000 0.004 0.488 0.016 0.316 0.176
#> GSM875459     4  0.5488     0.1214 0.000 0.128 0.000 0.476 0.396 0.000
#> GSM875460     3  0.3756     0.7593 0.000 0.004 0.676 0.004 0.316 0.000
#> GSM875463     3  0.6102     0.5934 0.000 0.004 0.464 0.004 0.316 0.212
#> GSM875464     5  0.5172     0.1722 0.000 0.124 0.000 0.284 0.592 0.000
#> GSM875466     3  0.1910     0.7514 0.000 0.000 0.892 0.000 0.108 0.000
#> GSM875473     3  0.5888     0.6151 0.000 0.004 0.488 0.000 0.312 0.196
#> GSM875474     4  0.0547     0.5269 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM875478     5  0.7092    -0.1265 0.000 0.112 0.364 0.156 0.368 0.000
#> GSM875479     4  0.5284     0.1564 0.000 0.104 0.000 0.508 0.388 0.000
#> GSM875480     5  0.4714     0.3688 0.000 0.116 0.040 0.108 0.736 0.000
#> GSM875481     5  0.5438    -0.0262 0.000 0.124 0.000 0.380 0.496 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) k
#> ATC:pam 70         4.52e-15 2
#> ATC:pam 66         3.39e-13 3
#> ATC:pam 60         3.06e-12 4
#> ATC:pam 67         1.02e-14 5
#> ATC:pam 53         3.46e-10 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 51941 rows and 70 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 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-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           0.987       0.991         0.4750 0.526   0.526
#> 3 3 0.959           0.938       0.973         0.4021 0.721   0.511
#> 4 4 0.965           0.918       0.972         0.0330 0.978   0.933
#> 5 5 0.779           0.735       0.886         0.0687 0.962   0.881
#> 6 6 0.816           0.831       0.893         0.0952 0.854   0.531

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
#> GSM875413     1  0.0672      0.995 0.992 0.008
#> GSM875415     1  0.0672      0.995 0.992 0.008
#> GSM875416     1  0.0938      0.994 0.988 0.012
#> GSM875417     1  0.1414      0.982 0.980 0.020
#> GSM875418     1  0.0672      0.995 0.992 0.008
#> GSM875423     1  0.0376      0.990 0.996 0.004
#> GSM875424     1  0.0938      0.994 0.988 0.012
#> GSM875425     1  0.0376      0.990 0.996 0.004
#> GSM875430     1  0.0672      0.995 0.992 0.008
#> GSM875432     1  0.0672      0.995 0.992 0.008
#> GSM875435     1  0.0672      0.995 0.992 0.008
#> GSM875436     2  0.7299      0.747 0.204 0.796
#> GSM875437     1  0.0672      0.995 0.992 0.008
#> GSM875447     1  0.0672      0.995 0.992 0.008
#> GSM875451     1  0.0672      0.995 0.992 0.008
#> GSM875456     1  0.0672      0.995 0.992 0.008
#> GSM875461     1  0.0672      0.995 0.992 0.008
#> GSM875462     1  0.0672      0.993 0.992 0.008
#> GSM875465     1  0.0938      0.994 0.988 0.012
#> GSM875469     1  0.0672      0.995 0.992 0.008
#> GSM875470     1  0.0672      0.989 0.992 0.008
#> GSM875471     1  0.1184      0.985 0.984 0.016
#> GSM875472     1  0.0938      0.994 0.988 0.012
#> GSM875475     1  0.0672      0.995 0.992 0.008
#> GSM875476     1  0.0672      0.995 0.992 0.008
#> GSM875477     1  0.0672      0.995 0.992 0.008
#> GSM875414     2  0.0672      0.988 0.008 0.992
#> GSM875427     2  0.0672      0.988 0.008 0.992
#> GSM875431     2  0.0672      0.988 0.008 0.992
#> GSM875433     2  0.0000      0.991 0.000 1.000
#> GSM875443     1  0.1414      0.982 0.980 0.020
#> GSM875444     2  0.0672      0.988 0.008 0.992
#> GSM875445     2  0.0672      0.988 0.008 0.992
#> GSM875449     2  0.0672      0.988 0.008 0.992
#> GSM875450     2  0.0672      0.988 0.008 0.992
#> GSM875452     2  0.0672      0.988 0.008 0.992
#> GSM875454     2  0.0672      0.988 0.008 0.992
#> GSM875457     2  0.0672      0.988 0.008 0.992
#> GSM875458     2  0.0672      0.988 0.008 0.992
#> GSM875467     2  0.0672      0.988 0.008 0.992
#> GSM875468     2  0.0672      0.988 0.008 0.992
#> GSM875412     2  0.0000      0.991 0.000 1.000
#> GSM875419     2  0.0000      0.991 0.000 1.000
#> GSM875420     2  0.0376      0.990 0.004 0.996
#> GSM875421     2  0.0000      0.991 0.000 1.000
#> GSM875422     2  0.0000      0.991 0.000 1.000
#> GSM875426     2  0.0000      0.991 0.000 1.000
#> GSM875428     2  0.0000      0.991 0.000 1.000
#> GSM875429     2  0.0672      0.988 0.008 0.992
#> GSM875434     2  0.0672      0.988 0.008 0.992
#> GSM875438     2  0.0000      0.991 0.000 1.000
#> GSM875439     2  0.0376      0.990 0.004 0.996
#> GSM875440     2  0.0000      0.991 0.000 1.000
#> GSM875441     2  0.0376      0.990 0.004 0.996
#> GSM875442     2  0.0672      0.988 0.008 0.992
#> GSM875446     2  0.0376      0.990 0.004 0.996
#> GSM875448     2  0.0000      0.991 0.000 1.000
#> GSM875453     2  0.0376      0.990 0.004 0.996
#> GSM875455     2  0.0672      0.988 0.008 0.992
#> GSM875459     2  0.0376      0.990 0.004 0.996
#> GSM875460     2  0.0672      0.988 0.008 0.992
#> GSM875463     2  0.0000      0.991 0.000 1.000
#> GSM875464     2  0.0672      0.988 0.008 0.992
#> GSM875466     2  0.0376      0.990 0.004 0.996
#> GSM875473     2  0.0672      0.988 0.008 0.992
#> GSM875474     2  0.0376      0.990 0.004 0.996
#> GSM875478     2  0.0000      0.991 0.000 1.000
#> GSM875479     2  0.0376      0.990 0.004 0.996
#> GSM875480     2  0.0000      0.991 0.000 1.000
#> GSM875481     2  0.0000      0.991 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM875413     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875415     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875416     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875417     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875418     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875423     3  0.4002      0.810 0.160 0.000 0.840
#> GSM875424     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875425     3  0.2356      0.909 0.072 0.000 0.928
#> GSM875430     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875432     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875435     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875436     2  0.5968      0.428 0.364 0.636 0.000
#> GSM875437     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875447     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875451     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875456     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875461     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875462     3  0.2878      0.887 0.096 0.000 0.904
#> GSM875465     1  0.5058      0.666 0.756 0.000 0.244
#> GSM875469     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875470     3  0.0237      0.962 0.004 0.000 0.996
#> GSM875471     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875472     1  0.2448      0.906 0.924 0.000 0.076
#> GSM875475     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875476     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875477     1  0.0000      0.981 1.000 0.000 0.000
#> GSM875414     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875427     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875431     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875433     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875443     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875444     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875445     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875449     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875450     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875452     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875454     3  0.1529      0.934 0.000 0.040 0.960
#> GSM875457     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875458     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875467     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875468     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875412     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875419     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875420     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875421     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875422     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875426     2  0.2959      0.870 0.000 0.900 0.100
#> GSM875428     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875429     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875434     2  0.0237      0.966 0.000 0.996 0.004
#> GSM875438     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875439     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875440     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875441     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875442     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875446     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875448     2  0.0424      0.963 0.000 0.992 0.008
#> GSM875453     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875455     2  0.1529      0.935 0.000 0.960 0.040
#> GSM875459     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875460     3  0.0237      0.962 0.000 0.004 0.996
#> GSM875463     3  0.5650      0.547 0.000 0.312 0.688
#> GSM875464     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875466     3  0.0424      0.959 0.000 0.008 0.992
#> GSM875473     3  0.0000      0.964 0.000 0.000 1.000
#> GSM875474     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875478     2  0.5810      0.479 0.000 0.664 0.336
#> GSM875479     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875480     2  0.0000      0.969 0.000 1.000 0.000
#> GSM875481     2  0.0000      0.969 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
#> GSM875413     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875415     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875416     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875417     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875418     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875423     3  0.2973    0.77588 0.144 0.000 0.856 0.000
#> GSM875424     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875425     3  0.1474    0.89610 0.052 0.000 0.948 0.000
#> GSM875430     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875432     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875435     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875436     2  0.5000    0.02338 0.500 0.500 0.000 0.000
#> GSM875437     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875447     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875451     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875456     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875461     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875462     3  0.1867    0.87483 0.072 0.000 0.928 0.000
#> GSM875465     1  0.3356    0.73213 0.824 0.000 0.176 0.000
#> GSM875469     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875470     3  0.0188    0.94142 0.004 0.000 0.996 0.000
#> GSM875471     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875472     1  0.2868    0.79567 0.864 0.000 0.136 0.000
#> GSM875475     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875476     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875477     1  0.0000    0.97545 1.000 0.000 0.000 0.000
#> GSM875414     4  0.0188    1.00000 0.000 0.004 0.000 0.996
#> GSM875427     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875431     4  0.0188    1.00000 0.000 0.004 0.000 0.996
#> GSM875433     2  0.0188    0.95886 0.000 0.996 0.004 0.000
#> GSM875443     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875444     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875445     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875449     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875450     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875452     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875454     3  0.0188    0.94137 0.000 0.004 0.996 0.000
#> GSM875457     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875458     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875467     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875468     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875412     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875419     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875420     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875421     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875422     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875426     2  0.1305    0.92273 0.000 0.960 0.036 0.004
#> GSM875428     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875429     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875434     2  0.0921    0.93404 0.000 0.972 0.028 0.000
#> GSM875438     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875439     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875440     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875441     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875442     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875446     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875448     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875453     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875455     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875459     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875460     3  0.0336    0.93768 0.000 0.008 0.992 0.000
#> GSM875463     3  0.5168   -0.00608 0.000 0.496 0.500 0.004
#> GSM875464     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875466     3  0.1557    0.88166 0.000 0.056 0.944 0.000
#> GSM875473     3  0.0000    0.94412 0.000 0.000 1.000 0.000
#> GSM875474     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875478     2  0.3626    0.71125 0.000 0.812 0.184 0.004
#> GSM875479     2  0.0188    0.96095 0.000 0.996 0.000 0.004
#> GSM875480     2  0.0000    0.96155 0.000 1.000 0.000 0.000
#> GSM875481     2  0.0000    0.96155 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4 p5
#> GSM875413     1  0.0162     0.9153 0.996 0.004 0.000 0.000  0
#> GSM875415     1  0.0162     0.9153 0.996 0.004 0.000 0.000  0
#> GSM875416     1  0.3914     0.7510 0.788 0.164 0.048 0.000  0
#> GSM875417     3  0.0162     0.9270 0.000 0.004 0.996 0.000  0
#> GSM875418     1  0.0162     0.9153 0.996 0.004 0.000 0.000  0
#> GSM875423     3  0.4335     0.7147 0.072 0.168 0.760 0.000  0
#> GSM875424     1  0.3535     0.7712 0.808 0.164 0.028 0.000  0
#> GSM875425     3  0.3093     0.7957 0.008 0.168 0.824 0.000  0
#> GSM875430     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875432     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875435     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875436     1  0.3876     0.4734 0.684 0.000 0.000 0.316  0
#> GSM875437     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875447     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875451     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875456     1  0.0404     0.9101 0.988 0.012 0.000 0.000  0
#> GSM875461     1  0.0162     0.9153 0.996 0.004 0.000 0.000  0
#> GSM875462     3  0.3399     0.7841 0.020 0.168 0.812 0.000  0
#> GSM875465     1  0.5083     0.6370 0.696 0.184 0.120 0.000  0
#> GSM875469     1  0.0162     0.9153 0.996 0.004 0.000 0.000  0
#> GSM875470     3  0.2329     0.8444 0.000 0.124 0.876 0.000  0
#> GSM875471     3  0.1792     0.8758 0.000 0.084 0.916 0.000  0
#> GSM875472     1  0.5236     0.6098 0.684 0.164 0.152 0.000  0
#> GSM875475     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875476     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875477     1  0.0000     0.9162 1.000 0.000 0.000 0.000  0
#> GSM875414     5  0.0000     1.0000 0.000 0.000 0.000 0.000  1
#> GSM875427     3  0.0510     0.9200 0.000 0.016 0.984 0.000  0
#> GSM875431     5  0.0000     1.0000 0.000 0.000 0.000 0.000  1
#> GSM875433     4  0.2561     0.6446 0.000 0.144 0.000 0.856  0
#> GSM875443     3  0.0162     0.9270 0.000 0.004 0.996 0.000  0
#> GSM875444     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875445     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875449     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875450     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875452     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875454     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875457     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875458     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875467     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875468     3  0.0510     0.9200 0.000 0.016 0.984 0.000  0
#> GSM875412     4  0.0162     0.7215 0.000 0.004 0.000 0.996  0
#> GSM875419     4  0.0000     0.7213 0.000 0.000 0.000 1.000  0
#> GSM875420     4  0.0404     0.7195 0.000 0.012 0.000 0.988  0
#> GSM875421     4  0.3366     0.5436 0.000 0.232 0.000 0.768  0
#> GSM875422     4  0.3452     0.5257 0.000 0.244 0.000 0.756  0
#> GSM875426     4  0.5685    -0.2342 0.000 0.396 0.084 0.520  0
#> GSM875428     4  0.0162     0.7216 0.000 0.004 0.000 0.996  0
#> GSM875429     4  0.1908     0.6711 0.000 0.092 0.000 0.908  0
#> GSM875434     4  0.0000     0.7213 0.000 0.000 0.000 1.000  0
#> GSM875438     4  0.5691    -0.3484 0.000 0.444 0.080 0.476  0
#> GSM875439     4  0.3636     0.4493 0.000 0.272 0.000 0.728  0
#> GSM875440     4  0.1671     0.7019 0.000 0.076 0.000 0.924  0
#> GSM875441     4  0.3508     0.5382 0.000 0.252 0.000 0.748  0
#> GSM875442     4  0.0000     0.7213 0.000 0.000 0.000 1.000  0
#> GSM875446     4  0.0404     0.7192 0.000 0.012 0.000 0.988  0
#> GSM875448     4  0.4528     0.0629 0.000 0.444 0.008 0.548  0
#> GSM875453     4  0.2813     0.6076 0.000 0.168 0.000 0.832  0
#> GSM875455     4  0.4482     0.2447 0.000 0.376 0.012 0.612  0
#> GSM875459     4  0.0609     0.7192 0.000 0.020 0.000 0.980  0
#> GSM875460     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875463     2  0.6746     0.6200 0.000 0.392 0.344 0.264  0
#> GSM875464     4  0.2852     0.5800 0.000 0.172 0.000 0.828  0
#> GSM875466     3  0.4865     0.3177 0.000 0.252 0.684 0.064  0
#> GSM875473     3  0.0000     0.9283 0.000 0.000 1.000 0.000  0
#> GSM875474     4  0.1608     0.6962 0.000 0.072 0.000 0.928  0
#> GSM875478     2  0.6384     0.4831 0.000 0.444 0.168 0.388  0
#> GSM875479     4  0.2813     0.6076 0.000 0.168 0.000 0.832  0
#> GSM875480     4  0.3242     0.5654 0.000 0.216 0.000 0.784  0
#> GSM875481     4  0.3452     0.5253 0.000 0.244 0.000 0.756  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1 p2    p3    p4    p5    p6
#> GSM875413     1  0.1895      0.916 0.912  0 0.000 0.000 0.072 0.016
#> GSM875415     1  0.0458      0.941 0.984  0 0.000 0.000 0.000 0.016
#> GSM875416     6  0.2823      0.690 0.204  0 0.000 0.000 0.000 0.796
#> GSM875417     3  0.2762      0.772 0.000  0 0.804 0.000 0.000 0.196
#> GSM875418     1  0.1895      0.916 0.912  0 0.000 0.000 0.072 0.016
#> GSM875423     6  0.1984      0.752 0.032  0 0.056 0.000 0.000 0.912
#> GSM875424     6  0.2854      0.685 0.208  0 0.000 0.000 0.000 0.792
#> GSM875425     6  0.2728      0.748 0.040  0 0.100 0.000 0.000 0.860
#> GSM875430     1  0.0260      0.943 0.992  0 0.000 0.000 0.000 0.008
#> GSM875432     1  0.0000      0.944 1.000  0 0.000 0.000 0.000 0.000
#> GSM875435     1  0.0000      0.944 1.000  0 0.000 0.000 0.000 0.000
#> GSM875436     1  0.3067      0.791 0.844  0 0.020 0.116 0.000 0.020
#> GSM875437     1  0.0937      0.924 0.960  0 0.000 0.000 0.000 0.040
#> GSM875447     1  0.0000      0.944 1.000  0 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0000      0.944 1.000  0 0.000 0.000 0.000 0.000
#> GSM875456     1  0.2527      0.771 0.832  0 0.000 0.000 0.000 0.168
#> GSM875461     1  0.1895      0.916 0.912  0 0.000 0.000 0.072 0.016
#> GSM875462     6  0.2122      0.750 0.024  0 0.076 0.000 0.000 0.900
#> GSM875465     6  0.1863      0.738 0.104  0 0.000 0.000 0.000 0.896
#> GSM875469     1  0.1895      0.916 0.912  0 0.000 0.000 0.072 0.016
#> GSM875470     6  0.3101      0.601 0.000  0 0.244 0.000 0.000 0.756
#> GSM875471     6  0.3810      0.234 0.000  0 0.428 0.000 0.000 0.572
#> GSM875472     6  0.2219      0.739 0.136  0 0.000 0.000 0.000 0.864
#> GSM875475     1  0.0000      0.944 1.000  0 0.000 0.000 0.000 0.000
#> GSM875476     1  0.0937      0.924 0.960  0 0.000 0.000 0.000 0.040
#> GSM875477     1  0.0000      0.944 1.000  0 0.000 0.000 0.000 0.000
#> GSM875414     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM875427     3  0.1408      0.921 0.000  0 0.944 0.000 0.020 0.036
#> GSM875431     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM875433     5  0.4630      0.657 0.000  0 0.048 0.372 0.580 0.000
#> GSM875443     3  0.2762      0.772 0.000  0 0.804 0.000 0.000 0.196
#> GSM875444     3  0.0000      0.939 0.000  0 1.000 0.000 0.000 0.000
#> GSM875445     3  0.0458      0.941 0.000  0 0.984 0.000 0.000 0.016
#> GSM875449     3  0.0458      0.941 0.000  0 0.984 0.000 0.000 0.016
#> GSM875450     3  0.0458      0.941 0.000  0 0.984 0.000 0.000 0.016
#> GSM875452     3  0.0790      0.928 0.000  0 0.968 0.000 0.000 0.032
#> GSM875454     3  0.1700      0.904 0.000  0 0.928 0.048 0.000 0.024
#> GSM875457     3  0.0458      0.941 0.000  0 0.984 0.000 0.000 0.016
#> GSM875458     3  0.1408      0.921 0.000  0 0.944 0.000 0.020 0.036
#> GSM875467     3  0.0458      0.941 0.000  0 0.984 0.000 0.000 0.016
#> GSM875468     3  0.1408      0.921 0.000  0 0.944 0.000 0.020 0.036
#> GSM875412     4  0.1141      0.881 0.000  0 0.000 0.948 0.052 0.000
#> GSM875419     4  0.0790      0.883 0.000  0 0.000 0.968 0.032 0.000
#> GSM875420     4  0.0146      0.880 0.000  0 0.000 0.996 0.000 0.004
#> GSM875421     5  0.4168      0.783 0.000  0 0.048 0.256 0.696 0.000
#> GSM875422     5  0.3446      0.772 0.000  0 0.000 0.308 0.692 0.000
#> GSM875426     5  0.2100      0.801 0.000  0 0.004 0.112 0.884 0.000
#> GSM875428     4  0.0291      0.879 0.000  0 0.000 0.992 0.004 0.004
#> GSM875429     4  0.1334      0.876 0.000  0 0.020 0.948 0.032 0.000
#> GSM875434     4  0.1588      0.839 0.000  0 0.072 0.924 0.000 0.004
#> GSM875438     5  0.1765      0.798 0.000  0 0.000 0.096 0.904 0.000
#> GSM875439     4  0.0291      0.879 0.000  0 0.000 0.992 0.004 0.004
#> GSM875440     4  0.3695      0.178 0.000  0 0.000 0.624 0.376 0.000
#> GSM875441     4  0.2597      0.806 0.000  0 0.000 0.824 0.176 0.000
#> GSM875442     4  0.0748      0.880 0.000  0 0.004 0.976 0.016 0.004
#> GSM875446     4  0.0547      0.882 0.000  0 0.000 0.980 0.020 0.000
#> GSM875448     5  0.2039      0.798 0.000  0 0.020 0.076 0.904 0.000
#> GSM875453     4  0.2969      0.754 0.000  0 0.000 0.776 0.224 0.000
#> GSM875455     5  0.3776      0.732 0.000  0 0.052 0.188 0.760 0.000
#> GSM875459     4  0.1501      0.867 0.000  0 0.000 0.924 0.076 0.000
#> GSM875460     3  0.1168      0.927 0.000  0 0.956 0.000 0.028 0.016
#> GSM875463     5  0.2852      0.768 0.000  0 0.080 0.064 0.856 0.000
#> GSM875464     4  0.0146      0.880 0.000  0 0.000 0.996 0.000 0.004
#> GSM875466     5  0.4470      0.582 0.000  0 0.268 0.036 0.680 0.016
#> GSM875473     3  0.0458      0.941 0.000  0 0.984 0.000 0.000 0.016
#> GSM875474     4  0.2260      0.836 0.000  0 0.000 0.860 0.140 0.000
#> GSM875478     5  0.2039      0.798 0.000  0 0.020 0.076 0.904 0.000
#> GSM875479     4  0.2969      0.754 0.000  0 0.000 0.776 0.224 0.000
#> GSM875480     5  0.3446      0.768 0.000  0 0.000 0.308 0.692 0.000
#> GSM875481     5  0.3446      0.772 0.000  0 0.000 0.308 0.692 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) k
#> ATC:mclust 70         3.65e-14 2
#> ATC:mclust 68         5.56e-15 3
#> ATC:mclust 68         7.55e-17 4
#> ATC:mclust 62         1.87e-14 5
#> ATC:mclust 68         2.12e-19 6

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


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

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.853           0.891       0.956         0.4969 0.499   0.499
#> 3 3 0.706           0.790       0.908         0.2643 0.814   0.649
#> 4 4 0.589           0.614       0.790         0.1272 0.876   0.690
#> 5 5 0.738           0.729       0.855         0.0817 0.900   0.690
#> 6 6 0.715           0.618       0.809         0.0517 0.920   0.692

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
#> GSM875413     1  0.0000     0.9478 1.000 0.000
#> GSM875415     1  0.0000     0.9478 1.000 0.000
#> GSM875416     1  0.0000     0.9478 1.000 0.000
#> GSM875417     1  0.0000     0.9478 1.000 0.000
#> GSM875418     1  0.0000     0.9478 1.000 0.000
#> GSM875423     1  0.0000     0.9478 1.000 0.000
#> GSM875424     1  0.0000     0.9478 1.000 0.000
#> GSM875425     1  0.0000     0.9478 1.000 0.000
#> GSM875430     1  0.0000     0.9478 1.000 0.000
#> GSM875432     1  0.0000     0.9478 1.000 0.000
#> GSM875435     1  0.0000     0.9478 1.000 0.000
#> GSM875436     1  0.0938     0.9392 0.988 0.012
#> GSM875437     1  0.0000     0.9478 1.000 0.000
#> GSM875447     1  0.0000     0.9478 1.000 0.000
#> GSM875451     1  0.0000     0.9478 1.000 0.000
#> GSM875456     1  0.0000     0.9478 1.000 0.000
#> GSM875461     1  0.0000     0.9478 1.000 0.000
#> GSM875462     1  0.0000     0.9478 1.000 0.000
#> GSM875465     1  0.0000     0.9478 1.000 0.000
#> GSM875469     1  0.0000     0.9478 1.000 0.000
#> GSM875470     1  0.0000     0.9478 1.000 0.000
#> GSM875471     1  0.0000     0.9478 1.000 0.000
#> GSM875472     1  0.0000     0.9478 1.000 0.000
#> GSM875475     1  0.0000     0.9478 1.000 0.000
#> GSM875476     1  0.0000     0.9478 1.000 0.000
#> GSM875477     1  0.0000     0.9478 1.000 0.000
#> GSM875414     2  0.0000     0.9529 0.000 1.000
#> GSM875427     2  0.2778     0.9143 0.048 0.952
#> GSM875431     2  0.0000     0.9529 0.000 1.000
#> GSM875433     2  0.0672     0.9479 0.008 0.992
#> GSM875443     1  0.0000     0.9478 1.000 0.000
#> GSM875444     1  0.4431     0.8686 0.908 0.092
#> GSM875445     2  0.7299     0.7306 0.204 0.796
#> GSM875449     1  0.8267     0.6513 0.740 0.260
#> GSM875450     1  0.0000     0.9478 1.000 0.000
#> GSM875452     2  0.9427     0.4331 0.360 0.640
#> GSM875454     2  0.0000     0.9529 0.000 1.000
#> GSM875457     1  0.3584     0.8917 0.932 0.068
#> GSM875458     1  0.0000     0.9478 1.000 0.000
#> GSM875467     1  0.0000     0.9478 1.000 0.000
#> GSM875468     1  0.0000     0.9478 1.000 0.000
#> GSM875412     2  0.0000     0.9529 0.000 1.000
#> GSM875419     2  0.1414     0.9388 0.020 0.980
#> GSM875420     2  0.0000     0.9529 0.000 1.000
#> GSM875421     2  0.0000     0.9529 0.000 1.000
#> GSM875422     2  0.0000     0.9529 0.000 1.000
#> GSM875426     2  0.0000     0.9529 0.000 1.000
#> GSM875428     2  0.0000     0.9529 0.000 1.000
#> GSM875429     2  0.0000     0.9529 0.000 1.000
#> GSM875434     1  0.9993     0.0597 0.516 0.484
#> GSM875438     2  0.0000     0.9529 0.000 1.000
#> GSM875439     2  0.0000     0.9529 0.000 1.000
#> GSM875440     2  0.0000     0.9529 0.000 1.000
#> GSM875441     2  0.0000     0.9529 0.000 1.000
#> GSM875442     2  0.0000     0.9529 0.000 1.000
#> GSM875446     2  0.0000     0.9529 0.000 1.000
#> GSM875448     2  0.8713     0.5834 0.292 0.708
#> GSM875453     2  0.0672     0.9479 0.008 0.992
#> GSM875455     1  0.8608     0.6110 0.716 0.284
#> GSM875459     2  0.0000     0.9529 0.000 1.000
#> GSM875460     2  0.9286     0.4726 0.344 0.656
#> GSM875463     1  0.8861     0.5737 0.696 0.304
#> GSM875464     2  0.0000     0.9529 0.000 1.000
#> GSM875466     1  0.9044     0.5411 0.680 0.320
#> GSM875473     1  0.0376     0.9450 0.996 0.004
#> GSM875474     2  0.0000     0.9529 0.000 1.000
#> GSM875478     2  0.0000     0.9529 0.000 1.000
#> GSM875479     2  0.0000     0.9529 0.000 1.000
#> GSM875480     2  0.0000     0.9529 0.000 1.000
#> GSM875481     2  0.0000     0.9529 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
#> GSM875413     1  0.4974     0.6603 0.764 0.000 0.236
#> GSM875415     1  0.0237     0.9164 0.996 0.000 0.004
#> GSM875416     1  0.0237     0.9164 0.996 0.000 0.004
#> GSM875417     1  0.2711     0.8677 0.912 0.000 0.088
#> GSM875418     1  0.0592     0.9154 0.988 0.000 0.012
#> GSM875423     1  0.1031     0.9111 0.976 0.000 0.024
#> GSM875424     1  0.0892     0.9130 0.980 0.000 0.020
#> GSM875425     1  0.0892     0.9130 0.980 0.000 0.020
#> GSM875430     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875432     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875435     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875436     1  0.5098     0.6061 0.752 0.248 0.000
#> GSM875437     1  0.0237     0.9164 0.996 0.000 0.004
#> GSM875447     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875451     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875456     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875461     1  0.0747     0.9150 0.984 0.000 0.016
#> GSM875462     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875465     1  0.0237     0.9164 0.996 0.000 0.004
#> GSM875469     1  0.0592     0.9154 0.988 0.000 0.012
#> GSM875470     1  0.0592     0.9154 0.988 0.000 0.012
#> GSM875471     1  0.0892     0.9130 0.980 0.000 0.020
#> GSM875472     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875475     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875476     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875477     1  0.0000     0.9161 1.000 0.000 0.000
#> GSM875414     3  0.4796     0.6710 0.000 0.220 0.780
#> GSM875427     3  0.0000     0.8030 0.000 0.000 1.000
#> GSM875431     3  0.3482     0.7449 0.000 0.128 0.872
#> GSM875433     3  0.0000     0.8030 0.000 0.000 1.000
#> GSM875443     1  0.2625     0.8708 0.916 0.000 0.084
#> GSM875444     1  0.5926     0.5124 0.644 0.000 0.356
#> GSM875445     2  0.6124     0.6572 0.036 0.744 0.220
#> GSM875449     3  0.4796     0.6070 0.220 0.000 0.780
#> GSM875450     1  0.4750     0.7339 0.784 0.000 0.216
#> GSM875452     3  0.0000     0.8030 0.000 0.000 1.000
#> GSM875454     3  0.6192     0.2303 0.000 0.420 0.580
#> GSM875457     1  0.4702     0.7427 0.788 0.000 0.212
#> GSM875458     3  0.0424     0.8013 0.008 0.000 0.992
#> GSM875467     1  0.4702     0.7385 0.788 0.000 0.212
#> GSM875468     3  0.0237     0.8027 0.004 0.000 0.996
#> GSM875412     2  0.0000     0.8782 0.000 1.000 0.000
#> GSM875419     2  0.0000     0.8782 0.000 1.000 0.000
#> GSM875420     2  0.0424     0.8769 0.000 0.992 0.008
#> GSM875421     2  0.5497     0.5619 0.000 0.708 0.292
#> GSM875422     2  0.0424     0.8769 0.000 0.992 0.008
#> GSM875426     2  0.0000     0.8782 0.000 1.000 0.000
#> GSM875428     2  0.0592     0.8753 0.000 0.988 0.012
#> GSM875429     2  0.3337     0.8308 0.032 0.908 0.060
#> GSM875434     3  0.5363     0.5506 0.276 0.000 0.724
#> GSM875438     2  0.0000     0.8782 0.000 1.000 0.000
#> GSM875439     2  0.0424     0.8769 0.000 0.992 0.008
#> GSM875440     2  0.0000     0.8782 0.000 1.000 0.000
#> GSM875441     2  0.0000     0.8782 0.000 1.000 0.000
#> GSM875442     2  0.5216     0.5839 0.000 0.740 0.260
#> GSM875446     2  0.0237     0.8777 0.000 0.996 0.004
#> GSM875448     2  0.4702     0.6768 0.212 0.788 0.000
#> GSM875453     2  0.3551     0.7716 0.132 0.868 0.000
#> GSM875455     1  0.6280     0.0325 0.540 0.460 0.000
#> GSM875459     2  0.0000     0.8782 0.000 1.000 0.000
#> GSM875460     2  0.6699     0.6576 0.092 0.744 0.164
#> GSM875463     2  0.5810     0.4926 0.336 0.664 0.000
#> GSM875464     3  0.6215     0.3503 0.000 0.428 0.572
#> GSM875466     2  0.9100     0.3170 0.248 0.548 0.204
#> GSM875473     1  0.2446     0.8903 0.936 0.012 0.052
#> GSM875474     2  0.0000     0.8782 0.000 1.000 0.000
#> GSM875478     2  0.0424     0.8757 0.008 0.992 0.000
#> GSM875479     2  0.0237     0.8771 0.004 0.996 0.000
#> GSM875480     2  0.2448     0.8353 0.000 0.924 0.076
#> GSM875481     2  0.0424     0.8769 0.000 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM875413     1  0.3801     0.6928 0.780 0.000 0.000 0.220
#> GSM875415     1  0.1211     0.8849 0.960 0.000 0.000 0.040
#> GSM875416     1  0.0188     0.8922 0.996 0.000 0.004 0.000
#> GSM875417     3  0.4925     0.4404 0.428 0.000 0.572 0.000
#> GSM875418     1  0.1211     0.8849 0.960 0.000 0.000 0.040
#> GSM875423     1  0.1978     0.8499 0.928 0.000 0.068 0.004
#> GSM875424     1  0.1398     0.8849 0.956 0.000 0.004 0.040
#> GSM875425     1  0.1510     0.8796 0.956 0.000 0.028 0.016
#> GSM875430     1  0.1211     0.8849 0.960 0.000 0.000 0.040
#> GSM875432     1  0.0336     0.8922 0.992 0.000 0.000 0.008
#> GSM875435     1  0.0707     0.8913 0.980 0.000 0.000 0.020
#> GSM875436     1  0.6312     0.4570 0.676 0.116 0.200 0.008
#> GSM875437     1  0.0336     0.8925 0.992 0.000 0.000 0.008
#> GSM875447     1  0.0817     0.8904 0.976 0.000 0.000 0.024
#> GSM875451     1  0.0188     0.8928 0.996 0.000 0.000 0.004
#> GSM875456     1  0.0336     0.8909 0.992 0.000 0.000 0.008
#> GSM875461     1  0.0817     0.8928 0.976 0.000 0.000 0.024
#> GSM875462     1  0.1398     0.8787 0.956 0.000 0.004 0.040
#> GSM875465     1  0.0376     0.8914 0.992 0.000 0.004 0.004
#> GSM875469     1  0.1211     0.8849 0.960 0.000 0.000 0.040
#> GSM875470     1  0.1975     0.8658 0.936 0.000 0.048 0.016
#> GSM875471     1  0.2399     0.8576 0.920 0.000 0.032 0.048
#> GSM875472     1  0.0895     0.8869 0.976 0.000 0.004 0.020
#> GSM875475     1  0.1022     0.8881 0.968 0.000 0.000 0.032
#> GSM875476     1  0.2101     0.8508 0.928 0.000 0.060 0.012
#> GSM875477     1  0.0336     0.8909 0.992 0.000 0.000 0.008
#> GSM875414     4  0.3172     0.5197 0.000 0.160 0.000 0.840
#> GSM875427     3  0.4916     0.2228 0.000 0.000 0.576 0.424
#> GSM875431     4  0.3306     0.5194 0.000 0.156 0.004 0.840
#> GSM875433     3  0.6381     0.4103 0.000 0.152 0.652 0.196
#> GSM875443     3  0.4941     0.4223 0.436 0.000 0.564 0.000
#> GSM875444     3  0.4597     0.5974 0.140 0.056 0.800 0.004
#> GSM875445     3  0.3610     0.4921 0.000 0.200 0.800 0.000
#> GSM875449     3  0.5423     0.5580 0.116 0.000 0.740 0.144
#> GSM875450     3  0.4049     0.5945 0.212 0.008 0.780 0.000
#> GSM875452     3  0.4597     0.5524 0.044 0.148 0.800 0.008
#> GSM875454     3  0.7785     0.0573 0.000 0.320 0.420 0.260
#> GSM875457     3  0.5808     0.4347 0.424 0.000 0.544 0.032
#> GSM875458     3  0.4977     0.1576 0.000 0.000 0.540 0.460
#> GSM875467     3  0.3942     0.5844 0.236 0.000 0.764 0.000
#> GSM875468     4  0.4985    -0.2357 0.000 0.000 0.468 0.532
#> GSM875412     2  0.3933     0.6451 0.000 0.792 0.200 0.008
#> GSM875419     2  0.0524     0.7015 0.008 0.988 0.000 0.004
#> GSM875420     2  0.2408     0.6852 0.000 0.920 0.044 0.036
#> GSM875421     2  0.5676     0.5717 0.000 0.720 0.136 0.144
#> GSM875422     2  0.3597     0.6779 0.000 0.836 0.148 0.016
#> GSM875426     2  0.4792     0.5616 0.000 0.680 0.312 0.008
#> GSM875428     2  0.2376     0.6973 0.000 0.916 0.068 0.016
#> GSM875429     2  0.8333     0.5340 0.052 0.508 0.264 0.176
#> GSM875434     4  0.4737     0.2654 0.296 0.004 0.004 0.696
#> GSM875438     2  0.5809     0.6513 0.000 0.692 0.216 0.092
#> GSM875439     2  0.1151     0.6995 0.000 0.968 0.008 0.024
#> GSM875440     2  0.3831     0.6436 0.000 0.792 0.204 0.004
#> GSM875441     2  0.5417     0.5929 0.000 0.732 0.180 0.088
#> GSM875442     2  0.5446     0.4756 0.000 0.680 0.044 0.276
#> GSM875446     2  0.1042     0.7000 0.000 0.972 0.008 0.020
#> GSM875448     2  0.7968     0.4900 0.096 0.592 0.196 0.116
#> GSM875453     2  0.7209     0.5533 0.044 0.636 0.204 0.116
#> GSM875455     1  0.9326    -0.1082 0.392 0.300 0.196 0.112
#> GSM875459     2  0.0672     0.7025 0.000 0.984 0.008 0.008
#> GSM875460     2  0.6070     0.4199 0.000 0.548 0.404 0.048
#> GSM875463     2  0.8979     0.3166 0.204 0.484 0.196 0.116
#> GSM875464     4  0.7529    -0.0840 0.000 0.344 0.196 0.460
#> GSM875466     3  0.4663     0.5574 0.064 0.148 0.788 0.000
#> GSM875473     1  0.7987     0.1344 0.464 0.120 0.376 0.040
#> GSM875474     2  0.5062     0.6695 0.000 0.752 0.184 0.064
#> GSM875478     2  0.7112     0.5460 0.040 0.644 0.196 0.120
#> GSM875479     2  0.7191     0.5435 0.044 0.640 0.196 0.120
#> GSM875480     2  0.2676     0.6857 0.000 0.896 0.092 0.012
#> GSM875481     2  0.3881     0.6645 0.000 0.812 0.172 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM875413     1  0.4924     0.5102 0.668 0.000 0.000 0.060 0.272
#> GSM875415     1  0.0162     0.9079 0.996 0.000 0.004 0.000 0.000
#> GSM875416     1  0.0771     0.9067 0.976 0.000 0.004 0.020 0.000
#> GSM875417     3  0.1043     0.8901 0.040 0.000 0.960 0.000 0.000
#> GSM875418     1  0.0162     0.9089 0.996 0.000 0.004 0.000 0.000
#> GSM875423     1  0.2408     0.8475 0.892 0.000 0.092 0.016 0.000
#> GSM875424     1  0.0290     0.9088 0.992 0.000 0.008 0.000 0.000
#> GSM875425     1  0.2685     0.8433 0.880 0.000 0.092 0.028 0.000
#> GSM875430     1  0.0162     0.9079 0.996 0.000 0.004 0.000 0.000
#> GSM875432     1  0.0613     0.9047 0.984 0.008 0.004 0.000 0.004
#> GSM875435     1  0.0000     0.9085 1.000 0.000 0.000 0.000 0.000
#> GSM875436     1  0.4554     0.5004 0.680 0.296 0.004 0.004 0.016
#> GSM875437     1  0.0324     0.9088 0.992 0.000 0.004 0.000 0.004
#> GSM875447     1  0.0162     0.9089 0.996 0.000 0.004 0.000 0.000
#> GSM875451     1  0.0510     0.9081 0.984 0.000 0.000 0.016 0.000
#> GSM875456     1  0.0771     0.9067 0.976 0.000 0.004 0.020 0.000
#> GSM875461     1  0.1560     0.9009 0.948 0.000 0.004 0.028 0.020
#> GSM875462     1  0.2642     0.8480 0.880 0.000 0.008 0.104 0.008
#> GSM875465     1  0.0162     0.9089 0.996 0.000 0.004 0.000 0.000
#> GSM875469     1  0.0451     0.9088 0.988 0.000 0.004 0.008 0.000
#> GSM875470     1  0.3967     0.6317 0.724 0.000 0.012 0.264 0.000
#> GSM875471     1  0.5705     0.4879 0.624 0.000 0.120 0.252 0.004
#> GSM875472     1  0.1282     0.8984 0.952 0.000 0.004 0.044 0.000
#> GSM875475     1  0.0566     0.9038 0.984 0.012 0.004 0.000 0.000
#> GSM875476     1  0.2128     0.8731 0.928 0.036 0.004 0.020 0.012
#> GSM875477     1  0.0609     0.9074 0.980 0.000 0.000 0.020 0.000
#> GSM875414     5  0.1205     0.7178 0.000 0.040 0.004 0.000 0.956
#> GSM875427     3  0.1197     0.8945 0.000 0.000 0.952 0.000 0.048
#> GSM875431     5  0.0771     0.7197 0.000 0.020 0.004 0.000 0.976
#> GSM875433     2  0.6586     0.0477 0.000 0.408 0.208 0.000 0.384
#> GSM875443     3  0.0880     0.8978 0.032 0.000 0.968 0.000 0.000
#> GSM875444     3  0.0451     0.9090 0.004 0.008 0.988 0.000 0.000
#> GSM875445     3  0.1043     0.8958 0.000 0.040 0.960 0.000 0.000
#> GSM875449     3  0.0290     0.9092 0.008 0.000 0.992 0.000 0.000
#> GSM875450     3  0.0324     0.9091 0.004 0.004 0.992 0.000 0.000
#> GSM875452     3  0.0671     0.9065 0.004 0.016 0.980 0.000 0.000
#> GSM875454     3  0.3827     0.7364 0.000 0.048 0.820 0.120 0.012
#> GSM875457     3  0.0609     0.9046 0.020 0.000 0.980 0.000 0.000
#> GSM875458     3  0.1121     0.8957 0.000 0.000 0.956 0.000 0.044
#> GSM875467     3  0.0404     0.9084 0.012 0.000 0.988 0.000 0.000
#> GSM875468     3  0.2773     0.7939 0.000 0.000 0.836 0.000 0.164
#> GSM875412     2  0.0404     0.6968 0.000 0.988 0.012 0.000 0.000
#> GSM875419     2  0.4213     0.6158 0.012 0.680 0.000 0.308 0.000
#> GSM875420     2  0.5086     0.6002 0.000 0.636 0.000 0.304 0.060
#> GSM875421     2  0.7758     0.3593 0.000 0.380 0.100 0.148 0.372
#> GSM875422     2  0.3745     0.7140 0.000 0.820 0.036 0.132 0.012
#> GSM875426     2  0.3565     0.6577 0.000 0.816 0.144 0.040 0.000
#> GSM875428     2  0.2630     0.7142 0.000 0.892 0.012 0.080 0.016
#> GSM875429     2  0.4973     0.5064 0.004 0.696 0.004 0.240 0.056
#> GSM875434     5  0.4047     0.4836 0.320 0.000 0.004 0.000 0.676
#> GSM875438     2  0.5002     0.5318 0.000 0.708 0.160 0.132 0.000
#> GSM875439     2  0.4054     0.6691 0.000 0.732 0.000 0.248 0.020
#> GSM875440     2  0.0771     0.6979 0.000 0.976 0.020 0.004 0.000
#> GSM875441     2  0.4161     0.5369 0.000 0.608 0.000 0.392 0.000
#> GSM875442     2  0.4451     0.2325 0.004 0.504 0.000 0.000 0.492
#> GSM875446     2  0.4080     0.6661 0.000 0.728 0.000 0.252 0.020
#> GSM875448     4  0.1012     0.7713 0.012 0.020 0.000 0.968 0.000
#> GSM875453     4  0.3266     0.5930 0.000 0.200 0.004 0.796 0.000
#> GSM875455     4  0.1443     0.7391 0.044 0.004 0.000 0.948 0.004
#> GSM875459     2  0.3992     0.6567 0.000 0.720 0.000 0.268 0.012
#> GSM875460     4  0.3427     0.6624 0.000 0.012 0.192 0.796 0.000
#> GSM875463     4  0.0566     0.7698 0.012 0.004 0.000 0.984 0.000
#> GSM875464     4  0.4108     0.5117 0.000 0.008 0.000 0.684 0.308
#> GSM875466     3  0.4256     0.2450 0.000 0.436 0.564 0.000 0.000
#> GSM875473     4  0.4303     0.6382 0.056 0.000 0.192 0.752 0.000
#> GSM875474     2  0.0955     0.6910 0.000 0.968 0.004 0.028 0.000
#> GSM875478     4  0.0162     0.7706 0.000 0.004 0.000 0.996 0.000
#> GSM875479     4  0.0566     0.7671 0.000 0.004 0.000 0.984 0.012
#> GSM875480     4  0.7186    -0.1031 0.000 0.280 0.332 0.372 0.016
#> GSM875481     2  0.4112     0.7119 0.000 0.800 0.048 0.136 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
#> GSM875413     1  0.4549    0.57625 0.696 0.032 0.000 0.032 0.000 0.240
#> GSM875415     1  0.0000    0.86167 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875416     1  0.0547    0.86240 0.980 0.020 0.000 0.000 0.000 0.000
#> GSM875417     3  0.0858    0.86956 0.004 0.028 0.968 0.000 0.000 0.000
#> GSM875418     1  0.0632    0.86262 0.976 0.024 0.000 0.000 0.000 0.000
#> GSM875423     1  0.2815    0.76657 0.848 0.032 0.120 0.000 0.000 0.000
#> GSM875424     1  0.2454    0.80487 0.840 0.160 0.000 0.000 0.000 0.000
#> GSM875425     1  0.3933    0.76276 0.784 0.124 0.080 0.012 0.000 0.000
#> GSM875430     1  0.0363    0.86162 0.988 0.012 0.000 0.000 0.000 0.000
#> GSM875432     1  0.2416    0.80300 0.844 0.156 0.000 0.000 0.000 0.000
#> GSM875435     1  0.0000    0.86167 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875436     2  0.4923    0.39141 0.192 0.680 0.012 0.000 0.116 0.000
#> GSM875437     1  0.2491    0.79761 0.836 0.164 0.000 0.000 0.000 0.000
#> GSM875447     1  0.0000    0.86167 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM875451     1  0.0547    0.85854 0.980 0.020 0.000 0.000 0.000 0.000
#> GSM875456     1  0.0458    0.85922 0.984 0.016 0.000 0.000 0.000 0.000
#> GSM875461     1  0.4840    0.67616 0.688 0.216 0.000 0.024 0.000 0.072
#> GSM875462     1  0.5450    0.51726 0.588 0.168 0.000 0.240 0.000 0.004
#> GSM875465     1  0.1958    0.83421 0.896 0.100 0.000 0.004 0.000 0.000
#> GSM875469     1  0.0632    0.85788 0.976 0.024 0.000 0.000 0.000 0.000
#> GSM875470     1  0.4744    0.19266 0.520 0.032 0.008 0.440 0.000 0.000
#> GSM875471     4  0.7620    0.04284 0.304 0.200 0.160 0.332 0.000 0.004
#> GSM875472     1  0.2066    0.82616 0.904 0.024 0.000 0.072 0.000 0.000
#> GSM875475     1  0.1075    0.85409 0.952 0.048 0.000 0.000 0.000 0.000
#> GSM875476     2  0.4092    0.25887 0.316 0.664 0.004 0.004 0.012 0.000
#> GSM875477     1  0.0547    0.85878 0.980 0.020 0.000 0.000 0.000 0.000
#> GSM875414     6  0.0363    0.56170 0.000 0.000 0.000 0.000 0.012 0.988
#> GSM875427     3  0.0692    0.87296 0.000 0.004 0.976 0.000 0.000 0.020
#> GSM875431     6  0.0260    0.56172 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM875433     6  0.6389   -0.00305 0.000 0.396 0.080 0.000 0.088 0.436
#> GSM875443     3  0.2205    0.80631 0.008 0.088 0.896 0.004 0.000 0.004
#> GSM875444     3  0.0713    0.87179 0.000 0.028 0.972 0.000 0.000 0.000
#> GSM875445     3  0.0458    0.87407 0.000 0.016 0.984 0.000 0.000 0.000
#> GSM875449     3  0.0260    0.87682 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM875450     3  0.0260    0.87682 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM875452     3  0.0146    0.87667 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM875454     3  0.4543    0.04414 0.000 0.008 0.520 0.008 0.456 0.008
#> GSM875457     3  0.1074    0.86732 0.000 0.028 0.960 0.012 0.000 0.000
#> GSM875458     3  0.0717    0.87317 0.000 0.008 0.976 0.000 0.000 0.016
#> GSM875467     3  0.0363    0.87614 0.000 0.012 0.988 0.000 0.000 0.000
#> GSM875468     3  0.1398    0.85674 0.000 0.008 0.940 0.000 0.000 0.052
#> GSM875412     5  0.4238    0.10543 0.000 0.444 0.016 0.000 0.540 0.000
#> GSM875419     5  0.2206    0.74575 0.000 0.024 0.008 0.064 0.904 0.000
#> GSM875420     5  0.2066    0.74173 0.000 0.000 0.000 0.052 0.908 0.040
#> GSM875421     5  0.5406    0.48423 0.000 0.012 0.100 0.008 0.620 0.260
#> GSM875422     5  0.2134    0.73873 0.000 0.044 0.052 0.000 0.904 0.000
#> GSM875426     5  0.4154    0.61033 0.000 0.144 0.112 0.000 0.744 0.000
#> GSM875428     5  0.1901    0.72928 0.000 0.076 0.004 0.000 0.912 0.008
#> GSM875429     2  0.5273    0.27110 0.004 0.612 0.004 0.292 0.080 0.008
#> GSM875434     6  0.5107    0.35778 0.208 0.124 0.000 0.000 0.012 0.656
#> GSM875438     2  0.6228    0.27925 0.000 0.524 0.160 0.040 0.276 0.000
#> GSM875439     5  0.1245    0.75375 0.000 0.000 0.000 0.032 0.952 0.016
#> GSM875440     5  0.4199    0.25947 0.000 0.380 0.020 0.000 0.600 0.000
#> GSM875441     5  0.5134    0.46064 0.000 0.152 0.000 0.228 0.620 0.000
#> GSM875442     6  0.5854    0.26151 0.000 0.332 0.008 0.000 0.164 0.496
#> GSM875446     5  0.1075    0.75089 0.000 0.000 0.000 0.048 0.952 0.000
#> GSM875448     4  0.3691    0.56217 0.000 0.036 0.004 0.768 0.192 0.000
#> GSM875453     4  0.4000    0.54261 0.000 0.064 0.008 0.764 0.164 0.000
#> GSM875455     4  0.3638    0.49519 0.008 0.172 0.000 0.784 0.036 0.000
#> GSM875459     5  0.1074    0.75442 0.000 0.012 0.000 0.028 0.960 0.000
#> GSM875460     4  0.5675    0.36177 0.000 0.000 0.344 0.488 0.168 0.000
#> GSM875463     4  0.1225    0.58849 0.000 0.012 0.000 0.952 0.036 0.000
#> GSM875464     6  0.4396    0.04827 0.000 0.000 0.000 0.456 0.024 0.520
#> GSM875466     3  0.5686   -0.07664 0.000 0.384 0.456 0.000 0.160 0.000
#> GSM875473     4  0.5825    0.31492 0.024 0.012 0.384 0.508 0.072 0.000
#> GSM875474     2  0.4244    0.33787 0.000 0.652 0.008 0.020 0.320 0.000
#> GSM875478     4  0.2688    0.57840 0.000 0.068 0.000 0.868 0.064 0.000
#> GSM875479     4  0.2595    0.58698 0.000 0.004 0.000 0.836 0.160 0.000
#> GSM875480     5  0.4322    0.60268 0.000 0.012 0.160 0.084 0.744 0.000
#> GSM875481     5  0.0865    0.74502 0.000 0.036 0.000 0.000 0.964 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) k
#> ATC:NMF 67         3.15e-09 2
#> ATC:NMF 65         5.59e-17 3
#> ATC:NMF 52         1.93e-18 4
#> ATC:NMF 63         4.17e-22 5
#> ATC:NMF 50         5.95e-17 6

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

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