cola Report for GDS2926

Date: 2019-12-25 20:17:21 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 18792 rows and 77 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] 18792    77

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 1.000 1.000 **
SD:NMF 2 1.000 1.000 1.000 **
CV:kmeans 2 1.000 0.987 0.995 **
CV:skmeans 2 1.000 0.986 0.995 **
CV:mclust 2 1.000 1.000 1.000 **
CV:NMF 2 1.000 0.979 0.992 **
MAD:kmeans 2 1.000 1.000 1.000 **
MAD:mclust 6 1.000 0.979 0.991 ** 2,3,5
MAD:NMF 2 1.000 1.000 1.000 **
ATC:kmeans 2 1.000 1.000 1.000 **
ATC:skmeans 2 1.000 1.000 1.000 **
ATC:mclust 3 0.960 0.922 0.967 ** 2
CV:pam 2 0.946 0.936 0.974 *
SD:pam 5 0.943 0.893 0.962 * 2
MAD:pam 6 0.941 0.911 0.957 * 2,3,5
ATC:NMF 4 0.935 0.915 0.939 * 2
SD:mclust 6 0.929 0.967 0.951 * 2,3,5
SD:skmeans 5 0.921 0.925 0.935 * 2,4
MAD:hclust 3 0.921 0.903 0.950 * 2
ATC:pam 3 0.913 0.855 0.946 * 2
SD:hclust 6 0.911 0.839 0.915 * 2,3
MAD:skmeans 5 0.906 0.906 0.924 * 2,3,4
ATC:hclust 3 0.903 0.965 0.976 * 2
CV:hclust 2 0.220 0.771 0.842

**: 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           1.000       1.000          0.505 0.496   0.496
#> CV:NMF      2 1.000           0.979       0.992          0.506 0.494   0.494
#> MAD:NMF     2 1.000           1.000       1.000          0.505 0.496   0.496
#> ATC:NMF     2 1.000           1.000       1.000          0.505 0.496   0.496
#> SD:skmeans  2 1.000           1.000       1.000          0.505 0.496   0.496
#> CV:skmeans  2 1.000           0.986       0.995          0.505 0.496   0.496
#> MAD:skmeans 2 1.000           1.000       1.000          0.505 0.496   0.496
#> ATC:skmeans 2 1.000           1.000       1.000          0.505 0.496   0.496
#> SD:mclust   2 1.000           1.000       1.000          0.505 0.496   0.496
#> CV:mclust   2 1.000           1.000       1.000          0.505 0.496   0.496
#> MAD:mclust  2 1.000           1.000       1.000          0.505 0.496   0.496
#> ATC:mclust  2 1.000           1.000       1.000          0.505 0.496   0.496
#> SD:kmeans   2 1.000           1.000       1.000          0.505 0.496   0.496
#> CV:kmeans   2 1.000           0.987       0.995          0.505 0.496   0.496
#> MAD:kmeans  2 1.000           1.000       1.000          0.505 0.496   0.496
#> ATC:kmeans  2 1.000           1.000       1.000          0.505 0.496   0.496
#> SD:pam      2 1.000           0.994       0.997          0.504 0.496   0.496
#> CV:pam      2 0.946           0.936       0.974          0.501 0.496   0.496
#> MAD:pam     2 1.000           0.996       0.998          0.505 0.496   0.496
#> ATC:pam     2 1.000           1.000       1.000          0.505 0.496   0.496
#> SD:hclust   2 1.000           1.000       1.000          0.505 0.496   0.496
#> CV:hclust   2 0.220           0.771       0.842          0.430 0.496   0.496
#> MAD:hclust  2 1.000           1.000       1.000          0.505 0.496   0.496
#> ATC:hclust  2 1.000           1.000       1.000          0.505 0.496   0.496
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.696           0.816       0.832         0.2417 0.889   0.777
#> CV:NMF      3 0.838           0.866       0.943         0.2516 0.825   0.661
#> MAD:NMF     3 0.723           0.759       0.771         0.2398 0.895   0.788
#> ATC:NMF     3 0.877           0.814       0.898         0.1802 0.931   0.860
#> SD:skmeans  3 0.749           0.962       0.917         0.2680 0.859   0.714
#> CV:skmeans  3 0.753           0.928       0.896         0.2668 0.859   0.714
#> MAD:skmeans 3 1.000           0.997       0.993         0.2790 0.859   0.714
#> ATC:skmeans 3 0.747           0.933       0.919         0.2196 0.895   0.788
#> SD:mclust   3 1.000           0.986       0.993         0.2774 0.859   0.714
#> CV:mclust   3 0.732           0.846       0.867         0.2399 0.861   0.719
#> MAD:mclust  3 0.999           0.987       0.992         0.2797 0.859   0.714
#> ATC:mclust  3 0.960           0.922       0.967         0.2779 0.859   0.714
#> SD:kmeans   3 0.712           0.794       0.759         0.2366 1.000   1.000
#> CV:kmeans   3 0.690           0.496       0.681         0.2404 0.900   0.800
#> MAD:kmeans  3 0.712           0.914       0.790         0.2417 0.859   0.714
#> ATC:kmeans  3 0.630           0.819       0.784         0.2408 1.000   1.000
#> SD:pam      3 0.742           0.914       0.866         0.2629 0.859   0.714
#> CV:pam      3 0.678           0.824       0.866         0.2799 0.857   0.712
#> MAD:pam     3 1.000           0.965       0.986         0.2834 0.857   0.712
#> ATC:pam     3 0.913           0.855       0.946         0.2817 0.859   0.714
#> SD:hclust   3 0.941           0.879       0.951         0.1945 0.895   0.788
#> CV:hclust   3 0.424           0.588       0.777         0.3743 0.948   0.898
#> MAD:hclust  3 0.921           0.903       0.950         0.1819 0.923   0.846
#> ATC:hclust  3 0.903           0.965       0.976         0.0883 0.966   0.932
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.893           0.904       0.953         0.1696 0.881   0.691
#> CV:NMF      4 0.780           0.794       0.889         0.0899 0.878   0.688
#> MAD:NMF     4 0.863           0.879       0.938         0.1712 0.837   0.603
#> ATC:NMF     4 0.935           0.915       0.939         0.0489 0.902   0.784
#> SD:skmeans  4 1.000           0.969       0.980         0.1769 0.889   0.687
#> CV:skmeans  4 0.804           0.876       0.926         0.1754 0.891   0.691
#> MAD:skmeans 4 1.000           0.961       0.973         0.1663 0.889   0.687
#> ATC:skmeans 4 0.805           0.880       0.919         0.2177 0.859   0.637
#> SD:mclust   4 0.885           0.797       0.913         0.1252 0.904   0.740
#> CV:mclust   4 0.663           0.669       0.819         0.1104 0.840   0.597
#> MAD:mclust  4 0.900           0.879       0.925         0.1302 0.864   0.632
#> ATC:mclust  4 0.800           0.794       0.874         0.1198 0.938   0.826
#> SD:kmeans   4 0.667           0.867       0.794         0.1193 0.749   0.494
#> CV:kmeans   4 0.585           0.778       0.774         0.1327 0.761   0.460
#> MAD:kmeans  4 0.644           0.827       0.751         0.1163 0.889   0.687
#> ATC:kmeans  4 0.589           0.329       0.643         0.1158 0.823   0.643
#> SD:pam      4 0.843           0.782       0.852         0.1600 0.892   0.701
#> CV:pam      4 0.794           0.704       0.877         0.1699 0.859   0.621
#> MAD:pam     4 0.844           0.781       0.896         0.1365 0.889   0.686
#> ATC:pam     4 0.830           0.805       0.924         0.1681 0.891   0.691
#> SD:hclust   4 0.784           0.829       0.881         0.0891 0.967   0.916
#> CV:hclust   4 0.483           0.632       0.801         0.0912 0.879   0.743
#> MAD:hclust  4 0.721           0.844       0.894         0.2165 0.857   0.659
#> ATC:hclust  4 0.868           0.895       0.945         0.0677 0.986   0.970
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.815           0.849       0.906         0.0626 0.853   0.533
#> CV:NMF      5 0.699           0.723       0.843         0.0851 0.934   0.790
#> MAD:NMF     5 0.767           0.840       0.869         0.0614 0.863   0.558
#> ATC:NMF     5 0.721           0.700       0.846         0.1234 0.938   0.840
#> SD:skmeans  5 0.921           0.925       0.935         0.0426 0.956   0.826
#> CV:skmeans  5 0.767           0.734       0.839         0.0568 0.914   0.673
#> MAD:skmeans 5 0.906           0.906       0.924         0.0438 0.975   0.899
#> ATC:skmeans 5 0.803           0.766       0.806         0.0577 1.000   1.000
#> SD:mclust   5 0.986           0.956       0.982         0.0718 0.900   0.671
#> CV:mclust   5 0.687           0.727       0.831         0.0986 0.912   0.707
#> MAD:mclust  5 0.998           0.966       0.985         0.0662 0.934   0.752
#> ATC:mclust  5 0.846           0.841       0.927         0.0774 0.926   0.748
#> SD:kmeans   5 0.587           0.793       0.776         0.0790 1.000   1.000
#> CV:kmeans   5 0.622           0.716       0.773         0.0846 1.000   1.000
#> MAD:kmeans  5 0.594           0.794       0.780         0.0808 1.000   1.000
#> ATC:kmeans  5 0.586           0.542       0.661         0.0796 0.785   0.416
#> SD:pam      5 0.943           0.893       0.962         0.0613 0.942   0.782
#> CV:pam      5 0.786           0.671       0.840         0.0545 0.933   0.744
#> MAD:pam     5 0.949           0.920       0.967         0.0649 0.933   0.743
#> ATC:pam     5 0.877           0.801       0.927         0.0460 0.946   0.786
#> SD:hclust   5 0.882           0.833       0.906         0.1819 0.857   0.600
#> CV:hclust   5 0.588           0.614       0.803         0.0929 0.927   0.798
#> MAD:hclust  5 0.814           0.848       0.893         0.0649 0.955   0.837
#> ATC:hclust  5 0.737           0.834       0.869         0.1199 0.911   0.802
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.875           0.843       0.912         0.0312 0.972   0.875
#> CV:NMF      6 0.657           0.481       0.712         0.0569 0.911   0.684
#> MAD:NMF     6 0.838           0.800       0.890         0.0329 0.971   0.873
#> ATC:NMF     6 0.686           0.545       0.805         0.0995 0.893   0.684
#> SD:skmeans  6 0.895           0.839       0.863         0.0388 1.000   1.000
#> CV:skmeans  6 0.747           0.665       0.781         0.0393 0.959   0.798
#> MAD:skmeans 6 0.865           0.736       0.830         0.0398 0.950   0.780
#> ATC:skmeans 6 0.798           0.701       0.774         0.0428 0.862   0.500
#> SD:mclust   6 0.929           0.967       0.951         0.0439 0.973   0.875
#> CV:mclust   6 0.677           0.603       0.771         0.0551 0.942   0.760
#> MAD:mclust  6 1.000           0.979       0.991         0.0369 0.973   0.875
#> ATC:mclust  6 0.796           0.674       0.780         0.0467 0.946   0.758
#> SD:kmeans   6 0.763           0.725       0.726         0.0554 0.926   0.711
#> CV:kmeans   6 0.683           0.628       0.696         0.0500 0.953   0.810
#> MAD:kmeans  6 0.752           0.710       0.750         0.0477 0.945   0.783
#> ATC:kmeans  6 0.637           0.647       0.667         0.0544 0.862   0.468
#> SD:pam      6 0.895           0.805       0.869         0.0414 0.951   0.785
#> CV:pam      6 0.796           0.741       0.847         0.0394 0.934   0.703
#> MAD:pam     6 0.941           0.911       0.957         0.0562 0.941   0.733
#> ATC:pam     6 0.897           0.890       0.941         0.0562 0.928   0.674
#> SD:hclust   6 0.911           0.839       0.915         0.0303 0.970   0.863
#> CV:hclust   6 0.644           0.643       0.770         0.0549 0.930   0.778
#> MAD:hclust  6 0.842           0.854       0.882         0.0368 0.959   0.822
#> ATC:hclust  6 0.820           0.853       0.874         0.1353 0.872   0.643

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 cell.line(p) agent(p) time(p) k
#> SD:NMF      77     1.27e-17 3.00e-14   0.361 2
#> CV:NMF      76     2.11e-17 4.87e-14   0.430 2
#> MAD:NMF     77     1.27e-17 3.00e-14   0.361 2
#> ATC:NMF     77     1.27e-17 3.00e-14   0.361 2
#> SD:skmeans  77     1.27e-17 3.00e-14   0.361 2
#> CV:skmeans  76     2.11e-17 4.87e-14   0.430 2
#> MAD:skmeans 77     1.27e-17 3.00e-14   0.361 2
#> ATC:skmeans 77     1.27e-17 3.00e-14   0.361 2
#> SD:mclust   77     1.27e-17 3.00e-14   0.361 2
#> CV:mclust   77     1.27e-17 3.00e-14   0.361 2
#> MAD:mclust  77     1.27e-17 3.00e-14   0.361 2
#> ATC:mclust  77     1.27e-17 3.00e-14   0.361 2
#> SD:kmeans   77     1.27e-17 3.00e-14   0.361 2
#> CV:kmeans   76     2.11e-17 4.87e-14   0.430 2
#> MAD:kmeans  77     1.27e-17 3.00e-14   0.361 2
#> ATC:kmeans  77     1.27e-17 3.00e-14   0.361 2
#> SD:pam      77     1.27e-17 3.00e-14   0.361 2
#> CV:pam      76     2.12e-17 4.96e-14   0.381 2
#> MAD:pam     77     1.27e-17 3.00e-14   0.361 2
#> ATC:pam     77     1.27e-17 3.00e-14   0.361 2
#> SD:hclust   77     1.27e-17 3.00e-14   0.361 2
#> CV:hclust   70     4.39e-16 4.85e-13   0.813 2
#> MAD:hclust  77     1.27e-17 3.00e-14   0.361 2
#> ATC:hclust  77     1.27e-17 3.00e-14   0.361 2
test_to_known_factors(res_list, k = 3)
#>              n cell.line(p) agent(p)  time(p) k
#> SD:NMF      73     1.41e-16 3.74e-13 0.002191 3
#> CV:NMF      75     9.29e-15 9.66e-13 0.035185 3
#> MAD:NMF     73     1.41e-16 1.34e-12 0.002072 3
#> ATC:NMF     73     1.41e-16 4.53e-12 0.016597 3
#> SD:skmeans  77     1.90e-17 1.77e-15 0.003803 3
#> CV:skmeans  77     1.90e-17 7.46e-13 0.657288 3
#> MAD:skmeans 77     1.90e-17 1.77e-15 0.003803 3
#> ATC:skmeans 77     1.90e-17 1.49e-13 0.004488 3
#> SD:mclust   77     1.90e-17 1.77e-15 0.003803 3
#> CV:mclust   75     5.18e-17 1.88e-12 0.582189 3
#> MAD:mclust  77     1.90e-17 1.77e-15 0.003803 3
#> ATC:mclust  74     8.53e-17 1.32e-15 0.015923 3
#> SD:kmeans   77     1.27e-17 3.00e-14 0.361151 3
#> CV:kmeans   55     1.14e-12 7.09e-11 0.027555 3
#> MAD:kmeans  77     1.90e-17 1.77e-15 0.003803 3
#> ATC:kmeans  77     1.27e-17 3.00e-14 0.361151 3
#> SD:pam      76     3.14e-17 1.71e-15 0.006091 3
#> CV:pam      73     1.41e-16 3.91e-13 0.152137 3
#> MAD:pam     75     5.18e-17 1.56e-15 0.009818 3
#> ATC:pam     70     6.31e-16 7.64e-15 0.155290 3
#> SD:hclust   73     1.41e-16 3.74e-13 0.000846 3
#> CV:hclust   54     1.88e-12 5.41e-08 0.882609 3
#> MAD:hclust  69     1.04e-15 1.38e-11 0.016184 3
#> ATC:hclust  77     1.90e-17 1.75e-12 0.410804 3
test_to_known_factors(res_list, k = 4)
#>              n cell.line(p) agent(p)  time(p) k
#> SD:NMF      76     2.21e-16 4.65e-21 4.88e-05 4
#> CV:NMF      70     4.27e-15 3.04e-11 4.69e-02 4
#> MAD:NMF     74     5.93e-16 2.37e-20 1.80e-04 4
#> ATC:NMF     75     5.18e-17 1.64e-13 1.29e-03 4
#> SD:skmeans  75     3.62e-16 4.17e-15 4.59e-06 4
#> CV:skmeans  77     1.35e-16 8.44e-13 6.07e-02 4
#> MAD:skmeans 75     3.62e-16 4.17e-15 4.59e-06 4
#> ATC:skmeans 77     1.35e-16 5.01e-15 4.16e-05 4
#> SD:mclust   65     5.02e-14 8.07e-19 5.46e-06 4
#> CV:mclust   69     6.99e-15 3.04e-10 2.86e-02 4
#> MAD:mclust  76     2.21e-16 2.45e-15 1.46e-05 4
#> ATC:mclust  73     9.72e-16 8.47e-23 2.99e-05 4
#> SD:kmeans   75     3.62e-16 4.17e-15 4.59e-06 4
#> CV:kmeans   73     9.72e-16 7.86e-12 1.82e-01 4
#> MAD:kmeans  75     3.62e-16 4.17e-15 4.59e-06 4
#> ATC:kmeans  34     4.14e-08 9.78e-07 8.50e-01 4
#> SD:pam      69     6.99e-15 1.76e-13 2.23e-05 4
#> CV:pam      65     5.02e-14 2.68e-13 1.70e-03 4
#> MAD:pam     68     1.14e-14 1.77e-13 4.33e-05 4
#> ATC:pam     69     6.99e-15 2.24e-14 5.71e-03 4
#> SD:hclust   73     9.72e-16 3.82e-19 1.25e-06 4
#> CV:hclust   59     9.61e-13 2.72e-09 2.20e-01 4
#> MAD:hclust  68     1.14e-14 8.37e-14 3.84e-03 4
#> ATC:hclust  74     8.53e-17 3.76e-12 3.35e-01 4
test_to_known_factors(res_list, k = 5)
#>              n cell.line(p) agent(p)  time(p) k
#> SD:NMF      71     1.40e-14 5.41e-20 3.79e-08 5
#> CV:NMF      67     9.75e-14 4.98e-10 3.96e-03 5
#> MAD:NMF     72     8.58e-15 2.48e-20 3.16e-08 5
#> ATC:NMF     68     1.14e-14 8.84e-11 5.46e-04 5
#> SD:skmeans  75     1.99e-15 4.00e-21 4.90e-09 5
#> CV:skmeans  66     1.58e-13 4.68e-11 3.13e-03 5
#> MAD:skmeans 75     1.99e-15 4.00e-21 4.90e-09 5
#> ATC:skmeans 75     3.62e-16 2.04e-14 1.33e-05 5
#> SD:mclust   76     1.22e-15 1.84e-21 3.21e-08 5
#> CV:mclust   69     3.69e-14 1.01e-09 5.29e-02 5
#> MAD:mclust  77     7.52e-16 8.50e-22 1.27e-08 5
#> ATC:mclust  69     3.69e-14 1.00e-19 5.42e-07 5
#> SD:kmeans   75     3.62e-16 4.17e-15 4.59e-06 5
#> CV:kmeans   72     1.59e-15 1.45e-11 1.45e-01 5
#> MAD:kmeans  75     3.62e-16 4.17e-15 4.59e-06 5
#> ATC:kmeans  52     3.00e-11 3.29e-11 3.84e-03 5
#> SD:pam      72     8.58e-15 2.48e-20 2.99e-07 5
#> CV:pam      64     8.21e-14 4.38e-13 2.08e-04 5
#> MAD:pam     74     3.24e-15 2.93e-21 6.97e-07 5
#> ATC:pam     67     9.75e-14 3.80e-17 8.34e-05 5
#> SD:hclust   72     8.58e-15 1.99e-21 4.16e-07 5
#> CV:hclust   63     6.79e-13 1.44e-09 4.23e-01 5
#> MAD:hclust  76     1.22e-15 7.53e-23 2.07e-05 5
#> ATC:hclust  74     5.93e-16 5.41e-12 7.06e-03 5
test_to_known_factors(res_list, k = 6)
#>              n cell.line(p) agent(p)  time(p) k
#> SD:NMF      72     3.93e-14 1.26e-18 4.90e-08 6
#> CV:NMF      37     4.60e-08 6.93e-07 6.23e-05 6
#> MAD:NMF     70     1.02e-13 5.64e-18 2.84e-07 6
#> ATC:NMF     55     3.25e-11 7.27e-08 2.99e-02 6
#> SD:skmeans  75     1.99e-15 4.00e-21 4.90e-09 6
#> CV:skmeans  61     7.55e-12 1.62e-09 7.09e-03 6
#> MAD:skmeans 68     2.67e-13 2.21e-23 5.58e-11 6
#> ATC:skmeans 66     6.95e-13 3.10e-17 2.91e-06 6
#> SD:mclust   77     3.56e-15 2.90e-20 8.56e-08 6
#> CV:mclust   64     1.81e-12 2.33e-09 4.06e-02 6
#> MAD:mclust  77     3.56e-15 2.90e-20 8.56e-08 6
#> ATC:mclust  67     4.31e-13 2.32e-19 7.09e-09 6
#> SD:kmeans   67     4.31e-13 3.04e-21 3.77e-13 6
#> CV:kmeans   67     9.75e-14 8.91e-15 1.68e-02 6
#> MAD:kmeans  68     2.67e-13 1.25e-16 2.76e-09 6
#> ATC:kmeans  66     6.95e-13 4.96e-20 1.19e-04 6
#> SD:pam      70     1.02e-13 4.31e-18 7.39e-08 6
#> CV:pam      67     4.31e-13 2.29e-22 9.41e-06 6
#> MAD:pam     74     1.50e-14 6.02e-26 3.93e-08 6
#> ATC:pam     73     2.43e-14 1.22e-19 2.42e-04 6
#> SD:hclust   72     3.93e-14 6.66e-20 8.21e-06 6
#> CV:hclust   64     4.18e-13 4.85e-10 2.64e-03 6
#> MAD:hclust  72     3.93e-14 6.66e-20 8.21e-06 6
#> ATC:hclust  73     5.28e-15 2.30e-12 3.01e-02 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 18792 rows and 77 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 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-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 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.941           0.879       0.951         0.1945 0.895   0.788
#> 4 4 0.784           0.829       0.881         0.0891 0.967   0.916
#> 5 5 0.882           0.833       0.906         0.1819 0.857   0.600
#> 6 6 0.911           0.839       0.915         0.0303 0.970   0.863

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 3

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette p1 p2
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      1.000  1 0.000 0.000
#> GSM87963     1  0.0000      1.000  1 0.000 0.000
#> GSM87983     1  0.0000      1.000  1 0.000 0.000
#> GSM87984     1  0.0000      1.000  1 0.000 0.000
#> GSM87961     1  0.0000      1.000  1 0.000 0.000
#> GSM87970     1  0.0000      1.000  1 0.000 0.000
#> GSM87971     1  0.0000      1.000  1 0.000 0.000
#> GSM87990     1  0.0000      1.000  1 0.000 0.000
#> GSM87991     1  0.0000      1.000  1 0.000 0.000
#> GSM87974     1  0.0000      1.000  1 0.000 0.000
#> GSM87994     1  0.0000      1.000  1 0.000 0.000
#> GSM87978     1  0.0000      1.000  1 0.000 0.000
#> GSM87979     1  0.0000      1.000  1 0.000 0.000
#> GSM87998     1  0.0000      1.000  1 0.000 0.000
#> GSM87999     1  0.0000      1.000  1 0.000 0.000
#> GSM87968     1  0.0000      1.000  1 0.000 0.000
#> GSM87987     1  0.0000      1.000  1 0.000 0.000
#> GSM87969     1  0.0000      1.000  1 0.000 0.000
#> GSM87988     1  0.0000      1.000  1 0.000 0.000
#> GSM87989     1  0.0000      1.000  1 0.000 0.000
#> GSM87972     1  0.0000      1.000  1 0.000 0.000
#> GSM87992     1  0.0000      1.000  1 0.000 0.000
#> GSM87973     1  0.0000      1.000  1 0.000 0.000
#> GSM87993     1  0.0000      1.000  1 0.000 0.000
#> GSM87975     1  0.0000      1.000  1 0.000 0.000
#> GSM87995     1  0.0000      1.000  1 0.000 0.000
#> GSM87976     1  0.0000      1.000  1 0.000 0.000
#> GSM87977     1  0.0000      1.000  1 0.000 0.000
#> GSM87996     1  0.0000      1.000  1 0.000 0.000
#> GSM87997     1  0.0000      1.000  1 0.000 0.000
#> GSM87980     1  0.0000      1.000  1 0.000 0.000
#> GSM88000     1  0.0000      1.000  1 0.000 0.000
#> GSM87981     1  0.0000      1.000  1 0.000 0.000
#> GSM87982     1  0.0000      1.000  1 0.000 0.000
#> GSM88001     1  0.0000      1.000  1 0.000 0.000
#> GSM87967     1  0.0000      1.000  1 0.000 0.000
#> GSM87964     1  0.0000      1.000  1 0.000 0.000
#> GSM87965     1  0.0000      1.000  1 0.000 0.000
#> GSM87966     1  0.0000      1.000  1 0.000 0.000
#> GSM87985     1  0.0000      1.000  1 0.000 0.000
#> GSM87986     1  0.0000      1.000  1 0.000 0.000
#> GSM88004     2  0.0000      0.903  0 1.000 0.000
#> GSM88015     2  0.0000      0.903  0 1.000 0.000
#> GSM88005     2  0.0000      0.903  0 1.000 0.000
#> GSM88006     2  0.0000      0.903  0 1.000 0.000
#> GSM88016     2  0.0000      0.903  0 1.000 0.000
#> GSM88007     2  0.0000      0.903  0 1.000 0.000
#> GSM88017     2  0.0000      0.903  0 1.000 0.000
#> GSM88029     2  0.0592      0.892  0 0.988 0.012
#> GSM88008     2  0.0000      0.903  0 1.000 0.000
#> GSM88009     2  0.0000      0.903  0 1.000 0.000
#> GSM88018     2  0.0000      0.903  0 1.000 0.000
#> GSM88024     2  0.0000      0.903  0 1.000 0.000
#> GSM88030     2  0.5650      0.452  0 0.688 0.312
#> GSM88036     2  0.5650      0.452  0 0.688 0.312
#> GSM88010     3  0.5926      0.604  0 0.356 0.644
#> GSM88011     3  0.5926      0.604  0 0.356 0.644
#> GSM88019     2  0.6305     -0.226  0 0.516 0.484
#> GSM88027     2  0.6305     -0.226  0 0.516 0.484
#> GSM88031     3  0.0000      0.797  0 0.000 1.000
#> GSM88012     3  0.5926      0.604  0 0.356 0.644
#> GSM88020     3  0.0000      0.797  0 0.000 1.000
#> GSM88032     3  0.0000      0.797  0 0.000 1.000
#> GSM88037     3  0.0000      0.797  0 0.000 1.000
#> GSM88013     3  0.5926      0.604  0 0.356 0.644
#> GSM88021     3  0.0000      0.797  0 0.000 1.000
#> GSM88025     3  0.0000      0.797  0 0.000 1.000
#> GSM88033     3  0.0000      0.797  0 0.000 1.000
#> GSM88014     3  0.5926      0.604  0 0.356 0.644
#> GSM88022     3  0.5926      0.604  0 0.356 0.644
#> GSM88034     3  0.0000      0.797  0 0.000 1.000
#> GSM88002     2  0.0000      0.903  0 1.000 0.000
#> GSM88003     2  0.0000      0.903  0 1.000 0.000
#> GSM88023     2  0.0000      0.903  0 1.000 0.000
#> GSM88026     2  0.0000      0.903  0 1.000 0.000
#> GSM88028     2  0.0000      0.903  0 1.000 0.000
#> GSM88035     2  0.0000      0.903  0 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
#> GSM87962     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87963     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87983     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87984     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87961     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87970     1  0.1792      0.906 0.932 0.000 0.068 0.000
#> GSM87971     1  0.1792      0.906 0.932 0.000 0.068 0.000
#> GSM87990     1  0.1792      0.906 0.932 0.000 0.068 0.000
#> GSM87991     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87974     1  0.1792      0.906 0.932 0.000 0.068 0.000
#> GSM87994     1  0.1022      0.921 0.968 0.000 0.032 0.000
#> GSM87978     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87979     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87998     1  0.1118      0.920 0.964 0.000 0.036 0.000
#> GSM87999     1  0.1118      0.920 0.964 0.000 0.036 0.000
#> GSM87968     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87987     1  0.0707      0.920 0.980 0.000 0.020 0.000
#> GSM87969     1  0.0707      0.920 0.980 0.000 0.020 0.000
#> GSM87988     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87989     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87972     1  0.2704      0.912 0.876 0.000 0.124 0.000
#> GSM87992     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87973     1  0.2704      0.912 0.876 0.000 0.124 0.000
#> GSM87993     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87975     1  0.2704      0.912 0.876 0.000 0.124 0.000
#> GSM87995     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87976     1  0.2704      0.912 0.876 0.000 0.124 0.000
#> GSM87977     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87996     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87997     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87980     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM88000     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87981     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87982     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM88001     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87967     1  0.2760      0.911 0.872 0.000 0.128 0.000
#> GSM87964     1  0.1940      0.902 0.924 0.000 0.076 0.000
#> GSM87965     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87966     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87985     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM87986     1  0.1302      0.917 0.956 0.000 0.044 0.000
#> GSM88004     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88005     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88029     2  0.0524      0.835 0.000 0.988 0.004 0.008
#> GSM88008     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88030     2  0.4632      0.436 0.000 0.688 0.004 0.308
#> GSM88036     2  0.4632      0.436 0.000 0.688 0.004 0.308
#> GSM88010     4  0.4872      0.584 0.000 0.356 0.004 0.640
#> GSM88011     4  0.4872      0.584 0.000 0.356 0.004 0.640
#> GSM88019     2  0.5163     -0.185 0.000 0.516 0.004 0.480
#> GSM88027     2  0.5163     -0.185 0.000 0.516 0.004 0.480
#> GSM88031     4  0.0000      0.784 0.000 0.000 0.000 1.000
#> GSM88012     4  0.4872      0.584 0.000 0.356 0.004 0.640
#> GSM88020     4  0.0000      0.784 0.000 0.000 0.000 1.000
#> GSM88032     4  0.0000      0.784 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000      0.784 0.000 0.000 0.000 1.000
#> GSM88013     4  0.4872      0.584 0.000 0.356 0.004 0.640
#> GSM88021     4  0.0000      0.784 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000      0.784 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000      0.784 0.000 0.000 0.000 1.000
#> GSM88014     4  0.4872      0.584 0.000 0.356 0.004 0.640
#> GSM88022     4  0.4872      0.584 0.000 0.356 0.004 0.640
#> GSM88034     4  0.0000      0.784 0.000 0.000 0.000 1.000
#> GSM88002     3  0.3688      1.000 0.000 0.208 0.792 0.000
#> GSM88003     3  0.3688      1.000 0.000 0.208 0.792 0.000
#> GSM88023     3  0.3688      1.000 0.000 0.208 0.792 0.000
#> GSM88026     3  0.3688      1.000 0.000 0.208 0.792 0.000
#> GSM88028     3  0.3688      1.000 0.000 0.208 0.792 0.000
#> GSM88035     3  0.3688      1.000 0.000 0.208 0.792 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
#> GSM87962     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM87963     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM87983     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM87984     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM87961     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM87970     1  0.0290     0.9555 0.992 0.000 0.008 0.000 0.000
#> GSM87971     1  0.0290     0.9555 0.992 0.000 0.008 0.000 0.000
#> GSM87990     1  0.0290     0.9555 0.992 0.000 0.008 0.000 0.000
#> GSM87991     1  0.0963     0.9670 0.964 0.000 0.036 0.000 0.000
#> GSM87974     1  0.0290     0.9555 0.992 0.000 0.008 0.000 0.000
#> GSM87994     3  0.2377     0.8376 0.128 0.000 0.872 0.000 0.000
#> GSM87978     1  0.1341     0.9525 0.944 0.000 0.056 0.000 0.000
#> GSM87979     1  0.1341     0.9525 0.944 0.000 0.056 0.000 0.000
#> GSM87998     3  0.2280     0.8459 0.120 0.000 0.880 0.000 0.000
#> GSM87999     3  0.2280     0.8459 0.120 0.000 0.880 0.000 0.000
#> GSM87968     1  0.1341     0.9525 0.944 0.000 0.056 0.000 0.000
#> GSM87987     3  0.4302     0.0388 0.480 0.000 0.520 0.000 0.000
#> GSM87969     1  0.3586     0.6638 0.736 0.000 0.264 0.000 0.000
#> GSM87988     3  0.0290     0.9456 0.008 0.000 0.992 0.000 0.000
#> GSM87989     3  0.0290     0.9456 0.008 0.000 0.992 0.000 0.000
#> GSM87972     3  0.0162     0.9483 0.004 0.000 0.996 0.000 0.000
#> GSM87992     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87973     3  0.0162     0.9483 0.004 0.000 0.996 0.000 0.000
#> GSM87993     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87975     3  0.0162     0.9483 0.004 0.000 0.996 0.000 0.000
#> GSM87995     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87976     3  0.0162     0.9483 0.004 0.000 0.996 0.000 0.000
#> GSM87977     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87996     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87997     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87980     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM88000     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87981     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87982     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM88001     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87967     3  0.0000     0.9493 0.000 0.000 1.000 0.000 0.000
#> GSM87964     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000
#> GSM87965     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM87966     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM87985     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM87986     1  0.0880     0.9691 0.968 0.000 0.032 0.000 0.000
#> GSM88004     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88015     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88005     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88006     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88016     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88007     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88017     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88029     2  0.0000     0.8530 0.000 1.000 0.000 0.000 0.000
#> GSM88008     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88009     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88018     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88024     2  0.0404     0.8622 0.000 0.988 0.000 0.000 0.012
#> GSM88030     2  0.3796     0.4682 0.000 0.700 0.000 0.300 0.000
#> GSM88036     2  0.3796     0.4682 0.000 0.700 0.000 0.300 0.000
#> GSM88010     4  0.4088     0.5720 0.000 0.368 0.000 0.632 0.000
#> GSM88011     4  0.4088     0.5720 0.000 0.368 0.000 0.632 0.000
#> GSM88019     2  0.4297    -0.1966 0.000 0.528 0.000 0.472 0.000
#> GSM88027     2  0.4297    -0.1966 0.000 0.528 0.000 0.472 0.000
#> GSM88031     4  0.0000     0.7802 0.000 0.000 0.000 1.000 0.000
#> GSM88012     4  0.4088     0.5720 0.000 0.368 0.000 0.632 0.000
#> GSM88020     4  0.0000     0.7802 0.000 0.000 0.000 1.000 0.000
#> GSM88032     4  0.0000     0.7802 0.000 0.000 0.000 1.000 0.000
#> GSM88037     4  0.0000     0.7802 0.000 0.000 0.000 1.000 0.000
#> GSM88013     4  0.4088     0.5720 0.000 0.368 0.000 0.632 0.000
#> GSM88021     4  0.0000     0.7802 0.000 0.000 0.000 1.000 0.000
#> GSM88025     4  0.0000     0.7802 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0000     0.7802 0.000 0.000 0.000 1.000 0.000
#> GSM88014     4  0.4088     0.5720 0.000 0.368 0.000 0.632 0.000
#> GSM88022     4  0.4088     0.5720 0.000 0.368 0.000 0.632 0.000
#> GSM88034     4  0.0000     0.7802 0.000 0.000 0.000 1.000 0.000
#> GSM88002     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM88003     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM88023     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM88026     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM88028     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM88035     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4 p5    p6
#> GSM87962     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM87963     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM87983     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM87984     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM87961     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM87970     1  0.0260     0.9555 0.992 0.000 0.008 0.000  0 0.000
#> GSM87971     1  0.0260     0.9555 0.992 0.000 0.008 0.000  0 0.000
#> GSM87990     1  0.0260     0.9555 0.992 0.000 0.008 0.000  0 0.000
#> GSM87991     1  0.0865     0.9670 0.964 0.000 0.036 0.000  0 0.000
#> GSM87974     1  0.0260     0.9555 0.992 0.000 0.008 0.000  0 0.000
#> GSM87994     3  0.2135     0.8376 0.128 0.000 0.872 0.000  0 0.000
#> GSM87978     1  0.1204     0.9525 0.944 0.000 0.056 0.000  0 0.000
#> GSM87979     1  0.1204     0.9525 0.944 0.000 0.056 0.000  0 0.000
#> GSM87998     3  0.2048     0.8459 0.120 0.000 0.880 0.000  0 0.000
#> GSM87999     3  0.2048     0.8459 0.120 0.000 0.880 0.000  0 0.000
#> GSM87968     1  0.1204     0.9525 0.944 0.000 0.056 0.000  0 0.000
#> GSM87987     3  0.3864     0.0388 0.480 0.000 0.520 0.000  0 0.000
#> GSM87969     1  0.3221     0.6638 0.736 0.000 0.264 0.000  0 0.000
#> GSM87988     3  0.0260     0.9456 0.008 0.000 0.992 0.000  0 0.000
#> GSM87989     3  0.0260     0.9456 0.008 0.000 0.992 0.000  0 0.000
#> GSM87972     3  0.0146     0.9483 0.004 0.000 0.996 0.000  0 0.000
#> GSM87992     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87973     3  0.0146     0.9483 0.004 0.000 0.996 0.000  0 0.000
#> GSM87993     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87975     3  0.0146     0.9483 0.004 0.000 0.996 0.000  0 0.000
#> GSM87995     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87976     3  0.0146     0.9483 0.004 0.000 0.996 0.000  0 0.000
#> GSM87977     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87996     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87997     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87980     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM88000     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87981     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87982     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM88001     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87967     3  0.0000     0.9493 0.000 0.000 1.000 0.000  0 0.000
#> GSM87964     1  0.0000     0.9472 1.000 0.000 0.000 0.000  0 0.000
#> GSM87965     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM87966     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM87985     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM87986     1  0.0790     0.9691 0.968 0.000 0.032 0.000  0 0.000
#> GSM88004     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88015     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88005     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88006     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88016     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88007     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88017     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88029     2  0.0458     0.8705 0.000 0.984 0.000 0.016  0 0.000
#> GSM88008     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88009     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88018     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88024     2  0.0000     0.8855 0.000 1.000 0.000 0.000  0 0.000
#> GSM88030     4  0.3727     0.0832 0.000 0.388 0.000 0.612  0 0.000
#> GSM88036     4  0.3727     0.0832 0.000 0.388 0.000 0.612  0 0.000
#> GSM88010     4  0.4524     0.7176 0.000 0.040 0.000 0.584  0 0.376
#> GSM88011     4  0.4524     0.7176 0.000 0.040 0.000 0.584  0 0.376
#> GSM88019     2  0.5944    -0.3061 0.000 0.400 0.000 0.384  0 0.216
#> GSM88027     2  0.5944    -0.3061 0.000 0.400 0.000 0.384  0 0.216
#> GSM88031     6  0.0000     0.8762 0.000 0.000 0.000 0.000  0 1.000
#> GSM88012     4  0.4524     0.7176 0.000 0.040 0.000 0.584  0 0.376
#> GSM88020     6  0.0000     0.8762 0.000 0.000 0.000 0.000  0 1.000
#> GSM88032     6  0.0000     0.8762 0.000 0.000 0.000 0.000  0 1.000
#> GSM88037     6  0.0000     0.8762 0.000 0.000 0.000 0.000  0 1.000
#> GSM88013     4  0.4524     0.7176 0.000 0.040 0.000 0.584  0 0.376
#> GSM88021     6  0.0000     0.8762 0.000 0.000 0.000 0.000  0 1.000
#> GSM88025     6  0.0000     0.8762 0.000 0.000 0.000 0.000  0 1.000
#> GSM88033     6  0.2912     0.7014 0.000 0.000 0.000 0.216  0 0.784
#> GSM88014     4  0.4524     0.7176 0.000 0.040 0.000 0.584  0 0.376
#> GSM88022     4  0.4524     0.7176 0.000 0.040 0.000 0.584  0 0.376
#> GSM88034     6  0.3695     0.5429 0.000 0.000 0.000 0.376  0 0.624
#> GSM88002     5  0.0000     1.0000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88003     5  0.0000     1.0000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88023     5  0.0000     1.0000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88026     5  0.0000     1.0000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88028     5  0.0000     1.0000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88035     5  0.0000     1.0000 0.000 0.000 0.000 0.000  1 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 cell.line(p) agent(p)  time(p) k
#> SD:hclust 77     1.27e-17 3.00e-14 3.61e-01 2
#> SD:hclust 73     1.41e-16 3.74e-13 8.46e-04 3
#> SD:hclust 73     9.72e-16 3.82e-19 1.25e-06 4
#> SD:hclust 72     8.58e-15 1.99e-21 4.16e-07 5
#> SD:hclust 72     3.93e-14 6.66e-20 8.21e-06 6

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


SD: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 18792 rows and 77 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           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.712           0.794       0.759         0.2366 1.000   1.000
#> 4 4 0.667           0.867       0.794         0.1193 0.749   0.494
#> 5 5 0.587           0.793       0.776         0.0790 1.000   1.000
#> 6 6 0.763           0.725       0.726         0.0554 0.926   0.711

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      0.810 1.000 0.000 NA
#> GSM87963     1  0.0000      0.810 1.000 0.000 NA
#> GSM87983     1  0.0000      0.810 1.000 0.000 NA
#> GSM87984     1  0.0000      0.810 1.000 0.000 NA
#> GSM87961     1  0.0000      0.810 1.000 0.000 NA
#> GSM87970     1  0.0000      0.810 1.000 0.000 NA
#> GSM87971     1  0.0000      0.810 1.000 0.000 NA
#> GSM87990     1  0.0000      0.810 1.000 0.000 NA
#> GSM87991     1  0.0000      0.810 1.000 0.000 NA
#> GSM87974     1  0.0000      0.810 1.000 0.000 NA
#> GSM87994     1  0.0000      0.810 1.000 0.000 NA
#> GSM87978     1  0.0000      0.810 1.000 0.000 NA
#> GSM87979     1  0.0000      0.810 1.000 0.000 NA
#> GSM87998     1  0.0000      0.810 1.000 0.000 NA
#> GSM87999     1  0.0000      0.810 1.000 0.000 NA
#> GSM87968     1  0.0000      0.810 1.000 0.000 NA
#> GSM87987     1  0.0424      0.809 0.992 0.000 NA
#> GSM87969     1  0.0000      0.810 1.000 0.000 NA
#> GSM87988     1  0.6291      0.748 0.532 0.000 NA
#> GSM87989     1  0.6291      0.748 0.532 0.000 NA
#> GSM87972     1  0.6291      0.748 0.532 0.000 NA
#> GSM87992     1  0.6291      0.748 0.532 0.000 NA
#> GSM87973     1  0.6291      0.748 0.532 0.000 NA
#> GSM87993     1  0.6291      0.748 0.532 0.000 NA
#> GSM87975     1  0.6291      0.748 0.532 0.000 NA
#> GSM87995     1  0.6291      0.748 0.532 0.000 NA
#> GSM87976     1  0.6291      0.748 0.532 0.000 NA
#> GSM87977     1  0.6291      0.748 0.532 0.000 NA
#> GSM87996     1  0.6291      0.748 0.532 0.000 NA
#> GSM87997     1  0.6291      0.748 0.532 0.000 NA
#> GSM87980     1  0.6291      0.748 0.532 0.000 NA
#> GSM88000     1  0.6291      0.748 0.532 0.000 NA
#> GSM87981     1  0.6291      0.748 0.532 0.000 NA
#> GSM87982     1  0.6291      0.748 0.532 0.000 NA
#> GSM88001     1  0.6291      0.748 0.532 0.000 NA
#> GSM87967     1  0.6291      0.748 0.532 0.000 NA
#> GSM87964     1  0.0000      0.810 1.000 0.000 NA
#> GSM87965     1  0.0000      0.810 1.000 0.000 NA
#> GSM87966     1  0.0000      0.810 1.000 0.000 NA
#> GSM87985     1  0.0000      0.810 1.000 0.000 NA
#> GSM87986     1  0.0000      0.810 1.000 0.000 NA
#> GSM88004     2  0.0000      0.819 0.000 1.000 NA
#> GSM88015     2  0.0000      0.819 0.000 1.000 NA
#> GSM88005     2  0.0000      0.819 0.000 1.000 NA
#> GSM88006     2  0.0000      0.819 0.000 1.000 NA
#> GSM88016     2  0.0000      0.819 0.000 1.000 NA
#> GSM88007     2  0.0000      0.819 0.000 1.000 NA
#> GSM88017     2  0.0000      0.819 0.000 1.000 NA
#> GSM88029     2  0.0000      0.819 0.000 1.000 NA
#> GSM88008     2  0.0000      0.819 0.000 1.000 NA
#> GSM88009     2  0.0000      0.819 0.000 1.000 NA
#> GSM88018     2  0.0000      0.819 0.000 1.000 NA
#> GSM88024     2  0.0000      0.819 0.000 1.000 NA
#> GSM88030     2  0.4654      0.823 0.000 0.792 NA
#> GSM88036     2  0.4654      0.823 0.000 0.792 NA
#> GSM88010     2  0.6126      0.806 0.000 0.600 NA
#> GSM88011     2  0.6126      0.806 0.000 0.600 NA
#> GSM88019     2  0.6126      0.806 0.000 0.600 NA
#> GSM88027     2  0.6126      0.806 0.000 0.600 NA
#> GSM88031     2  0.6215      0.807 0.000 0.572 NA
#> GSM88012     2  0.6215      0.807 0.000 0.572 NA
#> GSM88020     2  0.6215      0.807 0.000 0.572 NA
#> GSM88032     2  0.6215      0.807 0.000 0.572 NA
#> GSM88037     2  0.6215      0.807 0.000 0.572 NA
#> GSM88013     2  0.6215      0.807 0.000 0.572 NA
#> GSM88021     2  0.6215      0.807 0.000 0.572 NA
#> GSM88025     2  0.6215      0.807 0.000 0.572 NA
#> GSM88033     2  0.6215      0.807 0.000 0.572 NA
#> GSM88014     2  0.6215      0.807 0.000 0.572 NA
#> GSM88022     2  0.6215      0.807 0.000 0.572 NA
#> GSM88034     2  0.6215      0.807 0.000 0.572 NA
#> GSM88002     2  0.3619      0.782 0.000 0.864 NA
#> GSM88003     2  0.3619      0.782 0.000 0.864 NA
#> GSM88023     2  0.3619      0.782 0.000 0.864 NA
#> GSM88026     2  0.3619      0.782 0.000 0.864 NA
#> GSM88028     2  0.3619      0.782 0.000 0.864 NA
#> GSM88035     2  0.3619      0.782 0.000 0.864 NA

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.5206     0.9468 0.668 0.000 0.308 0.024
#> GSM87963     1  0.5206     0.9468 0.668 0.000 0.308 0.024
#> GSM87983     1  0.5300     0.9465 0.664 0.000 0.308 0.028
#> GSM87984     1  0.5300     0.9465 0.664 0.000 0.308 0.028
#> GSM87961     1  0.5206     0.9468 0.668 0.000 0.308 0.024
#> GSM87970     1  0.5389     0.9417 0.660 0.000 0.308 0.032
#> GSM87971     1  0.5475     0.9414 0.656 0.000 0.308 0.036
#> GSM87990     1  0.4632     0.9474 0.688 0.000 0.308 0.004
#> GSM87991     1  0.5206     0.9432 0.668 0.000 0.308 0.024
#> GSM87974     1  0.6182     0.9316 0.616 0.000 0.308 0.076
#> GSM87994     1  0.6356     0.9199 0.604 0.000 0.308 0.088
#> GSM87978     1  0.6182     0.9316 0.616 0.000 0.308 0.076
#> GSM87979     1  0.6182     0.9316 0.616 0.000 0.308 0.076
#> GSM87998     1  0.6356     0.9199 0.604 0.000 0.308 0.088
#> GSM87999     1  0.6356     0.9199 0.604 0.000 0.308 0.088
#> GSM87968     1  0.6242     0.9299 0.612 0.000 0.308 0.080
#> GSM87987     1  0.6430     0.9136 0.596 0.000 0.312 0.092
#> GSM87969     1  0.6464     0.9212 0.596 0.000 0.308 0.096
#> GSM87988     3  0.2760     0.9173 0.000 0.000 0.872 0.128
#> GSM87989     3  0.2760     0.9173 0.000 0.000 0.872 0.128
#> GSM87972     3  0.1022     0.9360 0.000 0.000 0.968 0.032
#> GSM87992     3  0.1940     0.9505 0.000 0.000 0.924 0.076
#> GSM87973     3  0.0000     0.9522 0.000 0.000 1.000 0.000
#> GSM87993     3  0.1940     0.9505 0.000 0.000 0.924 0.076
#> GSM87975     3  0.0188     0.9504 0.000 0.000 0.996 0.004
#> GSM87995     3  0.1940     0.9505 0.000 0.000 0.924 0.076
#> GSM87976     3  0.0188     0.9504 0.000 0.000 0.996 0.004
#> GSM87977     3  0.0000     0.9522 0.000 0.000 1.000 0.000
#> GSM87996     3  0.1940     0.9505 0.000 0.000 0.924 0.076
#> GSM87997     3  0.1940     0.9505 0.000 0.000 0.924 0.076
#> GSM87980     3  0.0000     0.9522 0.000 0.000 1.000 0.000
#> GSM88000     3  0.1940     0.9505 0.000 0.000 0.924 0.076
#> GSM87981     3  0.0000     0.9522 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000     0.9522 0.000 0.000 1.000 0.000
#> GSM88001     3  0.1940     0.9505 0.000 0.000 0.924 0.076
#> GSM87967     3  0.0000     0.9522 0.000 0.000 1.000 0.000
#> GSM87964     1  0.5857     0.9398 0.636 0.000 0.308 0.056
#> GSM87965     1  0.5206     0.9468 0.668 0.000 0.308 0.024
#> GSM87966     1  0.5300     0.9465 0.664 0.000 0.308 0.028
#> GSM87985     1  0.5300     0.9465 0.664 0.000 0.308 0.028
#> GSM87986     1  0.5300     0.9465 0.664 0.000 0.308 0.028
#> GSM88004     2  0.0000     0.7917 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0469     0.7895 0.012 0.988 0.000 0.000
#> GSM88005     2  0.0000     0.7917 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000     0.7917 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0469     0.7895 0.012 0.988 0.000 0.000
#> GSM88007     2  0.0000     0.7917 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0592     0.7889 0.016 0.984 0.000 0.000
#> GSM88029     2  0.0592     0.7889 0.016 0.984 0.000 0.000
#> GSM88008     2  0.0000     0.7917 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000     0.7917 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0469     0.7895 0.012 0.988 0.000 0.000
#> GSM88024     2  0.0469     0.7895 0.012 0.988 0.000 0.000
#> GSM88030     2  0.5231     0.0767 0.028 0.676 0.000 0.296
#> GSM88036     2  0.5231     0.0767 0.028 0.676 0.000 0.296
#> GSM88010     4  0.6031     0.8610 0.044 0.420 0.000 0.536
#> GSM88011     4  0.6031     0.8610 0.044 0.420 0.000 0.536
#> GSM88019     4  0.6038     0.8556 0.044 0.424 0.000 0.532
#> GSM88027     4  0.6038     0.8556 0.044 0.424 0.000 0.532
#> GSM88031     4  0.4585     0.9402 0.000 0.332 0.000 0.668
#> GSM88012     4  0.5755     0.9335 0.044 0.332 0.000 0.624
#> GSM88020     4  0.4585     0.9402 0.000 0.332 0.000 0.668
#> GSM88032     4  0.4585     0.9402 0.000 0.332 0.000 0.668
#> GSM88037     4  0.4585     0.9402 0.000 0.332 0.000 0.668
#> GSM88013     4  0.5755     0.9335 0.044 0.332 0.000 0.624
#> GSM88021     4  0.4585     0.9402 0.000 0.332 0.000 0.668
#> GSM88025     4  0.4585     0.9402 0.000 0.332 0.000 0.668
#> GSM88033     4  0.4585     0.9402 0.000 0.332 0.000 0.668
#> GSM88014     4  0.5755     0.9335 0.044 0.332 0.000 0.624
#> GSM88022     4  0.5755     0.9335 0.044 0.332 0.000 0.624
#> GSM88034     4  0.4761     0.9380 0.004 0.332 0.000 0.664
#> GSM88002     2  0.6435     0.6377 0.224 0.640 0.000 0.136
#> GSM88003     2  0.6435     0.6377 0.224 0.640 0.000 0.136
#> GSM88023     2  0.6366     0.6381 0.240 0.640 0.000 0.120
#> GSM88026     2  0.6366     0.6381 0.240 0.640 0.000 0.120
#> GSM88028     2  0.6346     0.6380 0.244 0.640 0.000 0.116
#> GSM88035     2  0.6346     0.6380 0.244 0.640 0.000 0.116

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4 p5
#> GSM87962     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM87963     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM87983     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM87984     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM87961     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM87970     1   0.543     0.8542 0.716 0.000 0.140 0.108 NA
#> GSM87971     1   0.551     0.8524 0.712 0.000 0.140 0.108 NA
#> GSM87990     1   0.352     0.8730 0.824 0.000 0.140 0.032 NA
#> GSM87991     1   0.492     0.8541 0.756 0.000 0.140 0.040 NA
#> GSM87974     1   0.671     0.8314 0.616 0.000 0.140 0.152 NA
#> GSM87994     1   0.721     0.7562 0.540 0.000 0.140 0.088 NA
#> GSM87978     1   0.680     0.8282 0.608 0.000 0.140 0.152 NA
#> GSM87979     1   0.683     0.8267 0.604 0.000 0.140 0.156 NA
#> GSM87998     1   0.723     0.7528 0.536 0.000 0.140 0.088 NA
#> GSM87999     1   0.723     0.7528 0.536 0.000 0.140 0.088 NA
#> GSM87968     1   0.692     0.8232 0.596 0.000 0.140 0.156 NA
#> GSM87987     1   0.727     0.7485 0.532 0.000 0.144 0.088 NA
#> GSM87969     1   0.744     0.7844 0.536 0.000 0.140 0.144 NA
#> GSM87988     3   0.399     0.6914 0.000 0.000 0.768 0.036 NA
#> GSM87989     3   0.402     0.6920 0.000 0.000 0.764 0.036 NA
#> GSM87972     3   0.454     0.8012 0.000 0.000 0.656 0.024 NA
#> GSM87992     3   0.000     0.8580 0.000 0.000 1.000 0.000 NA
#> GSM87973     3   0.358     0.8638 0.000 0.000 0.768 0.008 NA
#> GSM87993     3   0.000     0.8580 0.000 0.000 1.000 0.000 NA
#> GSM87975     3   0.369     0.8624 0.000 0.000 0.764 0.012 NA
#> GSM87995     3   0.000     0.8580 0.000 0.000 1.000 0.000 NA
#> GSM87976     3   0.369     0.8624 0.000 0.000 0.764 0.012 NA
#> GSM87977     3   0.337     0.8641 0.000 0.000 0.768 0.000 NA
#> GSM87996     3   0.000     0.8580 0.000 0.000 1.000 0.000 NA
#> GSM87997     3   0.000     0.8580 0.000 0.000 1.000 0.000 NA
#> GSM87980     3   0.337     0.8641 0.000 0.000 0.768 0.000 NA
#> GSM88000     3   0.000     0.8580 0.000 0.000 1.000 0.000 NA
#> GSM87981     3   0.337     0.8641 0.000 0.000 0.768 0.000 NA
#> GSM87982     3   0.334     0.8649 0.000 0.000 0.772 0.000 NA
#> GSM88001     3   0.000     0.8580 0.000 0.000 1.000 0.000 NA
#> GSM87967     3   0.334     0.8649 0.000 0.000 0.772 0.000 NA
#> GSM87964     1   0.515     0.8533 0.740 0.000 0.140 0.080 NA
#> GSM87965     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM87966     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM87985     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM87986     1   0.252     0.8740 0.860 0.000 0.140 0.000 NA
#> GSM88004     2   0.000     0.7723 0.000 1.000 0.000 0.000 NA
#> GSM88015     2   0.121     0.7648 0.016 0.960 0.000 0.000 NA
#> GSM88005     2   0.000     0.7723 0.000 1.000 0.000 0.000 NA
#> GSM88006     2   0.000     0.7723 0.000 1.000 0.000 0.000 NA
#> GSM88016     2   0.121     0.7648 0.016 0.960 0.000 0.000 NA
#> GSM88007     2   0.000     0.7723 0.000 1.000 0.000 0.000 NA
#> GSM88017     2   0.205     0.7562 0.052 0.920 0.000 0.000 NA
#> GSM88029     2   0.221     0.7526 0.056 0.912 0.000 0.000 NA
#> GSM88008     2   0.000     0.7723 0.000 1.000 0.000 0.000 NA
#> GSM88009     2   0.000     0.7723 0.000 1.000 0.000 0.000 NA
#> GSM88018     2   0.183     0.7584 0.040 0.932 0.000 0.000 NA
#> GSM88024     2   0.183     0.7584 0.040 0.932 0.000 0.000 NA
#> GSM88030     2   0.659     0.0675 0.076 0.564 0.000 0.292 NA
#> GSM88036     2   0.659     0.0675 0.076 0.564 0.000 0.292 NA
#> GSM88010     4   0.455     0.7802 0.008 0.348 0.000 0.636 NA
#> GSM88011     4   0.455     0.7802 0.008 0.348 0.000 0.636 NA
#> GSM88019     4   0.431     0.7752 0.000 0.356 0.000 0.636 NA
#> GSM88027     4   0.431     0.7752 0.000 0.356 0.000 0.636 NA
#> GSM88031     4   0.623     0.8793 0.052 0.236 0.000 0.624 NA
#> GSM88012     4   0.395     0.8609 0.008 0.236 0.000 0.748 NA
#> GSM88020     4   0.623     0.8793 0.052 0.236 0.000 0.624 NA
#> GSM88032     4   0.623     0.8793 0.052 0.236 0.000 0.624 NA
#> GSM88037     4   0.623     0.8793 0.052 0.236 0.000 0.624 NA
#> GSM88013     4   0.367     0.8636 0.008 0.236 0.000 0.756 NA
#> GSM88021     4   0.623     0.8793 0.052 0.236 0.000 0.624 NA
#> GSM88025     4   0.623     0.8793 0.052 0.236 0.000 0.624 NA
#> GSM88033     4   0.623     0.8793 0.052 0.236 0.000 0.624 NA
#> GSM88014     4   0.367     0.8636 0.008 0.236 0.000 0.756 NA
#> GSM88022     4   0.383     0.8624 0.008 0.236 0.000 0.752 NA
#> GSM88034     4   0.643     0.8697 0.056 0.236 0.000 0.608 NA
#> GSM88002     2   0.507     0.6264 0.004 0.600 0.000 0.036 NA
#> GSM88003     2   0.507     0.6264 0.004 0.600 0.000 0.036 NA
#> GSM88023     2   0.507     0.6264 0.004 0.600 0.000 0.036 NA
#> GSM88026     2   0.501     0.6264 0.004 0.600 0.000 0.032 NA
#> GSM88028     2   0.513     0.6264 0.004 0.600 0.000 0.040 NA
#> GSM88035     2   0.513     0.6264 0.004 0.600 0.000 0.040 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.0000      0.679 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87963     1  0.0000      0.679 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87983     1  0.0458      0.673 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM87984     1  0.0458      0.673 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM87961     1  0.0000      0.679 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87970     1  0.4489      0.545 0.760 0.096 0.000 0.000 0.048 0.096
#> GSM87971     1  0.4788      0.516 0.732 0.096 0.000 0.000 0.048 0.124
#> GSM87990     1  0.1793      0.647 0.928 0.012 0.000 0.000 0.012 0.048
#> GSM87991     1  0.2865      0.453 0.840 0.012 0.000 0.000 0.008 0.140
#> GSM87974     1  0.5646      0.313 0.616 0.096 0.000 0.000 0.048 0.240
#> GSM87994     6  0.3862      0.964 0.476 0.000 0.000 0.000 0.000 0.524
#> GSM87978     1  0.5630      0.297 0.612 0.096 0.000 0.000 0.044 0.248
#> GSM87979     1  0.5647      0.256 0.600 0.096 0.000 0.000 0.040 0.264
#> GSM87998     6  0.3854      0.981 0.464 0.000 0.000 0.000 0.000 0.536
#> GSM87999     6  0.3854      0.981 0.464 0.000 0.000 0.000 0.000 0.536
#> GSM87968     1  0.5700      0.215 0.588 0.096 0.000 0.000 0.040 0.276
#> GSM87987     6  0.4080      0.969 0.456 0.000 0.008 0.000 0.000 0.536
#> GSM87969     1  0.5751     -0.273 0.496 0.076 0.000 0.000 0.036 0.392
#> GSM87988     3  0.5067      0.464 0.068 0.004 0.584 0.000 0.004 0.340
#> GSM87989     3  0.5090      0.457 0.068 0.004 0.576 0.000 0.004 0.348
#> GSM87972     3  0.6884      0.734 0.068 0.280 0.484 0.000 0.012 0.156
#> GSM87992     3  0.1674      0.763 0.068 0.004 0.924 0.000 0.004 0.000
#> GSM87973     3  0.6223      0.787 0.068 0.264 0.572 0.000 0.012 0.084
#> GSM87993     3  0.1387      0.765 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM87975     3  0.6257      0.784 0.068 0.272 0.564 0.000 0.012 0.084
#> GSM87995     3  0.1387      0.765 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM87976     3  0.6257      0.784 0.068 0.272 0.564 0.000 0.012 0.084
#> GSM87977     3  0.6095      0.788 0.068 0.276 0.572 0.000 0.008 0.076
#> GSM87996     3  0.1387      0.765 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM87997     3  0.1387      0.765 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM87980     3  0.6095      0.788 0.068 0.276 0.572 0.000 0.008 0.076
#> GSM88000     3  0.1387      0.765 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM87981     3  0.6095      0.788 0.068 0.276 0.572 0.000 0.008 0.076
#> GSM87982     3  0.6049      0.789 0.068 0.276 0.576 0.000 0.008 0.072
#> GSM88001     3  0.1387      0.765 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM87967     3  0.6049      0.789 0.068 0.276 0.576 0.000 0.008 0.072
#> GSM87964     1  0.4133      0.564 0.788 0.092 0.000 0.000 0.044 0.076
#> GSM87965     1  0.0000      0.679 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87966     1  0.0458      0.673 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM87985     1  0.0458      0.673 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM87986     1  0.0458      0.673 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM88004     2  0.5663      0.945 0.000 0.524 0.000 0.156 0.316 0.004
#> GSM88015     2  0.5396      0.941 0.000 0.564 0.000 0.152 0.284 0.000
#> GSM88005     2  0.5663      0.945 0.000 0.524 0.000 0.156 0.316 0.004
#> GSM88006     2  0.5663      0.945 0.000 0.524 0.000 0.156 0.316 0.004
#> GSM88016     2  0.5396      0.941 0.000 0.564 0.000 0.152 0.284 0.000
#> GSM88007     2  0.5663      0.945 0.000 0.524 0.000 0.156 0.316 0.004
#> GSM88017     2  0.6749      0.884 0.000 0.500 0.016 0.152 0.280 0.052
#> GSM88029     2  0.6823      0.879 0.000 0.496 0.020 0.152 0.280 0.052
#> GSM88008     2  0.5663      0.945 0.000 0.524 0.000 0.156 0.316 0.004
#> GSM88009     2  0.5663      0.945 0.000 0.524 0.000 0.156 0.316 0.004
#> GSM88018     2  0.5822      0.931 0.000 0.556 0.004 0.152 0.276 0.012
#> GSM88024     2  0.5822      0.931 0.000 0.556 0.004 0.152 0.276 0.012
#> GSM88030     4  0.7714     -0.196 0.000 0.268 0.032 0.416 0.144 0.140
#> GSM88036     4  0.7714     -0.196 0.000 0.268 0.032 0.416 0.144 0.140
#> GSM88010     4  0.2584      0.700 0.000 0.144 0.004 0.848 0.000 0.004
#> GSM88011     4  0.2584      0.700 0.000 0.144 0.004 0.848 0.000 0.004
#> GSM88019     4  0.2632      0.690 0.000 0.164 0.004 0.832 0.000 0.000
#> GSM88027     4  0.2632      0.690 0.000 0.164 0.004 0.832 0.000 0.000
#> GSM88031     4  0.3062      0.801 0.000 0.024 0.000 0.816 0.000 0.160
#> GSM88012     4  0.0260      0.788 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM88020     4  0.3102      0.802 0.000 0.028 0.000 0.816 0.000 0.156
#> GSM88032     4  0.3062      0.801 0.000 0.024 0.000 0.816 0.000 0.160
#> GSM88037     4  0.3062      0.801 0.000 0.024 0.000 0.816 0.000 0.160
#> GSM88013     4  0.0260      0.788 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM88021     4  0.3102      0.802 0.000 0.028 0.000 0.816 0.000 0.156
#> GSM88025     4  0.3102      0.802 0.000 0.028 0.000 0.816 0.000 0.156
#> GSM88033     4  0.3062      0.801 0.000 0.024 0.000 0.816 0.000 0.160
#> GSM88014     4  0.0260      0.788 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM88022     4  0.0260      0.788 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM88034     4  0.3364      0.785 0.000 0.024 0.000 0.780 0.000 0.196
#> GSM88002     5  0.2550      0.974 0.000 0.008 0.020 0.076 0.888 0.008
#> GSM88003     5  0.2550      0.974 0.000 0.008 0.020 0.076 0.888 0.008
#> GSM88023     5  0.1644      0.982 0.000 0.000 0.004 0.076 0.920 0.000
#> GSM88026     5  0.1858      0.982 0.000 0.000 0.012 0.076 0.912 0.000
#> GSM88028     5  0.1757      0.981 0.000 0.000 0.008 0.076 0.916 0.000
#> GSM88035     5  0.1757      0.981 0.000 0.000 0.008 0.076 0.916 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-kmeans-collect-classes

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

test_to_known_factors(res)
#>            n cell.line(p) agent(p)  time(p) k
#> SD:kmeans 77     1.27e-17 3.00e-14 3.61e-01 2
#> SD:kmeans 77     1.27e-17 3.00e-14 3.61e-01 3
#> SD:kmeans 75     3.62e-16 4.17e-15 4.59e-06 4
#> SD:kmeans 75     3.62e-16 4.17e-15 4.59e-06 5
#> SD:kmeans 67     4.31e-13 3.04e-21 3.77e-13 6

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


SD:skmeans*

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

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

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

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

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

collect_plots(res)

plot of chunk SD-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           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.749           0.962       0.917         0.2680 0.859   0.714
#> 4 4 1.000           0.969       0.980         0.1769 0.889   0.687
#> 5 5 0.921           0.925       0.935         0.0426 0.956   0.826
#> 6 6 0.895           0.839       0.863         0.0388 1.000   1.000

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

suggest_best_k(res)
#> [1] 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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87963     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87983     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87984     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87961     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87970     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87971     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87990     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87991     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87974     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87994     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87978     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87979     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87998     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87999     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87968     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87987     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87969     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87988     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87989     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87972     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87992     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87973     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87993     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87975     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87995     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87976     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87977     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87996     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87997     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87980     3  0.0000      1.000 0.000 0.000 1.000
#> GSM88000     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87981     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87982     3  0.0000      1.000 0.000 0.000 1.000
#> GSM88001     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87967     3  0.0000      1.000 0.000 0.000 1.000
#> GSM87964     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87965     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87966     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87985     1  0.4399      1.000 0.812 0.000 0.188
#> GSM87986     1  0.4399      1.000 0.812 0.000 0.188
#> GSM88004     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88015     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88005     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88006     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88016     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88007     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88017     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88029     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88008     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88009     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88018     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88024     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88030     2  0.0747      0.926 0.016 0.984 0.000
#> GSM88036     2  0.0747      0.926 0.016 0.984 0.000
#> GSM88010     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88011     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88019     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88027     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88031     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88012     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88020     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88032     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88037     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88013     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88021     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88025     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88033     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88014     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88022     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88034     2  0.4399      0.909 0.188 0.812 0.000
#> GSM88002     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88003     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88023     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88026     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88028     2  0.0000      0.926 0.000 1.000 0.000
#> GSM88035     2  0.0000      0.926 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
#> GSM87962     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87983     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87961     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87970     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM87971     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM87990     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87991     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87974     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM87994     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87978     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM87979     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM87998     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87999     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87968     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM87987     1  0.1211      0.959 0.960 0.000 0.040 0.000
#> GSM87969     1  0.0779      0.982 0.980 0.000 0.016 0.004
#> GSM87988     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87989     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87972     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87992     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87973     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87993     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87975     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87995     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87976     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87977     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87996     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87997     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87980     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM88000     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87981     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87982     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM88001     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87967     3  0.0817      1.000 0.024 0.000 0.976 0.000
#> GSM87964     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM87965     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87966     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87985     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM87986     1  0.0000      0.996 1.000 0.000 0.000 0.000
#> GSM88004     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88005     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88029     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88008     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0000      0.993 0.000 1.000 0.000 0.000
#> GSM88030     4  0.4877      0.358 0.000 0.408 0.000 0.592
#> GSM88036     4  0.4877      0.358 0.000 0.408 0.000 0.592
#> GSM88010     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88011     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88019     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88027     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88031     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88012     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88020     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88032     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88037     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88013     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88021     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88025     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88033     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88014     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88022     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88034     4  0.0188      0.951 0.000 0.004 0.000 0.996
#> GSM88002     2  0.0817      0.987 0.000 0.976 0.024 0.000
#> GSM88003     2  0.0817      0.987 0.000 0.976 0.024 0.000
#> GSM88023     2  0.0817      0.987 0.000 0.976 0.024 0.000
#> GSM88026     2  0.0817      0.987 0.000 0.976 0.024 0.000
#> GSM88028     2  0.0817      0.987 0.000 0.976 0.024 0.000
#> GSM88035     2  0.0817      0.987 0.000 0.976 0.024 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
#> GSM87962     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM87963     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM87983     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM87984     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM87961     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM87970     1  0.1121      0.941 0.956 0.000 0.000 0.000 0.044
#> GSM87971     1  0.1478      0.939 0.936 0.000 0.000 0.000 0.064
#> GSM87990     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> GSM87991     1  0.0404      0.945 0.988 0.000 0.000 0.000 0.012
#> GSM87974     1  0.2020      0.930 0.900 0.000 0.000 0.000 0.100
#> GSM87994     1  0.1544      0.937 0.932 0.000 0.000 0.000 0.068
#> GSM87978     1  0.2020      0.930 0.900 0.000 0.000 0.000 0.100
#> GSM87979     1  0.2020      0.930 0.900 0.000 0.000 0.000 0.100
#> GSM87998     1  0.1608      0.935 0.928 0.000 0.000 0.000 0.072
#> GSM87999     1  0.1608      0.935 0.928 0.000 0.000 0.000 0.072
#> GSM87968     1  0.2020      0.930 0.900 0.000 0.000 0.000 0.100
#> GSM87987     1  0.2300      0.923 0.904 0.000 0.024 0.000 0.072
#> GSM87969     1  0.2411      0.923 0.884 0.000 0.008 0.000 0.108
#> GSM87988     3  0.0510      0.985 0.000 0.000 0.984 0.000 0.016
#> GSM87989     3  0.0510      0.985 0.000 0.000 0.984 0.000 0.016
#> GSM87972     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87992     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87973     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87993     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87975     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87995     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87976     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87977     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87996     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87997     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87980     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM88000     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87981     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87982     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM88001     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87967     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM87964     1  0.1851      0.938 0.912 0.000 0.000 0.000 0.088
#> GSM87965     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM87966     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM87985     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM87986     1  0.1197      0.943 0.952 0.000 0.000 0.000 0.048
#> GSM88004     2  0.0703      0.866 0.000 0.976 0.000 0.000 0.024
#> GSM88015     2  0.0510      0.866 0.000 0.984 0.000 0.000 0.016
#> GSM88005     2  0.0703      0.866 0.000 0.976 0.000 0.000 0.024
#> GSM88006     2  0.0703      0.866 0.000 0.976 0.000 0.000 0.024
#> GSM88016     2  0.0510      0.866 0.000 0.984 0.000 0.000 0.016
#> GSM88007     2  0.0703      0.866 0.000 0.976 0.000 0.000 0.024
#> GSM88017     2  0.0000      0.862 0.000 1.000 0.000 0.000 0.000
#> GSM88029     2  0.0000      0.862 0.000 1.000 0.000 0.000 0.000
#> GSM88008     2  0.0703      0.866 0.000 0.976 0.000 0.000 0.024
#> GSM88009     2  0.0703      0.866 0.000 0.976 0.000 0.000 0.024
#> GSM88018     2  0.0000      0.862 0.000 1.000 0.000 0.000 0.000
#> GSM88024     2  0.0000      0.862 0.000 1.000 0.000 0.000 0.000
#> GSM88030     2  0.4302      0.166 0.000 0.520 0.000 0.480 0.000
#> GSM88036     2  0.4302      0.166 0.000 0.520 0.000 0.480 0.000
#> GSM88010     4  0.3176      0.910 0.000 0.064 0.000 0.856 0.080
#> GSM88011     4  0.3110      0.912 0.000 0.060 0.000 0.860 0.080
#> GSM88019     4  0.3239      0.907 0.000 0.068 0.000 0.852 0.080
#> GSM88027     4  0.3239      0.907 0.000 0.068 0.000 0.852 0.080
#> GSM88031     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000
#> GSM88012     4  0.1732      0.941 0.000 0.000 0.000 0.920 0.080
#> GSM88020     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000
#> GSM88032     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000
#> GSM88037     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000
#> GSM88013     4  0.1732      0.941 0.000 0.000 0.000 0.920 0.080
#> GSM88021     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000
#> GSM88025     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000
#> GSM88014     4  0.1732      0.941 0.000 0.000 0.000 0.920 0.080
#> GSM88022     4  0.1732      0.941 0.000 0.000 0.000 0.920 0.080
#> GSM88034     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000
#> GSM88002     5  0.3424      1.000 0.000 0.240 0.000 0.000 0.760
#> GSM88003     5  0.3424      1.000 0.000 0.240 0.000 0.000 0.760
#> GSM88023     5  0.3424      1.000 0.000 0.240 0.000 0.000 0.760
#> GSM88026     5  0.3424      1.000 0.000 0.240 0.000 0.000 0.760
#> GSM88028     5  0.3424      1.000 0.000 0.240 0.000 0.000 0.760
#> GSM88035     5  0.3424      1.000 0.000 0.240 0.000 0.000 0.760

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM87962     1  0.0260      0.809 0.992 0.000 0.000 0.000 0.000 NA
#> GSM87963     1  0.0260      0.809 0.992 0.000 0.000 0.000 0.000 NA
#> GSM87983     1  0.0000      0.808 1.000 0.000 0.000 0.000 0.000 NA
#> GSM87984     1  0.0000      0.808 1.000 0.000 0.000 0.000 0.000 NA
#> GSM87961     1  0.0260      0.809 0.992 0.000 0.000 0.000 0.000 NA
#> GSM87970     1  0.3794      0.790 0.724 0.000 0.000 0.000 0.028 NA
#> GSM87971     1  0.4083      0.782 0.668 0.000 0.000 0.000 0.028 NA
#> GSM87990     1  0.2191      0.815 0.876 0.000 0.000 0.000 0.004 NA
#> GSM87991     1  0.2553      0.812 0.848 0.000 0.000 0.000 0.008 NA
#> GSM87974     1  0.4423      0.747 0.552 0.000 0.000 0.000 0.028 NA
#> GSM87994     1  0.3998      0.769 0.644 0.000 0.000 0.000 0.016 NA
#> GSM87978     1  0.4439      0.742 0.540 0.000 0.000 0.000 0.028 NA
#> GSM87979     1  0.4439      0.742 0.540 0.000 0.000 0.000 0.028 NA
#> GSM87998     1  0.4064      0.761 0.624 0.000 0.000 0.000 0.016 NA
#> GSM87999     1  0.4064      0.761 0.624 0.000 0.000 0.000 0.016 NA
#> GSM87968     1  0.4377      0.742 0.540 0.000 0.000 0.000 0.024 NA
#> GSM87987     1  0.4303      0.756 0.616 0.000 0.008 0.000 0.016 NA
#> GSM87969     1  0.4874      0.717 0.496 0.000 0.008 0.000 0.040 NA
#> GSM87988     3  0.2822      0.910 0.000 0.000 0.852 0.000 0.040 NA
#> GSM87989     3  0.2822      0.910 0.000 0.000 0.852 0.000 0.040 NA
#> GSM87972     3  0.0520      0.952 0.000 0.000 0.984 0.000 0.008 NA
#> GSM87992     3  0.1765      0.955 0.000 0.000 0.924 0.000 0.024 NA
#> GSM87973     3  0.0000      0.958 0.000 0.000 1.000 0.000 0.000 NA
#> GSM87993     3  0.1765      0.955 0.000 0.000 0.924 0.000 0.024 NA
#> GSM87975     3  0.0000      0.958 0.000 0.000 1.000 0.000 0.000 NA
#> GSM87995     3  0.1765      0.955 0.000 0.000 0.924 0.000 0.024 NA
#> GSM87976     3  0.0000      0.958 0.000 0.000 1.000 0.000 0.000 NA
#> GSM87977     3  0.0000      0.958 0.000 0.000 1.000 0.000 0.000 NA
#> GSM87996     3  0.1765      0.955 0.000 0.000 0.924 0.000 0.024 NA
#> GSM87997     3  0.1765      0.955 0.000 0.000 0.924 0.000 0.024 NA
#> GSM87980     3  0.0000      0.958 0.000 0.000 1.000 0.000 0.000 NA
#> GSM88000     3  0.1765      0.955 0.000 0.000 0.924 0.000 0.024 NA
#> GSM87981     3  0.0000      0.958 0.000 0.000 1.000 0.000 0.000 NA
#> GSM87982     3  0.0000      0.958 0.000 0.000 1.000 0.000 0.000 NA
#> GSM88001     3  0.1765      0.955 0.000 0.000 0.924 0.000 0.024 NA
#> GSM87967     3  0.0000      0.958 0.000 0.000 1.000 0.000 0.000 NA
#> GSM87964     1  0.2573      0.782 0.864 0.000 0.000 0.000 0.024 NA
#> GSM87965     1  0.0260      0.809 0.992 0.000 0.000 0.000 0.000 NA
#> GSM87966     1  0.0000      0.808 1.000 0.000 0.000 0.000 0.000 NA
#> GSM87985     1  0.0000      0.808 1.000 0.000 0.000 0.000 0.000 NA
#> GSM87986     1  0.0000      0.808 1.000 0.000 0.000 0.000 0.000 NA
#> GSM88004     2  0.0363      0.863 0.000 0.988 0.000 0.000 0.012 NA
#> GSM88015     2  0.0291      0.862 0.000 0.992 0.000 0.000 0.004 NA
#> GSM88005     2  0.0363      0.863 0.000 0.988 0.000 0.000 0.012 NA
#> GSM88006     2  0.0363      0.863 0.000 0.988 0.000 0.000 0.012 NA
#> GSM88016     2  0.0291      0.862 0.000 0.992 0.000 0.000 0.004 NA
#> GSM88007     2  0.0363      0.863 0.000 0.988 0.000 0.000 0.012 NA
#> GSM88017     2  0.2003      0.829 0.000 0.884 0.000 0.000 0.000 NA
#> GSM88029     2  0.2048      0.827 0.000 0.880 0.000 0.000 0.000 NA
#> GSM88008     2  0.0363      0.863 0.000 0.988 0.000 0.000 0.012 NA
#> GSM88009     2  0.0363      0.863 0.000 0.988 0.000 0.000 0.012 NA
#> GSM88018     2  0.1765      0.838 0.000 0.904 0.000 0.000 0.000 NA
#> GSM88024     2  0.1863      0.835 0.000 0.896 0.000 0.000 0.000 NA
#> GSM88030     2  0.6042      0.187 0.000 0.400 0.000 0.208 0.004 NA
#> GSM88036     2  0.6042      0.187 0.000 0.400 0.000 0.208 0.004 NA
#> GSM88010     4  0.1471      0.774 0.000 0.064 0.000 0.932 0.000 NA
#> GSM88011     4  0.1411      0.777 0.000 0.060 0.000 0.936 0.000 NA
#> GSM88019     4  0.2003      0.789 0.000 0.044 0.000 0.912 0.000 NA
#> GSM88027     4  0.1983      0.777 0.000 0.072 0.000 0.908 0.000 NA
#> GSM88031     4  0.3835      0.820 0.000 0.000 0.000 0.668 0.012 NA
#> GSM88012     4  0.0146      0.804 0.000 0.000 0.000 0.996 0.000 NA
#> GSM88020     4  0.3867      0.816 0.000 0.000 0.000 0.660 0.012 NA
#> GSM88032     4  0.3835      0.820 0.000 0.000 0.000 0.668 0.012 NA
#> GSM88037     4  0.3835      0.820 0.000 0.000 0.000 0.668 0.012 NA
#> GSM88013     4  0.0000      0.805 0.000 0.000 0.000 1.000 0.000 NA
#> GSM88021     4  0.3835      0.820 0.000 0.000 0.000 0.668 0.012 NA
#> GSM88025     4  0.3835      0.820 0.000 0.000 0.000 0.668 0.012 NA
#> GSM88033     4  0.3835      0.820 0.000 0.000 0.000 0.668 0.012 NA
#> GSM88014     4  0.0000      0.805 0.000 0.000 0.000 1.000 0.000 NA
#> GSM88022     4  0.0000      0.805 0.000 0.000 0.000 1.000 0.000 NA
#> GSM88034     4  0.3883      0.814 0.000 0.000 0.000 0.656 0.012 NA
#> GSM88002     5  0.1556      1.000 0.000 0.080 0.000 0.000 0.920 NA
#> GSM88003     5  0.1556      1.000 0.000 0.080 0.000 0.000 0.920 NA
#> GSM88023     5  0.1556      1.000 0.000 0.080 0.000 0.000 0.920 NA
#> GSM88026     5  0.1556      1.000 0.000 0.080 0.000 0.000 0.920 NA
#> GSM88028     5  0.1556      1.000 0.000 0.080 0.000 0.000 0.920 NA
#> GSM88035     5  0.1556      1.000 0.000 0.080 0.000 0.000 0.920 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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 cell.line(p) agent(p)  time(p) k
#> SD:skmeans 77     1.27e-17 3.00e-14 3.61e-01 2
#> SD:skmeans 77     1.90e-17 1.77e-15 3.80e-03 3
#> SD:skmeans 75     3.62e-16 4.17e-15 4.59e-06 4
#> SD:skmeans 75     1.99e-15 4.00e-21 4.90e-09 5
#> SD:skmeans 75     1.99e-15 4.00e-21 4.90e-09 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 18792 rows and 77 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-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.994       0.997         0.5045 0.496   0.496
#> 3 3 0.742           0.914       0.866         0.2629 0.859   0.714
#> 4 4 0.843           0.782       0.852         0.1600 0.892   0.701
#> 5 5 0.943           0.893       0.962         0.0613 0.942   0.782
#> 6 6 0.895           0.805       0.869         0.0414 0.951   0.785

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

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
#> GSM87962     1   0.000      1.000 1.000 0.000
#> GSM87963     1   0.000      1.000 1.000 0.000
#> GSM87983     1   0.000      1.000 1.000 0.000
#> GSM87984     1   0.000      1.000 1.000 0.000
#> GSM87961     1   0.000      1.000 1.000 0.000
#> GSM87970     1   0.000      1.000 1.000 0.000
#> GSM87971     1   0.000      1.000 1.000 0.000
#> GSM87990     1   0.000      1.000 1.000 0.000
#> GSM87991     1   0.000      1.000 1.000 0.000
#> GSM87974     1   0.000      1.000 1.000 0.000
#> GSM87994     1   0.000      1.000 1.000 0.000
#> GSM87978     1   0.000      1.000 1.000 0.000
#> GSM87979     1   0.000      1.000 1.000 0.000
#> GSM87998     1   0.000      1.000 1.000 0.000
#> GSM87999     1   0.000      1.000 1.000 0.000
#> GSM87968     1   0.000      1.000 1.000 0.000
#> GSM87987     1   0.000      1.000 1.000 0.000
#> GSM87969     1   0.000      1.000 1.000 0.000
#> GSM87988     1   0.000      1.000 1.000 0.000
#> GSM87989     1   0.000      1.000 1.000 0.000
#> GSM87972     1   0.000      1.000 1.000 0.000
#> GSM87992     1   0.000      1.000 1.000 0.000
#> GSM87973     1   0.000      1.000 1.000 0.000
#> GSM87993     1   0.000      1.000 1.000 0.000
#> GSM87975     1   0.000      1.000 1.000 0.000
#> GSM87995     1   0.000      1.000 1.000 0.000
#> GSM87976     1   0.000      1.000 1.000 0.000
#> GSM87977     1   0.000      1.000 1.000 0.000
#> GSM87996     1   0.000      1.000 1.000 0.000
#> GSM87997     1   0.000      1.000 1.000 0.000
#> GSM87980     1   0.000      1.000 1.000 0.000
#> GSM88000     1   0.000      1.000 1.000 0.000
#> GSM87981     1   0.000      1.000 1.000 0.000
#> GSM87982     1   0.000      1.000 1.000 0.000
#> GSM88001     1   0.000      1.000 1.000 0.000
#> GSM87967     1   0.000      1.000 1.000 0.000
#> GSM87964     1   0.000      1.000 1.000 0.000
#> GSM87965     1   0.000      1.000 1.000 0.000
#> GSM87966     1   0.000      1.000 1.000 0.000
#> GSM87985     1   0.000      1.000 1.000 0.000
#> GSM87986     1   0.000      1.000 1.000 0.000
#> GSM88004     2   0.000      0.994 0.000 1.000
#> GSM88015     2   0.000      0.994 0.000 1.000
#> GSM88005     2   0.000      0.994 0.000 1.000
#> GSM88006     2   0.000      0.994 0.000 1.000
#> GSM88016     2   0.000      0.994 0.000 1.000
#> GSM88007     2   0.000      0.994 0.000 1.000
#> GSM88017     2   0.000      0.994 0.000 1.000
#> GSM88029     2   0.000      0.994 0.000 1.000
#> GSM88008     2   0.000      0.994 0.000 1.000
#> GSM88009     2   0.000      0.994 0.000 1.000
#> GSM88018     2   0.000      0.994 0.000 1.000
#> GSM88024     2   0.000      0.994 0.000 1.000
#> GSM88030     2   0.000      0.994 0.000 1.000
#> GSM88036     2   0.000      0.994 0.000 1.000
#> GSM88010     2   0.000      0.994 0.000 1.000
#> GSM88011     2   0.000      0.994 0.000 1.000
#> GSM88019     2   0.000      0.994 0.000 1.000
#> GSM88027     2   0.000      0.994 0.000 1.000
#> GSM88031     2   0.000      0.994 0.000 1.000
#> GSM88012     2   0.000      0.994 0.000 1.000
#> GSM88020     2   0.000      0.994 0.000 1.000
#> GSM88032     2   0.000      0.994 0.000 1.000
#> GSM88037     2   0.000      0.994 0.000 1.000
#> GSM88013     2   0.000      0.994 0.000 1.000
#> GSM88021     2   0.000      0.994 0.000 1.000
#> GSM88025     2   0.000      0.994 0.000 1.000
#> GSM88033     2   0.000      0.994 0.000 1.000
#> GSM88014     2   0.000      0.994 0.000 1.000
#> GSM88022     2   0.000      0.994 0.000 1.000
#> GSM88034     2   0.753      0.724 0.216 0.784
#> GSM88002     2   0.000      0.994 0.000 1.000
#> GSM88003     2   0.000      0.994 0.000 1.000
#> GSM88023     2   0.000      0.994 0.000 1.000
#> GSM88026     2   0.000      0.994 0.000 1.000
#> GSM88028     2   0.000      0.994 0.000 1.000
#> GSM88035     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
#> GSM87962     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87963     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87983     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87984     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87961     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87970     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87971     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87990     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87991     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87974     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87994     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87978     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87979     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87998     1  0.3686      0.754 0.860 0.000 0.140
#> GSM87999     1  0.2878      0.832 0.904 0.000 0.096
#> GSM87968     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87987     1  0.6062     -0.143 0.616 0.000 0.384
#> GSM87969     1  0.0424      0.951 0.992 0.000 0.008
#> GSM87988     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87989     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87972     3  0.5591      0.975 0.304 0.000 0.696
#> GSM87992     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87973     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87993     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87975     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87995     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87976     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87977     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87996     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87997     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87980     3  0.5465      0.999 0.288 0.000 0.712
#> GSM88000     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87981     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87982     3  0.5465      0.999 0.288 0.000 0.712
#> GSM88001     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87967     3  0.5465      0.999 0.288 0.000 0.712
#> GSM87964     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87965     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87966     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87985     1  0.0000      0.959 1.000 0.000 0.000
#> GSM87986     1  0.0000      0.959 1.000 0.000 0.000
#> GSM88004     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88015     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88005     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88006     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88016     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88007     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88017     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88029     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88008     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88009     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88018     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88024     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88030     2  0.3412      0.887 0.000 0.876 0.124
#> GSM88036     2  0.2165      0.890 0.000 0.936 0.064
#> GSM88010     2  0.4504      0.880 0.000 0.804 0.196
#> GSM88011     2  0.4504      0.880 0.000 0.804 0.196
#> GSM88019     2  0.4887      0.874 0.000 0.772 0.228
#> GSM88027     2  0.4702      0.877 0.000 0.788 0.212
#> GSM88031     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88012     2  0.4504      0.880 0.000 0.804 0.196
#> GSM88020     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88032     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88037     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88013     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88021     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88025     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88033     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88014     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88022     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88034     2  0.5465      0.860 0.000 0.712 0.288
#> GSM88002     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88003     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88023     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88026     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88028     2  0.0000      0.900 0.000 1.000 0.000
#> GSM88035     2  0.0000      0.900 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
#> GSM87962     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87983     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87961     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87970     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87971     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87990     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87991     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87974     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87994     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87978     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87979     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87998     1  0.4564     0.5216 0.672 0.000 0.328 0.000
#> GSM87999     1  0.2814     0.8442 0.868 0.000 0.132 0.000
#> GSM87968     1  0.0188     0.9697 0.996 0.000 0.004 0.000
#> GSM87987     3  0.4925     0.2256 0.428 0.000 0.572 0.000
#> GSM87969     1  0.2216     0.8887 0.908 0.000 0.092 0.000
#> GSM87988     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87989     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87972     3  0.0592     0.9586 0.016 0.000 0.984 0.000
#> GSM87992     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87995     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87977     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87996     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM88000     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0000     0.9736 0.000 0.000 1.000 0.000
#> GSM87964     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87965     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87966     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87985     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM87986     1  0.0000     0.9727 1.000 0.000 0.000 0.000
#> GSM88004     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88005     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88029     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88008     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0000     0.6969 0.000 1.000 0.000 0.000
#> GSM88030     2  0.4661    -0.0538 0.000 0.652 0.000 0.348
#> GSM88036     2  0.3688     0.3938 0.000 0.792 0.000 0.208
#> GSM88010     2  0.4164     0.2241 0.000 0.736 0.000 0.264
#> GSM88011     2  0.4877    -0.3146 0.000 0.592 0.000 0.408
#> GSM88019     2  0.4994    -0.5456 0.000 0.520 0.000 0.480
#> GSM88027     2  0.4941    -0.4070 0.000 0.564 0.000 0.436
#> GSM88031     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88012     2  0.4866    -0.3009 0.000 0.596 0.000 0.404
#> GSM88020     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88032     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88037     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88013     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88021     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88025     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88033     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88014     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88022     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88034     4  0.4564     1.0000 0.000 0.328 0.000 0.672
#> GSM88002     2  0.4564     0.5702 0.000 0.672 0.000 0.328
#> GSM88003     2  0.4564     0.5702 0.000 0.672 0.000 0.328
#> GSM88023     2  0.4564     0.5702 0.000 0.672 0.000 0.328
#> GSM88026     2  0.4564     0.5702 0.000 0.672 0.000 0.328
#> GSM88028     2  0.4564     0.5702 0.000 0.672 0.000 0.328
#> GSM88035     2  0.4564     0.5702 0.000 0.672 0.000 0.328

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4 p5
#> GSM87962     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87963     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87983     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87984     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87961     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87970     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87971     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87990     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87991     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87974     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87994     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87978     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87979     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87998     1  0.3932      0.522 0.672 0.000 0.328 0.000  0
#> GSM87999     1  0.2424      0.829 0.868 0.000 0.132 0.000  0
#> GSM87968     1  0.0162      0.965 0.996 0.000 0.004 0.000  0
#> GSM87987     3  0.4242      0.226 0.428 0.000 0.572 0.000  0
#> GSM87969     1  0.1908      0.876 0.908 0.000 0.092 0.000  0
#> GSM87988     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87989     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87972     3  0.0510      0.951 0.016 0.000 0.984 0.000  0
#> GSM87992     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87973     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87993     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87975     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87995     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87976     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87977     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87996     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87997     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87980     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM88000     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87981     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87982     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM88001     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87967     3  0.0000      0.969 0.000 0.000 1.000 0.000  0
#> GSM87964     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87965     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87966     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87985     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM87986     1  0.0000      0.968 1.000 0.000 0.000 0.000  0
#> GSM88004     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88015     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88005     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88006     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88016     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88007     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88017     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88029     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88008     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88009     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88018     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88024     2  0.0000      0.923 0.000 1.000 0.000 0.000  0
#> GSM88030     4  0.4307     -0.045 0.000 0.500 0.000 0.500  0
#> GSM88036     2  0.4074      0.362 0.000 0.636 0.000 0.364  0
#> GSM88010     2  0.0703      0.908 0.000 0.976 0.000 0.024  0
#> GSM88011     2  0.2074      0.840 0.000 0.896 0.000 0.104  0
#> GSM88019     4  0.4114      0.315 0.000 0.376 0.000 0.624  0
#> GSM88027     2  0.4171      0.324 0.000 0.604 0.000 0.396  0
#> GSM88031     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88012     2  0.2929      0.751 0.000 0.820 0.000 0.180  0
#> GSM88020     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88032     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88037     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88013     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88021     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88025     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88033     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88014     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88022     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88034     4  0.0000      0.908 0.000 0.000 0.000 1.000  0
#> GSM88002     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88003     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88023     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88026     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88028     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88035     5  0.0000      1.000 0.000 0.000 0.000 0.000  1

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4 p5    p6
#> GSM87962     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM87963     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM87983     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM87984     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM87961     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM87970     1  0.0000      0.721 1.000 0.000 0.000 0.000  0 0.000
#> GSM87971     1  0.0000      0.721 1.000 0.000 0.000 0.000  0 0.000
#> GSM87990     1  0.3592      0.757 0.656 0.000 0.000 0.000  0 0.344
#> GSM87991     1  0.3774      0.756 0.592 0.000 0.000 0.000  0 0.408
#> GSM87974     1  0.0000      0.721 1.000 0.000 0.000 0.000  0 0.000
#> GSM87994     1  0.3578      0.757 0.660 0.000 0.000 0.000  0 0.340
#> GSM87978     1  0.0000      0.721 1.000 0.000 0.000 0.000  0 0.000
#> GSM87979     1  0.0000      0.721 1.000 0.000 0.000 0.000  0 0.000
#> GSM87998     1  0.2260      0.599 0.860 0.000 0.140 0.000  0 0.000
#> GSM87999     1  0.0790      0.705 0.968 0.000 0.032 0.000  0 0.000
#> GSM87968     1  0.0146      0.719 0.996 0.000 0.004 0.000  0 0.000
#> GSM87987     1  0.3868     -0.258 0.508 0.000 0.492 0.000  0 0.000
#> GSM87969     1  0.1387      0.673 0.932 0.000 0.068 0.000  0 0.000
#> GSM87988     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87989     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87972     3  0.3789      0.419 0.416 0.000 0.584 0.000  0 0.000
#> GSM87992     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87973     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87993     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87975     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87995     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87976     3  0.1007      0.928 0.044 0.000 0.956 0.000  0 0.000
#> GSM87977     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87996     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87997     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87980     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM88000     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87981     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87982     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM88001     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87967     3  0.0000      0.970 0.000 0.000 1.000 0.000  0 0.000
#> GSM87964     1  0.0713      0.724 0.972 0.000 0.000 0.000  0 0.028
#> GSM87965     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM87966     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM87985     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM87986     1  0.3782      0.756 0.588 0.000 0.000 0.000  0 0.412
#> GSM88004     2  0.0000      0.948 0.000 1.000 0.000 0.000  0 0.000
#> GSM88015     2  0.0000      0.948 0.000 1.000 0.000 0.000  0 0.000
#> GSM88005     2  0.0000      0.948 0.000 1.000 0.000 0.000  0 0.000
#> GSM88006     2  0.0000      0.948 0.000 1.000 0.000 0.000  0 0.000
#> GSM88016     2  0.0146      0.947 0.000 0.996 0.000 0.000  0 0.004
#> GSM88007     2  0.0000      0.948 0.000 1.000 0.000 0.000  0 0.000
#> GSM88017     2  0.0146      0.947 0.000 0.996 0.000 0.000  0 0.004
#> GSM88029     2  0.0458      0.936 0.000 0.984 0.000 0.000  0 0.016
#> GSM88008     2  0.0000      0.948 0.000 1.000 0.000 0.000  0 0.000
#> GSM88009     2  0.0000      0.948 0.000 1.000 0.000 0.000  0 0.000
#> GSM88018     2  0.0146      0.947 0.000 0.996 0.000 0.000  0 0.004
#> GSM88024     2  0.0146      0.947 0.000 0.996 0.000 0.000  0 0.004
#> GSM88030     4  0.4310      0.171 0.000 0.440 0.000 0.540  0 0.020
#> GSM88036     2  0.4092      0.314 0.000 0.636 0.000 0.344  0 0.020
#> GSM88010     6  0.4161      0.549 0.000 0.448 0.000 0.012  0 0.540
#> GSM88011     6  0.4395      0.613 0.000 0.404 0.000 0.028  0 0.568
#> GSM88019     6  0.5463      0.647 0.000 0.312 0.000 0.148  0 0.540
#> GSM88027     6  0.4624      0.585 0.000 0.432 0.000 0.040  0 0.528
#> GSM88031     4  0.0000      0.915 0.000 0.000 0.000 1.000  0 0.000
#> GSM88012     6  0.4508      0.622 0.000 0.396 0.000 0.036  0 0.568
#> GSM88020     4  0.0000      0.915 0.000 0.000 0.000 1.000  0 0.000
#> GSM88032     4  0.0000      0.915 0.000 0.000 0.000 1.000  0 0.000
#> GSM88037     4  0.0000      0.915 0.000 0.000 0.000 1.000  0 0.000
#> GSM88013     6  0.3817      0.353 0.000 0.000 0.000 0.432  0 0.568
#> GSM88021     4  0.0000      0.915 0.000 0.000 0.000 1.000  0 0.000
#> GSM88025     4  0.0000      0.915 0.000 0.000 0.000 1.000  0 0.000
#> GSM88033     4  0.0000      0.915 0.000 0.000 0.000 1.000  0 0.000
#> GSM88014     6  0.3817      0.353 0.000 0.000 0.000 0.432  0 0.568
#> GSM88022     6  0.3817      0.353 0.000 0.000 0.000 0.432  0 0.568
#> GSM88034     4  0.0000      0.915 0.000 0.000 0.000 1.000  0 0.000
#> GSM88002     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88003     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88023     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88026     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88028     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88035     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 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 cell.line(p) agent(p)  time(p) k
#> SD:pam 77     1.27e-17 3.00e-14 3.61e-01 2
#> SD:pam 76     3.14e-17 1.71e-15 6.09e-03 3
#> SD:pam 69     6.99e-15 1.76e-13 2.23e-05 4
#> SD:pam 72     8.58e-15 2.48e-20 2.99e-07 5
#> SD:pam 70     1.02e-13 4.31e-18 7.39e-08 6

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


SD:mclust*

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

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

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

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

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 1.000           0.986       0.993         0.2774 0.859   0.714
#> 4 4 0.885           0.797       0.913         0.1252 0.904   0.740
#> 5 5 0.986           0.956       0.982         0.0718 0.900   0.671
#> 6 6 0.929           0.967       0.951         0.0439 0.973   0.875

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

There is also optional best \(k\) = 2 3 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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      0.996 1.000  0 0.000
#> GSM87963     1  0.0000      0.996 1.000  0 0.000
#> GSM87983     1  0.0000      0.996 1.000  0 0.000
#> GSM87984     1  0.0000      0.996 1.000  0 0.000
#> GSM87961     1  0.0000      0.996 1.000  0 0.000
#> GSM87970     1  0.0000      0.996 1.000  0 0.000
#> GSM87971     1  0.0000      0.996 1.000  0 0.000
#> GSM87990     1  0.0000      0.996 1.000  0 0.000
#> GSM87991     1  0.0000      0.996 1.000  0 0.000
#> GSM87974     1  0.0000      0.996 1.000  0 0.000
#> GSM87994     1  0.0592      0.989 0.988  0 0.012
#> GSM87978     1  0.0000      0.996 1.000  0 0.000
#> GSM87979     1  0.0000      0.996 1.000  0 0.000
#> GSM87998     1  0.0747      0.986 0.984  0 0.016
#> GSM87999     1  0.0747      0.986 0.984  0 0.016
#> GSM87968     1  0.0000      0.996 1.000  0 0.000
#> GSM87987     1  0.0747      0.986 0.984  0 0.016
#> GSM87969     1  0.0747      0.986 0.984  0 0.016
#> GSM87988     3  0.3941      0.836 0.156  0 0.844
#> GSM87989     3  0.3941      0.836 0.156  0 0.844
#> GSM87972     3  0.3941      0.836 0.156  0 0.844
#> GSM87992     3  0.0000      0.972 0.000  0 1.000
#> GSM87973     3  0.0000      0.972 0.000  0 1.000
#> GSM87993     3  0.0000      0.972 0.000  0 1.000
#> GSM87975     3  0.0000      0.972 0.000  0 1.000
#> GSM87995     3  0.0000      0.972 0.000  0 1.000
#> GSM87976     3  0.0000      0.972 0.000  0 1.000
#> GSM87977     3  0.0000      0.972 0.000  0 1.000
#> GSM87996     3  0.0000      0.972 0.000  0 1.000
#> GSM87997     3  0.0000      0.972 0.000  0 1.000
#> GSM87980     3  0.0000      0.972 0.000  0 1.000
#> GSM88000     3  0.0000      0.972 0.000  0 1.000
#> GSM87981     3  0.0000      0.972 0.000  0 1.000
#> GSM87982     3  0.0000      0.972 0.000  0 1.000
#> GSM88001     3  0.0000      0.972 0.000  0 1.000
#> GSM87967     3  0.0000      0.972 0.000  0 1.000
#> GSM87964     1  0.0000      0.996 1.000  0 0.000
#> GSM87965     1  0.0000      0.996 1.000  0 0.000
#> GSM87966     1  0.0000      0.996 1.000  0 0.000
#> GSM87985     1  0.0000      0.996 1.000  0 0.000
#> GSM87986     1  0.0000      0.996 1.000  0 0.000
#> GSM88004     2  0.0000      1.000 0.000  1 0.000
#> GSM88015     2  0.0000      1.000 0.000  1 0.000
#> GSM88005     2  0.0000      1.000 0.000  1 0.000
#> GSM88006     2  0.0000      1.000 0.000  1 0.000
#> GSM88016     2  0.0000      1.000 0.000  1 0.000
#> GSM88007     2  0.0000      1.000 0.000  1 0.000
#> GSM88017     2  0.0000      1.000 0.000  1 0.000
#> GSM88029     2  0.0000      1.000 0.000  1 0.000
#> GSM88008     2  0.0000      1.000 0.000  1 0.000
#> GSM88009     2  0.0000      1.000 0.000  1 0.000
#> GSM88018     2  0.0000      1.000 0.000  1 0.000
#> GSM88024     2  0.0000      1.000 0.000  1 0.000
#> GSM88030     2  0.0000      1.000 0.000  1 0.000
#> GSM88036     2  0.0000      1.000 0.000  1 0.000
#> GSM88010     2  0.0000      1.000 0.000  1 0.000
#> GSM88011     2  0.0000      1.000 0.000  1 0.000
#> GSM88019     2  0.0000      1.000 0.000  1 0.000
#> GSM88027     2  0.0000      1.000 0.000  1 0.000
#> GSM88031     2  0.0000      1.000 0.000  1 0.000
#> GSM88012     2  0.0000      1.000 0.000  1 0.000
#> GSM88020     2  0.0000      1.000 0.000  1 0.000
#> GSM88032     2  0.0000      1.000 0.000  1 0.000
#> GSM88037     2  0.0000      1.000 0.000  1 0.000
#> GSM88013     2  0.0000      1.000 0.000  1 0.000
#> GSM88021     2  0.0000      1.000 0.000  1 0.000
#> GSM88025     2  0.0000      1.000 0.000  1 0.000
#> GSM88033     2  0.0000      1.000 0.000  1 0.000
#> GSM88014     2  0.0000      1.000 0.000  1 0.000
#> GSM88022     2  0.0000      1.000 0.000  1 0.000
#> GSM88034     2  0.0000      1.000 0.000  1 0.000
#> GSM88002     2  0.0000      1.000 0.000  1 0.000
#> GSM88003     2  0.0000      1.000 0.000  1 0.000
#> GSM88023     2  0.0000      1.000 0.000  1 0.000
#> GSM88026     2  0.0000      1.000 0.000  1 0.000
#> GSM88028     2  0.0000      1.000 0.000  1 0.000
#> GSM88035     2  0.0000      1.000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87983     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87961     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87970     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87971     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87990     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87991     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87974     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87994     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87978     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87979     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87998     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87999     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87968     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87987     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87969     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87988     1  0.3975     0.6752 0.760 0.000 0.240 0.000
#> GSM87989     1  0.4431     0.5559 0.696 0.000 0.304 0.000
#> GSM87972     3  0.5000    -0.0626 0.500 0.000 0.500 0.000
#> GSM87992     3  0.0592     0.9381 0.016 0.000 0.984 0.000
#> GSM87973     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87995     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87977     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87996     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM88000     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0000     0.9553 0.000 0.000 1.000 0.000
#> GSM87964     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87965     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87966     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87985     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM87986     1  0.0000     0.9749 1.000 0.000 0.000 0.000
#> GSM88004     4  0.4948     0.3324 0.000 0.440 0.000 0.560
#> GSM88015     4  0.4998     0.3063 0.000 0.488 0.000 0.512
#> GSM88005     4  0.4996     0.3159 0.000 0.484 0.000 0.516
#> GSM88006     4  0.4998     0.3063 0.000 0.488 0.000 0.512
#> GSM88016     4  0.4981     0.3507 0.000 0.464 0.000 0.536
#> GSM88007     4  0.4996     0.3159 0.000 0.484 0.000 0.516
#> GSM88017     4  0.4996     0.3159 0.000 0.484 0.000 0.516
#> GSM88029     2  0.4925    -0.1734 0.000 0.572 0.000 0.428
#> GSM88008     4  0.4996     0.3159 0.000 0.484 0.000 0.516
#> GSM88009     4  0.4989     0.3378 0.000 0.472 0.000 0.528
#> GSM88018     4  0.2589     0.7197 0.000 0.116 0.000 0.884
#> GSM88024     4  0.4746     0.4848 0.000 0.368 0.000 0.632
#> GSM88030     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88036     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88010     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88011     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88019     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88027     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88031     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88012     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88020     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88032     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88013     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88021     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88014     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88022     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88034     4  0.0000     0.7849 0.000 0.000 0.000 1.000
#> GSM88002     2  0.1792     0.8956 0.000 0.932 0.000 0.068
#> GSM88003     2  0.1792     0.8956 0.000 0.932 0.000 0.068
#> GSM88023     2  0.1792     0.8956 0.000 0.932 0.000 0.068
#> GSM88026     2  0.1792     0.8956 0.000 0.932 0.000 0.068
#> GSM88028     2  0.1792     0.8956 0.000 0.932 0.000 0.068
#> GSM88035     2  0.1792     0.8956 0.000 0.932 0.000 0.068

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4 p5
#> GSM87962     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87963     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87983     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87984     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87961     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87970     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87971     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87990     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87991     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87974     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87994     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87978     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87979     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87998     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87999     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87968     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87987     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87969     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87988     3  0.2966      0.766 0.184 0.000 0.816 0.000  0
#> GSM87989     3  0.2966      0.766 0.184 0.000 0.816 0.000  0
#> GSM87972     3  0.2929      0.771 0.180 0.000 0.820 0.000  0
#> GSM87992     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87973     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87993     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87975     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87995     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87976     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87977     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87996     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87997     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87980     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM88000     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87981     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87982     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM88001     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87967     3  0.0000      0.957 0.000 0.000 1.000 0.000  0
#> GSM87964     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87965     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87966     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87985     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87986     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM88004     2  0.0609      0.894 0.000 0.980 0.000 0.020  0
#> GSM88015     2  0.0000      0.906 0.000 1.000 0.000 0.000  0
#> GSM88005     2  0.0000      0.906 0.000 1.000 0.000 0.000  0
#> GSM88006     2  0.0000      0.906 0.000 1.000 0.000 0.000  0
#> GSM88016     2  0.4015      0.523 0.000 0.652 0.000 0.348  0
#> GSM88007     2  0.0000      0.906 0.000 1.000 0.000 0.000  0
#> GSM88017     2  0.0000      0.906 0.000 1.000 0.000 0.000  0
#> GSM88029     2  0.4060      0.491 0.000 0.640 0.000 0.360  0
#> GSM88008     2  0.0000      0.906 0.000 1.000 0.000 0.000  0
#> GSM88009     2  0.0000      0.906 0.000 1.000 0.000 0.000  0
#> GSM88018     2  0.0000      0.906 0.000 1.000 0.000 0.000  0
#> GSM88024     2  0.1270      0.867 0.000 0.948 0.000 0.052  0
#> GSM88030     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88036     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88010     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88011     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88019     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88027     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88031     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88012     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88020     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88032     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88037     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88013     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88021     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88025     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88033     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88014     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88022     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88034     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88002     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88003     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88023     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88026     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88028     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88035     5  0.0000      1.000 0.000 0.000 0.000 0.000  1

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4 p5    p6
#> GSM87962     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87963     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87983     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87984     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87961     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87970     1  0.0937      0.917 0.960 0.000 0.000 0.000  0 0.040
#> GSM87971     1  0.2219      0.904 0.864 0.000 0.000 0.000  0 0.136
#> GSM87990     1  0.0260      0.919 0.992 0.000 0.000 0.000  0 0.008
#> GSM87991     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87974     1  0.2730      0.892 0.808 0.000 0.000 0.000  0 0.192
#> GSM87994     1  0.2793      0.889 0.800 0.000 0.000 0.000  0 0.200
#> GSM87978     1  0.2730      0.892 0.808 0.000 0.000 0.000  0 0.192
#> GSM87979     1  0.2730      0.892 0.808 0.000 0.000 0.000  0 0.192
#> GSM87998     1  0.2793      0.889 0.800 0.000 0.000 0.000  0 0.200
#> GSM87999     1  0.2793      0.889 0.800 0.000 0.000 0.000  0 0.200
#> GSM87968     1  0.2730      0.892 0.808 0.000 0.000 0.000  0 0.192
#> GSM87987     1  0.2793      0.889 0.800 0.000 0.000 0.000  0 0.200
#> GSM87969     1  0.2793      0.889 0.800 0.000 0.000 0.000  0 0.200
#> GSM87988     3  0.0260      0.993 0.000 0.000 0.992 0.000  0 0.008
#> GSM87989     3  0.0260      0.993 0.000 0.000 0.992 0.000  0 0.008
#> GSM87972     3  0.0260      0.993 0.000 0.000 0.992 0.000  0 0.008
#> GSM87992     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87973     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87993     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87975     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87995     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87976     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87977     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87996     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87997     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87980     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM88000     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87981     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87982     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM88001     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87967     3  0.0000      0.999 0.000 0.000 1.000 0.000  0 0.000
#> GSM87964     1  0.0363      0.919 0.988 0.000 0.000 0.000  0 0.012
#> GSM87965     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87966     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87985     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM87986     1  0.0000      0.919 1.000 0.000 0.000 0.000  0 0.000
#> GSM88004     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88015     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88005     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88006     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88016     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88007     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88017     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88029     2  0.0146      0.996 0.000 0.996 0.000 0.004  0 0.000
#> GSM88008     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88009     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88018     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88024     2  0.0000      1.000 0.000 1.000 0.000 0.000  0 0.000
#> GSM88030     4  0.0000      0.972 0.000 0.000 0.000 1.000  0 0.000
#> GSM88036     4  0.0000      0.972 0.000 0.000 0.000 1.000  0 0.000
#> GSM88010     4  0.0000      0.972 0.000 0.000 0.000 1.000  0 0.000
#> GSM88011     4  0.0000      0.972 0.000 0.000 0.000 1.000  0 0.000
#> GSM88019     4  0.0000      0.972 0.000 0.000 0.000 1.000  0 0.000
#> GSM88027     4  0.0000      0.972 0.000 0.000 0.000 1.000  0 0.000
#> GSM88031     6  0.2793      1.000 0.000 0.000 0.000 0.200  0 0.800
#> GSM88012     4  0.0146      0.971 0.000 0.000 0.000 0.996  0 0.004
#> GSM88020     6  0.2793      1.000 0.000 0.000 0.000 0.200  0 0.800
#> GSM88032     6  0.2793      1.000 0.000 0.000 0.000 0.200  0 0.800
#> GSM88037     6  0.2793      1.000 0.000 0.000 0.000 0.200  0 0.800
#> GSM88013     4  0.1327      0.933 0.000 0.000 0.000 0.936  0 0.064
#> GSM88021     6  0.2793      1.000 0.000 0.000 0.000 0.200  0 0.800
#> GSM88025     6  0.2793      1.000 0.000 0.000 0.000 0.200  0 0.800
#> GSM88033     6  0.2793      1.000 0.000 0.000 0.000 0.200  0 0.800
#> GSM88014     4  0.1327      0.933 0.000 0.000 0.000 0.936  0 0.064
#> GSM88022     4  0.1327      0.933 0.000 0.000 0.000 0.936  0 0.064
#> GSM88034     6  0.2793      1.000 0.000 0.000 0.000 0.200  0 0.800
#> GSM88002     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88003     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88023     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88026     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88028     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88035     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 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 cell.line(p) agent(p)  time(p) k
#> SD:mclust 77     1.27e-17 3.00e-14 3.61e-01 2
#> SD:mclust 77     1.90e-17 1.77e-15 3.80e-03 3
#> SD:mclust 65     5.02e-14 8.07e-19 5.46e-06 4
#> SD:mclust 76     1.22e-15 1.84e-21 3.21e-08 5
#> SD:mclust 77     3.56e-15 2.90e-20 8.56e-08 6

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


SD:NMF**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 18792 rows and 77 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           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.696           0.816       0.832         0.2417 0.889   0.777
#> 4 4 0.893           0.904       0.953         0.1696 0.881   0.691
#> 5 5 0.815           0.849       0.906         0.0626 0.853   0.533
#> 6 6 0.875           0.843       0.912         0.0312 0.972   0.875

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87963     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87983     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87984     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87961     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87970     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87971     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87990     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87991     1  0.5591      0.833 0.696 0.304 0.000
#> GSM87974     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87994     1  0.2165      0.863 0.936 0.064 0.000
#> GSM87978     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87979     1  0.5621      0.832 0.692 0.308 0.000
#> GSM87998     1  0.1031      0.865 0.976 0.024 0.000
#> GSM87999     1  0.1031      0.865 0.976 0.024 0.000
#> GSM87968     1  0.5650      0.832 0.688 0.312 0.000
#> GSM87987     1  0.0892      0.865 0.980 0.020 0.000
#> GSM87969     1  0.1964      0.864 0.944 0.056 0.000
#> GSM87988     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87989     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87972     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87992     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87973     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87993     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87975     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87995     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87976     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87977     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87996     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87997     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87980     1  0.0000      0.865 1.000 0.000 0.000
#> GSM88000     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87981     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87982     1  0.0000      0.865 1.000 0.000 0.000
#> GSM88001     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87967     1  0.0000      0.865 1.000 0.000 0.000
#> GSM87964     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87965     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87966     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87985     1  0.5706      0.830 0.680 0.320 0.000
#> GSM87986     1  0.5706      0.830 0.680 0.320 0.000
#> GSM88004     2  0.5397      0.875 0.000 0.720 0.280
#> GSM88015     2  0.2711      0.622 0.000 0.912 0.088
#> GSM88005     2  0.4062      0.741 0.000 0.836 0.164
#> GSM88006     2  0.4002      0.735 0.000 0.840 0.160
#> GSM88016     2  0.4796      0.812 0.000 0.780 0.220
#> GSM88007     2  0.5178      0.852 0.000 0.744 0.256
#> GSM88017     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88029     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88008     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88009     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88018     2  0.5650      0.899 0.000 0.688 0.312
#> GSM88024     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88030     3  0.4504      0.615 0.000 0.196 0.804
#> GSM88036     3  0.5178      0.480 0.000 0.256 0.744
#> GSM88010     3  0.6280     -0.355 0.000 0.460 0.540
#> GSM88011     3  0.5363      0.446 0.000 0.276 0.724
#> GSM88019     3  0.4555      0.619 0.000 0.200 0.800
#> GSM88027     3  0.5254      0.478 0.000 0.264 0.736
#> GSM88031     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88012     3  0.0424      0.848 0.000 0.008 0.992
#> GSM88020     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88032     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88037     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88013     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88021     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88025     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88033     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88014     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88022     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88034     3  0.0000      0.853 0.000 0.000 1.000
#> GSM88002     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88003     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88023     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88026     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88028     2  0.5706      0.903 0.000 0.680 0.320
#> GSM88035     2  0.5706      0.903 0.000 0.680 0.320

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.0592     0.8913 0.984 0.000 0.016 0.000
#> GSM87963     1  0.0336     0.8860 0.992 0.000 0.008 0.000
#> GSM87983     1  0.1637     0.8931 0.940 0.000 0.060 0.000
#> GSM87984     1  0.0592     0.8913 0.984 0.000 0.016 0.000
#> GSM87961     1  0.0336     0.8860 0.992 0.000 0.008 0.000
#> GSM87970     1  0.4331     0.6535 0.712 0.000 0.288 0.000
#> GSM87971     1  0.1940     0.8876 0.924 0.000 0.076 0.000
#> GSM87990     1  0.3266     0.8270 0.832 0.000 0.168 0.000
#> GSM87991     3  0.4250     0.6486 0.276 0.000 0.724 0.000
#> GSM87974     3  0.4477     0.5806 0.312 0.000 0.688 0.000
#> GSM87994     3  0.3400     0.7766 0.180 0.000 0.820 0.000
#> GSM87978     3  0.4331     0.6268 0.288 0.000 0.712 0.000
#> GSM87979     3  0.3726     0.7407 0.212 0.000 0.788 0.000
#> GSM87998     3  0.2469     0.8428 0.108 0.000 0.892 0.000
#> GSM87999     3  0.2408     0.8458 0.104 0.000 0.896 0.000
#> GSM87968     3  0.3907     0.7159 0.232 0.000 0.768 0.000
#> GSM87987     3  0.0817     0.8936 0.024 0.000 0.976 0.000
#> GSM87969     3  0.1867     0.8672 0.072 0.000 0.928 0.000
#> GSM87988     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87989     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87972     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87992     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87995     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87977     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87996     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM88000     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0000     0.9044 0.000 0.000 1.000 0.000
#> GSM87964     1  0.0592     0.8913 0.984 0.000 0.016 0.000
#> GSM87965     1  0.3356     0.8187 0.824 0.000 0.176 0.000
#> GSM87966     3  0.4994     0.0598 0.480 0.000 0.520 0.000
#> GSM87985     1  0.1474     0.8942 0.948 0.000 0.052 0.000
#> GSM87986     1  0.4277     0.6685 0.720 0.000 0.280 0.000
#> GSM88004     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0188     0.9956 0.004 0.996 0.000 0.000
#> GSM88005     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88029     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88008     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0000     0.9986 0.000 1.000 0.000 0.000
#> GSM88030     4  0.1474     0.9456 0.000 0.052 0.000 0.948
#> GSM88036     4  0.1716     0.9328 0.000 0.064 0.000 0.936
#> GSM88010     4  0.0921     0.9672 0.000 0.028 0.000 0.972
#> GSM88011     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88019     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88027     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88031     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88012     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88020     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88032     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88013     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88021     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88014     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88022     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88034     4  0.0000     0.9907 0.000 0.000 0.000 1.000
#> GSM88002     2  0.0188     0.9976 0.004 0.996 0.000 0.000
#> GSM88003     2  0.0188     0.9976 0.004 0.996 0.000 0.000
#> GSM88023     2  0.0188     0.9976 0.004 0.996 0.000 0.000
#> GSM88026     2  0.0188     0.9976 0.004 0.996 0.000 0.000
#> GSM88028     2  0.0188     0.9976 0.004 0.996 0.000 0.000
#> GSM88035     2  0.0188     0.9976 0.004 0.996 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
#> GSM87962     1  0.0290    0.87948 0.992 0.000 0.008 0.000 0.000
#> GSM87963     1  0.0162    0.87306 0.996 0.000 0.000 0.000 0.004
#> GSM87983     1  0.0955    0.88768 0.968 0.000 0.028 0.000 0.004
#> GSM87984     1  0.0290    0.87948 0.992 0.000 0.008 0.000 0.000
#> GSM87961     1  0.0324    0.87638 0.992 0.000 0.004 0.000 0.004
#> GSM87970     1  0.1484    0.89361 0.944 0.000 0.048 0.000 0.008
#> GSM87971     1  0.1195    0.87354 0.960 0.000 0.012 0.000 0.028
#> GSM87990     1  0.0880    0.89014 0.968 0.000 0.032 0.000 0.000
#> GSM87991     1  0.2605    0.87848 0.852 0.000 0.148 0.000 0.000
#> GSM87974     1  0.2761    0.89164 0.872 0.000 0.104 0.000 0.024
#> GSM87994     1  0.2813    0.86613 0.832 0.000 0.168 0.000 0.000
#> GSM87978     1  0.3051    0.88816 0.852 0.000 0.120 0.000 0.028
#> GSM87979     1  0.2583    0.88585 0.864 0.000 0.132 0.000 0.004
#> GSM87998     1  0.3039    0.84855 0.808 0.000 0.192 0.000 0.000
#> GSM87999     1  0.3109    0.84173 0.800 0.000 0.200 0.000 0.000
#> GSM87968     1  0.3085    0.88878 0.852 0.000 0.116 0.000 0.032
#> GSM87987     1  0.4304    0.27582 0.516 0.000 0.484 0.000 0.000
#> GSM87969     1  0.3816    0.69950 0.696 0.000 0.304 0.000 0.000
#> GSM87988     3  0.1197    0.95051 0.048 0.000 0.952 0.000 0.000
#> GSM87989     3  0.1270    0.94588 0.052 0.000 0.948 0.000 0.000
#> GSM87972     3  0.0290    0.98863 0.008 0.000 0.992 0.000 0.000
#> GSM87992     3  0.0609    0.97860 0.020 0.000 0.980 0.000 0.000
#> GSM87973     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM87993     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM87975     3  0.0451    0.98720 0.008 0.000 0.988 0.000 0.004
#> GSM87995     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM87976     3  0.0451    0.98720 0.008 0.000 0.988 0.000 0.004
#> GSM87977     3  0.0324    0.98913 0.004 0.000 0.992 0.000 0.004
#> GSM87996     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM87997     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM87980     3  0.0324    0.98913 0.004 0.000 0.992 0.000 0.004
#> GSM88000     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM87981     3  0.0324    0.98913 0.004 0.000 0.992 0.000 0.004
#> GSM87982     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM88001     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM87967     3  0.0162    0.99050 0.004 0.000 0.996 0.000 0.000
#> GSM87964     1  0.2227    0.84012 0.916 0.032 0.004 0.000 0.048
#> GSM87965     1  0.1478    0.89607 0.936 0.000 0.064 0.000 0.000
#> GSM87966     1  0.2424    0.88557 0.868 0.000 0.132 0.000 0.000
#> GSM87985     1  0.0404    0.88171 0.988 0.000 0.012 0.000 0.000
#> GSM87986     1  0.1704    0.89578 0.928 0.000 0.068 0.000 0.004
#> GSM88004     2  0.2329    0.86635 0.000 0.876 0.000 0.000 0.124
#> GSM88015     2  0.2389    0.88105 0.004 0.880 0.000 0.000 0.116
#> GSM88005     2  0.2249    0.88487 0.008 0.896 0.000 0.000 0.096
#> GSM88006     2  0.2136    0.88534 0.008 0.904 0.000 0.000 0.088
#> GSM88016     2  0.1965    0.88221 0.000 0.904 0.000 0.000 0.096
#> GSM88007     2  0.2293    0.88456 0.016 0.900 0.000 0.000 0.084
#> GSM88017     2  0.1502    0.83825 0.004 0.940 0.000 0.000 0.056
#> GSM88029     2  0.1502    0.83825 0.004 0.940 0.000 0.000 0.056
#> GSM88008     2  0.2305    0.88454 0.012 0.896 0.000 0.000 0.092
#> GSM88009     2  0.2074    0.87892 0.000 0.896 0.000 0.000 0.104
#> GSM88018     2  0.1484    0.85539 0.008 0.944 0.000 0.000 0.048
#> GSM88024     2  0.0566    0.85975 0.004 0.984 0.000 0.000 0.012
#> GSM88030     4  0.5036    0.22196 0.004 0.452 0.000 0.520 0.024
#> GSM88036     4  0.5049    0.16976 0.004 0.472 0.000 0.500 0.024
#> GSM88010     2  0.4533    0.00581 0.000 0.544 0.000 0.448 0.008
#> GSM88011     4  0.4359    0.32516 0.000 0.412 0.000 0.584 0.004
#> GSM88019     4  0.3730    0.56997 0.000 0.288 0.000 0.712 0.000
#> GSM88027     4  0.4251    0.41740 0.000 0.372 0.000 0.624 0.004
#> GSM88031     4  0.0000    0.84684 0.000 0.000 0.000 1.000 0.000
#> GSM88012     4  0.0510    0.84339 0.000 0.016 0.000 0.984 0.000
#> GSM88020     4  0.1410    0.81711 0.000 0.060 0.000 0.940 0.000
#> GSM88032     4  0.0000    0.84684 0.000 0.000 0.000 1.000 0.000
#> GSM88037     4  0.0000    0.84684 0.000 0.000 0.000 1.000 0.000
#> GSM88013     4  0.0290    0.84615 0.000 0.008 0.000 0.992 0.000
#> GSM88021     4  0.0000    0.84684 0.000 0.000 0.000 1.000 0.000
#> GSM88025     4  0.0000    0.84684 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0000    0.84684 0.000 0.000 0.000 1.000 0.000
#> GSM88014     4  0.0290    0.84615 0.000 0.008 0.000 0.992 0.000
#> GSM88022     4  0.0290    0.84615 0.000 0.008 0.000 0.992 0.000
#> GSM88034     4  0.0771    0.83772 0.000 0.020 0.000 0.976 0.004
#> GSM88002     5  0.2074    0.99250 0.000 0.104 0.000 0.000 0.896
#> GSM88003     5  0.2020    0.99423 0.000 0.100 0.000 0.000 0.900
#> GSM88023     5  0.2127    0.99308 0.000 0.108 0.000 0.000 0.892
#> GSM88026     5  0.2074    0.99650 0.000 0.104 0.000 0.000 0.896
#> GSM88028     5  0.2074    0.99650 0.000 0.104 0.000 0.000 0.896
#> GSM88035     5  0.2074    0.99650 0.000 0.104 0.000 0.000 0.896

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.0000     0.9244 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87963     1  0.0146     0.9242 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM87983     1  0.0767     0.9238 0.976 0.000 0.008 0.000 0.004 0.012
#> GSM87984     1  0.0000     0.9244 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87961     1  0.0291     0.9238 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM87970     1  0.0725     0.9219 0.976 0.000 0.000 0.000 0.012 0.012
#> GSM87971     1  0.1562     0.9084 0.940 0.004 0.000 0.000 0.032 0.024
#> GSM87990     1  0.0865     0.9236 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM87991     1  0.1765     0.9130 0.924 0.000 0.024 0.000 0.000 0.052
#> GSM87974     1  0.2307     0.9081 0.896 0.004 0.000 0.000 0.032 0.068
#> GSM87994     1  0.2542     0.8905 0.876 0.000 0.044 0.000 0.000 0.080
#> GSM87978     1  0.2307     0.9081 0.896 0.004 0.000 0.000 0.032 0.068
#> GSM87979     1  0.1769     0.9180 0.924 0.000 0.004 0.000 0.012 0.060
#> GSM87998     1  0.3458     0.8312 0.808 0.000 0.112 0.000 0.000 0.080
#> GSM87999     1  0.3757     0.8023 0.780 0.000 0.136 0.000 0.000 0.084
#> GSM87968     1  0.2670     0.9038 0.876 0.004 0.004 0.000 0.032 0.084
#> GSM87987     1  0.4738     0.6033 0.640 0.000 0.276 0.000 0.000 0.084
#> GSM87969     1  0.3354     0.8294 0.812 0.000 0.128 0.000 0.000 0.060
#> GSM87988     3  0.2563     0.8670 0.052 0.000 0.876 0.000 0.000 0.072
#> GSM87989     3  0.2680     0.8581 0.056 0.000 0.868 0.000 0.000 0.076
#> GSM87972     3  0.0547     0.9704 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM87992     3  0.0806     0.9582 0.008 0.000 0.972 0.000 0.000 0.020
#> GSM87973     3  0.0260     0.9734 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM87993     3  0.0000     0.9739 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87975     3  0.1138     0.9567 0.012 0.000 0.960 0.000 0.004 0.024
#> GSM87995     3  0.0000     0.9739 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87976     3  0.1149     0.9574 0.008 0.000 0.960 0.000 0.008 0.024
#> GSM87977     3  0.0260     0.9734 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM87996     3  0.0000     0.9739 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87997     3  0.0000     0.9739 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87980     3  0.0508     0.9707 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM88000     3  0.0000     0.9739 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87981     3  0.0508     0.9707 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM87982     3  0.0260     0.9734 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM88001     3  0.0000     0.9739 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87967     3  0.0260     0.9734 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM87964     1  0.2189     0.8946 0.912 0.008 0.004 0.000 0.032 0.044
#> GSM87965     1  0.0146     0.9251 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM87966     1  0.0622     0.9251 0.980 0.000 0.012 0.000 0.000 0.008
#> GSM87985     1  0.0146     0.9247 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM87986     1  0.0862     0.9230 0.972 0.000 0.008 0.000 0.004 0.016
#> GSM88004     2  0.1418     0.7117 0.000 0.944 0.000 0.000 0.032 0.024
#> GSM88015     2  0.2163     0.6552 0.000 0.892 0.000 0.000 0.016 0.092
#> GSM88005     2  0.0146     0.7230 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM88006     2  0.0508     0.7215 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM88016     2  0.1858     0.6641 0.000 0.904 0.000 0.000 0.004 0.092
#> GSM88007     2  0.0260     0.7230 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM88017     6  0.4026     0.7264 0.000 0.376 0.000 0.000 0.012 0.612
#> GSM88029     6  0.4057     0.7078 0.000 0.388 0.000 0.000 0.012 0.600
#> GSM88008     2  0.0717     0.7195 0.000 0.976 0.000 0.000 0.016 0.008
#> GSM88009     2  0.0547     0.7207 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM88018     2  0.3684     0.1256 0.000 0.664 0.000 0.000 0.004 0.332
#> GSM88024     2  0.3841    -0.0681 0.000 0.616 0.000 0.000 0.004 0.380
#> GSM88030     6  0.4582     0.7734 0.004 0.176 0.000 0.076 0.016 0.728
#> GSM88036     6  0.4510     0.7788 0.004 0.180 0.000 0.068 0.016 0.732
#> GSM88010     2  0.4134     0.3751 0.000 0.656 0.000 0.316 0.000 0.028
#> GSM88011     2  0.4403     0.2012 0.000 0.564 0.000 0.408 0.000 0.028
#> GSM88019     4  0.3608     0.5784 0.000 0.272 0.000 0.716 0.000 0.012
#> GSM88027     4  0.3975     0.3128 0.000 0.392 0.000 0.600 0.000 0.008
#> GSM88031     4  0.0000     0.9285 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88012     4  0.1088     0.9073 0.000 0.024 0.000 0.960 0.000 0.016
#> GSM88020     4  0.1075     0.8923 0.000 0.000 0.000 0.952 0.000 0.048
#> GSM88032     4  0.0000     0.9285 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88037     4  0.0000     0.9285 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88013     4  0.0405     0.9254 0.000 0.004 0.000 0.988 0.000 0.008
#> GSM88021     4  0.0000     0.9285 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88025     4  0.0000     0.9285 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88033     4  0.0000     0.9285 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88014     4  0.0260     0.9269 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM88022     4  0.0260     0.9269 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM88034     4  0.0260     0.9247 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM88002     5  0.1204     0.9883 0.000 0.056 0.000 0.000 0.944 0.000
#> GSM88003     5  0.1204     0.9883 0.000 0.056 0.000 0.000 0.944 0.000
#> GSM88023     5  0.1434     0.9908 0.000 0.048 0.000 0.000 0.940 0.012
#> GSM88026     5  0.1462     0.9892 0.000 0.056 0.000 0.000 0.936 0.008
#> GSM88028     5  0.1434     0.9908 0.000 0.048 0.000 0.000 0.940 0.012
#> GSM88035     5  0.1434     0.9908 0.000 0.048 0.000 0.000 0.940 0.012

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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

test_to_known_factors(res)
#>         n cell.line(p) agent(p)  time(p) k
#> SD:NMF 77     1.27e-17 3.00e-14 3.61e-01 2
#> SD:NMF 73     1.41e-16 3.74e-13 2.19e-03 3
#> SD:NMF 76     2.21e-16 4.65e-21 4.88e-05 4
#> SD:NMF 71     1.40e-14 5.41e-20 3.79e-08 5
#> SD:NMF 72     3.93e-14 1.26e-18 4.90e-08 6

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


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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.220           0.771       0.842         0.4298 0.496   0.496
#> 3 3 0.424           0.588       0.777         0.3743 0.948   0.898
#> 4 4 0.483           0.632       0.801         0.0912 0.879   0.743
#> 5 5 0.588           0.614       0.803         0.0929 0.927   0.798
#> 6 6 0.644           0.643       0.770         0.0549 0.930   0.778

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
#> GSM87962     1  0.0000      0.875 1.000 0.000
#> GSM87963     1  0.0000      0.875 1.000 0.000
#> GSM87983     1  0.0000      0.875 1.000 0.000
#> GSM87984     1  0.0672      0.875 0.992 0.008
#> GSM87961     1  0.5294      0.778 0.880 0.120
#> GSM87970     1  0.9209      0.379 0.664 0.336
#> GSM87971     1  0.9209      0.379 0.664 0.336
#> GSM87990     1  0.4562      0.806 0.904 0.096
#> GSM87991     1  0.0000      0.875 1.000 0.000
#> GSM87974     1  0.9209      0.379 0.664 0.336
#> GSM87994     1  0.0376      0.875 0.996 0.004
#> GSM87978     1  0.9209      0.379 0.664 0.336
#> GSM87979     1  0.9170      0.382 0.668 0.332
#> GSM87998     1  0.0000      0.875 1.000 0.000
#> GSM87999     1  0.0000      0.875 1.000 0.000
#> GSM87968     1  0.9209      0.379 0.664 0.336
#> GSM87987     1  0.0672      0.874 0.992 0.008
#> GSM87969     1  0.0376      0.875 0.996 0.004
#> GSM87988     1  0.0000      0.875 1.000 0.000
#> GSM87989     1  0.0000      0.875 1.000 0.000
#> GSM87972     1  0.2236      0.864 0.964 0.036
#> GSM87992     1  0.0000      0.875 1.000 0.000
#> GSM87973     1  0.2236      0.864 0.964 0.036
#> GSM87993     1  0.0000      0.875 1.000 0.000
#> GSM87975     1  0.9087      0.517 0.676 0.324
#> GSM87995     1  0.0000      0.875 1.000 0.000
#> GSM87976     1  0.9087      0.517 0.676 0.324
#> GSM87977     1  0.0938      0.873 0.988 0.012
#> GSM87996     1  0.0000      0.875 1.000 0.000
#> GSM87997     1  0.0000      0.875 1.000 0.000
#> GSM87980     1  0.1633      0.868 0.976 0.024
#> GSM88000     1  0.0000      0.875 1.000 0.000
#> GSM87981     1  0.1633      0.868 0.976 0.024
#> GSM87982     1  0.1633      0.868 0.976 0.024
#> GSM88001     1  0.0000      0.875 1.000 0.000
#> GSM87967     1  0.0672      0.874 0.992 0.008
#> GSM87964     1  0.9686      0.330 0.604 0.396
#> GSM87965     1  0.5294      0.778 0.880 0.120
#> GSM87966     1  0.0000      0.875 1.000 0.000
#> GSM87985     1  0.4815      0.800 0.896 0.104
#> GSM87986     1  0.0672      0.874 0.992 0.008
#> GSM88004     2  0.5519      0.829 0.128 0.872
#> GSM88015     2  0.5842      0.831 0.140 0.860
#> GSM88005     2  0.9248      0.741 0.340 0.660
#> GSM88006     2  0.5519      0.829 0.128 0.872
#> GSM88016     2  0.5842      0.831 0.140 0.860
#> GSM88007     2  0.5519      0.829 0.128 0.872
#> GSM88017     2  0.6531      0.832 0.168 0.832
#> GSM88029     2  0.5737      0.830 0.136 0.864
#> GSM88008     2  0.9248      0.741 0.340 0.660
#> GSM88009     2  0.5519      0.829 0.128 0.872
#> GSM88018     2  0.5842      0.831 0.140 0.860
#> GSM88024     2  0.6531      0.832 0.168 0.832
#> GSM88030     2  0.6048      0.762 0.148 0.852
#> GSM88036     2  0.6048      0.762 0.148 0.852
#> GSM88010     2  0.7674      0.815 0.224 0.776
#> GSM88011     2  0.9248      0.741 0.340 0.660
#> GSM88019     2  0.9580      0.707 0.380 0.620
#> GSM88027     2  0.9580      0.707 0.380 0.620
#> GSM88031     2  0.9608      0.693 0.384 0.616
#> GSM88012     2  0.7674      0.815 0.224 0.776
#> GSM88020     2  0.7950      0.805 0.240 0.760
#> GSM88032     2  0.9608      0.693 0.384 0.616
#> GSM88037     2  0.9608      0.693 0.384 0.616
#> GSM88013     2  0.9323      0.737 0.348 0.652
#> GSM88021     2  0.6343      0.759 0.160 0.840
#> GSM88025     2  0.8909      0.773 0.308 0.692
#> GSM88033     2  0.9608      0.693 0.384 0.616
#> GSM88014     2  0.9323      0.737 0.348 0.652
#> GSM88022     2  0.9358      0.732 0.352 0.648
#> GSM88034     2  0.6048      0.762 0.148 0.852
#> GSM88002     2  0.5519      0.829 0.128 0.872
#> GSM88003     2  0.5519      0.829 0.128 0.872
#> GSM88023     2  0.5519      0.829 0.128 0.872
#> GSM88026     2  0.5519      0.829 0.128 0.872
#> GSM88028     2  0.5519      0.829 0.128 0.872
#> GSM88035     2  0.5519      0.829 0.128 0.872

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>          class entropy silhouette    p1    p2    p3
#> GSM87962     1  0.0000     0.8313 1.000 0.000 0.000
#> GSM87963     1  0.0000     0.8313 1.000 0.000 0.000
#> GSM87983     1  0.0000     0.8313 1.000 0.000 0.000
#> GSM87984     1  0.0475     0.8317 0.992 0.004 0.004
#> GSM87961     1  0.4137     0.7467 0.872 0.096 0.032
#> GSM87970     1  0.9452     0.0858 0.496 0.284 0.220
#> GSM87971     1  0.9304     0.1511 0.516 0.280 0.204
#> GSM87990     1  0.6087     0.6922 0.780 0.076 0.144
#> GSM87991     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87974     1  0.9452     0.0858 0.496 0.284 0.220
#> GSM87994     1  0.1031     0.8312 0.976 0.000 0.024
#> GSM87978     1  0.9304     0.1511 0.516 0.280 0.204
#> GSM87979     1  0.9211     0.1761 0.528 0.276 0.196
#> GSM87998     1  0.0892     0.8302 0.980 0.000 0.020
#> GSM87999     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87968     1  0.9304     0.1511 0.516 0.280 0.204
#> GSM87987     1  0.3038     0.8051 0.896 0.000 0.104
#> GSM87969     1  0.2448     0.8169 0.924 0.000 0.076
#> GSM87988     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87989     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87972     1  0.3752     0.7970 0.884 0.020 0.096
#> GSM87992     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87973     1  0.3752     0.7970 0.884 0.020 0.096
#> GSM87993     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87975     3  0.9431     1.0000 0.176 0.400 0.424
#> GSM87995     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87976     3  0.9431     1.0000 0.176 0.400 0.424
#> GSM87977     1  0.2682     0.8142 0.920 0.004 0.076
#> GSM87996     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87997     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87980     1  0.3359     0.8055 0.900 0.016 0.084
#> GSM88000     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87981     1  0.3359     0.8055 0.900 0.016 0.084
#> GSM87982     1  0.3359     0.8055 0.900 0.016 0.084
#> GSM88001     1  0.1529     0.8266 0.960 0.000 0.040
#> GSM87967     1  0.2356     0.8167 0.928 0.000 0.072
#> GSM87964     2  0.7997    -0.7592 0.060 0.472 0.468
#> GSM87965     1  0.4137     0.7467 0.872 0.096 0.032
#> GSM87966     1  0.0000     0.8313 1.000 0.000 0.000
#> GSM87985     1  0.4642     0.7463 0.856 0.084 0.060
#> GSM87986     1  0.0892     0.8298 0.980 0.000 0.020
#> GSM88004     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88015     2  0.0892     0.5235 0.000 0.980 0.020
#> GSM88005     2  0.8399     0.3652 0.188 0.624 0.188
#> GSM88006     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88016     2  0.0892     0.5235 0.000 0.980 0.020
#> GSM88007     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88017     2  0.3267     0.5359 0.000 0.884 0.116
#> GSM88029     2  0.0424     0.5261 0.000 0.992 0.008
#> GSM88008     2  0.8399     0.3652 0.188 0.624 0.188
#> GSM88009     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88018     2  0.0892     0.5235 0.000 0.980 0.020
#> GSM88024     2  0.3267     0.5359 0.000 0.884 0.116
#> GSM88030     2  0.6295     0.4603 0.000 0.528 0.472
#> GSM88036     2  0.6295     0.4603 0.000 0.528 0.472
#> GSM88010     2  0.5785     0.5365 0.000 0.668 0.332
#> GSM88011     2  0.9137     0.4109 0.188 0.536 0.276
#> GSM88019     2  0.9515     0.3939 0.216 0.480 0.304
#> GSM88027     2  0.9515     0.3939 0.216 0.480 0.304
#> GSM88031     2  0.9651     0.3923 0.216 0.436 0.348
#> GSM88012     2  0.5785     0.5365 0.000 0.668 0.332
#> GSM88020     2  0.6062     0.5207 0.000 0.616 0.384
#> GSM88032     2  0.9651     0.3923 0.216 0.436 0.348
#> GSM88037     2  0.9651     0.3923 0.216 0.436 0.348
#> GSM88013     2  0.9009     0.4579 0.132 0.464 0.404
#> GSM88021     2  0.6520     0.4589 0.004 0.508 0.488
#> GSM88025     2  0.8592     0.5072 0.116 0.552 0.332
#> GSM88033     2  0.9651     0.3923 0.216 0.436 0.348
#> GSM88014     2  0.9009     0.4579 0.132 0.464 0.404
#> GSM88022     2  0.9131     0.4508 0.144 0.460 0.396
#> GSM88034     2  0.6299     0.4588 0.000 0.524 0.476
#> GSM88002     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88003     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88023     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88026     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88028     2  0.0000     0.5290 0.000 1.000 0.000
#> GSM88035     2  0.0000     0.5290 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
#> GSM87962     1  0.0000      0.831 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000      0.831 1.000 0.000 0.000 0.000
#> GSM87983     1  0.0000      0.831 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0376      0.832 0.992 0.004 0.000 0.004
#> GSM87961     1  0.3400      0.760 0.872 0.064 0.064 0.000
#> GSM87970     1  0.7842      0.194 0.484 0.144 0.348 0.024
#> GSM87971     1  0.7787      0.249 0.504 0.144 0.328 0.024
#> GSM87990     1  0.5115      0.694 0.768 0.044 0.172 0.016
#> GSM87991     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87974     1  0.7842      0.194 0.484 0.144 0.348 0.024
#> GSM87994     1  0.1004      0.831 0.972 0.000 0.024 0.004
#> GSM87978     1  0.7787      0.249 0.504 0.144 0.328 0.024
#> GSM87979     1  0.7747      0.270 0.516 0.144 0.316 0.024
#> GSM87998     1  0.0817      0.830 0.976 0.000 0.024 0.000
#> GSM87999     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87968     1  0.7787      0.249 0.504 0.144 0.328 0.024
#> GSM87987     1  0.2924      0.802 0.884 0.000 0.100 0.016
#> GSM87969     1  0.2125      0.817 0.920 0.000 0.076 0.004
#> GSM87988     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87989     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87972     1  0.3048      0.796 0.876 0.000 0.108 0.016
#> GSM87992     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87973     1  0.3048      0.796 0.876 0.000 0.108 0.016
#> GSM87993     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87975     3  0.5122      0.899 0.164 0.080 0.756 0.000
#> GSM87995     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87976     3  0.5122      0.899 0.164 0.080 0.756 0.000
#> GSM87977     1  0.2450      0.813 0.912 0.000 0.072 0.016
#> GSM87996     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87997     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87980     1  0.2796      0.804 0.892 0.000 0.092 0.016
#> GSM88000     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87981     1  0.2796      0.804 0.892 0.000 0.092 0.016
#> GSM87982     1  0.2796      0.804 0.892 0.000 0.092 0.016
#> GSM88001     1  0.1302      0.826 0.956 0.000 0.044 0.000
#> GSM87967     1  0.2300      0.816 0.920 0.000 0.064 0.016
#> GSM87964     3  0.3286      0.797 0.044 0.080 0.876 0.000
#> GSM87965     1  0.3400      0.760 0.872 0.064 0.064 0.000
#> GSM87966     1  0.0000      0.831 1.000 0.000 0.000 0.000
#> GSM87985     1  0.4028      0.758 0.852 0.052 0.080 0.016
#> GSM87986     1  0.0927      0.830 0.976 0.000 0.008 0.016
#> GSM88004     2  0.0188      0.764 0.000 0.996 0.000 0.004
#> GSM88015     2  0.0921      0.753 0.000 0.972 0.000 0.028
#> GSM88005     2  0.7516      0.253 0.188 0.612 0.156 0.044
#> GSM88006     2  0.0188      0.764 0.000 0.996 0.000 0.004
#> GSM88016     2  0.0921      0.753 0.000 0.972 0.000 0.028
#> GSM88007     2  0.0188      0.764 0.000 0.996 0.000 0.004
#> GSM88017     2  0.4072      0.469 0.000 0.748 0.000 0.252
#> GSM88029     2  0.0592      0.760 0.000 0.984 0.000 0.016
#> GSM88008     2  0.7516      0.253 0.188 0.612 0.156 0.044
#> GSM88009     2  0.0188      0.764 0.000 0.996 0.000 0.004
#> GSM88018     2  0.0921      0.753 0.000 0.972 0.000 0.028
#> GSM88024     2  0.4103      0.461 0.000 0.744 0.000 0.256
#> GSM88030     4  0.1022      0.414 0.000 0.032 0.000 0.968
#> GSM88036     4  0.1022      0.414 0.000 0.032 0.000 0.968
#> GSM88010     4  0.4564      0.497 0.000 0.328 0.000 0.672
#> GSM88011     2  0.9517     -0.295 0.188 0.400 0.156 0.256
#> GSM88019     2  0.9730     -0.385 0.212 0.344 0.164 0.280
#> GSM88027     2  0.9730     -0.385 0.212 0.344 0.164 0.280
#> GSM88031     4  0.9646      0.516 0.212 0.244 0.164 0.380
#> GSM88012     4  0.4564      0.497 0.000 0.328 0.000 0.672
#> GSM88020     4  0.3726      0.548 0.000 0.212 0.000 0.788
#> GSM88032     4  0.9646      0.516 0.212 0.244 0.164 0.380
#> GSM88037     4  0.9646      0.516 0.212 0.244 0.164 0.380
#> GSM88013     4  0.9090      0.576 0.128 0.244 0.164 0.464
#> GSM88021     4  0.3196      0.547 0.000 0.136 0.008 0.856
#> GSM88025     4  0.6606      0.588 0.112 0.244 0.008 0.636
#> GSM88033     4  0.9646      0.516 0.212 0.244 0.164 0.380
#> GSM88014     4  0.9090      0.576 0.128 0.244 0.164 0.464
#> GSM88022     4  0.9214      0.568 0.140 0.248 0.164 0.448
#> GSM88034     4  0.0921      0.415 0.000 0.028 0.000 0.972
#> GSM88002     2  0.0000      0.765 0.000 1.000 0.000 0.000
#> GSM88003     2  0.0000      0.765 0.000 1.000 0.000 0.000
#> GSM88023     2  0.0000      0.765 0.000 1.000 0.000 0.000
#> GSM88026     2  0.0000      0.765 0.000 1.000 0.000 0.000
#> GSM88028     2  0.0000      0.765 0.000 1.000 0.000 0.000
#> GSM88035     2  0.0000      0.765 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
#> GSM87962     1  0.0703     0.7862 0.976 0.000 0.000 0.000 0.024
#> GSM87963     1  0.0703     0.7862 0.976 0.000 0.000 0.000 0.024
#> GSM87983     1  0.0703     0.7862 0.976 0.000 0.000 0.000 0.024
#> GSM87984     1  0.1153     0.7862 0.964 0.000 0.004 0.008 0.024
#> GSM87961     1  0.3465     0.6946 0.844 0.004 0.116 0.012 0.024
#> GSM87970     3  0.6571     0.1575 0.412 0.008 0.424 0.156 0.000
#> GSM87971     1  0.6569    -0.2716 0.432 0.008 0.404 0.156 0.000
#> GSM87990     1  0.4901     0.5459 0.700 0.000 0.216 0.084 0.000
#> GSM87991     1  0.2075     0.7794 0.924 0.000 0.032 0.004 0.040
#> GSM87974     3  0.6571     0.1575 0.412 0.008 0.424 0.156 0.000
#> GSM87994     1  0.1299     0.7888 0.960 0.000 0.012 0.008 0.020
#> GSM87978     1  0.6569    -0.2716 0.432 0.008 0.404 0.156 0.000
#> GSM87979     1  0.6562    -0.2399 0.444 0.008 0.392 0.156 0.000
#> GSM87998     1  0.1173     0.7875 0.964 0.000 0.012 0.004 0.020
#> GSM87999     1  0.1915     0.7773 0.928 0.000 0.032 0.000 0.040
#> GSM87968     1  0.6569    -0.2716 0.432 0.008 0.404 0.156 0.000
#> GSM87987     1  0.3754     0.7134 0.816 0.000 0.100 0.084 0.000
#> GSM87969     1  0.2077     0.7649 0.908 0.000 0.084 0.008 0.000
#> GSM87988     1  0.1579     0.7801 0.944 0.000 0.032 0.000 0.024
#> GSM87989     1  0.1915     0.7773 0.928 0.000 0.032 0.000 0.040
#> GSM87972     1  0.3857     0.6972 0.808 0.000 0.108 0.084 0.000
#> GSM87992     1  0.1579     0.7801 0.944 0.000 0.032 0.000 0.024
#> GSM87973     1  0.3857     0.6972 0.808 0.000 0.108 0.084 0.000
#> GSM87993     1  0.1739     0.7813 0.940 0.000 0.032 0.004 0.024
#> GSM87975     3  0.2690     0.5314 0.156 0.000 0.844 0.000 0.000
#> GSM87995     1  0.1579     0.7801 0.944 0.000 0.032 0.000 0.024
#> GSM87976     3  0.2690     0.5314 0.156 0.000 0.844 0.000 0.000
#> GSM87977     1  0.3359     0.7263 0.844 0.000 0.072 0.084 0.000
#> GSM87996     1  0.1579     0.7801 0.944 0.000 0.032 0.000 0.024
#> GSM87997     1  0.1579     0.7801 0.944 0.000 0.032 0.000 0.024
#> GSM87980     1  0.3648     0.7114 0.824 0.000 0.092 0.084 0.000
#> GSM88000     1  0.1739     0.7813 0.940 0.000 0.032 0.004 0.024
#> GSM87981     1  0.3648     0.7114 0.824 0.000 0.092 0.084 0.000
#> GSM87982     1  0.3648     0.7114 0.824 0.000 0.092 0.084 0.000
#> GSM88001     1  0.1579     0.7801 0.944 0.000 0.032 0.000 0.024
#> GSM87967     1  0.3234     0.7313 0.852 0.000 0.064 0.084 0.000
#> GSM87964     3  0.1168     0.4118 0.032 0.000 0.960 0.000 0.008
#> GSM87965     1  0.3465     0.6946 0.844 0.004 0.116 0.012 0.024
#> GSM87966     1  0.0703     0.7862 0.976 0.000 0.000 0.000 0.024
#> GSM87985     1  0.4835     0.6518 0.768 0.004 0.116 0.088 0.024
#> GSM87986     1  0.2482     0.7619 0.892 0.000 0.000 0.084 0.024
#> GSM88004     2  0.0510     0.8359 0.000 0.984 0.000 0.016 0.000
#> GSM88015     2  0.1478     0.8223 0.000 0.936 0.000 0.064 0.000
#> GSM88005     2  0.5787    -0.1529 0.052 0.476 0.000 0.456 0.016
#> GSM88006     2  0.0510     0.8359 0.000 0.984 0.000 0.016 0.000
#> GSM88016     2  0.1478     0.8223 0.000 0.936 0.000 0.064 0.000
#> GSM88007     2  0.0510     0.8359 0.000 0.984 0.000 0.016 0.000
#> GSM88017     2  0.5240     0.4909 0.000 0.660 0.000 0.096 0.244
#> GSM88029     2  0.2130     0.8245 0.000 0.908 0.000 0.080 0.012
#> GSM88008     2  0.5787    -0.1529 0.052 0.476 0.000 0.456 0.016
#> GSM88009     2  0.0510     0.8359 0.000 0.984 0.000 0.016 0.000
#> GSM88018     2  0.1638     0.8212 0.000 0.932 0.000 0.064 0.004
#> GSM88024     2  0.5265     0.4829 0.000 0.656 0.000 0.096 0.248
#> GSM88030     5  0.1671     0.7166 0.000 0.000 0.000 0.076 0.924
#> GSM88036     5  0.1671     0.7166 0.000 0.000 0.000 0.076 0.924
#> GSM88010     4  0.6717    -0.0844 0.000 0.248 0.000 0.388 0.364
#> GSM88011     4  0.5226     0.6325 0.052 0.264 0.000 0.668 0.016
#> GSM88019     4  0.4370     0.7175 0.056 0.200 0.000 0.744 0.000
#> GSM88027     4  0.4337     0.7163 0.056 0.196 0.000 0.748 0.000
#> GSM88031     4  0.4462     0.7645 0.056 0.124 0.000 0.788 0.032
#> GSM88012     4  0.6717    -0.0844 0.000 0.248 0.000 0.388 0.364
#> GSM88020     5  0.5611     0.5217 0.000 0.152 0.000 0.212 0.636
#> GSM88032     4  0.4462     0.7645 0.056 0.124 0.000 0.788 0.032
#> GSM88037     4  0.4462     0.7645 0.056 0.124 0.000 0.788 0.032
#> GSM88013     4  0.5096     0.7068 0.028 0.152 0.000 0.736 0.084
#> GSM88021     5  0.4961     0.5580 0.000 0.028 0.000 0.448 0.524
#> GSM88025     5  0.6941    -0.0303 0.028 0.152 0.000 0.396 0.424
#> GSM88033     4  0.4462     0.7645 0.056 0.124 0.000 0.788 0.032
#> GSM88014     4  0.5096     0.7068 0.028 0.152 0.000 0.736 0.084
#> GSM88022     4  0.5236     0.7200 0.036 0.156 0.000 0.728 0.080
#> GSM88034     5  0.1732     0.7167 0.000 0.000 0.000 0.080 0.920
#> GSM88002     2  0.1195     0.8376 0.000 0.960 0.000 0.028 0.012
#> GSM88003     2  0.1195     0.8376 0.000 0.960 0.000 0.028 0.012
#> GSM88023     2  0.1493     0.8360 0.000 0.948 0.000 0.028 0.024
#> GSM88026     2  0.1493     0.8360 0.000 0.948 0.000 0.028 0.024
#> GSM88028     2  0.1493     0.8360 0.000 0.948 0.000 0.028 0.024
#> GSM88035     2  0.1493     0.8360 0.000 0.948 0.000 0.028 0.024

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM87962     3   0.107     0.8086 0.000 0.000 0.952 0.000 0.000 NA
#> GSM87963     3   0.107     0.8086 0.000 0.000 0.952 0.000 0.000 NA
#> GSM87983     3   0.107     0.8086 0.000 0.000 0.952 0.000 0.000 NA
#> GSM87984     3   0.158     0.8074 0.012 0.000 0.936 0.004 0.000 NA
#> GSM87961     3   0.341     0.6835 0.124 0.004 0.820 0.004 0.000 NA
#> GSM87970     1   0.472     0.6033 0.592 0.008 0.360 0.040 0.000 NA
#> GSM87971     1   0.539     0.5804 0.544 0.008 0.380 0.040 0.000 NA
#> GSM87990     3   0.425     0.4412 0.288 0.000 0.676 0.028 0.000 NA
#> GSM87991     3   0.232     0.7839 0.000 0.000 0.864 0.004 0.000 NA
#> GSM87974     1   0.472     0.6033 0.592 0.008 0.360 0.040 0.000 NA
#> GSM87994     3   0.154     0.8147 0.008 0.000 0.936 0.004 0.000 NA
#> GSM87978     1   0.477     0.5818 0.572 0.008 0.380 0.040 0.000 NA
#> GSM87979     1   0.480     0.5591 0.560 0.008 0.392 0.040 0.000 NA
#> GSM87998     3   0.128     0.8126 0.000 0.000 0.944 0.004 0.000 NA
#> GSM87999     3   0.218     0.7820 0.000 0.000 0.868 0.000 0.000 NA
#> GSM87968     1   0.477     0.5818 0.572 0.008 0.380 0.040 0.000 NA
#> GSM87987     3   0.349     0.6950 0.172 0.000 0.792 0.028 0.000 NA
#> GSM87969     3   0.206     0.7823 0.088 0.000 0.900 0.004 0.000 NA
#> GSM87988     3   0.144     0.8035 0.000 0.000 0.928 0.000 0.000 NA
#> GSM87989     3   0.218     0.7820 0.000 0.000 0.868 0.000 0.000 NA
#> GSM87972     3   0.356     0.6589 0.180 0.000 0.784 0.028 0.000 NA
#> GSM87992     3   0.144     0.8035 0.000 0.000 0.928 0.000 0.000 NA
#> GSM87973     3   0.356     0.6589 0.180 0.000 0.784 0.028 0.000 NA
#> GSM87993     3   0.159     0.8042 0.000 0.000 0.924 0.004 0.000 NA
#> GSM87975     1   0.424     0.2617 0.736 0.000 0.136 0.000 0.000 NA
#> GSM87995     3   0.144     0.8035 0.000 0.000 0.928 0.000 0.000 NA
#> GSM87976     1   0.424     0.2617 0.736 0.000 0.136 0.000 0.000 NA
#> GSM87977     3   0.324     0.7049 0.144 0.000 0.820 0.028 0.000 NA
#> GSM87996     3   0.144     0.8035 0.000 0.000 0.928 0.000 0.000 NA
#> GSM87997     3   0.144     0.8035 0.000 0.000 0.928 0.000 0.000 NA
#> GSM87980     3   0.343     0.6814 0.164 0.000 0.800 0.028 0.000 NA
#> GSM88000     3   0.159     0.8042 0.000 0.000 0.924 0.004 0.000 NA
#> GSM87981     3   0.343     0.6814 0.164 0.000 0.800 0.028 0.000 NA
#> GSM87982     3   0.343     0.6814 0.164 0.000 0.800 0.028 0.000 NA
#> GSM88001     3   0.144     0.8035 0.000 0.000 0.928 0.000 0.000 NA
#> GSM87967     3   0.299     0.7304 0.120 0.000 0.844 0.028 0.000 NA
#> GSM87964     1   0.279     0.0822 0.800 0.000 0.000 0.000 0.000 NA
#> GSM87965     3   0.341     0.6835 0.124 0.004 0.820 0.004 0.000 NA
#> GSM87966     3   0.107     0.8086 0.000 0.000 0.952 0.000 0.000 NA
#> GSM87985     3   0.455     0.5925 0.192 0.004 0.728 0.028 0.000 NA
#> GSM87986     3   0.319     0.7705 0.072 0.000 0.852 0.028 0.000 NA
#> GSM88004     2   0.222     0.7767 0.000 0.864 0.000 0.136 0.000 NA
#> GSM88015     2   0.424     0.7369 0.012 0.752 0.000 0.156 0.000 NA
#> GSM88005     4   0.534     0.3634 0.012 0.280 0.000 0.600 0.000 NA
#> GSM88006     2   0.222     0.7767 0.000 0.864 0.000 0.136 0.000 NA
#> GSM88016     2   0.424     0.7369 0.012 0.752 0.000 0.156 0.000 NA
#> GSM88007     2   0.222     0.7767 0.000 0.864 0.000 0.136 0.000 NA
#> GSM88017     2   0.574     0.4392 0.000 0.532 0.000 0.192 0.272 NA
#> GSM88029     2   0.430     0.7276 0.000 0.720 0.000 0.188 0.000 NA
#> GSM88008     4   0.534     0.3634 0.012 0.280 0.000 0.600 0.000 NA
#> GSM88009     2   0.222     0.7767 0.000 0.864 0.000 0.136 0.000 NA
#> GSM88018     2   0.438     0.7356 0.012 0.748 0.000 0.156 0.004 NA
#> GSM88024     2   0.576     0.4308 0.000 0.528 0.000 0.192 0.276 NA
#> GSM88030     5   0.377     0.6241 0.000 0.000 0.000 0.012 0.684 NA
#> GSM88036     5   0.377     0.6241 0.000 0.000 0.000 0.012 0.684 NA
#> GSM88010     4   0.626     0.0319 0.040 0.128 0.000 0.420 0.412 NA
#> GSM88011     4   0.360     0.6276 0.012 0.068 0.000 0.812 0.000 NA
#> GSM88019     4   0.153     0.6968 0.000 0.068 0.000 0.928 0.000 NA
#> GSM88027     4   0.147     0.6962 0.000 0.064 0.000 0.932 0.000 NA
#> GSM88031     4   0.079     0.7074 0.000 0.000 0.000 0.968 0.000 NA
#> GSM88012     4   0.626     0.0319 0.040 0.128 0.000 0.420 0.412 NA
#> GSM88020     5   0.382     0.3653 0.000 0.032 0.000 0.240 0.728 NA
#> GSM88032     4   0.079     0.7074 0.000 0.000 0.000 0.968 0.000 NA
#> GSM88037     4   0.079     0.7074 0.000 0.000 0.000 0.968 0.000 NA
#> GSM88013     4   0.290     0.6520 0.000 0.032 0.000 0.840 0.128 NA
#> GSM88021     5   0.648     0.4157 0.060 0.032 0.000 0.156 0.600 NA
#> GSM88025     5   0.453    -0.0971 0.000 0.032 0.000 0.456 0.512 NA
#> GSM88033     4   0.079     0.7074 0.000 0.000 0.000 0.968 0.000 NA
#> GSM88014     4   0.290     0.6520 0.000 0.032 0.000 0.840 0.128 NA
#> GSM88022     4   0.291     0.6620 0.000 0.032 0.000 0.848 0.116 NA
#> GSM88034     5   0.385     0.6238 0.000 0.000 0.000 0.016 0.680 NA
#> GSM88002     2   0.176     0.7402 0.000 0.904 0.000 0.000 0.000 NA
#> GSM88003     2   0.176     0.7402 0.000 0.904 0.000 0.000 0.000 NA
#> GSM88023     2   0.196     0.7380 0.000 0.888 0.000 0.000 0.000 NA
#> GSM88026     2   0.196     0.7380 0.000 0.888 0.000 0.000 0.000 NA
#> GSM88028     2   0.196     0.7380 0.000 0.888 0.000 0.000 0.000 NA
#> GSM88035     2   0.196     0.7380 0.000 0.888 0.000 0.000 0.000 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 cell.line(p) agent(p) time(p) k
#> CV:hclust 70     4.39e-16 4.85e-13 0.81283 2
#> CV:hclust 54     1.88e-12 5.41e-08 0.88261 3
#> CV:hclust 59     9.61e-13 2.72e-09 0.22029 4
#> CV:hclust 63     6.79e-13 1.44e-09 0.42341 5
#> CV:hclust 64     4.18e-13 4.85e-10 0.00264 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 18792 rows and 77 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.987       0.995         0.5055 0.496   0.496
#> 3 3 0.690           0.496       0.681         0.2404 0.900   0.800
#> 4 4 0.585           0.778       0.774         0.1327 0.761   0.460
#> 5 5 0.622           0.716       0.773         0.0846 1.000   1.000
#> 6 6 0.683           0.628       0.696         0.0500 0.953   0.810

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
#> GSM87962     1   0.000      0.990 1.000 0.000
#> GSM87963     1   0.000      0.990 1.000 0.000
#> GSM87983     1   0.000      0.990 1.000 0.000
#> GSM87984     1   0.000      0.990 1.000 0.000
#> GSM87961     1   0.000      0.990 1.000 0.000
#> GSM87970     1   0.000      0.990 1.000 0.000
#> GSM87971     1   0.963      0.366 0.612 0.388
#> GSM87990     1   0.000      0.990 1.000 0.000
#> GSM87991     1   0.000      0.990 1.000 0.000
#> GSM87974     1   0.000      0.990 1.000 0.000
#> GSM87994     1   0.000      0.990 1.000 0.000
#> GSM87978     1   0.000      0.990 1.000 0.000
#> GSM87979     1   0.000      0.990 1.000 0.000
#> GSM87998     1   0.000      0.990 1.000 0.000
#> GSM87999     1   0.000      0.990 1.000 0.000
#> GSM87968     1   0.000      0.990 1.000 0.000
#> GSM87987     1   0.000      0.990 1.000 0.000
#> GSM87969     1   0.000      0.990 1.000 0.000
#> GSM87988     1   0.000      0.990 1.000 0.000
#> GSM87989     1   0.000      0.990 1.000 0.000
#> GSM87972     1   0.000      0.990 1.000 0.000
#> GSM87992     1   0.000      0.990 1.000 0.000
#> GSM87973     1   0.000      0.990 1.000 0.000
#> GSM87993     1   0.000      0.990 1.000 0.000
#> GSM87975     1   0.000      0.990 1.000 0.000
#> GSM87995     1   0.000      0.990 1.000 0.000
#> GSM87976     1   0.000      0.990 1.000 0.000
#> GSM87977     1   0.000      0.990 1.000 0.000
#> GSM87996     1   0.000      0.990 1.000 0.000
#> GSM87997     1   0.000      0.990 1.000 0.000
#> GSM87980     1   0.000      0.990 1.000 0.000
#> GSM88000     1   0.000      0.990 1.000 0.000
#> GSM87981     1   0.000      0.990 1.000 0.000
#> GSM87982     1   0.000      0.990 1.000 0.000
#> GSM88001     1   0.000      0.990 1.000 0.000
#> GSM87967     1   0.000      0.990 1.000 0.000
#> GSM87964     1   0.000      0.990 1.000 0.000
#> GSM87965     1   0.000      0.990 1.000 0.000
#> GSM87966     1   0.000      0.990 1.000 0.000
#> GSM87985     1   0.000      0.990 1.000 0.000
#> GSM87986     1   0.000      0.990 1.000 0.000
#> GSM88004     2   0.000      1.000 0.000 1.000
#> GSM88015     2   0.000      1.000 0.000 1.000
#> GSM88005     2   0.000      1.000 0.000 1.000
#> GSM88006     2   0.000      1.000 0.000 1.000
#> GSM88016     2   0.000      1.000 0.000 1.000
#> GSM88007     2   0.000      1.000 0.000 1.000
#> GSM88017     2   0.000      1.000 0.000 1.000
#> GSM88029     2   0.000      1.000 0.000 1.000
#> GSM88008     2   0.000      1.000 0.000 1.000
#> GSM88009     2   0.000      1.000 0.000 1.000
#> GSM88018     2   0.000      1.000 0.000 1.000
#> GSM88024     2   0.000      1.000 0.000 1.000
#> GSM88030     2   0.000      1.000 0.000 1.000
#> GSM88036     2   0.000      1.000 0.000 1.000
#> GSM88010     2   0.000      1.000 0.000 1.000
#> GSM88011     2   0.000      1.000 0.000 1.000
#> GSM88019     2   0.000      1.000 0.000 1.000
#> GSM88027     2   0.000      1.000 0.000 1.000
#> GSM88031     2   0.000      1.000 0.000 1.000
#> GSM88012     2   0.000      1.000 0.000 1.000
#> GSM88020     2   0.000      1.000 0.000 1.000
#> GSM88032     2   0.000      1.000 0.000 1.000
#> GSM88037     2   0.000      1.000 0.000 1.000
#> GSM88013     2   0.000      1.000 0.000 1.000
#> GSM88021     2   0.000      1.000 0.000 1.000
#> GSM88025     2   0.000      1.000 0.000 1.000
#> GSM88033     2   0.000      1.000 0.000 1.000
#> GSM88014     2   0.000      1.000 0.000 1.000
#> GSM88022     2   0.000      1.000 0.000 1.000
#> GSM88034     2   0.000      1.000 0.000 1.000
#> GSM88002     2   0.000      1.000 0.000 1.000
#> GSM88003     2   0.000      1.000 0.000 1.000
#> GSM88023     2   0.000      1.000 0.000 1.000
#> GSM88026     2   0.000      1.000 0.000 1.000
#> GSM88028     2   0.000      1.000 0.000 1.000
#> GSM88035     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
#> GSM87962     1  0.2356      0.807 0.928 0.000 0.072
#> GSM87963     1  0.2356      0.807 0.928 0.000 0.072
#> GSM87983     1  0.2356      0.807 0.928 0.000 0.072
#> GSM87984     1  0.2356      0.807 0.928 0.000 0.072
#> GSM87961     1  0.6286      0.759 0.536 0.000 0.464
#> GSM87970     1  0.6305      0.751 0.516 0.000 0.484
#> GSM87971     3  0.5397     -0.486 0.280 0.000 0.720
#> GSM87990     1  0.6291      0.758 0.532 0.000 0.468
#> GSM87991     1  0.1031      0.808 0.976 0.000 0.024
#> GSM87974     1  0.6305      0.751 0.516 0.000 0.484
#> GSM87994     1  0.1031      0.808 0.976 0.000 0.024
#> GSM87978     1  0.6305      0.751 0.516 0.000 0.484
#> GSM87979     1  0.6305      0.751 0.516 0.000 0.484
#> GSM87998     1  0.1031      0.808 0.976 0.000 0.024
#> GSM87999     1  0.0237      0.807 0.996 0.000 0.004
#> GSM87968     1  0.6305      0.751 0.516 0.000 0.484
#> GSM87987     1  0.2537      0.806 0.920 0.000 0.080
#> GSM87969     1  0.6111      0.775 0.604 0.000 0.396
#> GSM87988     1  0.0000      0.807 1.000 0.000 0.000
#> GSM87989     1  0.0000      0.807 1.000 0.000 0.000
#> GSM87972     1  0.6154      0.757 0.592 0.000 0.408
#> GSM87992     1  0.0000      0.807 1.000 0.000 0.000
#> GSM87973     1  0.6140      0.758 0.596 0.000 0.404
#> GSM87993     1  0.0000      0.807 1.000 0.000 0.000
#> GSM87975     1  0.6154      0.757 0.592 0.000 0.408
#> GSM87995     1  0.0000      0.807 1.000 0.000 0.000
#> GSM87976     1  0.6280      0.752 0.540 0.000 0.460
#> GSM87977     1  0.6280      0.752 0.540 0.000 0.460
#> GSM87996     1  0.0000      0.807 1.000 0.000 0.000
#> GSM87997     1  0.0000      0.807 1.000 0.000 0.000
#> GSM87980     1  0.6154      0.757 0.592 0.000 0.408
#> GSM88000     1  0.0747      0.809 0.984 0.000 0.016
#> GSM87981     1  0.6154      0.757 0.592 0.000 0.408
#> GSM87982     1  0.6079      0.763 0.612 0.000 0.388
#> GSM88001     1  0.0000      0.807 1.000 0.000 0.000
#> GSM87967     1  0.0592      0.807 0.988 0.000 0.012
#> GSM87964     1  0.6302      0.752 0.520 0.000 0.480
#> GSM87965     1  0.2356      0.807 0.928 0.000 0.072
#> GSM87966     1  0.1753      0.808 0.952 0.000 0.048
#> GSM87985     1  0.6291      0.758 0.532 0.000 0.468
#> GSM87986     1  0.2356      0.807 0.928 0.000 0.072
#> GSM88004     2  0.6302     -0.507 0.000 0.520 0.480
#> GSM88015     2  0.6302     -0.494 0.000 0.520 0.480
#> GSM88005     2  0.6299     -0.493 0.000 0.524 0.476
#> GSM88006     2  0.6302     -0.507 0.000 0.520 0.480
#> GSM88016     2  0.6302     -0.494 0.000 0.520 0.480
#> GSM88007     2  0.6302     -0.507 0.000 0.520 0.480
#> GSM88017     3  0.6305      0.540 0.000 0.484 0.516
#> GSM88029     3  0.6309      0.557 0.000 0.496 0.504
#> GSM88008     2  0.6299     -0.493 0.000 0.524 0.476
#> GSM88009     2  0.6302     -0.507 0.000 0.520 0.480
#> GSM88018     2  0.6305     -0.502 0.000 0.516 0.484
#> GSM88024     3  0.6307      0.546 0.000 0.488 0.512
#> GSM88030     2  0.2537      0.480 0.000 0.920 0.080
#> GSM88036     2  0.2537      0.480 0.000 0.920 0.080
#> GSM88010     2  0.6111     -0.172 0.000 0.604 0.396
#> GSM88011     2  0.5254      0.309 0.000 0.736 0.264
#> GSM88019     2  0.5431      0.276 0.000 0.716 0.284
#> GSM88027     2  0.5465      0.257 0.000 0.712 0.288
#> GSM88031     2  0.0237      0.506 0.000 0.996 0.004
#> GSM88012     2  0.6062     -0.101 0.000 0.616 0.384
#> GSM88020     2  0.1529      0.492 0.000 0.960 0.040
#> GSM88032     2  0.0237      0.506 0.000 0.996 0.004
#> GSM88037     2  0.0237      0.506 0.000 0.996 0.004
#> GSM88013     2  0.3412      0.467 0.000 0.876 0.124
#> GSM88021     2  0.0747      0.501 0.000 0.984 0.016
#> GSM88025     2  0.0237      0.506 0.000 0.996 0.004
#> GSM88033     2  0.0237      0.506 0.000 0.996 0.004
#> GSM88014     2  0.3412      0.467 0.000 0.876 0.124
#> GSM88022     2  0.5098      0.341 0.000 0.752 0.248
#> GSM88034     2  0.1529      0.492 0.000 0.960 0.040
#> GSM88002     3  0.6309      0.557 0.000 0.496 0.504
#> GSM88003     3  0.6308      0.554 0.000 0.492 0.508
#> GSM88023     3  0.6308      0.551 0.000 0.492 0.508
#> GSM88026     3  0.6309      0.557 0.000 0.496 0.504
#> GSM88028     3  0.6309      0.557 0.000 0.496 0.504
#> GSM88035     3  0.6309      0.557 0.000 0.496 0.504

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     3  0.7009      0.777 0.372 0.108 0.516 0.004
#> GSM87963     3  0.6982      0.772 0.380 0.104 0.512 0.004
#> GSM87983     3  0.7078      0.781 0.364 0.116 0.516 0.004
#> GSM87984     3  0.6973      0.776 0.376 0.104 0.516 0.004
#> GSM87961     1  0.1936      0.833 0.940 0.032 0.028 0.000
#> GSM87970     1  0.0592      0.850 0.984 0.016 0.000 0.000
#> GSM87971     1  0.2983      0.730 0.880 0.108 0.008 0.004
#> GSM87990     1  0.2909      0.768 0.888 0.092 0.020 0.000
#> GSM87991     3  0.6133      0.844 0.268 0.088 0.644 0.000
#> GSM87974     1  0.0592      0.850 0.984 0.016 0.000 0.000
#> GSM87994     3  0.6074      0.845 0.268 0.084 0.648 0.000
#> GSM87978     1  0.0336      0.846 0.992 0.008 0.000 0.000
#> GSM87979     1  0.0524      0.846 0.988 0.008 0.004 0.000
#> GSM87998     3  0.5953      0.846 0.268 0.076 0.656 0.000
#> GSM87999     3  0.5520      0.848 0.244 0.060 0.696 0.000
#> GSM87968     1  0.0336      0.846 0.992 0.008 0.000 0.000
#> GSM87987     3  0.6627      0.749 0.412 0.084 0.504 0.000
#> GSM87969     1  0.4621      0.631 0.796 0.076 0.128 0.000
#> GSM87988     3  0.4328      0.845 0.244 0.008 0.748 0.000
#> GSM87989     3  0.4675      0.845 0.244 0.020 0.736 0.000
#> GSM87972     1  0.4428      0.792 0.808 0.068 0.124 0.000
#> GSM87992     3  0.4328      0.843 0.244 0.008 0.748 0.000
#> GSM87973     1  0.4804      0.770 0.780 0.072 0.148 0.000
#> GSM87993     3  0.5137      0.820 0.244 0.040 0.716 0.000
#> GSM87975     1  0.4700      0.786 0.792 0.084 0.124 0.000
#> GSM87995     3  0.4328      0.843 0.244 0.008 0.748 0.000
#> GSM87976     1  0.2739      0.843 0.904 0.060 0.036 0.000
#> GSM87977     1  0.2840      0.841 0.900 0.056 0.044 0.000
#> GSM87996     3  0.4328      0.843 0.244 0.008 0.748 0.000
#> GSM87997     3  0.4776      0.833 0.244 0.024 0.732 0.000
#> GSM87980     1  0.4879      0.779 0.780 0.092 0.128 0.000
#> GSM88000     3  0.5393      0.793 0.268 0.044 0.688 0.000
#> GSM87981     1  0.4621      0.785 0.796 0.076 0.128 0.000
#> GSM87982     1  0.5100      0.748 0.756 0.076 0.168 0.000
#> GSM88001     3  0.4328      0.843 0.244 0.008 0.748 0.000
#> GSM87967     3  0.5744      0.806 0.256 0.068 0.676 0.000
#> GSM87964     1  0.1022      0.849 0.968 0.032 0.000 0.000
#> GSM87965     3  0.7079      0.765 0.384 0.112 0.500 0.004
#> GSM87966     3  0.6995      0.808 0.324 0.120 0.552 0.004
#> GSM87985     1  0.2450      0.804 0.912 0.072 0.016 0.000
#> GSM87986     3  0.6973      0.776 0.376 0.104 0.516 0.004
#> GSM88004     2  0.4482      0.881 0.000 0.728 0.008 0.264
#> GSM88015     2  0.4690      0.873 0.000 0.724 0.016 0.260
#> GSM88005     2  0.5522      0.845 0.000 0.668 0.044 0.288
#> GSM88006     2  0.4606      0.880 0.000 0.724 0.012 0.264
#> GSM88016     2  0.4748      0.875 0.000 0.716 0.016 0.268
#> GSM88007     2  0.4606      0.880 0.000 0.724 0.012 0.264
#> GSM88017     2  0.5500      0.858 0.004 0.712 0.056 0.228
#> GSM88029     2  0.4468      0.878 0.000 0.752 0.016 0.232
#> GSM88008     2  0.5522      0.845 0.000 0.668 0.044 0.288
#> GSM88009     2  0.4606      0.880 0.000 0.724 0.012 0.264
#> GSM88018     2  0.4839      0.873 0.004 0.724 0.016 0.256
#> GSM88024     2  0.5631      0.849 0.000 0.696 0.072 0.232
#> GSM88030     4  0.5459      0.646 0.004 0.128 0.120 0.748
#> GSM88036     4  0.5459      0.646 0.004 0.128 0.120 0.748
#> GSM88010     2  0.5414      0.731 0.000 0.604 0.020 0.376
#> GSM88011     4  0.5712      0.294 0.000 0.308 0.048 0.644
#> GSM88019     4  0.5773      0.217 0.000 0.336 0.044 0.620
#> GSM88027     4  0.5713      0.200 0.000 0.340 0.040 0.620
#> GSM88031     4  0.0188      0.769 0.000 0.004 0.000 0.996
#> GSM88012     2  0.5582      0.682 0.000 0.576 0.024 0.400
#> GSM88020     4  0.3917      0.721 0.004 0.044 0.108 0.844
#> GSM88032     4  0.0376      0.769 0.000 0.004 0.004 0.992
#> GSM88037     4  0.0188      0.769 0.000 0.004 0.000 0.996
#> GSM88013     4  0.3245      0.716 0.000 0.100 0.028 0.872
#> GSM88021     4  0.1732      0.766 0.004 0.008 0.040 0.948
#> GSM88025     4  0.0657      0.770 0.000 0.012 0.004 0.984
#> GSM88033     4  0.0804      0.770 0.000 0.012 0.008 0.980
#> GSM88014     4  0.3245      0.716 0.000 0.100 0.028 0.872
#> GSM88022     4  0.5574      0.370 0.000 0.284 0.048 0.668
#> GSM88034     4  0.3917      0.721 0.004 0.044 0.108 0.844
#> GSM88002     2  0.5900      0.852 0.000 0.684 0.096 0.220
#> GSM88003     2  0.5900      0.852 0.000 0.684 0.096 0.220
#> GSM88023     2  0.5750      0.851 0.000 0.696 0.088 0.216
#> GSM88026     2  0.5750      0.851 0.000 0.696 0.088 0.216
#> GSM88028     2  0.5750      0.851 0.000 0.696 0.088 0.216
#> GSM88035     2  0.5750      0.851 0.000 0.696 0.088 0.216

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4 p5
#> GSM87962     3  0.6586      0.663 0.236 0.000 0.460 0.000 NA
#> GSM87963     3  0.6710      0.622 0.272 0.000 0.424 0.000 NA
#> GSM87983     3  0.6533      0.673 0.224 0.000 0.472 0.000 NA
#> GSM87984     3  0.6558      0.669 0.232 0.000 0.468 0.000 NA
#> GSM87961     1  0.2352      0.781 0.912 0.000 0.032 0.008 NA
#> GSM87970     1  0.0404      0.803 0.988 0.000 0.000 0.000 NA
#> GSM87971     1  0.1554      0.786 0.952 0.024 0.008 0.012 NA
#> GSM87990     1  0.3696      0.612 0.772 0.000 0.016 0.000 NA
#> GSM87991     3  0.5568      0.751 0.116 0.000 0.644 0.004 NA
#> GSM87974     1  0.0703      0.803 0.976 0.000 0.000 0.000 NA
#> GSM87994     3  0.5464      0.753 0.116 0.000 0.660 0.004 NA
#> GSM87978     1  0.0451      0.800 0.988 0.000 0.000 0.008 NA
#> GSM87979     1  0.0451      0.800 0.988 0.000 0.000 0.008 NA
#> GSM87998     3  0.5493      0.754 0.124 0.000 0.660 0.004 NA
#> GSM87999     3  0.4872      0.757 0.092 0.000 0.724 0.004 NA
#> GSM87968     1  0.0451      0.800 0.988 0.000 0.000 0.008 NA
#> GSM87987     3  0.6671      0.625 0.292 0.000 0.440 0.000 NA
#> GSM87969     1  0.5872      0.400 0.636 0.000 0.140 0.012 NA
#> GSM87988     3  0.2712      0.750 0.088 0.000 0.880 0.000 NA
#> GSM87989     3  0.3030      0.749 0.088 0.000 0.868 0.004 NA
#> GSM87972     1  0.5351      0.744 0.724 0.000 0.132 0.036 NA
#> GSM87992     3  0.1851      0.743 0.088 0.000 0.912 0.000 NA
#> GSM87973     1  0.5973      0.699 0.660 0.000 0.196 0.044 NA
#> GSM87993     3  0.3248      0.706 0.088 0.000 0.856 0.004 NA
#> GSM87975     1  0.6257      0.715 0.648 0.000 0.136 0.056 NA
#> GSM87995     3  0.1851      0.743 0.088 0.000 0.912 0.000 NA
#> GSM87976     1  0.4643      0.776 0.776 0.000 0.044 0.048 NA
#> GSM87977     1  0.3986      0.789 0.828 0.000 0.068 0.036 NA
#> GSM87996     3  0.1851      0.743 0.088 0.000 0.912 0.000 NA
#> GSM87997     3  0.2608      0.731 0.088 0.000 0.888 0.004 NA
#> GSM87980     1  0.6418      0.695 0.624 0.000 0.168 0.048 NA
#> GSM88000     3  0.3888      0.666 0.112 0.000 0.816 0.008 NA
#> GSM87981     1  0.5589      0.729 0.700 0.000 0.156 0.036 NA
#> GSM87982     1  0.6127      0.668 0.628 0.000 0.232 0.036 NA
#> GSM88001     3  0.1851      0.743 0.088 0.000 0.912 0.000 NA
#> GSM87967     3  0.5143      0.683 0.108 0.000 0.740 0.032 NA
#> GSM87964     1  0.2787      0.789 0.880 0.000 0.004 0.028 NA
#> GSM87965     3  0.6748      0.605 0.284 0.000 0.408 0.000 NA
#> GSM87966     3  0.6217      0.706 0.164 0.000 0.520 0.000 NA
#> GSM87985     1  0.3190      0.709 0.840 0.000 0.012 0.008 NA
#> GSM87986     3  0.6558      0.669 0.232 0.000 0.468 0.000 NA
#> GSM88004     2  0.1393      0.852 0.000 0.956 0.008 0.012 NA
#> GSM88015     2  0.2515      0.841 0.000 0.908 0.020 0.032 NA
#> GSM88005     2  0.3700      0.781 0.000 0.840 0.020 0.080 NA
#> GSM88006     2  0.1393      0.852 0.000 0.956 0.008 0.012 NA
#> GSM88016     2  0.2342      0.842 0.000 0.916 0.020 0.024 NA
#> GSM88007     2  0.1393      0.852 0.000 0.956 0.008 0.012 NA
#> GSM88017     2  0.2629      0.832 0.000 0.880 0.012 0.004 NA
#> GSM88029     2  0.1800      0.852 0.000 0.932 0.020 0.000 NA
#> GSM88008     2  0.3700      0.781 0.000 0.840 0.020 0.080 NA
#> GSM88009     2  0.1393      0.852 0.000 0.956 0.008 0.012 NA
#> GSM88018     2  0.2767      0.840 0.004 0.900 0.024 0.032 NA
#> GSM88024     2  0.3511      0.767 0.000 0.800 0.012 0.004 NA
#> GSM88030     4  0.6194      0.565 0.000 0.156 0.000 0.516 NA
#> GSM88036     4  0.6194      0.565 0.000 0.156 0.000 0.516 NA
#> GSM88010     2  0.4371      0.674 0.000 0.776 0.028 0.164 NA
#> GSM88011     4  0.6294      0.340 0.000 0.396 0.032 0.500 NA
#> GSM88019     4  0.6098      0.312 0.000 0.416 0.020 0.492 NA
#> GSM88027     4  0.6020      0.298 0.000 0.420 0.016 0.492 NA
#> GSM88031     4  0.1732      0.737 0.000 0.080 0.000 0.920 NA
#> GSM88012     2  0.4741      0.640 0.000 0.744 0.028 0.188 NA
#> GSM88020     4  0.5488      0.627 0.000 0.092 0.000 0.608 NA
#> GSM88032     4  0.2017      0.737 0.000 0.080 0.000 0.912 NA
#> GSM88037     4  0.1732      0.737 0.000 0.080 0.000 0.920 NA
#> GSM88013     4  0.4846      0.673 0.000 0.192 0.028 0.736 NA
#> GSM88021     4  0.3886      0.724 0.000 0.068 0.020 0.828 NA
#> GSM88025     4  0.2352      0.737 0.000 0.092 0.004 0.896 NA
#> GSM88033     4  0.2193      0.737 0.000 0.092 0.000 0.900 NA
#> GSM88014     4  0.4846      0.673 0.000 0.192 0.028 0.736 NA
#> GSM88022     4  0.6199      0.408 0.000 0.364 0.036 0.536 NA
#> GSM88034     4  0.5488      0.627 0.000 0.092 0.000 0.608 NA
#> GSM88002     2  0.3409      0.822 0.000 0.824 0.032 0.000 NA
#> GSM88003     2  0.3366      0.822 0.000 0.828 0.032 0.000 NA
#> GSM88023     2  0.3400      0.824 0.000 0.828 0.036 0.000 NA
#> GSM88026     2  0.3400      0.826 0.000 0.828 0.036 0.000 NA
#> GSM88028     2  0.3400      0.824 0.000 0.828 0.036 0.000 NA
#> GSM88035     2  0.3400      0.824 0.000 0.828 0.036 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.1285     0.6042 0.944 0.000 0.052 0.000 0.004 0.000
#> GSM87963     1  0.1806     0.5913 0.908 0.000 0.088 0.000 0.004 0.000
#> GSM87983     1  0.1219     0.6024 0.948 0.000 0.048 0.000 0.004 0.000
#> GSM87984     1  0.1267     0.6032 0.940 0.000 0.060 0.000 0.000 0.000
#> GSM87961     3  0.3152     0.7124 0.196 0.000 0.792 0.000 0.008 0.004
#> GSM87970     3  0.1624     0.7681 0.040 0.000 0.936 0.004 0.000 0.020
#> GSM87971     3  0.1477     0.7622 0.048 0.000 0.940 0.000 0.004 0.008
#> GSM87990     3  0.3707     0.5263 0.312 0.000 0.680 0.000 0.000 0.008
#> GSM87991     1  0.3929     0.4035 0.792 0.000 0.000 0.020 0.112 0.076
#> GSM87974     3  0.2009     0.7683 0.040 0.000 0.916 0.004 0.000 0.040
#> GSM87994     1  0.3286     0.4269 0.832 0.000 0.000 0.012 0.112 0.044
#> GSM87978     3  0.1542     0.7626 0.052 0.000 0.936 0.000 0.004 0.008
#> GSM87979     3  0.1644     0.7623 0.052 0.000 0.932 0.000 0.004 0.012
#> GSM87998     1  0.4344     0.3423 0.756 0.000 0.004 0.016 0.148 0.076
#> GSM87999     1  0.4824     0.1815 0.700 0.000 0.000 0.020 0.184 0.096
#> GSM87968     3  0.1644     0.7623 0.052 0.000 0.932 0.000 0.004 0.012
#> GSM87987     1  0.2848     0.5256 0.816 0.000 0.176 0.000 0.000 0.008
#> GSM87969     1  0.5125    -0.0335 0.528 0.000 0.400 0.000 0.008 0.064
#> GSM87988     1  0.4328    -0.7460 0.520 0.000 0.000 0.000 0.460 0.020
#> GSM87989     1  0.5352    -0.6171 0.532 0.000 0.000 0.016 0.380 0.072
#> GSM87972     3  0.5784     0.7197 0.056 0.000 0.628 0.000 0.164 0.152
#> GSM87992     5  0.3854     0.9274 0.464 0.000 0.000 0.000 0.536 0.000
#> GSM87973     3  0.6565     0.6278 0.060 0.000 0.512 0.004 0.268 0.156
#> GSM87993     5  0.4025     0.8782 0.416 0.000 0.000 0.000 0.576 0.008
#> GSM87975     3  0.6343     0.6867 0.056 0.000 0.528 0.000 0.152 0.264
#> GSM87995     5  0.3854     0.9274 0.464 0.000 0.000 0.000 0.536 0.000
#> GSM87976     3  0.5149     0.7328 0.024 0.000 0.664 0.004 0.080 0.228
#> GSM87977     3  0.5054     0.7393 0.036 0.000 0.696 0.000 0.160 0.108
#> GSM87996     5  0.3854     0.9274 0.464 0.000 0.000 0.000 0.536 0.000
#> GSM87997     5  0.3828     0.9162 0.440 0.000 0.000 0.000 0.560 0.000
#> GSM87980     3  0.6741     0.6303 0.056 0.000 0.456 0.000 0.244 0.244
#> GSM88000     5  0.4294     0.8201 0.388 0.000 0.012 0.000 0.592 0.008
#> GSM87981     3  0.6133     0.6839 0.056 0.000 0.572 0.000 0.224 0.148
#> GSM87982     3  0.6365     0.6454 0.060 0.000 0.528 0.000 0.264 0.148
#> GSM88001     5  0.3854     0.9274 0.464 0.000 0.000 0.000 0.536 0.000
#> GSM87967     1  0.6511    -0.4191 0.424 0.000 0.032 0.004 0.368 0.172
#> GSM87964     3  0.4195     0.7419 0.040 0.000 0.776 0.004 0.040 0.140
#> GSM87965     1  0.2213     0.5765 0.888 0.000 0.100 0.000 0.008 0.004
#> GSM87966     1  0.0767     0.5746 0.976 0.000 0.008 0.000 0.012 0.004
#> GSM87985     3  0.3606     0.6290 0.264 0.000 0.724 0.000 0.008 0.004
#> GSM87986     1  0.1204     0.6028 0.944 0.000 0.056 0.000 0.000 0.000
#> GSM88004     2  0.1555     0.8088 0.000 0.940 0.000 0.008 0.012 0.040
#> GSM88015     2  0.3049     0.7976 0.000 0.868 0.020 0.016 0.024 0.072
#> GSM88005     2  0.4388     0.7117 0.000 0.780 0.012 0.100 0.036 0.072
#> GSM88006     2  0.1555     0.8088 0.000 0.940 0.000 0.008 0.012 0.040
#> GSM88016     2  0.2687     0.8011 0.000 0.884 0.008 0.016 0.020 0.072
#> GSM88007     2  0.1555     0.8088 0.000 0.940 0.000 0.008 0.012 0.040
#> GSM88017     2  0.3812     0.7682 0.000 0.788 0.008 0.000 0.072 0.132
#> GSM88029     2  0.2762     0.8084 0.000 0.864 0.004 0.012 0.012 0.108
#> GSM88008     2  0.4388     0.7117 0.000 0.780 0.012 0.100 0.036 0.072
#> GSM88009     2  0.1555     0.8088 0.000 0.940 0.000 0.008 0.012 0.040
#> GSM88018     2  0.3641     0.7879 0.000 0.828 0.024 0.016 0.032 0.100
#> GSM88024     2  0.4069     0.7516 0.000 0.764 0.008 0.000 0.080 0.148
#> GSM88030     4  0.7442     0.4595 0.000 0.112 0.004 0.368 0.272 0.244
#> GSM88036     4  0.7442     0.4595 0.000 0.112 0.004 0.368 0.272 0.244
#> GSM88010     2  0.4794     0.6276 0.000 0.716 0.004 0.152 0.016 0.112
#> GSM88011     4  0.5959     0.5409 0.000 0.232 0.020 0.612 0.036 0.100
#> GSM88019     4  0.5819     0.5289 0.000 0.244 0.008 0.604 0.032 0.112
#> GSM88027     4  0.5714     0.5263 0.000 0.244 0.008 0.612 0.028 0.108
#> GSM88031     4  0.0922     0.7335 0.000 0.024 0.000 0.968 0.004 0.004
#> GSM88012     2  0.5107     0.6014 0.000 0.680 0.004 0.176 0.016 0.124
#> GSM88020     4  0.6584     0.5578 0.000 0.052 0.000 0.488 0.236 0.224
#> GSM88032     4  0.1232     0.7328 0.000 0.024 0.000 0.956 0.004 0.016
#> GSM88037     4  0.0922     0.7335 0.000 0.024 0.000 0.968 0.004 0.004
#> GSM88013     4  0.3739     0.6929 0.000 0.112 0.004 0.800 0.004 0.080
#> GSM88021     4  0.5039     0.6873 0.000 0.024 0.020 0.720 0.092 0.144
#> GSM88025     4  0.1719     0.7323 0.000 0.032 0.000 0.932 0.004 0.032
#> GSM88033     4  0.1334     0.7322 0.000 0.032 0.000 0.948 0.000 0.020
#> GSM88014     4  0.3739     0.6929 0.000 0.112 0.004 0.800 0.004 0.080
#> GSM88022     4  0.5743     0.5691 0.000 0.200 0.008 0.632 0.036 0.124
#> GSM88034     4  0.6534     0.5573 0.000 0.052 0.000 0.496 0.252 0.200
#> GSM88002     2  0.3463     0.7731 0.000 0.748 0.000 0.008 0.004 0.240
#> GSM88003     2  0.3323     0.7734 0.000 0.752 0.000 0.008 0.000 0.240
#> GSM88023     2  0.3373     0.7717 0.000 0.744 0.000 0.008 0.000 0.248
#> GSM88026     2  0.3349     0.7732 0.000 0.748 0.000 0.008 0.000 0.244
#> GSM88028     2  0.3373     0.7717 0.000 0.744 0.000 0.008 0.000 0.248
#> GSM88035     2  0.3373     0.7717 0.000 0.744 0.000 0.008 0.000 0.248

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 cell.line(p) agent(p) time(p) k
#> CV:kmeans 76     2.11e-17 4.87e-14  0.4296 2
#> CV:kmeans 55     1.14e-12 7.09e-11  0.0276 3
#> CV:kmeans 73     9.72e-16 7.86e-12  0.1816 4
#> CV:kmeans 72     1.59e-15 1.45e-11  0.1453 5
#> CV:kmeans 67     9.75e-14 8.91e-15  0.0168 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 18792 rows and 77 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.986       0.995         0.5055 0.496   0.496
#> 3 3 0.753           0.928       0.896         0.2668 0.859   0.714
#> 4 4 0.804           0.876       0.926         0.1754 0.891   0.691
#> 5 5 0.767           0.734       0.839         0.0568 0.914   0.673
#> 6 6 0.747           0.665       0.781         0.0393 0.959   0.798

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
#> GSM87962     1   0.000      0.990 1.000 0.000
#> GSM87963     1   0.000      0.990 1.000 0.000
#> GSM87983     1   0.000      0.990 1.000 0.000
#> GSM87984     1   0.000      0.990 1.000 0.000
#> GSM87961     1   0.000      0.990 1.000 0.000
#> GSM87970     1   0.000      0.990 1.000 0.000
#> GSM87971     1   0.969      0.344 0.604 0.396
#> GSM87990     1   0.000      0.990 1.000 0.000
#> GSM87991     1   0.000      0.990 1.000 0.000
#> GSM87974     1   0.000      0.990 1.000 0.000
#> GSM87994     1   0.000      0.990 1.000 0.000
#> GSM87978     1   0.000      0.990 1.000 0.000
#> GSM87979     1   0.000      0.990 1.000 0.000
#> GSM87998     1   0.000      0.990 1.000 0.000
#> GSM87999     1   0.000      0.990 1.000 0.000
#> GSM87968     1   0.000      0.990 1.000 0.000
#> GSM87987     1   0.000      0.990 1.000 0.000
#> GSM87969     1   0.000      0.990 1.000 0.000
#> GSM87988     1   0.000      0.990 1.000 0.000
#> GSM87989     1   0.000      0.990 1.000 0.000
#> GSM87972     1   0.000      0.990 1.000 0.000
#> GSM87992     1   0.000      0.990 1.000 0.000
#> GSM87973     1   0.000      0.990 1.000 0.000
#> GSM87993     1   0.000      0.990 1.000 0.000
#> GSM87975     1   0.000      0.990 1.000 0.000
#> GSM87995     1   0.000      0.990 1.000 0.000
#> GSM87976     1   0.000      0.990 1.000 0.000
#> GSM87977     1   0.000      0.990 1.000 0.000
#> GSM87996     1   0.000      0.990 1.000 0.000
#> GSM87997     1   0.000      0.990 1.000 0.000
#> GSM87980     1   0.000      0.990 1.000 0.000
#> GSM88000     1   0.000      0.990 1.000 0.000
#> GSM87981     1   0.000      0.990 1.000 0.000
#> GSM87982     1   0.000      0.990 1.000 0.000
#> GSM88001     1   0.000      0.990 1.000 0.000
#> GSM87967     1   0.000      0.990 1.000 0.000
#> GSM87964     1   0.000      0.990 1.000 0.000
#> GSM87965     1   0.000      0.990 1.000 0.000
#> GSM87966     1   0.000      0.990 1.000 0.000
#> GSM87985     1   0.000      0.990 1.000 0.000
#> GSM87986     1   0.000      0.990 1.000 0.000
#> GSM88004     2   0.000      1.000 0.000 1.000
#> GSM88015     2   0.000      1.000 0.000 1.000
#> GSM88005     2   0.000      1.000 0.000 1.000
#> GSM88006     2   0.000      1.000 0.000 1.000
#> GSM88016     2   0.000      1.000 0.000 1.000
#> GSM88007     2   0.000      1.000 0.000 1.000
#> GSM88017     2   0.000      1.000 0.000 1.000
#> GSM88029     2   0.000      1.000 0.000 1.000
#> GSM88008     2   0.000      1.000 0.000 1.000
#> GSM88009     2   0.000      1.000 0.000 1.000
#> GSM88018     2   0.000      1.000 0.000 1.000
#> GSM88024     2   0.000      1.000 0.000 1.000
#> GSM88030     2   0.000      1.000 0.000 1.000
#> GSM88036     2   0.000      1.000 0.000 1.000
#> GSM88010     2   0.000      1.000 0.000 1.000
#> GSM88011     2   0.000      1.000 0.000 1.000
#> GSM88019     2   0.000      1.000 0.000 1.000
#> GSM88027     2   0.000      1.000 0.000 1.000
#> GSM88031     2   0.000      1.000 0.000 1.000
#> GSM88012     2   0.000      1.000 0.000 1.000
#> GSM88020     2   0.000      1.000 0.000 1.000
#> GSM88032     2   0.000      1.000 0.000 1.000
#> GSM88037     2   0.000      1.000 0.000 1.000
#> GSM88013     2   0.000      1.000 0.000 1.000
#> GSM88021     2   0.000      1.000 0.000 1.000
#> GSM88025     2   0.000      1.000 0.000 1.000
#> GSM88033     2   0.000      1.000 0.000 1.000
#> GSM88014     2   0.000      1.000 0.000 1.000
#> GSM88022     2   0.000      1.000 0.000 1.000
#> GSM88034     2   0.000      1.000 0.000 1.000
#> GSM88002     2   0.000      1.000 0.000 1.000
#> GSM88003     2   0.000      1.000 0.000 1.000
#> GSM88023     2   0.000      1.000 0.000 1.000
#> GSM88026     2   0.000      1.000 0.000 1.000
#> GSM88028     2   0.000      1.000 0.000 1.000
#> GSM88035     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
#> GSM87962     1  0.4796      0.983 0.780 0.000 0.220
#> GSM87963     1  0.4796      0.983 0.780 0.000 0.220
#> GSM87983     1  0.4796      0.983 0.780 0.000 0.220
#> GSM87984     1  0.4796      0.983 0.780 0.000 0.220
#> GSM87961     3  0.0000      0.956 0.000 0.000 1.000
#> GSM87970     3  0.0000      0.956 0.000 0.000 1.000
#> GSM87971     3  0.4654      0.688 0.000 0.208 0.792
#> GSM87990     3  0.2878      0.851 0.096 0.000 0.904
#> GSM87991     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87974     3  0.0000      0.956 0.000 0.000 1.000
#> GSM87994     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87978     3  0.0000      0.956 0.000 0.000 1.000
#> GSM87979     3  0.0000      0.956 0.000 0.000 1.000
#> GSM87998     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87999     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87968     3  0.0000      0.956 0.000 0.000 1.000
#> GSM87987     1  0.4796      0.983 0.780 0.000 0.220
#> GSM87969     1  0.6235      0.593 0.564 0.000 0.436
#> GSM87988     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87989     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87972     3  0.0237      0.956 0.004 0.000 0.996
#> GSM87992     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87973     3  0.0747      0.952 0.016 0.000 0.984
#> GSM87993     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87975     3  0.0237      0.956 0.004 0.000 0.996
#> GSM87995     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87976     3  0.0237      0.956 0.004 0.000 0.996
#> GSM87977     3  0.0747      0.952 0.016 0.000 0.984
#> GSM87996     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87997     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87980     3  0.0747      0.952 0.016 0.000 0.984
#> GSM88000     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87981     3  0.0747      0.952 0.016 0.000 0.984
#> GSM87982     3  0.3038      0.844 0.104 0.000 0.896
#> GSM88001     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87967     1  0.4750      0.985 0.784 0.000 0.216
#> GSM87964     3  0.0000      0.956 0.000 0.000 1.000
#> GSM87965     1  0.4796      0.983 0.780 0.000 0.220
#> GSM87966     1  0.4796      0.983 0.780 0.000 0.220
#> GSM87985     3  0.1643      0.920 0.044 0.000 0.956
#> GSM87986     1  0.4796      0.983 0.780 0.000 0.220
#> GSM88004     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88015     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88005     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88006     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88016     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88007     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88017     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88029     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88008     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88009     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88018     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88024     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88030     2  0.1860      0.911 0.052 0.948 0.000
#> GSM88036     2  0.1860      0.911 0.052 0.948 0.000
#> GSM88010     2  0.4504      0.896 0.196 0.804 0.000
#> GSM88011     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88019     2  0.4702      0.894 0.212 0.788 0.000
#> GSM88027     2  0.4702      0.894 0.212 0.788 0.000
#> GSM88031     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88012     2  0.4504      0.896 0.196 0.804 0.000
#> GSM88020     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88032     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88037     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88013     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88021     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88025     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88033     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88014     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88022     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88034     2  0.4750      0.894 0.216 0.784 0.000
#> GSM88002     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88003     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88023     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88026     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88028     2  0.0000      0.913 0.000 1.000 0.000
#> GSM88035     2  0.0000      0.913 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
#> GSM87962     1  0.3539      0.844 0.820 0.000 0.176 0.004
#> GSM87963     1  0.3539      0.844 0.820 0.000 0.176 0.004
#> GSM87983     1  0.3539      0.844 0.820 0.000 0.176 0.004
#> GSM87984     1  0.3539      0.844 0.820 0.000 0.176 0.004
#> GSM87961     3  0.0921      0.864 0.028 0.000 0.972 0.000
#> GSM87970     3  0.0000      0.869 0.000 0.000 1.000 0.000
#> GSM87971     3  0.0000      0.869 0.000 0.000 1.000 0.000
#> GSM87990     3  0.3105      0.754 0.140 0.000 0.856 0.004
#> GSM87991     1  0.1302      0.892 0.956 0.000 0.044 0.000
#> GSM87974     3  0.0000      0.869 0.000 0.000 1.000 0.000
#> GSM87994     1  0.1824      0.888 0.936 0.000 0.060 0.004
#> GSM87978     3  0.0000      0.869 0.000 0.000 1.000 0.000
#> GSM87979     3  0.0000      0.869 0.000 0.000 1.000 0.000
#> GSM87998     1  0.1302      0.892 0.956 0.000 0.044 0.000
#> GSM87999     1  0.0000      0.894 1.000 0.000 0.000 0.000
#> GSM87968     3  0.0000      0.869 0.000 0.000 1.000 0.000
#> GSM87987     1  0.3831      0.818 0.792 0.000 0.204 0.004
#> GSM87969     1  0.4313      0.599 0.736 0.000 0.260 0.004
#> GSM87988     1  0.0188      0.894 0.996 0.000 0.000 0.004
#> GSM87989     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87972     3  0.3649      0.836 0.204 0.000 0.796 0.000
#> GSM87992     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87973     3  0.4086      0.827 0.216 0.000 0.776 0.008
#> GSM87993     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87975     3  0.3649      0.836 0.204 0.000 0.796 0.000
#> GSM87995     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87976     3  0.3311      0.841 0.172 0.000 0.828 0.000
#> GSM87977     3  0.4194      0.814 0.228 0.000 0.764 0.008
#> GSM87996     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87997     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87980     3  0.4086      0.827 0.216 0.000 0.776 0.008
#> GSM88000     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87981     3  0.3870      0.833 0.208 0.000 0.788 0.004
#> GSM87982     3  0.4897      0.688 0.332 0.000 0.660 0.008
#> GSM88001     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87967     1  0.0336      0.894 0.992 0.000 0.000 0.008
#> GSM87964     3  0.0000      0.869 0.000 0.000 1.000 0.000
#> GSM87965     1  0.3539      0.844 0.820 0.000 0.176 0.004
#> GSM87966     1  0.3539      0.844 0.820 0.000 0.176 0.004
#> GSM87985     3  0.1902      0.832 0.064 0.000 0.932 0.004
#> GSM87986     1  0.3539      0.844 0.820 0.000 0.176 0.004
#> GSM88004     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88005     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88029     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88008     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88030     4  0.4543      0.577 0.000 0.324 0.000 0.676
#> GSM88036     4  0.4543      0.577 0.000 0.324 0.000 0.676
#> GSM88010     2  0.3610      0.726 0.000 0.800 0.000 0.200
#> GSM88011     4  0.1022      0.914 0.000 0.032 0.000 0.968
#> GSM88019     4  0.3528      0.774 0.000 0.192 0.000 0.808
#> GSM88027     4  0.3726      0.748 0.000 0.212 0.000 0.788
#> GSM88031     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88012     2  0.4222      0.617 0.000 0.728 0.000 0.272
#> GSM88020     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88032     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88037     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88013     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88021     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88025     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88033     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88014     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88022     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88034     4  0.0469      0.925 0.000 0.012 0.000 0.988
#> GSM88002     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88003     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88023     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88026     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88028     2  0.0000      0.972 0.000 1.000 0.000 0.000
#> GSM88035     2  0.0000      0.972 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
#> GSM87962     1  0.0510     0.8548 0.984 0.000 0.000 0.000 0.016
#> GSM87963     1  0.0510     0.8548 0.984 0.000 0.000 0.000 0.016
#> GSM87983     1  0.0404     0.8555 0.988 0.000 0.000 0.000 0.012
#> GSM87984     1  0.0510     0.8548 0.984 0.000 0.000 0.000 0.016
#> GSM87961     5  0.3563     0.7220 0.208 0.000 0.012 0.000 0.780
#> GSM87970     5  0.0794     0.8220 0.000 0.000 0.028 0.000 0.972
#> GSM87971     5  0.0609     0.8280 0.020 0.000 0.000 0.000 0.980
#> GSM87990     5  0.4047     0.5318 0.320 0.000 0.004 0.000 0.676
#> GSM87991     1  0.1671     0.8274 0.924 0.000 0.076 0.000 0.000
#> GSM87974     5  0.0880     0.8206 0.000 0.000 0.032 0.000 0.968
#> GSM87994     1  0.1410     0.8368 0.940 0.000 0.060 0.000 0.000
#> GSM87978     5  0.0609     0.8280 0.020 0.000 0.000 0.000 0.980
#> GSM87979     5  0.0609     0.8280 0.020 0.000 0.000 0.000 0.980
#> GSM87998     1  0.2561     0.7690 0.856 0.000 0.144 0.000 0.000
#> GSM87999     1  0.2813     0.7371 0.832 0.000 0.168 0.000 0.000
#> GSM87968     5  0.0609     0.8280 0.020 0.000 0.000 0.000 0.980
#> GSM87987     1  0.3196     0.6972 0.804 0.000 0.004 0.000 0.192
#> GSM87969     1  0.4944     0.5080 0.700 0.000 0.208 0.000 0.092
#> GSM87988     1  0.4219     0.0482 0.584 0.000 0.416 0.000 0.000
#> GSM87989     3  0.4278     0.3756 0.452 0.000 0.548 0.000 0.000
#> GSM87972     3  0.4410     0.1236 0.004 0.000 0.556 0.000 0.440
#> GSM87992     3  0.4161     0.5212 0.392 0.000 0.608 0.000 0.000
#> GSM87973     3  0.3715     0.4998 0.004 0.000 0.736 0.000 0.260
#> GSM87993     3  0.3661     0.6144 0.276 0.000 0.724 0.000 0.000
#> GSM87975     5  0.4211     0.4085 0.004 0.000 0.360 0.000 0.636
#> GSM87995     3  0.4161     0.5212 0.392 0.000 0.608 0.000 0.000
#> GSM87976     5  0.3305     0.6572 0.000 0.000 0.224 0.000 0.776
#> GSM87977     3  0.4990     0.3560 0.040 0.000 0.600 0.000 0.360
#> GSM87996     3  0.4161     0.5212 0.392 0.000 0.608 0.000 0.000
#> GSM87997     3  0.3999     0.5704 0.344 0.000 0.656 0.000 0.000
#> GSM87980     3  0.3969     0.4401 0.004 0.000 0.692 0.000 0.304
#> GSM88000     3  0.3480     0.6192 0.248 0.000 0.752 0.000 0.000
#> GSM87981     3  0.4047     0.4141 0.004 0.000 0.676 0.000 0.320
#> GSM87982     3  0.3942     0.4977 0.012 0.000 0.728 0.000 0.260
#> GSM88001     3  0.4161     0.5212 0.392 0.000 0.608 0.000 0.000
#> GSM87967     3  0.3707     0.6112 0.284 0.000 0.716 0.000 0.000
#> GSM87964     5  0.1341     0.8115 0.000 0.000 0.056 0.000 0.944
#> GSM87965     1  0.0510     0.8548 0.984 0.000 0.000 0.000 0.016
#> GSM87966     1  0.1012     0.8512 0.968 0.000 0.020 0.000 0.012
#> GSM87985     5  0.4126     0.5245 0.380 0.000 0.000 0.000 0.620
#> GSM87986     1  0.0404     0.8555 0.988 0.000 0.000 0.000 0.012
#> GSM88004     2  0.0162     0.9274 0.000 0.996 0.004 0.000 0.000
#> GSM88015     2  0.0510     0.9253 0.000 0.984 0.016 0.000 0.000
#> GSM88005     2  0.0703     0.9228 0.000 0.976 0.024 0.000 0.000
#> GSM88006     2  0.0162     0.9274 0.000 0.996 0.004 0.000 0.000
#> GSM88016     2  0.0510     0.9253 0.000 0.984 0.016 0.000 0.000
#> GSM88007     2  0.0162     0.9274 0.000 0.996 0.004 0.000 0.000
#> GSM88017     2  0.3427     0.8193 0.012 0.796 0.192 0.000 0.000
#> GSM88029     2  0.1478     0.9227 0.000 0.936 0.064 0.000 0.000
#> GSM88008     2  0.0703     0.9228 0.000 0.976 0.024 0.000 0.000
#> GSM88009     2  0.0162     0.9274 0.000 0.996 0.004 0.000 0.000
#> GSM88018     2  0.0510     0.9253 0.000 0.984 0.016 0.000 0.000
#> GSM88024     2  0.3427     0.8193 0.012 0.796 0.192 0.000 0.000
#> GSM88030     4  0.6602     0.4119 0.012 0.292 0.180 0.516 0.000
#> GSM88036     4  0.6616     0.4025 0.012 0.296 0.180 0.512 0.000
#> GSM88010     2  0.3300     0.6996 0.000 0.792 0.004 0.204 0.000
#> GSM88011     4  0.2482     0.8313 0.000 0.084 0.024 0.892 0.000
#> GSM88019     4  0.3488     0.7648 0.000 0.168 0.024 0.808 0.000
#> GSM88027     4  0.3745     0.7305 0.000 0.196 0.024 0.780 0.000
#> GSM88031     4  0.0162     0.8688 0.000 0.000 0.004 0.996 0.000
#> GSM88012     2  0.4645     0.6111 0.000 0.688 0.044 0.268 0.000
#> GSM88020     4  0.3039     0.8105 0.012 0.000 0.152 0.836 0.000
#> GSM88032     4  0.0162     0.8688 0.000 0.000 0.004 0.996 0.000
#> GSM88037     4  0.0162     0.8688 0.000 0.000 0.004 0.996 0.000
#> GSM88013     4  0.0162     0.8689 0.000 0.000 0.004 0.996 0.000
#> GSM88021     4  0.1792     0.8459 0.000 0.000 0.084 0.916 0.000
#> GSM88025     4  0.0000     0.8686 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0000     0.8686 0.000 0.000 0.000 1.000 0.000
#> GSM88014     4  0.0162     0.8689 0.000 0.000 0.004 0.996 0.000
#> GSM88022     4  0.1310     0.8592 0.000 0.020 0.024 0.956 0.000
#> GSM88034     4  0.3039     0.8105 0.012 0.000 0.152 0.836 0.000
#> GSM88002     2  0.1410     0.9248 0.000 0.940 0.060 0.000 0.000
#> GSM88003     2  0.1410     0.9248 0.000 0.940 0.060 0.000 0.000
#> GSM88023     2  0.1410     0.9248 0.000 0.940 0.060 0.000 0.000
#> GSM88026     2  0.1410     0.9248 0.000 0.940 0.060 0.000 0.000
#> GSM88028     2  0.1410     0.9248 0.000 0.940 0.060 0.000 0.000
#> GSM88035     2  0.1410     0.9248 0.000 0.940 0.060 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
#> GSM87962     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87963     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87983     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87961     5  0.3384      0.683 0.228 0.000 0.008 0.000 0.760 0.004
#> GSM87970     5  0.1334      0.770 0.000 0.000 0.020 0.000 0.948 0.032
#> GSM87971     5  0.0993      0.777 0.024 0.000 0.000 0.000 0.964 0.012
#> GSM87990     5  0.3984      0.390 0.396 0.000 0.000 0.000 0.596 0.008
#> GSM87991     1  0.3189      0.746 0.796 0.000 0.184 0.000 0.000 0.020
#> GSM87974     5  0.1408      0.769 0.000 0.000 0.020 0.000 0.944 0.036
#> GSM87994     1  0.2821      0.784 0.832 0.000 0.152 0.000 0.000 0.016
#> GSM87978     5  0.0993      0.777 0.024 0.000 0.000 0.000 0.964 0.012
#> GSM87979     5  0.1074      0.776 0.028 0.000 0.000 0.000 0.960 0.012
#> GSM87998     1  0.3641      0.673 0.732 0.000 0.248 0.000 0.000 0.020
#> GSM87999     1  0.3859      0.605 0.692 0.000 0.288 0.000 0.000 0.020
#> GSM87968     5  0.0993      0.777 0.024 0.000 0.000 0.000 0.964 0.012
#> GSM87987     1  0.3585      0.726 0.792 0.000 0.048 0.000 0.156 0.004
#> GSM87969     1  0.4488      0.588 0.720 0.000 0.204 0.000 0.052 0.024
#> GSM87988     3  0.4229      0.168 0.436 0.000 0.548 0.000 0.000 0.016
#> GSM87989     3  0.4018      0.479 0.324 0.000 0.656 0.000 0.000 0.020
#> GSM87972     3  0.5607      0.231 0.000 0.000 0.532 0.000 0.284 0.184
#> GSM87992     3  0.3508      0.550 0.292 0.000 0.704 0.000 0.000 0.004
#> GSM87973     3  0.3914      0.556 0.000 0.000 0.768 0.000 0.104 0.128
#> GSM87993     3  0.2135      0.647 0.128 0.000 0.872 0.000 0.000 0.000
#> GSM87975     5  0.5771      0.148 0.000 0.000 0.380 0.000 0.444 0.176
#> GSM87995     3  0.3371      0.554 0.292 0.000 0.708 0.000 0.000 0.000
#> GSM87976     5  0.5391      0.442 0.000 0.000 0.244 0.000 0.580 0.176
#> GSM87977     3  0.5479      0.383 0.032 0.000 0.612 0.000 0.264 0.092
#> GSM87996     3  0.3371      0.554 0.292 0.000 0.708 0.000 0.000 0.000
#> GSM87997     3  0.2969      0.605 0.224 0.000 0.776 0.000 0.000 0.000
#> GSM87980     3  0.4980      0.436 0.000 0.000 0.648 0.000 0.184 0.168
#> GSM88000     3  0.1644      0.653 0.076 0.000 0.920 0.000 0.000 0.004
#> GSM87981     3  0.4977      0.434 0.000 0.000 0.648 0.000 0.188 0.164
#> GSM87982     3  0.4377      0.521 0.000 0.000 0.720 0.000 0.120 0.160
#> GSM88001     3  0.3371      0.554 0.292 0.000 0.708 0.000 0.000 0.000
#> GSM87967     3  0.3626      0.648 0.144 0.000 0.788 0.000 0.000 0.068
#> GSM87964     5  0.2888      0.728 0.000 0.000 0.056 0.000 0.852 0.092
#> GSM87965     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87966     1  0.0713      0.845 0.972 0.000 0.028 0.000 0.000 0.000
#> GSM87985     5  0.3727      0.470 0.388 0.000 0.000 0.000 0.612 0.000
#> GSM87986     1  0.0146      0.852 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM88004     2  0.0291      0.824 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM88015     2  0.1152      0.817 0.000 0.952 0.004 0.000 0.000 0.044
#> GSM88005     2  0.1901      0.796 0.000 0.924 0.008 0.028 0.000 0.040
#> GSM88006     2  0.0291      0.824 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM88016     2  0.1152      0.817 0.000 0.952 0.004 0.000 0.000 0.044
#> GSM88007     2  0.0291      0.824 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM88017     6  0.3756      0.309 0.000 0.400 0.000 0.000 0.000 0.600
#> GSM88029     2  0.3610      0.778 0.000 0.792 0.052 0.004 0.000 0.152
#> GSM88008     2  0.1901      0.796 0.000 0.924 0.008 0.028 0.000 0.040
#> GSM88009     2  0.0291      0.824 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM88018     2  0.1588      0.807 0.000 0.924 0.004 0.000 0.000 0.072
#> GSM88024     6  0.3747      0.328 0.000 0.396 0.000 0.000 0.000 0.604
#> GSM88030     6  0.4614      0.635 0.000 0.108 0.000 0.208 0.000 0.684
#> GSM88036     6  0.4628      0.637 0.000 0.112 0.000 0.204 0.000 0.684
#> GSM88010     2  0.3912      0.540 0.000 0.732 0.000 0.224 0.000 0.044
#> GSM88011     4  0.2763      0.767 0.000 0.088 0.008 0.868 0.000 0.036
#> GSM88019     4  0.3128      0.739 0.000 0.096 0.008 0.844 0.000 0.052
#> GSM88027     4  0.3358      0.710 0.000 0.116 0.008 0.824 0.000 0.052
#> GSM88031     4  0.1387      0.840 0.000 0.000 0.000 0.932 0.000 0.068
#> GSM88012     2  0.5267      0.439 0.000 0.612 0.008 0.260 0.000 0.120
#> GSM88020     6  0.3727      0.394 0.000 0.000 0.000 0.388 0.000 0.612
#> GSM88032     4  0.1387      0.840 0.000 0.000 0.000 0.932 0.000 0.068
#> GSM88037     4  0.1387      0.840 0.000 0.000 0.000 0.932 0.000 0.068
#> GSM88013     4  0.0692      0.840 0.000 0.004 0.000 0.976 0.000 0.020
#> GSM88021     4  0.3684      0.283 0.000 0.000 0.000 0.628 0.000 0.372
#> GSM88025     4  0.1663      0.833 0.000 0.000 0.000 0.912 0.000 0.088
#> GSM88033     4  0.1663      0.833 0.000 0.000 0.000 0.912 0.000 0.088
#> GSM88014     4  0.0692      0.840 0.000 0.004 0.000 0.976 0.000 0.020
#> GSM88022     4  0.1693      0.824 0.000 0.020 0.004 0.932 0.000 0.044
#> GSM88034     6  0.3747      0.377 0.000 0.000 0.000 0.396 0.000 0.604
#> GSM88002     2  0.3785      0.784 0.000 0.780 0.064 0.004 0.000 0.152
#> GSM88003     2  0.3785      0.784 0.000 0.780 0.064 0.004 0.000 0.152
#> GSM88023     2  0.3857      0.783 0.000 0.772 0.064 0.004 0.000 0.160
#> GSM88026     2  0.3857      0.783 0.000 0.772 0.064 0.004 0.000 0.160
#> GSM88028     2  0.3857      0.783 0.000 0.772 0.064 0.004 0.000 0.160
#> GSM88035     2  0.3857      0.783 0.000 0.772 0.064 0.004 0.000 0.160

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 cell.line(p) agent(p) time(p) k
#> CV:skmeans 76     2.11e-17 4.87e-14 0.42960 2
#> CV:skmeans 77     1.90e-17 7.46e-13 0.65729 3
#> CV:skmeans 77     1.35e-16 8.44e-13 0.06074 4
#> CV:skmeans 66     1.58e-13 4.68e-11 0.00313 5
#> CV:skmeans 61     7.55e-12 1.62e-09 0.00709 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 18792 rows and 77 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.946           0.936       0.974         0.5010 0.496   0.496
#> 3 3 0.678           0.824       0.866         0.2799 0.857   0.712
#> 4 4 0.794           0.704       0.877         0.1699 0.859   0.621
#> 5 5 0.786           0.671       0.840         0.0545 0.933   0.744
#> 6 6 0.796           0.741       0.847         0.0394 0.934   0.703

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
#> GSM87962     1  0.0000     0.9911 1.000 0.000
#> GSM87963     1  0.0000     0.9911 1.000 0.000
#> GSM87983     1  0.0000     0.9911 1.000 0.000
#> GSM87984     1  0.0000     0.9911 1.000 0.000
#> GSM87961     1  0.0000     0.9911 1.000 0.000
#> GSM87970     1  0.0000     0.9911 1.000 0.000
#> GSM87971     1  0.8499     0.5874 0.724 0.276
#> GSM87990     1  0.0000     0.9911 1.000 0.000
#> GSM87991     1  0.0000     0.9911 1.000 0.000
#> GSM87974     1  0.0000     0.9911 1.000 0.000
#> GSM87994     1  0.0000     0.9911 1.000 0.000
#> GSM87978     1  0.0000     0.9911 1.000 0.000
#> GSM87979     1  0.0376     0.9874 0.996 0.004
#> GSM87998     1  0.0000     0.9911 1.000 0.000
#> GSM87999     1  0.0000     0.9911 1.000 0.000
#> GSM87968     1  0.1184     0.9757 0.984 0.016
#> GSM87987     1  0.0000     0.9911 1.000 0.000
#> GSM87969     1  0.0000     0.9911 1.000 0.000
#> GSM87988     1  0.0000     0.9911 1.000 0.000
#> GSM87989     1  0.0000     0.9911 1.000 0.000
#> GSM87972     1  0.0000     0.9911 1.000 0.000
#> GSM87992     1  0.0000     0.9911 1.000 0.000
#> GSM87973     1  0.0000     0.9911 1.000 0.000
#> GSM87993     1  0.0000     0.9911 1.000 0.000
#> GSM87975     1  0.0000     0.9911 1.000 0.000
#> GSM87995     1  0.0000     0.9911 1.000 0.000
#> GSM87976     1  0.0000     0.9911 1.000 0.000
#> GSM87977     1  0.0000     0.9911 1.000 0.000
#> GSM87996     1  0.0000     0.9911 1.000 0.000
#> GSM87997     1  0.0000     0.9911 1.000 0.000
#> GSM87980     1  0.0000     0.9911 1.000 0.000
#> GSM88000     1  0.0000     0.9911 1.000 0.000
#> GSM87981     1  0.0000     0.9911 1.000 0.000
#> GSM87982     1  0.0000     0.9911 1.000 0.000
#> GSM88001     1  0.0000     0.9911 1.000 0.000
#> GSM87967     1  0.0000     0.9911 1.000 0.000
#> GSM87964     1  0.2236     0.9546 0.964 0.036
#> GSM87965     1  0.0000     0.9911 1.000 0.000
#> GSM87966     1  0.0000     0.9911 1.000 0.000
#> GSM87985     1  0.0000     0.9911 1.000 0.000
#> GSM87986     1  0.0000     0.9911 1.000 0.000
#> GSM88004     2  0.0000     0.9498 0.000 1.000
#> GSM88015     2  0.0000     0.9498 0.000 1.000
#> GSM88005     2  0.0000     0.9498 0.000 1.000
#> GSM88006     2  0.0000     0.9498 0.000 1.000
#> GSM88016     2  0.0000     0.9498 0.000 1.000
#> GSM88007     2  0.0000     0.9498 0.000 1.000
#> GSM88017     2  0.0000     0.9498 0.000 1.000
#> GSM88029     2  0.0000     0.9498 0.000 1.000
#> GSM88008     2  0.0000     0.9498 0.000 1.000
#> GSM88009     2  0.0000     0.9498 0.000 1.000
#> GSM88018     2  0.0000     0.9498 0.000 1.000
#> GSM88024     2  0.0000     0.9498 0.000 1.000
#> GSM88030     2  0.0938     0.9411 0.012 0.988
#> GSM88036     2  0.2603     0.9151 0.044 0.956
#> GSM88010     2  0.0000     0.9498 0.000 1.000
#> GSM88011     2  0.0000     0.9498 0.000 1.000
#> GSM88019     2  0.0000     0.9498 0.000 1.000
#> GSM88027     2  0.0000     0.9498 0.000 1.000
#> GSM88031     2  0.0000     0.9498 0.000 1.000
#> GSM88012     2  0.0000     0.9498 0.000 1.000
#> GSM88020     2  0.8267     0.6630 0.260 0.740
#> GSM88032     2  0.9996     0.0701 0.488 0.512
#> GSM88037     2  0.9170     0.5154 0.332 0.668
#> GSM88013     2  0.0000     0.9498 0.000 1.000
#> GSM88021     2  0.8608     0.6246 0.284 0.716
#> GSM88025     2  0.0000     0.9498 0.000 1.000
#> GSM88033     2  0.0000     0.9498 0.000 1.000
#> GSM88014     2  0.0000     0.9498 0.000 1.000
#> GSM88022     2  0.0000     0.9498 0.000 1.000
#> GSM88034     2  0.8443     0.6450 0.272 0.728
#> GSM88002     2  0.0000     0.9498 0.000 1.000
#> GSM88003     2  0.0000     0.9498 0.000 1.000
#> GSM88023     2  0.0000     0.9498 0.000 1.000
#> GSM88026     2  0.0000     0.9498 0.000 1.000
#> GSM88028     2  0.0000     0.9498 0.000 1.000
#> GSM88035     2  0.0000     0.9498 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
#> GSM87962     1  0.0592      0.814 0.988 0.000 0.012
#> GSM87963     1  0.0592      0.814 0.988 0.000 0.012
#> GSM87983     3  0.6140      0.593 0.404 0.000 0.596
#> GSM87984     1  0.5254      0.505 0.736 0.000 0.264
#> GSM87961     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87970     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87971     1  0.4702      0.589 0.788 0.212 0.000
#> GSM87990     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87991     1  0.6308     -0.371 0.508 0.000 0.492
#> GSM87974     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87994     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87978     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87979     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87998     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87999     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87968     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87987     1  0.3752      0.701 0.856 0.000 0.144
#> GSM87969     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87988     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87989     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87972     3  0.5760      0.738 0.328 0.000 0.672
#> GSM87992     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87973     3  0.4605      0.938 0.204 0.000 0.796
#> GSM87993     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87975     1  0.5058      0.578 0.756 0.000 0.244
#> GSM87995     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87976     1  0.4555      0.634 0.800 0.000 0.200
#> GSM87977     1  0.5678      0.450 0.684 0.000 0.316
#> GSM87996     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87997     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87980     1  0.5733      0.413 0.676 0.000 0.324
#> GSM88000     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87981     3  0.4605      0.938 0.204 0.000 0.796
#> GSM87982     3  0.4605      0.938 0.204 0.000 0.796
#> GSM88001     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87967     3  0.4452      0.949 0.192 0.000 0.808
#> GSM87964     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87965     1  0.0237      0.818 0.996 0.000 0.004
#> GSM87966     1  0.6308     -0.371 0.508 0.000 0.492
#> GSM87985     1  0.0000      0.820 1.000 0.000 0.000
#> GSM87986     3  0.6095      0.617 0.392 0.000 0.608
#> GSM88004     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88015     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88005     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88006     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88016     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88007     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88017     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88029     2  0.0424      0.924 0.000 0.992 0.008
#> GSM88008     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88009     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88018     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88024     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88030     2  0.4452      0.890 0.000 0.808 0.192
#> GSM88036     2  0.0237      0.924 0.000 0.996 0.004
#> GSM88010     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88011     2  0.4399      0.891 0.000 0.812 0.188
#> GSM88019     2  0.4399      0.891 0.000 0.812 0.188
#> GSM88027     2  0.4399      0.891 0.000 0.812 0.188
#> GSM88031     2  0.4452      0.890 0.000 0.808 0.192
#> GSM88012     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88020     2  0.7605      0.776 0.124 0.684 0.192
#> GSM88032     2  0.4452      0.890 0.000 0.808 0.192
#> GSM88037     2  0.4452      0.890 0.000 0.808 0.192
#> GSM88013     2  0.4452      0.890 0.000 0.808 0.192
#> GSM88021     2  0.4808      0.887 0.008 0.804 0.188
#> GSM88025     2  0.4452      0.890 0.000 0.808 0.192
#> GSM88033     2  0.4452      0.890 0.000 0.808 0.192
#> GSM88014     2  0.4452      0.890 0.000 0.808 0.192
#> GSM88022     2  0.4399      0.891 0.000 0.812 0.188
#> GSM88034     2  0.7059      0.813 0.092 0.716 0.192
#> GSM88002     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88003     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88023     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88026     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88028     2  0.0000      0.925 0.000 1.000 0.000
#> GSM88035     2  0.0000      0.925 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
#> GSM87962     1  0.0592     0.8735 0.984 0.000 0.016 0.000
#> GSM87963     1  0.0592     0.8735 0.984 0.000 0.016 0.000
#> GSM87983     3  0.4855     0.4431 0.400 0.000 0.600 0.000
#> GSM87984     1  0.4072     0.5620 0.748 0.000 0.252 0.000
#> GSM87961     1  0.0000     0.8806 1.000 0.000 0.000 0.000
#> GSM87970     1  0.0000     0.8806 1.000 0.000 0.000 0.000
#> GSM87971     1  0.1637     0.8302 0.940 0.060 0.000 0.000
#> GSM87990     1  0.0188     0.8793 0.996 0.000 0.004 0.000
#> GSM87991     3  0.4967     0.3552 0.452 0.000 0.548 0.000
#> GSM87974     1  0.0000     0.8806 1.000 0.000 0.000 0.000
#> GSM87994     3  0.3486     0.7333 0.188 0.000 0.812 0.000
#> GSM87978     1  0.0000     0.8806 1.000 0.000 0.000 0.000
#> GSM87979     1  0.0000     0.8806 1.000 0.000 0.000 0.000
#> GSM87998     3  0.3486     0.7333 0.188 0.000 0.812 0.000
#> GSM87999     3  0.3486     0.7333 0.188 0.000 0.812 0.000
#> GSM87968     1  0.0000     0.8806 1.000 0.000 0.000 0.000
#> GSM87987     1  0.2281     0.8069 0.904 0.000 0.096 0.000
#> GSM87969     1  0.0000     0.8806 1.000 0.000 0.000 0.000
#> GSM87988     3  0.0000     0.8243 0.000 0.000 1.000 0.000
#> GSM87989     3  0.0188     0.8242 0.004 0.000 0.996 0.000
#> GSM87972     3  0.2149     0.7739 0.088 0.000 0.912 0.000
#> GSM87992     3  0.0000     0.8243 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0592     0.8200 0.016 0.000 0.984 0.000
#> GSM87993     3  0.0188     0.8242 0.004 0.000 0.996 0.000
#> GSM87975     1  0.4955     0.2502 0.556 0.000 0.444 0.000
#> GSM87995     3  0.0000     0.8243 0.000 0.000 1.000 0.000
#> GSM87976     1  0.4817     0.3735 0.612 0.000 0.388 0.000
#> GSM87977     1  0.4967     0.2519 0.548 0.000 0.452 0.000
#> GSM87996     3  0.0000     0.8243 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0188     0.8242 0.004 0.000 0.996 0.000
#> GSM87980     3  0.4972     0.0031 0.456 0.000 0.544 0.000
#> GSM88000     3  0.0188     0.8242 0.004 0.000 0.996 0.000
#> GSM87981     3  0.0592     0.8200 0.016 0.000 0.984 0.000
#> GSM87982     3  0.0592     0.8200 0.016 0.000 0.984 0.000
#> GSM88001     3  0.0000     0.8243 0.000 0.000 1.000 0.000
#> GSM87967     3  0.3444     0.7395 0.184 0.000 0.816 0.000
#> GSM87964     1  0.0000     0.8806 1.000 0.000 0.000 0.000
#> GSM87965     1  0.0469     0.8759 0.988 0.000 0.012 0.000
#> GSM87966     3  0.4967     0.3552 0.452 0.000 0.548 0.000
#> GSM87985     1  0.0188     0.8793 0.996 0.000 0.004 0.000
#> GSM87986     3  0.4817     0.4636 0.388 0.000 0.612 0.000
#> GSM88004     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88015     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88005     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88006     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88016     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88007     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88017     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88029     2  0.2149     0.1397 0.000 0.912 0.000 0.088
#> GSM88008     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88009     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88018     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88024     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88030     2  0.4916    -0.6164 0.000 0.576 0.000 0.424
#> GSM88036     2  0.0469     0.3045 0.000 0.988 0.000 0.012
#> GSM88010     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88011     4  0.0817     0.5156 0.000 0.024 0.000 0.976
#> GSM88019     4  0.0817     0.5156 0.000 0.024 0.000 0.976
#> GSM88027     4  0.0817     0.5156 0.000 0.024 0.000 0.976
#> GSM88031     4  0.4776     0.7909 0.000 0.376 0.000 0.624
#> GSM88012     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88020     2  0.6387    -0.6772 0.064 0.492 0.000 0.444
#> GSM88032     4  0.4776     0.7909 0.000 0.376 0.000 0.624
#> GSM88037     4  0.4776     0.7909 0.000 0.376 0.000 0.624
#> GSM88013     4  0.4776     0.7909 0.000 0.376 0.000 0.624
#> GSM88021     4  0.0895     0.5177 0.004 0.020 0.000 0.976
#> GSM88025     4  0.4776     0.7909 0.000 0.376 0.000 0.624
#> GSM88033     4  0.4776     0.7909 0.000 0.376 0.000 0.624
#> GSM88014     4  0.4776     0.7909 0.000 0.376 0.000 0.624
#> GSM88022     4  0.0817     0.5156 0.000 0.024 0.000 0.976
#> GSM88034     4  0.4776     0.7909 0.000 0.376 0.000 0.624
#> GSM88002     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88003     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88023     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88026     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88028     2  0.4776     0.8635 0.000 0.624 0.000 0.376
#> GSM88035     2  0.4776     0.8635 0.000 0.624 0.000 0.376

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM87962     5  0.4415     0.2575 0.444 0.000 0.004 0.000 0.552
#> GSM87963     5  0.4415     0.2575 0.444 0.000 0.004 0.000 0.552
#> GSM87983     5  0.4617     0.2811 0.012 0.000 0.436 0.000 0.552
#> GSM87984     5  0.5838     0.4106 0.336 0.000 0.112 0.000 0.552
#> GSM87961     1  0.4262    -0.0467 0.560 0.000 0.000 0.000 0.440
#> GSM87970     1  0.0000     0.8161 1.000 0.000 0.000 0.000 0.000
#> GSM87971     1  0.0000     0.8161 1.000 0.000 0.000 0.000 0.000
#> GSM87990     1  0.3366     0.5879 0.784 0.000 0.004 0.000 0.212
#> GSM87991     3  0.5092    -0.1206 0.036 0.000 0.524 0.000 0.440
#> GSM87974     1  0.0000     0.8161 1.000 0.000 0.000 0.000 0.000
#> GSM87994     3  0.3424     0.6040 0.000 0.000 0.760 0.000 0.240
#> GSM87978     1  0.0000     0.8161 1.000 0.000 0.000 0.000 0.000
#> GSM87979     1  0.0000     0.8161 1.000 0.000 0.000 0.000 0.000
#> GSM87998     3  0.3109     0.6746 0.000 0.000 0.800 0.000 0.200
#> GSM87999     3  0.3109     0.6677 0.000 0.000 0.800 0.000 0.200
#> GSM87968     1  0.0000     0.8161 1.000 0.000 0.000 0.000 0.000
#> GSM87987     1  0.2921     0.7016 0.856 0.000 0.020 0.000 0.124
#> GSM87969     1  0.3039     0.6092 0.808 0.000 0.000 0.000 0.192
#> GSM87988     3  0.0000     0.8554 0.000 0.000 1.000 0.000 0.000
#> GSM87989     3  0.0162     0.8556 0.004 0.000 0.996 0.000 0.000
#> GSM87972     3  0.2074     0.7751 0.104 0.000 0.896 0.000 0.000
#> GSM87992     3  0.0000     0.8554 0.000 0.000 1.000 0.000 0.000
#> GSM87973     3  0.0162     0.8556 0.004 0.000 0.996 0.000 0.000
#> GSM87993     3  0.0162     0.8556 0.004 0.000 0.996 0.000 0.000
#> GSM87975     1  0.3752     0.4003 0.708 0.000 0.292 0.000 0.000
#> GSM87995     3  0.0000     0.8554 0.000 0.000 1.000 0.000 0.000
#> GSM87976     1  0.0000     0.8161 1.000 0.000 0.000 0.000 0.000
#> GSM87977     1  0.1117     0.7923 0.964 0.000 0.016 0.000 0.020
#> GSM87996     3  0.0000     0.8554 0.000 0.000 1.000 0.000 0.000
#> GSM87997     3  0.0162     0.8556 0.004 0.000 0.996 0.000 0.000
#> GSM87980     3  0.4227     0.0742 0.420 0.000 0.580 0.000 0.000
#> GSM88000     3  0.0162     0.8556 0.004 0.000 0.996 0.000 0.000
#> GSM87981     3  0.1197     0.8267 0.048 0.000 0.952 0.000 0.000
#> GSM87982     3  0.0162     0.8556 0.004 0.000 0.996 0.000 0.000
#> GSM88001     3  0.0000     0.8554 0.000 0.000 1.000 0.000 0.000
#> GSM87967     3  0.2763     0.7348 0.004 0.000 0.848 0.000 0.148
#> GSM87964     1  0.0000     0.8161 1.000 0.000 0.000 0.000 0.000
#> GSM87965     5  0.4415     0.2575 0.444 0.000 0.004 0.000 0.552
#> GSM87966     5  0.4702     0.2804 0.016 0.000 0.432 0.000 0.552
#> GSM87985     1  0.4410    -0.0614 0.556 0.000 0.004 0.000 0.440
#> GSM87986     5  0.4273     0.2461 0.000 0.000 0.448 0.000 0.552
#> GSM88004     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88015     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88005     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88006     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88016     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88007     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88017     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88029     2  0.5559     0.6209 0.000 0.544 0.000 0.076 0.380
#> GSM88008     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88009     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88018     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88024     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88030     4  0.4555     0.5870 0.000 0.200 0.000 0.732 0.068
#> GSM88036     2  0.5449     0.3286 0.000 0.556 0.000 0.376 0.068
#> GSM88010     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88011     4  0.4126     0.6040 0.000 0.380 0.000 0.620 0.000
#> GSM88019     4  0.4126     0.6040 0.000 0.380 0.000 0.620 0.000
#> GSM88027     4  0.4126     0.6040 0.000 0.380 0.000 0.620 0.000
#> GSM88031     4  0.0000     0.8010 0.000 0.000 0.000 1.000 0.000
#> GSM88012     2  0.0000     0.8252 0.000 1.000 0.000 0.000 0.000
#> GSM88020     4  0.4051     0.7143 0.020 0.096 0.000 0.816 0.068
#> GSM88032     4  0.0000     0.8010 0.000 0.000 0.000 1.000 0.000
#> GSM88037     4  0.0000     0.8010 0.000 0.000 0.000 1.000 0.000
#> GSM88013     4  0.0404     0.7991 0.000 0.012 0.000 0.988 0.000
#> GSM88021     4  0.4264     0.6052 0.004 0.376 0.000 0.620 0.000
#> GSM88025     4  0.0000     0.8010 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0000     0.8010 0.000 0.000 0.000 1.000 0.000
#> GSM88014     4  0.0000     0.8010 0.000 0.000 0.000 1.000 0.000
#> GSM88022     4  0.4126     0.6040 0.000 0.380 0.000 0.620 0.000
#> GSM88034     4  0.1544     0.7737 0.000 0.000 0.000 0.932 0.068
#> GSM88002     2  0.4126     0.6890 0.000 0.620 0.000 0.000 0.380
#> GSM88003     2  0.3949     0.7092 0.000 0.668 0.000 0.000 0.332
#> GSM88023     2  0.4126     0.6890 0.000 0.620 0.000 0.000 0.380
#> GSM88026     2  0.4126     0.6890 0.000 0.620 0.000 0.000 0.380
#> GSM88028     2  0.4126     0.6890 0.000 0.620 0.000 0.000 0.380
#> GSM88035     2  0.4126     0.6890 0.000 0.620 0.000 0.000 0.380

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1   0.186      0.800 0.896 0.000 0.000 0.000 0.000 0.104
#> GSM87963     1   0.186      0.800 0.896 0.000 0.000 0.000 0.000 0.104
#> GSM87983     1   0.196      0.788 0.896 0.000 0.100 0.000 0.000 0.004
#> GSM87984     1   0.202      0.802 0.896 0.000 0.008 0.000 0.000 0.096
#> GSM87961     1   0.383      0.357 0.556 0.000 0.000 0.000 0.000 0.444
#> GSM87970     6   0.000      0.876 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM87971     6   0.000      0.876 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM87990     6   0.337      0.494 0.292 0.000 0.000 0.000 0.000 0.708
#> GSM87991     1   0.477      0.433 0.600 0.000 0.332 0.000 0.000 0.068
#> GSM87974     6   0.000      0.876 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM87994     3   0.382      0.230 0.432 0.000 0.568 0.000 0.000 0.000
#> GSM87978     6   0.000      0.876 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM87979     6   0.000      0.876 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM87998     3   0.279      0.711 0.200 0.000 0.800 0.000 0.000 0.000
#> GSM87999     3   0.348      0.511 0.316 0.000 0.684 0.000 0.000 0.000
#> GSM87968     6   0.000      0.876 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM87987     6   0.285      0.691 0.208 0.000 0.000 0.000 0.000 0.792
#> GSM87969     6   0.308      0.616 0.240 0.000 0.000 0.000 0.000 0.760
#> GSM87988     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87989     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87972     3   0.218      0.781 0.000 0.000 0.868 0.000 0.000 0.132
#> GSM87992     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87973     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87993     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87975     6   0.343      0.497 0.000 0.000 0.304 0.000 0.000 0.696
#> GSM87995     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87976     6   0.000      0.876 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM87977     6   0.139      0.833 0.068 0.000 0.000 0.000 0.000 0.932
#> GSM87996     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87997     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87980     3   0.377      0.249 0.000 0.000 0.592 0.000 0.000 0.408
#> GSM88000     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87981     3   0.101      0.856 0.000 0.000 0.956 0.000 0.000 0.044
#> GSM87982     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM88001     3   0.000      0.883 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87967     3   0.234      0.764 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM87964     6   0.079      0.859 0.032 0.000 0.000 0.000 0.000 0.968
#> GSM87965     1   0.186      0.800 0.896 0.000 0.000 0.000 0.000 0.104
#> GSM87966     1   0.231      0.787 0.880 0.000 0.104 0.000 0.000 0.016
#> GSM87985     1   0.366      0.524 0.636 0.000 0.000 0.000 0.000 0.364
#> GSM87986     1   0.186      0.786 0.896 0.000 0.104 0.000 0.000 0.000
#> GSM88004     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88015     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88005     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88006     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88016     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88007     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88017     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88029     5   0.209      0.864 0.000 0.028 0.000 0.068 0.904 0.000
#> GSM88008     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88009     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88018     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88024     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88030     2   0.511     -0.248 0.104 0.580 0.000 0.316 0.000 0.000
#> GSM88036     2   0.505     -0.223 0.104 0.596 0.000 0.300 0.000 0.000
#> GSM88010     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88011     4   0.343      0.635 0.000 0.304 0.000 0.696 0.000 0.000
#> GSM88019     4   0.343      0.635 0.000 0.304 0.000 0.696 0.000 0.000
#> GSM88027     4   0.343      0.635 0.000 0.304 0.000 0.696 0.000 0.000
#> GSM88031     4   0.000      0.777 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88012     2   0.371      0.818 0.000 0.620 0.000 0.000 0.380 0.000
#> GSM88020     4   0.550      0.441 0.104 0.380 0.000 0.508 0.000 0.008
#> GSM88032     4   0.000      0.777 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88037     4   0.000      0.777 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88013     4   0.150      0.748 0.000 0.076 0.000 0.924 0.000 0.000
#> GSM88021     4   0.395      0.644 0.028 0.276 0.000 0.696 0.000 0.000
#> GSM88025     4   0.000      0.777 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88033     4   0.000      0.777 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88014     4   0.000      0.777 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88022     4   0.343      0.635 0.000 0.304 0.000 0.696 0.000 0.000
#> GSM88034     4   0.527      0.449 0.104 0.380 0.000 0.516 0.000 0.000
#> GSM88002     5   0.000      0.964 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88003     5   0.114      0.893 0.000 0.052 0.000 0.000 0.948 0.000
#> GSM88023     5   0.000      0.964 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88026     5   0.000      0.964 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88028     5   0.000      0.964 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88035     5   0.000      0.964 0.000 0.000 0.000 0.000 1.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 cell.line(p) agent(p)  time(p) k
#> CV:pam 76     2.12e-17 4.96e-14 3.81e-01 2
#> CV:pam 73     1.41e-16 3.91e-13 1.52e-01 3
#> CV:pam 65     5.02e-14 2.68e-13 1.70e-03 4
#> CV:pam 64     8.21e-14 4.38e-13 2.08e-04 5
#> CV:pam 67     4.31e-13 2.29e-22 9.41e-06 6

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


CV: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 18792 rows and 77 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           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.732           0.846       0.867         0.2399 0.861   0.719
#> 4 4 0.663           0.669       0.819         0.1104 0.840   0.597
#> 5 5 0.687           0.727       0.831         0.0986 0.912   0.707
#> 6 6 0.677           0.603       0.771         0.0551 0.942   0.760

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette p1 p2
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.1860      0.870 0.948 0.000 0.052
#> GSM87963     1  0.1860      0.870 0.948 0.000 0.052
#> GSM87983     1  0.2165      0.881 0.936 0.000 0.064
#> GSM87984     1  0.1860      0.870 0.948 0.000 0.052
#> GSM87961     3  0.6154      0.804 0.408 0.000 0.592
#> GSM87970     3  0.5178      0.813 0.256 0.000 0.744
#> GSM87971     3  0.6644      0.682 0.160 0.092 0.748
#> GSM87990     3  0.5363      0.814 0.276 0.000 0.724
#> GSM87991     1  0.1643      0.875 0.956 0.000 0.044
#> GSM87974     3  0.6192      0.800 0.420 0.000 0.580
#> GSM87994     1  0.0000      0.891 1.000 0.000 0.000
#> GSM87978     3  0.5178      0.813 0.256 0.000 0.744
#> GSM87979     3  0.5216      0.814 0.260 0.000 0.740
#> GSM87998     1  0.1411      0.871 0.964 0.000 0.036
#> GSM87999     1  0.0000      0.891 1.000 0.000 0.000
#> GSM87968     3  0.5178      0.813 0.256 0.000 0.744
#> GSM87987     1  0.2625      0.878 0.916 0.000 0.084
#> GSM87969     1  0.2711      0.824 0.912 0.000 0.088
#> GSM87988     1  0.1411      0.871 0.964 0.000 0.036
#> GSM87989     1  0.0000      0.891 1.000 0.000 0.000
#> GSM87972     3  0.6267      0.773 0.452 0.000 0.548
#> GSM87992     1  0.0000      0.891 1.000 0.000 0.000
#> GSM87973     3  0.6274      0.765 0.456 0.000 0.544
#> GSM87993     1  0.1860      0.870 0.948 0.000 0.052
#> GSM87975     3  0.6244      0.786 0.440 0.000 0.560
#> GSM87995     1  0.0000      0.891 1.000 0.000 0.000
#> GSM87976     3  0.6215      0.795 0.428 0.000 0.572
#> GSM87977     1  0.5291      0.354 0.732 0.000 0.268
#> GSM87996     1  0.0000      0.891 1.000 0.000 0.000
#> GSM87997     1  0.1411      0.871 0.964 0.000 0.036
#> GSM87980     3  0.6267      0.773 0.452 0.000 0.548
#> GSM88000     1  0.6126     -0.363 0.600 0.000 0.400
#> GSM87981     3  0.6267      0.773 0.452 0.000 0.548
#> GSM87982     3  0.6267      0.773 0.452 0.000 0.548
#> GSM88001     1  0.1411      0.871 0.964 0.000 0.036
#> GSM87967     1  0.1529      0.872 0.960 0.000 0.040
#> GSM87964     3  0.5178      0.813 0.256 0.000 0.744
#> GSM87965     1  0.4842      0.512 0.776 0.000 0.224
#> GSM87966     1  0.0237      0.891 0.996 0.000 0.004
#> GSM87985     3  0.5254      0.813 0.264 0.000 0.736
#> GSM87986     1  0.2356      0.881 0.928 0.000 0.072
#> GSM88004     2  0.4654      0.880 0.000 0.792 0.208
#> GSM88015     2  0.4654      0.880 0.000 0.792 0.208
#> GSM88005     2  0.0892      0.929 0.000 0.980 0.020
#> GSM88006     2  0.1031      0.928 0.000 0.976 0.024
#> GSM88016     2  0.4605      0.882 0.000 0.796 0.204
#> GSM88007     2  0.4605      0.882 0.000 0.796 0.204
#> GSM88017     2  0.0747      0.931 0.000 0.984 0.016
#> GSM88029     2  0.1289      0.929 0.000 0.968 0.032
#> GSM88008     2  0.4605      0.882 0.000 0.796 0.204
#> GSM88009     2  0.4605      0.882 0.000 0.796 0.204
#> GSM88018     2  0.4702      0.881 0.000 0.788 0.212
#> GSM88024     2  0.0592      0.929 0.000 0.988 0.012
#> GSM88030     2  0.0592      0.929 0.000 0.988 0.012
#> GSM88036     2  0.0592      0.929 0.000 0.988 0.012
#> GSM88010     2  0.0592      0.931 0.000 0.988 0.012
#> GSM88011     2  0.0000      0.931 0.000 1.000 0.000
#> GSM88019     2  0.0000      0.931 0.000 1.000 0.000
#> GSM88027     2  0.0000      0.931 0.000 1.000 0.000
#> GSM88031     2  0.0237      0.931 0.000 0.996 0.004
#> GSM88012     2  0.0592      0.931 0.000 0.988 0.012
#> GSM88020     2  0.0592      0.929 0.000 0.988 0.012
#> GSM88032     2  0.0237      0.931 0.000 0.996 0.004
#> GSM88037     2  0.0237      0.931 0.000 0.996 0.004
#> GSM88013     2  0.0237      0.931 0.000 0.996 0.004
#> GSM88021     2  0.0424      0.930 0.000 0.992 0.008
#> GSM88025     2  0.0592      0.929 0.000 0.988 0.012
#> GSM88033     2  0.0424      0.930 0.000 0.992 0.008
#> GSM88014     2  0.0237      0.931 0.000 0.996 0.004
#> GSM88022     2  0.0000      0.931 0.000 1.000 0.000
#> GSM88034     2  0.0592      0.929 0.000 0.988 0.012
#> GSM88002     2  0.4605      0.882 0.000 0.796 0.204
#> GSM88003     2  0.4605      0.882 0.000 0.796 0.204
#> GSM88023     2  0.4605      0.882 0.000 0.796 0.204
#> GSM88026     2  0.4605      0.882 0.000 0.796 0.204
#> GSM88028     2  0.4654      0.880 0.000 0.792 0.208
#> GSM88035     2  0.4605      0.882 0.000 0.796 0.204

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     3  0.2647      0.749 0.120 0.000 0.880 0.000
#> GSM87963     3  0.2814      0.734 0.132 0.000 0.868 0.000
#> GSM87983     3  0.1867      0.774 0.072 0.000 0.928 0.000
#> GSM87984     3  0.2149      0.768 0.088 0.000 0.912 0.000
#> GSM87961     1  0.4103      0.881 0.744 0.000 0.256 0.000
#> GSM87970     1  0.4103      0.881 0.744 0.000 0.256 0.000
#> GSM87971     1  0.3486      0.842 0.812 0.000 0.188 0.000
#> GSM87990     1  0.4977      0.495 0.540 0.000 0.460 0.000
#> GSM87991     3  0.1211      0.781 0.040 0.000 0.960 0.000
#> GSM87974     1  0.3837      0.871 0.776 0.000 0.224 0.000
#> GSM87994     3  0.1211      0.780 0.040 0.000 0.960 0.000
#> GSM87978     1  0.4103      0.881 0.744 0.000 0.256 0.000
#> GSM87979     1  0.4134      0.877 0.740 0.000 0.260 0.000
#> GSM87998     3  0.1211      0.779 0.040 0.000 0.960 0.000
#> GSM87999     3  0.0592      0.774 0.016 0.000 0.984 0.000
#> GSM87968     1  0.4072      0.881 0.748 0.000 0.252 0.000
#> GSM87987     3  0.1867      0.774 0.072 0.000 0.928 0.000
#> GSM87969     3  0.2281      0.764 0.096 0.000 0.904 0.000
#> GSM87988     3  0.0000      0.774 0.000 0.000 1.000 0.000
#> GSM87989     3  0.0469      0.777 0.012 0.000 0.988 0.000
#> GSM87972     3  0.4994     -0.245 0.480 0.000 0.520 0.000
#> GSM87992     3  0.0592      0.778 0.016 0.000 0.984 0.000
#> GSM87973     3  0.4994     -0.228 0.480 0.000 0.520 0.000
#> GSM87993     3  0.0817      0.780 0.024 0.000 0.976 0.000
#> GSM87975     1  0.4500      0.792 0.684 0.000 0.316 0.000
#> GSM87995     3  0.0000      0.774 0.000 0.000 1.000 0.000
#> GSM87976     1  0.3837      0.856 0.776 0.000 0.224 0.000
#> GSM87977     3  0.4967     -0.172 0.452 0.000 0.548 0.000
#> GSM87996     3  0.0000      0.774 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000      0.774 0.000 0.000 1.000 0.000
#> GSM87980     3  0.4992     -0.229 0.476 0.000 0.524 0.000
#> GSM88000     3  0.4304      0.389 0.284 0.000 0.716 0.000
#> GSM87981     3  0.4996     -0.243 0.484 0.000 0.516 0.000
#> GSM87982     3  0.4989     -0.215 0.472 0.000 0.528 0.000
#> GSM88001     3  0.0000      0.774 0.000 0.000 1.000 0.000
#> GSM87967     3  0.3528      0.580 0.192 0.000 0.808 0.000
#> GSM87964     1  0.3444      0.838 0.816 0.000 0.184 0.000
#> GSM87965     3  0.3024      0.723 0.148 0.000 0.852 0.000
#> GSM87966     3  0.1022      0.780 0.032 0.000 0.968 0.000
#> GSM87985     1  0.4925      0.580 0.572 0.000 0.428 0.000
#> GSM87986     3  0.1867      0.774 0.072 0.000 0.928 0.000
#> GSM88004     2  0.0188      0.842 0.000 0.996 0.000 0.004
#> GSM88015     2  0.1792      0.787 0.068 0.932 0.000 0.000
#> GSM88005     2  0.3768      0.757 0.184 0.808 0.000 0.008
#> GSM88006     2  0.3895      0.756 0.184 0.804 0.000 0.012
#> GSM88016     2  0.0188      0.844 0.000 0.996 0.000 0.004
#> GSM88007     2  0.0188      0.842 0.000 0.996 0.000 0.004
#> GSM88017     2  0.3768      0.757 0.184 0.808 0.000 0.008
#> GSM88029     2  0.5948      0.566 0.144 0.696 0.000 0.160
#> GSM88008     2  0.0336      0.843 0.000 0.992 0.000 0.008
#> GSM88009     2  0.0188      0.842 0.000 0.996 0.000 0.004
#> GSM88018     2  0.2124      0.792 0.068 0.924 0.000 0.008
#> GSM88024     2  0.6001      0.572 0.184 0.688 0.000 0.128
#> GSM88030     4  0.4121      0.520 0.184 0.020 0.000 0.796
#> GSM88036     4  0.4121      0.520 0.184 0.020 0.000 0.796
#> GSM88010     2  0.3688      0.715 0.000 0.792 0.000 0.208
#> GSM88011     2  0.3764      0.705 0.000 0.784 0.000 0.216
#> GSM88019     2  0.3726      0.710 0.000 0.788 0.000 0.212
#> GSM88027     2  0.3837      0.693 0.000 0.776 0.000 0.224
#> GSM88031     4  0.4746      0.680 0.000 0.368 0.000 0.632
#> GSM88012     2  0.3688      0.715 0.000 0.792 0.000 0.208
#> GSM88020     4  0.1297      0.597 0.016 0.020 0.000 0.964
#> GSM88032     4  0.4746      0.680 0.000 0.368 0.000 0.632
#> GSM88037     4  0.4746      0.680 0.000 0.368 0.000 0.632
#> GSM88013     4  0.4746      0.680 0.000 0.368 0.000 0.632
#> GSM88021     4  0.4697      0.678 0.000 0.356 0.000 0.644
#> GSM88025     4  0.4746      0.680 0.000 0.368 0.000 0.632
#> GSM88033     4  0.4605      0.683 0.000 0.336 0.000 0.664
#> GSM88014     4  0.4916      0.550 0.000 0.424 0.000 0.576
#> GSM88022     2  0.3837      0.693 0.000 0.776 0.000 0.224
#> GSM88034     4  0.0524      0.591 0.008 0.004 0.000 0.988
#> GSM88002     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88003     2  0.0336      0.843 0.000 0.992 0.000 0.008
#> GSM88023     2  0.0000      0.843 0.000 1.000 0.000 0.000
#> GSM88026     2  0.0336      0.843 0.000 0.992 0.000 0.008
#> GSM88028     2  0.0188      0.842 0.000 0.996 0.000 0.004
#> GSM88035     2  0.0336      0.843 0.000 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM87962     3  0.4248      0.769 0.240 0.000 0.728 0.000 0.032
#> GSM87963     3  0.4302      0.763 0.248 0.000 0.720 0.000 0.032
#> GSM87983     3  0.3694      0.795 0.172 0.000 0.796 0.000 0.032
#> GSM87984     3  0.3944      0.789 0.200 0.000 0.768 0.000 0.032
#> GSM87961     1  0.3343      0.777 0.860 0.000 0.084 0.028 0.028
#> GSM87970     1  0.2696      0.794 0.900 0.000 0.040 0.028 0.032
#> GSM87971     1  0.1544      0.750 0.932 0.000 0.000 0.000 0.068
#> GSM87990     1  0.4134      0.638 0.760 0.000 0.196 0.000 0.044
#> GSM87991     3  0.2921      0.814 0.124 0.000 0.856 0.000 0.020
#> GSM87974     1  0.2617      0.791 0.904 0.000 0.032 0.028 0.036
#> GSM87994     3  0.2561      0.812 0.144 0.000 0.856 0.000 0.000
#> GSM87978     1  0.2228      0.789 0.912 0.000 0.040 0.000 0.048
#> GSM87979     1  0.1121      0.790 0.956 0.000 0.044 0.000 0.000
#> GSM87998     3  0.2773      0.809 0.164 0.000 0.836 0.000 0.000
#> GSM87999     3  0.2921      0.814 0.124 0.000 0.856 0.000 0.020
#> GSM87968     1  0.2359      0.786 0.904 0.000 0.036 0.000 0.060
#> GSM87987     3  0.4237      0.766 0.200 0.000 0.752 0.000 0.048
#> GSM87969     3  0.4210      0.777 0.224 0.000 0.740 0.000 0.036
#> GSM87988     3  0.0451      0.798 0.004 0.000 0.988 0.000 0.008
#> GSM87989     3  0.1725      0.811 0.044 0.000 0.936 0.000 0.020
#> GSM87972     1  0.5809      0.485 0.548 0.000 0.380 0.028 0.044
#> GSM87992     3  0.0290      0.797 0.000 0.000 0.992 0.000 0.008
#> GSM87973     3  0.4900      0.409 0.300 0.000 0.660 0.028 0.012
#> GSM87993     3  0.0579      0.796 0.000 0.000 0.984 0.008 0.008
#> GSM87975     1  0.4932      0.694 0.708 0.000 0.232 0.028 0.032
#> GSM87995     3  0.0290      0.797 0.000 0.000 0.992 0.000 0.008
#> GSM87976     1  0.4399      0.726 0.792 0.000 0.120 0.028 0.060
#> GSM87977     3  0.5195      0.325 0.388 0.000 0.564 0.000 0.048
#> GSM87996     3  0.0290      0.797 0.000 0.000 0.992 0.000 0.008
#> GSM87997     3  0.1251      0.806 0.036 0.000 0.956 0.000 0.008
#> GSM87980     1  0.5482      0.348 0.512 0.000 0.440 0.028 0.020
#> GSM88000     3  0.1399      0.787 0.000 0.000 0.952 0.028 0.020
#> GSM87981     1  0.5857      0.514 0.568 0.000 0.352 0.028 0.052
#> GSM87982     3  0.5141      0.218 0.360 0.000 0.600 0.028 0.012
#> GSM88001     3  0.0290      0.797 0.000 0.000 0.992 0.000 0.008
#> GSM87967     3  0.3274      0.628 0.220 0.000 0.780 0.000 0.000
#> GSM87964     1  0.2379      0.771 0.912 0.000 0.012 0.028 0.048
#> GSM87965     3  0.4378      0.761 0.248 0.000 0.716 0.000 0.036
#> GSM87966     3  0.2561      0.812 0.144 0.000 0.856 0.000 0.000
#> GSM87985     1  0.3919      0.645 0.776 0.000 0.188 0.000 0.036
#> GSM87986     3  0.3805      0.794 0.184 0.000 0.784 0.000 0.032
#> GSM88004     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM88015     2  0.1205      0.865 0.040 0.956 0.000 0.004 0.000
#> GSM88005     2  0.5396      0.189 0.000 0.560 0.000 0.376 0.064
#> GSM88006     2  0.1478      0.856 0.000 0.936 0.000 0.000 0.064
#> GSM88016     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM88007     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM88017     2  0.1478      0.856 0.000 0.936 0.000 0.000 0.064
#> GSM88029     2  0.4754      0.606 0.000 0.684 0.000 0.264 0.052
#> GSM88008     2  0.2329      0.791 0.000 0.876 0.000 0.124 0.000
#> GSM88009     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM88018     2  0.1205      0.865 0.040 0.956 0.000 0.004 0.000
#> GSM88024     2  0.6368      0.246 0.000 0.488 0.000 0.332 0.180
#> GSM88030     5  0.2969      0.879 0.000 0.020 0.000 0.128 0.852
#> GSM88036     5  0.2969      0.879 0.000 0.020 0.000 0.128 0.852
#> GSM88010     2  0.3074      0.698 0.000 0.804 0.000 0.196 0.000
#> GSM88011     4  0.3452      0.653 0.000 0.244 0.000 0.756 0.000
#> GSM88019     4  0.3913      0.563 0.000 0.324 0.000 0.676 0.000
#> GSM88027     4  0.2732      0.698 0.000 0.160 0.000 0.840 0.000
#> GSM88031     4  0.2228      0.726 0.000 0.040 0.000 0.912 0.048
#> GSM88012     2  0.3143      0.687 0.000 0.796 0.000 0.204 0.000
#> GSM88020     5  0.3242      0.865 0.000 0.000 0.000 0.216 0.784
#> GSM88032     4  0.2984      0.703 0.000 0.032 0.000 0.860 0.108
#> GSM88037     4  0.2984      0.703 0.000 0.032 0.000 0.860 0.108
#> GSM88013     4  0.1043      0.727 0.000 0.040 0.000 0.960 0.000
#> GSM88021     4  0.4465      0.616 0.000 0.060 0.000 0.736 0.204
#> GSM88025     4  0.3805      0.636 0.000 0.032 0.000 0.784 0.184
#> GSM88033     4  0.4442      0.476 0.000 0.028 0.000 0.688 0.284
#> GSM88014     4  0.1478      0.730 0.000 0.064 0.000 0.936 0.000
#> GSM88022     4  0.3774      0.607 0.000 0.296 0.000 0.704 0.000
#> GSM88034     5  0.3636      0.794 0.000 0.000 0.000 0.272 0.728
#> GSM88002     2  0.1197      0.865 0.000 0.952 0.000 0.048 0.000
#> GSM88003     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM88023     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM88026     2  0.1043      0.868 0.000 0.960 0.000 0.040 0.000
#> GSM88028     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM88035     2  0.0000      0.878 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
#> GSM87962     1  0.4138    0.60504 0.720 0.000 0.228 0.000 0.048 0.004
#> GSM87963     1  0.4023    0.61021 0.720 0.000 0.240 0.000 0.036 0.004
#> GSM87983     1  0.3878    0.62404 0.736 0.000 0.228 0.000 0.032 0.004
#> GSM87984     1  0.4152    0.59705 0.712 0.000 0.240 0.000 0.044 0.004
#> GSM87961     5  0.5845    0.25360 0.192 0.000 0.376 0.000 0.432 0.000
#> GSM87970     5  0.3439    0.72250 0.120 0.000 0.072 0.000 0.808 0.000
#> GSM87971     5  0.1657    0.70745 0.016 0.000 0.056 0.000 0.928 0.000
#> GSM87990     5  0.6006    0.24448 0.256 0.000 0.316 0.000 0.428 0.000
#> GSM87991     1  0.2076    0.67710 0.912 0.000 0.060 0.000 0.012 0.016
#> GSM87974     5  0.2740    0.71629 0.120 0.000 0.028 0.000 0.852 0.000
#> GSM87994     1  0.1141    0.68455 0.948 0.000 0.052 0.000 0.000 0.000
#> GSM87978     5  0.2672    0.72874 0.052 0.000 0.080 0.000 0.868 0.000
#> GSM87979     5  0.3534    0.71118 0.076 0.000 0.124 0.000 0.800 0.000
#> GSM87998     1  0.2973    0.67117 0.836 0.000 0.136 0.000 0.024 0.004
#> GSM87999     1  0.0458    0.67434 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM87968     5  0.2201    0.71873 0.028 0.000 0.076 0.000 0.896 0.000
#> GSM87987     1  0.5064    0.59926 0.604 0.000 0.300 0.000 0.092 0.004
#> GSM87969     1  0.4539    0.48155 0.644 0.000 0.304 0.000 0.048 0.004
#> GSM87988     1  0.2762    0.62693 0.804 0.000 0.196 0.000 0.000 0.000
#> GSM87989     1  0.1088    0.67390 0.960 0.000 0.024 0.000 0.000 0.016
#> GSM87972     3  0.4122    0.66920 0.048 0.000 0.704 0.000 0.248 0.000
#> GSM87992     1  0.2793    0.62442 0.800 0.000 0.200 0.000 0.000 0.000
#> GSM87973     3  0.4533    0.70483 0.156 0.000 0.704 0.000 0.140 0.000
#> GSM87993     1  0.3368    0.59757 0.756 0.000 0.232 0.000 0.012 0.000
#> GSM87975     3  0.4161    0.38374 0.012 0.000 0.540 0.000 0.448 0.000
#> GSM87995     1  0.2793    0.62442 0.800 0.000 0.200 0.000 0.000 0.000
#> GSM87976     5  0.1267    0.63825 0.000 0.000 0.060 0.000 0.940 0.000
#> GSM87977     3  0.5434    0.50467 0.164 0.000 0.564 0.000 0.272 0.000
#> GSM87996     1  0.2793    0.62442 0.800 0.000 0.200 0.000 0.000 0.000
#> GSM87997     1  0.2883    0.61374 0.788 0.000 0.212 0.000 0.000 0.000
#> GSM87980     3  0.4281    0.69237 0.068 0.000 0.704 0.000 0.228 0.000
#> GSM88000     3  0.4504   -0.01263 0.432 0.000 0.536 0.000 0.032 0.000
#> GSM87981     3  0.4061    0.67226 0.044 0.000 0.708 0.000 0.248 0.000
#> GSM87982     3  0.4602    0.70612 0.160 0.000 0.696 0.000 0.144 0.000
#> GSM88001     1  0.2793    0.62442 0.800 0.000 0.200 0.000 0.000 0.000
#> GSM87967     1  0.5024    0.28068 0.572 0.000 0.340 0.000 0.088 0.000
#> GSM87964     5  0.2662    0.71584 0.120 0.000 0.024 0.000 0.856 0.000
#> GSM87965     1  0.4884    0.05739 0.488 0.000 0.460 0.000 0.048 0.004
#> GSM87966     1  0.2833    0.66376 0.836 0.000 0.148 0.000 0.012 0.004
#> GSM87985     5  0.5911    0.34428 0.228 0.000 0.316 0.000 0.456 0.000
#> GSM87986     1  0.3878    0.62404 0.736 0.000 0.228 0.000 0.032 0.004
#> GSM88004     2  0.0000    0.86799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88015     2  0.3066    0.77036 0.000 0.832 0.124 0.044 0.000 0.000
#> GSM88005     2  0.6276   -0.00537 0.000 0.476 0.040 0.344 0.000 0.140
#> GSM88006     2  0.0000    0.86799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88016     2  0.0363    0.86536 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM88007     2  0.0260    0.86666 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM88017     2  0.1116    0.86451 0.000 0.960 0.008 0.028 0.000 0.004
#> GSM88029     2  0.3849    0.73578 0.000 0.796 0.004 0.080 0.008 0.112
#> GSM88008     2  0.4159    0.56699 0.000 0.704 0.040 0.252 0.000 0.004
#> GSM88009     2  0.0000    0.86799 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88018     2  0.2531    0.79632 0.000 0.856 0.132 0.012 0.000 0.000
#> GSM88024     6  0.6046   -0.21846 0.000 0.372 0.008 0.188 0.000 0.432
#> GSM88030     6  0.3076    0.61450 0.000 0.000 0.000 0.240 0.000 0.760
#> GSM88036     6  0.3101    0.61540 0.000 0.000 0.000 0.244 0.000 0.756
#> GSM88010     2  0.3133    0.64097 0.000 0.780 0.008 0.212 0.000 0.000
#> GSM88011     4  0.5704    0.57615 0.000 0.116 0.040 0.608 0.000 0.236
#> GSM88019     4  0.6027    0.55569 0.000 0.164 0.036 0.564 0.000 0.236
#> GSM88027     4  0.5908    0.57240 0.000 0.156 0.032 0.576 0.000 0.236
#> GSM88031     4  0.0363    0.55991 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM88012     2  0.3384    0.62583 0.000 0.760 0.008 0.228 0.000 0.004
#> GSM88020     6  0.3747    0.54912 0.000 0.000 0.000 0.396 0.000 0.604
#> GSM88032     4  0.0146    0.55975 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM88037     4  0.0146    0.55975 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM88013     4  0.5034    0.57282 0.000 0.132 0.000 0.628 0.000 0.240
#> GSM88021     4  0.1995    0.52308 0.000 0.036 0.000 0.912 0.000 0.052
#> GSM88025     4  0.3815    0.38559 0.000 0.092 0.000 0.776 0.000 0.132
#> GSM88033     4  0.3858    0.22646 0.000 0.044 0.000 0.740 0.000 0.216
#> GSM88014     4  0.5321    0.56587 0.000 0.156 0.004 0.608 0.000 0.232
#> GSM88022     4  0.6061    0.45309 0.000 0.312 0.004 0.448 0.000 0.236
#> GSM88034     6  0.3765    0.53336 0.000 0.000 0.000 0.404 0.000 0.596
#> GSM88002     2  0.1296    0.86121 0.000 0.948 0.004 0.044 0.000 0.004
#> GSM88003     2  0.0972    0.86515 0.000 0.964 0.008 0.028 0.000 0.000
#> GSM88023     2  0.0547    0.86767 0.000 0.980 0.000 0.020 0.000 0.000
#> GSM88026     2  0.1296    0.85495 0.000 0.952 0.032 0.012 0.000 0.004
#> GSM88028     2  0.0713    0.86596 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM88035     2  0.0713    0.86596 0.000 0.972 0.000 0.028 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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 cell.line(p) agent(p) time(p) k
#> CV:mclust 77     1.27e-17 3.00e-14  0.3612 2
#> CV:mclust 75     5.18e-17 1.88e-12  0.5822 3
#> CV:mclust 69     6.99e-15 3.04e-10  0.0286 4
#> CV:mclust 69     3.69e-14 1.01e-09  0.0529 5
#> CV:mclust 64     1.81e-12 2.33e-09  0.0406 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 18792 rows and 77 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.979       0.992         0.5059 0.494   0.494
#> 3 3 0.838           0.866       0.943         0.2516 0.825   0.661
#> 4 4 0.780           0.794       0.889         0.0899 0.878   0.688
#> 5 5 0.699           0.723       0.843         0.0851 0.934   0.790
#> 6 6 0.657           0.481       0.712         0.0569 0.911   0.684

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
#> GSM87962     1  0.0000      0.993 1.000 0.000
#> GSM87963     1  0.0000      0.993 1.000 0.000
#> GSM87983     1  0.0000      0.993 1.000 0.000
#> GSM87984     1  0.0000      0.993 1.000 0.000
#> GSM87961     1  0.0000      0.993 1.000 0.000
#> GSM87970     1  0.0000      0.993 1.000 0.000
#> GSM87971     2  0.9686      0.333 0.396 0.604
#> GSM87990     1  0.0000      0.993 1.000 0.000
#> GSM87991     1  0.0000      0.993 1.000 0.000
#> GSM87974     1  0.3879      0.916 0.924 0.076
#> GSM87994     1  0.0000      0.993 1.000 0.000
#> GSM87978     1  0.0000      0.993 1.000 0.000
#> GSM87979     1  0.0000      0.993 1.000 0.000
#> GSM87998     1  0.0000      0.993 1.000 0.000
#> GSM87999     1  0.0000      0.993 1.000 0.000
#> GSM87968     1  0.0000      0.993 1.000 0.000
#> GSM87987     1  0.0000      0.993 1.000 0.000
#> GSM87969     1  0.0000      0.993 1.000 0.000
#> GSM87988     1  0.0000      0.993 1.000 0.000
#> GSM87989     1  0.0000      0.993 1.000 0.000
#> GSM87972     1  0.0000      0.993 1.000 0.000
#> GSM87992     1  0.0000      0.993 1.000 0.000
#> GSM87973     1  0.0000      0.993 1.000 0.000
#> GSM87993     1  0.0000      0.993 1.000 0.000
#> GSM87975     1  0.0000      0.993 1.000 0.000
#> GSM87995     1  0.0000      0.993 1.000 0.000
#> GSM87976     1  0.0672      0.986 0.992 0.008
#> GSM87977     1  0.0000      0.993 1.000 0.000
#> GSM87996     1  0.0000      0.993 1.000 0.000
#> GSM87997     1  0.0000      0.993 1.000 0.000
#> GSM87980     1  0.0000      0.993 1.000 0.000
#> GSM88000     1  0.0000      0.993 1.000 0.000
#> GSM87981     1  0.0000      0.993 1.000 0.000
#> GSM87982     1  0.0000      0.993 1.000 0.000
#> GSM88001     1  0.0000      0.993 1.000 0.000
#> GSM87967     1  0.0000      0.993 1.000 0.000
#> GSM87964     1  0.6623      0.792 0.828 0.172
#> GSM87965     1  0.0000      0.993 1.000 0.000
#> GSM87966     1  0.0000      0.993 1.000 0.000
#> GSM87985     1  0.0000      0.993 1.000 0.000
#> GSM87986     1  0.0000      0.993 1.000 0.000
#> GSM88004     2  0.0000      0.989 0.000 1.000
#> GSM88015     2  0.0000      0.989 0.000 1.000
#> GSM88005     2  0.0000      0.989 0.000 1.000
#> GSM88006     2  0.0000      0.989 0.000 1.000
#> GSM88016     2  0.0000      0.989 0.000 1.000
#> GSM88007     2  0.0000      0.989 0.000 1.000
#> GSM88017     2  0.0000      0.989 0.000 1.000
#> GSM88029     2  0.0000      0.989 0.000 1.000
#> GSM88008     2  0.0000      0.989 0.000 1.000
#> GSM88009     2  0.0000      0.989 0.000 1.000
#> GSM88018     2  0.0000      0.989 0.000 1.000
#> GSM88024     2  0.0000      0.989 0.000 1.000
#> GSM88030     2  0.0000      0.989 0.000 1.000
#> GSM88036     2  0.0000      0.989 0.000 1.000
#> GSM88010     2  0.0000      0.989 0.000 1.000
#> GSM88011     2  0.0000      0.989 0.000 1.000
#> GSM88019     2  0.0000      0.989 0.000 1.000
#> GSM88027     2  0.0000      0.989 0.000 1.000
#> GSM88031     2  0.0000      0.989 0.000 1.000
#> GSM88012     2  0.0000      0.989 0.000 1.000
#> GSM88020     2  0.0000      0.989 0.000 1.000
#> GSM88032     2  0.0000      0.989 0.000 1.000
#> GSM88037     2  0.0000      0.989 0.000 1.000
#> GSM88013     2  0.0000      0.989 0.000 1.000
#> GSM88021     2  0.0000      0.989 0.000 1.000
#> GSM88025     2  0.0000      0.989 0.000 1.000
#> GSM88033     2  0.0000      0.989 0.000 1.000
#> GSM88014     2  0.0000      0.989 0.000 1.000
#> GSM88022     2  0.0000      0.989 0.000 1.000
#> GSM88034     2  0.0000      0.989 0.000 1.000
#> GSM88002     2  0.0000      0.989 0.000 1.000
#> GSM88003     2  0.0000      0.989 0.000 1.000
#> GSM88023     2  0.0000      0.989 0.000 1.000
#> GSM88026     2  0.0000      0.989 0.000 1.000
#> GSM88028     2  0.0000      0.989 0.000 1.000
#> GSM88035     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
#> GSM87962     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87963     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87983     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87984     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87961     1  0.0237     0.9659 0.996 0.004 0.000
#> GSM87970     1  0.3192     0.8586 0.888 0.112 0.000
#> GSM87971     2  0.4605     0.6920 0.204 0.796 0.000
#> GSM87990     1  0.0237     0.9659 0.996 0.004 0.000
#> GSM87991     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87974     2  0.5678     0.5493 0.316 0.684 0.000
#> GSM87994     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87978     1  0.5397     0.5922 0.720 0.280 0.000
#> GSM87979     1  0.3686     0.8232 0.860 0.140 0.000
#> GSM87998     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87999     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87968     2  0.6225     0.2610 0.432 0.568 0.000
#> GSM87987     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87969     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87988     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87989     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87972     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87992     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87973     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87993     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87975     1  0.0424     0.9630 0.992 0.008 0.000
#> GSM87995     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87976     1  0.6308    -0.0441 0.508 0.492 0.000
#> GSM87977     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87996     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87997     1  0.0237     0.9656 0.996 0.000 0.004
#> GSM87980     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM88000     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87981     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87982     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM88001     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87967     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87964     2  0.5431     0.6039 0.284 0.716 0.000
#> GSM87965     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87966     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM87985     1  0.0237     0.9659 0.996 0.004 0.000
#> GSM87986     1  0.0000     0.9686 1.000 0.000 0.000
#> GSM88004     2  0.0000     0.8857 0.000 1.000 0.000
#> GSM88015     2  0.0000     0.8857 0.000 1.000 0.000
#> GSM88005     2  0.2796     0.8265 0.000 0.908 0.092
#> GSM88006     2  0.0892     0.8833 0.000 0.980 0.020
#> GSM88016     2  0.0000     0.8857 0.000 1.000 0.000
#> GSM88007     2  0.0000     0.8857 0.000 1.000 0.000
#> GSM88017     2  0.1964     0.8592 0.000 0.944 0.056
#> GSM88029     2  0.2711     0.8277 0.000 0.912 0.088
#> GSM88008     2  0.0000     0.8857 0.000 1.000 0.000
#> GSM88009     2  0.0000     0.8857 0.000 1.000 0.000
#> GSM88018     2  0.0000     0.8857 0.000 1.000 0.000
#> GSM88024     3  0.5178     0.6959 0.000 0.256 0.744
#> GSM88030     3  0.0000     0.9031 0.000 0.000 1.000
#> GSM88036     3  0.0424     0.9022 0.000 0.008 0.992
#> GSM88010     2  0.0592     0.8852 0.000 0.988 0.012
#> GSM88011     3  0.6026     0.5042 0.000 0.376 0.624
#> GSM88019     3  0.5678     0.5754 0.000 0.316 0.684
#> GSM88027     3  0.5882     0.5546 0.000 0.348 0.652
#> GSM88031     3  0.0000     0.9031 0.000 0.000 1.000
#> GSM88012     2  0.5016     0.6498 0.000 0.760 0.240
#> GSM88020     3  0.0000     0.9031 0.000 0.000 1.000
#> GSM88032     3  0.0000     0.9031 0.000 0.000 1.000
#> GSM88037     3  0.0000     0.9031 0.000 0.000 1.000
#> GSM88013     3  0.0747     0.8996 0.000 0.016 0.984
#> GSM88021     3  0.0237     0.9031 0.000 0.004 0.996
#> GSM88025     3  0.0237     0.9031 0.000 0.004 0.996
#> GSM88033     3  0.0000     0.9031 0.000 0.000 1.000
#> GSM88014     3  0.0892     0.8980 0.000 0.020 0.980
#> GSM88022     3  0.3482     0.8231 0.000 0.128 0.872
#> GSM88034     3  0.0000     0.9031 0.000 0.000 1.000
#> GSM88002     2  0.1411     0.8744 0.000 0.964 0.036
#> GSM88003     2  0.0747     0.8846 0.000 0.984 0.016
#> GSM88023     2  0.0000     0.8857 0.000 1.000 0.000
#> GSM88026     2  0.0747     0.8846 0.000 0.984 0.016
#> GSM88028     2  0.0892     0.8833 0.000 0.980 0.020
#> GSM88035     2  0.1163     0.8794 0.000 0.972 0.028

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87963     3  0.0336     0.9388 0.008 0.000 0.992 0.000
#> GSM87983     3  0.0188     0.9413 0.004 0.000 0.996 0.000
#> GSM87984     3  0.0592     0.9368 0.016 0.000 0.984 0.000
#> GSM87961     3  0.3636     0.7257 0.172 0.008 0.820 0.000
#> GSM87970     1  0.5138     0.6096 0.600 0.008 0.392 0.000
#> GSM87971     1  0.7023     0.6322 0.576 0.232 0.192 0.000
#> GSM87990     3  0.2973     0.7911 0.144 0.000 0.856 0.000
#> GSM87991     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87974     1  0.5785     0.7404 0.664 0.064 0.272 0.000
#> GSM87994     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87978     1  0.5917     0.4927 0.520 0.036 0.444 0.000
#> GSM87979     3  0.2142     0.8768 0.016 0.056 0.928 0.000
#> GSM87998     3  0.0188     0.9414 0.004 0.000 0.996 0.000
#> GSM87999     3  0.0188     0.9412 0.000 0.000 0.996 0.004
#> GSM87968     3  0.7228    -0.3403 0.340 0.156 0.504 0.000
#> GSM87987     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87969     3  0.0469     0.9371 0.012 0.000 0.988 0.000
#> GSM87988     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87989     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87972     3  0.3024     0.7918 0.148 0.000 0.852 0.000
#> GSM87992     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0336     0.9402 0.008 0.000 0.992 0.000
#> GSM87993     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87975     1  0.4040     0.7247 0.752 0.000 0.248 0.000
#> GSM87995     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87976     1  0.4720     0.7055 0.672 0.004 0.324 0.000
#> GSM87977     3  0.0336     0.9402 0.008 0.000 0.992 0.000
#> GSM87996     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87980     3  0.3649     0.6825 0.204 0.000 0.796 0.000
#> GSM88000     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87981     3  0.2011     0.8730 0.080 0.000 0.920 0.000
#> GSM87982     3  0.1118     0.9187 0.036 0.000 0.964 0.000
#> GSM88001     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0376     0.9400 0.004 0.000 0.992 0.004
#> GSM87964     1  0.4882     0.7402 0.708 0.020 0.272 0.000
#> GSM87965     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87966     3  0.0000     0.9429 0.000 0.000 1.000 0.000
#> GSM87985     3  0.0707     0.9355 0.020 0.000 0.980 0.000
#> GSM87986     3  0.0336     0.9388 0.008 0.000 0.992 0.000
#> GSM88004     2  0.0000     0.9130 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0592     0.9088 0.016 0.984 0.000 0.000
#> GSM88005     2  0.1042     0.9104 0.008 0.972 0.000 0.020
#> GSM88006     2  0.0779     0.9132 0.004 0.980 0.000 0.016
#> GSM88016     2  0.0000     0.9130 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000     0.9130 0.000 1.000 0.000 0.000
#> GSM88017     1  0.4525     0.2842 0.804 0.116 0.000 0.080
#> GSM88029     2  0.1724     0.9026 0.032 0.948 0.000 0.020
#> GSM88008     2  0.0336     0.9146 0.000 0.992 0.000 0.008
#> GSM88009     2  0.0000     0.9130 0.000 1.000 0.000 0.000
#> GSM88018     1  0.4981     0.0415 0.536 0.464 0.000 0.000
#> GSM88024     4  0.6824     0.6041 0.324 0.120 0.000 0.556
#> GSM88030     4  0.4917     0.6679 0.336 0.008 0.000 0.656
#> GSM88036     4  0.4955     0.6622 0.344 0.008 0.000 0.648
#> GSM88010     2  0.2973     0.8396 0.020 0.884 0.000 0.096
#> GSM88011     2  0.4483     0.6097 0.004 0.712 0.000 0.284
#> GSM88019     4  0.4907     0.1783 0.000 0.420 0.000 0.580
#> GSM88027     2  0.4304     0.6166 0.000 0.716 0.000 0.284
#> GSM88031     4  0.0188     0.8253 0.004 0.000 0.000 0.996
#> GSM88012     2  0.7662     0.1471 0.344 0.436 0.000 0.220
#> GSM88020     4  0.4134     0.7227 0.260 0.000 0.000 0.740
#> GSM88032     4  0.0188     0.8253 0.004 0.000 0.000 0.996
#> GSM88037     4  0.0188     0.8253 0.004 0.000 0.000 0.996
#> GSM88013     4  0.0592     0.8231 0.000 0.016 0.000 0.984
#> GSM88021     4  0.1610     0.8214 0.032 0.016 0.000 0.952
#> GSM88025     4  0.0000     0.8255 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000     0.8255 0.000 0.000 0.000 1.000
#> GSM88014     4  0.1661     0.8052 0.004 0.052 0.000 0.944
#> GSM88022     4  0.4804     0.2875 0.000 0.384 0.000 0.616
#> GSM88034     4  0.1792     0.8117 0.068 0.000 0.000 0.932
#> GSM88002     2  0.0895     0.9116 0.004 0.976 0.000 0.020
#> GSM88003     2  0.0895     0.9095 0.020 0.976 0.000 0.004
#> GSM88023     2  0.0592     0.9077 0.016 0.984 0.000 0.000
#> GSM88026     2  0.0469     0.9147 0.000 0.988 0.000 0.012
#> GSM88028     2  0.0469     0.9147 0.000 0.988 0.000 0.012
#> GSM88035     2  0.0779     0.9133 0.004 0.980 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM87962     3  0.3522     0.7385 0.212 0.000 0.780 0.004 0.004
#> GSM87963     3  0.3675     0.7400 0.216 0.000 0.772 0.004 0.008
#> GSM87983     3  0.3074     0.7507 0.196 0.000 0.804 0.000 0.000
#> GSM87984     3  0.3109     0.7513 0.200 0.000 0.800 0.000 0.000
#> GSM87961     1  0.4401     0.1614 0.656 0.000 0.328 0.000 0.016
#> GSM87970     1  0.5708     0.6722 0.588 0.000 0.300 0.000 0.112
#> GSM87971     1  0.4597     0.6848 0.756 0.028 0.180 0.000 0.036
#> GSM87990     3  0.5204     0.4988 0.392 0.000 0.560 0.000 0.048
#> GSM87991     3  0.4042     0.6750 0.032 0.000 0.756 0.000 0.212
#> GSM87974     1  0.4747     0.7094 0.720 0.000 0.196 0.000 0.084
#> GSM87994     3  0.0703     0.8276 0.024 0.000 0.976 0.000 0.000
#> GSM87978     1  0.3814     0.6905 0.720 0.000 0.276 0.000 0.004
#> GSM87979     3  0.5665    -0.0717 0.424 0.008 0.516 0.004 0.048
#> GSM87998     3  0.1430     0.8229 0.052 0.000 0.944 0.004 0.000
#> GSM87999     3  0.0566     0.8288 0.012 0.000 0.984 0.000 0.004
#> GSM87968     1  0.5422     0.6725 0.648 0.016 0.284 0.004 0.048
#> GSM87987     3  0.1764     0.8176 0.064 0.000 0.928 0.000 0.008
#> GSM87969     3  0.1638     0.8128 0.064 0.000 0.932 0.000 0.004
#> GSM87988     3  0.0404     0.8285 0.012 0.000 0.988 0.000 0.000
#> GSM87989     3  0.0404     0.8293 0.000 0.000 0.988 0.000 0.012
#> GSM87972     3  0.4010     0.6642 0.136 0.000 0.792 0.000 0.072
#> GSM87992     3  0.0162     0.8284 0.004 0.000 0.996 0.000 0.000
#> GSM87973     3  0.3430     0.7075 0.152 0.000 0.824 0.012 0.012
#> GSM87993     3  0.0290     0.8276 0.008 0.000 0.992 0.000 0.000
#> GSM87975     1  0.5759     0.6895 0.616 0.000 0.224 0.000 0.160
#> GSM87995     3  0.0162     0.8277 0.004 0.000 0.996 0.000 0.000
#> GSM87976     1  0.5510     0.6903 0.648 0.000 0.208 0.000 0.144
#> GSM87977     3  0.2463     0.7830 0.100 0.000 0.888 0.004 0.008
#> GSM87996     3  0.0000     0.8285 0.000 0.000 1.000 0.000 0.000
#> GSM87997     3  0.0162     0.8277 0.004 0.000 0.996 0.000 0.000
#> GSM87980     3  0.4887     0.5295 0.148 0.000 0.720 0.000 0.132
#> GSM88000     3  0.0162     0.8284 0.004 0.000 0.996 0.000 0.000
#> GSM87981     3  0.4003     0.4711 0.288 0.000 0.704 0.000 0.008
#> GSM87982     3  0.0771     0.8243 0.020 0.000 0.976 0.000 0.004
#> GSM88001     3  0.0000     0.8285 0.000 0.000 1.000 0.000 0.000
#> GSM87967     3  0.0960     0.8251 0.016 0.000 0.972 0.008 0.004
#> GSM87964     1  0.5820     0.6688 0.612 0.000 0.192 0.000 0.196
#> GSM87965     3  0.3074     0.7590 0.196 0.000 0.804 0.000 0.000
#> GSM87966     3  0.3123     0.7547 0.184 0.000 0.812 0.000 0.004
#> GSM87985     3  0.4760     0.5098 0.416 0.000 0.564 0.000 0.020
#> GSM87986     3  0.3109     0.7514 0.200 0.000 0.800 0.000 0.000
#> GSM88004     2  0.0162     0.9163 0.000 0.996 0.000 0.000 0.004
#> GSM88015     2  0.2773     0.8053 0.112 0.868 0.000 0.000 0.020
#> GSM88005     2  0.0968     0.9086 0.012 0.972 0.004 0.000 0.012
#> GSM88006     2  0.1012     0.9091 0.012 0.968 0.000 0.000 0.020
#> GSM88016     2  0.0000     0.9161 0.000 1.000 0.000 0.000 0.000
#> GSM88007     2  0.0162     0.9163 0.000 0.996 0.000 0.000 0.004
#> GSM88017     5  0.5898     0.5506 0.148 0.192 0.000 0.016 0.644
#> GSM88029     2  0.1281     0.8940 0.032 0.956 0.000 0.012 0.000
#> GSM88008     2  0.0451     0.9145 0.008 0.988 0.000 0.000 0.004
#> GSM88009     2  0.0162     0.9163 0.000 0.996 0.000 0.000 0.004
#> GSM88018     1  0.4924     0.3341 0.668 0.272 0.000 0.000 0.060
#> GSM88024     5  0.4114     0.6162 0.000 0.244 0.000 0.024 0.732
#> GSM88030     5  0.3003     0.7059 0.000 0.000 0.000 0.188 0.812
#> GSM88036     5  0.3013     0.7137 0.008 0.000 0.000 0.160 0.832
#> GSM88010     2  0.6025     0.4274 0.180 0.612 0.000 0.200 0.008
#> GSM88011     4  0.5383     0.2313 0.004 0.408 0.000 0.540 0.048
#> GSM88019     4  0.4063     0.7232 0.032 0.108 0.000 0.816 0.044
#> GSM88027     2  0.4455     0.2634 0.000 0.588 0.000 0.404 0.008
#> GSM88031     4  0.0162     0.8574 0.000 0.000 0.000 0.996 0.004
#> GSM88012     1  0.7127     0.0208 0.468 0.224 0.000 0.280 0.028
#> GSM88020     5  0.4150     0.4414 0.000 0.000 0.000 0.388 0.612
#> GSM88032     4  0.0162     0.8576 0.000 0.000 0.000 0.996 0.004
#> GSM88037     4  0.0000     0.8579 0.000 0.000 0.000 1.000 0.000
#> GSM88013     4  0.0290     0.8572 0.000 0.000 0.000 0.992 0.008
#> GSM88021     4  0.3327     0.7774 0.060 0.004 0.000 0.852 0.084
#> GSM88025     4  0.0290     0.8572 0.000 0.000 0.000 0.992 0.008
#> GSM88033     4  0.0290     0.8572 0.000 0.000 0.000 0.992 0.008
#> GSM88014     4  0.0290     0.8567 0.000 0.008 0.000 0.992 0.000
#> GSM88022     4  0.2494     0.8139 0.016 0.044 0.000 0.908 0.032
#> GSM88034     4  0.3274     0.5876 0.000 0.000 0.000 0.780 0.220
#> GSM88002     2  0.0566     0.9152 0.004 0.984 0.000 0.000 0.012
#> GSM88003     2  0.0807     0.9141 0.012 0.976 0.000 0.000 0.012
#> GSM88023     2  0.0510     0.9132 0.016 0.984 0.000 0.000 0.000
#> GSM88026     2  0.0324     0.9163 0.004 0.992 0.000 0.000 0.004
#> GSM88028     2  0.0693     0.9151 0.008 0.980 0.000 0.000 0.012
#> GSM88035     2  0.0566     0.9152 0.004 0.984 0.000 0.000 0.012

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.2884     0.3508 0.864 0.000 0.064 0.000 0.008 0.064
#> GSM87963     1  0.2703     0.3607 0.876 0.000 0.052 0.000 0.008 0.064
#> GSM87983     1  0.1410     0.4087 0.944 0.000 0.044 0.000 0.004 0.008
#> GSM87984     1  0.2062     0.3828 0.900 0.000 0.088 0.000 0.004 0.008
#> GSM87961     1  0.4885    -0.4845 0.484 0.000 0.048 0.000 0.464 0.004
#> GSM87970     5  0.6136     0.5368 0.224 0.000 0.324 0.000 0.444 0.008
#> GSM87971     5  0.4379     0.6418 0.124 0.004 0.140 0.000 0.732 0.000
#> GSM87990     1  0.5198     0.0851 0.644 0.000 0.248 0.000 0.080 0.028
#> GSM87991     1  0.4543     0.2609 0.704 0.000 0.032 0.000 0.036 0.228
#> GSM87974     5  0.5058     0.6015 0.108 0.000 0.292 0.000 0.600 0.000
#> GSM87994     1  0.2980     0.3869 0.800 0.000 0.192 0.000 0.008 0.000
#> GSM87978     5  0.5475     0.6213 0.184 0.000 0.224 0.000 0.588 0.004
#> GSM87979     5  0.5904     0.3073 0.396 0.004 0.152 0.000 0.444 0.004
#> GSM87998     1  0.3665     0.3539 0.728 0.000 0.252 0.000 0.020 0.000
#> GSM87999     1  0.4720     0.3349 0.684 0.000 0.228 0.000 0.012 0.076
#> GSM87968     5  0.4915     0.6115 0.156 0.008 0.140 0.004 0.692 0.000
#> GSM87987     1  0.3376     0.3722 0.792 0.000 0.180 0.000 0.024 0.004
#> GSM87969     3  0.4488     0.0457 0.468 0.000 0.508 0.000 0.016 0.008
#> GSM87988     1  0.3810     0.2794 0.572 0.000 0.428 0.000 0.000 0.000
#> GSM87989     1  0.4280     0.2655 0.556 0.000 0.428 0.000 0.008 0.008
#> GSM87972     3  0.5166     0.1041 0.420 0.000 0.516 0.000 0.036 0.028
#> GSM87992     1  0.3833     0.2710 0.556 0.000 0.444 0.000 0.000 0.000
#> GSM87973     3  0.5978    -0.0440 0.420 0.000 0.448 0.004 0.104 0.024
#> GSM87993     1  0.3828     0.2754 0.560 0.000 0.440 0.000 0.000 0.000
#> GSM87975     3  0.4734    -0.1035 0.016 0.000 0.604 0.000 0.348 0.032
#> GSM87995     1  0.3833     0.2703 0.556 0.000 0.444 0.000 0.000 0.000
#> GSM87976     3  0.4846    -0.3286 0.016 0.000 0.520 0.000 0.436 0.028
#> GSM87977     1  0.4482     0.2006 0.528 0.000 0.448 0.012 0.012 0.000
#> GSM87996     1  0.3833     0.2724 0.556 0.000 0.444 0.000 0.000 0.000
#> GSM87997     1  0.3955     0.2754 0.560 0.000 0.436 0.000 0.004 0.000
#> GSM87980     3  0.4537     0.3940 0.236 0.000 0.696 0.000 0.052 0.016
#> GSM88000     1  0.3843     0.2591 0.548 0.000 0.452 0.000 0.000 0.000
#> GSM87981     3  0.5563     0.3807 0.272 0.000 0.544 0.000 0.184 0.000
#> GSM87982     1  0.3991     0.1914 0.524 0.000 0.472 0.000 0.004 0.000
#> GSM88001     1  0.3838     0.2669 0.552 0.000 0.448 0.000 0.000 0.000
#> GSM87967     1  0.4493     0.2426 0.540 0.000 0.436 0.004 0.016 0.004
#> GSM87964     5  0.6256     0.5223 0.120 0.000 0.408 0.000 0.428 0.044
#> GSM87965     1  0.0993     0.4168 0.964 0.000 0.024 0.000 0.012 0.000
#> GSM87966     1  0.0806     0.4169 0.972 0.000 0.020 0.000 0.000 0.008
#> GSM87985     1  0.3934     0.1189 0.708 0.000 0.032 0.000 0.260 0.000
#> GSM87986     1  0.0405     0.4200 0.988 0.000 0.008 0.000 0.004 0.000
#> GSM88004     2  0.1036     0.8413 0.004 0.964 0.008 0.000 0.024 0.000
#> GSM88015     2  0.5258     0.5538 0.036 0.648 0.028 0.000 0.264 0.024
#> GSM88005     2  0.2587     0.8092 0.016 0.892 0.036 0.004 0.052 0.000
#> GSM88006     2  0.1672     0.8285 0.004 0.932 0.016 0.000 0.048 0.000
#> GSM88016     2  0.2213     0.8177 0.000 0.908 0.012 0.000 0.032 0.048
#> GSM88007     2  0.1881     0.8279 0.004 0.924 0.016 0.000 0.052 0.004
#> GSM88017     6  0.5885     0.5963 0.000 0.192 0.064 0.000 0.128 0.616
#> GSM88029     2  0.4956     0.7560 0.000 0.744 0.076 0.024 0.044 0.112
#> GSM88008     2  0.1465     0.8341 0.000 0.948 0.020 0.004 0.024 0.004
#> GSM88009     2  0.0692     0.8403 0.000 0.976 0.000 0.000 0.020 0.004
#> GSM88018     5  0.3882     0.3976 0.004 0.160 0.004 0.000 0.776 0.056
#> GSM88024     6  0.4300     0.6948 0.000 0.184 0.036 0.004 0.028 0.748
#> GSM88030     6  0.1745     0.7615 0.000 0.000 0.012 0.068 0.000 0.920
#> GSM88036     6  0.1524     0.7609 0.000 0.000 0.008 0.060 0.000 0.932
#> GSM88010     2  0.5755     0.3262 0.000 0.520 0.004 0.180 0.296 0.000
#> GSM88011     4  0.4990     0.5950 0.000 0.192 0.024 0.708 0.024 0.052
#> GSM88019     4  0.2280     0.7997 0.000 0.036 0.016 0.912 0.008 0.028
#> GSM88027     4  0.5148     0.1940 0.000 0.432 0.020 0.512 0.008 0.028
#> GSM88031     4  0.0000     0.8396 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88012     5  0.5715     0.1426 0.000 0.176 0.008 0.264 0.552 0.000
#> GSM88020     6  0.4616     0.5039 0.000 0.000 0.072 0.280 0.000 0.648
#> GSM88032     4  0.0806     0.8316 0.000 0.000 0.008 0.972 0.000 0.020
#> GSM88037     4  0.0000     0.8396 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88013     4  0.0146     0.8390 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM88021     4  0.4766     0.5879 0.000 0.004 0.012 0.712 0.164 0.108
#> GSM88025     4  0.0291     0.8384 0.000 0.000 0.004 0.992 0.000 0.004
#> GSM88033     4  0.0603     0.8349 0.000 0.000 0.004 0.980 0.000 0.016
#> GSM88014     4  0.0000     0.8396 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88022     4  0.0692     0.8322 0.000 0.020 0.000 0.976 0.004 0.000
#> GSM88034     4  0.4535     0.3495 0.000 0.004 0.032 0.628 0.004 0.332
#> GSM88002     2  0.2811     0.8349 0.000 0.872 0.076 0.000 0.032 0.020
#> GSM88003     2  0.3119     0.8300 0.000 0.856 0.076 0.000 0.032 0.036
#> GSM88023     2  0.3113     0.8331 0.000 0.856 0.076 0.000 0.040 0.028
#> GSM88026     2  0.2883     0.8341 0.000 0.868 0.076 0.000 0.036 0.020
#> GSM88028     2  0.3046     0.8305 0.000 0.860 0.076 0.000 0.032 0.032
#> GSM88035     2  0.3119     0.8294 0.000 0.856 0.076 0.000 0.036 0.032

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 cell.line(p) agent(p)  time(p) k
#> CV:NMF 76     2.11e-17 4.87e-14 4.30e-01 2
#> CV:NMF 75     9.29e-15 9.66e-13 3.52e-02 3
#> CV:NMF 70     4.27e-15 3.04e-11 4.69e-02 4
#> CV:NMF 67     9.75e-14 4.98e-10 3.96e-03 5
#> CV:NMF 37     4.60e-08 6.93e-07 6.23e-05 6

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


MAD: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 18792 rows and 77 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 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.921           0.903       0.950         0.1819 0.923   0.846
#> 4 4 0.721           0.844       0.894         0.2165 0.857   0.659
#> 5 5 0.814           0.848       0.893         0.0649 0.955   0.837
#> 6 6 0.842           0.854       0.882         0.0368 0.959   0.822

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>          class entropy silhouette p1 p2
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      1.000  1 0.000 0.000
#> GSM87963     1  0.0000      1.000  1 0.000 0.000
#> GSM87983     1  0.0000      1.000  1 0.000 0.000
#> GSM87984     1  0.0000      1.000  1 0.000 0.000
#> GSM87961     1  0.0000      1.000  1 0.000 0.000
#> GSM87970     1  0.0000      1.000  1 0.000 0.000
#> GSM87971     1  0.0000      1.000  1 0.000 0.000
#> GSM87990     1  0.0000      1.000  1 0.000 0.000
#> GSM87991     1  0.0000      1.000  1 0.000 0.000
#> GSM87974     1  0.0000      1.000  1 0.000 0.000
#> GSM87994     1  0.0000      1.000  1 0.000 0.000
#> GSM87978     1  0.0000      1.000  1 0.000 0.000
#> GSM87979     1  0.0000      1.000  1 0.000 0.000
#> GSM87998     1  0.0000      1.000  1 0.000 0.000
#> GSM87999     1  0.0000      1.000  1 0.000 0.000
#> GSM87968     1  0.0000      1.000  1 0.000 0.000
#> GSM87987     1  0.0000      1.000  1 0.000 0.000
#> GSM87969     1  0.0000      1.000  1 0.000 0.000
#> GSM87988     1  0.0000      1.000  1 0.000 0.000
#> GSM87989     1  0.0000      1.000  1 0.000 0.000
#> GSM87972     1  0.0000      1.000  1 0.000 0.000
#> GSM87992     1  0.0000      1.000  1 0.000 0.000
#> GSM87973     1  0.0000      1.000  1 0.000 0.000
#> GSM87993     1  0.0000      1.000  1 0.000 0.000
#> GSM87975     1  0.0000      1.000  1 0.000 0.000
#> GSM87995     1  0.0000      1.000  1 0.000 0.000
#> GSM87976     1  0.0000      1.000  1 0.000 0.000
#> GSM87977     1  0.0000      1.000  1 0.000 0.000
#> GSM87996     1  0.0000      1.000  1 0.000 0.000
#> GSM87997     1  0.0000      1.000  1 0.000 0.000
#> GSM87980     1  0.0000      1.000  1 0.000 0.000
#> GSM88000     1  0.0000      1.000  1 0.000 0.000
#> GSM87981     1  0.0000      1.000  1 0.000 0.000
#> GSM87982     1  0.0000      1.000  1 0.000 0.000
#> GSM88001     1  0.0000      1.000  1 0.000 0.000
#> GSM87967     1  0.0000      1.000  1 0.000 0.000
#> GSM87964     1  0.0000      1.000  1 0.000 0.000
#> GSM87965     1  0.0000      1.000  1 0.000 0.000
#> GSM87966     1  0.0000      1.000  1 0.000 0.000
#> GSM87985     1  0.0000      1.000  1 0.000 0.000
#> GSM87986     1  0.0000      1.000  1 0.000 0.000
#> GSM88004     2  0.0000      0.845  0 1.000 0.000
#> GSM88015     2  0.0000      0.845  0 1.000 0.000
#> GSM88005     2  0.0000      0.845  0 1.000 0.000
#> GSM88006     2  0.0000      0.845  0 1.000 0.000
#> GSM88016     2  0.0000      0.845  0 1.000 0.000
#> GSM88007     2  0.0000      0.845  0 1.000 0.000
#> GSM88017     2  0.0000      0.845  0 1.000 0.000
#> GSM88029     2  0.0592      0.840  0 0.988 0.012
#> GSM88008     2  0.0000      0.845  0 1.000 0.000
#> GSM88009     2  0.0000      0.845  0 1.000 0.000
#> GSM88018     2  0.0000      0.845  0 1.000 0.000
#> GSM88024     2  0.0000      0.845  0 1.000 0.000
#> GSM88030     2  0.6140      0.475  0 0.596 0.404
#> GSM88036     2  0.6140      0.475  0 0.596 0.404
#> GSM88010     2  0.6192      0.496  0 0.580 0.420
#> GSM88011     2  0.6192      0.496  0 0.580 0.420
#> GSM88019     2  0.5098      0.689  0 0.752 0.248
#> GSM88027     2  0.5098      0.689  0 0.752 0.248
#> GSM88031     3  0.0000      1.000  0 0.000 1.000
#> GSM88012     2  0.6192      0.496  0 0.580 0.420
#> GSM88020     3  0.0000      1.000  0 0.000 1.000
#> GSM88032     3  0.0000      1.000  0 0.000 1.000
#> GSM88037     3  0.0000      1.000  0 0.000 1.000
#> GSM88013     2  0.6192      0.496  0 0.580 0.420
#> GSM88021     3  0.0000      1.000  0 0.000 1.000
#> GSM88025     3  0.0000      1.000  0 0.000 1.000
#> GSM88033     3  0.0000      1.000  0 0.000 1.000
#> GSM88014     2  0.6192      0.496  0 0.580 0.420
#> GSM88022     2  0.6192      0.496  0 0.580 0.420
#> GSM88034     3  0.0000      1.000  0 0.000 1.000
#> GSM88002     2  0.0000      0.845  0 1.000 0.000
#> GSM88003     2  0.0000      0.845  0 1.000 0.000
#> GSM88023     2  0.0000      0.845  0 1.000 0.000
#> GSM88026     2  0.0000      0.845  0 1.000 0.000
#> GSM88028     2  0.0000      0.845  0 1.000 0.000
#> GSM88035     2  0.0000      0.845  0 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
#> GSM87962     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87963     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87983     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87984     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87961     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87970     1  0.2589      0.945 0.884 0.000 0.116 0.000
#> GSM87971     1  0.2589      0.945 0.884 0.000 0.116 0.000
#> GSM87990     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87991     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87974     1  0.2647      0.944 0.880 0.000 0.120 0.000
#> GSM87994     3  0.1940      0.905 0.076 0.000 0.924 0.000
#> GSM87978     1  0.4250      0.792 0.724 0.000 0.276 0.000
#> GSM87979     1  0.4277      0.789 0.720 0.000 0.280 0.000
#> GSM87998     3  0.1940      0.905 0.076 0.000 0.924 0.000
#> GSM87999     3  0.1940      0.905 0.076 0.000 0.924 0.000
#> GSM87968     1  0.4250      0.792 0.724 0.000 0.276 0.000
#> GSM87987     3  0.4454      0.449 0.308 0.000 0.692 0.000
#> GSM87969     1  0.4855      0.557 0.600 0.000 0.400 0.000
#> GSM87988     3  0.1474      0.927 0.052 0.000 0.948 0.000
#> GSM87989     3  0.1474      0.927 0.052 0.000 0.948 0.000
#> GSM87972     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87992     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87995     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87977     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87996     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM88000     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0000      0.963 0.000 0.000 1.000 0.000
#> GSM87964     1  0.2589      0.945 0.884 0.000 0.116 0.000
#> GSM87965     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87966     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87985     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM87986     1  0.2647      0.947 0.880 0.000 0.120 0.000
#> GSM88004     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88005     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88029     2  0.0469      0.811 0.000 0.988 0.000 0.012
#> GSM88008     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0000      0.814 0.000 1.000 0.000 0.000
#> GSM88030     2  0.4866      0.454 0.000 0.596 0.000 0.404
#> GSM88036     2  0.4866      0.454 0.000 0.596 0.000 0.404
#> GSM88010     2  0.4907      0.472 0.000 0.580 0.000 0.420
#> GSM88011     2  0.4907      0.472 0.000 0.580 0.000 0.420
#> GSM88019     2  0.4040      0.671 0.000 0.752 0.000 0.248
#> GSM88027     2  0.4040      0.671 0.000 0.752 0.000 0.248
#> GSM88031     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM88012     2  0.4907      0.472 0.000 0.580 0.000 0.420
#> GSM88020     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM88032     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM88013     2  0.4907      0.472 0.000 0.580 0.000 0.420
#> GSM88021     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM88014     2  0.4907      0.472 0.000 0.580 0.000 0.420
#> GSM88022     2  0.4907      0.472 0.000 0.580 0.000 0.420
#> GSM88034     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM88002     2  0.2589      0.772 0.116 0.884 0.000 0.000
#> GSM88003     2  0.2589      0.772 0.116 0.884 0.000 0.000
#> GSM88023     2  0.2589      0.772 0.116 0.884 0.000 0.000
#> GSM88026     2  0.2589      0.772 0.116 0.884 0.000 0.000
#> GSM88028     2  0.2589      0.772 0.116 0.884 0.000 0.000
#> GSM88035     2  0.2589      0.772 0.116 0.884 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
#> GSM87962     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87963     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87983     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87961     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87970     1  0.0162      0.944 0.996 0.000 0.000 0.000 0.004
#> GSM87971     1  0.0162      0.944 0.996 0.000 0.000 0.000 0.004
#> GSM87990     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87991     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87974     1  0.0324      0.942 0.992 0.000 0.004 0.000 0.004
#> GSM87994     3  0.2230      0.869 0.116 0.000 0.884 0.000 0.000
#> GSM87978     1  0.2890      0.811 0.836 0.000 0.160 0.000 0.004
#> GSM87979     1  0.2732      0.811 0.840 0.000 0.160 0.000 0.000
#> GSM87998     3  0.2230      0.869 0.116 0.000 0.884 0.000 0.000
#> GSM87999     3  0.2230      0.869 0.116 0.000 0.884 0.000 0.000
#> GSM87968     1  0.2890      0.811 0.836 0.000 0.160 0.000 0.004
#> GSM87987     3  0.4242      0.244 0.428 0.000 0.572 0.000 0.000
#> GSM87969     1  0.3684      0.625 0.720 0.000 0.280 0.000 0.000
#> GSM87988     3  0.1908      0.888 0.092 0.000 0.908 0.000 0.000
#> GSM87989     3  0.1908      0.888 0.092 0.000 0.908 0.000 0.000
#> GSM87972     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87992     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87973     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87993     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87975     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87995     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87976     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87977     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87996     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87997     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87980     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM88000     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87981     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87982     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM88001     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87967     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> GSM87964     1  0.0162      0.944 0.996 0.000 0.000 0.000 0.004
#> GSM87965     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87966     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87985     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM87986     1  0.0000      0.945 1.000 0.000 0.000 0.000 0.000
#> GSM88004     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88015     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88005     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88006     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88016     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88007     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88017     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88029     2  0.1851      0.728 0.000 0.912 0.000 0.000 0.088
#> GSM88008     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88009     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88018     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88024     2  0.2377      0.732 0.000 0.872 0.000 0.000 0.128
#> GSM88030     2  0.5125      0.546 0.000 0.696 0.000 0.148 0.156
#> GSM88036     2  0.5125      0.546 0.000 0.696 0.000 0.148 0.156
#> GSM88010     2  0.3895      0.569 0.000 0.680 0.000 0.320 0.000
#> GSM88011     2  0.3895      0.569 0.000 0.680 0.000 0.320 0.000
#> GSM88019     2  0.2605      0.681 0.000 0.852 0.000 0.148 0.000
#> GSM88027     2  0.2605      0.681 0.000 0.852 0.000 0.148 0.000
#> GSM88031     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM88012     2  0.3895      0.569 0.000 0.680 0.000 0.320 0.000
#> GSM88020     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM88032     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM88037     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM88013     2  0.3895      0.569 0.000 0.680 0.000 0.320 0.000
#> GSM88021     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM88025     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM88014     2  0.3895      0.569 0.000 0.680 0.000 0.320 0.000
#> GSM88022     2  0.3895      0.569 0.000 0.680 0.000 0.320 0.000
#> GSM88034     4  0.2690      0.829 0.000 0.000 0.000 0.844 0.156
#> GSM88002     5  0.2732      1.000 0.000 0.160 0.000 0.000 0.840
#> GSM88003     5  0.2732      1.000 0.000 0.160 0.000 0.000 0.840
#> GSM88023     5  0.2732      1.000 0.000 0.160 0.000 0.000 0.840
#> GSM88026     5  0.2732      1.000 0.000 0.160 0.000 0.000 0.840
#> GSM88028     5  0.2732      1.000 0.000 0.160 0.000 0.000 0.840
#> GSM88035     5  0.2732      1.000 0.000 0.160 0.000 0.000 0.840

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87963     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87983     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87984     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87961     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87970     1  0.2520     0.8531 0.844 0.152 0.000 0.000 0.004 0.000
#> GSM87971     1  0.2520     0.8531 0.844 0.152 0.000 0.000 0.004 0.000
#> GSM87990     1  0.2178     0.8630 0.868 0.132 0.000 0.000 0.000 0.000
#> GSM87991     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87974     1  0.2631     0.8528 0.840 0.152 0.000 0.000 0.008 0.000
#> GSM87994     3  0.3700     0.8028 0.116 0.076 0.800 0.000 0.008 0.000
#> GSM87978     1  0.3473     0.8153 0.824 0.088 0.076 0.000 0.012 0.000
#> GSM87979     1  0.3318     0.8148 0.836 0.076 0.076 0.000 0.012 0.000
#> GSM87998     3  0.3700     0.8028 0.116 0.076 0.800 0.000 0.008 0.000
#> GSM87999     3  0.3700     0.8028 0.116 0.076 0.800 0.000 0.008 0.000
#> GSM87968     1  0.3473     0.8153 0.824 0.088 0.076 0.000 0.012 0.000
#> GSM87987     3  0.5290     0.1620 0.428 0.076 0.488 0.000 0.008 0.000
#> GSM87969     1  0.4411     0.6633 0.720 0.076 0.196 0.000 0.008 0.000
#> GSM87988     3  0.3314     0.8253 0.092 0.076 0.828 0.000 0.004 0.000
#> GSM87989     3  0.3314     0.8253 0.092 0.076 0.828 0.000 0.004 0.000
#> GSM87972     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87992     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87973     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87993     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87975     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87995     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87976     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87977     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87996     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87997     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87980     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM88000     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87981     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87982     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM88001     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87967     3  0.0000     0.9258 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87964     1  0.2668     0.8432 0.828 0.168 0.000 0.000 0.004 0.000
#> GSM87965     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87966     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87985     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87986     1  0.0000     0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM88004     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88015     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88005     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88006     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88016     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88007     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88017     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88029     2  0.3578     0.9166 0.000 0.660 0.000 0.340 0.000 0.000
#> GSM88008     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88009     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88018     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88024     2  0.3390     0.9929 0.000 0.704 0.000 0.296 0.000 0.000
#> GSM88030     4  0.5956     0.3385 0.000 0.292 0.000 0.452 0.000 0.256
#> GSM88036     4  0.5956     0.3385 0.000 0.292 0.000 0.452 0.000 0.256
#> GSM88010     4  0.0000     0.7509 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88011     4  0.0146     0.7483 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM88019     4  0.3634     0.0509 0.000 0.356 0.000 0.644 0.000 0.000
#> GSM88027     4  0.3634     0.0509 0.000 0.356 0.000 0.644 0.000 0.000
#> GSM88031     6  0.3330     0.9319 0.000 0.000 0.000 0.284 0.000 0.716
#> GSM88012     4  0.0000     0.7509 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88020     6  0.3330     0.9319 0.000 0.000 0.000 0.284 0.000 0.716
#> GSM88032     6  0.3330     0.9319 0.000 0.000 0.000 0.284 0.000 0.716
#> GSM88037     6  0.3330     0.9319 0.000 0.000 0.000 0.284 0.000 0.716
#> GSM88013     4  0.0000     0.7509 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88021     6  0.3330     0.9319 0.000 0.000 0.000 0.284 0.000 0.716
#> GSM88025     6  0.3330     0.9319 0.000 0.000 0.000 0.284 0.000 0.716
#> GSM88033     6  0.2562     0.8512 0.000 0.000 0.000 0.172 0.000 0.828
#> GSM88014     4  0.0000     0.7509 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88022     4  0.0000     0.7509 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88034     6  0.0000     0.6886 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM88002     5  0.0363     1.0000 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM88003     5  0.0363     1.0000 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM88023     5  0.0363     1.0000 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM88026     5  0.0363     1.0000 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM88028     5  0.0363     1.0000 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM88035     5  0.0363     1.0000 0.000 0.012 0.000 0.000 0.988 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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

test_to_known_factors(res)
#>             n cell.line(p) agent(p)  time(p) k
#> MAD:hclust 77     1.27e-17 3.00e-14 3.61e-01 2
#> MAD:hclust 69     1.04e-15 1.38e-11 1.62e-02 3
#> MAD:hclust 68     1.14e-14 8.37e-14 3.84e-03 4
#> MAD:hclust 76     1.22e-15 7.53e-23 2.07e-05 5
#> MAD:hclust 72     3.93e-14 6.66e-20 8.21e-06 6

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


MAD: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 18792 rows and 77 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           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.712           0.914       0.790         0.2417 0.859   0.714
#> 4 4 0.644           0.827       0.751         0.1163 0.889   0.687
#> 5 5 0.594           0.794       0.780         0.0808 1.000   1.000
#> 6 6 0.752           0.710       0.750         0.0477 0.945   0.783

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1   0.631      1.000 0.508 0.000 0.492
#> GSM87963     1   0.631      1.000 0.508 0.000 0.492
#> GSM87983     1   0.631      1.000 0.508 0.000 0.492
#> GSM87984     1   0.631      1.000 0.508 0.000 0.492
#> GSM87961     1   0.631      1.000 0.508 0.000 0.492
#> GSM87970     1   0.631      1.000 0.508 0.000 0.492
#> GSM87971     1   0.631      1.000 0.508 0.000 0.492
#> GSM87990     1   0.631      1.000 0.508 0.000 0.492
#> GSM87991     1   0.631      1.000 0.508 0.000 0.492
#> GSM87974     1   0.631      1.000 0.508 0.000 0.492
#> GSM87994     1   0.631      1.000 0.508 0.000 0.492
#> GSM87978     1   0.631      1.000 0.508 0.000 0.492
#> GSM87979     1   0.631      1.000 0.508 0.000 0.492
#> GSM87998     1   0.631      1.000 0.508 0.000 0.492
#> GSM87999     1   0.631      1.000 0.508 0.000 0.492
#> GSM87968     1   0.631      1.000 0.508 0.000 0.492
#> GSM87987     1   0.631      1.000 0.508 0.000 0.492
#> GSM87969     1   0.631      1.000 0.508 0.000 0.492
#> GSM87988     3   0.000      1.000 0.000 0.000 1.000
#> GSM87989     3   0.000      1.000 0.000 0.000 1.000
#> GSM87972     3   0.000      1.000 0.000 0.000 1.000
#> GSM87992     3   0.000      1.000 0.000 0.000 1.000
#> GSM87973     3   0.000      1.000 0.000 0.000 1.000
#> GSM87993     3   0.000      1.000 0.000 0.000 1.000
#> GSM87975     3   0.000      1.000 0.000 0.000 1.000
#> GSM87995     3   0.000      1.000 0.000 0.000 1.000
#> GSM87976     3   0.000      1.000 0.000 0.000 1.000
#> GSM87977     3   0.000      1.000 0.000 0.000 1.000
#> GSM87996     3   0.000      1.000 0.000 0.000 1.000
#> GSM87997     3   0.000      1.000 0.000 0.000 1.000
#> GSM87980     3   0.000      1.000 0.000 0.000 1.000
#> GSM88000     3   0.000      1.000 0.000 0.000 1.000
#> GSM87981     3   0.000      1.000 0.000 0.000 1.000
#> GSM87982     3   0.000      1.000 0.000 0.000 1.000
#> GSM88001     3   0.000      1.000 0.000 0.000 1.000
#> GSM87967     3   0.000      1.000 0.000 0.000 1.000
#> GSM87964     1   0.631      1.000 0.508 0.000 0.492
#> GSM87965     1   0.631      1.000 0.508 0.000 0.492
#> GSM87966     1   0.631      1.000 0.508 0.000 0.492
#> GSM87985     1   0.631      1.000 0.508 0.000 0.492
#> GSM87986     1   0.631      1.000 0.508 0.000 0.492
#> GSM88004     2   0.000      0.828 0.000 1.000 0.000
#> GSM88015     2   0.000      0.828 0.000 1.000 0.000
#> GSM88005     2   0.000      0.828 0.000 1.000 0.000
#> GSM88006     2   0.000      0.828 0.000 1.000 0.000
#> GSM88016     2   0.000      0.828 0.000 1.000 0.000
#> GSM88007     2   0.000      0.828 0.000 1.000 0.000
#> GSM88017     2   0.000      0.828 0.000 1.000 0.000
#> GSM88029     2   0.000      0.828 0.000 1.000 0.000
#> GSM88008     2   0.000      0.828 0.000 1.000 0.000
#> GSM88009     2   0.000      0.828 0.000 1.000 0.000
#> GSM88018     2   0.000      0.828 0.000 1.000 0.000
#> GSM88024     2   0.000      0.828 0.000 1.000 0.000
#> GSM88030     2   0.475      0.828 0.216 0.784 0.000
#> GSM88036     2   0.475      0.828 0.216 0.784 0.000
#> GSM88010     2   0.595      0.816 0.360 0.640 0.000
#> GSM88011     2   0.595      0.816 0.360 0.640 0.000
#> GSM88019     2   0.593      0.816 0.356 0.644 0.000
#> GSM88027     2   0.593      0.816 0.356 0.644 0.000
#> GSM88031     2   0.620      0.806 0.424 0.576 0.000
#> GSM88012     2   0.620      0.806 0.424 0.576 0.000
#> GSM88020     2   0.620      0.806 0.424 0.576 0.000
#> GSM88032     2   0.620      0.806 0.424 0.576 0.000
#> GSM88037     2   0.620      0.806 0.424 0.576 0.000
#> GSM88013     2   0.620      0.806 0.424 0.576 0.000
#> GSM88021     2   0.620      0.806 0.424 0.576 0.000
#> GSM88025     2   0.620      0.806 0.424 0.576 0.000
#> GSM88033     2   0.620      0.806 0.424 0.576 0.000
#> GSM88014     2   0.620      0.806 0.424 0.576 0.000
#> GSM88022     2   0.620      0.806 0.424 0.576 0.000
#> GSM88034     2   0.620      0.806 0.424 0.576 0.000
#> GSM88002     2   0.296      0.809 0.100 0.900 0.000
#> GSM88003     2   0.296      0.809 0.100 0.900 0.000
#> GSM88023     2   0.296      0.809 0.100 0.900 0.000
#> GSM88026     2   0.296      0.809 0.100 0.900 0.000
#> GSM88028     2   0.296      0.809 0.100 0.900 0.000
#> GSM88035     2   0.296      0.809 0.100 0.900 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.5565      0.926 0.684 0.056 0.260 0.000
#> GSM87963     1  0.5565      0.926 0.684 0.056 0.260 0.000
#> GSM87983     1  0.4576      0.923 0.728 0.012 0.260 0.000
#> GSM87984     1  0.4576      0.923 0.728 0.012 0.260 0.000
#> GSM87961     1  0.5565      0.926 0.684 0.056 0.260 0.000
#> GSM87970     1  0.6547      0.911 0.616 0.124 0.260 0.000
#> GSM87971     1  0.6547      0.911 0.616 0.124 0.260 0.000
#> GSM87990     1  0.4576      0.925 0.728 0.012 0.260 0.000
#> GSM87991     1  0.5172      0.911 0.704 0.036 0.260 0.000
#> GSM87974     1  0.6723      0.908 0.600 0.140 0.260 0.000
#> GSM87994     1  0.6138      0.898 0.648 0.092 0.260 0.000
#> GSM87978     1  0.6805      0.906 0.592 0.148 0.260 0.000
#> GSM87979     1  0.6805      0.906 0.592 0.148 0.260 0.000
#> GSM87998     1  0.6219      0.894 0.640 0.096 0.264 0.000
#> GSM87999     1  0.6219      0.894 0.640 0.096 0.264 0.000
#> GSM87968     1  0.6805      0.906 0.592 0.148 0.260 0.000
#> GSM87987     1  0.6273      0.894 0.636 0.100 0.264 0.000
#> GSM87969     1  0.6957      0.900 0.576 0.164 0.260 0.000
#> GSM87988     3  0.1637      0.904 0.000 0.060 0.940 0.000
#> GSM87989     3  0.1637      0.904 0.000 0.060 0.940 0.000
#> GSM87972     3  0.2345      0.944 0.000 0.100 0.900 0.000
#> GSM87992     3  0.0000      0.944 0.000 0.000 1.000 0.000
#> GSM87973     3  0.2216      0.947 0.000 0.092 0.908 0.000
#> GSM87993     3  0.0000      0.944 0.000 0.000 1.000 0.000
#> GSM87975     3  0.2216      0.947 0.000 0.092 0.908 0.000
#> GSM87995     3  0.0000      0.944 0.000 0.000 1.000 0.000
#> GSM87976     3  0.2216      0.947 0.000 0.092 0.908 0.000
#> GSM87977     3  0.2216      0.947 0.000 0.092 0.908 0.000
#> GSM87996     3  0.0000      0.944 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000      0.944 0.000 0.000 1.000 0.000
#> GSM87980     3  0.2216      0.947 0.000 0.092 0.908 0.000
#> GSM88000     3  0.0000      0.944 0.000 0.000 1.000 0.000
#> GSM87981     3  0.2216      0.947 0.000 0.092 0.908 0.000
#> GSM87982     3  0.2216      0.947 0.000 0.092 0.908 0.000
#> GSM88001     3  0.0000      0.944 0.000 0.000 1.000 0.000
#> GSM87967     3  0.2216      0.947 0.000 0.092 0.908 0.000
#> GSM87964     1  0.6452      0.911 0.624 0.116 0.260 0.000
#> GSM87965     1  0.5565      0.926 0.684 0.056 0.260 0.000
#> GSM87966     1  0.4576      0.923 0.728 0.012 0.260 0.000
#> GSM87985     1  0.4576      0.923 0.728 0.012 0.260 0.000
#> GSM87986     1  0.4576      0.923 0.728 0.012 0.260 0.000
#> GSM88004     2  0.4817      0.789 0.000 0.612 0.000 0.388
#> GSM88015     2  0.4817      0.789 0.000 0.612 0.000 0.388
#> GSM88005     2  0.4817      0.789 0.000 0.612 0.000 0.388
#> GSM88006     2  0.4817      0.789 0.000 0.612 0.000 0.388
#> GSM88016     2  0.4817      0.789 0.000 0.612 0.000 0.388
#> GSM88007     2  0.4817      0.789 0.000 0.612 0.000 0.388
#> GSM88017     2  0.4991      0.786 0.004 0.608 0.000 0.388
#> GSM88029     2  0.5125      0.782 0.008 0.604 0.000 0.388
#> GSM88008     2  0.4817      0.789 0.000 0.612 0.000 0.388
#> GSM88009     2  0.4817      0.789 0.000 0.612 0.000 0.388
#> GSM88018     2  0.4991      0.786 0.004 0.608 0.000 0.388
#> GSM88024     2  0.4991      0.786 0.004 0.608 0.000 0.388
#> GSM88030     4  0.4957      0.111 0.016 0.300 0.000 0.684
#> GSM88036     4  0.4957      0.111 0.016 0.300 0.000 0.684
#> GSM88010     4  0.4139      0.649 0.024 0.176 0.000 0.800
#> GSM88011     4  0.4139      0.649 0.024 0.176 0.000 0.800
#> GSM88019     4  0.4225      0.635 0.024 0.184 0.000 0.792
#> GSM88027     4  0.4225      0.635 0.024 0.184 0.000 0.792
#> GSM88031     4  0.0469      0.844 0.012 0.000 0.000 0.988
#> GSM88012     4  0.0817      0.837 0.024 0.000 0.000 0.976
#> GSM88020     4  0.0469      0.844 0.012 0.000 0.000 0.988
#> GSM88032     4  0.0469      0.844 0.012 0.000 0.000 0.988
#> GSM88037     4  0.0469      0.844 0.012 0.000 0.000 0.988
#> GSM88013     4  0.0707      0.838 0.020 0.000 0.000 0.980
#> GSM88021     4  0.0469      0.844 0.012 0.000 0.000 0.988
#> GSM88025     4  0.0469      0.844 0.012 0.000 0.000 0.988
#> GSM88033     4  0.0469      0.844 0.012 0.000 0.000 0.988
#> GSM88014     4  0.0707      0.838 0.020 0.000 0.000 0.980
#> GSM88022     4  0.0817      0.837 0.024 0.000 0.000 0.976
#> GSM88034     4  0.0592      0.842 0.016 0.000 0.000 0.984
#> GSM88002     2  0.7641      0.572 0.208 0.416 0.000 0.376
#> GSM88003     2  0.7641      0.572 0.208 0.416 0.000 0.376
#> GSM88023     2  0.7599      0.572 0.200 0.424 0.000 0.376
#> GSM88026     2  0.7599      0.572 0.200 0.424 0.000 0.376
#> GSM88028     2  0.7621      0.572 0.204 0.420 0.000 0.376
#> GSM88035     2  0.7621      0.572 0.204 0.420 0.000 0.376

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4 p5
#> GSM87962     1  0.3216      0.866 0.848 0.000 0.108 0.000 NA
#> GSM87963     1  0.3216      0.866 0.848 0.000 0.108 0.000 NA
#> GSM87983     1  0.2127      0.864 0.892 0.000 0.108 0.000 NA
#> GSM87984     1  0.2127      0.864 0.892 0.000 0.108 0.000 NA
#> GSM87961     1  0.3216      0.866 0.848 0.000 0.108 0.000 NA
#> GSM87970     1  0.5223      0.841 0.672 0.000 0.108 0.000 NA
#> GSM87971     1  0.5403      0.835 0.644 0.000 0.108 0.000 NA
#> GSM87990     1  0.2984      0.868 0.860 0.000 0.108 0.000 NA
#> GSM87991     1  0.3427      0.853 0.836 0.000 0.108 0.000 NA
#> GSM87974     1  0.5631      0.825 0.600 0.000 0.108 0.000 NA
#> GSM87994     1  0.6191      0.785 0.628 0.040 0.108 0.000 NA
#> GSM87978     1  0.5683      0.822 0.588 0.000 0.108 0.000 NA
#> GSM87979     1  0.5683      0.822 0.588 0.000 0.108 0.000 NA
#> GSM87998     1  0.6312      0.779 0.608 0.040 0.108 0.000 NA
#> GSM87999     1  0.6312      0.779 0.608 0.040 0.108 0.000 NA
#> GSM87968     1  0.5683      0.822 0.588 0.000 0.108 0.000 NA
#> GSM87987     1  0.6438      0.775 0.584 0.040 0.108 0.000 NA
#> GSM87969     1  0.6046      0.783 0.512 0.004 0.108 0.000 NA
#> GSM87988     3  0.3521      0.763 0.000 0.040 0.820 0.000 NA
#> GSM87989     3  0.3521      0.763 0.000 0.040 0.820 0.000 NA
#> GSM87972     3  0.5126      0.848 0.000 0.152 0.696 0.000 NA
#> GSM87992     3  0.0000      0.856 0.000 0.000 1.000 0.000 NA
#> GSM87973     3  0.4751      0.863 0.000 0.152 0.732 0.000 NA
#> GSM87993     3  0.0000      0.856 0.000 0.000 1.000 0.000 NA
#> GSM87975     3  0.4926      0.856 0.000 0.152 0.716 0.000 NA
#> GSM87995     3  0.0000      0.856 0.000 0.000 1.000 0.000 NA
#> GSM87976     3  0.4926      0.856 0.000 0.152 0.716 0.000 NA
#> GSM87977     3  0.4751      0.863 0.000 0.152 0.732 0.000 NA
#> GSM87996     3  0.0000      0.856 0.000 0.000 1.000 0.000 NA
#> GSM87997     3  0.0000      0.856 0.000 0.000 1.000 0.000 NA
#> GSM87980     3  0.4751      0.863 0.000 0.152 0.732 0.000 NA
#> GSM88000     3  0.0000      0.856 0.000 0.000 1.000 0.000 NA
#> GSM87981     3  0.4751      0.863 0.000 0.152 0.732 0.000 NA
#> GSM87982     3  0.4559      0.865 0.000 0.152 0.748 0.000 NA
#> GSM88001     3  0.0000      0.856 0.000 0.000 1.000 0.000 NA
#> GSM87967     3  0.4559      0.865 0.000 0.152 0.748 0.000 NA
#> GSM87964     1  0.4879      0.842 0.716 0.000 0.108 0.000 NA
#> GSM87965     1  0.3216      0.866 0.848 0.000 0.108 0.000 NA
#> GSM87966     1  0.2127      0.864 0.892 0.000 0.108 0.000 NA
#> GSM87985     1  0.2127      0.864 0.892 0.000 0.108 0.000 NA
#> GSM87986     1  0.2127      0.864 0.892 0.000 0.108 0.000 NA
#> GSM88004     2  0.6569      0.819 0.000 0.468 0.000 0.240 NA
#> GSM88015     2  0.6621      0.814 0.000 0.448 0.000 0.240 NA
#> GSM88005     2  0.6569      0.819 0.000 0.468 0.000 0.240 NA
#> GSM88006     2  0.6569      0.819 0.000 0.468 0.000 0.240 NA
#> GSM88016     2  0.6621      0.814 0.000 0.448 0.000 0.240 NA
#> GSM88007     2  0.6569      0.819 0.000 0.468 0.000 0.240 NA
#> GSM88017     2  0.7322      0.794 0.032 0.424 0.000 0.240 NA
#> GSM88029     2  0.7322      0.794 0.032 0.424 0.000 0.240 NA
#> GSM88008     2  0.6569      0.819 0.000 0.468 0.000 0.240 NA
#> GSM88009     2  0.6569      0.819 0.000 0.468 0.000 0.240 NA
#> GSM88018     2  0.6987      0.800 0.012 0.424 0.000 0.240 NA
#> GSM88024     2  0.6987      0.800 0.012 0.424 0.000 0.240 NA
#> GSM88030     4  0.7089      0.123 0.064 0.156 0.000 0.540 NA
#> GSM88036     4  0.7089      0.123 0.064 0.156 0.000 0.540 NA
#> GSM88010     4  0.5135      0.697 0.036 0.048 0.000 0.716 NA
#> GSM88011     4  0.5135      0.697 0.036 0.048 0.000 0.716 NA
#> GSM88019     4  0.5043      0.693 0.028 0.048 0.000 0.716 NA
#> GSM88027     4  0.5043      0.693 0.028 0.048 0.000 0.716 NA
#> GSM88031     4  0.0000      0.830 0.000 0.000 0.000 1.000 NA
#> GSM88012     4  0.2712      0.818 0.032 0.000 0.000 0.880 NA
#> GSM88020     4  0.0000      0.830 0.000 0.000 0.000 1.000 NA
#> GSM88032     4  0.0000      0.830 0.000 0.000 0.000 1.000 NA
#> GSM88037     4  0.0000      0.830 0.000 0.000 0.000 1.000 NA
#> GSM88013     4  0.2712      0.818 0.032 0.000 0.000 0.880 NA
#> GSM88021     4  0.0000      0.830 0.000 0.000 0.000 1.000 NA
#> GSM88025     4  0.0000      0.830 0.000 0.000 0.000 1.000 NA
#> GSM88033     4  0.0162      0.830 0.004 0.000 0.000 0.996 NA
#> GSM88014     4  0.2712      0.818 0.032 0.000 0.000 0.880 NA
#> GSM88022     4  0.2712      0.818 0.032 0.000 0.000 0.880 NA
#> GSM88034     4  0.1041      0.815 0.004 0.000 0.000 0.964 NA
#> GSM88002     2  0.3873      0.666 0.012 0.768 0.000 0.212 NA
#> GSM88003     2  0.3873      0.666 0.012 0.768 0.000 0.212 NA
#> GSM88023     2  0.3210      0.666 0.000 0.788 0.000 0.212 NA
#> GSM88026     2  0.3366      0.666 0.004 0.784 0.000 0.212 NA
#> GSM88028     2  0.3210      0.666 0.000 0.788 0.000 0.212 NA
#> GSM88035     2  0.3210      0.666 0.000 0.788 0.000 0.212 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.0146      0.782 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM87963     1  0.0146      0.782 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM87983     1  0.1007      0.778 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM87984     1  0.1007      0.778 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM87961     1  0.0146      0.782 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM87970     1  0.4645      0.735 0.732 0.000 0.004 0.024 0.164 0.076
#> GSM87971     1  0.4970      0.728 0.704 0.000 0.004 0.024 0.164 0.104
#> GSM87990     1  0.1610      0.782 0.916 0.000 0.000 0.000 0.000 0.084
#> GSM87991     1  0.2178      0.745 0.868 0.000 0.000 0.000 0.000 0.132
#> GSM87974     1  0.5543      0.707 0.640 0.000 0.004 0.024 0.160 0.172
#> GSM87994     1  0.3854      0.561 0.536 0.000 0.000 0.000 0.000 0.464
#> GSM87978     1  0.5543      0.707 0.640 0.000 0.004 0.024 0.160 0.172
#> GSM87979     1  0.5543      0.707 0.640 0.000 0.004 0.024 0.160 0.172
#> GSM87998     1  0.3862      0.555 0.524 0.000 0.000 0.000 0.000 0.476
#> GSM87999     1  0.3862      0.555 0.524 0.000 0.000 0.000 0.000 0.476
#> GSM87968     1  0.5543      0.707 0.640 0.000 0.004 0.024 0.160 0.172
#> GSM87987     1  0.3866      0.553 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM87969     1  0.5973      0.657 0.568 0.000 0.004 0.024 0.160 0.244
#> GSM87988     6  0.6325      1.000 0.076 0.000 0.356 0.012 0.060 0.496
#> GSM87989     6  0.6325      1.000 0.076 0.000 0.356 0.012 0.060 0.496
#> GSM87972     3  0.2859      0.572 0.076 0.000 0.872 0.008 0.008 0.036
#> GSM87992     3  0.7030      0.317 0.076 0.000 0.560 0.064 0.120 0.180
#> GSM87973     3  0.1757      0.622 0.076 0.000 0.916 0.008 0.000 0.000
#> GSM87993     3  0.7030      0.317 0.076 0.000 0.560 0.064 0.120 0.180
#> GSM87975     3  0.2935      0.596 0.076 0.000 0.872 0.020 0.016 0.016
#> GSM87995     3  0.7030      0.317 0.076 0.000 0.560 0.064 0.120 0.180
#> GSM87976     3  0.2935      0.596 0.076 0.000 0.872 0.020 0.016 0.016
#> GSM87977     3  0.1501      0.623 0.076 0.000 0.924 0.000 0.000 0.000
#> GSM87996     3  0.7030      0.317 0.076 0.000 0.560 0.064 0.120 0.180
#> GSM87997     3  0.7030      0.317 0.076 0.000 0.560 0.064 0.120 0.180
#> GSM87980     3  0.1501      0.623 0.076 0.000 0.924 0.000 0.000 0.000
#> GSM88000     3  0.7030      0.317 0.076 0.000 0.560 0.064 0.120 0.180
#> GSM87981     3  0.1901      0.621 0.076 0.000 0.912 0.004 0.008 0.000
#> GSM87982     3  0.2044      0.621 0.076 0.000 0.908 0.004 0.008 0.004
#> GSM88001     3  0.7030      0.317 0.076 0.000 0.560 0.064 0.120 0.180
#> GSM87967     3  0.2044      0.621 0.076 0.000 0.908 0.004 0.008 0.004
#> GSM87964     1  0.4388      0.732 0.764 0.000 0.004 0.048 0.140 0.044
#> GSM87965     1  0.0146      0.782 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM87966     1  0.1007      0.778 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM87985     1  0.1007      0.778 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM87986     1  0.1007      0.778 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM88004     2  0.0790      0.830 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM88015     2  0.0363      0.832 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM88005     2  0.0790      0.830 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM88006     2  0.0790      0.830 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM88016     2  0.0363      0.832 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM88007     2  0.0790      0.830 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM88017     2  0.1820      0.796 0.000 0.924 0.012 0.000 0.008 0.056
#> GSM88029     2  0.1882      0.792 0.000 0.920 0.012 0.000 0.008 0.060
#> GSM88008     2  0.0790      0.830 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM88009     2  0.0790      0.830 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM88018     2  0.0717      0.829 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM88024     2  0.0717      0.829 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM88030     2  0.6870      0.225 0.000 0.512 0.040 0.264 0.040 0.144
#> GSM88036     2  0.6870      0.225 0.000 0.512 0.040 0.264 0.040 0.144
#> GSM88010     4  0.6332      0.605 0.000 0.364 0.000 0.452 0.040 0.144
#> GSM88011     4  0.6332      0.605 0.000 0.364 0.000 0.452 0.040 0.144
#> GSM88019     4  0.6604      0.572 0.000 0.380 0.012 0.436 0.044 0.128
#> GSM88027     4  0.6604      0.572 0.000 0.380 0.012 0.436 0.044 0.128
#> GSM88031     4  0.2300      0.836 0.000 0.144 0.000 0.856 0.000 0.000
#> GSM88012     4  0.5294      0.814 0.000 0.144 0.000 0.672 0.036 0.148
#> GSM88020     4  0.2886      0.836 0.000 0.144 0.016 0.836 0.004 0.000
#> GSM88032     4  0.2300      0.836 0.000 0.144 0.000 0.856 0.000 0.000
#> GSM88037     4  0.2300      0.836 0.000 0.144 0.000 0.856 0.000 0.000
#> GSM88013     4  0.5225      0.817 0.000 0.144 0.000 0.680 0.036 0.140
#> GSM88021     4  0.2886      0.836 0.000 0.144 0.016 0.836 0.004 0.000
#> GSM88025     4  0.2886      0.836 0.000 0.144 0.016 0.836 0.004 0.000
#> GSM88033     4  0.2300      0.836 0.000 0.144 0.000 0.856 0.000 0.000
#> GSM88014     4  0.5225      0.817 0.000 0.144 0.000 0.680 0.036 0.140
#> GSM88022     4  0.5260      0.815 0.000 0.144 0.000 0.676 0.036 0.144
#> GSM88034     4  0.3240      0.817 0.000 0.144 0.000 0.820 0.008 0.028
#> GSM88002     5  0.4927      0.978 0.000 0.380 0.012 0.024 0.572 0.012
#> GSM88003     5  0.4927      0.978 0.000 0.380 0.012 0.024 0.572 0.012
#> GSM88023     5  0.4121      0.982 0.000 0.380 0.000 0.016 0.604 0.000
#> GSM88026     5  0.4570      0.982 0.000 0.380 0.008 0.020 0.588 0.004
#> GSM88028     5  0.4333      0.981 0.000 0.380 0.004 0.020 0.596 0.000
#> GSM88035     5  0.4333      0.981 0.000 0.380 0.004 0.020 0.596 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-kmeans-collect-classes

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

test_to_known_factors(res)
#>             n cell.line(p) agent(p)  time(p) k
#> MAD:kmeans 77     1.27e-17 3.00e-14 3.61e-01 2
#> MAD:kmeans 77     1.90e-17 1.77e-15 3.80e-03 3
#> MAD:kmeans 75     3.62e-16 4.17e-15 4.59e-06 4
#> MAD:kmeans 75     3.62e-16 4.17e-15 4.59e-06 5
#> MAD:kmeans 68     2.67e-13 1.25e-16 2.76e-09 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 18792 rows and 77 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 1.000           0.997       0.993         0.2790 0.859   0.714
#> 4 4 1.000           0.961       0.973         0.1663 0.889   0.687
#> 5 5 0.906           0.906       0.924         0.0438 0.975   0.899
#> 6 6 0.865           0.736       0.830         0.0398 0.950   0.780

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87963     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87983     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87984     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87961     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87970     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87971     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87990     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87991     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87974     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87994     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87978     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87979     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87998     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87999     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87968     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87987     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87969     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87988     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87989     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87972     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87992     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87973     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87993     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87975     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87995     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87976     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87977     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87996     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87997     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87980     3  0.0747      1.000 0.016 0.000 0.984
#> GSM88000     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87981     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87982     3  0.0747      1.000 0.016 0.000 0.984
#> GSM88001     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87967     3  0.0747      1.000 0.016 0.000 0.984
#> GSM87964     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87965     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87966     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87985     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87986     1  0.0000      1.000 1.000 0.000 0.000
#> GSM88004     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88015     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88005     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88006     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88016     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88007     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88017     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88029     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88008     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88009     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88018     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88024     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88030     2  0.0000      0.994 0.000 1.000 0.000
#> GSM88036     2  0.0000      0.994 0.000 1.000 0.000
#> GSM88010     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88011     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88019     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88027     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88031     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88012     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88020     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88032     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88037     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88013     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88021     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88025     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88033     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88014     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88022     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88034     2  0.0424      0.993 0.000 0.992 0.008
#> GSM88002     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88003     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88023     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88026     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88028     2  0.0424      0.994 0.000 0.992 0.008
#> GSM88035     2  0.0424      0.994 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
#> GSM87962     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87983     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87961     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87970     1  0.0817      0.985 0.976 0.000 0.000 0.024
#> GSM87971     1  0.1118      0.983 0.964 0.000 0.000 0.036
#> GSM87990     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87991     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87974     1  0.1118      0.983 0.964 0.000 0.000 0.036
#> GSM87994     1  0.0469      0.989 0.988 0.000 0.000 0.012
#> GSM87978     1  0.1118      0.983 0.964 0.000 0.000 0.036
#> GSM87979     1  0.1118      0.983 0.964 0.000 0.000 0.036
#> GSM87998     1  0.0469      0.989 0.988 0.000 0.000 0.012
#> GSM87999     1  0.0469      0.989 0.988 0.000 0.000 0.012
#> GSM87968     1  0.1118      0.983 0.964 0.000 0.000 0.036
#> GSM87987     1  0.0469      0.989 0.988 0.000 0.000 0.012
#> GSM87969     1  0.1118      0.983 0.964 0.000 0.000 0.036
#> GSM87988     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87989     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87972     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM87992     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM87993     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM87995     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM87977     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM87996     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM88000     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM87982     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM88001     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0188      0.998 0.000 0.000 0.996 0.004
#> GSM87964     1  0.0817      0.985 0.976 0.000 0.000 0.024
#> GSM87965     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87966     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87985     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM87986     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM88004     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88015     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88005     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88006     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88016     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88007     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88017     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88029     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88008     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88009     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88018     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88024     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> GSM88030     4  0.4999      0.152 0.000 0.492 0.000 0.508
#> GSM88036     4  0.4999      0.152 0.000 0.492 0.000 0.508
#> GSM88010     4  0.1389      0.937 0.000 0.048 0.000 0.952
#> GSM88011     4  0.1389      0.937 0.000 0.048 0.000 0.952
#> GSM88019     4  0.1389      0.937 0.000 0.048 0.000 0.952
#> GSM88027     4  0.1389      0.937 0.000 0.048 0.000 0.952
#> GSM88031     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88012     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88020     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88032     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88037     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88013     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88021     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88025     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88033     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88014     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88022     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88034     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM88002     2  0.0188      0.995 0.000 0.996 0.000 0.004
#> GSM88003     2  0.0188      0.995 0.000 0.996 0.000 0.004
#> GSM88023     2  0.0188      0.995 0.000 0.996 0.000 0.004
#> GSM88026     2  0.0188      0.995 0.000 0.996 0.000 0.004
#> GSM88028     2  0.0188      0.995 0.000 0.996 0.000 0.004
#> GSM88035     2  0.0188      0.995 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
#> GSM87962     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000
#> GSM87963     1  0.0162      0.940 0.996 0.000 0.000 0.000 0.004
#> GSM87983     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000
#> GSM87961     1  0.0162      0.940 0.996 0.000 0.000 0.000 0.004
#> GSM87970     1  0.2377      0.929 0.872 0.000 0.000 0.000 0.128
#> GSM87971     1  0.2605      0.925 0.852 0.000 0.000 0.000 0.148
#> GSM87990     1  0.0963      0.942 0.964 0.000 0.000 0.000 0.036
#> GSM87991     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000
#> GSM87974     1  0.2773      0.920 0.836 0.000 0.000 0.000 0.164
#> GSM87994     1  0.2020      0.936 0.900 0.000 0.000 0.000 0.100
#> GSM87978     1  0.2773      0.920 0.836 0.000 0.000 0.000 0.164
#> GSM87979     1  0.2773      0.920 0.836 0.000 0.000 0.000 0.164
#> GSM87998     1  0.2074      0.935 0.896 0.000 0.000 0.000 0.104
#> GSM87999     1  0.2074      0.935 0.896 0.000 0.000 0.000 0.104
#> GSM87968     1  0.2773      0.920 0.836 0.000 0.000 0.000 0.164
#> GSM87987     1  0.2074      0.935 0.896 0.000 0.000 0.000 0.104
#> GSM87969     1  0.2773      0.920 0.836 0.000 0.000 0.000 0.164
#> GSM87988     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87989     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87972     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM87992     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87973     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM87993     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87975     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM87995     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87976     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM87977     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM87996     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87997     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87980     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM88000     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87981     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM87982     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM88001     3  0.0404      0.995 0.000 0.000 0.988 0.000 0.012
#> GSM87967     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000
#> GSM87964     1  0.1410      0.931 0.940 0.000 0.000 0.000 0.060
#> GSM87965     1  0.0162      0.940 0.996 0.000 0.000 0.000 0.004
#> GSM87966     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000
#> GSM87985     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000
#> GSM87986     1  0.0000      0.940 1.000 0.000 0.000 0.000 0.000
#> GSM88004     2  0.0703      0.982 0.000 0.976 0.000 0.000 0.024
#> GSM88015     2  0.0162      0.982 0.000 0.996 0.000 0.000 0.004
#> GSM88005     2  0.0703      0.982 0.000 0.976 0.000 0.000 0.024
#> GSM88006     2  0.0703      0.982 0.000 0.976 0.000 0.000 0.024
#> GSM88016     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM88007     2  0.0703      0.982 0.000 0.976 0.000 0.000 0.024
#> GSM88017     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM88029     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM88008     2  0.0703      0.982 0.000 0.976 0.000 0.000 0.024
#> GSM88009     2  0.0703      0.982 0.000 0.976 0.000 0.000 0.024
#> GSM88018     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM88024     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM88030     4  0.4740      0.145 0.000 0.468 0.000 0.516 0.016
#> GSM88036     4  0.4740      0.145 0.000 0.468 0.000 0.516 0.016
#> GSM88010     4  0.4817      0.602 0.000 0.300 0.000 0.656 0.044
#> GSM88011     4  0.4797      0.607 0.000 0.296 0.000 0.660 0.044
#> GSM88019     4  0.4908      0.581 0.000 0.320 0.000 0.636 0.044
#> GSM88027     4  0.4908      0.581 0.000 0.320 0.000 0.636 0.044
#> GSM88031     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000
#> GSM88012     4  0.1121      0.826 0.000 0.000 0.000 0.956 0.044
#> GSM88020     4  0.0404      0.827 0.000 0.000 0.000 0.988 0.012
#> GSM88032     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000
#> GSM88037     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000
#> GSM88013     4  0.1121      0.826 0.000 0.000 0.000 0.956 0.044
#> GSM88021     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000
#> GSM88025     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000
#> GSM88014     4  0.1121      0.826 0.000 0.000 0.000 0.956 0.044
#> GSM88022     4  0.1121      0.826 0.000 0.000 0.000 0.956 0.044
#> GSM88034     4  0.0404      0.827 0.000 0.000 0.000 0.988 0.012
#> GSM88002     5  0.3395      1.000 0.000 0.236 0.000 0.000 0.764
#> GSM88003     5  0.3395      1.000 0.000 0.236 0.000 0.000 0.764
#> GSM88023     5  0.3395      1.000 0.000 0.236 0.000 0.000 0.764
#> GSM88026     5  0.3395      1.000 0.000 0.236 0.000 0.000 0.764
#> GSM88028     5  0.3395      1.000 0.000 0.236 0.000 0.000 0.764
#> GSM88035     5  0.3395      1.000 0.000 0.236 0.000 0.000 0.764

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.0547      0.685 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM87963     1  0.0547      0.685 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM87983     1  0.0000      0.690 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.690 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87961     1  0.0547      0.685 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM87970     1  0.3659     -0.304 0.636 0.000 0.000 0.000 0.000 0.364
#> GSM87971     1  0.3854     -0.712 0.536 0.000 0.000 0.000 0.000 0.464
#> GSM87990     1  0.1444      0.622 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM87991     1  0.0790      0.672 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM87974     6  0.3847      0.948 0.456 0.000 0.000 0.000 0.000 0.544
#> GSM87994     1  0.4118     -0.023 0.660 0.000 0.000 0.000 0.028 0.312
#> GSM87978     6  0.3838      0.964 0.448 0.000 0.000 0.000 0.000 0.552
#> GSM87979     6  0.3838      0.964 0.448 0.000 0.000 0.000 0.000 0.552
#> GSM87998     1  0.4251     -0.122 0.624 0.000 0.000 0.000 0.028 0.348
#> GSM87999     1  0.4251     -0.122 0.624 0.000 0.000 0.000 0.028 0.348
#> GSM87968     6  0.3833      0.961 0.444 0.000 0.000 0.000 0.000 0.556
#> GSM87987     1  0.4264     -0.140 0.620 0.000 0.000 0.000 0.028 0.352
#> GSM87969     6  0.4434      0.889 0.428 0.000 0.000 0.000 0.028 0.544
#> GSM87988     3  0.2971      0.904 0.000 0.000 0.844 0.000 0.052 0.104
#> GSM87989     3  0.2971      0.904 0.000 0.000 0.844 0.000 0.052 0.104
#> GSM87972     3  0.0363      0.952 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM87992     3  0.1829      0.953 0.000 0.000 0.920 0.000 0.024 0.056
#> GSM87973     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87993     3  0.1829      0.953 0.000 0.000 0.920 0.000 0.024 0.056
#> GSM87975     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87995     3  0.1829      0.953 0.000 0.000 0.920 0.000 0.024 0.056
#> GSM87976     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87977     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87996     3  0.1829      0.953 0.000 0.000 0.920 0.000 0.024 0.056
#> GSM87997     3  0.1829      0.953 0.000 0.000 0.920 0.000 0.024 0.056
#> GSM87980     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM88000     3  0.1829      0.953 0.000 0.000 0.920 0.000 0.024 0.056
#> GSM87981     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87982     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM88001     3  0.1829      0.953 0.000 0.000 0.920 0.000 0.024 0.056
#> GSM87967     3  0.0000      0.956 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87964     1  0.2969      0.258 0.776 0.000 0.000 0.000 0.000 0.224
#> GSM87965     1  0.0547      0.685 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM87966     1  0.0000      0.690 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87985     1  0.0000      0.690 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87986     1  0.0000      0.690 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM88004     2  0.0547      0.871 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM88015     2  0.0405      0.871 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM88005     2  0.0547      0.871 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM88006     2  0.0547      0.871 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM88016     2  0.0405      0.871 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM88007     2  0.0547      0.871 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM88017     2  0.1644      0.842 0.000 0.920 0.000 0.000 0.004 0.076
#> GSM88029     2  0.1700      0.840 0.000 0.916 0.000 0.000 0.004 0.080
#> GSM88008     2  0.0547      0.871 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM88009     2  0.0547      0.871 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM88018     2  0.0790      0.862 0.000 0.968 0.000 0.000 0.000 0.032
#> GSM88024     2  0.1285      0.854 0.000 0.944 0.000 0.000 0.004 0.052
#> GSM88030     2  0.6466      0.126 0.000 0.412 0.000 0.280 0.020 0.288
#> GSM88036     2  0.6466      0.126 0.000 0.412 0.000 0.280 0.020 0.288
#> GSM88010     4  0.3076      0.603 0.000 0.240 0.000 0.760 0.000 0.000
#> GSM88011     4  0.3050      0.608 0.000 0.236 0.000 0.764 0.000 0.000
#> GSM88019     4  0.3629      0.558 0.000 0.276 0.000 0.712 0.000 0.012
#> GSM88027     4  0.3575      0.550 0.000 0.284 0.000 0.708 0.000 0.008
#> GSM88031     4  0.3558      0.811 0.000 0.000 0.000 0.760 0.028 0.212
#> GSM88012     4  0.0000      0.786 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88020     4  0.3720      0.801 0.000 0.000 0.000 0.736 0.028 0.236
#> GSM88032     4  0.3558      0.811 0.000 0.000 0.000 0.760 0.028 0.212
#> GSM88037     4  0.3558      0.811 0.000 0.000 0.000 0.760 0.028 0.212
#> GSM88013     4  0.0000      0.786 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88021     4  0.3558      0.811 0.000 0.000 0.000 0.760 0.028 0.212
#> GSM88025     4  0.3558      0.811 0.000 0.000 0.000 0.760 0.028 0.212
#> GSM88033     4  0.3558      0.811 0.000 0.000 0.000 0.760 0.028 0.212
#> GSM88014     4  0.0000      0.786 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88022     4  0.0000      0.786 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88034     4  0.3911      0.786 0.000 0.000 0.000 0.712 0.032 0.256
#> GSM88002     5  0.1663      1.000 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM88003     5  0.1663      1.000 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM88023     5  0.1663      1.000 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM88026     5  0.1663      1.000 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM88028     5  0.1663      1.000 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM88035     5  0.1663      1.000 0.000 0.088 0.000 0.000 0.912 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 cell.line(p) agent(p)  time(p) k
#> MAD:skmeans 77     1.27e-17 3.00e-14 3.61e-01 2
#> MAD:skmeans 77     1.90e-17 1.77e-15 3.80e-03 3
#> MAD:skmeans 75     3.62e-16 4.17e-15 4.59e-06 4
#> MAD:skmeans 75     1.99e-15 4.00e-21 4.90e-09 5
#> MAD:skmeans 68     2.67e-13 2.21e-23 5.58e-11 6

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


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

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

collect_plots(res)

plot of chunk MAD-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.996       0.998         0.5047 0.496   0.496
#> 3 3 1.000           0.965       0.986         0.2834 0.857   0.712
#> 4 4 0.844           0.781       0.896         0.1365 0.889   0.686
#> 5 5 0.949           0.920       0.967         0.0649 0.933   0.743
#> 6 6 0.941           0.911       0.957         0.0562 0.941   0.733

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

There is also optional best \(k\) = 2 3 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
#> GSM87962     1   0.000      1.000 1.000 0.000
#> GSM87963     1   0.000      1.000 1.000 0.000
#> GSM87983     1   0.000      1.000 1.000 0.000
#> GSM87984     1   0.000      1.000 1.000 0.000
#> GSM87961     1   0.000      1.000 1.000 0.000
#> GSM87970     1   0.000      1.000 1.000 0.000
#> GSM87971     1   0.000      1.000 1.000 0.000
#> GSM87990     1   0.000      1.000 1.000 0.000
#> GSM87991     1   0.000      1.000 1.000 0.000
#> GSM87974     1   0.000      1.000 1.000 0.000
#> GSM87994     1   0.000      1.000 1.000 0.000
#> GSM87978     1   0.000      1.000 1.000 0.000
#> GSM87979     1   0.000      1.000 1.000 0.000
#> GSM87998     1   0.000      1.000 1.000 0.000
#> GSM87999     1   0.000      1.000 1.000 0.000
#> GSM87968     1   0.000      1.000 1.000 0.000
#> GSM87987     1   0.000      1.000 1.000 0.000
#> GSM87969     1   0.000      1.000 1.000 0.000
#> GSM87988     1   0.000      1.000 1.000 0.000
#> GSM87989     1   0.000      1.000 1.000 0.000
#> GSM87972     1   0.000      1.000 1.000 0.000
#> GSM87992     1   0.000      1.000 1.000 0.000
#> GSM87973     1   0.000      1.000 1.000 0.000
#> GSM87993     1   0.000      1.000 1.000 0.000
#> GSM87975     1   0.000      1.000 1.000 0.000
#> GSM87995     1   0.000      1.000 1.000 0.000
#> GSM87976     1   0.000      1.000 1.000 0.000
#> GSM87977     1   0.000      1.000 1.000 0.000
#> GSM87996     1   0.000      1.000 1.000 0.000
#> GSM87997     1   0.000      1.000 1.000 0.000
#> GSM87980     1   0.000      1.000 1.000 0.000
#> GSM88000     1   0.000      1.000 1.000 0.000
#> GSM87981     1   0.000      1.000 1.000 0.000
#> GSM87982     1   0.000      1.000 1.000 0.000
#> GSM88001     1   0.000      1.000 1.000 0.000
#> GSM87967     1   0.000      1.000 1.000 0.000
#> GSM87964     1   0.000      1.000 1.000 0.000
#> GSM87965     1   0.000      1.000 1.000 0.000
#> GSM87966     1   0.000      1.000 1.000 0.000
#> GSM87985     1   0.000      1.000 1.000 0.000
#> GSM87986     1   0.000      1.000 1.000 0.000
#> GSM88004     2   0.000      0.996 0.000 1.000
#> GSM88015     2   0.000      0.996 0.000 1.000
#> GSM88005     2   0.000      0.996 0.000 1.000
#> GSM88006     2   0.000      0.996 0.000 1.000
#> GSM88016     2   0.000      0.996 0.000 1.000
#> GSM88007     2   0.000      0.996 0.000 1.000
#> GSM88017     2   0.000      0.996 0.000 1.000
#> GSM88029     2   0.000      0.996 0.000 1.000
#> GSM88008     2   0.000      0.996 0.000 1.000
#> GSM88009     2   0.000      0.996 0.000 1.000
#> GSM88018     2   0.000      0.996 0.000 1.000
#> GSM88024     2   0.000      0.996 0.000 1.000
#> GSM88030     2   0.000      0.996 0.000 1.000
#> GSM88036     2   0.000      0.996 0.000 1.000
#> GSM88010     2   0.000      0.996 0.000 1.000
#> GSM88011     2   0.000      0.996 0.000 1.000
#> GSM88019     2   0.000      0.996 0.000 1.000
#> GSM88027     2   0.000      0.996 0.000 1.000
#> GSM88031     2   0.000      0.996 0.000 1.000
#> GSM88012     2   0.000      0.996 0.000 1.000
#> GSM88020     2   0.000      0.996 0.000 1.000
#> GSM88032     2   0.000      0.996 0.000 1.000
#> GSM88037     2   0.000      0.996 0.000 1.000
#> GSM88013     2   0.000      0.996 0.000 1.000
#> GSM88021     2   0.000      0.996 0.000 1.000
#> GSM88025     2   0.000      0.996 0.000 1.000
#> GSM88033     2   0.000      0.996 0.000 1.000
#> GSM88014     2   0.000      0.996 0.000 1.000
#> GSM88022     2   0.000      0.996 0.000 1.000
#> GSM88034     2   0.563      0.848 0.132 0.868
#> GSM88002     2   0.000      0.996 0.000 1.000
#> GSM88003     2   0.000      0.996 0.000 1.000
#> GSM88023     2   0.000      0.996 0.000 1.000
#> GSM88026     2   0.000      0.996 0.000 1.000
#> GSM88028     2   0.000      0.996 0.000 1.000
#> GSM88035     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
#> GSM87962     1  0.0000      0.969 1.000  0 0.000
#> GSM87963     1  0.0000      0.969 1.000  0 0.000
#> GSM87983     1  0.0000      0.969 1.000  0 0.000
#> GSM87984     1  0.0000      0.969 1.000  0 0.000
#> GSM87961     1  0.0000      0.969 1.000  0 0.000
#> GSM87970     1  0.0000      0.969 1.000  0 0.000
#> GSM87971     1  0.0000      0.969 1.000  0 0.000
#> GSM87990     1  0.0000      0.969 1.000  0 0.000
#> GSM87991     1  0.0000      0.969 1.000  0 0.000
#> GSM87974     1  0.0000      0.969 1.000  0 0.000
#> GSM87994     1  0.0000      0.969 1.000  0 0.000
#> GSM87978     1  0.0000      0.969 1.000  0 0.000
#> GSM87979     1  0.0000      0.969 1.000  0 0.000
#> GSM87998     1  0.5178      0.656 0.744  0 0.256
#> GSM87999     1  0.5905      0.465 0.648  0 0.352
#> GSM87968     1  0.0000      0.969 1.000  0 0.000
#> GSM87987     3  0.6192      0.260 0.420  0 0.580
#> GSM87969     1  0.0592      0.959 0.988  0 0.012
#> GSM87988     3  0.0000      0.976 0.000  0 1.000
#> GSM87989     3  0.0000      0.976 0.000  0 1.000
#> GSM87972     3  0.0000      0.976 0.000  0 1.000
#> GSM87992     3  0.0000      0.976 0.000  0 1.000
#> GSM87973     3  0.0000      0.976 0.000  0 1.000
#> GSM87993     3  0.0000      0.976 0.000  0 1.000
#> GSM87975     3  0.0000      0.976 0.000  0 1.000
#> GSM87995     3  0.0000      0.976 0.000  0 1.000
#> GSM87976     3  0.0000      0.976 0.000  0 1.000
#> GSM87977     3  0.0000      0.976 0.000  0 1.000
#> GSM87996     3  0.0000      0.976 0.000  0 1.000
#> GSM87997     3  0.0000      0.976 0.000  0 1.000
#> GSM87980     3  0.0000      0.976 0.000  0 1.000
#> GSM88000     3  0.0000      0.976 0.000  0 1.000
#> GSM87981     3  0.0000      0.976 0.000  0 1.000
#> GSM87982     3  0.0000      0.976 0.000  0 1.000
#> GSM88001     3  0.0000      0.976 0.000  0 1.000
#> GSM87967     3  0.0000      0.976 0.000  0 1.000
#> GSM87964     1  0.0000      0.969 1.000  0 0.000
#> GSM87965     1  0.0000      0.969 1.000  0 0.000
#> GSM87966     1  0.0000      0.969 1.000  0 0.000
#> GSM87985     1  0.0000      0.969 1.000  0 0.000
#> GSM87986     1  0.0000      0.969 1.000  0 0.000
#> GSM88004     2  0.0000      1.000 0.000  1 0.000
#> GSM88015     2  0.0000      1.000 0.000  1 0.000
#> GSM88005     2  0.0000      1.000 0.000  1 0.000
#> GSM88006     2  0.0000      1.000 0.000  1 0.000
#> GSM88016     2  0.0000      1.000 0.000  1 0.000
#> GSM88007     2  0.0000      1.000 0.000  1 0.000
#> GSM88017     2  0.0000      1.000 0.000  1 0.000
#> GSM88029     2  0.0000      1.000 0.000  1 0.000
#> GSM88008     2  0.0000      1.000 0.000  1 0.000
#> GSM88009     2  0.0000      1.000 0.000  1 0.000
#> GSM88018     2  0.0000      1.000 0.000  1 0.000
#> GSM88024     2  0.0000      1.000 0.000  1 0.000
#> GSM88030     2  0.0000      1.000 0.000  1 0.000
#> GSM88036     2  0.0000      1.000 0.000  1 0.000
#> GSM88010     2  0.0000      1.000 0.000  1 0.000
#> GSM88011     2  0.0000      1.000 0.000  1 0.000
#> GSM88019     2  0.0000      1.000 0.000  1 0.000
#> GSM88027     2  0.0000      1.000 0.000  1 0.000
#> GSM88031     2  0.0000      1.000 0.000  1 0.000
#> GSM88012     2  0.0000      1.000 0.000  1 0.000
#> GSM88020     2  0.0000      1.000 0.000  1 0.000
#> GSM88032     2  0.0000      1.000 0.000  1 0.000
#> GSM88037     2  0.0000      1.000 0.000  1 0.000
#> GSM88013     2  0.0000      1.000 0.000  1 0.000
#> GSM88021     2  0.0000      1.000 0.000  1 0.000
#> GSM88025     2  0.0000      1.000 0.000  1 0.000
#> GSM88033     2  0.0000      1.000 0.000  1 0.000
#> GSM88014     2  0.0000      1.000 0.000  1 0.000
#> GSM88022     2  0.0000      1.000 0.000  1 0.000
#> GSM88034     2  0.0000      1.000 0.000  1 0.000
#> GSM88002     2  0.0000      1.000 0.000  1 0.000
#> GSM88003     2  0.0000      1.000 0.000  1 0.000
#> GSM88023     2  0.0000      1.000 0.000  1 0.000
#> GSM88026     2  0.0000      1.000 0.000  1 0.000
#> GSM88028     2  0.0000      1.000 0.000  1 0.000
#> GSM88035     2  0.0000      1.000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87983     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87961     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87970     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87971     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87990     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87991     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87974     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87994     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87978     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87979     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87998     1  0.4103     0.6557 0.744 0.000 0.256 0.000
#> GSM87999     1  0.4679     0.4650 0.648 0.000 0.352 0.000
#> GSM87968     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87987     3  0.4907     0.2599 0.420 0.000 0.580 0.000
#> GSM87969     1  0.0469     0.9590 0.988 0.000 0.012 0.000
#> GSM87988     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87989     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87972     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87992     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87995     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87977     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87996     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM88000     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0000     0.9750 0.000 0.000 1.000 0.000
#> GSM87964     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87965     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87966     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87985     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM87986     1  0.0000     0.9691 1.000 0.000 0.000 0.000
#> GSM88004     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88015     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88005     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88006     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88016     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88007     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88017     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88029     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88008     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88009     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88018     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88024     2  0.4776     0.7053 0.000 0.624 0.000 0.376
#> GSM88030     4  0.3873     0.4909 0.000 0.228 0.000 0.772
#> GSM88036     4  0.4134     0.4258 0.000 0.260 0.000 0.740
#> GSM88010     4  0.4916    -0.0697 0.000 0.424 0.000 0.576
#> GSM88011     4  0.4855     0.0469 0.000 0.400 0.000 0.600
#> GSM88019     4  0.4605     0.2581 0.000 0.336 0.000 0.664
#> GSM88027     4  0.4790     0.1244 0.000 0.380 0.000 0.620
#> GSM88031     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88012     4  0.4830     0.0806 0.000 0.392 0.000 0.608
#> GSM88020     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88032     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88013     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88021     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88014     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88022     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88034     4  0.0000     0.7739 0.000 0.000 0.000 1.000
#> GSM88002     2  0.0000     0.5813 0.000 1.000 0.000 0.000
#> GSM88003     2  0.0000     0.5813 0.000 1.000 0.000 0.000
#> GSM88023     2  0.0000     0.5813 0.000 1.000 0.000 0.000
#> GSM88026     2  0.0000     0.5813 0.000 1.000 0.000 0.000
#> GSM88028     2  0.0000     0.5813 0.000 1.000 0.000 0.000
#> GSM88035     2  0.0000     0.5813 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
#> GSM87962     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87963     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87983     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87984     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87961     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87970     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87971     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87990     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87991     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87974     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87994     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87978     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87979     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87998     1  0.3534      0.649 0.744 0.000 0.256 0.000  0
#> GSM87999     1  0.4030      0.465 0.648 0.000 0.352 0.000  0
#> GSM87968     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87987     3  0.4227      0.260 0.420 0.000 0.580 0.000  0
#> GSM87969     1  0.0404      0.953 0.988 0.000 0.012 0.000  0
#> GSM87988     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87989     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87972     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87992     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87973     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87993     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87975     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87995     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87976     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87977     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87996     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87997     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87980     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM88000     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87981     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87982     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM88001     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87967     3  0.0000      0.970 0.000 0.000 1.000 0.000  0
#> GSM87964     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87965     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87966     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87985     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM87986     1  0.0000      0.964 1.000 0.000 0.000 0.000  0
#> GSM88004     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88015     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88005     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88006     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88016     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88007     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88017     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88029     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88008     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88009     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88018     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88024     2  0.0000      0.946 0.000 1.000 0.000 0.000  0
#> GSM88030     4  0.3816      0.578 0.000 0.304 0.000 0.696  0
#> GSM88036     4  0.4088      0.455 0.000 0.368 0.000 0.632  0
#> GSM88010     2  0.1410      0.913 0.000 0.940 0.000 0.060  0
#> GSM88011     2  0.2561      0.849 0.000 0.856 0.000 0.144  0
#> GSM88019     2  0.3534      0.704 0.000 0.744 0.000 0.256  0
#> GSM88027     2  0.2891      0.817 0.000 0.824 0.000 0.176  0
#> GSM88031     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88012     2  0.2690      0.838 0.000 0.844 0.000 0.156  0
#> GSM88020     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88032     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88037     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88013     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88021     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88025     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88033     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88014     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88022     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88034     4  0.0000      0.932 0.000 0.000 0.000 1.000  0
#> GSM88002     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88003     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88023     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88026     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88028     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88035     5  0.0000      1.000 0.000 0.000 0.000 0.000  1

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4 p5    p6
#> GSM87962     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87963     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87983     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87984     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87961     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87970     6  0.1007      0.965 0.044 0.000 0.000 0.000  0 0.956
#> GSM87971     6  0.1007      0.965 0.044 0.000 0.000 0.000  0 0.956
#> GSM87990     1  0.3797      0.287 0.580 0.000 0.000 0.000  0 0.420
#> GSM87991     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87974     6  0.1007      0.965 0.044 0.000 0.000 0.000  0 0.956
#> GSM87994     1  0.3797      0.287 0.580 0.000 0.000 0.000  0 0.420
#> GSM87978     6  0.1007      0.965 0.044 0.000 0.000 0.000  0 0.956
#> GSM87979     6  0.1007      0.965 0.044 0.000 0.000 0.000  0 0.956
#> GSM87998     6  0.1151      0.940 0.012 0.000 0.032 0.000  0 0.956
#> GSM87999     6  0.2255      0.886 0.028 0.000 0.080 0.000  0 0.892
#> GSM87968     6  0.1007      0.965 0.044 0.000 0.000 0.000  0 0.956
#> GSM87987     6  0.1007      0.965 0.044 0.000 0.000 0.000  0 0.956
#> GSM87969     6  0.1007      0.965 0.044 0.000 0.000 0.000  0 0.956
#> GSM87988     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87989     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87972     6  0.1007      0.928 0.000 0.000 0.044 0.000  0 0.956
#> GSM87992     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87973     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87993     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87975     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87995     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87976     3  0.2340      0.819 0.000 0.000 0.852 0.000  0 0.148
#> GSM87977     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87996     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87997     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87980     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM88000     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87981     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87982     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM88001     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87967     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> GSM87964     6  0.2597      0.815 0.176 0.000 0.000 0.000  0 0.824
#> GSM87965     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87966     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87985     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM87986     1  0.0000      0.910 1.000 0.000 0.000 0.000  0 0.000
#> GSM88004     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88015     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88005     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88006     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88016     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88007     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88017     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88029     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88008     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88009     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88018     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88024     2  0.0000      0.944 0.000 1.000 0.000 0.000  0 0.000
#> GSM88030     4  0.3934      0.558 0.000 0.304 0.000 0.676  0 0.020
#> GSM88036     4  0.4155      0.440 0.000 0.364 0.000 0.616  0 0.020
#> GSM88010     2  0.1267      0.911 0.000 0.940 0.000 0.060  0 0.000
#> GSM88011     2  0.2911      0.832 0.000 0.832 0.000 0.144  0 0.024
#> GSM88019     2  0.3175      0.703 0.000 0.744 0.000 0.256  0 0.000
#> GSM88027     2  0.2597      0.816 0.000 0.824 0.000 0.176  0 0.000
#> GSM88031     4  0.0000      0.925 0.000 0.000 0.000 1.000  0 0.000
#> GSM88012     2  0.3025      0.820 0.000 0.820 0.000 0.156  0 0.024
#> GSM88020     4  0.0000      0.925 0.000 0.000 0.000 1.000  0 0.000
#> GSM88032     4  0.0000      0.925 0.000 0.000 0.000 1.000  0 0.000
#> GSM88037     4  0.0000      0.925 0.000 0.000 0.000 1.000  0 0.000
#> GSM88013     4  0.0632      0.916 0.000 0.000 0.000 0.976  0 0.024
#> GSM88021     4  0.0146      0.924 0.000 0.000 0.000 0.996  0 0.004
#> GSM88025     4  0.0000      0.925 0.000 0.000 0.000 1.000  0 0.000
#> GSM88033     4  0.0000      0.925 0.000 0.000 0.000 1.000  0 0.000
#> GSM88014     4  0.0632      0.916 0.000 0.000 0.000 0.976  0 0.024
#> GSM88022     4  0.0632      0.916 0.000 0.000 0.000 0.976  0 0.024
#> GSM88034     4  0.0000      0.925 0.000 0.000 0.000 1.000  0 0.000
#> GSM88002     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88003     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88023     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88026     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88028     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> GSM88035     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 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 cell.line(p) agent(p)  time(p) k
#> MAD:pam 77     1.27e-17 3.00e-14 3.61e-01 2
#> MAD:pam 75     5.18e-17 1.56e-15 9.82e-03 3
#> MAD:pam 68     1.14e-14 1.77e-13 4.33e-05 4
#> MAD:pam 74     3.24e-15 2.93e-21 6.97e-07 5
#> MAD:pam 74     1.50e-14 6.02e-26 3.93e-08 6

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


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

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.999           0.987       0.992         0.2797 0.859   0.714
#> 4 4 0.900           0.879       0.925         0.1302 0.864   0.632
#> 5 5 0.998           0.966       0.985         0.0662 0.934   0.752
#> 6 6 1.000           0.979       0.991         0.0369 0.973   0.875

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

There is also optional best \(k\) = 2 3 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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      0.976 1.000  0 0.000
#> GSM87963     1  0.0000      0.976 1.000  0 0.000
#> GSM87983     1  0.0000      0.976 1.000  0 0.000
#> GSM87984     1  0.0000      0.976 1.000  0 0.000
#> GSM87961     1  0.0000      0.976 1.000  0 0.000
#> GSM87970     1  0.0000      0.976 1.000  0 0.000
#> GSM87971     1  0.0000      0.976 1.000  0 0.000
#> GSM87990     1  0.0000      0.976 1.000  0 0.000
#> GSM87991     1  0.0000      0.976 1.000  0 0.000
#> GSM87974     1  0.0000      0.976 1.000  0 0.000
#> GSM87994     1  0.2537      0.922 0.920  0 0.080
#> GSM87978     1  0.0000      0.976 1.000  0 0.000
#> GSM87979     1  0.0000      0.976 1.000  0 0.000
#> GSM87998     1  0.3192      0.896 0.888  0 0.112
#> GSM87999     1  0.3192      0.896 0.888  0 0.112
#> GSM87968     1  0.0000      0.976 1.000  0 0.000
#> GSM87987     1  0.3192      0.896 0.888  0 0.112
#> GSM87969     1  0.3192      0.896 0.888  0 0.112
#> GSM87988     3  0.0892      0.981 0.020  0 0.980
#> GSM87989     3  0.0892      0.981 0.020  0 0.980
#> GSM87972     3  0.0592      0.988 0.012  0 0.988
#> GSM87992     3  0.0000      0.997 0.000  0 1.000
#> GSM87973     3  0.0000      0.997 0.000  0 1.000
#> GSM87993     3  0.0000      0.997 0.000  0 1.000
#> GSM87975     3  0.0000      0.997 0.000  0 1.000
#> GSM87995     3  0.0000      0.997 0.000  0 1.000
#> GSM87976     3  0.0000      0.997 0.000  0 1.000
#> GSM87977     3  0.0000      0.997 0.000  0 1.000
#> GSM87996     3  0.0000      0.997 0.000  0 1.000
#> GSM87997     3  0.0000      0.997 0.000  0 1.000
#> GSM87980     3  0.0000      0.997 0.000  0 1.000
#> GSM88000     3  0.0000      0.997 0.000  0 1.000
#> GSM87981     3  0.0000      0.997 0.000  0 1.000
#> GSM87982     3  0.0000      0.997 0.000  0 1.000
#> GSM88001     3  0.0000      0.997 0.000  0 1.000
#> GSM87967     3  0.0000      0.997 0.000  0 1.000
#> GSM87964     1  0.0000      0.976 1.000  0 0.000
#> GSM87965     1  0.0000      0.976 1.000  0 0.000
#> GSM87966     1  0.0000      0.976 1.000  0 0.000
#> GSM87985     1  0.0000      0.976 1.000  0 0.000
#> GSM87986     1  0.0000      0.976 1.000  0 0.000
#> GSM88004     2  0.0000      1.000 0.000  1 0.000
#> GSM88015     2  0.0000      1.000 0.000  1 0.000
#> GSM88005     2  0.0000      1.000 0.000  1 0.000
#> GSM88006     2  0.0000      1.000 0.000  1 0.000
#> GSM88016     2  0.0000      1.000 0.000  1 0.000
#> GSM88007     2  0.0000      1.000 0.000  1 0.000
#> GSM88017     2  0.0000      1.000 0.000  1 0.000
#> GSM88029     2  0.0000      1.000 0.000  1 0.000
#> GSM88008     2  0.0000      1.000 0.000  1 0.000
#> GSM88009     2  0.0000      1.000 0.000  1 0.000
#> GSM88018     2  0.0000      1.000 0.000  1 0.000
#> GSM88024     2  0.0000      1.000 0.000  1 0.000
#> GSM88030     2  0.0000      1.000 0.000  1 0.000
#> GSM88036     2  0.0000      1.000 0.000  1 0.000
#> GSM88010     2  0.0000      1.000 0.000  1 0.000
#> GSM88011     2  0.0000      1.000 0.000  1 0.000
#> GSM88019     2  0.0000      1.000 0.000  1 0.000
#> GSM88027     2  0.0000      1.000 0.000  1 0.000
#> GSM88031     2  0.0000      1.000 0.000  1 0.000
#> GSM88012     2  0.0000      1.000 0.000  1 0.000
#> GSM88020     2  0.0000      1.000 0.000  1 0.000
#> GSM88032     2  0.0000      1.000 0.000  1 0.000
#> GSM88037     2  0.0000      1.000 0.000  1 0.000
#> GSM88013     2  0.0000      1.000 0.000  1 0.000
#> GSM88021     2  0.0000      1.000 0.000  1 0.000
#> GSM88025     2  0.0000      1.000 0.000  1 0.000
#> GSM88033     2  0.0000      1.000 0.000  1 0.000
#> GSM88014     2  0.0000      1.000 0.000  1 0.000
#> GSM88022     2  0.0000      1.000 0.000  1 0.000
#> GSM88034     2  0.0000      1.000 0.000  1 0.000
#> GSM88002     2  0.0000      1.000 0.000  1 0.000
#> GSM88003     2  0.0000      1.000 0.000  1 0.000
#> GSM88023     2  0.0000      1.000 0.000  1 0.000
#> GSM88026     2  0.0000      1.000 0.000  1 0.000
#> GSM88028     2  0.0000      1.000 0.000  1 0.000
#> GSM88035     2  0.0000      1.000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87983     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87961     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87970     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87971     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87990     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87991     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87974     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87994     1  0.0188      0.979 0.996 0.000 0.004 0.000
#> GSM87978     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87979     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87998     1  0.0188      0.979 0.996 0.000 0.004 0.000
#> GSM87999     1  0.0188      0.979 0.996 0.000 0.004 0.000
#> GSM87968     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87987     1  0.0188      0.979 0.996 0.000 0.004 0.000
#> GSM87969     1  0.0188      0.979 0.996 0.000 0.004 0.000
#> GSM87988     1  0.2814      0.842 0.868 0.000 0.132 0.000
#> GSM87989     1  0.4331      0.594 0.712 0.000 0.288 0.000
#> GSM87972     3  0.4250      0.605 0.276 0.000 0.724 0.000
#> GSM87992     3  0.0817      0.953 0.024 0.000 0.976 0.000
#> GSM87973     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87995     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87977     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87996     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM88000     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0000      0.976 0.000 0.000 1.000 0.000
#> GSM87964     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87965     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87966     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87985     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM87986     1  0.0000      0.981 1.000 0.000 0.000 0.000
#> GSM88004     2  0.4981      0.619 0.000 0.536 0.000 0.464
#> GSM88015     2  0.4916      0.674 0.000 0.576 0.000 0.424
#> GSM88005     2  0.4916      0.674 0.000 0.576 0.000 0.424
#> GSM88006     2  0.4916      0.674 0.000 0.576 0.000 0.424
#> GSM88016     2  0.4925      0.668 0.000 0.572 0.000 0.428
#> GSM88007     2  0.4916      0.674 0.000 0.576 0.000 0.424
#> GSM88017     2  0.4925      0.668 0.000 0.572 0.000 0.428
#> GSM88029     2  0.4916      0.674 0.000 0.576 0.000 0.424
#> GSM88008     2  0.4916      0.674 0.000 0.576 0.000 0.424
#> GSM88009     2  0.4916      0.674 0.000 0.576 0.000 0.424
#> GSM88018     4  0.1557      0.889 0.000 0.056 0.000 0.944
#> GSM88024     4  0.4898     -0.272 0.000 0.416 0.000 0.584
#> GSM88030     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88036     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88010     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88011     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88019     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88027     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88031     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88012     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88020     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88032     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88013     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88021     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88014     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88022     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88034     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM88002     2  0.1211      0.640 0.000 0.960 0.000 0.040
#> GSM88003     2  0.1211      0.640 0.000 0.960 0.000 0.040
#> GSM88023     2  0.1211      0.640 0.000 0.960 0.000 0.040
#> GSM88026     2  0.1211      0.640 0.000 0.960 0.000 0.040
#> GSM88028     2  0.1211      0.640 0.000 0.960 0.000 0.040
#> GSM88035     2  0.1211      0.640 0.000 0.960 0.000 0.040

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4 p5
#> GSM87962     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87963     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87983     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87984     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87961     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87970     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87971     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87990     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87991     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87974     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87994     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87978     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87979     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87998     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87999     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87968     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87987     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87969     1  0.0162      0.996 0.996 0.000 0.004 0.000  0
#> GSM87988     3  0.3534      0.659 0.256 0.000 0.744 0.000  0
#> GSM87989     3  0.3534      0.659 0.256 0.000 0.744 0.000  0
#> GSM87972     3  0.2605      0.795 0.148 0.000 0.852 0.000  0
#> GSM87992     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87973     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87993     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87975     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87995     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87976     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87977     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87996     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87997     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87980     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM88000     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87981     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87982     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM88001     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87967     3  0.0000      0.948 0.000 0.000 1.000 0.000  0
#> GSM87964     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87965     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87966     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87985     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM87986     1  0.0000      0.999 1.000 0.000 0.000 0.000  0
#> GSM88004     2  0.2471      0.836 0.000 0.864 0.000 0.136  0
#> GSM88015     2  0.0000      0.947 0.000 1.000 0.000 0.000  0
#> GSM88005     2  0.0000      0.947 0.000 1.000 0.000 0.000  0
#> GSM88006     2  0.0000      0.947 0.000 1.000 0.000 0.000  0
#> GSM88016     2  0.1608      0.915 0.000 0.928 0.000 0.072  0
#> GSM88007     2  0.0000      0.947 0.000 1.000 0.000 0.000  0
#> GSM88017     2  0.0000      0.947 0.000 1.000 0.000 0.000  0
#> GSM88029     2  0.1732      0.904 0.000 0.920 0.000 0.080  0
#> GSM88008     2  0.0000      0.947 0.000 1.000 0.000 0.000  0
#> GSM88009     2  0.0000      0.947 0.000 1.000 0.000 0.000  0
#> GSM88018     2  0.1732      0.904 0.000 0.920 0.000 0.080  0
#> GSM88024     2  0.1671      0.911 0.000 0.924 0.000 0.076  0
#> GSM88030     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88036     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88010     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88011     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88019     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88027     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88031     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88012     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88020     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88032     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88037     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88013     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88021     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88025     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88033     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88014     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88022     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88034     4  0.0000      1.000 0.000 0.000 0.000 1.000  0
#> GSM88002     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88003     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88023     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88026     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88028     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM88035     5  0.0000      1.000 0.000 0.000 0.000 0.000  1

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1 p2    p3    p4 p5    p6
#> GSM87962     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87963     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87983     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87984     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87961     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87970     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87971     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87990     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87991     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87974     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87994     1  0.0146      0.997 0.996  0 0.000 0.000  0 0.004
#> GSM87978     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87979     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87998     1  0.0146      0.997 0.996  0 0.000 0.000  0 0.004
#> GSM87999     1  0.0146      0.997 0.996  0 0.000 0.000  0 0.004
#> GSM87968     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87987     1  0.0146      0.997 0.996  0 0.000 0.000  0 0.004
#> GSM87969     1  0.0146      0.997 0.996  0 0.000 0.000  0 0.004
#> GSM87988     3  0.3652      0.534 0.324  0 0.672 0.000  0 0.004
#> GSM87989     3  0.2442      0.798 0.144  0 0.852 0.000  0 0.004
#> GSM87972     3  0.2006      0.847 0.104  0 0.892 0.000  0 0.004
#> GSM87992     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87973     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87993     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87975     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87995     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87976     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87977     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87996     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87997     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87980     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM88000     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87981     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87982     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM88001     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87967     3  0.0000      0.955 0.000  0 1.000 0.000  0 0.000
#> GSM87964     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87965     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87966     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87985     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM87986     1  0.0000      0.999 1.000  0 0.000 0.000  0 0.000
#> GSM88004     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88015     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88005     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88006     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88016     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88007     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88017     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88029     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88008     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88009     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88018     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88024     2  0.0000      1.000 0.000  1 0.000 0.000  0 0.000
#> GSM88030     4  0.0000      0.991 0.000  0 0.000 1.000  0 0.000
#> GSM88036     4  0.0000      0.991 0.000  0 0.000 1.000  0 0.000
#> GSM88010     4  0.0000      0.991 0.000  0 0.000 1.000  0 0.000
#> GSM88011     4  0.0000      0.991 0.000  0 0.000 1.000  0 0.000
#> GSM88019     4  0.0000      0.991 0.000  0 0.000 1.000  0 0.000
#> GSM88027     4  0.0000      0.991 0.000  0 0.000 1.000  0 0.000
#> GSM88031     6  0.0146      1.000 0.000  0 0.000 0.004  0 0.996
#> GSM88012     4  0.0000      0.991 0.000  0 0.000 1.000  0 0.000
#> GSM88020     6  0.0146      1.000 0.000  0 0.000 0.004  0 0.996
#> GSM88032     6  0.0146      1.000 0.000  0 0.000 0.004  0 0.996
#> GSM88037     6  0.0146      1.000 0.000  0 0.000 0.004  0 0.996
#> GSM88013     4  0.0632      0.980 0.000  0 0.000 0.976  0 0.024
#> GSM88021     6  0.0146      1.000 0.000  0 0.000 0.004  0 0.996
#> GSM88025     6  0.0146      1.000 0.000  0 0.000 0.004  0 0.996
#> GSM88033     6  0.0146      1.000 0.000  0 0.000 0.004  0 0.996
#> GSM88014     4  0.0632      0.980 0.000  0 0.000 0.976  0 0.024
#> GSM88022     4  0.0632      0.980 0.000  0 0.000 0.976  0 0.024
#> GSM88034     6  0.0146      1.000 0.000  0 0.000 0.004  0 0.996
#> GSM88002     5  0.0000      1.000 0.000  0 0.000 0.000  1 0.000
#> GSM88003     5  0.0000      1.000 0.000  0 0.000 0.000  1 0.000
#> GSM88023     5  0.0000      1.000 0.000  0 0.000 0.000  1 0.000
#> GSM88026     5  0.0000      1.000 0.000  0 0.000 0.000  1 0.000
#> GSM88028     5  0.0000      1.000 0.000  0 0.000 0.000  1 0.000
#> GSM88035     5  0.0000      1.000 0.000  0 0.000 0.000  1 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 cell.line(p) agent(p)  time(p) k
#> MAD:mclust 77     1.27e-17 3.00e-14 3.61e-01 2
#> MAD:mclust 77     1.90e-17 1.77e-15 3.80e-03 3
#> MAD:mclust 76     2.21e-16 2.45e-15 1.46e-05 4
#> MAD:mclust 77     7.52e-16 8.50e-22 1.27e-08 5
#> MAD:mclust 77     3.56e-15 2.90e-20 8.56e-08 6

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


MAD:NMF**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 18792 rows and 77 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           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.723           0.759       0.771         0.2398 0.895   0.788
#> 4 4 0.863           0.879       0.938         0.1712 0.837   0.603
#> 5 5 0.767           0.840       0.869         0.0614 0.863   0.558
#> 6 6 0.838           0.800       0.890         0.0329 0.971   0.873

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87963     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87983     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87984     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87961     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87970     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87971     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87990     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87991     1  0.0747     0.7444 0.984 0.016 0.000
#> GSM87974     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87994     1  0.6045     0.7923 0.620 0.380 0.000
#> GSM87978     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87979     1  0.0237     0.7424 0.996 0.004 0.000
#> GSM87998     1  0.6204     0.7958 0.576 0.424 0.000
#> GSM87999     1  0.6225     0.7961 0.568 0.432 0.000
#> GSM87968     1  0.0592     0.7438 0.988 0.012 0.000
#> GSM87987     1  0.6235     0.7962 0.564 0.436 0.000
#> GSM87969     1  0.6140     0.7949 0.596 0.404 0.000
#> GSM87988     1  0.6291     0.7957 0.532 0.468 0.000
#> GSM87989     1  0.6291     0.7957 0.532 0.468 0.000
#> GSM87972     1  0.6291     0.7957 0.532 0.468 0.000
#> GSM87992     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87973     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87993     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87975     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87995     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87976     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87977     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87996     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87997     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87980     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM88000     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87981     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87982     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM88001     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87967     1  0.6295     0.7953 0.528 0.472 0.000
#> GSM87964     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87965     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87966     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87985     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM87986     1  0.0000     0.7417 1.000 0.000 0.000
#> GSM88004     2  0.7542     0.8278 0.040 0.528 0.432
#> GSM88015     2  0.9151     0.3792 0.292 0.528 0.180
#> GSM88005     2  0.9184     0.5625 0.188 0.528 0.284
#> GSM88006     2  0.9211     0.5482 0.196 0.528 0.276
#> GSM88016     2  0.8362     0.7431 0.088 0.528 0.384
#> GSM88007     2  0.7627     0.8216 0.044 0.528 0.428
#> GSM88017     2  0.6295     0.8753 0.000 0.528 0.472
#> GSM88029     2  0.6299     0.8711 0.000 0.524 0.476
#> GSM88008     2  0.6505     0.8729 0.004 0.528 0.468
#> GSM88009     2  0.6295     0.8753 0.000 0.528 0.472
#> GSM88018     2  0.6804     0.8651 0.012 0.528 0.460
#> GSM88024     2  0.6295     0.8753 0.000 0.528 0.472
#> GSM88030     3  0.5678    -0.0391 0.000 0.316 0.684
#> GSM88036     3  0.5810    -0.1718 0.000 0.336 0.664
#> GSM88010     2  0.6302     0.8660 0.000 0.520 0.480
#> GSM88011     2  0.6302     0.8660 0.000 0.520 0.480
#> GSM88019     2  0.6309     0.8354 0.000 0.504 0.496
#> GSM88027     2  0.6302     0.8660 0.000 0.520 0.480
#> GSM88031     3  0.2165     0.7901 0.000 0.064 0.936
#> GSM88012     3  0.4702     0.4897 0.000 0.212 0.788
#> GSM88020     3  0.0000     0.8152 0.000 0.000 1.000
#> GSM88032     3  0.0000     0.8152 0.000 0.000 1.000
#> GSM88037     3  0.0000     0.8152 0.000 0.000 1.000
#> GSM88013     3  0.2537     0.7780 0.000 0.080 0.920
#> GSM88021     3  0.0000     0.8152 0.000 0.000 1.000
#> GSM88025     3  0.0000     0.8152 0.000 0.000 1.000
#> GSM88033     3  0.0000     0.8152 0.000 0.000 1.000
#> GSM88014     3  0.2537     0.7780 0.000 0.080 0.920
#> GSM88022     3  0.3752     0.6735 0.000 0.144 0.856
#> GSM88034     3  0.0237     0.8093 0.000 0.004 0.996
#> GSM88002     2  0.6295     0.8753 0.000 0.528 0.472
#> GSM88003     2  0.6295     0.8753 0.000 0.528 0.472
#> GSM88023     2  0.6295     0.8753 0.000 0.528 0.472
#> GSM88026     2  0.6295     0.8753 0.000 0.528 0.472
#> GSM88028     2  0.6295     0.8753 0.000 0.528 0.472
#> GSM88035     2  0.6295     0.8753 0.000 0.528 0.472

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.1022     0.8861 0.968 0.000 0.032 0.000
#> GSM87963     1  0.0592     0.8779 0.984 0.000 0.016 0.000
#> GSM87983     1  0.1557     0.8831 0.944 0.000 0.056 0.000
#> GSM87984     1  0.0707     0.8806 0.980 0.000 0.020 0.000
#> GSM87961     1  0.0469     0.8744 0.988 0.000 0.012 0.000
#> GSM87970     1  0.4222     0.6805 0.728 0.000 0.272 0.000
#> GSM87971     1  0.1716     0.8794 0.936 0.000 0.064 0.000
#> GSM87990     1  0.3444     0.7966 0.816 0.000 0.184 0.000
#> GSM87991     3  0.4193     0.6567 0.268 0.000 0.732 0.000
#> GSM87974     3  0.4746     0.4553 0.368 0.000 0.632 0.000
#> GSM87994     3  0.3356     0.7725 0.176 0.000 0.824 0.000
#> GSM87978     3  0.4679     0.4945 0.352 0.000 0.648 0.000
#> GSM87979     3  0.4008     0.6906 0.244 0.000 0.756 0.000
#> GSM87998     3  0.2704     0.8203 0.124 0.000 0.876 0.000
#> GSM87999     3  0.2760     0.8173 0.128 0.000 0.872 0.000
#> GSM87968     3  0.4543     0.5537 0.324 0.000 0.676 0.000
#> GSM87987     3  0.1716     0.8579 0.064 0.000 0.936 0.000
#> GSM87969     3  0.2760     0.8174 0.128 0.000 0.872 0.000
#> GSM87988     3  0.0469     0.8830 0.012 0.000 0.988 0.000
#> GSM87989     3  0.0336     0.8844 0.008 0.000 0.992 0.000
#> GSM87972     3  0.0336     0.8844 0.008 0.000 0.992 0.000
#> GSM87992     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87995     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87977     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87996     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM88000     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0000     0.8863 0.000 0.000 1.000 0.000
#> GSM87964     1  0.1022     0.8862 0.968 0.000 0.032 0.000
#> GSM87965     1  0.3975     0.7293 0.760 0.000 0.240 0.000
#> GSM87966     3  0.4994     0.0614 0.480 0.000 0.520 0.000
#> GSM87985     1  0.1118     0.8866 0.964 0.000 0.036 0.000
#> GSM87986     1  0.4500     0.5865 0.684 0.000 0.316 0.000
#> GSM88004     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0469     0.9864 0.012 0.988 0.000 0.000
#> GSM88005     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88029     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88008     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0000     0.9953 0.000 1.000 0.000 0.000
#> GSM88030     4  0.2281     0.9012 0.000 0.096 0.000 0.904
#> GSM88036     4  0.2345     0.8969 0.000 0.100 0.000 0.900
#> GSM88010     4  0.4008     0.7037 0.000 0.244 0.000 0.756
#> GSM88011     4  0.0707     0.9626 0.000 0.020 0.000 0.980
#> GSM88019     4  0.0469     0.9670 0.000 0.012 0.000 0.988
#> GSM88027     4  0.0469     0.9670 0.000 0.012 0.000 0.988
#> GSM88031     4  0.0469     0.9670 0.000 0.012 0.000 0.988
#> GSM88012     4  0.0469     0.9670 0.000 0.012 0.000 0.988
#> GSM88020     4  0.0188     0.9681 0.000 0.004 0.000 0.996
#> GSM88032     4  0.0000     0.9681 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000     0.9681 0.000 0.000 0.000 1.000
#> GSM88013     4  0.0000     0.9681 0.000 0.000 0.000 1.000
#> GSM88021     4  0.0000     0.9681 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000     0.9681 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000     0.9681 0.000 0.000 0.000 1.000
#> GSM88014     4  0.0000     0.9681 0.000 0.000 0.000 1.000
#> GSM88022     4  0.0336     0.9677 0.000 0.008 0.000 0.992
#> GSM88034     4  0.0000     0.9681 0.000 0.000 0.000 1.000
#> GSM88002     2  0.0469     0.9917 0.012 0.988 0.000 0.000
#> GSM88003     2  0.0469     0.9917 0.012 0.988 0.000 0.000
#> GSM88023     2  0.0469     0.9917 0.012 0.988 0.000 0.000
#> GSM88026     2  0.0469     0.9917 0.012 0.988 0.000 0.000
#> GSM88028     2  0.0469     0.9917 0.012 0.988 0.000 0.000
#> GSM88035     2  0.0469     0.9917 0.012 0.988 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
#> GSM87962     1  0.0898      0.848 0.972 0.000 0.008 0.000 0.020
#> GSM87963     1  0.1041      0.843 0.964 0.000 0.004 0.000 0.032
#> GSM87983     1  0.1830      0.852 0.932 0.000 0.040 0.000 0.028
#> GSM87984     1  0.1012      0.850 0.968 0.000 0.012 0.000 0.020
#> GSM87961     1  0.1282      0.840 0.952 0.000 0.004 0.000 0.044
#> GSM87970     1  0.2914      0.863 0.872 0.000 0.076 0.000 0.052
#> GSM87971     1  0.2414      0.826 0.900 0.008 0.012 0.000 0.080
#> GSM87990     1  0.1493      0.856 0.948 0.000 0.028 0.000 0.024
#> GSM87991     1  0.3274      0.810 0.780 0.000 0.220 0.000 0.000
#> GSM87974     1  0.3999      0.855 0.808 0.008 0.116 0.000 0.068
#> GSM87994     1  0.3561      0.777 0.740 0.000 0.260 0.000 0.000
#> GSM87978     1  0.4011      0.856 0.808 0.008 0.112 0.000 0.072
#> GSM87979     1  0.3710      0.853 0.808 0.000 0.144 0.000 0.048
#> GSM87998     1  0.3774      0.734 0.704 0.000 0.296 0.000 0.000
#> GSM87999     1  0.3913      0.693 0.676 0.000 0.324 0.000 0.000
#> GSM87968     1  0.4169      0.854 0.800 0.012 0.116 0.000 0.072
#> GSM87987     1  0.4227      0.497 0.580 0.000 0.420 0.000 0.000
#> GSM87969     1  0.3689      0.770 0.740 0.000 0.256 0.000 0.004
#> GSM87988     3  0.2020      0.894 0.100 0.000 0.900 0.000 0.000
#> GSM87989     3  0.1908      0.904 0.092 0.000 0.908 0.000 0.000
#> GSM87972     3  0.1282      0.951 0.044 0.000 0.952 0.000 0.004
#> GSM87992     3  0.1410      0.934 0.060 0.000 0.940 0.000 0.000
#> GSM87973     3  0.0579      0.959 0.008 0.000 0.984 0.000 0.008
#> GSM87993     3  0.0609      0.959 0.020 0.000 0.980 0.000 0.000
#> GSM87975     3  0.1907      0.938 0.044 0.000 0.928 0.000 0.028
#> GSM87995     3  0.0703      0.957 0.024 0.000 0.976 0.000 0.000
#> GSM87976     3  0.2077      0.932 0.040 0.000 0.920 0.000 0.040
#> GSM87977     3  0.1310      0.955 0.024 0.000 0.956 0.000 0.020
#> GSM87996     3  0.0794      0.954 0.028 0.000 0.972 0.000 0.000
#> GSM87997     3  0.0510      0.959 0.016 0.000 0.984 0.000 0.000
#> GSM87980     3  0.1493      0.948 0.028 0.000 0.948 0.000 0.024
#> GSM88000     3  0.0510      0.959 0.016 0.000 0.984 0.000 0.000
#> GSM87981     3  0.1582      0.946 0.028 0.000 0.944 0.000 0.028
#> GSM87982     3  0.0693      0.958 0.008 0.000 0.980 0.000 0.012
#> GSM88001     3  0.0404      0.959 0.012 0.000 0.988 0.000 0.000
#> GSM87967     3  0.0671      0.957 0.004 0.000 0.980 0.000 0.016
#> GSM87964     1  0.3077      0.806 0.864 0.028 0.008 0.000 0.100
#> GSM87965     1  0.2011      0.868 0.908 0.000 0.088 0.000 0.004
#> GSM87966     1  0.3224      0.843 0.824 0.000 0.160 0.000 0.016
#> GSM87985     1  0.1018      0.852 0.968 0.000 0.016 0.000 0.016
#> GSM87986     1  0.2388      0.861 0.900 0.000 0.072 0.000 0.028
#> GSM88004     2  0.1270      0.882 0.000 0.948 0.000 0.000 0.052
#> GSM88015     2  0.1211      0.895 0.016 0.960 0.000 0.000 0.024
#> GSM88005     2  0.0703      0.907 0.000 0.976 0.000 0.000 0.024
#> GSM88006     2  0.0510      0.908 0.000 0.984 0.000 0.000 0.016
#> GSM88016     2  0.0404      0.911 0.000 0.988 0.000 0.000 0.012
#> GSM88007     2  0.0162      0.911 0.000 0.996 0.000 0.000 0.004
#> GSM88017     2  0.2806      0.841 0.000 0.844 0.000 0.004 0.152
#> GSM88029     2  0.2930      0.840 0.000 0.832 0.000 0.004 0.164
#> GSM88008     2  0.0290      0.911 0.000 0.992 0.000 0.000 0.008
#> GSM88009     2  0.0703      0.904 0.000 0.976 0.000 0.000 0.024
#> GSM88018     2  0.2629      0.856 0.000 0.860 0.000 0.004 0.136
#> GSM88024     2  0.2389      0.868 0.000 0.880 0.000 0.004 0.116
#> GSM88030     4  0.6092      0.270 0.000 0.364 0.000 0.504 0.132
#> GSM88036     4  0.6140      0.244 0.000 0.372 0.000 0.492 0.136
#> GSM88010     4  0.4481      0.413 0.000 0.416 0.000 0.576 0.008
#> GSM88011     4  0.3983      0.560 0.000 0.340 0.000 0.660 0.000
#> GSM88019     4  0.4135      0.551 0.000 0.340 0.000 0.656 0.004
#> GSM88027     4  0.4497      0.403 0.000 0.424 0.000 0.568 0.008
#> GSM88031     4  0.0000      0.828 0.000 0.000 0.000 1.000 0.000
#> GSM88012     4  0.0510      0.827 0.000 0.016 0.000 0.984 0.000
#> GSM88020     4  0.1671      0.795 0.000 0.000 0.000 0.924 0.076
#> GSM88032     4  0.0162      0.828 0.000 0.000 0.000 0.996 0.004
#> GSM88037     4  0.0162      0.828 0.000 0.000 0.000 0.996 0.004
#> GSM88013     4  0.0451      0.828 0.000 0.008 0.000 0.988 0.004
#> GSM88021     4  0.0162      0.828 0.000 0.000 0.000 0.996 0.004
#> GSM88025     4  0.0162      0.828 0.000 0.000 0.000 0.996 0.004
#> GSM88033     4  0.0162      0.828 0.000 0.000 0.000 0.996 0.004
#> GSM88014     4  0.0451      0.828 0.000 0.008 0.000 0.988 0.004
#> GSM88022     4  0.0404      0.828 0.000 0.012 0.000 0.988 0.000
#> GSM88034     4  0.0880      0.818 0.000 0.000 0.000 0.968 0.032
#> GSM88002     5  0.3999      0.994 0.000 0.344 0.000 0.000 0.656
#> GSM88003     5  0.3999      0.994 0.000 0.344 0.000 0.000 0.656
#> GSM88023     5  0.4015      0.991 0.000 0.348 0.000 0.000 0.652
#> GSM88026     5  0.3999      0.994 0.000 0.344 0.000 0.000 0.656
#> GSM88028     5  0.3983      0.991 0.000 0.340 0.000 0.000 0.660
#> GSM88035     5  0.3983      0.991 0.000 0.340 0.000 0.000 0.660

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.0717    0.89297 0.976 0.000 0.000 0.000 0.016 0.008
#> GSM87963     1  0.0622    0.89321 0.980 0.000 0.000 0.000 0.012 0.008
#> GSM87983     1  0.2187    0.88573 0.908 0.004 0.012 0.000 0.012 0.064
#> GSM87984     1  0.1514    0.89099 0.944 0.004 0.004 0.000 0.012 0.036
#> GSM87961     1  0.0820    0.89011 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM87970     1  0.1408    0.88501 0.944 0.000 0.000 0.000 0.036 0.020
#> GSM87971     1  0.2933    0.85674 0.860 0.008 0.000 0.000 0.056 0.076
#> GSM87990     1  0.1820    0.89222 0.924 0.000 0.008 0.000 0.012 0.056
#> GSM87991     1  0.2201    0.88096 0.900 0.000 0.052 0.000 0.000 0.048
#> GSM87974     1  0.3017    0.86124 0.848 0.004 0.000 0.000 0.052 0.096
#> GSM87994     1  0.3103    0.85880 0.836 0.000 0.064 0.000 0.000 0.100
#> GSM87978     1  0.3079    0.85899 0.848 0.008 0.000 0.000 0.052 0.092
#> GSM87979     1  0.2554    0.87501 0.876 0.000 0.000 0.000 0.048 0.076
#> GSM87998     1  0.3857    0.79331 0.768 0.000 0.152 0.000 0.000 0.080
#> GSM87999     1  0.4156    0.75421 0.732 0.000 0.188 0.000 0.000 0.080
#> GSM87968     1  0.4079    0.84236 0.800 0.016 0.028 0.000 0.048 0.108
#> GSM87987     1  0.4494    0.71041 0.692 0.000 0.216 0.000 0.000 0.092
#> GSM87969     1  0.3252    0.84772 0.832 0.000 0.112 0.000 0.008 0.048
#> GSM87988     3  0.2799    0.84489 0.076 0.000 0.860 0.000 0.000 0.064
#> GSM87989     3  0.2744    0.84976 0.072 0.000 0.864 0.000 0.000 0.064
#> GSM87972     3  0.1780    0.93685 0.028 0.000 0.932 0.000 0.012 0.028
#> GSM87992     3  0.0909    0.94022 0.020 0.000 0.968 0.000 0.000 0.012
#> GSM87973     3  0.0767    0.95119 0.004 0.000 0.976 0.000 0.012 0.008
#> GSM87993     3  0.0363    0.95034 0.012 0.000 0.988 0.000 0.000 0.000
#> GSM87975     3  0.2295    0.91651 0.028 0.000 0.904 0.000 0.016 0.052
#> GSM87995     3  0.0363    0.95034 0.012 0.000 0.988 0.000 0.000 0.000
#> GSM87976     3  0.2487    0.90599 0.024 0.000 0.892 0.000 0.020 0.064
#> GSM87977     3  0.1269    0.94328 0.012 0.000 0.956 0.000 0.020 0.012
#> GSM87996     3  0.0363    0.95034 0.012 0.000 0.988 0.000 0.000 0.000
#> GSM87997     3  0.0146    0.95165 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM87980     3  0.1546    0.93852 0.016 0.000 0.944 0.000 0.020 0.020
#> GSM88000     3  0.0146    0.95165 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM87981     3  0.1452    0.93977 0.012 0.000 0.948 0.000 0.020 0.020
#> GSM87982     3  0.0870    0.95090 0.004 0.000 0.972 0.000 0.012 0.012
#> GSM88001     3  0.0260    0.95121 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM87967     3  0.0508    0.95045 0.000 0.000 0.984 0.000 0.012 0.004
#> GSM87964     1  0.2933    0.85396 0.860 0.008 0.000 0.000 0.056 0.076
#> GSM87965     1  0.0260    0.89568 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87966     1  0.1749    0.89176 0.932 0.000 0.036 0.000 0.008 0.024
#> GSM87985     1  0.1218    0.89185 0.956 0.004 0.000 0.000 0.012 0.028
#> GSM87986     1  0.2118    0.88727 0.916 0.004 0.020 0.000 0.012 0.048
#> GSM88004     2  0.1075    0.69571 0.000 0.952 0.000 0.000 0.048 0.000
#> GSM88015     2  0.1151    0.69102 0.000 0.956 0.000 0.000 0.012 0.032
#> GSM88005     2  0.0692    0.70641 0.000 0.976 0.000 0.000 0.020 0.004
#> GSM88006     2  0.0603    0.70680 0.000 0.980 0.000 0.000 0.016 0.004
#> GSM88016     2  0.1196    0.69215 0.000 0.952 0.000 0.000 0.008 0.040
#> GSM88007     2  0.0363    0.70615 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM88017     2  0.4293   -0.16700 0.000 0.536 0.000 0.004 0.012 0.448
#> GSM88029     2  0.4382   -0.04894 0.004 0.564 0.000 0.004 0.012 0.416
#> GSM88008     2  0.0632    0.70536 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM88009     2  0.0865    0.70197 0.000 0.964 0.000 0.000 0.036 0.000
#> GSM88018     2  0.3073    0.54330 0.000 0.788 0.000 0.000 0.008 0.204
#> GSM88024     2  0.3323    0.49568 0.000 0.752 0.000 0.000 0.008 0.240
#> GSM88030     6  0.4949    0.97651 0.004 0.228 0.000 0.092 0.008 0.668
#> GSM88036     6  0.4859    0.97633 0.004 0.236 0.000 0.080 0.008 0.672
#> GSM88010     2  0.3966    0.12260 0.000 0.552 0.000 0.444 0.000 0.004
#> GSM88011     4  0.3998   -0.03292 0.000 0.492 0.000 0.504 0.000 0.004
#> GSM88019     4  0.4089   -0.00589 0.000 0.468 0.000 0.524 0.000 0.008
#> GSM88027     2  0.3847    0.09668 0.000 0.544 0.000 0.456 0.000 0.000
#> GSM88031     4  0.0000    0.88746 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88012     4  0.0520    0.88177 0.000 0.008 0.000 0.984 0.000 0.008
#> GSM88020     4  0.1501    0.81942 0.000 0.000 0.000 0.924 0.000 0.076
#> GSM88032     4  0.0000    0.88746 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88037     4  0.0000    0.88746 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88013     4  0.0291    0.88594 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM88021     4  0.0000    0.88746 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88025     4  0.0000    0.88746 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88033     4  0.0000    0.88746 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88014     4  0.0291    0.88594 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM88022     4  0.0291    0.88594 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM88034     4  0.0865    0.86102 0.000 0.000 0.000 0.964 0.000 0.036
#> GSM88002     5  0.1714    0.99332 0.000 0.092 0.000 0.000 0.908 0.000
#> GSM88003     5  0.1714    0.99332 0.000 0.092 0.000 0.000 0.908 0.000
#> GSM88023     5  0.1858    0.99419 0.000 0.092 0.000 0.000 0.904 0.004
#> GSM88026     5  0.1858    0.99419 0.000 0.092 0.000 0.000 0.904 0.004
#> GSM88028     5  0.1918    0.99113 0.000 0.088 0.000 0.000 0.904 0.008
#> GSM88035     5  0.1918    0.99113 0.000 0.088 0.000 0.000 0.904 0.008

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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 cell.line(p) agent(p)  time(p) k
#> MAD:NMF 77     1.27e-17 3.00e-14 3.61e-01 2
#> MAD:NMF 73     1.41e-16 1.34e-12 2.07e-03 3
#> MAD:NMF 74     5.93e-16 2.37e-20 1.80e-04 4
#> MAD:NMF 72     8.58e-15 2.48e-20 3.16e-08 5
#> MAD:NMF 70     1.02e-13 5.64e-18 2.84e-07 6

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


ATC: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 18792 rows and 77 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 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.903           0.965       0.976         0.0883 0.966   0.932
#> 4 4 0.868           0.895       0.945         0.0677 0.986   0.970
#> 5 5 0.737           0.834       0.869         0.1199 0.911   0.802
#> 6 6 0.820           0.853       0.874         0.1353 0.872   0.643

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87963     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87983     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87984     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87961     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87970     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87971     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87990     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87991     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87974     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87994     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87978     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87979     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87998     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87999     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87968     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87987     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87969     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87988     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87989     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87972     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87992     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87973     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87993     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87975     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87995     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87976     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87977     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87996     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87997     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87980     1  0.0000      1.000 1.000 0.000 0.000
#> GSM88000     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87981     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87982     1  0.0000      1.000 1.000 0.000 0.000
#> GSM88001     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87967     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87964     1  0.0747      0.984 0.984 0.000 0.016
#> GSM87965     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87966     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87985     1  0.0000      1.000 1.000 0.000 0.000
#> GSM87986     1  0.0000      1.000 1.000 0.000 0.000
#> GSM88004     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88015     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88005     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88006     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88016     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88007     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88017     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88029     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88008     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88009     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88018     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88024     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88030     3  0.0747      1.000 0.000 0.016 0.984
#> GSM88036     3  0.0747      1.000 0.000 0.016 0.984
#> GSM88010     2  0.3192      0.907 0.000 0.888 0.112
#> GSM88011     2  0.3192      0.907 0.000 0.888 0.112
#> GSM88019     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88027     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88031     2  0.3619      0.893 0.000 0.864 0.136
#> GSM88012     2  0.3192      0.907 0.000 0.888 0.112
#> GSM88020     2  0.5397      0.715 0.000 0.720 0.280
#> GSM88032     2  0.3619      0.893 0.000 0.864 0.136
#> GSM88037     2  0.3619      0.893 0.000 0.864 0.136
#> GSM88013     2  0.3192      0.907 0.000 0.888 0.112
#> GSM88021     2  0.3619      0.893 0.000 0.864 0.136
#> GSM88025     2  0.3619      0.893 0.000 0.864 0.136
#> GSM88033     2  0.3619      0.893 0.000 0.864 0.136
#> GSM88014     2  0.3192      0.907 0.000 0.888 0.112
#> GSM88022     2  0.3192      0.907 0.000 0.888 0.112
#> GSM88034     3  0.0747      1.000 0.000 0.016 0.984
#> GSM88002     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88003     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88023     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88026     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88028     2  0.0000      0.942 0.000 1.000 0.000
#> GSM88035     2  0.0000      0.942 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87963     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87983     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87984     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87961     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87970     1   0.287      0.879 0.864 0.000 0.136 0.000
#> GSM87971     1   0.287      0.879 0.864 0.000 0.136 0.000
#> GSM87990     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87991     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87974     1   0.287      0.879 0.864 0.000 0.136 0.000
#> GSM87994     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87978     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87979     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87998     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87999     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87968     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87987     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87969     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87988     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87989     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87972     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87992     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87973     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87993     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87975     1   0.499      0.272 0.528 0.000 0.472 0.000
#> GSM87995     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87976     1   0.499      0.272 0.528 0.000 0.472 0.000
#> GSM87977     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87996     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87997     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87980     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM88000     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87981     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87982     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM88001     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87967     1   0.228      0.907 0.904 0.000 0.096 0.000
#> GSM87964     3   0.000      0.000 0.000 0.000 1.000 0.000
#> GSM87965     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87966     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87985     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM87986     1   0.000      0.937 1.000 0.000 0.000 0.000
#> GSM88004     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88015     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88005     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88006     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88016     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88007     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88017     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88029     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88008     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88009     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88018     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88024     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88030     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM88036     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM88010     2   0.253      0.907 0.000 0.888 0.000 0.112
#> GSM88011     2   0.253      0.907 0.000 0.888 0.000 0.112
#> GSM88019     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88027     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88031     2   0.297      0.888 0.000 0.856 0.000 0.144
#> GSM88012     2   0.253      0.907 0.000 0.888 0.000 0.112
#> GSM88020     2   0.433      0.710 0.000 0.712 0.000 0.288
#> GSM88032     2   0.297      0.888 0.000 0.856 0.000 0.144
#> GSM88037     2   0.297      0.888 0.000 0.856 0.000 0.144
#> GSM88013     2   0.253      0.907 0.000 0.888 0.000 0.112
#> GSM88021     2   0.297      0.888 0.000 0.856 0.000 0.144
#> GSM88025     2   0.297      0.888 0.000 0.856 0.000 0.144
#> GSM88033     2   0.297      0.888 0.000 0.856 0.000 0.144
#> GSM88014     2   0.253      0.907 0.000 0.888 0.000 0.112
#> GSM88022     2   0.253      0.907 0.000 0.888 0.000 0.112
#> GSM88034     4   0.000      1.000 0.000 0.000 0.000 1.000
#> GSM88002     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88003     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88023     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88026     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88028     2   0.000      0.941 0.000 1.000 0.000 0.000
#> GSM88035     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
#> GSM87962     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87963     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87983     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87984     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87961     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87970     1   0.410      0.802 0.760 0.000 0.040 0.000 0.200
#> GSM87971     1   0.410      0.802 0.760 0.000 0.040 0.000 0.200
#> GSM87990     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87991     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87974     1   0.410      0.802 0.760 0.000 0.040 0.000 0.200
#> GSM87994     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87978     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87979     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87998     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87999     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87968     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87987     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87969     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87988     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87989     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87972     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87992     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87973     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87993     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87975     1   0.655      0.185 0.424 0.000 0.376 0.000 0.200
#> GSM87995     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87976     1   0.655      0.185 0.424 0.000 0.376 0.000 0.200
#> GSM87977     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87996     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87997     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87980     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM88000     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87981     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87982     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM88001     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87967     1   0.311      0.832 0.800 0.000 0.000 0.000 0.200
#> GSM87964     3   0.000      0.000 0.000 0.000 1.000 0.000 0.000
#> GSM87965     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87966     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87985     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM87986     1   0.000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM88004     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88015     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88005     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88006     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88016     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88007     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88017     2   0.359      0.786 0.000 0.736 0.000 0.264 0.000
#> GSM88029     2   0.359      0.786 0.000 0.736 0.000 0.264 0.000
#> GSM88008     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88009     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88018     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88024     2   0.359      0.786 0.000 0.736 0.000 0.264 0.000
#> GSM88030     5   0.366      1.000 0.000 0.168 0.000 0.032 0.800
#> GSM88036     5   0.366      1.000 0.000 0.168 0.000 0.032 0.800
#> GSM88010     4   0.088      0.952 0.000 0.032 0.000 0.968 0.000
#> GSM88011     4   0.088      0.952 0.000 0.032 0.000 0.968 0.000
#> GSM88019     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88027     2   0.426      0.797 0.000 0.560 0.000 0.440 0.000
#> GSM88031     4   0.000      0.956 0.000 0.000 0.000 1.000 0.000
#> GSM88012     4   0.088      0.952 0.000 0.032 0.000 0.968 0.000
#> GSM88020     4   0.256      0.790 0.000 0.000 0.000 0.856 0.144
#> GSM88032     4   0.000      0.956 0.000 0.000 0.000 1.000 0.000
#> GSM88037     4   0.000      0.956 0.000 0.000 0.000 1.000 0.000
#> GSM88013     4   0.088      0.952 0.000 0.032 0.000 0.968 0.000
#> GSM88021     4   0.000      0.956 0.000 0.000 0.000 1.000 0.000
#> GSM88025     4   0.000      0.956 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4   0.000      0.956 0.000 0.000 0.000 1.000 0.000
#> GSM88014     4   0.088      0.952 0.000 0.032 0.000 0.968 0.000
#> GSM88022     4   0.088      0.952 0.000 0.032 0.000 0.968 0.000
#> GSM88034     5   0.366      1.000 0.000 0.168 0.000 0.032 0.800
#> GSM88002     2   0.281      0.748 0.000 0.832 0.000 0.168 0.000
#> GSM88003     2   0.281      0.748 0.000 0.832 0.000 0.168 0.000
#> GSM88023     2   0.281      0.748 0.000 0.832 0.000 0.168 0.000
#> GSM88026     2   0.281      0.748 0.000 0.832 0.000 0.168 0.000
#> GSM88028     2   0.281      0.748 0.000 0.832 0.000 0.168 0.000
#> GSM88035     2   0.281      0.748 0.000 0.832 0.000 0.168 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
#> GSM87962     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87963     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87983     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87984     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87961     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87970     3  0.4247    0.87434 0.296 0.000 0.664 0.000 0.000 0.040
#> GSM87971     3  0.4247    0.87434 0.296 0.000 0.664 0.000 0.000 0.040
#> GSM87990     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87991     1  0.0146    0.97295 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM87974     3  0.4247    0.87434 0.296 0.000 0.664 0.000 0.000 0.040
#> GSM87994     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87978     3  0.3592    0.89598 0.344 0.000 0.656 0.000 0.000 0.000
#> GSM87979     3  0.3592    0.89598 0.344 0.000 0.656 0.000 0.000 0.000
#> GSM87998     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87999     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87968     3  0.3592    0.89598 0.344 0.000 0.656 0.000 0.000 0.000
#> GSM87987     1  0.0146    0.96988 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM87969     1  0.3563    0.00751 0.664 0.000 0.336 0.000 0.000 0.000
#> GSM87988     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87989     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87972     3  0.3634    0.89929 0.356 0.000 0.644 0.000 0.000 0.000
#> GSM87992     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87973     3  0.3634    0.89929 0.356 0.000 0.644 0.000 0.000 0.000
#> GSM87993     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87975     3  0.4583    0.25814 0.044 0.000 0.580 0.000 0.000 0.376
#> GSM87995     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87976     3  0.4583    0.25814 0.044 0.000 0.580 0.000 0.000 0.376
#> GSM87977     3  0.3634    0.89929 0.356 0.000 0.644 0.000 0.000 0.000
#> GSM87996     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87997     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87980     3  0.3634    0.89929 0.356 0.000 0.644 0.000 0.000 0.000
#> GSM88000     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87981     3  0.3634    0.89929 0.356 0.000 0.644 0.000 0.000 0.000
#> GSM87982     3  0.3634    0.89929 0.356 0.000 0.644 0.000 0.000 0.000
#> GSM88001     1  0.0000    0.97338 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87967     3  0.3634    0.89929 0.356 0.000 0.644 0.000 0.000 0.000
#> GSM87964     6  0.0000    0.00000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM87965     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87966     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87985     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM87986     1  0.0260    0.97209 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM88004     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88015     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88005     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88006     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88016     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88007     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88017     2  0.3076    0.80223 0.000 0.760 0.240 0.000 0.000 0.000
#> GSM88029     2  0.3076    0.80223 0.000 0.760 0.240 0.000 0.000 0.000
#> GSM88008     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88009     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88018     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88024     2  0.3076    0.80223 0.000 0.760 0.240 0.000 0.000 0.000
#> GSM88030     5  0.0000    1.00000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88036     5  0.0000    1.00000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88010     4  0.3428    0.61296 0.000 0.304 0.000 0.696 0.000 0.000
#> GSM88011     4  0.3428    0.61296 0.000 0.304 0.000 0.696 0.000 0.000
#> GSM88019     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88027     2  0.0000    0.84532 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88031     4  0.0000    0.89323 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88012     4  0.1204    0.88707 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM88020     4  0.2300    0.78206 0.000 0.000 0.000 0.856 0.144 0.000
#> GSM88032     4  0.0000    0.89323 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88037     4  0.0000    0.89323 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88013     4  0.1204    0.88707 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM88021     4  0.0000    0.89323 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88025     4  0.0000    0.89323 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88033     4  0.0000    0.89323 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88014     4  0.1204    0.88707 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM88022     4  0.1204    0.88707 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM88034     5  0.0000    1.00000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88002     2  0.3563    0.76013 0.000 0.664 0.336 0.000 0.000 0.000
#> GSM88003     2  0.3563    0.76013 0.000 0.664 0.336 0.000 0.000 0.000
#> GSM88023     2  0.3563    0.76013 0.000 0.664 0.336 0.000 0.000 0.000
#> GSM88026     2  0.3563    0.76013 0.000 0.664 0.336 0.000 0.000 0.000
#> GSM88028     2  0.3563    0.76013 0.000 0.664 0.336 0.000 0.000 0.000
#> GSM88035     2  0.3563    0.76013 0.000 0.664 0.336 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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 cell.line(p) agent(p) time(p) k
#> ATC:hclust 77     1.27e-17 3.00e-14 0.36115 2
#> ATC:hclust 77     1.90e-17 1.75e-12 0.41080 3
#> ATC:hclust 74     8.53e-17 3.76e-12 0.33530 4
#> ATC:hclust 74     5.93e-16 5.41e-12 0.00706 5
#> ATC:hclust 73     5.28e-15 2.30e-12 0.03011 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 18792 rows and 77 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.630           0.819       0.784         0.2408 1.000   1.000
#> 4 4 0.589           0.329       0.643         0.1158 0.823   0.643
#> 5 5 0.586           0.542       0.661         0.0796 0.785   0.416
#> 6 6 0.637           0.647       0.667         0.0544 0.862   0.468

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.6274      0.805 0.544 0.000 NA
#> GSM87963     1  0.6274      0.805 0.544 0.000 NA
#> GSM87983     1  0.4504      0.802 0.804 0.000 NA
#> GSM87984     1  0.4504      0.802 0.804 0.000 NA
#> GSM87961     1  0.6274      0.805 0.544 0.000 NA
#> GSM87970     1  0.6274      0.805 0.544 0.000 NA
#> GSM87971     1  0.6274      0.805 0.544 0.000 NA
#> GSM87990     1  0.4750      0.805 0.784 0.000 NA
#> GSM87991     1  0.3551      0.789 0.868 0.000 NA
#> GSM87974     1  0.6274      0.805 0.544 0.000 NA
#> GSM87994     1  0.1753      0.775 0.952 0.000 NA
#> GSM87978     1  0.6274      0.805 0.544 0.000 NA
#> GSM87979     1  0.6274      0.805 0.544 0.000 NA
#> GSM87998     1  0.0000      0.774 1.000 0.000 NA
#> GSM87999     1  0.0000      0.774 1.000 0.000 NA
#> GSM87968     1  0.6274      0.805 0.544 0.000 NA
#> GSM87987     1  0.0237      0.775 0.996 0.000 NA
#> GSM87969     1  0.6274      0.805 0.544 0.000 NA
#> GSM87988     1  0.2625      0.763 0.916 0.000 NA
#> GSM87989     1  0.2625      0.763 0.916 0.000 NA
#> GSM87972     1  0.6267      0.803 0.548 0.000 NA
#> GSM87992     1  0.2625      0.763 0.916 0.000 NA
#> GSM87973     1  0.6180      0.801 0.584 0.000 NA
#> GSM87993     1  0.2625      0.763 0.916 0.000 NA
#> GSM87975     1  0.6302      0.804 0.520 0.000 NA
#> GSM87995     1  0.2625      0.763 0.916 0.000 NA
#> GSM87976     1  0.6302      0.804 0.520 0.000 NA
#> GSM87977     1  0.6267      0.803 0.548 0.000 NA
#> GSM87996     1  0.2625      0.763 0.916 0.000 NA
#> GSM87997     1  0.2625      0.763 0.916 0.000 NA
#> GSM87980     1  0.6267      0.803 0.548 0.000 NA
#> GSM88000     1  0.2625      0.763 0.916 0.000 NA
#> GSM87981     1  0.6267      0.803 0.548 0.000 NA
#> GSM87982     1  0.6267      0.803 0.548 0.000 NA
#> GSM88001     1  0.2625      0.763 0.916 0.000 NA
#> GSM87967     1  0.6180      0.801 0.584 0.000 NA
#> GSM87964     1  0.6274      0.805 0.544 0.000 NA
#> GSM87965     1  0.6274      0.805 0.544 0.000 NA
#> GSM87966     1  0.4504      0.802 0.804 0.000 NA
#> GSM87985     1  0.4796      0.806 0.780 0.000 NA
#> GSM87986     1  0.4504      0.802 0.804 0.000 NA
#> GSM88004     2  0.0000      0.870 0.000 1.000 NA
#> GSM88015     2  0.0000      0.870 0.000 1.000 NA
#> GSM88005     2  0.0000      0.870 0.000 1.000 NA
#> GSM88006     2  0.0000      0.870 0.000 1.000 NA
#> GSM88016     2  0.0000      0.870 0.000 1.000 NA
#> GSM88007     2  0.0000      0.870 0.000 1.000 NA
#> GSM88017     2  0.3619      0.843 0.000 0.864 NA
#> GSM88029     2  0.4178      0.848 0.000 0.828 NA
#> GSM88008     2  0.0000      0.870 0.000 1.000 NA
#> GSM88009     2  0.0000      0.870 0.000 1.000 NA
#> GSM88018     2  0.0000      0.870 0.000 1.000 NA
#> GSM88024     2  0.2537      0.860 0.000 0.920 NA
#> GSM88030     2  0.5926      0.829 0.000 0.644 NA
#> GSM88036     2  0.5926      0.829 0.000 0.644 NA
#> GSM88010     2  0.2625      0.872 0.000 0.916 NA
#> GSM88011     2  0.2066      0.870 0.000 0.940 NA
#> GSM88019     2  0.2066      0.870 0.000 0.940 NA
#> GSM88027     2  0.1529      0.870 0.000 0.960 NA
#> GSM88031     2  0.5560      0.837 0.000 0.700 NA
#> GSM88012     2  0.5591      0.837 0.000 0.696 NA
#> GSM88020     2  0.5591      0.837 0.000 0.696 NA
#> GSM88032     2  0.5591      0.837 0.000 0.696 NA
#> GSM88037     2  0.5591      0.837 0.000 0.696 NA
#> GSM88013     2  0.5591      0.837 0.000 0.696 NA
#> GSM88021     2  0.5591      0.837 0.000 0.696 NA
#> GSM88025     2  0.5591      0.837 0.000 0.696 NA
#> GSM88033     2  0.5591      0.837 0.000 0.696 NA
#> GSM88014     2  0.5591      0.837 0.000 0.696 NA
#> GSM88022     2  0.5591      0.837 0.000 0.696 NA
#> GSM88034     2  0.6192      0.814 0.000 0.580 NA
#> GSM88002     2  0.4605      0.838 0.000 0.796 NA
#> GSM88003     2  0.4605      0.838 0.000 0.796 NA
#> GSM88023     2  0.4605      0.838 0.000 0.796 NA
#> GSM88026     2  0.4605      0.838 0.000 0.796 NA
#> GSM88028     2  0.4605      0.838 0.000 0.796 NA
#> GSM88035     2  0.4605      0.838 0.000 0.796 NA

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.6824     0.5148 0.548 0.000 0.336 0.116
#> GSM87963     1  0.6824     0.5148 0.548 0.000 0.336 0.116
#> GSM87983     3  0.6634     0.3020 0.292 0.000 0.592 0.116
#> GSM87984     3  0.6634     0.3020 0.292 0.000 0.592 0.116
#> GSM87961     1  0.6824     0.5148 0.548 0.000 0.336 0.116
#> GSM87970     1  0.4250     0.7198 0.724 0.000 0.276 0.000
#> GSM87971     1  0.4250     0.7198 0.724 0.000 0.276 0.000
#> GSM87990     3  0.6711     0.2652 0.308 0.000 0.576 0.116
#> GSM87991     3  0.6422     0.3651 0.248 0.000 0.632 0.120
#> GSM87974     1  0.4690     0.7178 0.712 0.000 0.276 0.012
#> GSM87994     3  0.3105     0.5639 0.120 0.000 0.868 0.012
#> GSM87978     1  0.4250     0.7198 0.724 0.000 0.276 0.000
#> GSM87979     1  0.4250     0.7198 0.724 0.000 0.276 0.000
#> GSM87998     3  0.2125     0.5943 0.076 0.000 0.920 0.004
#> GSM87999     3  0.2125     0.5943 0.076 0.000 0.920 0.004
#> GSM87968     1  0.4250     0.7198 0.724 0.000 0.276 0.000
#> GSM87987     3  0.2401     0.5870 0.092 0.000 0.904 0.004
#> GSM87969     1  0.4250     0.7198 0.724 0.000 0.276 0.000
#> GSM87988     3  0.1716     0.6116 0.000 0.000 0.936 0.064
#> GSM87989     3  0.1716     0.6116 0.000 0.000 0.936 0.064
#> GSM87972     1  0.7006     0.5739 0.456 0.000 0.428 0.116
#> GSM87992     3  0.2216     0.6078 0.000 0.000 0.908 0.092
#> GSM87973     3  0.7047    -0.5840 0.436 0.000 0.444 0.120
#> GSM87993     3  0.2149     0.6074 0.000 0.000 0.912 0.088
#> GSM87975     1  0.7273     0.5869 0.452 0.000 0.400 0.148
#> GSM87995     3  0.2149     0.6074 0.000 0.000 0.912 0.088
#> GSM87976     1  0.7273     0.5869 0.452 0.000 0.400 0.148
#> GSM87977     1  0.7044     0.5696 0.452 0.000 0.428 0.120
#> GSM87996     3  0.2149     0.6074 0.000 0.000 0.912 0.088
#> GSM87997     3  0.2149     0.6074 0.000 0.000 0.912 0.088
#> GSM87980     1  0.7282     0.5664 0.436 0.000 0.416 0.148
#> GSM88000     3  0.2149     0.6074 0.000 0.000 0.912 0.088
#> GSM87981     1  0.7119     0.5660 0.444 0.000 0.428 0.128
#> GSM87982     1  0.7119     0.5660 0.444 0.000 0.428 0.128
#> GSM88001     3  0.2149     0.6074 0.000 0.000 0.912 0.088
#> GSM87967     3  0.7047    -0.5840 0.436 0.000 0.444 0.120
#> GSM87964     1  0.5282     0.7090 0.688 0.000 0.276 0.036
#> GSM87965     1  0.6824     0.5148 0.548 0.000 0.336 0.116
#> GSM87966     3  0.6634     0.3020 0.292 0.000 0.592 0.116
#> GSM87985     3  0.6746     0.2427 0.316 0.000 0.568 0.116
#> GSM87986     3  0.6634     0.3020 0.292 0.000 0.592 0.116
#> GSM88004     2  0.0000     0.4062 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0188     0.4053 0.004 0.996 0.000 0.000
#> GSM88005     2  0.0000     0.4062 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000     0.4062 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0188     0.4053 0.004 0.996 0.000 0.000
#> GSM88007     2  0.0000     0.4062 0.000 1.000 0.000 0.000
#> GSM88017     2  0.4840     0.1255 0.028 0.732 0.000 0.240
#> GSM88029     2  0.5022     0.0920 0.028 0.708 0.000 0.264
#> GSM88008     2  0.0000     0.4062 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000     0.4062 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0188     0.4053 0.004 0.996 0.000 0.000
#> GSM88024     2  0.1722     0.3614 0.008 0.944 0.000 0.048
#> GSM88030     4  0.6609     0.6834 0.080 0.448 0.000 0.472
#> GSM88036     4  0.6609     0.6834 0.080 0.448 0.000 0.472
#> GSM88010     2  0.3674     0.3047 0.044 0.852 0.000 0.104
#> GSM88011     2  0.3550     0.3113 0.044 0.860 0.000 0.096
#> GSM88019     2  0.3570     0.3123 0.048 0.860 0.000 0.092
#> GSM88027     2  0.2919     0.3448 0.044 0.896 0.000 0.060
#> GSM88031     2  0.7664    -0.2514 0.248 0.460 0.000 0.292
#> GSM88012     2  0.7677    -0.2538 0.248 0.456 0.000 0.296
#> GSM88020     2  0.7747    -0.3534 0.252 0.432 0.000 0.316
#> GSM88032     2  0.7677    -0.2538 0.248 0.456 0.000 0.296
#> GSM88037     2  0.7677    -0.2538 0.248 0.456 0.000 0.296
#> GSM88013     2  0.7677    -0.2538 0.248 0.456 0.000 0.296
#> GSM88021     2  0.7677    -0.2538 0.248 0.456 0.000 0.296
#> GSM88025     2  0.7677    -0.2538 0.248 0.456 0.000 0.296
#> GSM88033     2  0.7763    -0.3095 0.264 0.432 0.000 0.304
#> GSM88014     2  0.7677    -0.2538 0.248 0.456 0.000 0.296
#> GSM88022     2  0.7677    -0.2538 0.248 0.456 0.000 0.296
#> GSM88034     4  0.7698     0.4015 0.224 0.356 0.000 0.420
#> GSM88002     2  0.4605     0.0768 0.000 0.664 0.000 0.336
#> GSM88003     2  0.4605     0.0768 0.000 0.664 0.000 0.336
#> GSM88023     2  0.4605     0.0768 0.000 0.664 0.000 0.336
#> GSM88026     2  0.4605     0.0768 0.000 0.664 0.000 0.336
#> GSM88028     2  0.4605     0.0768 0.000 0.664 0.000 0.336
#> GSM88035     2  0.4605     0.0768 0.000 0.664 0.000 0.336

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM87962     1  0.2891     0.4841 0.824 0.000 0.176 0.000 0.000
#> GSM87963     1  0.2891     0.4841 0.824 0.000 0.176 0.000 0.000
#> GSM87983     1  0.5065     0.3445 0.544 0.036 0.420 0.000 0.000
#> GSM87984     1  0.5065     0.3445 0.544 0.036 0.420 0.000 0.000
#> GSM87961     1  0.2891     0.4841 0.824 0.000 0.176 0.000 0.000
#> GSM87970     1  0.7279     0.0687 0.492 0.056 0.176 0.000 0.276
#> GSM87971     1  0.7279     0.0687 0.492 0.056 0.176 0.000 0.276
#> GSM87990     1  0.5036     0.3688 0.560 0.036 0.404 0.000 0.000
#> GSM87991     1  0.5495     0.2619 0.500 0.064 0.436 0.000 0.000
#> GSM87974     1  0.7306     0.0453 0.484 0.056 0.176 0.000 0.284
#> GSM87994     3  0.4428     0.6515 0.160 0.084 0.756 0.000 0.000
#> GSM87978     1  0.7238     0.0631 0.492 0.052 0.176 0.000 0.280
#> GSM87979     1  0.7238     0.0631 0.492 0.052 0.176 0.000 0.280
#> GSM87998     3  0.4268     0.6825 0.144 0.084 0.772 0.000 0.000
#> GSM87999     3  0.4268     0.6825 0.144 0.084 0.772 0.000 0.000
#> GSM87968     1  0.7238     0.0631 0.492 0.052 0.176 0.000 0.280
#> GSM87987     3  0.4309     0.6767 0.148 0.084 0.768 0.000 0.000
#> GSM87969     1  0.7038     0.0360 0.496 0.036 0.176 0.000 0.292
#> GSM87988     3  0.1197     0.8205 0.000 0.048 0.952 0.000 0.000
#> GSM87989     3  0.1197     0.8205 0.000 0.048 0.952 0.000 0.000
#> GSM87972     5  0.6371     0.9372 0.216 0.000 0.268 0.000 0.516
#> GSM87992     3  0.1430     0.8426 0.000 0.004 0.944 0.000 0.052
#> GSM87973     5  0.6309     0.9365 0.192 0.000 0.288 0.000 0.520
#> GSM87993     3  0.1544     0.8418 0.000 0.000 0.932 0.000 0.068
#> GSM87975     5  0.6526     0.9061 0.224 0.008 0.236 0.000 0.532
#> GSM87995     3  0.1544     0.8418 0.000 0.000 0.932 0.000 0.068
#> GSM87976     5  0.6526     0.9061 0.224 0.008 0.236 0.000 0.532
#> GSM87977     5  0.6279     0.9470 0.200 0.000 0.268 0.000 0.532
#> GSM87996     3  0.1544     0.8418 0.000 0.000 0.932 0.000 0.068
#> GSM87997     3  0.1544     0.8418 0.000 0.000 0.932 0.000 0.068
#> GSM87980     5  0.6421     0.9350 0.196 0.008 0.248 0.000 0.548
#> GSM88000     3  0.1544     0.8418 0.000 0.000 0.932 0.000 0.068
#> GSM87981     5  0.6271     0.9468 0.196 0.000 0.272 0.000 0.532
#> GSM87982     5  0.6319     0.9406 0.196 0.000 0.284 0.000 0.520
#> GSM88001     3  0.1544     0.8418 0.000 0.000 0.932 0.000 0.068
#> GSM87967     5  0.6309     0.9365 0.192 0.000 0.288 0.000 0.520
#> GSM87964     1  0.7606    -0.0231 0.444 0.076 0.176 0.000 0.304
#> GSM87965     1  0.2891     0.4841 0.824 0.000 0.176 0.000 0.000
#> GSM87966     1  0.5065     0.3445 0.544 0.036 0.420 0.000 0.000
#> GSM87985     1  0.5028     0.3740 0.564 0.036 0.400 0.000 0.000
#> GSM87986     1  0.5065     0.3445 0.544 0.036 0.420 0.000 0.000
#> GSM88004     2  0.6749     0.6661 0.000 0.400 0.000 0.272 0.328
#> GSM88015     2  0.6767     0.6559 0.000 0.380 0.000 0.272 0.348
#> GSM88005     2  0.6749     0.6661 0.000 0.400 0.000 0.272 0.328
#> GSM88006     2  0.6749     0.6661 0.000 0.400 0.000 0.272 0.328
#> GSM88016     2  0.7423     0.6524 0.032 0.384 0.000 0.268 0.316
#> GSM88007     2  0.6749     0.6661 0.000 0.400 0.000 0.272 0.328
#> GSM88017     2  0.6979     0.6092 0.068 0.568 0.000 0.168 0.196
#> GSM88029     2  0.6973     0.5857 0.072 0.572 0.000 0.192 0.164
#> GSM88008     2  0.6749     0.6661 0.000 0.400 0.000 0.272 0.328
#> GSM88009     2  0.6749     0.6661 0.000 0.400 0.000 0.272 0.328
#> GSM88018     2  0.7423     0.6524 0.032 0.384 0.000 0.268 0.316
#> GSM88024     2  0.7458     0.6555 0.044 0.424 0.000 0.228 0.304
#> GSM88030     4  0.7128     0.2026 0.128 0.324 0.000 0.488 0.060
#> GSM88036     4  0.7128     0.2026 0.128 0.324 0.000 0.488 0.060
#> GSM88010     4  0.7022    -0.2597 0.020 0.228 0.000 0.464 0.288
#> GSM88011     4  0.7056    -0.2713 0.020 0.236 0.000 0.456 0.288
#> GSM88019     4  0.7415    -0.4095 0.036 0.236 0.000 0.396 0.332
#> GSM88027     4  0.7531    -0.5385 0.036 0.292 0.000 0.340 0.332
#> GSM88031     4  0.0162     0.7080 0.000 0.000 0.000 0.996 0.004
#> GSM88012     4  0.1310     0.7037 0.024 0.000 0.000 0.956 0.020
#> GSM88020     4  0.2104     0.6742 0.060 0.000 0.000 0.916 0.024
#> GSM88032     4  0.0162     0.7080 0.000 0.000 0.000 0.996 0.004
#> GSM88037     4  0.0162     0.7080 0.000 0.000 0.000 0.996 0.004
#> GSM88013     4  0.1310     0.7037 0.024 0.000 0.000 0.956 0.020
#> GSM88021     4  0.0000     0.7077 0.000 0.000 0.000 1.000 0.000
#> GSM88025     4  0.0000     0.7077 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0671     0.7011 0.004 0.000 0.000 0.980 0.016
#> GSM88014     4  0.1310     0.7037 0.024 0.000 0.000 0.956 0.020
#> GSM88022     4  0.1310     0.7037 0.024 0.000 0.000 0.956 0.020
#> GSM88034     4  0.4726     0.5664 0.100 0.088 0.000 0.776 0.036
#> GSM88002     2  0.3231     0.5595 0.000 0.800 0.000 0.196 0.004
#> GSM88003     2  0.3231     0.5595 0.000 0.800 0.000 0.196 0.004
#> GSM88023     2  0.3074     0.5598 0.000 0.804 0.000 0.196 0.000
#> GSM88026     2  0.3074     0.5598 0.000 0.804 0.000 0.196 0.000
#> GSM88028     2  0.3074     0.5598 0.000 0.804 0.000 0.196 0.000
#> GSM88035     2  0.3074     0.5598 0.000 0.804 0.000 0.196 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
#> GSM87962     1  0.3986     -0.319 0.532 0.000 0.000 0.000 0.004 0.464
#> GSM87963     1  0.3986     -0.319 0.532 0.000 0.000 0.000 0.004 0.464
#> GSM87983     6  0.5729      0.952 0.252 0.000 0.204 0.000 0.004 0.540
#> GSM87984     6  0.5729      0.952 0.252 0.000 0.204 0.000 0.004 0.540
#> GSM87961     1  0.3857     -0.320 0.532 0.000 0.000 0.000 0.000 0.468
#> GSM87970     1  0.0520      0.607 0.984 0.000 0.000 0.008 0.008 0.000
#> GSM87971     1  0.0520      0.607 0.984 0.000 0.000 0.008 0.008 0.000
#> GSM87990     6  0.5665      0.925 0.284 0.000 0.172 0.000 0.004 0.540
#> GSM87991     6  0.6270      0.822 0.196 0.000 0.232 0.016 0.016 0.540
#> GSM87974     1  0.0665      0.608 0.980 0.000 0.000 0.008 0.008 0.004
#> GSM87994     3  0.7095      0.478 0.104 0.000 0.520 0.104 0.036 0.236
#> GSM87978     1  0.0146      0.609 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM87979     1  0.0146      0.609 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM87998     3  0.6968      0.571 0.096 0.000 0.556 0.108 0.044 0.196
#> GSM87999     3  0.6968      0.571 0.096 0.000 0.556 0.108 0.044 0.196
#> GSM87968     1  0.0146      0.609 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM87987     3  0.7045      0.555 0.104 0.000 0.548 0.108 0.044 0.196
#> GSM87969     1  0.1065      0.605 0.964 0.000 0.000 0.020 0.008 0.008
#> GSM87988     3  0.4989      0.757 0.064 0.000 0.748 0.104 0.036 0.048
#> GSM87989     3  0.4993      0.758 0.064 0.000 0.748 0.104 0.040 0.044
#> GSM87972     1  0.6358      0.644 0.600 0.000 0.064 0.048 0.224 0.064
#> GSM87992     3  0.1841      0.803 0.064 0.000 0.920 0.008 0.008 0.000
#> GSM87973     1  0.6774      0.632 0.560 0.000 0.100 0.048 0.228 0.064
#> GSM87993     3  0.1471      0.806 0.064 0.000 0.932 0.000 0.004 0.000
#> GSM87975     1  0.6684      0.639 0.572 0.000 0.060 0.068 0.228 0.072
#> GSM87995     3  0.1471      0.806 0.064 0.000 0.932 0.000 0.004 0.000
#> GSM87976     1  0.6684      0.639 0.572 0.000 0.060 0.068 0.228 0.072
#> GSM87977     1  0.6547      0.641 0.584 0.000 0.080 0.048 0.224 0.064
#> GSM87996     3  0.1471      0.806 0.064 0.000 0.932 0.000 0.004 0.000
#> GSM87997     3  0.1471      0.806 0.064 0.000 0.932 0.000 0.004 0.000
#> GSM87980     1  0.6673      0.639 0.568 0.000 0.072 0.056 0.236 0.068
#> GSM88000     3  0.1471      0.806 0.064 0.000 0.932 0.000 0.004 0.000
#> GSM87981     1  0.6797      0.636 0.560 0.000 0.092 0.052 0.228 0.068
#> GSM87982     1  0.6797      0.636 0.560 0.000 0.092 0.052 0.228 0.068
#> GSM88001     3  0.1471      0.806 0.064 0.000 0.932 0.000 0.004 0.000
#> GSM87967     1  0.6774      0.632 0.560 0.000 0.100 0.048 0.228 0.064
#> GSM87964     1  0.3083      0.562 0.860 0.000 0.000 0.052 0.060 0.028
#> GSM87965     1  0.3857     -0.320 0.532 0.000 0.000 0.000 0.000 0.468
#> GSM87966     6  0.5597      0.952 0.252 0.000 0.204 0.000 0.000 0.544
#> GSM87985     6  0.5522      0.919 0.288 0.000 0.168 0.000 0.000 0.544
#> GSM87986     6  0.5597      0.952 0.252 0.000 0.204 0.000 0.000 0.544
#> GSM88004     2  0.0405      0.760 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM88015     2  0.0260      0.757 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM88005     2  0.0405      0.760 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM88006     2  0.0405      0.760 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM88016     2  0.1296      0.742 0.000 0.952 0.012 0.000 0.004 0.032
#> GSM88007     2  0.0405      0.760 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM88017     2  0.6161     -0.122 0.000 0.584 0.040 0.020 0.252 0.104
#> GSM88029     2  0.6475     -0.234 0.000 0.552 0.040 0.032 0.268 0.108
#> GSM88008     2  0.0405      0.760 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM88009     2  0.0405      0.760 0.000 0.988 0.004 0.000 0.008 0.000
#> GSM88018     2  0.1390      0.740 0.000 0.948 0.016 0.000 0.004 0.032
#> GSM88024     2  0.3473      0.601 0.000 0.844 0.024 0.012 0.068 0.052
#> GSM88030     5  0.8201      0.328 0.000 0.208 0.044 0.224 0.352 0.172
#> GSM88036     5  0.8201      0.328 0.000 0.208 0.044 0.224 0.352 0.172
#> GSM88010     2  0.4695      0.497 0.000 0.696 0.000 0.168 0.004 0.132
#> GSM88011     2  0.4695      0.497 0.000 0.696 0.000 0.168 0.004 0.132
#> GSM88019     2  0.4445      0.603 0.000 0.748 0.012 0.124 0.004 0.112
#> GSM88027     2  0.3997      0.643 0.000 0.788 0.012 0.084 0.004 0.112
#> GSM88031     4  0.3163      0.893 0.000 0.232 0.000 0.764 0.000 0.004
#> GSM88012     4  0.5125      0.853 0.000 0.232 0.000 0.632 0.004 0.132
#> GSM88020     4  0.4608      0.824 0.000 0.208 0.000 0.712 0.036 0.044
#> GSM88032     4  0.2996      0.895 0.000 0.228 0.000 0.772 0.000 0.000
#> GSM88037     4  0.2996      0.895 0.000 0.228 0.000 0.772 0.000 0.000
#> GSM88013     4  0.5125      0.853 0.000 0.232 0.000 0.632 0.004 0.132
#> GSM88021     4  0.2996      0.895 0.000 0.228 0.000 0.772 0.000 0.000
#> GSM88025     4  0.2996      0.895 0.000 0.228 0.000 0.772 0.000 0.000
#> GSM88033     4  0.2854      0.884 0.000 0.208 0.000 0.792 0.000 0.000
#> GSM88014     4  0.5125      0.853 0.000 0.232 0.000 0.632 0.004 0.132
#> GSM88022     4  0.5125      0.853 0.000 0.232 0.000 0.632 0.004 0.132
#> GSM88034     4  0.6524      0.546 0.000 0.124 0.020 0.596 0.160 0.100
#> GSM88002     5  0.4269      0.774 0.000 0.412 0.000 0.020 0.568 0.000
#> GSM88003     5  0.4269      0.774 0.000 0.412 0.000 0.020 0.568 0.000
#> GSM88023     5  0.4269      0.774 0.000 0.412 0.000 0.020 0.568 0.000
#> GSM88026     5  0.4269      0.774 0.000 0.412 0.000 0.020 0.568 0.000
#> GSM88028     5  0.4269      0.774 0.000 0.412 0.000 0.020 0.568 0.000
#> GSM88035     5  0.4269      0.774 0.000 0.412 0.000 0.020 0.568 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 cell.line(p) agent(p)  time(p) k
#> ATC:kmeans 77     1.27e-17 3.00e-14 0.361151 2
#> ATC:kmeans 77     1.27e-17 3.00e-14 0.361151 3
#> ATC:kmeans 34     4.14e-08 9.78e-07 0.849639 4
#> ATC:kmeans 52     3.00e-11 3.29e-11 0.003835 5
#> ATC:kmeans 66     6.95e-13 4.96e-20 0.000119 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 18792 rows and 77 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 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-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.747           0.933       0.919         0.2196 0.895   0.788
#> 4 4 0.805           0.880       0.919         0.2177 0.859   0.637
#> 5 5 0.803           0.766       0.806         0.0577 1.000   1.000
#> 6 6 0.798           0.701       0.774         0.0428 0.862   0.500

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87963     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87983     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87984     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87961     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87970     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87971     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87990     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87991     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87974     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87994     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87978     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87979     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87998     1  0.0592      0.951 0.988 0.000 0.012
#> GSM87999     1  0.0592      0.951 0.988 0.000 0.012
#> GSM87968     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87987     1  0.0592      0.951 0.988 0.000 0.012
#> GSM87969     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87988     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87989     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87972     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87992     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87973     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87993     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87975     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87995     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87976     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87977     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87996     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87997     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87980     1  0.3340      0.939 0.880 0.000 0.120
#> GSM88000     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87981     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87982     1  0.3340      0.939 0.880 0.000 0.120
#> GSM88001     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87967     1  0.3340      0.939 0.880 0.000 0.120
#> GSM87964     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87965     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87966     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87985     1  0.0000      0.951 1.000 0.000 0.000
#> GSM87986     1  0.0000      0.951 1.000 0.000 0.000
#> GSM88004     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88015     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88005     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88006     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88016     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88007     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88017     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88029     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88008     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88009     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88018     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88024     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88030     3  0.4702      0.884 0.000 0.212 0.788
#> GSM88036     3  0.4702      0.884 0.000 0.212 0.788
#> GSM88010     2  0.5591      0.540 0.000 0.696 0.304
#> GSM88011     2  0.5591      0.540 0.000 0.696 0.304
#> GSM88019     2  0.5529      0.556 0.000 0.704 0.296
#> GSM88027     2  0.2878      0.852 0.000 0.904 0.096
#> GSM88031     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88012     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88020     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88032     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88037     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88013     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88021     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88025     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88033     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88014     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88022     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88034     3  0.3340      0.982 0.000 0.120 0.880
#> GSM88002     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88003     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88023     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88026     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88028     2  0.0000      0.944 0.000 1.000 0.000
#> GSM88035     2  0.0000      0.944 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
#> GSM87962     1  0.1661      0.884 0.944 0.000 0.052 0.004
#> GSM87963     1  0.1743      0.883 0.940 0.000 0.056 0.004
#> GSM87983     1  0.0000      0.879 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.879 1.000 0.000 0.000 0.000
#> GSM87961     1  0.1743      0.883 0.940 0.000 0.056 0.004
#> GSM87970     1  0.3972      0.828 0.788 0.000 0.204 0.008
#> GSM87971     1  0.3972      0.828 0.788 0.000 0.204 0.008
#> GSM87990     1  0.0000      0.879 1.000 0.000 0.000 0.000
#> GSM87991     1  0.0000      0.879 1.000 0.000 0.000 0.000
#> GSM87974     1  0.3972      0.828 0.788 0.000 0.204 0.008
#> GSM87994     1  0.0000      0.879 1.000 0.000 0.000 0.000
#> GSM87978     1  0.3972      0.828 0.788 0.000 0.204 0.008
#> GSM87979     1  0.3972      0.828 0.788 0.000 0.204 0.008
#> GSM87998     1  0.2011      0.820 0.920 0.000 0.080 0.000
#> GSM87999     1  0.2149      0.811 0.912 0.000 0.088 0.000
#> GSM87968     1  0.3972      0.828 0.788 0.000 0.204 0.008
#> GSM87987     1  0.1867      0.828 0.928 0.000 0.072 0.000
#> GSM87969     1  0.3972      0.828 0.788 0.000 0.204 0.008
#> GSM87988     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87989     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87972     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM87992     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87973     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM87993     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87975     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM87995     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87976     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM87977     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM87996     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87997     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87980     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM88000     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87981     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM87982     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM88001     3  0.3907      0.860 0.232 0.000 0.768 0.000
#> GSM87967     3  0.0817      0.865 0.024 0.000 0.976 0.000
#> GSM87964     1  0.3972      0.828 0.788 0.000 0.204 0.008
#> GSM87965     1  0.1661      0.884 0.944 0.000 0.052 0.004
#> GSM87966     1  0.0000      0.879 1.000 0.000 0.000 0.000
#> GSM87985     1  0.0000      0.879 1.000 0.000 0.000 0.000
#> GSM87986     1  0.0000      0.879 1.000 0.000 0.000 0.000
#> GSM88004     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88005     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0817      0.935 0.000 0.976 0.024 0.000
#> GSM88029     2  0.0817      0.935 0.000 0.976 0.024 0.000
#> GSM88008     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000      0.936 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0592      0.936 0.000 0.984 0.016 0.000
#> GSM88030     4  0.4050      0.790 0.000 0.168 0.024 0.808
#> GSM88036     4  0.4050      0.790 0.000 0.168 0.024 0.808
#> GSM88010     2  0.4522      0.575 0.000 0.680 0.000 0.320
#> GSM88011     2  0.4585      0.552 0.000 0.668 0.000 0.332
#> GSM88019     2  0.4477      0.589 0.000 0.688 0.000 0.312
#> GSM88027     2  0.2647      0.837 0.000 0.880 0.000 0.120
#> GSM88031     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88012     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88020     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88032     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88037     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88013     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88021     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88025     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88033     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88014     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88022     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88034     4  0.0336      0.970 0.000 0.008 0.000 0.992
#> GSM88002     2  0.0817      0.935 0.000 0.976 0.024 0.000
#> GSM88003     2  0.0817      0.935 0.000 0.976 0.024 0.000
#> GSM88023     2  0.0817      0.935 0.000 0.976 0.024 0.000
#> GSM88026     2  0.0817      0.935 0.000 0.976 0.024 0.000
#> GSM88028     2  0.0817      0.935 0.000 0.976 0.024 0.000
#> GSM88035     2  0.0817      0.935 0.000 0.976 0.024 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
#> GSM87962     1  0.1697      0.786 0.932 0.000 0.008 0.000 NA
#> GSM87963     1  0.1697      0.786 0.932 0.000 0.008 0.000 NA
#> GSM87983     1  0.0162      0.782 0.996 0.000 0.004 0.000 NA
#> GSM87984     1  0.0000      0.783 1.000 0.000 0.000 0.000 NA
#> GSM87961     1  0.1697      0.786 0.932 0.000 0.008 0.000 NA
#> GSM87970     1  0.5381      0.665 0.516 0.000 0.056 0.000 NA
#> GSM87971     1  0.5393      0.660 0.504 0.000 0.056 0.000 NA
#> GSM87990     1  0.0162      0.784 0.996 0.000 0.000 0.000 NA
#> GSM87991     1  0.1608      0.747 0.928 0.000 0.072 0.000 NA
#> GSM87974     1  0.5393      0.660 0.504 0.000 0.056 0.000 NA
#> GSM87994     1  0.2280      0.717 0.880 0.000 0.120 0.000 NA
#> GSM87978     1  0.5393      0.660 0.504 0.000 0.056 0.000 NA
#> GSM87979     1  0.5414      0.670 0.528 0.000 0.060 0.000 NA
#> GSM87998     1  0.3143      0.644 0.796 0.000 0.204 0.000 NA
#> GSM87999     1  0.3242      0.630 0.784 0.000 0.216 0.000 NA
#> GSM87968     1  0.5443      0.658 0.504 0.000 0.060 0.000 NA
#> GSM87987     1  0.3242      0.636 0.784 0.000 0.216 0.000 NA
#> GSM87969     1  0.5474      0.683 0.576 0.000 0.076 0.000 NA
#> GSM87988     3  0.2732      0.810 0.160 0.000 0.840 0.000 NA
#> GSM87989     3  0.2648      0.818 0.152 0.000 0.848 0.000 NA
#> GSM87972     3  0.2471      0.843 0.000 0.000 0.864 0.000 NA
#> GSM87992     3  0.2179      0.850 0.112 0.000 0.888 0.000 NA
#> GSM87973     3  0.2280      0.849 0.000 0.000 0.880 0.000 NA
#> GSM87993     3  0.2179      0.850 0.112 0.000 0.888 0.000 NA
#> GSM87975     3  0.3561      0.757 0.000 0.000 0.740 0.000 NA
#> GSM87995     3  0.2179      0.850 0.112 0.000 0.888 0.000 NA
#> GSM87976     3  0.3612      0.750 0.000 0.000 0.732 0.000 NA
#> GSM87977     3  0.2471      0.843 0.000 0.000 0.864 0.000 NA
#> GSM87996     3  0.2179      0.850 0.112 0.000 0.888 0.000 NA
#> GSM87997     3  0.2179      0.850 0.112 0.000 0.888 0.000 NA
#> GSM87980     3  0.2561      0.840 0.000 0.000 0.856 0.000 NA
#> GSM88000     3  0.2179      0.850 0.112 0.000 0.888 0.000 NA
#> GSM87981     3  0.2377      0.846 0.000 0.000 0.872 0.000 NA
#> GSM87982     3  0.2439      0.850 0.004 0.000 0.876 0.000 NA
#> GSM88001     3  0.2179      0.850 0.112 0.000 0.888 0.000 NA
#> GSM87967     3  0.2439      0.850 0.004 0.000 0.876 0.000 NA
#> GSM87964     1  0.5393      0.660 0.504 0.000 0.056 0.000 NA
#> GSM87965     1  0.1697      0.786 0.932 0.000 0.008 0.000 NA
#> GSM87966     1  0.0162      0.782 0.996 0.000 0.004 0.000 NA
#> GSM87985     1  0.0000      0.783 1.000 0.000 0.000 0.000 NA
#> GSM87986     1  0.0162      0.782 0.996 0.000 0.004 0.000 NA
#> GSM88004     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88015     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88005     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88006     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88016     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88007     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88017     2  0.4192      0.711 0.000 0.596 0.000 0.000 NA
#> GSM88029     2  0.4210      0.709 0.000 0.588 0.000 0.000 NA
#> GSM88008     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88009     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88018     2  0.0000      0.789 0.000 1.000 0.000 0.000 NA
#> GSM88024     2  0.3452      0.752 0.000 0.756 0.000 0.000 NA
#> GSM88030     4  0.5896      0.267 0.000 0.100 0.000 0.452 NA
#> GSM88036     4  0.5896      0.267 0.000 0.100 0.000 0.452 NA
#> GSM88010     2  0.3942      0.553 0.000 0.728 0.000 0.260 NA
#> GSM88011     2  0.3662      0.565 0.000 0.744 0.000 0.252 NA
#> GSM88019     2  0.3395      0.586 0.000 0.764 0.000 0.236 NA
#> GSM88027     2  0.1851      0.730 0.000 0.912 0.000 0.088 NA
#> GSM88031     4  0.0000      0.914 0.000 0.000 0.000 1.000 NA
#> GSM88012     4  0.0404      0.910 0.000 0.000 0.000 0.988 NA
#> GSM88020     4  0.0609      0.906 0.000 0.000 0.000 0.980 NA
#> GSM88032     4  0.0000      0.914 0.000 0.000 0.000 1.000 NA
#> GSM88037     4  0.0000      0.914 0.000 0.000 0.000 1.000 NA
#> GSM88013     4  0.0162      0.914 0.000 0.000 0.000 0.996 NA
#> GSM88021     4  0.0000      0.914 0.000 0.000 0.000 1.000 NA
#> GSM88025     4  0.0000      0.914 0.000 0.000 0.000 1.000 NA
#> GSM88033     4  0.0000      0.914 0.000 0.000 0.000 1.000 NA
#> GSM88014     4  0.0162      0.914 0.000 0.000 0.000 0.996 NA
#> GSM88022     4  0.0162      0.914 0.000 0.000 0.000 0.996 NA
#> GSM88034     4  0.0609      0.906 0.000 0.000 0.000 0.980 NA
#> GSM88002     2  0.4235      0.704 0.000 0.576 0.000 0.000 NA
#> GSM88003     2  0.4235      0.704 0.000 0.576 0.000 0.000 NA
#> GSM88023     2  0.4235      0.704 0.000 0.576 0.000 0.000 NA
#> GSM88026     2  0.4235      0.704 0.000 0.576 0.000 0.000 NA
#> GSM88028     2  0.4235      0.704 0.000 0.576 0.000 0.000 NA
#> GSM88035     2  0.4235      0.704 0.000 0.576 0.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.0790     0.7932 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM87963     1  0.0790     0.7932 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM87983     1  0.1610     0.8680 0.916 0.000 0.084 0.000 0.000 0.000
#> GSM87984     1  0.1610     0.8680 0.916 0.000 0.084 0.000 0.000 0.000
#> GSM87961     1  0.0790     0.7932 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM87970     6  0.3861     0.6748 0.352 0.000 0.000 0.000 0.008 0.640
#> GSM87971     6  0.3725     0.7060 0.316 0.000 0.000 0.000 0.008 0.676
#> GSM87990     1  0.1753     0.8670 0.912 0.000 0.084 0.000 0.000 0.004
#> GSM87991     1  0.2631     0.7698 0.820 0.000 0.180 0.000 0.000 0.000
#> GSM87974     6  0.3707     0.7011 0.312 0.000 0.000 0.000 0.008 0.680
#> GSM87994     1  0.3930     0.3942 0.576 0.000 0.420 0.000 0.000 0.004
#> GSM87978     6  0.3619     0.7069 0.316 0.000 0.000 0.000 0.004 0.680
#> GSM87979     6  0.3782     0.6714 0.360 0.000 0.000 0.000 0.004 0.636
#> GSM87998     3  0.4158    -0.0233 0.416 0.000 0.572 0.000 0.004 0.008
#> GSM87999     3  0.4158    -0.0233 0.416 0.000 0.572 0.000 0.004 0.008
#> GSM87968     6  0.3619     0.7069 0.316 0.000 0.000 0.000 0.004 0.680
#> GSM87987     3  0.4394    -0.0212 0.408 0.000 0.568 0.000 0.004 0.020
#> GSM87969     6  0.4576     0.5797 0.412 0.000 0.024 0.000 0.008 0.556
#> GSM87988     3  0.1757     0.6426 0.076 0.000 0.916 0.000 0.000 0.008
#> GSM87989     3  0.1524     0.6537 0.060 0.000 0.932 0.000 0.000 0.008
#> GSM87972     3  0.5853     0.4757 0.008 0.000 0.520 0.000 0.184 0.288
#> GSM87992     3  0.0260     0.6835 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM87973     3  0.5689     0.5092 0.008 0.000 0.560 0.000 0.180 0.252
#> GSM87993     3  0.0260     0.6835 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM87975     6  0.5870    -0.1782 0.000 0.000 0.276 0.000 0.244 0.480
#> GSM87995     3  0.0260     0.6835 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM87976     6  0.5858    -0.1708 0.000 0.000 0.272 0.000 0.244 0.484
#> GSM87977     3  0.5839     0.4735 0.008 0.000 0.524 0.000 0.184 0.284
#> GSM87996     3  0.0260     0.6835 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM87997     3  0.0260     0.6835 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM87980     3  0.5982     0.3614 0.000 0.000 0.428 0.000 0.240 0.332
#> GSM88000     3  0.0260     0.6835 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM87981     3  0.5680     0.4961 0.004 0.000 0.544 0.000 0.184 0.268
#> GSM87982     3  0.5587     0.5107 0.004 0.000 0.564 0.000 0.180 0.252
#> GSM88001     3  0.0260     0.6835 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM87967     3  0.5671     0.5116 0.008 0.000 0.564 0.000 0.180 0.248
#> GSM87964     6  0.4745     0.6228 0.268 0.000 0.000 0.000 0.088 0.644
#> GSM87965     1  0.0790     0.7932 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM87966     1  0.1814     0.8562 0.900 0.000 0.100 0.000 0.000 0.000
#> GSM87985     1  0.1610     0.8680 0.916 0.000 0.084 0.000 0.000 0.000
#> GSM87986     1  0.1610     0.8680 0.916 0.000 0.084 0.000 0.000 0.000
#> GSM88004     2  0.0146     0.8581 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM88015     2  0.0405     0.8539 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM88005     2  0.0146     0.8581 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM88006     2  0.0146     0.8581 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM88016     2  0.0405     0.8539 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM88007     2  0.0146     0.8581 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM88017     5  0.4246     0.7475 0.000 0.400 0.000 0.000 0.580 0.020
#> GSM88029     5  0.4209     0.7721 0.000 0.384 0.000 0.000 0.596 0.020
#> GSM88008     2  0.0146     0.8581 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM88009     2  0.0146     0.8581 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM88018     2  0.0717     0.8478 0.000 0.976 0.000 0.000 0.016 0.008
#> GSM88024     2  0.4049    -0.0150 0.000 0.648 0.000 0.000 0.332 0.020
#> GSM88030     5  0.4904     0.5844 0.000 0.068 0.000 0.248 0.664 0.020
#> GSM88036     5  0.4904     0.5844 0.000 0.068 0.000 0.248 0.664 0.020
#> GSM88010     2  0.3973     0.6223 0.000 0.728 0.000 0.232 0.036 0.004
#> GSM88011     2  0.3488     0.6583 0.000 0.764 0.000 0.216 0.016 0.004
#> GSM88019     2  0.3158     0.7182 0.000 0.812 0.000 0.164 0.020 0.004
#> GSM88027     2  0.2069     0.8068 0.000 0.908 0.000 0.068 0.020 0.004
#> GSM88031     4  0.0000     0.9855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88012     4  0.0858     0.9739 0.000 0.000 0.000 0.968 0.028 0.004
#> GSM88020     4  0.1168     0.9605 0.000 0.000 0.000 0.956 0.028 0.016
#> GSM88032     4  0.0000     0.9855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88037     4  0.0000     0.9855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88013     4  0.0603     0.9806 0.000 0.000 0.000 0.980 0.016 0.004
#> GSM88021     4  0.0000     0.9855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88025     4  0.0000     0.9855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88033     4  0.0000     0.9855 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88014     4  0.0603     0.9806 0.000 0.000 0.000 0.980 0.016 0.004
#> GSM88022     4  0.0603     0.9806 0.000 0.000 0.000 0.980 0.016 0.004
#> GSM88034     4  0.1168     0.9605 0.000 0.000 0.000 0.956 0.028 0.016
#> GSM88002     5  0.3547     0.8530 0.000 0.332 0.000 0.000 0.668 0.000
#> GSM88003     5  0.3547     0.8530 0.000 0.332 0.000 0.000 0.668 0.000
#> GSM88023     5  0.3547     0.8530 0.000 0.332 0.000 0.000 0.668 0.000
#> GSM88026     5  0.3547     0.8530 0.000 0.332 0.000 0.000 0.668 0.000
#> GSM88028     5  0.3547     0.8530 0.000 0.332 0.000 0.000 0.668 0.000
#> GSM88035     5  0.3547     0.8530 0.000 0.332 0.000 0.000 0.668 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 cell.line(p) agent(p)  time(p) k
#> ATC:skmeans 77     1.27e-17 3.00e-14 3.61e-01 2
#> ATC:skmeans 77     1.90e-17 1.49e-13 4.49e-03 3
#> ATC:skmeans 77     1.35e-16 5.01e-15 4.16e-05 4
#> ATC:skmeans 75     3.62e-16 2.04e-14 1.33e-05 5
#> ATC:skmeans 66     6.95e-13 3.10e-17 2.91e-06 6

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


ATC: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 18792 rows and 77 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 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-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           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.913           0.855       0.946         0.2817 0.859   0.714
#> 4 4 0.830           0.805       0.924         0.1681 0.891   0.691
#> 5 5 0.877           0.801       0.927         0.0460 0.946   0.786
#> 6 6 0.897           0.890       0.941         0.0562 0.928   0.674

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000     0.8342 1.000  0 0.000
#> GSM87963     1  0.0000     0.8342 1.000  0 0.000
#> GSM87983     1  0.4555     0.6845 0.800  0 0.200
#> GSM87984     1  0.4555     0.6845 0.800  0 0.200
#> GSM87961     1  0.0000     0.8342 1.000  0 0.000
#> GSM87970     1  0.0000     0.8342 1.000  0 0.000
#> GSM87971     1  0.0000     0.8342 1.000  0 0.000
#> GSM87990     1  0.0000     0.8342 1.000  0 0.000
#> GSM87991     3  0.6307    -0.1131 0.488  0 0.512
#> GSM87974     1  0.0000     0.8342 1.000  0 0.000
#> GSM87994     3  0.0000     0.9183 0.000  0 1.000
#> GSM87978     1  0.0000     0.8342 1.000  0 0.000
#> GSM87979     1  0.0000     0.8342 1.000  0 0.000
#> GSM87998     3  0.0000     0.9183 0.000  0 1.000
#> GSM87999     3  0.0000     0.9183 0.000  0 1.000
#> GSM87968     1  0.0000     0.8342 1.000  0 0.000
#> GSM87987     3  0.5621     0.4231 0.308  0 0.692
#> GSM87969     1  0.0000     0.8342 1.000  0 0.000
#> GSM87988     3  0.0000     0.9183 0.000  0 1.000
#> GSM87989     3  0.0000     0.9183 0.000  0 1.000
#> GSM87972     1  0.6307     0.0822 0.512  0 0.488
#> GSM87992     3  0.0000     0.9183 0.000  0 1.000
#> GSM87973     3  0.0000     0.9183 0.000  0 1.000
#> GSM87993     3  0.0000     0.9183 0.000  0 1.000
#> GSM87975     1  0.6225     0.2353 0.568  0 0.432
#> GSM87995     3  0.0000     0.9183 0.000  0 1.000
#> GSM87976     1  0.1643     0.8099 0.956  0 0.044
#> GSM87977     1  0.6307     0.0822 0.512  0 0.488
#> GSM87996     3  0.0000     0.9183 0.000  0 1.000
#> GSM87997     3  0.0000     0.9183 0.000  0 1.000
#> GSM87980     1  0.6307     0.0822 0.512  0 0.488
#> GSM88000     3  0.0000     0.9183 0.000  0 1.000
#> GSM87981     3  0.5431     0.5232 0.284  0 0.716
#> GSM87982     3  0.0000     0.9183 0.000  0 1.000
#> GSM88001     3  0.0000     0.9183 0.000  0 1.000
#> GSM87967     3  0.0592     0.9071 0.012  0 0.988
#> GSM87964     1  0.0000     0.8342 1.000  0 0.000
#> GSM87965     1  0.0000     0.8342 1.000  0 0.000
#> GSM87966     1  0.6225     0.2583 0.568  0 0.432
#> GSM87985     1  0.2448     0.7914 0.924  0 0.076
#> GSM87986     1  0.4605     0.6801 0.796  0 0.204
#> GSM88004     2  0.0000     1.0000 0.000  1 0.000
#> GSM88015     2  0.0000     1.0000 0.000  1 0.000
#> GSM88005     2  0.0000     1.0000 0.000  1 0.000
#> GSM88006     2  0.0000     1.0000 0.000  1 0.000
#> GSM88016     2  0.0000     1.0000 0.000  1 0.000
#> GSM88007     2  0.0000     1.0000 0.000  1 0.000
#> GSM88017     2  0.0000     1.0000 0.000  1 0.000
#> GSM88029     2  0.0000     1.0000 0.000  1 0.000
#> GSM88008     2  0.0000     1.0000 0.000  1 0.000
#> GSM88009     2  0.0000     1.0000 0.000  1 0.000
#> GSM88018     2  0.0000     1.0000 0.000  1 0.000
#> GSM88024     2  0.0000     1.0000 0.000  1 0.000
#> GSM88030     2  0.0000     1.0000 0.000  1 0.000
#> GSM88036     2  0.0000     1.0000 0.000  1 0.000
#> GSM88010     2  0.0000     1.0000 0.000  1 0.000
#> GSM88011     2  0.0000     1.0000 0.000  1 0.000
#> GSM88019     2  0.0000     1.0000 0.000  1 0.000
#> GSM88027     2  0.0000     1.0000 0.000  1 0.000
#> GSM88031     2  0.0000     1.0000 0.000  1 0.000
#> GSM88012     2  0.0000     1.0000 0.000  1 0.000
#> GSM88020     2  0.0000     1.0000 0.000  1 0.000
#> GSM88032     2  0.0000     1.0000 0.000  1 0.000
#> GSM88037     2  0.0000     1.0000 0.000  1 0.000
#> GSM88013     2  0.0000     1.0000 0.000  1 0.000
#> GSM88021     2  0.0000     1.0000 0.000  1 0.000
#> GSM88025     2  0.0000     1.0000 0.000  1 0.000
#> GSM88033     2  0.0000     1.0000 0.000  1 0.000
#> GSM88014     2  0.0000     1.0000 0.000  1 0.000
#> GSM88022     2  0.0000     1.0000 0.000  1 0.000
#> GSM88034     2  0.0000     1.0000 0.000  1 0.000
#> GSM88002     2  0.0000     1.0000 0.000  1 0.000
#> GSM88003     2  0.0000     1.0000 0.000  1 0.000
#> GSM88023     2  0.0000     1.0000 0.000  1 0.000
#> GSM88026     2  0.0000     1.0000 0.000  1 0.000
#> GSM88028     2  0.0000     1.0000 0.000  1 0.000
#> GSM88035     2  0.0000     1.0000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87983     1  0.3610     0.6845 0.800 0.000 0.200 0.000
#> GSM87984     1  0.3610     0.6845 0.800 0.000 0.200 0.000
#> GSM87961     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87970     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87971     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87990     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87991     3  0.4998    -0.1131 0.488 0.000 0.512 0.000
#> GSM87974     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87994     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87978     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87979     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87998     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87999     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87968     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87987     3  0.4454     0.4231 0.308 0.000 0.692 0.000
#> GSM87969     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87988     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87989     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87972     1  0.4998     0.0822 0.512 0.000 0.488 0.000
#> GSM87992     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87975     1  0.4933     0.2353 0.568 0.000 0.432 0.000
#> GSM87995     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87976     1  0.1302     0.8099 0.956 0.000 0.044 0.000
#> GSM87977     1  0.4998     0.0822 0.512 0.000 0.488 0.000
#> GSM87996     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87980     1  0.4998     0.0822 0.512 0.000 0.488 0.000
#> GSM88000     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87981     3  0.4304     0.5232 0.284 0.000 0.716 0.000
#> GSM87982     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000     0.9183 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0469     0.9071 0.012 0.000 0.988 0.000
#> GSM87964     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87965     1  0.0000     0.8342 1.000 0.000 0.000 0.000
#> GSM87966     1  0.4933     0.2583 0.568 0.000 0.432 0.000
#> GSM87985     1  0.1940     0.7914 0.924 0.000 0.076 0.000
#> GSM87986     1  0.3649     0.6801 0.796 0.000 0.204 0.000
#> GSM88004     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88015     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88005     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88006     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88016     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88007     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88017     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88029     2  0.4585     0.5551 0.000 0.668 0.000 0.332
#> GSM88008     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88009     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88018     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88024     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88030     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88036     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88010     4  0.4406     0.5482 0.000 0.300 0.000 0.700
#> GSM88011     4  0.4843     0.3770 0.000 0.396 0.000 0.604
#> GSM88019     2  0.0188     0.9409 0.000 0.996 0.000 0.004
#> GSM88027     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88031     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88012     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88020     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88032     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88013     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88021     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88014     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88022     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88034     4  0.0000     0.9512 0.000 0.000 0.000 1.000
#> GSM88002     2  0.3837     0.7412 0.000 0.776 0.000 0.224
#> GSM88003     2  0.2868     0.8455 0.000 0.864 0.000 0.136
#> GSM88023     2  0.3311     0.8076 0.000 0.828 0.000 0.172
#> GSM88026     2  0.2868     0.8454 0.000 0.864 0.000 0.136
#> GSM88028     2  0.0000     0.9433 0.000 1.000 0.000 0.000
#> GSM88035     2  0.0000     0.9433 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
#> GSM87962     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87963     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87983     1  0.3109     0.6845 0.800 0.000 0.200 0.000 0.000
#> GSM87984     1  0.3109     0.6845 0.800 0.000 0.200 0.000 0.000
#> GSM87961     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87970     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87971     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87990     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87991     3  0.4305    -0.1131 0.488 0.000 0.512 0.000 0.000
#> GSM87974     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87994     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87978     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87979     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87998     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87999     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87968     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87987     3  0.3837     0.4231 0.308 0.000 0.692 0.000 0.000
#> GSM87969     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87988     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87989     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87972     1  0.4305     0.0822 0.512 0.000 0.488 0.000 0.000
#> GSM87992     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87973     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87993     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87975     1  0.4249     0.2353 0.568 0.000 0.432 0.000 0.000
#> GSM87995     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87976     1  0.1121     0.8095 0.956 0.000 0.044 0.000 0.000
#> GSM87977     1  0.4305     0.0822 0.512 0.000 0.488 0.000 0.000
#> GSM87996     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87997     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87980     1  0.4305     0.0822 0.512 0.000 0.488 0.000 0.000
#> GSM88000     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87981     3  0.3707     0.5232 0.284 0.000 0.716 0.000 0.000
#> GSM87982     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM88001     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM87967     3  0.0404     0.9071 0.012 0.000 0.988 0.000 0.000
#> GSM87964     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87965     1  0.0000     0.8297 1.000 0.000 0.000 0.000 0.000
#> GSM87966     1  0.4249     0.2583 0.568 0.000 0.432 0.000 0.000
#> GSM87985     1  0.1671     0.7914 0.924 0.000 0.076 0.000 0.000
#> GSM87986     1  0.3143     0.6801 0.796 0.000 0.204 0.000 0.000
#> GSM88004     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88015     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88005     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88006     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88016     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88007     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88017     2  0.0703     0.9364 0.000 0.976 0.000 0.000 0.024
#> GSM88029     5  0.0162     0.9164 0.000 0.004 0.000 0.000 0.996
#> GSM88008     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88009     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88018     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88024     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88030     5  0.3424     0.6863 0.000 0.000 0.000 0.240 0.760
#> GSM88036     5  0.4074     0.4650 0.000 0.000 0.000 0.364 0.636
#> GSM88010     2  0.4268     0.1327 0.000 0.556 0.000 0.444 0.000
#> GSM88011     4  0.4219     0.2470 0.000 0.416 0.000 0.584 0.000
#> GSM88019     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88027     2  0.0000     0.9588 0.000 1.000 0.000 0.000 0.000
#> GSM88031     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88012     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88020     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88032     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88037     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88013     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88021     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88025     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88033     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88014     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88022     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88034     4  0.0000     0.9571 0.000 0.000 0.000 1.000 0.000
#> GSM88002     5  0.0000     0.9191 0.000 0.000 0.000 0.000 1.000
#> GSM88003     5  0.0000     0.9191 0.000 0.000 0.000 0.000 1.000
#> GSM88023     5  0.0000     0.9191 0.000 0.000 0.000 0.000 1.000
#> GSM88026     5  0.0000     0.9191 0.000 0.000 0.000 0.000 1.000
#> GSM88028     5  0.0000     0.9191 0.000 0.000 0.000 0.000 1.000
#> GSM88035     5  0.0000     0.9191 0.000 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.0146      0.969 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM87963     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87983     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87961     1  0.0146      0.969 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM87970     6  0.2491      0.873 0.164 0.000 0.000 0.000 0.000 0.836
#> GSM87971     6  0.2048      0.899 0.120 0.000 0.000 0.000 0.000 0.880
#> GSM87990     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87991     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87974     6  0.1910      0.900 0.108 0.000 0.000 0.000 0.000 0.892
#> GSM87994     1  0.3076      0.662 0.760 0.000 0.240 0.000 0.000 0.000
#> GSM87978     6  0.2092      0.898 0.124 0.000 0.000 0.000 0.000 0.876
#> GSM87979     6  0.2454      0.876 0.160 0.000 0.000 0.000 0.000 0.840
#> GSM87998     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87999     3  0.0146      0.947 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM87968     6  0.1910      0.900 0.108 0.000 0.000 0.000 0.000 0.892
#> GSM87987     6  0.3737      0.424 0.000 0.000 0.392 0.000 0.000 0.608
#> GSM87969     6  0.2135      0.896 0.128 0.000 0.000 0.000 0.000 0.872
#> GSM87988     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87989     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87972     6  0.1910      0.852 0.000 0.000 0.108 0.000 0.000 0.892
#> GSM87992     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87973     3  0.1327      0.911 0.000 0.000 0.936 0.000 0.000 0.064
#> GSM87993     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87975     6  0.1910      0.852 0.000 0.000 0.108 0.000 0.000 0.892
#> GSM87995     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87976     6  0.1910      0.900 0.108 0.000 0.000 0.000 0.000 0.892
#> GSM87977     6  0.1910      0.852 0.000 0.000 0.108 0.000 0.000 0.892
#> GSM87996     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87997     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87980     6  0.1910      0.852 0.000 0.000 0.108 0.000 0.000 0.892
#> GSM88000     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87981     3  0.3828      0.173 0.000 0.000 0.560 0.000 0.000 0.440
#> GSM87982     3  0.1327      0.911 0.000 0.000 0.936 0.000 0.000 0.064
#> GSM88001     3  0.0000      0.950 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM87967     3  0.1501      0.900 0.000 0.000 0.924 0.000 0.000 0.076
#> GSM87964     6  0.2491      0.873 0.164 0.000 0.000 0.000 0.000 0.836
#> GSM87965     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87966     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87985     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM87986     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM88004     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88015     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88005     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88006     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88016     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88007     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88017     2  0.0632      0.937 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM88029     5  0.0146      0.929 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM88008     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88009     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88018     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88024     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88030     5  0.4036      0.763 0.000 0.000 0.000 0.136 0.756 0.108
#> GSM88036     5  0.4934      0.572 0.000 0.000 0.000 0.264 0.628 0.108
#> GSM88010     2  0.3833      0.143 0.000 0.556 0.000 0.444 0.000 0.000
#> GSM88011     4  0.3789      0.242 0.000 0.416 0.000 0.584 0.000 0.000
#> GSM88019     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88027     2  0.0000      0.959 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88031     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88012     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88020     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88032     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88037     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88013     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88021     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88025     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88033     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88014     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88022     4  0.0000      0.949 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM88034     4  0.1910      0.857 0.000 0.000 0.000 0.892 0.000 0.108
#> GSM88002     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88003     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88023     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88026     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88028     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88035     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 cell.line(p) agent(p)  time(p) k
#> ATC:pam 77     1.27e-17 3.00e-14 3.61e-01 2
#> ATC:pam 70     6.31e-16 7.64e-15 1.55e-01 3
#> ATC:pam 69     6.99e-15 2.24e-14 5.71e-03 4
#> ATC:pam 67     9.75e-14 3.80e-17 8.34e-05 5
#> ATC:pam 73     2.43e-14 1.22e-19 2.42e-04 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 18792 rows and 77 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.960           0.922       0.967         0.2779 0.859   0.714
#> 4 4 0.800           0.794       0.874         0.1198 0.938   0.826
#> 5 5 0.846           0.841       0.927         0.0774 0.926   0.748
#> 6 6 0.796           0.674       0.780         0.0467 0.946   0.758

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0000      0.900 1.000  0 0.000
#> GSM87963     1  0.0000      0.900 1.000  0 0.000
#> GSM87983     1  0.0000      0.900 1.000  0 0.000
#> GSM87984     1  0.0000      0.900 1.000  0 0.000
#> GSM87961     1  0.0000      0.900 1.000  0 0.000
#> GSM87970     1  0.0592      0.901 0.988  0 0.012
#> GSM87971     1  0.1031      0.897 0.976  0 0.024
#> GSM87990     1  0.0237      0.901 0.996  0 0.004
#> GSM87991     1  0.5948      0.487 0.640  0 0.360
#> GSM87974     1  0.0592      0.901 0.988  0 0.012
#> GSM87994     1  0.4887      0.711 0.772  0 0.228
#> GSM87978     1  0.0592      0.901 0.988  0 0.012
#> GSM87979     1  0.0592      0.901 0.988  0 0.012
#> GSM87998     1  0.6305      0.156 0.516  0 0.484
#> GSM87999     1  0.6309      0.098 0.500  0 0.500
#> GSM87968     1  0.0592      0.901 0.988  0 0.012
#> GSM87987     1  0.4842      0.720 0.776  0 0.224
#> GSM87969     1  0.2796      0.850 0.908  0 0.092
#> GSM87988     3  0.5363      0.568 0.276  0 0.724
#> GSM87989     3  0.4605      0.703 0.204  0 0.796
#> GSM87972     3  0.0000      0.966 0.000  0 1.000
#> GSM87992     3  0.0424      0.959 0.008  0 0.992
#> GSM87973     3  0.0000      0.966 0.000  0 1.000
#> GSM87993     3  0.0000      0.966 0.000  0 1.000
#> GSM87975     3  0.0000      0.966 0.000  0 1.000
#> GSM87995     3  0.0000      0.966 0.000  0 1.000
#> GSM87976     3  0.0000      0.966 0.000  0 1.000
#> GSM87977     3  0.0000      0.966 0.000  0 1.000
#> GSM87996     3  0.0000      0.966 0.000  0 1.000
#> GSM87997     3  0.0000      0.966 0.000  0 1.000
#> GSM87980     3  0.0000      0.966 0.000  0 1.000
#> GSM88000     3  0.0000      0.966 0.000  0 1.000
#> GSM87981     3  0.0000      0.966 0.000  0 1.000
#> GSM87982     3  0.0000      0.966 0.000  0 1.000
#> GSM88001     3  0.0000      0.966 0.000  0 1.000
#> GSM87967     3  0.0000      0.966 0.000  0 1.000
#> GSM87964     1  0.1860      0.883 0.948  0 0.052
#> GSM87965     1  0.0424      0.901 0.992  0 0.008
#> GSM87966     1  0.0747      0.898 0.984  0 0.016
#> GSM87985     1  0.0000      0.900 1.000  0 0.000
#> GSM87986     1  0.0237      0.901 0.996  0 0.004
#> GSM88004     2  0.0000      1.000 0.000  1 0.000
#> GSM88015     2  0.0000      1.000 0.000  1 0.000
#> GSM88005     2  0.0000      1.000 0.000  1 0.000
#> GSM88006     2  0.0000      1.000 0.000  1 0.000
#> GSM88016     2  0.0000      1.000 0.000  1 0.000
#> GSM88007     2  0.0000      1.000 0.000  1 0.000
#> GSM88017     2  0.0000      1.000 0.000  1 0.000
#> GSM88029     2  0.0000      1.000 0.000  1 0.000
#> GSM88008     2  0.0000      1.000 0.000  1 0.000
#> GSM88009     2  0.0000      1.000 0.000  1 0.000
#> GSM88018     2  0.0000      1.000 0.000  1 0.000
#> GSM88024     2  0.0000      1.000 0.000  1 0.000
#> GSM88030     2  0.0000      1.000 0.000  1 0.000
#> GSM88036     2  0.0000      1.000 0.000  1 0.000
#> GSM88010     2  0.0000      1.000 0.000  1 0.000
#> GSM88011     2  0.0000      1.000 0.000  1 0.000
#> GSM88019     2  0.0000      1.000 0.000  1 0.000
#> GSM88027     2  0.0000      1.000 0.000  1 0.000
#> GSM88031     2  0.0000      1.000 0.000  1 0.000
#> GSM88012     2  0.0000      1.000 0.000  1 0.000
#> GSM88020     2  0.0000      1.000 0.000  1 0.000
#> GSM88032     2  0.0000      1.000 0.000  1 0.000
#> GSM88037     2  0.0000      1.000 0.000  1 0.000
#> GSM88013     2  0.0000      1.000 0.000  1 0.000
#> GSM88021     2  0.0000      1.000 0.000  1 0.000
#> GSM88025     2  0.0000      1.000 0.000  1 0.000
#> GSM88033     2  0.0000      1.000 0.000  1 0.000
#> GSM88014     2  0.0000      1.000 0.000  1 0.000
#> GSM88022     2  0.0000      1.000 0.000  1 0.000
#> GSM88034     2  0.0000      1.000 0.000  1 0.000
#> GSM88002     2  0.0000      1.000 0.000  1 0.000
#> GSM88003     2  0.0000      1.000 0.000  1 0.000
#> GSM88023     2  0.0000      1.000 0.000  1 0.000
#> GSM88026     2  0.0000      1.000 0.000  1 0.000
#> GSM88028     2  0.0000      1.000 0.000  1 0.000
#> GSM88035     2  0.0000      1.000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>          class entropy silhouette    p1    p2    p3    p4
#> GSM87962     1  0.0000     0.9075 1.000 0.000 0.000 0.000
#> GSM87963     1  0.0000     0.9075 1.000 0.000 0.000 0.000
#> GSM87983     1  0.0000     0.9075 1.000 0.000 0.000 0.000
#> GSM87984     1  0.0000     0.9075 1.000 0.000 0.000 0.000
#> GSM87961     1  0.0188     0.9086 0.996 0.000 0.004 0.000
#> GSM87970     1  0.0188     0.9086 0.996 0.000 0.004 0.000
#> GSM87971     1  0.0707     0.9048 0.980 0.000 0.020 0.000
#> GSM87990     1  0.0188     0.9086 0.996 0.000 0.004 0.000
#> GSM87991     1  0.4830     0.4205 0.608 0.000 0.392 0.000
#> GSM87974     1  0.0188     0.9086 0.996 0.000 0.004 0.000
#> GSM87994     1  0.3400     0.7778 0.820 0.000 0.180 0.000
#> GSM87978     1  0.0188     0.9086 0.996 0.000 0.004 0.000
#> GSM87979     1  0.0336     0.9085 0.992 0.000 0.008 0.000
#> GSM87998     1  0.4925     0.3316 0.572 0.000 0.428 0.000
#> GSM87999     1  0.4925     0.3316 0.572 0.000 0.428 0.000
#> GSM87968     1  0.0336     0.9085 0.992 0.000 0.008 0.000
#> GSM87987     1  0.2647     0.8435 0.880 0.000 0.120 0.000
#> GSM87969     1  0.2011     0.8744 0.920 0.000 0.080 0.000
#> GSM87988     3  0.4955     0.0403 0.444 0.000 0.556 0.000
#> GSM87989     3  0.3024     0.7826 0.148 0.000 0.852 0.000
#> GSM87972     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87992     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87973     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87993     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87975     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87995     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87976     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87977     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87996     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87997     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87980     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM88000     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87981     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87982     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM88001     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87967     3  0.0000     0.9568 0.000 0.000 1.000 0.000
#> GSM87964     1  0.1389     0.8929 0.952 0.000 0.048 0.000
#> GSM87965     1  0.0188     0.9086 0.996 0.000 0.004 0.000
#> GSM87966     1  0.1637     0.8850 0.940 0.000 0.060 0.000
#> GSM87985     1  0.0000     0.9075 1.000 0.000 0.000 0.000
#> GSM87986     1  0.0188     0.9081 0.996 0.000 0.004 0.000
#> GSM88004     4  0.4955     0.5685 0.000 0.444 0.000 0.556
#> GSM88015     4  0.4994     0.5472 0.000 0.480 0.000 0.520
#> GSM88005     4  0.4994     0.5472 0.000 0.480 0.000 0.520
#> GSM88006     4  0.4994     0.5472 0.000 0.480 0.000 0.520
#> GSM88016     4  0.4843     0.6023 0.000 0.396 0.000 0.604
#> GSM88007     4  0.4994     0.5472 0.000 0.480 0.000 0.520
#> GSM88017     4  0.3569     0.6501 0.000 0.196 0.000 0.804
#> GSM88029     4  0.4817     0.5975 0.000 0.388 0.000 0.612
#> GSM88008     4  0.4994     0.5472 0.000 0.480 0.000 0.520
#> GSM88009     4  0.4994     0.5472 0.000 0.480 0.000 0.520
#> GSM88018     4  0.4888     0.5882 0.000 0.412 0.000 0.588
#> GSM88024     4  0.4406     0.6284 0.000 0.300 0.000 0.700
#> GSM88030     4  0.0707     0.7344 0.000 0.020 0.000 0.980
#> GSM88036     4  0.0707     0.7344 0.000 0.020 0.000 0.980
#> GSM88010     4  0.2149     0.7159 0.000 0.088 0.000 0.912
#> GSM88011     4  0.2081     0.7194 0.000 0.084 0.000 0.916
#> GSM88019     4  0.2011     0.7184 0.000 0.080 0.000 0.920
#> GSM88027     4  0.2149     0.7173 0.000 0.088 0.000 0.912
#> GSM88031     4  0.0000     0.7331 0.000 0.000 0.000 1.000
#> GSM88012     4  0.0188     0.7344 0.000 0.004 0.000 0.996
#> GSM88020     4  0.0469     0.7340 0.000 0.012 0.000 0.988
#> GSM88032     4  0.0000     0.7331 0.000 0.000 0.000 1.000
#> GSM88037     4  0.0000     0.7331 0.000 0.000 0.000 1.000
#> GSM88013     4  0.0336     0.7356 0.000 0.008 0.000 0.992
#> GSM88021     4  0.0000     0.7331 0.000 0.000 0.000 1.000
#> GSM88025     4  0.0000     0.7331 0.000 0.000 0.000 1.000
#> GSM88033     4  0.0000     0.7331 0.000 0.000 0.000 1.000
#> GSM88014     4  0.0336     0.7356 0.000 0.008 0.000 0.992
#> GSM88022     4  0.0336     0.7356 0.000 0.008 0.000 0.992
#> GSM88034     4  0.0469     0.7340 0.000 0.012 0.000 0.988
#> GSM88002     2  0.4477     1.0000 0.000 0.688 0.000 0.312
#> GSM88003     2  0.4477     1.0000 0.000 0.688 0.000 0.312
#> GSM88023     2  0.4477     1.0000 0.000 0.688 0.000 0.312
#> GSM88026     2  0.4477     1.0000 0.000 0.688 0.000 0.312
#> GSM88028     2  0.4477     1.0000 0.000 0.688 0.000 0.312
#> GSM88035     2  0.4477     1.0000 0.000 0.688 0.000 0.312

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4    p5
#> GSM87962     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000
#> GSM87963     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000
#> GSM87983     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000
#> GSM87984     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000
#> GSM87961     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000
#> GSM87970     1  0.0162      0.917 0.996 0.000 0.004 0.000 0.000
#> GSM87971     1  0.0290      0.916 0.992 0.000 0.008 0.000 0.000
#> GSM87990     1  0.0162      0.917 0.996 0.000 0.004 0.000 0.000
#> GSM87991     1  0.4074      0.470 0.636 0.000 0.364 0.000 0.000
#> GSM87974     1  0.0162      0.917 0.996 0.000 0.004 0.000 0.000
#> GSM87994     1  0.2605      0.802 0.852 0.000 0.148 0.000 0.000
#> GSM87978     1  0.0162      0.917 0.996 0.000 0.004 0.000 0.000
#> GSM87979     1  0.0162      0.917 0.996 0.000 0.004 0.000 0.000
#> GSM87998     1  0.4210      0.357 0.588 0.000 0.412 0.000 0.000
#> GSM87999     1  0.4227      0.335 0.580 0.000 0.420 0.000 0.000
#> GSM87968     1  0.0162      0.917 0.996 0.000 0.004 0.000 0.000
#> GSM87987     1  0.1671      0.873 0.924 0.000 0.076 0.000 0.000
#> GSM87969     1  0.0963      0.902 0.964 0.000 0.036 0.000 0.000
#> GSM87988     3  0.3949      0.439 0.332 0.000 0.668 0.000 0.000
#> GSM87989     3  0.2690      0.779 0.156 0.000 0.844 0.000 0.000
#> GSM87972     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87992     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87973     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87993     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87975     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87995     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87976     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87977     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87996     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87997     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87980     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM88000     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87981     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87982     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM88001     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87967     3  0.0000      0.963 0.000 0.000 1.000 0.000 0.000
#> GSM87964     1  0.0880      0.905 0.968 0.000 0.032 0.000 0.000
#> GSM87965     1  0.0162      0.917 0.996 0.000 0.004 0.000 0.000
#> GSM87966     1  0.0794      0.905 0.972 0.000 0.028 0.000 0.000
#> GSM87985     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000
#> GSM87986     1  0.0162      0.916 0.996 0.000 0.004 0.000 0.000
#> GSM88004     2  0.2424      0.815 0.000 0.868 0.000 0.132 0.000
#> GSM88015     2  0.0290      0.894 0.000 0.992 0.000 0.008 0.000
#> GSM88005     2  0.0162      0.894 0.000 0.996 0.000 0.004 0.000
#> GSM88006     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000
#> GSM88016     2  0.2280      0.838 0.000 0.880 0.000 0.120 0.000
#> GSM88007     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000
#> GSM88017     2  0.4040      0.595 0.000 0.712 0.000 0.276 0.012
#> GSM88029     2  0.3282      0.763 0.000 0.804 0.000 0.188 0.008
#> GSM88008     2  0.0162      0.894 0.000 0.996 0.000 0.004 0.000
#> GSM88009     2  0.0451      0.891 0.000 0.988 0.000 0.004 0.008
#> GSM88018     2  0.0510      0.894 0.000 0.984 0.000 0.016 0.000
#> GSM88024     2  0.3039      0.808 0.000 0.836 0.000 0.152 0.012
#> GSM88030     4  0.2377      0.738 0.000 0.000 0.000 0.872 0.128
#> GSM88036     4  0.2377      0.738 0.000 0.000 0.000 0.872 0.128
#> GSM88010     4  0.4161      0.441 0.000 0.392 0.000 0.608 0.000
#> GSM88011     4  0.4210      0.405 0.000 0.412 0.000 0.588 0.000
#> GSM88019     4  0.4210      0.405 0.000 0.412 0.000 0.588 0.000
#> GSM88027     4  0.4256      0.339 0.000 0.436 0.000 0.564 0.000
#> GSM88031     4  0.0609      0.821 0.000 0.020 0.000 0.980 0.000
#> GSM88012     4  0.1851      0.811 0.000 0.088 0.000 0.912 0.000
#> GSM88020     4  0.0324      0.817 0.000 0.004 0.000 0.992 0.004
#> GSM88032     4  0.0162      0.818 0.000 0.004 0.000 0.996 0.000
#> GSM88037     4  0.0162      0.818 0.000 0.004 0.000 0.996 0.000
#> GSM88013     4  0.2732      0.778 0.000 0.160 0.000 0.840 0.000
#> GSM88021     4  0.0162      0.818 0.000 0.004 0.000 0.996 0.000
#> GSM88025     4  0.1608      0.816 0.000 0.072 0.000 0.928 0.000
#> GSM88033     4  0.0880      0.821 0.000 0.032 0.000 0.968 0.000
#> GSM88014     4  0.2732      0.778 0.000 0.160 0.000 0.840 0.000
#> GSM88022     4  0.2732      0.778 0.000 0.160 0.000 0.840 0.000
#> GSM88034     4  0.0404      0.813 0.000 0.000 0.000 0.988 0.012
#> GSM88002     5  0.0000      0.999 0.000 0.000 0.000 0.000 1.000
#> GSM88003     5  0.0000      0.999 0.000 0.000 0.000 0.000 1.000
#> GSM88023     5  0.0000      0.999 0.000 0.000 0.000 0.000 1.000
#> GSM88026     5  0.0000      0.999 0.000 0.000 0.000 0.000 1.000
#> GSM88028     5  0.0162      0.995 0.000 0.000 0.000 0.004 0.996
#> GSM88035     5  0.0000      0.999 0.000 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     1  0.3765     0.8775 0.596 0.000 0.000 0.000 0.000 0.404
#> GSM87963     1  0.3774     0.8768 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM87983     1  0.3789     0.8726 0.584 0.000 0.000 0.000 0.000 0.416
#> GSM87984     1  0.3789     0.8726 0.584 0.000 0.000 0.000 0.000 0.416
#> GSM87961     1  0.3774     0.8768 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM87970     1  0.3672     0.8754 0.632 0.000 0.000 0.000 0.000 0.368
#> GSM87971     1  0.3672     0.8754 0.632 0.000 0.000 0.000 0.000 0.368
#> GSM87990     1  0.3774     0.8847 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM87991     6  0.2562     0.4130 0.172 0.000 0.000 0.000 0.000 0.828
#> GSM87974     1  0.3672     0.8754 0.632 0.000 0.000 0.000 0.000 0.368
#> GSM87994     6  0.1285     0.5313 0.052 0.000 0.004 0.000 0.000 0.944
#> GSM87978     1  0.3672     0.8754 0.632 0.000 0.000 0.000 0.000 0.368
#> GSM87979     1  0.3684     0.8771 0.628 0.000 0.000 0.000 0.000 0.372
#> GSM87998     6  0.0146     0.5510 0.000 0.000 0.004 0.000 0.000 0.996
#> GSM87999     6  0.0260     0.5519 0.000 0.000 0.008 0.000 0.000 0.992
#> GSM87968     1  0.3672     0.8754 0.632 0.000 0.000 0.000 0.000 0.368
#> GSM87987     6  0.3940    -0.1776 0.348 0.000 0.012 0.000 0.000 0.640
#> GSM87969     6  0.3999    -0.7020 0.496 0.000 0.004 0.000 0.000 0.500
#> GSM87988     6  0.4147     0.1981 0.060 0.000 0.224 0.000 0.000 0.716
#> GSM87989     6  0.4193    -0.3400 0.024 0.000 0.352 0.000 0.000 0.624
#> GSM87972     3  0.3991     0.6699 0.004 0.000 0.524 0.000 0.000 0.472
#> GSM87992     3  0.1584     0.6153 0.008 0.000 0.928 0.000 0.000 0.064
#> GSM87973     3  0.3860     0.6707 0.000 0.000 0.528 0.000 0.000 0.472
#> GSM87993     3  0.0520     0.6551 0.008 0.000 0.984 0.000 0.000 0.008
#> GSM87975     3  0.3991     0.6699 0.004 0.000 0.524 0.000 0.000 0.472
#> GSM87995     3  0.0520     0.6551 0.008 0.000 0.984 0.000 0.000 0.008
#> GSM87976     3  0.3991     0.6699 0.004 0.000 0.524 0.000 0.000 0.472
#> GSM87977     3  0.3860     0.6707 0.000 0.000 0.528 0.000 0.000 0.472
#> GSM87996     3  0.0520     0.6551 0.008 0.000 0.984 0.000 0.000 0.008
#> GSM87997     3  0.0520     0.6551 0.008 0.000 0.984 0.000 0.000 0.008
#> GSM87980     3  0.3804     0.6754 0.000 0.000 0.576 0.000 0.000 0.424
#> GSM88000     3  0.0972     0.6579 0.008 0.000 0.964 0.000 0.000 0.028
#> GSM87981     3  0.3860     0.6707 0.000 0.000 0.528 0.000 0.000 0.472
#> GSM87982     3  0.3804     0.6754 0.000 0.000 0.576 0.000 0.000 0.424
#> GSM88001     3  0.0520     0.6551 0.008 0.000 0.984 0.000 0.000 0.008
#> GSM87967     3  0.3991     0.6707 0.004 0.000 0.524 0.000 0.000 0.472
#> GSM87964     1  0.3774     0.8173 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM87965     1  0.3727     0.8879 0.612 0.000 0.000 0.000 0.000 0.388
#> GSM87966     6  0.3838    -0.5801 0.448 0.000 0.000 0.000 0.000 0.552
#> GSM87985     1  0.3782     0.8836 0.588 0.000 0.000 0.000 0.000 0.412
#> GSM87986     1  0.3789     0.8726 0.584 0.000 0.000 0.000 0.000 0.416
#> GSM88004     2  0.1411     0.8856 0.004 0.936 0.000 0.060 0.000 0.000
#> GSM88015     2  0.0146     0.9179 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM88005     2  0.0146     0.9179 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM88006     2  0.0000     0.9170 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88016     2  0.1531     0.8873 0.004 0.928 0.000 0.068 0.000 0.000
#> GSM88007     2  0.0000     0.9170 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88017     2  0.3693     0.6946 0.016 0.756 0.000 0.216 0.012 0.000
#> GSM88029     2  0.3290     0.7833 0.044 0.820 0.000 0.132 0.004 0.000
#> GSM88008     2  0.0000     0.9170 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88009     2  0.0146     0.9181 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM88018     2  0.0146     0.9181 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM88024     2  0.3018     0.7795 0.004 0.816 0.000 0.168 0.012 0.000
#> GSM88030     4  0.3032     0.6904 0.096 0.012 0.000 0.852 0.040 0.000
#> GSM88036     4  0.3032     0.6904 0.096 0.012 0.000 0.852 0.040 0.000
#> GSM88010     4  0.5123     0.1954 0.084 0.408 0.000 0.508 0.000 0.000
#> GSM88011     4  0.5136     0.1698 0.084 0.420 0.000 0.496 0.000 0.000
#> GSM88019     4  0.5136     0.1698 0.084 0.420 0.000 0.496 0.000 0.000
#> GSM88027     4  0.5113     0.0992 0.080 0.448 0.000 0.472 0.000 0.000
#> GSM88031     4  0.2668     0.7221 0.168 0.004 0.000 0.828 0.000 0.000
#> GSM88012     4  0.3424     0.6786 0.092 0.096 0.000 0.812 0.000 0.000
#> GSM88020     4  0.1918     0.7199 0.088 0.000 0.000 0.904 0.008 0.000
#> GSM88032     4  0.2793     0.7138 0.200 0.000 0.000 0.800 0.000 0.000
#> GSM88037     4  0.2793     0.7138 0.200 0.000 0.000 0.800 0.000 0.000
#> GSM88013     4  0.4390     0.6878 0.132 0.148 0.000 0.720 0.000 0.000
#> GSM88021     4  0.2793     0.7138 0.200 0.000 0.000 0.800 0.000 0.000
#> GSM88025     4  0.4144     0.7197 0.200 0.072 0.000 0.728 0.000 0.000
#> GSM88033     4  0.3110     0.7186 0.196 0.012 0.000 0.792 0.000 0.000
#> GSM88014     4  0.4459     0.6834 0.132 0.156 0.000 0.712 0.000 0.000
#> GSM88022     4  0.4638     0.6810 0.156 0.152 0.000 0.692 0.000 0.000
#> GSM88034     4  0.2613     0.7088 0.140 0.000 0.000 0.848 0.012 0.000
#> GSM88002     5  0.0000     0.9990 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88003     5  0.0000     0.9990 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88023     5  0.0000     0.9990 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88026     5  0.0000     0.9990 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM88028     5  0.0146     0.9950 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM88035     5  0.0000     0.9990 0.000 0.000 0.000 0.000 1.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 cell.line(p) agent(p)  time(p) k
#> ATC:mclust 77     1.27e-17 3.00e-14 3.61e-01 2
#> ATC:mclust 74     8.53e-17 1.32e-15 1.59e-02 3
#> ATC:mclust 73     9.72e-16 8.47e-23 2.99e-05 4
#> ATC:mclust 69     3.69e-14 1.00e-19 5.42e-07 5
#> ATC:mclust 67     4.31e-13 2.32e-19 7.09e-09 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 18792 rows and 77 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5049 0.496   0.496
#> 3 3 0.877           0.814       0.898         0.1802 0.931   0.860
#> 4 4 0.935           0.915       0.939         0.0489 0.902   0.784
#> 5 5 0.721           0.700       0.846         0.1234 0.938   0.840
#> 6 6 0.686           0.545       0.805         0.0995 0.893   0.684

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
#> GSM87962     1       0          1  1  0
#> GSM87963     1       0          1  1  0
#> GSM87983     1       0          1  1  0
#> GSM87984     1       0          1  1  0
#> GSM87961     1       0          1  1  0
#> GSM87970     1       0          1  1  0
#> GSM87971     1       0          1  1  0
#> GSM87990     1       0          1  1  0
#> GSM87991     1       0          1  1  0
#> GSM87974     1       0          1  1  0
#> GSM87994     1       0          1  1  0
#> GSM87978     1       0          1  1  0
#> GSM87979     1       0          1  1  0
#> GSM87998     1       0          1  1  0
#> GSM87999     1       0          1  1  0
#> GSM87968     1       0          1  1  0
#> GSM87987     1       0          1  1  0
#> GSM87969     1       0          1  1  0
#> GSM87988     1       0          1  1  0
#> GSM87989     1       0          1  1  0
#> GSM87972     1       0          1  1  0
#> GSM87992     1       0          1  1  0
#> GSM87973     1       0          1  1  0
#> GSM87993     1       0          1  1  0
#> GSM87975     1       0          1  1  0
#> GSM87995     1       0          1  1  0
#> GSM87976     1       0          1  1  0
#> GSM87977     1       0          1  1  0
#> GSM87996     1       0          1  1  0
#> GSM87997     1       0          1  1  0
#> GSM87980     1       0          1  1  0
#> GSM88000     1       0          1  1  0
#> GSM87981     1       0          1  1  0
#> GSM87982     1       0          1  1  0
#> GSM88001     1       0          1  1  0
#> GSM87967     1       0          1  1  0
#> GSM87964     1       0          1  1  0
#> GSM87965     1       0          1  1  0
#> GSM87966     1       0          1  1  0
#> GSM87985     1       0          1  1  0
#> GSM87986     1       0          1  1  0
#> GSM88004     2       0          1  0  1
#> GSM88015     2       0          1  0  1
#> GSM88005     2       0          1  0  1
#> GSM88006     2       0          1  0  1
#> GSM88016     2       0          1  0  1
#> GSM88007     2       0          1  0  1
#> GSM88017     2       0          1  0  1
#> GSM88029     2       0          1  0  1
#> GSM88008     2       0          1  0  1
#> GSM88009     2       0          1  0  1
#> GSM88018     2       0          1  0  1
#> GSM88024     2       0          1  0  1
#> GSM88030     2       0          1  0  1
#> GSM88036     2       0          1  0  1
#> GSM88010     2       0          1  0  1
#> GSM88011     2       0          1  0  1
#> GSM88019     2       0          1  0  1
#> GSM88027     2       0          1  0  1
#> GSM88031     2       0          1  0  1
#> GSM88012     2       0          1  0  1
#> GSM88020     2       0          1  0  1
#> GSM88032     2       0          1  0  1
#> GSM88037     2       0          1  0  1
#> GSM88013     2       0          1  0  1
#> GSM88021     2       0          1  0  1
#> GSM88025     2       0          1  0  1
#> GSM88033     2       0          1  0  1
#> GSM88014     2       0          1  0  1
#> GSM88022     2       0          1  0  1
#> GSM88034     2       0          1  0  1
#> GSM88002     2       0          1  0  1
#> GSM88003     2       0          1  0  1
#> GSM88023     2       0          1  0  1
#> GSM88026     2       0          1  0  1
#> GSM88028     2       0          1  0  1
#> GSM88035     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
#> GSM87962     1  0.0747      0.983 0.984 0.000 0.016
#> GSM87963     1  0.0747      0.983 0.984 0.000 0.016
#> GSM87983     1  0.0892      0.981 0.980 0.000 0.020
#> GSM87984     1  0.1289      0.973 0.968 0.000 0.032
#> GSM87961     1  0.1031      0.979 0.976 0.000 0.024
#> GSM87970     1  0.0237      0.988 0.996 0.000 0.004
#> GSM87971     1  0.4121      0.818 0.832 0.000 0.168
#> GSM87990     1  0.0892      0.981 0.980 0.000 0.020
#> GSM87991     1  0.0424      0.987 0.992 0.000 0.008
#> GSM87974     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87994     1  0.0424      0.987 0.992 0.000 0.008
#> GSM87978     1  0.0424      0.986 0.992 0.000 0.008
#> GSM87979     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87998     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87999     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87968     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87987     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87969     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87988     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87989     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87972     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87992     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87973     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87993     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87975     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87995     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87976     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87977     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87996     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87997     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87980     1  0.0000      0.989 1.000 0.000 0.000
#> GSM88000     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87981     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87982     1  0.0000      0.989 1.000 0.000 0.000
#> GSM88001     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87967     1  0.0000      0.989 1.000 0.000 0.000
#> GSM87964     1  0.3412      0.872 0.876 0.000 0.124
#> GSM87965     1  0.0237      0.988 0.996 0.000 0.004
#> GSM87966     1  0.0237      0.988 0.996 0.000 0.004
#> GSM87985     1  0.0747      0.983 0.984 0.000 0.016
#> GSM87986     1  0.0892      0.981 0.980 0.000 0.020
#> GSM88004     3  0.6280      0.981 0.000 0.460 0.540
#> GSM88015     3  0.6260      0.972 0.000 0.448 0.552
#> GSM88005     3  0.6267      0.977 0.000 0.452 0.548
#> GSM88006     3  0.6274      0.980 0.000 0.456 0.544
#> GSM88016     3  0.6295      0.971 0.000 0.472 0.528
#> GSM88007     3  0.6280      0.981 0.000 0.460 0.540
#> GSM88017     2  0.0892      0.564 0.000 0.980 0.020
#> GSM88029     2  0.1411      0.571 0.000 0.964 0.036
#> GSM88008     3  0.6308      0.942 0.000 0.492 0.508
#> GSM88009     2  0.5835     -0.571 0.000 0.660 0.340
#> GSM88018     2  0.5058     -0.242 0.000 0.756 0.244
#> GSM88024     2  0.0892      0.559 0.000 0.980 0.020
#> GSM88030     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88036     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88010     2  0.0000      0.549 0.000 1.000 0.000
#> GSM88011     2  0.2261      0.424 0.000 0.932 0.068
#> GSM88019     2  0.0424      0.549 0.000 0.992 0.008
#> GSM88027     2  0.1860      0.461 0.000 0.948 0.052
#> GSM88031     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88012     2  0.6079      0.680 0.000 0.612 0.388
#> GSM88020     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88032     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88037     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88013     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88021     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88025     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88033     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88014     2  0.6168      0.683 0.000 0.588 0.412
#> GSM88022     2  0.6111      0.682 0.000 0.604 0.396
#> GSM88034     2  0.6180      0.683 0.000 0.584 0.416
#> GSM88002     2  0.0237      0.553 0.000 0.996 0.004
#> GSM88003     2  0.0000      0.549 0.000 1.000 0.000
#> GSM88023     2  0.0000      0.549 0.000 1.000 0.000
#> GSM88026     2  0.1163      0.506 0.000 0.972 0.028
#> GSM88028     2  0.0237      0.544 0.000 0.996 0.004
#> GSM88035     2  0.0000      0.549 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
#> GSM87962     1  0.0524      0.974 0.988 0.004 NA 0.000
#> GSM87963     1  0.2048      0.940 0.928 0.008 NA 0.000
#> GSM87983     1  0.0592      0.972 0.984 0.000 NA 0.000
#> GSM87984     1  0.0592      0.972 0.984 0.000 NA 0.000
#> GSM87961     1  0.0672      0.973 0.984 0.008 NA 0.000
#> GSM87970     1  0.1576      0.955 0.948 0.004 NA 0.000
#> GSM87971     1  0.5320      0.522 0.572 0.012 NA 0.000
#> GSM87990     1  0.0592      0.973 0.984 0.000 NA 0.000
#> GSM87991     1  0.0188      0.975 0.996 0.000 NA 0.000
#> GSM87974     1  0.1489      0.959 0.952 0.004 NA 0.000
#> GSM87994     1  0.0188      0.975 0.996 0.000 NA 0.000
#> GSM87978     1  0.2197      0.932 0.916 0.004 NA 0.000
#> GSM87979     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87998     1  0.0000      0.975 1.000 0.000 NA 0.000
#> GSM87999     1  0.0000      0.975 1.000 0.000 NA 0.000
#> GSM87968     1  0.0817      0.971 0.976 0.000 NA 0.000
#> GSM87987     1  0.0188      0.975 0.996 0.000 NA 0.000
#> GSM87969     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87988     1  0.0188      0.976 0.996 0.000 NA 0.000
#> GSM87989     1  0.0188      0.976 0.996 0.000 NA 0.000
#> GSM87972     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87992     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87973     1  0.0188      0.976 0.996 0.000 NA 0.000
#> GSM87993     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87975     1  0.1411      0.964 0.960 0.000 NA 0.020
#> GSM87995     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87976     1  0.1520      0.961 0.956 0.000 NA 0.020
#> GSM87977     1  0.0469      0.975 0.988 0.000 NA 0.000
#> GSM87996     1  0.0188      0.976 0.996 0.000 NA 0.000
#> GSM87997     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87980     1  0.1297      0.966 0.964 0.000 NA 0.020
#> GSM88000     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87981     1  0.0469      0.975 0.988 0.000 NA 0.000
#> GSM87982     1  0.0469      0.975 0.988 0.000 NA 0.000
#> GSM88001     1  0.0336      0.975 0.992 0.000 NA 0.000
#> GSM87967     1  0.0188      0.976 0.996 0.000 NA 0.000
#> GSM87964     1  0.4270      0.834 0.804 0.008 NA 0.020
#> GSM87965     1  0.0188      0.975 0.996 0.000 NA 0.000
#> GSM87966     1  0.0188      0.975 0.996 0.000 NA 0.000
#> GSM87985     1  0.0188      0.975 0.996 0.000 NA 0.000
#> GSM87986     1  0.0188      0.975 0.996 0.000 NA 0.000
#> GSM88004     2  0.1059      0.932 0.000 0.972 NA 0.016
#> GSM88015     2  0.3172      0.806 0.000 0.840 NA 0.000
#> GSM88005     2  0.0921      0.908 0.000 0.972 NA 0.000
#> GSM88006     2  0.0469      0.920 0.000 0.988 NA 0.000
#> GSM88016     2  0.1256      0.941 0.000 0.964 NA 0.028
#> GSM88007     2  0.1174      0.935 0.000 0.968 NA 0.020
#> GSM88017     2  0.1824      0.945 0.000 0.936 NA 0.060
#> GSM88029     2  0.1716      0.944 0.000 0.936 NA 0.064
#> GSM88008     2  0.1356      0.942 0.000 0.960 NA 0.032
#> GSM88009     2  0.1557      0.948 0.000 0.944 NA 0.056
#> GSM88018     2  0.1489      0.947 0.000 0.952 NA 0.044
#> GSM88024     2  0.1792      0.942 0.000 0.932 NA 0.068
#> GSM88030     4  0.5510      0.463 0.000 0.376 NA 0.600
#> GSM88036     4  0.5602      0.378 0.000 0.408 NA 0.568
#> GSM88010     2  0.4836      0.507 0.000 0.672 NA 0.320
#> GSM88011     4  0.6393      0.688 0.000 0.188 NA 0.652
#> GSM88019     4  0.2300      0.894 0.000 0.048 NA 0.924
#> GSM88027     4  0.6388      0.690 0.000 0.192 NA 0.652
#> GSM88031     4  0.1209      0.905 0.000 0.032 NA 0.964
#> GSM88012     4  0.2469      0.864 0.000 0.108 NA 0.892
#> GSM88020     4  0.1211      0.905 0.000 0.040 NA 0.960
#> GSM88032     4  0.0921      0.903 0.000 0.028 NA 0.972
#> GSM88037     4  0.0921      0.903 0.000 0.028 NA 0.972
#> GSM88013     4  0.1118      0.905 0.000 0.036 NA 0.964
#> GSM88021     4  0.1118      0.905 0.000 0.036 NA 0.964
#> GSM88025     4  0.1022      0.905 0.000 0.032 NA 0.968
#> GSM88033     4  0.1022      0.905 0.000 0.032 NA 0.968
#> GSM88014     4  0.1211      0.905 0.000 0.040 NA 0.960
#> GSM88022     4  0.1302      0.904 0.000 0.044 NA 0.956
#> GSM88034     4  0.1211      0.905 0.000 0.040 NA 0.960
#> GSM88002     2  0.1557      0.948 0.000 0.944 NA 0.056
#> GSM88003     2  0.1557      0.948 0.000 0.944 NA 0.056
#> GSM88023     2  0.1557      0.948 0.000 0.944 NA 0.056
#> GSM88026     2  0.1474      0.948 0.000 0.948 NA 0.052
#> GSM88028     2  0.1557      0.948 0.000 0.944 NA 0.056
#> GSM88035     2  0.1557      0.948 0.000 0.944 NA 0.056

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>          class entropy silhouette    p1    p2    p3    p4 p5
#> GSM87962     3  0.3398     0.5566 0.216 0.000 0.780 0.000 NA
#> GSM87963     3  0.5182    -0.3577 0.412 0.000 0.544 0.000 NA
#> GSM87983     3  0.1597     0.7674 0.048 0.000 0.940 0.000 NA
#> GSM87984     3  0.2669     0.7105 0.104 0.000 0.876 0.000 NA
#> GSM87961     3  0.4800    -0.1200 0.368 0.000 0.604 0.000 NA
#> GSM87970     1  0.4262     0.6774 0.560 0.000 0.440 0.000 NA
#> GSM87971     1  0.4946     0.6733 0.648 0.000 0.300 0.000 NA
#> GSM87990     3  0.3355     0.6054 0.184 0.000 0.804 0.000 NA
#> GSM87991     3  0.0963     0.7770 0.036 0.000 0.964 0.000 NA
#> GSM87974     1  0.4425     0.6529 0.544 0.000 0.452 0.000 NA
#> GSM87994     3  0.0609     0.7804 0.020 0.000 0.980 0.000 NA
#> GSM87978     1  0.4815     0.6330 0.524 0.000 0.456 0.000 NA
#> GSM87979     3  0.3513     0.6193 0.180 0.000 0.800 0.000 NA
#> GSM87998     3  0.0703     0.7792 0.024 0.000 0.976 0.000 NA
#> GSM87999     3  0.0955     0.7784 0.028 0.000 0.968 0.000 NA
#> GSM87968     3  0.4451     0.1086 0.340 0.000 0.644 0.000 NA
#> GSM87987     3  0.1041     0.7834 0.032 0.000 0.964 0.000 NA
#> GSM87969     3  0.2424     0.7123 0.132 0.000 0.868 0.000 NA
#> GSM87988     3  0.0404     0.7812 0.012 0.000 0.988 0.000 NA
#> GSM87989     3  0.0404     0.7812 0.012 0.000 0.988 0.000 NA
#> GSM87972     3  0.2561     0.6848 0.144 0.000 0.856 0.000 NA
#> GSM87992     3  0.0703     0.7806 0.024 0.000 0.976 0.000 NA
#> GSM87973     3  0.1341     0.7732 0.056 0.000 0.944 0.000 NA
#> GSM87993     3  0.0703     0.7819 0.024 0.000 0.976 0.000 NA
#> GSM87975     3  0.4949    -0.2684 0.396 0.000 0.572 0.000 NA
#> GSM87995     3  0.0880     0.7802 0.032 0.000 0.968 0.000 NA
#> GSM87976     3  0.4966    -0.3059 0.404 0.000 0.564 0.000 NA
#> GSM87977     3  0.3123     0.6279 0.184 0.000 0.812 0.000 NA
#> GSM87996     3  0.0880     0.7798 0.032 0.000 0.968 0.000 NA
#> GSM87997     3  0.0880     0.7798 0.032 0.000 0.968 0.000 NA
#> GSM87980     3  0.4327     0.0164 0.360 0.000 0.632 0.000 NA
#> GSM88000     3  0.1121     0.7774 0.044 0.000 0.956 0.000 NA
#> GSM87981     3  0.3109     0.5964 0.200 0.000 0.800 0.000 NA
#> GSM87982     3  0.2732     0.6686 0.160 0.000 0.840 0.000 NA
#> GSM88001     3  0.0794     0.7813 0.028 0.000 0.972 0.000 NA
#> GSM87967     3  0.1430     0.7756 0.052 0.000 0.944 0.000 NA
#> GSM87964     1  0.4490     0.5606 0.756 0.000 0.168 0.004 NA
#> GSM87965     3  0.2439     0.7134 0.120 0.000 0.876 0.000 NA
#> GSM87966     3  0.1121     0.7755 0.044 0.000 0.956 0.000 NA
#> GSM87985     3  0.1251     0.7764 0.036 0.000 0.956 0.000 NA
#> GSM87986     3  0.1251     0.7748 0.036 0.000 0.956 0.000 NA
#> GSM88004     2  0.0162     0.9308 0.004 0.996 0.000 0.000 NA
#> GSM88015     2  0.2813     0.8839 0.040 0.876 0.000 0.000 NA
#> GSM88005     2  0.1357     0.9224 0.004 0.948 0.000 0.000 NA
#> GSM88006     2  0.0865     0.9278 0.004 0.972 0.000 0.000 NA
#> GSM88016     2  0.0798     0.9293 0.000 0.976 0.000 0.008 NA
#> GSM88007     2  0.1168     0.9265 0.000 0.960 0.000 0.008 NA
#> GSM88017     2  0.3849     0.7688 0.000 0.752 0.000 0.016 NA
#> GSM88029     2  0.3326     0.8368 0.000 0.824 0.000 0.024 NA
#> GSM88008     2  0.1082     0.9261 0.000 0.964 0.000 0.008 NA
#> GSM88009     2  0.0693     0.9299 0.000 0.980 0.000 0.008 NA
#> GSM88018     2  0.2095     0.9155 0.012 0.920 0.000 0.008 NA
#> GSM88024     2  0.2305     0.8909 0.000 0.896 0.000 0.012 NA
#> GSM88030     4  0.7507     0.3736 0.048 0.248 0.000 0.432 NA
#> GSM88036     4  0.7621     0.3240 0.052 0.268 0.000 0.408 NA
#> GSM88010     2  0.5619     0.3393 0.016 0.592 0.000 0.336 NA
#> GSM88011     4  0.5949     0.6518 0.012 0.132 0.000 0.620 NA
#> GSM88019     4  0.2214     0.8489 0.004 0.028 0.000 0.916 NA
#> GSM88027     4  0.5941     0.5608 0.000 0.228 0.000 0.592 NA
#> GSM88031     4  0.0579     0.8621 0.000 0.008 0.000 0.984 NA
#> GSM88012     4  0.2517     0.8143 0.004 0.104 0.000 0.884 NA
#> GSM88020     4  0.3391     0.7915 0.000 0.012 0.000 0.800 NA
#> GSM88032     4  0.0451     0.8614 0.000 0.004 0.000 0.988 NA
#> GSM88037     4  0.0162     0.8621 0.000 0.004 0.000 0.996 NA
#> GSM88013     4  0.0290     0.8625 0.000 0.008 0.000 0.992 NA
#> GSM88021     4  0.0451     0.8626 0.000 0.008 0.000 0.988 NA
#> GSM88025     4  0.0579     0.8625 0.000 0.008 0.000 0.984 NA
#> GSM88033     4  0.0671     0.8602 0.000 0.004 0.000 0.980 NA
#> GSM88014     4  0.0451     0.8626 0.000 0.008 0.000 0.988 NA
#> GSM88022     4  0.0912     0.8610 0.000 0.012 0.000 0.972 NA
#> GSM88034     4  0.3675     0.7714 0.004 0.008 0.000 0.772 NA
#> GSM88002     2  0.0807     0.9300 0.012 0.976 0.000 0.000 NA
#> GSM88003     2  0.0693     0.9306 0.012 0.980 0.000 0.000 NA
#> GSM88023     2  0.0693     0.9306 0.012 0.980 0.000 0.000 NA
#> GSM88026     2  0.0693     0.9303 0.012 0.980 0.000 0.000 NA
#> GSM88028     2  0.0693     0.9306 0.012 0.980 0.000 0.000 NA
#> GSM88035     2  0.0693     0.9306 0.012 0.980 0.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>          class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM87962     3  0.5617     -0.145 0.228 0.000 0.564 0.000 0.004 0.204
#> GSM87963     3  0.6124     -0.831 0.316 0.000 0.356 0.000 0.000 0.328
#> GSM87983     3  0.3732      0.547 0.076 0.000 0.780 0.000 0.000 0.144
#> GSM87984     3  0.4520      0.386 0.092 0.000 0.688 0.000 0.000 0.220
#> GSM87961     6  0.6227      0.000 0.320 0.000 0.300 0.000 0.004 0.376
#> GSM87970     1  0.3474      0.476 0.820 0.000 0.056 0.000 0.012 0.112
#> GSM87971     1  0.2821      0.469 0.860 0.000 0.040 0.000 0.004 0.096
#> GSM87990     3  0.5283      0.140 0.180 0.000 0.620 0.000 0.004 0.196
#> GSM87991     3  0.2794      0.630 0.060 0.000 0.860 0.000 0.000 0.080
#> GSM87974     1  0.2113      0.527 0.908 0.000 0.060 0.000 0.004 0.028
#> GSM87994     3  0.2179      0.648 0.036 0.000 0.900 0.000 0.000 0.064
#> GSM87978     1  0.3063      0.504 0.840 0.000 0.092 0.000 0.000 0.068
#> GSM87979     1  0.5412     -0.331 0.468 0.000 0.436 0.000 0.008 0.088
#> GSM87998     3  0.1780      0.659 0.028 0.000 0.924 0.000 0.000 0.048
#> GSM87999     3  0.1845      0.657 0.028 0.000 0.920 0.000 0.000 0.052
#> GSM87968     1  0.4562      0.255 0.692 0.000 0.236 0.000 0.012 0.060
#> GSM87987     3  0.1930      0.666 0.048 0.000 0.916 0.000 0.000 0.036
#> GSM87969     3  0.4191      0.111 0.388 0.000 0.596 0.000 0.004 0.012
#> GSM87988     3  0.0547      0.671 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM87989     3  0.0146      0.672 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM87972     3  0.4937      0.214 0.340 0.000 0.592 0.000 0.008 0.060
#> GSM87992     3  0.0909      0.670 0.012 0.000 0.968 0.000 0.000 0.020
#> GSM87973     3  0.4051      0.501 0.184 0.000 0.752 0.000 0.008 0.056
#> GSM87993     3  0.1575      0.662 0.032 0.000 0.936 0.000 0.000 0.032
#> GSM87975     1  0.4114      0.519 0.740 0.000 0.200 0.000 0.008 0.052
#> GSM87995     3  0.1418      0.664 0.024 0.000 0.944 0.000 0.000 0.032
#> GSM87976     1  0.4288      0.526 0.744 0.000 0.180 0.000 0.020 0.056
#> GSM87977     3  0.5246     -0.224 0.456 0.000 0.472 0.000 0.016 0.056
#> GSM87996     3  0.1003      0.671 0.016 0.000 0.964 0.000 0.000 0.020
#> GSM87997     3  0.1794      0.658 0.040 0.000 0.924 0.000 0.000 0.036
#> GSM87980     1  0.4655      0.405 0.632 0.000 0.300 0.000 0.000 0.068
#> GSM88000     3  0.2448      0.634 0.064 0.000 0.884 0.000 0.000 0.052
#> GSM87981     1  0.5127      0.163 0.480 0.000 0.452 0.000 0.008 0.060
#> GSM87982     3  0.4898      0.249 0.328 0.000 0.604 0.000 0.008 0.060
#> GSM88001     3  0.1794      0.654 0.036 0.000 0.924 0.000 0.000 0.040
#> GSM87967     3  0.3534      0.542 0.160 0.000 0.796 0.000 0.008 0.036
#> GSM87964     1  0.3913      0.379 0.788 0.000 0.012 0.000 0.096 0.104
#> GSM87965     3  0.4525      0.323 0.228 0.000 0.684 0.000 0.000 0.088
#> GSM87966     3  0.3073      0.613 0.080 0.000 0.840 0.000 0.000 0.080
#> GSM87985     3  0.3508      0.586 0.080 0.000 0.812 0.000 0.004 0.104
#> GSM87986     3  0.3017      0.617 0.072 0.000 0.844 0.000 0.000 0.084
#> GSM88004     2  0.0000      0.886 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM88015     2  0.2711      0.816 0.000 0.872 0.000 0.008 0.084 0.036
#> GSM88005     2  0.1464      0.872 0.000 0.944 0.000 0.004 0.036 0.016
#> GSM88006     2  0.0837      0.882 0.000 0.972 0.000 0.004 0.020 0.004
#> GSM88016     2  0.0405      0.885 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM88007     2  0.1080      0.876 0.000 0.960 0.000 0.004 0.032 0.004
#> GSM88017     2  0.4335      0.104 0.004 0.536 0.000 0.008 0.448 0.004
#> GSM88029     2  0.4022      0.385 0.000 0.628 0.000 0.008 0.360 0.004
#> GSM88008     2  0.1367      0.866 0.000 0.944 0.000 0.012 0.044 0.000
#> GSM88009     2  0.0260      0.885 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM88018     2  0.2308      0.831 0.012 0.896 0.000 0.000 0.076 0.016
#> GSM88024     2  0.3565      0.576 0.000 0.716 0.000 0.004 0.276 0.004
#> GSM88030     5  0.4792      0.738 0.000 0.200 0.000 0.132 0.668 0.000
#> GSM88036     5  0.4765      0.739 0.000 0.196 0.000 0.132 0.672 0.000
#> GSM88010     4  0.5543      0.201 0.000 0.364 0.000 0.516 0.112 0.008
#> GSM88011     4  0.4256      0.624 0.000 0.112 0.000 0.744 0.140 0.004
#> GSM88019     4  0.2361      0.743 0.000 0.028 0.000 0.884 0.088 0.000
#> GSM88027     4  0.4650      0.562 0.000 0.172 0.000 0.712 0.104 0.012
#> GSM88031     4  0.0713      0.786 0.000 0.000 0.000 0.972 0.028 0.000
#> GSM88012     4  0.2346      0.703 0.000 0.124 0.000 0.868 0.008 0.000
#> GSM88020     4  0.3868     -0.377 0.000 0.000 0.000 0.508 0.492 0.000
#> GSM88032     4  0.1285      0.775 0.000 0.000 0.000 0.944 0.052 0.004
#> GSM88037     4  0.1152      0.780 0.000 0.000 0.000 0.952 0.044 0.004
#> GSM88013     4  0.0632      0.786 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM88021     4  0.0865      0.784 0.000 0.000 0.000 0.964 0.036 0.000
#> GSM88025     4  0.1219      0.778 0.000 0.000 0.000 0.948 0.048 0.004
#> GSM88033     4  0.2146      0.716 0.000 0.000 0.000 0.880 0.116 0.004
#> GSM88014     4  0.0146      0.786 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM88022     4  0.0632      0.783 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM88034     5  0.3857      0.174 0.000 0.000 0.000 0.468 0.532 0.000
#> GSM88002     2  0.0767      0.886 0.000 0.976 0.000 0.004 0.012 0.008
#> GSM88003     2  0.0767      0.886 0.000 0.976 0.000 0.004 0.012 0.008
#> GSM88023     2  0.0964      0.885 0.000 0.968 0.000 0.004 0.016 0.012
#> GSM88026     2  0.0767      0.886 0.000 0.976 0.000 0.004 0.008 0.012
#> GSM88028     2  0.0964      0.885 0.000 0.968 0.000 0.004 0.016 0.012
#> GSM88035     2  0.0964      0.885 0.000 0.968 0.000 0.004 0.016 0.012

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 cell.line(p) agent(p)  time(p) k
#> ATC:NMF 77     1.27e-17 3.00e-14 0.361151 2
#> ATC:NMF 73     1.41e-16 4.53e-12 0.016597 3
#> ATC:NMF 75     5.18e-17 1.64e-13 0.001290 4
#> ATC:NMF 68     1.14e-14 8.84e-11 0.000546 5
#> ATC:NMF 55     3.25e-11 7.27e-08 0.029874 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