cola Report for GDS2113

Date: 2019-12-25 20:17:12 CET, cola version: 1.3.2

Document is loading...


Summary

All available functions which can be applied to this res_list object:

res_list
#> A 'ConsensusPartitionList' object with 24 methods.
#>   On a matrix with 21168 rows and 75 columns.
#>   Top rows are extracted by 'SD, CV, MAD, ATC' methods.
#>   Subgroups are detected by 'hclust, kmeans, skmeans, pam, mclust, NMF' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 30000 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"         "collect_stats"        
#>  [5] "colnames"              "functional_enrichment" "get_anno_col"          "get_anno"             
#>  [9] "get_classes"           "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                  "nrow"                 
#> [17] "rownames"              "show"                  "suggest_best_k"        "test_to_known_factors"
#> [21] "top_rows_heatmap"      "top_rows_overlap"     
#> 
#> You can get result for a single method by, e.g. object["SD", "hclust"] or object["SD:hclust"]
#> or a subset of methods by object[c("SD", "CV")], c("hclust", "kmeans")]

The call of run_all_consensus_partition_methods() was:

#> run_all_consensus_partition_methods(data = mat, mc.cores = 4, anno = anno)

Dimension of the input matrix:

mat = get_matrix(res_list)
dim(mat)
#> [1] 21168    75

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:kmeans 2 1.000 0.980 0.992 **
SD:skmeans 3 1.000 0.966 0.978 ** 2
SD:mclust 2 1.000 0.973 0.987 **
SD:NMF 2 1.000 0.953 0.982 **
CV:kmeans 2 1.000 0.990 0.996 **
CV:skmeans 3 1.000 0.952 0.977 ** 2
CV:mclust 2 1.000 0.949 0.981 **
MAD:kmeans 2 1.000 0.970 0.989 **
MAD:skmeans 3 1.000 0.942 0.969 ** 2
MAD:mclust 2 1.000 0.993 0.997 **
MAD:NMF 2 1.000 0.974 0.990 **
ATC:pam 2 1.000 0.987 0.995 **
ATC:NMF 2 1.000 0.989 0.995 **
MAD:pam 4 0.943 0.923 0.969 * 2
SD:pam 6 0.940 0.847 0.941 * 2,4,5
ATC:skmeans 5 0.938 0.858 0.953 * 2,3,4
ATC:hclust 3 0.931 0.826 0.918 *
CV:pam 5 0.930 0.902 0.944 * 2,4
CV:NMF 3 0.925 0.889 0.955 * 2
ATC:kmeans 4 0.910 0.948 0.965 * 2
CV:hclust 4 0.750 0.751 0.845
SD:hclust 3 0.732 0.822 0.902
MAD:hclust 3 0.725 0.786 0.897
ATC:mclust 2 0.674 0.950 0.954

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 1.000           0.953       0.982          0.428 0.580   0.580
#> CV:NMF      2 0.972           0.963       0.984          0.438 0.559   0.559
#> MAD:NMF     2 1.000           0.974       0.990          0.457 0.550   0.550
#> ATC:NMF     2 1.000           0.989       0.995          0.444 0.559   0.559
#> SD:skmeans  2 1.000           0.994       0.997          0.476 0.526   0.526
#> CV:skmeans  2 1.000           0.987       0.994          0.477 0.526   0.526
#> MAD:skmeans 2 1.000           0.980       0.992          0.487 0.514   0.514
#> ATC:skmeans 2 1.000           0.998       0.999          0.467 0.533   0.533
#> SD:mclust   2 1.000           0.973       0.987          0.474 0.526   0.526
#> CV:mclust   2 1.000           0.949       0.981          0.472 0.519   0.519
#> MAD:mclust  2 1.000           0.993       0.997          0.466 0.533   0.533
#> ATC:mclust  2 0.674           0.950       0.954          0.455 0.550   0.550
#> SD:kmeans   2 1.000           0.980       0.992          0.449 0.550   0.550
#> CV:kmeans   2 1.000           0.990       0.996          0.454 0.550   0.550
#> MAD:kmeans  2 1.000           0.970       0.989          0.459 0.541   0.541
#> ATC:kmeans  2 1.000           1.000       1.000          0.421 0.580   0.580
#> SD:pam      2 1.000           0.946       0.979          0.454 0.559   0.559
#> CV:pam      2 1.000           0.954       0.979          0.482 0.508   0.508
#> MAD:pam     2 1.000           0.969       0.987          0.488 0.508   0.508
#> ATC:pam     2 1.000           0.987       0.995          0.425 0.580   0.580
#> SD:hclust   2 0.839           0.907       0.961          0.381 0.630   0.630
#> CV:hclust   2 0.567           0.888       0.942          0.364 0.630   0.630
#> MAD:hclust  2 0.614           0.889       0.941          0.356 0.630   0.630
#> ATC:hclust  2 0.792           0.911       0.940          0.344 0.591   0.591
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.862           0.828       0.930          0.306 0.823   0.706
#> CV:NMF      3 0.925           0.889       0.955          0.286 0.835   0.714
#> MAD:NMF     3 0.748           0.763       0.897          0.290 0.847   0.730
#> ATC:NMF     3 0.807           0.898       0.939          0.191 0.921   0.861
#> SD:skmeans  3 1.000           0.966       0.978          0.394 0.788   0.605
#> CV:skmeans  3 1.000           0.952       0.977          0.390 0.792   0.612
#> MAD:skmeans 3 1.000           0.942       0.969          0.360 0.783   0.592
#> ATC:skmeans 3 1.000           0.950       0.982          0.256 0.838   0.707
#> SD:mclust   3 0.597           0.733       0.830          0.192 0.934   0.878
#> CV:mclust   3 0.728           0.837       0.856          0.183 0.870   0.772
#> MAD:mclust  3 0.542           0.658       0.767          0.268 0.930   0.871
#> ATC:mclust  3 0.629           0.854       0.866          0.223 0.944   0.898
#> SD:kmeans   3 0.671           0.798       0.839          0.282 0.904   0.829
#> CV:kmeans   3 0.663           0.772       0.822          0.288 0.882   0.792
#> MAD:kmeans  3 0.552           0.549       0.707          0.329 0.890   0.799
#> ATC:kmeans  3 0.686           0.812       0.911          0.341 0.717   0.553
#> SD:pam      3 0.728           0.886       0.926          0.258 0.803   0.669
#> CV:pam      3 0.715           0.745       0.782          0.288 0.745   0.536
#> MAD:pam     3 0.647           0.224       0.654          0.260 0.699   0.484
#> ATC:pam     3 0.632           0.799       0.886          0.424 0.717   0.540
#> SD:hclust   3 0.732           0.822       0.902          0.431 0.818   0.711
#> CV:hclust   3 0.651           0.722       0.864          0.500 0.790   0.672
#> MAD:hclust  3 0.725           0.786       0.897          0.615 0.751   0.611
#> ATC:hclust  3 0.931           0.826       0.918          0.374 0.950   0.916
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.839           0.854       0.925         0.1431 0.846   0.683
#> CV:NMF      4 0.818           0.826       0.921         0.1353 0.901   0.781
#> MAD:NMF     4 0.666           0.717       0.865         0.1501 0.829   0.634
#> ATC:NMF     4 0.692           0.777       0.886         0.2421 0.790   0.593
#> SD:skmeans  4 0.831           0.820       0.883         0.0924 0.938   0.819
#> CV:skmeans  4 0.831           0.849       0.923         0.0969 0.922   0.776
#> MAD:skmeans 4 0.870           0.857       0.931         0.1026 0.907   0.737
#> ATC:skmeans 4 0.967           0.898       0.965         0.1019 0.928   0.826
#> SD:mclust   4 0.604           0.826       0.767         0.2098 0.660   0.384
#> CV:mclust   4 0.514           0.527       0.674         0.1545 0.761   0.579
#> MAD:mclust  4 0.682           0.829       0.895         0.1163 0.792   0.589
#> ATC:mclust  4 0.573           0.663       0.746         0.2278 0.795   0.595
#> SD:kmeans   4 0.653           0.859       0.854         0.1889 0.801   0.586
#> CV:kmeans   4 0.643           0.872       0.873         0.1843 0.789   0.562
#> MAD:kmeans  4 0.583           0.707       0.785         0.1549 0.731   0.457
#> ATC:kmeans  4 0.910           0.948       0.965         0.2452 0.735   0.445
#> SD:pam      4 0.967           0.913       0.963         0.2582 0.764   0.505
#> CV:pam      4 0.999           0.949       0.981         0.1631 0.879   0.670
#> MAD:pam     4 0.943           0.923       0.969         0.1787 0.704   0.364
#> ATC:pam     4 0.835           0.838       0.935         0.1636 0.797   0.527
#> SD:hclust   4 0.829           0.780       0.894         0.0692 0.954   0.900
#> CV:hclust   4 0.750           0.751       0.845         0.0813 0.953   0.898
#> MAD:hclust  4 0.771           0.736       0.855         0.0622 0.981   0.953
#> ATC:hclust  4 0.743           0.816       0.915         0.1508 0.941   0.893
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.648           0.662       0.812         0.1815 0.758   0.439
#> CV:NMF      5 0.651           0.581       0.805         0.1779 0.776   0.469
#> MAD:NMF     5 0.681           0.524       0.769         0.1111 0.801   0.495
#> ATC:NMF     5 0.612           0.649       0.812         0.0921 0.856   0.625
#> SD:skmeans  5 0.866           0.814       0.911         0.0707 0.924   0.745
#> CV:skmeans  5 0.828           0.799       0.903         0.0661 0.943   0.802
#> MAD:skmeans 5 0.828           0.753       0.886         0.0705 0.936   0.772
#> ATC:skmeans 5 0.938           0.858       0.953         0.0398 0.966   0.904
#> SD:mclust   5 0.628           0.717       0.765         0.0879 0.908   0.675
#> CV:mclust   5 0.557           0.650       0.736         0.1457 0.730   0.396
#> MAD:mclust  5 0.709           0.793       0.815         0.1354 0.827   0.517
#> ATC:mclust  5 0.630           0.774       0.799         0.0663 0.809   0.492
#> SD:kmeans   5 0.612           0.507       0.693         0.1130 0.889   0.631
#> CV:kmeans   5 0.696           0.718       0.801         0.1095 0.919   0.720
#> MAD:kmeans  5 0.625           0.760       0.801         0.0965 0.906   0.673
#> ATC:kmeans  5 0.780           0.648       0.786         0.0931 0.929   0.759
#> SD:pam      5 0.916           0.858       0.935         0.0409 0.969   0.889
#> CV:pam      5 0.930           0.902       0.944         0.0357 0.968   0.884
#> MAD:pam     5 0.900           0.831       0.914         0.0364 0.977   0.918
#> ATC:pam     5 0.796           0.828       0.892         0.0786 0.878   0.620
#> SD:hclust   5 0.861           0.864       0.940         0.0388 0.967   0.925
#> CV:hclust   5 0.842           0.737       0.871         0.0552 0.966   0.920
#> MAD:hclust  5 0.640           0.707       0.820         0.0821 0.964   0.909
#> ATC:hclust  5 0.656           0.724       0.847         0.3076 0.746   0.505
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.739           0.721       0.853         0.0646 0.834   0.451
#> CV:NMF      6 0.784           0.758       0.884         0.0788 0.836   0.446
#> MAD:NMF     6 0.751           0.737       0.880         0.0761 0.814   0.405
#> ATC:NMF     6 0.593           0.587       0.778         0.0402 0.994   0.980
#> SD:skmeans  6 0.822           0.718       0.852         0.0363 0.963   0.843
#> CV:skmeans  6 0.818           0.678       0.844         0.0364 0.979   0.912
#> MAD:skmeans 6 0.795           0.606       0.800         0.0316 0.957   0.825
#> ATC:skmeans 6 0.748           0.766       0.878         0.0663 0.962   0.882
#> SD:mclust   6 0.693           0.781       0.855         0.0652 0.991   0.955
#> CV:mclust   6 0.580           0.734       0.788         0.0513 0.936   0.721
#> MAD:mclust  6 0.715           0.803       0.856         0.0667 0.947   0.763
#> ATC:mclust  6 0.825           0.867       0.885         0.0997 0.926   0.710
#> SD:kmeans   6 0.775           0.727       0.839         0.0669 0.885   0.542
#> CV:kmeans   6 0.795           0.656       0.827         0.0634 0.942   0.745
#> MAD:kmeans  6 0.768           0.708       0.822         0.0617 0.957   0.801
#> ATC:kmeans  6 0.788           0.775       0.824         0.0499 0.881   0.559
#> SD:pam      6 0.940           0.847       0.941         0.0305 0.952   0.818
#> CV:pam      6 0.832           0.733       0.831         0.0555 0.947   0.796
#> MAD:pam     6 0.851           0.842       0.917         0.0460 0.933   0.753
#> ATC:pam     6 0.784           0.551       0.807         0.0325 0.921   0.709
#> SD:hclust   6 0.680           0.760       0.874         0.0575 0.989   0.974
#> CV:hclust   6 0.652           0.662       0.793         0.0704 0.968   0.924
#> MAD:hclust  6 0.619           0.691       0.765         0.0843 0.942   0.844
#> ATC:hclust  6 0.716           0.776       0.876         0.0226 0.978   0.921

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) other(p) genotype/variation(p) k
#> SD:NMF      73            0.345    1.000                 0.453 2
#> CV:NMF      74            0.309    0.876                 0.447 2
#> MAD:NMF     74            0.565    1.000                 0.744 2
#> ATC:NMF     75            0.666    1.000                 0.753 2
#> SD:skmeans  75            0.824    1.000                 0.806 2
#> CV:skmeans  75            0.824    1.000                 0.806 2
#> MAD:skmeans 74            0.815    1.000                 0.749 2
#> ATC:skmeans 75            0.453    0.570                 0.713 2
#> SD:mclust   75            0.824    0.881                 0.806 2
#> CV:mclust   72            0.747    1.000                 0.811 2
#> MAD:mclust  75            0.909    1.000                 0.811 2
#> ATC:mclust  75            0.590    0.935                 0.748 2
#> SD:kmeans   74            0.640    1.000                 0.752 2
#> CV:kmeans   75            0.590    0.935                 0.748 2
#> MAD:kmeans  73            0.685    1.000                 0.791 2
#> ATC:kmeans  75            0.379    1.000                 0.456 2
#> SD:pam      72            0.737    1.000                 0.794 2
#> CV:pam      74            1.000    0.964                 0.661 2
#> MAD:pam     74            1.000    0.964                 0.661 2
#> ATC:pam     74            0.362    1.000                 0.455 2
#> SD:hclust   75            0.247    0.737                 0.442 2
#> CV:hclust   75            0.247    0.737                 0.442 2
#> MAD:hclust  73            0.318    0.730                 0.358 2
#> ATC:hclust  75            0.439    0.943                 0.454 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) other(p) genotype/variation(p) k
#> SD:NMF      66         0.052527    0.183                0.1640 3
#> CV:NMF      71         0.010333    0.139                0.1968 3
#> MAD:NMF     67         0.178000    0.578                0.3090 3
#> ATC:NMF     74         0.007855    0.232                0.5561 3
#> SD:skmeans  74         0.001421    0.752                0.0372 3
#> CV:skmeans  73         0.001689    0.823                0.0378 3
#> MAD:skmeans 73         0.001807    0.763                0.0348 3
#> ATC:skmeans 73         0.511869    0.411                0.0361 3
#> SD:mclust   66         0.566264    0.946                0.9663 3
#> CV:mclust   73         0.361725    0.761                0.7414 3
#> MAD:mclust  65         0.259024    0.758                0.5528 3
#> ATC:mclust  69         0.199585    0.843                0.6419 3
#> SD:kmeans   72         0.402469    0.748                0.7928 3
#> CV:kmeans   70         0.391695    0.745                0.8200 3
#> MAD:kmeans  58         0.568772    0.874                0.5252 3
#> ATC:kmeans  67         0.272784    0.548                0.9529 3
#> SD:pam      74         0.287294    0.924                0.6716 3
#> CV:pam      66         0.000535    0.487                0.0379 3
#> MAD:pam     32         0.042258    0.653                0.3681 3
#> ATC:pam     69         0.373818    0.816                0.2377 3
#> SD:hclust   73         0.253041    0.421                0.4818 3
#> CV:hclust   65         0.193270    0.297                0.2281 3
#> MAD:hclust  69         0.307899    0.652                0.3201 3
#> ATC:hclust  67         0.551176    0.636                0.8204 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) other(p) genotype/variation(p) k
#> SD:NMF      71         0.224177   0.1944               0.66012 4
#> CV:NMF      69         0.037263   0.1331               0.48807 4
#> MAD:NMF     64         0.001506   0.1321               0.18030 4
#> ATC:NMF     68         0.049888   0.3067               0.83114 4
#> SD:skmeans  71         0.001238   0.9066               0.10041 4
#> CV:skmeans  70         0.005868   0.8457               0.16870 4
#> MAD:skmeans 70         0.004230   0.9111               0.12371 4
#> ATC:skmeans 70         0.357776   0.5988               0.00548 4
#> SD:mclust   73         0.002448   0.8741               0.35441 4
#> CV:mclust   52         0.002713   0.5864               0.14274 4
#> MAD:mclust  71         0.352475   0.5029               0.21180 4
#> ATC:mclust  56         0.287596   0.1722               0.37478 4
#> SD:kmeans   72         0.001048   0.6508               0.05855 4
#> CV:kmeans   75         0.000715   0.7674               0.07887 4
#> MAD:kmeans  66         0.005810   0.7387               0.11970 4
#> ATC:kmeans  75         0.541677   0.7662               0.24119 4
#> SD:pam      71         0.000538   0.4611               0.07001 4
#> CV:pam      73         0.000841   0.5838               0.07081 4
#> MAD:pam     73         0.000105   0.5240               0.06918 4
#> ATC:pam     67         0.587473   0.9234               0.43299 4
#> SD:hclust   70         0.487927   0.5728               0.77561 4
#> CV:hclust   64         0.505398   0.2806               0.74874 4
#> MAD:hclust  59         0.321006   0.0961               0.85564 4
#> ATC:hclust  70         0.657129   0.7659               0.83760 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) other(p) genotype/variation(p) k
#> SD:NMF      63         0.000176    0.587               0.18127 5
#> CV:NMF      45         0.004589    0.229               0.15688 5
#> MAD:NMF     47         0.007345    0.147               0.09751 5
#> ATC:NMF     60         0.062578    0.340               0.93590 5
#> SD:skmeans  67         0.003010    0.933               0.27830 5
#> CV:skmeans  68         0.005865    0.913               0.39047 5
#> MAD:skmeans 67         0.007780    0.892               0.05352 5
#> ATC:skmeans 69         0.718979    0.703               0.03915 5
#> SD:mclust   60         0.005094    0.824               0.37698 5
#> CV:mclust   54         0.011620    0.853               0.48081 5
#> MAD:mclust  71         0.017914    0.847               0.39516 5
#> ATC:mclust  71         0.707488    0.773               0.38854 5
#> SD:kmeans   41         0.031084    0.201               0.00686 5
#> CV:kmeans   65         0.006004    0.598               0.05930 5
#> MAD:kmeans  70         0.005756    0.767               0.06749 5
#> ATC:kmeans  58         0.646907    0.771               0.19308 5
#> SD:pam      70         0.000227    0.580               0.12319 5
#> CV:pam      72         0.000419    0.692               0.14116 5
#> MAD:pam     68         0.000189    0.864               0.10618 5
#> ATC:pam     72         0.617977    0.116               0.03196 5
#> SD:hclust   73         0.121102    0.370               0.68014 5
#> CV:hclust   58         0.493728    0.236               0.98000 5
#> MAD:hclust  59         0.149134    0.313               0.96129 5
#> ATC:hclust  70         0.730214    0.937               0.52496 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) other(p) genotype/variation(p) k
#> SD:NMF      66         5.62e-04    0.483                0.1753 6
#> CV:NMF      67         2.34e-04    0.189                0.0681 6
#> MAD:NMF     64         1.02e-03    0.541                0.1707 6
#> ATC:NMF     50         1.87e-02    0.459                0.2911 6
#> SD:skmeans  63         3.44e-04    0.471                0.3397 6
#> CV:skmeans  60         1.02e-03    0.575                0.2353 6
#> MAD:skmeans 53         8.95e-04    0.891                0.2355 6
#> ATC:skmeans 67         6.04e-01    0.536                0.0669 6
#> SD:mclust   72         1.10e-02    0.771                0.6890 6
#> CV:mclust   68         3.12e-03    0.768                0.4616 6
#> MAD:mclust  69         1.29e-02    0.929                0.5392 6
#> ATC:mclust  73         3.26e-01    0.450                0.1041 6
#> SD:kmeans   68         5.47e-03    0.636                0.1350 6
#> CV:kmeans   60         8.14e-03    0.203                0.3440 6
#> MAD:kmeans  64         4.26e-03    0.792                0.2004 6
#> ATC:kmeans  68         4.57e-01    0.794                0.1252 6
#> SD:pam      66         5.16e-05    0.358                0.2058 6
#> CV:pam      59         5.34e-05    0.578                0.1340 6
#> MAD:pam     69         1.72e-05    0.318                0.2467 6
#> ATC:pam     39         6.40e-01    0.682                0.3520 6
#> SD:hclust   68         1.77e-01    0.351                0.7957 6
#> CV:hclust   59         4.74e-02    0.346                0.3712 6
#> MAD:hclust  68         6.86e-02    0.486                0.6597 6
#> ATC:hclust  72         6.77e-01    0.719                0.7626 6

Results for each method


SD:hclust

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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.839           0.907       0.961         0.3810 0.630   0.630
#> 3 3 0.732           0.822       0.902         0.4308 0.818   0.711
#> 4 4 0.829           0.780       0.894         0.0692 0.954   0.900
#> 5 5 0.861           0.864       0.940         0.0388 0.967   0.925
#> 6 6 0.680           0.760       0.874         0.0575 0.989   0.974

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
#> GSM62248     2  0.0000      0.961 0.000 1.000
#> GSM62256     2  0.0000      0.961 0.000 1.000
#> GSM62259     2  0.0000      0.961 0.000 1.000
#> GSM62267     1  0.7299      0.757 0.796 0.204
#> GSM62280     2  0.0672      0.953 0.008 0.992
#> GSM62284     1  0.0000      0.941 1.000 0.000
#> GSM62289     2  0.0000      0.961 0.000 1.000
#> GSM62307     2  0.0000      0.961 0.000 1.000
#> GSM62316     2  0.0000      0.961 0.000 1.000
#> GSM62254     2  0.0000      0.961 0.000 1.000
#> GSM62292     2  0.0000      0.961 0.000 1.000
#> GSM62253     1  0.0000      0.941 1.000 0.000
#> GSM62270     1  0.0000      0.941 1.000 0.000
#> GSM62278     1  0.0000      0.941 1.000 0.000
#> GSM62297     2  0.0000      0.961 0.000 1.000
#> GSM62298     2  0.0000      0.961 0.000 1.000
#> GSM62299     2  0.0000      0.961 0.000 1.000
#> GSM62258     1  0.7299      0.756 0.796 0.204
#> GSM62281     2  0.0000      0.961 0.000 1.000
#> GSM62294     2  0.0000      0.961 0.000 1.000
#> GSM62305     2  0.0000      0.961 0.000 1.000
#> GSM62306     2  0.0000      0.961 0.000 1.000
#> GSM62310     2  0.0000      0.961 0.000 1.000
#> GSM62311     2  0.0000      0.961 0.000 1.000
#> GSM62317     2  0.0000      0.961 0.000 1.000
#> GSM62318     2  0.0000      0.961 0.000 1.000
#> GSM62321     2  0.0000      0.961 0.000 1.000
#> GSM62322     1  0.0000      0.941 1.000 0.000
#> GSM62250     2  0.0000      0.961 0.000 1.000
#> GSM62252     2  0.0000      0.961 0.000 1.000
#> GSM62255     2  0.0000      0.961 0.000 1.000
#> GSM62257     2  0.0000      0.961 0.000 1.000
#> GSM62260     2  0.9129      0.514 0.328 0.672
#> GSM62261     2  0.0000      0.961 0.000 1.000
#> GSM62262     2  0.0000      0.961 0.000 1.000
#> GSM62264     2  0.9129      0.514 0.328 0.672
#> GSM62268     1  0.0000      0.941 1.000 0.000
#> GSM62269     1  0.0000      0.941 1.000 0.000
#> GSM62271     1  0.0000      0.941 1.000 0.000
#> GSM62272     1  0.0000      0.941 1.000 0.000
#> GSM62273     2  0.0000      0.961 0.000 1.000
#> GSM62274     1  0.0000      0.941 1.000 0.000
#> GSM62275     1  0.0000      0.941 1.000 0.000
#> GSM62276     1  0.7299      0.757 0.796 0.204
#> GSM62277     1  0.0000      0.941 1.000 0.000
#> GSM62279     1  0.0672      0.936 0.992 0.008
#> GSM62282     1  0.8909      0.570 0.692 0.308
#> GSM62283     2  0.9170      0.505 0.332 0.668
#> GSM62286     2  0.0000      0.961 0.000 1.000
#> GSM62287     2  0.0000      0.961 0.000 1.000
#> GSM62288     2  0.0000      0.961 0.000 1.000
#> GSM62290     2  0.0000      0.961 0.000 1.000
#> GSM62293     2  0.0000      0.961 0.000 1.000
#> GSM62301     2  0.0000      0.961 0.000 1.000
#> GSM62302     2  0.0000      0.961 0.000 1.000
#> GSM62303     2  0.0000      0.961 0.000 1.000
#> GSM62304     2  0.0000      0.961 0.000 1.000
#> GSM62312     2  0.0000      0.961 0.000 1.000
#> GSM62313     2  0.0000      0.961 0.000 1.000
#> GSM62314     2  0.0000      0.961 0.000 1.000
#> GSM62319     2  0.0000      0.961 0.000 1.000
#> GSM62320     2  0.0000      0.961 0.000 1.000
#> GSM62249     2  0.9170      0.505 0.332 0.668
#> GSM62251     2  0.9170      0.505 0.332 0.668
#> GSM62263     2  0.0000      0.961 0.000 1.000
#> GSM62285     2  0.0000      0.961 0.000 1.000
#> GSM62315     2  0.0000      0.961 0.000 1.000
#> GSM62291     2  0.0000      0.961 0.000 1.000
#> GSM62265     2  0.9170      0.505 0.332 0.668
#> GSM62266     1  0.0000      0.941 1.000 0.000
#> GSM62296     2  0.0000      0.961 0.000 1.000
#> GSM62309     2  0.0000      0.961 0.000 1.000
#> GSM62295     2  0.0000      0.961 0.000 1.000
#> GSM62300     2  0.0000      0.961 0.000 1.000
#> GSM62308     2  0.0000      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
#> GSM62248     2  0.1411      0.923 0.036 0.964 0.000
#> GSM62256     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62259     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62267     3  0.5020      0.616 0.192 0.012 0.796
#> GSM62280     1  0.5061      0.675 0.784 0.208 0.008
#> GSM62284     3  0.0000      0.851 0.000 0.000 1.000
#> GSM62289     2  0.5098      0.641 0.248 0.752 0.000
#> GSM62307     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62316     2  0.1411      0.923 0.036 0.964 0.000
#> GSM62254     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62292     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62253     3  0.0000      0.851 0.000 0.000 1.000
#> GSM62270     3  0.4654      0.776 0.208 0.000 0.792
#> GSM62278     3  0.0000      0.851 0.000 0.000 1.000
#> GSM62297     2  0.1411      0.923 0.036 0.964 0.000
#> GSM62298     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62299     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62258     3  0.4784      0.617 0.200 0.004 0.796
#> GSM62281     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62294     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62305     2  0.5529      0.549 0.296 0.704 0.000
#> GSM62306     2  0.5529      0.549 0.296 0.704 0.000
#> GSM62310     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62317     1  0.4654      0.677 0.792 0.208 0.000
#> GSM62318     1  0.4654      0.677 0.792 0.208 0.000
#> GSM62321     1  0.4654      0.677 0.792 0.208 0.000
#> GSM62322     3  0.4654      0.776 0.208 0.000 0.792
#> GSM62250     2  0.5529      0.549 0.296 0.704 0.000
#> GSM62252     2  0.5529      0.549 0.296 0.704 0.000
#> GSM62255     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62260     1  0.6448      0.632 0.656 0.016 0.328
#> GSM62261     2  0.1411      0.923 0.036 0.964 0.000
#> GSM62262     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62264     1  0.6448      0.632 0.656 0.016 0.328
#> GSM62268     3  0.0000      0.851 0.000 0.000 1.000
#> GSM62269     3  0.4654      0.776 0.208 0.000 0.792
#> GSM62271     3  0.0000      0.851 0.000 0.000 1.000
#> GSM62272     3  0.4654      0.776 0.208 0.000 0.792
#> GSM62273     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62274     3  0.0000      0.851 0.000 0.000 1.000
#> GSM62275     3  0.4654      0.776 0.208 0.000 0.792
#> GSM62276     3  0.5020      0.616 0.192 0.012 0.796
#> GSM62277     3  0.0000      0.851 0.000 0.000 1.000
#> GSM62279     3  0.0424      0.845 0.000 0.008 0.992
#> GSM62282     3  0.7558      0.468 0.164 0.144 0.692
#> GSM62283     1  0.6726      0.637 0.644 0.024 0.332
#> GSM62286     2  0.5529      0.549 0.296 0.704 0.000
#> GSM62287     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62288     2  0.1411      0.923 0.036 0.964 0.000
#> GSM62290     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62293     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62301     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62302     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62312     2  0.1411      0.923 0.036 0.964 0.000
#> GSM62313     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62314     2  0.1411      0.923 0.036 0.964 0.000
#> GSM62319     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62320     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62249     1  0.6726      0.637 0.644 0.024 0.332
#> GSM62251     1  0.6603      0.635 0.648 0.020 0.332
#> GSM62263     1  0.6295      0.183 0.528 0.472 0.000
#> GSM62285     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62315     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62291     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62265     1  0.6726      0.637 0.644 0.024 0.332
#> GSM62266     3  0.0000      0.851 0.000 0.000 1.000
#> GSM62296     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62309     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62295     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62300     2  0.0000      0.946 0.000 1.000 0.000
#> GSM62308     2  0.0000      0.946 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
#> GSM62248     2  0.1211     0.9265 0.040 0.960 0.000 0.000
#> GSM62256     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62259     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62267     1  0.5158    -0.5474 0.524 0.004 0.000 0.472
#> GSM62280     1  0.4661     0.5024 0.652 0.000 0.000 0.348
#> GSM62284     4  0.5090     0.9008 0.324 0.000 0.016 0.660
#> GSM62289     2  0.4103     0.6820 0.256 0.744 0.000 0.000
#> GSM62307     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62316     2  0.1211     0.9265 0.040 0.960 0.000 0.000
#> GSM62254     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62292     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62253     4  0.5090     0.9008 0.324 0.000 0.016 0.660
#> GSM62270     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM62278     4  0.7142     0.8076 0.324 0.000 0.152 0.524
#> GSM62297     2  0.1211     0.9265 0.040 0.960 0.000 0.000
#> GSM62298     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62258     1  0.5451    -0.5494 0.524 0.004 0.008 0.464
#> GSM62281     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62294     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62305     2  0.4454     0.6004 0.308 0.692 0.000 0.000
#> GSM62306     2  0.4454     0.6004 0.308 0.692 0.000 0.000
#> GSM62310     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62311     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62317     1  0.4624     0.5038 0.660 0.000 0.000 0.340
#> GSM62318     1  0.4624     0.5038 0.660 0.000 0.000 0.340
#> GSM62321     1  0.4624     0.5038 0.660 0.000 0.000 0.340
#> GSM62322     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM62250     2  0.4454     0.6004 0.308 0.692 0.000 0.000
#> GSM62252     2  0.4454     0.6004 0.308 0.692 0.000 0.000
#> GSM62255     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62257     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62260     1  0.0188     0.5538 0.996 0.000 0.000 0.004
#> GSM62261     2  0.1211     0.9265 0.040 0.960 0.000 0.000
#> GSM62262     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62264     1  0.0188     0.5538 0.996 0.000 0.000 0.004
#> GSM62268     4  0.5090     0.9008 0.324 0.000 0.016 0.660
#> GSM62269     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM62271     4  0.7142     0.8076 0.324 0.000 0.152 0.524
#> GSM62272     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM62273     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62274     4  0.5090     0.9008 0.324 0.000 0.016 0.660
#> GSM62275     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM62276     1  0.5158    -0.5474 0.524 0.004 0.000 0.472
#> GSM62277     4  0.5090     0.9008 0.324 0.000 0.016 0.660
#> GSM62279     4  0.4897     0.8913 0.332 0.000 0.008 0.660
#> GSM62282     4  0.6851     0.3792 0.268 0.000 0.148 0.584
#> GSM62283     1  0.0927     0.5566 0.976 0.016 0.000 0.008
#> GSM62286     2  0.4454     0.6004 0.308 0.692 0.000 0.000
#> GSM62287     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62288     2  0.1211     0.9265 0.040 0.960 0.000 0.000
#> GSM62290     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62293     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62301     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62302     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62312     2  0.1211     0.9265 0.040 0.960 0.000 0.000
#> GSM62313     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62314     2  0.1211     0.9265 0.040 0.960 0.000 0.000
#> GSM62319     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62320     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62249     1  0.0927     0.5566 0.976 0.016 0.000 0.008
#> GSM62251     1  0.0804     0.5563 0.980 0.012 0.000 0.008
#> GSM62263     1  0.4981    -0.0392 0.536 0.464 0.000 0.000
#> GSM62285     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62265     1  0.0927     0.5566 0.976 0.016 0.000 0.008
#> GSM62266     4  0.5090     0.9008 0.324 0.000 0.016 0.660
#> GSM62296     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62309     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62295     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62300     2  0.0000     0.9497 0.000 1.000 0.000 0.000
#> GSM62308     2  0.0000     0.9497 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
#> GSM62248     4  0.1121     0.9195 0.000 0.000 0.000 0.956 0.044
#> GSM62256     4  0.0162     0.9433 0.000 0.000 0.000 0.996 0.004
#> GSM62259     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62267     1  0.3861     0.6728 0.712 0.004 0.000 0.000 0.284
#> GSM62280     2  0.0451     0.9887 0.004 0.988 0.000 0.000 0.008
#> GSM62284     1  0.0000     0.8526 1.000 0.000 0.000 0.000 0.000
#> GSM62289     4  0.3636     0.6433 0.000 0.000 0.000 0.728 0.272
#> GSM62307     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62316     4  0.1121     0.9195 0.000 0.000 0.000 0.956 0.044
#> GSM62254     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62292     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62253     1  0.0000     0.8526 1.000 0.000 0.000 0.000 0.000
#> GSM62270     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM62278     1  0.2787     0.7941 0.856 0.004 0.136 0.000 0.004
#> GSM62297     4  0.1121     0.9195 0.000 0.000 0.000 0.956 0.044
#> GSM62298     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62299     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62258     1  0.3741     0.6915 0.732 0.004 0.000 0.000 0.264
#> GSM62281     4  0.0162     0.9433 0.000 0.000 0.000 0.996 0.004
#> GSM62294     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62305     4  0.3913     0.5518 0.000 0.000 0.000 0.676 0.324
#> GSM62306     4  0.3913     0.5518 0.000 0.000 0.000 0.676 0.324
#> GSM62310     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62311     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62317     2  0.0162     0.9929 0.000 0.996 0.000 0.000 0.004
#> GSM62318     2  0.0404     0.9912 0.000 0.988 0.000 0.000 0.012
#> GSM62321     2  0.0162     0.9929 0.000 0.996 0.000 0.000 0.004
#> GSM62322     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM62250     4  0.3913     0.5518 0.000 0.000 0.000 0.676 0.324
#> GSM62252     4  0.3913     0.5518 0.000 0.000 0.000 0.676 0.324
#> GSM62255     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62257     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62260     5  0.1041     0.8001 0.004 0.032 0.000 0.000 0.964
#> GSM62261     4  0.1121     0.9195 0.000 0.000 0.000 0.956 0.044
#> GSM62262     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62264     5  0.1041     0.8001 0.004 0.032 0.000 0.000 0.964
#> GSM62268     1  0.0000     0.8526 1.000 0.000 0.000 0.000 0.000
#> GSM62269     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM62271     1  0.2787     0.7941 0.856 0.004 0.136 0.000 0.004
#> GSM62272     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM62273     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62274     1  0.0000     0.8526 1.000 0.000 0.000 0.000 0.000
#> GSM62275     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM62276     1  0.3861     0.6728 0.712 0.004 0.000 0.000 0.284
#> GSM62277     1  0.0000     0.8526 1.000 0.000 0.000 0.000 0.000
#> GSM62279     1  0.1410     0.8313 0.940 0.000 0.000 0.000 0.060
#> GSM62282     1  0.6943     0.3455 0.520 0.296 0.136 0.000 0.048
#> GSM62283     5  0.0162     0.8184 0.004 0.000 0.000 0.000 0.996
#> GSM62286     4  0.3913     0.5518 0.000 0.000 0.000 0.676 0.324
#> GSM62287     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62288     4  0.1121     0.9195 0.000 0.000 0.000 0.956 0.044
#> GSM62290     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62293     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62301     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62302     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62303     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62304     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62312     4  0.1121     0.9195 0.000 0.000 0.000 0.956 0.044
#> GSM62313     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62314     4  0.1121     0.9195 0.000 0.000 0.000 0.956 0.044
#> GSM62319     4  0.0290     0.9408 0.000 0.000 0.000 0.992 0.008
#> GSM62320     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62249     5  0.0162     0.8184 0.004 0.000 0.000 0.000 0.996
#> GSM62251     5  0.0324     0.8175 0.004 0.004 0.000 0.000 0.992
#> GSM62263     5  0.4430     0.0288 0.000 0.004 0.000 0.456 0.540
#> GSM62285     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62315     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62291     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62265     5  0.0162     0.8184 0.004 0.000 0.000 0.000 0.996
#> GSM62266     1  0.0000     0.8526 1.000 0.000 0.000 0.000 0.000
#> GSM62296     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62309     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62295     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62300     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000
#> GSM62308     4  0.0000     0.9452 0.000 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2   p3    p4    p5    p6
#> GSM62248     4  0.2445      0.866 0.000 0.020 0.00 0.872 0.108 0.000
#> GSM62256     4  0.0146      0.900 0.000 0.004 0.00 0.996 0.000 0.000
#> GSM62259     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62267     5  0.5392      0.486 0.436 0.112 0.00 0.000 0.452 0.000
#> GSM62280     6  0.3446      0.823 0.000 0.000 0.00 0.000 0.308 0.692
#> GSM62284     1  0.0000      0.720 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM62289     4  0.4583      0.618 0.000 0.176 0.00 0.696 0.128 0.000
#> GSM62307     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62316     4  0.2445      0.866 0.000 0.020 0.00 0.872 0.108 0.000
#> GSM62254     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62292     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62253     1  0.0000      0.720 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM62270     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM62278     1  0.5287     -0.048 0.588 0.004 0.12 0.000 0.288 0.000
#> GSM62297     4  0.3017      0.839 0.000 0.020 0.00 0.816 0.164 0.000
#> GSM62298     4  0.0547      0.899 0.000 0.000 0.00 0.980 0.020 0.000
#> GSM62299     4  0.0547      0.899 0.000 0.000 0.00 0.980 0.020 0.000
#> GSM62258     1  0.5560     -0.557 0.476 0.140 0.00 0.000 0.384 0.000
#> GSM62281     4  0.0146      0.900 0.000 0.004 0.00 0.996 0.000 0.000
#> GSM62294     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62305     4  0.5008      0.529 0.000 0.188 0.00 0.644 0.168 0.000
#> GSM62306     4  0.5008      0.529 0.000 0.188 0.00 0.644 0.168 0.000
#> GSM62310     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62311     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62317     6  0.0000      0.833 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM62318     6  0.3409      0.827 0.000 0.000 0.00 0.000 0.300 0.700
#> GSM62321     6  0.0000      0.833 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM62322     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM62250     4  0.5008      0.529 0.000 0.188 0.00 0.644 0.168 0.000
#> GSM62252     4  0.5008      0.529 0.000 0.188 0.00 0.644 0.168 0.000
#> GSM62255     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62257     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62260     2  0.1572      0.715 0.000 0.936 0.00 0.000 0.036 0.028
#> GSM62261     4  0.2981      0.841 0.000 0.020 0.00 0.820 0.160 0.000
#> GSM62262     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62264     2  0.1572      0.715 0.000 0.936 0.00 0.000 0.036 0.028
#> GSM62268     1  0.0000      0.720 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM62269     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM62271     1  0.5287     -0.048 0.588 0.004 0.12 0.000 0.288 0.000
#> GSM62272     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM62273     4  0.0146      0.900 0.000 0.000 0.00 0.996 0.004 0.000
#> GSM62274     1  0.0000      0.720 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM62275     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM62276     5  0.5392      0.486 0.436 0.112 0.00 0.000 0.452 0.000
#> GSM62277     1  0.0000      0.720 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM62279     1  0.1806      0.610 0.908 0.004 0.00 0.000 0.088 0.000
#> GSM62282     5  0.5675      0.199 0.248 0.032 0.12 0.000 0.600 0.000
#> GSM62283     2  0.2092      0.732 0.000 0.876 0.00 0.000 0.124 0.000
#> GSM62286     4  0.5008      0.529 0.000 0.188 0.00 0.644 0.168 0.000
#> GSM62287     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62288     4  0.2445      0.866 0.000 0.020 0.00 0.872 0.108 0.000
#> GSM62290     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000
#> GSM62293     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62301     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000
#> GSM62302     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62303     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62304     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62312     4  0.3017      0.839 0.000 0.020 0.00 0.816 0.164 0.000
#> GSM62313     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62314     4  0.2445      0.866 0.000 0.020 0.00 0.872 0.108 0.000
#> GSM62319     4  0.0858      0.894 0.000 0.004 0.00 0.968 0.028 0.000
#> GSM62320     4  0.0547      0.899 0.000 0.000 0.00 0.980 0.020 0.000
#> GSM62249     2  0.2092      0.732 0.000 0.876 0.00 0.000 0.124 0.000
#> GSM62251     2  0.0000      0.736 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM62263     2  0.5647      0.224 0.000 0.520 0.00 0.296 0.184 0.000
#> GSM62285     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000
#> GSM62315     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000
#> GSM62291     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000
#> GSM62265     2  0.2092      0.732 0.000 0.876 0.00 0.000 0.124 0.000
#> GSM62266     1  0.0000      0.720 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM62296     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000
#> GSM62309     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000
#> GSM62295     4  0.0000      0.901 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM62300     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000
#> GSM62308     4  0.2178      0.863 0.000 0.000 0.00 0.868 0.132 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) other(p) genotype/variation(p) k
#> SD:hclust 75            0.247    0.737                 0.442 2
#> SD:hclust 73            0.253    0.421                 0.482 3
#> SD:hclust 70            0.488    0.573                 0.776 4
#> SD:hclust 73            0.121    0.370                 0.680 5
#> SD:hclust 68            0.177    0.351                 0.796 6

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


SD:kmeans**

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

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

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

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

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.980       0.992         0.4491 0.550   0.550
#> 3 3 0.671           0.798       0.839         0.2823 0.904   0.829
#> 4 4 0.653           0.859       0.854         0.1889 0.801   0.586
#> 5 5 0.612           0.507       0.693         0.1130 0.889   0.631
#> 6 6 0.775           0.727       0.839         0.0669 0.885   0.542

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
#> GSM62248     2   0.000      0.996 0.000 1.000
#> GSM62256     2   0.000      0.996 0.000 1.000
#> GSM62259     2   0.000      0.996 0.000 1.000
#> GSM62267     1   0.000      0.983 1.000 0.000
#> GSM62280     1   0.000      0.983 1.000 0.000
#> GSM62284     1   0.000      0.983 1.000 0.000
#> GSM62289     2   0.000      0.996 0.000 1.000
#> GSM62307     2   0.000      0.996 0.000 1.000
#> GSM62316     2   0.000      0.996 0.000 1.000
#> GSM62254     2   0.000      0.996 0.000 1.000
#> GSM62292     2   0.000      0.996 0.000 1.000
#> GSM62253     1   0.000      0.983 1.000 0.000
#> GSM62270     1   0.000      0.983 1.000 0.000
#> GSM62278     1   0.000      0.983 1.000 0.000
#> GSM62297     2   0.000      0.996 0.000 1.000
#> GSM62298     2   0.000      0.996 0.000 1.000
#> GSM62299     2   0.000      0.996 0.000 1.000
#> GSM62258     1   0.000      0.983 1.000 0.000
#> GSM62281     2   0.000      0.996 0.000 1.000
#> GSM62294     2   0.000      0.996 0.000 1.000
#> GSM62305     2   0.000      0.996 0.000 1.000
#> GSM62306     2   0.000      0.996 0.000 1.000
#> GSM62310     2   0.000      0.996 0.000 1.000
#> GSM62311     2   0.000      0.996 0.000 1.000
#> GSM62317     2   0.000      0.996 0.000 1.000
#> GSM62318     1   0.000      0.983 1.000 0.000
#> GSM62321     2   0.738      0.730 0.208 0.792
#> GSM62322     1   0.000      0.983 1.000 0.000
#> GSM62250     2   0.000      0.996 0.000 1.000
#> GSM62252     2   0.000      0.996 0.000 1.000
#> GSM62255     2   0.000      0.996 0.000 1.000
#> GSM62257     2   0.000      0.996 0.000 1.000
#> GSM62260     1   0.966      0.347 0.608 0.392
#> GSM62261     2   0.000      0.996 0.000 1.000
#> GSM62262     2   0.000      0.996 0.000 1.000
#> GSM62264     1   0.000      0.983 1.000 0.000
#> GSM62268     1   0.000      0.983 1.000 0.000
#> GSM62269     1   0.000      0.983 1.000 0.000
#> GSM62271     1   0.000      0.983 1.000 0.000
#> GSM62272     1   0.000      0.983 1.000 0.000
#> GSM62273     2   0.000      0.996 0.000 1.000
#> GSM62274     1   0.000      0.983 1.000 0.000
#> GSM62275     1   0.000      0.983 1.000 0.000
#> GSM62276     1   0.000      0.983 1.000 0.000
#> GSM62277     1   0.000      0.983 1.000 0.000
#> GSM62279     1   0.000      0.983 1.000 0.000
#> GSM62282     1   0.000      0.983 1.000 0.000
#> GSM62283     1   0.000      0.983 1.000 0.000
#> GSM62286     2   0.000      0.996 0.000 1.000
#> GSM62287     2   0.000      0.996 0.000 1.000
#> GSM62288     2   0.000      0.996 0.000 1.000
#> GSM62290     2   0.000      0.996 0.000 1.000
#> GSM62293     2   0.000      0.996 0.000 1.000
#> GSM62301     2   0.000      0.996 0.000 1.000
#> GSM62302     2   0.000      0.996 0.000 1.000
#> GSM62303     2   0.000      0.996 0.000 1.000
#> GSM62304     2   0.000      0.996 0.000 1.000
#> GSM62312     2   0.000      0.996 0.000 1.000
#> GSM62313     2   0.000      0.996 0.000 1.000
#> GSM62314     2   0.000      0.996 0.000 1.000
#> GSM62319     2   0.000      0.996 0.000 1.000
#> GSM62320     2   0.000      0.996 0.000 1.000
#> GSM62249     2   0.000      0.996 0.000 1.000
#> GSM62251     1   0.000      0.983 1.000 0.000
#> GSM62263     2   0.000      0.996 0.000 1.000
#> GSM62285     2   0.000      0.996 0.000 1.000
#> GSM62315     2   0.000      0.996 0.000 1.000
#> GSM62291     2   0.000      0.996 0.000 1.000
#> GSM62265     1   0.000      0.983 1.000 0.000
#> GSM62266     1   0.000      0.983 1.000 0.000
#> GSM62296     2   0.000      0.996 0.000 1.000
#> GSM62309     2   0.000      0.996 0.000 1.000
#> GSM62295     2   0.000      0.996 0.000 1.000
#> GSM62300     2   0.000      0.996 0.000 1.000
#> GSM62308     2   0.000      0.996 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.1411      0.869 0.000 0.964 0.036
#> GSM62256     2  0.2796      0.864 0.000 0.908 0.092
#> GSM62259     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62267     1  0.0000      0.791 1.000 0.000 0.000
#> GSM62280     1  0.1163      0.787 0.972 0.000 0.028
#> GSM62284     1  0.6302     -0.690 0.520 0.000 0.480
#> GSM62289     2  0.1289      0.869 0.000 0.968 0.032
#> GSM62307     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62316     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62254     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62292     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62253     1  0.0592      0.780 0.988 0.000 0.012
#> GSM62270     3  0.5968      0.995 0.364 0.000 0.636
#> GSM62278     3  0.5968      0.995 0.364 0.000 0.636
#> GSM62297     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62298     2  0.4504      0.825 0.000 0.804 0.196
#> GSM62299     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62258     1  0.0000      0.791 1.000 0.000 0.000
#> GSM62281     2  0.2711      0.864 0.000 0.912 0.088
#> GSM62294     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62305     2  0.3267      0.856 0.000 0.884 0.116
#> GSM62306     2  0.1289      0.869 0.000 0.968 0.032
#> GSM62310     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62317     2  0.6189      0.754 0.004 0.632 0.364
#> GSM62318     1  0.1163      0.787 0.972 0.000 0.028
#> GSM62321     1  0.5785      0.531 0.668 0.000 0.332
#> GSM62322     3  0.5968      0.995 0.364 0.000 0.636
#> GSM62250     2  0.2599      0.863 0.016 0.932 0.052
#> GSM62252     2  0.7552      0.324 0.352 0.596 0.052
#> GSM62255     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62260     1  0.5431      0.582 0.716 0.000 0.284
#> GSM62261     2  0.1289      0.869 0.000 0.968 0.032
#> GSM62262     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62264     1  0.4178      0.693 0.828 0.000 0.172
#> GSM62268     1  0.3941      0.529 0.844 0.000 0.156
#> GSM62269     3  0.5968      0.995 0.364 0.000 0.636
#> GSM62271     1  0.0000      0.791 1.000 0.000 0.000
#> GSM62272     3  0.5968      0.995 0.364 0.000 0.636
#> GSM62273     2  0.3267      0.853 0.000 0.884 0.116
#> GSM62274     3  0.6062      0.966 0.384 0.000 0.616
#> GSM62275     3  0.5968      0.995 0.364 0.000 0.636
#> GSM62276     1  0.0000      0.791 1.000 0.000 0.000
#> GSM62277     3  0.5968      0.995 0.364 0.000 0.636
#> GSM62279     1  0.0000      0.791 1.000 0.000 0.000
#> GSM62282     1  0.1031      0.788 0.976 0.000 0.024
#> GSM62283     1  0.2711      0.749 0.912 0.000 0.088
#> GSM62286     2  0.1860      0.867 0.000 0.948 0.052
#> GSM62287     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62288     2  0.1289      0.869 0.000 0.968 0.032
#> GSM62290     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62293     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62301     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62302     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62312     2  0.5678      0.787 0.000 0.684 0.316
#> GSM62313     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62314     2  0.0747      0.869 0.000 0.984 0.016
#> GSM62319     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62320     2  0.4504      0.825 0.000 0.804 0.196
#> GSM62249     1  0.6867      0.476 0.636 0.028 0.336
#> GSM62251     1  0.3267      0.729 0.884 0.000 0.116
#> GSM62263     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62285     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62315     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62291     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62265     1  0.0000      0.791 1.000 0.000 0.000
#> GSM62266     1  0.0000      0.791 1.000 0.000 0.000
#> GSM62296     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62309     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62295     2  0.0000      0.868 0.000 1.000 0.000
#> GSM62300     2  0.5810      0.780 0.000 0.664 0.336
#> GSM62308     2  0.5810      0.780 0.000 0.664 0.336

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4  0.3402     0.8561 0.000 0.164 0.004 0.832
#> GSM62256     4  0.2888     0.8660 0.000 0.124 0.004 0.872
#> GSM62259     4  0.1356     0.8891 0.000 0.032 0.008 0.960
#> GSM62267     1  0.1022     0.8895 0.968 0.000 0.032 0.000
#> GSM62280     1  0.3791     0.8025 0.796 0.200 0.004 0.000
#> GSM62284     3  0.5040     0.4592 0.364 0.008 0.628 0.000
#> GSM62289     4  0.3432     0.8547 0.008 0.140 0.004 0.848
#> GSM62307     4  0.1022     0.8906 0.000 0.032 0.000 0.968
#> GSM62316     4  0.3123     0.8610 0.000 0.156 0.000 0.844
#> GSM62254     4  0.0336     0.8922 0.000 0.000 0.008 0.992
#> GSM62292     4  0.0336     0.8922 0.000 0.000 0.008 0.992
#> GSM62253     1  0.1545     0.8853 0.952 0.008 0.040 0.000
#> GSM62270     3  0.0469     0.9213 0.012 0.000 0.988 0.000
#> GSM62278     3  0.1389     0.9119 0.048 0.000 0.952 0.000
#> GSM62297     2  0.3764     0.8916 0.000 0.784 0.000 0.216
#> GSM62298     2  0.4699     0.9052 0.000 0.676 0.004 0.320
#> GSM62299     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62258     1  0.1284     0.8899 0.964 0.012 0.024 0.000
#> GSM62281     4  0.2530     0.8717 0.000 0.100 0.004 0.896
#> GSM62294     4  0.0188     0.8921 0.000 0.000 0.004 0.996
#> GSM62305     4  0.3534     0.8504 0.008 0.148 0.004 0.840
#> GSM62306     4  0.3052     0.8609 0.000 0.136 0.004 0.860
#> GSM62310     4  0.0817     0.8912 0.000 0.024 0.000 0.976
#> GSM62311     4  0.0817     0.8912 0.000 0.024 0.000 0.976
#> GSM62317     2  0.2907     0.6447 0.032 0.900 0.004 0.064
#> GSM62318     1  0.3791     0.8025 0.796 0.200 0.004 0.000
#> GSM62321     1  0.4343     0.7562 0.732 0.264 0.004 0.000
#> GSM62322     3  0.0469     0.9213 0.012 0.000 0.988 0.000
#> GSM62250     4  0.5136     0.7698 0.084 0.144 0.004 0.768
#> GSM62252     4  0.5563     0.7191 0.128 0.128 0.004 0.740
#> GSM62255     4  0.0817     0.8912 0.000 0.024 0.000 0.976
#> GSM62257     4  0.1022     0.8906 0.000 0.032 0.000 0.968
#> GSM62260     1  0.2216     0.8616 0.908 0.092 0.000 0.000
#> GSM62261     4  0.3172     0.8585 0.000 0.160 0.000 0.840
#> GSM62262     4  0.0188     0.8921 0.000 0.000 0.004 0.996
#> GSM62264     1  0.2281     0.8638 0.904 0.096 0.000 0.000
#> GSM62268     1  0.4792     0.4926 0.680 0.008 0.312 0.000
#> GSM62269     3  0.0469     0.9213 0.012 0.000 0.988 0.000
#> GSM62271     1  0.1356     0.8899 0.960 0.008 0.032 0.000
#> GSM62272     3  0.0469     0.9213 0.012 0.000 0.988 0.000
#> GSM62273     4  0.4973     0.0412 0.000 0.348 0.008 0.644
#> GSM62274     3  0.3725     0.7947 0.180 0.008 0.812 0.000
#> GSM62275     3  0.0469     0.9213 0.012 0.000 0.988 0.000
#> GSM62276     1  0.1022     0.8895 0.968 0.000 0.032 0.000
#> GSM62277     3  0.1302     0.9136 0.044 0.000 0.956 0.000
#> GSM62279     1  0.1356     0.8881 0.960 0.008 0.032 0.000
#> GSM62282     1  0.3545     0.8220 0.828 0.164 0.008 0.000
#> GSM62283     1  0.1624     0.8881 0.952 0.020 0.028 0.000
#> GSM62286     4  0.3432     0.8547 0.008 0.140 0.004 0.848
#> GSM62287     4  0.0000     0.8931 0.000 0.000 0.000 1.000
#> GSM62288     4  0.3172     0.8585 0.000 0.160 0.000 0.840
#> GSM62290     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62293     4  0.0336     0.8922 0.000 0.000 0.008 0.992
#> GSM62301     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62302     4  0.0000     0.8931 0.000 0.000 0.000 1.000
#> GSM62303     4  0.0000     0.8931 0.000 0.000 0.000 1.000
#> GSM62304     4  0.0817     0.8912 0.000 0.024 0.000 0.976
#> GSM62312     2  0.4304     0.9471 0.000 0.716 0.000 0.284
#> GSM62313     4  0.0817     0.8912 0.000 0.024 0.000 0.976
#> GSM62314     4  0.2973     0.8660 0.000 0.144 0.000 0.856
#> GSM62319     2  0.4746     0.9228 0.000 0.688 0.008 0.304
#> GSM62320     2  0.4522     0.9103 0.000 0.680 0.000 0.320
#> GSM62249     1  0.4804     0.6953 0.776 0.160 0.000 0.064
#> GSM62251     1  0.1833     0.8883 0.944 0.024 0.032 0.000
#> GSM62263     2  0.3791     0.8756 0.004 0.796 0.000 0.200
#> GSM62285     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62315     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62291     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62265     1  0.1488     0.8889 0.956 0.012 0.032 0.000
#> GSM62266     1  0.1356     0.8881 0.960 0.008 0.032 0.000
#> GSM62296     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62309     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62295     4  0.0336     0.8922 0.000 0.000 0.008 0.992
#> GSM62300     2  0.4250     0.9533 0.000 0.724 0.000 0.276
#> GSM62308     2  0.4250     0.9533 0.000 0.724 0.000 0.276

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     4  0.3012      0.524 0.000 0.104 0.000 0.860 0.036
#> GSM62256     4  0.3141      0.520 0.000 0.152 0.000 0.832 0.016
#> GSM62259     4  0.5925      0.188 0.000 0.128 0.000 0.556 0.316
#> GSM62267     1  0.2053      0.840 0.924 0.004 0.000 0.048 0.024
#> GSM62280     5  0.4591     -0.590 0.476 0.000 0.004 0.004 0.516
#> GSM62284     3  0.4889      0.259 0.476 0.004 0.504 0.000 0.016
#> GSM62289     4  0.1808      0.500 0.012 0.044 0.000 0.936 0.008
#> GSM62307     5  0.6130      0.153 0.000 0.128 0.000 0.424 0.448
#> GSM62316     4  0.4630      0.483 0.000 0.116 0.000 0.744 0.140
#> GSM62254     4  0.5799      0.146 0.000 0.112 0.000 0.564 0.324
#> GSM62292     4  0.5799      0.146 0.000 0.112 0.000 0.564 0.324
#> GSM62253     1  0.0703      0.821 0.976 0.000 0.000 0.000 0.024
#> GSM62270     3  0.0162      0.873 0.004 0.000 0.996 0.000 0.000
#> GSM62278     3  0.2295      0.848 0.088 0.004 0.900 0.000 0.008
#> GSM62297     2  0.1956      0.853 0.000 0.916 0.000 0.076 0.008
#> GSM62298     2  0.0912      0.893 0.000 0.972 0.000 0.016 0.012
#> GSM62299     2  0.0451      0.901 0.000 0.988 0.000 0.004 0.008
#> GSM62258     1  0.2885      0.838 0.880 0.004 0.000 0.052 0.064
#> GSM62281     4  0.4067      0.418 0.000 0.300 0.000 0.692 0.008
#> GSM62294     5  0.6003      0.119 0.000 0.112 0.000 0.440 0.448
#> GSM62305     4  0.3067      0.457 0.068 0.040 0.000 0.876 0.016
#> GSM62306     4  0.2522      0.526 0.000 0.108 0.000 0.880 0.012
#> GSM62310     5  0.6068      0.158 0.000 0.120 0.000 0.428 0.452
#> GSM62311     5  0.6068      0.158 0.000 0.120 0.000 0.428 0.452
#> GSM62317     2  0.4670      0.426 0.000 0.548 0.004 0.008 0.440
#> GSM62318     5  0.4591     -0.590 0.476 0.000 0.004 0.004 0.516
#> GSM62321     5  0.5890     -0.553 0.400 0.004 0.004 0.076 0.516
#> GSM62322     3  0.0162      0.873 0.004 0.000 0.996 0.000 0.000
#> GSM62250     4  0.4218      0.364 0.176 0.032 0.000 0.776 0.016
#> GSM62252     4  0.4174      0.362 0.180 0.028 0.000 0.776 0.016
#> GSM62255     5  0.6100      0.162 0.000 0.124 0.000 0.428 0.448
#> GSM62257     5  0.6102      0.157 0.000 0.124 0.000 0.436 0.440
#> GSM62260     1  0.4634      0.780 0.752 0.004 0.000 0.100 0.144
#> GSM62261     4  0.4676      0.486 0.000 0.120 0.000 0.740 0.140
#> GSM62262     4  0.6003     -0.222 0.000 0.112 0.000 0.448 0.440
#> GSM62264     1  0.3622      0.799 0.820 0.000 0.000 0.056 0.124
#> GSM62268     1  0.4086      0.480 0.736 0.000 0.240 0.000 0.024
#> GSM62269     3  0.0162      0.873 0.004 0.000 0.996 0.000 0.000
#> GSM62271     1  0.2304      0.834 0.908 0.004 0.000 0.020 0.068
#> GSM62272     3  0.0162      0.873 0.004 0.000 0.996 0.000 0.000
#> GSM62273     2  0.5719      0.088 0.000 0.552 0.000 0.352 0.096
#> GSM62274     3  0.4491      0.597 0.336 0.004 0.648 0.000 0.012
#> GSM62275     3  0.0162      0.873 0.004 0.000 0.996 0.000 0.000
#> GSM62276     1  0.1862      0.842 0.932 0.004 0.000 0.048 0.016
#> GSM62277     3  0.2408      0.845 0.096 0.004 0.892 0.000 0.008
#> GSM62279     1  0.1329      0.833 0.956 0.004 0.000 0.032 0.008
#> GSM62282     1  0.4714      0.511 0.540 0.004 0.004 0.004 0.448
#> GSM62283     1  0.3081      0.832 0.868 0.004 0.000 0.072 0.056
#> GSM62286     4  0.1731      0.499 0.012 0.040 0.000 0.940 0.008
#> GSM62287     4  0.5968     -0.229 0.000 0.108 0.000 0.448 0.444
#> GSM62288     4  0.4634      0.486 0.000 0.120 0.000 0.744 0.136
#> GSM62290     2  0.0579      0.901 0.000 0.984 0.000 0.008 0.008
#> GSM62293     4  0.5989     -0.149 0.000 0.112 0.000 0.476 0.412
#> GSM62301     2  0.0579      0.900 0.000 0.984 0.000 0.008 0.008
#> GSM62302     5  0.6037      0.145 0.000 0.116 0.000 0.440 0.444
#> GSM62303     4  0.5968     -0.229 0.000 0.108 0.000 0.448 0.444
#> GSM62304     5  0.6101      0.160 0.000 0.124 0.000 0.432 0.444
#> GSM62312     2  0.0693      0.899 0.000 0.980 0.000 0.008 0.012
#> GSM62313     5  0.6069      0.158 0.000 0.120 0.000 0.432 0.448
#> GSM62314     4  0.5459      0.384 0.000 0.120 0.000 0.644 0.236
#> GSM62319     2  0.2329      0.807 0.000 0.876 0.000 0.124 0.000
#> GSM62320     2  0.0912      0.893 0.000 0.972 0.000 0.016 0.012
#> GSM62249     1  0.6684      0.353 0.436 0.064 0.000 0.436 0.064
#> GSM62251     1  0.2491      0.831 0.896 0.000 0.000 0.068 0.036
#> GSM62263     2  0.4675      0.524 0.004 0.640 0.000 0.336 0.020
#> GSM62285     2  0.0579      0.900 0.000 0.984 0.000 0.008 0.008
#> GSM62315     2  0.0451      0.900 0.000 0.988 0.000 0.008 0.004
#> GSM62291     2  0.0290      0.901 0.000 0.992 0.000 0.008 0.000
#> GSM62265     1  0.1444      0.842 0.948 0.000 0.000 0.040 0.012
#> GSM62266     1  0.0703      0.821 0.976 0.000 0.000 0.000 0.024
#> GSM62296     2  0.0290      0.901 0.000 0.992 0.000 0.008 0.000
#> GSM62309     2  0.0290      0.901 0.000 0.992 0.000 0.008 0.000
#> GSM62295     4  0.5799      0.146 0.000 0.112 0.000 0.564 0.324
#> GSM62300     2  0.0290      0.901 0.000 0.992 0.000 0.008 0.000
#> GSM62308     2  0.0290      0.901 0.000 0.992 0.000 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5  0.4054     0.7436 0.000 0.024 0.000 0.180 0.760 0.036
#> GSM62256     5  0.4787     0.6988 0.000 0.020 0.000 0.212 0.692 0.076
#> GSM62259     4  0.5583     0.4663 0.000 0.020 0.000 0.600 0.244 0.136
#> GSM62267     1  0.2864     0.7482 0.860 0.012 0.000 0.000 0.100 0.028
#> GSM62280     6  0.2845     0.8058 0.172 0.004 0.000 0.000 0.004 0.820
#> GSM62284     1  0.5251     0.1136 0.532 0.012 0.404 0.000 0.036 0.016
#> GSM62289     5  0.2540     0.7584 0.000 0.004 0.000 0.104 0.872 0.020
#> GSM62307     4  0.1176     0.8489 0.000 0.024 0.000 0.956 0.000 0.020
#> GSM62316     5  0.4934     0.5727 0.000 0.028 0.000 0.364 0.580 0.028
#> GSM62254     4  0.4358     0.6753 0.000 0.012 0.000 0.744 0.148 0.096
#> GSM62292     4  0.4358     0.6753 0.000 0.012 0.000 0.744 0.148 0.096
#> GSM62253     1  0.1364     0.7279 0.952 0.016 0.000 0.000 0.020 0.012
#> GSM62270     3  0.0000     0.9420 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.3220     0.8453 0.104 0.016 0.844 0.000 0.032 0.004
#> GSM62297     2  0.2255     0.8686 0.000 0.908 0.000 0.024 0.044 0.024
#> GSM62298     2  0.1777     0.8875 0.000 0.928 0.000 0.044 0.004 0.024
#> GSM62299     2  0.1844     0.8871 0.000 0.924 0.000 0.048 0.004 0.024
#> GSM62258     1  0.3692     0.7290 0.808 0.016 0.000 0.000 0.108 0.068
#> GSM62281     5  0.5943     0.6210 0.000 0.080 0.000 0.200 0.612 0.108
#> GSM62294     4  0.0291     0.8569 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM62305     5  0.2395     0.7195 0.020 0.004 0.000 0.044 0.904 0.028
#> GSM62306     5  0.3761     0.7373 0.000 0.008 0.000 0.196 0.764 0.032
#> GSM62310     4  0.0547     0.8574 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM62311     4  0.0547     0.8574 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM62317     6  0.3420     0.5939 0.000 0.240 0.000 0.000 0.012 0.748
#> GSM62318     6  0.2597     0.8054 0.176 0.000 0.000 0.000 0.000 0.824
#> GSM62321     6  0.3229     0.7864 0.120 0.004 0.000 0.000 0.048 0.828
#> GSM62322     3  0.0000     0.9420 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.2113     0.7046 0.048 0.000 0.000 0.032 0.912 0.008
#> GSM62252     5  0.2113     0.7046 0.048 0.000 0.000 0.032 0.912 0.008
#> GSM62255     4  0.0806     0.8558 0.000 0.020 0.000 0.972 0.000 0.008
#> GSM62257     4  0.1088     0.8499 0.000 0.024 0.000 0.960 0.000 0.016
#> GSM62260     1  0.5101     0.5223 0.648 0.008 0.000 0.000 0.128 0.216
#> GSM62261     5  0.4989     0.5769 0.000 0.032 0.000 0.360 0.580 0.028
#> GSM62262     4  0.1036     0.8487 0.000 0.008 0.000 0.964 0.004 0.024
#> GSM62264     1  0.4411     0.5742 0.720 0.008 0.000 0.000 0.076 0.196
#> GSM62268     1  0.3659     0.6031 0.804 0.016 0.148 0.000 0.020 0.012
#> GSM62269     3  0.0000     0.9420 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     1  0.3103     0.7377 0.856 0.020 0.000 0.000 0.060 0.064
#> GSM62272     3  0.0000     0.9420 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2  0.7017     0.2837 0.000 0.464 0.000 0.240 0.180 0.116
#> GSM62274     1  0.5134    -0.0809 0.484 0.012 0.460 0.000 0.036 0.008
#> GSM62275     3  0.0000     0.9420 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     1  0.2912     0.7478 0.856 0.012 0.000 0.000 0.104 0.028
#> GSM62277     3  0.3447     0.8333 0.116 0.012 0.828 0.000 0.036 0.008
#> GSM62279     1  0.1606     0.7451 0.932 0.004 0.000 0.000 0.056 0.008
#> GSM62282     6  0.4454     0.5982 0.308 0.020 0.000 0.000 0.020 0.652
#> GSM62283     1  0.3413     0.7260 0.824 0.012 0.000 0.000 0.112 0.052
#> GSM62286     5  0.2051     0.7554 0.004 0.004 0.000 0.096 0.896 0.000
#> GSM62287     4  0.0260     0.8569 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM62288     5  0.4944     0.5964 0.000 0.032 0.000 0.344 0.596 0.028
#> GSM62290     2  0.1075     0.8915 0.000 0.952 0.000 0.048 0.000 0.000
#> GSM62293     4  0.2402     0.8132 0.000 0.012 0.000 0.896 0.032 0.060
#> GSM62301     2  0.1219     0.8910 0.000 0.948 0.000 0.048 0.000 0.004
#> GSM62302     4  0.0914     0.8586 0.000 0.016 0.000 0.968 0.000 0.016
#> GSM62303     4  0.0458     0.8563 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM62304     4  0.0806     0.8558 0.000 0.020 0.000 0.972 0.000 0.008
#> GSM62312     2  0.2201     0.8777 0.000 0.904 0.000 0.056 0.004 0.036
#> GSM62313     4  0.0458     0.8579 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM62314     4  0.5029    -0.0401 0.000 0.028 0.000 0.564 0.376 0.032
#> GSM62319     2  0.4763     0.6835 0.000 0.728 0.000 0.044 0.148 0.080
#> GSM62320     2  0.1844     0.8871 0.000 0.924 0.000 0.048 0.004 0.024
#> GSM62249     5  0.4302     0.1817 0.368 0.000 0.000 0.004 0.608 0.020
#> GSM62251     1  0.2540     0.7302 0.872 0.004 0.000 0.000 0.104 0.020
#> GSM62263     2  0.4908     0.1809 0.008 0.520 0.000 0.008 0.436 0.028
#> GSM62285     2  0.1219     0.8910 0.000 0.948 0.000 0.048 0.000 0.004
#> GSM62315     2  0.1296     0.8909 0.000 0.948 0.000 0.044 0.004 0.004
#> GSM62291     2  0.1226     0.8917 0.000 0.952 0.000 0.040 0.004 0.004
#> GSM62265     1  0.1668     0.7503 0.928 0.004 0.000 0.000 0.060 0.008
#> GSM62266     1  0.1364     0.7279 0.952 0.016 0.000 0.000 0.020 0.012
#> GSM62296     2  0.1624     0.8893 0.000 0.936 0.000 0.040 0.020 0.004
#> GSM62309     2  0.1666     0.8868 0.000 0.936 0.000 0.036 0.020 0.008
#> GSM62295     4  0.4614     0.6516 0.000 0.012 0.000 0.720 0.148 0.120
#> GSM62300     2  0.1624     0.8893 0.000 0.936 0.000 0.040 0.020 0.004
#> GSM62308     2  0.1624     0.8893 0.000 0.936 0.000 0.040 0.020 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) other(p) genotype/variation(p) k
#> SD:kmeans 74          0.64023    1.000               0.75225 2
#> SD:kmeans 72          0.40247    0.748               0.79276 3
#> SD:kmeans 72          0.00105    0.651               0.05855 4
#> SD:kmeans 41          0.03108    0.201               0.00686 5
#> SD:kmeans 68          0.00547    0.636               0.13500 6

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


SD:skmeans**

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

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

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

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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.994       0.997         0.4760 0.526   0.526
#> 3 3 1.000           0.966       0.978         0.3936 0.788   0.605
#> 4 4 0.831           0.820       0.883         0.0924 0.938   0.819
#> 5 5 0.866           0.814       0.911         0.0707 0.924   0.745
#> 6 6 0.822           0.718       0.852         0.0363 0.963   0.843

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
#> GSM62248     2   0.000      0.996 0.000 1.000
#> GSM62256     2   0.000      0.996 0.000 1.000
#> GSM62259     2   0.000      0.996 0.000 1.000
#> GSM62267     1   0.000      1.000 1.000 0.000
#> GSM62280     1   0.000      1.000 1.000 0.000
#> GSM62284     1   0.000      1.000 1.000 0.000
#> GSM62289     2   0.000      0.996 0.000 1.000
#> GSM62307     2   0.000      0.996 0.000 1.000
#> GSM62316     2   0.000      0.996 0.000 1.000
#> GSM62254     2   0.000      0.996 0.000 1.000
#> GSM62292     2   0.000      0.996 0.000 1.000
#> GSM62253     1   0.000      1.000 1.000 0.000
#> GSM62270     1   0.000      1.000 1.000 0.000
#> GSM62278     1   0.000      1.000 1.000 0.000
#> GSM62297     2   0.000      0.996 0.000 1.000
#> GSM62298     2   0.000      0.996 0.000 1.000
#> GSM62299     2   0.000      0.996 0.000 1.000
#> GSM62258     1   0.000      1.000 1.000 0.000
#> GSM62281     2   0.000      0.996 0.000 1.000
#> GSM62294     2   0.000      0.996 0.000 1.000
#> GSM62305     2   0.000      0.996 0.000 1.000
#> GSM62306     2   0.000      0.996 0.000 1.000
#> GSM62310     2   0.000      0.996 0.000 1.000
#> GSM62311     2   0.000      0.996 0.000 1.000
#> GSM62317     2   0.000      0.996 0.000 1.000
#> GSM62318     1   0.000      1.000 1.000 0.000
#> GSM62321     1   0.000      1.000 1.000 0.000
#> GSM62322     1   0.000      1.000 1.000 0.000
#> GSM62250     2   0.714      0.756 0.196 0.804
#> GSM62252     1   0.000      1.000 1.000 0.000
#> GSM62255     2   0.000      0.996 0.000 1.000
#> GSM62257     2   0.000      0.996 0.000 1.000
#> GSM62260     1   0.000      1.000 1.000 0.000
#> GSM62261     2   0.000      0.996 0.000 1.000
#> GSM62262     2   0.000      0.996 0.000 1.000
#> GSM62264     1   0.000      1.000 1.000 0.000
#> GSM62268     1   0.000      1.000 1.000 0.000
#> GSM62269     1   0.000      1.000 1.000 0.000
#> GSM62271     1   0.000      1.000 1.000 0.000
#> GSM62272     1   0.000      1.000 1.000 0.000
#> GSM62273     2   0.000      0.996 0.000 1.000
#> GSM62274     1   0.000      1.000 1.000 0.000
#> GSM62275     1   0.000      1.000 1.000 0.000
#> GSM62276     1   0.000      1.000 1.000 0.000
#> GSM62277     1   0.000      1.000 1.000 0.000
#> GSM62279     1   0.000      1.000 1.000 0.000
#> GSM62282     1   0.000      1.000 1.000 0.000
#> GSM62283     1   0.000      1.000 1.000 0.000
#> GSM62286     2   0.000      0.996 0.000 1.000
#> GSM62287     2   0.000      0.996 0.000 1.000
#> GSM62288     2   0.000      0.996 0.000 1.000
#> GSM62290     2   0.000      0.996 0.000 1.000
#> GSM62293     2   0.000      0.996 0.000 1.000
#> GSM62301     2   0.000      0.996 0.000 1.000
#> GSM62302     2   0.000      0.996 0.000 1.000
#> GSM62303     2   0.000      0.996 0.000 1.000
#> GSM62304     2   0.000      0.996 0.000 1.000
#> GSM62312     2   0.000      0.996 0.000 1.000
#> GSM62313     2   0.000      0.996 0.000 1.000
#> GSM62314     2   0.000      0.996 0.000 1.000
#> GSM62319     2   0.000      0.996 0.000 1.000
#> GSM62320     2   0.000      0.996 0.000 1.000
#> GSM62249     1   0.000      1.000 1.000 0.000
#> GSM62251     1   0.000      1.000 1.000 0.000
#> GSM62263     2   0.000      0.996 0.000 1.000
#> GSM62285     2   0.000      0.996 0.000 1.000
#> GSM62315     2   0.000      0.996 0.000 1.000
#> GSM62291     2   0.000      0.996 0.000 1.000
#> GSM62265     1   0.000      1.000 1.000 0.000
#> GSM62266     1   0.000      1.000 1.000 0.000
#> GSM62296     2   0.000      0.996 0.000 1.000
#> GSM62309     2   0.000      0.996 0.000 1.000
#> GSM62295     2   0.000      0.996 0.000 1.000
#> GSM62300     2   0.000      0.996 0.000 1.000
#> GSM62308     2   0.000      0.996 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.0892      0.964 0.000 0.980 0.020
#> GSM62256     2  0.3482      0.900 0.000 0.872 0.128
#> GSM62259     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62267     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62280     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62284     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62289     2  0.0237      0.964 0.000 0.996 0.004
#> GSM62307     2  0.1964      0.971 0.000 0.944 0.056
#> GSM62316     2  0.0747      0.965 0.000 0.984 0.016
#> GSM62254     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62292     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62253     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62270     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62278     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62297     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62298     3  0.0237      0.968 0.000 0.004 0.996
#> GSM62299     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62258     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62281     3  0.6126      0.270 0.000 0.400 0.600
#> GSM62294     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62305     2  0.0424      0.964 0.000 0.992 0.008
#> GSM62306     2  0.0237      0.964 0.000 0.996 0.004
#> GSM62310     2  0.1860      0.972 0.000 0.948 0.052
#> GSM62311     2  0.1860      0.972 0.000 0.948 0.052
#> GSM62317     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62318     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62321     1  0.2878      0.893 0.904 0.000 0.096
#> GSM62322     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62250     2  0.0237      0.964 0.000 0.996 0.004
#> GSM62252     2  0.1163      0.948 0.028 0.972 0.000
#> GSM62255     2  0.1860      0.972 0.000 0.948 0.052
#> GSM62257     2  0.1860      0.973 0.000 0.948 0.052
#> GSM62260     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62261     2  0.0892      0.964 0.000 0.980 0.020
#> GSM62262     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62264     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62268     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62269     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62271     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62272     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62273     3  0.1289      0.949 0.000 0.032 0.968
#> GSM62274     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62275     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62276     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62277     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62279     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62282     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62283     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62286     2  0.0000      0.964 0.000 1.000 0.000
#> GSM62287     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62288     2  0.0892      0.964 0.000 0.980 0.020
#> GSM62290     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62293     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62301     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62302     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62303     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62304     2  0.1643      0.975 0.000 0.956 0.044
#> GSM62312     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62313     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62314     2  0.0892      0.964 0.000 0.980 0.020
#> GSM62319     3  0.0747      0.960 0.000 0.016 0.984
#> GSM62320     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62249     1  0.1765      0.957 0.956 0.040 0.004
#> GSM62251     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62263     3  0.1529      0.935 0.000 0.040 0.960
#> GSM62285     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62315     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62291     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62265     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62266     1  0.0000      0.995 1.000 0.000 0.000
#> GSM62296     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62309     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62295     2  0.1529      0.976 0.000 0.960 0.040
#> GSM62300     3  0.0000      0.971 0.000 0.000 1.000
#> GSM62308     3  0.0000      0.971 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4  0.4522      0.732 0.000 0.000 0.320 0.680
#> GSM62256     4  0.1743      0.826 0.000 0.056 0.004 0.940
#> GSM62259     4  0.0524      0.849 0.000 0.004 0.008 0.988
#> GSM62267     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62280     3  0.5000      0.664 0.496 0.000 0.504 0.000
#> GSM62284     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62289     4  0.4877      0.671 0.000 0.000 0.408 0.592
#> GSM62307     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62316     4  0.4283      0.764 0.000 0.004 0.256 0.740
#> GSM62254     4  0.0336      0.851 0.000 0.000 0.008 0.992
#> GSM62292     4  0.0336      0.851 0.000 0.000 0.008 0.992
#> GSM62253     1  0.0817      0.934 0.976 0.000 0.024 0.000
#> GSM62270     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62278     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62297     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62298     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62258     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62281     4  0.4761      0.383 0.000 0.372 0.000 0.628
#> GSM62294     4  0.0188      0.852 0.000 0.000 0.004 0.996
#> GSM62305     4  0.5774      0.589 0.000 0.028 0.464 0.508
#> GSM62306     4  0.4790      0.693 0.000 0.000 0.380 0.620
#> GSM62310     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62311     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62317     2  0.5000      0.218 0.000 0.504 0.496 0.000
#> GSM62318     3  0.4981      0.703 0.464 0.000 0.536 0.000
#> GSM62321     3  0.6538      0.680 0.292 0.108 0.600 0.000
#> GSM62322     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62250     4  0.4977      0.619 0.000 0.000 0.460 0.540
#> GSM62252     4  0.6008      0.563 0.040 0.000 0.464 0.496
#> GSM62255     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62257     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62260     3  0.4855      0.758 0.400 0.000 0.600 0.000
#> GSM62261     4  0.4283      0.764 0.000 0.004 0.256 0.740
#> GSM62262     4  0.0336      0.851 0.000 0.000 0.008 0.992
#> GSM62264     3  0.4866      0.757 0.404 0.000 0.596 0.000
#> GSM62268     1  0.0817      0.934 0.976 0.000 0.024 0.000
#> GSM62269     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62271     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62272     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62273     2  0.4697      0.569 0.000 0.696 0.008 0.296
#> GSM62274     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62275     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62276     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62277     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62279     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM62282     1  0.4277      0.137 0.720 0.000 0.280 0.000
#> GSM62283     1  0.0921      0.930 0.972 0.000 0.028 0.000
#> GSM62286     4  0.4877      0.671 0.000 0.000 0.408 0.592
#> GSM62287     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62288     4  0.4608      0.739 0.000 0.004 0.304 0.692
#> GSM62290     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62293     4  0.0336      0.851 0.000 0.000 0.008 0.992
#> GSM62301     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62302     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62303     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62304     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62312     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62313     4  0.0000      0.853 0.000 0.000 0.000 1.000
#> GSM62314     4  0.3791      0.788 0.000 0.004 0.200 0.796
#> GSM62319     2  0.0672      0.919 0.000 0.984 0.008 0.008
#> GSM62320     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62249     3  0.4679      0.387 0.352 0.000 0.648 0.000
#> GSM62251     1  0.2704      0.751 0.876 0.000 0.124 0.000
#> GSM62263     2  0.4304      0.629 0.000 0.716 0.284 0.000
#> GSM62285     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62265     1  0.0921      0.930 0.972 0.000 0.028 0.000
#> GSM62266     1  0.0921      0.930 0.972 0.000 0.028 0.000
#> GSM62296     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62309     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62295     4  0.0524      0.849 0.000 0.004 0.008 0.988
#> GSM62300     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62308     2  0.0000      0.931 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
#> GSM62248     5  0.4510     0.3502 0.000 0.008 0.000 0.432 0.560
#> GSM62256     4  0.1774     0.8455 0.000 0.052 0.000 0.932 0.016
#> GSM62259     4  0.1956     0.8504 0.000 0.000 0.008 0.916 0.076
#> GSM62267     1  0.0162     0.9446 0.996 0.000 0.004 0.000 0.000
#> GSM62280     3  0.2074     0.8572 0.104 0.000 0.896 0.000 0.000
#> GSM62284     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62289     5  0.2074     0.7539 0.000 0.000 0.000 0.104 0.896
#> GSM62307     4  0.0579     0.8762 0.000 0.008 0.000 0.984 0.008
#> GSM62316     4  0.4298     0.2919 0.000 0.008 0.000 0.640 0.352
#> GSM62254     4  0.2017     0.8480 0.000 0.000 0.008 0.912 0.080
#> GSM62292     4  0.2017     0.8480 0.000 0.000 0.008 0.912 0.080
#> GSM62253     1  0.1956     0.9048 0.916 0.000 0.076 0.000 0.008
#> GSM62270     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62278     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62297     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62298     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62299     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62258     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62281     4  0.3522     0.6650 0.000 0.212 0.004 0.780 0.004
#> GSM62294     4  0.1041     0.8680 0.000 0.000 0.004 0.964 0.032
#> GSM62305     5  0.1282     0.7092 0.000 0.004 0.000 0.044 0.952
#> GSM62306     5  0.3003     0.7241 0.000 0.000 0.000 0.188 0.812
#> GSM62310     4  0.0579     0.8762 0.000 0.008 0.000 0.984 0.008
#> GSM62311     4  0.0579     0.8762 0.000 0.008 0.000 0.984 0.008
#> GSM62317     3  0.2127     0.8394 0.000 0.108 0.892 0.000 0.000
#> GSM62318     3  0.0510     0.9331 0.016 0.000 0.984 0.000 0.000
#> GSM62321     3  0.0451     0.9327 0.008 0.004 0.988 0.000 0.000
#> GSM62322     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62250     5  0.2020     0.7528 0.000 0.000 0.000 0.100 0.900
#> GSM62252     5  0.2116     0.7393 0.008 0.000 0.004 0.076 0.912
#> GSM62255     4  0.0579     0.8762 0.000 0.008 0.000 0.984 0.008
#> GSM62257     4  0.0579     0.8762 0.000 0.008 0.000 0.984 0.008
#> GSM62260     3  0.0807     0.9325 0.012 0.000 0.976 0.000 0.012
#> GSM62261     4  0.4403     0.1819 0.000 0.008 0.000 0.608 0.384
#> GSM62262     4  0.2017     0.8480 0.000 0.000 0.008 0.912 0.080
#> GSM62264     3  0.1211     0.9240 0.016 0.000 0.960 0.000 0.024
#> GSM62268     1  0.1956     0.9048 0.916 0.000 0.076 0.000 0.008
#> GSM62269     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62271     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62272     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62273     2  0.5981     0.0707 0.000 0.476 0.008 0.432 0.084
#> GSM62274     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62275     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62276     1  0.0162     0.9446 0.996 0.000 0.004 0.000 0.000
#> GSM62277     1  0.0000     0.9459 1.000 0.000 0.000 0.000 0.000
#> GSM62279     1  0.0162     0.9446 0.996 0.000 0.004 0.000 0.000
#> GSM62282     1  0.4101     0.3601 0.628 0.000 0.372 0.000 0.000
#> GSM62283     1  0.2046     0.9083 0.916 0.000 0.068 0.000 0.016
#> GSM62286     5  0.2020     0.7539 0.000 0.000 0.000 0.100 0.900
#> GSM62287     4  0.0290     0.8761 0.000 0.000 0.000 0.992 0.008
#> GSM62288     5  0.4552     0.2473 0.000 0.008 0.000 0.468 0.524
#> GSM62290     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62293     4  0.2017     0.8480 0.000 0.000 0.008 0.912 0.080
#> GSM62301     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62302     4  0.0324     0.8764 0.000 0.000 0.004 0.992 0.004
#> GSM62303     4  0.0324     0.8764 0.000 0.000 0.004 0.992 0.004
#> GSM62304     4  0.0579     0.8762 0.000 0.008 0.000 0.984 0.008
#> GSM62312     2  0.0510     0.9195 0.000 0.984 0.000 0.016 0.000
#> GSM62313     4  0.0290     0.8761 0.000 0.000 0.000 0.992 0.008
#> GSM62314     4  0.3980     0.4738 0.000 0.008 0.000 0.708 0.284
#> GSM62319     2  0.2289     0.8518 0.000 0.904 0.004 0.012 0.080
#> GSM62320     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62249     5  0.6667    -0.0536 0.244 0.000 0.328 0.000 0.428
#> GSM62251     1  0.3821     0.7957 0.800 0.000 0.148 0.000 0.052
#> GSM62263     2  0.4762     0.5766 0.000 0.700 0.236 0.000 0.064
#> GSM62285     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62265     1  0.2351     0.8927 0.896 0.000 0.088 0.000 0.016
#> GSM62266     1  0.2136     0.8980 0.904 0.000 0.088 0.000 0.008
#> GSM62296     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62309     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62295     4  0.2302     0.8419 0.000 0.008 0.008 0.904 0.080
#> GSM62300     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000
#> GSM62308     2  0.0000     0.9337 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5  0.5324    0.05426 0.104 0.000 0.000 0.428 0.468 0.000
#> GSM62256     4  0.3679    0.73019 0.124 0.024 0.000 0.812 0.036 0.004
#> GSM62259     4  0.3511    0.75702 0.216 0.000 0.000 0.760 0.024 0.000
#> GSM62267     3  0.0146    0.90188 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62280     6  0.1444    0.75299 0.000 0.000 0.072 0.000 0.000 0.928
#> GSM62284     3  0.0363    0.89719 0.012 0.000 0.988 0.000 0.000 0.000
#> GSM62289     5  0.0993    0.79430 0.012 0.000 0.000 0.024 0.964 0.000
#> GSM62307     4  0.1967    0.77747 0.084 0.000 0.000 0.904 0.012 0.000
#> GSM62316     4  0.4914    0.42894 0.104 0.000 0.000 0.628 0.268 0.000
#> GSM62254     4  0.3301    0.73143 0.188 0.000 0.000 0.788 0.024 0.000
#> GSM62292     4  0.3301    0.73143 0.188 0.000 0.000 0.788 0.024 0.000
#> GSM62253     3  0.3394    0.65840 0.144 0.000 0.804 0.000 0.000 0.052
#> GSM62270     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62297     2  0.0458    0.89647 0.016 0.984 0.000 0.000 0.000 0.000
#> GSM62298     2  0.0363    0.89799 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM62299     2  0.0363    0.89799 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM62258     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62281     4  0.4560    0.61194 0.088 0.212 0.000 0.696 0.000 0.004
#> GSM62294     4  0.1895    0.78965 0.072 0.000 0.000 0.912 0.016 0.000
#> GSM62305     5  0.3010    0.74653 0.148 0.000 0.000 0.020 0.828 0.004
#> GSM62306     5  0.4634    0.67517 0.164 0.000 0.000 0.144 0.692 0.000
#> GSM62310     4  0.0405    0.80335 0.008 0.000 0.000 0.988 0.004 0.000
#> GSM62311     4  0.0291    0.80371 0.004 0.000 0.000 0.992 0.004 0.000
#> GSM62317     6  0.1327    0.76601 0.000 0.064 0.000 0.000 0.000 0.936
#> GSM62318     6  0.0146    0.80239 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM62321     6  0.0000    0.80346 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.0777    0.79462 0.004 0.000 0.000 0.024 0.972 0.000
#> GSM62252     5  0.1152    0.76323 0.044 0.000 0.000 0.004 0.952 0.000
#> GSM62255     4  0.1010    0.79826 0.036 0.000 0.000 0.960 0.004 0.000
#> GSM62257     4  0.2006    0.77717 0.080 0.000 0.000 0.904 0.016 0.000
#> GSM62260     6  0.3930    0.11887 0.420 0.000 0.004 0.000 0.000 0.576
#> GSM62261     4  0.5025    0.38370 0.108 0.000 0.000 0.608 0.284 0.000
#> GSM62262     4  0.3062    0.74707 0.160 0.000 0.000 0.816 0.024 0.000
#> GSM62264     1  0.4152   -0.02767 0.548 0.000 0.012 0.000 0.000 0.440
#> GSM62268     3  0.3254    0.67976 0.136 0.000 0.816 0.000 0.000 0.048
#> GSM62269     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     3  0.0146    0.90108 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62272     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2  0.6565    0.02241 0.216 0.404 0.000 0.352 0.024 0.004
#> GSM62274     3  0.0146    0.90188 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62275     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62277     3  0.0000    0.90348 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62279     3  0.0632    0.88786 0.024 0.000 0.976 0.000 0.000 0.000
#> GSM62282     3  0.3737    0.25292 0.000 0.000 0.608 0.000 0.000 0.392
#> GSM62283     1  0.4653    0.63097 0.588 0.000 0.360 0.000 0.000 0.052
#> GSM62286     5  0.0858    0.79364 0.004 0.000 0.000 0.028 0.968 0.000
#> GSM62287     4  0.0547    0.80405 0.020 0.000 0.000 0.980 0.000 0.000
#> GSM62288     4  0.5368   -0.00276 0.112 0.000 0.000 0.488 0.400 0.000
#> GSM62290     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62293     4  0.3236    0.73598 0.180 0.000 0.000 0.796 0.024 0.000
#> GSM62301     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62302     4  0.0790    0.80352 0.032 0.000 0.000 0.968 0.000 0.000
#> GSM62303     4  0.0865    0.80304 0.036 0.000 0.000 0.964 0.000 0.000
#> GSM62304     4  0.1333    0.79319 0.048 0.000 0.000 0.944 0.008 0.000
#> GSM62312     2  0.3565    0.72675 0.096 0.808 0.000 0.092 0.004 0.000
#> GSM62313     4  0.0260    0.80433 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM62314     4  0.4704    0.49515 0.100 0.000 0.000 0.664 0.236 0.000
#> GSM62319     2  0.3452    0.72355 0.176 0.792 0.000 0.008 0.024 0.000
#> GSM62320     2  0.0363    0.89799 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM62249     1  0.5771    0.42221 0.628 0.000 0.060 0.000 0.188 0.124
#> GSM62251     1  0.5679    0.65860 0.588 0.000 0.284 0.000 0.048 0.080
#> GSM62263     2  0.5257    0.37850 0.292 0.596 0.000 0.000 0.008 0.104
#> GSM62285     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62315     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62291     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62265     1  0.4899    0.53652 0.532 0.000 0.404 0.000 0.000 0.064
#> GSM62266     3  0.4604    0.18015 0.300 0.000 0.636 0.000 0.000 0.064
#> GSM62296     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62309     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62295     4  0.3394    0.72399 0.200 0.000 0.000 0.776 0.024 0.000
#> GSM62300     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62308     2  0.0000    0.90122 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) other(p) genotype/variation(p) k
#> SD:skmeans 75         0.823665    1.000                0.8057 2
#> SD:skmeans 74         0.001421    0.752                0.0372 3
#> SD:skmeans 71         0.001238    0.907                0.1004 4
#> SD:skmeans 67         0.003010    0.933                0.2783 5
#> SD:skmeans 63         0.000344    0.471                0.3397 6

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


SD:pam*

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 1.000           0.946       0.979         0.4536 0.559   0.559
#> 3 3 0.728           0.886       0.926         0.2584 0.803   0.669
#> 4 4 0.967           0.913       0.963         0.2582 0.764   0.505
#> 5 5 0.916           0.858       0.935         0.0409 0.969   0.889
#> 6 6 0.940           0.847       0.941         0.0305 0.952   0.818

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 4 5

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM62248     2   0.000      0.969 0.000 1.000
#> GSM62256     2   0.000      0.969 0.000 1.000
#> GSM62259     2   0.000      0.969 0.000 1.000
#> GSM62267     1   0.000      0.996 1.000 0.000
#> GSM62280     1   0.000      0.996 1.000 0.000
#> GSM62284     1   0.000      0.996 1.000 0.000
#> GSM62289     2   0.000      0.969 0.000 1.000
#> GSM62307     2   0.000      0.969 0.000 1.000
#> GSM62316     2   0.000      0.969 0.000 1.000
#> GSM62254     2   0.000      0.969 0.000 1.000
#> GSM62292     2   0.000      0.969 0.000 1.000
#> GSM62253     1   0.000      0.996 1.000 0.000
#> GSM62270     1   0.000      0.996 1.000 0.000
#> GSM62278     1   0.000      0.996 1.000 0.000
#> GSM62297     2   0.000      0.969 0.000 1.000
#> GSM62298     2   0.000      0.969 0.000 1.000
#> GSM62299     2   0.000      0.969 0.000 1.000
#> GSM62258     1   0.000      0.996 1.000 0.000
#> GSM62281     2   0.000      0.969 0.000 1.000
#> GSM62294     2   0.000      0.969 0.000 1.000
#> GSM62305     2   0.373      0.904 0.072 0.928
#> GSM62306     2   0.000      0.969 0.000 1.000
#> GSM62310     2   0.000      0.969 0.000 1.000
#> GSM62311     2   0.000      0.969 0.000 1.000
#> GSM62317     2   0.000      0.969 0.000 1.000
#> GSM62318     1   0.000      0.996 1.000 0.000
#> GSM62321     2   0.961      0.389 0.384 0.616
#> GSM62322     1   0.000      0.996 1.000 0.000
#> GSM62250     2   0.000      0.969 0.000 1.000
#> GSM62252     2   0.373      0.904 0.072 0.928
#> GSM62255     2   0.000      0.969 0.000 1.000
#> GSM62257     2   0.000      0.969 0.000 1.000
#> GSM62260     2   0.994      0.204 0.456 0.544
#> GSM62261     2   0.000      0.969 0.000 1.000
#> GSM62262     2   0.000      0.969 0.000 1.000
#> GSM62264     1   0.416      0.903 0.916 0.084
#> GSM62268     1   0.000      0.996 1.000 0.000
#> GSM62269     1   0.000      0.996 1.000 0.000
#> GSM62271     1   0.000      0.996 1.000 0.000
#> GSM62272     1   0.000      0.996 1.000 0.000
#> GSM62273     2   0.000      0.969 0.000 1.000
#> GSM62274     1   0.000      0.996 1.000 0.000
#> GSM62275     1   0.000      0.996 1.000 0.000
#> GSM62276     1   0.000      0.996 1.000 0.000
#> GSM62277     1   0.000      0.996 1.000 0.000
#> GSM62279     1   0.000      0.996 1.000 0.000
#> GSM62282     1   0.000      0.996 1.000 0.000
#> GSM62283     1   0.000      0.996 1.000 0.000
#> GSM62286     2   0.000      0.969 0.000 1.000
#> GSM62287     2   0.000      0.969 0.000 1.000
#> GSM62288     2   0.000      0.969 0.000 1.000
#> GSM62290     2   0.000      0.969 0.000 1.000
#> GSM62293     2   0.000      0.969 0.000 1.000
#> GSM62301     2   0.000      0.969 0.000 1.000
#> GSM62302     2   0.000      0.969 0.000 1.000
#> GSM62303     2   0.000      0.969 0.000 1.000
#> GSM62304     2   0.000      0.969 0.000 1.000
#> GSM62312     2   0.000      0.969 0.000 1.000
#> GSM62313     2   0.000      0.969 0.000 1.000
#> GSM62314     2   0.000      0.969 0.000 1.000
#> GSM62319     2   0.373      0.904 0.072 0.928
#> GSM62320     2   0.000      0.969 0.000 1.000
#> GSM62249     2   0.994      0.204 0.456 0.544
#> GSM62251     1   0.000      0.996 1.000 0.000
#> GSM62263     2   0.000      0.969 0.000 1.000
#> GSM62285     2   0.000      0.969 0.000 1.000
#> GSM62315     2   0.000      0.969 0.000 1.000
#> GSM62291     2   0.000      0.969 0.000 1.000
#> GSM62265     1   0.000      0.996 1.000 0.000
#> GSM62266     1   0.000      0.996 1.000 0.000
#> GSM62296     2   0.000      0.969 0.000 1.000
#> GSM62309     2   0.000      0.969 0.000 1.000
#> GSM62295     2   0.000      0.969 0.000 1.000
#> GSM62300     2   0.000      0.969 0.000 1.000
#> GSM62308     2   0.000      0.969 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
#> GSM62248     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62256     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62259     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62267     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62280     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62284     3  0.5591      0.507 0.304 0.000 0.696
#> GSM62289     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62307     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62316     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62254     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62292     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62253     1  0.3941      0.861 0.844 0.000 0.156
#> GSM62270     3  0.0000      0.926 0.000 0.000 1.000
#> GSM62278     3  0.0424      0.922 0.008 0.000 0.992
#> GSM62297     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62298     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62299     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62258     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62281     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62294     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62305     1  0.5810      0.313 0.664 0.336 0.000
#> GSM62306     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62310     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62317     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62318     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62321     1  0.0000      0.788 1.000 0.000 0.000
#> GSM62322     3  0.0000      0.926 0.000 0.000 1.000
#> GSM62250     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62252     1  0.5254      0.571 0.736 0.264 0.000
#> GSM62255     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62260     1  0.2537      0.845 0.920 0.000 0.080
#> GSM62261     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62262     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62264     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62268     1  0.4796      0.790 0.780 0.000 0.220
#> GSM62269     3  0.0000      0.926 0.000 0.000 1.000
#> GSM62271     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62272     3  0.0000      0.926 0.000 0.000 1.000
#> GSM62273     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62274     3  0.4291      0.743 0.180 0.000 0.820
#> GSM62275     3  0.0000      0.926 0.000 0.000 1.000
#> GSM62276     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62277     3  0.0000      0.926 0.000 0.000 1.000
#> GSM62279     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62282     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62283     1  0.1163      0.812 0.972 0.000 0.028
#> GSM62286     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62287     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62288     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62290     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62293     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62301     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62302     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62312     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62313     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62314     2  0.0000      0.950 0.000 1.000 0.000
#> GSM62319     1  0.3619      0.623 0.864 0.136 0.000
#> GSM62320     2  0.3340      0.908 0.120 0.880 0.000
#> GSM62249     1  0.0747      0.803 0.984 0.000 0.016
#> GSM62251     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62263     1  0.0592      0.779 0.988 0.012 0.000
#> GSM62285     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62315     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62291     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62265     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62266     1  0.3686      0.874 0.860 0.000 0.140
#> GSM62296     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62309     2  0.4121      0.876 0.168 0.832 0.000
#> GSM62295     2  0.0592      0.947 0.012 0.988 0.000
#> GSM62300     2  0.3686      0.900 0.140 0.860 0.000
#> GSM62308     2  0.3686      0.900 0.140 0.860 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62256     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62259     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62267     1  0.0817      0.961 0.976 0.000 0.024 0.000
#> GSM62280     1  0.0376      0.950 0.992 0.004 0.004 0.000
#> GSM62284     1  0.4843      0.331 0.604 0.000 0.396 0.000
#> GSM62289     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62307     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62316     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62254     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62292     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62253     1  0.1022      0.956 0.968 0.000 0.032 0.000
#> GSM62270     3  0.0188      0.936 0.004 0.000 0.996 0.000
#> GSM62278     3  0.2408      0.852 0.104 0.000 0.896 0.000
#> GSM62297     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62298     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62299     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62258     1  0.0817      0.961 0.976 0.000 0.024 0.000
#> GSM62281     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62294     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62305     2  0.0779      0.915 0.016 0.980 0.000 0.004
#> GSM62306     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62310     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62311     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62317     2  0.1004      0.907 0.024 0.972 0.004 0.000
#> GSM62318     1  0.0376      0.950 0.992 0.004 0.004 0.000
#> GSM62321     2  0.3791      0.710 0.200 0.796 0.004 0.000
#> GSM62322     3  0.0188      0.936 0.004 0.000 0.996 0.000
#> GSM62250     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62252     4  0.5784      0.220 0.412 0.032 0.000 0.556
#> GSM62255     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62257     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62260     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM62261     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62262     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62264     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> GSM62268     1  0.1211      0.950 0.960 0.000 0.040 0.000
#> GSM62269     3  0.0188      0.936 0.004 0.000 0.996 0.000
#> GSM62271     1  0.0817      0.961 0.976 0.000 0.024 0.000
#> GSM62272     3  0.0188      0.936 0.004 0.000 0.996 0.000
#> GSM62273     2  0.0336      0.926 0.000 0.992 0.000 0.008
#> GSM62274     3  0.4454      0.524 0.308 0.000 0.692 0.000
#> GSM62275     3  0.0188      0.936 0.004 0.000 0.996 0.000
#> GSM62276     1  0.0817      0.961 0.976 0.000 0.024 0.000
#> GSM62277     3  0.0188      0.936 0.004 0.000 0.996 0.000
#> GSM62279     1  0.0817      0.961 0.976 0.000 0.024 0.000
#> GSM62282     1  0.0376      0.950 0.992 0.004 0.004 0.000
#> GSM62283     1  0.0921      0.943 0.972 0.028 0.000 0.000
#> GSM62286     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62287     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62288     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62290     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62293     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62301     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62302     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62303     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62304     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62312     4  0.0188      0.978 0.000 0.004 0.000 0.996
#> GSM62313     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62314     4  0.0000      0.982 0.000 0.000 0.000 1.000
#> GSM62319     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62320     2  0.4948      0.247 0.000 0.560 0.000 0.440
#> GSM62249     1  0.0921      0.943 0.972 0.028 0.000 0.000
#> GSM62251     1  0.0817      0.961 0.976 0.000 0.024 0.000
#> GSM62263     2  0.0188      0.925 0.004 0.996 0.000 0.000
#> GSM62285     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62315     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62291     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62265     1  0.0817      0.961 0.976 0.000 0.024 0.000
#> GSM62266     1  0.0817      0.961 0.976 0.000 0.024 0.000
#> GSM62296     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62309     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62295     2  0.4679      0.480 0.000 0.648 0.000 0.352
#> GSM62300     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62308     2  0.0188      0.929 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
#> GSM62248     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62256     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62259     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62267     1  0.0000     0.8155 1.000 0.000 0.000 0.000 0.000
#> GSM62280     5  0.3210     0.7775 0.212 0.000 0.000 0.000 0.788
#> GSM62284     1  0.6603     0.1715 0.400 0.000 0.388 0.000 0.212
#> GSM62289     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62307     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62316     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62254     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62292     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62253     1  0.3877     0.7921 0.764 0.000 0.024 0.000 0.212
#> GSM62270     3  0.0000     0.9393 0.000 0.000 1.000 0.000 0.000
#> GSM62278     3  0.0000     0.9393 0.000 0.000 1.000 0.000 0.000
#> GSM62297     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62298     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62299     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62258     1  0.0000     0.8155 1.000 0.000 0.000 0.000 0.000
#> GSM62281     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62294     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62305     2  0.2753     0.7477 0.136 0.856 0.000 0.008 0.000
#> GSM62306     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62310     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62311     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62317     5  0.3730     0.6089 0.000 0.288 0.000 0.000 0.712
#> GSM62318     5  0.0000     0.6904 0.000 0.000 0.000 0.000 1.000
#> GSM62321     5  0.4123     0.7799 0.104 0.108 0.000 0.000 0.788
#> GSM62322     3  0.0000     0.9393 0.000 0.000 1.000 0.000 0.000
#> GSM62250     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62252     4  0.4451     0.0734 0.492 0.004 0.000 0.504 0.000
#> GSM62255     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62257     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62260     1  0.2230     0.7137 0.884 0.000 0.000 0.000 0.116
#> GSM62261     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62262     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62264     1  0.3305     0.8001 0.776 0.000 0.000 0.000 0.224
#> GSM62268     1  0.4818     0.7476 0.708 0.000 0.080 0.000 0.212
#> GSM62269     3  0.0000     0.9393 0.000 0.000 1.000 0.000 0.000
#> GSM62271     1  0.0000     0.8155 1.000 0.000 0.000 0.000 0.000
#> GSM62272     3  0.0000     0.9393 0.000 0.000 1.000 0.000 0.000
#> GSM62273     2  0.0963     0.8710 0.000 0.964 0.000 0.036 0.000
#> GSM62274     3  0.5607     0.4915 0.228 0.000 0.632 0.000 0.140
#> GSM62275     3  0.0000     0.9393 0.000 0.000 1.000 0.000 0.000
#> GSM62276     1  0.0000     0.8155 1.000 0.000 0.000 0.000 0.000
#> GSM62277     3  0.0000     0.9393 0.000 0.000 1.000 0.000 0.000
#> GSM62279     1  0.2074     0.8175 0.896 0.000 0.000 0.000 0.104
#> GSM62282     5  0.3366     0.7679 0.232 0.000 0.000 0.000 0.768
#> GSM62283     1  0.0000     0.8155 1.000 0.000 0.000 0.000 0.000
#> GSM62286     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62287     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62288     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62290     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62293     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62301     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62302     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62303     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62304     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62312     4  0.0880     0.9438 0.000 0.032 0.000 0.968 0.000
#> GSM62313     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62314     4  0.0000     0.9793 0.000 0.000 0.000 1.000 0.000
#> GSM62319     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62320     2  0.4256     0.2493 0.000 0.564 0.000 0.436 0.000
#> GSM62249     1  0.2773     0.6741 0.836 0.164 0.000 0.000 0.000
#> GSM62251     1  0.3210     0.8026 0.788 0.000 0.000 0.000 0.212
#> GSM62263     2  0.0290     0.9035 0.008 0.992 0.000 0.000 0.000
#> GSM62285     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62265     1  0.2127     0.8179 0.892 0.000 0.000 0.000 0.108
#> GSM62266     1  0.3210     0.8026 0.788 0.000 0.000 0.000 0.212
#> GSM62296     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62309     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62295     2  0.4030     0.3797 0.000 0.648 0.000 0.352 0.000
#> GSM62300     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000
#> GSM62308     2  0.0000     0.9105 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62256     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62259     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62267     5  0.0260     0.7418 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM62280     6  0.0000     0.8750 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62284     1  0.0000     0.7735 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62289     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62307     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62316     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62254     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62292     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62253     1  0.0000     0.7735 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62270     3  0.0000     0.9593 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.2260     0.8458 0.140 0.000 0.860 0.000 0.000 0.000
#> GSM62297     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62298     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62299     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62258     5  0.0000     0.7465 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM62281     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62294     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62305     5  0.3782     0.3838 0.000 0.412 0.000 0.000 0.588 0.000
#> GSM62306     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62310     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62311     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     6  0.0000     0.8750 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62318     6  0.0000     0.8750 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62321     6  0.0000     0.8750 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000     0.9593 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     4  0.0547     0.9780 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM62252     5  0.0547     0.7280 0.000 0.000 0.000 0.020 0.980 0.000
#> GSM62255     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62257     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62260     5  0.3659     0.3860 0.000 0.000 0.000 0.000 0.636 0.364
#> GSM62261     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62262     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62264     1  0.3175     0.5716 0.744 0.000 0.000 0.000 0.256 0.000
#> GSM62268     1  0.0000     0.7735 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62269     3  0.0000     0.9593 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     5  0.0000     0.7465 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM62272     3  0.0000     0.9593 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2  0.1007     0.8727 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM62274     1  0.2260     0.7100 0.860 0.000 0.000 0.000 0.140 0.000
#> GSM62275     3  0.0000     0.9593 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     5  0.0000     0.7465 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM62277     3  0.1663     0.9060 0.088 0.000 0.912 0.000 0.000 0.000
#> GSM62279     1  0.3789     0.3880 0.584 0.000 0.000 0.000 0.416 0.000
#> GSM62282     6  0.3838     0.3001 0.000 0.000 0.000 0.000 0.448 0.552
#> GSM62283     5  0.0000     0.7465 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM62286     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62287     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62288     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62290     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62293     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62301     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62302     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62303     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62304     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62312     4  0.0937     0.9520 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM62313     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62314     4  0.0000     0.9975 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62319     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62320     2  0.3817     0.2613 0.000 0.568 0.000 0.432 0.000 0.000
#> GSM62249     5  0.3659     0.4656 0.000 0.364 0.000 0.000 0.636 0.000
#> GSM62251     1  0.3854     0.0973 0.536 0.000 0.000 0.000 0.464 0.000
#> GSM62263     2  0.0363     0.9107 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM62285     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62291     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62265     5  0.3672     0.2677 0.368 0.000 0.000 0.000 0.632 0.000
#> GSM62266     1  0.0000     0.7735 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62296     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62309     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62295     2  0.3620     0.4380 0.000 0.648 0.000 0.352 0.000 0.000
#> GSM62300     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62308     2  0.0000     0.9213 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) other(p) genotype/variation(p) k
#> SD:pam 72         7.37e-01    1.000                 0.794 2
#> SD:pam 74         2.87e-01    0.924                 0.672 3
#> SD:pam 71         5.38e-04    0.461                 0.070 4
#> SD:pam 70         2.27e-04    0.580                 0.123 5
#> SD:pam 66         5.16e-05    0.358                 0.206 6

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


SD:mclust**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 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-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.973       0.987         0.4738 0.526   0.526
#> 3 3 0.597           0.733       0.830         0.1916 0.934   0.878
#> 4 4 0.604           0.826       0.767         0.2098 0.660   0.384
#> 5 5 0.628           0.717       0.765         0.0879 0.908   0.675
#> 6 6 0.693           0.781       0.855         0.0652 0.991   0.955

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
#> GSM62248     2  0.0000      0.989 0.000 1.000
#> GSM62256     2  0.1633      0.970 0.024 0.976
#> GSM62259     2  0.0000      0.989 0.000 1.000
#> GSM62267     1  0.0000      0.983 1.000 0.000
#> GSM62280     1  0.0000      0.983 1.000 0.000
#> GSM62284     1  0.0000      0.983 1.000 0.000
#> GSM62289     2  0.2948      0.949 0.052 0.948
#> GSM62307     2  0.0000      0.989 0.000 1.000
#> GSM62316     2  0.0000      0.989 0.000 1.000
#> GSM62254     2  0.0000      0.989 0.000 1.000
#> GSM62292     2  0.0000      0.989 0.000 1.000
#> GSM62253     1  0.0000      0.983 1.000 0.000
#> GSM62270     1  0.0000      0.983 1.000 0.000
#> GSM62278     1  0.0000      0.983 1.000 0.000
#> GSM62297     2  0.0000      0.989 0.000 1.000
#> GSM62298     2  0.0000      0.989 0.000 1.000
#> GSM62299     2  0.0000      0.989 0.000 1.000
#> GSM62258     1  0.0000      0.983 1.000 0.000
#> GSM62281     2  0.0376      0.986 0.004 0.996
#> GSM62294     2  0.0000      0.989 0.000 1.000
#> GSM62305     2  0.2948      0.949 0.052 0.948
#> GSM62306     2  0.0000      0.989 0.000 1.000
#> GSM62310     2  0.0000      0.989 0.000 1.000
#> GSM62311     2  0.0000      0.989 0.000 1.000
#> GSM62317     1  0.6531      0.794 0.832 0.168
#> GSM62318     1  0.0000      0.983 1.000 0.000
#> GSM62321     1  0.0000      0.983 1.000 0.000
#> GSM62322     1  0.0000      0.983 1.000 0.000
#> GSM62250     2  0.2948      0.949 0.052 0.948
#> GSM62252     2  0.2948      0.949 0.052 0.948
#> GSM62255     2  0.0000      0.989 0.000 1.000
#> GSM62257     2  0.0000      0.989 0.000 1.000
#> GSM62260     1  0.0000      0.983 1.000 0.000
#> GSM62261     2  0.0000      0.989 0.000 1.000
#> GSM62262     2  0.0000      0.989 0.000 1.000
#> GSM62264     1  0.0000      0.983 1.000 0.000
#> GSM62268     1  0.0000      0.983 1.000 0.000
#> GSM62269     1  0.0000      0.983 1.000 0.000
#> GSM62271     1  0.0000      0.983 1.000 0.000
#> GSM62272     1  0.0000      0.983 1.000 0.000
#> GSM62273     2  0.0000      0.989 0.000 1.000
#> GSM62274     1  0.0000      0.983 1.000 0.000
#> GSM62275     1  0.0000      0.983 1.000 0.000
#> GSM62276     1  0.0000      0.983 1.000 0.000
#> GSM62277     1  0.0000      0.983 1.000 0.000
#> GSM62279     1  0.0000      0.983 1.000 0.000
#> GSM62282     1  0.0000      0.983 1.000 0.000
#> GSM62283     1  0.0000      0.983 1.000 0.000
#> GSM62286     2  0.2948      0.949 0.052 0.948
#> GSM62287     2  0.0000      0.989 0.000 1.000
#> GSM62288     2  0.0000      0.989 0.000 1.000
#> GSM62290     2  0.0000      0.989 0.000 1.000
#> GSM62293     2  0.0000      0.989 0.000 1.000
#> GSM62301     2  0.0000      0.989 0.000 1.000
#> GSM62302     2  0.0000      0.989 0.000 1.000
#> GSM62303     2  0.0000      0.989 0.000 1.000
#> GSM62304     2  0.0000      0.989 0.000 1.000
#> GSM62312     2  0.0000      0.989 0.000 1.000
#> GSM62313     2  0.0000      0.989 0.000 1.000
#> GSM62314     2  0.0000      0.989 0.000 1.000
#> GSM62319     2  0.2948      0.949 0.052 0.948
#> GSM62320     2  0.0000      0.989 0.000 1.000
#> GSM62249     1  0.8713      0.589 0.708 0.292
#> GSM62251     1  0.0000      0.983 1.000 0.000
#> GSM62263     2  0.6531      0.809 0.168 0.832
#> GSM62285     2  0.0000      0.989 0.000 1.000
#> GSM62315     2  0.0000      0.989 0.000 1.000
#> GSM62291     2  0.0000      0.989 0.000 1.000
#> GSM62265     1  0.0000      0.983 1.000 0.000
#> GSM62266     1  0.0000      0.983 1.000 0.000
#> GSM62296     2  0.0000      0.989 0.000 1.000
#> GSM62309     2  0.0000      0.989 0.000 1.000
#> GSM62295     2  0.0000      0.989 0.000 1.000
#> GSM62300     2  0.0000      0.989 0.000 1.000
#> GSM62308     2  0.0000      0.989 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.5291     0.8552 0.000 0.732 0.268
#> GSM62256     2  0.6033     0.8409 0.004 0.660 0.336
#> GSM62259     2  0.4974     0.8564 0.000 0.764 0.236
#> GSM62267     1  0.0000     0.7527 1.000 0.000 0.000
#> GSM62280     1  0.4399     0.4599 0.812 0.000 0.188
#> GSM62284     1  0.1289     0.7322 0.968 0.000 0.032
#> GSM62289     2  0.7433     0.8298 0.072 0.660 0.268
#> GSM62307     2  0.2165     0.8200 0.000 0.936 0.064
#> GSM62316     2  0.5291     0.8552 0.000 0.732 0.268
#> GSM62254     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62292     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62253     1  0.1031     0.7423 0.976 0.000 0.024
#> GSM62270     3  0.6274     0.9903 0.456 0.000 0.544
#> GSM62278     1  0.6168    -0.6043 0.588 0.000 0.412
#> GSM62297     2  0.5785     0.8467 0.000 0.668 0.332
#> GSM62298     2  0.4452     0.8395 0.000 0.808 0.192
#> GSM62299     2  0.5835     0.8445 0.000 0.660 0.340
#> GSM62258     1  0.0000     0.7527 1.000 0.000 0.000
#> GSM62281     2  0.5327     0.8565 0.000 0.728 0.272
#> GSM62294     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62305     2  0.7433     0.8336 0.072 0.660 0.268
#> GSM62306     2  0.5291     0.8552 0.000 0.732 0.268
#> GSM62310     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62311     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62317     1  0.9507    -0.1258 0.432 0.380 0.188
#> GSM62318     1  0.4399     0.4599 0.812 0.000 0.188
#> GSM62321     1  0.7963     0.0534 0.660 0.152 0.188
#> GSM62322     3  0.6267     0.9976 0.452 0.000 0.548
#> GSM62250     2  0.8263     0.7934 0.120 0.612 0.268
#> GSM62252     2  0.7665     0.8227 0.084 0.648 0.268
#> GSM62255     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62257     2  0.2625     0.8262 0.000 0.916 0.084
#> GSM62260     1  0.0424     0.7513 0.992 0.000 0.008
#> GSM62261     2  0.5291     0.8552 0.000 0.732 0.268
#> GSM62262     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62264     1  0.0424     0.7513 0.992 0.000 0.008
#> GSM62268     1  0.1031     0.7423 0.976 0.000 0.024
#> GSM62269     3  0.6267     0.9976 0.452 0.000 0.548
#> GSM62271     1  0.0237     0.7530 0.996 0.000 0.004
#> GSM62272     3  0.6267     0.9976 0.452 0.000 0.548
#> GSM62273     2  0.4974     0.8564 0.000 0.764 0.236
#> GSM62274     1  0.1753     0.7055 0.952 0.000 0.048
#> GSM62275     3  0.6267     0.9976 0.452 0.000 0.548
#> GSM62276     1  0.0000     0.7527 1.000 0.000 0.000
#> GSM62277     1  0.6095    -0.5587 0.608 0.000 0.392
#> GSM62279     1  0.0000     0.7527 1.000 0.000 0.000
#> GSM62282     1  0.4399     0.4599 0.812 0.000 0.188
#> GSM62283     1  0.0237     0.7530 0.996 0.000 0.004
#> GSM62286     2  0.6126     0.8527 0.020 0.712 0.268
#> GSM62287     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62288     2  0.5291     0.8552 0.000 0.732 0.268
#> GSM62290     2  0.5810     0.8451 0.000 0.664 0.336
#> GSM62293     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62301     2  0.5785     0.8456 0.000 0.668 0.332
#> GSM62302     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62303     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62304     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62312     2  0.5733     0.8476 0.000 0.676 0.324
#> GSM62313     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62314     2  0.5254     0.8558 0.000 0.736 0.264
#> GSM62319     2  0.7644     0.8231 0.072 0.632 0.296
#> GSM62320     2  0.5465     0.8532 0.000 0.712 0.288
#> GSM62249     2  0.6500     0.2205 0.464 0.532 0.004
#> GSM62251     1  0.0237     0.7530 0.996 0.000 0.004
#> GSM62263     2  0.7885     0.4537 0.352 0.580 0.068
#> GSM62285     2  0.5785     0.8456 0.000 0.668 0.332
#> GSM62315     2  0.7378     0.8275 0.052 0.628 0.320
#> GSM62291     2  0.6154     0.8149 0.000 0.592 0.408
#> GSM62265     1  0.0237     0.7530 0.996 0.000 0.004
#> GSM62266     1  0.1031     0.7423 0.976 0.000 0.024
#> GSM62296     2  0.6140     0.8169 0.000 0.596 0.404
#> GSM62309     2  0.6819     0.8388 0.028 0.644 0.328
#> GSM62295     2  0.0000     0.7971 0.000 1.000 0.000
#> GSM62300     2  0.6180     0.8098 0.000 0.584 0.416
#> GSM62308     2  0.6180     0.8098 0.000 0.584 0.416

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     3  0.3972      0.866 0.000 0.008 0.788 0.204
#> GSM62256     2  0.6979      0.780 0.004 0.600 0.220 0.176
#> GSM62259     4  0.6788      0.587 0.000 0.144 0.264 0.592
#> GSM62267     1  0.1022      0.884 0.968 0.000 0.032 0.000
#> GSM62280     1  0.4817      0.727 0.612 0.388 0.000 0.000
#> GSM62284     1  0.3674      0.871 0.848 0.000 0.036 0.116
#> GSM62289     3  0.3335      0.853 0.016 0.000 0.856 0.128
#> GSM62307     4  0.4391      0.792 0.000 0.008 0.252 0.740
#> GSM62316     3  0.4323      0.858 0.000 0.020 0.776 0.204
#> GSM62254     4  0.2760      0.828 0.000 0.000 0.128 0.872
#> GSM62292     4  0.2760      0.828 0.000 0.000 0.128 0.872
#> GSM62253     1  0.0469      0.882 0.988 0.000 0.012 0.000
#> GSM62270     1  0.5012      0.856 0.792 0.020 0.060 0.128
#> GSM62278     1  0.3791      0.870 0.844 0.012 0.016 0.128
#> GSM62297     3  0.2586      0.714 0.004 0.004 0.900 0.092
#> GSM62298     4  0.5271      0.692 0.000 0.020 0.340 0.640
#> GSM62299     2  0.6421      0.908 0.000 0.556 0.368 0.076
#> GSM62258     1  0.1792      0.883 0.932 0.000 0.068 0.000
#> GSM62281     2  0.7306      0.713 0.004 0.556 0.240 0.200
#> GSM62294     4  0.3400      0.869 0.000 0.000 0.180 0.820
#> GSM62305     3  0.3598      0.850 0.028 0.000 0.848 0.124
#> GSM62306     3  0.4098      0.864 0.000 0.012 0.784 0.204
#> GSM62310     4  0.3626      0.867 0.004 0.000 0.184 0.812
#> GSM62311     4  0.3444      0.870 0.000 0.000 0.184 0.816
#> GSM62317     1  0.4817      0.727 0.612 0.388 0.000 0.000
#> GSM62318     1  0.4817      0.727 0.612 0.388 0.000 0.000
#> GSM62321     1  0.4817      0.727 0.612 0.388 0.000 0.000
#> GSM62322     1  0.5086      0.856 0.788 0.020 0.064 0.128
#> GSM62250     3  0.3587      0.723 0.104 0.000 0.856 0.040
#> GSM62252     3  0.3978      0.807 0.056 0.000 0.836 0.108
#> GSM62255     4  0.3486      0.868 0.000 0.000 0.188 0.812
#> GSM62257     4  0.4720      0.765 0.000 0.016 0.264 0.720
#> GSM62260     1  0.1854      0.878 0.940 0.012 0.048 0.000
#> GSM62261     3  0.3831      0.867 0.000 0.004 0.792 0.204
#> GSM62262     4  0.3400      0.869 0.000 0.000 0.180 0.820
#> GSM62264     1  0.1576      0.878 0.948 0.004 0.048 0.000
#> GSM62268     1  0.0804      0.884 0.980 0.000 0.012 0.008
#> GSM62269     1  0.5012      0.856 0.792 0.020 0.060 0.128
#> GSM62271     1  0.1211      0.878 0.960 0.000 0.040 0.000
#> GSM62272     1  0.5012      0.856 0.792 0.020 0.060 0.128
#> GSM62273     4  0.7297      0.442 0.000 0.204 0.264 0.532
#> GSM62274     1  0.3674      0.871 0.848 0.000 0.036 0.116
#> GSM62275     1  0.5012      0.856 0.792 0.020 0.060 0.128
#> GSM62276     1  0.1022      0.884 0.968 0.000 0.032 0.000
#> GSM62277     1  0.3842      0.868 0.836 0.000 0.036 0.128
#> GSM62279     1  0.1022      0.884 0.968 0.000 0.032 0.000
#> GSM62282     1  0.4103      0.819 0.744 0.256 0.000 0.000
#> GSM62283     1  0.1211      0.878 0.960 0.000 0.040 0.000
#> GSM62286     3  0.3271      0.856 0.012 0.000 0.856 0.132
#> GSM62287     4  0.3444      0.870 0.000 0.000 0.184 0.816
#> GSM62288     3  0.3831      0.867 0.000 0.004 0.792 0.204
#> GSM62290     2  0.6421      0.908 0.000 0.556 0.368 0.076
#> GSM62293     4  0.2760      0.828 0.000 0.000 0.128 0.872
#> GSM62301     2  0.6421      0.908 0.000 0.556 0.368 0.076
#> GSM62302     4  0.3444      0.870 0.000 0.000 0.184 0.816
#> GSM62303     4  0.3444      0.870 0.000 0.000 0.184 0.816
#> GSM62304     4  0.3444      0.870 0.000 0.000 0.184 0.816
#> GSM62312     2  0.6549      0.896 0.000 0.556 0.356 0.088
#> GSM62313     4  0.3444      0.870 0.000 0.000 0.184 0.816
#> GSM62314     3  0.4323      0.858 0.000 0.020 0.776 0.204
#> GSM62319     2  0.8473      0.798 0.100 0.496 0.300 0.104
#> GSM62320     4  0.7581      0.133 0.000 0.200 0.360 0.440
#> GSM62249     1  0.1557      0.874 0.944 0.000 0.056 0.000
#> GSM62251     1  0.0817      0.881 0.976 0.000 0.024 0.000
#> GSM62263     1  0.5559      0.578 0.696 0.000 0.240 0.064
#> GSM62285     2  0.6421      0.908 0.000 0.556 0.368 0.076
#> GSM62315     2  0.7520      0.879 0.044 0.516 0.364 0.076
#> GSM62291     2  0.6280      0.894 0.000 0.604 0.316 0.080
#> GSM62265     1  0.1211      0.878 0.960 0.000 0.040 0.000
#> GSM62266     1  0.0469      0.882 0.988 0.000 0.012 0.000
#> GSM62296     2  0.6319      0.894 0.000 0.604 0.312 0.084
#> GSM62309     2  0.7520      0.879 0.044 0.516 0.364 0.076
#> GSM62295     4  0.2814      0.829 0.000 0.000 0.132 0.868
#> GSM62300     2  0.6240      0.892 0.000 0.604 0.320 0.076
#> GSM62308     2  0.6240      0.892 0.000 0.604 0.320 0.076

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     5  0.5375    0.80371 0.000 0.320 0.000 0.076 0.604
#> GSM62256     2  0.4214    0.65561 0.004 0.788 0.000 0.088 0.120
#> GSM62259     4  0.5576    0.50967 0.000 0.388 0.000 0.536 0.076
#> GSM62267     1  0.1082    0.90275 0.964 0.000 0.000 0.008 0.028
#> GSM62280     3  0.4192    0.33934 0.404 0.000 0.596 0.000 0.000
#> GSM62284     1  0.2720    0.83043 0.880 0.000 0.004 0.020 0.096
#> GSM62289     5  0.4763    0.78257 0.000 0.212 0.000 0.076 0.712
#> GSM62307     4  0.5338    0.62571 0.000 0.324 0.000 0.604 0.072
#> GSM62316     5  0.5491    0.79735 0.000 0.312 0.000 0.088 0.600
#> GSM62254     4  0.0880    0.74445 0.000 0.032 0.000 0.968 0.000
#> GSM62292     4  0.0880    0.74445 0.000 0.032 0.000 0.968 0.000
#> GSM62253     1  0.0451    0.90508 0.988 0.000 0.004 0.008 0.000
#> GSM62270     3  0.7166    0.42775 0.336 0.000 0.404 0.020 0.240
#> GSM62278     1  0.2172    0.86094 0.908 0.000 0.000 0.016 0.076
#> GSM62297     5  0.4555    0.57565 0.008 0.472 0.000 0.000 0.520
#> GSM62298     4  0.5232    0.44082 0.000 0.456 0.000 0.500 0.044
#> GSM62299     2  0.0162    0.84155 0.000 0.996 0.000 0.000 0.004
#> GSM62258     1  0.1082    0.90275 0.964 0.000 0.000 0.008 0.028
#> GSM62281     2  0.4022    0.64427 0.004 0.804 0.000 0.092 0.100
#> GSM62294     4  0.3048    0.84988 0.000 0.176 0.000 0.820 0.004
#> GSM62305     5  0.4932    0.75529 0.028 0.232 0.000 0.032 0.708
#> GSM62306     5  0.5375    0.80371 0.000 0.320 0.000 0.076 0.604
#> GSM62310     4  0.3243    0.84799 0.004 0.180 0.000 0.812 0.004
#> GSM62311     4  0.3048    0.84988 0.000 0.176 0.000 0.820 0.004
#> GSM62317     3  0.4192    0.33934 0.404 0.000 0.596 0.000 0.000
#> GSM62318     3  0.4192    0.33934 0.404 0.000 0.596 0.000 0.000
#> GSM62321     3  0.4192    0.33934 0.404 0.000 0.596 0.000 0.000
#> GSM62322     3  0.7171    0.42615 0.340 0.000 0.400 0.020 0.240
#> GSM62250     5  0.6071    0.61074 0.180 0.120 0.000 0.044 0.656
#> GSM62252     5  0.6987    0.47251 0.264 0.136 0.000 0.060 0.540
#> GSM62255     4  0.4558    0.79910 0.000 0.180 0.000 0.740 0.080
#> GSM62257     4  0.5470    0.61167 0.000 0.296 0.000 0.612 0.092
#> GSM62260     1  0.1569    0.85283 0.944 0.000 0.044 0.004 0.008
#> GSM62261     5  0.5390    0.80147 0.000 0.324 0.000 0.076 0.600
#> GSM62262     4  0.2929    0.85089 0.000 0.180 0.000 0.820 0.000
#> GSM62264     1  0.0451    0.90217 0.988 0.000 0.000 0.004 0.008
#> GSM62268     1  0.1153    0.89632 0.964 0.000 0.004 0.008 0.024
#> GSM62269     3  0.7166    0.42775 0.336 0.000 0.404 0.020 0.240
#> GSM62271     1  0.0000    0.90357 1.000 0.000 0.000 0.000 0.000
#> GSM62272     3  0.7166    0.42775 0.336 0.000 0.404 0.020 0.240
#> GSM62273     2  0.5447   -0.00558 0.000 0.572 0.000 0.356 0.072
#> GSM62274     1  0.2172    0.87076 0.916 0.000 0.004 0.020 0.060
#> GSM62275     3  0.7166    0.42775 0.336 0.000 0.404 0.020 0.240
#> GSM62276     1  0.1082    0.90275 0.964 0.000 0.000 0.008 0.028
#> GSM62277     1  0.2932    0.80796 0.864 0.000 0.004 0.020 0.112
#> GSM62279     1  0.1243    0.90224 0.960 0.000 0.004 0.008 0.028
#> GSM62282     3  0.4307    0.18662 0.496 0.000 0.504 0.000 0.000
#> GSM62283     1  0.0451    0.90217 0.988 0.000 0.000 0.004 0.008
#> GSM62286     5  0.4763    0.78257 0.000 0.212 0.000 0.076 0.712
#> GSM62287     4  0.2929    0.85089 0.000 0.180 0.000 0.820 0.000
#> GSM62288     5  0.5390    0.80147 0.000 0.324 0.000 0.076 0.600
#> GSM62290     2  0.0000    0.84485 0.000 1.000 0.000 0.000 0.000
#> GSM62293     4  0.0880    0.74445 0.000 0.032 0.000 0.968 0.000
#> GSM62301     2  0.0000    0.84485 0.000 1.000 0.000 0.000 0.000
#> GSM62302     4  0.2929    0.85089 0.000 0.180 0.000 0.820 0.000
#> GSM62303     4  0.3003    0.84902 0.000 0.188 0.000 0.812 0.000
#> GSM62304     4  0.3003    0.84902 0.000 0.188 0.000 0.812 0.000
#> GSM62312     2  0.0000    0.84485 0.000 1.000 0.000 0.000 0.000
#> GSM62313     4  0.2929    0.85089 0.000 0.180 0.000 0.820 0.000
#> GSM62314     5  0.5697    0.77645 0.000 0.288 0.000 0.116 0.596
#> GSM62319     2  0.4480    0.16908 0.400 0.592 0.000 0.004 0.004
#> GSM62320     2  0.0451    0.83701 0.000 0.988 0.000 0.004 0.008
#> GSM62249     1  0.1012    0.89111 0.968 0.012 0.000 0.000 0.020
#> GSM62251     1  0.0771    0.89890 0.976 0.000 0.004 0.000 0.020
#> GSM62263     1  0.4419    0.27985 0.668 0.312 0.000 0.000 0.020
#> GSM62285     2  0.0000    0.84485 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000    0.84485 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.1197    0.82276 0.000 0.952 0.000 0.000 0.048
#> GSM62265     1  0.0613    0.90306 0.984 0.000 0.004 0.004 0.008
#> GSM62266     1  0.0451    0.90508 0.988 0.000 0.004 0.008 0.000
#> GSM62296     2  0.1197    0.82276 0.000 0.952 0.000 0.000 0.048
#> GSM62309     2  0.0000    0.84485 0.000 1.000 0.000 0.000 0.000
#> GSM62295     4  0.1753    0.74198 0.000 0.032 0.000 0.936 0.032
#> GSM62300     2  0.1197    0.82276 0.000 0.952 0.000 0.000 0.048
#> GSM62308     2  0.1197    0.82276 0.000 0.952 0.000 0.000 0.048

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5   0.445      0.762 0.000 0.100 0.000 0.196 0.704 0.000
#> GSM62256     2   0.453      0.764 0.000 0.704 0.000 0.164 0.132 0.000
#> GSM62259     4   0.453      0.528 0.000 0.164 0.000 0.704 0.132 0.000
#> GSM62267     1   0.249      0.810 0.880 0.000 0.076 0.000 0.044 0.000
#> GSM62280     6   0.000      0.907 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62284     1   0.295      0.770 0.812 0.000 0.176 0.000 0.012 0.000
#> GSM62289     5   0.141      0.728 0.000 0.004 0.000 0.060 0.936 0.000
#> GSM62307     4   0.365      0.653 0.000 0.092 0.000 0.792 0.116 0.000
#> GSM62316     5   0.481      0.724 0.000 0.096 0.000 0.264 0.640 0.000
#> GSM62254     4   0.321      0.722 0.000 0.132 0.000 0.820 0.048 0.000
#> GSM62292     4   0.321      0.722 0.000 0.132 0.000 0.820 0.048 0.000
#> GSM62253     1   0.000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62270     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     1   0.415      0.301 0.548 0.000 0.440 0.000 0.012 0.000
#> GSM62297     5   0.577      0.509 0.008 0.272 0.000 0.180 0.540 0.000
#> GSM62298     4   0.446      0.420 0.000 0.268 0.000 0.668 0.064 0.000
#> GSM62299     2   0.263      0.897 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM62258     1   0.246      0.810 0.880 0.000 0.084 0.000 0.036 0.000
#> GSM62281     2   0.468      0.759 0.000 0.684 0.000 0.184 0.132 0.000
#> GSM62294     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62305     5   0.143      0.724 0.000 0.012 0.000 0.048 0.940 0.000
#> GSM62306     5   0.440      0.764 0.000 0.096 0.000 0.196 0.708 0.000
#> GSM62310     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62311     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     6   0.000      0.907 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62318     6   0.000      0.907 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62321     6   0.000      0.907 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5   0.192      0.699 0.028 0.004 0.000 0.048 0.920 0.000
#> GSM62252     5   0.122      0.650 0.000 0.004 0.000 0.000 0.948 0.048
#> GSM62255     4   0.186      0.780 0.000 0.000 0.000 0.896 0.104 0.000
#> GSM62257     4   0.254      0.750 0.000 0.020 0.000 0.864 0.116 0.000
#> GSM62260     1   0.358      0.505 0.660 0.000 0.000 0.000 0.000 0.340
#> GSM62261     5   0.456      0.755 0.000 0.108 0.000 0.200 0.692 0.000
#> GSM62262     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62264     1   0.285      0.688 0.792 0.000 0.000 0.000 0.000 0.208
#> GSM62268     1   0.000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62269     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     1   0.159      0.811 0.940 0.000 0.008 0.000 0.020 0.032
#> GSM62272     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2   0.515      0.679 0.000 0.604 0.000 0.264 0.132 0.000
#> GSM62274     1   0.291      0.787 0.832 0.000 0.144 0.000 0.024 0.000
#> GSM62275     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     1   0.249      0.810 0.880 0.000 0.076 0.000 0.044 0.000
#> GSM62277     1   0.305      0.773 0.812 0.000 0.168 0.000 0.020 0.000
#> GSM62279     1   0.243      0.811 0.884 0.000 0.072 0.000 0.044 0.000
#> GSM62282     6   0.324      0.594 0.268 0.000 0.000 0.000 0.000 0.732
#> GSM62283     1   0.144      0.791 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM62286     5   0.147      0.730 0.000 0.004 0.000 0.064 0.932 0.000
#> GSM62287     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62288     5   0.454      0.759 0.000 0.096 0.000 0.216 0.688 0.000
#> GSM62290     2   0.263      0.897 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM62293     4   0.321      0.722 0.000 0.132 0.000 0.820 0.048 0.000
#> GSM62301     2   0.263      0.897 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM62302     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62303     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62304     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62312     2   0.263      0.897 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM62313     4   0.000      0.855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62314     5   0.483      0.718 0.000 0.092 0.000 0.276 0.632 0.000
#> GSM62319     2   0.422      0.600 0.000 0.712 0.000 0.004 0.052 0.232
#> GSM62320     2   0.362      0.871 0.000 0.772 0.000 0.184 0.044 0.000
#> GSM62249     1   0.279      0.695 0.800 0.000 0.000 0.000 0.000 0.200
#> GSM62251     1   0.263      0.713 0.820 0.000 0.000 0.000 0.000 0.180
#> GSM62263     1   0.606      0.342 0.516 0.252 0.000 0.000 0.016 0.216
#> GSM62285     2   0.263      0.897 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM62315     2   0.353      0.886 0.000 0.784 0.000 0.180 0.004 0.032
#> GSM62291     2   0.218      0.880 0.000 0.868 0.000 0.132 0.000 0.000
#> GSM62265     1   0.000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62266     1   0.000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62296     2   0.253      0.881 0.000 0.856 0.000 0.132 0.012 0.000
#> GSM62309     2   0.353      0.886 0.000 0.784 0.000 0.180 0.004 0.032
#> GSM62295     4   0.382      0.722 0.000 0.132 0.000 0.776 0.092 0.000
#> GSM62300     2   0.218      0.880 0.000 0.868 0.000 0.132 0.000 0.000
#> GSM62308     2   0.218      0.880 0.000 0.868 0.000 0.132 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) other(p) genotype/variation(p) k
#> SD:mclust 75          0.82366    0.881                 0.806 2
#> SD:mclust 66          0.56626    0.946                 0.966 3
#> SD:mclust 73          0.00245    0.874                 0.354 4
#> SD:mclust 60          0.00509    0.824                 0.377 5
#> SD:mclust 72          0.01102    0.771                 0.689 6

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


SD:NMF**

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

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

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

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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.953       0.982         0.4275 0.580   0.580
#> 3 3 0.862           0.828       0.930         0.3062 0.823   0.706
#> 4 4 0.839           0.854       0.925         0.1431 0.846   0.683
#> 5 5 0.648           0.662       0.812         0.1815 0.758   0.439
#> 6 6 0.739           0.721       0.853         0.0646 0.834   0.451

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
#> GSM62248     2  0.0000      0.980 0.000 1.000
#> GSM62256     2  0.0000      0.980 0.000 1.000
#> GSM62259     2  0.0000      0.980 0.000 1.000
#> GSM62267     1  0.1414      0.967 0.980 0.020
#> GSM62280     1  0.0000      0.982 1.000 0.000
#> GSM62284     1  0.0000      0.982 1.000 0.000
#> GSM62289     2  0.0000      0.980 0.000 1.000
#> GSM62307     2  0.0000      0.980 0.000 1.000
#> GSM62316     2  0.0000      0.980 0.000 1.000
#> GSM62254     2  0.0000      0.980 0.000 1.000
#> GSM62292     2  0.0000      0.980 0.000 1.000
#> GSM62253     1  0.0000      0.982 1.000 0.000
#> GSM62270     1  0.0000      0.982 1.000 0.000
#> GSM62278     1  0.0000      0.982 1.000 0.000
#> GSM62297     2  0.0000      0.980 0.000 1.000
#> GSM62298     2  0.0000      0.980 0.000 1.000
#> GSM62299     2  0.0000      0.980 0.000 1.000
#> GSM62258     1  0.0000      0.982 1.000 0.000
#> GSM62281     2  0.0000      0.980 0.000 1.000
#> GSM62294     2  0.0000      0.980 0.000 1.000
#> GSM62305     2  0.0000      0.980 0.000 1.000
#> GSM62306     2  0.0000      0.980 0.000 1.000
#> GSM62310     2  0.0000      0.980 0.000 1.000
#> GSM62311     2  0.0000      0.980 0.000 1.000
#> GSM62317     2  0.0000      0.980 0.000 1.000
#> GSM62318     1  0.0000      0.982 1.000 0.000
#> GSM62321     2  0.7056      0.752 0.192 0.808
#> GSM62322     1  0.0000      0.982 1.000 0.000
#> GSM62250     2  0.0000      0.980 0.000 1.000
#> GSM62252     2  0.0000      0.980 0.000 1.000
#> GSM62255     2  0.0000      0.980 0.000 1.000
#> GSM62257     2  0.0000      0.980 0.000 1.000
#> GSM62260     2  0.9954      0.140 0.460 0.540
#> GSM62261     2  0.0000      0.980 0.000 1.000
#> GSM62262     2  0.0000      0.980 0.000 1.000
#> GSM62264     1  0.8763      0.567 0.704 0.296
#> GSM62268     1  0.0000      0.982 1.000 0.000
#> GSM62269     1  0.0000      0.982 1.000 0.000
#> GSM62271     1  0.0000      0.982 1.000 0.000
#> GSM62272     1  0.0000      0.982 1.000 0.000
#> GSM62273     2  0.0000      0.980 0.000 1.000
#> GSM62274     1  0.0000      0.982 1.000 0.000
#> GSM62275     1  0.0000      0.982 1.000 0.000
#> GSM62276     1  0.0000      0.982 1.000 0.000
#> GSM62277     1  0.0000      0.982 1.000 0.000
#> GSM62279     1  0.2043      0.955 0.968 0.032
#> GSM62282     1  0.0000      0.982 1.000 0.000
#> GSM62283     2  0.9323      0.461 0.348 0.652
#> GSM62286     2  0.0000      0.980 0.000 1.000
#> GSM62287     2  0.0000      0.980 0.000 1.000
#> GSM62288     2  0.0000      0.980 0.000 1.000
#> GSM62290     2  0.0000      0.980 0.000 1.000
#> GSM62293     2  0.0000      0.980 0.000 1.000
#> GSM62301     2  0.0000      0.980 0.000 1.000
#> GSM62302     2  0.0000      0.980 0.000 1.000
#> GSM62303     2  0.0000      0.980 0.000 1.000
#> GSM62304     2  0.0000      0.980 0.000 1.000
#> GSM62312     2  0.0000      0.980 0.000 1.000
#> GSM62313     2  0.0000      0.980 0.000 1.000
#> GSM62314     2  0.0000      0.980 0.000 1.000
#> GSM62319     2  0.0000      0.980 0.000 1.000
#> GSM62320     2  0.0000      0.980 0.000 1.000
#> GSM62249     2  0.0000      0.980 0.000 1.000
#> GSM62251     2  0.0938      0.969 0.012 0.988
#> GSM62263     2  0.0000      0.980 0.000 1.000
#> GSM62285     2  0.0000      0.980 0.000 1.000
#> GSM62315     2  0.0000      0.980 0.000 1.000
#> GSM62291     2  0.0000      0.980 0.000 1.000
#> GSM62265     1  0.1184      0.970 0.984 0.016
#> GSM62266     1  0.0000      0.982 1.000 0.000
#> GSM62296     2  0.0000      0.980 0.000 1.000
#> GSM62309     2  0.0000      0.980 0.000 1.000
#> GSM62295     2  0.0000      0.980 0.000 1.000
#> GSM62300     2  0.0000      0.980 0.000 1.000
#> GSM62308     2  0.0000      0.980 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
#> GSM62248     2  0.1031      0.963 0.024 0.976 0.000
#> GSM62256     2  0.0424      0.972 0.008 0.992 0.000
#> GSM62259     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62267     3  0.2492      0.784 0.016 0.048 0.936
#> GSM62280     1  0.0829      0.743 0.984 0.004 0.012
#> GSM62284     3  0.5733      0.361 0.324 0.000 0.676
#> GSM62289     2  0.0747      0.969 0.016 0.984 0.000
#> GSM62307     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62316     2  0.0424      0.974 0.008 0.992 0.000
#> GSM62254     2  0.0237      0.975 0.004 0.996 0.000
#> GSM62292     2  0.0424      0.974 0.008 0.992 0.000
#> GSM62253     1  0.6154      0.379 0.592 0.000 0.408
#> GSM62270     3  0.0000      0.849 0.000 0.000 1.000
#> GSM62278     3  0.0000      0.849 0.000 0.000 1.000
#> GSM62297     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62298     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62299     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62258     1  0.6168      0.379 0.588 0.000 0.412
#> GSM62281     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62294     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62305     2  0.0892      0.967 0.020 0.980 0.000
#> GSM62306     2  0.0424      0.974 0.008 0.992 0.000
#> GSM62310     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62317     1  0.4887      0.512 0.772 0.228 0.000
#> GSM62318     1  0.0747      0.742 0.984 0.000 0.016
#> GSM62321     1  0.0829      0.741 0.984 0.012 0.004
#> GSM62322     3  0.0000      0.849 0.000 0.000 1.000
#> GSM62250     2  0.0747      0.969 0.016 0.984 0.000
#> GSM62252     2  0.0747      0.969 0.016 0.984 0.000
#> GSM62255     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62257     2  0.0237      0.975 0.004 0.996 0.000
#> GSM62260     1  0.0592      0.743 0.988 0.000 0.012
#> GSM62261     2  0.0592      0.972 0.012 0.988 0.000
#> GSM62262     2  0.0237      0.975 0.004 0.996 0.000
#> GSM62264     1  0.0592      0.743 0.988 0.000 0.012
#> GSM62268     1  0.6168      0.375 0.588 0.000 0.412
#> GSM62269     3  0.0000      0.849 0.000 0.000 1.000
#> GSM62271     3  0.4062      0.693 0.164 0.000 0.836
#> GSM62272     3  0.0000      0.849 0.000 0.000 1.000
#> GSM62273     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62274     3  0.0237      0.848 0.004 0.000 0.996
#> GSM62275     3  0.0000      0.849 0.000 0.000 1.000
#> GSM62276     3  0.0747      0.841 0.016 0.000 0.984
#> GSM62277     3  0.0237      0.848 0.004 0.000 0.996
#> GSM62279     3  0.6299     -0.108 0.476 0.000 0.524
#> GSM62282     3  0.6280      0.152 0.460 0.000 0.540
#> GSM62283     1  0.3993      0.722 0.884 0.064 0.052
#> GSM62286     2  0.0592      0.972 0.012 0.988 0.000
#> GSM62287     2  0.0424      0.974 0.008 0.992 0.000
#> GSM62288     2  0.0592      0.972 0.012 0.988 0.000
#> GSM62290     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62293     2  0.0237      0.975 0.004 0.996 0.000
#> GSM62301     2  0.0424      0.971 0.008 0.992 0.000
#> GSM62302     2  0.0237      0.975 0.004 0.996 0.000
#> GSM62303     2  0.0237      0.975 0.004 0.996 0.000
#> GSM62304     2  0.0237      0.975 0.004 0.996 0.000
#> GSM62312     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62313     2  0.0237      0.975 0.004 0.996 0.000
#> GSM62314     2  0.0592      0.972 0.012 0.988 0.000
#> GSM62319     2  0.0424      0.971 0.008 0.992 0.000
#> GSM62320     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62249     1  0.3482      0.681 0.872 0.128 0.000
#> GSM62251     1  0.5467      0.624 0.792 0.176 0.032
#> GSM62263     1  0.0424      0.743 0.992 0.008 0.000
#> GSM62285     2  0.0237      0.974 0.004 0.996 0.000
#> GSM62315     2  0.6095      0.380 0.392 0.608 0.000
#> GSM62291     2  0.0237      0.974 0.004 0.996 0.000
#> GSM62265     1  0.4750      0.635 0.784 0.000 0.216
#> GSM62266     1  0.6095      0.409 0.608 0.000 0.392
#> GSM62296     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62309     2  0.6260      0.224 0.448 0.552 0.000
#> GSM62295     2  0.0000      0.975 0.000 1.000 0.000
#> GSM62300     2  0.0424      0.971 0.008 0.992 0.000
#> GSM62308     2  0.0592      0.969 0.012 0.988 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     2  0.2053      0.908 0.072 0.924 0.000 0.004
#> GSM62256     2  0.4790      0.447 0.000 0.620 0.000 0.380
#> GSM62259     2  0.0188      0.954 0.000 0.996 0.000 0.004
#> GSM62267     1  0.2383      0.787 0.924 0.024 0.048 0.004
#> GSM62280     4  0.0336      0.901 0.000 0.000 0.008 0.992
#> GSM62284     1  0.4193      0.631 0.732 0.000 0.268 0.000
#> GSM62289     1  0.5070      0.356 0.580 0.416 0.000 0.004
#> GSM62307     2  0.0188      0.954 0.000 0.996 0.000 0.004
#> GSM62316     2  0.0376      0.952 0.004 0.992 0.000 0.004
#> GSM62254     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM62292     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM62253     1  0.1302      0.791 0.956 0.000 0.044 0.000
#> GSM62270     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM62278     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM62297     2  0.3123      0.854 0.156 0.844 0.000 0.000
#> GSM62298     2  0.0927      0.950 0.016 0.976 0.000 0.008
#> GSM62299     2  0.1854      0.935 0.048 0.940 0.000 0.012
#> GSM62258     1  0.4933      0.572 0.688 0.000 0.296 0.016
#> GSM62281     2  0.0336      0.953 0.000 0.992 0.000 0.008
#> GSM62294     2  0.0188      0.954 0.000 0.996 0.000 0.004
#> GSM62305     2  0.4331      0.631 0.288 0.712 0.000 0.000
#> GSM62306     2  0.0657      0.949 0.012 0.984 0.000 0.004
#> GSM62310     2  0.0188      0.954 0.000 0.996 0.000 0.004
#> GSM62311     2  0.0188      0.954 0.000 0.996 0.000 0.004
#> GSM62317     4  0.0188      0.901 0.000 0.004 0.000 0.996
#> GSM62318     4  0.0524      0.900 0.004 0.000 0.008 0.988
#> GSM62321     4  0.0188      0.902 0.000 0.000 0.004 0.996
#> GSM62322     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM62250     1  0.4372      0.583 0.728 0.268 0.000 0.004
#> GSM62252     1  0.4741      0.513 0.668 0.328 0.000 0.004
#> GSM62255     2  0.0188      0.954 0.000 0.996 0.000 0.004
#> GSM62257     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM62260     4  0.2011      0.879 0.080 0.000 0.000 0.920
#> GSM62261     2  0.1209      0.937 0.032 0.964 0.000 0.004
#> GSM62262     2  0.0000      0.953 0.000 1.000 0.000 0.000
#> GSM62264     1  0.3266      0.693 0.832 0.000 0.000 0.168
#> GSM62268     1  0.2345      0.773 0.900 0.000 0.100 0.000
#> GSM62269     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM62271     3  0.4319      0.697 0.228 0.000 0.760 0.012
#> GSM62272     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM62273     2  0.0336      0.953 0.000 0.992 0.000 0.008
#> GSM62274     1  0.3486      0.719 0.812 0.000 0.188 0.000
#> GSM62275     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> GSM62276     1  0.5093      0.497 0.652 0.008 0.336 0.004
#> GSM62277     3  0.0469      0.948 0.012 0.000 0.988 0.000
#> GSM62279     1  0.1909      0.790 0.940 0.008 0.048 0.004
#> GSM62282     4  0.4713      0.402 0.000 0.000 0.360 0.640
#> GSM62283     1  0.0188      0.793 0.996 0.000 0.000 0.004
#> GSM62286     2  0.1661      0.924 0.052 0.944 0.000 0.004
#> GSM62287     2  0.0188      0.953 0.000 0.996 0.000 0.004
#> GSM62288     2  0.1489      0.929 0.044 0.952 0.000 0.004
#> GSM62290     2  0.1807      0.935 0.052 0.940 0.000 0.008
#> GSM62293     2  0.0000      0.953 0.000 1.000 0.000 0.000
#> GSM62301     2  0.3464      0.882 0.056 0.868 0.000 0.076
#> GSM62302     2  0.0000      0.953 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000      0.953 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000      0.953 0.000 1.000 0.000 0.000
#> GSM62312     2  0.1635      0.939 0.044 0.948 0.000 0.008
#> GSM62313     2  0.0000      0.953 0.000 1.000 0.000 0.000
#> GSM62314     2  0.0376      0.952 0.004 0.992 0.000 0.004
#> GSM62319     2  0.2111      0.931 0.044 0.932 0.000 0.024
#> GSM62320     2  0.0927      0.950 0.016 0.976 0.000 0.008
#> GSM62249     1  0.0188      0.793 0.996 0.000 0.000 0.004
#> GSM62251     1  0.0000      0.793 1.000 0.000 0.000 0.000
#> GSM62263     1  0.3688      0.620 0.792 0.000 0.000 0.208
#> GSM62285     2  0.2174      0.929 0.052 0.928 0.000 0.020
#> GSM62315     4  0.2483      0.864 0.052 0.032 0.000 0.916
#> GSM62291     2  0.2089      0.932 0.048 0.932 0.000 0.020
#> GSM62265     1  0.0000      0.793 1.000 0.000 0.000 0.000
#> GSM62266     1  0.1022      0.793 0.968 0.000 0.032 0.000
#> GSM62296     2  0.2174      0.929 0.052 0.928 0.000 0.020
#> GSM62309     4  0.1970      0.883 0.060 0.008 0.000 0.932
#> GSM62295     2  0.0188      0.954 0.000 0.996 0.000 0.004
#> GSM62300     2  0.2282      0.927 0.052 0.924 0.000 0.024
#> GSM62308     2  0.2578      0.920 0.052 0.912 0.000 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
#> GSM62248     4  0.0771     0.6643 0.020 0.000 0.000 0.976 0.004
#> GSM62256     5  0.0609     0.8989 0.000 0.000 0.000 0.020 0.980
#> GSM62259     4  0.4074     0.6236 0.000 0.364 0.000 0.636 0.000
#> GSM62267     4  0.4410    -0.1572 0.440 0.000 0.000 0.556 0.004
#> GSM62280     5  0.0162     0.9070 0.004 0.000 0.000 0.000 0.996
#> GSM62284     1  0.3895     0.4072 0.680 0.000 0.320 0.000 0.000
#> GSM62289     4  0.0771     0.6568 0.020 0.000 0.000 0.976 0.004
#> GSM62307     4  0.4278     0.5535 0.000 0.452 0.000 0.548 0.000
#> GSM62316     4  0.0609     0.6831 0.000 0.020 0.000 0.980 0.000
#> GSM62254     4  0.4060     0.6534 0.000 0.360 0.000 0.640 0.000
#> GSM62292     4  0.3480     0.6989 0.000 0.248 0.000 0.752 0.000
#> GSM62253     1  0.0000     0.7173 1.000 0.000 0.000 0.000 0.000
#> GSM62270     3  0.0000     0.9416 0.000 0.000 1.000 0.000 0.000
#> GSM62278     3  0.0000     0.9416 0.000 0.000 1.000 0.000 0.000
#> GSM62297     2  0.3752     0.5133 0.292 0.708 0.000 0.000 0.000
#> GSM62298     2  0.0703     0.8258 0.000 0.976 0.000 0.024 0.000
#> GSM62299     2  0.1331     0.8406 0.040 0.952 0.000 0.008 0.000
#> GSM62258     5  0.5000     0.6165 0.068 0.000 0.004 0.240 0.688
#> GSM62281     4  0.5103     0.5094 0.000 0.452 0.000 0.512 0.036
#> GSM62294     4  0.4171     0.6259 0.000 0.396 0.000 0.604 0.000
#> GSM62305     4  0.3807     0.4653 0.176 0.028 0.000 0.792 0.004
#> GSM62306     4  0.1041     0.6881 0.000 0.032 0.000 0.964 0.004
#> GSM62310     4  0.4182     0.6223 0.000 0.400 0.000 0.600 0.000
#> GSM62311     4  0.4219     0.6052 0.000 0.416 0.000 0.584 0.000
#> GSM62317     5  0.0162     0.9070 0.004 0.000 0.000 0.000 0.996
#> GSM62318     5  0.0162     0.9070 0.004 0.000 0.000 0.000 0.996
#> GSM62321     5  0.0162     0.9070 0.004 0.000 0.000 0.000 0.996
#> GSM62322     3  0.0000     0.9416 0.000 0.000 1.000 0.000 0.000
#> GSM62250     4  0.2286     0.5763 0.108 0.000 0.000 0.888 0.004
#> GSM62252     4  0.0865     0.6545 0.024 0.000 0.000 0.972 0.004
#> GSM62255     4  0.4305     0.4889 0.000 0.488 0.000 0.512 0.000
#> GSM62257     4  0.3074     0.7072 0.000 0.196 0.000 0.804 0.000
#> GSM62260     5  0.3085     0.7921 0.116 0.032 0.000 0.000 0.852
#> GSM62261     4  0.2124     0.6980 0.000 0.096 0.000 0.900 0.004
#> GSM62262     4  0.4291     0.5344 0.000 0.464 0.000 0.536 0.000
#> GSM62264     1  0.1041     0.7102 0.964 0.004 0.000 0.000 0.032
#> GSM62268     1  0.1851     0.6668 0.912 0.000 0.088 0.000 0.000
#> GSM62269     3  0.0000     0.9416 0.000 0.000 1.000 0.000 0.000
#> GSM62271     3  0.4546     0.4705 0.304 0.028 0.668 0.000 0.000
#> GSM62272     3  0.0000     0.9416 0.000 0.000 1.000 0.000 0.000
#> GSM62273     2  0.1608     0.7626 0.000 0.928 0.000 0.072 0.000
#> GSM62274     1  0.4210     0.2339 0.588 0.000 0.412 0.000 0.000
#> GSM62275     3  0.0000     0.9416 0.000 0.000 1.000 0.000 0.000
#> GSM62276     4  0.6135    -0.0351 0.248 0.000 0.192 0.560 0.000
#> GSM62277     3  0.0510     0.9275 0.016 0.000 0.984 0.000 0.000
#> GSM62279     1  0.4066     0.4511 0.672 0.000 0.000 0.324 0.004
#> GSM62282     5  0.2230     0.8249 0.000 0.000 0.116 0.000 0.884
#> GSM62283     1  0.6070     0.2134 0.504 0.424 0.020 0.028 0.024
#> GSM62286     4  0.0486     0.6689 0.004 0.004 0.000 0.988 0.004
#> GSM62287     4  0.3074     0.7086 0.000 0.196 0.000 0.804 0.000
#> GSM62288     4  0.1560     0.6841 0.020 0.028 0.000 0.948 0.004
#> GSM62290     2  0.2068     0.8164 0.092 0.904 0.000 0.004 0.000
#> GSM62293     4  0.4249     0.5848 0.000 0.432 0.000 0.568 0.000
#> GSM62301     2  0.3003     0.6970 0.188 0.812 0.000 0.000 0.000
#> GSM62302     4  0.4138     0.6365 0.000 0.384 0.000 0.616 0.000
#> GSM62303     4  0.3949     0.6699 0.000 0.332 0.000 0.668 0.000
#> GSM62304     4  0.3366     0.7033 0.000 0.232 0.000 0.768 0.000
#> GSM62312     2  0.0609     0.8295 0.000 0.980 0.000 0.020 0.000
#> GSM62313     4  0.4150     0.6339 0.000 0.388 0.000 0.612 0.000
#> GSM62314     4  0.3151     0.6933 0.020 0.144 0.000 0.836 0.000
#> GSM62319     2  0.0404     0.8346 0.000 0.988 0.000 0.012 0.000
#> GSM62320     2  0.0609     0.8292 0.000 0.980 0.000 0.020 0.000
#> GSM62249     1  0.3990     0.4906 0.688 0.308 0.000 0.004 0.000
#> GSM62251     1  0.0162     0.7183 0.996 0.004 0.000 0.000 0.000
#> GSM62263     1  0.4219     0.2835 0.584 0.416 0.000 0.000 0.000
#> GSM62285     2  0.2020     0.8058 0.100 0.900 0.000 0.000 0.000
#> GSM62315     2  0.2124     0.8198 0.056 0.916 0.000 0.000 0.028
#> GSM62291     2  0.0162     0.8418 0.004 0.996 0.000 0.000 0.000
#> GSM62265     1  0.0671     0.7162 0.980 0.016 0.000 0.004 0.000
#> GSM62266     1  0.0162     0.7183 0.996 0.004 0.000 0.000 0.000
#> GSM62296     2  0.0671     0.8435 0.016 0.980 0.000 0.004 0.000
#> GSM62309     2  0.4193     0.6075 0.212 0.748 0.000 0.000 0.040
#> GSM62295     2  0.4304    -0.4761 0.000 0.516 0.000 0.484 0.000
#> GSM62300     2  0.2462     0.8003 0.112 0.880 0.000 0.008 0.000
#> GSM62308     2  0.0671     0.8434 0.016 0.980 0.000 0.004 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
#> GSM62248     5  0.2723     0.7814 0.016 0.004 0.000 0.128 0.852 0.000
#> GSM62256     6  0.0000     0.8901 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62259     5  0.3964     0.7168 0.000 0.044 0.000 0.232 0.724 0.000
#> GSM62267     5  0.0291     0.7564 0.004 0.000 0.004 0.000 0.992 0.000
#> GSM62280     6  0.0000     0.8901 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62284     1  0.2260     0.8080 0.860 0.000 0.140 0.000 0.000 0.000
#> GSM62289     5  0.1578     0.7785 0.012 0.004 0.000 0.048 0.936 0.000
#> GSM62307     4  0.3584     0.3877 0.004 0.000 0.000 0.688 0.308 0.000
#> GSM62316     5  0.2933     0.7724 0.000 0.004 0.000 0.200 0.796 0.000
#> GSM62254     5  0.3727     0.5702 0.000 0.000 0.000 0.388 0.612 0.000
#> GSM62292     5  0.3076     0.7579 0.000 0.000 0.000 0.240 0.760 0.000
#> GSM62253     1  0.0632     0.8791 0.976 0.024 0.000 0.000 0.000 0.000
#> GSM62270     3  0.0000     0.9960 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.0291     0.9912 0.004 0.004 0.992 0.000 0.000 0.000
#> GSM62297     2  0.1141     0.8159 0.052 0.948 0.000 0.000 0.000 0.000
#> GSM62298     4  0.2562     0.6192 0.000 0.172 0.000 0.828 0.000 0.000
#> GSM62299     2  0.1958     0.8200 0.004 0.896 0.000 0.100 0.000 0.000
#> GSM62258     5  0.3192     0.6143 0.000 0.000 0.004 0.004 0.776 0.216
#> GSM62281     6  0.4885    -0.1008 0.000 0.004 0.000 0.464 0.048 0.484
#> GSM62294     4  0.3817    -0.0813 0.000 0.000 0.000 0.568 0.432 0.000
#> GSM62305     5  0.2791     0.6760 0.016 0.124 0.000 0.008 0.852 0.000
#> GSM62306     5  0.1434     0.7640 0.008 0.020 0.000 0.024 0.948 0.000
#> GSM62310     4  0.0713     0.7513 0.000 0.000 0.000 0.972 0.028 0.000
#> GSM62311     4  0.0632     0.7510 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM62317     6  0.0000     0.8901 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62318     6  0.0000     0.8901 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62321     6  0.0000     0.8901 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000     0.9960 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.1313     0.7723 0.016 0.004 0.000 0.028 0.952 0.000
#> GSM62252     5  0.0725     0.7576 0.012 0.012 0.000 0.000 0.976 0.000
#> GSM62255     4  0.0837     0.7507 0.004 0.004 0.000 0.972 0.020 0.000
#> GSM62257     5  0.3076     0.7556 0.000 0.000 0.000 0.240 0.760 0.000
#> GSM62260     2  0.3364     0.6794 0.024 0.780 0.000 0.000 0.000 0.196
#> GSM62261     5  0.4471     0.6765 0.040 0.008 0.000 0.292 0.660 0.000
#> GSM62262     4  0.1910     0.7290 0.000 0.000 0.000 0.892 0.108 0.000
#> GSM62264     1  0.1483     0.8756 0.944 0.036 0.000 0.000 0.008 0.012
#> GSM62268     1  0.0717     0.8791 0.976 0.016 0.008 0.000 0.000 0.000
#> GSM62269     3  0.0000     0.9960 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     2  0.5597     0.2570 0.048 0.524 0.384 0.004 0.040 0.000
#> GSM62272     3  0.0146     0.9941 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62273     4  0.3101     0.5346 0.000 0.244 0.000 0.756 0.000 0.000
#> GSM62274     1  0.3741     0.5752 0.672 0.000 0.320 0.000 0.008 0.000
#> GSM62275     3  0.0000     0.9960 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     5  0.0893     0.7526 0.004 0.016 0.004 0.004 0.972 0.000
#> GSM62277     3  0.0405     0.9880 0.004 0.000 0.988 0.000 0.008 0.000
#> GSM62279     1  0.3721     0.6822 0.728 0.016 0.000 0.004 0.252 0.000
#> GSM62282     6  0.0000     0.8901 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62283     2  0.2009     0.7831 0.004 0.904 0.000 0.008 0.084 0.000
#> GSM62286     5  0.1225     0.7750 0.000 0.012 0.000 0.036 0.952 0.000
#> GSM62287     5  0.3151     0.7473 0.000 0.000 0.000 0.252 0.748 0.000
#> GSM62288     5  0.2845     0.7776 0.004 0.004 0.000 0.172 0.820 0.000
#> GSM62290     2  0.2595     0.7747 0.004 0.836 0.000 0.160 0.000 0.000
#> GSM62293     4  0.3221     0.5035 0.000 0.000 0.000 0.736 0.264 0.000
#> GSM62301     2  0.1082     0.8348 0.004 0.956 0.000 0.040 0.000 0.000
#> GSM62302     4  0.2178     0.7089 0.000 0.000 0.000 0.868 0.132 0.000
#> GSM62303     5  0.3782     0.5128 0.000 0.000 0.000 0.412 0.588 0.000
#> GSM62304     5  0.3428     0.6986 0.000 0.000 0.000 0.304 0.696 0.000
#> GSM62312     2  0.3851     0.2049 0.000 0.540 0.000 0.460 0.000 0.000
#> GSM62313     4  0.1957     0.7242 0.000 0.000 0.000 0.888 0.112 0.000
#> GSM62314     5  0.4459     0.2998 0.020 0.004 0.000 0.460 0.516 0.000
#> GSM62319     2  0.1584     0.8335 0.008 0.928 0.000 0.064 0.000 0.000
#> GSM62320     4  0.3464     0.4020 0.000 0.312 0.000 0.688 0.000 0.000
#> GSM62249     2  0.2407     0.7785 0.048 0.892 0.000 0.004 0.056 0.000
#> GSM62251     1  0.1636     0.8735 0.936 0.036 0.000 0.004 0.024 0.000
#> GSM62263     2  0.3950     0.2416 0.432 0.564 0.000 0.004 0.000 0.000
#> GSM62285     2  0.1610     0.8297 0.000 0.916 0.000 0.084 0.000 0.000
#> GSM62315     2  0.1387     0.8327 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM62291     2  0.2969     0.7112 0.000 0.776 0.000 0.224 0.000 0.000
#> GSM62265     2  0.4405     0.4849 0.316 0.644 0.000 0.004 0.036 0.000
#> GSM62266     1  0.0972     0.8793 0.964 0.028 0.000 0.000 0.008 0.000
#> GSM62296     2  0.1141     0.8357 0.000 0.948 0.000 0.052 0.000 0.000
#> GSM62309     2  0.0820     0.8256 0.016 0.972 0.000 0.012 0.000 0.000
#> GSM62295     4  0.1462     0.7198 0.008 0.056 0.000 0.936 0.000 0.000
#> GSM62300     2  0.1196     0.8355 0.008 0.952 0.000 0.040 0.000 0.000
#> GSM62308     2  0.1327     0.8335 0.000 0.936 0.000 0.064 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) other(p) genotype/variation(p) k
#> SD:NMF 73         0.344519    1.000                 0.453 2
#> SD:NMF 66         0.052527    0.183                 0.164 3
#> SD:NMF 71         0.224177    0.194                 0.660 4
#> SD:NMF 63         0.000176    0.587                 0.181 5
#> SD:NMF 66         0.000562    0.483                 0.175 6

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


CV:hclust

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-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.567           0.888       0.942         0.3643 0.630   0.630
#> 3 3 0.651           0.722       0.864         0.5005 0.790   0.672
#> 4 4 0.750           0.751       0.845         0.0813 0.953   0.898
#> 5 5 0.842           0.737       0.871         0.0552 0.966   0.920
#> 6 6 0.652           0.662       0.793         0.0704 0.968   0.924

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM62248     2  0.0000      0.951 0.000 1.000
#> GSM62256     2  0.0000      0.951 0.000 1.000
#> GSM62259     2  0.0000      0.951 0.000 1.000
#> GSM62267     1  0.8608      0.709 0.716 0.284
#> GSM62280     2  0.6247      0.816 0.156 0.844
#> GSM62284     1  0.4161      0.871 0.916 0.084
#> GSM62289     2  0.0000      0.951 0.000 1.000
#> GSM62307     2  0.0000      0.951 0.000 1.000
#> GSM62316     2  0.0000      0.951 0.000 1.000
#> GSM62254     2  0.0000      0.951 0.000 1.000
#> GSM62292     2  0.0000      0.951 0.000 1.000
#> GSM62253     1  0.6531      0.834 0.832 0.168
#> GSM62270     1  0.0000      0.872 1.000 0.000
#> GSM62278     1  0.0376      0.873 0.996 0.004
#> GSM62297     2  0.0000      0.951 0.000 1.000
#> GSM62298     2  0.0000      0.951 0.000 1.000
#> GSM62299     2  0.0000      0.951 0.000 1.000
#> GSM62258     1  0.9000      0.650 0.684 0.316
#> GSM62281     2  0.0000      0.951 0.000 1.000
#> GSM62294     2  0.0000      0.951 0.000 1.000
#> GSM62305     2  0.6531      0.794 0.168 0.832
#> GSM62306     2  0.6531      0.794 0.168 0.832
#> GSM62310     2  0.0000      0.951 0.000 1.000
#> GSM62311     2  0.0000      0.951 0.000 1.000
#> GSM62317     2  0.0000      0.951 0.000 1.000
#> GSM62318     2  0.4939      0.867 0.108 0.892
#> GSM62321     2  0.0000      0.951 0.000 1.000
#> GSM62322     1  0.0000      0.872 1.000 0.000
#> GSM62250     2  0.4815      0.868 0.104 0.896
#> GSM62252     2  0.4815      0.868 0.104 0.896
#> GSM62255     2  0.0000      0.951 0.000 1.000
#> GSM62257     2  0.0000      0.951 0.000 1.000
#> GSM62260     2  0.7602      0.722 0.220 0.780
#> GSM62261     2  0.0000      0.951 0.000 1.000
#> GSM62262     2  0.0000      0.951 0.000 1.000
#> GSM62264     2  0.4939      0.857 0.108 0.892
#> GSM62268     1  0.4815      0.865 0.896 0.104
#> GSM62269     1  0.0000      0.872 1.000 0.000
#> GSM62271     1  0.0376      0.873 0.996 0.004
#> GSM62272     1  0.0000      0.872 1.000 0.000
#> GSM62273     2  0.0000      0.951 0.000 1.000
#> GSM62274     1  0.2236      0.877 0.964 0.036
#> GSM62275     1  0.0000      0.872 1.000 0.000
#> GSM62276     1  0.8608      0.709 0.716 0.284
#> GSM62277     1  0.2236      0.877 0.964 0.036
#> GSM62279     1  0.7219      0.809 0.800 0.200
#> GSM62282     1  0.8713      0.692 0.708 0.292
#> GSM62283     2  0.8144      0.665 0.252 0.748
#> GSM62286     2  0.4815      0.868 0.104 0.896
#> GSM62287     2  0.0000      0.951 0.000 1.000
#> GSM62288     2  0.0000      0.951 0.000 1.000
#> GSM62290     2  0.0000      0.951 0.000 1.000
#> GSM62293     2  0.0000      0.951 0.000 1.000
#> GSM62301     2  0.0000      0.951 0.000 1.000
#> GSM62302     2  0.0000      0.951 0.000 1.000
#> GSM62303     2  0.0000      0.951 0.000 1.000
#> GSM62304     2  0.0000      0.951 0.000 1.000
#> GSM62312     2  0.0000      0.951 0.000 1.000
#> GSM62313     2  0.0000      0.951 0.000 1.000
#> GSM62314     2  0.0000      0.951 0.000 1.000
#> GSM62319     2  0.6343      0.804 0.160 0.840
#> GSM62320     2  0.0000      0.951 0.000 1.000
#> GSM62249     2  0.8144      0.665 0.252 0.748
#> GSM62251     2  0.6887      0.759 0.184 0.816
#> GSM62263     2  0.0000      0.951 0.000 1.000
#> GSM62285     2  0.0000      0.951 0.000 1.000
#> GSM62315     2  0.0000      0.951 0.000 1.000
#> GSM62291     2  0.0000      0.951 0.000 1.000
#> GSM62265     2  0.8813      0.570 0.300 0.700
#> GSM62266     1  0.6531      0.834 0.832 0.168
#> GSM62296     2  0.0000      0.951 0.000 1.000
#> GSM62309     2  0.0000      0.951 0.000 1.000
#> GSM62295     2  0.0000      0.951 0.000 1.000
#> GSM62300     2  0.0000      0.951 0.000 1.000
#> GSM62308     2  0.0000      0.951 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
#> GSM62248     2  0.1411      0.904 0.036 0.964 0.000
#> GSM62256     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62259     2  0.0237      0.929 0.004 0.996 0.000
#> GSM62267     1  0.7181     -0.429 0.508 0.024 0.468
#> GSM62280     1  0.6151      0.615 0.772 0.160 0.068
#> GSM62284     3  0.5785      0.703 0.332 0.000 0.668
#> GSM62289     2  0.1964      0.885 0.056 0.944 0.000
#> GSM62307     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62316     2  0.1411      0.904 0.036 0.964 0.000
#> GSM62254     2  0.0592      0.924 0.012 0.988 0.000
#> GSM62292     2  0.0592      0.924 0.012 0.988 0.000
#> GSM62253     3  0.6180      0.616 0.416 0.000 0.584
#> GSM62270     3  0.0000      0.719 0.000 0.000 1.000
#> GSM62278     3  0.3412      0.747 0.124 0.000 0.876
#> GSM62297     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62298     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62299     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62258     1  0.7021     -0.383 0.544 0.020 0.436
#> GSM62281     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62294     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62305     2  0.6154      0.257 0.408 0.592 0.000
#> GSM62306     2  0.6154      0.257 0.408 0.592 0.000
#> GSM62310     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62317     1  0.5926      0.507 0.644 0.356 0.000
#> GSM62318     1  0.6402      0.619 0.744 0.200 0.056
#> GSM62321     1  0.5926      0.507 0.644 0.356 0.000
#> GSM62322     3  0.0000      0.719 0.000 0.000 1.000
#> GSM62250     2  0.6095      0.297 0.392 0.608 0.000
#> GSM62252     2  0.6095      0.297 0.392 0.608 0.000
#> GSM62255     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62260     1  0.3499      0.565 0.900 0.072 0.028
#> GSM62261     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62262     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62264     1  0.5348      0.614 0.796 0.176 0.028
#> GSM62268     3  0.5905      0.686 0.352 0.000 0.648
#> GSM62269     3  0.0000      0.719 0.000 0.000 1.000
#> GSM62271     3  0.3412      0.747 0.124 0.000 0.876
#> GSM62272     3  0.0000      0.719 0.000 0.000 1.000
#> GSM62273     2  0.0592      0.924 0.012 0.988 0.000
#> GSM62274     3  0.5431      0.730 0.284 0.000 0.716
#> GSM62275     3  0.0000      0.719 0.000 0.000 1.000
#> GSM62276     1  0.7181     -0.429 0.508 0.024 0.468
#> GSM62277     3  0.5431      0.730 0.284 0.000 0.716
#> GSM62279     3  0.6625      0.569 0.440 0.008 0.552
#> GSM62282     3  0.6274      0.474 0.456 0.000 0.544
#> GSM62283     1  0.3112      0.569 0.900 0.096 0.004
#> GSM62286     2  0.6095      0.297 0.392 0.608 0.000
#> GSM62287     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62288     2  0.1411      0.904 0.036 0.964 0.000
#> GSM62290     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62293     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62301     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62302     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62312     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62313     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62314     2  0.1411      0.904 0.036 0.964 0.000
#> GSM62319     2  0.5706      0.468 0.320 0.680 0.000
#> GSM62320     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62249     1  0.3112      0.569 0.900 0.096 0.004
#> GSM62251     1  0.7945      0.587 0.652 0.224 0.124
#> GSM62263     1  0.5733      0.575 0.676 0.324 0.000
#> GSM62285     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62315     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62291     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62265     1  0.4087      0.524 0.880 0.068 0.052
#> GSM62266     3  0.6180      0.616 0.416 0.000 0.584
#> GSM62296     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62309     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62295     2  0.0424      0.926 0.008 0.992 0.000
#> GSM62300     2  0.0000      0.931 0.000 1.000 0.000
#> GSM62308     2  0.0000      0.931 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
#> GSM62248     2  0.1706      0.903 0.000 0.948 0.016 0.036
#> GSM62256     2  0.0188      0.930 0.000 0.996 0.004 0.000
#> GSM62259     2  0.0336      0.929 0.000 0.992 0.008 0.000
#> GSM62267     1  0.3107      0.653 0.884 0.000 0.036 0.080
#> GSM62280     4  0.7474      0.500 0.280 0.000 0.220 0.500
#> GSM62284     1  0.2216      0.663 0.908 0.000 0.092 0.000
#> GSM62289     2  0.2328      0.884 0.004 0.924 0.016 0.056
#> GSM62307     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62316     2  0.1706      0.903 0.000 0.948 0.016 0.036
#> GSM62254     2  0.0921      0.920 0.000 0.972 0.028 0.000
#> GSM62292     2  0.0921      0.920 0.000 0.972 0.028 0.000
#> GSM62253     1  0.0657      0.707 0.984 0.000 0.004 0.012
#> GSM62270     3  0.4624      1.000 0.340 0.000 0.660 0.000
#> GSM62278     1  0.4406      0.161 0.700 0.000 0.300 0.000
#> GSM62297     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62298     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62258     1  0.4139      0.613 0.816 0.000 0.040 0.144
#> GSM62281     2  0.0188      0.930 0.000 0.996 0.004 0.000
#> GSM62294     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62305     2  0.7581      0.343 0.268 0.572 0.036 0.124
#> GSM62306     2  0.7581      0.343 0.268 0.572 0.036 0.124
#> GSM62310     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62311     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62317     4  0.5691      0.520 0.000 0.048 0.304 0.648
#> GSM62318     4  0.6941      0.552 0.192 0.000 0.220 0.588
#> GSM62321     4  0.5691      0.520 0.000 0.048 0.304 0.648
#> GSM62322     3  0.4624      1.000 0.340 0.000 0.660 0.000
#> GSM62250     2  0.7678      0.375 0.200 0.584 0.036 0.180
#> GSM62252     2  0.7678      0.375 0.200 0.584 0.036 0.180
#> GSM62255     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62257     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62260     4  0.6024      0.449 0.376 0.012 0.028 0.584
#> GSM62261     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62262     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62264     4  0.4194      0.576 0.172 0.000 0.028 0.800
#> GSM62268     1  0.2198      0.676 0.920 0.000 0.072 0.008
#> GSM62269     3  0.4624      1.000 0.340 0.000 0.660 0.000
#> GSM62271     1  0.4406      0.161 0.700 0.000 0.300 0.000
#> GSM62272     3  0.4624      1.000 0.340 0.000 0.660 0.000
#> GSM62273     2  0.0921      0.920 0.000 0.972 0.028 0.000
#> GSM62274     1  0.2921      0.607 0.860 0.000 0.140 0.000
#> GSM62275     3  0.4624      1.000 0.340 0.000 0.660 0.000
#> GSM62276     1  0.3107      0.653 0.884 0.000 0.036 0.080
#> GSM62277     1  0.2921      0.607 0.860 0.000 0.140 0.000
#> GSM62279     1  0.1211      0.701 0.960 0.000 0.000 0.040
#> GSM62282     1  0.5332      0.551 0.748 0.000 0.124 0.128
#> GSM62283     4  0.7338      0.329 0.420 0.072 0.032 0.476
#> GSM62286     2  0.7678      0.375 0.200 0.584 0.036 0.180
#> GSM62287     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62288     2  0.1706      0.903 0.000 0.948 0.016 0.036
#> GSM62290     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62293     2  0.0592      0.925 0.000 0.984 0.016 0.000
#> GSM62301     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62302     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62312     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62313     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62314     2  0.1706      0.903 0.000 0.948 0.016 0.036
#> GSM62319     2  0.6428      0.526 0.248 0.664 0.036 0.052
#> GSM62320     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62249     4  0.7338      0.329 0.420 0.072 0.032 0.476
#> GSM62251     4  0.5279      0.536 0.252 0.044 0.000 0.704
#> GSM62263     4  0.4686      0.547 0.068 0.144 0.000 0.788
#> GSM62285     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62265     1  0.6933     -0.373 0.464 0.044 0.032 0.460
#> GSM62266     1  0.0657      0.707 0.984 0.000 0.004 0.012
#> GSM62296     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62309     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62295     2  0.0817      0.922 0.000 0.976 0.024 0.000
#> GSM62300     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM62308     2  0.0000      0.932 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
#> GSM62248     4  0.1908     0.8637 0.000 0.000 0.000 0.908 0.092
#> GSM62256     4  0.0162     0.9248 0.000 0.000 0.000 0.996 0.004
#> GSM62259     4  0.0451     0.9218 0.000 0.000 0.004 0.988 0.008
#> GSM62267     1  0.4774     0.4341 0.540 0.004 0.012 0.000 0.444
#> GSM62280     2  0.5924     0.6152 0.156 0.608 0.004 0.000 0.232
#> GSM62284     1  0.2127     0.7228 0.892 0.000 0.108 0.000 0.000
#> GSM62289     4  0.2230     0.8411 0.000 0.000 0.000 0.884 0.116
#> GSM62307     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62316     4  0.1908     0.8637 0.000 0.000 0.000 0.908 0.092
#> GSM62254     4  0.0955     0.9113 0.000 0.000 0.004 0.968 0.028
#> GSM62292     4  0.0955     0.9113 0.000 0.000 0.004 0.968 0.028
#> GSM62253     1  0.1764     0.7191 0.928 0.000 0.008 0.000 0.064
#> GSM62270     3  0.0404     1.0000 0.012 0.000 0.988 0.000 0.000
#> GSM62278     1  0.4238     0.5394 0.628 0.004 0.368 0.000 0.000
#> GSM62297     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62298     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62299     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62258     1  0.4738     0.3975 0.564 0.012 0.004 0.000 0.420
#> GSM62281     4  0.0162     0.9248 0.000 0.000 0.000 0.996 0.004
#> GSM62294     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62305     4  0.4562     0.0504 0.000 0.000 0.008 0.496 0.496
#> GSM62306     5  0.4562    -0.1875 0.000 0.000 0.008 0.496 0.496
#> GSM62310     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62311     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62317     2  0.1331     0.7286 0.000 0.952 0.000 0.040 0.008
#> GSM62318     2  0.5229     0.6798 0.108 0.688 0.004 0.000 0.200
#> GSM62321     2  0.1331     0.7286 0.000 0.952 0.000 0.040 0.008
#> GSM62322     3  0.0404     1.0000 0.012 0.000 0.988 0.000 0.000
#> GSM62250     4  0.4538     0.2084 0.000 0.000 0.008 0.540 0.452
#> GSM62252     4  0.4538     0.2084 0.000 0.000 0.008 0.540 0.452
#> GSM62255     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62257     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62260     5  0.3961     0.3294 0.032 0.184 0.004 0.000 0.780
#> GSM62261     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62262     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62264     5  0.5218     0.0297 0.036 0.424 0.004 0.000 0.536
#> GSM62268     1  0.1732     0.7261 0.920 0.000 0.080 0.000 0.000
#> GSM62269     3  0.0404     1.0000 0.012 0.000 0.988 0.000 0.000
#> GSM62271     1  0.4238     0.5394 0.628 0.004 0.368 0.000 0.000
#> GSM62272     3  0.0404     1.0000 0.012 0.000 0.988 0.000 0.000
#> GSM62273     4  0.0955     0.9113 0.000 0.000 0.004 0.968 0.028
#> GSM62274     1  0.2690     0.7115 0.844 0.000 0.156 0.000 0.000
#> GSM62275     3  0.0404     1.0000 0.012 0.000 0.988 0.000 0.000
#> GSM62276     1  0.4774     0.4341 0.540 0.004 0.012 0.000 0.444
#> GSM62277     1  0.2690     0.7115 0.844 0.000 0.156 0.000 0.000
#> GSM62279     1  0.1965     0.7068 0.904 0.000 0.000 0.000 0.096
#> GSM62282     1  0.6839     0.4378 0.568 0.056 0.144 0.000 0.232
#> GSM62283     5  0.1564     0.4961 0.024 0.004 0.000 0.024 0.948
#> GSM62286     4  0.4538     0.2084 0.000 0.000 0.008 0.540 0.452
#> GSM62287     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62288     4  0.1908     0.8637 0.000 0.000 0.000 0.908 0.092
#> GSM62290     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62293     4  0.0510     0.9191 0.000 0.000 0.000 0.984 0.016
#> GSM62301     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62302     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62303     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62304     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62312     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62313     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62314     4  0.1908     0.8637 0.000 0.000 0.000 0.908 0.092
#> GSM62319     4  0.4425     0.3579 0.000 0.000 0.008 0.600 0.392
#> GSM62320     4  0.0000     0.9259 0.000 0.000 0.000 1.000 0.000
#> GSM62249     5  0.1564     0.4961 0.024 0.004 0.000 0.024 0.948
#> GSM62251     5  0.6035     0.1706 0.132 0.340 0.000 0.000 0.528
#> GSM62263     5  0.5787     0.2274 0.004 0.340 0.000 0.092 0.564
#> GSM62285     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62315     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62291     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62265     5  0.1768     0.4718 0.072 0.004 0.000 0.000 0.924
#> GSM62266     1  0.1764     0.7191 0.928 0.000 0.008 0.000 0.064
#> GSM62296     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62309     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62295     4  0.0865     0.9136 0.000 0.000 0.004 0.972 0.024
#> GSM62300     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000
#> GSM62308     4  0.0162     0.9256 0.000 0.004 0.000 0.996 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     4  0.3738     0.7799 0.020 0.132 0.000 0.800 0.048 0.000
#> GSM62256     4  0.1116     0.8591 0.004 0.028 0.000 0.960 0.000 0.008
#> GSM62259     4  0.1667     0.8524 0.004 0.044 0.000 0.936 0.008 0.008
#> GSM62267     1  0.2715     0.2853 0.860 0.024 0.004 0.000 0.112 0.000
#> GSM62280     6  0.3290     0.6413 0.252 0.000 0.000 0.000 0.004 0.744
#> GSM62284     1  0.5300    -0.4833 0.516 0.376 0.108 0.000 0.000 0.000
#> GSM62289     4  0.4128     0.7542 0.020 0.148 0.000 0.768 0.064 0.000
#> GSM62307     4  0.0520     0.8585 0.000 0.008 0.000 0.984 0.000 0.008
#> GSM62316     4  0.3738     0.7799 0.020 0.132 0.000 0.800 0.048 0.000
#> GSM62254     4  0.2265     0.8388 0.024 0.068 0.000 0.900 0.008 0.000
#> GSM62292     4  0.2265     0.8388 0.024 0.068 0.000 0.900 0.008 0.000
#> GSM62253     2  0.4783     0.9044 0.420 0.536 0.008 0.000 0.036 0.000
#> GSM62270     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     1  0.3911     0.2466 0.624 0.008 0.368 0.000 0.000 0.000
#> GSM62297     4  0.1124     0.8547 0.000 0.008 0.000 0.956 0.000 0.036
#> GSM62298     4  0.1176     0.8549 0.000 0.020 0.000 0.956 0.000 0.024
#> GSM62299     4  0.1088     0.8557 0.000 0.016 0.000 0.960 0.000 0.024
#> GSM62258     1  0.3447     0.3023 0.804 0.004 0.000 0.000 0.044 0.148
#> GSM62281     4  0.1116     0.8591 0.004 0.028 0.000 0.960 0.000 0.008
#> GSM62294     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62305     4  0.7471    -0.1560 0.296 0.164 0.000 0.352 0.188 0.000
#> GSM62306     4  0.7471    -0.1560 0.296 0.164 0.000 0.352 0.188 0.000
#> GSM62310     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62311     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62317     6  0.2805     0.7340 0.000 0.184 0.000 0.000 0.004 0.812
#> GSM62318     6  0.2632     0.6986 0.164 0.000 0.000 0.000 0.004 0.832
#> GSM62321     6  0.2805     0.7340 0.000 0.184 0.000 0.000 0.004 0.812
#> GSM62322     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     4  0.7343     0.0778 0.168 0.168 0.000 0.404 0.260 0.000
#> GSM62252     4  0.7343     0.0778 0.168 0.168 0.000 0.404 0.260 0.000
#> GSM62255     4  0.0363     0.8587 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM62257     4  0.0520     0.8585 0.000 0.008 0.000 0.984 0.000 0.008
#> GSM62260     5  0.4681     0.6226 0.176 0.016 0.000 0.000 0.712 0.096
#> GSM62261     4  0.0865     0.8558 0.000 0.000 0.000 0.964 0.000 0.036
#> GSM62262     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62264     5  0.3313     0.4980 0.004 0.036 0.000 0.000 0.812 0.148
#> GSM62268     2  0.5077     0.7655 0.404 0.516 0.080 0.000 0.000 0.000
#> GSM62269     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     1  0.3911     0.2466 0.624 0.008 0.368 0.000 0.000 0.000
#> GSM62272     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     4  0.2878     0.8103 0.024 0.100 0.000 0.860 0.016 0.000
#> GSM62274     1  0.5564    -0.3482 0.516 0.328 0.156 0.000 0.000 0.000
#> GSM62275     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     1  0.2715     0.2853 0.860 0.024 0.004 0.000 0.112 0.000
#> GSM62277     1  0.5564    -0.3482 0.516 0.328 0.156 0.000 0.000 0.000
#> GSM62279     2  0.4763     0.8561 0.412 0.536 0.000 0.000 0.052 0.000
#> GSM62282     1  0.5082     0.2948 0.660 0.004 0.140 0.000 0.004 0.192
#> GSM62283     5  0.3710     0.6690 0.292 0.012 0.000 0.000 0.696 0.000
#> GSM62286     4  0.7343     0.0778 0.168 0.168 0.000 0.404 0.260 0.000
#> GSM62287     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62288     4  0.3738     0.7799 0.020 0.132 0.000 0.800 0.048 0.000
#> GSM62290     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036
#> GSM62293     4  0.1779     0.8470 0.016 0.064 0.000 0.920 0.000 0.000
#> GSM62301     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036
#> GSM62302     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62303     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62304     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62312     4  0.1010     0.8553 0.000 0.004 0.000 0.960 0.000 0.036
#> GSM62313     4  0.1327     0.8501 0.000 0.064 0.000 0.936 0.000 0.000
#> GSM62314     4  0.3738     0.7799 0.020 0.132 0.000 0.800 0.048 0.000
#> GSM62319     4  0.6832     0.2073 0.272 0.152 0.000 0.476 0.100 0.000
#> GSM62320     4  0.0820     0.8571 0.000 0.016 0.000 0.972 0.000 0.012
#> GSM62249     5  0.3710     0.6690 0.292 0.012 0.000 0.000 0.696 0.000
#> GSM62251     5  0.4658     0.5044 0.140 0.068 0.000 0.000 0.740 0.052
#> GSM62263     5  0.3649     0.5465 0.004 0.080 0.000 0.036 0.828 0.052
#> GSM62285     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036
#> GSM62315     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036
#> GSM62291     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036
#> GSM62265     5  0.4092     0.6547 0.344 0.020 0.000 0.000 0.636 0.000
#> GSM62266     2  0.4783     0.9044 0.420 0.536 0.008 0.000 0.036 0.000
#> GSM62296     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036
#> GSM62309     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036
#> GSM62295     4  0.2747     0.8155 0.020 0.096 0.000 0.868 0.016 0.000
#> GSM62300     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036
#> GSM62308     4  0.1408     0.8520 0.000 0.020 0.000 0.944 0.000 0.036

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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) other(p) genotype/variation(p) k
#> CV:hclust 75           0.2472    0.737                 0.442 2
#> CV:hclust 65           0.1933    0.297                 0.228 3
#> CV:hclust 64           0.5054    0.281                 0.749 4
#> CV:hclust 58           0.4937    0.236                 0.980 5
#> CV:hclust 59           0.0474    0.346                 0.371 6

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


CV:kmeans**

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

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

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

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

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.990       0.996         0.4537 0.550   0.550
#> 3 3 0.663           0.772       0.822         0.2884 0.882   0.792
#> 4 4 0.643           0.872       0.873         0.1843 0.789   0.562
#> 5 5 0.696           0.718       0.801         0.1095 0.919   0.720
#> 6 6 0.795           0.656       0.827         0.0634 0.942   0.745

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM62248     2   0.000      0.994 0.000 1.000
#> GSM62256     2   0.000      0.994 0.000 1.000
#> GSM62259     2   0.000      0.994 0.000 1.000
#> GSM62267     1   0.000      1.000 1.000 0.000
#> GSM62280     1   0.000      1.000 1.000 0.000
#> GSM62284     1   0.000      1.000 1.000 0.000
#> GSM62289     2   0.000      0.994 0.000 1.000
#> GSM62307     2   0.000      0.994 0.000 1.000
#> GSM62316     2   0.000      0.994 0.000 1.000
#> GSM62254     2   0.000      0.994 0.000 1.000
#> GSM62292     2   0.000      0.994 0.000 1.000
#> GSM62253     1   0.000      1.000 1.000 0.000
#> GSM62270     1   0.000      1.000 1.000 0.000
#> GSM62278     1   0.000      1.000 1.000 0.000
#> GSM62297     2   0.000      0.994 0.000 1.000
#> GSM62298     2   0.000      0.994 0.000 1.000
#> GSM62299     2   0.000      0.994 0.000 1.000
#> GSM62258     1   0.000      1.000 1.000 0.000
#> GSM62281     2   0.000      0.994 0.000 1.000
#> GSM62294     2   0.000      0.994 0.000 1.000
#> GSM62305     2   0.000      0.994 0.000 1.000
#> GSM62306     2   0.000      0.994 0.000 1.000
#> GSM62310     2   0.000      0.994 0.000 1.000
#> GSM62311     2   0.000      0.994 0.000 1.000
#> GSM62317     2   0.000      0.994 0.000 1.000
#> GSM62318     1   0.000      1.000 1.000 0.000
#> GSM62321     2   0.891      0.555 0.308 0.692
#> GSM62322     1   0.000      1.000 1.000 0.000
#> GSM62250     2   0.000      0.994 0.000 1.000
#> GSM62252     2   0.000      0.994 0.000 1.000
#> GSM62255     2   0.000      0.994 0.000 1.000
#> GSM62257     2   0.000      0.994 0.000 1.000
#> GSM62260     1   0.000      1.000 1.000 0.000
#> GSM62261     2   0.000      0.994 0.000 1.000
#> GSM62262     2   0.000      0.994 0.000 1.000
#> GSM62264     1   0.000      1.000 1.000 0.000
#> GSM62268     1   0.000      1.000 1.000 0.000
#> GSM62269     1   0.000      1.000 1.000 0.000
#> GSM62271     1   0.000      1.000 1.000 0.000
#> GSM62272     1   0.000      1.000 1.000 0.000
#> GSM62273     2   0.000      0.994 0.000 1.000
#> GSM62274     1   0.000      1.000 1.000 0.000
#> GSM62275     1   0.000      1.000 1.000 0.000
#> GSM62276     1   0.000      1.000 1.000 0.000
#> GSM62277     1   0.000      1.000 1.000 0.000
#> GSM62279     1   0.000      1.000 1.000 0.000
#> GSM62282     1   0.000      1.000 1.000 0.000
#> GSM62283     1   0.000      1.000 1.000 0.000
#> GSM62286     2   0.000      0.994 0.000 1.000
#> GSM62287     2   0.000      0.994 0.000 1.000
#> GSM62288     2   0.000      0.994 0.000 1.000
#> GSM62290     2   0.000      0.994 0.000 1.000
#> GSM62293     2   0.000      0.994 0.000 1.000
#> GSM62301     2   0.000      0.994 0.000 1.000
#> GSM62302     2   0.000      0.994 0.000 1.000
#> GSM62303     2   0.000      0.994 0.000 1.000
#> GSM62304     2   0.000      0.994 0.000 1.000
#> GSM62312     2   0.000      0.994 0.000 1.000
#> GSM62313     2   0.000      0.994 0.000 1.000
#> GSM62314     2   0.000      0.994 0.000 1.000
#> GSM62319     2   0.000      0.994 0.000 1.000
#> GSM62320     2   0.000      0.994 0.000 1.000
#> GSM62249     2   0.000      0.994 0.000 1.000
#> GSM62251     1   0.000      1.000 1.000 0.000
#> GSM62263     2   0.000      0.994 0.000 1.000
#> GSM62285     2   0.000      0.994 0.000 1.000
#> GSM62315     2   0.000      0.994 0.000 1.000
#> GSM62291     2   0.000      0.994 0.000 1.000
#> GSM62265     1   0.000      1.000 1.000 0.000
#> GSM62266     1   0.000      1.000 1.000 0.000
#> GSM62296     2   0.000      0.994 0.000 1.000
#> GSM62309     2   0.000      0.994 0.000 1.000
#> GSM62295     2   0.000      0.994 0.000 1.000
#> GSM62300     2   0.000      0.994 0.000 1.000
#> GSM62308     2   0.000      0.994 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.5431      0.854 0.000 0.716 0.284
#> GSM62256     2  0.5254      0.853 0.000 0.736 0.264
#> GSM62259     2  0.5859      0.857 0.000 0.656 0.344
#> GSM62267     1  0.1031      0.718 0.976 0.000 0.024
#> GSM62280     1  0.1529      0.722 0.960 0.000 0.040
#> GSM62284     1  0.6235     -0.660 0.564 0.000 0.436
#> GSM62289     2  0.5678      0.856 0.000 0.684 0.316
#> GSM62307     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62316     2  0.5760      0.857 0.000 0.672 0.328
#> GSM62254     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62292     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62253     1  0.1753      0.689 0.952 0.000 0.048
#> GSM62270     3  0.6168      1.000 0.412 0.000 0.588
#> GSM62278     3  0.6168      1.000 0.412 0.000 0.588
#> GSM62297     2  0.0000      0.768 0.000 1.000 0.000
#> GSM62298     2  0.2537      0.787 0.000 0.920 0.080
#> GSM62299     2  0.0000      0.768 0.000 1.000 0.000
#> GSM62258     1  0.0000      0.727 1.000 0.000 0.000
#> GSM62281     2  0.5254      0.853 0.000 0.736 0.264
#> GSM62294     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62305     2  0.7394      0.816 0.064 0.652 0.284
#> GSM62306     2  0.5465      0.855 0.000 0.712 0.288
#> GSM62310     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62311     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62317     2  0.2773      0.705 0.024 0.928 0.048
#> GSM62318     1  0.1529      0.722 0.960 0.000 0.040
#> GSM62321     1  0.7442      0.412 0.604 0.348 0.048
#> GSM62322     3  0.6168      1.000 0.412 0.000 0.588
#> GSM62250     2  0.7637      0.810 0.076 0.640 0.284
#> GSM62252     1  0.8777      0.291 0.564 0.148 0.288
#> GSM62255     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62257     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62260     1  0.5847      0.584 0.780 0.172 0.048
#> GSM62261     2  0.5733      0.857 0.000 0.676 0.324
#> GSM62262     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62264     1  0.4930      0.637 0.836 0.120 0.044
#> GSM62268     1  0.4399      0.365 0.812 0.000 0.188
#> GSM62269     3  0.6168      1.000 0.412 0.000 0.588
#> GSM62271     1  0.0892      0.720 0.980 0.000 0.020
#> GSM62272     3  0.6168      1.000 0.412 0.000 0.588
#> GSM62273     2  0.5254      0.851 0.000 0.736 0.264
#> GSM62274     3  0.6168      1.000 0.412 0.000 0.588
#> GSM62275     3  0.6168      1.000 0.412 0.000 0.588
#> GSM62276     1  0.1031      0.718 0.976 0.000 0.024
#> GSM62277     3  0.6168      1.000 0.412 0.000 0.588
#> GSM62279     1  0.1031      0.718 0.976 0.000 0.024
#> GSM62282     1  0.1643      0.725 0.956 0.000 0.044
#> GSM62283     1  0.1170      0.726 0.976 0.016 0.008
#> GSM62286     2  0.5431      0.854 0.000 0.716 0.284
#> GSM62287     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62288     2  0.5733      0.857 0.000 0.676 0.324
#> GSM62290     2  0.0000      0.768 0.000 1.000 0.000
#> GSM62293     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62301     2  0.0424      0.770 0.000 0.992 0.008
#> GSM62302     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62303     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62304     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62312     2  0.0747      0.773 0.000 0.984 0.016
#> GSM62313     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62314     2  0.5760      0.857 0.000 0.672 0.328
#> GSM62319     2  0.0424      0.763 0.000 0.992 0.008
#> GSM62320     2  0.2537      0.787 0.000 0.920 0.080
#> GSM62249     1  0.6527      0.378 0.588 0.404 0.008
#> GSM62251     1  0.2261      0.698 0.932 0.068 0.000
#> GSM62263     2  0.1315      0.747 0.020 0.972 0.008
#> GSM62285     2  0.0424      0.770 0.000 0.992 0.008
#> GSM62315     2  0.0424      0.763 0.000 0.992 0.008
#> GSM62291     2  0.0000      0.768 0.000 1.000 0.000
#> GSM62265     1  0.0237      0.726 0.996 0.000 0.004
#> GSM62266     1  0.1031      0.718 0.976 0.000 0.024
#> GSM62296     2  0.0424      0.763 0.000 0.992 0.008
#> GSM62309     2  0.0424      0.763 0.000 0.992 0.008
#> GSM62295     2  0.5968      0.855 0.000 0.636 0.364
#> GSM62300     2  0.0424      0.763 0.000 0.992 0.008
#> GSM62308     2  0.0424      0.763 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
#> GSM62248     4  0.2814      0.865 0.000 0.132 0.000 0.868
#> GSM62256     4  0.2654      0.865 0.000 0.108 0.004 0.888
#> GSM62259     4  0.2125      0.880 0.000 0.076 0.004 0.920
#> GSM62267     1  0.2081      0.883 0.916 0.000 0.084 0.000
#> GSM62280     1  0.3074      0.812 0.848 0.152 0.000 0.000
#> GSM62284     3  0.4840      0.618 0.240 0.028 0.732 0.000
#> GSM62289     4  0.3427      0.851 0.028 0.112 0.000 0.860
#> GSM62307     4  0.1824      0.891 0.000 0.060 0.004 0.936
#> GSM62316     4  0.2530      0.879 0.000 0.112 0.000 0.888
#> GSM62254     4  0.0707      0.888 0.000 0.020 0.000 0.980
#> GSM62292     4  0.0707      0.888 0.000 0.020 0.000 0.980
#> GSM62253     1  0.3895      0.850 0.832 0.036 0.132 0.000
#> GSM62270     3  0.0188      0.957 0.004 0.000 0.996 0.000
#> GSM62278     3  0.0336      0.956 0.008 0.000 0.992 0.000
#> GSM62297     2  0.3791      0.930 0.000 0.796 0.004 0.200
#> GSM62298     2  0.4220      0.936 0.000 0.748 0.004 0.248
#> GSM62299     2  0.4088      0.946 0.000 0.764 0.004 0.232
#> GSM62258     1  0.2586      0.884 0.912 0.012 0.068 0.008
#> GSM62281     4  0.2593      0.867 0.000 0.104 0.004 0.892
#> GSM62294     4  0.0921      0.894 0.000 0.028 0.000 0.972
#> GSM62305     4  0.5707      0.720 0.144 0.124 0.004 0.728
#> GSM62306     4  0.2773      0.863 0.000 0.116 0.004 0.880
#> GSM62310     4  0.1474      0.889 0.000 0.052 0.000 0.948
#> GSM62311     4  0.1389      0.891 0.000 0.048 0.000 0.952
#> GSM62317     2  0.3900      0.709 0.084 0.844 0.000 0.072
#> GSM62318     1  0.3356      0.809 0.824 0.176 0.000 0.000
#> GSM62321     1  0.3400      0.801 0.820 0.180 0.000 0.000
#> GSM62322     3  0.0188      0.957 0.004 0.000 0.996 0.000
#> GSM62250     4  0.5528      0.720 0.144 0.124 0.000 0.732
#> GSM62252     4  0.6127      0.616 0.228 0.108 0.000 0.664
#> GSM62255     4  0.1576      0.891 0.000 0.048 0.004 0.948
#> GSM62257     4  0.1576      0.895 0.000 0.048 0.004 0.948
#> GSM62260     1  0.1474      0.858 0.948 0.052 0.000 0.000
#> GSM62261     4  0.2647      0.874 0.000 0.120 0.000 0.880
#> GSM62262     4  0.0921      0.894 0.000 0.028 0.000 0.972
#> GSM62264     1  0.1867      0.861 0.928 0.072 0.000 0.000
#> GSM62268     1  0.5577      0.563 0.636 0.036 0.328 0.000
#> GSM62269     3  0.0188      0.957 0.004 0.000 0.996 0.000
#> GSM62271     1  0.2480      0.882 0.904 0.008 0.088 0.000
#> GSM62272     3  0.0188      0.957 0.004 0.000 0.996 0.000
#> GSM62273     4  0.3908      0.708 0.000 0.212 0.004 0.784
#> GSM62274     3  0.1389      0.929 0.048 0.000 0.952 0.000
#> GSM62275     3  0.0188      0.957 0.004 0.000 0.996 0.000
#> GSM62276     1  0.2081      0.883 0.916 0.000 0.084 0.000
#> GSM62277     3  0.0469      0.954 0.012 0.000 0.988 0.000
#> GSM62279     1  0.2542      0.882 0.904 0.012 0.084 0.000
#> GSM62282     1  0.3787      0.835 0.840 0.124 0.036 0.000
#> GSM62283     1  0.2695      0.880 0.912 0.024 0.056 0.008
#> GSM62286     4  0.3991      0.829 0.048 0.120 0.000 0.832
#> GSM62287     4  0.0921      0.894 0.000 0.028 0.000 0.972
#> GSM62288     4  0.2647      0.874 0.000 0.120 0.000 0.880
#> GSM62290     2  0.3907      0.947 0.000 0.768 0.000 0.232
#> GSM62293     4  0.0336      0.892 0.000 0.008 0.000 0.992
#> GSM62301     2  0.3942      0.945 0.000 0.764 0.000 0.236
#> GSM62302     4  0.1389      0.891 0.000 0.048 0.000 0.952
#> GSM62303     4  0.0707      0.894 0.000 0.020 0.000 0.980
#> GSM62304     4  0.1389      0.891 0.000 0.048 0.000 0.952
#> GSM62312     2  0.4155      0.942 0.000 0.756 0.004 0.240
#> GSM62313     4  0.1389      0.891 0.000 0.048 0.000 0.952
#> GSM62314     4  0.2530      0.877 0.000 0.112 0.000 0.888
#> GSM62319     2  0.4610      0.875 0.020 0.744 0.000 0.236
#> GSM62320     2  0.4220      0.936 0.000 0.748 0.004 0.248
#> GSM62249     1  0.4508      0.727 0.780 0.184 0.000 0.036
#> GSM62251     1  0.3168      0.880 0.884 0.060 0.056 0.000
#> GSM62263     2  0.3899      0.831 0.052 0.840 0.000 0.108
#> GSM62285     2  0.3942      0.945 0.000 0.764 0.000 0.236
#> GSM62315     2  0.3907      0.947 0.000 0.768 0.000 0.232
#> GSM62291     2  0.3907      0.947 0.000 0.768 0.000 0.232
#> GSM62265     1  0.3082      0.878 0.884 0.032 0.084 0.000
#> GSM62266     1  0.3557      0.867 0.856 0.036 0.108 0.000
#> GSM62296     2  0.3726      0.943 0.000 0.788 0.000 0.212
#> GSM62309     2  0.3688      0.941 0.000 0.792 0.000 0.208
#> GSM62295     4  0.0895      0.889 0.000 0.020 0.004 0.976
#> GSM62300     2  0.3726      0.943 0.000 0.788 0.000 0.212
#> GSM62308     2  0.3726      0.943 0.000 0.788 0.000 0.212

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     5  0.4855     0.5919 0.000 0.024 0.000 0.424 0.552
#> GSM62256     5  0.4964     0.5452 0.000 0.020 0.004 0.460 0.516
#> GSM62259     4  0.4449     0.2655 0.000 0.020 0.004 0.688 0.288
#> GSM62267     1  0.4995     0.8174 0.584 0.004 0.028 0.000 0.384
#> GSM62280     1  0.1697     0.6228 0.932 0.060 0.000 0.000 0.008
#> GSM62284     3  0.6381     0.3573 0.240 0.024 0.588 0.000 0.148
#> GSM62289     5  0.4630     0.6371 0.000 0.016 0.000 0.396 0.588
#> GSM62307     4  0.0609     0.7769 0.000 0.020 0.000 0.980 0.000
#> GSM62316     4  0.4338     0.3197 0.000 0.024 0.000 0.696 0.280
#> GSM62254     4  0.3544     0.5108 0.000 0.008 0.004 0.788 0.200
#> GSM62292     4  0.3544     0.5108 0.000 0.008 0.004 0.788 0.200
#> GSM62253     1  0.5620     0.8044 0.552 0.036 0.024 0.000 0.388
#> GSM62270     3  0.0162     0.9287 0.004 0.000 0.996 0.000 0.000
#> GSM62278     3  0.0162     0.9287 0.004 0.000 0.996 0.000 0.000
#> GSM62297     2  0.2863     0.8766 0.000 0.876 0.000 0.060 0.064
#> GSM62298     2  0.2179     0.9307 0.000 0.888 0.000 0.112 0.000
#> GSM62299     2  0.2179     0.9307 0.000 0.888 0.000 0.112 0.000
#> GSM62258     1  0.4613     0.8163 0.620 0.000 0.020 0.000 0.360
#> GSM62281     5  0.5050     0.4936 0.000 0.024 0.004 0.476 0.496
#> GSM62294     4  0.0162     0.7797 0.000 0.004 0.000 0.996 0.000
#> GSM62305     5  0.4237     0.6358 0.016 0.016 0.004 0.200 0.764
#> GSM62306     5  0.4860     0.5853 0.000 0.016 0.004 0.440 0.540
#> GSM62310     4  0.0510     0.7777 0.000 0.016 0.000 0.984 0.000
#> GSM62311     4  0.0404     0.7808 0.000 0.012 0.000 0.988 0.000
#> GSM62317     2  0.4854     0.5147 0.340 0.628 0.000 0.028 0.004
#> GSM62318     1  0.1410     0.6226 0.940 0.060 0.000 0.000 0.000
#> GSM62321     1  0.2569     0.6050 0.892 0.068 0.000 0.000 0.040
#> GSM62322     3  0.0162     0.9287 0.004 0.000 0.996 0.000 0.000
#> GSM62250     5  0.3628     0.6382 0.000 0.012 0.000 0.216 0.772
#> GSM62252     5  0.3697     0.6156 0.016 0.008 0.000 0.180 0.796
#> GSM62255     4  0.0404     0.7808 0.000 0.012 0.000 0.988 0.000
#> GSM62257     4  0.0510     0.7795 0.000 0.016 0.000 0.984 0.000
#> GSM62260     1  0.4497     0.7813 0.632 0.016 0.000 0.000 0.352
#> GSM62261     4  0.4397     0.3278 0.000 0.028 0.000 0.696 0.276
#> GSM62262     4  0.0162     0.7797 0.000 0.004 0.000 0.996 0.000
#> GSM62264     1  0.5155     0.8004 0.596 0.052 0.000 0.000 0.352
#> GSM62268     1  0.7265     0.4960 0.460 0.036 0.276 0.000 0.228
#> GSM62269     3  0.0162     0.9287 0.004 0.000 0.996 0.000 0.000
#> GSM62271     1  0.4718     0.8182 0.628 0.000 0.028 0.000 0.344
#> GSM62272     3  0.0162     0.9287 0.004 0.000 0.996 0.000 0.000
#> GSM62273     4  0.6658    -0.0444 0.000 0.304 0.004 0.472 0.220
#> GSM62274     3  0.2867     0.8434 0.044 0.004 0.880 0.000 0.072
#> GSM62275     3  0.0162     0.9287 0.004 0.000 0.996 0.000 0.000
#> GSM62276     1  0.4846     0.8169 0.588 0.000 0.028 0.000 0.384
#> GSM62277     3  0.0960     0.9175 0.008 0.004 0.972 0.000 0.016
#> GSM62279     1  0.5468     0.8087 0.528 0.024 0.024 0.000 0.424
#> GSM62282     1  0.3238     0.6545 0.872 0.048 0.032 0.000 0.048
#> GSM62283     1  0.4171     0.8135 0.604 0.000 0.000 0.000 0.396
#> GSM62286     5  0.4630     0.6371 0.000 0.016 0.000 0.396 0.588
#> GSM62287     4  0.0162     0.7797 0.000 0.004 0.000 0.996 0.000
#> GSM62288     4  0.4584     0.2104 0.000 0.028 0.000 0.660 0.312
#> GSM62290     2  0.2179     0.9307 0.000 0.888 0.000 0.112 0.000
#> GSM62293     4  0.0451     0.7673 0.000 0.004 0.000 0.988 0.008
#> GSM62301     2  0.2338     0.9304 0.000 0.884 0.000 0.112 0.004
#> GSM62302     4  0.0404     0.7808 0.000 0.012 0.000 0.988 0.000
#> GSM62303     4  0.0162     0.7797 0.000 0.004 0.000 0.996 0.000
#> GSM62304     4  0.0404     0.7808 0.000 0.012 0.000 0.988 0.000
#> GSM62312     2  0.2338     0.9304 0.000 0.884 0.000 0.112 0.004
#> GSM62313     4  0.0404     0.7808 0.000 0.012 0.000 0.988 0.000
#> GSM62314     4  0.4169     0.4200 0.000 0.028 0.000 0.732 0.240
#> GSM62319     2  0.5690     0.6418 0.020 0.672 0.004 0.092 0.212
#> GSM62320     2  0.2179     0.9307 0.000 0.888 0.000 0.112 0.000
#> GSM62249     5  0.3474     0.1743 0.116 0.044 0.000 0.004 0.836
#> GSM62251     1  0.5014     0.8026 0.536 0.032 0.000 0.000 0.432
#> GSM62263     2  0.4456     0.6492 0.004 0.716 0.000 0.032 0.248
#> GSM62285     2  0.2338     0.9304 0.000 0.884 0.000 0.112 0.004
#> GSM62315     2  0.2338     0.9304 0.000 0.884 0.000 0.112 0.004
#> GSM62291     2  0.2127     0.9302 0.000 0.892 0.000 0.108 0.000
#> GSM62265     1  0.5370     0.8076 0.544 0.020 0.024 0.000 0.412
#> GSM62266     1  0.5620     0.8044 0.552 0.036 0.024 0.000 0.388
#> GSM62296     2  0.2074     0.9291 0.000 0.896 0.000 0.104 0.000
#> GSM62309     2  0.2179     0.9267 0.000 0.896 0.000 0.100 0.004
#> GSM62295     4  0.3544     0.5108 0.000 0.008 0.004 0.788 0.200
#> GSM62300     2  0.2074     0.9291 0.000 0.896 0.000 0.104 0.000
#> GSM62308     2  0.2074     0.9291 0.000 0.896 0.000 0.104 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
#> GSM62248     5  0.2920     0.7679 0.000 0.008 0.000 0.128 0.844 0.020
#> GSM62256     5  0.4585     0.7315 0.000 0.016 0.000 0.144 0.728 0.112
#> GSM62259     4  0.5979    -0.0668 0.000 0.004 0.000 0.412 0.392 0.192
#> GSM62267     1  0.3852     0.7113 0.796 0.016 0.000 0.000 0.080 0.108
#> GSM62280     6  0.2969     0.7030 0.224 0.000 0.000 0.000 0.000 0.776
#> GSM62284     1  0.4653    -0.2247 0.484 0.020 0.484 0.000 0.012 0.000
#> GSM62289     5  0.2261     0.7873 0.000 0.004 0.000 0.104 0.884 0.008
#> GSM62307     4  0.1332     0.7653 0.000 0.012 0.000 0.952 0.008 0.028
#> GSM62316     4  0.4565    -0.0977 0.000 0.008 0.000 0.496 0.476 0.020
#> GSM62254     4  0.5177     0.4019 0.000 0.000 0.000 0.612 0.236 0.152
#> GSM62292     4  0.5177     0.4019 0.000 0.000 0.000 0.612 0.236 0.152
#> GSM62253     1  0.1251     0.7063 0.956 0.024 0.000 0.000 0.012 0.008
#> GSM62270     3  0.0146     0.9368 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62278     3  0.0458     0.9316 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM62297     2  0.1838     0.8301 0.000 0.928 0.000 0.012 0.040 0.020
#> GSM62298     2  0.1549     0.8625 0.000 0.936 0.000 0.044 0.000 0.020
#> GSM62299     2  0.1549     0.8625 0.000 0.936 0.000 0.044 0.000 0.020
#> GSM62258     1  0.4191     0.6740 0.752 0.008 0.000 0.000 0.084 0.156
#> GSM62281     5  0.5029     0.6852 0.000 0.016 0.000 0.156 0.680 0.148
#> GSM62294     4  0.0260     0.7757 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM62305     5  0.3033     0.7424 0.032 0.004 0.000 0.012 0.856 0.096
#> GSM62306     5  0.4002     0.7545 0.000 0.004 0.000 0.132 0.768 0.096
#> GSM62310     4  0.0551     0.7751 0.000 0.008 0.000 0.984 0.004 0.004
#> GSM62311     4  0.0508     0.7758 0.000 0.012 0.000 0.984 0.004 0.000
#> GSM62317     6  0.4088     0.2618 0.000 0.368 0.000 0.000 0.016 0.616
#> GSM62318     6  0.2969     0.7030 0.224 0.000 0.000 0.000 0.000 0.776
#> GSM62321     6  0.3660     0.6773 0.160 0.000 0.000 0.000 0.060 0.780
#> GSM62322     3  0.0146     0.9368 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62250     5  0.1413     0.7622 0.036 0.004 0.000 0.008 0.948 0.004
#> GSM62252     5  0.1413     0.7622 0.036 0.004 0.000 0.008 0.948 0.004
#> GSM62255     4  0.0508     0.7760 0.000 0.012 0.000 0.984 0.000 0.004
#> GSM62257     4  0.1364     0.7667 0.000 0.012 0.000 0.952 0.016 0.020
#> GSM62260     1  0.5584     0.4373 0.580 0.016 0.000 0.000 0.128 0.276
#> GSM62261     4  0.4933    -0.0913 0.000 0.020 0.004 0.492 0.464 0.020
#> GSM62262     4  0.1049     0.7646 0.000 0.008 0.000 0.960 0.000 0.032
#> GSM62264     1  0.3313     0.6037 0.820 0.016 0.000 0.000 0.024 0.140
#> GSM62268     1  0.3474     0.5681 0.816 0.024 0.140 0.000 0.012 0.008
#> GSM62269     3  0.0146     0.9368 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62271     1  0.4124     0.6784 0.764 0.008 0.004 0.000 0.068 0.156
#> GSM62272     3  0.0146     0.9368 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62273     2  0.7661    -0.1467 0.000 0.288 0.000 0.252 0.276 0.184
#> GSM62274     3  0.4096     0.5994 0.268 0.020 0.700 0.000 0.012 0.000
#> GSM62275     3  0.0146     0.9368 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62276     1  0.3715     0.7100 0.800 0.008 0.000 0.000 0.084 0.108
#> GSM62277     3  0.2103     0.8848 0.056 0.020 0.912 0.000 0.012 0.000
#> GSM62279     1  0.1895     0.7333 0.912 0.016 0.000 0.000 0.072 0.000
#> GSM62282     6  0.4704     0.4402 0.352 0.008 0.004 0.000 0.032 0.604
#> GSM62283     1  0.4222     0.6976 0.764 0.016 0.000 0.000 0.100 0.120
#> GSM62286     5  0.1806     0.7926 0.000 0.004 0.000 0.088 0.908 0.000
#> GSM62287     4  0.0405     0.7760 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM62288     5  0.4542     0.1597 0.000 0.008 0.000 0.440 0.532 0.020
#> GSM62290     2  0.1007     0.8666 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM62293     4  0.1829     0.7414 0.000 0.004 0.000 0.920 0.012 0.064
#> GSM62301     2  0.1152     0.8664 0.000 0.952 0.004 0.044 0.000 0.000
#> GSM62302     4  0.0551     0.7760 0.000 0.008 0.000 0.984 0.004 0.004
#> GSM62303     4  0.0405     0.7754 0.000 0.008 0.000 0.988 0.000 0.004
#> GSM62304     4  0.0653     0.7755 0.000 0.012 0.000 0.980 0.004 0.004
#> GSM62312     2  0.1296     0.8658 0.000 0.948 0.004 0.044 0.000 0.004
#> GSM62313     4  0.0508     0.7758 0.000 0.012 0.000 0.984 0.004 0.000
#> GSM62314     4  0.4546     0.0055 0.000 0.008 0.000 0.528 0.444 0.020
#> GSM62319     2  0.6407     0.3197 0.000 0.500 0.000 0.044 0.276 0.180
#> GSM62320     2  0.1713     0.8591 0.000 0.928 0.000 0.044 0.000 0.028
#> GSM62249     5  0.3712     0.5098 0.232 0.012 0.000 0.000 0.744 0.012
#> GSM62251     1  0.1679     0.7127 0.936 0.016 0.000 0.000 0.036 0.012
#> GSM62263     2  0.4820     0.1804 0.012 0.532 0.000 0.004 0.428 0.024
#> GSM62285     2  0.1152     0.8664 0.000 0.952 0.004 0.044 0.000 0.000
#> GSM62315     2  0.1152     0.8664 0.000 0.952 0.004 0.044 0.000 0.000
#> GSM62291     2  0.1511     0.8658 0.000 0.940 0.000 0.044 0.012 0.004
#> GSM62265     1  0.1333     0.7347 0.944 0.008 0.000 0.000 0.048 0.000
#> GSM62266     1  0.1251     0.7063 0.956 0.024 0.000 0.000 0.012 0.008
#> GSM62296     2  0.1605     0.8650 0.000 0.936 0.000 0.044 0.016 0.004
#> GSM62309     2  0.1605     0.8650 0.000 0.936 0.000 0.044 0.016 0.004
#> GSM62295     4  0.5217     0.3967 0.000 0.000 0.000 0.608 0.232 0.160
#> GSM62300     2  0.1718     0.8649 0.000 0.932 0.000 0.044 0.016 0.008
#> GSM62308     2  0.1605     0.8650 0.000 0.936 0.000 0.044 0.016 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-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) other(p) genotype/variation(p) k
#> CV:kmeans 75         0.589716    0.935                0.7479 2
#> CV:kmeans 70         0.391695    0.745                0.8200 3
#> CV:kmeans 75         0.000715    0.767                0.0789 4
#> CV:kmeans 65         0.006004    0.598                0.0593 5
#> CV:kmeans 60         0.008136    0.203                0.3440 6

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


CV:skmeans**

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

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

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

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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.987       0.994         0.4775 0.526   0.526
#> 3 3 1.000           0.952       0.977         0.3896 0.792   0.612
#> 4 4 0.831           0.849       0.923         0.0969 0.922   0.776
#> 5 5 0.828           0.799       0.903         0.0661 0.943   0.802
#> 6 6 0.818           0.678       0.844         0.0364 0.979   0.912

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
#> GSM62248     2   0.000      0.990 0.000 1.000
#> GSM62256     2   0.000      0.990 0.000 1.000
#> GSM62259     2   0.000      0.990 0.000 1.000
#> GSM62267     1   0.000      1.000 1.000 0.000
#> GSM62280     1   0.000      1.000 1.000 0.000
#> GSM62284     1   0.000      1.000 1.000 0.000
#> GSM62289     2   0.000      0.990 0.000 1.000
#> GSM62307     2   0.000      0.990 0.000 1.000
#> GSM62316     2   0.000      0.990 0.000 1.000
#> GSM62254     2   0.000      0.990 0.000 1.000
#> GSM62292     2   0.000      0.990 0.000 1.000
#> GSM62253     1   0.000      1.000 1.000 0.000
#> GSM62270     1   0.000      1.000 1.000 0.000
#> GSM62278     1   0.000      1.000 1.000 0.000
#> GSM62297     2   0.000      0.990 0.000 1.000
#> GSM62298     2   0.000      0.990 0.000 1.000
#> GSM62299     2   0.000      0.990 0.000 1.000
#> GSM62258     1   0.000      1.000 1.000 0.000
#> GSM62281     2   0.000      0.990 0.000 1.000
#> GSM62294     2   0.000      0.990 0.000 1.000
#> GSM62305     2   0.605      0.826 0.148 0.852
#> GSM62306     2   0.000      0.990 0.000 1.000
#> GSM62310     2   0.000      0.990 0.000 1.000
#> GSM62311     2   0.000      0.990 0.000 1.000
#> GSM62317     2   0.000      0.990 0.000 1.000
#> GSM62318     1   0.000      1.000 1.000 0.000
#> GSM62321     1   0.000      1.000 1.000 0.000
#> GSM62322     1   0.000      1.000 1.000 0.000
#> GSM62250     2   0.866      0.602 0.288 0.712
#> GSM62252     1   0.000      1.000 1.000 0.000
#> GSM62255     2   0.000      0.990 0.000 1.000
#> GSM62257     2   0.000      0.990 0.000 1.000
#> GSM62260     1   0.000      1.000 1.000 0.000
#> GSM62261     2   0.000      0.990 0.000 1.000
#> GSM62262     2   0.000      0.990 0.000 1.000
#> GSM62264     1   0.000      1.000 1.000 0.000
#> GSM62268     1   0.000      1.000 1.000 0.000
#> GSM62269     1   0.000      1.000 1.000 0.000
#> GSM62271     1   0.000      1.000 1.000 0.000
#> GSM62272     1   0.000      1.000 1.000 0.000
#> GSM62273     2   0.000      0.990 0.000 1.000
#> GSM62274     1   0.000      1.000 1.000 0.000
#> GSM62275     1   0.000      1.000 1.000 0.000
#> GSM62276     1   0.000      1.000 1.000 0.000
#> GSM62277     1   0.000      1.000 1.000 0.000
#> GSM62279     1   0.000      1.000 1.000 0.000
#> GSM62282     1   0.000      1.000 1.000 0.000
#> GSM62283     1   0.000      1.000 1.000 0.000
#> GSM62286     2   0.000      0.990 0.000 1.000
#> GSM62287     2   0.000      0.990 0.000 1.000
#> GSM62288     2   0.000      0.990 0.000 1.000
#> GSM62290     2   0.000      0.990 0.000 1.000
#> GSM62293     2   0.000      0.990 0.000 1.000
#> GSM62301     2   0.000      0.990 0.000 1.000
#> GSM62302     2   0.000      0.990 0.000 1.000
#> GSM62303     2   0.000      0.990 0.000 1.000
#> GSM62304     2   0.000      0.990 0.000 1.000
#> GSM62312     2   0.000      0.990 0.000 1.000
#> GSM62313     2   0.000      0.990 0.000 1.000
#> GSM62314     2   0.000      0.990 0.000 1.000
#> GSM62319     2   0.000      0.990 0.000 1.000
#> GSM62320     2   0.000      0.990 0.000 1.000
#> GSM62249     1   0.000      1.000 1.000 0.000
#> GSM62251     1   0.000      1.000 1.000 0.000
#> GSM62263     2   0.000      0.990 0.000 1.000
#> GSM62285     2   0.000      0.990 0.000 1.000
#> GSM62315     2   0.000      0.990 0.000 1.000
#> GSM62291     2   0.000      0.990 0.000 1.000
#> GSM62265     1   0.000      1.000 1.000 0.000
#> GSM62266     1   0.000      1.000 1.000 0.000
#> GSM62296     2   0.000      0.990 0.000 1.000
#> GSM62309     2   0.000      0.990 0.000 1.000
#> GSM62295     2   0.000      0.990 0.000 1.000
#> GSM62300     2   0.000      0.990 0.000 1.000
#> GSM62308     2   0.000      0.990 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
#> GSM62248     2  0.1031      0.944 0.000 0.976 0.024
#> GSM62256     2  0.1643      0.938 0.000 0.956 0.044
#> GSM62259     2  0.0747      0.955 0.000 0.984 0.016
#> GSM62267     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62280     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62284     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62289     2  0.0237      0.949 0.000 0.996 0.004
#> GSM62307     2  0.0892      0.955 0.000 0.980 0.020
#> GSM62316     2  0.0424      0.950 0.000 0.992 0.008
#> GSM62254     2  0.0747      0.955 0.000 0.984 0.016
#> GSM62292     2  0.0747      0.955 0.000 0.984 0.016
#> GSM62253     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62270     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62278     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62297     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62298     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62299     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62258     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62281     2  0.6291      0.137 0.000 0.532 0.468
#> GSM62294     2  0.0747      0.955 0.000 0.984 0.016
#> GSM62305     2  0.2680      0.887 0.068 0.924 0.008
#> GSM62306     2  0.0000      0.949 0.000 1.000 0.000
#> GSM62310     2  0.1411      0.947 0.000 0.964 0.036
#> GSM62311     2  0.0892      0.955 0.000 0.980 0.020
#> GSM62317     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62318     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62321     1  0.2066      0.938 0.940 0.000 0.060
#> GSM62322     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62250     2  0.0237      0.949 0.000 0.996 0.004
#> GSM62252     2  0.6154      0.309 0.408 0.592 0.000
#> GSM62255     2  0.0892      0.955 0.000 0.980 0.020
#> GSM62257     2  0.0892      0.955 0.000 0.980 0.020
#> GSM62260     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62261     2  0.1031      0.944 0.000 0.976 0.024
#> GSM62262     2  0.0747      0.955 0.000 0.984 0.016
#> GSM62264     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62268     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62269     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62271     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62272     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62273     3  0.3941      0.815 0.000 0.156 0.844
#> GSM62274     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62275     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62276     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62277     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62279     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62282     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62283     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62286     2  0.0000      0.949 0.000 1.000 0.000
#> GSM62287     2  0.0747      0.955 0.000 0.984 0.016
#> GSM62288     2  0.1031      0.944 0.000 0.976 0.024
#> GSM62290     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62293     2  0.0747      0.955 0.000 0.984 0.016
#> GSM62301     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62302     2  0.0892      0.955 0.000 0.980 0.020
#> GSM62303     2  0.0747      0.955 0.000 0.984 0.016
#> GSM62304     2  0.0892      0.955 0.000 0.980 0.020
#> GSM62312     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62313     2  0.0892      0.955 0.000 0.980 0.020
#> GSM62314     2  0.1031      0.944 0.000 0.976 0.024
#> GSM62319     3  0.1031      0.969 0.000 0.024 0.976
#> GSM62320     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62249     1  0.1999      0.955 0.952 0.012 0.036
#> GSM62251     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62263     3  0.0747      0.974 0.000 0.016 0.984
#> GSM62285     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62315     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62291     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62265     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62266     1  0.0000      0.996 1.000 0.000 0.000
#> GSM62296     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62309     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62295     2  0.0892      0.954 0.000 0.980 0.020
#> GSM62300     3  0.0000      0.988 0.000 0.000 1.000
#> GSM62308     3  0.0000      0.988 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4  0.5273    -0.0647 0.000 0.008 0.456 0.536
#> GSM62256     4  0.2048     0.8129 0.000 0.064 0.008 0.928
#> GSM62259     4  0.0672     0.8544 0.000 0.008 0.008 0.984
#> GSM62267     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62280     1  0.3172     0.8499 0.840 0.000 0.160 0.000
#> GSM62284     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62289     3  0.4088     0.8332 0.000 0.004 0.764 0.232
#> GSM62307     4  0.0336     0.8617 0.000 0.008 0.000 0.992
#> GSM62316     4  0.4744     0.4992 0.000 0.012 0.284 0.704
#> GSM62254     4  0.0336     0.8578 0.000 0.000 0.008 0.992
#> GSM62292     4  0.0336     0.8578 0.000 0.000 0.008 0.992
#> GSM62253     1  0.1022     0.9376 0.968 0.000 0.032 0.000
#> GSM62270     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62278     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62297     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62298     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62258     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62281     4  0.3668     0.6639 0.000 0.188 0.004 0.808
#> GSM62294     4  0.0000     0.8605 0.000 0.000 0.000 1.000
#> GSM62305     3  0.3895     0.8281 0.000 0.012 0.804 0.184
#> GSM62306     3  0.4277     0.7848 0.000 0.000 0.720 0.280
#> GSM62310     4  0.0469     0.8597 0.000 0.012 0.000 0.988
#> GSM62311     4  0.0336     0.8617 0.000 0.008 0.000 0.992
#> GSM62317     2  0.3172     0.8295 0.000 0.840 0.160 0.000
#> GSM62318     1  0.3569     0.8333 0.804 0.000 0.196 0.000
#> GSM62321     1  0.5489     0.7276 0.700 0.060 0.240 0.000
#> GSM62322     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62250     3  0.3649     0.8443 0.000 0.000 0.796 0.204
#> GSM62252     3  0.4188     0.7710 0.112 0.000 0.824 0.064
#> GSM62255     4  0.0336     0.8617 0.000 0.008 0.000 0.992
#> GSM62257     4  0.0336     0.8617 0.000 0.008 0.000 0.992
#> GSM62260     1  0.3942     0.7994 0.764 0.000 0.236 0.000
#> GSM62261     4  0.4744     0.4992 0.000 0.012 0.284 0.704
#> GSM62262     4  0.0000     0.8605 0.000 0.000 0.000 1.000
#> GSM62264     1  0.4103     0.7796 0.744 0.000 0.256 0.000
#> GSM62268     1  0.1022     0.9376 0.968 0.000 0.032 0.000
#> GSM62269     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62271     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62272     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62273     4  0.5288     0.0570 0.000 0.472 0.008 0.520
#> GSM62274     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62275     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62276     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62277     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62279     1  0.0000     0.9476 1.000 0.000 0.000 0.000
#> GSM62282     1  0.1557     0.9210 0.944 0.000 0.056 0.000
#> GSM62283     1  0.0188     0.9466 0.996 0.000 0.004 0.000
#> GSM62286     3  0.3975     0.8332 0.000 0.000 0.760 0.240
#> GSM62287     4  0.0000     0.8605 0.000 0.000 0.000 1.000
#> GSM62288     4  0.5075     0.3494 0.000 0.012 0.344 0.644
#> GSM62290     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62293     4  0.0000     0.8605 0.000 0.000 0.000 1.000
#> GSM62301     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62302     4  0.0336     0.8617 0.000 0.008 0.000 0.992
#> GSM62303     4  0.0000     0.8605 0.000 0.000 0.000 1.000
#> GSM62304     4  0.0336     0.8617 0.000 0.008 0.000 0.992
#> GSM62312     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62313     4  0.0336     0.8617 0.000 0.008 0.000 0.992
#> GSM62314     4  0.4137     0.6350 0.000 0.012 0.208 0.780
#> GSM62319     2  0.1042     0.9533 0.000 0.972 0.008 0.020
#> GSM62320     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62249     3  0.2589     0.6996 0.116 0.000 0.884 0.000
#> GSM62251     1  0.2345     0.8960 0.900 0.000 0.100 0.000
#> GSM62263     2  0.3528     0.7930 0.000 0.808 0.192 0.000
#> GSM62285     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62265     1  0.1022     0.9376 0.968 0.000 0.032 0.000
#> GSM62266     1  0.1022     0.9376 0.968 0.000 0.032 0.000
#> GSM62296     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62309     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62295     4  0.0524     0.8566 0.000 0.004 0.008 0.988
#> GSM62300     2  0.0000     0.9768 0.000 1.000 0.000 0.000
#> GSM62308     2  0.0000     0.9768 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
#> GSM62248     5  0.4675     0.1716 0.000 0.004 0.008 0.444 0.544
#> GSM62256     4  0.2783     0.8058 0.000 0.036 0.032 0.896 0.036
#> GSM62259     4  0.3058     0.7883 0.000 0.000 0.044 0.860 0.096
#> GSM62267     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62280     3  0.3366     0.6986 0.232 0.000 0.768 0.000 0.000
#> GSM62284     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62289     5  0.2127     0.7583 0.000 0.000 0.000 0.108 0.892
#> GSM62307     4  0.0451     0.8391 0.000 0.004 0.008 0.988 0.000
#> GSM62316     4  0.4478     0.3387 0.000 0.004 0.008 0.628 0.360
#> GSM62254     4  0.2561     0.7966 0.000 0.000 0.020 0.884 0.096
#> GSM62292     4  0.2561     0.7966 0.000 0.000 0.020 0.884 0.096
#> GSM62253     1  0.2707     0.8455 0.860 0.000 0.132 0.000 0.008
#> GSM62270     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62278     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62297     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62298     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62299     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62258     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62281     4  0.4037     0.6679 0.000 0.184 0.016 0.780 0.020
#> GSM62294     4  0.0404     0.8386 0.000 0.000 0.000 0.988 0.012
#> GSM62305     5  0.3209     0.6789 0.000 0.004 0.060 0.076 0.860
#> GSM62306     5  0.3732     0.7002 0.000 0.000 0.032 0.176 0.792
#> GSM62310     4  0.0324     0.8400 0.000 0.004 0.000 0.992 0.004
#> GSM62311     4  0.0324     0.8400 0.000 0.004 0.000 0.992 0.004
#> GSM62317     3  0.3424     0.6205 0.000 0.240 0.760 0.000 0.000
#> GSM62318     3  0.1671     0.8455 0.076 0.000 0.924 0.000 0.000
#> GSM62321     3  0.1205     0.8520 0.040 0.004 0.956 0.000 0.000
#> GSM62322     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62250     5  0.2248     0.7572 0.000 0.000 0.012 0.088 0.900
#> GSM62252     5  0.2673     0.7225 0.020 0.000 0.044 0.036 0.900
#> GSM62255     4  0.0162     0.8400 0.000 0.004 0.000 0.996 0.000
#> GSM62257     4  0.0613     0.8377 0.000 0.004 0.008 0.984 0.004
#> GSM62260     3  0.1270     0.8549 0.052 0.000 0.948 0.000 0.000
#> GSM62261     4  0.4464     0.3484 0.000 0.004 0.008 0.632 0.356
#> GSM62262     4  0.1522     0.8254 0.000 0.000 0.012 0.944 0.044
#> GSM62264     3  0.1549     0.8457 0.040 0.000 0.944 0.000 0.016
#> GSM62268     1  0.2074     0.8751 0.896 0.000 0.104 0.000 0.000
#> GSM62269     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62271     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62272     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62273     4  0.6581     0.1958 0.000 0.384 0.032 0.484 0.100
#> GSM62274     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62275     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62276     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62277     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62279     1  0.0000     0.9425 1.000 0.000 0.000 0.000 0.000
#> GSM62282     1  0.3561     0.5927 0.740 0.000 0.260 0.000 0.000
#> GSM62283     1  0.0609     0.9327 0.980 0.000 0.020 0.000 0.000
#> GSM62286     5  0.1965     0.7616 0.000 0.000 0.000 0.096 0.904
#> GSM62287     4  0.0000     0.8398 0.000 0.000 0.000 1.000 0.000
#> GSM62288     4  0.4651     0.1257 0.000 0.004 0.008 0.560 0.428
#> GSM62290     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62293     4  0.1914     0.8173 0.000 0.000 0.016 0.924 0.060
#> GSM62301     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62302     4  0.0324     0.8400 0.000 0.004 0.000 0.992 0.004
#> GSM62303     4  0.0162     0.8398 0.000 0.000 0.000 0.996 0.004
#> GSM62304     4  0.0324     0.8400 0.000 0.004 0.000 0.992 0.004
#> GSM62312     2  0.0510     0.9455 0.000 0.984 0.000 0.016 0.000
#> GSM62313     4  0.0324     0.8400 0.000 0.004 0.000 0.992 0.004
#> GSM62314     4  0.4088     0.5185 0.000 0.004 0.008 0.712 0.276
#> GSM62319     2  0.3182     0.8274 0.000 0.864 0.028 0.016 0.092
#> GSM62320     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62249     5  0.5876     0.0418 0.100 0.000 0.412 0.000 0.488
#> GSM62251     1  0.3909     0.7229 0.760 0.000 0.216 0.000 0.024
#> GSM62263     2  0.5203     0.3833 0.000 0.608 0.332 0.000 0.060
#> GSM62285     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62265     1  0.2338     0.8669 0.884 0.000 0.112 0.000 0.004
#> GSM62266     1  0.2707     0.8455 0.860 0.000 0.132 0.000 0.008
#> GSM62296     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62309     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62295     4  0.2616     0.7940 0.000 0.000 0.020 0.880 0.100
#> GSM62300     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000
#> GSM62308     2  0.0000     0.9616 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5  0.5161     0.1797 0.000 0.004 0.080 0.376 0.540 0.000
#> GSM62256     4  0.4746     0.3578 0.000 0.036 0.332 0.616 0.016 0.000
#> GSM62259     4  0.3997     0.0823 0.000 0.000 0.488 0.508 0.004 0.000
#> GSM62267     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62280     6  0.5147     0.5897 0.096 0.000 0.356 0.000 0.000 0.548
#> GSM62284     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62289     5  0.1176     0.7083 0.000 0.000 0.020 0.024 0.956 0.000
#> GSM62307     4  0.2009     0.7100 0.000 0.008 0.084 0.904 0.004 0.000
#> GSM62316     4  0.4961     0.4092 0.000 0.004 0.084 0.616 0.296 0.000
#> GSM62254     4  0.3215     0.5348 0.000 0.000 0.240 0.756 0.004 0.000
#> GSM62292     4  0.3215     0.5348 0.000 0.000 0.240 0.756 0.004 0.000
#> GSM62253     1  0.3507     0.7247 0.752 0.000 0.004 0.000 0.012 0.232
#> GSM62270     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62278     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62297     2  0.0146     0.9488 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM62298     2  0.0146     0.9488 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM62299     2  0.0146     0.9488 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM62258     1  0.0146     0.8861 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM62281     4  0.5446     0.1857 0.000 0.156 0.236 0.600 0.008 0.000
#> GSM62294     4  0.1152     0.7237 0.000 0.000 0.044 0.952 0.004 0.000
#> GSM62305     5  0.4574     0.4386 0.000 0.000 0.440 0.000 0.524 0.036
#> GSM62306     5  0.5400     0.4053 0.000 0.000 0.400 0.116 0.484 0.000
#> GSM62310     4  0.0508     0.7374 0.000 0.004 0.012 0.984 0.000 0.000
#> GSM62311     4  0.0146     0.7385 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM62317     6  0.5195     0.5928 0.000 0.100 0.360 0.000 0.000 0.540
#> GSM62318     6  0.3769     0.6448 0.004 0.000 0.356 0.000 0.000 0.640
#> GSM62321     6  0.3634     0.6449 0.000 0.000 0.356 0.000 0.000 0.644
#> GSM62322     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62250     5  0.0363     0.7076 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM62252     5  0.0748     0.6876 0.004 0.000 0.004 0.000 0.976 0.016
#> GSM62255     4  0.0291     0.7387 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM62257     4  0.1888     0.7159 0.000 0.004 0.068 0.916 0.012 0.000
#> GSM62260     6  0.2544     0.6189 0.004 0.000 0.140 0.000 0.004 0.852
#> GSM62261     4  0.4921     0.4594 0.000 0.008 0.084 0.644 0.264 0.000
#> GSM62262     4  0.2146     0.6726 0.000 0.000 0.116 0.880 0.004 0.000
#> GSM62264     6  0.0508     0.5598 0.004 0.000 0.000 0.000 0.012 0.984
#> GSM62268     1  0.3121     0.7671 0.804 0.000 0.004 0.000 0.012 0.180
#> GSM62269     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62271     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62272     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62273     3  0.6202     0.0000 0.000 0.320 0.392 0.284 0.004 0.000
#> GSM62274     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62275     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62276     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62277     1  0.0000     0.8882 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62279     1  0.0405     0.8832 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM62282     1  0.4361     0.5796 0.720 0.000 0.112 0.000 0.000 0.168
#> GSM62283     1  0.3817     0.6786 0.720 0.000 0.028 0.000 0.000 0.252
#> GSM62286     5  0.0547     0.7114 0.000 0.000 0.000 0.020 0.980 0.000
#> GSM62287     4  0.0146     0.7385 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM62288     4  0.5065     0.3425 0.000 0.004 0.084 0.588 0.324 0.000
#> GSM62290     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62293     4  0.2668     0.6225 0.000 0.000 0.168 0.828 0.004 0.000
#> GSM62301     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62302     4  0.0363     0.7396 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM62303     4  0.0865     0.7294 0.000 0.000 0.036 0.964 0.000 0.000
#> GSM62304     4  0.0291     0.7387 0.000 0.004 0.004 0.992 0.000 0.000
#> GSM62312     2  0.1845     0.8328 0.000 0.920 0.028 0.052 0.000 0.000
#> GSM62313     4  0.0000     0.7388 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62314     4  0.4486     0.5427 0.000 0.004 0.084 0.704 0.208 0.000
#> GSM62319     2  0.3979     0.0460 0.000 0.628 0.360 0.012 0.000 0.000
#> GSM62320     2  0.0458     0.9368 0.000 0.984 0.016 0.000 0.000 0.000
#> GSM62249     6  0.5693     0.0698 0.040 0.004 0.060 0.000 0.356 0.540
#> GSM62251     1  0.5058     0.3244 0.484 0.000 0.020 0.000 0.036 0.460
#> GSM62263     6  0.5603    -0.0204 0.000 0.448 0.064 0.000 0.032 0.456
#> GSM62285     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62291     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62265     1  0.4116     0.6604 0.684 0.000 0.016 0.000 0.012 0.288
#> GSM62266     1  0.3915     0.6709 0.696 0.000 0.008 0.000 0.012 0.284
#> GSM62296     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62309     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62295     4  0.3521     0.4817 0.000 0.004 0.268 0.724 0.004 0.000
#> GSM62300     2  0.0146     0.9488 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM62308     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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) other(p) genotype/variation(p) k
#> CV:skmeans 75          0.82366    1.000                0.8057 2
#> CV:skmeans 73          0.00169    0.823                0.0378 3
#> CV:skmeans 70          0.00587    0.846                0.1687 4
#> CV:skmeans 68          0.00587    0.913                0.3905 5
#> CV:skmeans 60          0.00102    0.575                0.2353 6

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


CV:pam*

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-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 1.000           0.954       0.979         0.4821 0.508   0.508
#> 3 3 0.715           0.745       0.782         0.2884 0.745   0.536
#> 4 4 0.999           0.949       0.981         0.1631 0.879   0.670
#> 5 5 0.930           0.902       0.944         0.0357 0.968   0.884
#> 6 6 0.832           0.733       0.831         0.0555 0.947   0.796

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM62248     2   0.000      1.000 0.000 1.000
#> GSM62256     2   0.000      1.000 0.000 1.000
#> GSM62259     2   0.000      1.000 0.000 1.000
#> GSM62267     1   0.000      0.947 1.000 0.000
#> GSM62280     1   0.000      0.947 1.000 0.000
#> GSM62284     1   0.000      0.947 1.000 0.000
#> GSM62289     2   0.000      1.000 0.000 1.000
#> GSM62307     2   0.000      1.000 0.000 1.000
#> GSM62316     2   0.000      1.000 0.000 1.000
#> GSM62254     2   0.000      1.000 0.000 1.000
#> GSM62292     2   0.000      1.000 0.000 1.000
#> GSM62253     1   0.000      0.947 1.000 0.000
#> GSM62270     1   0.000      0.947 1.000 0.000
#> GSM62278     1   0.000      0.947 1.000 0.000
#> GSM62297     2   0.000      1.000 0.000 1.000
#> GSM62298     2   0.000      1.000 0.000 1.000
#> GSM62299     2   0.000      1.000 0.000 1.000
#> GSM62258     1   0.000      0.947 1.000 0.000
#> GSM62281     2   0.000      1.000 0.000 1.000
#> GSM62294     2   0.000      1.000 0.000 1.000
#> GSM62305     1   0.895      0.599 0.688 0.312
#> GSM62306     2   0.000      1.000 0.000 1.000
#> GSM62310     2   0.000      1.000 0.000 1.000
#> GSM62311     2   0.000      1.000 0.000 1.000
#> GSM62317     2   0.000      1.000 0.000 1.000
#> GSM62318     1   0.000      0.947 1.000 0.000
#> GSM62321     1   0.430      0.882 0.912 0.088
#> GSM62322     1   0.000      0.947 1.000 0.000
#> GSM62250     2   0.000      1.000 0.000 1.000
#> GSM62252     1   0.904      0.584 0.680 0.320
#> GSM62255     2   0.000      1.000 0.000 1.000
#> GSM62257     2   0.000      1.000 0.000 1.000
#> GSM62260     1   0.224      0.923 0.964 0.036
#> GSM62261     2   0.000      1.000 0.000 1.000
#> GSM62262     2   0.000      1.000 0.000 1.000
#> GSM62264     1   0.000      0.947 1.000 0.000
#> GSM62268     1   0.000      0.947 1.000 0.000
#> GSM62269     1   0.000      0.947 1.000 0.000
#> GSM62271     1   0.000      0.947 1.000 0.000
#> GSM62272     1   0.000      0.947 1.000 0.000
#> GSM62273     2   0.000      1.000 0.000 1.000
#> GSM62274     1   0.000      0.947 1.000 0.000
#> GSM62275     1   0.000      0.947 1.000 0.000
#> GSM62276     1   0.000      0.947 1.000 0.000
#> GSM62277     1   0.000      0.947 1.000 0.000
#> GSM62279     1   0.000      0.947 1.000 0.000
#> GSM62282     1   0.000      0.947 1.000 0.000
#> GSM62283     1   0.000      0.947 1.000 0.000
#> GSM62286     2   0.000      1.000 0.000 1.000
#> GSM62287     2   0.000      1.000 0.000 1.000
#> GSM62288     2   0.000      1.000 0.000 1.000
#> GSM62290     2   0.000      1.000 0.000 1.000
#> GSM62293     2   0.000      1.000 0.000 1.000
#> GSM62301     2   0.000      1.000 0.000 1.000
#> GSM62302     2   0.000      1.000 0.000 1.000
#> GSM62303     2   0.000      1.000 0.000 1.000
#> GSM62304     2   0.000      1.000 0.000 1.000
#> GSM62312     2   0.000      1.000 0.000 1.000
#> GSM62313     2   0.000      1.000 0.000 1.000
#> GSM62314     2   0.000      1.000 0.000 1.000
#> GSM62319     1   0.990      0.301 0.560 0.440
#> GSM62320     2   0.000      1.000 0.000 1.000
#> GSM62249     1   0.430      0.882 0.912 0.088
#> GSM62251     1   0.000      0.947 1.000 0.000
#> GSM62263     1   0.876      0.626 0.704 0.296
#> GSM62285     2   0.000      1.000 0.000 1.000
#> GSM62315     2   0.000      1.000 0.000 1.000
#> GSM62291     2   0.000      1.000 0.000 1.000
#> GSM62265     1   0.000      0.947 1.000 0.000
#> GSM62266     1   0.000      0.947 1.000 0.000
#> GSM62296     2   0.000      1.000 0.000 1.000
#> GSM62309     2   0.000      1.000 0.000 1.000
#> GSM62295     2   0.000      1.000 0.000 1.000
#> GSM62300     2   0.000      1.000 0.000 1.000
#> GSM62308     2   0.000      1.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62256     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62259     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62267     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62280     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62284     1  0.1860      0.813 0.948 0.000 0.052
#> GSM62289     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62307     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62316     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62254     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62292     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62253     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62270     1  0.6215      0.692 0.572 0.000 0.428
#> GSM62278     1  0.6215      0.692 0.572 0.000 0.428
#> GSM62297     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62298     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62299     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62258     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62281     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62294     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62305     3  0.6836      0.344 0.412 0.016 0.572
#> GSM62306     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62310     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62317     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62318     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62321     3  0.6299      0.220 0.476 0.000 0.524
#> GSM62322     1  0.6215      0.692 0.572 0.000 0.428
#> GSM62250     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62252     2  0.7591      0.129 0.412 0.544 0.044
#> GSM62255     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62260     3  0.6309      0.160 0.500 0.000 0.500
#> GSM62261     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62262     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62264     1  0.0424      0.818 0.992 0.000 0.008
#> GSM62268     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62269     1  0.6215      0.692 0.572 0.000 0.428
#> GSM62271     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62272     1  0.6215      0.692 0.572 0.000 0.428
#> GSM62273     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62274     1  0.5882      0.719 0.652 0.000 0.348
#> GSM62275     1  0.6215      0.692 0.572 0.000 0.428
#> GSM62276     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62277     1  0.6215      0.692 0.572 0.000 0.428
#> GSM62279     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62282     1  0.1860      0.813 0.948 0.000 0.052
#> GSM62283     1  0.6308     -0.214 0.508 0.000 0.492
#> GSM62286     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62287     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62288     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62290     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62293     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62301     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62302     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62312     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62313     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62314     2  0.0000      0.940 0.000 1.000 0.000
#> GSM62319     3  0.7726      0.408 0.372 0.056 0.572
#> GSM62320     2  0.6309     -0.575 0.000 0.504 0.496
#> GSM62249     3  0.6244      0.293 0.440 0.000 0.560
#> GSM62251     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62263     3  0.6215      0.313 0.428 0.000 0.572
#> GSM62285     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62315     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62291     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62265     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62266     1  0.0000      0.824 1.000 0.000 0.000
#> GSM62296     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62309     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62295     2  0.4605      0.542 0.000 0.796 0.204
#> GSM62300     3  0.6215      0.718 0.000 0.428 0.572
#> GSM62308     3  0.6215      0.718 0.000 0.428 0.572

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62256     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62259     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62267     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62280     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62284     1   0.460      0.485 0.664 0.000 0.336 0.000
#> GSM62289     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62307     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62316     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62254     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62292     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62253     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62270     3   0.000      0.988 0.000 0.000 1.000 0.000
#> GSM62278     3   0.000      0.988 0.000 0.000 1.000 0.000
#> GSM62297     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62298     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62299     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62258     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62281     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62294     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62305     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62306     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62310     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62311     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62317     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62318     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62321     2   0.384      0.685 0.224 0.776 0.000 0.000
#> GSM62322     3   0.000      0.988 0.000 0.000 1.000 0.000
#> GSM62250     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62252     1   0.215      0.862 0.912 0.000 0.000 0.088
#> GSM62255     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62257     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62260     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62261     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62262     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62264     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62268     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62269     3   0.000      0.988 0.000 0.000 1.000 0.000
#> GSM62271     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62272     3   0.000      0.988 0.000 0.000 1.000 0.000
#> GSM62273     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62274     3   0.201      0.910 0.080 0.000 0.920 0.000
#> GSM62275     3   0.000      0.988 0.000 0.000 1.000 0.000
#> GSM62276     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62277     3   0.000      0.988 0.000 0.000 1.000 0.000
#> GSM62279     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62282     1   0.147      0.926 0.948 0.000 0.052 0.000
#> GSM62283     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62286     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62287     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62288     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62290     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62293     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62301     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62302     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62303     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62304     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62312     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62313     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62314     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM62319     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62320     2   0.340      0.727 0.000 0.820 0.000 0.180
#> GSM62249     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62251     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62263     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62285     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62315     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62291     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62265     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62266     1   0.000      0.971 1.000 0.000 0.000 0.000
#> GSM62296     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62309     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62295     2   0.498      0.158 0.000 0.536 0.000 0.464
#> GSM62300     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM62308     2   0.000      0.941 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
#> GSM62248     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62256     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62259     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62267     1  0.0794      0.869 0.972 0.000 0.000 0.000 0.028
#> GSM62280     5  0.2471      0.738 0.136 0.000 0.000 0.000 0.864
#> GSM62284     1  0.6058      0.393 0.528 0.000 0.336 0.000 0.136
#> GSM62289     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62307     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62316     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62254     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62292     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62253     1  0.2471      0.861 0.864 0.000 0.000 0.000 0.136
#> GSM62270     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM62278     3  0.0794      0.943 0.000 0.000 0.972 0.000 0.028
#> GSM62297     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62298     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62299     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62258     1  0.0794      0.869 0.972 0.000 0.000 0.000 0.028
#> GSM62281     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62294     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62305     2  0.0404      0.922 0.012 0.988 0.000 0.000 0.000
#> GSM62306     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62310     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62311     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62317     5  0.4182      0.394 0.000 0.400 0.000 0.000 0.600
#> GSM62318     5  0.0794      0.688 0.028 0.000 0.000 0.000 0.972
#> GSM62321     5  0.2773      0.721 0.000 0.164 0.000 0.000 0.836
#> GSM62322     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM62250     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62252     1  0.2519      0.763 0.884 0.016 0.000 0.100 0.000
#> GSM62255     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62257     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62260     1  0.0794      0.869 0.972 0.000 0.000 0.000 0.028
#> GSM62261     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62262     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62264     1  0.2471      0.861 0.864 0.000 0.000 0.000 0.136
#> GSM62268     1  0.2471      0.861 0.864 0.000 0.000 0.000 0.136
#> GSM62269     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM62271     1  0.0794      0.869 0.972 0.000 0.000 0.000 0.028
#> GSM62272     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM62273     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62274     3  0.3231      0.746 0.196 0.000 0.800 0.000 0.004
#> GSM62275     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM62276     1  0.0794      0.869 0.972 0.000 0.000 0.000 0.028
#> GSM62277     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM62279     1  0.0000      0.870 1.000 0.000 0.000 0.000 0.000
#> GSM62282     5  0.2471      0.738 0.136 0.000 0.000 0.000 0.864
#> GSM62283     1  0.0794      0.869 0.972 0.000 0.000 0.000 0.028
#> GSM62286     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62287     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62288     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62290     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62293     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62301     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62302     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62303     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62304     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62312     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62313     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62314     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM62319     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62320     2  0.2929      0.651 0.000 0.820 0.000 0.180 0.000
#> GSM62249     1  0.2773      0.740 0.836 0.164 0.000 0.000 0.000
#> GSM62251     1  0.2471      0.861 0.864 0.000 0.000 0.000 0.136
#> GSM62263     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62285     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62265     1  0.2471      0.861 0.864 0.000 0.000 0.000 0.136
#> GSM62266     1  0.2471      0.861 0.864 0.000 0.000 0.000 0.136
#> GSM62296     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62309     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62295     2  0.4291      0.154 0.000 0.536 0.000 0.464 0.000
#> GSM62300     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000
#> GSM62308     2  0.0000      0.936 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     4   0.387     0.5038 0.000 0.000 0.000 0.508 0.492 0.000
#> GSM62256     4   0.266     0.8096 0.000 0.000 0.000 0.816 0.184 0.000
#> GSM62259     4   0.101     0.8732 0.000 0.000 0.000 0.956 0.044 0.000
#> GSM62267     1   0.000     0.7967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62280     6   0.000     0.8871 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62284     5   0.577     0.2289 0.220 0.000 0.276 0.000 0.504 0.000
#> GSM62289     4   0.387     0.4983 0.000 0.000 0.000 0.504 0.496 0.000
#> GSM62307     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62316     4   0.276     0.7987 0.000 0.000 0.000 0.804 0.196 0.000
#> GSM62254     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62292     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62253     5   0.387     0.4488 0.496 0.000 0.000 0.000 0.504 0.000
#> GSM62270     3   0.000     0.9351 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3   0.000     0.9351 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62297     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62298     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62299     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62258     1   0.000     0.7967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62281     4   0.366     0.6586 0.000 0.000 0.000 0.636 0.364 0.000
#> GSM62294     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62305     5   0.583    -0.1355 0.196 0.348 0.000 0.000 0.456 0.000
#> GSM62306     4   0.234     0.8308 0.000 0.000 0.000 0.852 0.148 0.000
#> GSM62310     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62311     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     6   0.254     0.8115 0.000 0.032 0.000 0.000 0.096 0.872
#> GSM62318     6   0.000     0.8871 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62321     6   0.000     0.8871 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3   0.000     0.9351 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5   0.506    -0.4489 0.076 0.000 0.000 0.428 0.496 0.000
#> GSM62252     1   0.387     0.1451 0.504 0.000 0.000 0.000 0.496 0.000
#> GSM62255     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62257     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62260     1   0.333     0.4053 0.716 0.000 0.000 0.000 0.000 0.284
#> GSM62261     4   0.196     0.8471 0.000 0.000 0.000 0.888 0.112 0.000
#> GSM62262     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62264     5   0.387     0.4488 0.496 0.000 0.000 0.000 0.504 0.000
#> GSM62268     5   0.387     0.4488 0.496 0.000 0.000 0.000 0.504 0.000
#> GSM62269     3   0.000     0.9351 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     1   0.000     0.7967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62272     3   0.000     0.9351 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62274     3   0.533     0.4181 0.300 0.000 0.564 0.000 0.136 0.000
#> GSM62275     3   0.000     0.9351 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     1   0.000     0.7967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62277     3   0.000     0.9351 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62279     1   0.000     0.7967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62282     6   0.333     0.6007 0.284 0.000 0.000 0.000 0.000 0.716
#> GSM62283     1   0.000     0.7967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62286     4   0.387     0.4983 0.000 0.000 0.000 0.504 0.496 0.000
#> GSM62287     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62288     4   0.327     0.7476 0.000 0.000 0.000 0.728 0.272 0.000
#> GSM62290     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62293     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62301     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62302     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62303     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62304     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62312     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62313     4   0.000     0.8867 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62314     4   0.305     0.7745 0.000 0.000 0.000 0.764 0.236 0.000
#> GSM62319     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62320     2   0.263     0.6940 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM62249     2   0.387    -0.0464 0.496 0.504 0.000 0.000 0.000 0.000
#> GSM62251     5   0.387     0.4488 0.496 0.000 0.000 0.000 0.504 0.000
#> GSM62263     2   0.196     0.7992 0.000 0.888 0.000 0.000 0.112 0.000
#> GSM62285     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62315     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62291     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62265     5   0.387     0.4488 0.496 0.000 0.000 0.000 0.504 0.000
#> GSM62266     5   0.387     0.4488 0.496 0.000 0.000 0.000 0.504 0.000
#> GSM62296     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62309     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62295     2   0.385     0.1569 0.000 0.536 0.000 0.464 0.000 0.000
#> GSM62300     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62308     2   0.000     0.9046 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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) other(p) genotype/variation(p) k
#> CV:pam 74         1.00e+00    0.964                0.6606 2
#> CV:pam 66         5.35e-04    0.487                0.0379 3
#> CV:pam 73         8.41e-04    0.584                0.0708 4
#> CV:pam 72         4.19e-04    0.692                0.1412 5
#> CV:pam 59         5.34e-05    0.578                0.1340 6

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


CV:mclust**

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

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

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

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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.949       0.981         0.4720 0.519   0.519
#> 3 3 0.728           0.837       0.856         0.1832 0.870   0.772
#> 4 4 0.514           0.527       0.674         0.1545 0.761   0.579
#> 5 5 0.557           0.650       0.736         0.1457 0.730   0.396
#> 6 6 0.580           0.734       0.788         0.0513 0.936   0.721

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
#> GSM62248     2  0.0000      0.999 0.000 1.000
#> GSM62256     2  0.1633      0.974 0.024 0.976
#> GSM62259     2  0.0000      0.999 0.000 1.000
#> GSM62267     1  0.0000      0.950 1.000 0.000
#> GSM62280     1  0.0000      0.950 1.000 0.000
#> GSM62284     1  0.0000      0.950 1.000 0.000
#> GSM62289     2  0.0000      0.999 0.000 1.000
#> GSM62307     2  0.0000      0.999 0.000 1.000
#> GSM62316     2  0.0000      0.999 0.000 1.000
#> GSM62254     2  0.0000      0.999 0.000 1.000
#> GSM62292     2  0.0000      0.999 0.000 1.000
#> GSM62253     1  0.0000      0.950 1.000 0.000
#> GSM62270     1  0.0000      0.950 1.000 0.000
#> GSM62278     1  0.0000      0.950 1.000 0.000
#> GSM62297     2  0.0000      0.999 0.000 1.000
#> GSM62298     2  0.0000      0.999 0.000 1.000
#> GSM62299     2  0.0000      0.999 0.000 1.000
#> GSM62258     1  0.0000      0.950 1.000 0.000
#> GSM62281     2  0.0672      0.991 0.008 0.992
#> GSM62294     2  0.0000      0.999 0.000 1.000
#> GSM62305     2  0.0000      0.999 0.000 1.000
#> GSM62306     2  0.0000      0.999 0.000 1.000
#> GSM62310     2  0.0000      0.999 0.000 1.000
#> GSM62311     2  0.0000      0.999 0.000 1.000
#> GSM62317     1  0.9933      0.221 0.548 0.452
#> GSM62318     1  0.0000      0.950 1.000 0.000
#> GSM62321     1  0.0000      0.950 1.000 0.000
#> GSM62322     1  0.0000      0.950 1.000 0.000
#> GSM62250     2  0.0000      0.999 0.000 1.000
#> GSM62252     2  0.0376      0.995 0.004 0.996
#> GSM62255     2  0.0000      0.999 0.000 1.000
#> GSM62257     2  0.0000      0.999 0.000 1.000
#> GSM62260     1  0.0000      0.950 1.000 0.000
#> GSM62261     2  0.0000      0.999 0.000 1.000
#> GSM62262     2  0.0000      0.999 0.000 1.000
#> GSM62264     1  0.0000      0.950 1.000 0.000
#> GSM62268     1  0.0000      0.950 1.000 0.000
#> GSM62269     1  0.0000      0.950 1.000 0.000
#> GSM62271     1  0.0000      0.950 1.000 0.000
#> GSM62272     1  0.0000      0.950 1.000 0.000
#> GSM62273     2  0.0000      0.999 0.000 1.000
#> GSM62274     1  0.0000      0.950 1.000 0.000
#> GSM62275     1  0.0000      0.950 1.000 0.000
#> GSM62276     1  0.0000      0.950 1.000 0.000
#> GSM62277     1  0.0000      0.950 1.000 0.000
#> GSM62279     1  0.0000      0.950 1.000 0.000
#> GSM62282     1  0.0000      0.950 1.000 0.000
#> GSM62283     1  0.0000      0.950 1.000 0.000
#> GSM62286     2  0.0000      0.999 0.000 1.000
#> GSM62287     2  0.0000      0.999 0.000 1.000
#> GSM62288     2  0.0000      0.999 0.000 1.000
#> GSM62290     2  0.0000      0.999 0.000 1.000
#> GSM62293     2  0.0000      0.999 0.000 1.000
#> GSM62301     2  0.0000      0.999 0.000 1.000
#> GSM62302     2  0.0000      0.999 0.000 1.000
#> GSM62303     2  0.0000      0.999 0.000 1.000
#> GSM62304     2  0.0000      0.999 0.000 1.000
#> GSM62312     2  0.0000      0.999 0.000 1.000
#> GSM62313     2  0.0000      0.999 0.000 1.000
#> GSM62314     2  0.0000      0.999 0.000 1.000
#> GSM62319     2  0.0000      0.999 0.000 1.000
#> GSM62320     2  0.0000      0.999 0.000 1.000
#> GSM62249     1  0.9944      0.209 0.544 0.456
#> GSM62251     1  0.0000      0.950 1.000 0.000
#> GSM62263     1  0.9993      0.107 0.516 0.484
#> GSM62285     2  0.0000      0.999 0.000 1.000
#> GSM62315     2  0.0000      0.999 0.000 1.000
#> GSM62291     2  0.0000      0.999 0.000 1.000
#> GSM62265     1  0.0000      0.950 1.000 0.000
#> GSM62266     1  0.0000      0.950 1.000 0.000
#> GSM62296     2  0.0000      0.999 0.000 1.000
#> GSM62309     2  0.0000      0.999 0.000 1.000
#> GSM62295     2  0.0000      0.999 0.000 1.000
#> GSM62300     2  0.0000      0.999 0.000 1.000
#> GSM62308     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
#> GSM62248     2  0.0237      0.871 0.000 0.996 0.004
#> GSM62256     2  0.1170      0.867 0.016 0.976 0.008
#> GSM62259     2  0.0424      0.871 0.000 0.992 0.008
#> GSM62267     1  0.0475      0.917 0.992 0.004 0.004
#> GSM62280     1  0.3619      0.776 0.864 0.000 0.136
#> GSM62284     1  0.3412      0.779 0.876 0.000 0.124
#> GSM62289     2  0.0237      0.871 0.000 0.996 0.004
#> GSM62307     2  0.5497      0.775 0.000 0.708 0.292
#> GSM62316     2  0.0237      0.871 0.000 0.996 0.004
#> GSM62254     2  0.5591      0.769 0.000 0.696 0.304
#> GSM62292     2  0.5591      0.769 0.000 0.696 0.304
#> GSM62253     1  0.0237      0.919 0.996 0.004 0.000
#> GSM62270     3  0.5835      0.966 0.340 0.000 0.660
#> GSM62278     3  0.5835      0.966 0.340 0.000 0.660
#> GSM62297     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62298     2  0.1163      0.871 0.000 0.972 0.028
#> GSM62299     2  0.1031      0.868 0.000 0.976 0.024
#> GSM62258     1  0.0237      0.915 0.996 0.000 0.004
#> GSM62281     2  0.0424      0.871 0.000 0.992 0.008
#> GSM62294     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62305     2  0.0892      0.865 0.020 0.980 0.000
#> GSM62306     2  0.0237      0.871 0.000 0.996 0.004
#> GSM62310     2  0.5016      0.798 0.000 0.760 0.240
#> GSM62311     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62317     2  0.8858      0.234 0.332 0.532 0.136
#> GSM62318     1  0.3619      0.776 0.864 0.000 0.136
#> GSM62321     1  0.6788      0.479 0.744 0.120 0.136
#> GSM62322     3  0.5835      0.966 0.340 0.000 0.660
#> GSM62250     2  0.1031      0.863 0.024 0.976 0.000
#> GSM62252     2  0.1031      0.863 0.024 0.976 0.000
#> GSM62255     2  0.5591      0.769 0.000 0.696 0.304
#> GSM62257     2  0.4796      0.805 0.000 0.780 0.220
#> GSM62260     1  0.0661      0.916 0.988 0.004 0.008
#> GSM62261     2  0.0000      0.871 0.000 1.000 0.000
#> GSM62262     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62264     1  0.0237      0.919 0.996 0.004 0.000
#> GSM62268     1  0.0237      0.919 0.996 0.004 0.000
#> GSM62269     3  0.5835      0.966 0.340 0.000 0.660
#> GSM62271     1  0.0475      0.918 0.992 0.004 0.004
#> GSM62272     3  0.5835      0.966 0.340 0.000 0.660
#> GSM62273     2  0.0424      0.871 0.000 0.992 0.008
#> GSM62274     3  0.6299      0.727 0.476 0.000 0.524
#> GSM62275     3  0.5835      0.966 0.340 0.000 0.660
#> GSM62276     1  0.0475      0.917 0.992 0.004 0.004
#> GSM62277     3  0.5905      0.952 0.352 0.000 0.648
#> GSM62279     1  0.0237      0.919 0.996 0.004 0.000
#> GSM62282     1  0.3619      0.776 0.864 0.000 0.136
#> GSM62283     1  0.0237      0.919 0.996 0.004 0.000
#> GSM62286     2  0.0000      0.871 0.000 1.000 0.000
#> GSM62287     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62288     2  0.0000      0.871 0.000 1.000 0.000
#> GSM62290     2  0.1031      0.868 0.000 0.976 0.024
#> GSM62293     2  0.5591      0.769 0.000 0.696 0.304
#> GSM62301     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62302     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62303     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62304     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62312     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62313     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62314     2  0.0237      0.871 0.000 0.996 0.004
#> GSM62319     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62320     2  0.1031      0.870 0.000 0.976 0.024
#> GSM62249     2  0.5859      0.517 0.344 0.656 0.000
#> GSM62251     1  0.0237      0.919 0.996 0.004 0.000
#> GSM62263     2  0.5733      0.553 0.324 0.676 0.000
#> GSM62285     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62315     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62291     2  0.1031      0.868 0.000 0.976 0.024
#> GSM62265     1  0.0237      0.919 0.996 0.004 0.000
#> GSM62266     1  0.0237      0.919 0.996 0.004 0.000
#> GSM62296     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62309     2  0.0892      0.869 0.000 0.980 0.020
#> GSM62295     2  0.5621      0.768 0.000 0.692 0.308
#> GSM62300     2  0.1031      0.868 0.000 0.976 0.024
#> GSM62308     2  0.1031      0.868 0.000 0.976 0.024

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2 p3    p4
#> GSM62248     2  0.0188     0.3832 0.004 0.996 NA 0.000
#> GSM62256     2  0.5250    -0.8224 0.008 0.552 NA 0.440
#> GSM62259     2  0.5929     0.3729 0.000 0.688 NA 0.108
#> GSM62267     1  0.0188     0.8095 0.996 0.000 NA 0.004
#> GSM62280     1  0.6039     0.7092 0.596 0.000 NA 0.056
#> GSM62284     1  0.4158     0.7854 0.768 0.000 NA 0.224
#> GSM62289     2  0.1576     0.3595 0.048 0.948 NA 0.004
#> GSM62307     2  0.5070     0.5396 0.000 0.620 NA 0.008
#> GSM62316     2  0.0188     0.3854 0.000 0.996 NA 0.004
#> GSM62254     2  0.4948     0.5209 0.000 0.560 NA 0.000
#> GSM62292     2  0.4948     0.5209 0.000 0.560 NA 0.000
#> GSM62253     1  0.0336     0.8077 0.992 0.000 NA 0.008
#> GSM62270     1  0.7221     0.6460 0.436 0.000 NA 0.424
#> GSM62278     1  0.5055     0.7453 0.624 0.000 NA 0.368
#> GSM62297     2  0.1722     0.2977 0.008 0.944 NA 0.048
#> GSM62298     2  0.5675     0.4545 0.004 0.676 NA 0.048
#> GSM62299     4  0.5168     0.9984 0.004 0.492 NA 0.504
#> GSM62258     1  0.2281     0.8074 0.904 0.000 NA 0.096
#> GSM62281     2  0.4836    -0.3334 0.008 0.672 NA 0.320
#> GSM62294     2  0.4855     0.5418 0.000 0.600 NA 0.000
#> GSM62305     2  0.2805     0.2993 0.100 0.888 NA 0.012
#> GSM62306     2  0.0000     0.3871 0.000 1.000 NA 0.000
#> GSM62310     2  0.4018     0.5075 0.004 0.772 NA 0.000
#> GSM62311     2  0.4830     0.5454 0.000 0.608 NA 0.000
#> GSM62317     1  0.8464     0.5754 0.492 0.132 NA 0.076
#> GSM62318     1  0.6039     0.7092 0.596 0.000 NA 0.056
#> GSM62321     1  0.6570     0.7002 0.580 0.016 NA 0.056
#> GSM62322     1  0.7221     0.6460 0.436 0.000 NA 0.424
#> GSM62250     2  0.3052     0.2750 0.136 0.860 NA 0.004
#> GSM62252     2  0.4401     0.1027 0.272 0.724 NA 0.004
#> GSM62255     2  0.4830     0.5454 0.000 0.608 NA 0.000
#> GSM62257     2  0.4605     0.5275 0.000 0.664 NA 0.000
#> GSM62260     1  0.2773     0.8008 0.900 0.000 NA 0.028
#> GSM62261     2  0.0188     0.3832 0.004 0.996 NA 0.000
#> GSM62262     2  0.4855     0.5418 0.000 0.600 NA 0.000
#> GSM62264     1  0.2111     0.8019 0.932 0.000 NA 0.024
#> GSM62268     1  0.0592     0.8094 0.984 0.000 NA 0.016
#> GSM62269     1  0.7221     0.6460 0.436 0.000 NA 0.424
#> GSM62271     1  0.1716     0.8101 0.936 0.000 NA 0.064
#> GSM62272     1  0.7221     0.6460 0.436 0.000 NA 0.424
#> GSM62273     2  0.6258     0.3537 0.012 0.688 NA 0.108
#> GSM62274     1  0.4328     0.7809 0.748 0.000 NA 0.244
#> GSM62275     1  0.7221     0.6460 0.436 0.000 NA 0.424
#> GSM62276     1  0.0188     0.8095 0.996 0.000 NA 0.004
#> GSM62277     1  0.4857     0.7581 0.668 0.000 NA 0.324
#> GSM62279     1  0.0000     0.8090 1.000 0.000 NA 0.000
#> GSM62282     1  0.5916     0.7364 0.656 0.000 NA 0.072
#> GSM62283     1  0.0707     0.8050 0.980 0.000 NA 0.020
#> GSM62286     2  0.1661     0.3555 0.052 0.944 NA 0.004
#> GSM62287     2  0.4830     0.5454 0.000 0.608 NA 0.000
#> GSM62288     2  0.0188     0.3832 0.004 0.996 NA 0.000
#> GSM62290     4  0.5168     0.9984 0.004 0.492 NA 0.504
#> GSM62293     2  0.4948     0.5209 0.000 0.560 NA 0.000
#> GSM62301     4  0.5168     0.9984 0.004 0.492 NA 0.504
#> GSM62302     2  0.4830     0.5454 0.000 0.608 NA 0.000
#> GSM62303     2  0.4830     0.5454 0.000 0.608 NA 0.000
#> GSM62304     2  0.4830     0.5454 0.000 0.608 NA 0.000
#> GSM62312     2  0.5167    -0.9644 0.004 0.508 NA 0.488
#> GSM62313     2  0.4830     0.5454 0.000 0.608 NA 0.000
#> GSM62314     2  0.0188     0.3854 0.000 0.996 NA 0.004
#> GSM62319     2  0.6719    -0.0753 0.240 0.608 NA 0.152
#> GSM62320     2  0.7289    -0.3325 0.004 0.544 NA 0.284
#> GSM62249     1  0.3757     0.6719 0.828 0.152 NA 0.020
#> GSM62251     1  0.0469     0.8068 0.988 0.000 NA 0.012
#> GSM62263     1  0.5512     0.3769 0.660 0.300 NA 0.040
#> GSM62285     4  0.5168     0.9984 0.004 0.492 NA 0.504
#> GSM62315     2  0.7468    -0.4748 0.196 0.484 NA 0.320
#> GSM62291     4  0.5168     0.9984 0.004 0.492 NA 0.504
#> GSM62265     1  0.0336     0.8077 0.992 0.000 NA 0.008
#> GSM62266     1  0.0336     0.8077 0.992 0.000 NA 0.008
#> GSM62296     4  0.5168     0.9886 0.004 0.496 NA 0.500
#> GSM62309     2  0.7443    -0.4789 0.196 0.492 NA 0.312
#> GSM62295     2  0.4948     0.5209 0.000 0.560 NA 0.000
#> GSM62300     4  0.5168     0.9984 0.004 0.492 NA 0.504
#> GSM62308     4  0.5168     0.9984 0.004 0.492 NA 0.504

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     5  0.6245     0.4795 0.000 0.144 0.000 0.416 0.440
#> GSM62256     2  0.3883     0.7155 0.004 0.744 0.000 0.244 0.008
#> GSM62259     4  0.2248     0.7669 0.000 0.088 0.000 0.900 0.012
#> GSM62267     1  0.1544     0.7979 0.932 0.000 0.068 0.000 0.000
#> GSM62280     5  0.6739    -0.3464 0.348 0.000 0.260 0.000 0.392
#> GSM62284     1  0.2648     0.7347 0.848 0.000 0.152 0.000 0.000
#> GSM62289     5  0.6177     0.4832 0.000 0.136 0.000 0.400 0.464
#> GSM62307     4  0.2361     0.7741 0.000 0.096 0.000 0.892 0.012
#> GSM62316     5  0.6191     0.4653 0.000 0.136 0.000 0.428 0.436
#> GSM62254     4  0.3321     0.7200 0.000 0.032 0.000 0.832 0.136
#> GSM62292     4  0.3321     0.7200 0.000 0.032 0.000 0.832 0.136
#> GSM62253     1  0.0404     0.8076 0.988 0.000 0.012 0.000 0.000
#> GSM62270     3  0.3636     1.0000 0.272 0.000 0.728 0.000 0.000
#> GSM62278     1  0.3210     0.6694 0.788 0.000 0.212 0.000 0.000
#> GSM62297     5  0.6783     0.4287 0.004 0.232 0.000 0.340 0.424
#> GSM62298     4  0.3980     0.4523 0.000 0.284 0.000 0.708 0.008
#> GSM62299     2  0.2179     0.8138 0.000 0.888 0.000 0.112 0.000
#> GSM62258     1  0.2710     0.8003 0.892 0.008 0.064 0.000 0.036
#> GSM62281     2  0.4670     0.3303 0.004 0.548 0.000 0.440 0.008
#> GSM62294     4  0.0000     0.8506 0.000 0.000 0.000 1.000 0.000
#> GSM62305     5  0.6846     0.4880 0.024 0.152 0.000 0.368 0.456
#> GSM62306     5  0.6219     0.4692 0.000 0.140 0.000 0.424 0.436
#> GSM62310     4  0.3031     0.6939 0.004 0.016 0.000 0.852 0.128
#> GSM62311     4  0.0162     0.8480 0.000 0.004 0.000 0.996 0.000
#> GSM62317     5  0.7974    -0.2865 0.296 0.068 0.260 0.004 0.372
#> GSM62318     5  0.6726    -0.3616 0.360 0.000 0.252 0.000 0.388
#> GSM62321     5  0.6872    -0.3365 0.340 0.004 0.260 0.000 0.396
#> GSM62322     3  0.3636     1.0000 0.272 0.000 0.728 0.000 0.000
#> GSM62250     5  0.6911     0.4717 0.044 0.116 0.000 0.380 0.460
#> GSM62252     5  0.8202     0.3283 0.296 0.116 0.000 0.240 0.348
#> GSM62255     4  0.0162     0.8490 0.000 0.000 0.000 0.996 0.004
#> GSM62257     4  0.1942     0.7828 0.000 0.068 0.000 0.920 0.012
#> GSM62260     1  0.4867     0.6159 0.716 0.000 0.104 0.000 0.180
#> GSM62261     5  0.6247     0.4736 0.000 0.144 0.000 0.420 0.436
#> GSM62262     4  0.0000     0.8506 0.000 0.000 0.000 1.000 0.000
#> GSM62264     1  0.3239     0.7267 0.828 0.004 0.012 0.000 0.156
#> GSM62268     1  0.0963     0.8075 0.964 0.000 0.036 0.000 0.000
#> GSM62269     3  0.3636     1.0000 0.272 0.000 0.728 0.000 0.000
#> GSM62271     1  0.2227     0.8078 0.916 0.004 0.032 0.000 0.048
#> GSM62272     3  0.3636     1.0000 0.272 0.000 0.728 0.000 0.000
#> GSM62273     4  0.4206     0.4908 0.000 0.272 0.000 0.708 0.020
#> GSM62274     1  0.2605     0.7388 0.852 0.000 0.148 0.000 0.000
#> GSM62275     3  0.3636     1.0000 0.272 0.000 0.728 0.000 0.000
#> GSM62276     1  0.1544     0.7979 0.932 0.000 0.068 0.000 0.000
#> GSM62277     1  0.2648     0.7347 0.848 0.000 0.152 0.000 0.000
#> GSM62279     1  0.0162     0.8114 0.996 0.000 0.004 0.000 0.000
#> GSM62282     1  0.6612     0.2991 0.456 0.000 0.248 0.000 0.296
#> GSM62283     1  0.1041     0.8098 0.964 0.004 0.000 0.000 0.032
#> GSM62286     5  0.6177     0.4832 0.000 0.136 0.000 0.400 0.464
#> GSM62287     4  0.0000     0.8506 0.000 0.000 0.000 1.000 0.000
#> GSM62288     5  0.6245     0.4795 0.000 0.144 0.000 0.416 0.440
#> GSM62290     2  0.3003     0.7878 0.000 0.812 0.000 0.188 0.000
#> GSM62293     4  0.3321     0.7200 0.000 0.032 0.000 0.832 0.136
#> GSM62301     2  0.1792     0.8053 0.000 0.916 0.000 0.084 0.000
#> GSM62302     4  0.0000     0.8506 0.000 0.000 0.000 1.000 0.000
#> GSM62303     4  0.0000     0.8506 0.000 0.000 0.000 1.000 0.000
#> GSM62304     4  0.0000     0.8506 0.000 0.000 0.000 1.000 0.000
#> GSM62312     2  0.2852     0.8006 0.000 0.828 0.000 0.172 0.000
#> GSM62313     4  0.0000     0.8506 0.000 0.000 0.000 1.000 0.000
#> GSM62314     5  0.6102     0.4528 0.000 0.124 0.000 0.436 0.440
#> GSM62319     2  0.8617     0.0765 0.324 0.376 0.104 0.156 0.040
#> GSM62320     2  0.3969     0.6729 0.000 0.692 0.000 0.304 0.004
#> GSM62249     1  0.4170     0.7023 0.804 0.016 0.008 0.036 0.136
#> GSM62251     1  0.1851     0.7803 0.912 0.000 0.000 0.000 0.088
#> GSM62263     1  0.6079     0.5627 0.676 0.136 0.012 0.032 0.144
#> GSM62285     2  0.1792     0.8053 0.000 0.916 0.000 0.084 0.000
#> GSM62315     2  0.4061     0.6940 0.004 0.816 0.116 0.044 0.020
#> GSM62291     2  0.2813     0.8035 0.000 0.832 0.000 0.168 0.000
#> GSM62265     1  0.0000     0.8108 1.000 0.000 0.000 0.000 0.000
#> GSM62266     1  0.0404     0.8076 0.988 0.000 0.012 0.000 0.000
#> GSM62296     2  0.2605     0.8107 0.000 0.852 0.000 0.148 0.000
#> GSM62309     2  0.4111     0.7509 0.004 0.796 0.116 0.084 0.000
#> GSM62295     4  0.3366     0.7201 0.000 0.032 0.000 0.828 0.140
#> GSM62300     2  0.2127     0.8142 0.000 0.892 0.000 0.108 0.000
#> GSM62308     2  0.1908     0.8094 0.000 0.908 0.000 0.092 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
#> GSM62248     5  0.4314     0.9087 0.000 0.184 0.000 0.096 0.720 0.000
#> GSM62256     2  0.3522     0.7166 0.000 0.800 0.000 0.128 0.072 0.000
#> GSM62259     4  0.5269     0.6939 0.000 0.248 0.000 0.596 0.156 0.000
#> GSM62267     1  0.1957     0.7448 0.888 0.000 0.112 0.000 0.000 0.000
#> GSM62280     6  0.1168     0.8040 0.016 0.000 0.000 0.000 0.028 0.956
#> GSM62284     1  0.2631     0.7061 0.820 0.000 0.180 0.000 0.000 0.000
#> GSM62289     5  0.3961     0.9124 0.000 0.124 0.000 0.112 0.764 0.000
#> GSM62307     4  0.5257     0.6822 0.000 0.280 0.000 0.584 0.136 0.000
#> GSM62316     5  0.4603     0.8864 0.000 0.156 0.000 0.148 0.696 0.000
#> GSM62254     4  0.1765     0.7944 0.000 0.096 0.000 0.904 0.000 0.000
#> GSM62292     4  0.1765     0.7944 0.000 0.096 0.000 0.904 0.000 0.000
#> GSM62253     1  0.0603     0.7561 0.980 0.000 0.000 0.000 0.004 0.016
#> GSM62270     3  0.0000     0.9458 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.2793     0.6996 0.200 0.000 0.800 0.000 0.000 0.000
#> GSM62297     5  0.4975     0.7443 0.000 0.312 0.000 0.092 0.596 0.000
#> GSM62298     2  0.5784    -0.2610 0.000 0.420 0.000 0.404 0.176 0.000
#> GSM62299     2  0.0790     0.7977 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM62258     1  0.4681     0.6388 0.676 0.000 0.112 0.000 0.000 0.212
#> GSM62281     2  0.4148     0.6504 0.000 0.744 0.000 0.148 0.108 0.000
#> GSM62294     4  0.3088     0.8384 0.000 0.120 0.000 0.832 0.048 0.000
#> GSM62305     5  0.4003     0.9117 0.000 0.124 0.000 0.116 0.760 0.000
#> GSM62306     5  0.4267     0.9144 0.000 0.152 0.000 0.116 0.732 0.000
#> GSM62310     4  0.4762     0.7985 0.000 0.176 0.000 0.676 0.148 0.000
#> GSM62311     4  0.4148     0.8503 0.000 0.148 0.000 0.744 0.108 0.000
#> GSM62317     6  0.4764     0.6985 0.016 0.112 0.000 0.096 0.028 0.748
#> GSM62318     6  0.0458     0.8013 0.016 0.000 0.000 0.000 0.000 0.984
#> GSM62321     6  0.2807     0.7824 0.016 0.000 0.000 0.088 0.028 0.868
#> GSM62322     3  0.0000     0.9458 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.4702     0.8897 0.032 0.124 0.000 0.112 0.732 0.000
#> GSM62252     5  0.5282     0.8642 0.036 0.124 0.000 0.112 0.708 0.020
#> GSM62255     4  0.4039     0.8269 0.000 0.208 0.000 0.732 0.060 0.000
#> GSM62257     4  0.5348     0.6023 0.000 0.152 0.000 0.576 0.272 0.000
#> GSM62260     6  0.3923     0.0962 0.416 0.000 0.000 0.000 0.004 0.580
#> GSM62261     5  0.4299     0.9059 0.000 0.188 0.000 0.092 0.720 0.000
#> GSM62262     4  0.3088     0.8384 0.000 0.120 0.000 0.832 0.048 0.000
#> GSM62264     1  0.5465     0.3986 0.572 0.000 0.000 0.000 0.208 0.220
#> GSM62268     1  0.0603     0.7561 0.980 0.000 0.000 0.000 0.004 0.016
#> GSM62269     3  0.0000     0.9458 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     1  0.3952     0.5161 0.672 0.000 0.020 0.000 0.000 0.308
#> GSM62272     3  0.0000     0.9458 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2  0.6081     0.1053 0.000 0.492 0.000 0.348 0.128 0.032
#> GSM62274     1  0.2664     0.7047 0.816 0.000 0.184 0.000 0.000 0.000
#> GSM62275     3  0.0000     0.9458 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     1  0.1957     0.7448 0.888 0.000 0.112 0.000 0.000 0.000
#> GSM62277     1  0.2664     0.7047 0.816 0.000 0.184 0.000 0.000 0.000
#> GSM62279     1  0.0146     0.7574 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM62282     6  0.1753     0.7646 0.084 0.000 0.004 0.000 0.000 0.912
#> GSM62283     1  0.3023     0.6454 0.784 0.000 0.004 0.000 0.000 0.212
#> GSM62286     5  0.3961     0.9124 0.000 0.124 0.000 0.112 0.764 0.000
#> GSM62287     4  0.4148     0.8503 0.000 0.148 0.000 0.744 0.108 0.000
#> GSM62288     5  0.4314     0.9087 0.000 0.184 0.000 0.096 0.720 0.000
#> GSM62290     2  0.1682     0.7800 0.000 0.928 0.000 0.052 0.020 0.000
#> GSM62293     4  0.1765     0.7944 0.000 0.096 0.000 0.904 0.000 0.000
#> GSM62301     2  0.0000     0.7889 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62302     4  0.4427     0.8274 0.000 0.148 0.000 0.716 0.136 0.000
#> GSM62303     4  0.4148     0.8503 0.000 0.148 0.000 0.744 0.108 0.000
#> GSM62304     4  0.4148     0.8503 0.000 0.148 0.000 0.744 0.108 0.000
#> GSM62312     2  0.1265     0.7914 0.000 0.948 0.000 0.044 0.008 0.000
#> GSM62313     4  0.4148     0.8503 0.000 0.148 0.000 0.744 0.108 0.000
#> GSM62314     5  0.4603     0.8864 0.000 0.156 0.000 0.148 0.696 0.000
#> GSM62319     2  0.6988     0.2925 0.016 0.440 0.000 0.064 0.148 0.332
#> GSM62320     2  0.3176     0.7400 0.000 0.832 0.000 0.084 0.084 0.000
#> GSM62249     1  0.6953     0.2813 0.560 0.140 0.004 0.080 0.032 0.184
#> GSM62251     1  0.4024     0.6278 0.744 0.000 0.000 0.000 0.184 0.072
#> GSM62263     1  0.7723     0.2395 0.424 0.136 0.000 0.028 0.228 0.184
#> GSM62285     2  0.0146     0.7917 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM62315     2  0.2882     0.6669 0.000 0.812 0.000 0.008 0.000 0.180
#> GSM62291     2  0.0820     0.7986 0.000 0.972 0.000 0.016 0.012 0.000
#> GSM62265     1  0.0146     0.7574 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM62266     1  0.0603     0.7561 0.980 0.000 0.000 0.000 0.004 0.016
#> GSM62296     2  0.1686     0.7841 0.000 0.924 0.000 0.012 0.064 0.000
#> GSM62309     2  0.2744     0.7173 0.000 0.840 0.000 0.000 0.016 0.144
#> GSM62295     4  0.1814     0.7925 0.000 0.100 0.000 0.900 0.000 0.000
#> GSM62300     2  0.0363     0.7957 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM62308     2  0.0458     0.7971 0.000 0.984 0.000 0.016 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) other(p) genotype/variation(p) k
#> CV:mclust 72          0.74742    1.000                 0.811 2
#> CV:mclust 73          0.36173    0.761                 0.741 3
#> CV:mclust 52          0.00271    0.586                 0.143 4
#> CV:mclust 54          0.01162    0.853                 0.481 5
#> CV:mclust 68          0.00312    0.768                 0.462 6

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


CV:NMF*

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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.972           0.963       0.984         0.4381 0.559   0.559
#> 3 3 0.925           0.889       0.955         0.2862 0.835   0.714
#> 4 4 0.818           0.826       0.921         0.1353 0.901   0.781
#> 5 5 0.651           0.581       0.805         0.1779 0.776   0.469
#> 6 6 0.784           0.758       0.884         0.0788 0.836   0.446

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
#> GSM62248     2   0.000      0.991 0.000 1.000
#> GSM62256     2   0.000      0.991 0.000 1.000
#> GSM62259     2   0.000      0.991 0.000 1.000
#> GSM62267     1   0.000      0.967 1.000 0.000
#> GSM62280     1   0.000      0.967 1.000 0.000
#> GSM62284     1   0.000      0.967 1.000 0.000
#> GSM62289     2   0.000      0.991 0.000 1.000
#> GSM62307     2   0.000      0.991 0.000 1.000
#> GSM62316     2   0.000      0.991 0.000 1.000
#> GSM62254     2   0.000      0.991 0.000 1.000
#> GSM62292     2   0.000      0.991 0.000 1.000
#> GSM62253     1   0.000      0.967 1.000 0.000
#> GSM62270     1   0.000      0.967 1.000 0.000
#> GSM62278     1   0.000      0.967 1.000 0.000
#> GSM62297     2   0.000      0.991 0.000 1.000
#> GSM62298     2   0.000      0.991 0.000 1.000
#> GSM62299     2   0.000      0.991 0.000 1.000
#> GSM62258     1   0.000      0.967 1.000 0.000
#> GSM62281     2   0.000      0.991 0.000 1.000
#> GSM62294     2   0.000      0.991 0.000 1.000
#> GSM62305     2   0.000      0.991 0.000 1.000
#> GSM62306     2   0.000      0.991 0.000 1.000
#> GSM62310     2   0.000      0.991 0.000 1.000
#> GSM62311     2   0.000      0.991 0.000 1.000
#> GSM62317     2   0.000      0.991 0.000 1.000
#> GSM62318     1   0.000      0.967 1.000 0.000
#> GSM62321     2   0.781      0.687 0.232 0.768
#> GSM62322     1   0.000      0.967 1.000 0.000
#> GSM62250     2   0.000      0.991 0.000 1.000
#> GSM62252     2   0.000      0.991 0.000 1.000
#> GSM62255     2   0.000      0.991 0.000 1.000
#> GSM62257     2   0.000      0.991 0.000 1.000
#> GSM62260     1   0.850      0.629 0.724 0.276
#> GSM62261     2   0.000      0.991 0.000 1.000
#> GSM62262     2   0.000      0.991 0.000 1.000
#> GSM62264     1   0.552      0.843 0.872 0.128
#> GSM62268     1   0.000      0.967 1.000 0.000
#> GSM62269     1   0.000      0.967 1.000 0.000
#> GSM62271     1   0.000      0.967 1.000 0.000
#> GSM62272     1   0.000      0.967 1.000 0.000
#> GSM62273     2   0.000      0.991 0.000 1.000
#> GSM62274     1   0.000      0.967 1.000 0.000
#> GSM62275     1   0.000      0.967 1.000 0.000
#> GSM62276     1   0.000      0.967 1.000 0.000
#> GSM62277     1   0.000      0.967 1.000 0.000
#> GSM62279     1   0.000      0.967 1.000 0.000
#> GSM62282     1   0.000      0.967 1.000 0.000
#> GSM62283     1   0.929      0.487 0.656 0.344
#> GSM62286     2   0.000      0.991 0.000 1.000
#> GSM62287     2   0.000      0.991 0.000 1.000
#> GSM62288     2   0.000      0.991 0.000 1.000
#> GSM62290     2   0.000      0.991 0.000 1.000
#> GSM62293     2   0.000      0.991 0.000 1.000
#> GSM62301     2   0.000      0.991 0.000 1.000
#> GSM62302     2   0.000      0.991 0.000 1.000
#> GSM62303     2   0.000      0.991 0.000 1.000
#> GSM62304     2   0.000      0.991 0.000 1.000
#> GSM62312     2   0.000      0.991 0.000 1.000
#> GSM62313     2   0.000      0.991 0.000 1.000
#> GSM62314     2   0.000      0.991 0.000 1.000
#> GSM62319     2   0.000      0.991 0.000 1.000
#> GSM62320     2   0.000      0.991 0.000 1.000
#> GSM62249     2   0.000      0.991 0.000 1.000
#> GSM62251     2   0.722      0.741 0.200 0.800
#> GSM62263     2   0.000      0.991 0.000 1.000
#> GSM62285     2   0.000      0.991 0.000 1.000
#> GSM62315     2   0.000      0.991 0.000 1.000
#> GSM62291     2   0.000      0.991 0.000 1.000
#> GSM62265     1   0.000      0.967 1.000 0.000
#> GSM62266     1   0.000      0.967 1.000 0.000
#> GSM62296     2   0.000      0.991 0.000 1.000
#> GSM62309     2   0.000      0.991 0.000 1.000
#> GSM62295     2   0.000      0.991 0.000 1.000
#> GSM62300     2   0.000      0.991 0.000 1.000
#> GSM62308     2   0.000      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
#> GSM62248     2  0.1163    0.96014 0.028 0.972 0.000
#> GSM62256     2  0.1031    0.96826 0.024 0.976 0.000
#> GSM62259     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62267     3  0.0237    0.93331 0.000 0.004 0.996
#> GSM62280     1  0.1964    0.77460 0.944 0.000 0.056
#> GSM62284     3  0.4842    0.69062 0.224 0.000 0.776
#> GSM62289     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62307     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62316     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62254     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62292     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62253     1  0.6062    0.36838 0.616 0.000 0.384
#> GSM62270     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62278     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62297     2  0.0237    0.98606 0.004 0.996 0.000
#> GSM62298     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62299     2  0.0237    0.98606 0.004 0.996 0.000
#> GSM62258     3  0.1529    0.90798 0.040 0.000 0.960
#> GSM62281     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62294     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62305     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62306     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62310     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62311     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62317     1  0.4887    0.56950 0.772 0.228 0.000
#> GSM62318     1  0.0000    0.79765 1.000 0.000 0.000
#> GSM62321     1  0.0000    0.79765 1.000 0.000 0.000
#> GSM62322     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62250     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62252     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62255     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62257     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62260     1  0.0237    0.79786 0.996 0.000 0.004
#> GSM62261     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62262     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62264     1  0.0237    0.79786 0.996 0.000 0.004
#> GSM62268     1  0.6126    0.32971 0.600 0.000 0.400
#> GSM62269     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62271     3  0.0237    0.93498 0.004 0.000 0.996
#> GSM62272     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62273     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62274     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62275     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62276     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62277     3  0.0000    0.93722 0.000 0.000 1.000
#> GSM62279     3  0.5016    0.66278 0.240 0.000 0.760
#> GSM62282     3  0.4887    0.66283 0.228 0.000 0.772
#> GSM62283     1  0.1163    0.79340 0.972 0.000 0.028
#> GSM62286     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62287     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62288     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62290     2  0.0237    0.98606 0.004 0.996 0.000
#> GSM62293     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62301     2  0.0424    0.98365 0.008 0.992 0.000
#> GSM62302     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62303     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62304     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62312     2  0.0237    0.98606 0.004 0.996 0.000
#> GSM62313     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62314     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62319     2  0.0237    0.98606 0.004 0.996 0.000
#> GSM62320     2  0.0237    0.98606 0.004 0.996 0.000
#> GSM62249     1  0.0592    0.79521 0.988 0.012 0.000
#> GSM62251     1  0.3690    0.75753 0.884 0.016 0.100
#> GSM62263     1  0.0000    0.79765 1.000 0.000 0.000
#> GSM62285     2  0.0424    0.98365 0.008 0.992 0.000
#> GSM62315     2  0.6095    0.32793 0.392 0.608 0.000
#> GSM62291     2  0.0424    0.98365 0.008 0.992 0.000
#> GSM62265     1  0.4178    0.70390 0.828 0.000 0.172
#> GSM62266     1  0.5016    0.62694 0.760 0.000 0.240
#> GSM62296     2  0.0237    0.98606 0.004 0.996 0.000
#> GSM62309     1  0.6307    0.00733 0.512 0.488 0.000
#> GSM62295     2  0.0000    0.98776 0.000 1.000 0.000
#> GSM62300     2  0.0424    0.98365 0.008 0.992 0.000
#> GSM62308     2  0.0424    0.98365 0.008 0.992 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     2  0.2469    0.86969 0.108 0.892 0.000 0.000
#> GSM62256     2  0.4981    0.21062 0.000 0.536 0.000 0.464
#> GSM62259     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62267     1  0.4720    0.53458 0.720 0.016 0.264 0.000
#> GSM62280     4  0.0000    0.95434 0.000 0.000 0.000 1.000
#> GSM62284     1  0.4431    0.49318 0.696 0.000 0.304 0.000
#> GSM62289     2  0.4713    0.41476 0.360 0.640 0.000 0.000
#> GSM62307     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62316     2  0.0592    0.93561 0.016 0.984 0.000 0.000
#> GSM62254     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62292     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62253     1  0.0524    0.77953 0.988 0.000 0.008 0.004
#> GSM62270     3  0.0000    0.87509 0.000 0.000 1.000 0.000
#> GSM62278     3  0.0000    0.87509 0.000 0.000 1.000 0.000
#> GSM62297     2  0.3142    0.83796 0.132 0.860 0.000 0.008
#> GSM62298     2  0.0657    0.93840 0.004 0.984 0.000 0.012
#> GSM62299     2  0.1151    0.93300 0.008 0.968 0.000 0.024
#> GSM62258     3  0.3448    0.75057 0.168 0.000 0.828 0.004
#> GSM62281     2  0.0592    0.93830 0.000 0.984 0.000 0.016
#> GSM62294     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62305     2  0.3528    0.76918 0.192 0.808 0.000 0.000
#> GSM62306     2  0.0188    0.94027 0.004 0.996 0.000 0.000
#> GSM62310     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62311     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62317     4  0.0000    0.95434 0.000 0.000 0.000 1.000
#> GSM62318     4  0.0592    0.94586 0.016 0.000 0.000 0.984
#> GSM62321     4  0.0000    0.95434 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000    0.87509 0.000 0.000 1.000 0.000
#> GSM62250     1  0.4925    0.24468 0.572 0.428 0.000 0.000
#> GSM62252     1  0.4776    0.39741 0.624 0.376 0.000 0.000
#> GSM62255     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62257     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62260     4  0.1557    0.92991 0.056 0.000 0.000 0.944
#> GSM62261     2  0.0921    0.92969 0.028 0.972 0.000 0.000
#> GSM62262     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62264     1  0.3266    0.69326 0.832 0.000 0.000 0.168
#> GSM62268     1  0.3105    0.70923 0.856 0.000 0.140 0.004
#> GSM62269     3  0.0000    0.87509 0.000 0.000 1.000 0.000
#> GSM62271     3  0.1557    0.84607 0.056 0.000 0.944 0.000
#> GSM62272     3  0.0000    0.87509 0.000 0.000 1.000 0.000
#> GSM62273     2  0.0779    0.93715 0.004 0.980 0.000 0.016
#> GSM62274     3  0.4992    0.00268 0.476 0.000 0.524 0.000
#> GSM62275     3  0.0000    0.87509 0.000 0.000 1.000 0.000
#> GSM62276     3  0.4277    0.60312 0.280 0.000 0.720 0.000
#> GSM62277     3  0.0336    0.87228 0.008 0.000 0.992 0.000
#> GSM62279     1  0.0469    0.77785 0.988 0.000 0.012 0.000
#> GSM62282     3  0.3907    0.66275 0.000 0.000 0.768 0.232
#> GSM62283     1  0.4188    0.68073 0.812 0.000 0.148 0.040
#> GSM62286     2  0.1867    0.89795 0.072 0.928 0.000 0.000
#> GSM62287     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62288     2  0.1389    0.91746 0.048 0.952 0.000 0.000
#> GSM62290     2  0.0927    0.93601 0.008 0.976 0.000 0.016
#> GSM62293     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62301     2  0.4248    0.72886 0.012 0.768 0.000 0.220
#> GSM62302     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62312     2  0.0927    0.93601 0.008 0.976 0.000 0.016
#> GSM62313     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62314     2  0.0707    0.93375 0.020 0.980 0.000 0.000
#> GSM62319     2  0.2342    0.89856 0.008 0.912 0.000 0.080
#> GSM62320     2  0.0927    0.93601 0.008 0.976 0.000 0.016
#> GSM62249     1  0.1118    0.77686 0.964 0.000 0.000 0.036
#> GSM62251     1  0.0336    0.78030 0.992 0.000 0.000 0.008
#> GSM62263     1  0.3219    0.69023 0.836 0.000 0.000 0.164
#> GSM62285     2  0.2271    0.90124 0.008 0.916 0.000 0.076
#> GSM62315     4  0.2342    0.86208 0.008 0.080 0.000 0.912
#> GSM62291     2  0.1452    0.92745 0.008 0.956 0.000 0.036
#> GSM62265     1  0.0469    0.78066 0.988 0.000 0.000 0.012
#> GSM62266     1  0.0895    0.78055 0.976 0.000 0.004 0.020
#> GSM62296     2  0.1970    0.91280 0.008 0.932 0.000 0.060
#> GSM62309     4  0.1888    0.93491 0.044 0.016 0.000 0.940
#> GSM62295     2  0.0000    0.94150 0.000 1.000 0.000 0.000
#> GSM62300     2  0.1970    0.91343 0.008 0.932 0.000 0.060
#> GSM62308     2  0.3351    0.83370 0.008 0.844 0.000 0.148

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     4  0.1082    0.72508 0.028 0.008 0.000 0.964 0.000
#> GSM62256     5  0.1012    0.81554 0.000 0.012 0.000 0.020 0.968
#> GSM62259     4  0.4219    0.18105 0.000 0.416 0.000 0.584 0.000
#> GSM62267     4  0.3991    0.46763 0.172 0.000 0.048 0.780 0.000
#> GSM62280     5  0.0404    0.82472 0.012 0.000 0.000 0.000 0.988
#> GSM62284     1  0.4114    0.31381 0.624 0.000 0.376 0.000 0.000
#> GSM62289     4  0.0404    0.72229 0.012 0.000 0.000 0.988 0.000
#> GSM62307     2  0.4249    0.28807 0.000 0.568 0.000 0.432 0.000
#> GSM62316     4  0.0963    0.72171 0.000 0.036 0.000 0.964 0.000
#> GSM62254     2  0.4262    0.29089 0.000 0.560 0.000 0.440 0.000
#> GSM62292     4  0.4278    0.01471 0.000 0.452 0.000 0.548 0.000
#> GSM62253     1  0.0162    0.74665 0.996 0.000 0.004 0.000 0.000
#> GSM62270     3  0.0000    0.97676 0.000 0.000 1.000 0.000 0.000
#> GSM62278     3  0.0000    0.97676 0.000 0.000 1.000 0.000 0.000
#> GSM62297     2  0.4385    0.31812 0.312 0.672 0.000 0.004 0.012
#> GSM62298     2  0.0865    0.64447 0.000 0.972 0.000 0.024 0.004
#> GSM62299     2  0.1012    0.64330 0.020 0.968 0.000 0.000 0.012
#> GSM62258     5  0.5445    0.35615 0.016 0.000 0.032 0.420 0.532
#> GSM62281     2  0.5982    0.38328 0.000 0.552 0.000 0.312 0.136
#> GSM62294     2  0.4138    0.39953 0.000 0.616 0.000 0.384 0.000
#> GSM62305     4  0.2387    0.67632 0.040 0.048 0.000 0.908 0.004
#> GSM62306     4  0.0880    0.72259 0.000 0.032 0.000 0.968 0.000
#> GSM62310     2  0.4397    0.30451 0.000 0.564 0.000 0.432 0.004
#> GSM62311     2  0.4350    0.35508 0.000 0.588 0.000 0.408 0.004
#> GSM62317     5  0.0324    0.82301 0.004 0.004 0.000 0.000 0.992
#> GSM62318     5  0.0404    0.82472 0.012 0.000 0.000 0.000 0.988
#> GSM62321     5  0.0404    0.82472 0.012 0.000 0.000 0.000 0.988
#> GSM62322     3  0.0000    0.97676 0.000 0.000 1.000 0.000 0.000
#> GSM62250     4  0.1544    0.68404 0.068 0.000 0.000 0.932 0.000
#> GSM62252     4  0.0880    0.71468 0.032 0.000 0.000 0.968 0.000
#> GSM62255     2  0.3816    0.49027 0.000 0.696 0.000 0.304 0.000
#> GSM62257     4  0.2891    0.63257 0.000 0.176 0.000 0.824 0.000
#> GSM62260     5  0.4019    0.63465 0.152 0.052 0.000 0.004 0.792
#> GSM62261     4  0.3612    0.48337 0.000 0.268 0.000 0.732 0.000
#> GSM62262     2  0.4088    0.42339 0.000 0.632 0.000 0.368 0.000
#> GSM62264     1  0.1357    0.72693 0.948 0.004 0.000 0.000 0.048
#> GSM62268     1  0.2424    0.67733 0.868 0.000 0.132 0.000 0.000
#> GSM62269     3  0.0000    0.97676 0.000 0.000 1.000 0.000 0.000
#> GSM62271     3  0.1571    0.91585 0.060 0.004 0.936 0.000 0.000
#> GSM62272     3  0.0000    0.97676 0.000 0.000 1.000 0.000 0.000
#> GSM62273     2  0.1571    0.63476 0.000 0.936 0.000 0.060 0.004
#> GSM62274     3  0.1908    0.88525 0.092 0.000 0.908 0.000 0.000
#> GSM62275     3  0.0000    0.97676 0.000 0.000 1.000 0.000 0.000
#> GSM62276     4  0.4780    0.34249 0.060 0.000 0.248 0.692 0.000
#> GSM62277     3  0.0000    0.97676 0.000 0.000 1.000 0.000 0.000
#> GSM62279     1  0.4114    0.39189 0.624 0.000 0.000 0.376 0.000
#> GSM62282     5  0.3913    0.46562 0.000 0.000 0.324 0.000 0.676
#> GSM62283     1  0.8505    0.33881 0.428 0.256 0.088 0.188 0.040
#> GSM62286     4  0.0162    0.72413 0.000 0.004 0.000 0.996 0.000
#> GSM62287     4  0.3895    0.41993 0.000 0.320 0.000 0.680 0.000
#> GSM62288     4  0.2900    0.68174 0.028 0.108 0.000 0.864 0.000
#> GSM62290     2  0.1830    0.62714 0.068 0.924 0.000 0.000 0.008
#> GSM62293     2  0.4088    0.42353 0.000 0.632 0.000 0.368 0.000
#> GSM62301     2  0.3039    0.55069 0.152 0.836 0.000 0.000 0.012
#> GSM62302     2  0.4278    0.25842 0.000 0.548 0.000 0.452 0.000
#> GSM62303     2  0.4305    0.14691 0.000 0.512 0.000 0.488 0.000
#> GSM62304     4  0.4150    0.24103 0.000 0.388 0.000 0.612 0.000
#> GSM62312     2  0.1267    0.64714 0.012 0.960 0.000 0.024 0.004
#> GSM62313     2  0.4291    0.22489 0.000 0.536 0.000 0.464 0.000
#> GSM62314     4  0.4716    0.37766 0.036 0.308 0.000 0.656 0.000
#> GSM62319     2  0.1029    0.64584 0.008 0.972 0.004 0.008 0.008
#> GSM62320     2  0.0671    0.64644 0.000 0.980 0.000 0.016 0.004
#> GSM62249     1  0.7032    0.39064 0.492 0.216 0.000 0.264 0.028
#> GSM62251     1  0.0162    0.74752 0.996 0.000 0.000 0.004 0.000
#> GSM62263     1  0.1792    0.70839 0.916 0.084 0.000 0.000 0.000
#> GSM62285     2  0.2011    0.61623 0.088 0.908 0.000 0.000 0.004
#> GSM62315     2  0.4735    0.30014 0.048 0.680 0.000 0.000 0.272
#> GSM62291     2  0.0798    0.64533 0.016 0.976 0.000 0.000 0.008
#> GSM62265     1  0.1369    0.74199 0.956 0.008 0.000 0.028 0.008
#> GSM62266     1  0.0000    0.74708 1.000 0.000 0.000 0.000 0.000
#> GSM62296     2  0.1211    0.64212 0.016 0.960 0.000 0.000 0.024
#> GSM62309     2  0.6361   -0.00792 0.196 0.508 0.000 0.000 0.296
#> GSM62295     2  0.3774    0.49739 0.000 0.704 0.000 0.296 0.000
#> GSM62300     2  0.2136    0.61449 0.088 0.904 0.000 0.000 0.008
#> GSM62308     2  0.1168    0.64032 0.032 0.960 0.000 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5  0.2389     0.7905 0.008 0.000 0.000 0.128 0.864 0.000
#> GSM62256     6  0.0000     0.9362 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62259     5  0.3418     0.7452 0.004 0.092 0.000 0.084 0.820 0.000
#> GSM62267     5  0.0291     0.7846 0.004 0.000 0.000 0.004 0.992 0.000
#> GSM62280     6  0.0000     0.9362 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62284     1  0.1610     0.8435 0.916 0.000 0.084 0.000 0.000 0.000
#> GSM62289     5  0.0717     0.7888 0.008 0.000 0.000 0.016 0.976 0.000
#> GSM62307     5  0.3819     0.6082 0.000 0.004 0.000 0.372 0.624 0.000
#> GSM62316     5  0.2378     0.7882 0.000 0.000 0.000 0.152 0.848 0.000
#> GSM62254     5  0.3756     0.5686 0.000 0.000 0.000 0.400 0.600 0.000
#> GSM62292     5  0.3405     0.7292 0.000 0.004 0.000 0.272 0.724 0.000
#> GSM62253     1  0.0146     0.8936 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM62270     3  0.0000     0.9762 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.0000     0.9762 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62297     2  0.0458     0.8932 0.016 0.984 0.000 0.000 0.000 0.000
#> GSM62298     4  0.2178     0.6994 0.000 0.132 0.000 0.868 0.000 0.000
#> GSM62299     2  0.0632     0.8955 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM62258     5  0.3942     0.2857 0.004 0.004 0.000 0.000 0.624 0.368
#> GSM62281     6  0.3710     0.5288 0.000 0.000 0.000 0.292 0.012 0.696
#> GSM62294     4  0.3515     0.2236 0.000 0.000 0.000 0.676 0.324 0.000
#> GSM62305     5  0.2520     0.6847 0.004 0.152 0.000 0.000 0.844 0.000
#> GSM62306     5  0.0748     0.7816 0.004 0.016 0.000 0.004 0.976 0.000
#> GSM62310     4  0.0000     0.7852 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62311     4  0.0000     0.7852 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     6  0.0000     0.9362 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62318     6  0.0000     0.9362 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62321     6  0.0000     0.9362 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000     0.9762 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.0405     0.7850 0.008 0.000 0.000 0.004 0.988 0.000
#> GSM62252     5  0.0767     0.7877 0.004 0.008 0.000 0.012 0.976 0.000
#> GSM62255     4  0.0291     0.7854 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM62257     5  0.2562     0.7847 0.000 0.000 0.000 0.172 0.828 0.000
#> GSM62260     2  0.2765     0.7917 0.004 0.848 0.000 0.000 0.016 0.132
#> GSM62261     5  0.3575     0.7166 0.008 0.000 0.000 0.284 0.708 0.000
#> GSM62262     4  0.0547     0.7801 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM62264     1  0.0520     0.8918 0.984 0.008 0.000 0.000 0.000 0.008
#> GSM62268     1  0.0363     0.8912 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM62269     3  0.0000     0.9762 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     3  0.2592     0.8295 0.004 0.116 0.864 0.000 0.016 0.000
#> GSM62272     3  0.0000     0.9762 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     4  0.2912     0.6315 0.000 0.216 0.000 0.784 0.000 0.000
#> GSM62274     3  0.0632     0.9583 0.024 0.000 0.976 0.000 0.000 0.000
#> GSM62275     3  0.0000     0.9762 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     5  0.0291     0.7819 0.004 0.004 0.000 0.000 0.992 0.000
#> GSM62277     3  0.0146     0.9740 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM62279     1  0.4067     0.2687 0.548 0.008 0.000 0.000 0.444 0.000
#> GSM62282     6  0.0000     0.9362 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62283     2  0.1806     0.8459 0.004 0.908 0.000 0.000 0.088 0.000
#> GSM62286     5  0.0862     0.7888 0.004 0.008 0.000 0.016 0.972 0.000
#> GSM62287     5  0.3371     0.7189 0.000 0.000 0.000 0.292 0.708 0.000
#> GSM62288     5  0.2805     0.7776 0.004 0.000 0.000 0.184 0.812 0.000
#> GSM62290     2  0.2664     0.7495 0.000 0.816 0.000 0.184 0.000 0.000
#> GSM62293     4  0.0713     0.7740 0.000 0.000 0.000 0.972 0.028 0.000
#> GSM62301     2  0.0622     0.8958 0.012 0.980 0.000 0.008 0.000 0.000
#> GSM62302     4  0.0000     0.7852 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62303     5  0.3843     0.4604 0.000 0.000 0.000 0.452 0.548 0.000
#> GSM62304     5  0.3499     0.6884 0.000 0.000 0.000 0.320 0.680 0.000
#> GSM62312     4  0.3774     0.2901 0.000 0.408 0.000 0.592 0.000 0.000
#> GSM62313     4  0.0547     0.7801 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM62314     4  0.5713    -0.2823 0.140 0.004 0.000 0.436 0.420 0.000
#> GSM62319     2  0.0632     0.8955 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM62320     4  0.3868    -0.0138 0.000 0.496 0.000 0.504 0.000 0.000
#> GSM62249     2  0.1802     0.8597 0.012 0.916 0.000 0.000 0.072 0.000
#> GSM62251     1  0.0405     0.8931 0.988 0.004 0.000 0.000 0.008 0.000
#> GSM62263     1  0.1204     0.8583 0.944 0.056 0.000 0.000 0.000 0.000
#> GSM62285     2  0.1663     0.8559 0.000 0.912 0.000 0.088 0.000 0.000
#> GSM62315     2  0.0547     0.8967 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM62291     2  0.3266     0.6095 0.000 0.728 0.000 0.272 0.000 0.000
#> GSM62265     2  0.4300     0.2379 0.432 0.548 0.000 0.000 0.020 0.000
#> GSM62266     1  0.0146     0.8936 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM62296     2  0.0458     0.8967 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM62309     2  0.0363     0.8936 0.012 0.988 0.000 0.000 0.000 0.000
#> GSM62295     4  0.0146     0.7841 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM62300     2  0.0260     0.8962 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM62308     2  0.0937     0.8889 0.000 0.960 0.000 0.040 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-NMF-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) other(p) genotype/variation(p) k
#> CV:NMF 74         0.309249    0.876                0.4468 2
#> CV:NMF 71         0.010333    0.139                0.1968 3
#> CV:NMF 69         0.037263    0.133                0.4881 4
#> CV:NMF 45         0.004589    0.229                0.1569 5
#> CV:NMF 67         0.000234    0.189                0.0681 6

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


MAD:hclust

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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.614           0.889       0.941         0.3559 0.630   0.630
#> 3 3 0.725           0.786       0.897         0.6149 0.751   0.611
#> 4 4 0.771           0.736       0.855         0.0622 0.981   0.953
#> 5 5 0.640           0.707       0.820         0.0821 0.964   0.909
#> 6 6 0.619           0.691       0.765         0.0843 0.942   0.844

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
#> GSM62248     2  0.0000      0.955 0.000 1.000
#> GSM62256     2  0.0000      0.955 0.000 1.000
#> GSM62259     2  0.0000      0.955 0.000 1.000
#> GSM62267     1  0.9815      0.408 0.580 0.420
#> GSM62280     2  0.8327      0.648 0.264 0.736
#> GSM62284     1  0.6247      0.840 0.844 0.156
#> GSM62289     2  0.4161      0.897 0.084 0.916
#> GSM62307     2  0.0000      0.955 0.000 1.000
#> GSM62316     2  0.0000      0.955 0.000 1.000
#> GSM62254     2  0.0000      0.955 0.000 1.000
#> GSM62292     2  0.0000      0.955 0.000 1.000
#> GSM62253     1  0.6247      0.840 0.844 0.156
#> GSM62270     1  0.0000      0.854 1.000 0.000
#> GSM62278     1  0.0376      0.855 0.996 0.004
#> GSM62297     2  0.0000      0.955 0.000 1.000
#> GSM62298     2  0.0000      0.955 0.000 1.000
#> GSM62299     2  0.0000      0.955 0.000 1.000
#> GSM62258     1  0.9323      0.577 0.652 0.348
#> GSM62281     2  0.0000      0.955 0.000 1.000
#> GSM62294     2  0.0000      0.955 0.000 1.000
#> GSM62305     2  0.3733      0.907 0.072 0.928
#> GSM62306     2  0.3733      0.907 0.072 0.928
#> GSM62310     2  0.0000      0.955 0.000 1.000
#> GSM62311     2  0.0000      0.955 0.000 1.000
#> GSM62317     2  0.2603      0.927 0.044 0.956
#> GSM62318     2  0.7528      0.729 0.216 0.784
#> GSM62321     2  0.2778      0.924 0.048 0.952
#> GSM62322     1  0.0000      0.854 1.000 0.000
#> GSM62250     2  0.5178      0.867 0.116 0.884
#> GSM62252     2  0.5178      0.867 0.116 0.884
#> GSM62255     2  0.0000      0.955 0.000 1.000
#> GSM62257     2  0.0000      0.955 0.000 1.000
#> GSM62260     2  0.4815      0.877 0.104 0.896
#> GSM62261     2  0.0000      0.955 0.000 1.000
#> GSM62262     2  0.0000      0.955 0.000 1.000
#> GSM62264     2  0.4690      0.880 0.100 0.900
#> GSM62268     1  0.6247      0.840 0.844 0.156
#> GSM62269     1  0.0000      0.854 1.000 0.000
#> GSM62271     1  0.0376      0.855 0.996 0.004
#> GSM62272     1  0.0000      0.854 1.000 0.000
#> GSM62273     2  0.0000      0.955 0.000 1.000
#> GSM62274     1  0.2778      0.859 0.952 0.048
#> GSM62275     1  0.0000      0.854 1.000 0.000
#> GSM62276     1  0.9815      0.408 0.580 0.420
#> GSM62277     1  0.2778      0.859 0.952 0.048
#> GSM62279     1  0.6438      0.834 0.836 0.164
#> GSM62282     1  0.6973      0.808 0.812 0.188
#> GSM62283     2  0.6887      0.786 0.184 0.816
#> GSM62286     2  0.5178      0.867 0.116 0.884
#> GSM62287     2  0.0000      0.955 0.000 1.000
#> GSM62288     2  0.0000      0.955 0.000 1.000
#> GSM62290     2  0.0000      0.955 0.000 1.000
#> GSM62293     2  0.0000      0.955 0.000 1.000
#> GSM62301     2  0.0000      0.955 0.000 1.000
#> GSM62302     2  0.0000      0.955 0.000 1.000
#> GSM62303     2  0.0000      0.955 0.000 1.000
#> GSM62304     2  0.0000      0.955 0.000 1.000
#> GSM62312     2  0.0000      0.955 0.000 1.000
#> GSM62313     2  0.0000      0.955 0.000 1.000
#> GSM62314     2  0.0000      0.955 0.000 1.000
#> GSM62319     2  0.2778      0.926 0.048 0.952
#> GSM62320     2  0.0000      0.955 0.000 1.000
#> GSM62249     2  0.6887      0.786 0.184 0.816
#> GSM62251     2  0.5408      0.856 0.124 0.876
#> GSM62263     2  0.4161      0.895 0.084 0.916
#> GSM62285     2  0.0000      0.955 0.000 1.000
#> GSM62315     2  0.0000      0.955 0.000 1.000
#> GSM62291     2  0.0000      0.955 0.000 1.000
#> GSM62265     2  0.6973      0.780 0.188 0.812
#> GSM62266     1  0.6247      0.840 0.844 0.156
#> GSM62296     2  0.0000      0.955 0.000 1.000
#> GSM62309     2  0.0000      0.955 0.000 1.000
#> GSM62295     2  0.0000      0.955 0.000 1.000
#> GSM62300     2  0.0000      0.955 0.000 1.000
#> GSM62308     2  0.0000      0.955 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
#> GSM62248     2  0.1529      0.930 0.040 0.960 0.000
#> GSM62256     2  0.1643      0.927 0.044 0.956 0.000
#> GSM62259     2  0.1643      0.927 0.044 0.956 0.000
#> GSM62267     1  0.6286     -0.289 0.536 0.000 0.464
#> GSM62280     1  0.4915      0.560 0.832 0.036 0.132
#> GSM62284     3  0.5138      0.788 0.252 0.000 0.748
#> GSM62289     1  0.6154      0.425 0.592 0.408 0.000
#> GSM62307     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62316     2  0.1529      0.930 0.040 0.960 0.000
#> GSM62254     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62292     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62253     3  0.5178      0.787 0.256 0.000 0.744
#> GSM62270     3  0.0000      0.820 0.000 0.000 1.000
#> GSM62278     3  0.1031      0.826 0.024 0.000 0.976
#> GSM62297     2  0.0424      0.957 0.008 0.992 0.000
#> GSM62298     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62299     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62258     3  0.6286      0.416 0.464 0.000 0.536
#> GSM62281     2  0.1643      0.927 0.044 0.956 0.000
#> GSM62294     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62305     2  0.6111      0.219 0.396 0.604 0.000
#> GSM62306     2  0.6111      0.219 0.396 0.604 0.000
#> GSM62310     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62317     1  0.5678      0.561 0.684 0.316 0.000
#> GSM62318     1  0.6157      0.604 0.780 0.128 0.092
#> GSM62321     1  0.5650      0.564 0.688 0.312 0.000
#> GSM62322     3  0.0000      0.820 0.000 0.000 1.000
#> GSM62250     1  0.6738      0.530 0.624 0.356 0.020
#> GSM62252     1  0.6738      0.530 0.624 0.356 0.020
#> GSM62255     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62260     1  0.2356      0.657 0.928 0.072 0.000
#> GSM62261     2  0.0424      0.957 0.008 0.992 0.000
#> GSM62262     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62264     1  0.2448      0.658 0.924 0.076 0.000
#> GSM62268     3  0.5178      0.787 0.256 0.000 0.744
#> GSM62269     3  0.0000      0.820 0.000 0.000 1.000
#> GSM62271     3  0.1031      0.826 0.024 0.000 0.976
#> GSM62272     3  0.0000      0.820 0.000 0.000 1.000
#> GSM62273     2  0.1643      0.924 0.044 0.956 0.000
#> GSM62274     3  0.3752      0.826 0.144 0.000 0.856
#> GSM62275     3  0.0000      0.820 0.000 0.000 1.000
#> GSM62276     1  0.6286     -0.289 0.536 0.000 0.464
#> GSM62277     3  0.3752      0.826 0.144 0.000 0.856
#> GSM62279     3  0.5397      0.763 0.280 0.000 0.720
#> GSM62282     3  0.5497      0.718 0.292 0.000 0.708
#> GSM62283     1  0.1170      0.613 0.976 0.008 0.016
#> GSM62286     1  0.6738      0.530 0.624 0.356 0.020
#> GSM62287     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62288     2  0.1529      0.930 0.040 0.960 0.000
#> GSM62290     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62293     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62301     2  0.0424      0.957 0.008 0.992 0.000
#> GSM62302     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62312     2  0.0424      0.957 0.008 0.992 0.000
#> GSM62313     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62314     2  0.1529      0.930 0.040 0.960 0.000
#> GSM62319     2  0.4663      0.751 0.156 0.828 0.016
#> GSM62320     2  0.0000      0.959 0.000 1.000 0.000
#> GSM62249     1  0.1170      0.613 0.976 0.008 0.016
#> GSM62251     1  0.3234      0.655 0.908 0.072 0.020
#> GSM62263     1  0.3267      0.662 0.884 0.116 0.000
#> GSM62285     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62315     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62291     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62265     1  0.1315      0.611 0.972 0.008 0.020
#> GSM62266     3  0.5178      0.787 0.256 0.000 0.744
#> GSM62296     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62309     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62295     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62300     2  0.0237      0.958 0.004 0.996 0.000
#> GSM62308     2  0.0237      0.958 0.004 0.996 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     2  0.1545      0.931 0.008 0.952 0.000 0.040
#> GSM62256     2  0.1820      0.928 0.036 0.944 0.000 0.020
#> GSM62259     2  0.1820      0.928 0.036 0.944 0.000 0.020
#> GSM62267     1  0.5570     -0.254 0.540 0.000 0.440 0.020
#> GSM62280     4  0.6951      0.584 0.324 0.000 0.132 0.544
#> GSM62284     3  0.5170      0.749 0.228 0.000 0.724 0.048
#> GSM62289     1  0.6070      0.263 0.548 0.404 0.000 0.048
#> GSM62307     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62316     2  0.1545      0.931 0.008 0.952 0.000 0.040
#> GSM62254     2  0.0336      0.952 0.008 0.992 0.000 0.000
#> GSM62292     2  0.0336      0.952 0.008 0.992 0.000 0.000
#> GSM62253     3  0.5203      0.747 0.232 0.000 0.720 0.048
#> GSM62270     3  0.2149      0.728 0.000 0.000 0.912 0.088
#> GSM62278     3  0.1042      0.759 0.020 0.000 0.972 0.008
#> GSM62297     2  0.1109      0.947 0.004 0.968 0.000 0.028
#> GSM62298     2  0.0188      0.952 0.000 0.996 0.000 0.004
#> GSM62299     2  0.0188      0.952 0.000 0.996 0.000 0.004
#> GSM62258     3  0.5600      0.361 0.468 0.000 0.512 0.020
#> GSM62281     2  0.1820      0.928 0.036 0.944 0.000 0.020
#> GSM62294     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62305     2  0.5839      0.279 0.352 0.604 0.000 0.044
#> GSM62306     2  0.5839      0.279 0.352 0.604 0.000 0.044
#> GSM62310     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62311     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62317     4  0.4022      0.718 0.096 0.068 0.000 0.836
#> GSM62318     4  0.6214      0.678 0.272 0.000 0.092 0.636
#> GSM62321     4  0.3948      0.721 0.096 0.064 0.000 0.840
#> GSM62322     3  0.2149      0.728 0.000 0.000 0.912 0.088
#> GSM62250     1  0.5913      0.310 0.600 0.352 0.000 0.048
#> GSM62252     1  0.5913      0.310 0.600 0.352 0.000 0.048
#> GSM62255     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62257     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62260     1  0.3610      0.273 0.800 0.000 0.000 0.200
#> GSM62261     2  0.1109      0.947 0.004 0.968 0.000 0.028
#> GSM62262     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62264     1  0.3649      0.268 0.796 0.000 0.000 0.204
#> GSM62268     3  0.5203      0.747 0.232 0.000 0.720 0.048
#> GSM62269     3  0.2149      0.728 0.000 0.000 0.912 0.088
#> GSM62271     3  0.1042      0.759 0.020 0.000 0.972 0.008
#> GSM62272     3  0.2149      0.728 0.000 0.000 0.912 0.088
#> GSM62273     2  0.1398      0.927 0.040 0.956 0.000 0.004
#> GSM62274     3  0.3647      0.774 0.152 0.000 0.832 0.016
#> GSM62275     3  0.2149      0.728 0.000 0.000 0.912 0.088
#> GSM62276     1  0.5570     -0.254 0.540 0.000 0.440 0.020
#> GSM62277     3  0.3647      0.774 0.152 0.000 0.832 0.016
#> GSM62279     3  0.5387      0.723 0.256 0.000 0.696 0.048
#> GSM62282     3  0.5256      0.656 0.260 0.000 0.700 0.040
#> GSM62283     1  0.1792      0.355 0.932 0.000 0.000 0.068
#> GSM62286     1  0.5913      0.310 0.600 0.352 0.000 0.048
#> GSM62287     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62288     2  0.1545      0.931 0.008 0.952 0.000 0.040
#> GSM62290     2  0.0817      0.948 0.000 0.976 0.000 0.024
#> GSM62293     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62301     2  0.1109      0.947 0.004 0.968 0.000 0.028
#> GSM62302     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62303     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62304     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62312     2  0.1109      0.947 0.004 0.968 0.000 0.028
#> GSM62313     2  0.0188      0.953 0.004 0.996 0.000 0.000
#> GSM62314     2  0.1545      0.931 0.008 0.952 0.000 0.040
#> GSM62319     2  0.3923      0.767 0.148 0.828 0.008 0.016
#> GSM62320     2  0.0188      0.952 0.000 0.996 0.000 0.004
#> GSM62249     1  0.1792      0.355 0.932 0.000 0.000 0.068
#> GSM62251     1  0.3539      0.297 0.820 0.000 0.004 0.176
#> GSM62263     1  0.4595      0.268 0.776 0.040 0.000 0.184
#> GSM62285     2  0.0921      0.947 0.000 0.972 0.000 0.028
#> GSM62315     2  0.0921      0.947 0.000 0.972 0.000 0.028
#> GSM62291     2  0.0817      0.948 0.000 0.976 0.000 0.024
#> GSM62265     1  0.1902      0.355 0.932 0.000 0.004 0.064
#> GSM62266     3  0.5203      0.747 0.232 0.000 0.720 0.048
#> GSM62296     2  0.0921      0.947 0.000 0.972 0.000 0.028
#> GSM62309     2  0.0921      0.947 0.000 0.972 0.000 0.028
#> GSM62295     2  0.0188      0.952 0.004 0.996 0.000 0.000
#> GSM62300     2  0.0921      0.947 0.000 0.972 0.000 0.028
#> GSM62308     2  0.0921      0.947 0.000 0.972 0.000 0.028

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     4  0.2971     0.8269 0.000 0.156 0.000 0.836 0.008
#> GSM62256     4  0.2208     0.8830 0.000 0.072 0.000 0.908 0.020
#> GSM62259     4  0.2208     0.8830 0.000 0.072 0.000 0.908 0.020
#> GSM62267     1  0.5799     0.3329 0.492 0.092 0.000 0.000 0.416
#> GSM62280     2  0.7989     0.6664 0.096 0.392 0.224 0.000 0.288
#> GSM62284     1  0.0671     0.6008 0.980 0.000 0.016 0.000 0.004
#> GSM62289     5  0.6941     0.3805 0.016 0.228 0.000 0.288 0.468
#> GSM62307     4  0.0609     0.8990 0.000 0.020 0.000 0.980 0.000
#> GSM62316     4  0.2971     0.8269 0.000 0.156 0.000 0.836 0.008
#> GSM62254     4  0.0794     0.8968 0.000 0.028 0.000 0.972 0.000
#> GSM62292     4  0.0794     0.8968 0.000 0.028 0.000 0.972 0.000
#> GSM62253     1  0.0290     0.6063 0.992 0.000 0.000 0.000 0.008
#> GSM62270     3  0.3612     1.0000 0.268 0.000 0.732 0.000 0.000
#> GSM62278     1  0.4787    -0.2093 0.548 0.020 0.432 0.000 0.000
#> GSM62297     4  0.2304     0.8839 0.000 0.100 0.000 0.892 0.008
#> GSM62298     4  0.1502     0.8957 0.000 0.056 0.000 0.940 0.004
#> GSM62299     4  0.1502     0.8959 0.000 0.056 0.000 0.940 0.004
#> GSM62258     1  0.5819     0.4298 0.552 0.080 0.008 0.000 0.360
#> GSM62281     4  0.2208     0.8830 0.000 0.072 0.000 0.908 0.020
#> GSM62294     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62305     4  0.6298     0.0625 0.000 0.188 0.000 0.520 0.292
#> GSM62306     4  0.6298     0.0625 0.000 0.188 0.000 0.520 0.292
#> GSM62310     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62311     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62317     2  0.5334     0.7742 0.000 0.656 0.268 0.012 0.064
#> GSM62318     2  0.7550     0.7436 0.080 0.484 0.196 0.000 0.240
#> GSM62321     2  0.5391     0.7753 0.000 0.652 0.268 0.012 0.068
#> GSM62322     3  0.3612     1.0000 0.268 0.000 0.732 0.000 0.000
#> GSM62250     5  0.7298     0.4220 0.048 0.212 0.000 0.256 0.484
#> GSM62252     5  0.7298     0.4220 0.048 0.212 0.000 0.256 0.484
#> GSM62255     4  0.0609     0.8990 0.000 0.020 0.000 0.980 0.000
#> GSM62257     4  0.0609     0.8990 0.000 0.020 0.000 0.980 0.000
#> GSM62260     5  0.3810     0.4263 0.088 0.100 0.000 0.000 0.812
#> GSM62261     4  0.2193     0.8857 0.000 0.092 0.000 0.900 0.008
#> GSM62262     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62264     5  0.4022     0.4125 0.100 0.104 0.000 0.000 0.796
#> GSM62268     1  0.0290     0.6063 0.992 0.000 0.000 0.000 0.008
#> GSM62269     3  0.3612     1.0000 0.268 0.000 0.732 0.000 0.000
#> GSM62271     1  0.4787    -0.2093 0.548 0.020 0.432 0.000 0.000
#> GSM62272     3  0.3612     1.0000 0.268 0.000 0.732 0.000 0.000
#> GSM62273     4  0.2079     0.8715 0.000 0.064 0.000 0.916 0.020
#> GSM62274     1  0.2329     0.5255 0.876 0.000 0.124 0.000 0.000
#> GSM62275     3  0.3612     1.0000 0.268 0.000 0.732 0.000 0.000
#> GSM62276     1  0.5799     0.3329 0.492 0.092 0.000 0.000 0.416
#> GSM62277     1  0.2648     0.5014 0.848 0.000 0.152 0.000 0.000
#> GSM62279     1  0.1106     0.6030 0.964 0.012 0.000 0.000 0.024
#> GSM62282     1  0.7108     0.1790 0.476 0.028 0.264 0.000 0.232
#> GSM62283     5  0.1043     0.5072 0.040 0.000 0.000 0.000 0.960
#> GSM62286     5  0.7298     0.4220 0.048 0.212 0.000 0.256 0.484
#> GSM62287     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62288     4  0.2971     0.8269 0.000 0.156 0.000 0.836 0.008
#> GSM62290     4  0.2338     0.8799 0.000 0.112 0.000 0.884 0.004
#> GSM62293     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62301     4  0.2563     0.8750 0.000 0.120 0.000 0.872 0.008
#> GSM62302     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62303     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62304     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62312     4  0.2193     0.8857 0.000 0.092 0.000 0.900 0.008
#> GSM62313     4  0.0703     0.8977 0.000 0.024 0.000 0.976 0.000
#> GSM62314     4  0.2971     0.8269 0.000 0.156 0.000 0.836 0.008
#> GSM62319     4  0.4203     0.7132 0.000 0.128 0.000 0.780 0.092
#> GSM62320     4  0.1502     0.8957 0.000 0.056 0.000 0.940 0.004
#> GSM62249     5  0.1043     0.5072 0.040 0.000 0.000 0.000 0.960
#> GSM62251     5  0.4149     0.4443 0.128 0.088 0.000 0.000 0.784
#> GSM62263     5  0.4441     0.4314 0.096 0.120 0.000 0.008 0.776
#> GSM62285     4  0.2439     0.8759 0.000 0.120 0.000 0.876 0.004
#> GSM62315     4  0.2439     0.8759 0.000 0.120 0.000 0.876 0.004
#> GSM62291     4  0.2338     0.8799 0.000 0.112 0.000 0.884 0.004
#> GSM62265     5  0.1121     0.5067 0.044 0.000 0.000 0.000 0.956
#> GSM62266     1  0.0290     0.6063 0.992 0.000 0.000 0.000 0.008
#> GSM62296     4  0.2439     0.8759 0.000 0.120 0.000 0.876 0.004
#> GSM62309     4  0.2439     0.8759 0.000 0.120 0.000 0.876 0.004
#> GSM62295     4  0.0963     0.8941 0.000 0.036 0.000 0.964 0.000
#> GSM62300     4  0.2439     0.8759 0.000 0.120 0.000 0.876 0.004
#> GSM62308     4  0.2439     0.8759 0.000 0.120 0.000 0.876 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
#> GSM62248     4  0.2664      0.666 0.000 0.000 0.000 0.816 0.184 0.000
#> GSM62256     4  0.3210      0.736 0.000 0.000 0.028 0.804 0.168 0.000
#> GSM62259     4  0.3210      0.736 0.000 0.000 0.028 0.804 0.168 0.000
#> GSM62267     1  0.5821      0.299 0.412 0.184 0.000 0.000 0.404 0.000
#> GSM62280     6  0.6003      0.667 0.016 0.104 0.040 0.000 0.236 0.604
#> GSM62284     1  0.0972      0.690 0.964 0.008 0.028 0.000 0.000 0.000
#> GSM62289     5  0.5915      0.745 0.016 0.224 0.000 0.212 0.548 0.000
#> GSM62307     4  0.2631      0.757 0.000 0.000 0.008 0.840 0.152 0.000
#> GSM62316     4  0.2664      0.666 0.000 0.000 0.000 0.816 0.184 0.000
#> GSM62254     4  0.2948      0.737 0.000 0.000 0.008 0.804 0.188 0.000
#> GSM62292     4  0.2948      0.737 0.000 0.000 0.008 0.804 0.188 0.000
#> GSM62253     1  0.0725      0.696 0.976 0.012 0.012 0.000 0.000 0.000
#> GSM62270     3  0.1075      0.739 0.048 0.000 0.952 0.000 0.000 0.000
#> GSM62278     3  0.5749      0.341 0.376 0.000 0.480 0.000 0.136 0.008
#> GSM62297     4  0.2939      0.747 0.000 0.004 0.036 0.872 0.064 0.024
#> GSM62298     4  0.1701      0.768 0.000 0.000 0.008 0.920 0.072 0.000
#> GSM62299     4  0.1625      0.767 0.000 0.000 0.012 0.928 0.060 0.000
#> GSM62258     1  0.5772      0.372 0.472 0.156 0.004 0.000 0.368 0.000
#> GSM62281     4  0.3245      0.735 0.000 0.000 0.028 0.800 0.172 0.000
#> GSM62294     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62305     5  0.5120      0.644 0.000 0.088 0.000 0.380 0.532 0.000
#> GSM62306     5  0.5120      0.644 0.000 0.088 0.000 0.380 0.532 0.000
#> GSM62310     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62311     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62317     6  0.0508      0.777 0.000 0.012 0.000 0.004 0.000 0.984
#> GSM62318     6  0.5352      0.743 0.016 0.112 0.032 0.000 0.148 0.692
#> GSM62321     6  0.0603      0.779 0.000 0.016 0.000 0.004 0.000 0.980
#> GSM62322     3  0.1075      0.739 0.048 0.000 0.952 0.000 0.000 0.000
#> GSM62250     5  0.5690      0.743 0.016 0.244 0.000 0.160 0.580 0.000
#> GSM62252     5  0.5690      0.743 0.016 0.244 0.000 0.160 0.580 0.000
#> GSM62255     4  0.2631      0.757 0.000 0.000 0.008 0.840 0.152 0.000
#> GSM62257     4  0.2631      0.757 0.000 0.000 0.008 0.840 0.152 0.000
#> GSM62260     2  0.1718      0.811 0.008 0.932 0.000 0.000 0.016 0.044
#> GSM62261     4  0.2649      0.752 0.000 0.004 0.028 0.888 0.060 0.020
#> GSM62262     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62264     2  0.1265      0.799 0.008 0.948 0.000 0.000 0.000 0.044
#> GSM62268     1  0.0725      0.696 0.976 0.012 0.012 0.000 0.000 0.000
#> GSM62269     3  0.1075      0.739 0.048 0.000 0.952 0.000 0.000 0.000
#> GSM62271     3  0.5749      0.341 0.376 0.000 0.480 0.000 0.136 0.008
#> GSM62272     3  0.1075      0.739 0.048 0.000 0.952 0.000 0.000 0.000
#> GSM62273     4  0.3163      0.704 0.000 0.000 0.004 0.764 0.232 0.000
#> GSM62274     1  0.2219      0.614 0.864 0.000 0.136 0.000 0.000 0.000
#> GSM62275     3  0.1075      0.739 0.048 0.000 0.952 0.000 0.000 0.000
#> GSM62276     1  0.5821      0.299 0.412 0.184 0.000 0.000 0.404 0.000
#> GSM62277     1  0.2597      0.573 0.824 0.000 0.176 0.000 0.000 0.000
#> GSM62279     1  0.1124      0.686 0.956 0.008 0.000 0.000 0.036 0.000
#> GSM62282     3  0.7791      0.167 0.264 0.100 0.312 0.000 0.300 0.024
#> GSM62283     2  0.3014      0.788 0.012 0.804 0.000 0.000 0.184 0.000
#> GSM62286     5  0.5690      0.743 0.016 0.244 0.000 0.160 0.580 0.000
#> GSM62287     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62288     4  0.2664      0.666 0.000 0.000 0.000 0.816 0.184 0.000
#> GSM62290     4  0.3838      0.717 0.000 0.004 0.036 0.800 0.132 0.028
#> GSM62293     4  0.2915      0.740 0.000 0.000 0.008 0.808 0.184 0.000
#> GSM62301     4  0.4023      0.708 0.000 0.004 0.040 0.784 0.144 0.028
#> GSM62302     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62303     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62304     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62312     4  0.2732      0.750 0.000 0.004 0.028 0.884 0.060 0.024
#> GSM62313     4  0.2848      0.746 0.000 0.000 0.008 0.816 0.176 0.000
#> GSM62314     4  0.2664      0.666 0.000 0.000 0.000 0.816 0.184 0.000
#> GSM62319     4  0.4144      0.352 0.000 0.000 0.008 0.580 0.408 0.004
#> GSM62320     4  0.1701      0.768 0.000 0.000 0.008 0.920 0.072 0.000
#> GSM62249     2  0.3014      0.788 0.012 0.804 0.000 0.000 0.184 0.000
#> GSM62251     2  0.0603      0.822 0.016 0.980 0.000 0.000 0.004 0.000
#> GSM62263     2  0.1452      0.792 0.008 0.948 0.000 0.032 0.004 0.008
#> GSM62285     4  0.3985      0.710 0.000 0.004 0.040 0.788 0.140 0.028
#> GSM62315     4  0.3985      0.710 0.000 0.004 0.040 0.788 0.140 0.028
#> GSM62291     4  0.3838      0.717 0.000 0.004 0.036 0.800 0.132 0.028
#> GSM62265     2  0.3104      0.786 0.016 0.800 0.000 0.000 0.184 0.000
#> GSM62266     1  0.0725      0.696 0.976 0.012 0.012 0.000 0.000 0.000
#> GSM62296     4  0.3985      0.710 0.000 0.004 0.040 0.788 0.140 0.028
#> GSM62309     4  0.3985      0.710 0.000 0.004 0.040 0.788 0.140 0.028
#> GSM62295     4  0.2805      0.737 0.000 0.000 0.004 0.812 0.184 0.000
#> GSM62300     4  0.3985      0.710 0.000 0.004 0.040 0.788 0.140 0.028
#> GSM62308     4  0.3985      0.710 0.000 0.004 0.040 0.788 0.140 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-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) other(p) genotype/variation(p) k
#> MAD:hclust 73           0.3184   0.7301                 0.358 2
#> MAD:hclust 69           0.3079   0.6515                 0.320 3
#> MAD:hclust 59           0.3210   0.0961                 0.856 4
#> MAD:hclust 59           0.1491   0.3128                 0.961 5
#> MAD:hclust 68           0.0686   0.4857                 0.660 6

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


MAD:kmeans**

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.970       0.989         0.4593 0.541   0.541
#> 3 3 0.552           0.549       0.707         0.3294 0.890   0.799
#> 4 4 0.583           0.707       0.785         0.1549 0.731   0.457
#> 5 5 0.625           0.760       0.801         0.0965 0.906   0.673
#> 6 6 0.768           0.708       0.822         0.0617 0.957   0.801

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
#> GSM62248     2   0.000      0.991 0.000 1.000
#> GSM62256     2   0.000      0.991 0.000 1.000
#> GSM62259     2   0.000      0.991 0.000 1.000
#> GSM62267     1   0.000      0.983 1.000 0.000
#> GSM62280     1   0.000      0.983 1.000 0.000
#> GSM62284     1   0.000      0.983 1.000 0.000
#> GSM62289     2   0.000      0.991 0.000 1.000
#> GSM62307     2   0.000      0.991 0.000 1.000
#> GSM62316     2   0.000      0.991 0.000 1.000
#> GSM62254     2   0.000      0.991 0.000 1.000
#> GSM62292     2   0.000      0.991 0.000 1.000
#> GSM62253     1   0.000      0.983 1.000 0.000
#> GSM62270     1   0.000      0.983 1.000 0.000
#> GSM62278     1   0.000      0.983 1.000 0.000
#> GSM62297     2   0.000      0.991 0.000 1.000
#> GSM62298     2   0.000      0.991 0.000 1.000
#> GSM62299     2   0.000      0.991 0.000 1.000
#> GSM62258     1   0.000      0.983 1.000 0.000
#> GSM62281     2   0.000      0.991 0.000 1.000
#> GSM62294     2   0.000      0.991 0.000 1.000
#> GSM62305     2   0.000      0.991 0.000 1.000
#> GSM62306     2   0.000      0.991 0.000 1.000
#> GSM62310     2   0.000      0.991 0.000 1.000
#> GSM62311     2   0.000      0.991 0.000 1.000
#> GSM62317     2   0.000      0.991 0.000 1.000
#> GSM62318     1   0.000      0.983 1.000 0.000
#> GSM62321     1   0.975      0.297 0.592 0.408
#> GSM62322     1   0.000      0.983 1.000 0.000
#> GSM62250     2   0.000      0.991 0.000 1.000
#> GSM62252     2   0.000      0.991 0.000 1.000
#> GSM62255     2   0.000      0.991 0.000 1.000
#> GSM62257     2   0.000      0.991 0.000 1.000
#> GSM62260     1   0.000      0.983 1.000 0.000
#> GSM62261     2   0.000      0.991 0.000 1.000
#> GSM62262     2   0.000      0.991 0.000 1.000
#> GSM62264     1   0.000      0.983 1.000 0.000
#> GSM62268     1   0.000      0.983 1.000 0.000
#> GSM62269     1   0.000      0.983 1.000 0.000
#> GSM62271     1   0.000      0.983 1.000 0.000
#> GSM62272     1   0.000      0.983 1.000 0.000
#> GSM62273     2   0.000      0.991 0.000 1.000
#> GSM62274     1   0.000      0.983 1.000 0.000
#> GSM62275     1   0.000      0.983 1.000 0.000
#> GSM62276     1   0.000      0.983 1.000 0.000
#> GSM62277     1   0.000      0.983 1.000 0.000
#> GSM62279     1   0.000      0.983 1.000 0.000
#> GSM62282     1   0.000      0.983 1.000 0.000
#> GSM62283     1   0.000      0.983 1.000 0.000
#> GSM62286     2   0.000      0.991 0.000 1.000
#> GSM62287     2   0.000      0.991 0.000 1.000
#> GSM62288     2   0.000      0.991 0.000 1.000
#> GSM62290     2   0.000      0.991 0.000 1.000
#> GSM62293     2   0.000      0.991 0.000 1.000
#> GSM62301     2   0.000      0.991 0.000 1.000
#> GSM62302     2   0.000      0.991 0.000 1.000
#> GSM62303     2   0.000      0.991 0.000 1.000
#> GSM62304     2   0.000      0.991 0.000 1.000
#> GSM62312     2   0.000      0.991 0.000 1.000
#> GSM62313     2   0.000      0.991 0.000 1.000
#> GSM62314     2   0.000      0.991 0.000 1.000
#> GSM62319     2   0.000      0.991 0.000 1.000
#> GSM62320     2   0.000      0.991 0.000 1.000
#> GSM62249     2   0.973      0.300 0.404 0.596
#> GSM62251     1   0.000      0.983 1.000 0.000
#> GSM62263     2   0.000      0.991 0.000 1.000
#> GSM62285     2   0.000      0.991 0.000 1.000
#> GSM62315     2   0.000      0.991 0.000 1.000
#> GSM62291     2   0.000      0.991 0.000 1.000
#> GSM62265     1   0.000      0.983 1.000 0.000
#> GSM62266     1   0.000      0.983 1.000 0.000
#> GSM62296     2   0.000      0.991 0.000 1.000
#> GSM62309     2   0.000      0.991 0.000 1.000
#> GSM62295     2   0.000      0.991 0.000 1.000
#> GSM62300     2   0.000      0.991 0.000 1.000
#> GSM62308     2   0.000      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
#> GSM62248     2  0.5785     0.7317 0.332 0.668 0.000
#> GSM62256     2  0.5733     0.7302 0.324 0.676 0.000
#> GSM62259     2  0.6244     0.7470 0.440 0.560 0.000
#> GSM62267     3  0.6309     0.4004 0.496 0.000 0.504
#> GSM62280     3  0.6291     0.4523 0.468 0.000 0.532
#> GSM62284     3  0.4002     0.5912 0.160 0.000 0.840
#> GSM62289     2  0.6215     0.6994 0.428 0.572 0.000
#> GSM62307     2  0.6286     0.7446 0.464 0.536 0.000
#> GSM62316     2  0.6095     0.7422 0.392 0.608 0.000
#> GSM62254     2  0.6302     0.7394 0.480 0.520 0.000
#> GSM62292     2  0.6302     0.7394 0.480 0.520 0.000
#> GSM62253     3  0.6168     0.5130 0.412 0.000 0.588
#> GSM62270     3  0.0000     0.5982 0.000 0.000 1.000
#> GSM62278     3  0.0000     0.5982 0.000 0.000 1.000
#> GSM62297     2  0.0747     0.6423 0.016 0.984 0.000
#> GSM62298     2  0.3116     0.6649 0.108 0.892 0.000
#> GSM62299     2  0.0000     0.6505 0.000 1.000 0.000
#> GSM62258     3  0.6309     0.4004 0.496 0.000 0.504
#> GSM62281     2  0.5650     0.7348 0.312 0.688 0.000
#> GSM62294     2  0.6295     0.7423 0.472 0.528 0.000
#> GSM62305     1  0.6008    -0.1620 0.628 0.372 0.000
#> GSM62306     2  0.5859     0.7305 0.344 0.656 0.000
#> GSM62310     2  0.6286     0.7446 0.464 0.536 0.000
#> GSM62311     2  0.6286     0.7446 0.464 0.536 0.000
#> GSM62317     2  0.0592     0.6413 0.012 0.988 0.000
#> GSM62318     3  0.6291     0.4523 0.468 0.000 0.532
#> GSM62321     1  0.9046     0.2642 0.516 0.332 0.152
#> GSM62322     3  0.0000     0.5982 0.000 0.000 1.000
#> GSM62250     1  0.5733    -0.0511 0.676 0.324 0.000
#> GSM62252     1  0.4002     0.3405 0.840 0.160 0.000
#> GSM62255     2  0.6286     0.7446 0.464 0.536 0.000
#> GSM62257     2  0.6286     0.7446 0.464 0.536 0.000
#> GSM62260     1  0.8549    -0.1569 0.516 0.100 0.384
#> GSM62261     2  0.5968     0.7418 0.364 0.636 0.000
#> GSM62262     2  0.6295     0.7423 0.472 0.528 0.000
#> GSM62264     1  0.8173    -0.2622 0.508 0.072 0.420
#> GSM62268     3  0.5926     0.5457 0.356 0.000 0.644
#> GSM62269     3  0.0000     0.5982 0.000 0.000 1.000
#> GSM62271     3  0.5926     0.5463 0.356 0.000 0.644
#> GSM62272     3  0.0000     0.5982 0.000 0.000 1.000
#> GSM62273     2  0.4750     0.7083 0.216 0.784 0.000
#> GSM62274     3  0.0000     0.5982 0.000 0.000 1.000
#> GSM62275     3  0.0000     0.5982 0.000 0.000 1.000
#> GSM62276     3  0.6309     0.4004 0.496 0.000 0.504
#> GSM62277     3  0.0000     0.5982 0.000 0.000 1.000
#> GSM62279     3  0.6309     0.4004 0.496 0.000 0.504
#> GSM62282     3  0.5948     0.5436 0.360 0.000 0.640
#> GSM62283     1  0.6309    -0.4780 0.504 0.000 0.496
#> GSM62286     2  0.6095     0.6943 0.392 0.608 0.000
#> GSM62287     2  0.6295     0.7423 0.472 0.528 0.000
#> GSM62288     2  0.5988     0.7424 0.368 0.632 0.000
#> GSM62290     2  0.0237     0.6486 0.004 0.996 0.000
#> GSM62293     2  0.6302     0.7394 0.480 0.520 0.000
#> GSM62301     2  0.0000     0.6505 0.000 1.000 0.000
#> GSM62302     2  0.6286     0.7446 0.464 0.536 0.000
#> GSM62303     2  0.6295     0.7423 0.472 0.528 0.000
#> GSM62304     2  0.6286     0.7446 0.464 0.536 0.000
#> GSM62312     2  0.0424     0.6530 0.008 0.992 0.000
#> GSM62313     2  0.6286     0.7446 0.464 0.536 0.000
#> GSM62314     2  0.6180     0.7444 0.416 0.584 0.000
#> GSM62319     2  0.1031     0.6469 0.024 0.976 0.000
#> GSM62320     2  0.3116     0.6649 0.108 0.892 0.000
#> GSM62249     1  0.8872     0.2734 0.536 0.324 0.140
#> GSM62251     1  0.6825    -0.4470 0.500 0.012 0.488
#> GSM62263     2  0.5948    -0.1724 0.360 0.640 0.000
#> GSM62285     2  0.0237     0.6519 0.004 0.996 0.000
#> GSM62315     2  0.0000     0.6505 0.000 1.000 0.000
#> GSM62291     2  0.0237     0.6486 0.004 0.996 0.000
#> GSM62265     3  0.6308     0.4078 0.492 0.000 0.508
#> GSM62266     3  0.6168     0.5130 0.412 0.000 0.588
#> GSM62296     2  0.0237     0.6486 0.004 0.996 0.000
#> GSM62309     2  0.0237     0.6486 0.004 0.996 0.000
#> GSM62295     2  0.6302     0.7394 0.480 0.520 0.000
#> GSM62300     2  0.0237     0.6486 0.004 0.996 0.000
#> GSM62308     2  0.0237     0.6486 0.004 0.996 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4  0.6603    0.61081 0.008 0.296 0.088 0.608
#> GSM62256     4  0.6929    0.65590 0.008 0.348 0.096 0.548
#> GSM62259     4  0.5713    0.71030 0.000 0.360 0.036 0.604
#> GSM62267     1  0.2546    0.75786 0.912 0.000 0.060 0.028
#> GSM62280     1  0.5624    0.62521 0.720 0.000 0.172 0.108
#> GSM62284     3  0.5781    0.00407 0.480 0.000 0.492 0.028
#> GSM62289     4  0.8534    0.38233 0.220 0.160 0.092 0.528
#> GSM62307     4  0.4624    0.74403 0.000 0.340 0.000 0.660
#> GSM62316     4  0.6486    0.63550 0.008 0.320 0.072 0.600
#> GSM62254     4  0.4963    0.75017 0.000 0.284 0.020 0.696
#> GSM62292     4  0.4963    0.75017 0.000 0.284 0.020 0.696
#> GSM62253     1  0.4964    0.59403 0.716 0.000 0.256 0.028
#> GSM62270     3  0.2530    0.91866 0.112 0.000 0.888 0.000
#> GSM62278     3  0.2530    0.91866 0.112 0.000 0.888 0.000
#> GSM62297     2  0.3108    0.75037 0.000 0.872 0.016 0.112
#> GSM62298     2  0.0895    0.87477 0.000 0.976 0.004 0.020
#> GSM62299     2  0.0188    0.89122 0.000 0.996 0.004 0.000
#> GSM62258     1  0.2214    0.76073 0.928 0.000 0.044 0.028
#> GSM62281     4  0.6709    0.63836 0.000 0.400 0.092 0.508
#> GSM62294     4  0.4535    0.75353 0.000 0.292 0.004 0.704
#> GSM62305     4  0.8872    0.19686 0.336 0.140 0.096 0.428
#> GSM62306     4  0.6554    0.62001 0.008 0.268 0.096 0.628
#> GSM62310     4  0.4585    0.74633 0.000 0.332 0.000 0.668
#> GSM62311     4  0.4585    0.74633 0.000 0.332 0.000 0.668
#> GSM62317     2  0.4102    0.73378 0.040 0.840 0.012 0.108
#> GSM62318     1  0.5834    0.61744 0.704 0.000 0.172 0.124
#> GSM62321     1  0.4989    0.66783 0.792 0.020 0.056 0.132
#> GSM62322     3  0.2530    0.91866 0.112 0.000 0.888 0.000
#> GSM62250     4  0.8784    0.24067 0.316 0.140 0.092 0.452
#> GSM62252     1  0.7185    0.25561 0.512 0.016 0.092 0.380
#> GSM62255     4  0.4585    0.74633 0.000 0.332 0.000 0.668
#> GSM62257     4  0.4585    0.74633 0.000 0.332 0.000 0.668
#> GSM62260     1  0.2856    0.72435 0.900 0.004 0.024 0.072
#> GSM62261     4  0.6564    0.62859 0.008 0.324 0.076 0.592
#> GSM62262     4  0.4535    0.75353 0.000 0.292 0.004 0.704
#> GSM62264     1  0.2342    0.74050 0.912 0.008 0.000 0.080
#> GSM62268     1  0.5322    0.48964 0.660 0.000 0.312 0.028
#> GSM62269     3  0.2530    0.91866 0.112 0.000 0.888 0.000
#> GSM62271     1  0.4155    0.63176 0.756 0.000 0.240 0.004
#> GSM62272     3  0.2530    0.91866 0.112 0.000 0.888 0.000
#> GSM62273     2  0.5228    0.10877 0.000 0.664 0.024 0.312
#> GSM62274     3  0.3881    0.84839 0.172 0.000 0.812 0.016
#> GSM62275     3  0.2530    0.91866 0.112 0.000 0.888 0.000
#> GSM62276     1  0.2546    0.75786 0.912 0.000 0.060 0.028
#> GSM62277     3  0.2714    0.91636 0.112 0.000 0.884 0.004
#> GSM62279     1  0.2739    0.75676 0.904 0.000 0.060 0.036
#> GSM62282     1  0.5327    0.61121 0.720 0.000 0.220 0.060
#> GSM62283     1  0.1510    0.75996 0.956 0.000 0.028 0.016
#> GSM62286     4  0.8564    0.39942 0.200 0.180 0.092 0.528
#> GSM62287     4  0.4356    0.75460 0.000 0.292 0.000 0.708
#> GSM62288     4  0.6564    0.62859 0.008 0.324 0.076 0.592
#> GSM62290     2  0.0000    0.89211 0.000 1.000 0.000 0.000
#> GSM62293     4  0.4647    0.75260 0.000 0.288 0.008 0.704
#> GSM62301     2  0.0000    0.89211 0.000 1.000 0.000 0.000
#> GSM62302     4  0.4543    0.74921 0.000 0.324 0.000 0.676
#> GSM62303     4  0.4356    0.75460 0.000 0.292 0.000 0.708
#> GSM62304     4  0.4585    0.74633 0.000 0.332 0.000 0.668
#> GSM62312     2  0.0376    0.88899 0.000 0.992 0.004 0.004
#> GSM62313     4  0.4585    0.74633 0.000 0.332 0.000 0.668
#> GSM62314     4  0.5381    0.66894 0.008 0.320 0.016 0.656
#> GSM62319     2  0.2587    0.81555 0.008 0.916 0.020 0.056
#> GSM62320     2  0.0779    0.87909 0.000 0.980 0.004 0.016
#> GSM62249     1  0.5304    0.59857 0.780 0.024 0.080 0.116
#> GSM62251     1  0.2578    0.75914 0.912 0.000 0.036 0.052
#> GSM62263     2  0.8521    0.30053 0.252 0.504 0.068 0.176
#> GSM62285     2  0.0000    0.89211 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000    0.89211 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000    0.89211 0.000 1.000 0.000 0.000
#> GSM62265     1  0.2399    0.75996 0.920 0.000 0.048 0.032
#> GSM62266     1  0.4964    0.59403 0.716 0.000 0.256 0.028
#> GSM62296     2  0.0188    0.89157 0.000 0.996 0.000 0.004
#> GSM62309     2  0.0188    0.89157 0.000 0.996 0.000 0.004
#> GSM62295     4  0.5062    0.74891 0.000 0.284 0.024 0.692
#> GSM62300     2  0.0188    0.89157 0.000 0.996 0.000 0.004
#> GSM62308     2  0.0188    0.89157 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
#> GSM62248     5  0.5814     0.6991 0.000 0.128 0.000 0.288 0.584
#> GSM62256     5  0.6211     0.6739 0.000 0.144 0.012 0.264 0.580
#> GSM62259     4  0.6368     0.2958 0.000 0.148 0.012 0.548 0.292
#> GSM62267     1  0.5375     0.7471 0.684 0.000 0.116 0.008 0.192
#> GSM62280     1  0.5858     0.6436 0.636 0.000 0.016 0.116 0.232
#> GSM62284     1  0.4452     0.0380 0.500 0.000 0.496 0.000 0.004
#> GSM62289     5  0.4088     0.7067 0.008 0.036 0.000 0.176 0.780
#> GSM62307     4  0.3277     0.8881 0.000 0.148 0.012 0.832 0.008
#> GSM62316     5  0.6225     0.6312 0.000 0.148 0.000 0.368 0.484
#> GSM62254     4  0.4457     0.7858 0.000 0.116 0.000 0.760 0.124
#> GSM62292     4  0.4457     0.7858 0.000 0.116 0.000 0.760 0.124
#> GSM62253     1  0.2773     0.7218 0.836 0.000 0.164 0.000 0.000
#> GSM62270     3  0.0609     0.9725 0.020 0.000 0.980 0.000 0.000
#> GSM62278     3  0.0609     0.9725 0.020 0.000 0.980 0.000 0.000
#> GSM62297     2  0.2130     0.8210 0.000 0.908 0.012 0.000 0.080
#> GSM62298     2  0.0566     0.8842 0.000 0.984 0.012 0.004 0.000
#> GSM62299     2  0.0566     0.8856 0.000 0.984 0.012 0.004 0.000
#> GSM62258     1  0.5334     0.7556 0.672 0.000 0.076 0.012 0.240
#> GSM62281     5  0.6932     0.5246 0.000 0.268 0.012 0.264 0.456
#> GSM62294     4  0.2230     0.9025 0.000 0.116 0.000 0.884 0.000
#> GSM62305     5  0.4453     0.6554 0.076 0.036 0.000 0.092 0.796
#> GSM62306     5  0.5579     0.6992 0.000 0.116 0.000 0.264 0.620
#> GSM62310     4  0.2674     0.9026 0.000 0.140 0.000 0.856 0.004
#> GSM62311     4  0.2674     0.9026 0.000 0.140 0.000 0.856 0.004
#> GSM62317     2  0.6518     0.5743 0.100 0.656 0.008 0.108 0.128
#> GSM62318     1  0.5608     0.6392 0.672 0.000 0.016 0.116 0.196
#> GSM62321     1  0.6023     0.6361 0.620 0.008 0.008 0.116 0.248
#> GSM62322     3  0.0609     0.9725 0.020 0.000 0.980 0.000 0.000
#> GSM62250     5  0.4506     0.6578 0.076 0.036 0.000 0.096 0.792
#> GSM62252     5  0.4111     0.5953 0.116 0.004 0.000 0.084 0.796
#> GSM62255     4  0.2674     0.9026 0.000 0.140 0.000 0.856 0.004
#> GSM62257     4  0.3001     0.8967 0.000 0.144 0.004 0.844 0.008
#> GSM62260     1  0.3821     0.7292 0.764 0.000 0.000 0.020 0.216
#> GSM62261     5  0.6260     0.6251 0.000 0.152 0.000 0.372 0.476
#> GSM62262     4  0.2439     0.8992 0.000 0.120 0.000 0.876 0.004
#> GSM62264     1  0.2069     0.7378 0.912 0.000 0.000 0.012 0.076
#> GSM62268     1  0.3177     0.6881 0.792 0.000 0.208 0.000 0.000
#> GSM62269     3  0.0609     0.9725 0.020 0.000 0.980 0.000 0.000
#> GSM62271     1  0.5019     0.7584 0.732 0.000 0.128 0.012 0.128
#> GSM62272     3  0.0609     0.9725 0.020 0.000 0.980 0.000 0.000
#> GSM62273     2  0.6178     0.2397 0.000 0.572 0.012 0.288 0.128
#> GSM62274     3  0.3048     0.7882 0.176 0.000 0.820 0.000 0.004
#> GSM62275     3  0.0609     0.9725 0.020 0.000 0.980 0.000 0.000
#> GSM62276     1  0.5407     0.7461 0.680 0.000 0.116 0.008 0.196
#> GSM62277     3  0.0794     0.9670 0.028 0.000 0.972 0.000 0.000
#> GSM62279     1  0.4864     0.7412 0.720 0.000 0.116 0.000 0.164
#> GSM62282     1  0.6318     0.6875 0.644 0.000 0.084 0.088 0.184
#> GSM62283     1  0.4352     0.7671 0.772 0.000 0.060 0.008 0.160
#> GSM62286     5  0.3927     0.7053 0.004 0.040 0.000 0.164 0.792
#> GSM62287     4  0.2439     0.9041 0.000 0.120 0.000 0.876 0.004
#> GSM62288     5  0.6260     0.6251 0.000 0.152 0.000 0.372 0.476
#> GSM62290     2  0.0162     0.8883 0.000 0.996 0.000 0.000 0.004
#> GSM62293     4  0.3389     0.8678 0.000 0.116 0.000 0.836 0.048
#> GSM62301     2  0.0162     0.8873 0.000 0.996 0.000 0.004 0.000
#> GSM62302     4  0.2536     0.9050 0.000 0.128 0.000 0.868 0.004
#> GSM62303     4  0.2389     0.9033 0.000 0.116 0.000 0.880 0.004
#> GSM62304     4  0.2674     0.9026 0.000 0.140 0.000 0.856 0.004
#> GSM62312     2  0.0566     0.8856 0.000 0.984 0.012 0.004 0.000
#> GSM62313     4  0.2583     0.9042 0.000 0.132 0.000 0.864 0.004
#> GSM62314     5  0.6289     0.5832 0.000 0.152 0.000 0.396 0.452
#> GSM62319     2  0.3449     0.7149 0.000 0.812 0.000 0.024 0.164
#> GSM62320     2  0.0693     0.8835 0.000 0.980 0.012 0.008 0.000
#> GSM62249     1  0.4390     0.4900 0.568 0.004 0.000 0.000 0.428
#> GSM62251     1  0.2974     0.7601 0.868 0.000 0.052 0.000 0.080
#> GSM62263     2  0.5708     0.0362 0.060 0.480 0.000 0.008 0.452
#> GSM62285     2  0.0162     0.8873 0.000 0.996 0.000 0.004 0.000
#> GSM62315     2  0.0162     0.8873 0.000 0.996 0.000 0.004 0.000
#> GSM62291     2  0.0162     0.8883 0.000 0.996 0.000 0.000 0.004
#> GSM62265     1  0.2694     0.7592 0.884 0.000 0.076 0.000 0.040
#> GSM62266     1  0.2773     0.7218 0.836 0.000 0.164 0.000 0.000
#> GSM62296     2  0.0290     0.8877 0.000 0.992 0.000 0.000 0.008
#> GSM62309     2  0.0290     0.8877 0.000 0.992 0.000 0.000 0.008
#> GSM62295     4  0.4840     0.7762 0.000 0.116 0.012 0.748 0.124
#> GSM62300     2  0.0290     0.8877 0.000 0.992 0.000 0.000 0.008
#> GSM62308     2  0.0290     0.8877 0.000 0.992 0.000 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5  0.3951    0.74731 0.000 0.036 0.004 0.136 0.792 0.032
#> GSM62256     5  0.5627    0.66447 0.000 0.028 0.004 0.132 0.628 0.208
#> GSM62259     4  0.6478    0.17269 0.000 0.008 0.008 0.404 0.276 0.304
#> GSM62267     1  0.5677    0.61606 0.660 0.004 0.084 0.000 0.160 0.092
#> GSM62280     6  0.3887    0.84713 0.360 0.000 0.000 0.000 0.008 0.632
#> GSM62284     1  0.4382    0.17574 0.564 0.004 0.416 0.000 0.012 0.004
#> GSM62289     5  0.1096    0.72289 0.008 0.004 0.004 0.020 0.964 0.000
#> GSM62307     4  0.1668    0.84478 0.000 0.008 0.004 0.928 0.000 0.060
#> GSM62316     5  0.4799    0.69386 0.000 0.036 0.004 0.248 0.680 0.032
#> GSM62254     4  0.4657    0.69319 0.000 0.004 0.004 0.688 0.076 0.228
#> GSM62292     4  0.4657    0.69319 0.000 0.004 0.004 0.688 0.076 0.228
#> GSM62253     1  0.2149    0.65000 0.888 0.004 0.104 0.000 0.004 0.000
#> GSM62270     3  0.0458    0.93614 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM62278     3  0.0547    0.93426 0.020 0.000 0.980 0.000 0.000 0.000
#> GSM62297     2  0.1973    0.86501 0.000 0.924 0.008 0.004 0.028 0.036
#> GSM62298     2  0.1749    0.87387 0.000 0.932 0.008 0.024 0.000 0.036
#> GSM62299     2  0.1749    0.87336 0.000 0.932 0.008 0.024 0.000 0.036
#> GSM62258     1  0.5808    0.49373 0.624 0.004 0.040 0.000 0.156 0.176
#> GSM62281     5  0.7099    0.53663 0.000 0.160 0.008 0.116 0.484 0.232
#> GSM62294     4  0.0790    0.86458 0.000 0.000 0.000 0.968 0.000 0.032
#> GSM62305     5  0.1686    0.70850 0.000 0.000 0.000 0.012 0.924 0.064
#> GSM62306     5  0.4255    0.73738 0.000 0.024 0.000 0.112 0.768 0.096
#> GSM62310     4  0.0260    0.86739 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM62311     4  0.0260    0.86739 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM62317     2  0.4649    0.17634 0.040 0.492 0.000 0.000 0.000 0.468
#> GSM62318     6  0.3684    0.84451 0.372 0.000 0.000 0.000 0.000 0.628
#> GSM62321     6  0.4420    0.80986 0.320 0.004 0.000 0.000 0.036 0.640
#> GSM62322     3  0.0458    0.93614 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM62250     5  0.1223    0.71632 0.012 0.004 0.000 0.016 0.960 0.008
#> GSM62252     5  0.1325    0.71107 0.012 0.004 0.000 0.012 0.956 0.016
#> GSM62255     4  0.0806    0.86436 0.000 0.008 0.000 0.972 0.000 0.020
#> GSM62257     4  0.1912    0.84332 0.000 0.008 0.008 0.924 0.008 0.052
#> GSM62260     1  0.5414    0.06945 0.600 0.012 0.000 0.000 0.124 0.264
#> GSM62261     5  0.4888    0.68983 0.000 0.036 0.004 0.252 0.672 0.036
#> GSM62262     4  0.1644    0.84874 0.000 0.004 0.000 0.920 0.000 0.076
#> GSM62264     1  0.2949    0.41894 0.848 0.008 0.000 0.000 0.028 0.116
#> GSM62268     1  0.2288    0.64464 0.876 0.004 0.116 0.000 0.004 0.000
#> GSM62269     3  0.0458    0.93614 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM62271     1  0.5471    0.47664 0.672 0.004 0.092 0.000 0.060 0.172
#> GSM62272     3  0.0458    0.93614 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM62273     2  0.7244    0.14602 0.000 0.380 0.004 0.232 0.084 0.300
#> GSM62274     3  0.4119    0.40600 0.348 0.004 0.636 0.000 0.008 0.004
#> GSM62275     3  0.0458    0.93614 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM62276     1  0.5674    0.61295 0.660 0.004 0.080 0.000 0.160 0.096
#> GSM62277     3  0.1010    0.92110 0.036 0.000 0.960 0.000 0.004 0.000
#> GSM62279     1  0.4540    0.63327 0.732 0.000 0.076 0.000 0.168 0.024
#> GSM62282     6  0.5625    0.54009 0.432 0.004 0.088 0.000 0.012 0.464
#> GSM62283     1  0.4892    0.59110 0.732 0.008 0.036 0.000 0.120 0.104
#> GSM62286     5  0.0862    0.72042 0.008 0.004 0.000 0.016 0.972 0.000
#> GSM62287     4  0.0000    0.86852 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62288     5  0.4822    0.69082 0.000 0.036 0.004 0.252 0.676 0.032
#> GSM62290     2  0.0603    0.88136 0.000 0.980 0.000 0.016 0.004 0.000
#> GSM62293     4  0.2734    0.82376 0.000 0.004 0.004 0.860 0.016 0.116
#> GSM62301     2  0.0632    0.88066 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM62302     4  0.0837    0.86800 0.000 0.004 0.004 0.972 0.000 0.020
#> GSM62303     4  0.0777    0.86776 0.000 0.000 0.004 0.972 0.000 0.024
#> GSM62304     4  0.0520    0.86632 0.000 0.008 0.000 0.984 0.000 0.008
#> GSM62312     2  0.2408    0.84492 0.000 0.892 0.004 0.052 0.000 0.052
#> GSM62313     4  0.0146    0.86806 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM62314     5  0.4991    0.67777 0.000 0.036 0.008 0.264 0.660 0.032
#> GSM62319     2  0.5252    0.57475 0.000 0.628 0.000 0.016 0.104 0.252
#> GSM62320     2  0.1844    0.87041 0.000 0.924 0.004 0.024 0.000 0.048
#> GSM62249     5  0.4853   -0.00092 0.396 0.016 0.000 0.000 0.556 0.032
#> GSM62251     1  0.2179    0.62858 0.916 0.012 0.024 0.000 0.040 0.008
#> GSM62263     5  0.4997    0.32032 0.020 0.396 0.004 0.000 0.552 0.028
#> GSM62285     2  0.0632    0.88066 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM62315     2  0.0891    0.88117 0.000 0.968 0.000 0.024 0.000 0.008
#> GSM62291     2  0.0748    0.88143 0.000 0.976 0.000 0.016 0.004 0.004
#> GSM62265     1  0.1586    0.64731 0.940 0.004 0.040 0.000 0.012 0.004
#> GSM62266     1  0.2149    0.65000 0.888 0.004 0.104 0.000 0.004 0.000
#> GSM62296     2  0.1313    0.87940 0.000 0.952 0.000 0.016 0.004 0.028
#> GSM62309     2  0.1313    0.87940 0.000 0.952 0.000 0.016 0.004 0.028
#> GSM62295     4  0.5132    0.63731 0.000 0.004 0.008 0.624 0.084 0.280
#> GSM62300     2  0.1313    0.87940 0.000 0.952 0.000 0.016 0.004 0.028
#> GSM62308     2  0.1313    0.87940 0.000 0.952 0.000 0.016 0.004 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) other(p) genotype/variation(p) k
#> MAD:kmeans 73          0.68498    1.000                0.7909 2
#> MAD:kmeans 58          0.56877    0.874                0.5252 3
#> MAD:kmeans 66          0.00581    0.739                0.1197 4
#> MAD:kmeans 70          0.00576    0.767                0.0675 5
#> MAD:kmeans 64          0.00426    0.792                0.2004 6

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


MAD:skmeans**

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.980       0.992         0.4871 0.514   0.514
#> 3 3 1.000           0.942       0.969         0.3596 0.783   0.592
#> 4 4 0.870           0.857       0.931         0.1026 0.907   0.737
#> 5 5 0.828           0.753       0.886         0.0705 0.936   0.772
#> 6 6 0.795           0.606       0.800         0.0316 0.957   0.825

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
#> GSM62248     2   0.000      0.992 0.000 1.000
#> GSM62256     2   0.000      0.992 0.000 1.000
#> GSM62259     2   0.000      0.992 0.000 1.000
#> GSM62267     1   0.000      0.990 1.000 0.000
#> GSM62280     1   0.000      0.990 1.000 0.000
#> GSM62284     1   0.000      0.990 1.000 0.000
#> GSM62289     2   0.000      0.992 0.000 1.000
#> GSM62307     2   0.000      0.992 0.000 1.000
#> GSM62316     2   0.000      0.992 0.000 1.000
#> GSM62254     2   0.000      0.992 0.000 1.000
#> GSM62292     2   0.000      0.992 0.000 1.000
#> GSM62253     1   0.000      0.990 1.000 0.000
#> GSM62270     1   0.000      0.990 1.000 0.000
#> GSM62278     1   0.000      0.990 1.000 0.000
#> GSM62297     2   0.000      0.992 0.000 1.000
#> GSM62298     2   0.000      0.992 0.000 1.000
#> GSM62299     2   0.000      0.992 0.000 1.000
#> GSM62258     1   0.000      0.990 1.000 0.000
#> GSM62281     2   0.000      0.992 0.000 1.000
#> GSM62294     2   0.000      0.992 0.000 1.000
#> GSM62305     1   0.781      0.696 0.768 0.232
#> GSM62306     2   0.000      0.992 0.000 1.000
#> GSM62310     2   0.000      0.992 0.000 1.000
#> GSM62311     2   0.000      0.992 0.000 1.000
#> GSM62317     2   0.000      0.992 0.000 1.000
#> GSM62318     1   0.000      0.990 1.000 0.000
#> GSM62321     1   0.000      0.990 1.000 0.000
#> GSM62322     1   0.000      0.990 1.000 0.000
#> GSM62250     1   0.260      0.948 0.956 0.044
#> GSM62252     1   0.000      0.990 1.000 0.000
#> GSM62255     2   0.000      0.992 0.000 1.000
#> GSM62257     2   0.000      0.992 0.000 1.000
#> GSM62260     1   0.000      0.990 1.000 0.000
#> GSM62261     2   0.000      0.992 0.000 1.000
#> GSM62262     2   0.000      0.992 0.000 1.000
#> GSM62264     1   0.000      0.990 1.000 0.000
#> GSM62268     1   0.000      0.990 1.000 0.000
#> GSM62269     1   0.000      0.990 1.000 0.000
#> GSM62271     1   0.000      0.990 1.000 0.000
#> GSM62272     1   0.000      0.990 1.000 0.000
#> GSM62273     2   0.000      0.992 0.000 1.000
#> GSM62274     1   0.000      0.990 1.000 0.000
#> GSM62275     1   0.000      0.990 1.000 0.000
#> GSM62276     1   0.000      0.990 1.000 0.000
#> GSM62277     1   0.000      0.990 1.000 0.000
#> GSM62279     1   0.000      0.990 1.000 0.000
#> GSM62282     1   0.000      0.990 1.000 0.000
#> GSM62283     1   0.000      0.990 1.000 0.000
#> GSM62286     2   0.000      0.992 0.000 1.000
#> GSM62287     2   0.000      0.992 0.000 1.000
#> GSM62288     2   0.000      0.992 0.000 1.000
#> GSM62290     2   0.000      0.992 0.000 1.000
#> GSM62293     2   0.000      0.992 0.000 1.000
#> GSM62301     2   0.000      0.992 0.000 1.000
#> GSM62302     2   0.000      0.992 0.000 1.000
#> GSM62303     2   0.000      0.992 0.000 1.000
#> GSM62304     2   0.000      0.992 0.000 1.000
#> GSM62312     2   0.000      0.992 0.000 1.000
#> GSM62313     2   0.000      0.992 0.000 1.000
#> GSM62314     2   0.000      0.992 0.000 1.000
#> GSM62319     2   0.000      0.992 0.000 1.000
#> GSM62320     2   0.000      0.992 0.000 1.000
#> GSM62249     1   0.000      0.990 1.000 0.000
#> GSM62251     1   0.000      0.990 1.000 0.000
#> GSM62263     2   0.925      0.474 0.340 0.660
#> GSM62285     2   0.000      0.992 0.000 1.000
#> GSM62315     2   0.000      0.992 0.000 1.000
#> GSM62291     2   0.000      0.992 0.000 1.000
#> GSM62265     1   0.000      0.990 1.000 0.000
#> GSM62266     1   0.000      0.990 1.000 0.000
#> GSM62296     2   0.000      0.992 0.000 1.000
#> GSM62309     2   0.000      0.992 0.000 1.000
#> GSM62295     2   0.000      0.992 0.000 1.000
#> GSM62300     2   0.000      0.992 0.000 1.000
#> GSM62308     2   0.000      0.992 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.0747     0.9314 0.000 0.984 0.016
#> GSM62256     2  0.1964     0.9487 0.000 0.944 0.056
#> GSM62259     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62267     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62280     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62284     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62289     2  0.0000     0.9306 0.000 1.000 0.000
#> GSM62307     2  0.1964     0.9487 0.000 0.944 0.056
#> GSM62316     2  0.0592     0.9322 0.000 0.988 0.012
#> GSM62254     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62292     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62253     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62270     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62278     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62297     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62298     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62299     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62258     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62281     3  0.6274     0.0957 0.000 0.456 0.544
#> GSM62294     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62305     2  0.5948     0.4172 0.360 0.640 0.000
#> GSM62306     2  0.0000     0.9306 0.000 1.000 0.000
#> GSM62310     2  0.2066     0.9464 0.000 0.940 0.060
#> GSM62311     2  0.1964     0.9487 0.000 0.944 0.056
#> GSM62317     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62318     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62321     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62322     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62250     2  0.5529     0.5589 0.296 0.704 0.000
#> GSM62252     1  0.1964     0.9493 0.944 0.056 0.000
#> GSM62255     2  0.1964     0.9487 0.000 0.944 0.056
#> GSM62257     2  0.1964     0.9487 0.000 0.944 0.056
#> GSM62260     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62261     2  0.0747     0.9314 0.000 0.984 0.016
#> GSM62262     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62264     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62268     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62269     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62271     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62272     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62273     3  0.2537     0.8938 0.000 0.080 0.920
#> GSM62274     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62275     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62276     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62277     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62279     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62282     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62283     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62286     2  0.0000     0.9306 0.000 1.000 0.000
#> GSM62287     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62288     2  0.0747     0.9314 0.000 0.984 0.016
#> GSM62290     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62293     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62301     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62302     2  0.1964     0.9487 0.000 0.944 0.056
#> GSM62303     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62304     2  0.1964     0.9487 0.000 0.944 0.056
#> GSM62312     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62313     2  0.1964     0.9487 0.000 0.944 0.056
#> GSM62314     2  0.0747     0.9314 0.000 0.984 0.016
#> GSM62319     3  0.0747     0.9532 0.000 0.016 0.984
#> GSM62320     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62249     1  0.1289     0.9702 0.968 0.032 0.000
#> GSM62251     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62263     3  0.1753     0.9200 0.000 0.048 0.952
#> GSM62285     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62315     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62291     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62265     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62266     1  0.0000     0.9970 1.000 0.000 0.000
#> GSM62296     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62309     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62295     2  0.1753     0.9495 0.000 0.952 0.048
#> GSM62300     3  0.0000     0.9647 0.000 0.000 1.000
#> GSM62308     3  0.0000     0.9647 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     3  0.3908     0.8247 0.000 0.004 0.784 0.212
#> GSM62256     4  0.0469     0.8644 0.000 0.012 0.000 0.988
#> GSM62259     4  0.0707     0.8656 0.000 0.000 0.020 0.980
#> GSM62267     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62280     1  0.1474     0.9368 0.948 0.000 0.052 0.000
#> GSM62284     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62289     3  0.3123     0.8540 0.000 0.000 0.844 0.156
#> GSM62307     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62316     4  0.5126    -0.1033 0.000 0.004 0.444 0.552
#> GSM62254     4  0.0707     0.8656 0.000 0.000 0.020 0.980
#> GSM62292     4  0.0707     0.8656 0.000 0.000 0.020 0.980
#> GSM62253     1  0.1557     0.9430 0.944 0.000 0.056 0.000
#> GSM62270     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62278     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62297     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62298     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62258     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62281     4  0.3726     0.6258 0.000 0.212 0.000 0.788
#> GSM62294     4  0.0188     0.8704 0.000 0.000 0.004 0.996
#> GSM62305     3  0.1807     0.8176 0.008 0.000 0.940 0.052
#> GSM62306     3  0.3837     0.8159 0.000 0.000 0.776 0.224
#> GSM62310     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62311     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62317     2  0.1474     0.9418 0.000 0.948 0.052 0.000
#> GSM62318     1  0.2469     0.9168 0.892 0.000 0.108 0.000
#> GSM62321     1  0.3024     0.8910 0.852 0.000 0.148 0.000
#> GSM62322     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62250     3  0.3037     0.8325 0.036 0.000 0.888 0.076
#> GSM62252     3  0.2760     0.7557 0.128 0.000 0.872 0.000
#> GSM62255     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62257     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62260     1  0.3074     0.8891 0.848 0.000 0.152 0.000
#> GSM62261     4  0.5250    -0.0989 0.000 0.008 0.440 0.552
#> GSM62262     4  0.0707     0.8656 0.000 0.000 0.020 0.980
#> GSM62264     1  0.3123     0.8859 0.844 0.000 0.156 0.000
#> GSM62268     1  0.1557     0.9430 0.944 0.000 0.056 0.000
#> GSM62269     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62271     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62272     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62273     4  0.5570     0.1608 0.000 0.440 0.020 0.540
#> GSM62274     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62275     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62276     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62277     1  0.0000     0.9574 1.000 0.000 0.000 0.000
#> GSM62279     1  0.0592     0.9523 0.984 0.000 0.016 0.000
#> GSM62282     1  0.0188     0.9565 0.996 0.000 0.004 0.000
#> GSM62283     1  0.0592     0.9549 0.984 0.000 0.016 0.000
#> GSM62286     3  0.3074     0.8542 0.000 0.000 0.848 0.152
#> GSM62287     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62288     3  0.5039     0.4866 0.000 0.004 0.592 0.404
#> GSM62290     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62293     4  0.0707     0.8656 0.000 0.000 0.020 0.980
#> GSM62301     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62302     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62303     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62304     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62312     2  0.0188     0.9797 0.000 0.996 0.000 0.004
#> GSM62313     4  0.0000     0.8713 0.000 0.000 0.000 1.000
#> GSM62314     4  0.4991     0.1165 0.000 0.004 0.388 0.608
#> GSM62319     2  0.1411     0.9489 0.000 0.960 0.020 0.020
#> GSM62320     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62249     1  0.4382     0.7137 0.704 0.000 0.296 0.000
#> GSM62251     1  0.2408     0.9180 0.896 0.000 0.104 0.000
#> GSM62263     2  0.3400     0.8073 0.000 0.820 0.180 0.000
#> GSM62285     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62265     1  0.1557     0.9430 0.944 0.000 0.056 0.000
#> GSM62266     1  0.1557     0.9430 0.944 0.000 0.056 0.000
#> GSM62296     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62309     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62295     4  0.0895     0.8630 0.000 0.004 0.020 0.976
#> GSM62300     2  0.0000     0.9830 0.000 1.000 0.000 0.000
#> GSM62308     2  0.0000     0.9830 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
#> GSM62248     5  0.3810     0.7523 0.000 0.000 0.036 0.176 0.788
#> GSM62256     4  0.3318     0.7643 0.000 0.036 0.048 0.868 0.048
#> GSM62259     4  0.2863     0.8190 0.000 0.000 0.060 0.876 0.064
#> GSM62267     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62280     3  0.4450     0.2483 0.488 0.000 0.508 0.000 0.004
#> GSM62284     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62289     5  0.1638     0.7714 0.000 0.000 0.004 0.064 0.932
#> GSM62307     4  0.1116     0.8329 0.000 0.004 0.028 0.964 0.004
#> GSM62316     4  0.5259    -0.3105 0.000 0.004 0.036 0.484 0.476
#> GSM62254     4  0.2104     0.8249 0.000 0.000 0.024 0.916 0.060
#> GSM62292     4  0.2104     0.8249 0.000 0.000 0.024 0.916 0.060
#> GSM62253     1  0.3932     0.5292 0.672 0.000 0.328 0.000 0.000
#> GSM62270     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62278     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62297     2  0.0162     0.9497 0.000 0.996 0.004 0.000 0.000
#> GSM62298     2  0.0162     0.9497 0.000 0.996 0.004 0.000 0.000
#> GSM62299     2  0.0162     0.9497 0.000 0.996 0.004 0.000 0.000
#> GSM62258     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62281     4  0.4651     0.5801 0.000 0.248 0.036 0.708 0.008
#> GSM62294     4  0.1106     0.8402 0.000 0.000 0.012 0.964 0.024
#> GSM62305     5  0.2470     0.7021 0.000 0.000 0.104 0.012 0.884
#> GSM62306     5  0.4031     0.7533 0.000 0.000 0.044 0.184 0.772
#> GSM62310     4  0.0324     0.8434 0.000 0.004 0.004 0.992 0.000
#> GSM62311     4  0.0162     0.8440 0.000 0.004 0.000 0.996 0.000
#> GSM62317     2  0.4561     0.0744 0.000 0.504 0.488 0.000 0.008
#> GSM62318     3  0.3010     0.7952 0.172 0.000 0.824 0.000 0.004
#> GSM62321     3  0.2124     0.8253 0.096 0.000 0.900 0.000 0.004
#> GSM62322     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62250     5  0.1992     0.7620 0.000 0.000 0.032 0.044 0.924
#> GSM62252     5  0.2504     0.6979 0.064 0.000 0.040 0.000 0.896
#> GSM62255     4  0.0566     0.8419 0.000 0.004 0.012 0.984 0.000
#> GSM62257     4  0.1461     0.8254 0.000 0.004 0.028 0.952 0.016
#> GSM62260     3  0.2280     0.8330 0.120 0.000 0.880 0.000 0.000
#> GSM62261     5  0.5259     0.2025 0.000 0.004 0.036 0.480 0.480
#> GSM62262     4  0.2104     0.8249 0.000 0.000 0.024 0.916 0.060
#> GSM62264     3  0.2127     0.8324 0.108 0.000 0.892 0.000 0.000
#> GSM62268     1  0.3895     0.5423 0.680 0.000 0.320 0.000 0.000
#> GSM62269     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62271     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62272     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62273     4  0.6182     0.1059 0.000 0.432 0.032 0.476 0.060
#> GSM62274     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62275     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62276     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62277     1  0.0000     0.8721 1.000 0.000 0.000 0.000 0.000
#> GSM62279     1  0.0693     0.8571 0.980 0.000 0.008 0.000 0.012
#> GSM62282     1  0.1197     0.8298 0.952 0.000 0.048 0.000 0.000
#> GSM62283     1  0.3177     0.6954 0.792 0.000 0.208 0.000 0.000
#> GSM62286     5  0.1331     0.7672 0.000 0.000 0.008 0.040 0.952
#> GSM62287     4  0.0000     0.8444 0.000 0.000 0.000 1.000 0.000
#> GSM62288     5  0.5139     0.4634 0.000 0.004 0.036 0.384 0.576
#> GSM62290     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000
#> GSM62293     4  0.2104     0.8249 0.000 0.000 0.024 0.916 0.060
#> GSM62301     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000
#> GSM62302     4  0.0162     0.8446 0.000 0.000 0.004 0.996 0.000
#> GSM62303     4  0.0324     0.8448 0.000 0.000 0.004 0.992 0.004
#> GSM62304     4  0.0833     0.8387 0.000 0.004 0.016 0.976 0.004
#> GSM62312     2  0.2546     0.8633 0.000 0.904 0.036 0.048 0.012
#> GSM62313     4  0.0000     0.8444 0.000 0.000 0.000 1.000 0.000
#> GSM62314     4  0.5206    -0.1079 0.000 0.004 0.036 0.544 0.416
#> GSM62319     2  0.2409     0.8691 0.000 0.908 0.020 0.012 0.060
#> GSM62320     2  0.0162     0.9497 0.000 0.996 0.004 0.000 0.000
#> GSM62249     3  0.3667     0.7919 0.140 0.000 0.812 0.000 0.048
#> GSM62251     1  0.4171     0.3847 0.604 0.000 0.396 0.000 0.000
#> GSM62263     3  0.2852     0.6641 0.000 0.172 0.828 0.000 0.000
#> GSM62285     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000
#> GSM62265     1  0.3837     0.5619 0.692 0.000 0.308 0.000 0.000
#> GSM62266     1  0.3949     0.5216 0.668 0.000 0.332 0.000 0.000
#> GSM62296     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000
#> GSM62309     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000
#> GSM62295     4  0.2104     0.8249 0.000 0.000 0.024 0.916 0.060
#> GSM62300     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000
#> GSM62308     2  0.0000     0.9508 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5  0.5497     0.4483 0.000 0.000 0.176 0.268 0.556 0.000
#> GSM62256     4  0.4759     0.5992 0.000 0.024 0.224 0.696 0.052 0.004
#> GSM62259     4  0.4139     0.6306 0.000 0.000 0.336 0.640 0.024 0.000
#> GSM62267     1  0.0000     0.8290 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62280     6  0.2912     0.2864 0.216 0.000 0.000 0.000 0.000 0.784
#> GSM62284     1  0.0291     0.8264 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM62289     5  0.2066     0.7191 0.000 0.000 0.072 0.024 0.904 0.000
#> GSM62307     4  0.1524     0.7580 0.000 0.000 0.060 0.932 0.008 0.000
#> GSM62316     4  0.5544     0.2487 0.000 0.000 0.176 0.544 0.280 0.000
#> GSM62254     4  0.3230     0.7016 0.000 0.000 0.212 0.776 0.012 0.000
#> GSM62292     4  0.3230     0.7016 0.000 0.000 0.212 0.776 0.012 0.000
#> GSM62253     1  0.5556     0.3402 0.588 0.000 0.220 0.000 0.008 0.184
#> GSM62270     1  0.0146     0.8291 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM62278     1  0.0146     0.8291 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM62297     2  0.0547     0.9069 0.000 0.980 0.020 0.000 0.000 0.000
#> GSM62298     2  0.0508     0.9079 0.000 0.984 0.012 0.004 0.000 0.000
#> GSM62299     2  0.0458     0.9081 0.000 0.984 0.016 0.000 0.000 0.000
#> GSM62258     1  0.0146     0.8281 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM62281     4  0.5728     0.4841 0.000 0.220 0.164 0.596 0.016 0.004
#> GSM62294     4  0.2070     0.7556 0.000 0.000 0.092 0.896 0.012 0.000
#> GSM62305     5  0.4391     0.5520 0.000 0.000 0.320 0.028 0.644 0.008
#> GSM62306     5  0.5738     0.4924 0.000 0.000 0.240 0.244 0.516 0.000
#> GSM62310     4  0.0458     0.7755 0.000 0.000 0.016 0.984 0.000 0.000
#> GSM62311     4  0.0000     0.7770 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     6  0.3190     0.3146 0.000 0.220 0.008 0.000 0.000 0.772
#> GSM62318     6  0.0692     0.3865 0.020 0.000 0.004 0.000 0.000 0.976
#> GSM62321     6  0.0146     0.3815 0.000 0.000 0.004 0.000 0.000 0.996
#> GSM62322     1  0.0146     0.8291 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM62250     5  0.0717     0.7217 0.000 0.000 0.016 0.008 0.976 0.000
#> GSM62252     5  0.2074     0.6697 0.036 0.000 0.048 0.000 0.912 0.004
#> GSM62255     4  0.0363     0.7761 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM62257     4  0.1657     0.7555 0.000 0.000 0.056 0.928 0.016 0.000
#> GSM62260     6  0.4076    -0.3872 0.016 0.000 0.364 0.000 0.000 0.620
#> GSM62261     4  0.5506     0.2734 0.000 0.000 0.180 0.556 0.264 0.000
#> GSM62262     4  0.3046     0.7137 0.000 0.000 0.188 0.800 0.012 0.000
#> GSM62264     6  0.4452    -0.5787 0.016 0.000 0.428 0.000 0.008 0.548
#> GSM62268     1  0.5437     0.3800 0.608 0.000 0.204 0.000 0.008 0.180
#> GSM62269     1  0.0146     0.8291 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM62271     1  0.0260     0.8284 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM62272     1  0.0146     0.8291 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM62273     2  0.6306    -0.0188 0.000 0.380 0.288 0.324 0.008 0.000
#> GSM62274     1  0.0000     0.8290 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62275     1  0.0146     0.8291 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM62276     1  0.0000     0.8290 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62277     1  0.0000     0.8290 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62279     1  0.0820     0.8166 0.972 0.000 0.012 0.000 0.016 0.000
#> GSM62282     1  0.1327     0.7855 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM62283     1  0.5127     0.1971 0.544 0.000 0.364 0.000 0.000 0.092
#> GSM62286     5  0.0551     0.7266 0.000 0.000 0.008 0.004 0.984 0.004
#> GSM62287     4  0.0291     0.7776 0.000 0.000 0.004 0.992 0.004 0.000
#> GSM62288     4  0.5728     0.0604 0.000 0.000 0.180 0.484 0.336 0.000
#> GSM62290     2  0.0146     0.9096 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM62293     4  0.3141     0.7078 0.000 0.000 0.200 0.788 0.012 0.000
#> GSM62301     2  0.0146     0.9096 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM62302     4  0.0363     0.7774 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM62303     4  0.0935     0.7749 0.000 0.000 0.032 0.964 0.004 0.000
#> GSM62304     4  0.0806     0.7720 0.000 0.000 0.020 0.972 0.008 0.000
#> GSM62312     2  0.4178     0.6522 0.000 0.756 0.092 0.144 0.008 0.000
#> GSM62313     4  0.0146     0.7773 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM62314     4  0.5287     0.3661 0.000 0.000 0.176 0.600 0.224 0.000
#> GSM62319     2  0.3290     0.6775 0.000 0.744 0.252 0.000 0.004 0.000
#> GSM62320     2  0.0363     0.9086 0.000 0.988 0.012 0.000 0.000 0.000
#> GSM62249     3  0.6387     0.0000 0.064 0.000 0.444 0.000 0.108 0.384
#> GSM62251     1  0.6120    -0.1323 0.436 0.000 0.344 0.000 0.008 0.212
#> GSM62263     6  0.5258    -0.5756 0.000 0.064 0.448 0.000 0.012 0.476
#> GSM62285     2  0.0000     0.9102 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9102 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62291     2  0.0000     0.9102 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62265     1  0.5806     0.1871 0.524 0.000 0.296 0.000 0.008 0.172
#> GSM62266     1  0.5866     0.1629 0.516 0.000 0.292 0.000 0.008 0.184
#> GSM62296     2  0.0363     0.9090 0.000 0.988 0.012 0.000 0.000 0.000
#> GSM62309     2  0.0260     0.9091 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM62295     4  0.3394     0.6880 0.000 0.000 0.236 0.752 0.012 0.000
#> GSM62300     2  0.0363     0.9090 0.000 0.988 0.012 0.000 0.000 0.000
#> GSM62308     2  0.0260     0.9091 0.000 0.992 0.008 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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) other(p) genotype/variation(p) k
#> MAD:skmeans 74         0.814696    1.000                0.7495 2
#> MAD:skmeans 73         0.001807    0.763                0.0348 3
#> MAD:skmeans 70         0.004230    0.911                0.1237 4
#> MAD:skmeans 67         0.007780    0.892                0.0535 5
#> MAD:skmeans 53         0.000895    0.891                0.2355 6

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


MAD:pam*

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 1.000           0.969       0.987         0.4876 0.508   0.508
#> 3 3 0.647           0.224       0.654         0.2597 0.699   0.484
#> 4 4 0.943           0.923       0.969         0.1787 0.704   0.364
#> 5 5 0.900           0.831       0.914         0.0364 0.977   0.918
#> 6 6 0.851           0.842       0.917         0.0460 0.933   0.753

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette    p1    p2
#> GSM62248     2   0.000     0.9989 0.000 1.000
#> GSM62256     2   0.000     0.9989 0.000 1.000
#> GSM62259     2   0.000     0.9989 0.000 1.000
#> GSM62267     1   0.000     0.9700 1.000 0.000
#> GSM62280     1   0.000     0.9700 1.000 0.000
#> GSM62284     1   0.000     0.9700 1.000 0.000
#> GSM62289     2   0.000     0.9989 0.000 1.000
#> GSM62307     2   0.000     0.9989 0.000 1.000
#> GSM62316     2   0.000     0.9989 0.000 1.000
#> GSM62254     2   0.000     0.9989 0.000 1.000
#> GSM62292     2   0.000     0.9989 0.000 1.000
#> GSM62253     1   0.000     0.9700 1.000 0.000
#> GSM62270     1   0.000     0.9700 1.000 0.000
#> GSM62278     1   0.000     0.9700 1.000 0.000
#> GSM62297     2   0.000     0.9989 0.000 1.000
#> GSM62298     2   0.000     0.9989 0.000 1.000
#> GSM62299     2   0.000     0.9989 0.000 1.000
#> GSM62258     1   0.000     0.9700 1.000 0.000
#> GSM62281     2   0.000     0.9989 0.000 1.000
#> GSM62294     2   0.000     0.9989 0.000 1.000
#> GSM62305     1   0.689     0.7762 0.816 0.184
#> GSM62306     2   0.000     0.9989 0.000 1.000
#> GSM62310     2   0.000     0.9989 0.000 1.000
#> GSM62311     2   0.000     0.9989 0.000 1.000
#> GSM62317     2   0.000     0.9989 0.000 1.000
#> GSM62318     1   0.000     0.9700 1.000 0.000
#> GSM62321     1   0.278     0.9322 0.952 0.048
#> GSM62322     1   0.000     0.9700 1.000 0.000
#> GSM62250     2   0.278     0.9481 0.048 0.952
#> GSM62252     1   0.482     0.8764 0.896 0.104
#> GSM62255     2   0.000     0.9989 0.000 1.000
#> GSM62257     2   0.000     0.9989 0.000 1.000
#> GSM62260     1   0.000     0.9700 1.000 0.000
#> GSM62261     2   0.000     0.9989 0.000 1.000
#> GSM62262     2   0.000     0.9989 0.000 1.000
#> GSM62264     1   0.000     0.9700 1.000 0.000
#> GSM62268     1   0.000     0.9700 1.000 0.000
#> GSM62269     1   0.000     0.9700 1.000 0.000
#> GSM62271     1   0.000     0.9700 1.000 0.000
#> GSM62272     1   0.000     0.9700 1.000 0.000
#> GSM62273     2   0.000     0.9989 0.000 1.000
#> GSM62274     1   0.000     0.9700 1.000 0.000
#> GSM62275     1   0.000     0.9700 1.000 0.000
#> GSM62276     1   0.000     0.9700 1.000 0.000
#> GSM62277     1   0.000     0.9700 1.000 0.000
#> GSM62279     1   0.000     0.9700 1.000 0.000
#> GSM62282     1   0.000     0.9700 1.000 0.000
#> GSM62283     1   0.000     0.9700 1.000 0.000
#> GSM62286     2   0.000     0.9989 0.000 1.000
#> GSM62287     2   0.000     0.9989 0.000 1.000
#> GSM62288     2   0.000     0.9989 0.000 1.000
#> GSM62290     2   0.000     0.9989 0.000 1.000
#> GSM62293     2   0.000     0.9989 0.000 1.000
#> GSM62301     2   0.000     0.9989 0.000 1.000
#> GSM62302     2   0.000     0.9989 0.000 1.000
#> GSM62303     2   0.000     0.9989 0.000 1.000
#> GSM62304     2   0.000     0.9989 0.000 1.000
#> GSM62312     2   0.000     0.9989 0.000 1.000
#> GSM62313     2   0.000     0.9989 0.000 1.000
#> GSM62314     2   0.000     0.9989 0.000 1.000
#> GSM62319     1   0.999     0.0844 0.516 0.484
#> GSM62320     2   0.000     0.9989 0.000 1.000
#> GSM62249     1   0.000     0.9700 1.000 0.000
#> GSM62251     1   0.000     0.9700 1.000 0.000
#> GSM62263     1   0.373     0.9111 0.928 0.072
#> GSM62285     2   0.000     0.9989 0.000 1.000
#> GSM62315     2   0.000     0.9989 0.000 1.000
#> GSM62291     2   0.000     0.9989 0.000 1.000
#> GSM62265     1   0.000     0.9700 1.000 0.000
#> GSM62266     1   0.000     0.9700 1.000 0.000
#> GSM62296     2   0.000     0.9989 0.000 1.000
#> GSM62309     2   0.000     0.9989 0.000 1.000
#> GSM62295     2   0.000     0.9989 0.000 1.000
#> GSM62300     2   0.000     0.9989 0.000 1.000
#> GSM62308     2   0.000     0.9989 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
#> GSM62248     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62256     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62259     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62267     1  0.6309    -0.7144 0.500 0.000 0.500
#> GSM62280     3  0.6309     0.6825 0.500 0.000 0.500
#> GSM62284     3  0.5254     0.7102 0.264 0.000 0.736
#> GSM62289     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62307     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62316     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62254     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62292     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62253     1  0.6309    -0.7144 0.500 0.000 0.500
#> GSM62270     3  0.0000     0.6999 0.000 0.000 1.000
#> GSM62278     3  0.0000     0.6999 0.000 0.000 1.000
#> GSM62297     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62298     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62299     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62258     3  0.6309     0.6825 0.500 0.000 0.500
#> GSM62281     2  0.5678     0.4593 0.316 0.684 0.000
#> GSM62294     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62305     2  0.6489    -0.1862 0.456 0.540 0.004
#> GSM62306     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62310     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62311     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62317     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62318     3  0.6309     0.6825 0.500 0.000 0.500
#> GSM62321     1  0.8859    -0.3085 0.500 0.376 0.124
#> GSM62322     3  0.0000     0.6999 0.000 0.000 1.000
#> GSM62250     1  0.6669    -0.3880 0.524 0.468 0.008
#> GSM62252     1  0.2165    -0.0917 0.936 0.000 0.064
#> GSM62255     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62257     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62260     1  0.9372    -0.3900 0.500 0.300 0.200
#> GSM62261     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62262     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62264     1  0.7979    -0.6560 0.500 0.060 0.440
#> GSM62268     3  0.6309     0.6825 0.500 0.000 0.500
#> GSM62269     3  0.0000     0.6999 0.000 0.000 1.000
#> GSM62271     3  0.6309     0.6825 0.500 0.000 0.500
#> GSM62272     3  0.0000     0.6999 0.000 0.000 1.000
#> GSM62273     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62274     3  0.2878     0.7074 0.096 0.000 0.904
#> GSM62275     3  0.0000     0.6999 0.000 0.000 1.000
#> GSM62276     3  0.6309     0.6825 0.500 0.000 0.500
#> GSM62277     3  0.0000     0.6999 0.000 0.000 1.000
#> GSM62279     1  0.6309    -0.7144 0.500 0.000 0.500
#> GSM62282     3  0.5882     0.6990 0.348 0.000 0.652
#> GSM62283     1  0.8310    -0.6363 0.500 0.080 0.420
#> GSM62286     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62287     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62288     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62290     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62293     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62301     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62302     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62303     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62304     2  0.6309     0.3636 0.500 0.500 0.000
#> GSM62312     2  0.6309     0.3659 0.496 0.504 0.000
#> GSM62313     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62314     1  0.6309    -0.4108 0.500 0.500 0.000
#> GSM62319     2  0.6309    -0.2579 0.500 0.500 0.000
#> GSM62320     2  0.4887     0.4908 0.228 0.772 0.000
#> GSM62249     1  0.8936    -0.3161 0.500 0.368 0.132
#> GSM62251     3  0.6309     0.6825 0.500 0.000 0.500
#> GSM62263     2  0.6309    -0.2579 0.500 0.500 0.000
#> GSM62285     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62315     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62291     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62265     1  0.6309    -0.7144 0.500 0.000 0.500
#> GSM62266     3  0.6309     0.6825 0.500 0.000 0.500
#> GSM62296     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62309     2  0.0424     0.5284 0.008 0.992 0.000
#> GSM62295     2  0.5363     0.4754 0.276 0.724 0.000
#> GSM62300     2  0.0000     0.5367 0.000 1.000 0.000
#> GSM62308     2  0.0000     0.5367 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
#> GSM62248     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62256     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62259     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62267     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62280     1  0.0592      0.961 0.984 0.000 0.016 0.000
#> GSM62284     1  0.4431      0.534 0.696 0.000 0.304 0.000
#> GSM62289     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62307     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62316     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62254     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62292     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62253     1  0.0592      0.961 0.984 0.000 0.016 0.000
#> GSM62270     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM62278     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM62297     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62298     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62258     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62281     4  0.2530      0.860 0.000 0.112 0.000 0.888
#> GSM62294     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62305     2  0.2469      0.843 0.108 0.892 0.000 0.000
#> GSM62306     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62310     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62311     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62317     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62318     1  0.0592      0.961 0.984 0.000 0.016 0.000
#> GSM62321     2  0.4746      0.445 0.368 0.632 0.000 0.000
#> GSM62322     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM62250     4  0.2011      0.892 0.080 0.000 0.000 0.920
#> GSM62252     1  0.1940      0.872 0.924 0.000 0.000 0.076
#> GSM62255     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62257     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62260     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62261     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62262     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62264     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62268     1  0.0592      0.961 0.984 0.000 0.016 0.000
#> GSM62269     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM62271     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62272     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM62273     2  0.0188      0.943 0.000 0.996 0.000 0.004
#> GSM62274     3  0.3610      0.734 0.200 0.000 0.800 0.000
#> GSM62275     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM62276     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62277     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM62279     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62282     3  0.4431      0.560 0.304 0.000 0.696 0.000
#> GSM62283     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62286     4  0.0469      0.966 0.000 0.012 0.000 0.988
#> GSM62287     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62288     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62290     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62293     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62301     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62302     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62303     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62304     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62312     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM62313     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62314     4  0.0000      0.977 0.000 0.000 0.000 1.000
#> GSM62319     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62320     4  0.4761      0.409 0.000 0.372 0.000 0.628
#> GSM62249     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62251     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62263     2  0.0817      0.928 0.024 0.976 0.000 0.000
#> GSM62285     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62265     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62266     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> GSM62296     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62309     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62295     2  0.4304      0.577 0.000 0.716 0.000 0.284
#> GSM62300     2  0.0000      0.947 0.000 1.000 0.000 0.000
#> GSM62308     2  0.0000      0.947 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
#> GSM62248     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62256     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62259     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62267     1  0.0000      0.707 1.000 0.000 0.000 0.000 0.000
#> GSM62280     5  0.4088      0.697 0.368 0.000 0.000 0.000 0.632
#> GSM62284     1  0.6728      0.346 0.380 0.000 0.252 0.000 0.368
#> GSM62289     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62307     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62316     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62254     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62292     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62253     1  0.4088      0.673 0.632 0.000 0.000 0.000 0.368
#> GSM62270     3  0.0000      0.943 0.000 0.000 1.000 0.000 0.000
#> GSM62278     3  0.0000      0.943 0.000 0.000 1.000 0.000 0.000
#> GSM62297     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62298     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62299     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62258     1  0.0000      0.707 1.000 0.000 0.000 0.000 0.000
#> GSM62281     4  0.1270      0.925 0.000 0.052 0.000 0.948 0.000
#> GSM62294     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62305     2  0.4171      0.264 0.396 0.604 0.000 0.000 0.000
#> GSM62306     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62310     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62311     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62317     2  0.4273      0.155 0.000 0.552 0.000 0.000 0.448
#> GSM62318     5  0.0000      0.483 0.000 0.000 0.000 0.000 1.000
#> GSM62321     5  0.5670      0.639 0.192 0.176 0.000 0.000 0.632
#> GSM62322     3  0.0000      0.943 0.000 0.000 1.000 0.000 0.000
#> GSM62250     4  0.2020      0.870 0.100 0.000 0.000 0.900 0.000
#> GSM62252     1  0.1671      0.618 0.924 0.000 0.000 0.076 0.000
#> GSM62255     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62257     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62260     1  0.0794      0.685 0.972 0.000 0.000 0.000 0.028
#> GSM62261     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62262     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62264     1  0.4088      0.673 0.632 0.000 0.000 0.000 0.368
#> GSM62268     1  0.4238      0.670 0.628 0.000 0.004 0.000 0.368
#> GSM62269     3  0.0000      0.943 0.000 0.000 1.000 0.000 0.000
#> GSM62271     1  0.0000      0.707 1.000 0.000 0.000 0.000 0.000
#> GSM62272     3  0.0000      0.943 0.000 0.000 1.000 0.000 0.000
#> GSM62273     2  0.0162      0.909 0.000 0.996 0.000 0.004 0.000
#> GSM62274     3  0.5670      0.472 0.176 0.000 0.632 0.000 0.192
#> GSM62275     3  0.0000      0.943 0.000 0.000 1.000 0.000 0.000
#> GSM62276     1  0.0000      0.707 1.000 0.000 0.000 0.000 0.000
#> GSM62277     3  0.0000      0.943 0.000 0.000 1.000 0.000 0.000
#> GSM62279     1  0.3039      0.694 0.808 0.000 0.000 0.000 0.192
#> GSM62282     5  0.4800      0.694 0.368 0.000 0.028 0.000 0.604
#> GSM62283     1  0.0000      0.707 1.000 0.000 0.000 0.000 0.000
#> GSM62286     4  0.0404      0.967 0.000 0.012 0.000 0.988 0.000
#> GSM62287     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62288     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62290     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62293     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62301     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62302     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62303     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62304     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62312     4  0.0290      0.971 0.000 0.008 0.000 0.992 0.000
#> GSM62313     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62314     4  0.0000      0.978 0.000 0.000 0.000 1.000 0.000
#> GSM62319     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62320     4  0.4045      0.437 0.000 0.356 0.000 0.644 0.000
#> GSM62249     1  0.2852      0.565 0.828 0.172 0.000 0.000 0.000
#> GSM62251     1  0.4088      0.673 0.632 0.000 0.000 0.000 0.368
#> GSM62263     2  0.0794      0.886 0.028 0.972 0.000 0.000 0.000
#> GSM62285     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62265     1  0.2891      0.697 0.824 0.000 0.000 0.000 0.176
#> GSM62266     1  0.4088      0.673 0.632 0.000 0.000 0.000 0.368
#> GSM62296     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62309     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62295     2  0.3730      0.474 0.000 0.712 0.000 0.288 0.000
#> GSM62300     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000
#> GSM62308     2  0.0000      0.913 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     4  0.2793     0.8404 0.000 0.000 0.000 0.800 0.200 0.000
#> GSM62256     4  0.2416     0.8692 0.000 0.000 0.000 0.844 0.156 0.000
#> GSM62259     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62267     5  0.2883     0.7167 0.212 0.000 0.000 0.000 0.788 0.000
#> GSM62280     6  0.0000     0.8441 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62284     1  0.2697     0.6959 0.812 0.000 0.188 0.000 0.000 0.000
#> GSM62289     4  0.2883     0.8306 0.000 0.000 0.000 0.788 0.212 0.000
#> GSM62307     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62316     4  0.2416     0.8692 0.000 0.000 0.000 0.844 0.156 0.000
#> GSM62254     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62292     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62253     1  0.0000     0.9423 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62270     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62297     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62298     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62299     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62258     5  0.2793     0.7175 0.200 0.000 0.000 0.000 0.800 0.000
#> GSM62281     4  0.3210     0.8517 0.000 0.036 0.000 0.812 0.152 0.000
#> GSM62294     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62305     5  0.0790     0.6143 0.000 0.032 0.000 0.000 0.968 0.000
#> GSM62306     4  0.2562     0.8607 0.000 0.000 0.000 0.828 0.172 0.000
#> GSM62310     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62311     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     6  0.1610     0.7845 0.000 0.084 0.000 0.000 0.000 0.916
#> GSM62318     6  0.0000     0.8441 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62321     6  0.0000     0.8441 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.2762     0.4063 0.000 0.000 0.000 0.196 0.804 0.000
#> GSM62252     5  0.0000     0.6225 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM62255     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62257     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62260     6  0.5488     0.2599 0.216 0.000 0.000 0.000 0.216 0.568
#> GSM62261     4  0.2219     0.8789 0.000 0.000 0.000 0.864 0.136 0.000
#> GSM62262     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62264     1  0.0000     0.9423 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62268     1  0.0000     0.9423 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62269     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     5  0.2912     0.7146 0.216 0.000 0.000 0.000 0.784 0.000
#> GSM62272     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62274     5  0.5419     0.0824 0.116 0.000 0.424 0.000 0.460 0.000
#> GSM62275     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     5  0.2883     0.7167 0.212 0.000 0.000 0.000 0.788 0.000
#> GSM62277     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62279     5  0.3101     0.6943 0.244 0.000 0.000 0.000 0.756 0.000
#> GSM62282     5  0.3817     0.2125 0.000 0.000 0.000 0.000 0.568 0.432
#> GSM62283     5  0.2883     0.7167 0.212 0.000 0.000 0.000 0.788 0.000
#> GSM62286     4  0.3133     0.8250 0.000 0.008 0.000 0.780 0.212 0.000
#> GSM62287     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62288     4  0.2416     0.8692 0.000 0.000 0.000 0.844 0.156 0.000
#> GSM62290     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62293     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62301     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62302     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62303     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62304     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62312     4  0.0146     0.9204 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM62313     4  0.0000     0.9221 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62314     4  0.2135     0.8822 0.000 0.000 0.000 0.872 0.128 0.000
#> GSM62319     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62320     4  0.3634     0.4575 0.000 0.356 0.000 0.644 0.000 0.000
#> GSM62249     5  0.6002     0.2744 0.236 0.368 0.000 0.000 0.396 0.000
#> GSM62251     1  0.0000     0.9423 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62263     2  0.0632     0.9471 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM62285     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62291     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62265     1  0.1075     0.8931 0.952 0.000 0.000 0.000 0.048 0.000
#> GSM62266     1  0.0000     0.9423 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62296     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62309     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62295     2  0.3351     0.5471 0.000 0.712 0.000 0.288 0.000 0.000
#> GSM62300     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62308     2  0.0000     0.9721 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-pam-collect-classes

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

test_to_known_factors(res)
#>          n disease.state(p) other(p) genotype/variation(p) k
#> MAD:pam 74         1.00e+00    0.964                0.6606 2
#> MAD:pam 32         4.23e-02    0.653                0.3681 3
#> MAD:pam 73         1.05e-04    0.524                0.0692 4
#> MAD:pam 68         1.89e-04    0.864                0.1062 5
#> MAD:pam 69         1.72e-05    0.318                0.2467 6

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


MAD:mclust**

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.993       0.997         0.4661 0.533   0.533
#> 3 3 0.542           0.658       0.767         0.2682 0.930   0.871
#> 4 4 0.682           0.829       0.895         0.1163 0.792   0.589
#> 5 5 0.709           0.793       0.815         0.1354 0.827   0.517
#> 6 6 0.715           0.803       0.856         0.0667 0.947   0.763

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
#> GSM62248     2  0.0376      0.997 0.004 0.996
#> GSM62256     2  0.0000      0.999 0.000 1.000
#> GSM62259     2  0.0000      0.999 0.000 1.000
#> GSM62267     1  0.0000      0.992 1.000 0.000
#> GSM62280     1  0.0000      0.992 1.000 0.000
#> GSM62284     1  0.0000      0.992 1.000 0.000
#> GSM62289     2  0.0376      0.997 0.004 0.996
#> GSM62307     2  0.0000      0.999 0.000 1.000
#> GSM62316     2  0.0000      0.999 0.000 1.000
#> GSM62254     2  0.0000      0.999 0.000 1.000
#> GSM62292     2  0.0000      0.999 0.000 1.000
#> GSM62253     1  0.0000      0.992 1.000 0.000
#> GSM62270     1  0.0000      0.992 1.000 0.000
#> GSM62278     1  0.0000      0.992 1.000 0.000
#> GSM62297     2  0.0000      0.999 0.000 1.000
#> GSM62298     2  0.0000      0.999 0.000 1.000
#> GSM62299     2  0.0000      0.999 0.000 1.000
#> GSM62258     1  0.0000      0.992 1.000 0.000
#> GSM62281     2  0.0000      0.999 0.000 1.000
#> GSM62294     2  0.0000      0.999 0.000 1.000
#> GSM62305     2  0.0376      0.997 0.004 0.996
#> GSM62306     2  0.0000      0.999 0.000 1.000
#> GSM62310     2  0.0000      0.999 0.000 1.000
#> GSM62311     2  0.0000      0.999 0.000 1.000
#> GSM62317     2  0.0000      0.999 0.000 1.000
#> GSM62318     1  0.0000      0.992 1.000 0.000
#> GSM62321     1  0.0000      0.992 1.000 0.000
#> GSM62322     1  0.0000      0.992 1.000 0.000
#> GSM62250     2  0.0376      0.997 0.004 0.996
#> GSM62252     2  0.0376      0.997 0.004 0.996
#> GSM62255     2  0.0000      0.999 0.000 1.000
#> GSM62257     2  0.0000      0.999 0.000 1.000
#> GSM62260     1  0.0000      0.992 1.000 0.000
#> GSM62261     2  0.0000      0.999 0.000 1.000
#> GSM62262     2  0.0000      0.999 0.000 1.000
#> GSM62264     1  0.0000      0.992 1.000 0.000
#> GSM62268     1  0.0000      0.992 1.000 0.000
#> GSM62269     1  0.0000      0.992 1.000 0.000
#> GSM62271     1  0.0000      0.992 1.000 0.000
#> GSM62272     1  0.0000      0.992 1.000 0.000
#> GSM62273     2  0.0000      0.999 0.000 1.000
#> GSM62274     1  0.0000      0.992 1.000 0.000
#> GSM62275     1  0.0000      0.992 1.000 0.000
#> GSM62276     1  0.0000      0.992 1.000 0.000
#> GSM62277     1  0.0000      0.992 1.000 0.000
#> GSM62279     1  0.0000      0.992 1.000 0.000
#> GSM62282     1  0.0000      0.992 1.000 0.000
#> GSM62283     1  0.0000      0.992 1.000 0.000
#> GSM62286     2  0.0376      0.997 0.004 0.996
#> GSM62287     2  0.0000      0.999 0.000 1.000
#> GSM62288     2  0.0000      0.999 0.000 1.000
#> GSM62290     2  0.0000      0.999 0.000 1.000
#> GSM62293     2  0.0000      0.999 0.000 1.000
#> GSM62301     2  0.0000      0.999 0.000 1.000
#> GSM62302     2  0.0000      0.999 0.000 1.000
#> GSM62303     2  0.0000      0.999 0.000 1.000
#> GSM62304     2  0.0000      0.999 0.000 1.000
#> GSM62312     2  0.0000      0.999 0.000 1.000
#> GSM62313     2  0.0000      0.999 0.000 1.000
#> GSM62314     2  0.0000      0.999 0.000 1.000
#> GSM62319     2  0.0376      0.997 0.004 0.996
#> GSM62320     2  0.0000      0.999 0.000 1.000
#> GSM62249     1  0.7299      0.743 0.796 0.204
#> GSM62251     1  0.0000      0.992 1.000 0.000
#> GSM62263     2  0.0376      0.997 0.004 0.996
#> GSM62285     2  0.0000      0.999 0.000 1.000
#> GSM62315     2  0.0000      0.999 0.000 1.000
#> GSM62291     2  0.0000      0.999 0.000 1.000
#> GSM62265     1  0.0000      0.992 1.000 0.000
#> GSM62266     1  0.0000      0.992 1.000 0.000
#> GSM62296     2  0.0000      0.999 0.000 1.000
#> GSM62309     2  0.0000      0.999 0.000 1.000
#> GSM62295     2  0.0000      0.999 0.000 1.000
#> GSM62300     2  0.0000      0.999 0.000 1.000
#> GSM62308     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
#> GSM62248     2  0.6228      0.610 0.316 0.672 0.012
#> GSM62256     2  0.3967      0.796 0.044 0.884 0.072
#> GSM62259     2  0.0000      0.813 0.000 1.000 0.000
#> GSM62267     1  0.0000      0.636 1.000 0.000 0.000
#> GSM62280     1  0.5678      0.188 0.684 0.000 0.316
#> GSM62284     1  0.3816      0.576 0.852 0.000 0.148
#> GSM62289     2  0.6228      0.610 0.316 0.672 0.012
#> GSM62307     2  0.1753      0.812 0.000 0.952 0.048
#> GSM62316     2  0.5884      0.655 0.272 0.716 0.012
#> GSM62254     2  0.4887      0.760 0.000 0.772 0.228
#> GSM62292     2  0.4750      0.766 0.000 0.784 0.216
#> GSM62253     1  0.2625      0.638 0.916 0.000 0.084
#> GSM62270     3  0.5905      0.996 0.352 0.000 0.648
#> GSM62278     3  0.5948      0.982 0.360 0.000 0.640
#> GSM62297     2  0.6228      0.610 0.316 0.672 0.012
#> GSM62298     2  0.0237      0.813 0.000 0.996 0.004
#> GSM62299     2  0.0848      0.813 0.008 0.984 0.008
#> GSM62258     1  0.0000      0.636 1.000 0.000 0.000
#> GSM62281     2  0.2261      0.805 0.000 0.932 0.068
#> GSM62294     2  0.5098      0.747 0.000 0.752 0.248
#> GSM62305     2  0.6228      0.610 0.316 0.672 0.012
#> GSM62306     2  0.6172      0.619 0.308 0.680 0.012
#> GSM62310     2  0.4750      0.764 0.000 0.784 0.216
#> GSM62311     2  0.5098      0.747 0.000 0.752 0.248
#> GSM62317     2  0.2356      0.792 0.072 0.928 0.000
#> GSM62318     1  0.5678      0.188 0.684 0.000 0.316
#> GSM62321     1  0.5678      0.188 0.684 0.000 0.316
#> GSM62322     3  0.5905      0.996 0.352 0.000 0.648
#> GSM62250     2  0.6282      0.602 0.324 0.664 0.012
#> GSM62252     2  0.6688      0.455 0.408 0.580 0.012
#> GSM62255     2  0.4452      0.775 0.000 0.808 0.192
#> GSM62257     2  0.5239      0.789 0.032 0.808 0.160
#> GSM62260     1  0.4702      0.468 0.788 0.000 0.212
#> GSM62261     2  0.6228      0.610 0.316 0.672 0.012
#> GSM62262     2  0.5098      0.747 0.000 0.752 0.248
#> GSM62264     1  0.3816      0.577 0.852 0.000 0.148
#> GSM62268     1  0.2625      0.638 0.916 0.000 0.084
#> GSM62269     3  0.5905      0.996 0.352 0.000 0.648
#> GSM62271     1  0.5621      0.216 0.692 0.000 0.308
#> GSM62272     3  0.5905      0.996 0.352 0.000 0.648
#> GSM62273     2  0.0424      0.813 0.008 0.992 0.000
#> GSM62274     1  0.5254      0.370 0.736 0.000 0.264
#> GSM62275     3  0.5905      0.996 0.352 0.000 0.648
#> GSM62276     1  0.0000      0.636 1.000 0.000 0.000
#> GSM62277     1  0.6308     -0.588 0.508 0.000 0.492
#> GSM62279     1  0.0000      0.636 1.000 0.000 0.000
#> GSM62282     1  0.6062     -0.120 0.616 0.000 0.384
#> GSM62283     1  0.0000      0.636 1.000 0.000 0.000
#> GSM62286     2  0.6228      0.610 0.316 0.672 0.012
#> GSM62287     2  0.5098      0.747 0.000 0.752 0.248
#> GSM62288     2  0.6228      0.610 0.316 0.672 0.012
#> GSM62290     2  0.0424      0.813 0.000 0.992 0.008
#> GSM62293     2  0.4887      0.760 0.000 0.772 0.228
#> GSM62301     2  0.0424      0.813 0.000 0.992 0.008
#> GSM62302     2  0.5098      0.747 0.000 0.752 0.248
#> GSM62303     2  0.5098      0.747 0.000 0.752 0.248
#> GSM62304     2  0.5016      0.752 0.000 0.760 0.240
#> GSM62312     2  0.0747      0.812 0.016 0.984 0.000
#> GSM62313     2  0.5098      0.747 0.000 0.752 0.248
#> GSM62314     2  0.5884      0.655 0.272 0.716 0.012
#> GSM62319     2  0.2356      0.792 0.072 0.928 0.000
#> GSM62320     2  0.0424      0.813 0.000 0.992 0.008
#> GSM62249     1  0.2448      0.531 0.924 0.076 0.000
#> GSM62251     1  0.0000      0.636 1.000 0.000 0.000
#> GSM62263     1  0.6308     -0.315 0.508 0.492 0.000
#> GSM62285     2  0.0424      0.813 0.000 0.992 0.008
#> GSM62315     2  0.2356      0.792 0.072 0.928 0.000
#> GSM62291     2  0.2356      0.803 0.000 0.928 0.072
#> GSM62265     1  0.2356      0.640 0.928 0.000 0.072
#> GSM62266     1  0.2625      0.638 0.916 0.000 0.084
#> GSM62296     2  0.2356      0.803 0.000 0.928 0.072
#> GSM62309     2  0.2496      0.794 0.068 0.928 0.004
#> GSM62295     2  0.3752      0.793 0.000 0.856 0.144
#> GSM62300     2  0.2356      0.803 0.000 0.928 0.072
#> GSM62308     2  0.2356      0.803 0.000 0.928 0.072

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     2  0.2156      0.872 0.008 0.928 0.060 0.004
#> GSM62256     2  0.1398      0.876 0.000 0.956 0.040 0.004
#> GSM62259     2  0.0921      0.873 0.000 0.972 0.000 0.028
#> GSM62267     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62280     1  0.1022      0.933 0.968 0.000 0.000 0.032
#> GSM62284     1  0.0336      0.940 0.992 0.000 0.008 0.000
#> GSM62289     2  0.2101      0.872 0.012 0.928 0.060 0.000
#> GSM62307     2  0.1716      0.849 0.000 0.936 0.000 0.064
#> GSM62316     2  0.1824      0.873 0.000 0.936 0.060 0.004
#> GSM62254     4  0.2149      0.689 0.000 0.088 0.000 0.912
#> GSM62292     4  0.2149      0.689 0.000 0.088 0.000 0.912
#> GSM62253     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62270     3  0.2469      0.990 0.108 0.000 0.892 0.000
#> GSM62278     1  0.4955      0.109 0.556 0.000 0.444 0.000
#> GSM62297     2  0.1890      0.875 0.008 0.936 0.056 0.000
#> GSM62298     2  0.1022      0.872 0.000 0.968 0.000 0.032
#> GSM62299     2  0.1118      0.878 0.000 0.964 0.000 0.036
#> GSM62258     1  0.0336      0.940 0.992 0.000 0.008 0.000
#> GSM62281     2  0.1398      0.876 0.000 0.956 0.040 0.004
#> GSM62294     4  0.3486      0.788 0.000 0.188 0.000 0.812
#> GSM62305     2  0.2101      0.872 0.012 0.928 0.060 0.000
#> GSM62306     2  0.2010      0.873 0.004 0.932 0.060 0.004
#> GSM62310     4  0.4855      0.705 0.000 0.400 0.000 0.600
#> GSM62311     4  0.4817      0.724 0.000 0.388 0.000 0.612
#> GSM62317     2  0.3071      0.835 0.068 0.888 0.000 0.044
#> GSM62318     1  0.1022      0.933 0.968 0.000 0.000 0.032
#> GSM62321     1  0.1724      0.918 0.948 0.020 0.000 0.032
#> GSM62322     3  0.2345      0.997 0.100 0.000 0.900 0.000
#> GSM62250     2  0.5905      0.391 0.304 0.636 0.060 0.000
#> GSM62252     1  0.4776      0.639 0.776 0.164 0.060 0.000
#> GSM62255     2  0.4941     -0.281 0.000 0.564 0.000 0.436
#> GSM62257     2  0.4072      0.491 0.000 0.748 0.000 0.252
#> GSM62260     1  0.0817      0.936 0.976 0.000 0.000 0.024
#> GSM62261     2  0.2156      0.872 0.008 0.928 0.060 0.004
#> GSM62262     4  0.3444      0.785 0.000 0.184 0.000 0.816
#> GSM62264     1  0.0592      0.938 0.984 0.000 0.000 0.016
#> GSM62268     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62269     3  0.2345      0.997 0.100 0.000 0.900 0.000
#> GSM62271     1  0.0672      0.939 0.984 0.000 0.008 0.008
#> GSM62272     3  0.2345      0.997 0.100 0.000 0.900 0.000
#> GSM62273     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM62274     1  0.0336      0.940 0.992 0.000 0.008 0.000
#> GSM62275     3  0.2345      0.997 0.100 0.000 0.900 0.000
#> GSM62276     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62277     1  0.2704      0.842 0.876 0.000 0.124 0.000
#> GSM62279     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62282     1  0.2546      0.873 0.900 0.000 0.092 0.008
#> GSM62283     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62286     2  0.2156      0.872 0.008 0.928 0.060 0.004
#> GSM62287     4  0.4382      0.819 0.000 0.296 0.000 0.704
#> GSM62288     2  0.2156      0.872 0.008 0.928 0.060 0.004
#> GSM62290     2  0.1118      0.878 0.000 0.964 0.000 0.036
#> GSM62293     4  0.2149      0.689 0.000 0.088 0.000 0.912
#> GSM62301     2  0.1118      0.878 0.000 0.964 0.000 0.036
#> GSM62302     4  0.4431      0.817 0.000 0.304 0.000 0.696
#> GSM62303     4  0.4431      0.817 0.000 0.304 0.000 0.696
#> GSM62304     4  0.4855      0.705 0.000 0.400 0.000 0.600
#> GSM62312     2  0.0336      0.881 0.000 0.992 0.000 0.008
#> GSM62313     4  0.4431      0.817 0.000 0.304 0.000 0.696
#> GSM62314     2  0.1824      0.873 0.000 0.936 0.060 0.004
#> GSM62319     2  0.1389      0.865 0.048 0.952 0.000 0.000
#> GSM62320     2  0.0000      0.880 0.000 1.000 0.000 0.000
#> GSM62249     1  0.1109      0.915 0.968 0.028 0.000 0.004
#> GSM62251     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62263     2  0.4040      0.611 0.248 0.752 0.000 0.000
#> GSM62285     2  0.1118      0.878 0.000 0.964 0.000 0.036
#> GSM62315     2  0.2319      0.856 0.040 0.924 0.000 0.036
#> GSM62291     2  0.2319      0.861 0.000 0.924 0.040 0.036
#> GSM62265     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62266     1  0.0000      0.942 1.000 0.000 0.000 0.000
#> GSM62296     2  0.2319      0.861 0.000 0.924 0.040 0.036
#> GSM62309     2  0.2319      0.856 0.040 0.924 0.000 0.036
#> GSM62295     4  0.4585      0.587 0.000 0.332 0.000 0.668
#> GSM62300     2  0.2319      0.861 0.000 0.924 0.040 0.036
#> GSM62308     2  0.2319      0.861 0.000 0.924 0.040 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
#> GSM62248     5  0.0510     0.8737 0.000 0.016 0.000 0.000 0.984
#> GSM62256     2  0.2074     0.8595 0.000 0.896 0.000 0.000 0.104
#> GSM62259     4  0.6219     0.7762 0.000 0.140 0.000 0.440 0.420
#> GSM62267     1  0.1121     0.8121 0.956 0.000 0.000 0.000 0.044
#> GSM62280     1  0.4746     0.6682 0.600 0.000 0.024 0.376 0.000
#> GSM62284     1  0.0290     0.8198 0.992 0.000 0.008 0.000 0.000
#> GSM62289     5  0.0510     0.8737 0.000 0.016 0.000 0.000 0.984
#> GSM62307     4  0.5483     0.9001 0.000 0.064 0.000 0.512 0.424
#> GSM62316     5  0.0671     0.8695 0.000 0.016 0.000 0.004 0.980
#> GSM62254     4  0.5139     0.8114 0.000 0.060 0.000 0.624 0.316
#> GSM62292     4  0.5139     0.8114 0.000 0.060 0.000 0.624 0.316
#> GSM62253     1  0.0290     0.8198 0.992 0.000 0.008 0.000 0.000
#> GSM62270     3  0.0963     0.8906 0.036 0.000 0.964 0.000 0.000
#> GSM62278     3  0.4268     0.0559 0.444 0.000 0.556 0.000 0.000
#> GSM62297     5  0.4227     0.1756 0.000 0.420 0.000 0.000 0.580
#> GSM62298     2  0.4158     0.7722 0.000 0.784 0.000 0.092 0.124
#> GSM62299     2  0.1908     0.8638 0.000 0.908 0.000 0.000 0.092
#> GSM62258     1  0.1195     0.8217 0.960 0.000 0.000 0.028 0.012
#> GSM62281     2  0.2329     0.8465 0.000 0.876 0.000 0.000 0.124
#> GSM62294     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62305     5  0.0510     0.8737 0.000 0.016 0.000 0.000 0.984
#> GSM62306     5  0.0510     0.8737 0.000 0.016 0.000 0.000 0.984
#> GSM62310     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62311     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62317     2  0.2540     0.8009 0.000 0.888 0.024 0.088 0.000
#> GSM62318     1  0.4380     0.6790 0.616 0.000 0.008 0.376 0.000
#> GSM62321     1  0.4746     0.6682 0.600 0.000 0.024 0.376 0.000
#> GSM62322     3  0.0794     0.8955 0.028 0.000 0.972 0.000 0.000
#> GSM62250     5  0.1117     0.8484 0.020 0.016 0.000 0.000 0.964
#> GSM62252     5  0.3663     0.5497 0.208 0.016 0.000 0.000 0.776
#> GSM62255     4  0.5329     0.9149 0.000 0.052 0.000 0.516 0.432
#> GSM62257     4  0.5334     0.9124 0.000 0.052 0.000 0.512 0.436
#> GSM62260     1  0.4380     0.6800 0.616 0.000 0.008 0.376 0.000
#> GSM62261     5  0.0510     0.8737 0.000 0.016 0.000 0.000 0.984
#> GSM62262     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62264     1  0.3039     0.7922 0.836 0.000 0.012 0.152 0.000
#> GSM62268     1  0.0290     0.8198 0.992 0.000 0.008 0.000 0.000
#> GSM62269     3  0.0794     0.8955 0.028 0.000 0.972 0.000 0.000
#> GSM62271     1  0.4925     0.6807 0.632 0.000 0.044 0.324 0.000
#> GSM62272     3  0.0794     0.8955 0.028 0.000 0.972 0.000 0.000
#> GSM62273     2  0.3992     0.7844 0.000 0.796 0.000 0.080 0.124
#> GSM62274     1  0.0000     0.8200 1.000 0.000 0.000 0.000 0.000
#> GSM62275     3  0.0794     0.8955 0.028 0.000 0.972 0.000 0.000
#> GSM62276     1  0.1121     0.8121 0.956 0.000 0.000 0.000 0.044
#> GSM62277     1  0.0510     0.8182 0.984 0.000 0.016 0.000 0.000
#> GSM62279     1  0.1121     0.8121 0.956 0.000 0.000 0.000 0.044
#> GSM62282     1  0.5172     0.6686 0.616 0.000 0.060 0.324 0.000
#> GSM62283     1  0.2020     0.8040 0.900 0.000 0.000 0.100 0.000
#> GSM62286     5  0.0510     0.8737 0.000 0.016 0.000 0.000 0.984
#> GSM62287     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62288     5  0.0510     0.8737 0.000 0.016 0.000 0.000 0.984
#> GSM62290     2  0.2074     0.8602 0.000 0.896 0.000 0.000 0.104
#> GSM62293     4  0.5139     0.8114 0.000 0.060 0.000 0.624 0.316
#> GSM62301     2  0.0880     0.8675 0.000 0.968 0.000 0.000 0.032
#> GSM62302     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62303     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62304     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62312     2  0.4278     0.1227 0.000 0.548 0.000 0.000 0.452
#> GSM62313     4  0.5220     0.9226 0.000 0.044 0.000 0.516 0.440
#> GSM62314     5  0.2293     0.7341 0.000 0.016 0.000 0.084 0.900
#> GSM62319     2  0.5211     0.6348 0.188 0.708 0.000 0.088 0.016
#> GSM62320     2  0.2612     0.8425 0.000 0.868 0.000 0.008 0.124
#> GSM62249     1  0.4268     0.5484 0.708 0.000 0.000 0.024 0.268
#> GSM62251     1  0.0579     0.8211 0.984 0.000 0.008 0.008 0.000
#> GSM62263     1  0.7116     0.4726 0.572 0.136 0.004 0.084 0.204
#> GSM62285     2  0.0404     0.8566 0.000 0.988 0.000 0.000 0.012
#> GSM62315     2  0.2011     0.8119 0.000 0.908 0.004 0.088 0.000
#> GSM62291     2  0.0703     0.8639 0.000 0.976 0.000 0.000 0.024
#> GSM62265     1  0.0000     0.8200 1.000 0.000 0.000 0.000 0.000
#> GSM62266     1  0.0290     0.8198 0.992 0.000 0.008 0.000 0.000
#> GSM62296     2  0.1121     0.8692 0.000 0.956 0.000 0.000 0.044
#> GSM62309     2  0.2407     0.8221 0.000 0.896 0.004 0.088 0.012
#> GSM62295     4  0.5642     0.7051 0.000 0.136 0.000 0.624 0.240
#> GSM62300     2  0.0880     0.8673 0.000 0.968 0.000 0.000 0.032
#> GSM62308     2  0.0510     0.8594 0.000 0.984 0.000 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5  0.3419      0.844 0.000 0.084 0.000 0.104 0.812 0.000
#> GSM62256     2  0.0146      0.896 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM62259     4  0.2980      0.835 0.000 0.180 0.000 0.808 0.012 0.000
#> GSM62267     1  0.0260      0.794 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM62280     6  0.0146      0.906 0.000 0.000 0.004 0.000 0.000 0.996
#> GSM62284     1  0.2278      0.769 0.868 0.000 0.128 0.000 0.000 0.004
#> GSM62289     5  0.3716      0.843 0.012 0.080 0.000 0.092 0.812 0.004
#> GSM62307     4  0.2553      0.874 0.000 0.144 0.000 0.848 0.008 0.000
#> GSM62316     5  0.3552      0.835 0.000 0.084 0.000 0.116 0.800 0.000
#> GSM62254     4  0.1007      0.799 0.000 0.000 0.000 0.956 0.044 0.000
#> GSM62292     4  0.1007      0.799 0.000 0.000 0.000 0.956 0.044 0.000
#> GSM62253     1  0.3586      0.781 0.796 0.000 0.000 0.000 0.080 0.124
#> GSM62270     3  0.0000      0.977 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.1908      0.880 0.096 0.000 0.900 0.000 0.000 0.004
#> GSM62297     5  0.5066      0.599 0.000 0.304 0.000 0.104 0.592 0.000
#> GSM62298     2  0.2048      0.839 0.000 0.880 0.000 0.120 0.000 0.000
#> GSM62299     2  0.1007      0.901 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM62258     1  0.0260      0.794 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM62281     2  0.0790      0.901 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM62294     4  0.1556      0.889 0.000 0.080 0.000 0.920 0.000 0.000
#> GSM62305     5  0.3419      0.844 0.000 0.084 0.000 0.104 0.812 0.000
#> GSM62306     5  0.3419      0.844 0.000 0.084 0.000 0.104 0.812 0.000
#> GSM62310     4  0.2962      0.904 0.000 0.084 0.000 0.848 0.068 0.000
#> GSM62311     4  0.2965      0.906 0.000 0.080 0.000 0.848 0.072 0.000
#> GSM62317     2  0.2883      0.713 0.000 0.788 0.000 0.000 0.000 0.212
#> GSM62318     6  0.0146      0.906 0.000 0.000 0.004 0.000 0.000 0.996
#> GSM62321     6  0.0000      0.905 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000      0.977 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.3969      0.824 0.012 0.072 0.000 0.072 0.812 0.032
#> GSM62252     5  0.4131      0.673 0.044 0.000 0.000 0.048 0.780 0.128
#> GSM62255     4  0.2948      0.903 0.000 0.092 0.000 0.848 0.060 0.000
#> GSM62257     4  0.2962      0.904 0.000 0.084 0.000 0.848 0.068 0.000
#> GSM62260     6  0.1007      0.887 0.044 0.000 0.000 0.000 0.000 0.956
#> GSM62261     5  0.3277      0.844 0.000 0.084 0.000 0.092 0.824 0.000
#> GSM62262     4  0.1556      0.889 0.000 0.080 0.000 0.920 0.000 0.000
#> GSM62264     1  0.4704      0.268 0.488 0.000 0.000 0.000 0.044 0.468
#> GSM62268     1  0.3586      0.781 0.796 0.000 0.000 0.000 0.080 0.124
#> GSM62269     3  0.0000      0.977 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     6  0.3081      0.719 0.220 0.000 0.000 0.000 0.004 0.776
#> GSM62272     3  0.0000      0.977 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2  0.1219      0.899 0.000 0.948 0.000 0.048 0.000 0.004
#> GSM62274     1  0.2668      0.743 0.828 0.000 0.168 0.000 0.000 0.004
#> GSM62275     3  0.0000      0.977 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     1  0.0260      0.794 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM62277     1  0.3699      0.518 0.660 0.000 0.336 0.000 0.000 0.004
#> GSM62279     1  0.0260      0.794 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM62282     6  0.2261      0.839 0.104 0.000 0.008 0.000 0.004 0.884
#> GSM62283     1  0.4301      0.462 0.584 0.000 0.000 0.000 0.024 0.392
#> GSM62286     5  0.3419      0.844 0.000 0.084 0.000 0.104 0.812 0.000
#> GSM62287     4  0.2965      0.906 0.000 0.080 0.000 0.848 0.072 0.000
#> GSM62288     5  0.3277      0.844 0.000 0.084 0.000 0.092 0.824 0.000
#> GSM62290     2  0.1007      0.901 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM62293     4  0.1007      0.799 0.000 0.000 0.000 0.956 0.044 0.000
#> GSM62301     2  0.1007      0.901 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM62302     4  0.2965      0.906 0.000 0.080 0.000 0.848 0.072 0.000
#> GSM62303     4  0.2965      0.906 0.000 0.080 0.000 0.848 0.072 0.000
#> GSM62304     4  0.2965      0.906 0.000 0.080 0.000 0.848 0.072 0.000
#> GSM62312     2  0.4660      0.104 0.000 0.540 0.000 0.416 0.044 0.000
#> GSM62313     4  0.2965      0.906 0.000 0.080 0.000 0.848 0.072 0.000
#> GSM62314     5  0.4982      0.472 0.000 0.084 0.000 0.340 0.576 0.000
#> GSM62319     2  0.3052      0.705 0.000 0.780 0.000 0.004 0.000 0.216
#> GSM62320     2  0.1007      0.901 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM62249     5  0.4788      0.206 0.060 0.000 0.000 0.000 0.568 0.372
#> GSM62251     1  0.3175      0.706 0.744 0.000 0.000 0.000 0.000 0.256
#> GSM62263     5  0.5633      0.359 0.044 0.084 0.000 0.000 0.596 0.276
#> GSM62285     2  0.1007      0.901 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM62315     2  0.2647      0.861 0.000 0.868 0.000 0.044 0.000 0.088
#> GSM62291     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62265     1  0.2378      0.777 0.848 0.000 0.000 0.000 0.000 0.152
#> GSM62266     1  0.3586      0.781 0.796 0.000 0.000 0.000 0.080 0.124
#> GSM62296     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62309     2  0.2647      0.861 0.000 0.868 0.000 0.044 0.000 0.088
#> GSM62295     4  0.1152      0.797 0.000 0.004 0.000 0.952 0.044 0.000
#> GSM62300     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62308     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-mclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) other(p) genotype/variation(p) k
#> MAD:mclust 75           0.9089    1.000                 0.811 2
#> MAD:mclust 65           0.2590    0.758                 0.553 3
#> MAD:mclust 71           0.3525    0.503                 0.212 4
#> MAD:mclust 71           0.0179    0.847                 0.395 5
#> MAD:mclust 69           0.0129    0.929                 0.539 6

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


MAD:NMF**

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.974       0.990         0.4567 0.550   0.550
#> 3 3 0.748           0.763       0.897         0.2900 0.847   0.730
#> 4 4 0.666           0.717       0.865         0.1501 0.829   0.634
#> 5 5 0.681           0.524       0.769         0.1111 0.801   0.495
#> 6 6 0.751           0.737       0.880         0.0761 0.814   0.405

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
#> GSM62248     2  0.0000      0.985 0.000 1.000
#> GSM62256     2  0.0000      0.985 0.000 1.000
#> GSM62259     2  0.0000      0.985 0.000 1.000
#> GSM62267     1  0.0000      0.998 1.000 0.000
#> GSM62280     1  0.0000      0.998 1.000 0.000
#> GSM62284     1  0.0000      0.998 1.000 0.000
#> GSM62289     2  0.0000      0.985 0.000 1.000
#> GSM62307     2  0.0000      0.985 0.000 1.000
#> GSM62316     2  0.0000      0.985 0.000 1.000
#> GSM62254     2  0.0000      0.985 0.000 1.000
#> GSM62292     2  0.0000      0.985 0.000 1.000
#> GSM62253     1  0.0000      0.998 1.000 0.000
#> GSM62270     1  0.0000      0.998 1.000 0.000
#> GSM62278     1  0.0000      0.998 1.000 0.000
#> GSM62297     2  0.0000      0.985 0.000 1.000
#> GSM62298     2  0.0000      0.985 0.000 1.000
#> GSM62299     2  0.0000      0.985 0.000 1.000
#> GSM62258     1  0.0000      0.998 1.000 0.000
#> GSM62281     2  0.0000      0.985 0.000 1.000
#> GSM62294     2  0.0000      0.985 0.000 1.000
#> GSM62305     2  0.0000      0.985 0.000 1.000
#> GSM62306     2  0.0000      0.985 0.000 1.000
#> GSM62310     2  0.0000      0.985 0.000 1.000
#> GSM62311     2  0.0000      0.985 0.000 1.000
#> GSM62317     2  0.0000      0.985 0.000 1.000
#> GSM62318     1  0.0000      0.998 1.000 0.000
#> GSM62321     2  0.9775      0.311 0.412 0.588
#> GSM62322     1  0.0000      0.998 1.000 0.000
#> GSM62250     2  0.0000      0.985 0.000 1.000
#> GSM62252     2  0.0000      0.985 0.000 1.000
#> GSM62255     2  0.0000      0.985 0.000 1.000
#> GSM62257     2  0.0000      0.985 0.000 1.000
#> GSM62260     1  0.2236      0.962 0.964 0.036
#> GSM62261     2  0.0000      0.985 0.000 1.000
#> GSM62262     2  0.0000      0.985 0.000 1.000
#> GSM62264     1  0.0000      0.998 1.000 0.000
#> GSM62268     1  0.0000      0.998 1.000 0.000
#> GSM62269     1  0.0000      0.998 1.000 0.000
#> GSM62271     1  0.0000      0.998 1.000 0.000
#> GSM62272     1  0.0000      0.998 1.000 0.000
#> GSM62273     2  0.0000      0.985 0.000 1.000
#> GSM62274     1  0.0000      0.998 1.000 0.000
#> GSM62275     1  0.0000      0.998 1.000 0.000
#> GSM62276     1  0.0000      0.998 1.000 0.000
#> GSM62277     1  0.0000      0.998 1.000 0.000
#> GSM62279     1  0.0000      0.998 1.000 0.000
#> GSM62282     1  0.0000      0.998 1.000 0.000
#> GSM62283     1  0.0000      0.998 1.000 0.000
#> GSM62286     2  0.0000      0.985 0.000 1.000
#> GSM62287     2  0.0000      0.985 0.000 1.000
#> GSM62288     2  0.0000      0.985 0.000 1.000
#> GSM62290     2  0.0000      0.985 0.000 1.000
#> GSM62293     2  0.0000      0.985 0.000 1.000
#> GSM62301     2  0.0000      0.985 0.000 1.000
#> GSM62302     2  0.0000      0.985 0.000 1.000
#> GSM62303     2  0.0000      0.985 0.000 1.000
#> GSM62304     2  0.0000      0.985 0.000 1.000
#> GSM62312     2  0.0000      0.985 0.000 1.000
#> GSM62313     2  0.0000      0.985 0.000 1.000
#> GSM62314     2  0.0000      0.985 0.000 1.000
#> GSM62319     2  0.0000      0.985 0.000 1.000
#> GSM62320     2  0.0000      0.985 0.000 1.000
#> GSM62249     2  0.9000      0.542 0.316 0.684
#> GSM62251     1  0.0000      0.998 1.000 0.000
#> GSM62263     2  0.0376      0.981 0.004 0.996
#> GSM62285     2  0.0000      0.985 0.000 1.000
#> GSM62315     2  0.0000      0.985 0.000 1.000
#> GSM62291     2  0.0000      0.985 0.000 1.000
#> GSM62265     1  0.0000      0.998 1.000 0.000
#> GSM62266     1  0.0000      0.998 1.000 0.000
#> GSM62296     2  0.0000      0.985 0.000 1.000
#> GSM62309     2  0.0000      0.985 0.000 1.000
#> GSM62295     2  0.0000      0.985 0.000 1.000
#> GSM62300     2  0.0000      0.985 0.000 1.000
#> GSM62308     2  0.0000      0.985 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
#> GSM62248     2  0.2448      0.834 0.076 0.924 0.000
#> GSM62256     2  0.0424      0.900 0.008 0.992 0.000
#> GSM62259     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62267     3  0.0237      0.940 0.000 0.004 0.996
#> GSM62280     1  0.4235      0.575 0.824 0.000 0.176
#> GSM62284     3  0.5621      0.500 0.308 0.000 0.692
#> GSM62289     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62307     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62316     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62254     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62292     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62253     1  0.6154      0.288 0.592 0.000 0.408
#> GSM62270     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62278     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62297     2  0.5397      0.677 0.280 0.720 0.000
#> GSM62298     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62299     2  0.4931      0.725 0.232 0.768 0.000
#> GSM62258     3  0.0747      0.931 0.016 0.000 0.984
#> GSM62281     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62294     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62305     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62306     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62310     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62311     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62317     1  0.5905      0.178 0.648 0.352 0.000
#> GSM62318     1  0.0237      0.684 0.996 0.000 0.004
#> GSM62321     1  0.0000      0.684 1.000 0.000 0.000
#> GSM62322     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62250     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62252     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62255     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62257     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62260     1  0.0237      0.684 0.996 0.000 0.004
#> GSM62261     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62262     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62264     1  0.3879      0.615 0.848 0.000 0.152
#> GSM62268     1  0.6252      0.192 0.556 0.000 0.444
#> GSM62269     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62271     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62272     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62273     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62274     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62275     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62276     3  0.0237      0.940 0.000 0.004 0.996
#> GSM62277     3  0.0000      0.944 0.000 0.000 1.000
#> GSM62279     3  0.5722      0.533 0.292 0.004 0.704
#> GSM62282     3  0.0237      0.940 0.004 0.000 0.996
#> GSM62283     1  0.1529      0.677 0.960 0.000 0.040
#> GSM62286     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62287     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62288     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62290     2  0.5706      0.630 0.320 0.680 0.000
#> GSM62293     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62301     2  0.6111      0.509 0.396 0.604 0.000
#> GSM62302     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62312     2  0.2165      0.865 0.064 0.936 0.000
#> GSM62313     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62314     2  0.0000      0.902 0.000 1.000 0.000
#> GSM62319     2  0.5835      0.604 0.340 0.660 0.000
#> GSM62320     2  0.0424      0.900 0.008 0.992 0.000
#> GSM62249     1  0.0000      0.684 1.000 0.000 0.000
#> GSM62251     1  0.5882      0.403 0.652 0.000 0.348
#> GSM62263     1  0.0000      0.684 1.000 0.000 0.000
#> GSM62285     2  0.5760      0.620 0.328 0.672 0.000
#> GSM62315     2  0.6204      0.451 0.424 0.576 0.000
#> GSM62291     2  0.5835      0.604 0.340 0.660 0.000
#> GSM62265     1  0.5926      0.391 0.644 0.000 0.356
#> GSM62266     1  0.6140      0.297 0.596 0.000 0.404
#> GSM62296     2  0.5859      0.598 0.344 0.656 0.000
#> GSM62309     1  0.6295     -0.230 0.528 0.472 0.000
#> GSM62295     2  0.0237      0.901 0.004 0.996 0.000
#> GSM62300     2  0.5882      0.592 0.348 0.652 0.000
#> GSM62308     2  0.5926      0.579 0.356 0.644 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     2  0.4522     0.5637 0.320 0.680 0.000 0.000
#> GSM62256     2  0.4511     0.5786 0.008 0.724 0.000 0.268
#> GSM62259     2  0.0469     0.8681 0.000 0.988 0.000 0.012
#> GSM62267     1  0.3581     0.6556 0.852 0.032 0.116 0.000
#> GSM62280     4  0.0592     0.7347 0.000 0.000 0.016 0.984
#> GSM62284     1  0.4008     0.6224 0.756 0.000 0.244 0.000
#> GSM62289     1  0.4477     0.4649 0.688 0.312 0.000 0.000
#> GSM62307     2  0.0469     0.8681 0.000 0.988 0.000 0.012
#> GSM62316     2  0.2530     0.8058 0.112 0.888 0.000 0.000
#> GSM62254     2  0.0188     0.8690 0.000 0.996 0.000 0.004
#> GSM62292     2  0.0000     0.8687 0.000 1.000 0.000 0.000
#> GSM62253     1  0.3370     0.7302 0.872 0.000 0.080 0.048
#> GSM62270     3  0.0000     0.9267 0.000 0.000 1.000 0.000
#> GSM62278     3  0.0000     0.9267 0.000 0.000 1.000 0.000
#> GSM62297     2  0.4907     0.6893 0.060 0.764 0.000 0.176
#> GSM62298     2  0.1629     0.8534 0.024 0.952 0.000 0.024
#> GSM62299     2  0.3812     0.7528 0.028 0.832 0.000 0.140
#> GSM62258     3  0.4585     0.5547 0.332 0.000 0.668 0.000
#> GSM62281     2  0.0707     0.8658 0.000 0.980 0.000 0.020
#> GSM62294     2  0.0336     0.8687 0.000 0.992 0.000 0.008
#> GSM62305     2  0.3649     0.7426 0.204 0.796 0.000 0.000
#> GSM62306     2  0.1118     0.8546 0.036 0.964 0.000 0.000
#> GSM62310     2  0.0336     0.8687 0.000 0.992 0.000 0.008
#> GSM62311     2  0.0188     0.8690 0.000 0.996 0.000 0.004
#> GSM62317     4  0.0188     0.7426 0.000 0.004 0.000 0.996
#> GSM62318     4  0.0895     0.7287 0.004 0.000 0.020 0.976
#> GSM62321     4  0.0376     0.7389 0.004 0.000 0.004 0.992
#> GSM62322     3  0.0000     0.9267 0.000 0.000 1.000 0.000
#> GSM62250     1  0.4730     0.3573 0.636 0.364 0.000 0.000
#> GSM62252     1  0.4866     0.2633 0.596 0.404 0.000 0.000
#> GSM62255     2  0.0469     0.8681 0.000 0.988 0.000 0.012
#> GSM62257     2  0.0592     0.8638 0.016 0.984 0.000 0.000
#> GSM62260     4  0.2179     0.6967 0.064 0.000 0.012 0.924
#> GSM62261     2  0.2868     0.7862 0.136 0.864 0.000 0.000
#> GSM62262     2  0.0336     0.8687 0.000 0.992 0.000 0.008
#> GSM62264     1  0.4182     0.7244 0.796 0.000 0.024 0.180
#> GSM62268     1  0.3668     0.6711 0.808 0.000 0.188 0.004
#> GSM62269     3  0.0000     0.9267 0.000 0.000 1.000 0.000
#> GSM62271     3  0.0804     0.9162 0.012 0.000 0.980 0.008
#> GSM62272     3  0.0000     0.9267 0.000 0.000 1.000 0.000
#> GSM62273     2  0.1302     0.8559 0.000 0.956 0.000 0.044
#> GSM62274     1  0.4790     0.4242 0.620 0.000 0.380 0.000
#> GSM62275     3  0.0000     0.9267 0.000 0.000 1.000 0.000
#> GSM62276     3  0.4718     0.6342 0.280 0.012 0.708 0.000
#> GSM62277     3  0.0336     0.9227 0.008 0.000 0.992 0.000
#> GSM62279     1  0.1510     0.7042 0.956 0.016 0.028 0.000
#> GSM62282     3  0.0921     0.9059 0.000 0.000 0.972 0.028
#> GSM62283     1  0.5727     0.6776 0.704 0.000 0.096 0.200
#> GSM62286     2  0.3074     0.7738 0.152 0.848 0.000 0.000
#> GSM62287     2  0.0188     0.8676 0.004 0.996 0.000 0.000
#> GSM62288     2  0.3074     0.7730 0.152 0.848 0.000 0.000
#> GSM62290     2  0.3581     0.7739 0.032 0.852 0.000 0.116
#> GSM62293     2  0.0188     0.8690 0.000 0.996 0.000 0.004
#> GSM62301     4  0.5530     0.4643 0.032 0.336 0.000 0.632
#> GSM62302     2  0.0000     0.8687 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000     0.8687 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000     0.8687 0.000 1.000 0.000 0.000
#> GSM62312     2  0.2021     0.8463 0.024 0.936 0.000 0.040
#> GSM62313     2  0.0000     0.8687 0.000 1.000 0.000 0.000
#> GSM62314     2  0.2281     0.8177 0.096 0.904 0.000 0.000
#> GSM62319     2  0.5693    -0.0819 0.024 0.504 0.000 0.472
#> GSM62320     2  0.1929     0.8466 0.024 0.940 0.000 0.036
#> GSM62249     1  0.3311     0.7183 0.828 0.000 0.000 0.172
#> GSM62251     1  0.1716     0.7384 0.936 0.000 0.000 0.064
#> GSM62263     1  0.4222     0.6230 0.728 0.000 0.000 0.272
#> GSM62285     2  0.5420     0.3549 0.024 0.624 0.000 0.352
#> GSM62315     4  0.1151     0.7416 0.024 0.008 0.000 0.968
#> GSM62291     2  0.5452     0.3329 0.024 0.616 0.000 0.360
#> GSM62265     1  0.2921     0.7327 0.860 0.000 0.000 0.140
#> GSM62266     1  0.3850     0.7385 0.840 0.000 0.044 0.116
#> GSM62296     2  0.5691    -0.0683 0.024 0.508 0.000 0.468
#> GSM62309     4  0.1256     0.7411 0.028 0.008 0.000 0.964
#> GSM62295     2  0.0592     0.8669 0.000 0.984 0.000 0.016
#> GSM62300     4  0.5695     0.0848 0.024 0.476 0.000 0.500
#> GSM62308     4  0.5643     0.2513 0.024 0.428 0.000 0.548

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     5  0.4555     0.8263 0.020 0.000 0.000 0.344 0.636
#> GSM62256     2  0.5645     0.4227 0.000 0.540 0.000 0.084 0.376
#> GSM62259     4  0.3928     0.0311 0.000 0.004 0.000 0.700 0.296
#> GSM62267     5  0.5395     0.4607 0.272 0.000 0.044 0.028 0.656
#> GSM62280     2  0.4268     0.5145 0.008 0.648 0.000 0.000 0.344
#> GSM62284     1  0.3857     0.4682 0.688 0.000 0.312 0.000 0.000
#> GSM62289     5  0.4135     0.8280 0.004 0.000 0.000 0.340 0.656
#> GSM62307     4  0.2471     0.4739 0.000 0.000 0.000 0.864 0.136
#> GSM62316     5  0.4060     0.8179 0.000 0.000 0.000 0.360 0.640
#> GSM62254     4  0.0880     0.5942 0.000 0.000 0.000 0.968 0.032
#> GSM62292     4  0.2773     0.4444 0.000 0.000 0.000 0.836 0.164
#> GSM62253     1  0.0000     0.8114 1.000 0.000 0.000 0.000 0.000
#> GSM62270     3  0.0000     0.8865 0.000 0.000 1.000 0.000 0.000
#> GSM62278     3  0.0000     0.8865 0.000 0.000 1.000 0.000 0.000
#> GSM62297     2  0.7029    -0.1525 0.284 0.356 0.000 0.352 0.008
#> GSM62298     4  0.3966     0.5172 0.000 0.336 0.000 0.664 0.000
#> GSM62299     4  0.5181     0.4509 0.052 0.360 0.000 0.588 0.000
#> GSM62258     5  0.3561     0.4292 0.032 0.024 0.100 0.000 0.844
#> GSM62281     4  0.0404     0.6083 0.000 0.012 0.000 0.988 0.000
#> GSM62294     4  0.1478     0.5726 0.000 0.000 0.000 0.936 0.064
#> GSM62305     5  0.5592     0.7952 0.068 0.024 0.000 0.256 0.652
#> GSM62306     5  0.4060     0.8177 0.000 0.000 0.000 0.360 0.640
#> GSM62310     4  0.1952     0.5586 0.000 0.004 0.000 0.912 0.084
#> GSM62311     4  0.1851     0.5509 0.000 0.000 0.000 0.912 0.088
#> GSM62317     2  0.4419     0.5136 0.004 0.644 0.000 0.008 0.344
#> GSM62318     2  0.4467     0.5113 0.016 0.640 0.000 0.000 0.344
#> GSM62321     2  0.4268     0.5145 0.008 0.648 0.000 0.000 0.344
#> GSM62322     3  0.0000     0.8865 0.000 0.000 1.000 0.000 0.000
#> GSM62250     5  0.5062     0.8094 0.068 0.000 0.000 0.276 0.656
#> GSM62252     5  0.4401     0.8286 0.016 0.000 0.000 0.328 0.656
#> GSM62255     4  0.0162     0.6050 0.000 0.000 0.000 0.996 0.004
#> GSM62257     4  0.4307    -0.5763 0.000 0.000 0.000 0.504 0.496
#> GSM62260     2  0.6109     0.4339 0.148 0.532 0.000 0.000 0.320
#> GSM62261     5  0.4201     0.7535 0.000 0.000 0.000 0.408 0.592
#> GSM62262     4  0.0880     0.5946 0.000 0.000 0.000 0.968 0.032
#> GSM62264     1  0.0404     0.8070 0.988 0.000 0.000 0.000 0.012
#> GSM62268     1  0.1792     0.7691 0.916 0.000 0.084 0.000 0.000
#> GSM62269     3  0.0000     0.8865 0.000 0.000 1.000 0.000 0.000
#> GSM62271     3  0.0865     0.8651 0.024 0.004 0.972 0.000 0.000
#> GSM62272     3  0.0000     0.8865 0.000 0.000 1.000 0.000 0.000
#> GSM62273     4  0.3796     0.5359 0.000 0.300 0.000 0.700 0.000
#> GSM62274     3  0.3684     0.5252 0.280 0.000 0.720 0.000 0.000
#> GSM62275     3  0.0000     0.8865 0.000 0.000 1.000 0.000 0.000
#> GSM62276     5  0.4791     0.4073 0.020 0.000 0.336 0.008 0.636
#> GSM62277     3  0.0000     0.8865 0.000 0.000 1.000 0.000 0.000
#> GSM62279     1  0.3932     0.4431 0.672 0.000 0.000 0.000 0.328
#> GSM62282     3  0.6817    -0.1254 0.000 0.308 0.348 0.000 0.344
#> GSM62283     2  0.6851    -0.2030 0.408 0.412 0.160 0.000 0.020
#> GSM62286     5  0.3999     0.8267 0.000 0.000 0.000 0.344 0.656
#> GSM62287     4  0.4060    -0.1581 0.000 0.000 0.000 0.640 0.360
#> GSM62288     5  0.4482     0.7985 0.012 0.000 0.000 0.376 0.612
#> GSM62290     4  0.5080     0.4668 0.048 0.348 0.000 0.604 0.000
#> GSM62293     4  0.0880     0.5946 0.000 0.000 0.000 0.968 0.032
#> GSM62301     4  0.5520     0.4100 0.076 0.364 0.000 0.560 0.000
#> GSM62302     4  0.1792     0.5542 0.000 0.000 0.000 0.916 0.084
#> GSM62303     4  0.2516     0.4845 0.000 0.000 0.000 0.860 0.140
#> GSM62304     4  0.4262    -0.4263 0.000 0.000 0.000 0.560 0.440
#> GSM62312     4  0.4101     0.5201 0.004 0.332 0.000 0.664 0.000
#> GSM62313     4  0.2127     0.5269 0.000 0.000 0.000 0.892 0.108
#> GSM62314     4  0.4371    -0.1295 0.012 0.000 0.000 0.644 0.344
#> GSM62319     4  0.4238     0.4912 0.000 0.368 0.004 0.628 0.000
#> GSM62320     4  0.3966     0.5172 0.000 0.336 0.000 0.664 0.000
#> GSM62249     1  0.4863     0.4942 0.672 0.272 0.000 0.000 0.056
#> GSM62251     1  0.0000     0.8114 1.000 0.000 0.000 0.000 0.000
#> GSM62263     1  0.3333     0.6016 0.788 0.208 0.000 0.000 0.004
#> GSM62285     4  0.4402     0.4986 0.012 0.352 0.000 0.636 0.000
#> GSM62315     2  0.4613    -0.0564 0.020 0.620 0.000 0.360 0.000
#> GSM62291     4  0.4015     0.5085 0.000 0.348 0.000 0.652 0.000
#> GSM62265     1  0.0451     0.8085 0.988 0.004 0.000 0.000 0.008
#> GSM62266     1  0.0000     0.8114 1.000 0.000 0.000 0.000 0.000
#> GSM62296     4  0.4264     0.4844 0.004 0.376 0.000 0.620 0.000
#> GSM62309     2  0.5484     0.1953 0.120 0.640 0.000 0.240 0.000
#> GSM62295     4  0.0880     0.6135 0.000 0.032 0.000 0.968 0.000
#> GSM62300     4  0.4457     0.4859 0.012 0.368 0.000 0.620 0.000
#> GSM62308     4  0.4060     0.5006 0.000 0.360 0.000 0.640 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
#> GSM62248     5  0.2400     0.8246 0.008 0.000 0.000 0.116 0.872 0.004
#> GSM62256     6  0.0777     0.9653 0.000 0.000 0.000 0.004 0.024 0.972
#> GSM62259     5  0.3671     0.7267 0.000 0.036 0.000 0.208 0.756 0.000
#> GSM62267     5  0.0000     0.8152 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM62280     6  0.0000     0.9908 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62284     1  0.1327     0.7746 0.936 0.000 0.064 0.000 0.000 0.000
#> GSM62289     5  0.0405     0.8169 0.008 0.000 0.000 0.004 0.988 0.000
#> GSM62307     4  0.3843    -0.0821 0.000 0.000 0.000 0.548 0.452 0.000
#> GSM62316     5  0.2260     0.8196 0.000 0.000 0.000 0.140 0.860 0.000
#> GSM62254     4  0.2631     0.6650 0.000 0.000 0.000 0.820 0.180 0.000
#> GSM62292     5  0.3578     0.6307 0.000 0.000 0.000 0.340 0.660 0.000
#> GSM62253     1  0.0146     0.8001 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM62270     3  0.0000     0.9708 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.0000     0.9708 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62297     2  0.0632     0.8234 0.024 0.976 0.000 0.000 0.000 0.000
#> GSM62298     4  0.2135     0.7457 0.000 0.128 0.000 0.872 0.000 0.000
#> GSM62299     2  0.1387     0.8193 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM62258     5  0.2378     0.7116 0.000 0.000 0.000 0.000 0.848 0.152
#> GSM62281     4  0.2048     0.7639 0.000 0.000 0.000 0.880 0.000 0.120
#> GSM62294     4  0.2300     0.7116 0.000 0.000 0.000 0.856 0.144 0.000
#> GSM62305     5  0.2234     0.7427 0.004 0.124 0.000 0.000 0.872 0.000
#> GSM62306     5  0.0603     0.8128 0.004 0.016 0.000 0.000 0.980 0.000
#> GSM62310     4  0.0146     0.8209 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62311     4  0.0000     0.8212 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     6  0.0000     0.9908 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62318     6  0.0000     0.9908 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62321     6  0.0000     0.9908 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000     0.9708 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.0146     0.8171 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM62252     5  0.0146     0.8148 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM62255     4  0.0000     0.8212 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62257     5  0.2562     0.8081 0.000 0.000 0.000 0.172 0.828 0.000
#> GSM62260     2  0.3468     0.7047 0.028 0.808 0.000 0.000 0.016 0.148
#> GSM62261     5  0.2805     0.7989 0.004 0.000 0.000 0.184 0.812 0.000
#> GSM62262     4  0.0458     0.8168 0.000 0.000 0.000 0.984 0.016 0.000
#> GSM62264     1  0.0405     0.7989 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM62268     1  0.0508     0.7986 0.984 0.004 0.012 0.000 0.000 0.000
#> GSM62269     3  0.0000     0.9708 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     3  0.2747     0.8232 0.028 0.108 0.860 0.000 0.004 0.000
#> GSM62272     3  0.0000     0.9708 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     4  0.2378     0.7315 0.000 0.152 0.000 0.848 0.000 0.000
#> GSM62274     1  0.3868     0.0320 0.508 0.000 0.492 0.000 0.000 0.000
#> GSM62275     3  0.0000     0.9708 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     5  0.0790     0.8068 0.000 0.000 0.032 0.000 0.968 0.000
#> GSM62277     3  0.0865     0.9420 0.036 0.000 0.964 0.000 0.000 0.000
#> GSM62279     1  0.3944     0.3076 0.568 0.004 0.000 0.000 0.428 0.000
#> GSM62282     6  0.0405     0.9848 0.000 0.000 0.008 0.000 0.004 0.988
#> GSM62283     2  0.2011     0.7853 0.020 0.912 0.004 0.000 0.064 0.000
#> GSM62286     5  0.0632     0.8231 0.000 0.000 0.000 0.024 0.976 0.000
#> GSM62287     5  0.3578     0.6298 0.000 0.000 0.000 0.340 0.660 0.000
#> GSM62288     5  0.2378     0.8153 0.000 0.000 0.000 0.152 0.848 0.000
#> GSM62290     2  0.3828     0.1554 0.000 0.560 0.000 0.440 0.000 0.000
#> GSM62293     4  0.0000     0.8212 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62301     2  0.0458     0.8327 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM62302     4  0.0000     0.8212 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62303     4  0.3499     0.3845 0.000 0.000 0.000 0.680 0.320 0.000
#> GSM62304     5  0.3547     0.6403 0.000 0.000 0.000 0.332 0.668 0.000
#> GSM62312     4  0.3515     0.4886 0.000 0.324 0.000 0.676 0.000 0.000
#> GSM62313     4  0.0363     0.8182 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM62314     5  0.4453     0.3274 0.028 0.000 0.000 0.444 0.528 0.000
#> GSM62319     2  0.0937     0.8301 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM62320     4  0.2527     0.7114 0.000 0.168 0.000 0.832 0.000 0.000
#> GSM62249     2  0.2263     0.7733 0.048 0.896 0.000 0.000 0.056 0.000
#> GSM62251     1  0.0508     0.7977 0.984 0.004 0.000 0.000 0.012 0.000
#> GSM62263     1  0.3807     0.3421 0.628 0.368 0.000 0.000 0.000 0.004
#> GSM62285     2  0.3747     0.2946 0.000 0.604 0.000 0.396 0.000 0.000
#> GSM62315     2  0.1327     0.8209 0.000 0.936 0.000 0.064 0.000 0.000
#> GSM62291     4  0.3765     0.2856 0.000 0.404 0.000 0.596 0.000 0.000
#> GSM62265     2  0.4465     0.0386 0.460 0.512 0.000 0.000 0.028 0.000
#> GSM62266     1  0.0146     0.8001 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM62296     2  0.0363     0.8318 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM62309     2  0.0146     0.8266 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM62295     4  0.1285     0.8046 0.004 0.052 0.000 0.944 0.000 0.000
#> GSM62300     2  0.0363     0.8319 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM62308     2  0.1444     0.8169 0.000 0.928 0.000 0.072 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

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

test_to_known_factors(res)
#>          n disease.state(p) other(p) genotype/variation(p) k
#> MAD:NMF 74          0.56459    1.000                0.7441 2
#> MAD:NMF 67          0.17800    0.578                0.3090 3
#> MAD:NMF 64          0.00151    0.132                0.1803 4
#> MAD:NMF 47          0.00735    0.147                0.0975 5
#> MAD:NMF 64          0.00102    0.541                0.1707 6

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


ATC:hclust*

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.792           0.911       0.940         0.3436 0.591   0.591
#> 3 3 0.931           0.826       0.918         0.3738 0.950   0.916
#> 4 4 0.743           0.816       0.915         0.1508 0.941   0.893
#> 5 5 0.656           0.724       0.847         0.3076 0.746   0.505
#> 6 6 0.716           0.776       0.876         0.0226 0.978   0.921

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
#> GSM62248     2   0.000      0.996 0.000 1.000
#> GSM62256     2   0.000      0.996 0.000 1.000
#> GSM62259     2   0.000      0.996 0.000 1.000
#> GSM62267     1   0.943      0.695 0.640 0.360
#> GSM62280     1   0.943      0.695 0.640 0.360
#> GSM62284     1   0.808      0.738 0.752 0.248
#> GSM62289     2   0.000      0.996 0.000 1.000
#> GSM62307     2   0.000      0.996 0.000 1.000
#> GSM62316     2   0.000      0.996 0.000 1.000
#> GSM62254     2   0.000      0.996 0.000 1.000
#> GSM62292     2   0.000      0.996 0.000 1.000
#> GSM62253     1   0.992      0.551 0.552 0.448
#> GSM62270     1   0.000      0.771 1.000 0.000
#> GSM62278     1   0.000      0.771 1.000 0.000
#> GSM62297     2   0.000      0.996 0.000 1.000
#> GSM62298     2   0.000      0.996 0.000 1.000
#> GSM62299     2   0.000      0.996 0.000 1.000
#> GSM62258     1   0.943      0.695 0.640 0.360
#> GSM62281     2   0.000      0.996 0.000 1.000
#> GSM62294     2   0.000      0.996 0.000 1.000
#> GSM62305     2   0.000      0.996 0.000 1.000
#> GSM62306     2   0.000      0.996 0.000 1.000
#> GSM62310     2   0.000      0.996 0.000 1.000
#> GSM62311     2   0.000      0.996 0.000 1.000
#> GSM62317     2   0.000      0.996 0.000 1.000
#> GSM62318     2   0.671      0.699 0.176 0.824
#> GSM62321     2   0.000      0.996 0.000 1.000
#> GSM62322     1   0.000      0.771 1.000 0.000
#> GSM62250     2   0.000      0.996 0.000 1.000
#> GSM62252     2   0.000      0.996 0.000 1.000
#> GSM62255     2   0.000      0.996 0.000 1.000
#> GSM62257     2   0.000      0.996 0.000 1.000
#> GSM62260     2   0.000      0.996 0.000 1.000
#> GSM62261     2   0.000      0.996 0.000 1.000
#> GSM62262     2   0.000      0.996 0.000 1.000
#> GSM62264     2   0.000      0.996 0.000 1.000
#> GSM62268     1   0.992      0.551 0.552 0.448
#> GSM62269     1   0.000      0.771 1.000 0.000
#> GSM62271     1   0.388      0.773 0.924 0.076
#> GSM62272     1   0.000      0.771 1.000 0.000
#> GSM62273     2   0.000      0.996 0.000 1.000
#> GSM62274     1   0.000      0.771 1.000 0.000
#> GSM62275     1   0.000      0.771 1.000 0.000
#> GSM62276     1   0.943      0.695 0.640 0.360
#> GSM62277     1   0.000      0.771 1.000 0.000
#> GSM62279     1   0.975      0.625 0.592 0.408
#> GSM62282     1   0.388      0.773 0.924 0.076
#> GSM62283     1   0.943      0.695 0.640 0.360
#> GSM62286     2   0.000      0.996 0.000 1.000
#> GSM62287     2   0.000      0.996 0.000 1.000
#> GSM62288     2   0.000      0.996 0.000 1.000
#> GSM62290     2   0.000      0.996 0.000 1.000
#> GSM62293     2   0.000      0.996 0.000 1.000
#> GSM62301     2   0.000      0.996 0.000 1.000
#> GSM62302     2   0.000      0.996 0.000 1.000
#> GSM62303     2   0.000      0.996 0.000 1.000
#> GSM62304     2   0.000      0.996 0.000 1.000
#> GSM62312     2   0.000      0.996 0.000 1.000
#> GSM62313     2   0.000      0.996 0.000 1.000
#> GSM62314     2   0.000      0.996 0.000 1.000
#> GSM62319     2   0.000      0.996 0.000 1.000
#> GSM62320     2   0.000      0.996 0.000 1.000
#> GSM62249     2   0.000      0.996 0.000 1.000
#> GSM62251     2   0.000      0.996 0.000 1.000
#> GSM62263     2   0.000      0.996 0.000 1.000
#> GSM62285     2   0.000      0.996 0.000 1.000
#> GSM62315     2   0.000      0.996 0.000 1.000
#> GSM62291     2   0.000      0.996 0.000 1.000
#> GSM62265     1   0.943      0.695 0.640 0.360
#> GSM62266     1   0.992      0.551 0.552 0.448
#> GSM62296     2   0.000      0.996 0.000 1.000
#> GSM62309     2   0.000      0.996 0.000 1.000
#> GSM62295     2   0.000      0.996 0.000 1.000
#> GSM62300     2   0.000      0.996 0.000 1.000
#> GSM62308     2   0.000      0.996 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62256     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62259     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62267     1   0.588     0.7542 0.652 0.000 0.348
#> GSM62280     1   0.588     0.7542 0.652 0.000 0.348
#> GSM62284     1   0.630     0.5703 0.528 0.000 0.472
#> GSM62289     2   0.199     0.9377 0.048 0.948 0.004
#> GSM62307     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62316     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62254     2   0.129     0.9495 0.032 0.968 0.000
#> GSM62292     2   0.175     0.9402 0.048 0.952 0.000
#> GSM62253     1   0.623     0.7141 0.564 0.000 0.436
#> GSM62270     3   0.623     0.7171 0.436 0.000 0.564
#> GSM62278     1   0.450     0.0899 0.804 0.000 0.196
#> GSM62297     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62298     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62299     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62258     1   0.588     0.7542 0.652 0.000 0.348
#> GSM62281     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62294     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62305     2   0.206     0.9379 0.044 0.948 0.008
#> GSM62306     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62310     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62311     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62317     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62318     3   0.950    -0.2104 0.188 0.376 0.436
#> GSM62321     2   0.238     0.9283 0.056 0.936 0.008
#> GSM62322     3   0.623     0.7171 0.436 0.000 0.564
#> GSM62250     2   0.238     0.9283 0.056 0.936 0.008
#> GSM62252     2   0.238     0.9283 0.056 0.936 0.008
#> GSM62255     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62257     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62260     2   0.238     0.9283 0.056 0.936 0.008
#> GSM62261     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62262     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62264     2   0.812     0.2913 0.076 0.552 0.372
#> GSM62268     1   0.623     0.7141 0.564 0.000 0.436
#> GSM62269     3   0.623     0.7171 0.436 0.000 0.564
#> GSM62271     1   0.000     0.4548 1.000 0.000 0.000
#> GSM62272     3   0.623     0.7171 0.436 0.000 0.564
#> GSM62273     2   0.129     0.9495 0.032 0.968 0.000
#> GSM62274     1   0.450     0.0899 0.804 0.000 0.196
#> GSM62275     3   0.623     0.7171 0.436 0.000 0.564
#> GSM62276     1   0.588     0.7542 0.652 0.000 0.348
#> GSM62277     1   0.450     0.0899 0.804 0.000 0.196
#> GSM62279     1   0.611     0.7356 0.604 0.000 0.396
#> GSM62282     1   0.000     0.4548 1.000 0.000 0.000
#> GSM62283     1   0.588     0.7542 0.652 0.000 0.348
#> GSM62286     2   0.238     0.9283 0.056 0.936 0.008
#> GSM62287     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62288     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62290     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62293     2   0.175     0.9402 0.048 0.952 0.000
#> GSM62301     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62302     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62303     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62304     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62312     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62313     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62314     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62319     2   0.175     0.9402 0.048 0.952 0.000
#> GSM62320     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62249     2   0.238     0.9283 0.056 0.936 0.008
#> GSM62251     2   0.812     0.2913 0.076 0.552 0.372
#> GSM62263     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62285     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62315     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62291     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62265     1   0.588     0.7542 0.652 0.000 0.348
#> GSM62266     1   0.623     0.7141 0.564 0.000 0.436
#> GSM62296     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62309     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62295     2   0.175     0.9402 0.048 0.952 0.000
#> GSM62300     2   0.000     0.9660 0.000 1.000 0.000
#> GSM62308     2   0.000     0.9660 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
#> GSM62248     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62256     2  0.0188      0.927 0.000 0.996 0.000 0.004
#> GSM62259     2  0.0188      0.927 0.000 0.996 0.000 0.004
#> GSM62267     1  0.0000      0.852 1.000 0.000 0.000 0.000
#> GSM62280     1  0.0000      0.852 1.000 0.000 0.000 0.000
#> GSM62284     1  0.4353      0.556 0.756 0.000 0.232 0.012
#> GSM62289     2  0.3837      0.775 0.000 0.776 0.000 0.224
#> GSM62307     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62316     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62254     2  0.3123      0.830 0.000 0.844 0.000 0.156
#> GSM62292     2  0.3649      0.793 0.000 0.796 0.000 0.204
#> GSM62253     1  0.2589      0.809 0.884 0.000 0.000 0.116
#> GSM62270     3  0.0000      0.715 0.000 0.000 1.000 0.000
#> GSM62278     3  0.5388      0.272 0.456 0.000 0.532 0.012
#> GSM62297     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62298     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62258     1  0.0000      0.852 1.000 0.000 0.000 0.000
#> GSM62281     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62294     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62305     2  0.4103      0.739 0.000 0.744 0.000 0.256
#> GSM62306     2  0.0188      0.927 0.000 0.996 0.000 0.004
#> GSM62310     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62311     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62317     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62318     4  0.3444      0.718 0.184 0.000 0.000 0.816
#> GSM62321     2  0.4382      0.692 0.000 0.704 0.000 0.296
#> GSM62322     3  0.0000      0.715 0.000 0.000 1.000 0.000
#> GSM62250     2  0.4382      0.692 0.000 0.704 0.000 0.296
#> GSM62252     2  0.4382      0.692 0.000 0.704 0.000 0.296
#> GSM62255     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62257     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62260     2  0.4382      0.692 0.000 0.704 0.000 0.296
#> GSM62261     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62262     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62264     4  0.0469      0.870 0.000 0.012 0.000 0.988
#> GSM62268     1  0.2469      0.812 0.892 0.000 0.000 0.108
#> GSM62269     3  0.0000      0.715 0.000 0.000 1.000 0.000
#> GSM62271     1  0.5038      0.300 0.652 0.000 0.336 0.012
#> GSM62272     3  0.0000      0.715 0.000 0.000 1.000 0.000
#> GSM62273     2  0.3123      0.830 0.000 0.844 0.000 0.156
#> GSM62274     3  0.5388      0.272 0.456 0.000 0.532 0.012
#> GSM62275     3  0.0000      0.715 0.000 0.000 1.000 0.000
#> GSM62276     1  0.0000      0.852 1.000 0.000 0.000 0.000
#> GSM62277     3  0.5388      0.272 0.456 0.000 0.532 0.012
#> GSM62279     1  0.1792      0.832 0.932 0.000 0.000 0.068
#> GSM62282     1  0.5038      0.300 0.652 0.000 0.336 0.012
#> GSM62283     1  0.0000      0.852 1.000 0.000 0.000 0.000
#> GSM62286     2  0.4382      0.692 0.000 0.704 0.000 0.296
#> GSM62287     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62288     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62290     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62293     2  0.3649      0.793 0.000 0.796 0.000 0.204
#> GSM62301     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62302     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62312     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62313     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62314     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62319     2  0.3649      0.793 0.000 0.796 0.000 0.204
#> GSM62320     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62249     2  0.4382      0.692 0.000 0.704 0.000 0.296
#> GSM62251     4  0.0469      0.870 0.000 0.012 0.000 0.988
#> GSM62263     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62285     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62265     1  0.0000      0.852 1.000 0.000 0.000 0.000
#> GSM62266     1  0.2469      0.812 0.892 0.000 0.000 0.108
#> GSM62296     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62309     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62295     2  0.3649      0.793 0.000 0.796 0.000 0.204
#> GSM62300     2  0.0000      0.928 0.000 1.000 0.000 0.000
#> GSM62308     2  0.0000      0.928 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
#> GSM62248     4  0.4304      0.343 0.000 0.484 0.000 0.516 0.000
#> GSM62256     4  0.4060      0.624 0.000 0.360 0.000 0.640 0.000
#> GSM62259     4  0.4060      0.624 0.000 0.360 0.000 0.640 0.000
#> GSM62267     1  0.0000      0.753 1.000 0.000 0.000 0.000 0.000
#> GSM62280     1  0.0000      0.753 1.000 0.000 0.000 0.000 0.000
#> GSM62284     1  0.5115      0.635 0.720 0.000 0.108 0.012 0.160
#> GSM62289     4  0.3182      0.671 0.000 0.124 0.000 0.844 0.032
#> GSM62307     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62316     4  0.4304      0.343 0.000 0.484 0.000 0.516 0.000
#> GSM62254     4  0.2813      0.687 0.000 0.168 0.000 0.832 0.000
#> GSM62292     4  0.0404      0.630 0.000 0.012 0.000 0.988 0.000
#> GSM62253     1  0.2624      0.691 0.872 0.000 0.000 0.012 0.116
#> GSM62270     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM62278     1  0.6347      0.251 0.432 0.000 0.408 0.000 0.160
#> GSM62297     2  0.3305      0.653 0.000 0.776 0.000 0.224 0.000
#> GSM62298     2  0.3305      0.653 0.000 0.776 0.000 0.224 0.000
#> GSM62299     2  0.3305      0.653 0.000 0.776 0.000 0.224 0.000
#> GSM62258     1  0.0000      0.753 1.000 0.000 0.000 0.000 0.000
#> GSM62281     4  0.4074      0.620 0.000 0.364 0.000 0.636 0.000
#> GSM62294     4  0.4074      0.620 0.000 0.364 0.000 0.636 0.000
#> GSM62305     4  0.3215      0.619 0.000 0.056 0.000 0.852 0.092
#> GSM62306     4  0.4060      0.624 0.000 0.360 0.000 0.640 0.000
#> GSM62310     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62311     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62317     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62318     5  0.4325      0.737 0.180 0.000 0.000 0.064 0.756
#> GSM62321     4  0.2305      0.585 0.000 0.012 0.000 0.896 0.092
#> GSM62322     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM62250     4  0.2305      0.585 0.000 0.012 0.000 0.896 0.092
#> GSM62252     4  0.2305      0.585 0.000 0.012 0.000 0.896 0.092
#> GSM62255     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62257     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62260     4  0.2305      0.585 0.000 0.012 0.000 0.896 0.092
#> GSM62261     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62262     4  0.4074      0.620 0.000 0.364 0.000 0.636 0.000
#> GSM62264     5  0.2732      0.873 0.000 0.000 0.000 0.160 0.840
#> GSM62268     1  0.2522      0.694 0.880 0.000 0.000 0.012 0.108
#> GSM62269     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM62271     1  0.4990      0.504 0.628 0.000 0.324 0.000 0.048
#> GSM62272     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM62273     4  0.2813      0.687 0.000 0.168 0.000 0.832 0.000
#> GSM62274     1  0.6347      0.251 0.432 0.000 0.408 0.000 0.160
#> GSM62275     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM62276     1  0.0000      0.753 1.000 0.000 0.000 0.000 0.000
#> GSM62277     1  0.6347      0.251 0.432 0.000 0.408 0.000 0.160
#> GSM62279     1  0.1942      0.721 0.920 0.000 0.000 0.012 0.068
#> GSM62282     1  0.4990      0.504 0.628 0.000 0.324 0.000 0.048
#> GSM62283     1  0.0000      0.753 1.000 0.000 0.000 0.000 0.000
#> GSM62286     4  0.2305      0.585 0.000 0.012 0.000 0.896 0.092
#> GSM62287     4  0.4074      0.620 0.000 0.364 0.000 0.636 0.000
#> GSM62288     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62290     2  0.0963      0.891 0.000 0.964 0.000 0.036 0.000
#> GSM62293     4  0.0404      0.630 0.000 0.012 0.000 0.988 0.000
#> GSM62301     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62302     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62303     2  0.3424      0.627 0.000 0.760 0.000 0.240 0.000
#> GSM62304     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62312     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62313     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62314     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62319     4  0.0404      0.630 0.000 0.012 0.000 0.988 0.000
#> GSM62320     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62249     4  0.2305      0.585 0.000 0.012 0.000 0.896 0.092
#> GSM62251     5  0.2732      0.873 0.000 0.000 0.000 0.160 0.840
#> GSM62263     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62285     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000      0.916 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.0963      0.891 0.000 0.964 0.000 0.036 0.000
#> GSM62265     1  0.0000      0.753 1.000 0.000 0.000 0.000 0.000
#> GSM62266     1  0.2522      0.694 0.880 0.000 0.000 0.012 0.108
#> GSM62296     2  0.3424      0.627 0.000 0.760 0.000 0.240 0.000
#> GSM62309     4  0.4074      0.620 0.000 0.364 0.000 0.636 0.000
#> GSM62295     4  0.0404      0.630 0.000 0.012 0.000 0.988 0.000
#> GSM62300     2  0.3424      0.627 0.000 0.760 0.000 0.240 0.000
#> GSM62308     4  0.4074      0.620 0.000 0.364 0.000 0.636 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
#> GSM62248     4  0.3860      0.360 0.000 0.472 0.000 0.528 0.000 0.000
#> GSM62256     4  0.3607      0.634 0.000 0.348 0.000 0.652 0.000 0.000
#> GSM62259     4  0.3607      0.634 0.000 0.348 0.000 0.652 0.000 0.000
#> GSM62267     1  0.1556      0.920 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM62280     1  0.1556      0.920 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM62284     6  0.3737      0.330 0.392 0.000 0.000 0.000 0.000 0.608
#> GSM62289     4  0.2726      0.701 0.000 0.112 0.000 0.856 0.032 0.000
#> GSM62307     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62316     4  0.3860      0.360 0.000 0.472 0.000 0.528 0.000 0.000
#> GSM62254     4  0.2416      0.712 0.000 0.156 0.000 0.844 0.000 0.000
#> GSM62292     4  0.0000      0.667 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62253     1  0.1858      0.865 0.912 0.000 0.000 0.000 0.076 0.012
#> GSM62270     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     6  0.0363      0.772 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM62297     2  0.3023      0.642 0.000 0.768 0.000 0.232 0.000 0.000
#> GSM62298     2  0.3023      0.642 0.000 0.768 0.000 0.232 0.000 0.000
#> GSM62299     2  0.3023      0.642 0.000 0.768 0.000 0.232 0.000 0.000
#> GSM62258     1  0.1556      0.920 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM62281     4  0.3620      0.629 0.000 0.352 0.000 0.648 0.000 0.000
#> GSM62294     4  0.3620      0.629 0.000 0.352 0.000 0.648 0.000 0.000
#> GSM62305     4  0.2697      0.657 0.000 0.044 0.000 0.864 0.092 0.000
#> GSM62306     4  0.3607      0.634 0.000 0.348 0.000 0.652 0.000 0.000
#> GSM62310     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62311     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62317     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62318     5  0.2664      0.730 0.184 0.000 0.000 0.000 0.816 0.000
#> GSM62321     4  0.1714      0.631 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM62322     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     4  0.1714      0.631 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM62252     4  0.1714      0.631 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM62255     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62257     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62260     4  0.1714      0.631 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM62261     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62262     4  0.3620      0.629 0.000 0.352 0.000 0.648 0.000 0.000
#> GSM62264     5  0.0000      0.874 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM62268     1  0.1745      0.870 0.920 0.000 0.000 0.000 0.068 0.012
#> GSM62269     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     6  0.2823      0.725 0.204 0.000 0.000 0.000 0.000 0.796
#> GSM62272     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     4  0.2416      0.712 0.000 0.156 0.000 0.844 0.000 0.000
#> GSM62274     6  0.0508      0.773 0.004 0.000 0.012 0.000 0.000 0.984
#> GSM62275     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     1  0.1556      0.920 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM62277     6  0.0363      0.772 0.000 0.000 0.012 0.000 0.000 0.988
#> GSM62279     1  0.1074      0.884 0.960 0.000 0.000 0.000 0.028 0.012
#> GSM62282     6  0.2823      0.725 0.204 0.000 0.000 0.000 0.000 0.796
#> GSM62283     1  0.1556      0.920 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM62286     4  0.1714      0.631 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM62287     4  0.3620      0.629 0.000 0.352 0.000 0.648 0.000 0.000
#> GSM62288     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62290     2  0.0865      0.889 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM62293     4  0.0000      0.667 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62301     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62302     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62303     2  0.3126      0.616 0.000 0.752 0.000 0.248 0.000 0.000
#> GSM62304     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62312     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62313     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62314     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62319     4  0.0000      0.667 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62320     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62249     4  0.1714      0.631 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM62251     5  0.0000      0.874 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM62263     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62285     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62315     2  0.0000      0.914 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62291     2  0.0865      0.889 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM62265     1  0.1556      0.920 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM62266     1  0.1745      0.870 0.920 0.000 0.000 0.000 0.068 0.012
#> GSM62296     2  0.3126      0.616 0.000 0.752 0.000 0.248 0.000 0.000
#> GSM62309     4  0.3620      0.629 0.000 0.352 0.000 0.648 0.000 0.000
#> GSM62295     4  0.0000      0.667 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62300     2  0.3126      0.616 0.000 0.752 0.000 0.248 0.000 0.000
#> GSM62308     4  0.3620      0.629 0.000 0.352 0.000 0.648 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-hclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) other(p) genotype/variation(p) k
#> ATC:hclust 75            0.439    0.943                 0.454 2
#> ATC:hclust 67            0.551    0.636                 0.820 3
#> ATC:hclust 70            0.657    0.766                 0.838 4
#> ATC:hclust 70            0.730    0.937                 0.525 5
#> ATC:hclust 72            0.677    0.719                 0.763 6

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


ATC:kmeans*

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 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-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4208 0.580   0.580
#> 3 3 0.686           0.812       0.911         0.3412 0.717   0.553
#> 4 4 0.910           0.948       0.965         0.2452 0.735   0.445
#> 5 5 0.780           0.648       0.786         0.0931 0.929   0.759
#> 6 6 0.788           0.775       0.824         0.0499 0.881   0.559

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette p1 p2
#> GSM62248     2       0          1  0  1
#> GSM62256     2       0          1  0  1
#> GSM62259     2       0          1  0  1
#> GSM62267     1       0          1  1  0
#> GSM62280     1       0          1  1  0
#> GSM62284     1       0          1  1  0
#> GSM62289     2       0          1  0  1
#> GSM62307     2       0          1  0  1
#> GSM62316     2       0          1  0  1
#> GSM62254     2       0          1  0  1
#> GSM62292     2       0          1  0  1
#> GSM62253     1       0          1  1  0
#> GSM62270     1       0          1  1  0
#> GSM62278     1       0          1  1  0
#> GSM62297     2       0          1  0  1
#> GSM62298     2       0          1  0  1
#> GSM62299     2       0          1  0  1
#> GSM62258     1       0          1  1  0
#> GSM62281     2       0          1  0  1
#> GSM62294     2       0          1  0  1
#> GSM62305     2       0          1  0  1
#> GSM62306     2       0          1  0  1
#> GSM62310     2       0          1  0  1
#> GSM62311     2       0          1  0  1
#> GSM62317     2       0          1  0  1
#> GSM62318     1       0          1  1  0
#> GSM62321     2       0          1  0  1
#> GSM62322     1       0          1  1  0
#> GSM62250     2       0          1  0  1
#> GSM62252     2       0          1  0  1
#> GSM62255     2       0          1  0  1
#> GSM62257     2       0          1  0  1
#> GSM62260     2       0          1  0  1
#> GSM62261     2       0          1  0  1
#> GSM62262     2       0          1  0  1
#> GSM62264     2       0          1  0  1
#> GSM62268     1       0          1  1  0
#> GSM62269     1       0          1  1  0
#> GSM62271     1       0          1  1  0
#> GSM62272     1       0          1  1  0
#> GSM62273     2       0          1  0  1
#> GSM62274     1       0          1  1  0
#> GSM62275     1       0          1  1  0
#> GSM62276     1       0          1  1  0
#> GSM62277     1       0          1  1  0
#> GSM62279     1       0          1  1  0
#> GSM62282     1       0          1  1  0
#> GSM62283     1       0          1  1  0
#> GSM62286     2       0          1  0  1
#> GSM62287     2       0          1  0  1
#> GSM62288     2       0          1  0  1
#> GSM62290     2       0          1  0  1
#> GSM62293     2       0          1  0  1
#> GSM62301     2       0          1  0  1
#> GSM62302     2       0          1  0  1
#> GSM62303     2       0          1  0  1
#> GSM62304     2       0          1  0  1
#> GSM62312     2       0          1  0  1
#> GSM62313     2       0          1  0  1
#> GSM62314     2       0          1  0  1
#> GSM62319     2       0          1  0  1
#> GSM62320     2       0          1  0  1
#> GSM62249     2       0          1  0  1
#> GSM62251     2       0          1  0  1
#> GSM62263     2       0          1  0  1
#> GSM62285     2       0          1  0  1
#> GSM62315     2       0          1  0  1
#> GSM62291     2       0          1  0  1
#> GSM62265     1       0          1  1  0
#> GSM62266     1       0          1  1  0
#> GSM62296     2       0          1  0  1
#> GSM62309     2       0          1  0  1
#> GSM62295     2       0          1  0  1
#> GSM62300     2       0          1  0  1
#> GSM62308     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62256     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62259     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62267     1  0.3412      0.536 0.876 0.000 0.124
#> GSM62280     1  0.0892      0.624 0.980 0.000 0.020
#> GSM62284     3  0.4842      0.792 0.224 0.000 0.776
#> GSM62289     2  0.4452      0.722 0.192 0.808 0.000
#> GSM62307     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62316     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62254     2  0.3412      0.841 0.124 0.876 0.000
#> GSM62292     1  0.6215      0.476 0.572 0.428 0.000
#> GSM62253     1  0.3412      0.536 0.876 0.000 0.124
#> GSM62270     3  0.0000      0.887 0.000 0.000 1.000
#> GSM62278     3  0.0000      0.887 0.000 0.000 1.000
#> GSM62297     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62298     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62299     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62258     1  0.0892      0.624 0.980 0.000 0.020
#> GSM62281     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62294     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62305     1  0.6307      0.313 0.512 0.488 0.000
#> GSM62306     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62310     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62317     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62318     1  0.0000      0.632 1.000 0.000 0.000
#> GSM62321     1  0.6215      0.476 0.572 0.428 0.000
#> GSM62322     3  0.0000      0.887 0.000 0.000 1.000
#> GSM62250     1  0.6215      0.476 0.572 0.428 0.000
#> GSM62252     1  0.4887      0.634 0.772 0.228 0.000
#> GSM62255     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62260     1  0.0000      0.632 1.000 0.000 0.000
#> GSM62261     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62262     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62264     1  0.4750      0.636 0.784 0.216 0.000
#> GSM62268     1  0.3412      0.536 0.876 0.000 0.124
#> GSM62269     3  0.0000      0.887 0.000 0.000 1.000
#> GSM62271     3  0.6215      0.540 0.428 0.000 0.572
#> GSM62272     3  0.0000      0.887 0.000 0.000 1.000
#> GSM62273     2  0.3412      0.841 0.124 0.876 0.000
#> GSM62274     3  0.4842      0.792 0.224 0.000 0.776
#> GSM62275     3  0.0000      0.887 0.000 0.000 1.000
#> GSM62276     1  0.3412      0.536 0.876 0.000 0.124
#> GSM62277     3  0.0000      0.887 0.000 0.000 1.000
#> GSM62279     1  0.0892      0.624 0.980 0.000 0.020
#> GSM62282     3  0.5431      0.739 0.284 0.000 0.716
#> GSM62283     1  0.0000      0.632 1.000 0.000 0.000
#> GSM62286     1  0.6215      0.476 0.572 0.428 0.000
#> GSM62287     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62288     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62290     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62293     1  0.6215      0.476 0.572 0.428 0.000
#> GSM62301     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62302     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62312     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62313     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62314     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62319     1  0.4842      0.635 0.776 0.224 0.000
#> GSM62320     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62249     1  0.6215      0.476 0.572 0.428 0.000
#> GSM62251     1  0.0000      0.632 1.000 0.000 0.000
#> GSM62263     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62285     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62315     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62291     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62265     1  0.0892      0.624 0.980 0.000 0.020
#> GSM62266     1  0.3412      0.536 0.876 0.000 0.124
#> GSM62296     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62309     2  0.0892      0.970 0.020 0.980 0.000
#> GSM62295     1  0.6215      0.476 0.572 0.428 0.000
#> GSM62300     2  0.0000      0.980 0.000 1.000 0.000
#> GSM62308     2  0.0892      0.970 0.020 0.980 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4  0.1867      0.897 0.000 0.072 0.000 0.928
#> GSM62256     4  0.3873      0.788 0.000 0.228 0.000 0.772
#> GSM62259     4  0.2647      0.870 0.000 0.120 0.000 0.880
#> GSM62267     1  0.0336      0.985 0.992 0.000 0.000 0.008
#> GSM62280     1  0.0336      0.985 0.992 0.000 0.000 0.008
#> GSM62284     1  0.0469      0.985 0.988 0.000 0.000 0.012
#> GSM62289     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62307     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62316     4  0.4103      0.755 0.000 0.256 0.000 0.744
#> GSM62254     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62292     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62253     1  0.0817      0.983 0.976 0.000 0.000 0.024
#> GSM62270     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM62278     3  0.0376      0.994 0.004 0.000 0.992 0.004
#> GSM62297     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62298     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62258     1  0.0336      0.985 0.992 0.000 0.000 0.008
#> GSM62281     4  0.1867      0.897 0.000 0.072 0.000 0.928
#> GSM62294     4  0.3873      0.788 0.000 0.228 0.000 0.772
#> GSM62305     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62306     4  0.2081      0.891 0.000 0.084 0.000 0.916
#> GSM62310     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62311     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62317     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62318     1  0.0817      0.983 0.976 0.000 0.000 0.024
#> GSM62321     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62322     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM62250     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62252     4  0.0927      0.902 0.008 0.016 0.000 0.976
#> GSM62255     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62257     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62260     4  0.0469      0.887 0.012 0.000 0.000 0.988
#> GSM62261     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62262     4  0.3873      0.788 0.000 0.228 0.000 0.772
#> GSM62264     4  0.0469      0.885 0.012 0.000 0.000 0.988
#> GSM62268     1  0.0817      0.984 0.976 0.000 0.000 0.024
#> GSM62269     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM62271     1  0.0524      0.984 0.988 0.000 0.008 0.004
#> GSM62272     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM62273     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62274     1  0.0804      0.982 0.980 0.000 0.012 0.008
#> GSM62275     3  0.0000      0.999 0.000 0.000 1.000 0.000
#> GSM62276     1  0.0336      0.985 0.992 0.000 0.000 0.008
#> GSM62277     3  0.0188      0.997 0.000 0.000 0.996 0.004
#> GSM62279     1  0.0817      0.983 0.976 0.000 0.000 0.024
#> GSM62282     1  0.0524      0.984 0.988 0.000 0.008 0.004
#> GSM62283     1  0.0469      0.985 0.988 0.000 0.000 0.012
#> GSM62286     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62287     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62288     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62290     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62293     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62301     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62302     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62312     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62313     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62314     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62319     4  0.0937      0.898 0.012 0.012 0.000 0.976
#> GSM62320     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62249     4  0.0817      0.907 0.000 0.024 0.000 0.976
#> GSM62251     4  0.3266      0.730 0.168 0.000 0.000 0.832
#> GSM62263     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62285     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62291     2  0.1940      0.901 0.000 0.924 0.000 0.076
#> GSM62265     1  0.0592      0.985 0.984 0.000 0.000 0.016
#> GSM62266     1  0.0817      0.983 0.976 0.000 0.000 0.024
#> GSM62296     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62309     4  0.3873      0.788 0.000 0.228 0.000 0.772
#> GSM62295     4  0.0921      0.910 0.000 0.028 0.000 0.972
#> GSM62300     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM62308     4  0.4072      0.761 0.000 0.252 0.000 0.748

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     5  0.4305    -0.4528 0.000 0.000 0.000 0.488 0.512
#> GSM62256     4  0.5458     0.5847 0.000 0.060 0.000 0.476 0.464
#> GSM62259     4  0.4848     0.5480 0.000 0.024 0.000 0.556 0.420
#> GSM62267     1  0.0000     0.8777 1.000 0.000 0.000 0.000 0.000
#> GSM62280     1  0.0000     0.8777 1.000 0.000 0.000 0.000 0.000
#> GSM62284     1  0.2605     0.8693 0.852 0.000 0.000 0.148 0.000
#> GSM62289     5  0.0794     0.6485 0.000 0.000 0.000 0.028 0.972
#> GSM62307     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62316     4  0.5529     0.6093 0.000 0.068 0.000 0.512 0.420
#> GSM62254     5  0.3999     0.4066 0.000 0.000 0.000 0.344 0.656
#> GSM62292     5  0.3796     0.4897 0.000 0.000 0.000 0.300 0.700
#> GSM62253     1  0.3661     0.8419 0.724 0.000 0.000 0.276 0.000
#> GSM62270     3  0.0000     0.9843 0.000 0.000 1.000 0.000 0.000
#> GSM62278     3  0.2193     0.9268 0.060 0.000 0.912 0.028 0.000
#> GSM62297     2  0.4273     0.1978 0.000 0.552 0.000 0.448 0.000
#> GSM62298     2  0.3752     0.5411 0.000 0.708 0.000 0.292 0.000
#> GSM62299     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62258     1  0.0000     0.8777 1.000 0.000 0.000 0.000 0.000
#> GSM62281     5  0.4307    -0.5091 0.000 0.000 0.000 0.496 0.504
#> GSM62294     4  0.4946     0.5544 0.000 0.036 0.000 0.596 0.368
#> GSM62305     5  0.0000     0.6545 0.000 0.000 0.000 0.000 1.000
#> GSM62306     5  0.4655    -0.5303 0.000 0.012 0.000 0.476 0.512
#> GSM62310     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62311     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62317     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62318     1  0.3837     0.8198 0.692 0.000 0.000 0.308 0.000
#> GSM62321     5  0.0794     0.6493 0.000 0.000 0.000 0.028 0.972
#> GSM62322     3  0.0000     0.9843 0.000 0.000 1.000 0.000 0.000
#> GSM62250     5  0.0000     0.6545 0.000 0.000 0.000 0.000 1.000
#> GSM62252     5  0.1121     0.6534 0.000 0.000 0.000 0.044 0.956
#> GSM62255     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62257     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62260     5  0.1608     0.6258 0.000 0.000 0.000 0.072 0.928
#> GSM62261     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62262     4  0.4946     0.5544 0.000 0.036 0.000 0.596 0.368
#> GSM62264     5  0.4030     0.4114 0.000 0.000 0.000 0.352 0.648
#> GSM62268     1  0.3636     0.8434 0.728 0.000 0.000 0.272 0.000
#> GSM62269     3  0.0000     0.9843 0.000 0.000 1.000 0.000 0.000
#> GSM62271     1  0.0794     0.8682 0.972 0.000 0.000 0.028 0.000
#> GSM62272     3  0.0000     0.9843 0.000 0.000 1.000 0.000 0.000
#> GSM62273     5  0.3999     0.4066 0.000 0.000 0.000 0.344 0.656
#> GSM62274     1  0.1270     0.8694 0.948 0.000 0.000 0.052 0.000
#> GSM62275     3  0.0000     0.9843 0.000 0.000 1.000 0.000 0.000
#> GSM62276     1  0.0000     0.8777 1.000 0.000 0.000 0.000 0.000
#> GSM62277     3  0.0794     0.9722 0.000 0.000 0.972 0.028 0.000
#> GSM62279     1  0.3612     0.8434 0.732 0.000 0.000 0.268 0.000
#> GSM62282     1  0.0794     0.8682 0.972 0.000 0.000 0.028 0.000
#> GSM62283     1  0.1270     0.8779 0.948 0.000 0.000 0.052 0.000
#> GSM62286     5  0.1043     0.6532 0.000 0.000 0.000 0.040 0.960
#> GSM62287     2  0.4549     0.1145 0.000 0.528 0.000 0.464 0.008
#> GSM62288     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62290     2  0.4302     0.1220 0.000 0.520 0.000 0.480 0.000
#> GSM62293     5  0.3796     0.4897 0.000 0.000 0.000 0.300 0.700
#> GSM62301     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62302     2  0.3561     0.5888 0.000 0.740 0.000 0.260 0.000
#> GSM62303     2  0.4268     0.2074 0.000 0.556 0.000 0.444 0.000
#> GSM62304     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62312     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62313     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62314     2  0.0703     0.8296 0.000 0.976 0.000 0.024 0.000
#> GSM62319     5  0.2329     0.6205 0.000 0.000 0.000 0.124 0.876
#> GSM62320     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62249     5  0.0404     0.6532 0.000 0.000 0.000 0.012 0.988
#> GSM62251     5  0.4402     0.4014 0.012 0.000 0.000 0.352 0.636
#> GSM62263     2  0.1270     0.8096 0.000 0.948 0.000 0.052 0.000
#> GSM62285     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.8461 0.000 1.000 0.000 0.000 0.000
#> GSM62291     4  0.5393     0.0691 0.000 0.440 0.000 0.504 0.056
#> GSM62265     1  0.3480     0.8477 0.752 0.000 0.000 0.248 0.000
#> GSM62266     1  0.3661     0.8419 0.724 0.000 0.000 0.276 0.000
#> GSM62296     4  0.6051     0.2816 0.000 0.404 0.000 0.476 0.120
#> GSM62309     4  0.5435     0.6026 0.000 0.060 0.000 0.512 0.428
#> GSM62295     5  0.3796     0.4897 0.000 0.000 0.000 0.300 0.700
#> GSM62300     2  0.4300     0.1043 0.000 0.524 0.000 0.476 0.000
#> GSM62308     4  0.6122     0.6234 0.000 0.140 0.000 0.512 0.348

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     2  0.1493      0.784 0.000 0.936 0.000 0.004 0.056 0.004
#> GSM62256     2  0.1261      0.810 0.000 0.952 0.000 0.024 0.024 0.000
#> GSM62259     2  0.0692      0.791 0.000 0.976 0.000 0.004 0.020 0.000
#> GSM62267     1  0.0000      0.727 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62280     1  0.0000      0.727 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62284     1  0.4294      0.622 0.672 0.000 0.000 0.000 0.048 0.280
#> GSM62289     5  0.2664      0.742 0.000 0.184 0.000 0.000 0.816 0.000
#> GSM62307     4  0.0146      0.981 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62316     2  0.1138      0.814 0.000 0.960 0.000 0.024 0.012 0.004
#> GSM62254     5  0.5478      0.706 0.000 0.236 0.000 0.000 0.568 0.196
#> GSM62292     5  0.5416      0.713 0.000 0.224 0.000 0.000 0.580 0.196
#> GSM62253     1  0.3864      0.462 0.520 0.000 0.000 0.000 0.000 0.480
#> GSM62270     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.3396      0.851 0.076 0.000 0.840 0.000 0.044 0.040
#> GSM62297     2  0.3509      0.767 0.000 0.744 0.000 0.240 0.000 0.016
#> GSM62298     2  0.3853      0.689 0.000 0.680 0.000 0.304 0.000 0.016
#> GSM62299     4  0.1168      0.948 0.000 0.028 0.000 0.956 0.000 0.016
#> GSM62258     1  0.0000      0.727 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62281     2  0.0632      0.794 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM62294     2  0.2585      0.746 0.000 0.880 0.000 0.004 0.068 0.048
#> GSM62305     5  0.2454      0.748 0.000 0.160 0.000 0.000 0.840 0.000
#> GSM62306     2  0.1285      0.789 0.000 0.944 0.000 0.004 0.052 0.000
#> GSM62310     4  0.0790      0.969 0.000 0.000 0.000 0.968 0.000 0.032
#> GSM62311     4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     4  0.1151      0.962 0.000 0.012 0.000 0.956 0.000 0.032
#> GSM62318     6  0.4741     -0.195 0.344 0.004 0.000 0.000 0.052 0.600
#> GSM62321     5  0.2730      0.736 0.000 0.152 0.000 0.000 0.836 0.012
#> GSM62322     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.2416      0.746 0.000 0.156 0.000 0.000 0.844 0.000
#> GSM62252     5  0.2048      0.745 0.000 0.120 0.000 0.000 0.880 0.000
#> GSM62255     4  0.0146      0.981 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62257     4  0.0146      0.981 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62260     5  0.4269      0.356 0.000 0.092 0.000 0.000 0.724 0.184
#> GSM62261     4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62262     2  0.2585      0.746 0.000 0.880 0.000 0.004 0.068 0.048
#> GSM62264     6  0.4361      0.621 0.000 0.024 0.000 0.000 0.424 0.552
#> GSM62268     1  0.4177      0.468 0.520 0.000 0.000 0.000 0.012 0.468
#> GSM62269     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     1  0.0937      0.712 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM62272     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     5  0.5478      0.706 0.000 0.236 0.000 0.000 0.568 0.196
#> GSM62274     1  0.3835      0.655 0.748 0.000 0.000 0.000 0.048 0.204
#> GSM62275     3  0.0000      0.962 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     1  0.0000      0.727 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM62277     3  0.1934      0.919 0.000 0.000 0.916 0.000 0.044 0.040
#> GSM62279     1  0.4083      0.470 0.532 0.000 0.000 0.000 0.008 0.460
#> GSM62282     1  0.0937      0.712 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM62283     1  0.1588      0.706 0.924 0.000 0.000 0.000 0.004 0.072
#> GSM62286     5  0.2431      0.752 0.000 0.132 0.000 0.000 0.860 0.008
#> GSM62287     2  0.3200      0.799 0.000 0.788 0.000 0.196 0.000 0.016
#> GSM62288     4  0.0790      0.969 0.000 0.000 0.000 0.968 0.000 0.032
#> GSM62290     2  0.3261      0.787 0.000 0.780 0.000 0.204 0.000 0.016
#> GSM62293     5  0.5416      0.713 0.000 0.224 0.000 0.000 0.580 0.196
#> GSM62301     4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62302     2  0.4465      0.342 0.000 0.512 0.000 0.460 0.000 0.028
#> GSM62303     2  0.3606      0.754 0.000 0.728 0.000 0.256 0.000 0.016
#> GSM62304     4  0.0146      0.981 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62312     4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62313     4  0.0146      0.981 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62314     4  0.1334      0.956 0.000 0.020 0.000 0.948 0.000 0.032
#> GSM62319     5  0.4871      0.718 0.000 0.144 0.000 0.000 0.660 0.196
#> GSM62320     4  0.0146      0.981 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62249     5  0.2378      0.743 0.000 0.152 0.000 0.000 0.848 0.000
#> GSM62251     6  0.4218      0.621 0.000 0.016 0.000 0.000 0.428 0.556
#> GSM62263     4  0.2250      0.905 0.000 0.020 0.000 0.888 0.000 0.092
#> GSM62285     4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62315     4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62291     2  0.2558      0.811 0.000 0.840 0.000 0.156 0.000 0.004
#> GSM62265     1  0.3684      0.531 0.664 0.000 0.000 0.000 0.004 0.332
#> GSM62266     1  0.3864      0.462 0.520 0.000 0.000 0.000 0.000 0.480
#> GSM62296     2  0.2446      0.822 0.000 0.864 0.000 0.124 0.000 0.012
#> GSM62309     2  0.0993      0.813 0.000 0.964 0.000 0.024 0.012 0.000
#> GSM62295     5  0.5416      0.713 0.000 0.224 0.000 0.000 0.580 0.196
#> GSM62300     2  0.2946      0.806 0.000 0.812 0.000 0.176 0.000 0.012
#> GSM62308     2  0.0865      0.818 0.000 0.964 0.000 0.036 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-kmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) other(p) genotype/variation(p) k
#> ATC:kmeans 75            0.379    1.000                 0.456 2
#> ATC:kmeans 67            0.273    0.548                 0.953 3
#> ATC:kmeans 75            0.542    0.766                 0.241 4
#> ATC:kmeans 58            0.647    0.771                 0.193 5
#> ATC:kmeans 68            0.457    0.794                 0.125 6

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


ATC:skmeans*

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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.998       0.999         0.4669 0.533   0.533
#> 3 3 1.000           0.950       0.982         0.2564 0.838   0.707
#> 4 4 0.967           0.898       0.965         0.1019 0.928   0.826
#> 5 5 0.938           0.858       0.953         0.0398 0.966   0.904
#> 6 6 0.748           0.766       0.878         0.0663 0.962   0.882

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette   p1   p2
#> GSM62248     2   0.000      1.000 0.00 1.00
#> GSM62256     2   0.000      1.000 0.00 1.00
#> GSM62259     2   0.000      1.000 0.00 1.00
#> GSM62267     1   0.000      0.997 1.00 0.00
#> GSM62280     1   0.000      0.997 1.00 0.00
#> GSM62284     1   0.000      0.997 1.00 0.00
#> GSM62289     2   0.000      1.000 0.00 1.00
#> GSM62307     2   0.000      1.000 0.00 1.00
#> GSM62316     2   0.000      1.000 0.00 1.00
#> GSM62254     2   0.000      1.000 0.00 1.00
#> GSM62292     2   0.000      1.000 0.00 1.00
#> GSM62253     1   0.000      0.997 1.00 0.00
#> GSM62270     1   0.000      0.997 1.00 0.00
#> GSM62278     1   0.000      0.997 1.00 0.00
#> GSM62297     2   0.000      1.000 0.00 1.00
#> GSM62298     2   0.000      1.000 0.00 1.00
#> GSM62299     2   0.000      1.000 0.00 1.00
#> GSM62258     1   0.000      0.997 1.00 0.00
#> GSM62281     2   0.000      1.000 0.00 1.00
#> GSM62294     2   0.000      1.000 0.00 1.00
#> GSM62305     2   0.000      1.000 0.00 1.00
#> GSM62306     2   0.000      1.000 0.00 1.00
#> GSM62310     2   0.000      1.000 0.00 1.00
#> GSM62311     2   0.000      1.000 0.00 1.00
#> GSM62317     2   0.000      1.000 0.00 1.00
#> GSM62318     1   0.000      0.997 1.00 0.00
#> GSM62321     2   0.000      1.000 0.00 1.00
#> GSM62322     1   0.000      0.997 1.00 0.00
#> GSM62250     2   0.000      1.000 0.00 1.00
#> GSM62252     1   0.000      0.997 1.00 0.00
#> GSM62255     2   0.000      1.000 0.00 1.00
#> GSM62257     2   0.000      1.000 0.00 1.00
#> GSM62260     1   0.000      0.997 1.00 0.00
#> GSM62261     2   0.000      1.000 0.00 1.00
#> GSM62262     2   0.000      1.000 0.00 1.00
#> GSM62264     1   0.402      0.913 0.92 0.08
#> GSM62268     1   0.000      0.997 1.00 0.00
#> GSM62269     1   0.000      0.997 1.00 0.00
#> GSM62271     1   0.000      0.997 1.00 0.00
#> GSM62272     1   0.000      0.997 1.00 0.00
#> GSM62273     2   0.000      1.000 0.00 1.00
#> GSM62274     1   0.000      0.997 1.00 0.00
#> GSM62275     1   0.000      0.997 1.00 0.00
#> GSM62276     1   0.000      0.997 1.00 0.00
#> GSM62277     1   0.000      0.997 1.00 0.00
#> GSM62279     1   0.000      0.997 1.00 0.00
#> GSM62282     1   0.000      0.997 1.00 0.00
#> GSM62283     1   0.000      0.997 1.00 0.00
#> GSM62286     2   0.000      1.000 0.00 1.00
#> GSM62287     2   0.000      1.000 0.00 1.00
#> GSM62288     2   0.000      1.000 0.00 1.00
#> GSM62290     2   0.000      1.000 0.00 1.00
#> GSM62293     2   0.000      1.000 0.00 1.00
#> GSM62301     2   0.000      1.000 0.00 1.00
#> GSM62302     2   0.000      1.000 0.00 1.00
#> GSM62303     2   0.000      1.000 0.00 1.00
#> GSM62304     2   0.000      1.000 0.00 1.00
#> GSM62312     2   0.000      1.000 0.00 1.00
#> GSM62313     2   0.000      1.000 0.00 1.00
#> GSM62314     2   0.000      1.000 0.00 1.00
#> GSM62319     1   0.000      0.997 1.00 0.00
#> GSM62320     2   0.000      1.000 0.00 1.00
#> GSM62249     2   0.000      1.000 0.00 1.00
#> GSM62251     1   0.000      0.997 1.00 0.00
#> GSM62263     2   0.000      1.000 0.00 1.00
#> GSM62285     2   0.000      1.000 0.00 1.00
#> GSM62315     2   0.000      1.000 0.00 1.00
#> GSM62291     2   0.000      1.000 0.00 1.00
#> GSM62265     1   0.000      0.997 1.00 0.00
#> GSM62266     1   0.000      0.997 1.00 0.00
#> GSM62296     2   0.000      1.000 0.00 1.00
#> GSM62309     2   0.000      1.000 0.00 1.00
#> GSM62295     2   0.000      1.000 0.00 1.00
#> GSM62300     2   0.000      1.000 0.00 1.00
#> GSM62308     2   0.000      1.000 0.00 1.00

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62256     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62259     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62267     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62280     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62284     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62289     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62307     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62316     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62254     3  0.0000     0.9020 0.000 0.000 1.000
#> GSM62292     3  0.0000     0.9020 0.000 0.000 1.000
#> GSM62253     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62270     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62278     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62297     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62298     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62299     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62258     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62281     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62294     3  0.5591     0.5809 0.000 0.304 0.696
#> GSM62305     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62306     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62310     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62311     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62317     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62318     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62321     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62322     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62250     2  0.6267     0.0431 0.000 0.548 0.452
#> GSM62252     3  0.0000     0.9020 0.000 0.000 1.000
#> GSM62255     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62257     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62260     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62261     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62262     3  0.6154     0.3526 0.000 0.408 0.592
#> GSM62264     2  0.4062     0.7609 0.164 0.836 0.000
#> GSM62268     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62269     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62271     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62272     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62273     3  0.0000     0.9020 0.000 0.000 1.000
#> GSM62274     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62275     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62276     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62277     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62279     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62282     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62283     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62286     3  0.0000     0.9020 0.000 0.000 1.000
#> GSM62287     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62288     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62290     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62293     3  0.0000     0.9020 0.000 0.000 1.000
#> GSM62301     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62302     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62303     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62304     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62312     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62313     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62314     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62319     3  0.0237     0.8989 0.004 0.000 0.996
#> GSM62320     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62249     2  0.0237     0.9783 0.000 0.996 0.004
#> GSM62251     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62263     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62285     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62315     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62291     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62265     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62266     1  0.0000     1.0000 1.000 0.000 0.000
#> GSM62296     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62309     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62295     3  0.0000     0.9020 0.000 0.000 1.000
#> GSM62300     2  0.0000     0.9823 0.000 1.000 0.000
#> GSM62308     2  0.0000     0.9823 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
#> GSM62248     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62256     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62259     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62267     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62280     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62284     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62289     2  0.4008     0.6446 0.000 0.756 0.244 0.000
#> GSM62307     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62316     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62254     4  0.0000     0.7622 0.000 0.000 0.000 1.000
#> GSM62292     4  0.0000     0.7622 0.000 0.000 0.000 1.000
#> GSM62253     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62270     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62278     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62297     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62298     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62258     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62281     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62294     4  0.4790     0.2959 0.000 0.380 0.000 0.620
#> GSM62305     2  0.4522     0.4816 0.000 0.680 0.320 0.000
#> GSM62306     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62310     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62311     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62317     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62318     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62321     3  0.1716     0.7451 0.000 0.064 0.936 0.000
#> GSM62322     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62250     3  0.7042     0.1671 0.000 0.388 0.488 0.124
#> GSM62252     4  0.4981     0.0633 0.000 0.000 0.464 0.536
#> GSM62255     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62257     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62260     3  0.1867     0.7560 0.072 0.000 0.928 0.000
#> GSM62261     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62262     4  0.4989     0.1578 0.000 0.472 0.000 0.528
#> GSM62264     3  0.0000     0.7773 0.000 0.000 1.000 0.000
#> GSM62268     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62269     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62271     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62272     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62273     4  0.0000     0.7622 0.000 0.000 0.000 1.000
#> GSM62274     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62275     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62276     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62277     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62279     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62282     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62283     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62286     4  0.0336     0.7575 0.000 0.000 0.008 0.992
#> GSM62287     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62288     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62290     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62293     4  0.0000     0.7622 0.000 0.000 0.000 1.000
#> GSM62301     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62302     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62312     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62313     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62314     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62319     4  0.0336     0.7555 0.008 0.000 0.000 0.992
#> GSM62320     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62249     3  0.0000     0.7773 0.000 0.000 1.000 0.000
#> GSM62251     3  0.1557     0.7692 0.056 0.000 0.944 0.000
#> GSM62263     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62285     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62265     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62266     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM62296     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62309     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62295     4  0.0000     0.7622 0.000 0.000 0.000 1.000
#> GSM62300     2  0.0000     0.9827 0.000 1.000 0.000 0.000
#> GSM62308     2  0.0000     0.9827 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
#> GSM62248     2  0.0324     0.9803 0.000 0.992 0.004 0.000 0.004
#> GSM62256     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62259     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62267     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62280     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62284     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62289     5  0.3395     0.4797 0.000 0.236 0.000 0.000 0.764
#> GSM62307     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62316     2  0.0162     0.9826 0.000 0.996 0.000 0.000 0.004
#> GSM62254     4  0.0000     0.7653 0.000 0.000 0.000 1.000 0.000
#> GSM62292     4  0.0000     0.7653 0.000 0.000 0.000 1.000 0.000
#> GSM62253     1  0.3612     0.6413 0.732 0.000 0.268 0.000 0.000
#> GSM62270     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62278     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62297     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62298     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62299     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62258     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62281     2  0.0162     0.9826 0.000 0.996 0.000 0.000 0.004
#> GSM62294     4  0.4268     0.3680 0.000 0.344 0.000 0.648 0.008
#> GSM62305     2  0.5770     0.1042 0.000 0.540 0.028 0.040 0.392
#> GSM62306     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62310     2  0.0162     0.9826 0.000 0.996 0.000 0.000 0.004
#> GSM62311     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62317     2  0.0324     0.9803 0.000 0.992 0.004 0.000 0.004
#> GSM62318     3  0.4278    -0.0173 0.452 0.000 0.548 0.000 0.000
#> GSM62321     3  0.5296     0.1908 0.000 0.280 0.636 0.000 0.084
#> GSM62322     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62250     5  0.0162     0.7990 0.000 0.004 0.000 0.000 0.996
#> GSM62252     5  0.0880     0.8007 0.000 0.000 0.000 0.032 0.968
#> GSM62255     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62257     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62260     3  0.1818     0.5873 0.044 0.000 0.932 0.000 0.024
#> GSM62261     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62262     4  0.4262     0.2657 0.000 0.440 0.000 0.560 0.000
#> GSM62264     3  0.0000     0.5998 0.000 0.000 1.000 0.000 0.000
#> GSM62268     1  0.3508     0.6665 0.748 0.000 0.252 0.000 0.000
#> GSM62269     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62271     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62272     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62273     4  0.0290     0.7608 0.000 0.000 0.000 0.992 0.008
#> GSM62274     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62275     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62276     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62277     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62279     1  0.0880     0.9275 0.968 0.000 0.032 0.000 0.000
#> GSM62282     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62283     1  0.0000     0.9531 1.000 0.000 0.000 0.000 0.000
#> GSM62286     5  0.2690     0.7309 0.000 0.000 0.000 0.156 0.844
#> GSM62287     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62288     2  0.0162     0.9826 0.000 0.996 0.000 0.000 0.004
#> GSM62290     2  0.0162     0.9826 0.000 0.996 0.000 0.000 0.004
#> GSM62293     4  0.0000     0.7653 0.000 0.000 0.000 1.000 0.000
#> GSM62301     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62302     2  0.0162     0.9826 0.000 0.996 0.000 0.000 0.004
#> GSM62303     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62304     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62312     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62313     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62314     2  0.0324     0.9803 0.000 0.992 0.004 0.000 0.004
#> GSM62319     4  0.0162     0.7619 0.004 0.000 0.000 0.996 0.000
#> GSM62320     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62249     5  0.1732     0.7675 0.000 0.000 0.080 0.000 0.920
#> GSM62251     3  0.0162     0.6022 0.004 0.000 0.996 0.000 0.000
#> GSM62263     2  0.0324     0.9803 0.000 0.992 0.004 0.000 0.004
#> GSM62285     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62291     2  0.0324     0.9803 0.000 0.992 0.004 0.000 0.004
#> GSM62265     1  0.0162     0.9502 0.996 0.000 0.004 0.000 0.000
#> GSM62266     1  0.3586     0.6481 0.736 0.000 0.264 0.000 0.000
#> GSM62296     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62309     2  0.0162     0.9826 0.000 0.996 0.000 0.000 0.004
#> GSM62295     4  0.0000     0.7653 0.000 0.000 0.000 1.000 0.000
#> GSM62300     2  0.0000     0.9839 0.000 1.000 0.000 0.000 0.000
#> GSM62308     2  0.0162     0.9826 0.000 0.996 0.000 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     4  0.3175     0.7194 0.000 0.000 0.000 0.744 0.000 0.256
#> GSM62256     4  0.2278     0.8024 0.000 0.000 0.000 0.868 0.004 0.128
#> GSM62259     4  0.2320     0.7978 0.000 0.000 0.000 0.864 0.004 0.132
#> GSM62267     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62280     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62284     3  0.2048     0.8275 0.120 0.000 0.880 0.000 0.000 0.000
#> GSM62289     5  0.4680     0.3434 0.000 0.000 0.000 0.132 0.684 0.184
#> GSM62307     4  0.0260     0.8910 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM62316     4  0.3244     0.7223 0.000 0.000 0.000 0.732 0.000 0.268
#> GSM62254     2  0.0508     0.7383 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM62292     2  0.0000     0.7399 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62253     1  0.3756     0.5410 0.600 0.000 0.400 0.000 0.000 0.000
#> GSM62270     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62297     4  0.0260     0.8912 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM62298     4  0.0260     0.8912 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM62299     4  0.0146     0.8914 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62258     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62281     4  0.2597     0.8212 0.000 0.000 0.000 0.824 0.000 0.176
#> GSM62294     2  0.5081     0.1373 0.000 0.592 0.000 0.316 0.004 0.088
#> GSM62305     6  0.5878     0.3367 0.000 0.004 0.000 0.308 0.196 0.492
#> GSM62306     4  0.2442     0.7814 0.000 0.000 0.000 0.852 0.004 0.144
#> GSM62310     4  0.1957     0.8470 0.000 0.000 0.000 0.888 0.000 0.112
#> GSM62311     4  0.0000     0.8917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     4  0.2597     0.8001 0.000 0.000 0.000 0.824 0.000 0.176
#> GSM62318     1  0.3351     0.6034 0.712 0.000 0.288 0.000 0.000 0.000
#> GSM62321     6  0.6260     0.3082 0.256 0.000 0.000 0.152 0.052 0.540
#> GSM62322     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.0665     0.7735 0.000 0.004 0.000 0.008 0.980 0.008
#> GSM62252     5  0.1895     0.7676 0.000 0.016 0.000 0.000 0.912 0.072
#> GSM62255     4  0.0363     0.8899 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM62257     4  0.0146     0.8914 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62260     1  0.4938    -0.0102 0.560 0.000 0.052 0.000 0.008 0.380
#> GSM62261     4  0.0000     0.8917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62262     2  0.5310    -0.0743 0.000 0.480 0.000 0.428 0.004 0.088
#> GSM62264     1  0.2738     0.2188 0.820 0.000 0.000 0.000 0.004 0.176
#> GSM62268     1  0.3782     0.5167 0.588 0.000 0.412 0.000 0.000 0.000
#> GSM62269     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62272     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2  0.1152     0.7249 0.000 0.952 0.000 0.000 0.004 0.044
#> GSM62274     3  0.0260     0.9558 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM62275     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62277     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62279     3  0.2793     0.6916 0.200 0.000 0.800 0.000 0.000 0.000
#> GSM62282     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62283     3  0.0000     0.9627 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62286     5  0.2706     0.7199 0.000 0.124 0.000 0.000 0.852 0.024
#> GSM62287     4  0.1806     0.8413 0.000 0.000 0.000 0.908 0.004 0.088
#> GSM62288     4  0.2178     0.8346 0.000 0.000 0.000 0.868 0.000 0.132
#> GSM62290     4  0.2730     0.7904 0.000 0.000 0.000 0.808 0.000 0.192
#> GSM62293     2  0.0000     0.7399 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62301     4  0.0000     0.8917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62302     4  0.0937     0.8859 0.000 0.000 0.000 0.960 0.000 0.040
#> GSM62303     4  0.0458     0.8888 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM62304     4  0.0363     0.8899 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM62312     4  0.0000     0.8917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62313     4  0.0146     0.8910 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM62314     4  0.2854     0.7694 0.000 0.000 0.000 0.792 0.000 0.208
#> GSM62319     2  0.2051     0.6776 0.000 0.896 0.004 0.000 0.004 0.096
#> GSM62320     4  0.0000     0.8917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62249     5  0.2826     0.7243 0.028 0.000 0.000 0.000 0.844 0.128
#> GSM62251     1  0.0508     0.3547 0.984 0.000 0.004 0.000 0.000 0.012
#> GSM62263     4  0.2912     0.7611 0.000 0.000 0.000 0.784 0.000 0.216
#> GSM62285     4  0.0000     0.8917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62315     4  0.0000     0.8917 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62291     4  0.2969     0.7548 0.000 0.000 0.000 0.776 0.000 0.224
#> GSM62265     3  0.2340     0.7878 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM62266     1  0.3756     0.5410 0.600 0.000 0.400 0.000 0.000 0.000
#> GSM62296     4  0.1588     0.8535 0.000 0.000 0.000 0.924 0.004 0.072
#> GSM62309     4  0.2793     0.7990 0.000 0.000 0.000 0.800 0.000 0.200
#> GSM62295     2  0.0000     0.7399 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62300     4  0.0790     0.8831 0.000 0.000 0.000 0.968 0.000 0.032
#> GSM62308     4  0.2300     0.8395 0.000 0.000 0.000 0.856 0.000 0.144

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) other(p) genotype/variation(p) k
#> ATC:skmeans 75            0.453    0.570               0.71263 2
#> ATC:skmeans 73            0.512    0.411               0.03614 3
#> ATC:skmeans 70            0.358    0.599               0.00548 4
#> ATC:skmeans 69            0.719    0.703               0.03915 5
#> ATC:skmeans 67            0.604    0.536               0.06692 6

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


ATC:pam**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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.987       0.995         0.4247 0.580   0.580
#> 3 3 0.632           0.799       0.886         0.4235 0.717   0.540
#> 4 4 0.835           0.838       0.935         0.1636 0.797   0.527
#> 5 5 0.796           0.828       0.892         0.0786 0.878   0.620
#> 6 6 0.784           0.551       0.807         0.0325 0.921   0.709

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
#> GSM62248     2   0.000      0.993 0.000 1.000
#> GSM62256     2   0.000      0.993 0.000 1.000
#> GSM62259     2   0.000      0.993 0.000 1.000
#> GSM62267     1   0.000      1.000 1.000 0.000
#> GSM62280     1   0.000      1.000 1.000 0.000
#> GSM62284     1   0.000      1.000 1.000 0.000
#> GSM62289     2   0.000      0.993 0.000 1.000
#> GSM62307     2   0.000      0.993 0.000 1.000
#> GSM62316     2   0.000      0.993 0.000 1.000
#> GSM62254     2   0.000      0.993 0.000 1.000
#> GSM62292     2   0.000      0.993 0.000 1.000
#> GSM62253     1   0.000      1.000 1.000 0.000
#> GSM62270     1   0.000      1.000 1.000 0.000
#> GSM62278     1   0.000      1.000 1.000 0.000
#> GSM62297     2   0.000      0.993 0.000 1.000
#> GSM62298     2   0.000      0.993 0.000 1.000
#> GSM62299     2   0.000      0.993 0.000 1.000
#> GSM62258     1   0.000      1.000 1.000 0.000
#> GSM62281     2   0.000      0.993 0.000 1.000
#> GSM62294     2   0.000      0.993 0.000 1.000
#> GSM62305     2   0.000      0.993 0.000 1.000
#> GSM62306     2   0.000      0.993 0.000 1.000
#> GSM62310     2   0.000      0.993 0.000 1.000
#> GSM62311     2   0.000      0.993 0.000 1.000
#> GSM62317     2   0.000      0.993 0.000 1.000
#> GSM62318     1   0.000      1.000 1.000 0.000
#> GSM62321     2   0.000      0.993 0.000 1.000
#> GSM62322     1   0.000      1.000 1.000 0.000
#> GSM62250     2   0.000      0.993 0.000 1.000
#> GSM62252     2   0.000      0.993 0.000 1.000
#> GSM62255     2   0.000      0.993 0.000 1.000
#> GSM62257     2   0.000      0.993 0.000 1.000
#> GSM62260     2   0.949      0.418 0.368 0.632
#> GSM62261     2   0.000      0.993 0.000 1.000
#> GSM62262     2   0.000      0.993 0.000 1.000
#> GSM62264     2   0.000      0.993 0.000 1.000
#> GSM62268     1   0.000      1.000 1.000 0.000
#> GSM62269     1   0.000      1.000 1.000 0.000
#> GSM62271     1   0.000      1.000 1.000 0.000
#> GSM62272     1   0.000      1.000 1.000 0.000
#> GSM62273     2   0.000      0.993 0.000 1.000
#> GSM62274     1   0.000      1.000 1.000 0.000
#> GSM62275     1   0.000      1.000 1.000 0.000
#> GSM62276     1   0.000      1.000 1.000 0.000
#> GSM62277     1   0.000      1.000 1.000 0.000
#> GSM62279     1   0.000      1.000 1.000 0.000
#> GSM62282     1   0.000      1.000 1.000 0.000
#> GSM62283     1   0.000      1.000 1.000 0.000
#> GSM62286     2   0.000      0.993 0.000 1.000
#> GSM62287     2   0.000      0.993 0.000 1.000
#> GSM62288     2   0.000      0.993 0.000 1.000
#> GSM62290     2   0.000      0.993 0.000 1.000
#> GSM62293     2   0.000      0.993 0.000 1.000
#> GSM62301     2   0.000      0.993 0.000 1.000
#> GSM62302     2   0.000      0.993 0.000 1.000
#> GSM62303     2   0.000      0.993 0.000 1.000
#> GSM62304     2   0.000      0.993 0.000 1.000
#> GSM62312     2   0.000      0.993 0.000 1.000
#> GSM62313     2   0.000      0.993 0.000 1.000
#> GSM62314     2   0.000      0.993 0.000 1.000
#> GSM62319     2   0.000      0.993 0.000 1.000
#> GSM62320     2   0.000      0.993 0.000 1.000
#> GSM62249     2   0.000      0.993 0.000 1.000
#> GSM62251     2   0.000      0.993 0.000 1.000
#> GSM62263     2   0.000      0.993 0.000 1.000
#> GSM62285     2   0.000      0.993 0.000 1.000
#> GSM62315     2   0.000      0.993 0.000 1.000
#> GSM62291     2   0.000      0.993 0.000 1.000
#> GSM62265     1   0.000      1.000 1.000 0.000
#> GSM62266     1   0.000      1.000 1.000 0.000
#> GSM62296     2   0.000      0.993 0.000 1.000
#> GSM62309     2   0.000      0.993 0.000 1.000
#> GSM62295     2   0.000      0.993 0.000 1.000
#> GSM62300     2   0.000      0.993 0.000 1.000
#> GSM62308     2   0.000      0.993 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.4504      0.744 0.196 0.804 0.000
#> GSM62256     2  0.0592      0.935 0.012 0.988 0.000
#> GSM62259     2  0.3267      0.841 0.116 0.884 0.000
#> GSM62267     3  0.0000      0.822 0.000 0.000 1.000
#> GSM62280     1  0.6308      0.384 0.508 0.000 0.492
#> GSM62284     3  0.0000      0.822 0.000 0.000 1.000
#> GSM62289     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62307     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62316     2  0.4178      0.779 0.172 0.828 0.000
#> GSM62254     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62292     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62253     3  0.0000      0.822 0.000 0.000 1.000
#> GSM62270     3  0.5591      0.836 0.304 0.000 0.696
#> GSM62278     3  0.5591      0.836 0.304 0.000 0.696
#> GSM62297     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62298     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62299     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62258     1  0.6299      0.416 0.524 0.000 0.476
#> GSM62281     2  0.6026      0.301 0.376 0.624 0.000
#> GSM62294     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62305     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62306     2  0.4346      0.762 0.184 0.816 0.000
#> GSM62310     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62317     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62318     1  0.5591      0.620 0.696 0.000 0.304
#> GSM62321     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62322     3  0.5591      0.836 0.304 0.000 0.696
#> GSM62250     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62252     1  0.6597      0.715 0.696 0.268 0.036
#> GSM62255     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62260     1  0.5591      0.620 0.696 0.000 0.304
#> GSM62261     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62262     2  0.0892      0.929 0.020 0.980 0.000
#> GSM62264     1  0.5785      0.623 0.696 0.004 0.300
#> GSM62268     3  0.0000      0.822 0.000 0.000 1.000
#> GSM62269     3  0.5591      0.836 0.304 0.000 0.696
#> GSM62271     3  0.0000      0.822 0.000 0.000 1.000
#> GSM62272     3  0.5591      0.836 0.304 0.000 0.696
#> GSM62273     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62274     3  0.5529      0.836 0.296 0.000 0.704
#> GSM62275     3  0.5591      0.836 0.304 0.000 0.696
#> GSM62276     3  0.0000      0.822 0.000 0.000 1.000
#> GSM62277     3  0.5591      0.836 0.304 0.000 0.696
#> GSM62279     1  0.6299      0.416 0.524 0.000 0.476
#> GSM62282     3  0.0000      0.822 0.000 0.000 1.000
#> GSM62283     1  0.6299      0.416 0.524 0.000 0.476
#> GSM62286     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62287     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62288     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62290     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62293     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62301     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62302     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62312     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62313     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62314     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62319     1  0.5591      0.620 0.696 0.000 0.304
#> GSM62320     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62249     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62251     1  0.5591      0.620 0.696 0.000 0.304
#> GSM62263     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62285     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62315     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62291     2  0.4178      0.779 0.172 0.828 0.000
#> GSM62265     1  0.6299      0.416 0.524 0.000 0.476
#> GSM62266     3  0.0000      0.822 0.000 0.000 1.000
#> GSM62296     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62309     2  0.4842      0.697 0.224 0.776 0.000
#> GSM62295     1  0.5591      0.706 0.696 0.304 0.000
#> GSM62300     2  0.0000      0.943 0.000 1.000 0.000
#> GSM62308     2  0.4178      0.779 0.172 0.828 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4  0.4985      0.171 0.000 0.468 0.000 0.532
#> GSM62256     2  0.1557      0.906 0.000 0.944 0.000 0.056
#> GSM62259     4  0.4543      0.580 0.000 0.324 0.000 0.676
#> GSM62267     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62280     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62284     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62289     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62307     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62316     2  0.3123      0.773 0.000 0.844 0.000 0.156
#> GSM62254     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62292     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62253     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62270     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM62278     3  0.0469      0.987 0.012 0.000 0.988 0.000
#> GSM62297     2  0.1022      0.931 0.000 0.968 0.000 0.032
#> GSM62298     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62258     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62281     4  0.2408      0.761 0.000 0.104 0.000 0.896
#> GSM62294     4  0.4888      0.424 0.000 0.412 0.000 0.588
#> GSM62305     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62306     2  0.4925      0.143 0.000 0.572 0.000 0.428
#> GSM62310     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62311     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62317     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62318     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62321     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62322     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM62250     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62252     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62255     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62257     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62260     1  0.4992      0.252 0.524 0.000 0.000 0.476
#> GSM62261     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62262     4  0.4855      0.451 0.000 0.400 0.000 0.600
#> GSM62264     1  0.4643      0.526 0.656 0.000 0.000 0.344
#> GSM62268     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62269     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM62271     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62272     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM62273     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62274     1  0.4790      0.357 0.620 0.000 0.380 0.000
#> GSM62275     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM62276     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62277     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM62279     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62282     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62283     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62286     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62287     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62288     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62290     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62293     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62301     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62302     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62303     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62304     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62312     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62313     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62314     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62319     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62320     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62249     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62251     1  0.3801      0.697 0.780 0.000 0.000 0.220
#> GSM62263     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62285     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62291     2  0.4222      0.566 0.000 0.728 0.000 0.272
#> GSM62265     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62266     1  0.0000      0.903 1.000 0.000 0.000 0.000
#> GSM62296     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62309     4  0.4761      0.500 0.000 0.372 0.000 0.628
#> GSM62295     4  0.0000      0.820 0.000 0.000 0.000 1.000
#> GSM62300     2  0.0000      0.961 0.000 1.000 0.000 0.000
#> GSM62308     4  0.4804      0.477 0.000 0.384 0.000 0.616

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     5  0.0510     0.7654 0.000 0.016 0.000 0.000 0.984
#> GSM62256     5  0.4210     0.3684 0.000 0.412 0.000 0.000 0.588
#> GSM62259     5  0.3561     0.5853 0.000 0.260 0.000 0.000 0.740
#> GSM62267     1  0.0000     0.9006 1.000 0.000 0.000 0.000 0.000
#> GSM62280     1  0.0000     0.9006 1.000 0.000 0.000 0.000 0.000
#> GSM62284     1  0.3508     0.7822 0.748 0.000 0.000 0.252 0.000
#> GSM62289     5  0.0290     0.7540 0.000 0.000 0.000 0.008 0.992
#> GSM62307     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62316     5  0.3274     0.6438 0.000 0.220 0.000 0.000 0.780
#> GSM62254     4  0.3508     0.9394 0.000 0.000 0.000 0.748 0.252
#> GSM62292     4  0.3508     0.9394 0.000 0.000 0.000 0.748 0.252
#> GSM62253     1  0.1341     0.8966 0.944 0.000 0.000 0.056 0.000
#> GSM62270     3  0.0000     0.9407 0.000 0.000 1.000 0.000 0.000
#> GSM62278     3  0.3988     0.8309 0.036 0.000 0.768 0.196 0.000
#> GSM62297     2  0.3534     0.6399 0.000 0.744 0.000 0.000 0.256
#> GSM62298     2  0.1121     0.9208 0.000 0.956 0.000 0.000 0.044
#> GSM62299     2  0.0963     0.9252 0.000 0.964 0.000 0.000 0.036
#> GSM62258     1  0.0000     0.9006 1.000 0.000 0.000 0.000 0.000
#> GSM62281     5  0.0510     0.7651 0.000 0.016 0.000 0.000 0.984
#> GSM62294     2  0.4491     0.4553 0.000 0.652 0.000 0.020 0.328
#> GSM62305     5  0.1965     0.6716 0.000 0.000 0.000 0.096 0.904
#> GSM62306     5  0.0794     0.7662 0.000 0.028 0.000 0.000 0.972
#> GSM62310     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62311     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62317     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62318     1  0.1341     0.8966 0.944 0.000 0.000 0.056 0.000
#> GSM62321     5  0.0290     0.7540 0.000 0.000 0.000 0.008 0.992
#> GSM62322     3  0.0000     0.9407 0.000 0.000 1.000 0.000 0.000
#> GSM62250     5  0.1121     0.7246 0.000 0.000 0.000 0.044 0.956
#> GSM62252     4  0.3508     0.9394 0.000 0.000 0.000 0.748 0.252
#> GSM62255     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62257     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62260     5  0.3388     0.6089 0.200 0.000 0.000 0.008 0.792
#> GSM62261     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62262     4  0.5727     0.5444 0.000 0.100 0.000 0.560 0.340
#> GSM62264     5  0.3318     0.6292 0.180 0.000 0.000 0.012 0.808
#> GSM62268     1  0.1341     0.8966 0.944 0.000 0.000 0.056 0.000
#> GSM62269     3  0.0000     0.9407 0.000 0.000 1.000 0.000 0.000
#> GSM62271     1  0.3074     0.7876 0.804 0.000 0.000 0.196 0.000
#> GSM62272     3  0.0000     0.9407 0.000 0.000 1.000 0.000 0.000
#> GSM62273     4  0.3612     0.9263 0.000 0.000 0.000 0.732 0.268
#> GSM62274     1  0.6715     0.0198 0.392 0.000 0.360 0.248 0.000
#> GSM62275     3  0.0000     0.9407 0.000 0.000 1.000 0.000 0.000
#> GSM62276     1  0.0000     0.9006 1.000 0.000 0.000 0.000 0.000
#> GSM62277     3  0.3074     0.8512 0.000 0.000 0.804 0.196 0.000
#> GSM62279     1  0.1197     0.8976 0.952 0.000 0.000 0.048 0.000
#> GSM62282     1  0.3074     0.7876 0.804 0.000 0.000 0.196 0.000
#> GSM62283     1  0.0000     0.9006 1.000 0.000 0.000 0.000 0.000
#> GSM62286     4  0.3932     0.8576 0.000 0.000 0.000 0.672 0.328
#> GSM62287     2  0.0963     0.9252 0.000 0.964 0.000 0.000 0.036
#> GSM62288     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62290     2  0.3177     0.7542 0.000 0.792 0.000 0.000 0.208
#> GSM62293     4  0.3508     0.9394 0.000 0.000 0.000 0.748 0.252
#> GSM62301     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62302     2  0.0963     0.9252 0.000 0.964 0.000 0.000 0.036
#> GSM62303     2  0.0963     0.9252 0.000 0.964 0.000 0.000 0.036
#> GSM62304     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62312     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62313     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62314     2  0.2773     0.7748 0.000 0.836 0.000 0.000 0.164
#> GSM62319     4  0.3508     0.9394 0.000 0.000 0.000 0.748 0.252
#> GSM62320     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62249     5  0.0880     0.7354 0.000 0.000 0.000 0.032 0.968
#> GSM62251     1  0.2068     0.8414 0.904 0.000 0.000 0.004 0.092
#> GSM62263     2  0.3177     0.7542 0.000 0.792 0.000 0.000 0.208
#> GSM62285     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62315     2  0.0000     0.9365 0.000 1.000 0.000 0.000 0.000
#> GSM62291     5  0.2329     0.7281 0.000 0.124 0.000 0.000 0.876
#> GSM62265     1  0.0000     0.9006 1.000 0.000 0.000 0.000 0.000
#> GSM62266     1  0.1341     0.8966 0.944 0.000 0.000 0.056 0.000
#> GSM62296     2  0.1410     0.9099 0.000 0.940 0.000 0.000 0.060
#> GSM62309     5  0.1908     0.7455 0.000 0.092 0.000 0.000 0.908
#> GSM62295     4  0.3508     0.9394 0.000 0.000 0.000 0.748 0.252
#> GSM62300     2  0.1121     0.9208 0.000 0.956 0.000 0.000 0.044
#> GSM62308     5  0.3796     0.5481 0.000 0.300 0.000 0.000 0.700

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM62248     5  0.3765     0.3854 0.404 0.000 0.000 0.000 0.596 0.000
#> GSM62256     5  0.3774     0.0323 0.000 0.000 0.000 0.408 0.592 0.000
#> GSM62259     5  0.3765     0.0429 0.000 0.000 0.000 0.404 0.596 0.000
#> GSM62267     5  0.5902    -0.3540 0.392 0.000 0.000 0.000 0.404 0.204
#> GSM62280     5  0.5917    -0.3577 0.388 0.000 0.000 0.000 0.404 0.208
#> GSM62284     6  0.2823     0.1016 0.204 0.000 0.000 0.000 0.000 0.796
#> GSM62289     5  0.4851     0.3642 0.404 0.060 0.000 0.000 0.536 0.000
#> GSM62307     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62316     5  0.3765     0.3854 0.404 0.000 0.000 0.000 0.596 0.000
#> GSM62254     2  0.0000     0.8660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62292     2  0.0000     0.8660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62253     1  0.3804     0.4706 0.576 0.000 0.000 0.000 0.000 0.424
#> GSM62270     3  0.0000     0.9150 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62278     6  0.5993     0.2903 0.004 0.000 0.296 0.000 0.228 0.472
#> GSM62297     4  0.3695     0.4913 0.000 0.000 0.000 0.624 0.376 0.000
#> GSM62298     4  0.1814     0.8902 0.000 0.000 0.000 0.900 0.100 0.000
#> GSM62299     4  0.1556     0.9004 0.000 0.000 0.000 0.920 0.080 0.000
#> GSM62258     5  0.5902    -0.3540 0.392 0.000 0.000 0.000 0.404 0.204
#> GSM62281     5  0.3765     0.3854 0.404 0.000 0.000 0.000 0.596 0.000
#> GSM62294     4  0.4534     0.4312 0.000 0.040 0.000 0.580 0.380 0.000
#> GSM62305     5  0.5659     0.3064 0.336 0.168 0.000 0.000 0.496 0.000
#> GSM62306     5  0.4141     0.3862 0.388 0.000 0.000 0.016 0.596 0.000
#> GSM62310     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62311     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62317     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62318     1  0.3804     0.4706 0.576 0.000 0.000 0.000 0.000 0.424
#> GSM62321     5  0.4851     0.3642 0.404 0.060 0.000 0.000 0.536 0.000
#> GSM62322     3  0.0000     0.9150 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62250     5  0.5270     0.3354 0.404 0.100 0.000 0.000 0.496 0.000
#> GSM62252     2  0.0000     0.8660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62255     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62257     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62260     1  0.4838    -0.2683 0.564 0.064 0.000 0.000 0.372 0.000
#> GSM62261     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62262     2  0.4057     0.3992 0.000 0.600 0.000 0.012 0.388 0.000
#> GSM62264     1  0.4674    -0.2355 0.608 0.060 0.000 0.000 0.332 0.000
#> GSM62268     1  0.3810     0.4658 0.572 0.000 0.000 0.000 0.000 0.428
#> GSM62269     3  0.0000     0.9150 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62271     6  0.4254     0.5722 0.020 0.000 0.000 0.000 0.404 0.576
#> GSM62272     3  0.0000     0.9150 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62273     2  0.0363     0.8539 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM62274     6  0.0000     0.4014 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM62275     3  0.0000     0.9150 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM62276     5  0.5902    -0.3540 0.392 0.000 0.000 0.000 0.404 0.204
#> GSM62277     3  0.3684     0.4015 0.000 0.000 0.628 0.000 0.000 0.372
#> GSM62279     1  0.3923     0.4646 0.580 0.000 0.000 0.000 0.004 0.416
#> GSM62282     6  0.4254     0.5722 0.020 0.000 0.000 0.000 0.404 0.576
#> GSM62283     5  0.5902    -0.3540 0.392 0.000 0.000 0.000 0.404 0.204
#> GSM62286     2  0.4110     0.4062 0.376 0.608 0.000 0.000 0.016 0.000
#> GSM62287     4  0.1556     0.9004 0.000 0.000 0.000 0.920 0.080 0.000
#> GSM62288     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62290     4  0.2558     0.8725 0.028 0.000 0.000 0.868 0.104 0.000
#> GSM62293     2  0.0000     0.8660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62301     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62302     4  0.1814     0.8902 0.000 0.000 0.000 0.900 0.100 0.000
#> GSM62303     4  0.1663     0.8967 0.000 0.000 0.000 0.912 0.088 0.000
#> GSM62304     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62312     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62313     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62314     4  0.0972     0.9083 0.028 0.000 0.000 0.964 0.008 0.000
#> GSM62319     2  0.0000     0.8660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62320     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62249     5  0.5233     0.3390 0.404 0.096 0.000 0.000 0.500 0.000
#> GSM62251     1  0.0622     0.3027 0.980 0.008 0.000 0.000 0.012 0.000
#> GSM62263     4  0.2558     0.8725 0.028 0.000 0.000 0.868 0.104 0.000
#> GSM62285     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62315     4  0.0000     0.9242 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62291     5  0.5095     0.3632 0.368 0.000 0.000 0.088 0.544 0.000
#> GSM62265     5  0.5902    -0.3540 0.392 0.000 0.000 0.000 0.404 0.204
#> GSM62266     1  0.3804     0.4706 0.576 0.000 0.000 0.000 0.000 0.424
#> GSM62296     4  0.2823     0.7831 0.000 0.000 0.000 0.796 0.204 0.000
#> GSM62309     5  0.4756     0.3768 0.380 0.000 0.000 0.056 0.564 0.000
#> GSM62295     2  0.0000     0.8660 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM62300     4  0.1814     0.8902 0.000 0.000 0.000 0.900 0.100 0.000
#> GSM62308     5  0.3979    -0.1080 0.004 0.000 0.000 0.456 0.540 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) other(p) genotype/variation(p) k
#> ATC:pam 74            0.362    1.000                 0.455 2
#> ATC:pam 69            0.374    0.816                 0.238 3
#> ATC:pam 67            0.587    0.923                 0.433 4
#> ATC:pam 72            0.618    0.116                 0.032 5
#> ATC:pam 39            0.640    0.682                 0.352 6

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


ATC:mclust

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 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-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.674           0.950       0.954         0.4548 0.550   0.550
#> 3 3 0.629           0.854       0.866         0.2233 0.944   0.898
#> 4 4 0.573           0.663       0.746         0.2278 0.795   0.595
#> 5 5 0.630           0.774       0.799         0.0663 0.809   0.492
#> 6 6 0.825           0.867       0.885         0.0997 0.926   0.710

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
#> GSM62248     2  0.4562      0.933 0.096 0.904
#> GSM62256     2  0.0000      0.934 0.000 1.000
#> GSM62259     2  0.4161      0.935 0.084 0.916
#> GSM62267     1  0.0000      0.999 1.000 0.000
#> GSM62280     1  0.0000      0.999 1.000 0.000
#> GSM62284     1  0.0000      0.999 1.000 0.000
#> GSM62289     2  0.4939      0.921 0.108 0.892
#> GSM62307     2  0.0000      0.934 0.000 1.000
#> GSM62316     2  0.0938      0.938 0.012 0.988
#> GSM62254     2  0.5408      0.922 0.124 0.876
#> GSM62292     2  0.5408      0.922 0.124 0.876
#> GSM62253     1  0.0000      0.999 1.000 0.000
#> GSM62270     1  0.0000      0.999 1.000 0.000
#> GSM62278     1  0.0000      0.999 1.000 0.000
#> GSM62297     2  0.5842      0.909 0.140 0.860
#> GSM62298     2  0.0000      0.934 0.000 1.000
#> GSM62299     2  0.2603      0.940 0.044 0.956
#> GSM62258     1  0.0000      0.999 1.000 0.000
#> GSM62281     2  0.0938      0.938 0.012 0.988
#> GSM62294     2  0.5408      0.922 0.124 0.876
#> GSM62305     2  0.6148      0.903 0.152 0.848
#> GSM62306     2  0.2236      0.934 0.036 0.964
#> GSM62310     2  0.0938      0.938 0.012 0.988
#> GSM62311     2  0.0000      0.934 0.000 1.000
#> GSM62317     2  0.4690      0.932 0.100 0.900
#> GSM62318     1  0.0000      0.999 1.000 0.000
#> GSM62321     2  0.6531      0.890 0.168 0.832
#> GSM62322     1  0.0000      0.999 1.000 0.000
#> GSM62250     2  0.6247      0.898 0.156 0.844
#> GSM62252     2  0.6623      0.884 0.172 0.828
#> GSM62255     2  0.0000      0.934 0.000 1.000
#> GSM62257     2  0.0376      0.936 0.004 0.996
#> GSM62260     1  0.1633      0.972 0.976 0.024
#> GSM62261     2  0.5519      0.917 0.128 0.872
#> GSM62262     2  0.4562      0.934 0.096 0.904
#> GSM62264     1  0.0000      0.999 1.000 0.000
#> GSM62268     1  0.0000      0.999 1.000 0.000
#> GSM62269     1  0.0000      0.999 1.000 0.000
#> GSM62271     1  0.0000      0.999 1.000 0.000
#> GSM62272     1  0.0000      0.999 1.000 0.000
#> GSM62273     2  0.5294      0.924 0.120 0.880
#> GSM62274     1  0.0000      0.999 1.000 0.000
#> GSM62275     1  0.0000      0.999 1.000 0.000
#> GSM62276     1  0.0000      0.999 1.000 0.000
#> GSM62277     1  0.0000      0.999 1.000 0.000
#> GSM62279     1  0.0000      0.999 1.000 0.000
#> GSM62282     1  0.0000      0.999 1.000 0.000
#> GSM62283     1  0.0000      0.999 1.000 0.000
#> GSM62286     2  0.6438      0.892 0.164 0.836
#> GSM62287     2  0.4690      0.932 0.100 0.900
#> GSM62288     2  0.2423      0.940 0.040 0.960
#> GSM62290     2  0.0938      0.938 0.012 0.988
#> GSM62293     2  0.5408      0.922 0.124 0.876
#> GSM62301     2  0.0000      0.934 0.000 1.000
#> GSM62302     2  0.0938      0.938 0.012 0.988
#> GSM62303     2  0.0000      0.934 0.000 1.000
#> GSM62304     2  0.0000      0.934 0.000 1.000
#> GSM62312     2  0.3584      0.938 0.068 0.932
#> GSM62313     2  0.0000      0.934 0.000 1.000
#> GSM62314     2  0.4690      0.932 0.100 0.900
#> GSM62319     2  0.5519      0.920 0.128 0.872
#> GSM62320     2  0.0000      0.934 0.000 1.000
#> GSM62249     2  0.6531      0.888 0.168 0.832
#> GSM62251     1  0.0000      0.999 1.000 0.000
#> GSM62263     2  0.6973      0.871 0.188 0.812
#> GSM62285     2  0.0000      0.934 0.000 1.000
#> GSM62315     2  0.0000      0.934 0.000 1.000
#> GSM62291     2  0.4690      0.932 0.100 0.900
#> GSM62265     1  0.0000      0.999 1.000 0.000
#> GSM62266     1  0.0000      0.999 1.000 0.000
#> GSM62296     2  0.2236      0.940 0.036 0.964
#> GSM62309     2  0.0938      0.938 0.012 0.988
#> GSM62295     2  0.5408      0.922 0.124 0.876
#> GSM62300     2  0.0000      0.934 0.000 1.000
#> GSM62308     2  0.0938      0.938 0.012 0.988

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.3896      0.877 0.060 0.888 0.052
#> GSM62256     2  0.2356      0.891 0.072 0.928 0.000
#> GSM62259     2  0.2998      0.892 0.068 0.916 0.016
#> GSM62267     1  0.4605      0.968 0.796 0.000 0.204
#> GSM62280     1  0.4605      0.968 0.796 0.000 0.204
#> GSM62284     3  0.0892      0.937 0.020 0.000 0.980
#> GSM62289     2  0.7424      0.440 0.388 0.572 0.040
#> GSM62307     2  0.3116      0.876 0.108 0.892 0.000
#> GSM62316     2  0.1964      0.891 0.056 0.944 0.000
#> GSM62254     2  0.3045      0.891 0.064 0.916 0.020
#> GSM62292     2  0.3181      0.891 0.064 0.912 0.024
#> GSM62253     3  0.1411      0.932 0.036 0.000 0.964
#> GSM62270     3  0.0000      0.938 0.000 0.000 1.000
#> GSM62278     3  0.0424      0.937 0.008 0.000 0.992
#> GSM62297     2  0.3683      0.881 0.060 0.896 0.044
#> GSM62298     2  0.1964      0.892 0.056 0.944 0.000
#> GSM62299     2  0.1989      0.894 0.048 0.948 0.004
#> GSM62258     1  0.4605      0.968 0.796 0.000 0.204
#> GSM62281     2  0.1860      0.891 0.052 0.948 0.000
#> GSM62294     2  0.2998      0.892 0.068 0.916 0.016
#> GSM62305     2  0.4887      0.858 0.096 0.844 0.060
#> GSM62306     2  0.2866      0.885 0.076 0.916 0.008
#> GSM62310     2  0.2066      0.893 0.060 0.940 0.000
#> GSM62311     2  0.3116      0.871 0.108 0.892 0.000
#> GSM62317     2  0.3045      0.892 0.064 0.916 0.020
#> GSM62318     3  0.6274     -0.149 0.456 0.000 0.544
#> GSM62321     2  0.8465      0.355 0.376 0.528 0.096
#> GSM62322     3  0.0000      0.938 0.000 0.000 1.000
#> GSM62250     2  0.7490      0.455 0.380 0.576 0.044
#> GSM62252     2  0.7878      0.389 0.392 0.548 0.060
#> GSM62255     2  0.3038      0.872 0.104 0.896 0.000
#> GSM62257     2  0.2261      0.884 0.068 0.932 0.000
#> GSM62260     1  0.5239      0.917 0.808 0.032 0.160
#> GSM62261     2  0.3253      0.888 0.052 0.912 0.036
#> GSM62262     2  0.2998      0.892 0.068 0.916 0.016
#> GSM62264     1  0.4796      0.933 0.780 0.000 0.220
#> GSM62268     3  0.1289      0.933 0.032 0.000 0.968
#> GSM62269     3  0.0000      0.938 0.000 0.000 1.000
#> GSM62271     1  0.4605      0.968 0.796 0.000 0.204
#> GSM62272     3  0.0000      0.938 0.000 0.000 1.000
#> GSM62273     2  0.3045      0.891 0.064 0.916 0.020
#> GSM62274     3  0.1163      0.935 0.028 0.000 0.972
#> GSM62275     3  0.0000      0.938 0.000 0.000 1.000
#> GSM62276     1  0.4605      0.968 0.796 0.000 0.204
#> GSM62277     3  0.0892      0.936 0.020 0.000 0.980
#> GSM62279     3  0.1163      0.935 0.028 0.000 0.972
#> GSM62282     1  0.4605      0.968 0.796 0.000 0.204
#> GSM62283     1  0.4861      0.959 0.800 0.008 0.192
#> GSM62286     2  0.7138      0.587 0.312 0.644 0.044
#> GSM62287     2  0.2939      0.892 0.072 0.916 0.012
#> GSM62288     2  0.3134      0.893 0.052 0.916 0.032
#> GSM62290     2  0.1964      0.893 0.056 0.944 0.000
#> GSM62293     2  0.3181      0.891 0.064 0.912 0.024
#> GSM62301     2  0.3038      0.876 0.104 0.896 0.000
#> GSM62302     2  0.1031      0.894 0.024 0.976 0.000
#> GSM62303     2  0.1643      0.893 0.044 0.956 0.000
#> GSM62304     2  0.3116      0.876 0.108 0.892 0.000
#> GSM62312     2  0.2550      0.895 0.056 0.932 0.012
#> GSM62313     2  0.3116      0.871 0.108 0.892 0.000
#> GSM62314     2  0.3045      0.892 0.064 0.916 0.020
#> GSM62319     2  0.4087      0.879 0.068 0.880 0.052
#> GSM62320     2  0.2959      0.873 0.100 0.900 0.000
#> GSM62249     2  0.8046      0.348 0.396 0.536 0.068
#> GSM62251     1  0.4750      0.941 0.784 0.000 0.216
#> GSM62263     2  0.4802      0.818 0.020 0.824 0.156
#> GSM62285     2  0.3038      0.871 0.104 0.896 0.000
#> GSM62315     2  0.3412      0.875 0.124 0.876 0.000
#> GSM62291     2  0.3083      0.892 0.060 0.916 0.024
#> GSM62265     1  0.4654      0.953 0.792 0.000 0.208
#> GSM62266     1  0.4796      0.933 0.780 0.000 0.220
#> GSM62296     2  0.2400      0.894 0.064 0.932 0.004
#> GSM62309     2  0.2066      0.892 0.060 0.940 0.000
#> GSM62295     2  0.3310      0.891 0.064 0.908 0.028
#> GSM62300     2  0.1031      0.895 0.024 0.976 0.000
#> GSM62308     2  0.2066      0.892 0.060 0.940 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM62248     4  0.5609    0.82146 0.068 0.176 0.016 0.740
#> GSM62256     4  0.4072    0.77932 0.000 0.252 0.000 0.748
#> GSM62259     2  0.5376    0.39246 0.016 0.588 0.000 0.396
#> GSM62267     1  0.2255    0.91416 0.920 0.000 0.068 0.012
#> GSM62280     1  0.2255    0.91416 0.920 0.000 0.068 0.012
#> GSM62284     3  0.4039    0.76409 0.084 0.000 0.836 0.080
#> GSM62289     4  0.5275    0.81073 0.120 0.088 0.016 0.776
#> GSM62307     2  0.1042    0.74179 0.020 0.972 0.000 0.008
#> GSM62316     4  0.4535    0.78953 0.016 0.240 0.000 0.744
#> GSM62254     2  0.5843    0.38704 0.028 0.568 0.004 0.400
#> GSM62292     2  0.5837    0.37970 0.036 0.564 0.000 0.400
#> GSM62253     3  0.4150    0.74340 0.056 0.000 0.824 0.120
#> GSM62270     3  0.1792    0.75582 0.068 0.000 0.932 0.000
#> GSM62278     3  0.2888    0.75832 0.124 0.000 0.872 0.004
#> GSM62297     2  0.3289    0.72981 0.012 0.864 0.004 0.120
#> GSM62298     2  0.1305    0.75158 0.004 0.960 0.000 0.036
#> GSM62299     2  0.2466    0.74238 0.004 0.900 0.000 0.096
#> GSM62258     1  0.2255    0.91416 0.920 0.000 0.068 0.012
#> GSM62281     4  0.4328    0.77511 0.008 0.244 0.000 0.748
#> GSM62294     2  0.5837    0.37970 0.036 0.564 0.000 0.400
#> GSM62305     4  0.4755    0.81500 0.024 0.192 0.012 0.772
#> GSM62306     4  0.4098    0.80199 0.012 0.204 0.000 0.784
#> GSM62310     2  0.1256    0.74952 0.008 0.964 0.000 0.028
#> GSM62311     2  0.1297    0.74014 0.020 0.964 0.000 0.016
#> GSM62317     2  0.2256    0.74662 0.020 0.924 0.000 0.056
#> GSM62318     3  0.7393    0.25949 0.400 0.000 0.436 0.164
#> GSM62321     4  0.5845    0.79153 0.136 0.080 0.036 0.748
#> GSM62322     3  0.1792    0.75582 0.068 0.000 0.932 0.000
#> GSM62250     4  0.4914    0.82418 0.084 0.116 0.008 0.792
#> GSM62252     4  0.5127    0.80155 0.132 0.084 0.008 0.776
#> GSM62255     2  0.1297    0.74014 0.020 0.964 0.000 0.016
#> GSM62257     2  0.1398    0.74611 0.004 0.956 0.000 0.040
#> GSM62260     1  0.4967    0.78498 0.808 0.036 0.068 0.088
#> GSM62261     2  0.3113    0.73217 0.012 0.876 0.004 0.108
#> GSM62262     2  0.5746    0.38944 0.032 0.572 0.000 0.396
#> GSM62264     3  0.7349    0.25411 0.384 0.000 0.456 0.160
#> GSM62268     3  0.4758    0.72227 0.064 0.000 0.780 0.156
#> GSM62269     3  0.1792    0.75582 0.068 0.000 0.932 0.000
#> GSM62271     1  0.2300    0.91326 0.920 0.000 0.064 0.016
#> GSM62272     3  0.1474    0.75985 0.052 0.000 0.948 0.000
#> GSM62273     2  0.5937    0.37326 0.032 0.560 0.004 0.404
#> GSM62274     3  0.2489    0.76802 0.068 0.000 0.912 0.020
#> GSM62275     3  0.1792    0.75582 0.068 0.000 0.932 0.000
#> GSM62276     1  0.2300    0.91326 0.920 0.000 0.064 0.016
#> GSM62277     3  0.2611    0.76757 0.096 0.000 0.896 0.008
#> GSM62279     3  0.4292    0.75075 0.080 0.000 0.820 0.100
#> GSM62282     1  0.2255    0.91416 0.920 0.000 0.068 0.012
#> GSM62283     1  0.3465    0.87595 0.880 0.028 0.072 0.020
#> GSM62286     4  0.4666    0.82728 0.052 0.152 0.004 0.792
#> GSM62287     2  0.5638    0.39458 0.028 0.584 0.000 0.388
#> GSM62288     2  0.5614   -0.00444 0.008 0.568 0.012 0.412
#> GSM62290     2  0.1545    0.74936 0.008 0.952 0.000 0.040
#> GSM62293     2  0.5837    0.37970 0.036 0.564 0.000 0.400
#> GSM62301     2  0.1174    0.74242 0.020 0.968 0.000 0.012
#> GSM62302     2  0.1824    0.75005 0.004 0.936 0.000 0.060
#> GSM62303     2  0.1209    0.75143 0.004 0.964 0.000 0.032
#> GSM62304     2  0.1042    0.74179 0.020 0.972 0.000 0.008
#> GSM62312     2  0.2530    0.74079 0.004 0.896 0.000 0.100
#> GSM62313     2  0.1297    0.74014 0.020 0.964 0.000 0.016
#> GSM62314     2  0.2521    0.74480 0.020 0.916 0.004 0.060
#> GSM62319     2  0.6469    0.34261 0.036 0.540 0.020 0.404
#> GSM62320     2  0.1297    0.74014 0.020 0.964 0.000 0.016
#> GSM62249     4  0.5430    0.74949 0.160 0.056 0.024 0.760
#> GSM62251     3  0.7276    0.20798 0.404 0.000 0.448 0.148
#> GSM62263     4  0.8070    0.06880 0.048 0.112 0.400 0.440
#> GSM62285     2  0.1297    0.74014 0.020 0.964 0.000 0.016
#> GSM62315     2  0.0895    0.74061 0.020 0.976 0.000 0.004
#> GSM62291     2  0.2707    0.74289 0.016 0.908 0.008 0.068
#> GSM62265     1  0.6009    0.43739 0.632 0.020 0.320 0.028
#> GSM62266     3  0.7349    0.25411 0.384 0.000 0.456 0.160
#> GSM62296     2  0.5496    0.40797 0.024 0.604 0.000 0.372
#> GSM62309     4  0.4295    0.78510 0.008 0.240 0.000 0.752
#> GSM62295     2  0.5837    0.37970 0.036 0.564 0.000 0.400
#> GSM62300     2  0.2593    0.73072 0.004 0.892 0.000 0.104
#> GSM62308     2  0.5300    0.36233 0.012 0.580 0.000 0.408

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     4  0.6234      0.681 0.056 0.320 0.044 0.576 0.004
#> GSM62256     4  0.5403      0.664 0.016 0.368 0.036 0.580 0.000
#> GSM62259     4  0.5445      0.666 0.028 0.352 0.020 0.596 0.004
#> GSM62267     1  0.2793      0.918 0.876 0.000 0.036 0.000 0.088
#> GSM62280     1  0.2793      0.918 0.876 0.000 0.036 0.000 0.088
#> GSM62284     5  0.1310      0.880 0.024 0.000 0.020 0.000 0.956
#> GSM62289     4  0.6305      0.527 0.344 0.076 0.028 0.548 0.004
#> GSM62307     2  0.2890      0.743 0.000 0.836 0.004 0.160 0.000
#> GSM62316     4  0.5734      0.666 0.028 0.352 0.044 0.576 0.000
#> GSM62254     4  0.5585      0.690 0.036 0.308 0.028 0.624 0.004
#> GSM62292     4  0.2433      0.598 0.024 0.024 0.032 0.916 0.004
#> GSM62253     5  0.0000      0.887 0.000 0.000 0.000 0.000 1.000
#> GSM62270     3  0.1892      0.895 0.004 0.000 0.916 0.000 0.080
#> GSM62278     3  0.3319      0.836 0.020 0.000 0.820 0.000 0.160
#> GSM62297     2  0.3336      0.877 0.044 0.864 0.008 0.076 0.008
#> GSM62298     2  0.1502      0.907 0.004 0.940 0.000 0.056 0.000
#> GSM62299     2  0.2284      0.900 0.028 0.912 0.004 0.056 0.000
#> GSM62258     1  0.2793      0.918 0.876 0.000 0.036 0.000 0.088
#> GSM62281     4  0.5643      0.674 0.028 0.344 0.040 0.588 0.000
#> GSM62294     4  0.2074      0.612 0.004 0.032 0.032 0.928 0.004
#> GSM62305     4  0.6253      0.689 0.068 0.316 0.036 0.576 0.004
#> GSM62306     4  0.5588      0.673 0.028 0.348 0.036 0.588 0.000
#> GSM62310     2  0.1772      0.906 0.020 0.940 0.008 0.032 0.000
#> GSM62311     2  0.0324      0.909 0.004 0.992 0.000 0.004 0.000
#> GSM62317     2  0.3005      0.889 0.052 0.884 0.012 0.048 0.004
#> GSM62318     5  0.1408      0.877 0.044 0.000 0.008 0.000 0.948
#> GSM62321     4  0.6344      0.540 0.332 0.060 0.032 0.564 0.012
#> GSM62322     3  0.1892      0.895 0.004 0.000 0.916 0.000 0.080
#> GSM62250     4  0.6454      0.569 0.304 0.076 0.032 0.576 0.012
#> GSM62252     4  0.6582      0.522 0.320 0.056 0.032 0.564 0.028
#> GSM62255     2  0.0324      0.909 0.004 0.992 0.000 0.004 0.000
#> GSM62257     2  0.0898      0.911 0.008 0.972 0.000 0.020 0.000
#> GSM62260     1  0.5650      0.583 0.688 0.024 0.012 0.208 0.068
#> GSM62261     2  0.2568      0.892 0.036 0.908 0.008 0.040 0.008
#> GSM62262     4  0.3210      0.645 0.008 0.092 0.032 0.864 0.004
#> GSM62264     5  0.0771      0.888 0.020 0.000 0.000 0.004 0.976
#> GSM62268     5  0.0162      0.888 0.004 0.000 0.000 0.000 0.996
#> GSM62269     3  0.1892      0.895 0.004 0.000 0.916 0.000 0.080
#> GSM62271     1  0.2793      0.918 0.876 0.000 0.036 0.000 0.088
#> GSM62272     3  0.2068      0.891 0.004 0.000 0.904 0.000 0.092
#> GSM62273     4  0.5183      0.705 0.036 0.224 0.032 0.704 0.004
#> GSM62274     3  0.4971      0.258 0.020 0.000 0.504 0.004 0.472
#> GSM62275     3  0.1892      0.895 0.004 0.000 0.916 0.000 0.080
#> GSM62276     1  0.2793      0.918 0.876 0.000 0.036 0.000 0.088
#> GSM62277     3  0.3304      0.842 0.016 0.000 0.816 0.000 0.168
#> GSM62279     5  0.2787      0.798 0.028 0.000 0.088 0.004 0.880
#> GSM62282     1  0.2959      0.907 0.864 0.000 0.036 0.000 0.100
#> GSM62283     1  0.3183      0.897 0.868 0.012 0.020 0.008 0.092
#> GSM62286     4  0.6516      0.597 0.280 0.096 0.028 0.584 0.012
#> GSM62287     4  0.4937      0.698 0.012 0.292 0.032 0.664 0.000
#> GSM62288     2  0.3530      0.844 0.024 0.844 0.028 0.104 0.000
#> GSM62290     2  0.2321      0.899 0.024 0.912 0.008 0.056 0.000
#> GSM62293     4  0.2522      0.596 0.028 0.024 0.032 0.912 0.004
#> GSM62301     2  0.0451      0.909 0.008 0.988 0.000 0.004 0.000
#> GSM62302     2  0.2050      0.904 0.008 0.920 0.008 0.064 0.000
#> GSM62303     2  0.1704      0.902 0.004 0.928 0.000 0.068 0.000
#> GSM62304     2  0.2848      0.750 0.000 0.840 0.004 0.156 0.000
#> GSM62312     2  0.1981      0.903 0.028 0.924 0.000 0.048 0.000
#> GSM62313     2  0.0324      0.909 0.004 0.992 0.000 0.004 0.000
#> GSM62314     2  0.3005      0.889 0.052 0.884 0.012 0.048 0.004
#> GSM62319     4  0.5765      0.699 0.036 0.296 0.016 0.628 0.024
#> GSM62320     2  0.0162      0.909 0.000 0.996 0.000 0.004 0.000
#> GSM62249     4  0.6689      0.424 0.372 0.044 0.032 0.516 0.036
#> GSM62251     5  0.1282      0.881 0.044 0.000 0.000 0.004 0.952
#> GSM62263     5  0.5880      0.413 0.048 0.296 0.004 0.036 0.616
#> GSM62285     2  0.0324      0.909 0.004 0.992 0.000 0.004 0.000
#> GSM62315     2  0.0451      0.909 0.008 0.988 0.000 0.004 0.000
#> GSM62291     2  0.3279      0.881 0.052 0.868 0.012 0.064 0.004
#> GSM62265     1  0.4134      0.723 0.720 0.008 0.008 0.000 0.264
#> GSM62266     5  0.0451      0.888 0.008 0.000 0.004 0.000 0.988
#> GSM62296     4  0.4871      0.655 0.004 0.368 0.024 0.604 0.000
#> GSM62309     4  0.5782      0.669 0.032 0.344 0.044 0.580 0.000
#> GSM62295     4  0.2522      0.596 0.028 0.024 0.032 0.912 0.004
#> GSM62300     2  0.4081      0.450 0.004 0.696 0.004 0.296 0.000
#> GSM62308     4  0.4994      0.655 0.020 0.364 0.012 0.604 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
#> GSM62248     5  0.2781      0.825 0.004 0.008 0.052 0.020 0.888 0.028
#> GSM62256     5  0.2686      0.829 0.000 0.024 0.008 0.100 0.868 0.000
#> GSM62259     5  0.6900      0.176 0.004 0.292 0.028 0.232 0.432 0.012
#> GSM62267     6  0.1405      0.956 0.024 0.004 0.024 0.000 0.000 0.948
#> GSM62280     6  0.1401      0.954 0.028 0.004 0.020 0.000 0.000 0.948
#> GSM62284     1  0.1765      0.882 0.924 0.000 0.024 0.000 0.000 0.052
#> GSM62289     5  0.1767      0.849 0.000 0.036 0.000 0.020 0.932 0.012
#> GSM62307     4  0.0508      0.942 0.000 0.004 0.000 0.984 0.012 0.000
#> GSM62316     5  0.2695      0.832 0.000 0.012 0.020 0.072 0.884 0.012
#> GSM62254     2  0.2595      0.908 0.004 0.900 0.028 0.016 0.040 0.012
#> GSM62292     2  0.0767      0.912 0.000 0.976 0.000 0.004 0.012 0.008
#> GSM62253     1  0.0837      0.886 0.972 0.000 0.004 0.000 0.004 0.020
#> GSM62270     3  0.1572      0.957 0.028 0.000 0.936 0.000 0.000 0.036
#> GSM62278     3  0.2745      0.919 0.068 0.000 0.864 0.000 0.000 0.068
#> GSM62297     4  0.3472      0.891 0.004 0.032 0.008 0.832 0.112 0.012
#> GSM62298     4  0.1716      0.934 0.004 0.036 0.000 0.932 0.028 0.000
#> GSM62299     4  0.2545      0.915 0.004 0.020 0.008 0.884 0.084 0.000
#> GSM62258     6  0.1434      0.953 0.024 0.008 0.020 0.000 0.000 0.948
#> GSM62281     5  0.2880      0.832 0.000 0.016 0.020 0.072 0.876 0.016
#> GSM62294     2  0.1049      0.914 0.000 0.960 0.000 0.008 0.032 0.000
#> GSM62305     5  0.2471      0.846 0.008 0.032 0.008 0.024 0.908 0.020
#> GSM62306     5  0.2307      0.841 0.004 0.032 0.000 0.068 0.896 0.000
#> GSM62310     4  0.2107      0.930 0.000 0.008 0.024 0.920 0.036 0.012
#> GSM62311     4  0.0551      0.940 0.004 0.008 0.000 0.984 0.000 0.004
#> GSM62317     4  0.3440      0.904 0.008 0.012 0.048 0.856 0.048 0.028
#> GSM62318     1  0.2006      0.873 0.904 0.000 0.016 0.000 0.000 0.080
#> GSM62321     5  0.2714      0.844 0.008 0.040 0.004 0.016 0.892 0.040
#> GSM62322     3  0.1572      0.957 0.028 0.000 0.936 0.000 0.000 0.036
#> GSM62250     5  0.2274      0.840 0.004 0.028 0.008 0.016 0.916 0.028
#> GSM62252     5  0.2615      0.834 0.012 0.028 0.008 0.012 0.900 0.040
#> GSM62255     4  0.0291      0.941 0.004 0.000 0.000 0.992 0.000 0.004
#> GSM62257     4  0.0260      0.942 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM62260     5  0.6597      0.191 0.256 0.024 0.004 0.004 0.468 0.244
#> GSM62261     4  0.2951      0.901 0.004 0.020 0.008 0.868 0.088 0.012
#> GSM62262     2  0.1572      0.911 0.000 0.936 0.000 0.036 0.028 0.000
#> GSM62264     1  0.0870      0.879 0.972 0.000 0.004 0.000 0.012 0.012
#> GSM62268     1  0.0806      0.887 0.972 0.000 0.008 0.000 0.000 0.020
#> GSM62269     3  0.1649      0.957 0.032 0.000 0.932 0.000 0.000 0.036
#> GSM62271     6  0.1405      0.956 0.024 0.004 0.024 0.000 0.000 0.948
#> GSM62272     3  0.1895      0.942 0.072 0.000 0.912 0.000 0.000 0.016
#> GSM62273     2  0.2650      0.908 0.004 0.896 0.028 0.020 0.044 0.008
#> GSM62274     1  0.3373      0.785 0.816 0.000 0.140 0.000 0.012 0.032
#> GSM62275     3  0.1572      0.957 0.028 0.000 0.936 0.000 0.000 0.036
#> GSM62276     6  0.1405      0.956 0.024 0.004 0.024 0.000 0.000 0.948
#> GSM62277     3  0.2930      0.894 0.124 0.000 0.840 0.000 0.000 0.036
#> GSM62279     1  0.2045      0.881 0.916 0.000 0.016 0.000 0.016 0.052
#> GSM62282     6  0.1777      0.940 0.044 0.004 0.024 0.000 0.000 0.928
#> GSM62283     6  0.3776      0.737 0.188 0.008 0.004 0.008 0.016 0.776
#> GSM62286     5  0.2391      0.844 0.004 0.044 0.008 0.024 0.908 0.012
#> GSM62287     2  0.2442      0.890 0.000 0.884 0.000 0.068 0.048 0.000
#> GSM62288     4  0.2918      0.906 0.004 0.020 0.004 0.856 0.112 0.004
#> GSM62290     4  0.2635      0.920 0.000 0.016 0.024 0.892 0.056 0.012
#> GSM62293     2  0.0520      0.907 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM62301     4  0.0291      0.941 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM62302     4  0.2296      0.927 0.000 0.020 0.012 0.908 0.052 0.008
#> GSM62303     4  0.1498      0.933 0.000 0.032 0.000 0.940 0.028 0.000
#> GSM62304     4  0.0291      0.941 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM62312     4  0.2508      0.911 0.004 0.012 0.008 0.888 0.084 0.004
#> GSM62313     4  0.0405      0.940 0.000 0.008 0.000 0.988 0.000 0.004
#> GSM62314     4  0.3603      0.901 0.012 0.012 0.048 0.848 0.052 0.028
#> GSM62319     2  0.4346      0.802 0.016 0.784 0.032 0.016 0.132 0.020
#> GSM62320     4  0.0000      0.940 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM62249     5  0.2777      0.830 0.024 0.028 0.008 0.008 0.892 0.040
#> GSM62251     1  0.1367      0.879 0.944 0.000 0.000 0.000 0.012 0.044
#> GSM62263     1  0.5553      0.597 0.684 0.016 0.008 0.180 0.064 0.048
#> GSM62285     4  0.0665      0.940 0.004 0.008 0.000 0.980 0.000 0.008
#> GSM62315     4  0.0767      0.940 0.004 0.012 0.000 0.976 0.000 0.008
#> GSM62291     4  0.4016      0.893 0.012 0.020 0.048 0.824 0.068 0.028
#> GSM62265     1  0.3772      0.569 0.672 0.000 0.004 0.000 0.004 0.320
#> GSM62266     1  0.0777      0.887 0.972 0.000 0.004 0.000 0.000 0.024
#> GSM62296     2  0.3139      0.808 0.000 0.812 0.000 0.160 0.028 0.000
#> GSM62309     5  0.2580      0.835 0.000 0.012 0.020 0.064 0.892 0.012
#> GSM62295     2  0.0520      0.907 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM62300     4  0.1498      0.932 0.000 0.032 0.000 0.940 0.028 0.000
#> GSM62308     5  0.4592      0.699 0.000 0.060 0.020 0.180 0.732 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-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) other(p) genotype/variation(p) k
#> ATC:mclust 75            0.590    0.935                 0.748 2
#> ATC:mclust 69            0.200    0.843                 0.642 3
#> ATC:mclust 56            0.288    0.172                 0.375 4
#> ATC:mclust 71            0.707    0.773                 0.389 5
#> ATC:mclust 73            0.326    0.450                 0.104 6

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


ATC:NMF**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 21168 rows and 75 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 1.000           0.989       0.995         0.4439 0.559   0.559
#> 3 3 0.807           0.898       0.939         0.1915 0.921   0.861
#> 4 4 0.692           0.777       0.886         0.2421 0.790   0.593
#> 5 5 0.612           0.649       0.812         0.0921 0.856   0.625
#> 6 6 0.593           0.587       0.778         0.0402 0.994   0.980

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
#> GSM62248     2  0.0000      0.994 0.000 1.000
#> GSM62256     2  0.0000      0.994 0.000 1.000
#> GSM62259     2  0.0000      0.994 0.000 1.000
#> GSM62267     1  0.0000      0.997 1.000 0.000
#> GSM62280     1  0.0000      0.997 1.000 0.000
#> GSM62284     1  0.0000      0.997 1.000 0.000
#> GSM62289     2  0.0000      0.994 0.000 1.000
#> GSM62307     2  0.0000      0.994 0.000 1.000
#> GSM62316     2  0.0000      0.994 0.000 1.000
#> GSM62254     2  0.0000      0.994 0.000 1.000
#> GSM62292     2  0.0000      0.994 0.000 1.000
#> GSM62253     1  0.0000      0.997 1.000 0.000
#> GSM62270     1  0.0000      0.997 1.000 0.000
#> GSM62278     1  0.0000      0.997 1.000 0.000
#> GSM62297     2  0.0000      0.994 0.000 1.000
#> GSM62298     2  0.0000      0.994 0.000 1.000
#> GSM62299     2  0.0000      0.994 0.000 1.000
#> GSM62258     1  0.0000      0.997 1.000 0.000
#> GSM62281     2  0.0000      0.994 0.000 1.000
#> GSM62294     2  0.0000      0.994 0.000 1.000
#> GSM62305     2  0.0000      0.994 0.000 1.000
#> GSM62306     2  0.0000      0.994 0.000 1.000
#> GSM62310     2  0.0000      0.994 0.000 1.000
#> GSM62311     2  0.0000      0.994 0.000 1.000
#> GSM62317     2  0.0000      0.994 0.000 1.000
#> GSM62318     1  0.0000      0.997 1.000 0.000
#> GSM62321     2  0.0000      0.994 0.000 1.000
#> GSM62322     1  0.0000      0.997 1.000 0.000
#> GSM62250     2  0.0000      0.994 0.000 1.000
#> GSM62252     2  0.4939      0.878 0.108 0.892
#> GSM62255     2  0.0000      0.994 0.000 1.000
#> GSM62257     2  0.0000      0.994 0.000 1.000
#> GSM62260     1  0.3431      0.931 0.936 0.064
#> GSM62261     2  0.0000      0.994 0.000 1.000
#> GSM62262     2  0.0000      0.994 0.000 1.000
#> GSM62264     2  0.0376      0.990 0.004 0.996
#> GSM62268     1  0.0000      0.997 1.000 0.000
#> GSM62269     1  0.0000      0.997 1.000 0.000
#> GSM62271     1  0.0000      0.997 1.000 0.000
#> GSM62272     1  0.0000      0.997 1.000 0.000
#> GSM62273     2  0.0000      0.994 0.000 1.000
#> GSM62274     1  0.0000      0.997 1.000 0.000
#> GSM62275     1  0.0000      0.997 1.000 0.000
#> GSM62276     1  0.0000      0.997 1.000 0.000
#> GSM62277     1  0.0000      0.997 1.000 0.000
#> GSM62279     1  0.0000      0.997 1.000 0.000
#> GSM62282     1  0.0000      0.997 1.000 0.000
#> GSM62283     1  0.0000      0.997 1.000 0.000
#> GSM62286     2  0.0000      0.994 0.000 1.000
#> GSM62287     2  0.0000      0.994 0.000 1.000
#> GSM62288     2  0.0000      0.994 0.000 1.000
#> GSM62290     2  0.0000      0.994 0.000 1.000
#> GSM62293     2  0.0000      0.994 0.000 1.000
#> GSM62301     2  0.0000      0.994 0.000 1.000
#> GSM62302     2  0.0000      0.994 0.000 1.000
#> GSM62303     2  0.0000      0.994 0.000 1.000
#> GSM62304     2  0.0000      0.994 0.000 1.000
#> GSM62312     2  0.0000      0.994 0.000 1.000
#> GSM62313     2  0.0000      0.994 0.000 1.000
#> GSM62314     2  0.0000      0.994 0.000 1.000
#> GSM62319     2  0.7376      0.741 0.208 0.792
#> GSM62320     2  0.0000      0.994 0.000 1.000
#> GSM62249     2  0.0000      0.994 0.000 1.000
#> GSM62251     1  0.0376      0.993 0.996 0.004
#> GSM62263     2  0.0000      0.994 0.000 1.000
#> GSM62285     2  0.0000      0.994 0.000 1.000
#> GSM62315     2  0.0000      0.994 0.000 1.000
#> GSM62291     2  0.0000      0.994 0.000 1.000
#> GSM62265     1  0.0000      0.997 1.000 0.000
#> GSM62266     1  0.0000      0.997 1.000 0.000
#> GSM62296     2  0.0000      0.994 0.000 1.000
#> GSM62309     2  0.0000      0.994 0.000 1.000
#> GSM62295     2  0.0000      0.994 0.000 1.000
#> GSM62300     2  0.0000      0.994 0.000 1.000
#> GSM62308     2  0.0000      0.994 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM62248     2  0.3686      0.825 0.140 0.860 0.000
#> GSM62256     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62259     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62267     3  0.0000      0.908 0.000 0.000 1.000
#> GSM62280     3  0.1529      0.884 0.040 0.000 0.960
#> GSM62284     3  0.4178      0.819 0.172 0.000 0.828
#> GSM62289     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62307     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62316     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62254     2  0.2165      0.920 0.064 0.936 0.000
#> GSM62292     2  0.3607      0.879 0.112 0.880 0.008
#> GSM62253     1  0.3412      0.894 0.876 0.000 0.124
#> GSM62270     3  0.0424      0.905 0.008 0.000 0.992
#> GSM62278     3  0.1964      0.915 0.056 0.000 0.944
#> GSM62297     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62298     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62299     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62258     3  0.1753      0.916 0.048 0.000 0.952
#> GSM62281     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62294     2  0.3116      0.888 0.108 0.892 0.000
#> GSM62305     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62306     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62310     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62311     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62317     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62318     1  0.3412      0.894 0.876 0.000 0.124
#> GSM62321     2  0.0237      0.953 0.004 0.996 0.000
#> GSM62322     3  0.0424      0.905 0.008 0.000 0.992
#> GSM62250     2  0.1163      0.941 0.028 0.972 0.000
#> GSM62252     2  0.7412      0.643 0.112 0.696 0.192
#> GSM62255     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62257     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62260     3  0.5689      0.612 0.036 0.184 0.780
#> GSM62261     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62262     2  0.2878      0.897 0.096 0.904 0.000
#> GSM62264     1  0.3966      0.798 0.876 0.100 0.024
#> GSM62268     1  0.3551      0.888 0.868 0.000 0.132
#> GSM62269     3  0.2066      0.914 0.060 0.000 0.940
#> GSM62271     3  0.3340      0.811 0.120 0.000 0.880
#> GSM62272     3  0.2066      0.914 0.060 0.000 0.940
#> GSM62273     2  0.2625      0.906 0.084 0.916 0.000
#> GSM62274     3  0.2796      0.896 0.092 0.000 0.908
#> GSM62275     3  0.0424      0.910 0.008 0.000 0.992
#> GSM62276     3  0.2711      0.844 0.088 0.000 0.912
#> GSM62277     3  0.2165      0.913 0.064 0.000 0.936
#> GSM62279     3  0.3879      0.843 0.152 0.000 0.848
#> GSM62282     3  0.1643      0.916 0.044 0.000 0.956
#> GSM62283     3  0.2165      0.913 0.064 0.000 0.936
#> GSM62286     2  0.2959      0.895 0.100 0.900 0.000
#> GSM62287     2  0.1529      0.935 0.040 0.960 0.000
#> GSM62288     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62290     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62293     2  0.5428      0.815 0.120 0.816 0.064
#> GSM62301     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62302     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62303     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62304     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62312     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62313     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62314     2  0.4291      0.772 0.180 0.820 0.000
#> GSM62319     2  0.7537      0.436 0.056 0.612 0.332
#> GSM62320     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62249     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62251     1  0.3412      0.894 0.876 0.000 0.124
#> GSM62263     1  0.5254      0.590 0.736 0.264 0.000
#> GSM62285     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62315     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62291     2  0.0237      0.953 0.004 0.996 0.000
#> GSM62265     1  0.4002      0.860 0.840 0.000 0.160
#> GSM62266     1  0.3412      0.894 0.876 0.000 0.124
#> GSM62296     2  0.1289      0.939 0.032 0.968 0.000
#> GSM62309     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62295     2  0.6317      0.761 0.124 0.772 0.104
#> GSM62300     2  0.0000      0.955 0.000 1.000 0.000
#> GSM62308     2  0.0000      0.955 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
#> GSM62248     1  0.6347      0.274 0.524 0.412 0.000 0.064
#> GSM62256     2  0.3610      0.741 0.000 0.800 0.000 0.200
#> GSM62259     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62267     3  0.1022      0.872 0.000 0.000 0.968 0.032
#> GSM62280     4  0.4500      0.569 0.000 0.000 0.316 0.684
#> GSM62284     3  0.4049      0.727 0.212 0.000 0.780 0.008
#> GSM62289     4  0.1913      0.655 0.040 0.020 0.000 0.940
#> GSM62307     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62316     2  0.3907      0.723 0.000 0.768 0.000 0.232
#> GSM62254     2  0.0188      0.930 0.000 0.996 0.000 0.004
#> GSM62292     2  0.4776      0.352 0.000 0.624 0.000 0.376
#> GSM62253     1  0.0469      0.750 0.988 0.000 0.012 0.000
#> GSM62270     3  0.0336      0.886 0.000 0.000 0.992 0.008
#> GSM62278     3  0.0188      0.887 0.000 0.000 0.996 0.004
#> GSM62297     2  0.0188      0.930 0.000 0.996 0.000 0.004
#> GSM62298     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62299     2  0.0188      0.930 0.000 0.996 0.000 0.004
#> GSM62258     4  0.5000      0.192 0.000 0.000 0.496 0.504
#> GSM62281     4  0.4804      0.436 0.000 0.384 0.000 0.616
#> GSM62294     4  0.4193      0.623 0.000 0.268 0.000 0.732
#> GSM62305     2  0.3311      0.785 0.000 0.828 0.000 0.172
#> GSM62306     2  0.3219      0.802 0.000 0.836 0.000 0.164
#> GSM62310     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62311     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62317     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62318     1  0.2730      0.775 0.896 0.000 0.016 0.088
#> GSM62321     2  0.7133      0.189 0.148 0.520 0.000 0.332
#> GSM62322     3  0.0188      0.887 0.000 0.000 0.996 0.004
#> GSM62250     4  0.3219      0.664 0.000 0.164 0.000 0.836
#> GSM62252     4  0.3015      0.694 0.000 0.024 0.092 0.884
#> GSM62255     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62257     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62260     4  0.4479      0.612 0.056 0.020 0.096 0.828
#> GSM62261     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62262     2  0.1940      0.884 0.000 0.924 0.000 0.076
#> GSM62264     1  0.3610      0.783 0.800 0.000 0.000 0.200
#> GSM62268     1  0.2530      0.675 0.888 0.000 0.112 0.000
#> GSM62269     3  0.0804      0.883 0.012 0.000 0.980 0.008
#> GSM62271     4  0.4500      0.561 0.000 0.000 0.316 0.684
#> GSM62272     3  0.0804      0.883 0.012 0.000 0.980 0.008
#> GSM62273     2  0.2760      0.836 0.000 0.872 0.000 0.128
#> GSM62274     3  0.0188      0.887 0.000 0.000 0.996 0.004
#> GSM62275     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> GSM62276     4  0.4817      0.476 0.000 0.000 0.388 0.612
#> GSM62277     3  0.0469      0.885 0.000 0.000 0.988 0.012
#> GSM62279     3  0.3695      0.777 0.156 0.000 0.828 0.016
#> GSM62282     3  0.2704      0.774 0.000 0.000 0.876 0.124
#> GSM62283     4  0.1510      0.651 0.028 0.000 0.016 0.956
#> GSM62286     4  0.4540      0.679 0.000 0.196 0.032 0.772
#> GSM62287     2  0.2216      0.872 0.000 0.908 0.000 0.092
#> GSM62288     2  0.0188      0.929 0.000 0.996 0.000 0.004
#> GSM62290     2  0.0707      0.922 0.000 0.980 0.000 0.020
#> GSM62293     4  0.4072      0.638 0.000 0.252 0.000 0.748
#> GSM62301     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62302     2  0.0188      0.930 0.000 0.996 0.000 0.004
#> GSM62303     2  0.0469      0.926 0.000 0.988 0.000 0.012
#> GSM62304     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62312     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62313     2  0.0188      0.930 0.000 0.996 0.000 0.004
#> GSM62314     2  0.0188      0.929 0.004 0.996 0.000 0.000
#> GSM62319     3  0.5183      0.201 0.000 0.408 0.584 0.008
#> GSM62320     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62249     4  0.1610      0.656 0.032 0.016 0.000 0.952
#> GSM62251     1  0.3569      0.784 0.804 0.000 0.000 0.196
#> GSM62263     1  0.4253      0.610 0.776 0.208 0.000 0.016
#> GSM62285     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62315     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62291     2  0.0336      0.928 0.000 0.992 0.000 0.008
#> GSM62265     1  0.4253      0.774 0.776 0.000 0.016 0.208
#> GSM62266     1  0.3311      0.787 0.828 0.000 0.000 0.172
#> GSM62296     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62309     2  0.4134      0.646 0.000 0.740 0.000 0.260
#> GSM62295     4  0.5220      0.696 0.000 0.156 0.092 0.752
#> GSM62300     2  0.0000      0.931 0.000 1.000 0.000 0.000
#> GSM62308     2  0.2011      0.880 0.000 0.920 0.000 0.080

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM62248     2  0.6232     0.3121 0.288 0.584 0.000 0.028 0.100
#> GSM62256     5  0.4321     0.4899 0.000 0.396 0.000 0.004 0.600
#> GSM62259     2  0.4113     0.5849 0.000 0.740 0.000 0.028 0.232
#> GSM62267     3  0.1341     0.8004 0.000 0.000 0.944 0.056 0.000
#> GSM62280     3  0.6215     0.3899 0.000 0.000 0.508 0.156 0.336
#> GSM62284     3  0.4171     0.7323 0.108 0.000 0.804 0.072 0.016
#> GSM62289     5  0.6642     0.1558 0.148 0.016 0.000 0.356 0.480
#> GSM62307     2  0.2358     0.7826 0.000 0.888 0.000 0.008 0.104
#> GSM62316     2  0.6420    -0.0375 0.024 0.480 0.000 0.096 0.400
#> GSM62254     2  0.2011     0.7985 0.000 0.908 0.000 0.088 0.004
#> GSM62292     4  0.4738     0.3234 0.000 0.420 0.004 0.564 0.012
#> GSM62253     1  0.0579     0.8393 0.984 0.000 0.000 0.008 0.008
#> GSM62270     3  0.1197     0.8007 0.000 0.000 0.952 0.048 0.000
#> GSM62278     3  0.1638     0.7898 0.000 0.000 0.932 0.064 0.004
#> GSM62297     2  0.3307     0.7783 0.000 0.844 0.000 0.104 0.052
#> GSM62298     2  0.1270     0.8147 0.000 0.948 0.000 0.052 0.000
#> GSM62299     2  0.0671     0.8279 0.000 0.980 0.000 0.004 0.016
#> GSM62258     3  0.4708     0.3842 0.000 0.000 0.548 0.016 0.436
#> GSM62281     2  0.5334    -0.1023 0.000 0.512 0.000 0.436 0.052
#> GSM62294     4  0.4657     0.5790 0.000 0.296 0.000 0.668 0.036
#> GSM62305     5  0.5554     0.5097 0.004 0.264 0.000 0.100 0.632
#> GSM62306     5  0.4610     0.4860 0.000 0.388 0.000 0.016 0.596
#> GSM62310     2  0.0290     0.8266 0.000 0.992 0.000 0.008 0.000
#> GSM62311     2  0.0693     0.8284 0.000 0.980 0.000 0.008 0.012
#> GSM62317     2  0.0807     0.8274 0.000 0.976 0.000 0.012 0.012
#> GSM62318     1  0.6275     0.6340 0.652 0.000 0.112 0.072 0.164
#> GSM62321     5  0.4986     0.5020 0.008 0.368 0.000 0.024 0.600
#> GSM62322     3  0.1197     0.8007 0.000 0.000 0.952 0.048 0.000
#> GSM62250     5  0.6191     0.2006 0.000 0.164 0.000 0.308 0.528
#> GSM62252     4  0.4561     0.3931 0.004 0.016 0.044 0.764 0.172
#> GSM62255     2  0.1484     0.8191 0.000 0.944 0.000 0.008 0.048
#> GSM62257     2  0.1981     0.8128 0.000 0.920 0.000 0.016 0.064
#> GSM62260     5  0.1721     0.5006 0.016 0.020 0.000 0.020 0.944
#> GSM62261     2  0.1638     0.8126 0.000 0.932 0.000 0.004 0.064
#> GSM62262     2  0.4604     0.1209 0.000 0.560 0.000 0.428 0.012
#> GSM62264     1  0.2964     0.8354 0.856 0.000 0.000 0.024 0.120
#> GSM62268     1  0.1569     0.8248 0.944 0.000 0.044 0.008 0.004
#> GSM62269     3  0.2173     0.7873 0.016 0.000 0.920 0.052 0.012
#> GSM62271     3  0.5091     0.6229 0.000 0.000 0.672 0.244 0.084
#> GSM62272     3  0.2277     0.7860 0.016 0.000 0.916 0.052 0.016
#> GSM62273     2  0.3160     0.7109 0.000 0.808 0.000 0.188 0.004
#> GSM62274     3  0.1597     0.8014 0.012 0.000 0.940 0.048 0.000
#> GSM62275     3  0.0000     0.7992 0.000 0.000 1.000 0.000 0.000
#> GSM62276     3  0.5191     0.6299 0.000 0.000 0.684 0.124 0.192
#> GSM62277     3  0.2020     0.7919 0.000 0.000 0.900 0.100 0.000
#> GSM62279     3  0.6026     0.5566 0.192 0.000 0.652 0.120 0.036
#> GSM62282     3  0.3182     0.7549 0.000 0.000 0.844 0.124 0.032
#> GSM62283     5  0.4558     0.3785 0.040 0.000 0.008 0.224 0.728
#> GSM62286     4  0.5335     0.5965 0.000 0.128 0.028 0.720 0.124
#> GSM62287     2  0.3993     0.6771 0.000 0.756 0.000 0.216 0.028
#> GSM62288     2  0.1571     0.8142 0.000 0.936 0.000 0.004 0.060
#> GSM62290     2  0.3671     0.6478 0.000 0.756 0.000 0.236 0.008
#> GSM62293     4  0.3852     0.6636 0.000 0.168 0.028 0.796 0.008
#> GSM62301     2  0.0703     0.8261 0.000 0.976 0.000 0.000 0.024
#> GSM62302     2  0.1341     0.8142 0.000 0.944 0.000 0.056 0.000
#> GSM62303     2  0.2930     0.7329 0.000 0.832 0.000 0.164 0.004
#> GSM62304     2  0.1331     0.8217 0.000 0.952 0.000 0.008 0.040
#> GSM62312     2  0.1571     0.8133 0.000 0.936 0.000 0.004 0.060
#> GSM62313     2  0.0510     0.8287 0.000 0.984 0.000 0.016 0.000
#> GSM62314     2  0.0566     0.8256 0.004 0.984 0.000 0.012 0.000
#> GSM62319     3  0.7317     0.0693 0.000 0.244 0.496 0.204 0.056
#> GSM62320     2  0.0703     0.8261 0.000 0.976 0.000 0.000 0.024
#> GSM62249     5  0.4415     0.4604 0.048 0.020 0.000 0.156 0.776
#> GSM62251     1  0.2124     0.8427 0.900 0.000 0.000 0.004 0.096
#> GSM62263     1  0.3790     0.5063 0.744 0.248 0.000 0.004 0.004
#> GSM62285     2  0.0451     0.8272 0.000 0.988 0.000 0.008 0.004
#> GSM62315     2  0.0324     0.8273 0.000 0.992 0.000 0.004 0.004
#> GSM62291     2  0.4230     0.6644 0.036 0.764 0.000 0.192 0.008
#> GSM62265     1  0.2771     0.8274 0.860 0.000 0.000 0.012 0.128
#> GSM62266     1  0.0794     0.8452 0.972 0.000 0.000 0.000 0.028
#> GSM62296     2  0.0794     0.8254 0.000 0.972 0.000 0.000 0.028
#> GSM62309     2  0.4141     0.6090 0.000 0.736 0.000 0.236 0.028
#> GSM62295     4  0.3748     0.6312 0.000 0.100 0.052 0.832 0.016
#> GSM62300     2  0.0510     0.8268 0.000 0.984 0.000 0.016 0.000
#> GSM62308     2  0.3783     0.6091 0.000 0.740 0.000 0.252 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
#> GSM62248     4  0.6361     0.2122 0.308 0.040 0.000 0.540 0.076 0.036
#> GSM62256     5  0.5133     0.3661 0.000 0.088 0.000 0.332 0.576 0.004
#> GSM62259     4  0.6084     0.3732 0.000 0.140 0.000 0.588 0.208 0.064
#> GSM62267     3  0.2058     0.7804 0.000 0.036 0.908 0.000 0.000 0.056
#> GSM62280     3  0.6746     0.3140 0.000 0.244 0.444 0.000 0.260 0.052
#> GSM62284     3  0.2905     0.7450 0.048 0.092 0.856 0.000 0.000 0.004
#> GSM62289     5  0.7157     0.2864 0.160 0.096 0.000 0.016 0.480 0.248
#> GSM62307     4  0.2346     0.7621 0.000 0.000 0.000 0.868 0.124 0.008
#> GSM62316     4  0.6287     0.3251 0.012 0.056 0.000 0.556 0.276 0.100
#> GSM62254     4  0.3253     0.6784 0.000 0.020 0.000 0.788 0.000 0.192
#> GSM62292     6  0.5435     0.0323 0.000 0.120 0.000 0.300 0.008 0.572
#> GSM62253     1  0.1049     0.8039 0.960 0.032 0.000 0.000 0.000 0.008
#> GSM62270     3  0.1856     0.7806 0.000 0.032 0.920 0.000 0.000 0.048
#> GSM62278     3  0.1471     0.7751 0.000 0.064 0.932 0.000 0.000 0.004
#> GSM62297     4  0.5795     0.5163 0.004 0.044 0.000 0.628 0.140 0.184
#> GSM62298     4  0.1434     0.7776 0.000 0.012 0.000 0.940 0.000 0.048
#> GSM62299     4  0.1477     0.7867 0.000 0.004 0.000 0.940 0.048 0.008
#> GSM62258     3  0.5023     0.4776 0.004 0.052 0.576 0.000 0.360 0.008
#> GSM62281     4  0.5697     0.3641 0.000 0.080 0.000 0.608 0.060 0.252
#> GSM62294     6  0.5464     0.1437 0.000 0.044 0.000 0.424 0.040 0.492
#> GSM62305     5  0.7309     0.0417 0.024 0.320 0.000 0.096 0.428 0.132
#> GSM62306     5  0.4734     0.4105 0.008 0.028 0.000 0.268 0.672 0.024
#> GSM62310     4  0.0260     0.7865 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM62311     4  0.1649     0.7893 0.000 0.008 0.000 0.936 0.040 0.016
#> GSM62317     4  0.2622     0.7249 0.000 0.104 0.000 0.868 0.024 0.004
#> GSM62318     1  0.6758     0.2442 0.404 0.380 0.128 0.000 0.088 0.000
#> GSM62321     5  0.6343     0.3289 0.004 0.232 0.004 0.288 0.464 0.008
#> GSM62322     3  0.1320     0.7835 0.000 0.016 0.948 0.000 0.000 0.036
#> GSM62250     5  0.5506     0.4073 0.016 0.028 0.000 0.080 0.648 0.228
#> GSM62252     6  0.4622     0.2247 0.020 0.092 0.000 0.000 0.164 0.724
#> GSM62255     4  0.2342     0.7773 0.000 0.004 0.000 0.888 0.088 0.020
#> GSM62257     4  0.2912     0.7671 0.000 0.012 0.000 0.856 0.104 0.028
#> GSM62260     5  0.2278     0.4641 0.004 0.128 0.000 0.000 0.868 0.000
#> GSM62261     4  0.3099     0.7114 0.000 0.008 0.000 0.808 0.176 0.008
#> GSM62262     4  0.5097     0.0193 0.000 0.068 0.000 0.508 0.004 0.420
#> GSM62264     1  0.2257     0.8059 0.904 0.020 0.000 0.000 0.060 0.016
#> GSM62268     1  0.1649     0.7910 0.932 0.032 0.036 0.000 0.000 0.000
#> GSM62269     3  0.1296     0.7780 0.004 0.044 0.948 0.000 0.000 0.004
#> GSM62271     3  0.5790     0.5679 0.000 0.108 0.612 0.000 0.056 0.224
#> GSM62272     3  0.1219     0.7786 0.000 0.048 0.948 0.000 0.000 0.004
#> GSM62273     4  0.2834     0.7300 0.000 0.020 0.000 0.852 0.008 0.120
#> GSM62274     3  0.1410     0.7858 0.004 0.044 0.944 0.000 0.000 0.008
#> GSM62275     3  0.0405     0.7837 0.000 0.008 0.988 0.000 0.000 0.004
#> GSM62276     3  0.5220     0.5957 0.000 0.024 0.668 0.000 0.156 0.152
#> GSM62277     3  0.3566     0.7366 0.000 0.104 0.800 0.000 0.000 0.096
#> GSM62279     3  0.7309     0.1159 0.084 0.276 0.472 0.000 0.040 0.128
#> GSM62282     3  0.3590     0.7440 0.000 0.092 0.820 0.000 0.020 0.068
#> GSM62283     5  0.5366     0.4102 0.016 0.192 0.004 0.000 0.648 0.140
#> GSM62286     6  0.5638     0.3038 0.000 0.128 0.016 0.060 0.116 0.680
#> GSM62287     4  0.4141     0.7265 0.000 0.008 0.000 0.756 0.080 0.156
#> GSM62288     4  0.2400     0.7638 0.004 0.000 0.000 0.872 0.116 0.008
#> GSM62290     4  0.3539     0.6435 0.000 0.024 0.000 0.756 0.000 0.220
#> GSM62293     6  0.3422     0.3594 0.000 0.036 0.000 0.176 0.000 0.788
#> GSM62301     4  0.1493     0.7837 0.000 0.004 0.000 0.936 0.056 0.004
#> GSM62302     4  0.0777     0.7855 0.000 0.004 0.000 0.972 0.000 0.024
#> GSM62303     4  0.3921     0.6565 0.000 0.020 0.000 0.748 0.020 0.212
#> GSM62304     4  0.1866     0.7779 0.000 0.000 0.000 0.908 0.084 0.008
#> GSM62312     4  0.2920     0.7215 0.000 0.004 0.000 0.820 0.168 0.008
#> GSM62313     4  0.1923     0.7836 0.000 0.004 0.000 0.916 0.016 0.064
#> GSM62314     4  0.1768     0.7874 0.012 0.012 0.000 0.936 0.008 0.032
#> GSM62319     2  0.7874     0.0000 0.000 0.372 0.148 0.200 0.024 0.256
#> GSM62320     4  0.0717     0.7879 0.000 0.008 0.000 0.976 0.016 0.000
#> GSM62249     5  0.4340     0.5021 0.060 0.028 0.000 0.032 0.792 0.088
#> GSM62251     1  0.1493     0.8074 0.936 0.004 0.000 0.000 0.056 0.004
#> GSM62263     1  0.3583     0.4252 0.728 0.008 0.000 0.260 0.004 0.000
#> GSM62285     4  0.0692     0.7843 0.000 0.020 0.000 0.976 0.000 0.004
#> GSM62315     4  0.1367     0.7785 0.000 0.044 0.000 0.944 0.012 0.000
#> GSM62291     4  0.4376     0.6201 0.020 0.060 0.000 0.736 0.000 0.184
#> GSM62265     1  0.3139     0.7831 0.852 0.048 0.000 0.000 0.080 0.020
#> GSM62266     1  0.0806     0.8097 0.972 0.020 0.000 0.000 0.008 0.000
#> GSM62296     4  0.1462     0.7838 0.000 0.008 0.000 0.936 0.056 0.000
#> GSM62309     4  0.4856     0.6221 0.012 0.056 0.000 0.732 0.044 0.156
#> GSM62295     6  0.2717     0.3442 0.000 0.020 0.020 0.068 0.008 0.884
#> GSM62300     4  0.0363     0.7858 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM62308     4  0.3602     0.6691 0.000 0.032 0.000 0.784 0.008 0.176

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) other(p) genotype/variation(p) k
#> ATC:NMF 75          0.66603    1.000                 0.753 2
#> ATC:NMF 74          0.00785    0.232                 0.556 3
#> ATC:NMF 68          0.04989    0.307                 0.831 4
#> ATC:NMF 60          0.06258    0.340                 0.936 5
#> ATC:NMF 50          0.01870    0.459                 0.291 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