cola Report for GDS4761

Date: 2019-12-25 21:47: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 48983 rows and 91 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] 48983    91

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
ATC:pam 3 0.939 0.932 0.974 * 2
ATC:skmeans 2 0.932 0.927 0.972 *
SD:kmeans 2 0.899 0.894 0.942
MAD:kmeans 2 0.870 0.929 0.969
CV:NMF 6 0.869 0.871 0.921
MAD:skmeans 2 0.869 0.935 0.970
SD:skmeans 2 0.866 0.897 0.959
MAD:mclust 2 0.853 0.952 0.976
MAD:NMF 2 0.844 0.926 0.966
SD:NMF 2 0.803 0.878 0.948
CV:skmeans 2 0.787 0.880 0.952
MAD:pam 3 0.760 0.888 0.934
SD:pam 4 0.756 0.883 0.923
CV:mclust 5 0.727 0.812 0.866
CV:pam 4 0.723 0.837 0.910
ATC:mclust 2 0.721 0.944 0.956
ATC:NMF 2 0.720 0.878 0.943
SD:mclust 3 0.704 0.872 0.932
CV:kmeans 3 0.676 0.744 0.855
ATC:kmeans 3 0.559 0.769 0.868
ATC:hclust 4 0.518 0.776 0.864
SD:hclust 3 0.319 0.679 0.804
MAD:hclust 3 0.310 0.691 0.836
CV:hclust 4 0.282 0.632 0.749

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 0.803           0.878       0.948          0.494 0.499   0.499
#> CV:NMF      2 0.670           0.852       0.937          0.500 0.502   0.502
#> MAD:NMF     2 0.844           0.926       0.966          0.495 0.505   0.505
#> ATC:NMF     2 0.720           0.878       0.943          0.494 0.499   0.499
#> SD:skmeans  2 0.866           0.897       0.959          0.491 0.512   0.512
#> CV:skmeans  2 0.787           0.880       0.952          0.491 0.508   0.508
#> MAD:skmeans 2 0.869           0.935       0.970          0.494 0.508   0.508
#> ATC:skmeans 2 0.932           0.927       0.972          0.496 0.505   0.505
#> SD:mclust   2 0.491           0.690       0.851          0.390 0.693   0.693
#> CV:mclust   2 0.507           0.817       0.891          0.364 0.693   0.693
#> MAD:mclust  2 0.853           0.952       0.976          0.456 0.546   0.546
#> ATC:mclust  2 0.721           0.944       0.956          0.401 0.561   0.561
#> SD:kmeans   2 0.899           0.894       0.942          0.466 0.516   0.516
#> CV:kmeans   2 0.426           0.842       0.855          0.428 0.546   0.546
#> MAD:kmeans  2 0.870           0.929       0.969          0.481 0.512   0.512
#> ATC:kmeans  2 0.651           0.816       0.859          0.364 0.666   0.666
#> SD:pam      2 0.689           0.816       0.907          0.369 0.587   0.587
#> CV:pam      2 0.669           0.873       0.917          0.360 0.597   0.597
#> MAD:pam     2 0.655           0.770       0.909          0.357 0.707   0.707
#> ATC:pam     2 0.977           0.945       0.978          0.271 0.752   0.752
#> SD:hclust   2 0.627           0.884       0.938          0.240 0.785   0.785
#> CV:hclust   2 0.447           0.788       0.889          0.261 0.820   0.820
#> MAD:hclust  2 0.432           0.832       0.907          0.248 0.785   0.785
#> ATC:hclust  2 0.548           0.845       0.919          0.308 0.752   0.752
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.637           0.783       0.902          0.239 0.792   0.621
#> CV:NMF      3 0.588           0.724       0.867          0.247 0.805   0.639
#> MAD:NMF     3 0.879           0.919       0.965          0.235 0.766   0.583
#> ATC:NMF     3 0.682           0.799       0.910          0.290 0.795   0.615
#> SD:skmeans  3 0.499           0.600       0.816          0.321 0.780   0.598
#> CV:skmeans  3 0.590           0.661       0.843          0.322 0.763   0.560
#> MAD:skmeans 3 0.564           0.511       0.778          0.326 0.762   0.565
#> ATC:skmeans 3 0.807           0.780       0.917          0.271 0.738   0.531
#> SD:mclust   3 0.704           0.872       0.932          0.570 0.670   0.532
#> CV:mclust   3 0.396           0.789       0.857          0.599 0.636   0.486
#> MAD:mclust  3 0.619           0.725       0.841          0.261 0.892   0.807
#> ATC:mclust  3 0.665           0.825       0.887          0.358 0.827   0.711
#> SD:kmeans   3 0.546           0.609       0.814          0.301 0.896   0.805
#> CV:kmeans   3 0.676           0.744       0.855          0.405 0.839   0.713
#> MAD:kmeans  3 0.611           0.682       0.788          0.291 0.882   0.775
#> ATC:kmeans  3 0.559           0.769       0.868          0.616 0.673   0.536
#> SD:pam      3 0.723           0.795       0.876          0.428 0.889   0.815
#> CV:pam      3 0.733           0.800       0.883          0.426 0.855   0.758
#> MAD:pam     3 0.760           0.888       0.934          0.493 0.754   0.658
#> ATC:pam     3 0.939           0.932       0.974          1.119 0.629   0.523
#> SD:hclust   3 0.319           0.679       0.804          1.267 0.717   0.640
#> CV:hclust   3 0.190           0.449       0.729          0.701 0.840   0.804
#> MAD:hclust  3 0.310           0.691       0.836          1.164 0.660   0.579
#> ATC:hclust  3 0.585           0.780       0.876          0.187 0.993   0.990
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.727           0.763       0.887         0.1452 0.753   0.478
#> CV:NMF      4 0.695           0.823       0.906         0.1432 0.746   0.460
#> MAD:NMF     4 0.887           0.869       0.943         0.2028 0.790   0.509
#> ATC:NMF     4 0.805           0.833       0.918         0.1317 0.807   0.536
#> SD:skmeans  4 0.747           0.791       0.893         0.1607 0.839   0.584
#> CV:skmeans  4 0.759           0.810       0.902         0.1552 0.814   0.517
#> MAD:skmeans 4 0.853           0.856       0.931         0.1451 0.779   0.458
#> ATC:skmeans 4 0.807           0.836       0.917         0.1146 0.898   0.728
#> SD:mclust   4 0.708           0.765       0.867         0.0714 0.932   0.836
#> CV:mclust   4 0.555           0.741       0.817         0.1124 0.904   0.764
#> MAD:mclust  4 0.541           0.462       0.746         0.2206 0.847   0.678
#> ATC:mclust  4 0.824           0.872       0.919         0.2548 0.743   0.507
#> SD:kmeans   4 0.618           0.611       0.809         0.1707 0.786   0.557
#> CV:kmeans   4 0.605           0.645       0.786         0.1701 0.879   0.718
#> MAD:kmeans  4 0.693           0.832       0.881         0.1729 0.754   0.471
#> ATC:kmeans  4 0.603           0.425       0.648         0.1724 0.801   0.547
#> SD:pam      4 0.756           0.883       0.923         0.2280 0.868   0.738
#> CV:pam      4 0.723           0.837       0.910         0.2279 0.847   0.698
#> MAD:pam     4 0.763           0.771       0.910         0.3169 0.815   0.621
#> ATC:pam     4 0.805           0.890       0.936         0.1425 0.907   0.788
#> SD:hclust   4 0.369           0.632       0.760         0.1820 0.852   0.711
#> CV:hclust   4 0.282           0.632       0.749         0.3181 0.730   0.603
#> MAD:hclust  4 0.380           0.418       0.726         0.1967 0.958   0.915
#> ATC:hclust  4 0.518           0.776       0.864         0.5851 0.649   0.533
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.848           0.833       0.911         0.1149 0.820   0.492
#> CV:NMF      5 0.765           0.828       0.903         0.0969 0.796   0.442
#> MAD:NMF     5 0.825           0.765       0.892         0.0606 0.917   0.705
#> ATC:NMF     5 0.751           0.780       0.882         0.0720 0.889   0.647
#> SD:skmeans  5 0.679           0.663       0.810         0.0593 0.910   0.666
#> CV:skmeans  5 0.709           0.751       0.837         0.0639 0.920   0.698
#> MAD:skmeans 5 0.698           0.612       0.791         0.0610 0.977   0.909
#> ATC:skmeans 5 0.798           0.798       0.905         0.0994 0.897   0.670
#> SD:mclust   5 0.718           0.798       0.868         0.1496 0.841   0.592
#> CV:mclust   5 0.727           0.812       0.866         0.1371 0.901   0.724
#> MAD:mclust  5 0.562           0.510       0.734         0.0932 0.785   0.470
#> ATC:mclust  5 0.807           0.843       0.842         0.1451 0.865   0.589
#> SD:kmeans   5 0.642           0.682       0.766         0.0827 0.823   0.496
#> CV:kmeans   5 0.595           0.637       0.758         0.0907 0.821   0.505
#> MAD:kmeans  5 0.676           0.543       0.721         0.0747 0.899   0.661
#> ATC:kmeans  5 0.677           0.730       0.834         0.0988 0.802   0.434
#> SD:pam      5 0.762           0.742       0.894         0.1357 0.889   0.707
#> CV:pam      5 0.708           0.821       0.863         0.1497 0.882   0.716
#> MAD:pam     5 0.833           0.849       0.921         0.0844 0.925   0.756
#> ATC:pam     5 0.798           0.864       0.926         0.1176 0.906   0.737
#> SD:hclust   5 0.397           0.572       0.718         0.0882 0.886   0.718
#> CV:hclust   5 0.436           0.700       0.784         0.1321 0.953   0.892
#> MAD:hclust  5 0.421           0.379       0.649         0.1011 0.868   0.713
#> ATC:hclust  5 0.578           0.600       0.809         0.1483 0.936   0.845
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.805           0.725       0.865         0.0447 0.945   0.759
#> CV:NMF      6 0.869           0.871       0.921         0.0580 0.932   0.707
#> MAD:NMF     6 0.731           0.525       0.747         0.0482 0.931   0.715
#> ATC:NMF     6 0.761           0.728       0.865         0.0599 0.889   0.579
#> SD:skmeans  6 0.717           0.570       0.748         0.0418 0.893   0.545
#> CV:skmeans  6 0.728           0.644       0.794         0.0417 0.908   0.601
#> MAD:skmeans 6 0.683           0.537       0.753         0.0395 0.915   0.652
#> ATC:skmeans 6 0.781           0.694       0.832         0.0430 0.963   0.845
#> SD:mclust   6 0.744           0.750       0.845         0.0426 0.931   0.733
#> CV:mclust   6 0.780           0.644       0.820         0.0449 0.979   0.920
#> MAD:mclust  6 0.818           0.834       0.901         0.0459 0.892   0.619
#> ATC:mclust  6 0.865           0.864       0.907         0.0537 0.921   0.647
#> SD:kmeans   6 0.705           0.644       0.767         0.0550 0.930   0.704
#> CV:kmeans   6 0.665           0.574       0.765         0.0553 0.929   0.709
#> MAD:kmeans  6 0.718           0.630       0.791         0.0478 0.904   0.619
#> ATC:kmeans  6 0.748           0.692       0.803         0.0607 0.894   0.594
#> SD:pam      6 0.721           0.776       0.865         0.0797 0.927   0.740
#> CV:pam      6 0.745           0.732       0.862         0.0912 0.873   0.596
#> MAD:pam     6 0.792           0.735       0.850         0.0643 0.954   0.811
#> ATC:pam     6 0.723           0.792       0.880         0.0320 0.990   0.964
#> SD:hclust   6 0.482           0.487       0.675         0.0701 0.809   0.499
#> CV:hclust   6 0.526           0.553       0.717         0.1098 0.996   0.991
#> MAD:hclust  6 0.433           0.346       0.626         0.0452 0.904   0.725
#> ATC:hclust  6 0.673           0.692       0.827         0.1019 0.892   0.711

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 tissue(p) k
#> SD:NMF      84  1.17e-01 2
#> CV:NMF      84  7.76e-03 2
#> MAD:NMF     90  5.72e-01 2
#> ATC:NMF     86  4.93e-01 2
#> SD:skmeans  85  2.64e-01 2
#> CV:skmeans  83  9.38e-02 2
#> MAD:skmeans 89  4.88e-01 2
#> ATC:skmeans 87  4.17e-01 2
#> SD:mclust   84  5.32e-16 2
#> CV:mclust   87  2.44e-15 2
#> MAD:mclust  91  2.24e-01 2
#> ATC:mclust  91  3.80e-01 2
#> SD:kmeans   84  9.23e-02 2
#> CV:kmeans   86  8.31e-02 2
#> MAD:kmeans  89  3.83e-01 2
#> ATC:kmeans  87  1.46e-01 2
#> SD:pam      85  1.30e-01 2
#> CV:pam      88  1.01e-01 2
#> MAD:pam     74  3.68e-01 2
#> ATC:pam     87  2.44e-01 2
#> SD:hclust   89  1.49e-01 2
#> CV:hclust   86  6.87e-02 2
#> MAD:hclust  89  8.14e-02 2
#> ATC:hclust  88  1.92e-01 2
test_to_known_factors(res_list, k = 3)
#>              n tissue(p) k
#> SD:NMF      82  1.14e-03 3
#> CV:NMF      85  2.09e-03 3
#> MAD:NMF     90  3.05e-02 3
#> ATC:NMF     83  2.91e-01 3
#> SD:skmeans  72  6.46e-02 3
#> CV:skmeans  74  5.17e-12 3
#> MAD:skmeans 65  4.17e-02 3
#> ATC:skmeans 82  5.71e-02 3
#> SD:mclust   86  2.14e-13 3
#> CV:mclust   85  6.01e-14 3
#> MAD:mclust  83  5.40e-02 3
#> ATC:mclust  88  3.06e-01 3
#> SD:kmeans   64  6.27e-02 3
#> CV:kmeans   80  1.15e-09 3
#> MAD:kmeans  86  1.13e-01 3
#> ATC:kmeans  81  1.74e-01 3
#> SD:pam      86  1.01e-01 3
#> CV:pam      81  1.24e-09 3
#> MAD:pam     88  7.64e-02 3
#> ATC:pam     89  5.07e-02 3
#> SD:hclust   76  1.83e-01 3
#> CV:hclust   56  4.59e-02 3
#> MAD:hclust  79  7.34e-02 3
#> ATC:hclust  87  1.56e-01 3
test_to_known_factors(res_list, k = 4)
#>              n tissue(p) k
#> SD:NMF      83  1.47e-13 4
#> CV:NMF      88  2.63e-12 4
#> MAD:NMF     86  1.66e-02 4
#> ATC:NMF     86  2.88e-01 4
#> SD:skmeans  86  2.15e-05 4
#> CV:skmeans  87  7.43e-06 4
#> MAD:skmeans 85  4.72e-02 4
#> ATC:skmeans 85  2.73e-01 4
#> SD:mclust   81  8.62e-16 4
#> CV:mclust   79  7.15e-12 4
#> MAD:mclust  51  1.22e-04 4
#> ATC:mclust  89  5.02e-02 4
#> SD:kmeans   69  7.43e-10 4
#> CV:kmeans   73  3.96e-08 4
#> MAD:kmeans  86  3.71e-02 4
#> ATC:kmeans  35  2.31e-01 4
#> SD:pam      90  7.47e-09 4
#> CV:pam      84  1.06e-08 4
#> MAD:pam     76  3.51e-04 4
#> ATC:pam     88  1.60e-01 4
#> SD:hclust   76  6.47e-06 4
#> CV:hclust   71  1.41e-07 4
#> MAD:hclust  44  3.52e-02 4
#> ATC:hclust  88  1.19e-01 4
test_to_known_factors(res_list, k = 5)
#>              n tissue(p) k
#> SD:NMF      85  2.68e-07 5
#> CV:NMF      86  7.94e-09 5
#> MAD:NMF     79  5.23e-02 5
#> ATC:NMF     84  5.68e-02 5
#> SD:skmeans  75  9.57e-07 5
#> CV:skmeans  83  2.69e-07 5
#> MAD:skmeans 68  1.20e-02 5
#> ATC:skmeans 83  4.58e-01 5
#> SD:mclust   87  1.01e-07 5
#> CV:mclust   85  5.74e-10 5
#> MAD:mclust  63  4.33e-04 5
#> ATC:mclust  88  3.26e-02 5
#> SD:kmeans   76  4.33e-06 5
#> CV:kmeans   71  1.20e-05 5
#> MAD:kmeans  64  6.83e-02 5
#> ATC:kmeans  79  3.01e-01 5
#> SD:pam      76  3.91e-07 5
#> CV:pam      89  2.60e-07 5
#> MAD:pam     88  3.22e-04 5
#> ATC:pam     89  2.92e-02 5
#> SD:hclust   70  1.04e-06 5
#> CV:hclust   79  5.09e-05 5
#> MAD:hclust  45  1.11e-01 5
#> ATC:hclust  71  3.28e-02 5
test_to_known_factors(res_list, k = 6)
#>              n tissue(p) k
#> SD:NMF      72  4.02e-04 6
#> CV:NMF      86  8.13e-05 6
#> MAD:NMF     53  2.93e-01 6
#> ATC:NMF     79  4.65e-02 6
#> SD:skmeans  58  6.40e-07 6
#> CV:skmeans  71  2.04e-05 6
#> MAD:skmeans 57  1.51e-01 6
#> ATC:skmeans 77  3.93e-01 6
#> SD:mclust   82  9.95e-07 6
#> CV:mclust   71  6.17e-11 6
#> MAD:mclust  87  3.48e-02 6
#> ATC:mclust  87  1.41e-01 6
#> SD:kmeans   71  2.65e-04 6
#> CV:kmeans   50  1.44e-03 6
#> MAD:kmeans  69  7.35e-03 6
#> ATC:kmeans  75  1.33e-01 6
#> SD:pam      83  9.01e-07 6
#> CV:pam      79  3.31e-06 6
#> MAD:pam     79  3.93e-04 6
#> ATC:pam     86  1.94e-02 6
#> SD:hclust   43  4.30e-03 6
#> CV:hclust   59  4.87e-07 6
#> MAD:hclust  39  1.12e-01 6
#> ATC:hclust  77  1.68e-01 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 48983 rows and 91 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.627           0.884       0.938         0.2397 0.785   0.785
#> 3 3 0.319           0.679       0.804         1.2669 0.717   0.640
#> 4 4 0.369           0.632       0.760         0.1820 0.852   0.711
#> 5 5 0.397           0.572       0.718         0.0882 0.886   0.718
#> 6 6 0.482           0.487       0.675         0.0701 0.809   0.499

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.8327     0.8682 0.736 0.264
#> GSM1124888     1  0.8327     0.8682 0.736 0.264
#> GSM1124890     2  0.5059     0.8386 0.112 0.888
#> GSM1124904     2  0.0000     0.9419 0.000 1.000
#> GSM1124927     2  0.0000     0.9419 0.000 1.000
#> GSM1124953     2  0.9795     0.0761 0.416 0.584
#> GSM1124869     2  0.0000     0.9419 0.000 1.000
#> GSM1124870     2  0.0000     0.9419 0.000 1.000
#> GSM1124882     2  0.0672     0.9400 0.008 0.992
#> GSM1124884     2  0.0000     0.9419 0.000 1.000
#> GSM1124898     2  0.0000     0.9419 0.000 1.000
#> GSM1124903     2  0.0000     0.9419 0.000 1.000
#> GSM1124905     2  0.0000     0.9419 0.000 1.000
#> GSM1124910     2  0.1633     0.9318 0.024 0.976
#> GSM1124919     2  0.5059     0.8386 0.112 0.888
#> GSM1124932     2  0.0376     0.9411 0.004 0.996
#> GSM1124933     1  0.6973     0.8640 0.812 0.188
#> GSM1124867     2  0.0672     0.9405 0.008 0.992
#> GSM1124868     2  0.4161     0.8753 0.084 0.916
#> GSM1124878     2  0.4022     0.8790 0.080 0.920
#> GSM1124895     2  0.6973     0.7571 0.188 0.812
#> GSM1124897     2  0.4161     0.8753 0.084 0.916
#> GSM1124902     2  0.6973     0.7571 0.188 0.812
#> GSM1124908     2  0.6973     0.7571 0.188 0.812
#> GSM1124921     2  0.6973     0.7571 0.188 0.812
#> GSM1124939     2  0.6973     0.7571 0.188 0.812
#> GSM1124944     2  0.6973     0.7571 0.188 0.812
#> GSM1124945     1  0.0672     0.7903 0.992 0.008
#> GSM1124946     2  0.6973     0.7571 0.188 0.812
#> GSM1124947     2  0.6973     0.7571 0.188 0.812
#> GSM1124951     1  0.0672     0.7903 0.992 0.008
#> GSM1124952     2  0.6973     0.7571 0.188 0.812
#> GSM1124957     1  0.0672     0.7903 0.992 0.008
#> GSM1124900     2  0.0672     0.9400 0.008 0.992
#> GSM1124914     2  0.0000     0.9419 0.000 1.000
#> GSM1124871     2  0.0000     0.9419 0.000 1.000
#> GSM1124874     2  0.0000     0.9419 0.000 1.000
#> GSM1124875     2  0.1184     0.9358 0.016 0.984
#> GSM1124880     2  0.1184     0.9370 0.016 0.984
#> GSM1124881     2  0.0376     0.9411 0.004 0.996
#> GSM1124885     2  0.0000     0.9419 0.000 1.000
#> GSM1124886     2  0.6438     0.7471 0.164 0.836
#> GSM1124887     2  0.3584     0.8891 0.068 0.932
#> GSM1124894     2  0.0376     0.9407 0.004 0.996
#> GSM1124896     2  0.0000     0.9419 0.000 1.000
#> GSM1124899     2  0.0000     0.9419 0.000 1.000
#> GSM1124901     2  0.0000     0.9419 0.000 1.000
#> GSM1124906     2  0.0000     0.9419 0.000 1.000
#> GSM1124907     2  0.1414     0.9333 0.020 0.980
#> GSM1124911     2  0.0000     0.9419 0.000 1.000
#> GSM1124912     2  0.0672     0.9400 0.008 0.992
#> GSM1124915     2  0.0000     0.9419 0.000 1.000
#> GSM1124917     2  0.0938     0.9389 0.012 0.988
#> GSM1124918     2  0.1184     0.9358 0.016 0.984
#> GSM1124920     1  0.8443     0.8621 0.728 0.272
#> GSM1124922     2  0.0000     0.9419 0.000 1.000
#> GSM1124924     2  0.1184     0.9374 0.016 0.984
#> GSM1124926     2  0.0000     0.9419 0.000 1.000
#> GSM1124928     2  0.1633     0.9318 0.024 0.976
#> GSM1124930     2  0.1414     0.9333 0.020 0.980
#> GSM1124931     2  0.0376     0.9411 0.004 0.996
#> GSM1124935     2  0.0000     0.9419 0.000 1.000
#> GSM1124936     1  0.8555     0.8524 0.720 0.280
#> GSM1124938     2  0.1184     0.9360 0.016 0.984
#> GSM1124940     2  0.0000     0.9419 0.000 1.000
#> GSM1124941     2  0.0000     0.9419 0.000 1.000
#> GSM1124942     2  0.1414     0.9333 0.020 0.980
#> GSM1124943     2  0.1414     0.9333 0.020 0.980
#> GSM1124948     2  0.0938     0.9390 0.012 0.988
#> GSM1124949     2  0.1184     0.9360 0.016 0.984
#> GSM1124950     2  0.0376     0.9411 0.004 0.996
#> GSM1124954     1  0.8327     0.8682 0.736 0.264
#> GSM1124955     2  0.0000     0.9419 0.000 1.000
#> GSM1124956     2  0.0000     0.9419 0.000 1.000
#> GSM1124872     2  0.0376     0.9411 0.004 0.996
#> GSM1124873     2  0.0376     0.9411 0.004 0.996
#> GSM1124876     1  0.6973     0.8640 0.812 0.188
#> GSM1124877     2  0.0000     0.9419 0.000 1.000
#> GSM1124879     2  0.1184     0.9359 0.016 0.984
#> GSM1124883     2  0.0000     0.9419 0.000 1.000
#> GSM1124889     2  0.0000     0.9419 0.000 1.000
#> GSM1124892     2  0.9522     0.1807 0.372 0.628
#> GSM1124893     2  0.0000     0.9419 0.000 1.000
#> GSM1124909     2  0.0376     0.9411 0.004 0.996
#> GSM1124913     2  0.0000     0.9419 0.000 1.000
#> GSM1124916     2  0.0376     0.9411 0.004 0.996
#> GSM1124923     2  0.5059     0.8386 0.112 0.888
#> GSM1124925     2  0.0000     0.9419 0.000 1.000
#> GSM1124929     2  0.1184     0.9360 0.016 0.984
#> GSM1124934     1  0.8499     0.8567 0.724 0.276
#> GSM1124937     2  0.1414     0.9338 0.020 0.980

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3   0.596     0.8506 0.264 0.016 0.720
#> GSM1124888     3   0.573     0.8529 0.272 0.008 0.720
#> GSM1124890     2   0.460     0.7502 0.040 0.852 0.108
#> GSM1124904     2   0.116     0.7704 0.028 0.972 0.000
#> GSM1124927     2   0.604     0.4291 0.380 0.620 0.000
#> GSM1124953     2   0.640     0.3309 0.004 0.580 0.416
#> GSM1124869     1   0.254     0.8099 0.920 0.080 0.000
#> GSM1124870     2   0.604     0.4291 0.380 0.620 0.000
#> GSM1124882     1   0.259     0.8039 0.924 0.072 0.004
#> GSM1124884     2   0.388     0.7614 0.152 0.848 0.000
#> GSM1124898     2   0.245     0.7820 0.076 0.924 0.000
#> GSM1124903     2   0.116     0.7704 0.028 0.972 0.000
#> GSM1124905     2   0.626     0.2244 0.448 0.552 0.000
#> GSM1124910     1   0.468     0.7140 0.804 0.192 0.004
#> GSM1124919     2   0.460     0.7502 0.040 0.852 0.108
#> GSM1124932     2   0.468     0.7359 0.192 0.804 0.004
#> GSM1124933     3   0.429     0.8464 0.180 0.000 0.820
#> GSM1124867     2   0.648     0.2385 0.452 0.544 0.004
#> GSM1124868     2   0.395     0.7376 0.040 0.884 0.076
#> GSM1124878     2   0.386     0.7391 0.040 0.888 0.072
#> GSM1124895     2   0.642     0.6647 0.068 0.752 0.180
#> GSM1124897     2   0.395     0.7376 0.040 0.884 0.076
#> GSM1124902     2   0.642     0.6647 0.068 0.752 0.180
#> GSM1124908     2   0.642     0.6647 0.068 0.752 0.180
#> GSM1124921     2   0.642     0.6647 0.068 0.752 0.180
#> GSM1124939     2   0.642     0.6647 0.068 0.752 0.180
#> GSM1124944     2   0.642     0.6647 0.068 0.752 0.180
#> GSM1124945     3   0.000     0.7628 0.000 0.000 1.000
#> GSM1124946     2   0.642     0.6647 0.068 0.752 0.180
#> GSM1124947     2   0.642     0.6647 0.068 0.752 0.180
#> GSM1124951     3   0.000     0.7628 0.000 0.000 1.000
#> GSM1124952     2   0.776     0.6340 0.144 0.676 0.180
#> GSM1124957     3   0.000     0.7628 0.000 0.000 1.000
#> GSM1124900     2   0.636     0.3696 0.404 0.592 0.004
#> GSM1124914     2   0.236     0.7817 0.072 0.928 0.000
#> GSM1124871     2   0.175     0.7821 0.048 0.952 0.000
#> GSM1124874     2   0.196     0.7843 0.056 0.944 0.000
#> GSM1124875     2   0.517     0.7230 0.192 0.792 0.016
#> GSM1124880     1   0.633     0.3007 0.600 0.396 0.004
#> GSM1124881     2   0.518     0.6670 0.256 0.744 0.000
#> GSM1124885     2   0.116     0.7704 0.028 0.972 0.000
#> GSM1124886     1   0.603     0.6074 0.780 0.068 0.152
#> GSM1124887     2   0.367     0.7690 0.040 0.896 0.064
#> GSM1124894     2   0.644     0.2715 0.432 0.564 0.004
#> GSM1124896     1   0.254     0.8099 0.920 0.080 0.000
#> GSM1124899     2   0.319     0.7821 0.112 0.888 0.000
#> GSM1124901     2   0.245     0.7827 0.076 0.924 0.000
#> GSM1124906     2   0.418     0.7479 0.172 0.828 0.000
#> GSM1124907     2   0.323     0.7802 0.072 0.908 0.020
#> GSM1124911     2   0.263     0.7797 0.084 0.916 0.000
#> GSM1124912     1   0.259     0.8039 0.924 0.072 0.004
#> GSM1124915     2   0.164     0.7836 0.044 0.956 0.000
#> GSM1124917     2   0.537     0.6699 0.252 0.744 0.004
#> GSM1124918     2   0.517     0.7230 0.192 0.792 0.016
#> GSM1124920     3   0.592     0.8486 0.276 0.012 0.712
#> GSM1124922     2   0.388     0.7614 0.152 0.848 0.000
#> GSM1124924     1   0.648     0.1112 0.548 0.448 0.004
#> GSM1124926     2   0.319     0.7821 0.112 0.888 0.000
#> GSM1124928     1   0.596     0.4925 0.672 0.324 0.004
#> GSM1124930     2   0.359     0.7794 0.088 0.892 0.020
#> GSM1124931     2   0.488     0.7168 0.208 0.788 0.004
#> GSM1124935     2   0.245     0.7820 0.076 0.924 0.000
#> GSM1124936     3   0.602     0.8389 0.288 0.012 0.700
#> GSM1124938     2   0.369     0.7791 0.100 0.884 0.016
#> GSM1124940     1   0.254     0.8099 0.920 0.080 0.000
#> GSM1124941     2   0.418     0.7479 0.172 0.828 0.000
#> GSM1124942     2   0.359     0.7794 0.088 0.892 0.020
#> GSM1124943     2   0.359     0.7794 0.088 0.892 0.020
#> GSM1124948     2   0.651     0.1497 0.472 0.524 0.004
#> GSM1124949     1   0.277     0.7996 0.920 0.072 0.008
#> GSM1124950     2   0.627     0.2290 0.456 0.544 0.000
#> GSM1124954     3   0.576     0.8521 0.276 0.008 0.716
#> GSM1124955     1   0.254     0.8099 0.920 0.080 0.000
#> GSM1124956     2   0.263     0.7797 0.084 0.916 0.000
#> GSM1124872     2   0.627     0.2290 0.456 0.544 0.000
#> GSM1124873     2   0.518     0.6670 0.256 0.744 0.000
#> GSM1124876     3   0.429     0.8464 0.180 0.000 0.820
#> GSM1124877     1   0.254     0.8099 0.920 0.080 0.000
#> GSM1124879     1   0.254     0.7988 0.920 0.080 0.000
#> GSM1124883     2   0.116     0.7704 0.028 0.972 0.000
#> GSM1124889     2   0.164     0.7836 0.044 0.956 0.000
#> GSM1124892     1   0.684    -0.0515 0.624 0.024 0.352
#> GSM1124893     1   0.254     0.8099 0.920 0.080 0.000
#> GSM1124909     2   0.518     0.6670 0.256 0.744 0.000
#> GSM1124913     2   0.116     0.7704 0.028 0.972 0.000
#> GSM1124916     2   0.518     0.6670 0.256 0.744 0.000
#> GSM1124923     2   0.460     0.7502 0.040 0.852 0.108
#> GSM1124925     1   0.254     0.8099 0.920 0.080 0.000
#> GSM1124929     1   0.277     0.7996 0.920 0.072 0.008
#> GSM1124934     3   0.586     0.8404 0.288 0.008 0.704
#> GSM1124937     1   0.604     0.3697 0.620 0.380 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.6564    0.83727 0.248 0.024 0.652 0.076
#> GSM1124888     3  0.6418    0.84030 0.256 0.016 0.652 0.076
#> GSM1124890     2  0.4235    0.63594 0.020 0.840 0.096 0.044
#> GSM1124904     2  0.2976    0.64181 0.008 0.872 0.000 0.120
#> GSM1124927     2  0.7591    0.29979 0.352 0.444 0.000 0.204
#> GSM1124953     2  0.5984    0.23431 0.008 0.560 0.404 0.028
#> GSM1124869     1  0.0804    0.72623 0.980 0.012 0.000 0.008
#> GSM1124870     2  0.7591    0.29979 0.352 0.444 0.000 0.204
#> GSM1124882     1  0.0524    0.72011 0.988 0.004 0.000 0.008
#> GSM1124884     2  0.6404    0.58147 0.136 0.644 0.000 0.220
#> GSM1124898     2  0.3934    0.69880 0.048 0.836 0.000 0.116
#> GSM1124903     2  0.2976    0.64181 0.008 0.872 0.000 0.120
#> GSM1124905     1  0.7429    0.13828 0.492 0.192 0.000 0.316
#> GSM1124910     1  0.4820    0.61617 0.772 0.168 0.000 0.060
#> GSM1124919     2  0.4235    0.63594 0.020 0.840 0.096 0.044
#> GSM1124932     2  0.6360    0.61020 0.180 0.656 0.000 0.164
#> GSM1124933     3  0.3400    0.82927 0.180 0.000 0.820 0.000
#> GSM1124867     2  0.6957    0.26085 0.416 0.472 0.000 0.112
#> GSM1124868     2  0.4053    0.55433 0.004 0.768 0.000 0.228
#> GSM1124878     2  0.3870    0.54785 0.004 0.788 0.000 0.208
#> GSM1124895     4  0.3791    0.95057 0.004 0.200 0.000 0.796
#> GSM1124897     2  0.4053    0.55433 0.004 0.768 0.000 0.228
#> GSM1124902     4  0.3791    0.95057 0.004 0.200 0.000 0.796
#> GSM1124908     4  0.3751    0.94323 0.004 0.196 0.000 0.800
#> GSM1124921     4  0.3751    0.94323 0.004 0.196 0.000 0.800
#> GSM1124939     4  0.3791    0.95057 0.004 0.200 0.000 0.796
#> GSM1124944     4  0.3791    0.95057 0.004 0.200 0.000 0.796
#> GSM1124945     3  0.0000    0.74586 0.000 0.000 1.000 0.000
#> GSM1124946     4  0.3710    0.93892 0.004 0.192 0.000 0.804
#> GSM1124947     4  0.3791    0.95057 0.004 0.200 0.000 0.796
#> GSM1124951     3  0.0000    0.74586 0.000 0.000 1.000 0.000
#> GSM1124952     4  0.6536    0.59205 0.096 0.324 0.000 0.580
#> GSM1124957     3  0.0000    0.74586 0.000 0.000 1.000 0.000
#> GSM1124900     2  0.7485    0.27255 0.380 0.440 0.000 0.180
#> GSM1124914     2  0.3850    0.69744 0.044 0.840 0.000 0.116
#> GSM1124871     2  0.3308    0.70174 0.036 0.872 0.000 0.092
#> GSM1124874     2  0.3840    0.70561 0.052 0.844 0.000 0.104
#> GSM1124875     2  0.5074    0.68151 0.168 0.764 0.004 0.064
#> GSM1124880     1  0.6383    0.16817 0.568 0.356 0.000 0.076
#> GSM1124881     2  0.5790    0.64066 0.236 0.684 0.000 0.080
#> GSM1124885     2  0.2976    0.64181 0.008 0.872 0.000 0.120
#> GSM1124886     1  0.4411    0.53386 0.824 0.012 0.112 0.052
#> GSM1124887     2  0.3928    0.65542 0.020 0.860 0.052 0.068
#> GSM1124894     1  0.7660    0.10533 0.476 0.200 0.004 0.320
#> GSM1124896     1  0.0804    0.72623 0.980 0.012 0.000 0.008
#> GSM1124899     2  0.4856    0.69832 0.084 0.780 0.000 0.136
#> GSM1124901     2  0.3899    0.70278 0.052 0.840 0.000 0.108
#> GSM1124906     2  0.5515    0.67812 0.152 0.732 0.000 0.116
#> GSM1124907     2  0.2920    0.69787 0.044 0.904 0.008 0.044
#> GSM1124911     2  0.4791    0.68379 0.080 0.784 0.000 0.136
#> GSM1124912     1  0.0524    0.72011 0.988 0.004 0.000 0.008
#> GSM1124915     2  0.3286    0.70905 0.044 0.876 0.000 0.080
#> GSM1124917     2  0.5997    0.64678 0.232 0.680 0.004 0.084
#> GSM1124918     2  0.5074    0.68151 0.168 0.764 0.004 0.064
#> GSM1124920     3  0.6471    0.83658 0.264 0.016 0.644 0.076
#> GSM1124922     2  0.5434    0.68038 0.128 0.740 0.000 0.132
#> GSM1124924     1  0.6527   -0.04647 0.508 0.416 0.000 0.076
#> GSM1124926     2  0.4856    0.69832 0.084 0.780 0.000 0.136
#> GSM1124928     1  0.6016    0.36432 0.632 0.300 0.000 0.068
#> GSM1124930     2  0.2877    0.70112 0.060 0.904 0.008 0.028
#> GSM1124931     2  0.6852    0.51724 0.192 0.600 0.000 0.208
#> GSM1124935     2  0.3818    0.70220 0.048 0.844 0.000 0.108
#> GSM1124936     3  0.6581    0.82669 0.272 0.016 0.632 0.080
#> GSM1124938     2  0.2958    0.70416 0.072 0.896 0.004 0.028
#> GSM1124940     1  0.0804    0.72623 0.980 0.012 0.000 0.008
#> GSM1124941     2  0.5515    0.67812 0.152 0.732 0.000 0.116
#> GSM1124942     2  0.2877    0.70112 0.060 0.904 0.008 0.028
#> GSM1124943     2  0.2877    0.70112 0.060 0.904 0.008 0.028
#> GSM1124948     2  0.6247    0.28567 0.428 0.516 0.000 0.056
#> GSM1124949     1  0.1059    0.71797 0.972 0.012 0.000 0.016
#> GSM1124950     2  0.7044    0.22175 0.428 0.452 0.000 0.120
#> GSM1124954     3  0.6539    0.83895 0.256 0.016 0.644 0.084
#> GSM1124955     1  0.0804    0.72623 0.980 0.012 0.000 0.008
#> GSM1124956     2  0.4791    0.68379 0.080 0.784 0.000 0.136
#> GSM1124872     2  0.7044    0.22175 0.428 0.452 0.000 0.120
#> GSM1124873     2  0.5790    0.64066 0.236 0.684 0.000 0.080
#> GSM1124876     3  0.3400    0.82927 0.180 0.000 0.820 0.000
#> GSM1124877     1  0.0937    0.72390 0.976 0.012 0.000 0.012
#> GSM1124879     1  0.3081    0.68487 0.888 0.048 0.000 0.064
#> GSM1124883     2  0.2976    0.64181 0.008 0.872 0.000 0.120
#> GSM1124889     2  0.3505    0.70991 0.048 0.864 0.000 0.088
#> GSM1124892     1  0.6126   -0.00345 0.632 0.004 0.300 0.064
#> GSM1124893     1  0.0804    0.72623 0.980 0.012 0.000 0.008
#> GSM1124909     2  0.5759    0.64291 0.232 0.688 0.000 0.080
#> GSM1124913     2  0.2976    0.64181 0.008 0.872 0.000 0.120
#> GSM1124916     2  0.5759    0.64291 0.232 0.688 0.000 0.080
#> GSM1124923     2  0.4235    0.63594 0.020 0.840 0.096 0.044
#> GSM1124925     1  0.0804    0.72623 0.980 0.012 0.000 0.008
#> GSM1124929     1  0.1059    0.71797 0.972 0.012 0.000 0.016
#> GSM1124934     3  0.6531    0.83120 0.264 0.016 0.640 0.080
#> GSM1124937     1  0.6362    0.16982 0.560 0.368 0.000 0.072

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1124891     5  0.6284     0.9481 0.188 0.008 0.232 0.000 0.572
#> GSM1124888     5  0.6076     0.9549 0.196 0.000 0.232 0.000 0.572
#> GSM1124890     2  0.6524     0.5678 0.008 0.620 0.080 0.064 0.228
#> GSM1124904     2  0.3141     0.6053 0.000 0.852 0.000 0.040 0.108
#> GSM1124927     1  0.8472     0.1052 0.300 0.268 0.000 0.268 0.164
#> GSM1124953     3  0.6791     0.2139 0.000 0.312 0.384 0.000 0.304
#> GSM1124869     1  0.0162     0.5363 0.996 0.004 0.000 0.000 0.000
#> GSM1124870     1  0.8472     0.1052 0.300 0.268 0.000 0.268 0.164
#> GSM1124882     1  0.0510     0.5283 0.984 0.000 0.000 0.000 0.016
#> GSM1124884     2  0.6267     0.5615 0.136 0.560 0.000 0.292 0.012
#> GSM1124898     2  0.3935     0.6903 0.040 0.828 0.000 0.092 0.040
#> GSM1124903     2  0.3141     0.6053 0.000 0.852 0.000 0.040 0.108
#> GSM1124905     1  0.7001     0.0735 0.452 0.048 0.000 0.380 0.120
#> GSM1124910     1  0.5546     0.5136 0.720 0.100 0.000 0.064 0.116
#> GSM1124919     2  0.6524     0.5678 0.008 0.620 0.080 0.064 0.228
#> GSM1124932     2  0.7630     0.4970 0.160 0.496 0.000 0.228 0.116
#> GSM1124933     3  0.3203     0.4773 0.168 0.000 0.820 0.000 0.012
#> GSM1124867     1  0.8139     0.0821 0.372 0.316 0.000 0.172 0.140
#> GSM1124868     2  0.5153     0.5229 0.000 0.684 0.000 0.204 0.112
#> GSM1124878     2  0.4454     0.5313 0.000 0.760 0.000 0.128 0.112
#> GSM1124895     4  0.0963     0.9339 0.000 0.036 0.000 0.964 0.000
#> GSM1124897     2  0.5153     0.5229 0.000 0.684 0.000 0.204 0.112
#> GSM1124902     4  0.0963     0.9339 0.000 0.036 0.000 0.964 0.000
#> GSM1124908     4  0.1341     0.9255 0.000 0.056 0.000 0.944 0.000
#> GSM1124921     4  0.1341     0.9255 0.000 0.056 0.000 0.944 0.000
#> GSM1124939     4  0.0963     0.9339 0.000 0.036 0.000 0.964 0.000
#> GSM1124944     4  0.0963     0.9339 0.000 0.036 0.000 0.964 0.000
#> GSM1124945     3  0.0000     0.6720 0.000 0.000 1.000 0.000 0.000
#> GSM1124946     4  0.1410     0.9204 0.000 0.060 0.000 0.940 0.000
#> GSM1124947     4  0.0963     0.9339 0.000 0.036 0.000 0.964 0.000
#> GSM1124951     3  0.0000     0.6720 0.000 0.000 1.000 0.000 0.000
#> GSM1124952     4  0.5215     0.4640 0.096 0.240 0.000 0.664 0.000
#> GSM1124957     3  0.0000     0.6720 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     1  0.8453     0.1118 0.312 0.280 0.000 0.244 0.164
#> GSM1124914     2  0.4083     0.6942 0.044 0.820 0.000 0.092 0.044
#> GSM1124871     2  0.4026     0.7045 0.040 0.824 0.000 0.088 0.048
#> GSM1124874     2  0.4461     0.7010 0.048 0.784 0.000 0.136 0.032
#> GSM1124875     2  0.6455     0.6341 0.152 0.636 0.000 0.140 0.072
#> GSM1124880     1  0.7551     0.3723 0.496 0.248 0.000 0.104 0.152
#> GSM1124881     2  0.6693     0.5576 0.216 0.584 0.000 0.152 0.048
#> GSM1124885     2  0.3141     0.6053 0.000 0.852 0.000 0.040 0.108
#> GSM1124886     1  0.3048     0.3207 0.820 0.004 0.000 0.000 0.176
#> GSM1124887     2  0.5500     0.6062 0.008 0.696 0.036 0.048 0.212
#> GSM1124894     1  0.7099     0.0461 0.436 0.048 0.000 0.384 0.132
#> GSM1124896     1  0.0579     0.5402 0.984 0.008 0.000 0.000 0.008
#> GSM1124899     2  0.5274     0.6858 0.080 0.724 0.000 0.160 0.036
#> GSM1124901     2  0.3986     0.6957 0.044 0.824 0.000 0.096 0.036
#> GSM1124906     2  0.5828     0.6456 0.148 0.660 0.000 0.172 0.020
#> GSM1124907     2  0.4908     0.6640 0.028 0.748 0.000 0.068 0.156
#> GSM1124911     2  0.5254     0.6771 0.072 0.712 0.000 0.188 0.028
#> GSM1124912     1  0.0510     0.5283 0.984 0.000 0.000 0.000 0.016
#> GSM1124915     2  0.3606     0.7113 0.044 0.840 0.000 0.100 0.016
#> GSM1124917     2  0.6949     0.5776 0.208 0.572 0.000 0.148 0.072
#> GSM1124918     2  0.6455     0.6341 0.152 0.636 0.000 0.140 0.072
#> GSM1124920     5  0.6155     0.9535 0.212 0.000 0.228 0.000 0.560
#> GSM1124922     2  0.5922     0.6598 0.116 0.652 0.000 0.204 0.028
#> GSM1124924     1  0.7810     0.3007 0.444 0.276 0.000 0.104 0.176
#> GSM1124926     2  0.5274     0.6858 0.080 0.724 0.000 0.160 0.036
#> GSM1124928     1  0.7048     0.4519 0.560 0.216 0.000 0.076 0.148
#> GSM1124930     2  0.5209     0.6651 0.044 0.732 0.000 0.068 0.156
#> GSM1124931     2  0.8121     0.3364 0.160 0.400 0.000 0.284 0.156
#> GSM1124935     2  0.3853     0.6989 0.044 0.832 0.000 0.092 0.032
#> GSM1124936     5  0.6203     0.9416 0.224 0.000 0.224 0.000 0.552
#> GSM1124938     2  0.5371     0.6682 0.056 0.724 0.000 0.068 0.152
#> GSM1124940     1  0.0162     0.5363 0.996 0.004 0.000 0.000 0.000
#> GSM1124941     2  0.5828     0.6456 0.148 0.660 0.000 0.172 0.020
#> GSM1124942     2  0.5209     0.6651 0.044 0.732 0.000 0.068 0.156
#> GSM1124943     2  0.5209     0.6651 0.044 0.732 0.000 0.068 0.156
#> GSM1124948     2  0.7069     0.0737 0.404 0.432 0.000 0.092 0.072
#> GSM1124949     1  0.0955     0.5241 0.968 0.004 0.000 0.000 0.028
#> GSM1124950     1  0.8280     0.1797 0.372 0.280 0.000 0.180 0.168
#> GSM1124954     5  0.5820     0.9477 0.196 0.000 0.192 0.000 0.612
#> GSM1124955     1  0.0579     0.5402 0.984 0.008 0.000 0.000 0.008
#> GSM1124956     2  0.5254     0.6771 0.072 0.712 0.000 0.188 0.028
#> GSM1124872     1  0.8280     0.1797 0.372 0.280 0.000 0.180 0.168
#> GSM1124873     2  0.6754     0.5541 0.216 0.580 0.000 0.152 0.052
#> GSM1124876     3  0.3203     0.4773 0.168 0.000 0.820 0.000 0.012
#> GSM1124877     1  0.0807     0.5399 0.976 0.012 0.000 0.000 0.012
#> GSM1124879     1  0.3079     0.5221 0.876 0.016 0.000 0.064 0.044
#> GSM1124883     2  0.3141     0.6053 0.000 0.852 0.000 0.040 0.108
#> GSM1124889     2  0.3781     0.7108 0.048 0.828 0.000 0.108 0.016
#> GSM1124892     1  0.5174    -0.2583 0.604 0.000 0.056 0.000 0.340
#> GSM1124893     1  0.0324     0.5357 0.992 0.004 0.000 0.000 0.004
#> GSM1124909     2  0.6693     0.5575 0.216 0.584 0.000 0.152 0.048
#> GSM1124913     2  0.3141     0.6053 0.000 0.852 0.000 0.040 0.108
#> GSM1124916     2  0.6693     0.5575 0.216 0.584 0.000 0.152 0.048
#> GSM1124923     2  0.6499     0.5671 0.008 0.624 0.080 0.064 0.224
#> GSM1124925     1  0.0579     0.5402 0.984 0.008 0.000 0.000 0.008
#> GSM1124929     1  0.0955     0.5241 0.968 0.004 0.000 0.000 0.028
#> GSM1124934     5  0.5969     0.9398 0.200 0.004 0.188 0.000 0.608
#> GSM1124937     1  0.6720     0.2607 0.528 0.328 0.000 0.076 0.068

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     6  0.3375     0.9222 0.112 0.008 0.056 0.000 0.000 0.824
#> GSM1124888     6  0.3352     0.9255 0.120 0.004 0.056 0.000 0.000 0.820
#> GSM1124890     2  0.5257     0.1657 0.000 0.724 0.080 0.020 0.088 0.088
#> GSM1124904     5  0.3189     0.7292 0.000 0.236 0.000 0.000 0.760 0.004
#> GSM1124927     2  0.8090     0.3618 0.228 0.380 0.000 0.160 0.188 0.044
#> GSM1124953     3  0.7356     0.3192 0.000 0.364 0.380 0.020 0.120 0.116
#> GSM1124869     1  0.0405     0.7343 0.988 0.004 0.000 0.000 0.000 0.008
#> GSM1124870     2  0.8090     0.3618 0.228 0.380 0.000 0.160 0.188 0.044
#> GSM1124882     1  0.0865     0.7218 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM1124884     2  0.6437     0.3292 0.088 0.572 0.000 0.184 0.152 0.004
#> GSM1124898     5  0.5155     0.5345 0.008 0.424 0.000 0.064 0.504 0.000
#> GSM1124903     5  0.3189     0.7292 0.000 0.236 0.000 0.000 0.760 0.004
#> GSM1124905     1  0.7868    -0.0167 0.364 0.056 0.000 0.328 0.156 0.096
#> GSM1124910     1  0.5891     0.5090 0.656 0.168 0.000 0.024 0.088 0.064
#> GSM1124919     2  0.5257     0.1657 0.000 0.724 0.080 0.020 0.088 0.088
#> GSM1124932     2  0.7423     0.3428 0.128 0.444 0.000 0.140 0.268 0.020
#> GSM1124933     3  0.3703     0.6468 0.104 0.000 0.788 0.000 0.000 0.108
#> GSM1124867     2  0.7235     0.4020 0.292 0.456 0.000 0.076 0.148 0.028
#> GSM1124868     5  0.5184     0.6434 0.000 0.176 0.000 0.148 0.660 0.016
#> GSM1124878     5  0.4492     0.6555 0.000 0.164 0.000 0.088 0.732 0.016
#> GSM1124895     4  0.0937     0.9225 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM1124897     5  0.5242     0.6412 0.000 0.184 0.000 0.148 0.652 0.016
#> GSM1124902     4  0.0937     0.9225 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM1124908     4  0.1257     0.9137 0.000 0.028 0.000 0.952 0.020 0.000
#> GSM1124921     4  0.1257     0.9137 0.000 0.028 0.000 0.952 0.020 0.000
#> GSM1124939     4  0.0937     0.9225 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM1124944     4  0.0937     0.9225 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM1124945     3  0.0458     0.7606 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM1124946     4  0.1261     0.9085 0.000 0.024 0.000 0.952 0.024 0.000
#> GSM1124947     4  0.0937     0.9225 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM1124951     3  0.0458     0.7606 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM1124952     4  0.6380     0.3369 0.080 0.204 0.000 0.572 0.140 0.004
#> GSM1124957     3  0.0458     0.7606 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM1124900     2  0.8087     0.3621 0.232 0.396 0.000 0.144 0.172 0.056
#> GSM1124914     5  0.5464     0.5347 0.012 0.416 0.000 0.064 0.500 0.008
#> GSM1124871     5  0.4761     0.3734 0.008 0.468 0.000 0.032 0.492 0.000
#> GSM1124874     2  0.5336    -0.2105 0.012 0.520 0.000 0.076 0.392 0.000
#> GSM1124875     2  0.5948     0.3916 0.128 0.652 0.008 0.048 0.152 0.012
#> GSM1124880     1  0.7235    -0.1303 0.400 0.360 0.000 0.028 0.144 0.068
#> GSM1124881     2  0.5839     0.4293 0.156 0.624 0.000 0.060 0.160 0.000
#> GSM1124885     5  0.3076     0.7270 0.000 0.240 0.000 0.000 0.760 0.000
#> GSM1124886     1  0.3171     0.5583 0.812 0.008 0.000 0.004 0.008 0.168
#> GSM1124887     2  0.5706    -0.0211 0.000 0.624 0.036 0.020 0.252 0.068
#> GSM1124894     1  0.8000    -0.0516 0.344 0.060 0.000 0.328 0.164 0.104
#> GSM1124896     1  0.0405     0.7354 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM1124899     2  0.5860     0.1278 0.036 0.564 0.000 0.116 0.284 0.000
#> GSM1124901     5  0.5254     0.4906 0.012 0.440 0.000 0.064 0.484 0.000
#> GSM1124906     2  0.5960     0.3428 0.100 0.616 0.000 0.096 0.188 0.000
#> GSM1124907     2  0.2695     0.2844 0.012 0.884 0.012 0.000 0.072 0.020
#> GSM1124911     2  0.5929     0.1299 0.036 0.556 0.000 0.124 0.284 0.000
#> GSM1124912     1  0.0865     0.7218 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM1124915     2  0.5025    -0.2162 0.012 0.532 0.000 0.048 0.408 0.000
#> GSM1124917     2  0.7020     0.4012 0.156 0.544 0.000 0.060 0.188 0.052
#> GSM1124918     2  0.5948     0.3916 0.128 0.652 0.008 0.048 0.152 0.012
#> GSM1124920     6  0.3878     0.9067 0.176 0.004 0.056 0.000 0.000 0.764
#> GSM1124922     2  0.6093     0.3372 0.076 0.608 0.000 0.120 0.192 0.004
#> GSM1124924     2  0.7231     0.1844 0.352 0.396 0.000 0.028 0.168 0.056
#> GSM1124926     2  0.5860     0.1278 0.036 0.564 0.000 0.116 0.284 0.000
#> GSM1124928     1  0.6939     0.0799 0.472 0.312 0.000 0.024 0.132 0.060
#> GSM1124930     2  0.2674     0.3002 0.028 0.892 0.012 0.000 0.048 0.020
#> GSM1124931     2  0.7870     0.3259 0.124 0.400 0.000 0.176 0.260 0.040
#> GSM1124935     5  0.5303     0.4510 0.012 0.452 0.000 0.068 0.468 0.000
#> GSM1124936     6  0.4332     0.8836 0.192 0.004 0.052 0.008 0.004 0.740
#> GSM1124938     2  0.2427     0.3094 0.032 0.904 0.008 0.000 0.040 0.016
#> GSM1124940     1  0.0405     0.7343 0.988 0.004 0.000 0.000 0.000 0.008
#> GSM1124941     2  0.5960     0.3428 0.100 0.616 0.000 0.096 0.188 0.000
#> GSM1124942     2  0.2674     0.3002 0.028 0.892 0.012 0.000 0.048 0.020
#> GSM1124943     2  0.2674     0.3002 0.028 0.892 0.012 0.000 0.048 0.020
#> GSM1124948     2  0.5451     0.4126 0.328 0.580 0.000 0.016 0.064 0.012
#> GSM1124949     1  0.1210     0.7271 0.960 0.008 0.000 0.004 0.008 0.020
#> GSM1124950     2  0.7677     0.3458 0.288 0.408 0.000 0.084 0.176 0.044
#> GSM1124954     6  0.2333     0.9211 0.120 0.004 0.004 0.000 0.000 0.872
#> GSM1124955     1  0.0405     0.7354 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM1124956     2  0.5929     0.1299 0.036 0.556 0.000 0.124 0.284 0.000
#> GSM1124872     2  0.7677     0.3458 0.288 0.408 0.000 0.084 0.176 0.044
#> GSM1124873     2  0.5927     0.4281 0.156 0.612 0.000 0.060 0.172 0.000
#> GSM1124876     3  0.3703     0.6468 0.104 0.000 0.788 0.000 0.000 0.108
#> GSM1124877     1  0.0717     0.7347 0.976 0.016 0.000 0.000 0.000 0.008
#> GSM1124879     1  0.3751     0.6492 0.828 0.084 0.000 0.024 0.040 0.024
#> GSM1124883     5  0.3189     0.7292 0.000 0.236 0.000 0.000 0.760 0.004
#> GSM1124889     2  0.5198    -0.1824 0.016 0.528 0.000 0.056 0.400 0.000
#> GSM1124892     1  0.4363    -0.0174 0.580 0.004 0.000 0.008 0.008 0.400
#> GSM1124893     1  0.0405     0.7336 0.988 0.004 0.000 0.000 0.000 0.008
#> GSM1124909     2  0.5869     0.4317 0.156 0.620 0.000 0.060 0.164 0.000
#> GSM1124913     5  0.3189     0.7292 0.000 0.236 0.000 0.000 0.760 0.004
#> GSM1124916     2  0.5869     0.4317 0.156 0.620 0.000 0.060 0.164 0.000
#> GSM1124923     2  0.5383     0.1505 0.000 0.712 0.080 0.020 0.108 0.080
#> GSM1124925     1  0.0405     0.7354 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM1124929     1  0.1210     0.7271 0.960 0.008 0.000 0.004 0.008 0.020
#> GSM1124934     6  0.2402     0.9161 0.120 0.012 0.000 0.000 0.000 0.868
#> GSM1124937     2  0.6047     0.1458 0.440 0.444 0.000 0.024 0.068 0.024

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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 tissue(p) k
#> SD:hclust 89  1.49e-01 2
#> SD:hclust 76  1.83e-01 3
#> SD:hclust 76  6.47e-06 4
#> SD:hclust 70  1.04e-06 5
#> SD:hclust 43  4.30e-03 6

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


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

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.899           0.894       0.942         0.4661 0.516   0.516
#> 3 3 0.546           0.609       0.814         0.3007 0.896   0.805
#> 4 4 0.618           0.611       0.809         0.1707 0.786   0.557
#> 5 5 0.642           0.682       0.766         0.0827 0.823   0.496
#> 6 6 0.705           0.644       0.767         0.0550 0.930   0.704

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
#> GSM1124891     1  0.1843      0.911 0.972 0.028
#> GSM1124888     1  0.1843      0.911 0.972 0.028
#> GSM1124890     1  0.9909      0.336 0.556 0.444
#> GSM1124904     2  0.0000      0.968 0.000 1.000
#> GSM1124927     2  0.4022      0.895 0.080 0.920
#> GSM1124953     2  0.1843      0.952 0.028 0.972
#> GSM1124869     1  0.3114      0.917 0.944 0.056
#> GSM1124870     1  0.3733      0.907 0.928 0.072
#> GSM1124882     1  0.3114      0.917 0.944 0.056
#> GSM1124884     2  0.0938      0.967 0.012 0.988
#> GSM1124898     2  0.0000      0.968 0.000 1.000
#> GSM1124903     2  0.0376      0.967 0.004 0.996
#> GSM1124905     1  0.3114      0.917 0.944 0.056
#> GSM1124910     1  0.2043      0.912 0.968 0.032
#> GSM1124919     2  0.1633      0.955 0.024 0.976
#> GSM1124932     2  0.0938      0.967 0.012 0.988
#> GSM1124933     1  0.1843      0.911 0.972 0.028
#> GSM1124867     2  0.0938      0.967 0.012 0.988
#> GSM1124868     2  0.1843      0.955 0.028 0.972
#> GSM1124878     2  0.1843      0.955 0.028 0.972
#> GSM1124895     2  0.1843      0.955 0.028 0.972
#> GSM1124897     2  0.1843      0.955 0.028 0.972
#> GSM1124902     2  0.1843      0.955 0.028 0.972
#> GSM1124908     2  0.2043      0.953 0.032 0.968
#> GSM1124921     2  0.2043      0.953 0.032 0.968
#> GSM1124939     2  0.1843      0.955 0.028 0.972
#> GSM1124944     2  0.2043      0.953 0.032 0.968
#> GSM1124945     1  0.9795      0.334 0.584 0.416
#> GSM1124946     2  0.2043      0.953 0.032 0.968
#> GSM1124947     2  0.1843      0.955 0.028 0.972
#> GSM1124951     1  0.9795      0.334 0.584 0.416
#> GSM1124952     2  0.1843      0.955 0.028 0.972
#> GSM1124957     1  0.0938      0.887 0.988 0.012
#> GSM1124900     1  0.3733      0.907 0.928 0.072
#> GSM1124914     2  0.0000      0.968 0.000 1.000
#> GSM1124871     2  0.0000      0.968 0.000 1.000
#> GSM1124874     2  0.0938      0.967 0.012 0.988
#> GSM1124875     2  0.0000      0.968 0.000 1.000
#> GSM1124880     1  0.3114      0.917 0.944 0.056
#> GSM1124881     2  0.0938      0.967 0.012 0.988
#> GSM1124885     2  0.0000      0.968 0.000 1.000
#> GSM1124886     1  0.2043      0.912 0.968 0.032
#> GSM1124887     2  0.0376      0.967 0.004 0.996
#> GSM1124894     2  0.8955      0.486 0.312 0.688
#> GSM1124896     1  0.3114      0.917 0.944 0.056
#> GSM1124899     2  0.0938      0.967 0.012 0.988
#> GSM1124901     2  0.0000      0.968 0.000 1.000
#> GSM1124906     2  0.0938      0.967 0.012 0.988
#> GSM1124907     2  0.0376      0.967 0.004 0.996
#> GSM1124911     2  0.0938      0.967 0.012 0.988
#> GSM1124912     1  0.3114      0.917 0.944 0.056
#> GSM1124915     2  0.0000      0.968 0.000 1.000
#> GSM1124917     2  0.0000      0.968 0.000 1.000
#> GSM1124918     2  0.0672      0.967 0.008 0.992
#> GSM1124920     1  0.1843      0.911 0.972 0.028
#> GSM1124922     2  0.0938      0.967 0.012 0.988
#> GSM1124924     1  0.5519      0.849 0.872 0.128
#> GSM1124926     2  0.0938      0.967 0.012 0.988
#> GSM1124928     1  0.3114      0.917 0.944 0.056
#> GSM1124930     2  0.1414      0.958 0.020 0.980
#> GSM1124931     2  0.1184      0.964 0.016 0.984
#> GSM1124935     2  0.0000      0.968 0.000 1.000
#> GSM1124936     1  0.1843      0.911 0.972 0.028
#> GSM1124938     1  0.9866      0.352 0.568 0.432
#> GSM1124940     1  0.3114      0.917 0.944 0.056
#> GSM1124941     2  0.0938      0.967 0.012 0.988
#> GSM1124942     2  0.0376      0.967 0.004 0.996
#> GSM1124943     2  0.9795      0.149 0.416 0.584
#> GSM1124948     1  0.9909      0.319 0.556 0.444
#> GSM1124949     1  0.3114      0.917 0.944 0.056
#> GSM1124950     2  0.0938      0.967 0.012 0.988
#> GSM1124954     1  0.1843      0.911 0.972 0.028
#> GSM1124955     1  0.3114      0.917 0.944 0.056
#> GSM1124956     2  0.0938      0.967 0.012 0.988
#> GSM1124872     2  0.0938      0.967 0.012 0.988
#> GSM1124873     2  0.0938      0.967 0.012 0.988
#> GSM1124876     1  0.1843      0.911 0.972 0.028
#> GSM1124877     1  0.3114      0.917 0.944 0.056
#> GSM1124879     1  0.3114      0.917 0.944 0.056
#> GSM1124883     2  0.0000      0.968 0.000 1.000
#> GSM1124889     2  0.0938      0.967 0.012 0.988
#> GSM1124892     1  0.2043      0.912 0.968 0.032
#> GSM1124893     1  0.3114      0.917 0.944 0.056
#> GSM1124909     2  0.0938      0.967 0.012 0.988
#> GSM1124913     2  0.0000      0.968 0.000 1.000
#> GSM1124916     2  0.0938      0.967 0.012 0.988
#> GSM1124923     2  0.1843      0.952 0.028 0.972
#> GSM1124925     1  0.3274      0.915 0.940 0.060
#> GSM1124929     1  0.3114      0.917 0.944 0.056
#> GSM1124934     1  0.2043      0.912 0.968 0.032
#> GSM1124937     1  0.6973      0.800 0.812 0.188

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     1  0.6309    -0.0598 0.500 0.000 0.500
#> GSM1124888     3  0.6309    -0.0782 0.500 0.000 0.500
#> GSM1124890     3  0.8676     0.5546 0.112 0.368 0.520
#> GSM1124904     2  0.4121     0.7257 0.000 0.832 0.168
#> GSM1124927     2  0.3454     0.6912 0.104 0.888 0.008
#> GSM1124953     3  0.6275     0.4653 0.008 0.348 0.644
#> GSM1124869     1  0.0237     0.8034 0.996 0.004 0.000
#> GSM1124870     1  0.4861     0.6045 0.800 0.192 0.008
#> GSM1124882     1  0.0237     0.8034 0.996 0.004 0.000
#> GSM1124884     2  0.0592     0.7788 0.012 0.988 0.000
#> GSM1124898     2  0.1163     0.7746 0.000 0.972 0.028
#> GSM1124903     2  0.4178     0.7235 0.000 0.828 0.172
#> GSM1124905     1  0.1399     0.7943 0.968 0.028 0.004
#> GSM1124910     1  0.0829     0.7984 0.984 0.004 0.012
#> GSM1124919     2  0.6148     0.3341 0.004 0.640 0.356
#> GSM1124932     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124933     3  0.6309    -0.0656 0.496 0.000 0.504
#> GSM1124867     2  0.1399     0.7743 0.028 0.968 0.004
#> GSM1124868     2  0.5948     0.5784 0.000 0.640 0.360
#> GSM1124878     2  0.5859     0.5933 0.000 0.656 0.344
#> GSM1124895     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124897     2  0.5882     0.5905 0.000 0.652 0.348
#> GSM1124902     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124908     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124921     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124939     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124944     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124945     3  0.3112     0.4869 0.096 0.004 0.900
#> GSM1124946     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124947     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124951     3  0.2772     0.4871 0.080 0.004 0.916
#> GSM1124952     2  0.6309     0.4410 0.000 0.504 0.496
#> GSM1124957     3  0.4235     0.4417 0.176 0.000 0.824
#> GSM1124900     1  0.4912     0.5982 0.796 0.196 0.008
#> GSM1124914     2  0.2878     0.7565 0.000 0.904 0.096
#> GSM1124871     2  0.0237     0.7785 0.004 0.996 0.000
#> GSM1124874     2  0.1031     0.7772 0.024 0.976 0.000
#> GSM1124875     2  0.1031     0.7761 0.000 0.976 0.024
#> GSM1124880     1  0.4531     0.6353 0.824 0.168 0.008
#> GSM1124881     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124885     2  0.3816     0.7359 0.000 0.852 0.148
#> GSM1124886     1  0.0661     0.7987 0.988 0.004 0.008
#> GSM1124887     2  0.4235     0.7219 0.000 0.824 0.176
#> GSM1124894     2  0.8264     0.2325 0.356 0.556 0.088
#> GSM1124896     1  0.1411     0.7894 0.964 0.036 0.000
#> GSM1124899     2  0.1031     0.7772 0.024 0.976 0.000
#> GSM1124901     2  0.1289     0.7745 0.000 0.968 0.032
#> GSM1124906     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124907     2  0.3038     0.7545 0.000 0.896 0.104
#> GSM1124911     2  0.1031     0.7772 0.024 0.976 0.000
#> GSM1124912     1  0.0237     0.8034 0.996 0.004 0.000
#> GSM1124915     2  0.1289     0.7749 0.000 0.968 0.032
#> GSM1124917     2  0.0475     0.7781 0.004 0.992 0.004
#> GSM1124918     2  0.0829     0.7782 0.012 0.984 0.004
#> GSM1124920     1  0.6192     0.1787 0.580 0.000 0.420
#> GSM1124922     2  0.1031     0.7772 0.024 0.976 0.000
#> GSM1124924     3  0.9914     0.4073 0.272 0.348 0.380
#> GSM1124926     2  0.1267     0.7778 0.024 0.972 0.004
#> GSM1124928     1  0.1129     0.7983 0.976 0.020 0.004
#> GSM1124930     2  0.4002     0.6996 0.000 0.840 0.160
#> GSM1124931     2  0.1453     0.7742 0.024 0.968 0.008
#> GSM1124935     2  0.0000     0.7781 0.000 1.000 0.000
#> GSM1124936     1  0.6168     0.1928 0.588 0.000 0.412
#> GSM1124938     3  0.8474     0.5179 0.092 0.404 0.504
#> GSM1124940     1  0.0237     0.8034 0.996 0.004 0.000
#> GSM1124941     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124942     2  0.3038     0.7520 0.000 0.896 0.104
#> GSM1124943     3  0.8157     0.4885 0.072 0.412 0.516
#> GSM1124948     2  0.8363    -0.3697 0.084 0.504 0.412
#> GSM1124949     1  0.0237     0.8034 0.996 0.004 0.000
#> GSM1124950     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124954     1  0.6235     0.1403 0.564 0.000 0.436
#> GSM1124955     1  0.1411     0.7894 0.964 0.036 0.000
#> GSM1124956     2  0.1031     0.7772 0.024 0.976 0.000
#> GSM1124872     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124873     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124876     1  0.6309    -0.0598 0.500 0.000 0.500
#> GSM1124877     1  0.0237     0.8034 0.996 0.004 0.000
#> GSM1124879     1  0.0592     0.8014 0.988 0.012 0.000
#> GSM1124883     2  0.4002     0.7301 0.000 0.840 0.160
#> GSM1124889     2  0.0892     0.7781 0.020 0.980 0.000
#> GSM1124892     1  0.0592     0.7920 0.988 0.000 0.012
#> GSM1124893     1  0.0237     0.8034 0.996 0.004 0.000
#> GSM1124909     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124913     2  0.4121     0.7257 0.000 0.832 0.168
#> GSM1124916     2  0.1267     0.7762 0.024 0.972 0.004
#> GSM1124923     2  0.6518     0.0737 0.004 0.512 0.484
#> GSM1124925     1  0.1529     0.7859 0.960 0.040 0.000
#> GSM1124929     1  0.0237     0.8034 0.996 0.004 0.000
#> GSM1124934     1  0.5070     0.5800 0.772 0.004 0.224
#> GSM1124937     1  0.5591     0.3324 0.696 0.304 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.3975     0.6148 0.240 0.000 0.760 0.000
#> GSM1124888     3  0.3942     0.6173 0.236 0.000 0.764 0.000
#> GSM1124890     3  0.3847     0.5849 0.020 0.108 0.852 0.020
#> GSM1124904     2  0.7469     0.0359 0.000 0.432 0.176 0.392
#> GSM1124927     2  0.2363     0.7298 0.024 0.920 0.056 0.000
#> GSM1124953     3  0.2032     0.5961 0.000 0.036 0.936 0.028
#> GSM1124869     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124870     1  0.6206     0.3313 0.540 0.404 0.056 0.000
#> GSM1124882     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124884     2  0.0336     0.7504 0.000 0.992 0.000 0.008
#> GSM1124898     2  0.5690     0.5933 0.000 0.716 0.168 0.116
#> GSM1124903     2  0.7416     0.0571 0.000 0.440 0.168 0.392
#> GSM1124905     1  0.2744     0.8138 0.912 0.052 0.024 0.012
#> GSM1124910     1  0.0000     0.8687 1.000 0.000 0.000 0.000
#> GSM1124919     3  0.6928    -0.1043 0.000 0.372 0.512 0.116
#> GSM1124932     2  0.1389     0.7450 0.000 0.952 0.048 0.000
#> GSM1124933     3  0.3626     0.6349 0.184 0.000 0.812 0.004
#> GSM1124867     2  0.2021     0.7402 0.000 0.932 0.056 0.012
#> GSM1124868     4  0.5681     0.6204 0.000 0.208 0.088 0.704
#> GSM1124878     4  0.7321     0.2587 0.000 0.328 0.172 0.500
#> GSM1124895     4  0.1211     0.8388 0.000 0.040 0.000 0.960
#> GSM1124897     4  0.7321     0.2587 0.000 0.328 0.172 0.500
#> GSM1124902     4  0.1211     0.8388 0.000 0.040 0.000 0.960
#> GSM1124908     4  0.1118     0.8376 0.000 0.036 0.000 0.964
#> GSM1124921     4  0.0817     0.8335 0.000 0.024 0.000 0.976
#> GSM1124939     4  0.1211     0.8388 0.000 0.040 0.000 0.960
#> GSM1124944     4  0.0817     0.8335 0.000 0.024 0.000 0.976
#> GSM1124945     3  0.4391     0.5438 0.008 0.000 0.740 0.252
#> GSM1124946     4  0.0817     0.8335 0.000 0.024 0.000 0.976
#> GSM1124947     4  0.0817     0.8335 0.000 0.024 0.000 0.976
#> GSM1124951     3  0.4155     0.5499 0.004 0.000 0.756 0.240
#> GSM1124952     4  0.1211     0.8388 0.000 0.040 0.000 0.960
#> GSM1124957     3  0.4361     0.5736 0.020 0.000 0.772 0.208
#> GSM1124900     1  0.6206     0.3313 0.540 0.404 0.056 0.000
#> GSM1124914     2  0.7015     0.3725 0.000 0.568 0.168 0.264
#> GSM1124871     2  0.0804     0.7490 0.000 0.980 0.008 0.012
#> GSM1124874     2  0.0927     0.7482 0.000 0.976 0.016 0.008
#> GSM1124875     2  0.4418     0.6794 0.000 0.784 0.184 0.032
#> GSM1124880     2  0.6395    -0.1813 0.460 0.476 0.064 0.000
#> GSM1124881     2  0.1398     0.7476 0.000 0.956 0.040 0.004
#> GSM1124885     2  0.7412     0.0698 0.000 0.444 0.168 0.388
#> GSM1124886     1  0.0000     0.8687 1.000 0.000 0.000 0.000
#> GSM1124887     2  0.7472     0.0402 0.000 0.428 0.176 0.396
#> GSM1124894     2  0.9042     0.1236 0.248 0.456 0.100 0.196
#> GSM1124896     1  0.0524     0.8687 0.988 0.008 0.000 0.004
#> GSM1124899     2  0.0000     0.7517 0.000 1.000 0.000 0.000
#> GSM1124901     2  0.5842     0.5800 0.000 0.704 0.168 0.128
#> GSM1124906     2  0.0188     0.7519 0.000 0.996 0.004 0.000
#> GSM1124907     2  0.6967     0.4374 0.000 0.580 0.176 0.244
#> GSM1124911     2  0.0336     0.7504 0.000 0.992 0.000 0.008
#> GSM1124912     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124915     2  0.5742     0.5892 0.000 0.712 0.168 0.120
#> GSM1124917     2  0.4095     0.6891 0.000 0.792 0.192 0.016
#> GSM1124918     2  0.2060     0.7463 0.000 0.932 0.052 0.016
#> GSM1124920     3  0.4996     0.2548 0.484 0.000 0.516 0.000
#> GSM1124922     2  0.0000     0.7517 0.000 1.000 0.000 0.000
#> GSM1124924     2  0.6211     0.4414 0.072 0.676 0.236 0.016
#> GSM1124926     2  0.0524     0.7503 0.000 0.988 0.004 0.008
#> GSM1124928     1  0.2399     0.8147 0.920 0.048 0.032 0.000
#> GSM1124930     2  0.6790     0.5126 0.000 0.576 0.296 0.128
#> GSM1124931     2  0.1557     0.7435 0.000 0.944 0.056 0.000
#> GSM1124935     2  0.4010     0.6777 0.000 0.816 0.156 0.028
#> GSM1124936     3  0.4996     0.2626 0.484 0.000 0.516 0.000
#> GSM1124938     3  0.5437     0.5060 0.024 0.244 0.712 0.020
#> GSM1124940     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124941     2  0.0188     0.7519 0.000 0.996 0.004 0.000
#> GSM1124942     2  0.5757     0.6172 0.000 0.684 0.240 0.076
#> GSM1124943     3  0.4709     0.5028 0.008 0.200 0.768 0.024
#> GSM1124948     2  0.5066     0.5251 0.016 0.740 0.224 0.020
#> GSM1124949     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124950     2  0.1557     0.7435 0.000 0.944 0.056 0.000
#> GSM1124954     3  0.5387     0.3991 0.400 0.000 0.584 0.016
#> GSM1124955     1  0.0336     0.8700 0.992 0.008 0.000 0.000
#> GSM1124956     2  0.0336     0.7504 0.000 0.992 0.000 0.008
#> GSM1124872     2  0.1557     0.7435 0.000 0.944 0.056 0.000
#> GSM1124873     2  0.1389     0.7458 0.000 0.952 0.048 0.000
#> GSM1124876     3  0.4088     0.6177 0.232 0.000 0.764 0.004
#> GSM1124877     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124879     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124883     2  0.7416     0.0571 0.000 0.440 0.168 0.392
#> GSM1124889     2  0.0336     0.7504 0.000 0.992 0.000 0.008
#> GSM1124892     1  0.0000     0.8687 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124909     2  0.1854     0.7431 0.000 0.940 0.048 0.012
#> GSM1124913     2  0.7416     0.0571 0.000 0.440 0.168 0.392
#> GSM1124916     2  0.1854     0.7431 0.000 0.940 0.048 0.012
#> GSM1124923     3  0.6397     0.2895 0.000 0.208 0.648 0.144
#> GSM1124925     1  0.0336     0.8700 0.992 0.008 0.000 0.000
#> GSM1124929     1  0.0188     0.8720 0.996 0.004 0.000 0.000
#> GSM1124934     1  0.5157     0.3714 0.676 0.004 0.304 0.016
#> GSM1124937     1  0.5937     0.3887 0.608 0.340 0.052 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
#> GSM1124891     3  0.1981     0.7497 0.064 0.000 0.920 0.000 0.016
#> GSM1124888     3  0.1981     0.7510 0.064 0.000 0.920 0.000 0.016
#> GSM1124890     3  0.4900     0.4086 0.000 0.024 0.512 0.000 0.464
#> GSM1124904     5  0.5638     0.7000 0.000 0.152 0.000 0.216 0.632
#> GSM1124927     2  0.1444     0.7111 0.000 0.948 0.040 0.000 0.012
#> GSM1124953     3  0.4511     0.5639 0.000 0.016 0.628 0.000 0.356
#> GSM1124869     1  0.0162     0.9323 0.996 0.004 0.000 0.000 0.000
#> GSM1124870     2  0.5019     0.4591 0.280 0.668 0.040 0.000 0.012
#> GSM1124882     1  0.0162     0.9323 0.996 0.004 0.000 0.000 0.000
#> GSM1124884     2  0.3697     0.6688 0.000 0.796 0.008 0.016 0.180
#> GSM1124898     5  0.4570     0.6173 0.000 0.348 0.000 0.020 0.632
#> GSM1124903     5  0.5707     0.7003 0.000 0.160 0.000 0.216 0.624
#> GSM1124905     1  0.7066     0.4803 0.572 0.224 0.100 0.004 0.100
#> GSM1124910     1  0.2507     0.8602 0.908 0.020 0.044 0.000 0.028
#> GSM1124919     5  0.4490     0.4758 0.000 0.072 0.168 0.004 0.756
#> GSM1124932     2  0.1243     0.7261 0.000 0.960 0.008 0.004 0.028
#> GSM1124933     3  0.2124     0.7451 0.028 0.000 0.916 0.000 0.056
#> GSM1124867     2  0.2054     0.7032 0.000 0.920 0.028 0.000 0.052
#> GSM1124868     4  0.5928    -0.0363 0.000 0.124 0.000 0.548 0.328
#> GSM1124878     5  0.5887     0.6620 0.000 0.156 0.000 0.252 0.592
#> GSM1124895     4  0.0162     0.9288 0.000 0.004 0.000 0.996 0.000
#> GSM1124897     5  0.5854     0.6615 0.000 0.152 0.000 0.252 0.596
#> GSM1124902     4  0.0162     0.9288 0.000 0.004 0.000 0.996 0.000
#> GSM1124908     4  0.0613     0.9256 0.000 0.004 0.004 0.984 0.008
#> GSM1124921     4  0.0727     0.9251 0.000 0.004 0.004 0.980 0.012
#> GSM1124939     4  0.0162     0.9288 0.000 0.004 0.000 0.996 0.000
#> GSM1124944     4  0.0324     0.9275 0.000 0.004 0.000 0.992 0.004
#> GSM1124945     3  0.3697     0.7011 0.000 0.000 0.820 0.100 0.080
#> GSM1124946     4  0.0727     0.9251 0.000 0.004 0.004 0.980 0.012
#> GSM1124947     4  0.0324     0.9275 0.000 0.004 0.000 0.992 0.004
#> GSM1124951     3  0.3622     0.7135 0.000 0.000 0.820 0.056 0.124
#> GSM1124952     4  0.0162     0.9288 0.000 0.004 0.000 0.996 0.000
#> GSM1124957     3  0.2592     0.7259 0.000 0.000 0.892 0.052 0.056
#> GSM1124900     2  0.5019     0.4591 0.280 0.668 0.040 0.000 0.012
#> GSM1124914     5  0.5541     0.7039 0.000 0.236 0.000 0.128 0.636
#> GSM1124871     2  0.3718     0.6517 0.000 0.784 0.004 0.016 0.196
#> GSM1124874     2  0.3421     0.6884 0.000 0.824 0.008 0.016 0.152
#> GSM1124875     5  0.3949     0.5613 0.000 0.300 0.004 0.000 0.696
#> GSM1124880     2  0.5591     0.5619 0.140 0.712 0.088 0.000 0.060
#> GSM1124881     2  0.2583     0.7115 0.000 0.864 0.000 0.004 0.132
#> GSM1124885     5  0.5740     0.7025 0.000 0.164 0.000 0.216 0.620
#> GSM1124886     1  0.0162     0.9291 0.996 0.000 0.000 0.000 0.004
#> GSM1124887     5  0.4901     0.7025 0.000 0.116 0.000 0.168 0.716
#> GSM1124894     2  0.7280     0.4233 0.044 0.600 0.184 0.064 0.108
#> GSM1124896     1  0.0960     0.9221 0.972 0.004 0.008 0.000 0.016
#> GSM1124899     2  0.3544     0.6485 0.000 0.788 0.004 0.008 0.200
#> GSM1124901     5  0.4819     0.6113 0.000 0.352 0.004 0.024 0.620
#> GSM1124906     2  0.3053     0.6882 0.000 0.828 0.008 0.000 0.164
#> GSM1124907     5  0.3731     0.6799 0.000 0.160 0.000 0.040 0.800
#> GSM1124911     2  0.3538     0.6728 0.000 0.804 0.004 0.016 0.176
#> GSM1124912     1  0.0162     0.9323 0.996 0.004 0.000 0.000 0.000
#> GSM1124915     5  0.4696     0.6018 0.000 0.360 0.000 0.024 0.616
#> GSM1124917     5  0.4138     0.4562 0.000 0.384 0.000 0.000 0.616
#> GSM1124918     2  0.4268     0.5063 0.000 0.648 0.008 0.000 0.344
#> GSM1124920     3  0.4575     0.5289 0.328 0.000 0.648 0.000 0.024
#> GSM1124922     2  0.3585     0.6213 0.000 0.772 0.004 0.004 0.220
#> GSM1124924     2  0.5578     0.5343 0.020 0.680 0.108 0.000 0.192
#> GSM1124926     2  0.3718     0.6498 0.000 0.784 0.004 0.016 0.196
#> GSM1124928     1  0.5835     0.5100 0.624 0.276 0.072 0.000 0.028
#> GSM1124930     5  0.4150     0.6178 0.000 0.180 0.044 0.004 0.772
#> GSM1124931     2  0.1569     0.7150 0.000 0.944 0.044 0.004 0.008
#> GSM1124935     5  0.4604     0.4825 0.000 0.428 0.000 0.012 0.560
#> GSM1124936     3  0.4639     0.4769 0.368 0.000 0.612 0.000 0.020
#> GSM1124938     3  0.6318     0.3329 0.000 0.168 0.488 0.000 0.344
#> GSM1124940     1  0.0162     0.9323 0.996 0.004 0.000 0.000 0.000
#> GSM1124941     2  0.3053     0.6882 0.000 0.828 0.008 0.000 0.164
#> GSM1124942     5  0.4240     0.6145 0.000 0.240 0.024 0.004 0.732
#> GSM1124943     5  0.5389    -0.1968 0.000 0.056 0.436 0.000 0.508
#> GSM1124948     2  0.4960     0.5392 0.000 0.688 0.080 0.000 0.232
#> GSM1124949     1  0.0162     0.9323 0.996 0.004 0.000 0.000 0.000
#> GSM1124950     2  0.1522     0.7142 0.000 0.944 0.044 0.000 0.012
#> GSM1124954     3  0.4747     0.6609 0.184 0.000 0.732 0.004 0.080
#> GSM1124955     1  0.0566     0.9298 0.984 0.004 0.000 0.000 0.012
#> GSM1124956     2  0.3538     0.6728 0.000 0.804 0.004 0.016 0.176
#> GSM1124872     2  0.1331     0.7151 0.000 0.952 0.040 0.000 0.008
#> GSM1124873     2  0.1952     0.7206 0.000 0.912 0.000 0.004 0.084
#> GSM1124876     3  0.2588     0.7495 0.060 0.000 0.892 0.000 0.048
#> GSM1124877     1  0.0451     0.9309 0.988 0.004 0.000 0.000 0.008
#> GSM1124879     1  0.0566     0.9298 0.984 0.004 0.000 0.000 0.012
#> GSM1124883     5  0.5707     0.7003 0.000 0.160 0.000 0.216 0.624
#> GSM1124889     2  0.3575     0.6692 0.000 0.800 0.004 0.016 0.180
#> GSM1124892     1  0.0290     0.9273 0.992 0.000 0.000 0.000 0.008
#> GSM1124893     1  0.0162     0.9323 0.996 0.004 0.000 0.000 0.000
#> GSM1124909     2  0.1952     0.7166 0.000 0.912 0.004 0.000 0.084
#> GSM1124913     5  0.5707     0.7003 0.000 0.160 0.000 0.216 0.624
#> GSM1124916     2  0.1952     0.7166 0.000 0.912 0.004 0.000 0.084
#> GSM1124923     5  0.4256     0.4254 0.000 0.044 0.192 0.004 0.760
#> GSM1124925     1  0.0566     0.9298 0.984 0.004 0.000 0.000 0.012
#> GSM1124929     1  0.0162     0.9323 0.996 0.004 0.000 0.000 0.000
#> GSM1124934     3  0.6671     0.4241 0.304 0.036 0.548 0.004 0.108
#> GSM1124937     2  0.6602     0.2176 0.324 0.540 0.060 0.000 0.076

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.3465    0.70337 0.024 0.000 0.804 0.000 0.156 0.016
#> GSM1124888     3  0.3313    0.70744 0.024 0.000 0.820 0.000 0.140 0.016
#> GSM1124890     5  0.6063    0.29861 0.000 0.012 0.316 0.000 0.480 0.192
#> GSM1124904     6  0.3013    0.77979 0.000 0.024 0.004 0.116 0.008 0.848
#> GSM1124927     2  0.2738    0.64782 0.000 0.820 0.000 0.000 0.176 0.004
#> GSM1124953     3  0.5532   -0.00867 0.000 0.012 0.520 0.000 0.368 0.100
#> GSM1124869     1  0.0000    0.93480 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.3771    0.60356 0.056 0.764 0.000 0.000 0.180 0.000
#> GSM1124882     1  0.0000    0.93480 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.3309    0.70136 0.000 0.788 0.004 0.000 0.016 0.192
#> GSM1124898     6  0.2613    0.69893 0.000 0.140 0.000 0.000 0.012 0.848
#> GSM1124903     6  0.2902    0.78121 0.000 0.024 0.004 0.116 0.004 0.852
#> GSM1124905     5  0.6643   -0.27104 0.384 0.160 0.012 0.004 0.416 0.024
#> GSM1124910     1  0.2730    0.74108 0.808 0.000 0.000 0.000 0.192 0.000
#> GSM1124919     5  0.6038    0.38691 0.000 0.020 0.140 0.000 0.432 0.408
#> GSM1124932     2  0.1720    0.71588 0.000 0.928 0.000 0.000 0.032 0.040
#> GSM1124933     3  0.0964    0.70100 0.000 0.004 0.968 0.000 0.016 0.012
#> GSM1124867     2  0.2703    0.64934 0.000 0.824 0.000 0.000 0.172 0.004
#> GSM1124868     6  0.4477    0.43227 0.000 0.020 0.004 0.384 0.004 0.588
#> GSM1124878     6  0.3310    0.77284 0.000 0.024 0.008 0.124 0.012 0.832
#> GSM1124895     4  0.0146    0.99283 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124897     6  0.3747    0.76328 0.000 0.024 0.004 0.124 0.040 0.808
#> GSM1124902     4  0.0146    0.99283 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124908     4  0.0665    0.98561 0.000 0.000 0.008 0.980 0.004 0.008
#> GSM1124921     4  0.0665    0.98561 0.000 0.000 0.008 0.980 0.004 0.008
#> GSM1124939     4  0.0146    0.99283 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124944     4  0.0146    0.99283 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124945     3  0.3411    0.63393 0.000 0.000 0.836 0.044 0.088 0.032
#> GSM1124946     4  0.0665    0.98561 0.000 0.000 0.008 0.980 0.004 0.008
#> GSM1124947     4  0.0146    0.99283 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124951     3  0.3098    0.62341 0.000 0.000 0.844 0.004 0.088 0.064
#> GSM1124952     4  0.0146    0.99283 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124957     3  0.0767    0.70081 0.000 0.000 0.976 0.008 0.004 0.012
#> GSM1124900     2  0.3771    0.60356 0.056 0.764 0.000 0.000 0.180 0.000
#> GSM1124914     6  0.2926    0.72212 0.000 0.124 0.000 0.028 0.004 0.844
#> GSM1124871     2  0.3341    0.69278 0.000 0.776 0.004 0.000 0.012 0.208
#> GSM1124874     2  0.3453    0.71124 0.000 0.788 0.004 0.000 0.028 0.180
#> GSM1124875     5  0.5943    0.26240 0.000 0.216 0.000 0.000 0.404 0.380
#> GSM1124880     2  0.3876    0.53618 0.024 0.700 0.000 0.000 0.276 0.000
#> GSM1124881     2  0.2306    0.71516 0.000 0.888 0.004 0.000 0.016 0.092
#> GSM1124885     6  0.2871    0.77999 0.000 0.024 0.000 0.116 0.008 0.852
#> GSM1124886     1  0.0405    0.92964 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM1124887     6  0.3303    0.67447 0.000 0.020 0.004 0.040 0.092 0.844
#> GSM1124894     2  0.6277    0.27807 0.008 0.472 0.064 0.024 0.404 0.028
#> GSM1124896     1  0.0862    0.92473 0.972 0.000 0.000 0.004 0.016 0.008
#> GSM1124899     2  0.3622    0.68152 0.000 0.760 0.004 0.000 0.024 0.212
#> GSM1124901     6  0.3452    0.65454 0.000 0.176 0.000 0.008 0.024 0.792
#> GSM1124906     2  0.3176    0.71058 0.000 0.812 0.000 0.000 0.032 0.156
#> GSM1124907     6  0.4803   -0.21288 0.000 0.044 0.004 0.000 0.424 0.528
#> GSM1124911     2  0.3309    0.70226 0.000 0.788 0.004 0.000 0.016 0.192
#> GSM1124912     1  0.0000    0.93480 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.2573    0.71781 0.000 0.132 0.000 0.008 0.004 0.856
#> GSM1124917     2  0.6069   -0.36838 0.000 0.368 0.000 0.000 0.368 0.264
#> GSM1124918     2  0.5353   -0.12399 0.000 0.472 0.000 0.000 0.420 0.108
#> GSM1124920     3  0.5754    0.59393 0.240 0.000 0.572 0.000 0.172 0.016
#> GSM1124922     2  0.3852    0.66524 0.000 0.740 0.004 0.000 0.032 0.224
#> GSM1124924     5  0.4111   -0.13962 0.000 0.456 0.004 0.000 0.536 0.004
#> GSM1124926     2  0.3213    0.69707 0.000 0.784 0.004 0.000 0.008 0.204
#> GSM1124928     1  0.6009    0.16382 0.432 0.268 0.000 0.000 0.300 0.000
#> GSM1124930     5  0.5710    0.38785 0.000 0.120 0.012 0.000 0.496 0.372
#> GSM1124931     2  0.2830    0.68221 0.000 0.836 0.000 0.000 0.144 0.020
#> GSM1124935     6  0.3898    0.41568 0.000 0.336 0.000 0.000 0.012 0.652
#> GSM1124936     3  0.5335    0.50181 0.336 0.000 0.568 0.000 0.080 0.016
#> GSM1124938     5  0.6408    0.38553 0.000 0.136 0.216 0.000 0.556 0.092
#> GSM1124940     1  0.0000    0.93480 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.3176    0.71058 0.000 0.812 0.000 0.000 0.032 0.156
#> GSM1124942     5  0.6201    0.38643 0.000 0.132 0.036 0.000 0.464 0.368
#> GSM1124943     5  0.6443    0.45427 0.000 0.048 0.212 0.000 0.512 0.228
#> GSM1124948     5  0.4318    0.26154 0.000 0.340 0.008 0.000 0.632 0.020
#> GSM1124949     1  0.0000    0.93480 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.2260    0.66795 0.000 0.860 0.000 0.000 0.140 0.000
#> GSM1124954     3  0.5574    0.62683 0.096 0.000 0.584 0.000 0.292 0.028
#> GSM1124955     1  0.0551    0.93157 0.984 0.000 0.000 0.004 0.004 0.008
#> GSM1124956     2  0.3309    0.70226 0.000 0.788 0.004 0.000 0.016 0.192
#> GSM1124872     2  0.2178    0.66884 0.000 0.868 0.000 0.000 0.132 0.000
#> GSM1124873     2  0.1584    0.71946 0.000 0.928 0.000 0.000 0.008 0.064
#> GSM1124876     3  0.1257    0.71360 0.020 0.000 0.952 0.000 0.028 0.000
#> GSM1124877     1  0.0551    0.93157 0.984 0.000 0.000 0.004 0.004 0.008
#> GSM1124879     1  0.0405    0.93261 0.988 0.000 0.000 0.004 0.000 0.008
#> GSM1124883     6  0.2902    0.78121 0.000 0.024 0.004 0.116 0.004 0.852
#> GSM1124889     2  0.2902    0.70304 0.000 0.800 0.004 0.000 0.000 0.196
#> GSM1124892     1  0.0767    0.92170 0.976 0.000 0.004 0.000 0.008 0.012
#> GSM1124893     1  0.0000    0.93480 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.1838    0.69203 0.000 0.916 0.000 0.000 0.068 0.016
#> GSM1124913     6  0.2902    0.78121 0.000 0.024 0.004 0.116 0.004 0.852
#> GSM1124916     2  0.1779    0.69242 0.000 0.920 0.000 0.000 0.064 0.016
#> GSM1124923     5  0.6005    0.38671 0.000 0.012 0.160 0.000 0.428 0.400
#> GSM1124925     1  0.0551    0.93157 0.984 0.000 0.000 0.004 0.004 0.008
#> GSM1124929     1  0.0000    0.93480 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.6202    0.54763 0.124 0.000 0.480 0.004 0.360 0.032
#> GSM1124937     2  0.5911    0.25700 0.192 0.540 0.000 0.004 0.256 0.008

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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 tissue(p) k
#> SD:kmeans 84  9.23e-02 2
#> SD:kmeans 64  6.27e-02 3
#> SD:kmeans 69  7.43e-10 4
#> SD:kmeans 76  4.33e-06 5
#> SD:kmeans 71  2.65e-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.


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 48983 rows and 91 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 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-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.866           0.897       0.959         0.4905 0.512   0.512
#> 3 3 0.499           0.600       0.816         0.3207 0.780   0.598
#> 4 4 0.747           0.791       0.893         0.1607 0.839   0.584
#> 5 5 0.679           0.663       0.810         0.0593 0.910   0.666
#> 6 6 0.717           0.570       0.748         0.0418 0.893   0.545

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
#> GSM1124891     1  0.0000      0.953 1.000 0.000
#> GSM1124888     1  0.0000      0.953 1.000 0.000
#> GSM1124890     1  0.7376      0.743 0.792 0.208
#> GSM1124904     2  0.0000      0.956 0.000 1.000
#> GSM1124927     2  0.9988      0.118 0.480 0.520
#> GSM1124953     2  0.4298      0.870 0.088 0.912
#> GSM1124869     1  0.0000      0.953 1.000 0.000
#> GSM1124870     1  0.0000      0.953 1.000 0.000
#> GSM1124882     1  0.0000      0.953 1.000 0.000
#> GSM1124884     2  0.0000      0.956 0.000 1.000
#> GSM1124898     2  0.0000      0.956 0.000 1.000
#> GSM1124903     2  0.0000      0.956 0.000 1.000
#> GSM1124905     1  0.0000      0.953 1.000 0.000
#> GSM1124910     1  0.0000      0.953 1.000 0.000
#> GSM1124919     2  0.0000      0.956 0.000 1.000
#> GSM1124932     2  0.9000      0.540 0.316 0.684
#> GSM1124933     1  0.0000      0.953 1.000 0.000
#> GSM1124867     2  0.9491      0.369 0.368 0.632
#> GSM1124868     2  0.0000      0.956 0.000 1.000
#> GSM1124878     2  0.0000      0.956 0.000 1.000
#> GSM1124895     2  0.0000      0.956 0.000 1.000
#> GSM1124897     2  0.0000      0.956 0.000 1.000
#> GSM1124902     2  0.0000      0.956 0.000 1.000
#> GSM1124908     2  0.0000      0.956 0.000 1.000
#> GSM1124921     2  0.0000      0.956 0.000 1.000
#> GSM1124939     2  0.0000      0.956 0.000 1.000
#> GSM1124944     2  0.0000      0.956 0.000 1.000
#> GSM1124945     1  0.7219      0.754 0.800 0.200
#> GSM1124946     2  0.0000      0.956 0.000 1.000
#> GSM1124947     2  0.0000      0.956 0.000 1.000
#> GSM1124951     1  0.9460      0.455 0.636 0.364
#> GSM1124952     2  0.0000      0.956 0.000 1.000
#> GSM1124957     1  0.0000      0.953 1.000 0.000
#> GSM1124900     1  0.0000      0.953 1.000 0.000
#> GSM1124914     2  0.0000      0.956 0.000 1.000
#> GSM1124871     2  0.0000      0.956 0.000 1.000
#> GSM1124874     2  0.0000      0.956 0.000 1.000
#> GSM1124875     2  0.0000      0.956 0.000 1.000
#> GSM1124880     1  0.0000      0.953 1.000 0.000
#> GSM1124881     2  0.0000      0.956 0.000 1.000
#> GSM1124885     2  0.0000      0.956 0.000 1.000
#> GSM1124886     1  0.0000      0.953 1.000 0.000
#> GSM1124887     2  0.0000      0.956 0.000 1.000
#> GSM1124894     2  0.9988      0.118 0.480 0.520
#> GSM1124896     1  0.0000      0.953 1.000 0.000
#> GSM1124899     2  0.0000      0.956 0.000 1.000
#> GSM1124901     2  0.0000      0.956 0.000 1.000
#> GSM1124906     2  0.0000      0.956 0.000 1.000
#> GSM1124907     2  0.0000      0.956 0.000 1.000
#> GSM1124911     2  0.0000      0.956 0.000 1.000
#> GSM1124912     1  0.0000      0.953 1.000 0.000
#> GSM1124915     2  0.0000      0.956 0.000 1.000
#> GSM1124917     2  0.0000      0.956 0.000 1.000
#> GSM1124918     2  0.0000      0.956 0.000 1.000
#> GSM1124920     1  0.0000      0.953 1.000 0.000
#> GSM1124922     2  0.0000      0.956 0.000 1.000
#> GSM1124924     1  0.0000      0.953 1.000 0.000
#> GSM1124926     2  0.0000      0.956 0.000 1.000
#> GSM1124928     1  0.0000      0.953 1.000 0.000
#> GSM1124930     2  0.0000      0.956 0.000 1.000
#> GSM1124931     2  0.9608      0.394 0.384 0.616
#> GSM1124935     2  0.0000      0.956 0.000 1.000
#> GSM1124936     1  0.0000      0.953 1.000 0.000
#> GSM1124938     1  0.7299      0.749 0.796 0.204
#> GSM1124940     1  0.0000      0.953 1.000 0.000
#> GSM1124941     2  0.0000      0.956 0.000 1.000
#> GSM1124942     2  0.0000      0.956 0.000 1.000
#> GSM1124943     1  0.9732      0.355 0.596 0.404
#> GSM1124948     1  0.6801      0.778 0.820 0.180
#> GSM1124949     1  0.0000      0.953 1.000 0.000
#> GSM1124950     2  0.1633      0.935 0.024 0.976
#> GSM1124954     1  0.0000      0.953 1.000 0.000
#> GSM1124955     1  0.0000      0.953 1.000 0.000
#> GSM1124956     2  0.0000      0.956 0.000 1.000
#> GSM1124872     2  0.2603      0.917 0.044 0.956
#> GSM1124873     2  0.0000      0.956 0.000 1.000
#> GSM1124876     1  0.0000      0.953 1.000 0.000
#> GSM1124877     1  0.0000      0.953 1.000 0.000
#> GSM1124879     1  0.0000      0.953 1.000 0.000
#> GSM1124883     2  0.0000      0.956 0.000 1.000
#> GSM1124889     2  0.0000      0.956 0.000 1.000
#> GSM1124892     1  0.0000      0.953 1.000 0.000
#> GSM1124893     1  0.0000      0.953 1.000 0.000
#> GSM1124909     2  0.0938      0.946 0.012 0.988
#> GSM1124913     2  0.0000      0.956 0.000 1.000
#> GSM1124916     2  0.0000      0.956 0.000 1.000
#> GSM1124923     2  0.0000      0.956 0.000 1.000
#> GSM1124925     1  0.0000      0.953 1.000 0.000
#> GSM1124929     1  0.0000      0.953 1.000 0.000
#> GSM1124934     1  0.0000      0.953 1.000 0.000
#> GSM1124937     1  0.0000      0.953 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.6286     0.0523 0.464 0.000 0.536
#> GSM1124888     3  0.6286     0.0523 0.464 0.000 0.536
#> GSM1124890     3  0.3896     0.6202 0.008 0.128 0.864
#> GSM1124904     2  0.5706     0.6171 0.000 0.680 0.320
#> GSM1124927     1  0.5948     0.4656 0.640 0.360 0.000
#> GSM1124953     3  0.0747     0.6064 0.000 0.016 0.984
#> GSM1124869     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124870     1  0.3816     0.7603 0.852 0.148 0.000
#> GSM1124882     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124884     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124898     2  0.3482     0.7263 0.000 0.872 0.128
#> GSM1124903     2  0.5254     0.6665 0.000 0.736 0.264
#> GSM1124905     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124910     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124919     3  0.3482     0.6177 0.000 0.128 0.872
#> GSM1124932     2  0.2165     0.6930 0.064 0.936 0.000
#> GSM1124933     3  0.6286     0.0523 0.464 0.000 0.536
#> GSM1124867     2  0.9188     0.0244 0.380 0.468 0.152
#> GSM1124868     2  0.6140     0.5800 0.000 0.596 0.404
#> GSM1124878     2  0.6140     0.5800 0.000 0.596 0.404
#> GSM1124895     2  0.6286     0.5142 0.000 0.536 0.464
#> GSM1124897     2  0.6286     0.5142 0.000 0.536 0.464
#> GSM1124902     2  0.6286     0.5142 0.000 0.536 0.464
#> GSM1124908     2  0.6299     0.4956 0.000 0.524 0.476
#> GSM1124921     2  0.6309     0.4598 0.000 0.504 0.496
#> GSM1124939     2  0.6286     0.5142 0.000 0.536 0.464
#> GSM1124944     3  0.6307    -0.4700 0.000 0.488 0.512
#> GSM1124945     3  0.0000     0.6010 0.000 0.000 1.000
#> GSM1124946     2  0.6308     0.4675 0.000 0.508 0.492
#> GSM1124947     3  0.6309    -0.4912 0.000 0.500 0.500
#> GSM1124951     3  0.0000     0.6010 0.000 0.000 1.000
#> GSM1124952     2  0.6295     0.5021 0.000 0.528 0.472
#> GSM1124957     3  0.3482     0.5645 0.128 0.000 0.872
#> GSM1124900     1  0.3412     0.7851 0.876 0.124 0.000
#> GSM1124914     2  0.5178     0.6706 0.000 0.744 0.256
#> GSM1124871     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124874     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124875     2  0.5216     0.6624 0.000 0.740 0.260
#> GSM1124880     1  0.3340     0.7885 0.880 0.120 0.000
#> GSM1124881     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124885     2  0.5216     0.6691 0.000 0.740 0.260
#> GSM1124886     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124887     2  0.5988     0.5643 0.000 0.632 0.368
#> GSM1124894     1  0.5986     0.5361 0.736 0.240 0.024
#> GSM1124896     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124899     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124901     2  0.3267     0.7297 0.000 0.884 0.116
#> GSM1124906     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124907     3  0.6299    -0.2758 0.000 0.476 0.524
#> GSM1124911     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124912     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124915     2  0.3192     0.7307 0.000 0.888 0.112
#> GSM1124917     2  0.3267     0.7289 0.000 0.884 0.116
#> GSM1124918     2  0.4605     0.4910 0.000 0.796 0.204
#> GSM1124920     1  0.6204     0.2251 0.576 0.000 0.424
#> GSM1124922     2  0.1643     0.7370 0.000 0.956 0.044
#> GSM1124924     3  0.8824     0.1119 0.364 0.124 0.512
#> GSM1124926     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124928     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124930     3  0.3551     0.6171 0.000 0.132 0.868
#> GSM1124931     2  0.4291     0.5685 0.180 0.820 0.000
#> GSM1124935     2  0.3192     0.7307 0.000 0.888 0.112
#> GSM1124936     1  0.6008     0.3566 0.628 0.000 0.372
#> GSM1124938     3  0.5122     0.5890 0.012 0.200 0.788
#> GSM1124940     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124941     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124942     3  0.3619     0.6135 0.000 0.136 0.864
#> GSM1124943     3  0.3551     0.6171 0.000 0.132 0.868
#> GSM1124948     3  0.6753     0.4038 0.016 0.388 0.596
#> GSM1124949     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124950     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124954     1  0.6095     0.3092 0.608 0.000 0.392
#> GSM1124955     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124956     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124872     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124873     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124876     3  0.6286     0.0523 0.464 0.000 0.536
#> GSM1124877     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124879     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124883     2  0.5254     0.6665 0.000 0.736 0.264
#> GSM1124889     2  0.0000     0.7354 0.000 1.000 0.000
#> GSM1124892     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124893     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124909     2  0.5835     0.2949 0.340 0.660 0.000
#> GSM1124913     2  0.5254     0.6665 0.000 0.736 0.264
#> GSM1124916     2  0.2959     0.6481 0.100 0.900 0.000
#> GSM1124923     3  0.3482     0.6177 0.000 0.128 0.872
#> GSM1124925     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124929     1  0.0000     0.8782 1.000 0.000 0.000
#> GSM1124934     1  0.3816     0.7386 0.852 0.000 0.148
#> GSM1124937     1  0.3038     0.8036 0.896 0.104 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.3649     0.7506 0.204 0.000 0.796 0.000
#> GSM1124888     3  0.3649     0.7506 0.204 0.000 0.796 0.000
#> GSM1124890     3  0.0000     0.8411 0.000 0.000 1.000 0.000
#> GSM1124904     4  0.5035     0.7780 0.000 0.052 0.204 0.744
#> GSM1124927     2  0.1118     0.8605 0.036 0.964 0.000 0.000
#> GSM1124953     3  0.1118     0.8385 0.000 0.000 0.964 0.036
#> GSM1124869     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.3873     0.6935 0.772 0.228 0.000 0.000
#> GSM1124882     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0188     0.8868 0.000 0.996 0.004 0.000
#> GSM1124898     2  0.7062     0.4860 0.000 0.572 0.204 0.224
#> GSM1124903     4  0.5035     0.7780 0.000 0.052 0.204 0.744
#> GSM1124905     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124910     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124919     3  0.0000     0.8411 0.000 0.000 1.000 0.000
#> GSM1124932     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124933     3  0.3649     0.7506 0.204 0.000 0.796 0.000
#> GSM1124867     2  0.4890     0.6822 0.024 0.736 0.004 0.236
#> GSM1124868     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124878     4  0.0817     0.8481 0.000 0.024 0.000 0.976
#> GSM1124895     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124897     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124902     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124921     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124944     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124945     3  0.3649     0.7630 0.000 0.000 0.796 0.204
#> GSM1124946     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124951     3  0.3649     0.7630 0.000 0.000 0.796 0.204
#> GSM1124952     4  0.0000     0.8558 0.000 0.000 0.000 1.000
#> GSM1124957     3  0.3649     0.7630 0.000 0.000 0.796 0.204
#> GSM1124900     1  0.3764     0.7067 0.784 0.216 0.000 0.000
#> GSM1124914     4  0.5035     0.7780 0.000 0.052 0.204 0.744
#> GSM1124871     2  0.1118     0.8764 0.000 0.964 0.036 0.000
#> GSM1124874     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124875     2  0.6871     0.5540 0.000 0.592 0.240 0.168
#> GSM1124880     1  0.3688     0.7151 0.792 0.208 0.000 0.000
#> GSM1124881     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124885     4  0.5035     0.7780 0.000 0.052 0.204 0.744
#> GSM1124886     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124887     4  0.4610     0.7683 0.000 0.020 0.236 0.744
#> GSM1124894     4  0.5150     0.3402 0.396 0.008 0.000 0.596
#> GSM1124896     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124899     2  0.1388     0.8770 0.000 0.960 0.028 0.012
#> GSM1124901     2  0.6754     0.5691 0.000 0.612 0.204 0.184
#> GSM1124906     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124907     4  0.5355     0.6207 0.000 0.020 0.360 0.620
#> GSM1124911     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124912     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.5111     0.7329 0.000 0.740 0.204 0.056
#> GSM1124917     2  0.4040     0.7404 0.000 0.752 0.248 0.000
#> GSM1124918     2  0.3688     0.7691 0.000 0.792 0.208 0.000
#> GSM1124920     1  0.4972     0.0812 0.544 0.000 0.456 0.000
#> GSM1124922     2  0.5665     0.7122 0.000 0.716 0.176 0.108
#> GSM1124924     3  0.4939     0.7043 0.040 0.220 0.740 0.000
#> GSM1124926     2  0.2011     0.8433 0.000 0.920 0.000 0.080
#> GSM1124928     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124930     3  0.0000     0.8411 0.000 0.000 1.000 0.000
#> GSM1124931     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124935     2  0.4617     0.7520 0.000 0.764 0.204 0.032
#> GSM1124936     1  0.4877     0.2370 0.592 0.000 0.408 0.000
#> GSM1124938     3  0.0188     0.8413 0.000 0.004 0.996 0.000
#> GSM1124940     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124942     3  0.0336     0.8357 0.000 0.000 0.992 0.008
#> GSM1124943     3  0.0000     0.8411 0.000 0.000 1.000 0.000
#> GSM1124948     3  0.3569     0.7468 0.000 0.196 0.804 0.000
#> GSM1124949     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124954     1  0.4985     0.0353 0.532 0.000 0.468 0.000
#> GSM1124955     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124872     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124873     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124876     3  0.3649     0.7506 0.204 0.000 0.796 0.000
#> GSM1124877     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124883     4  0.5035     0.7780 0.000 0.052 0.204 0.744
#> GSM1124889     2  0.0188     0.8868 0.000 0.996 0.004 0.000
#> GSM1124892     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124913     4  0.5035     0.7780 0.000 0.052 0.204 0.744
#> GSM1124916     2  0.0000     0.8875 0.000 1.000 0.000 0.000
#> GSM1124923     3  0.0000     0.8411 0.000 0.000 1.000 0.000
#> GSM1124925     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.8861 1.000 0.000 0.000 0.000
#> GSM1124934     1  0.2216     0.8079 0.908 0.000 0.092 0.000
#> GSM1124937     1  0.3569     0.7251 0.804 0.196 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
#> GSM1124891     3  0.2719    0.71710 0.144 0.000 0.852 0.000 0.004
#> GSM1124888     3  0.2719    0.71710 0.144 0.000 0.852 0.000 0.004
#> GSM1124890     3  0.2891    0.73447 0.000 0.000 0.824 0.000 0.176
#> GSM1124904     5  0.3774    0.72678 0.000 0.012 0.008 0.200 0.780
#> GSM1124927     2  0.1710    0.72099 0.016 0.940 0.040 0.000 0.004
#> GSM1124953     3  0.2900    0.75177 0.000 0.000 0.864 0.028 0.108
#> GSM1124869     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.5168    0.27025 0.508 0.452 0.040 0.000 0.000
#> GSM1124882     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.4806    0.73433 0.000 0.688 0.060 0.000 0.252
#> GSM1124898     5  0.2793    0.72245 0.000 0.088 0.000 0.036 0.876
#> GSM1124903     5  0.3630    0.72892 0.000 0.016 0.000 0.204 0.780
#> GSM1124905     1  0.0290    0.84693 0.992 0.008 0.000 0.000 0.000
#> GSM1124910     1  0.1205    0.82430 0.956 0.000 0.040 0.000 0.004
#> GSM1124919     3  0.3913    0.61807 0.000 0.000 0.676 0.000 0.324
#> GSM1124932     2  0.4064    0.77188 0.000 0.792 0.092 0.000 0.116
#> GSM1124933     3  0.2074    0.74001 0.104 0.000 0.896 0.000 0.000
#> GSM1124867     2  0.5127    0.02046 0.012 0.532 0.004 0.440 0.012
#> GSM1124868     4  0.3561    0.58618 0.000 0.000 0.000 0.740 0.260
#> GSM1124878     4  0.4546    0.03813 0.000 0.008 0.000 0.532 0.460
#> GSM1124895     4  0.0000    0.86024 0.000 0.000 0.000 1.000 0.000
#> GSM1124897     4  0.3796    0.51725 0.000 0.000 0.000 0.700 0.300
#> GSM1124902     4  0.0000    0.86024 0.000 0.000 0.000 1.000 0.000
#> GSM1124908     4  0.0290    0.85868 0.000 0.000 0.000 0.992 0.008
#> GSM1124921     4  0.0290    0.85868 0.000 0.000 0.000 0.992 0.008
#> GSM1124939     4  0.0000    0.86024 0.000 0.000 0.000 1.000 0.000
#> GSM1124944     4  0.0000    0.86024 0.000 0.000 0.000 1.000 0.000
#> GSM1124945     3  0.2890    0.70292 0.000 0.000 0.836 0.160 0.004
#> GSM1124946     4  0.0290    0.85868 0.000 0.000 0.000 0.992 0.008
#> GSM1124947     4  0.0000    0.86024 0.000 0.000 0.000 1.000 0.000
#> GSM1124951     3  0.2753    0.71741 0.000 0.000 0.856 0.136 0.008
#> GSM1124952     4  0.0000    0.86024 0.000 0.000 0.000 1.000 0.000
#> GSM1124957     3  0.2488    0.72120 0.000 0.000 0.872 0.124 0.004
#> GSM1124900     1  0.5118    0.36478 0.548 0.412 0.040 0.000 0.000
#> GSM1124914     5  0.3742    0.73842 0.000 0.020 0.004 0.188 0.788
#> GSM1124871     2  0.4524    0.63864 0.000 0.644 0.020 0.000 0.336
#> GSM1124874     2  0.4003    0.68249 0.000 0.704 0.008 0.000 0.288
#> GSM1124875     5  0.1806    0.70986 0.000 0.016 0.028 0.016 0.940
#> GSM1124880     1  0.5623    0.35347 0.520 0.416 0.056 0.000 0.008
#> GSM1124881     2  0.3123    0.77993 0.000 0.828 0.012 0.000 0.160
#> GSM1124885     5  0.3630    0.72892 0.000 0.016 0.000 0.204 0.780
#> GSM1124886     1  0.0324    0.84686 0.992 0.000 0.004 0.000 0.004
#> GSM1124887     5  0.4160    0.70812 0.000 0.008 0.036 0.184 0.772
#> GSM1124894     4  0.5962    0.52990 0.224 0.052 0.048 0.664 0.012
#> GSM1124896     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124899     5  0.4979   -0.31858 0.000 0.480 0.028 0.000 0.492
#> GSM1124901     5  0.2940    0.73324 0.000 0.072 0.004 0.048 0.876
#> GSM1124906     2  0.4522    0.76480 0.000 0.736 0.068 0.000 0.196
#> GSM1124907     5  0.3412    0.68894 0.000 0.008 0.048 0.096 0.848
#> GSM1124911     2  0.3690    0.75826 0.000 0.764 0.012 0.000 0.224
#> GSM1124912     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.3171    0.63170 0.000 0.176 0.000 0.008 0.816
#> GSM1124917     5  0.5304    0.39983 0.000 0.292 0.080 0.000 0.628
#> GSM1124918     2  0.5725    0.42122 0.000 0.488 0.084 0.000 0.428
#> GSM1124920     1  0.4448    0.00988 0.516 0.000 0.480 0.000 0.004
#> GSM1124922     5  0.5137    0.37958 0.004 0.296 0.020 0.024 0.656
#> GSM1124924     3  0.5678    0.35059 0.004 0.368 0.552 0.000 0.076
#> GSM1124926     2  0.5080    0.35381 0.000 0.524 0.016 0.012 0.448
#> GSM1124928     1  0.1412    0.83016 0.952 0.036 0.008 0.000 0.004
#> GSM1124930     3  0.4331    0.57859 0.000 0.004 0.596 0.000 0.400
#> GSM1124931     2  0.3248    0.73932 0.004 0.856 0.088 0.000 0.052
#> GSM1124935     5  0.3388    0.59206 0.000 0.200 0.000 0.008 0.792
#> GSM1124936     1  0.4403    0.15655 0.560 0.000 0.436 0.000 0.004
#> GSM1124938     3  0.3171    0.72737 0.000 0.008 0.816 0.000 0.176
#> GSM1124940     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.4522    0.76480 0.000 0.736 0.068 0.000 0.196
#> GSM1124942     3  0.4714    0.48785 0.000 0.012 0.576 0.004 0.408
#> GSM1124943     3  0.3661    0.70186 0.000 0.000 0.724 0.000 0.276
#> GSM1124948     3  0.4761    0.65059 0.000 0.168 0.728 0.000 0.104
#> GSM1124949     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.1831    0.72191 0.000 0.920 0.076 0.000 0.004
#> GSM1124954     3  0.4437    0.06135 0.464 0.000 0.532 0.000 0.004
#> GSM1124955     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.3659    0.76023 0.000 0.768 0.012 0.000 0.220
#> GSM1124872     2  0.1197    0.72667 0.000 0.952 0.048 0.000 0.000
#> GSM1124873     2  0.2719    0.78084 0.000 0.852 0.004 0.000 0.144
#> GSM1124876     3  0.2561    0.71854 0.144 0.000 0.856 0.000 0.000
#> GSM1124877     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.0162    0.84836 0.996 0.000 0.000 0.000 0.004
#> GSM1124883     5  0.3596    0.73203 0.000 0.016 0.000 0.200 0.784
#> GSM1124889     2  0.4114    0.72117 0.000 0.712 0.016 0.000 0.272
#> GSM1124892     1  0.0566    0.84338 0.984 0.000 0.012 0.000 0.004
#> GSM1124893     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.1701    0.76292 0.000 0.936 0.016 0.000 0.048
#> GSM1124913     5  0.3752    0.73129 0.000 0.016 0.004 0.200 0.780
#> GSM1124916     2  0.1800    0.76404 0.000 0.932 0.020 0.000 0.048
#> GSM1124923     3  0.4264    0.56721 0.000 0.000 0.620 0.004 0.376
#> GSM1124925     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000    0.84962 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     1  0.4135    0.42816 0.656 0.000 0.340 0.000 0.004
#> GSM1124937     1  0.4467    0.64604 0.724 0.240 0.024 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
#> GSM1124891     3  0.1779    0.66217 0.064 0.000 0.920 0.000 0.000 0.016
#> GSM1124888     3  0.1625    0.66408 0.060 0.000 0.928 0.000 0.000 0.012
#> GSM1124890     3  0.4061    0.58945 0.000 0.000 0.748 0.000 0.164 0.088
#> GSM1124904     5  0.2741    0.68040 0.000 0.032 0.000 0.092 0.868 0.008
#> GSM1124927     6  0.3991    0.18319 0.004 0.472 0.000 0.000 0.000 0.524
#> GSM1124953     3  0.3317    0.63112 0.000 0.004 0.828 0.000 0.080 0.088
#> GSM1124869     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     6  0.5873    0.38972 0.352 0.204 0.000 0.000 0.000 0.444
#> GSM1124882     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.2858    0.66062 0.000 0.844 0.000 0.000 0.124 0.032
#> GSM1124898     5  0.2971    0.62492 0.000 0.144 0.000 0.020 0.832 0.004
#> GSM1124903     5  0.2629    0.68098 0.000 0.040 0.000 0.092 0.868 0.000
#> GSM1124905     1  0.1564    0.90574 0.936 0.000 0.024 0.000 0.000 0.040
#> GSM1124910     1  0.1812    0.87326 0.912 0.000 0.080 0.000 0.000 0.008
#> GSM1124919     3  0.5618    0.33673 0.000 0.004 0.528 0.000 0.320 0.148
#> GSM1124932     2  0.3088    0.51784 0.000 0.808 0.000 0.000 0.020 0.172
#> GSM1124933     3  0.0363    0.66187 0.012 0.000 0.988 0.000 0.000 0.000
#> GSM1124867     6  0.6048    0.20107 0.000 0.212 0.004 0.368 0.000 0.416
#> GSM1124868     4  0.3672    0.51060 0.000 0.008 0.000 0.688 0.304 0.000
#> GSM1124878     5  0.4508    0.22023 0.000 0.036 0.000 0.396 0.568 0.000
#> GSM1124895     4  0.0000    0.88165 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124897     4  0.3795    0.39168 0.000 0.004 0.000 0.632 0.364 0.000
#> GSM1124902     4  0.0000    0.88165 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124908     4  0.0363    0.87814 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM1124921     4  0.0363    0.87886 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM1124939     4  0.0000    0.88165 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0000    0.88165 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124945     3  0.3196    0.61171 0.000 0.000 0.816 0.156 0.008 0.020
#> GSM1124946     4  0.0363    0.87886 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM1124947     4  0.0000    0.88165 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124951     3  0.3224    0.64206 0.000 0.000 0.848 0.084 0.032 0.036
#> GSM1124952     4  0.0146    0.87808 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124957     3  0.0865    0.65650 0.000 0.000 0.964 0.036 0.000 0.000
#> GSM1124900     6  0.5746    0.35538 0.376 0.172 0.000 0.000 0.000 0.452
#> GSM1124914     5  0.3030    0.67645 0.000 0.056 0.000 0.092 0.848 0.004
#> GSM1124871     2  0.3974    0.56955 0.000 0.680 0.000 0.000 0.296 0.024
#> GSM1124874     2  0.4506    0.60941 0.000 0.704 0.000 0.000 0.176 0.120
#> GSM1124875     5  0.5032    0.40959 0.000 0.052 0.020 0.000 0.604 0.324
#> GSM1124880     6  0.5527    0.42484 0.240 0.152 0.012 0.000 0.000 0.596
#> GSM1124881     2  0.3551    0.57359 0.000 0.784 0.000 0.000 0.048 0.168
#> GSM1124885     5  0.2837    0.67795 0.000 0.056 0.000 0.088 0.856 0.000
#> GSM1124886     1  0.0363    0.94084 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM1124887     5  0.3309    0.65455 0.000 0.004 0.028 0.080 0.848 0.040
#> GSM1124894     4  0.7002    0.42227 0.168 0.056 0.128 0.580 0.012 0.056
#> GSM1124896     1  0.0146    0.94556 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM1124899     2  0.4770    0.49940 0.000 0.636 0.004 0.004 0.300 0.056
#> GSM1124901     5  0.3394    0.58119 0.000 0.188 0.000 0.012 0.788 0.012
#> GSM1124906     2  0.2527    0.64852 0.000 0.884 0.004 0.000 0.048 0.064
#> GSM1124907     5  0.4317    0.39621 0.000 0.004 0.028 0.000 0.640 0.328
#> GSM1124911     2  0.1588    0.66674 0.000 0.924 0.000 0.000 0.072 0.004
#> GSM1124912     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.3713    0.47327 0.000 0.284 0.000 0.008 0.704 0.004
#> GSM1124917     5  0.6858    0.20491 0.000 0.264 0.072 0.000 0.452 0.212
#> GSM1124918     6  0.6322   -0.05674 0.000 0.356 0.016 0.000 0.220 0.408
#> GSM1124920     3  0.4334    0.34172 0.408 0.000 0.568 0.000 0.000 0.024
#> GSM1124922     2  0.5347    0.16667 0.000 0.488 0.008 0.008 0.436 0.060
#> GSM1124924     6  0.4503    0.36510 0.000 0.084 0.152 0.000 0.024 0.740
#> GSM1124926     2  0.4306    0.51711 0.000 0.656 0.000 0.004 0.308 0.032
#> GSM1124928     1  0.2266    0.84693 0.880 0.000 0.012 0.000 0.000 0.108
#> GSM1124930     5  0.6051   -0.08173 0.000 0.000 0.260 0.000 0.396 0.344
#> GSM1124931     2  0.4234   -0.00119 0.004 0.576 0.000 0.000 0.012 0.408
#> GSM1124935     5  0.4004    0.42993 0.000 0.296 0.004 0.004 0.684 0.012
#> GSM1124936     3  0.4184    0.34893 0.408 0.000 0.576 0.000 0.000 0.016
#> GSM1124938     3  0.6356    0.30827 0.000 0.020 0.428 0.000 0.216 0.336
#> GSM1124940     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.2575    0.64509 0.000 0.880 0.004 0.000 0.044 0.072
#> GSM1124942     5  0.6444   -0.03818 0.000 0.020 0.236 0.000 0.380 0.364
#> GSM1124943     3  0.6108    0.21323 0.000 0.000 0.376 0.000 0.304 0.320
#> GSM1124948     6  0.6177   -0.02541 0.000 0.068 0.228 0.000 0.132 0.572
#> GSM1124949     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     6  0.3862    0.15337 0.000 0.476 0.000 0.000 0.000 0.524
#> GSM1124954     3  0.3592    0.55848 0.240 0.000 0.740 0.000 0.000 0.020
#> GSM1124955     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.1588    0.66674 0.000 0.924 0.000 0.000 0.072 0.004
#> GSM1124872     6  0.3866    0.15685 0.000 0.484 0.000 0.000 0.000 0.516
#> GSM1124873     2  0.2848    0.53270 0.000 0.828 0.004 0.000 0.008 0.160
#> GSM1124876     3  0.1524    0.66478 0.060 0.000 0.932 0.000 0.000 0.008
#> GSM1124877     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.2772    0.68058 0.000 0.040 0.000 0.092 0.864 0.004
#> GSM1124889     2  0.3062    0.66597 0.000 0.824 0.000 0.000 0.144 0.032
#> GSM1124892     1  0.1204    0.90588 0.944 0.000 0.056 0.000 0.000 0.000
#> GSM1124893     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.4062    0.05432 0.000 0.552 0.000 0.000 0.008 0.440
#> GSM1124913     5  0.2772    0.68102 0.000 0.040 0.000 0.092 0.864 0.004
#> GSM1124916     2  0.4032    0.09971 0.000 0.572 0.000 0.000 0.008 0.420
#> GSM1124923     3  0.5877    0.18553 0.000 0.000 0.428 0.000 0.372 0.200
#> GSM1124925     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000    0.94772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.4428    0.32906 0.388 0.000 0.580 0.000 0.000 0.032
#> GSM1124937     1  0.5380    0.14052 0.540 0.096 0.008 0.000 0.000 0.356

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 tissue(p) k
#> SD:skmeans 85  2.64e-01 2
#> SD:skmeans 72  6.46e-02 3
#> SD:skmeans 86  2.15e-05 4
#> SD:skmeans 75  9.57e-07 5
#> SD:skmeans 58  6.40e-07 6

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


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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.689           0.816       0.907         0.3686 0.587   0.587
#> 3 3 0.723           0.795       0.876         0.4283 0.889   0.815
#> 4 4 0.756           0.883       0.923         0.2280 0.868   0.738
#> 5 5 0.762           0.742       0.894         0.1357 0.889   0.707
#> 6 6 0.721           0.776       0.865         0.0797 0.927   0.740

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.0000     0.7167 1.000 0.000
#> GSM1124888     1  0.0000     0.7167 1.000 0.000
#> GSM1124890     2  0.9552     0.3204 0.376 0.624
#> GSM1124904     2  0.0000     0.9481 0.000 1.000
#> GSM1124927     2  0.0000     0.9481 0.000 1.000
#> GSM1124953     2  0.9710     0.2710 0.400 0.600
#> GSM1124869     1  0.9710     0.6640 0.600 0.400
#> GSM1124870     2  0.0672     0.9387 0.008 0.992
#> GSM1124882     1  0.9710     0.6640 0.600 0.400
#> GSM1124884     2  0.0000     0.9481 0.000 1.000
#> GSM1124898     2  0.0000     0.9481 0.000 1.000
#> GSM1124903     2  0.0000     0.9481 0.000 1.000
#> GSM1124905     2  0.9993    -0.4112 0.484 0.516
#> GSM1124910     1  0.9427     0.6742 0.640 0.360
#> GSM1124919     2  0.0000     0.9481 0.000 1.000
#> GSM1124932     2  0.0000     0.9481 0.000 1.000
#> GSM1124933     1  0.1843     0.7068 0.972 0.028
#> GSM1124867     2  0.0000     0.9481 0.000 1.000
#> GSM1124868     2  0.0000     0.9481 0.000 1.000
#> GSM1124878     2  0.0000     0.9481 0.000 1.000
#> GSM1124895     2  0.0000     0.9481 0.000 1.000
#> GSM1124897     2  0.0000     0.9481 0.000 1.000
#> GSM1124902     2  0.0000     0.9481 0.000 1.000
#> GSM1124908     2  0.0000     0.9481 0.000 1.000
#> GSM1124921     2  0.0000     0.9481 0.000 1.000
#> GSM1124939     2  0.0000     0.9481 0.000 1.000
#> GSM1124944     2  0.0000     0.9481 0.000 1.000
#> GSM1124945     2  0.9754     0.2531 0.408 0.592
#> GSM1124946     2  0.0000     0.9481 0.000 1.000
#> GSM1124947     2  0.0000     0.9481 0.000 1.000
#> GSM1124951     1  0.9998    -0.0136 0.508 0.492
#> GSM1124952     2  0.0000     0.9481 0.000 1.000
#> GSM1124957     1  0.0000     0.7167 1.000 0.000
#> GSM1124900     2  0.0000     0.9481 0.000 1.000
#> GSM1124914     2  0.0000     0.9481 0.000 1.000
#> GSM1124871     2  0.0000     0.9481 0.000 1.000
#> GSM1124874     2  0.0000     0.9481 0.000 1.000
#> GSM1124875     2  0.0000     0.9481 0.000 1.000
#> GSM1124880     2  0.0672     0.9387 0.008 0.992
#> GSM1124881     2  0.0000     0.9481 0.000 1.000
#> GSM1124885     2  0.0000     0.9481 0.000 1.000
#> GSM1124886     1  0.0000     0.7167 1.000 0.000
#> GSM1124887     2  0.0000     0.9481 0.000 1.000
#> GSM1124894     2  0.7139     0.6141 0.196 0.804
#> GSM1124896     1  0.9754     0.6495 0.592 0.408
#> GSM1124899     2  0.0000     0.9481 0.000 1.000
#> GSM1124901     2  0.0000     0.9481 0.000 1.000
#> GSM1124906     2  0.0000     0.9481 0.000 1.000
#> GSM1124907     2  0.0000     0.9481 0.000 1.000
#> GSM1124911     2  0.0000     0.9481 0.000 1.000
#> GSM1124912     1  0.9710     0.6640 0.600 0.400
#> GSM1124915     2  0.0000     0.9481 0.000 1.000
#> GSM1124917     2  0.0000     0.9481 0.000 1.000
#> GSM1124918     2  0.0000     0.9481 0.000 1.000
#> GSM1124920     1  0.0000     0.7167 1.000 0.000
#> GSM1124922     2  0.0000     0.9481 0.000 1.000
#> GSM1124924     2  0.0000     0.9481 0.000 1.000
#> GSM1124926     2  0.0000     0.9481 0.000 1.000
#> GSM1124928     1  0.9710     0.6640 0.600 0.400
#> GSM1124930     2  0.0000     0.9481 0.000 1.000
#> GSM1124931     2  0.0000     0.9481 0.000 1.000
#> GSM1124935     2  0.0000     0.9481 0.000 1.000
#> GSM1124936     1  0.0000     0.7167 1.000 0.000
#> GSM1124938     2  0.9710     0.2710 0.400 0.600
#> GSM1124940     1  0.9710     0.6640 0.600 0.400
#> GSM1124941     2  0.0000     0.9481 0.000 1.000
#> GSM1124942     2  0.0000     0.9481 0.000 1.000
#> GSM1124943     2  0.4562     0.8230 0.096 0.904
#> GSM1124948     2  0.0000     0.9481 0.000 1.000
#> GSM1124949     1  0.9710     0.6640 0.600 0.400
#> GSM1124950     2  0.0000     0.9481 0.000 1.000
#> GSM1124954     1  0.0000     0.7167 1.000 0.000
#> GSM1124955     1  0.9710     0.6640 0.600 0.400
#> GSM1124956     2  0.0000     0.9481 0.000 1.000
#> GSM1124872     2  0.0000     0.9481 0.000 1.000
#> GSM1124873     2  0.0000     0.9481 0.000 1.000
#> GSM1124876     1  0.0000     0.7167 1.000 0.000
#> GSM1124877     1  0.9710     0.6640 0.600 0.400
#> GSM1124879     1  0.9710     0.6640 0.600 0.400
#> GSM1124883     2  0.0000     0.9481 0.000 1.000
#> GSM1124889     2  0.0000     0.9481 0.000 1.000
#> GSM1124892     1  0.0000     0.7167 1.000 0.000
#> GSM1124893     1  0.9710     0.6640 0.600 0.400
#> GSM1124909     2  0.0000     0.9481 0.000 1.000
#> GSM1124913     2  0.0000     0.9481 0.000 1.000
#> GSM1124916     2  0.0000     0.9481 0.000 1.000
#> GSM1124923     2  0.0000     0.9481 0.000 1.000
#> GSM1124925     1  0.9710     0.6640 0.600 0.400
#> GSM1124929     1  0.9710     0.6640 0.600 0.400
#> GSM1124934     1  0.0000     0.7167 1.000 0.000
#> GSM1124937     2  0.0000     0.9481 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
#> GSM1124891     3  0.0000      0.568 0.000 0.000 1.000
#> GSM1124888     3  0.0000      0.568 0.000 0.000 1.000
#> GSM1124890     3  0.6204      0.398 0.000 0.424 0.576
#> GSM1124904     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124927     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124953     3  0.6111      0.455 0.000 0.396 0.604
#> GSM1124869     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124870     2  0.3826      0.771 0.124 0.868 0.008
#> GSM1124882     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124884     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124898     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124903     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124905     2  0.7015      0.249 0.024 0.584 0.392
#> GSM1124910     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124919     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124932     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124933     3  0.0592      0.571 0.000 0.012 0.988
#> GSM1124867     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124868     2  0.5882      0.597 0.348 0.652 0.000
#> GSM1124878     2  0.3340      0.819 0.120 0.880 0.000
#> GSM1124895     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124897     2  0.2878      0.837 0.096 0.904 0.000
#> GSM1124902     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124908     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124921     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124939     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124944     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124945     3  0.8528      0.521 0.156 0.240 0.604
#> GSM1124946     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124947     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124951     3  0.8595      0.519 0.180 0.216 0.604
#> GSM1124952     2  0.6111      0.544 0.396 0.604 0.000
#> GSM1124957     3  0.0747      0.566 0.016 0.000 0.984
#> GSM1124900     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124914     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124871     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124874     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124875     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124880     2  0.0747      0.892 0.000 0.984 0.016
#> GSM1124881     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124885     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124886     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124887     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124894     2  0.4605      0.678 0.000 0.796 0.204
#> GSM1124896     3  0.9921     -0.283 0.308 0.296 0.396
#> GSM1124899     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124901     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124906     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124907     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124911     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124912     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124915     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124917     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124918     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124920     3  0.0000      0.568 0.000 0.000 1.000
#> GSM1124922     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124924     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124926     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124928     1  0.6330      0.991 0.600 0.004 0.396
#> GSM1124930     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124931     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124935     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124936     3  0.0000      0.568 0.000 0.000 1.000
#> GSM1124938     3  0.6111      0.455 0.000 0.396 0.604
#> GSM1124940     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124941     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124942     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124943     2  0.3686      0.750 0.000 0.860 0.140
#> GSM1124948     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124949     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124950     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124954     3  0.0000      0.568 0.000 0.000 1.000
#> GSM1124955     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124956     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124872     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124873     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124876     3  0.0000      0.568 0.000 0.000 1.000
#> GSM1124877     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124879     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124883     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124889     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124892     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124893     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124909     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124913     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124916     2  0.0000      0.904 0.000 1.000 0.000
#> GSM1124923     2  0.1411      0.873 0.000 0.964 0.036
#> GSM1124925     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124929     1  0.6111      0.999 0.604 0.000 0.396
#> GSM1124934     3  0.0475      0.562 0.004 0.004 0.992
#> GSM1124937     2  0.0000      0.904 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
#> GSM1124891     3  0.3528      0.860 0.192 0.000 0.808 0.000
#> GSM1124888     3  0.3610      0.858 0.200 0.000 0.800 0.000
#> GSM1124890     3  0.1022      0.756 0.000 0.032 0.968 0.000
#> GSM1124904     2  0.3610      0.852 0.000 0.800 0.200 0.000
#> GSM1124927     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124953     3  0.0188      0.783 0.000 0.004 0.996 0.000
#> GSM1124869     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124870     2  0.2704      0.817 0.124 0.876 0.000 0.000
#> GSM1124882     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124898     2  0.3486      0.859 0.000 0.812 0.188 0.000
#> GSM1124903     2  0.3681      0.862 0.000 0.816 0.176 0.008
#> GSM1124905     2  0.4331      0.650 0.288 0.712 0.000 0.000
#> GSM1124910     1  0.0188      0.959 0.996 0.000 0.004 0.000
#> GSM1124919     2  0.3649      0.849 0.000 0.796 0.204 0.000
#> GSM1124932     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124933     3  0.3123      0.863 0.156 0.000 0.844 0.000
#> GSM1124867     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124868     4  0.2408      0.849 0.000 0.104 0.000 0.896
#> GSM1124878     2  0.5375      0.760 0.000 0.744 0.116 0.140
#> GSM1124895     4  0.0000      0.956 0.000 0.000 0.000 1.000
#> GSM1124897     2  0.4798      0.831 0.000 0.768 0.180 0.052
#> GSM1124902     4  0.0000      0.956 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.3074      0.742 0.000 0.152 0.000 0.848
#> GSM1124921     4  0.0000      0.956 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.0000      0.956 0.000 0.000 0.000 1.000
#> GSM1124944     4  0.0000      0.956 0.000 0.000 0.000 1.000
#> GSM1124945     3  0.1389      0.783 0.000 0.000 0.952 0.048
#> GSM1124946     4  0.0000      0.956 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.0000      0.956 0.000 0.000 0.000 1.000
#> GSM1124951     3  0.0000      0.782 0.000 0.000 1.000 0.000
#> GSM1124952     4  0.0000      0.956 0.000 0.000 0.000 1.000
#> GSM1124957     3  0.3529      0.863 0.152 0.000 0.836 0.012
#> GSM1124900     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124914     2  0.3486      0.859 0.000 0.812 0.188 0.000
#> GSM1124871     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124874     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124875     2  0.1940      0.902 0.000 0.924 0.076 0.000
#> GSM1124880     2  0.0707      0.909 0.020 0.980 0.000 0.000
#> GSM1124881     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124885     2  0.3356      0.865 0.000 0.824 0.176 0.000
#> GSM1124886     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124887     2  0.3610      0.852 0.000 0.800 0.200 0.000
#> GSM1124894     2  0.3649      0.768 0.204 0.796 0.000 0.000
#> GSM1124896     1  0.4382      0.431 0.704 0.296 0.000 0.000
#> GSM1124899     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124901     2  0.1637      0.906 0.000 0.940 0.060 0.000
#> GSM1124906     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124907     2  0.3528      0.856 0.000 0.808 0.192 0.000
#> GSM1124911     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124912     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124917     2  0.0469      0.913 0.000 0.988 0.012 0.000
#> GSM1124918     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124920     3  0.3942      0.831 0.236 0.000 0.764 0.000
#> GSM1124922     2  0.1867      0.903 0.000 0.928 0.072 0.000
#> GSM1124924     2  0.1302      0.909 0.000 0.956 0.044 0.000
#> GSM1124926     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124928     1  0.0188      0.958 0.996 0.004 0.000 0.000
#> GSM1124930     2  0.3172      0.873 0.000 0.840 0.160 0.000
#> GSM1124931     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124935     2  0.1867      0.903 0.000 0.928 0.072 0.000
#> GSM1124936     3  0.3610      0.858 0.200 0.000 0.800 0.000
#> GSM1124938     3  0.1867      0.770 0.000 0.072 0.928 0.000
#> GSM1124940     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124942     2  0.3649      0.849 0.000 0.796 0.204 0.000
#> GSM1124943     2  0.4661      0.682 0.000 0.652 0.348 0.000
#> GSM1124948     2  0.1867      0.903 0.000 0.928 0.072 0.000
#> GSM1124949     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124954     3  0.3942      0.831 0.236 0.000 0.764 0.000
#> GSM1124955     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124872     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124873     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124876     3  0.3610      0.858 0.200 0.000 0.800 0.000
#> GSM1124877     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124883     2  0.3486      0.859 0.000 0.812 0.188 0.000
#> GSM1124889     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124892     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124913     2  0.3569      0.854 0.000 0.804 0.196 0.000
#> GSM1124916     2  0.0000      0.915 0.000 1.000 0.000 0.000
#> GSM1124923     2  0.4543      0.722 0.000 0.676 0.324 0.000
#> GSM1124925     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.964 1.000 0.000 0.000 0.000
#> GSM1124934     3  0.4642      0.818 0.240 0.020 0.740 0.000
#> GSM1124937     2  0.0000      0.915 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
#> GSM1124891     3  0.0162      0.883 0.004 0.000 0.996 0.000 0.000
#> GSM1124888     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000
#> GSM1124890     5  0.3884      0.344 0.000 0.004 0.288 0.000 0.708
#> GSM1124904     5  0.4304     -0.149 0.000 0.484 0.000 0.000 0.516
#> GSM1124927     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124953     3  0.0162      0.881 0.000 0.000 0.996 0.000 0.004
#> GSM1124869     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.2329      0.719 0.124 0.876 0.000 0.000 0.000
#> GSM1124882     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124898     2  0.4278      0.238 0.000 0.548 0.000 0.000 0.452
#> GSM1124903     2  0.4446      0.162 0.000 0.520 0.000 0.004 0.476
#> GSM1124905     2  0.3949      0.440 0.332 0.668 0.000 0.000 0.000
#> GSM1124910     1  0.2439      0.837 0.876 0.000 0.004 0.000 0.120
#> GSM1124919     5  0.2930      0.594 0.000 0.164 0.004 0.000 0.832
#> GSM1124932     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124933     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124868     4  0.2280      0.808 0.000 0.120 0.000 0.880 0.000
#> GSM1124878     2  0.5418      0.287 0.000 0.568 0.000 0.068 0.364
#> GSM1124895     4  0.0000      0.943 0.000 0.000 0.000 1.000 0.000
#> GSM1124897     2  0.5605      0.193 0.000 0.520 0.000 0.076 0.404
#> GSM1124902     4  0.0000      0.943 0.000 0.000 0.000 1.000 0.000
#> GSM1124908     4  0.4083      0.678 0.000 0.132 0.000 0.788 0.080
#> GSM1124921     4  0.0404      0.937 0.000 0.000 0.000 0.988 0.012
#> GSM1124939     4  0.0000      0.943 0.000 0.000 0.000 1.000 0.000
#> GSM1124944     4  0.0000      0.943 0.000 0.000 0.000 1.000 0.000
#> GSM1124945     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000
#> GSM1124946     4  0.0963      0.919 0.000 0.000 0.000 0.964 0.036
#> GSM1124947     4  0.0000      0.943 0.000 0.000 0.000 1.000 0.000
#> GSM1124951     3  0.1478      0.839 0.000 0.000 0.936 0.000 0.064
#> GSM1124952     4  0.0000      0.943 0.000 0.000 0.000 1.000 0.000
#> GSM1124957     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124914     2  0.3661      0.573 0.000 0.724 0.000 0.000 0.276
#> GSM1124871     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124874     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124875     2  0.3074      0.671 0.000 0.804 0.000 0.000 0.196
#> GSM1124880     2  0.1549      0.819 0.016 0.944 0.040 0.000 0.000
#> GSM1124881     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124885     2  0.4273      0.244 0.000 0.552 0.000 0.000 0.448
#> GSM1124886     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     2  0.4287      0.217 0.000 0.540 0.000 0.000 0.460
#> GSM1124894     2  0.3955      0.679 0.084 0.800 0.116 0.000 0.000
#> GSM1124896     1  0.3928      0.432 0.700 0.296 0.004 0.000 0.000
#> GSM1124899     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124901     2  0.1197      0.824 0.000 0.952 0.000 0.000 0.048
#> GSM1124906     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124907     5  0.0000      0.585 0.000 0.000 0.000 0.000 1.000
#> GSM1124911     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124912     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124917     2  0.1270      0.821 0.000 0.948 0.000 0.000 0.052
#> GSM1124918     2  0.0162      0.851 0.000 0.996 0.000 0.000 0.004
#> GSM1124920     3  0.4879      0.716 0.228 0.000 0.696 0.000 0.076
#> GSM1124922     2  0.1341      0.818 0.000 0.944 0.000 0.000 0.056
#> GSM1124924     5  0.6369      0.391 0.000 0.236 0.244 0.000 0.520
#> GSM1124926     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124928     1  0.0162      0.954 0.996 0.004 0.000 0.000 0.000
#> GSM1124930     5  0.1341      0.616 0.000 0.056 0.000 0.000 0.944
#> GSM1124931     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124935     2  0.1341      0.818 0.000 0.944 0.000 0.000 0.056
#> GSM1124936     3  0.2773      0.804 0.164 0.000 0.836 0.000 0.000
#> GSM1124938     5  0.4211      0.237 0.000 0.004 0.360 0.000 0.636
#> GSM1124940     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124942     5  0.5008      0.539 0.000 0.152 0.140 0.000 0.708
#> GSM1124943     5  0.2077      0.625 0.000 0.084 0.008 0.000 0.908
#> GSM1124948     5  0.4030      0.457 0.000 0.352 0.000 0.000 0.648
#> GSM1124949     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124954     3  0.3336      0.753 0.228 0.000 0.772 0.000 0.000
#> GSM1124955     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124872     2  0.0290      0.849 0.000 0.992 0.008 0.000 0.000
#> GSM1124873     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124876     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.4306     -0.171 0.000 0.492 0.000 0.000 0.508
#> GSM1124889     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124892     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124913     2  0.4302      0.164 0.000 0.520 0.000 0.000 0.480
#> GSM1124916     2  0.0000      0.853 0.000 1.000 0.000 0.000 0.000
#> GSM1124923     5  0.1205      0.606 0.000 0.040 0.004 0.000 0.956
#> GSM1124925     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.4918      0.720 0.228 0.008 0.704 0.000 0.060
#> GSM1124937     2  0.0290      0.849 0.000 0.992 0.000 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.0146      0.858 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM1124888     3  0.0000      0.858 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124890     6  0.5755      0.489 0.000 0.004 0.296 0.000 0.180 0.520
#> GSM1124904     5  0.2147      0.713 0.000 0.084 0.000 0.000 0.896 0.020
#> GSM1124927     2  0.2793      0.783 0.000 0.800 0.000 0.000 0.000 0.200
#> GSM1124953     3  0.0520      0.852 0.000 0.000 0.984 0.000 0.008 0.008
#> GSM1124869     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.4449      0.691 0.124 0.712 0.000 0.000 0.000 0.164
#> GSM1124882     1  0.0632      0.911 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1124884     2  0.0790      0.846 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1124898     5  0.4945      0.573 0.000 0.304 0.000 0.000 0.604 0.092
#> GSM1124903     5  0.0692      0.639 0.000 0.004 0.000 0.000 0.976 0.020
#> GSM1124905     2  0.5272      0.479 0.276 0.584 0.000 0.000 0.000 0.140
#> GSM1124910     1  0.3774      0.426 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM1124919     5  0.4895      0.389 0.000 0.068 0.004 0.000 0.600 0.328
#> GSM1124932     2  0.1863      0.823 0.000 0.896 0.000 0.000 0.104 0.000
#> GSM1124933     3  0.0000      0.858 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     2  0.2135      0.817 0.000 0.872 0.000 0.000 0.000 0.128
#> GSM1124868     4  0.2191      0.802 0.000 0.120 0.000 0.876 0.000 0.004
#> GSM1124878     5  0.2494      0.708 0.000 0.120 0.000 0.016 0.864 0.000
#> GSM1124895     4  0.0000      0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124897     5  0.5394      0.571 0.000 0.308 0.000 0.024 0.588 0.080
#> GSM1124902     4  0.0000      0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124908     4  0.4159      0.655 0.000 0.116 0.000 0.744 0.140 0.000
#> GSM1124921     4  0.2260      0.815 0.000 0.000 0.000 0.860 0.140 0.000
#> GSM1124939     4  0.0000      0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0000      0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124945     3  0.0000      0.858 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124946     4  0.0405      0.921 0.000 0.000 0.000 0.988 0.004 0.008
#> GSM1124947     4  0.0000      0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124951     3  0.1349      0.818 0.000 0.000 0.940 0.000 0.056 0.004
#> GSM1124952     4  0.0000      0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124957     3  0.0000      0.858 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     2  0.2668      0.799 0.000 0.828 0.000 0.000 0.004 0.168
#> GSM1124914     2  0.4971      0.332 0.000 0.604 0.000 0.000 0.300 0.096
#> GSM1124871     2  0.0146      0.845 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1124874     2  0.2006      0.823 0.000 0.892 0.000 0.000 0.104 0.004
#> GSM1124875     2  0.3487      0.726 0.000 0.788 0.000 0.000 0.044 0.168
#> GSM1124880     2  0.3891      0.764 0.016 0.768 0.036 0.000 0.000 0.180
#> GSM1124881     2  0.0000      0.845 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124885     5  0.3321      0.681 0.000 0.100 0.000 0.000 0.820 0.080
#> GSM1124886     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.3390      0.622 0.000 0.296 0.000 0.000 0.704 0.000
#> GSM1124894     2  0.5399      0.682 0.072 0.688 0.092 0.000 0.004 0.144
#> GSM1124896     1  0.3878      0.469 0.688 0.296 0.008 0.000 0.000 0.008
#> GSM1124899     2  0.1367      0.844 0.000 0.944 0.000 0.000 0.044 0.012
#> GSM1124901     2  0.3068      0.802 0.000 0.840 0.000 0.000 0.088 0.072
#> GSM1124906     2  0.0790      0.846 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1124907     6  0.2883      0.749 0.000 0.000 0.000 0.000 0.212 0.788
#> GSM1124911     2  0.1863      0.823 0.000 0.896 0.000 0.000 0.104 0.000
#> GSM1124912     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.2003      0.818 0.000 0.884 0.000 0.000 0.116 0.000
#> GSM1124917     2  0.3418      0.687 0.000 0.784 0.000 0.000 0.184 0.032
#> GSM1124918     2  0.0547      0.847 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM1124920     3  0.5712      0.449 0.220 0.000 0.520 0.000 0.000 0.260
#> GSM1124922     2  0.2510      0.789 0.000 0.872 0.000 0.000 0.028 0.100
#> GSM1124924     6  0.2633      0.618 0.000 0.032 0.104 0.000 0.000 0.864
#> GSM1124926     2  0.1500      0.842 0.000 0.936 0.000 0.000 0.052 0.012
#> GSM1124928     1  0.2402      0.796 0.856 0.004 0.000 0.000 0.000 0.140
#> GSM1124930     6  0.2793      0.756 0.000 0.000 0.000 0.000 0.200 0.800
#> GSM1124931     2  0.2706      0.823 0.000 0.860 0.000 0.000 0.104 0.036
#> GSM1124935     2  0.3862      0.755 0.000 0.772 0.000 0.000 0.132 0.096
#> GSM1124936     3  0.2378      0.772 0.152 0.000 0.848 0.000 0.000 0.000
#> GSM1124938     6  0.3242      0.733 0.000 0.004 0.148 0.000 0.032 0.816
#> GSM1124940     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.0713      0.847 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM1124942     6  0.3387      0.772 0.000 0.000 0.040 0.000 0.164 0.796
#> GSM1124943     6  0.2980      0.764 0.000 0.000 0.008 0.000 0.192 0.800
#> GSM1124948     6  0.1151      0.709 0.000 0.012 0.000 0.000 0.032 0.956
#> GSM1124949     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.2416      0.802 0.000 0.844 0.000 0.000 0.000 0.156
#> GSM1124954     3  0.2883      0.718 0.212 0.000 0.788 0.000 0.000 0.000
#> GSM1124955     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.1863      0.823 0.000 0.896 0.000 0.000 0.104 0.000
#> GSM1124872     2  0.2933      0.781 0.000 0.796 0.004 0.000 0.000 0.200
#> GSM1124873     2  0.0000      0.845 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124876     3  0.0000      0.858 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.0458      0.918 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM1124883     5  0.2909      0.706 0.000 0.136 0.000 0.000 0.836 0.028
#> GSM1124889     2  0.0363      0.846 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1124892     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.1863      0.834 0.000 0.896 0.000 0.000 0.000 0.104
#> GSM1124913     5  0.2147      0.713 0.000 0.084 0.000 0.000 0.896 0.020
#> GSM1124916     2  0.1007      0.845 0.000 0.956 0.000 0.000 0.000 0.044
#> GSM1124923     5  0.3672      0.383 0.000 0.008 0.000 0.000 0.688 0.304
#> GSM1124925     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.928 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.5456      0.556 0.216 0.004 0.592 0.000 0.000 0.188
#> GSM1124937     2  0.2854      0.783 0.000 0.792 0.000 0.000 0.000 0.208

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 tissue(p) k
#> SD:pam 85  1.30e-01 2
#> SD:pam 86  1.01e-01 3
#> SD:pam 90  7.47e-09 4
#> SD:pam 76  3.91e-07 5
#> SD:pam 83  9.01e-07 6

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


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

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.491           0.690       0.851         0.3897 0.693   0.693
#> 3 3 0.704           0.872       0.932         0.5699 0.670   0.532
#> 4 4 0.708           0.765       0.867         0.0714 0.932   0.836
#> 5 5 0.718           0.798       0.868         0.1496 0.841   0.592
#> 6 6 0.744           0.750       0.845         0.0426 0.931   0.733

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.9732      0.536 0.596 0.404
#> GSM1124888     1  0.9833      0.499 0.576 0.424
#> GSM1124890     1  0.0000      0.779 1.000 0.000
#> GSM1124904     1  0.5178      0.679 0.884 0.116
#> GSM1124927     1  0.0938      0.776 0.988 0.012
#> GSM1124953     2  0.9866     -0.168 0.432 0.568
#> GSM1124869     1  0.9710      0.543 0.600 0.400
#> GSM1124870     1  0.9710      0.543 0.600 0.400
#> GSM1124882     1  0.9710      0.543 0.600 0.400
#> GSM1124884     1  0.0000      0.779 1.000 0.000
#> GSM1124898     1  0.0000      0.779 1.000 0.000
#> GSM1124903     1  0.6531      0.612 0.832 0.168
#> GSM1124905     1  0.9710      0.543 0.600 0.400
#> GSM1124910     1  0.9710      0.543 0.600 0.400
#> GSM1124919     1  0.0000      0.779 1.000 0.000
#> GSM1124932     1  0.0000      0.779 1.000 0.000
#> GSM1124933     1  0.9833      0.499 0.576 0.424
#> GSM1124867     1  0.9996      0.155 0.512 0.488
#> GSM1124868     2  0.0000      0.895 0.000 1.000
#> GSM1124878     2  0.9710      0.311 0.400 0.600
#> GSM1124895     2  0.0000      0.895 0.000 1.000
#> GSM1124897     2  0.4562      0.790 0.096 0.904
#> GSM1124902     2  0.0000      0.895 0.000 1.000
#> GSM1124908     2  0.0000      0.895 0.000 1.000
#> GSM1124921     2  0.0000      0.895 0.000 1.000
#> GSM1124939     2  0.0000      0.895 0.000 1.000
#> GSM1124944     2  0.0000      0.895 0.000 1.000
#> GSM1124945     2  0.0000      0.895 0.000 1.000
#> GSM1124946     2  0.0000      0.895 0.000 1.000
#> GSM1124947     2  0.0000      0.895 0.000 1.000
#> GSM1124951     2  0.0000      0.895 0.000 1.000
#> GSM1124952     2  0.0000      0.895 0.000 1.000
#> GSM1124957     2  0.0000      0.895 0.000 1.000
#> GSM1124900     1  0.9710      0.543 0.600 0.400
#> GSM1124914     1  0.0000      0.779 1.000 0.000
#> GSM1124871     1  0.0000      0.779 1.000 0.000
#> GSM1124874     1  0.0000      0.779 1.000 0.000
#> GSM1124875     1  0.0000      0.779 1.000 0.000
#> GSM1124880     1  0.0376      0.778 0.996 0.004
#> GSM1124881     1  0.0000      0.779 1.000 0.000
#> GSM1124885     1  0.4298      0.709 0.912 0.088
#> GSM1124886     1  0.9710      0.543 0.600 0.400
#> GSM1124887     1  0.5408      0.670 0.876 0.124
#> GSM1124894     2  0.8555      0.420 0.280 0.720
#> GSM1124896     1  0.9710      0.543 0.600 0.400
#> GSM1124899     1  0.0000      0.779 1.000 0.000
#> GSM1124901     1  0.0000      0.779 1.000 0.000
#> GSM1124906     1  0.0000      0.779 1.000 0.000
#> GSM1124907     1  0.0376      0.777 0.996 0.004
#> GSM1124911     1  0.0000      0.779 1.000 0.000
#> GSM1124912     1  0.9710      0.543 0.600 0.400
#> GSM1124915     1  0.0000      0.779 1.000 0.000
#> GSM1124917     1  0.0000      0.779 1.000 0.000
#> GSM1124918     1  0.0000      0.779 1.000 0.000
#> GSM1124920     1  0.9710      0.543 0.600 0.400
#> GSM1124922     1  0.1184      0.775 0.984 0.016
#> GSM1124924     1  0.0000      0.779 1.000 0.000
#> GSM1124926     1  0.6973      0.689 0.812 0.188
#> GSM1124928     1  0.9710      0.543 0.600 0.400
#> GSM1124930     1  0.0000      0.779 1.000 0.000
#> GSM1124931     1  0.0000      0.779 1.000 0.000
#> GSM1124935     1  0.0000      0.779 1.000 0.000
#> GSM1124936     1  0.9710      0.543 0.600 0.400
#> GSM1124938     1  0.0000      0.779 1.000 0.000
#> GSM1124940     1  0.9710      0.543 0.600 0.400
#> GSM1124941     1  0.0000      0.779 1.000 0.000
#> GSM1124942     1  0.0000      0.779 1.000 0.000
#> GSM1124943     1  0.0000      0.779 1.000 0.000
#> GSM1124948     1  0.0000      0.779 1.000 0.000
#> GSM1124949     1  0.9710      0.543 0.600 0.400
#> GSM1124950     1  0.0000      0.779 1.000 0.000
#> GSM1124954     1  0.9710      0.543 0.600 0.400
#> GSM1124955     1  0.9710      0.543 0.600 0.400
#> GSM1124956     1  0.0000      0.779 1.000 0.000
#> GSM1124872     1  0.0000      0.779 1.000 0.000
#> GSM1124873     1  0.0000      0.779 1.000 0.000
#> GSM1124876     1  0.9833      0.499 0.576 0.424
#> GSM1124877     1  0.9710      0.543 0.600 0.400
#> GSM1124879     1  0.9710      0.543 0.600 0.400
#> GSM1124883     1  0.0376      0.777 0.996 0.004
#> GSM1124889     1  0.0000      0.779 1.000 0.000
#> GSM1124892     1  0.9710      0.543 0.600 0.400
#> GSM1124893     1  0.9710      0.543 0.600 0.400
#> GSM1124909     1  0.0000      0.779 1.000 0.000
#> GSM1124913     1  0.3733      0.724 0.928 0.072
#> GSM1124916     1  0.0000      0.779 1.000 0.000
#> GSM1124923     1  0.4298      0.709 0.912 0.088
#> GSM1124925     1  0.9710      0.543 0.600 0.400
#> GSM1124929     1  0.9710      0.543 0.600 0.400
#> GSM1124934     1  0.9710      0.543 0.600 0.400
#> GSM1124937     1  0.5946      0.715 0.856 0.144

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     1  0.4110     0.8405 0.844 0.004 0.152
#> GSM1124888     1  0.4110     0.8405 0.844 0.004 0.152
#> GSM1124890     2  0.3038     0.8805 0.000 0.896 0.104
#> GSM1124904     2  0.0424     0.9317 0.000 0.992 0.008
#> GSM1124927     2  0.4172     0.7857 0.156 0.840 0.004
#> GSM1124953     2  0.4121     0.8301 0.000 0.832 0.168
#> GSM1124869     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124870     1  0.1453     0.9341 0.968 0.024 0.008
#> GSM1124882     1  0.0475     0.9466 0.992 0.004 0.004
#> GSM1124884     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124898     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124903     2  0.0747     0.9265 0.000 0.984 0.016
#> GSM1124905     1  0.1015     0.9433 0.980 0.012 0.008
#> GSM1124910     1  0.0661     0.9460 0.988 0.004 0.008
#> GSM1124919     2  0.3038     0.8805 0.000 0.896 0.104
#> GSM1124932     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124933     1  0.4110     0.8405 0.844 0.004 0.152
#> GSM1124867     2  0.9457    -0.0836 0.204 0.484 0.312
#> GSM1124868     3  0.2959     0.9029 0.000 0.100 0.900
#> GSM1124878     3  0.6305     0.2543 0.000 0.484 0.516
#> GSM1124895     3  0.2959     0.9029 0.000 0.100 0.900
#> GSM1124897     3  0.6225     0.4031 0.000 0.432 0.568
#> GSM1124902     3  0.2959     0.9029 0.000 0.100 0.900
#> GSM1124908     3  0.2959     0.9029 0.000 0.100 0.900
#> GSM1124921     3  0.2959     0.9029 0.000 0.100 0.900
#> GSM1124939     3  0.2959     0.9029 0.000 0.100 0.900
#> GSM1124944     3  0.2959     0.9029 0.000 0.100 0.900
#> GSM1124945     3  0.0237     0.8290 0.004 0.000 0.996
#> GSM1124946     3  0.2959     0.9029 0.000 0.100 0.900
#> GSM1124947     3  0.3193     0.9019 0.004 0.100 0.896
#> GSM1124951     3  0.0000     0.8294 0.000 0.000 1.000
#> GSM1124952     3  0.3193     0.9019 0.004 0.100 0.896
#> GSM1124957     3  0.0237     0.8290 0.004 0.000 0.996
#> GSM1124900     1  0.2200     0.9017 0.940 0.056 0.004
#> GSM1124914     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124871     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124874     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124875     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124880     2  0.6267     0.2184 0.452 0.548 0.000
#> GSM1124881     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124885     2  0.0424     0.9317 0.000 0.992 0.008
#> GSM1124886     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124887     2  0.0424     0.9317 0.000 0.992 0.008
#> GSM1124894     3  0.6705     0.7752 0.144 0.108 0.748
#> GSM1124896     1  0.0475     0.9466 0.992 0.004 0.004
#> GSM1124899     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124901     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124906     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124907     2  0.3038     0.8805 0.000 0.896 0.104
#> GSM1124911     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124912     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124915     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124917     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124918     2  0.2599     0.9034 0.016 0.932 0.052
#> GSM1124920     1  0.0661     0.9460 0.988 0.004 0.008
#> GSM1124922     2  0.0237     0.9327 0.000 0.996 0.004
#> GSM1124924     2  0.3573     0.8424 0.120 0.876 0.004
#> GSM1124926     2  0.0424     0.9317 0.000 0.992 0.008
#> GSM1124928     1  0.0983     0.9422 0.980 0.016 0.004
#> GSM1124930     2  0.3038     0.8805 0.000 0.896 0.104
#> GSM1124931     2  0.0237     0.9327 0.000 0.996 0.004
#> GSM1124935     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124936     1  0.0661     0.9460 0.988 0.004 0.008
#> GSM1124938     2  0.3038     0.8805 0.000 0.896 0.104
#> GSM1124940     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124941     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124942     2  0.3038     0.8805 0.000 0.896 0.104
#> GSM1124943     2  0.3038     0.8805 0.000 0.896 0.104
#> GSM1124948     2  0.3590     0.8822 0.028 0.896 0.076
#> GSM1124949     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124950     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124954     1  0.0983     0.9423 0.980 0.004 0.016
#> GSM1124955     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124956     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124872     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124873     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124876     1  0.4110     0.8405 0.844 0.004 0.152
#> GSM1124877     1  0.0475     0.9466 0.992 0.004 0.004
#> GSM1124879     1  0.0661     0.9461 0.988 0.008 0.004
#> GSM1124883     2  0.0424     0.9317 0.000 0.992 0.008
#> GSM1124889     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124892     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124893     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124909     2  0.2959     0.8614 0.100 0.900 0.000
#> GSM1124913     2  0.0424     0.9317 0.000 0.992 0.008
#> GSM1124916     2  0.0000     0.9345 0.000 1.000 0.000
#> GSM1124923     2  0.3116     0.8793 0.000 0.892 0.108
#> GSM1124925     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124929     1  0.0237     0.9469 0.996 0.004 0.000
#> GSM1124934     1  0.1620     0.9327 0.964 0.024 0.012
#> GSM1124937     1  0.6495     0.0925 0.536 0.460 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.5004     0.5848 0.392 0.004 0.604 0.000
#> GSM1124888     3  0.5004     0.5848 0.392 0.004 0.604 0.000
#> GSM1124890     2  0.2081     0.8533 0.000 0.916 0.084 0.000
#> GSM1124904     2  0.1211     0.8705 0.000 0.960 0.000 0.040
#> GSM1124927     2  0.4669     0.8241 0.100 0.796 0.104 0.000
#> GSM1124953     2  0.3117     0.8299 0.000 0.880 0.092 0.028
#> GSM1124869     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.0804     0.8714 0.980 0.008 0.012 0.000
#> GSM1124882     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124898     2  0.0000     0.8811 0.000 1.000 0.000 0.000
#> GSM1124903     2  0.2334     0.8421 0.000 0.908 0.004 0.088
#> GSM1124905     1  0.0804     0.8714 0.980 0.008 0.012 0.000
#> GSM1124910     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124919     2  0.2081     0.8533 0.000 0.916 0.084 0.000
#> GSM1124932     2  0.2868     0.8821 0.000 0.864 0.136 0.000
#> GSM1124933     3  0.5004     0.5848 0.392 0.004 0.604 0.000
#> GSM1124867     2  0.6681     0.4332 0.024 0.604 0.060 0.312
#> GSM1124868     4  0.1637     0.7238 0.000 0.000 0.060 0.940
#> GSM1124878     2  0.6336     0.1257 0.000 0.480 0.060 0.460
#> GSM1124895     4  0.3569     0.7865 0.000 0.000 0.196 0.804
#> GSM1124897     4  0.6315    -0.0328 0.000 0.432 0.060 0.508
#> GSM1124902     4  0.3569     0.7865 0.000 0.000 0.196 0.804
#> GSM1124908     4  0.1474     0.7270 0.000 0.000 0.052 0.948
#> GSM1124921     4  0.0000     0.7513 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.3569     0.7865 0.000 0.000 0.196 0.804
#> GSM1124944     4  0.3569     0.7865 0.000 0.000 0.196 0.804
#> GSM1124945     3  0.4643     0.4239 0.000 0.000 0.656 0.344
#> GSM1124946     4  0.0000     0.7513 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.3569     0.7865 0.000 0.000 0.196 0.804
#> GSM1124951     3  0.4624     0.4240 0.000 0.000 0.660 0.340
#> GSM1124952     4  0.3528     0.7864 0.000 0.000 0.192 0.808
#> GSM1124957     3  0.4454     0.3844 0.000 0.000 0.692 0.308
#> GSM1124900     1  0.1305     0.8402 0.960 0.036 0.004 0.000
#> GSM1124914     2  0.0188     0.8811 0.000 0.996 0.004 0.000
#> GSM1124871     2  0.1940     0.8869 0.000 0.924 0.076 0.000
#> GSM1124874     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124875     2  0.0000     0.8811 0.000 1.000 0.000 0.000
#> GSM1124880     2  0.4855     0.5121 0.352 0.644 0.004 0.000
#> GSM1124881     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124885     2  0.0779     0.8781 0.000 0.980 0.004 0.016
#> GSM1124886     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124887     2  0.0336     0.8800 0.000 0.992 0.000 0.008
#> GSM1124894     4  0.6700     0.4513 0.148 0.096 0.060 0.696
#> GSM1124896     1  0.0188     0.8844 0.996 0.000 0.004 0.000
#> GSM1124899     2  0.2868     0.8821 0.000 0.864 0.136 0.000
#> GSM1124901     2  0.0000     0.8811 0.000 1.000 0.000 0.000
#> GSM1124906     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124907     2  0.2081     0.8533 0.000 0.916 0.084 0.000
#> GSM1124911     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124912     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.0000     0.8811 0.000 1.000 0.000 0.000
#> GSM1124917     2  0.1022     0.8856 0.000 0.968 0.032 0.000
#> GSM1124918     2  0.0188     0.8820 0.000 0.996 0.004 0.000
#> GSM1124920     1  0.4933    -0.0847 0.568 0.000 0.432 0.000
#> GSM1124922     2  0.2868     0.8821 0.000 0.864 0.136 0.000
#> GSM1124924     2  0.4879     0.8396 0.092 0.780 0.128 0.000
#> GSM1124926     2  0.2868     0.8821 0.000 0.864 0.136 0.000
#> GSM1124928     1  0.2973     0.6488 0.856 0.144 0.000 0.000
#> GSM1124930     2  0.2081     0.8533 0.000 0.916 0.084 0.000
#> GSM1124931     2  0.2868     0.8821 0.000 0.864 0.136 0.000
#> GSM1124935     2  0.0000     0.8811 0.000 1.000 0.000 0.000
#> GSM1124936     1  0.4933    -0.0847 0.568 0.000 0.432 0.000
#> GSM1124938     2  0.2149     0.8548 0.000 0.912 0.088 0.000
#> GSM1124940     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124942     2  0.2081     0.8533 0.000 0.916 0.084 0.000
#> GSM1124943     2  0.2081     0.8533 0.000 0.916 0.084 0.000
#> GSM1124948     2  0.3764     0.8602 0.000 0.784 0.216 0.000
#> GSM1124949     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124954     1  0.4916    -0.0531 0.576 0.000 0.424 0.000
#> GSM1124955     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124872     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124873     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124876     3  0.5004     0.5848 0.392 0.004 0.604 0.000
#> GSM1124877     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124883     2  0.0188     0.8811 0.000 0.996 0.004 0.000
#> GSM1124889     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124892     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124913     2  0.2197     0.8478 0.000 0.916 0.004 0.080
#> GSM1124916     2  0.2814     0.8830 0.000 0.868 0.132 0.000
#> GSM1124923     2  0.2081     0.8533 0.000 0.916 0.084 0.000
#> GSM1124925     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.8876 1.000 0.000 0.000 0.000
#> GSM1124934     1  0.2714     0.7100 0.884 0.112 0.004 0.000
#> GSM1124937     2  0.6403     0.6598 0.232 0.640 0.128 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
#> GSM1124891     3  0.2930      0.862 0.164 0.000 0.832 0.000 0.004
#> GSM1124888     3  0.2719      0.867 0.144 0.000 0.852 0.000 0.004
#> GSM1124890     5  0.1851      0.857 0.000 0.088 0.000 0.000 0.912
#> GSM1124904     2  0.4378      0.726 0.000 0.740 0.004 0.040 0.216
#> GSM1124927     2  0.3331      0.767 0.068 0.864 0.044 0.000 0.024
#> GSM1124953     5  0.2735      0.839 0.000 0.084 0.036 0.000 0.880
#> GSM1124869     1  0.0000      0.899 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.1682      0.889 0.940 0.012 0.044 0.000 0.004
#> GSM1124882     1  0.0290      0.899 0.992 0.000 0.008 0.000 0.000
#> GSM1124884     2  0.0404      0.833 0.000 0.988 0.000 0.000 0.012
#> GSM1124898     2  0.2891      0.782 0.000 0.824 0.000 0.000 0.176
#> GSM1124903     2  0.5084      0.728 0.000 0.712 0.032 0.044 0.212
#> GSM1124905     1  0.2798      0.875 0.888 0.008 0.044 0.000 0.060
#> GSM1124910     1  0.1731      0.876 0.932 0.004 0.060 0.000 0.004
#> GSM1124919     5  0.1908      0.860 0.000 0.092 0.000 0.000 0.908
#> GSM1124932     2  0.0404      0.830 0.000 0.988 0.000 0.000 0.012
#> GSM1124933     3  0.2719      0.867 0.144 0.000 0.852 0.000 0.004
#> GSM1124867     2  0.7982      0.473 0.084 0.556 0.076 0.144 0.140
#> GSM1124868     4  0.1831      0.917 0.000 0.000 0.076 0.920 0.004
#> GSM1124878     2  0.6122      0.587 0.000 0.644 0.080 0.216 0.060
#> GSM1124895     4  0.0000      0.939 0.000 0.000 0.000 1.000 0.000
#> GSM1124897     2  0.5829      0.376 0.000 0.548 0.080 0.364 0.008
#> GSM1124902     4  0.0000      0.939 0.000 0.000 0.000 1.000 0.000
#> GSM1124908     4  0.1704      0.921 0.000 0.000 0.068 0.928 0.004
#> GSM1124921     4  0.1043      0.938 0.000 0.000 0.040 0.960 0.000
#> GSM1124939     4  0.0000      0.939 0.000 0.000 0.000 1.000 0.000
#> GSM1124944     4  0.0000      0.939 0.000 0.000 0.000 1.000 0.000
#> GSM1124945     3  0.2915      0.714 0.000 0.000 0.860 0.116 0.024
#> GSM1124946     4  0.1043      0.938 0.000 0.000 0.040 0.960 0.000
#> GSM1124947     4  0.0000      0.939 0.000 0.000 0.000 1.000 0.000
#> GSM1124951     3  0.2864      0.715 0.000 0.000 0.864 0.112 0.024
#> GSM1124952     4  0.1043      0.938 0.000 0.000 0.040 0.960 0.000
#> GSM1124957     3  0.2915      0.714 0.000 0.000 0.860 0.116 0.024
#> GSM1124900     1  0.3469      0.855 0.860 0.044 0.052 0.000 0.044
#> GSM1124914     2  0.3274      0.776 0.000 0.780 0.000 0.000 0.220
#> GSM1124871     2  0.1410      0.829 0.000 0.940 0.000 0.000 0.060
#> GSM1124874     2  0.0510      0.833 0.000 0.984 0.000 0.000 0.016
#> GSM1124875     2  0.3274      0.757 0.000 0.780 0.000 0.000 0.220
#> GSM1124880     5  0.7631      0.176 0.300 0.304 0.044 0.000 0.352
#> GSM1124881     2  0.0963      0.828 0.000 0.964 0.000 0.000 0.036
#> GSM1124885     2  0.4284      0.752 0.000 0.752 0.004 0.040 0.204
#> GSM1124886     1  0.0000      0.899 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     2  0.4823      0.577 0.000 0.644 0.000 0.040 0.316
#> GSM1124894     4  0.6940      0.589 0.144 0.036 0.120 0.636 0.064
#> GSM1124896     1  0.3455      0.861 0.856 0.020 0.064 0.000 0.060
#> GSM1124899     2  0.0162      0.833 0.000 0.996 0.000 0.000 0.004
#> GSM1124901     2  0.2690      0.792 0.000 0.844 0.000 0.000 0.156
#> GSM1124906     2  0.0000      0.832 0.000 1.000 0.000 0.000 0.000
#> GSM1124907     5  0.1965      0.858 0.000 0.096 0.000 0.000 0.904
#> GSM1124911     2  0.0703      0.831 0.000 0.976 0.000 0.000 0.024
#> GSM1124912     1  0.0000      0.899 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.2732      0.789 0.000 0.840 0.000 0.000 0.160
#> GSM1124917     2  0.3561      0.668 0.000 0.740 0.000 0.000 0.260
#> GSM1124918     5  0.3837      0.651 0.000 0.308 0.000 0.000 0.692
#> GSM1124920     3  0.3521      0.817 0.232 0.000 0.764 0.000 0.004
#> GSM1124922     2  0.0703      0.826 0.000 0.976 0.000 0.000 0.024
#> GSM1124924     5  0.5080      0.599 0.000 0.368 0.044 0.000 0.588
#> GSM1124926     2  0.0162      0.832 0.000 0.996 0.000 0.000 0.004
#> GSM1124928     1  0.4107      0.810 0.820 0.040 0.056 0.000 0.084
#> GSM1124930     5  0.1908      0.860 0.000 0.092 0.000 0.000 0.908
#> GSM1124931     2  0.1484      0.813 0.000 0.944 0.008 0.000 0.048
#> GSM1124935     2  0.2732      0.789 0.000 0.840 0.000 0.000 0.160
#> GSM1124936     3  0.3689      0.800 0.256 0.000 0.740 0.000 0.004
#> GSM1124938     5  0.2561      0.837 0.000 0.144 0.000 0.000 0.856
#> GSM1124940     1  0.1341      0.883 0.944 0.000 0.000 0.000 0.056
#> GSM1124941     2  0.1197      0.818 0.000 0.952 0.000 0.000 0.048
#> GSM1124942     5  0.1908      0.860 0.000 0.092 0.000 0.000 0.908
#> GSM1124943     5  0.1908      0.860 0.000 0.092 0.000 0.000 0.908
#> GSM1124948     5  0.3661      0.726 0.000 0.276 0.000 0.000 0.724
#> GSM1124949     1  0.0404      0.899 0.988 0.000 0.000 0.000 0.012
#> GSM1124950     2  0.0510      0.830 0.000 0.984 0.000 0.000 0.016
#> GSM1124954     3  0.3266      0.839 0.200 0.000 0.796 0.000 0.004
#> GSM1124955     1  0.0162      0.898 0.996 0.000 0.004 0.000 0.000
#> GSM1124956     2  0.0703      0.831 0.000 0.976 0.000 0.000 0.024
#> GSM1124872     2  0.0000      0.832 0.000 1.000 0.000 0.000 0.000
#> GSM1124873     2  0.0000      0.832 0.000 1.000 0.000 0.000 0.000
#> GSM1124876     3  0.2719      0.867 0.144 0.000 0.852 0.000 0.004
#> GSM1124877     1  0.0324      0.900 0.992 0.004 0.000 0.000 0.004
#> GSM1124879     1  0.3186      0.867 0.872 0.020 0.052 0.000 0.056
#> GSM1124883     2  0.3210      0.780 0.000 0.788 0.000 0.000 0.212
#> GSM1124889     2  0.0510      0.832 0.000 0.984 0.000 0.000 0.016
#> GSM1124892     1  0.0703      0.895 0.976 0.000 0.024 0.000 0.000
#> GSM1124893     1  0.0000      0.899 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.3177      0.612 0.000 0.792 0.000 0.000 0.208
#> GSM1124913     2  0.4218      0.744 0.000 0.760 0.004 0.040 0.196
#> GSM1124916     2  0.3003      0.653 0.000 0.812 0.000 0.000 0.188
#> GSM1124923     5  0.1851      0.857 0.000 0.088 0.000 0.000 0.912
#> GSM1124925     1  0.0000      0.899 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.1341      0.883 0.944 0.000 0.000 0.000 0.056
#> GSM1124934     1  0.5481      0.618 0.692 0.016 0.136 0.000 0.156
#> GSM1124937     1  0.7317      0.134 0.432 0.284 0.032 0.000 0.252

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.1921     0.8036 0.052 0.000 0.916 0.000 0.000 0.032
#> GSM1124888     3  0.1075     0.8094 0.048 0.000 0.952 0.000 0.000 0.000
#> GSM1124890     5  0.1387     0.8189 0.000 0.068 0.000 0.000 0.932 0.000
#> GSM1124904     6  0.6151     0.7195 0.000 0.316 0.000 0.020 0.180 0.484
#> GSM1124927     2  0.3582     0.6345 0.124 0.816 0.016 0.000 0.004 0.040
#> GSM1124953     5  0.2568     0.7967 0.000 0.068 0.056 0.000 0.876 0.000
#> GSM1124869     1  0.0363     0.9081 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1124870     1  0.2570     0.8770 0.896 0.012 0.048 0.000 0.032 0.012
#> GSM1124882     1  0.0146     0.9095 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM1124884     2  0.0146     0.8276 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1124898     2  0.3456     0.6586 0.000 0.788 0.000 0.000 0.040 0.172
#> GSM1124903     6  0.6146     0.7575 0.000 0.252 0.064 0.020 0.072 0.592
#> GSM1124905     1  0.2620     0.8696 0.888 0.000 0.028 0.000 0.032 0.052
#> GSM1124910     1  0.2003     0.8786 0.912 0.000 0.044 0.000 0.000 0.044
#> GSM1124919     5  0.1387     0.8189 0.000 0.068 0.000 0.000 0.932 0.000
#> GSM1124932     2  0.0547     0.8172 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM1124933     3  0.1075     0.8094 0.048 0.000 0.952 0.000 0.000 0.000
#> GSM1124867     2  0.6426     0.3772 0.060 0.660 0.136 0.048 0.044 0.052
#> GSM1124868     4  0.3297     0.7998 0.000 0.000 0.112 0.820 0.000 0.068
#> GSM1124878     6  0.6926     0.6650 0.000 0.212 0.112 0.140 0.012 0.524
#> GSM1124895     4  0.0000     0.9069 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124897     6  0.7083     0.6105 0.000 0.192 0.112 0.180 0.012 0.504
#> GSM1124902     4  0.0000     0.9069 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124908     4  0.2587     0.8334 0.000 0.000 0.108 0.868 0.004 0.020
#> GSM1124921     4  0.1088     0.8985 0.000 0.000 0.024 0.960 0.000 0.016
#> GSM1124939     4  0.0000     0.9069 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0146     0.9064 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1124945     3  0.4832     0.6793 0.000 0.000 0.684 0.060 0.028 0.228
#> GSM1124946     4  0.1088     0.8985 0.000 0.000 0.024 0.960 0.000 0.016
#> GSM1124947     4  0.0260     0.9055 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM1124951     3  0.4832     0.6793 0.000 0.000 0.684 0.060 0.028 0.228
#> GSM1124952     4  0.0405     0.9063 0.000 0.000 0.004 0.988 0.008 0.000
#> GSM1124957     3  0.4832     0.6793 0.000 0.000 0.684 0.060 0.028 0.228
#> GSM1124900     1  0.2951     0.8592 0.880 0.040 0.024 0.000 0.020 0.036
#> GSM1124914     2  0.3938     0.5827 0.000 0.728 0.000 0.000 0.044 0.228
#> GSM1124871     2  0.1967     0.7766 0.000 0.904 0.000 0.000 0.012 0.084
#> GSM1124874     2  0.0146     0.8276 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1124875     2  0.4402     0.5389 0.000 0.712 0.000 0.000 0.184 0.104
#> GSM1124880     2  0.6661    -0.0522 0.372 0.436 0.020 0.000 0.140 0.032
#> GSM1124881     2  0.0632     0.8142 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM1124885     6  0.5365     0.7398 0.000 0.308 0.000 0.020 0.084 0.588
#> GSM1124886     1  0.0000     0.9099 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.4967     0.1611 0.000 0.420 0.000 0.020 0.528 0.032
#> GSM1124894     4  0.7573     0.3321 0.252 0.032 0.148 0.484 0.036 0.048
#> GSM1124896     1  0.1983     0.8779 0.908 0.000 0.072 0.000 0.000 0.020
#> GSM1124899     2  0.0000     0.8270 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124901     2  0.3523     0.6471 0.000 0.780 0.000 0.000 0.040 0.180
#> GSM1124906     2  0.0260     0.8273 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1124907     5  0.2312     0.7950 0.000 0.112 0.000 0.000 0.876 0.012
#> GSM1124911     2  0.0260     0.8273 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1124912     1  0.0363     0.9081 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1124915     2  0.4396     0.1641 0.000 0.612 0.000 0.000 0.036 0.352
#> GSM1124917     2  0.4175     0.5916 0.000 0.740 0.000 0.000 0.156 0.104
#> GSM1124918     5  0.5051     0.4485 0.000 0.300 0.000 0.000 0.596 0.104
#> GSM1124920     3  0.3418     0.7501 0.184 0.000 0.784 0.000 0.000 0.032
#> GSM1124922     2  0.0632     0.8140 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM1124924     5  0.5672     0.4959 0.100 0.280 0.012 0.000 0.592 0.016
#> GSM1124926     2  0.0713     0.8133 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM1124928     1  0.2613     0.8710 0.896 0.016 0.044 0.000 0.028 0.016
#> GSM1124930     5  0.2088     0.8145 0.000 0.068 0.000 0.000 0.904 0.028
#> GSM1124931     2  0.0935     0.8084 0.000 0.964 0.004 0.000 0.000 0.032
#> GSM1124935     2  0.3163     0.6961 0.000 0.820 0.000 0.000 0.040 0.140
#> GSM1124936     3  0.3791     0.7237 0.236 0.000 0.732 0.000 0.000 0.032
#> GSM1124938     5  0.3123     0.7811 0.000 0.076 0.000 0.000 0.836 0.088
#> GSM1124940     1  0.0632     0.9063 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1124941     2  0.0520     0.8262 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM1124942     5  0.1387     0.8189 0.000 0.068 0.000 0.000 0.932 0.000
#> GSM1124943     5  0.1387     0.8189 0.000 0.068 0.000 0.000 0.932 0.000
#> GSM1124948     5  0.3592     0.6910 0.000 0.240 0.000 0.000 0.740 0.020
#> GSM1124949     1  0.0363     0.9081 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1124950     2  0.0146     0.8273 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1124954     3  0.3602     0.7218 0.208 0.000 0.760 0.000 0.000 0.032
#> GSM1124955     1  0.0000     0.9099 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.0260     0.8273 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1124872     2  0.0000     0.8270 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124873     2  0.0000     0.8270 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124876     3  0.1141     0.8094 0.052 0.000 0.948 0.000 0.000 0.000
#> GSM1124877     1  0.0000     0.9099 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.1624     0.8951 0.936 0.004 0.020 0.000 0.000 0.040
#> GSM1124883     6  0.4947     0.4357 0.000 0.456 0.000 0.000 0.064 0.480
#> GSM1124889     2  0.0260     0.8273 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1124892     1  0.0291     0.9094 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM1124893     1  0.0363     0.9081 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1124909     2  0.1663     0.7502 0.000 0.912 0.000 0.000 0.088 0.000
#> GSM1124913     6  0.5984     0.7399 0.000 0.308 0.000 0.020 0.156 0.516
#> GSM1124916     2  0.0632     0.8197 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM1124923     5  0.2492     0.8059 0.000 0.068 0.036 0.000 0.888 0.008
#> GSM1124925     1  0.0000     0.9099 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0632     0.9063 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1124934     1  0.5639     0.5268 0.636 0.004 0.200 0.000 0.124 0.036
#> GSM1124937     1  0.6683    -0.0400 0.416 0.396 0.012 0.000 0.124 0.052

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 tissue(p) k
#> SD:mclust 84  5.32e-16 2
#> SD:mclust 86  2.14e-13 3
#> SD:mclust 81  8.62e-16 4
#> SD:mclust 87  1.01e-07 5
#> SD:mclust 82  9.95e-07 6

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


SD: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 48983 rows and 91 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 0.803           0.878       0.948         0.4936 0.499   0.499
#> 3 3 0.637           0.783       0.902         0.2389 0.792   0.621
#> 4 4 0.727           0.763       0.887         0.1452 0.753   0.478
#> 5 5 0.848           0.833       0.911         0.1149 0.820   0.492
#> 6 6 0.805           0.725       0.865         0.0447 0.945   0.759

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
#> GSM1124891     1  0.0000     0.9065 1.000 0.000
#> GSM1124888     1  0.0000     0.9065 1.000 0.000
#> GSM1124890     1  0.7219     0.7435 0.800 0.200
#> GSM1124904     2  0.0000     0.9733 0.000 1.000
#> GSM1124927     1  0.9732     0.3336 0.596 0.404
#> GSM1124953     1  0.9732     0.4150 0.596 0.404
#> GSM1124869     1  0.0000     0.9065 1.000 0.000
#> GSM1124870     1  0.0000     0.9065 1.000 0.000
#> GSM1124882     1  0.0000     0.9065 1.000 0.000
#> GSM1124884     2  0.0000     0.9733 0.000 1.000
#> GSM1124898     2  0.0000     0.9733 0.000 1.000
#> GSM1124903     2  0.0000     0.9733 0.000 1.000
#> GSM1124905     1  0.0000     0.9065 1.000 0.000
#> GSM1124910     1  0.0000     0.9065 1.000 0.000
#> GSM1124919     2  0.0672     0.9668 0.008 0.992
#> GSM1124932     2  0.9580     0.3508 0.380 0.620
#> GSM1124933     1  0.0000     0.9065 1.000 0.000
#> GSM1124867     2  0.2778     0.9270 0.048 0.952
#> GSM1124868     2  0.0000     0.9733 0.000 1.000
#> GSM1124878     2  0.0000     0.9733 0.000 1.000
#> GSM1124895     2  0.0000     0.9733 0.000 1.000
#> GSM1124897     2  0.0000     0.9733 0.000 1.000
#> GSM1124902     2  0.0000     0.9733 0.000 1.000
#> GSM1124908     2  0.0000     0.9733 0.000 1.000
#> GSM1124921     2  0.0000     0.9733 0.000 1.000
#> GSM1124939     2  0.0000     0.9733 0.000 1.000
#> GSM1124944     2  0.0000     0.9733 0.000 1.000
#> GSM1124945     1  0.9323     0.5291 0.652 0.348
#> GSM1124946     2  0.0000     0.9733 0.000 1.000
#> GSM1124947     2  0.0000     0.9733 0.000 1.000
#> GSM1124951     1  0.9710     0.4239 0.600 0.400
#> GSM1124952     2  0.0000     0.9733 0.000 1.000
#> GSM1124957     1  0.7219     0.7435 0.800 0.200
#> GSM1124900     1  0.0000     0.9065 1.000 0.000
#> GSM1124914     2  0.0000     0.9733 0.000 1.000
#> GSM1124871     2  0.0000     0.9733 0.000 1.000
#> GSM1124874     2  0.0000     0.9733 0.000 1.000
#> GSM1124875     2  0.0000     0.9733 0.000 1.000
#> GSM1124880     1  0.0000     0.9065 1.000 0.000
#> GSM1124881     2  0.0000     0.9733 0.000 1.000
#> GSM1124885     2  0.0000     0.9733 0.000 1.000
#> GSM1124886     1  0.0000     0.9065 1.000 0.000
#> GSM1124887     2  0.0000     0.9733 0.000 1.000
#> GSM1124894     2  0.8016     0.6538 0.244 0.756
#> GSM1124896     1  0.0000     0.9065 1.000 0.000
#> GSM1124899     2  0.0000     0.9733 0.000 1.000
#> GSM1124901     2  0.0000     0.9733 0.000 1.000
#> GSM1124906     2  0.0000     0.9733 0.000 1.000
#> GSM1124907     2  0.0000     0.9733 0.000 1.000
#> GSM1124911     2  0.0000     0.9733 0.000 1.000
#> GSM1124912     1  0.0000     0.9065 1.000 0.000
#> GSM1124915     2  0.0000     0.9733 0.000 1.000
#> GSM1124917     2  0.0000     0.9733 0.000 1.000
#> GSM1124918     2  0.0000     0.9733 0.000 1.000
#> GSM1124920     1  0.0000     0.9065 1.000 0.000
#> GSM1124922     2  0.0000     0.9733 0.000 1.000
#> GSM1124924     1  0.0000     0.9065 1.000 0.000
#> GSM1124926     2  0.0000     0.9733 0.000 1.000
#> GSM1124928     1  0.0000     0.9065 1.000 0.000
#> GSM1124930     2  0.6973     0.7326 0.188 0.812
#> GSM1124931     1  0.9993     0.0847 0.516 0.484
#> GSM1124935     2  0.0000     0.9733 0.000 1.000
#> GSM1124936     1  0.0000     0.9065 1.000 0.000
#> GSM1124938     1  0.7219     0.7435 0.800 0.200
#> GSM1124940     1  0.0000     0.9065 1.000 0.000
#> GSM1124941     2  0.0000     0.9733 0.000 1.000
#> GSM1124942     2  0.0000     0.9733 0.000 1.000
#> GSM1124943     1  0.9710     0.4243 0.600 0.400
#> GSM1124948     1  0.2423     0.8808 0.960 0.040
#> GSM1124949     1  0.0000     0.9065 1.000 0.000
#> GSM1124950     2  0.3733     0.9037 0.072 0.928
#> GSM1124954     1  0.0000     0.9065 1.000 0.000
#> GSM1124955     1  0.0000     0.9065 1.000 0.000
#> GSM1124956     2  0.0000     0.9733 0.000 1.000
#> GSM1124872     2  0.5408     0.8401 0.124 0.876
#> GSM1124873     2  0.0000     0.9733 0.000 1.000
#> GSM1124876     1  0.0000     0.9065 1.000 0.000
#> GSM1124877     1  0.0000     0.9065 1.000 0.000
#> GSM1124879     1  0.0000     0.9065 1.000 0.000
#> GSM1124883     2  0.0000     0.9733 0.000 1.000
#> GSM1124889     2  0.0000     0.9733 0.000 1.000
#> GSM1124892     1  0.0000     0.9065 1.000 0.000
#> GSM1124893     1  0.0000     0.9065 1.000 0.000
#> GSM1124909     1  0.9933     0.2309 0.548 0.452
#> GSM1124913     2  0.0000     0.9733 0.000 1.000
#> GSM1124916     2  0.4022     0.8946 0.080 0.920
#> GSM1124923     2  0.0938     0.9629 0.012 0.988
#> GSM1124925     1  0.0000     0.9065 1.000 0.000
#> GSM1124929     1  0.0000     0.9065 1.000 0.000
#> GSM1124934     1  0.0000     0.9065 1.000 0.000
#> GSM1124937     1  0.0000     0.9065 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.4555      0.737 0.200 0.000 0.800
#> GSM1124888     3  0.4555      0.737 0.200 0.000 0.800
#> GSM1124890     3  0.4555      0.764 0.000 0.200 0.800
#> GSM1124904     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124927     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124953     3  0.4504      0.766 0.000 0.196 0.804
#> GSM1124869     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124870     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124882     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124884     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124898     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124903     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124905     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124910     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124919     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124932     1  0.4121      0.708 0.832 0.168 0.000
#> GSM1124933     3  0.4555      0.737 0.200 0.000 0.800
#> GSM1124867     2  0.7091      0.449 0.320 0.640 0.040
#> GSM1124868     2  0.3267      0.836 0.000 0.884 0.116
#> GSM1124878     2  0.1289      0.888 0.000 0.968 0.032
#> GSM1124895     2  0.4555      0.770 0.000 0.800 0.200
#> GSM1124897     2  0.1163      0.890 0.000 0.972 0.028
#> GSM1124902     2  0.4555      0.770 0.000 0.800 0.200
#> GSM1124908     2  0.4555      0.770 0.000 0.800 0.200
#> GSM1124921     2  0.4555      0.770 0.000 0.800 0.200
#> GSM1124939     2  0.4555      0.770 0.000 0.800 0.200
#> GSM1124944     2  0.4654      0.763 0.000 0.792 0.208
#> GSM1124945     3  0.0000      0.768 0.000 0.000 1.000
#> GSM1124946     2  0.4555      0.770 0.000 0.800 0.200
#> GSM1124947     2  0.4605      0.767 0.000 0.796 0.204
#> GSM1124951     3  0.0000      0.768 0.000 0.000 1.000
#> GSM1124952     2  0.4605      0.767 0.000 0.796 0.204
#> GSM1124957     3  0.0000      0.768 0.000 0.000 1.000
#> GSM1124900     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124914     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124871     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124874     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124875     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124880     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124881     2  0.0237      0.900 0.004 0.996 0.000
#> GSM1124885     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124886     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124887     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124894     1  0.4733      0.688 0.800 0.004 0.196
#> GSM1124896     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124899     2  0.1964      0.858 0.056 0.944 0.000
#> GSM1124901     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124906     1  0.5905      0.463 0.648 0.352 0.000
#> GSM1124907     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124911     2  0.3412      0.784 0.124 0.876 0.000
#> GSM1124912     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124915     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124917     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124918     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124920     1  0.6008      0.256 0.628 0.000 0.372
#> GSM1124922     1  0.6299      0.183 0.524 0.476 0.000
#> GSM1124924     1  0.0424      0.861 0.992 0.000 0.008
#> GSM1124926     2  0.0424      0.897 0.008 0.992 0.000
#> GSM1124928     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124930     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124931     1  0.2066      0.819 0.940 0.060 0.000
#> GSM1124935     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124936     1  0.2261      0.807 0.932 0.000 0.068
#> GSM1124938     3  0.4605      0.762 0.000 0.204 0.796
#> GSM1124940     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124941     2  0.6111      0.262 0.396 0.604 0.000
#> GSM1124942     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124943     3  0.6095      0.493 0.000 0.392 0.608
#> GSM1124948     3  0.8516      0.559 0.112 0.328 0.560
#> GSM1124949     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124950     2  0.3686      0.763 0.140 0.860 0.000
#> GSM1124954     1  0.6225      0.056 0.568 0.000 0.432
#> GSM1124955     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124956     1  0.6308      0.115 0.508 0.492 0.000
#> GSM1124872     1  0.5835      0.482 0.660 0.340 0.000
#> GSM1124873     2  0.3619      0.769 0.136 0.864 0.000
#> GSM1124876     3  0.4555      0.737 0.200 0.000 0.800
#> GSM1124877     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124879     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124883     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124889     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124892     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124893     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124909     1  0.4750      0.652 0.784 0.216 0.000
#> GSM1124913     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1124916     1  0.4842      0.643 0.776 0.224 0.000
#> GSM1124923     2  0.0892      0.893 0.000 0.980 0.020
#> GSM1124925     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124929     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124934     1  0.0000      0.867 1.000 0.000 0.000
#> GSM1124937     1  0.0000      0.867 1.000 0.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
#> GSM1124891     3  0.2345   0.757526 0.100 0.000 0.900 0.000
#> GSM1124888     3  0.2216   0.761662 0.092 0.000 0.908 0.000
#> GSM1124890     3  0.4072   0.594989 0.000 0.252 0.748 0.000
#> GSM1124904     2  0.5998   0.660686 0.000 0.668 0.092 0.240
#> GSM1124927     1  0.4522   0.543413 0.680 0.320 0.000 0.000
#> GSM1124953     3  0.4193   0.585972 0.000 0.268 0.732 0.000
#> GSM1124869     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.2216   0.828783 0.908 0.092 0.000 0.000
#> GSM1124882     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124898     2  0.2401   0.847818 0.000 0.904 0.092 0.004
#> GSM1124903     2  0.6307   0.592478 0.000 0.620 0.092 0.288
#> GSM1124905     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124910     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124919     2  0.2466   0.846616 0.000 0.900 0.096 0.004
#> GSM1124932     2  0.4967  -0.014002 0.452 0.548 0.000 0.000
#> GSM1124933     3  0.2216   0.761662 0.092 0.000 0.908 0.000
#> GSM1124867     4  0.7016   0.314269 0.140 0.320 0.000 0.540
#> GSM1124868     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124878     4  0.3591   0.660950 0.000 0.168 0.008 0.824
#> GSM1124895     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124897     4  0.5160   0.556906 0.000 0.180 0.072 0.748
#> GSM1124902     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.0188   0.857578 0.000 0.000 0.004 0.996
#> GSM1124921     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124944     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124945     4  0.4776   0.275699 0.000 0.000 0.376 0.624
#> GSM1124946     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124951     3  0.4382   0.461939 0.000 0.000 0.704 0.296
#> GSM1124952     4  0.0000   0.860451 0.000 0.000 0.000 1.000
#> GSM1124957     3  0.2216   0.705025 0.000 0.000 0.908 0.092
#> GSM1124900     1  0.2216   0.828783 0.908 0.092 0.000 0.000
#> GSM1124914     2  0.5594   0.716540 0.000 0.716 0.092 0.192
#> GSM1124871     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124874     2  0.0188   0.855018 0.000 0.996 0.000 0.004
#> GSM1124875     2  0.2216   0.848684 0.000 0.908 0.092 0.000
#> GSM1124880     1  0.3764   0.691451 0.784 0.216 0.000 0.000
#> GSM1124881     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124885     2  0.5174   0.755139 0.000 0.756 0.092 0.152
#> GSM1124886     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124887     2  0.5436   0.732740 0.000 0.732 0.092 0.176
#> GSM1124894     4  0.3024   0.695149 0.148 0.000 0.000 0.852
#> GSM1124896     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124899     2  0.0469   0.856023 0.000 0.988 0.012 0.000
#> GSM1124901     2  0.2401   0.847818 0.000 0.904 0.092 0.004
#> GSM1124906     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124907     2  0.4662   0.787683 0.000 0.796 0.092 0.112
#> GSM1124911     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124912     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.2197   0.851245 0.000 0.916 0.080 0.004
#> GSM1124917     2  0.2216   0.848684 0.000 0.908 0.092 0.000
#> GSM1124918     2  0.1118   0.855915 0.000 0.964 0.036 0.000
#> GSM1124920     1  0.4907   0.264161 0.580 0.000 0.420 0.000
#> GSM1124922     2  0.4068   0.796117 0.100 0.844 0.044 0.012
#> GSM1124924     1  0.7822   0.000862 0.380 0.364 0.256 0.000
#> GSM1124926     2  0.2596   0.827110 0.024 0.908 0.000 0.068
#> GSM1124928     1  0.0188   0.895142 0.996 0.004 0.000 0.000
#> GSM1124930     2  0.2216   0.848684 0.000 0.908 0.092 0.000
#> GSM1124931     2  0.4888   0.131696 0.412 0.588 0.000 0.000
#> GSM1124935     2  0.2216   0.848684 0.000 0.908 0.092 0.000
#> GSM1124936     1  0.1022   0.875793 0.968 0.000 0.032 0.000
#> GSM1124938     3  0.3528   0.655685 0.000 0.192 0.808 0.000
#> GSM1124940     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124942     2  0.2216   0.848684 0.000 0.908 0.092 0.000
#> GSM1124943     2  0.3873   0.746882 0.000 0.772 0.228 0.000
#> GSM1124948     2  0.1302   0.848825 0.000 0.956 0.044 0.000
#> GSM1124949     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0188   0.853362 0.000 0.996 0.000 0.004
#> GSM1124954     1  0.4855   0.312885 0.600 0.000 0.400 0.000
#> GSM1124955     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124872     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124873     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124876     3  0.2216   0.761662 0.092 0.000 0.908 0.000
#> GSM1124877     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124883     2  0.5907   0.676335 0.000 0.680 0.092 0.228
#> GSM1124889     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124892     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124913     2  0.5842   0.685864 0.000 0.688 0.092 0.220
#> GSM1124916     2  0.0000   0.854756 0.000 1.000 0.000 0.000
#> GSM1124923     2  0.5219   0.690862 0.000 0.712 0.244 0.044
#> GSM1124925     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000   0.897165 1.000 0.000 0.000 0.000
#> GSM1124934     1  0.0524   0.891597 0.988 0.004 0.008 0.000
#> GSM1124937     1  0.2281   0.828711 0.904 0.096 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
#> GSM1124891     3  0.4698      0.696 0.168 0.016 0.752 0.000 0.064
#> GSM1124888     3  0.1774      0.810 0.000 0.016 0.932 0.000 0.052
#> GSM1124890     3  0.3074      0.689 0.000 0.000 0.804 0.000 0.196
#> GSM1124904     5  0.1792      0.854 0.000 0.000 0.000 0.084 0.916
#> GSM1124927     2  0.0609      0.934 0.020 0.980 0.000 0.000 0.000
#> GSM1124953     3  0.4211      0.467 0.000 0.360 0.636 0.000 0.004
#> GSM1124869     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.4015      0.490 0.348 0.652 0.000 0.000 0.000
#> GSM1124882     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.0703      0.940 0.000 0.976 0.000 0.000 0.024
#> GSM1124898     5  0.1430      0.845 0.000 0.052 0.000 0.004 0.944
#> GSM1124903     5  0.1851      0.852 0.000 0.000 0.000 0.088 0.912
#> GSM1124905     1  0.0324      0.933 0.992 0.004 0.000 0.000 0.004
#> GSM1124910     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124919     5  0.2331      0.835 0.000 0.080 0.020 0.000 0.900
#> GSM1124932     2  0.0693      0.937 0.012 0.980 0.000 0.000 0.008
#> GSM1124933     3  0.0000      0.826 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     2  0.1571      0.899 0.000 0.936 0.000 0.060 0.004
#> GSM1124868     4  0.1043      0.903 0.000 0.000 0.000 0.960 0.040
#> GSM1124878     5  0.3816      0.622 0.000 0.000 0.000 0.304 0.696
#> GSM1124895     4  0.0000      0.933 0.000 0.000 0.000 1.000 0.000
#> GSM1124897     5  0.2648      0.816 0.000 0.000 0.000 0.152 0.848
#> GSM1124902     4  0.0000      0.933 0.000 0.000 0.000 1.000 0.000
#> GSM1124908     5  0.4294      0.244 0.000 0.000 0.000 0.468 0.532
#> GSM1124921     4  0.0000      0.933 0.000 0.000 0.000 1.000 0.000
#> GSM1124939     4  0.0000      0.933 0.000 0.000 0.000 1.000 0.000
#> GSM1124944     4  0.0000      0.933 0.000 0.000 0.000 1.000 0.000
#> GSM1124945     4  0.3586      0.628 0.000 0.000 0.264 0.736 0.000
#> GSM1124946     4  0.2690      0.770 0.000 0.000 0.000 0.844 0.156
#> GSM1124947     4  0.0000      0.933 0.000 0.000 0.000 1.000 0.000
#> GSM1124951     3  0.0162      0.825 0.000 0.000 0.996 0.004 0.000
#> GSM1124952     4  0.0000      0.933 0.000 0.000 0.000 1.000 0.000
#> GSM1124957     3  0.0609      0.819 0.000 0.000 0.980 0.020 0.000
#> GSM1124900     2  0.2424      0.824 0.132 0.868 0.000 0.000 0.000
#> GSM1124914     5  0.1792      0.853 0.000 0.000 0.000 0.084 0.916
#> GSM1124871     2  0.0880      0.936 0.000 0.968 0.000 0.000 0.032
#> GSM1124874     2  0.0963      0.933 0.000 0.964 0.000 0.000 0.036
#> GSM1124875     5  0.1043      0.842 0.000 0.040 0.000 0.000 0.960
#> GSM1124880     2  0.0798      0.929 0.008 0.976 0.000 0.000 0.016
#> GSM1124881     2  0.0703      0.940 0.000 0.976 0.000 0.000 0.024
#> GSM1124885     5  0.1792      0.854 0.000 0.000 0.000 0.084 0.916
#> GSM1124886     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.1956      0.856 0.000 0.008 0.000 0.076 0.916
#> GSM1124894     4  0.1792      0.839 0.084 0.000 0.000 0.916 0.000
#> GSM1124896     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124899     5  0.1043      0.845 0.000 0.040 0.000 0.000 0.960
#> GSM1124901     5  0.1965      0.850 0.000 0.052 0.000 0.024 0.924
#> GSM1124906     2  0.0609      0.940 0.000 0.980 0.000 0.000 0.020
#> GSM1124907     5  0.1484      0.850 0.000 0.008 0.000 0.048 0.944
#> GSM1124911     2  0.0703      0.940 0.000 0.976 0.000 0.000 0.024
#> GSM1124912     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.3177      0.727 0.000 0.208 0.000 0.000 0.792
#> GSM1124917     2  0.3274      0.702 0.000 0.780 0.000 0.000 0.220
#> GSM1124918     2  0.1478      0.905 0.000 0.936 0.000 0.000 0.064
#> GSM1124920     1  0.5103      0.577 0.688 0.016 0.244 0.000 0.052
#> GSM1124922     5  0.2692      0.814 0.092 0.016 0.000 0.008 0.884
#> GSM1124924     2  0.1430      0.902 0.000 0.944 0.004 0.000 0.052
#> GSM1124926     5  0.4712      0.655 0.028 0.236 0.000 0.020 0.716
#> GSM1124928     1  0.1544      0.877 0.932 0.068 0.000 0.000 0.000
#> GSM1124930     5  0.0898      0.828 0.000 0.020 0.008 0.000 0.972
#> GSM1124931     2  0.0579      0.938 0.008 0.984 0.000 0.000 0.008
#> GSM1124935     5  0.2286      0.807 0.000 0.108 0.000 0.004 0.888
#> GSM1124936     1  0.0609      0.925 0.980 0.000 0.020 0.000 0.000
#> GSM1124938     3  0.4369      0.708 0.000 0.208 0.740 0.000 0.052
#> GSM1124940     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.0404      0.940 0.000 0.988 0.000 0.000 0.012
#> GSM1124942     5  0.5731      0.386 0.000 0.328 0.104 0.000 0.568
#> GSM1124943     5  0.4547      0.161 0.000 0.012 0.400 0.000 0.588
#> GSM1124948     2  0.1341      0.906 0.000 0.944 0.000 0.000 0.056
#> GSM1124949     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.0404      0.939 0.000 0.988 0.000 0.000 0.012
#> GSM1124954     1  0.6154      0.153 0.512 0.020 0.388 0.000 0.080
#> GSM1124955     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.0609      0.940 0.000 0.980 0.000 0.000 0.020
#> GSM1124872     2  0.0609      0.940 0.000 0.980 0.000 0.000 0.020
#> GSM1124873     2  0.0609      0.940 0.000 0.980 0.000 0.000 0.020
#> GSM1124876     3  0.0000      0.826 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     1  0.0671      0.926 0.980 0.004 0.000 0.000 0.016
#> GSM1124879     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.1851      0.852 0.000 0.000 0.000 0.088 0.912
#> GSM1124889     2  0.0880      0.936 0.000 0.968 0.000 0.000 0.032
#> GSM1124892     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.1121      0.931 0.000 0.956 0.000 0.000 0.044
#> GSM1124913     5  0.1792      0.854 0.000 0.000 0.000 0.084 0.916
#> GSM1124916     2  0.1121      0.924 0.000 0.956 0.000 0.000 0.044
#> GSM1124923     5  0.2130      0.833 0.000 0.000 0.080 0.012 0.908
#> GSM1124925     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     1  0.4519      0.772 0.796 0.060 0.060 0.000 0.084
#> GSM1124937     1  0.3479      0.807 0.836 0.084 0.000 0.000 0.080

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     6  0.5588     0.2364 0.132 0.000 0.316 0.000 0.008 0.544
#> GSM1124888     3  0.4246     0.0430 0.000 0.000 0.532 0.000 0.016 0.452
#> GSM1124890     3  0.3694     0.5548 0.000 0.000 0.784 0.000 0.140 0.076
#> GSM1124904     5  0.0547     0.8492 0.000 0.000 0.000 0.020 0.980 0.000
#> GSM1124927     2  0.0146     0.8504 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1124953     3  0.4395     0.2288 0.000 0.404 0.568 0.000 0.000 0.028
#> GSM1124869     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.3448     0.4975 0.280 0.716 0.000 0.000 0.000 0.004
#> GSM1124882     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.1082     0.8455 0.000 0.956 0.000 0.000 0.004 0.040
#> GSM1124898     5  0.1674     0.8450 0.000 0.004 0.000 0.004 0.924 0.068
#> GSM1124903     5  0.0632     0.8486 0.000 0.000 0.000 0.024 0.976 0.000
#> GSM1124905     1  0.1297     0.9423 0.948 0.000 0.000 0.012 0.000 0.040
#> GSM1124910     1  0.1082     0.9435 0.956 0.000 0.000 0.000 0.004 0.040
#> GSM1124919     5  0.5548     0.3361 0.000 0.020 0.376 0.000 0.520 0.084
#> GSM1124932     2  0.1615     0.8355 0.000 0.928 0.000 0.004 0.004 0.064
#> GSM1124933     3  0.0000     0.7064 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     2  0.1745     0.8267 0.000 0.924 0.000 0.056 0.000 0.020
#> GSM1124868     4  0.3172     0.7902 0.000 0.000 0.000 0.832 0.092 0.076
#> GSM1124878     5  0.1765     0.8189 0.000 0.000 0.000 0.096 0.904 0.000
#> GSM1124895     4  0.0146     0.9440 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1124897     5  0.2474     0.8405 0.000 0.004 0.000 0.032 0.884 0.080
#> GSM1124902     4  0.0146     0.9440 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1124908     5  0.3175     0.6543 0.000 0.000 0.000 0.256 0.744 0.000
#> GSM1124921     4  0.0260     0.9416 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM1124939     4  0.0146     0.9440 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1124944     4  0.0146     0.9440 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1124945     3  0.3175     0.5521 0.000 0.000 0.744 0.256 0.000 0.000
#> GSM1124946     4  0.2730     0.7472 0.000 0.000 0.000 0.808 0.192 0.000
#> GSM1124947     4  0.0146     0.9440 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1124951     3  0.1141     0.6943 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM1124952     4  0.0146     0.9440 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1124957     3  0.0547     0.7058 0.000 0.000 0.980 0.020 0.000 0.000
#> GSM1124900     2  0.1908     0.7812 0.096 0.900 0.000 0.000 0.000 0.004
#> GSM1124914     5  0.0692     0.8503 0.000 0.000 0.000 0.020 0.976 0.004
#> GSM1124871     2  0.0363     0.8502 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1124874     2  0.1610     0.8137 0.000 0.916 0.000 0.000 0.000 0.084
#> GSM1124875     5  0.1411     0.8456 0.000 0.004 0.000 0.000 0.936 0.060
#> GSM1124880     2  0.0725     0.8477 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM1124881     2  0.1610     0.8137 0.000 0.916 0.000 0.000 0.000 0.084
#> GSM1124885     5  0.2237     0.8413 0.000 0.004 0.000 0.020 0.896 0.080
#> GSM1124886     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.0748     0.8505 0.000 0.004 0.000 0.016 0.976 0.004
#> GSM1124894     4  0.1065     0.9124 0.020 0.008 0.000 0.964 0.000 0.008
#> GSM1124896     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124899     5  0.2311     0.8343 0.000 0.016 0.000 0.000 0.880 0.104
#> GSM1124901     5  0.1900     0.8444 0.000 0.008 0.000 0.008 0.916 0.068
#> GSM1124906     2  0.1204     0.8388 0.000 0.944 0.000 0.000 0.000 0.056
#> GSM1124907     5  0.0363     0.8455 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM1124911     2  0.2001     0.8199 0.000 0.900 0.000 0.004 0.004 0.092
#> GSM1124912     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.1663     0.8094 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM1124917     2  0.5415     0.3103 0.000 0.564 0.000 0.004 0.304 0.128
#> GSM1124918     6  0.3695     0.3911 0.000 0.272 0.000 0.000 0.016 0.712
#> GSM1124920     6  0.6404     0.2063 0.280 0.000 0.292 0.000 0.016 0.412
#> GSM1124922     5  0.3943     0.7198 0.156 0.000 0.000 0.000 0.760 0.084
#> GSM1124924     2  0.4264    -0.0568 0.000 0.500 0.000 0.000 0.016 0.484
#> GSM1124926     5  0.5168     0.6596 0.064 0.156 0.000 0.000 0.696 0.084
#> GSM1124928     1  0.1444     0.9099 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM1124930     5  0.3866     0.3005 0.000 0.000 0.000 0.000 0.516 0.484
#> GSM1124931     2  0.0458     0.8491 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM1124935     5  0.3601     0.6347 0.000 0.000 0.000 0.004 0.684 0.312
#> GSM1124936     1  0.0363     0.9756 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM1124938     6  0.5096    -0.1276 0.000 0.044 0.460 0.000 0.016 0.480
#> GSM1124940     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.1863     0.8067 0.000 0.896 0.000 0.000 0.000 0.104
#> GSM1124942     6  0.6804     0.0344 0.000 0.052 0.216 0.000 0.344 0.388
#> GSM1124943     5  0.5249     0.3299 0.000 0.000 0.104 0.000 0.528 0.368
#> GSM1124948     6  0.4303     0.2762 0.000 0.360 0.008 0.000 0.016 0.616
#> GSM1124949     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000     0.8502 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124954     6  0.4092     0.4246 0.316 0.000 0.012 0.004 0.004 0.664
#> GSM1124955     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.2113     0.8277 0.000 0.896 0.000 0.004 0.008 0.092
#> GSM1124872     2  0.0146     0.8504 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1124873     2  0.0146     0.8504 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1124876     3  0.0000     0.7064 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     1  0.1010     0.9507 0.960 0.000 0.000 0.000 0.004 0.036
#> GSM1124879     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.0547     0.8492 0.000 0.000 0.000 0.020 0.980 0.000
#> GSM1124889     2  0.0291     0.8512 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM1124892     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.3989     0.1927 0.000 0.528 0.000 0.004 0.000 0.468
#> GSM1124913     5  0.0603     0.8497 0.000 0.004 0.000 0.016 0.980 0.000
#> GSM1124916     6  0.4211    -0.1022 0.000 0.456 0.000 0.004 0.008 0.532
#> GSM1124923     5  0.0937     0.8431 0.000 0.000 0.040 0.000 0.960 0.000
#> GSM1124925     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9845 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     6  0.2773     0.4497 0.164 0.000 0.000 0.004 0.004 0.828
#> GSM1124937     6  0.3819     0.3307 0.372 0.000 0.000 0.004 0.000 0.624

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 tissue(p) k
#> SD:NMF 84  1.17e-01 2
#> SD:NMF 82  1.14e-03 3
#> SD:NMF 83  1.47e-13 4
#> SD:NMF 85  2.68e-07 5
#> SD:NMF 72  4.02e-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.


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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.447           0.788       0.889          0.261 0.820   0.820
#> 3 3 0.190           0.449       0.729          0.701 0.840   0.804
#> 4 4 0.282           0.632       0.749          0.318 0.730   0.603
#> 5 5 0.436           0.700       0.784          0.132 0.953   0.892
#> 6 6 0.526           0.553       0.717          0.110 0.996   0.991

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.9286      0.717 0.656 0.344
#> GSM1124888     1  0.9129      0.744 0.672 0.328
#> GSM1124890     2  0.7602      0.703 0.220 0.780
#> GSM1124904     2  0.1414      0.868 0.020 0.980
#> GSM1124927     2  0.2423      0.871 0.040 0.960
#> GSM1124953     2  0.7815      0.684 0.232 0.768
#> GSM1124869     2  0.3733      0.860 0.072 0.928
#> GSM1124870     2  0.2423      0.871 0.040 0.960
#> GSM1124882     2  0.3733      0.860 0.072 0.928
#> GSM1124884     2  0.0938      0.876 0.012 0.988
#> GSM1124898     2  0.1414      0.868 0.020 0.980
#> GSM1124903     2  0.1414      0.868 0.020 0.980
#> GSM1124905     2  0.2948      0.873 0.052 0.948
#> GSM1124910     2  0.5842      0.805 0.140 0.860
#> GSM1124919     2  0.7602      0.703 0.220 0.780
#> GSM1124932     2  0.8955      0.415 0.312 0.688
#> GSM1124933     1  0.7602      0.793 0.780 0.220
#> GSM1124867     2  0.4815      0.846 0.104 0.896
#> GSM1124868     2  0.4298      0.826 0.088 0.912
#> GSM1124878     2  0.4298      0.826 0.088 0.912
#> GSM1124895     2  0.7674      0.666 0.224 0.776
#> GSM1124897     2  0.4298      0.826 0.088 0.912
#> GSM1124902     2  0.7674      0.666 0.224 0.776
#> GSM1124908     2  0.7674      0.666 0.224 0.776
#> GSM1124921     2  0.7674      0.666 0.224 0.776
#> GSM1124939     2  0.7674      0.666 0.224 0.776
#> GSM1124944     2  0.7674      0.666 0.224 0.776
#> GSM1124945     1  0.2423      0.750 0.960 0.040
#> GSM1124946     2  0.7674      0.666 0.224 0.776
#> GSM1124947     2  0.7674      0.666 0.224 0.776
#> GSM1124951     1  0.2423      0.750 0.960 0.040
#> GSM1124952     2  0.7674      0.666 0.224 0.776
#> GSM1124957     1  0.2423      0.750 0.960 0.040
#> GSM1124900     2  0.3274      0.867 0.060 0.940
#> GSM1124914     2  0.2948      0.874 0.052 0.948
#> GSM1124871     2  0.0938      0.875 0.012 0.988
#> GSM1124874     2  0.0938      0.875 0.012 0.988
#> GSM1124875     2  0.2043      0.874 0.032 0.968
#> GSM1124880     2  0.5059      0.833 0.112 0.888
#> GSM1124881     2  0.0672      0.875 0.008 0.992
#> GSM1124885     2  0.1414      0.868 0.020 0.980
#> GSM1124886     2  0.3879      0.858 0.076 0.924
#> GSM1124887     2  0.7602      0.703 0.220 0.780
#> GSM1124894     2  0.3584      0.871 0.068 0.932
#> GSM1124896     2  0.3733      0.860 0.072 0.928
#> GSM1124899     2  0.0376      0.873 0.004 0.996
#> GSM1124901     2  0.1414      0.868 0.020 0.980
#> GSM1124906     2  0.0938      0.876 0.012 0.988
#> GSM1124907     2  0.2043      0.874 0.032 0.968
#> GSM1124911     2  0.0376      0.875 0.004 0.996
#> GSM1124912     2  0.3733      0.860 0.072 0.928
#> GSM1124915     2  0.0938      0.876 0.012 0.988
#> GSM1124917     2  0.2043      0.874 0.032 0.968
#> GSM1124918     2  0.1843      0.874 0.028 0.972
#> GSM1124920     1  0.9129      0.744 0.672 0.328
#> GSM1124922     2  0.1633      0.874 0.024 0.976
#> GSM1124924     2  0.6531      0.778 0.168 0.832
#> GSM1124926     2  0.0376      0.873 0.004 0.996
#> GSM1124928     2  0.5059      0.833 0.112 0.888
#> GSM1124930     2  0.2043      0.874 0.032 0.968
#> GSM1124931     2  0.1843      0.874 0.028 0.972
#> GSM1124935     2  0.0672      0.875 0.008 0.992
#> GSM1124936     1  0.9754      0.578 0.592 0.408
#> GSM1124938     2  0.4815      0.835 0.104 0.896
#> GSM1124940     2  0.3733      0.860 0.072 0.928
#> GSM1124941     2  0.0938      0.876 0.012 0.988
#> GSM1124942     2  0.2043      0.874 0.032 0.968
#> GSM1124943     2  0.2043      0.874 0.032 0.968
#> GSM1124948     2  0.6343      0.788 0.160 0.840
#> GSM1124949     2  0.4022      0.856 0.080 0.920
#> GSM1124950     2  0.2236      0.872 0.036 0.964
#> GSM1124954     2  0.9491      0.284 0.368 0.632
#> GSM1124955     2  0.3733      0.860 0.072 0.928
#> GSM1124956     2  0.0376      0.875 0.004 0.996
#> GSM1124872     2  0.2236      0.872 0.036 0.964
#> GSM1124873     2  0.0672      0.875 0.008 0.992
#> GSM1124876     1  0.7602      0.793 0.780 0.220
#> GSM1124877     2  0.9491      0.284 0.368 0.632
#> GSM1124879     2  0.5842      0.807 0.140 0.860
#> GSM1124883     2  0.1414      0.868 0.020 0.980
#> GSM1124889     2  0.1184      0.876 0.016 0.984
#> GSM1124892     2  0.9686      0.166 0.396 0.604
#> GSM1124893     2  0.3733      0.860 0.072 0.928
#> GSM1124909     2  0.0672      0.875 0.008 0.992
#> GSM1124913     2  0.1414      0.868 0.020 0.980
#> GSM1124916     2  0.0672      0.875 0.008 0.992
#> GSM1124923     2  0.7602      0.703 0.220 0.780
#> GSM1124925     2  0.3733      0.860 0.072 0.928
#> GSM1124929     2  0.3879      0.858 0.076 0.924
#> GSM1124934     2  0.9491      0.284 0.368 0.632
#> GSM1124937     2  0.5946      0.802 0.144 0.856

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3   0.917     0.4557 0.312 0.172 0.516
#> GSM1124888     3   0.819     0.5501 0.372 0.080 0.548
#> GSM1124890     2   0.594     0.4915 0.036 0.760 0.204
#> GSM1124904     2   0.196     0.6440 0.056 0.944 0.000
#> GSM1124927     2   0.460     0.5359 0.204 0.796 0.000
#> GSM1124953     2   0.608     0.4744 0.036 0.748 0.216
#> GSM1124869     2   0.631    -0.4399 0.496 0.504 0.000
#> GSM1124870     2   0.460     0.5359 0.204 0.796 0.000
#> GSM1124882     2   0.631    -0.4399 0.496 0.504 0.000
#> GSM1124884     2   0.312     0.6393 0.108 0.892 0.000
#> GSM1124898     2   0.164     0.6537 0.044 0.956 0.000
#> GSM1124903     2   0.196     0.6440 0.056 0.944 0.000
#> GSM1124905     2   0.596     0.2624 0.324 0.672 0.004
#> GSM1124910     2   0.744     0.0618 0.348 0.604 0.048
#> GSM1124919     2   0.594     0.4915 0.036 0.760 0.204
#> GSM1124932     1   0.597     0.5568 0.636 0.364 0.000
#> GSM1124933     3   0.524     0.7040 0.132 0.048 0.820
#> GSM1124867     2   0.538     0.6230 0.112 0.820 0.068
#> GSM1124868     2   0.491     0.6032 0.088 0.844 0.068
#> GSM1124878     2   0.491     0.6032 0.088 0.844 0.068
#> GSM1124895     2   0.792     0.4412 0.180 0.664 0.156
#> GSM1124897     2   0.491     0.6032 0.088 0.844 0.068
#> GSM1124902     2   0.792     0.4412 0.180 0.664 0.156
#> GSM1124908     2   0.787     0.4454 0.176 0.668 0.156
#> GSM1124921     2   0.787     0.4454 0.176 0.668 0.156
#> GSM1124939     2   0.792     0.4412 0.180 0.664 0.156
#> GSM1124944     2   0.792     0.4412 0.180 0.664 0.156
#> GSM1124945     3   0.000     0.6816 0.000 0.000 1.000
#> GSM1124946     2   0.787     0.4454 0.176 0.668 0.156
#> GSM1124947     2   0.792     0.4412 0.180 0.664 0.156
#> GSM1124951     3   0.000     0.6816 0.000 0.000 1.000
#> GSM1124952     2   0.819     0.4347 0.204 0.640 0.156
#> GSM1124957     3   0.000     0.6816 0.000 0.000 1.000
#> GSM1124900     2   0.516     0.5143 0.216 0.776 0.008
#> GSM1124914     2   0.475     0.5373 0.216 0.784 0.000
#> GSM1124871     2   0.334     0.6436 0.120 0.880 0.000
#> GSM1124874     2   0.334     0.6327 0.120 0.880 0.000
#> GSM1124875     2   0.238     0.6580 0.056 0.936 0.008
#> GSM1124880     2   0.685     0.2742 0.300 0.664 0.036
#> GSM1124881     2   0.304     0.6435 0.104 0.896 0.000
#> GSM1124885     2   0.175     0.6468 0.048 0.952 0.000
#> GSM1124886     1   0.631     0.3782 0.500 0.500 0.000
#> GSM1124887     2   0.594     0.4915 0.036 0.760 0.204
#> GSM1124894     2   0.642     0.2943 0.304 0.676 0.020
#> GSM1124896     2   0.631    -0.4399 0.496 0.504 0.000
#> GSM1124899     2   0.175     0.6606 0.048 0.952 0.000
#> GSM1124901     2   0.141     0.6579 0.036 0.964 0.000
#> GSM1124906     2   0.280     0.6499 0.092 0.908 0.000
#> GSM1124907     2   0.206     0.6575 0.044 0.948 0.008
#> GSM1124911     2   0.207     0.6629 0.060 0.940 0.000
#> GSM1124912     2   0.631    -0.4399 0.496 0.504 0.000
#> GSM1124915     2   0.186     0.6635 0.052 0.948 0.000
#> GSM1124917     2   0.327     0.6623 0.080 0.904 0.016
#> GSM1124918     2   0.228     0.6615 0.052 0.940 0.008
#> GSM1124920     3   0.819     0.5501 0.372 0.080 0.548
#> GSM1124922     2   0.196     0.6629 0.056 0.944 0.000
#> GSM1124924     2   0.768     0.1402 0.328 0.608 0.064
#> GSM1124926     2   0.175     0.6606 0.048 0.952 0.000
#> GSM1124928     2   0.691     0.2319 0.308 0.656 0.036
#> GSM1124930     2   0.228     0.6575 0.052 0.940 0.008
#> GSM1124931     2   0.440     0.5614 0.188 0.812 0.000
#> GSM1124935     2   0.175     0.6631 0.048 0.952 0.000
#> GSM1124936     3   0.864     0.3705 0.440 0.100 0.460
#> GSM1124938     2   0.516     0.5620 0.140 0.820 0.040
#> GSM1124940     2   0.631    -0.4399 0.496 0.504 0.000
#> GSM1124941     2   0.280     0.6499 0.092 0.908 0.000
#> GSM1124942     2   0.228     0.6575 0.052 0.940 0.008
#> GSM1124943     2   0.228     0.6575 0.052 0.940 0.008
#> GSM1124948     2   0.719     0.2860 0.280 0.664 0.056
#> GSM1124949     1   0.631     0.3918 0.504 0.496 0.000
#> GSM1124950     2   0.440     0.5598 0.188 0.812 0.000
#> GSM1124954     1   0.460     0.5581 0.796 0.204 0.000
#> GSM1124955     2   0.631    -0.4399 0.496 0.504 0.000
#> GSM1124956     2   0.207     0.6629 0.060 0.940 0.000
#> GSM1124872     2   0.440     0.5598 0.188 0.812 0.000
#> GSM1124873     2   0.296     0.6452 0.100 0.900 0.000
#> GSM1124876     3   0.524     0.7040 0.132 0.048 0.820
#> GSM1124877     1   0.460     0.5581 0.796 0.204 0.000
#> GSM1124879     1   0.623     0.5415 0.564 0.436 0.000
#> GSM1124883     2   0.196     0.6440 0.056 0.944 0.000
#> GSM1124889     2   0.263     0.6573 0.084 0.916 0.000
#> GSM1124892     1   0.960     0.4098 0.476 0.268 0.256
#> GSM1124893     2   0.631    -0.4399 0.496 0.504 0.000
#> GSM1124909     2   0.355     0.6266 0.132 0.868 0.000
#> GSM1124913     2   0.196     0.6440 0.056 0.944 0.000
#> GSM1124916     2   0.355     0.6266 0.132 0.868 0.000
#> GSM1124923     2   0.594     0.4915 0.036 0.760 0.204
#> GSM1124925     2   0.631    -0.4399 0.496 0.504 0.000
#> GSM1124929     2   0.631    -0.4548 0.500 0.500 0.000
#> GSM1124934     1   0.460     0.5581 0.796 0.204 0.000
#> GSM1124937     1   0.628     0.5139 0.540 0.460 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3   0.813      0.446 0.268 0.124 0.540 0.068
#> GSM1124888     3   0.684      0.504 0.372 0.016 0.544 0.068
#> GSM1124890     2   0.462      0.476 0.020 0.760 0.216 0.004
#> GSM1124904     2   0.320      0.549 0.036 0.892 0.060 0.012
#> GSM1124927     2   0.541      0.563 0.296 0.668 0.036 0.000
#> GSM1124953     2   0.472      0.459 0.020 0.748 0.228 0.004
#> GSM1124869     1   0.172      0.836 0.936 0.064 0.000 0.000
#> GSM1124870     2   0.541      0.563 0.296 0.668 0.036 0.000
#> GSM1124882     1   0.172      0.836 0.936 0.064 0.000 0.000
#> GSM1124884     2   0.370      0.681 0.156 0.828 0.016 0.000
#> GSM1124898     2   0.294      0.608 0.044 0.900 0.052 0.004
#> GSM1124903     2   0.320      0.549 0.036 0.892 0.060 0.012
#> GSM1124905     2   0.651      0.284 0.452 0.492 0.040 0.016
#> GSM1124910     2   0.743      0.272 0.424 0.468 0.068 0.040
#> GSM1124919     2   0.462      0.476 0.020 0.760 0.216 0.004
#> GSM1124932     1   0.838      0.286 0.368 0.252 0.020 0.360
#> GSM1124933     3   0.358      0.690 0.180 0.004 0.816 0.000
#> GSM1124867     2   0.572      0.629 0.184 0.736 0.048 0.032
#> GSM1124868     2   0.469      0.432 0.016 0.804 0.044 0.136
#> GSM1124878     2   0.469      0.432 0.016 0.804 0.044 0.136
#> GSM1124895     4   0.482      0.994 0.000 0.388 0.000 0.612
#> GSM1124897     2   0.469      0.432 0.016 0.804 0.044 0.136
#> GSM1124902     4   0.482      0.994 0.000 0.388 0.000 0.612
#> GSM1124908     4   0.530      0.991 0.004 0.388 0.008 0.600
#> GSM1124921     4   0.530      0.991 0.004 0.388 0.008 0.600
#> GSM1124939     4   0.482      0.994 0.000 0.388 0.000 0.612
#> GSM1124944     4   0.482      0.994 0.000 0.388 0.000 0.612
#> GSM1124945     3   0.253      0.672 0.000 0.004 0.896 0.100
#> GSM1124946     4   0.530      0.991 0.004 0.388 0.008 0.600
#> GSM1124947     4   0.482      0.994 0.000 0.388 0.000 0.612
#> GSM1124951     3   0.253      0.672 0.000 0.004 0.896 0.100
#> GSM1124952     2   0.655     -0.234 0.092 0.568 0.000 0.340
#> GSM1124957     3   0.253      0.672 0.000 0.004 0.896 0.100
#> GSM1124900     2   0.545      0.552 0.304 0.660 0.036 0.000
#> GSM1124914     2   0.540      0.578 0.280 0.684 0.032 0.004
#> GSM1124871     2   0.396      0.684 0.152 0.820 0.028 0.000
#> GSM1124874     2   0.427      0.672 0.188 0.788 0.024 0.000
#> GSM1124875     2   0.297      0.676 0.096 0.884 0.020 0.000
#> GSM1124880     2   0.691      0.427 0.384 0.532 0.064 0.020
#> GSM1124881     2   0.386      0.686 0.152 0.824 0.024 0.000
#> GSM1124885     2   0.276      0.572 0.028 0.912 0.048 0.012
#> GSM1124886     1   0.190      0.835 0.932 0.064 0.000 0.004
#> GSM1124887     2   0.462      0.476 0.020 0.760 0.216 0.004
#> GSM1124894     2   0.685      0.328 0.420 0.504 0.056 0.020
#> GSM1124896     1   0.172      0.836 0.936 0.064 0.000 0.000
#> GSM1124899     2   0.233      0.685 0.088 0.908 0.004 0.000
#> GSM1124901     2   0.212      0.651 0.052 0.932 0.012 0.004
#> GSM1124906     2   0.381      0.687 0.156 0.824 0.020 0.000
#> GSM1124907     2   0.308      0.665 0.084 0.884 0.032 0.000
#> GSM1124911     2   0.286      0.687 0.096 0.888 0.016 0.000
#> GSM1124912     1   0.172      0.836 0.936 0.064 0.000 0.000
#> GSM1124915     2   0.326      0.678 0.096 0.876 0.024 0.004
#> GSM1124917     2   0.349      0.694 0.104 0.864 0.028 0.004
#> GSM1124918     2   0.299      0.686 0.104 0.880 0.016 0.000
#> GSM1124920     3   0.684      0.504 0.372 0.016 0.544 0.068
#> GSM1124922     2   0.220      0.677 0.080 0.916 0.004 0.000
#> GSM1124924     2   0.772      0.389 0.372 0.492 0.096 0.040
#> GSM1124926     2   0.233      0.685 0.088 0.908 0.004 0.000
#> GSM1124928     2   0.676      0.396 0.408 0.520 0.052 0.020
#> GSM1124930     2   0.284      0.667 0.088 0.892 0.020 0.000
#> GSM1124931     2   0.511      0.602 0.252 0.712 0.036 0.000
#> GSM1124935     2   0.308      0.683 0.096 0.880 0.024 0.000
#> GSM1124936     3   0.714      0.291 0.452 0.024 0.456 0.068
#> GSM1124938     2   0.540      0.599 0.140 0.772 0.052 0.036
#> GSM1124940     1   0.172      0.836 0.936 0.064 0.000 0.000
#> GSM1124941     2   0.381      0.687 0.156 0.824 0.020 0.000
#> GSM1124942     2   0.284      0.667 0.088 0.892 0.020 0.000
#> GSM1124943     2   0.284      0.667 0.088 0.892 0.020 0.000
#> GSM1124948     2   0.746      0.442 0.340 0.536 0.088 0.036
#> GSM1124949     1   0.205      0.833 0.928 0.064 0.000 0.008
#> GSM1124950     2   0.531      0.582 0.280 0.684 0.036 0.000
#> GSM1124954     1   0.588      0.506 0.572 0.040 0.000 0.388
#> GSM1124955     1   0.172      0.836 0.936 0.064 0.000 0.000
#> GSM1124956     2   0.286      0.687 0.096 0.888 0.016 0.000
#> GSM1124872     2   0.531      0.582 0.280 0.684 0.036 0.000
#> GSM1124873     2   0.374      0.686 0.160 0.824 0.016 0.000
#> GSM1124876     3   0.358      0.690 0.180 0.004 0.816 0.000
#> GSM1124877     1   0.581      0.508 0.576 0.036 0.000 0.388
#> GSM1124879     1   0.309      0.793 0.888 0.056 0.000 0.056
#> GSM1124883     2   0.320      0.549 0.036 0.892 0.060 0.012
#> GSM1124889     2   0.383      0.691 0.152 0.828 0.016 0.004
#> GSM1124892     1   0.651      0.328 0.656 0.032 0.252 0.060
#> GSM1124893     1   0.172      0.836 0.936 0.064 0.000 0.000
#> GSM1124909     2   0.435      0.669 0.196 0.780 0.024 0.000
#> GSM1124913     2   0.320      0.549 0.036 0.892 0.060 0.012
#> GSM1124916     2   0.435      0.669 0.196 0.780 0.024 0.000
#> GSM1124923     2   0.462      0.476 0.020 0.760 0.216 0.004
#> GSM1124925     1   0.172      0.836 0.936 0.064 0.000 0.000
#> GSM1124929     1   0.190      0.835 0.932 0.064 0.000 0.004
#> GSM1124934     1   0.588      0.506 0.572 0.040 0.000 0.388
#> GSM1124937     1   0.503      0.730 0.796 0.116 0.024 0.064

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1124891     3  0.8221      0.378 0.152 0.116 0.516 0.048 0.168
#> GSM1124888     3  0.7108      0.530 0.288 0.020 0.544 0.048 0.100
#> GSM1124890     2  0.4580      0.661 0.008 0.740 0.200 0.000 0.052
#> GSM1124904     2  0.3379      0.724 0.016 0.828 0.000 0.008 0.148
#> GSM1124927     2  0.5490      0.671 0.200 0.652 0.000 0.000 0.148
#> GSM1124953     2  0.4674      0.648 0.008 0.728 0.212 0.000 0.052
#> GSM1124869     1  0.0955      0.782 0.968 0.028 0.000 0.000 0.004
#> GSM1124870     2  0.5490      0.671 0.200 0.652 0.000 0.000 0.148
#> GSM1124882     1  0.0794      0.782 0.972 0.028 0.000 0.000 0.000
#> GSM1124884     2  0.3888      0.772 0.136 0.800 0.000 0.000 0.064
#> GSM1124898     2  0.3340      0.751 0.032 0.840 0.000 0.004 0.124
#> GSM1124903     2  0.3379      0.724 0.016 0.828 0.000 0.008 0.148
#> GSM1124905     1  0.8189      0.106 0.396 0.300 0.004 0.136 0.164
#> GSM1124910     2  0.7686      0.308 0.324 0.448 0.044 0.020 0.164
#> GSM1124919     2  0.4580      0.661 0.008 0.740 0.200 0.000 0.052
#> GSM1124932     5  0.5190      0.443 0.096 0.236 0.000 0.000 0.668
#> GSM1124933     3  0.3048      0.648 0.176 0.000 0.820 0.000 0.004
#> GSM1124867     2  0.5520      0.744 0.172 0.712 0.064 0.004 0.048
#> GSM1124868     2  0.5058      0.715 0.008 0.768 0.064 0.104 0.056
#> GSM1124878     2  0.5058      0.715 0.008 0.768 0.064 0.104 0.056
#> GSM1124895     4  0.1197      0.986 0.000 0.048 0.000 0.952 0.000
#> GSM1124897     2  0.5058      0.715 0.008 0.768 0.064 0.104 0.056
#> GSM1124902     4  0.1197      0.986 0.000 0.048 0.000 0.952 0.000
#> GSM1124908     4  0.2053      0.977 0.000 0.048 0.024 0.924 0.004
#> GSM1124921     4  0.2308      0.967 0.000 0.048 0.036 0.912 0.004
#> GSM1124939     4  0.1197      0.986 0.000 0.048 0.000 0.952 0.000
#> GSM1124944     4  0.1197      0.986 0.000 0.048 0.000 0.952 0.000
#> GSM1124945     3  0.0162      0.623 0.000 0.000 0.996 0.004 0.000
#> GSM1124946     4  0.2053      0.977 0.000 0.048 0.024 0.924 0.004
#> GSM1124947     4  0.1197      0.986 0.000 0.048 0.000 0.952 0.000
#> GSM1124951     3  0.0162      0.623 0.000 0.000 0.996 0.004 0.000
#> GSM1124952     2  0.6473      0.448 0.092 0.532 0.000 0.340 0.036
#> GSM1124957     3  0.0162      0.623 0.000 0.000 0.996 0.004 0.000
#> GSM1124900     2  0.5575      0.659 0.224 0.648 0.004 0.000 0.124
#> GSM1124914     2  0.5818      0.692 0.220 0.636 0.004 0.004 0.136
#> GSM1124871     2  0.3857      0.781 0.084 0.808 0.000 0.000 0.108
#> GSM1124874     2  0.4017      0.766 0.148 0.788 0.000 0.000 0.064
#> GSM1124875     2  0.2952      0.780 0.088 0.872 0.004 0.000 0.036
#> GSM1124880     2  0.7069      0.473 0.272 0.512 0.032 0.004 0.180
#> GSM1124881     2  0.3507      0.781 0.120 0.828 0.000 0.000 0.052
#> GSM1124885     2  0.3059      0.740 0.016 0.856 0.000 0.008 0.120
#> GSM1124886     1  0.1195      0.777 0.960 0.028 0.000 0.000 0.012
#> GSM1124887     2  0.4580      0.661 0.008 0.740 0.200 0.000 0.052
#> GSM1124894     1  0.8617      0.072 0.360 0.308 0.020 0.140 0.172
#> GSM1124896     1  0.0955      0.781 0.968 0.028 0.000 0.000 0.004
#> GSM1124899     2  0.2208      0.787 0.072 0.908 0.000 0.000 0.020
#> GSM1124901     2  0.2214      0.778 0.028 0.916 0.000 0.004 0.052
#> GSM1124906     2  0.3413      0.782 0.124 0.832 0.000 0.000 0.044
#> GSM1124907     2  0.3142      0.774 0.076 0.864 0.004 0.000 0.056
#> GSM1124911     2  0.2654      0.785 0.048 0.888 0.000 0.000 0.064
#> GSM1124912     1  0.0794      0.782 0.972 0.028 0.000 0.000 0.000
#> GSM1124915     2  0.2888      0.783 0.056 0.880 0.000 0.004 0.060
#> GSM1124917     2  0.3383      0.796 0.072 0.856 0.012 0.000 0.060
#> GSM1124918     2  0.2608      0.787 0.088 0.888 0.004 0.000 0.020
#> GSM1124920     3  0.7108      0.530 0.288 0.020 0.544 0.048 0.100
#> GSM1124922     2  0.2726      0.787 0.052 0.884 0.000 0.000 0.064
#> GSM1124924     2  0.7882      0.417 0.224 0.476 0.060 0.020 0.220
#> GSM1124926     2  0.2208      0.787 0.072 0.908 0.000 0.000 0.020
#> GSM1124928     2  0.7041      0.411 0.312 0.496 0.032 0.004 0.156
#> GSM1124930     2  0.2989      0.774 0.080 0.872 0.004 0.000 0.044
#> GSM1124931     2  0.5159      0.703 0.124 0.688 0.000 0.000 0.188
#> GSM1124935     2  0.2927      0.783 0.060 0.872 0.000 0.000 0.068
#> GSM1124936     3  0.7151      0.371 0.392 0.016 0.456 0.048 0.088
#> GSM1124938     2  0.5331      0.705 0.116 0.752 0.036 0.020 0.076
#> GSM1124940     1  0.0955      0.782 0.968 0.028 0.000 0.000 0.004
#> GSM1124941     2  0.3413      0.782 0.124 0.832 0.000 0.000 0.044
#> GSM1124942     2  0.2989      0.774 0.080 0.872 0.004 0.000 0.044
#> GSM1124943     2  0.2989      0.774 0.080 0.872 0.004 0.000 0.044
#> GSM1124948     2  0.7536      0.494 0.204 0.528 0.052 0.020 0.196
#> GSM1124949     1  0.2067      0.739 0.924 0.028 0.000 0.004 0.044
#> GSM1124950     2  0.5367      0.686 0.184 0.668 0.000 0.000 0.148
#> GSM1124954     5  0.4400      0.784 0.308 0.020 0.000 0.000 0.672
#> GSM1124955     1  0.0955      0.781 0.968 0.028 0.000 0.000 0.004
#> GSM1124956     2  0.2654      0.785 0.048 0.888 0.000 0.000 0.064
#> GSM1124872     2  0.5367      0.686 0.184 0.668 0.000 0.000 0.148
#> GSM1124873     2  0.3507      0.781 0.120 0.828 0.000 0.000 0.052
#> GSM1124876     3  0.3048      0.648 0.176 0.000 0.820 0.000 0.004
#> GSM1124877     5  0.4251      0.772 0.316 0.012 0.000 0.000 0.672
#> GSM1124879     1  0.2492      0.723 0.908 0.024 0.000 0.048 0.020
#> GSM1124883     2  0.3379      0.724 0.016 0.828 0.000 0.008 0.148
#> GSM1124889     2  0.3567      0.786 0.112 0.832 0.000 0.004 0.052
#> GSM1124892     1  0.6542      0.109 0.608 0.016 0.252 0.040 0.084
#> GSM1124893     1  0.0955      0.782 0.968 0.028 0.000 0.000 0.004
#> GSM1124909     2  0.4127      0.766 0.136 0.784 0.000 0.000 0.080
#> GSM1124913     2  0.3336      0.727 0.016 0.832 0.000 0.008 0.144
#> GSM1124916     2  0.4127      0.766 0.136 0.784 0.000 0.000 0.080
#> GSM1124923     2  0.4580      0.661 0.008 0.740 0.200 0.000 0.052
#> GSM1124925     1  0.0955      0.781 0.968 0.028 0.000 0.000 0.004
#> GSM1124929     1  0.1907      0.741 0.928 0.028 0.000 0.000 0.044
#> GSM1124934     5  0.4400      0.784 0.308 0.020 0.000 0.000 0.672
#> GSM1124937     1  0.5297      0.523 0.744 0.092 0.004 0.048 0.112

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.7432     0.4442 0.064 0.108 0.488 0.000 0.248 0.092
#> GSM1124888     3  0.7057     0.5745 0.196 0.020 0.520 0.000 0.164 0.100
#> GSM1124890     2  0.5507     0.3934 0.000 0.596 0.180 0.000 0.216 0.008
#> GSM1124904     2  0.4591     0.4188 0.000 0.552 0.000 0.000 0.408 0.040
#> GSM1124927     2  0.6013     0.4664 0.128 0.612 0.000 0.000 0.176 0.084
#> GSM1124953     2  0.5606     0.3709 0.000 0.580 0.192 0.000 0.220 0.008
#> GSM1124869     1  0.0405     0.8062 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM1124870     2  0.6013     0.4664 0.128 0.612 0.000 0.000 0.176 0.084
#> GSM1124882     1  0.0405     0.8055 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM1124884     2  0.4540     0.5798 0.084 0.744 0.000 0.000 0.140 0.032
#> GSM1124898     2  0.4435     0.5276 0.012 0.664 0.000 0.000 0.292 0.032
#> GSM1124903     2  0.4591     0.4188 0.000 0.552 0.000 0.000 0.408 0.040
#> GSM1124905     1  0.8437    -0.9345 0.312 0.128 0.000 0.108 0.304 0.148
#> GSM1124910     2  0.7834    -0.1107 0.224 0.340 0.028 0.000 0.300 0.108
#> GSM1124919     2  0.5507     0.3934 0.000 0.596 0.180 0.000 0.216 0.008
#> GSM1124932     6  0.4419     0.3002 0.020 0.244 0.000 0.000 0.036 0.700
#> GSM1124933     3  0.2981     0.6586 0.160 0.000 0.820 0.000 0.000 0.020
#> GSM1124867     2  0.5466     0.5670 0.108 0.700 0.068 0.000 0.108 0.016
#> GSM1124868     2  0.5945     0.4775 0.000 0.584 0.068 0.092 0.256 0.000
#> GSM1124878     2  0.5945     0.4775 0.000 0.584 0.068 0.092 0.256 0.000
#> GSM1124895     4  0.0000     0.9816 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124897     2  0.5945     0.4775 0.000 0.584 0.068 0.092 0.256 0.000
#> GSM1124902     4  0.0000     0.9816 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124908     4  0.0858     0.9699 0.000 0.000 0.028 0.968 0.004 0.000
#> GSM1124921     4  0.1082     0.9589 0.000 0.000 0.040 0.956 0.004 0.000
#> GSM1124939     4  0.0000     0.9816 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0000     0.9816 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124945     3  0.0000     0.6370 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124946     4  0.0858     0.9699 0.000 0.000 0.028 0.968 0.004 0.000
#> GSM1124947     4  0.0000     0.9816 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124951     3  0.0000     0.6370 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124952     2  0.6910     0.0636 0.060 0.460 0.000 0.340 0.112 0.028
#> GSM1124957     3  0.0000     0.6370 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     2  0.6017     0.4584 0.144 0.612 0.000 0.000 0.164 0.080
#> GSM1124914     2  0.6124     0.4280 0.168 0.520 0.000 0.000 0.284 0.028
#> GSM1124871     2  0.4822     0.6132 0.060 0.704 0.000 0.000 0.196 0.040
#> GSM1124874     2  0.4250     0.6062 0.092 0.760 0.000 0.000 0.132 0.016
#> GSM1124875     2  0.3665     0.5911 0.052 0.800 0.000 0.000 0.136 0.012
#> GSM1124880     2  0.7492     0.0934 0.164 0.408 0.016 0.000 0.292 0.120
#> GSM1124881     2  0.3677     0.6279 0.064 0.804 0.000 0.000 0.120 0.012
#> GSM1124885     2  0.4170     0.5198 0.000 0.660 0.000 0.000 0.308 0.032
#> GSM1124886     1  0.0881     0.8002 0.972 0.008 0.000 0.000 0.008 0.012
#> GSM1124887     2  0.5507     0.3934 0.000 0.596 0.180 0.000 0.216 0.008
#> GSM1124894     5  0.8800     0.0000 0.276 0.132 0.012 0.112 0.308 0.160
#> GSM1124896     1  0.0405     0.8042 0.988 0.008 0.000 0.000 0.004 0.000
#> GSM1124899     2  0.3054     0.6240 0.036 0.828 0.000 0.000 0.136 0.000
#> GSM1124901     2  0.3459     0.5826 0.016 0.768 0.000 0.000 0.212 0.004
#> GSM1124906     2  0.3270     0.6241 0.072 0.836 0.000 0.000 0.084 0.008
#> GSM1124907     2  0.3900     0.5601 0.044 0.760 0.000 0.000 0.188 0.008
#> GSM1124911     2  0.3299     0.6303 0.028 0.844 0.000 0.000 0.080 0.048
#> GSM1124912     1  0.0260     0.8055 0.992 0.008 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.3713     0.6208 0.032 0.812 0.000 0.000 0.108 0.048
#> GSM1124917     2  0.3416     0.6405 0.036 0.812 0.004 0.000 0.144 0.004
#> GSM1124918     2  0.3548     0.6000 0.052 0.816 0.000 0.000 0.116 0.016
#> GSM1124920     3  0.7057     0.5745 0.196 0.020 0.520 0.000 0.164 0.100
#> GSM1124922     2  0.2968     0.6333 0.028 0.840 0.000 0.000 0.128 0.004
#> GSM1124924     2  0.7726    -0.0268 0.112 0.360 0.040 0.000 0.348 0.140
#> GSM1124926     2  0.3054     0.6240 0.036 0.828 0.000 0.000 0.136 0.000
#> GSM1124928     2  0.7489     0.0320 0.212 0.400 0.016 0.000 0.276 0.096
#> GSM1124930     2  0.3934     0.5597 0.044 0.764 0.000 0.000 0.180 0.012
#> GSM1124931     2  0.5727     0.5138 0.064 0.640 0.000 0.000 0.160 0.136
#> GSM1124935     2  0.3791     0.6209 0.032 0.808 0.000 0.000 0.104 0.056
#> GSM1124936     3  0.7174     0.4452 0.308 0.012 0.436 0.000 0.148 0.096
#> GSM1124938     2  0.5138     0.4284 0.044 0.644 0.016 0.000 0.276 0.020
#> GSM1124940     1  0.0405     0.8062 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM1124941     2  0.3270     0.6241 0.072 0.836 0.000 0.000 0.084 0.008
#> GSM1124942     2  0.3934     0.5597 0.044 0.764 0.000 0.000 0.180 0.012
#> GSM1124943     2  0.3934     0.5597 0.044 0.764 0.000 0.000 0.180 0.012
#> GSM1124948     2  0.7399     0.1031 0.100 0.416 0.032 0.000 0.332 0.120
#> GSM1124949     1  0.2136     0.7570 0.908 0.012 0.000 0.000 0.016 0.064
#> GSM1124950     2  0.5702     0.4930 0.112 0.648 0.000 0.000 0.160 0.080
#> GSM1124954     6  0.3171     0.7925 0.204 0.012 0.000 0.000 0.000 0.784
#> GSM1124955     1  0.0405     0.8042 0.988 0.008 0.000 0.000 0.004 0.000
#> GSM1124956     2  0.3299     0.6303 0.028 0.844 0.000 0.000 0.080 0.048
#> GSM1124872     2  0.5702     0.4930 0.112 0.648 0.000 0.000 0.160 0.080
#> GSM1124873     2  0.3548     0.6284 0.068 0.812 0.000 0.000 0.112 0.008
#> GSM1124876     3  0.2981     0.6586 0.160 0.000 0.820 0.000 0.000 0.020
#> GSM1124877     6  0.3133     0.7829 0.212 0.008 0.000 0.000 0.000 0.780
#> GSM1124879     1  0.2712     0.6923 0.864 0.012 0.000 0.000 0.108 0.016
#> GSM1124883     2  0.4591     0.4188 0.000 0.552 0.000 0.000 0.408 0.040
#> GSM1124889     2  0.3513     0.6355 0.072 0.816 0.000 0.000 0.104 0.008
#> GSM1124892     1  0.6735     0.0525 0.532 0.012 0.240 0.000 0.132 0.084
#> GSM1124893     1  0.0405     0.8062 0.988 0.008 0.000 0.000 0.000 0.004
#> GSM1124909     2  0.3809     0.6098 0.080 0.808 0.000 0.000 0.084 0.028
#> GSM1124913     2  0.4524     0.4281 0.000 0.560 0.000 0.000 0.404 0.036
#> GSM1124916     2  0.3809     0.6098 0.080 0.808 0.000 0.000 0.084 0.028
#> GSM1124923     2  0.5507     0.3934 0.000 0.596 0.180 0.000 0.216 0.008
#> GSM1124925     1  0.0405     0.8042 0.988 0.008 0.000 0.000 0.004 0.000
#> GSM1124929     1  0.1983     0.7616 0.916 0.012 0.000 0.000 0.012 0.060
#> GSM1124934     6  0.3171     0.7925 0.204 0.012 0.000 0.000 0.000 0.784
#> GSM1124937     1  0.5704     0.2648 0.624 0.104 0.000 0.000 0.216 0.056

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 tissue(p) k
#> CV:hclust 86  6.87e-02 2
#> CV:hclust 56  4.59e-02 3
#> CV:hclust 71  1.41e-07 4
#> CV:hclust 79  5.09e-05 5
#> CV:hclust 59  4.87e-07 6

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


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

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.426           0.842       0.855         0.4283 0.546   0.546
#> 3 3 0.676           0.744       0.855         0.4046 0.839   0.713
#> 4 4 0.605           0.645       0.786         0.1701 0.879   0.718
#> 5 5 0.595           0.637       0.758         0.0907 0.821   0.505
#> 6 6 0.665           0.574       0.765         0.0553 0.929   0.709

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.6343      0.914 0.840 0.160
#> GSM1124888     1  0.6343      0.914 0.840 0.160
#> GSM1124890     2  0.9087      0.481 0.324 0.676
#> GSM1124904     2  0.1184      0.862 0.016 0.984
#> GSM1124927     2  0.8327      0.548 0.264 0.736
#> GSM1124953     2  0.4690      0.836 0.100 0.900
#> GSM1124869     1  0.7883      0.951 0.764 0.236
#> GSM1124870     1  0.7883      0.951 0.764 0.236
#> GSM1124882     1  0.7883      0.951 0.764 0.236
#> GSM1124884     2  0.3733      0.856 0.072 0.928
#> GSM1124898     2  0.0376      0.866 0.004 0.996
#> GSM1124903     2  0.0000      0.865 0.000 1.000
#> GSM1124905     1  0.7883      0.951 0.764 0.236
#> GSM1124910     1  0.7219      0.941 0.800 0.200
#> GSM1124919     2  0.3584      0.850 0.068 0.932
#> GSM1124932     2  0.4431      0.853 0.092 0.908
#> GSM1124933     1  0.6343      0.914 0.840 0.160
#> GSM1124867     2  0.3584      0.858 0.068 0.932
#> GSM1124868     2  0.5842      0.787 0.140 0.860
#> GSM1124878     2  0.5408      0.799 0.124 0.876
#> GSM1124895     2  0.6343      0.780 0.160 0.840
#> GSM1124897     2  0.6247      0.782 0.156 0.844
#> GSM1124902     2  0.6343      0.780 0.160 0.840
#> GSM1124908     2  0.6343      0.780 0.160 0.840
#> GSM1124921     2  0.6343      0.780 0.160 0.840
#> GSM1124939     2  0.6343      0.780 0.160 0.840
#> GSM1124944     2  0.6343      0.780 0.160 0.840
#> GSM1124945     2  0.9909      0.443 0.444 0.556
#> GSM1124946     2  0.6343      0.780 0.160 0.840
#> GSM1124947     2  0.6343      0.780 0.160 0.840
#> GSM1124951     2  0.9909      0.443 0.444 0.556
#> GSM1124952     2  0.6343      0.780 0.160 0.840
#> GSM1124957     1  0.7376      0.547 0.792 0.208
#> GSM1124900     1  0.7883      0.951 0.764 0.236
#> GSM1124914     2  0.0376      0.866 0.004 0.996
#> GSM1124871     2  0.2043      0.865 0.032 0.968
#> GSM1124874     2  0.3879      0.854 0.076 0.924
#> GSM1124875     2  0.1414      0.866 0.020 0.980
#> GSM1124880     1  0.7883      0.951 0.764 0.236
#> GSM1124881     2  0.3879      0.854 0.076 0.924
#> GSM1124885     2  0.0376      0.866 0.004 0.996
#> GSM1124886     1  0.7139      0.939 0.804 0.196
#> GSM1124887     2  0.1414      0.861 0.020 0.980
#> GSM1124894     2  0.3584      0.858 0.068 0.932
#> GSM1124896     1  0.7883      0.951 0.764 0.236
#> GSM1124899     2  0.3879      0.854 0.076 0.924
#> GSM1124901     2  0.0938      0.866 0.012 0.988
#> GSM1124906     2  0.3879      0.854 0.076 0.924
#> GSM1124907     2  0.1414      0.861 0.020 0.980
#> GSM1124911     2  0.4431      0.853 0.092 0.908
#> GSM1124912     1  0.7883      0.951 0.764 0.236
#> GSM1124915     2  0.2043      0.866 0.032 0.968
#> GSM1124917     2  0.2043      0.866 0.032 0.968
#> GSM1124918     2  0.4431      0.853 0.092 0.908
#> GSM1124920     1  0.6247      0.916 0.844 0.156
#> GSM1124922     2  0.3879      0.854 0.076 0.924
#> GSM1124924     1  0.7139      0.940 0.804 0.196
#> GSM1124926     2  0.3879      0.854 0.076 0.924
#> GSM1124928     1  0.7883      0.951 0.764 0.236
#> GSM1124930     2  0.2948      0.863 0.052 0.948
#> GSM1124931     2  0.4431      0.853 0.092 0.908
#> GSM1124935     2  0.2423      0.866 0.040 0.960
#> GSM1124936     1  0.6247      0.916 0.844 0.156
#> GSM1124938     2  0.9686      0.343 0.396 0.604
#> GSM1124940     1  0.7883      0.951 0.764 0.236
#> GSM1124941     2  0.3879      0.854 0.076 0.924
#> GSM1124942     2  0.3114      0.861 0.056 0.944
#> GSM1124943     2  0.7883      0.674 0.236 0.764
#> GSM1124948     2  0.9491      0.393 0.368 0.632
#> GSM1124949     1  0.7883      0.951 0.764 0.236
#> GSM1124950     2  0.3879      0.854 0.076 0.924
#> GSM1124954     1  0.6801      0.932 0.820 0.180
#> GSM1124955     1  0.7883      0.951 0.764 0.236
#> GSM1124956     2  0.4431      0.853 0.092 0.908
#> GSM1124872     2  0.3879      0.854 0.076 0.924
#> GSM1124873     2  0.3879      0.854 0.076 0.924
#> GSM1124876     1  0.6343      0.914 0.840 0.160
#> GSM1124877     1  0.7602      0.941 0.780 0.220
#> GSM1124879     1  0.7883      0.951 0.764 0.236
#> GSM1124883     2  0.0000      0.865 0.000 1.000
#> GSM1124889     2  0.3879      0.854 0.076 0.924
#> GSM1124892     1  0.6712      0.926 0.824 0.176
#> GSM1124893     1  0.7883      0.951 0.764 0.236
#> GSM1124909     2  0.3879      0.854 0.076 0.924
#> GSM1124913     2  0.0000      0.865 0.000 1.000
#> GSM1124916     2  0.4431      0.853 0.092 0.908
#> GSM1124923     2  0.4022      0.832 0.080 0.920
#> GSM1124925     1  0.7883      0.951 0.764 0.236
#> GSM1124929     1  0.7883      0.951 0.764 0.236
#> GSM1124934     1  0.6801      0.932 0.820 0.180
#> GSM1124937     1  0.7883      0.951 0.764 0.236

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     1  0.6490     0.6114 0.628 0.012 0.360
#> GSM1124888     1  0.6490     0.6114 0.628 0.012 0.360
#> GSM1124890     2  0.7517     0.3101 0.040 0.540 0.420
#> GSM1124904     2  0.1964     0.7700 0.000 0.944 0.056
#> GSM1124927     2  0.4475     0.7024 0.144 0.840 0.016
#> GSM1124953     2  0.6421     0.3560 0.004 0.572 0.424
#> GSM1124869     1  0.0424     0.9119 0.992 0.008 0.000
#> GSM1124870     1  0.3183     0.8491 0.908 0.076 0.016
#> GSM1124882     1  0.0424     0.9119 0.992 0.008 0.000
#> GSM1124884     2  0.0892     0.8056 0.020 0.980 0.000
#> GSM1124898     2  0.0000     0.8001 0.000 1.000 0.000
#> GSM1124903     2  0.1964     0.7700 0.000 0.944 0.056
#> GSM1124905     1  0.0661     0.9114 0.988 0.008 0.004
#> GSM1124910     1  0.0475     0.9108 0.992 0.004 0.004
#> GSM1124919     2  0.5956     0.4963 0.004 0.672 0.324
#> GSM1124932     2  0.3148     0.7950 0.048 0.916 0.036
#> GSM1124933     1  0.6566     0.5889 0.612 0.012 0.376
#> GSM1124867     2  0.1878     0.8083 0.044 0.952 0.004
#> GSM1124868     2  0.5431     0.2774 0.000 0.716 0.284
#> GSM1124878     2  0.2066     0.7662 0.000 0.940 0.060
#> GSM1124895     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124897     2  0.2165     0.7632 0.000 0.936 0.064
#> GSM1124902     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124908     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124921     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124939     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124944     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124945     3  0.3028     0.5047 0.048 0.032 0.920
#> GSM1124946     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124947     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124951     3  0.2918     0.5090 0.044 0.032 0.924
#> GSM1124952     3  0.6111     0.8022 0.000 0.396 0.604
#> GSM1124957     3  0.3120     0.4574 0.080 0.012 0.908
#> GSM1124900     1  0.3091     0.8537 0.912 0.072 0.016
#> GSM1124914     2  0.0592     0.7962 0.000 0.988 0.012
#> GSM1124871     2  0.0424     0.8038 0.008 0.992 0.000
#> GSM1124874     2  0.1643     0.8080 0.044 0.956 0.000
#> GSM1124875     2  0.1170     0.8056 0.008 0.976 0.016
#> GSM1124880     1  0.2096     0.8789 0.944 0.052 0.004
#> GSM1124881     2  0.1878     0.8083 0.044 0.952 0.004
#> GSM1124885     2  0.1860     0.7732 0.000 0.948 0.052
#> GSM1124886     1  0.0475     0.9108 0.992 0.004 0.004
#> GSM1124887     2  0.2066     0.7750 0.000 0.940 0.060
#> GSM1124894     2  0.6899     0.2001 0.364 0.612 0.024
#> GSM1124896     1  0.0661     0.9114 0.988 0.008 0.004
#> GSM1124899     2  0.1643     0.8080 0.044 0.956 0.000
#> GSM1124901     2  0.0000     0.8001 0.000 1.000 0.000
#> GSM1124906     2  0.1878     0.8083 0.044 0.952 0.004
#> GSM1124907     2  0.2772     0.7605 0.004 0.916 0.080
#> GSM1124911     2  0.3028     0.7955 0.048 0.920 0.032
#> GSM1124912     1  0.0424     0.9119 0.992 0.008 0.000
#> GSM1124915     2  0.1399     0.7983 0.004 0.968 0.028
#> GSM1124917     2  0.0829     0.8064 0.012 0.984 0.004
#> GSM1124918     2  0.3148     0.7962 0.036 0.916 0.048
#> GSM1124920     1  0.5254     0.7218 0.736 0.000 0.264
#> GSM1124922     2  0.1643     0.8080 0.044 0.956 0.000
#> GSM1124924     2  0.9998    -0.0321 0.336 0.340 0.324
#> GSM1124926     2  0.0892     0.8056 0.020 0.980 0.000
#> GSM1124928     1  0.0424     0.9119 0.992 0.008 0.000
#> GSM1124930     2  0.4931     0.6474 0.004 0.784 0.212
#> GSM1124931     2  0.3148     0.7950 0.048 0.916 0.036
#> GSM1124935     2  0.2031     0.8010 0.016 0.952 0.032
#> GSM1124936     1  0.5016     0.7431 0.760 0.000 0.240
#> GSM1124938     2  0.7931     0.2910 0.060 0.528 0.412
#> GSM1124940     1  0.0424     0.9119 0.992 0.008 0.000
#> GSM1124941     2  0.2063     0.8085 0.044 0.948 0.008
#> GSM1124942     2  0.4931     0.6474 0.004 0.784 0.212
#> GSM1124943     2  0.7213     0.3290 0.028 0.552 0.420
#> GSM1124948     2  0.7676     0.3635 0.056 0.584 0.360
#> GSM1124949     1  0.0424     0.9119 0.992 0.008 0.000
#> GSM1124950     2  0.1878     0.8083 0.044 0.952 0.004
#> GSM1124954     1  0.1525     0.8973 0.964 0.004 0.032
#> GSM1124955     1  0.0661     0.9114 0.988 0.008 0.004
#> GSM1124956     2  0.3028     0.7955 0.048 0.920 0.032
#> GSM1124872     2  0.2383     0.8053 0.044 0.940 0.016
#> GSM1124873     2  0.1878     0.8083 0.044 0.952 0.004
#> GSM1124876     1  0.6490     0.6114 0.628 0.012 0.360
#> GSM1124877     1  0.1525     0.8973 0.964 0.004 0.032
#> GSM1124879     1  0.0424     0.9119 0.992 0.008 0.000
#> GSM1124883     2  0.1860     0.7732 0.000 0.948 0.052
#> GSM1124889     2  0.1643     0.8080 0.044 0.956 0.000
#> GSM1124892     1  0.0475     0.9108 0.992 0.004 0.004
#> GSM1124893     1  0.0424     0.9119 0.992 0.008 0.000
#> GSM1124909     2  0.2383     0.8053 0.044 0.940 0.016
#> GSM1124913     2  0.1964     0.7700 0.000 0.944 0.056
#> GSM1124916     2  0.3148     0.7950 0.048 0.916 0.036
#> GSM1124923     2  0.6421     0.3565 0.004 0.572 0.424
#> GSM1124925     1  0.0661     0.9114 0.988 0.008 0.004
#> GSM1124929     1  0.0237     0.9110 0.996 0.004 0.000
#> GSM1124934     1  0.1525     0.8973 0.964 0.004 0.032
#> GSM1124937     1  0.0661     0.9114 0.988 0.008 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.5070     0.3720 0.372 0.000 0.620 0.008
#> GSM1124888     3  0.5311     0.3533 0.392 0.004 0.596 0.008
#> GSM1124890     3  0.3479     0.6084 0.012 0.148 0.840 0.000
#> GSM1124904     2  0.7039     0.5306 0.000 0.568 0.256 0.176
#> GSM1124927     2  0.3778     0.6603 0.100 0.848 0.052 0.000
#> GSM1124953     3  0.3448     0.6037 0.000 0.168 0.828 0.004
#> GSM1124869     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124870     1  0.6028     0.4072 0.584 0.364 0.052 0.000
#> GSM1124882     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124884     2  0.0779     0.7363 0.004 0.980 0.000 0.016
#> GSM1124898     2  0.5025     0.6432 0.000 0.716 0.252 0.032
#> GSM1124903     2  0.7039     0.5306 0.000 0.568 0.256 0.176
#> GSM1124905     1  0.2174     0.8249 0.928 0.020 0.052 0.000
#> GSM1124910     1  0.0657     0.8436 0.984 0.000 0.012 0.004
#> GSM1124919     3  0.4978     0.2348 0.000 0.324 0.664 0.012
#> GSM1124932     2  0.4540     0.6543 0.008 0.816 0.104 0.072
#> GSM1124933     3  0.5404     0.4203 0.328 0.028 0.644 0.000
#> GSM1124867     2  0.2142     0.7204 0.016 0.928 0.056 0.000
#> GSM1124868     4  0.7154    -0.0805 0.000 0.428 0.132 0.440
#> GSM1124878     2  0.7138     0.5117 0.000 0.552 0.268 0.180
#> GSM1124895     4  0.2011     0.9161 0.000 0.080 0.000 0.920
#> GSM1124897     2  0.7117     0.5169 0.000 0.556 0.264 0.180
#> GSM1124902     4  0.2011     0.9161 0.000 0.080 0.000 0.920
#> GSM1124908     4  0.2593     0.9070 0.000 0.080 0.016 0.904
#> GSM1124921     4  0.2342     0.9129 0.000 0.080 0.008 0.912
#> GSM1124939     4  0.2011     0.9161 0.000 0.080 0.000 0.920
#> GSM1124944     4  0.2011     0.9161 0.000 0.080 0.000 0.920
#> GSM1124945     3  0.5443     0.3376 0.016 0.004 0.616 0.364
#> GSM1124946     4  0.2197     0.9145 0.000 0.080 0.004 0.916
#> GSM1124947     4  0.2011     0.9161 0.000 0.080 0.000 0.920
#> GSM1124951     3  0.4381     0.5083 0.012 0.008 0.780 0.200
#> GSM1124952     4  0.2011     0.9161 0.000 0.080 0.000 0.920
#> GSM1124957     3  0.5732     0.3377 0.028 0.004 0.604 0.364
#> GSM1124900     1  0.6028     0.4072 0.584 0.364 0.052 0.000
#> GSM1124914     2  0.5648     0.6258 0.000 0.684 0.252 0.064
#> GSM1124871     2  0.0657     0.7363 0.004 0.984 0.000 0.012
#> GSM1124874     2  0.1182     0.7320 0.016 0.968 0.016 0.000
#> GSM1124875     2  0.4571     0.6500 0.008 0.736 0.252 0.004
#> GSM1124880     1  0.6438     0.3687 0.560 0.376 0.056 0.008
#> GSM1124881     2  0.1059     0.7333 0.016 0.972 0.012 0.000
#> GSM1124885     2  0.6756     0.5662 0.000 0.600 0.252 0.148
#> GSM1124886     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124887     2  0.6828     0.5555 0.000 0.588 0.264 0.148
#> GSM1124894     2  0.8566     0.2221 0.280 0.496 0.084 0.140
#> GSM1124896     1  0.0376     0.8499 0.992 0.004 0.004 0.000
#> GSM1124899     2  0.1182     0.7367 0.016 0.968 0.016 0.000
#> GSM1124901     2  0.5025     0.6432 0.000 0.716 0.252 0.032
#> GSM1124906     2  0.0779     0.7346 0.016 0.980 0.004 0.000
#> GSM1124907     2  0.5921     0.5966 0.004 0.652 0.288 0.056
#> GSM1124911     2  0.4020     0.6706 0.008 0.848 0.072 0.072
#> GSM1124912     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124915     2  0.5907     0.6392 0.000 0.668 0.252 0.080
#> GSM1124917     2  0.3538     0.7014 0.004 0.832 0.160 0.004
#> GSM1124918     2  0.4149     0.6695 0.004 0.836 0.088 0.072
#> GSM1124920     1  0.5286     0.2209 0.604 0.004 0.384 0.008
#> GSM1124922     2  0.2222     0.7323 0.016 0.924 0.060 0.000
#> GSM1124924     2  0.6839     0.1186 0.088 0.552 0.352 0.008
#> GSM1124926     2  0.1139     0.7371 0.008 0.972 0.008 0.012
#> GSM1124928     1  0.2189     0.8252 0.932 0.020 0.044 0.004
#> GSM1124930     2  0.5482     0.4453 0.004 0.572 0.412 0.012
#> GSM1124931     2  0.4768     0.6452 0.008 0.800 0.120 0.072
#> GSM1124935     2  0.5850     0.6431 0.000 0.676 0.244 0.080
#> GSM1124936     1  0.4857     0.3934 0.668 0.000 0.324 0.008
#> GSM1124938     3  0.4767     0.5556 0.028 0.196 0.768 0.008
#> GSM1124940     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124941     2  0.0895     0.7347 0.020 0.976 0.004 0.000
#> GSM1124942     2  0.5233     0.4594 0.004 0.580 0.412 0.004
#> GSM1124943     3  0.4514     0.5103 0.008 0.228 0.756 0.008
#> GSM1124948     2  0.6005     0.2187 0.036 0.600 0.356 0.008
#> GSM1124949     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124950     2  0.2089     0.7207 0.020 0.932 0.048 0.000
#> GSM1124954     1  0.5361     0.7169 0.772 0.020 0.128 0.080
#> GSM1124955     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124956     2  0.4020     0.6706 0.008 0.848 0.072 0.072
#> GSM1124872     2  0.1975     0.7209 0.016 0.936 0.048 0.000
#> GSM1124873     2  0.1297     0.7316 0.016 0.964 0.020 0.000
#> GSM1124876     3  0.4817     0.3650 0.388 0.000 0.612 0.000
#> GSM1124877     1  0.4148     0.7466 0.844 0.012 0.072 0.072
#> GSM1124879     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124883     2  0.7005     0.5355 0.000 0.572 0.256 0.172
#> GSM1124889     2  0.0592     0.7349 0.016 0.984 0.000 0.000
#> GSM1124892     1  0.0376     0.8487 0.992 0.004 0.004 0.000
#> GSM1124893     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124909     2  0.1888     0.7227 0.016 0.940 0.044 0.000
#> GSM1124913     2  0.7005     0.5363 0.000 0.572 0.256 0.172
#> GSM1124916     2  0.4656     0.6508 0.008 0.808 0.112 0.072
#> GSM1124923     3  0.3969     0.5584 0.000 0.180 0.804 0.016
#> GSM1124925     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124929     1  0.0188     0.8513 0.996 0.004 0.000 0.000
#> GSM1124934     1  0.5361     0.7169 0.772 0.020 0.128 0.080
#> GSM1124937     1  0.3005     0.8044 0.900 0.048 0.044 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
#> GSM1124891     3  0.3701      0.714 0.112 0.004 0.824 0.000 0.060
#> GSM1124888     3  0.3871      0.710 0.132 0.000 0.808 0.004 0.056
#> GSM1124890     3  0.4705      0.611 0.000 0.040 0.692 0.004 0.264
#> GSM1124904     5  0.6272      0.764 0.000 0.344 0.016 0.108 0.532
#> GSM1124927     2  0.3985      0.640 0.052 0.820 0.024 0.000 0.104
#> GSM1124953     3  0.5122      0.616 0.000 0.076 0.692 0.008 0.224
#> GSM1124869     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.6280      0.352 0.320 0.556 0.024 0.000 0.100
#> GSM1124882     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.1408      0.599 0.000 0.948 0.008 0.000 0.044
#> GSM1124898     5  0.4934      0.723 0.000 0.432 0.004 0.020 0.544
#> GSM1124903     5  0.6272      0.764 0.000 0.344 0.016 0.108 0.532
#> GSM1124905     1  0.6415      0.590 0.648 0.128 0.096 0.000 0.128
#> GSM1124910     1  0.3400      0.744 0.848 0.004 0.076 0.000 0.072
#> GSM1124919     5  0.6696      0.438 0.000 0.208 0.300 0.008 0.484
#> GSM1124932     2  0.5428      0.549 0.000 0.620 0.064 0.008 0.308
#> GSM1124933     3  0.2635      0.723 0.088 0.016 0.888 0.008 0.000
#> GSM1124867     2  0.2773      0.651 0.000 0.868 0.020 0.000 0.112
#> GSM1124868     5  0.7048      0.545 0.000 0.308 0.008 0.324 0.360
#> GSM1124878     5  0.6242      0.764 0.000 0.348 0.016 0.104 0.532
#> GSM1124895     4  0.0794      0.976 0.000 0.028 0.000 0.972 0.000
#> GSM1124897     5  0.6180      0.763 0.000 0.356 0.016 0.096 0.532
#> GSM1124902     4  0.0794      0.976 0.000 0.028 0.000 0.972 0.000
#> GSM1124908     4  0.2414      0.898 0.000 0.008 0.012 0.900 0.080
#> GSM1124921     4  0.1507      0.956 0.000 0.012 0.012 0.952 0.024
#> GSM1124939     4  0.0794      0.976 0.000 0.028 0.000 0.972 0.000
#> GSM1124944     4  0.0794      0.976 0.000 0.028 0.000 0.972 0.000
#> GSM1124945     3  0.3596      0.613 0.000 0.000 0.784 0.200 0.016
#> GSM1124946     4  0.1059      0.958 0.000 0.008 0.004 0.968 0.020
#> GSM1124947     4  0.0794      0.976 0.000 0.028 0.000 0.972 0.000
#> GSM1124951     3  0.3667      0.689 0.000 0.000 0.812 0.048 0.140
#> GSM1124952     4  0.0794      0.976 0.000 0.028 0.000 0.972 0.000
#> GSM1124957     3  0.3544      0.614 0.008 0.000 0.788 0.200 0.004
#> GSM1124900     2  0.6307      0.338 0.328 0.548 0.024 0.000 0.100
#> GSM1124914     5  0.5149      0.732 0.000 0.424 0.004 0.032 0.540
#> GSM1124871     2  0.1732      0.553 0.000 0.920 0.000 0.000 0.080
#> GSM1124874     2  0.1124      0.622 0.000 0.960 0.004 0.000 0.036
#> GSM1124875     5  0.5047      0.618 0.000 0.472 0.032 0.000 0.496
#> GSM1124880     2  0.7441      0.389 0.224 0.524 0.080 0.004 0.168
#> GSM1124881     2  0.0609      0.620 0.000 0.980 0.000 0.000 0.020
#> GSM1124885     5  0.5745      0.761 0.000 0.376 0.004 0.080 0.540
#> GSM1124886     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.5955      0.767 0.000 0.356 0.012 0.084 0.548
#> GSM1124894     2  0.7999      0.474 0.128 0.556 0.128 0.064 0.124
#> GSM1124896     1  0.0162      0.840 0.996 0.000 0.004 0.000 0.000
#> GSM1124899     2  0.3048      0.356 0.000 0.820 0.004 0.000 0.176
#> GSM1124901     5  0.4881      0.698 0.000 0.460 0.004 0.016 0.520
#> GSM1124906     2  0.0992      0.621 0.000 0.968 0.008 0.000 0.024
#> GSM1124907     5  0.5994      0.729 0.000 0.328 0.044 0.048 0.580
#> GSM1124911     2  0.4587      0.543 0.000 0.724 0.040 0.008 0.228
#> GSM1124912     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.5310      0.332 0.000 0.380 0.040 0.008 0.572
#> GSM1124917     2  0.3857     -0.151 0.000 0.688 0.000 0.000 0.312
#> GSM1124918     2  0.5379      0.498 0.000 0.612 0.056 0.008 0.324
#> GSM1124920     3  0.5508      0.334 0.384 0.000 0.552 0.004 0.060
#> GSM1124922     2  0.3700      0.127 0.000 0.752 0.008 0.000 0.240
#> GSM1124924     2  0.6663      0.428 0.016 0.556 0.212 0.004 0.212
#> GSM1124926     2  0.2690      0.411 0.000 0.844 0.000 0.000 0.156
#> GSM1124928     1  0.6633      0.550 0.620 0.152 0.080 0.000 0.148
#> GSM1124930     5  0.6137      0.607 0.000 0.336 0.116 0.008 0.540
#> GSM1124931     2  0.5587      0.547 0.000 0.600 0.072 0.008 0.320
#> GSM1124935     5  0.5507      0.293 0.000 0.384 0.052 0.008 0.556
#> GSM1124936     3  0.5283      0.204 0.444 0.000 0.508 0.000 0.048
#> GSM1124938     3  0.5571      0.558 0.000 0.072 0.604 0.008 0.316
#> GSM1124940     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.1106      0.620 0.000 0.964 0.012 0.000 0.024
#> GSM1124942     5  0.6670      0.573 0.000 0.344 0.184 0.008 0.464
#> GSM1124943     3  0.5844      0.475 0.000 0.084 0.556 0.008 0.352
#> GSM1124948     2  0.6209      0.438 0.000 0.572 0.212 0.004 0.212
#> GSM1124949     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.2864      0.650 0.000 0.864 0.024 0.000 0.112
#> GSM1124954     1  0.7814      0.320 0.396 0.064 0.180 0.008 0.352
#> GSM1124955     1  0.0162      0.840 0.996 0.000 0.004 0.000 0.000
#> GSM1124956     2  0.4587      0.543 0.000 0.724 0.040 0.008 0.228
#> GSM1124872     2  0.2761      0.650 0.000 0.872 0.024 0.000 0.104
#> GSM1124873     2  0.0290      0.627 0.000 0.992 0.000 0.000 0.008
#> GSM1124876     3  0.2719      0.711 0.144 0.000 0.852 0.004 0.000
#> GSM1124877     1  0.4735      0.604 0.720 0.000 0.052 0.008 0.220
#> GSM1124879     1  0.0162      0.840 0.996 0.000 0.004 0.000 0.000
#> GSM1124883     5  0.6272      0.764 0.000 0.344 0.016 0.108 0.532
#> GSM1124889     2  0.1043      0.604 0.000 0.960 0.000 0.000 0.040
#> GSM1124892     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.1952      0.652 0.000 0.912 0.004 0.000 0.084
#> GSM1124913     5  0.6272      0.764 0.000 0.344 0.016 0.108 0.532
#> GSM1124916     2  0.4332      0.612 0.000 0.732 0.024 0.008 0.236
#> GSM1124923     5  0.6446      0.203 0.000 0.120 0.372 0.016 0.492
#> GSM1124925     1  0.0162      0.840 0.996 0.000 0.004 0.000 0.000
#> GSM1124929     1  0.0000      0.841 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     1  0.7814      0.320 0.396 0.064 0.180 0.008 0.352
#> GSM1124937     1  0.6839      0.511 0.588 0.196 0.052 0.004 0.160

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.3184    0.68648 0.020 0.004 0.848 0.000 0.028 0.100
#> GSM1124888     3  0.3200    0.68436 0.024 0.004 0.844 0.000 0.020 0.108
#> GSM1124890     3  0.6138    0.48111 0.000 0.032 0.560 0.004 0.228 0.176
#> GSM1124904     5  0.3147    0.74776 0.000 0.028 0.008 0.056 0.864 0.044
#> GSM1124927     2  0.2420    0.48659 0.000 0.888 0.004 0.000 0.032 0.076
#> GSM1124953     3  0.5523    0.56720 0.000 0.040 0.660 0.004 0.160 0.136
#> GSM1124869     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.3790    0.40928 0.112 0.796 0.004 0.000 0.004 0.084
#> GSM1124882     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.4065    0.46921 0.000 0.724 0.000 0.000 0.220 0.056
#> GSM1124898     5  0.2356    0.74030 0.000 0.100 0.008 0.004 0.884 0.004
#> GSM1124903     5  0.3147    0.74776 0.000 0.028 0.008 0.056 0.864 0.044
#> GSM1124905     2  0.7177    0.06705 0.316 0.436 0.072 0.008 0.008 0.160
#> GSM1124910     1  0.5019    0.63435 0.724 0.060 0.068 0.000 0.008 0.140
#> GSM1124919     5  0.6241    0.41632 0.000 0.044 0.240 0.004 0.556 0.156
#> GSM1124932     6  0.4377    0.38971 0.000 0.436 0.000 0.000 0.024 0.540
#> GSM1124933     3  0.0810    0.69967 0.004 0.008 0.976 0.000 0.004 0.008
#> GSM1124867     2  0.1151    0.49916 0.000 0.956 0.000 0.000 0.012 0.032
#> GSM1124868     5  0.4744    0.57667 0.000 0.052 0.004 0.264 0.668 0.012
#> GSM1124878     5  0.3152    0.75983 0.000 0.060 0.008 0.056 0.860 0.016
#> GSM1124895     4  0.0520    0.95022 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM1124897     5  0.3777    0.76121 0.000 0.068 0.016 0.056 0.828 0.032
#> GSM1124902     4  0.0520    0.95022 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM1124908     4  0.4017    0.69425 0.000 0.004 0.004 0.732 0.228 0.032
#> GSM1124921     4  0.1621    0.92746 0.000 0.004 0.004 0.936 0.048 0.008
#> GSM1124939     4  0.0520    0.95022 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM1124944     4  0.0520    0.95022 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM1124945     3  0.2445    0.66518 0.000 0.000 0.872 0.108 0.000 0.020
#> GSM1124946     4  0.1969    0.91906 0.000 0.004 0.004 0.920 0.052 0.020
#> GSM1124947     4  0.0520    0.95022 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM1124951     3  0.2476    0.69142 0.000 0.000 0.888 0.008 0.072 0.032
#> GSM1124952     4  0.0520    0.95022 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM1124957     3  0.2053    0.66317 0.000 0.000 0.888 0.108 0.000 0.004
#> GSM1124900     2  0.3797    0.41369 0.112 0.800 0.008 0.000 0.004 0.076
#> GSM1124914     5  0.2243    0.74071 0.000 0.112 0.000 0.004 0.880 0.004
#> GSM1124871     2  0.3821    0.47624 0.000 0.740 0.000 0.000 0.220 0.040
#> GSM1124874     2  0.3189    0.50115 0.000 0.796 0.000 0.000 0.184 0.020
#> GSM1124875     5  0.5671    0.56096 0.000 0.180 0.020 0.004 0.616 0.180
#> GSM1124880     2  0.5369    0.33898 0.064 0.700 0.052 0.000 0.024 0.160
#> GSM1124881     2  0.3284    0.50159 0.000 0.800 0.000 0.000 0.168 0.032
#> GSM1124885     5  0.2691    0.75344 0.000 0.088 0.000 0.032 0.872 0.008
#> GSM1124886     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.2094    0.76310 0.000 0.032 0.004 0.028 0.920 0.016
#> GSM1124894     2  0.5918    0.33253 0.020 0.672 0.096 0.028 0.028 0.156
#> GSM1124896     1  0.0405    0.93740 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM1124899     2  0.4696    0.33896 0.000 0.588 0.000 0.000 0.356 0.056
#> GSM1124901     5  0.3090    0.71066 0.000 0.140 0.000 0.004 0.828 0.028
#> GSM1124906     2  0.3916    0.48427 0.000 0.752 0.000 0.000 0.184 0.064
#> GSM1124907     5  0.4209    0.62528 0.000 0.020 0.016 0.012 0.736 0.216
#> GSM1124911     2  0.5296   -0.34102 0.000 0.456 0.000 0.000 0.100 0.444
#> GSM1124912     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.6016    0.36966 0.000 0.244 0.000 0.000 0.352 0.404
#> GSM1124917     2  0.4981    0.06175 0.000 0.488 0.000 0.004 0.452 0.056
#> GSM1124918     6  0.5280    0.39382 0.000 0.320 0.008 0.000 0.096 0.576
#> GSM1124920     3  0.5634    0.49960 0.248 0.004 0.604 0.000 0.020 0.124
#> GSM1124922     2  0.4641    0.28386 0.000 0.552 0.000 0.000 0.404 0.044
#> GSM1124924     2  0.5910    0.23686 0.000 0.588 0.064 0.004 0.076 0.268
#> GSM1124926     2  0.4524    0.36354 0.000 0.616 0.000 0.000 0.336 0.048
#> GSM1124928     2  0.7006    0.08358 0.324 0.440 0.072 0.000 0.012 0.152
#> GSM1124930     5  0.6124    0.50379 0.000 0.116 0.064 0.004 0.588 0.228
#> GSM1124931     6  0.4129    0.38163 0.000 0.424 0.000 0.000 0.012 0.564
#> GSM1124935     6  0.5845    0.44513 0.000 0.212 0.000 0.000 0.316 0.472
#> GSM1124936     3  0.5067    0.38028 0.340 0.004 0.584 0.000 0.004 0.068
#> GSM1124938     3  0.7073    0.39615 0.000 0.068 0.416 0.004 0.252 0.260
#> GSM1124940     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.3916    0.48427 0.000 0.752 0.000 0.000 0.184 0.064
#> GSM1124942     5  0.6221    0.51200 0.000 0.116 0.084 0.004 0.592 0.204
#> GSM1124943     3  0.7231    0.25180 0.000 0.080 0.364 0.004 0.320 0.232
#> GSM1124948     2  0.6275    0.17457 0.000 0.528 0.068 0.004 0.092 0.308
#> GSM1124949     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.1738    0.49344 0.000 0.928 0.004 0.000 0.016 0.052
#> GSM1124954     6  0.5608    0.39028 0.164 0.072 0.096 0.004 0.000 0.664
#> GSM1124955     1  0.0146    0.94196 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124956     2  0.5261   -0.34334 0.000 0.460 0.000 0.000 0.096 0.444
#> GSM1124872     2  0.1972    0.49394 0.000 0.916 0.004 0.000 0.024 0.056
#> GSM1124873     2  0.2909    0.50564 0.000 0.836 0.000 0.000 0.136 0.028
#> GSM1124876     3  0.1225    0.69789 0.036 0.000 0.952 0.000 0.000 0.012
#> GSM1124877     1  0.3955    0.24713 0.560 0.000 0.000 0.004 0.000 0.436
#> GSM1124879     1  0.0146    0.94196 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124883     5  0.3147    0.74776 0.000 0.028 0.008 0.056 0.864 0.044
#> GSM1124889     2  0.3794    0.48029 0.000 0.744 0.000 0.000 0.216 0.040
#> GSM1124892     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.0806    0.49910 0.000 0.972 0.000 0.000 0.020 0.008
#> GSM1124913     5  0.3147    0.74776 0.000 0.028 0.008 0.056 0.864 0.044
#> GSM1124916     2  0.3707   -0.00253 0.000 0.680 0.000 0.000 0.008 0.312
#> GSM1124923     5  0.5870    0.38447 0.000 0.016 0.248 0.004 0.568 0.164
#> GSM1124925     1  0.0146    0.94196 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124929     1  0.0000    0.94340 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     6  0.5596    0.39119 0.168 0.072 0.092 0.004 0.000 0.664
#> GSM1124937     2  0.6509    0.14609 0.264 0.508 0.020 0.000 0.020 0.188

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 tissue(p) k
#> CV:kmeans 86  8.31e-02 2
#> CV:kmeans 80  1.15e-09 3
#> CV:kmeans 73  3.96e-08 4
#> CV:kmeans 71  1.20e-05 5
#> CV:kmeans 50  1.44e-03 6

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


CV:skmeans

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 48983 rows and 91 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 0.787           0.880       0.952         0.4912 0.508   0.508
#> 3 3 0.590           0.661       0.843         0.3218 0.763   0.560
#> 4 4 0.759           0.810       0.902         0.1552 0.814   0.517
#> 5 5 0.709           0.751       0.837         0.0639 0.920   0.698
#> 6 6 0.728           0.644       0.794         0.0417 0.908   0.601

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
#> GSM1124891     1  0.0000      0.932 1.000 0.000
#> GSM1124888     1  0.0000      0.932 1.000 0.000
#> GSM1124890     1  0.9710      0.383 0.600 0.400
#> GSM1124904     2  0.0000      0.956 0.000 1.000
#> GSM1124927     1  0.9460      0.400 0.636 0.364
#> GSM1124953     2  0.0000      0.956 0.000 1.000
#> GSM1124869     1  0.0000      0.932 1.000 0.000
#> GSM1124870     1  0.0000      0.932 1.000 0.000
#> GSM1124882     1  0.0000      0.932 1.000 0.000
#> GSM1124884     2  0.0000      0.956 0.000 1.000
#> GSM1124898     2  0.0000      0.956 0.000 1.000
#> GSM1124903     2  0.0000      0.956 0.000 1.000
#> GSM1124905     1  0.0000      0.932 1.000 0.000
#> GSM1124910     1  0.0000      0.932 1.000 0.000
#> GSM1124919     2  0.0000      0.956 0.000 1.000
#> GSM1124932     2  0.9661      0.360 0.392 0.608
#> GSM1124933     1  0.0000      0.932 1.000 0.000
#> GSM1124867     2  0.0672      0.949 0.008 0.992
#> GSM1124868     2  0.0000      0.956 0.000 1.000
#> GSM1124878     2  0.0000      0.956 0.000 1.000
#> GSM1124895     2  0.0000      0.956 0.000 1.000
#> GSM1124897     2  0.0000      0.956 0.000 1.000
#> GSM1124902     2  0.0000      0.956 0.000 1.000
#> GSM1124908     2  0.0000      0.956 0.000 1.000
#> GSM1124921     2  0.0000      0.956 0.000 1.000
#> GSM1124939     2  0.0000      0.956 0.000 1.000
#> GSM1124944     2  0.0000      0.956 0.000 1.000
#> GSM1124945     1  0.9710      0.383 0.600 0.400
#> GSM1124946     2  0.0000      0.956 0.000 1.000
#> GSM1124947     2  0.0000      0.956 0.000 1.000
#> GSM1124951     1  0.9732      0.373 0.596 0.404
#> GSM1124952     2  0.0000      0.956 0.000 1.000
#> GSM1124957     1  0.7056      0.744 0.808 0.192
#> GSM1124900     1  0.0000      0.932 1.000 0.000
#> GSM1124914     2  0.0000      0.956 0.000 1.000
#> GSM1124871     2  0.0000      0.956 0.000 1.000
#> GSM1124874     2  0.2043      0.928 0.032 0.968
#> GSM1124875     2  0.0000      0.956 0.000 1.000
#> GSM1124880     1  0.0000      0.932 1.000 0.000
#> GSM1124881     2  0.0000      0.956 0.000 1.000
#> GSM1124885     2  0.0000      0.956 0.000 1.000
#> GSM1124886     1  0.0000      0.932 1.000 0.000
#> GSM1124887     2  0.0000      0.956 0.000 1.000
#> GSM1124894     1  0.9393      0.420 0.644 0.356
#> GSM1124896     1  0.0000      0.932 1.000 0.000
#> GSM1124899     2  0.0000      0.956 0.000 1.000
#> GSM1124901     2  0.0000      0.956 0.000 1.000
#> GSM1124906     2  0.0000      0.956 0.000 1.000
#> GSM1124907     2  0.0000      0.956 0.000 1.000
#> GSM1124911     2  0.0000      0.956 0.000 1.000
#> GSM1124912     1  0.0000      0.932 1.000 0.000
#> GSM1124915     2  0.0000      0.956 0.000 1.000
#> GSM1124917     2  0.0000      0.956 0.000 1.000
#> GSM1124918     2  0.0000      0.956 0.000 1.000
#> GSM1124920     1  0.0000      0.932 1.000 0.000
#> GSM1124922     2  0.0000      0.956 0.000 1.000
#> GSM1124924     1  0.0000      0.932 1.000 0.000
#> GSM1124926     2  0.0000      0.956 0.000 1.000
#> GSM1124928     1  0.0000      0.932 1.000 0.000
#> GSM1124930     2  0.0000      0.956 0.000 1.000
#> GSM1124931     2  0.9710      0.339 0.400 0.600
#> GSM1124935     2  0.0000      0.956 0.000 1.000
#> GSM1124936     1  0.0000      0.932 1.000 0.000
#> GSM1124938     1  0.6887      0.754 0.816 0.184
#> GSM1124940     1  0.0000      0.932 1.000 0.000
#> GSM1124941     2  0.0000      0.956 0.000 1.000
#> GSM1124942     2  0.0000      0.956 0.000 1.000
#> GSM1124943     2  0.9881      0.134 0.436 0.564
#> GSM1124948     1  0.0000      0.932 1.000 0.000
#> GSM1124949     1  0.0000      0.932 1.000 0.000
#> GSM1124950     2  0.7139      0.743 0.196 0.804
#> GSM1124954     1  0.0000      0.932 1.000 0.000
#> GSM1124955     1  0.0000      0.932 1.000 0.000
#> GSM1124956     2  0.0000      0.956 0.000 1.000
#> GSM1124872     2  0.7602      0.708 0.220 0.780
#> GSM1124873     2  0.0000      0.956 0.000 1.000
#> GSM1124876     1  0.0000      0.932 1.000 0.000
#> GSM1124877     1  0.0000      0.932 1.000 0.000
#> GSM1124879     1  0.0000      0.932 1.000 0.000
#> GSM1124883     2  0.0000      0.956 0.000 1.000
#> GSM1124889     2  0.0000      0.956 0.000 1.000
#> GSM1124892     1  0.0000      0.932 1.000 0.000
#> GSM1124893     1  0.0000      0.932 1.000 0.000
#> GSM1124909     2  0.6973      0.754 0.188 0.812
#> GSM1124913     2  0.0000      0.956 0.000 1.000
#> GSM1124916     2  0.6973      0.754 0.188 0.812
#> GSM1124923     2  0.0000      0.956 0.000 1.000
#> GSM1124925     1  0.0000      0.932 1.000 0.000
#> GSM1124929     1  0.0000      0.932 1.000 0.000
#> GSM1124934     1  0.0000      0.932 1.000 0.000
#> GSM1124937     1  0.0000      0.932 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     1  0.5835     0.6359 0.660 0.000 0.340
#> GSM1124888     1  0.5835     0.6359 0.660 0.000 0.340
#> GSM1124890     3  0.5845     0.4107 0.004 0.308 0.688
#> GSM1124904     2  0.5216     0.4468 0.000 0.740 0.260
#> GSM1124927     1  0.5397     0.5911 0.720 0.280 0.000
#> GSM1124953     3  0.4504     0.4929 0.000 0.196 0.804
#> GSM1124869     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124870     1  0.3619     0.7764 0.864 0.136 0.000
#> GSM1124882     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124884     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124898     2  0.1643     0.7701 0.000 0.956 0.044
#> GSM1124903     2  0.4931     0.5116 0.000 0.768 0.232
#> GSM1124905     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124910     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124919     3  0.5621     0.4121 0.000 0.308 0.692
#> GSM1124932     2  0.4504     0.5638 0.196 0.804 0.000
#> GSM1124933     1  0.5882     0.6260 0.652 0.000 0.348
#> GSM1124867     2  0.8754    -0.0859 0.116 0.508 0.376
#> GSM1124868     3  0.5948     0.5407 0.000 0.360 0.640
#> GSM1124878     3  0.6079     0.4917 0.000 0.388 0.612
#> GSM1124895     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124897     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124902     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124908     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124921     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124939     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124944     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124945     3  0.0000     0.5332 0.000 0.000 1.000
#> GSM1124946     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124947     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124951     3  0.0000     0.5332 0.000 0.000 1.000
#> GSM1124952     3  0.5835     0.5702 0.000 0.340 0.660
#> GSM1124957     3  0.1031     0.5248 0.024 0.000 0.976
#> GSM1124900     1  0.0747     0.8846 0.984 0.016 0.000
#> GSM1124914     2  0.4750     0.5424 0.000 0.784 0.216
#> GSM1124871     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124874     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124875     2  0.4702     0.5883 0.000 0.788 0.212
#> GSM1124880     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124881     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124885     2  0.4750     0.5417 0.000 0.784 0.216
#> GSM1124886     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124887     2  0.5591     0.3303 0.000 0.696 0.304
#> GSM1124894     1  0.8180     0.2248 0.532 0.076 0.392
#> GSM1124896     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124899     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124901     2  0.0592     0.7964 0.000 0.988 0.012
#> GSM1124906     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124907     3  0.6095     0.2994 0.000 0.392 0.608
#> GSM1124911     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124912     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124915     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124917     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124918     2  0.5254     0.4147 0.000 0.736 0.264
#> GSM1124920     1  0.5810     0.6400 0.664 0.000 0.336
#> GSM1124922     2  0.0237     0.8019 0.000 0.996 0.004
#> GSM1124924     1  0.6381     0.6261 0.648 0.012 0.340
#> GSM1124926     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124928     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124930     3  0.6026     0.3130 0.000 0.376 0.624
#> GSM1124931     2  0.5138     0.4826 0.252 0.748 0.000
#> GSM1124935     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124936     1  0.3116     0.8323 0.892 0.000 0.108
#> GSM1124938     3  0.8796     0.2156 0.120 0.372 0.508
#> GSM1124940     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124941     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124942     3  0.6008     0.3194 0.000 0.372 0.628
#> GSM1124943     3  0.5988     0.3264 0.000 0.368 0.632
#> GSM1124948     2  0.9328    -0.0568 0.168 0.460 0.372
#> GSM1124949     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124950     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124954     1  0.1031     0.8841 0.976 0.000 0.024
#> GSM1124955     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124956     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124872     2  0.0592     0.7945 0.012 0.988 0.000
#> GSM1124873     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124876     1  0.5835     0.6359 0.660 0.000 0.340
#> GSM1124877     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124879     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124883     2  0.4931     0.5116 0.000 0.768 0.232
#> GSM1124889     2  0.0000     0.8040 0.000 1.000 0.000
#> GSM1124892     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124893     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124909     2  0.3941     0.6243 0.156 0.844 0.000
#> GSM1124913     2  0.4931     0.5116 0.000 0.768 0.232
#> GSM1124916     2  0.1860     0.7559 0.052 0.948 0.000
#> GSM1124923     3  0.5621     0.4121 0.000 0.308 0.692
#> GSM1124925     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124929     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124934     1  0.0000     0.8954 1.000 0.000 0.000
#> GSM1124937     1  0.0000     0.8954 1.000 0.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
#> GSM1124891     3  0.3801      0.736 0.220 0.000 0.780 0.000
#> GSM1124888     3  0.3801      0.736 0.220 0.000 0.780 0.000
#> GSM1124890     3  0.0000      0.825 0.000 0.000 1.000 0.000
#> GSM1124904     4  0.6576      0.666 0.000 0.152 0.220 0.628
#> GSM1124927     2  0.3024      0.736 0.148 0.852 0.000 0.000
#> GSM1124953     3  0.1356      0.821 0.000 0.032 0.960 0.008
#> GSM1124869     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.3764      0.721 0.784 0.216 0.000 0.000
#> GSM1124882     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124898     2  0.7439      0.288 0.000 0.508 0.220 0.272
#> GSM1124903     4  0.6576      0.666 0.000 0.152 0.220 0.628
#> GSM1124905     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124910     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124919     3  0.0000      0.825 0.000 0.000 1.000 0.000
#> GSM1124932     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124933     3  0.3801      0.736 0.220 0.000 0.780 0.000
#> GSM1124867     2  0.4877      0.377 0.000 0.592 0.000 0.408
#> GSM1124868     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124878     4  0.0592      0.830 0.000 0.016 0.000 0.984
#> GSM1124895     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124897     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124902     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124921     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124944     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124945     3  0.3801      0.725 0.000 0.000 0.780 0.220
#> GSM1124946     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124951     3  0.3764      0.728 0.000 0.000 0.784 0.216
#> GSM1124952     4  0.0000      0.836 0.000 0.000 0.000 1.000
#> GSM1124957     3  0.3801      0.725 0.000 0.000 0.780 0.220
#> GSM1124900     1  0.3528      0.751 0.808 0.192 0.000 0.000
#> GSM1124914     4  0.6616      0.661 0.000 0.156 0.220 0.624
#> GSM1124871     2  0.0469      0.877 0.000 0.988 0.012 0.000
#> GSM1124874     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124875     2  0.6371      0.567 0.000 0.608 0.300 0.092
#> GSM1124880     1  0.1940      0.883 0.924 0.076 0.000 0.000
#> GSM1124881     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124885     4  0.6576      0.666 0.000 0.152 0.220 0.628
#> GSM1124886     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124887     4  0.6180      0.628 0.000 0.080 0.296 0.624
#> GSM1124894     4  0.1716      0.779 0.064 0.000 0.000 0.936
#> GSM1124896     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124899     2  0.2489      0.847 0.000 0.912 0.068 0.020
#> GSM1124901     2  0.6695      0.543 0.000 0.616 0.220 0.164
#> GSM1124906     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124907     3  0.4103      0.459 0.000 0.000 0.744 0.256
#> GSM1124911     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124912     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.3610      0.764 0.000 0.800 0.200 0.000
#> GSM1124917     2  0.2868      0.816 0.000 0.864 0.136 0.000
#> GSM1124918     2  0.2921      0.812 0.000 0.860 0.140 0.000
#> GSM1124920     1  0.4761      0.327 0.628 0.000 0.372 0.000
#> GSM1124922     2  0.5889      0.661 0.000 0.696 0.188 0.116
#> GSM1124924     3  0.4323      0.727 0.020 0.204 0.776 0.000
#> GSM1124926     2  0.2401      0.823 0.000 0.904 0.004 0.092
#> GSM1124928     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124930     3  0.0000      0.825 0.000 0.000 1.000 0.000
#> GSM1124931     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124935     2  0.3610      0.764 0.000 0.800 0.200 0.000
#> GSM1124936     1  0.2281      0.858 0.904 0.000 0.096 0.000
#> GSM1124938     3  0.0000      0.825 0.000 0.000 1.000 0.000
#> GSM1124940     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124942     3  0.0000      0.825 0.000 0.000 1.000 0.000
#> GSM1124943     3  0.0000      0.825 0.000 0.000 1.000 0.000
#> GSM1124948     3  0.3610      0.735 0.000 0.200 0.800 0.000
#> GSM1124949     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124954     1  0.0592      0.940 0.984 0.000 0.016 0.000
#> GSM1124955     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124872     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124873     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124876     3  0.3801      0.736 0.220 0.000 0.780 0.000
#> GSM1124877     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124883     4  0.6576      0.666 0.000 0.152 0.220 0.628
#> GSM1124889     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124892     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124913     4  0.6576      0.666 0.000 0.152 0.220 0.628
#> GSM1124916     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124923     3  0.0000      0.825 0.000 0.000 1.000 0.000
#> GSM1124925     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124934     1  0.0000      0.953 1.000 0.000 0.000 0.000
#> GSM1124937     1  0.0000      0.953 1.000 0.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
#> GSM1124891     3  0.2516      0.799 0.140 0.000 0.860 0.000 0.000
#> GSM1124888     3  0.2583      0.806 0.132 0.000 0.864 0.000 0.004
#> GSM1124890     3  0.2074      0.842 0.000 0.000 0.896 0.000 0.104
#> GSM1124904     5  0.3242      0.823 0.000 0.000 0.012 0.172 0.816
#> GSM1124927     2  0.4992      0.718 0.076 0.760 0.052 0.000 0.112
#> GSM1124953     3  0.1943      0.844 0.000 0.020 0.924 0.000 0.056
#> GSM1124869     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.5520      0.394 0.584 0.352 0.052 0.000 0.012
#> GSM1124882     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.4045      0.712 0.000 0.644 0.000 0.000 0.356
#> GSM1124898     5  0.2907      0.816 0.000 0.008 0.012 0.116 0.864
#> GSM1124903     5  0.3242      0.823 0.000 0.000 0.012 0.172 0.816
#> GSM1124905     1  0.0290      0.891 0.992 0.000 0.008 0.000 0.000
#> GSM1124910     1  0.0880      0.880 0.968 0.000 0.032 0.000 0.000
#> GSM1124919     3  0.3074      0.794 0.000 0.000 0.804 0.000 0.196
#> GSM1124932     2  0.1894      0.745 0.000 0.920 0.008 0.000 0.072
#> GSM1124933     3  0.1121      0.838 0.044 0.000 0.956 0.000 0.000
#> GSM1124867     4  0.5229      0.530 0.004 0.200 0.000 0.688 0.108
#> GSM1124868     4  0.2471      0.770 0.000 0.000 0.000 0.864 0.136
#> GSM1124878     4  0.4268      0.061 0.000 0.000 0.000 0.556 0.444
#> GSM1124895     4  0.0000      0.888 0.000 0.000 0.000 1.000 0.000
#> GSM1124897     4  0.3366      0.638 0.000 0.000 0.000 0.768 0.232
#> GSM1124902     4  0.0000      0.888 0.000 0.000 0.000 1.000 0.000
#> GSM1124908     4  0.0162      0.886 0.000 0.000 0.000 0.996 0.004
#> GSM1124921     4  0.0000      0.888 0.000 0.000 0.000 1.000 0.000
#> GSM1124939     4  0.0000      0.888 0.000 0.000 0.000 1.000 0.000
#> GSM1124944     4  0.0000      0.888 0.000 0.000 0.000 1.000 0.000
#> GSM1124945     3  0.3366      0.742 0.000 0.000 0.784 0.212 0.004
#> GSM1124946     4  0.0000      0.888 0.000 0.000 0.000 1.000 0.000
#> GSM1124947     4  0.0000      0.888 0.000 0.000 0.000 1.000 0.000
#> GSM1124951     3  0.3280      0.776 0.000 0.000 0.812 0.176 0.012
#> GSM1124952     4  0.0000      0.888 0.000 0.000 0.000 1.000 0.000
#> GSM1124957     3  0.3266      0.753 0.000 0.000 0.796 0.200 0.004
#> GSM1124900     1  0.5092      0.560 0.664 0.276 0.052 0.000 0.008
#> GSM1124914     5  0.3010      0.821 0.000 0.000 0.004 0.172 0.824
#> GSM1124871     2  0.4356      0.714 0.000 0.648 0.012 0.000 0.340
#> GSM1124874     2  0.4851      0.677 0.000 0.624 0.036 0.000 0.340
#> GSM1124875     5  0.3405      0.718 0.000 0.012 0.104 0.036 0.848
#> GSM1124880     1  0.5261      0.652 0.696 0.200 0.092 0.000 0.012
#> GSM1124881     2  0.4080      0.766 0.000 0.728 0.020 0.000 0.252
#> GSM1124885     5  0.3360      0.824 0.000 0.004 0.012 0.168 0.816
#> GSM1124886     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.3359      0.821 0.000 0.000 0.020 0.164 0.816
#> GSM1124894     4  0.1628      0.832 0.056 0.000 0.008 0.936 0.000
#> GSM1124896     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124899     5  0.3849      0.357 0.000 0.232 0.016 0.000 0.752
#> GSM1124901     5  0.2756      0.790 0.000 0.024 0.004 0.092 0.880
#> GSM1124906     2  0.3835      0.767 0.000 0.732 0.008 0.000 0.260
#> GSM1124907     5  0.4985      0.572 0.000 0.000 0.244 0.076 0.680
#> GSM1124911     2  0.2411      0.743 0.000 0.884 0.008 0.000 0.108
#> GSM1124912     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.4425      0.428 0.000 0.600 0.008 0.000 0.392
#> GSM1124917     2  0.4894      0.439 0.000 0.520 0.024 0.000 0.456
#> GSM1124918     2  0.4466      0.654 0.000 0.748 0.076 0.000 0.176
#> GSM1124920     1  0.4397      0.231 0.564 0.000 0.432 0.000 0.004
#> GSM1124922     5  0.3649      0.610 0.008 0.120 0.020 0.016 0.836
#> GSM1124924     3  0.4066      0.690 0.004 0.196 0.768 0.000 0.032
#> GSM1124926     5  0.4888      0.122 0.000 0.320 0.008 0.028 0.644
#> GSM1124928     1  0.1082      0.881 0.964 0.008 0.028 0.000 0.000
#> GSM1124930     3  0.3452      0.749 0.000 0.000 0.756 0.000 0.244
#> GSM1124931     2  0.1918      0.735 0.000 0.928 0.036 0.000 0.036
#> GSM1124935     2  0.4538      0.259 0.000 0.540 0.008 0.000 0.452
#> GSM1124936     1  0.3143      0.715 0.796 0.000 0.204 0.000 0.000
#> GSM1124938     3  0.2074      0.843 0.000 0.000 0.896 0.000 0.104
#> GSM1124940     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.3942      0.767 0.000 0.728 0.012 0.000 0.260
#> GSM1124942     3  0.2852      0.817 0.000 0.000 0.828 0.000 0.172
#> GSM1124943     3  0.2516      0.834 0.000 0.000 0.860 0.000 0.140
#> GSM1124948     3  0.2388      0.813 0.000 0.072 0.900 0.000 0.028
#> GSM1124949     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.4059      0.753 0.000 0.776 0.052 0.000 0.172
#> GSM1124954     1  0.5165      0.696 0.708 0.188 0.092 0.000 0.012
#> GSM1124955     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.2411      0.743 0.000 0.884 0.008 0.000 0.108
#> GSM1124872     2  0.3736      0.758 0.000 0.808 0.052 0.000 0.140
#> GSM1124873     2  0.3690      0.769 0.000 0.780 0.020 0.000 0.200
#> GSM1124876     3  0.2605      0.793 0.148 0.000 0.852 0.000 0.000
#> GSM1124877     1  0.3360      0.777 0.816 0.168 0.004 0.000 0.012
#> GSM1124879     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.3242      0.823 0.000 0.000 0.012 0.172 0.816
#> GSM1124889     2  0.4339      0.725 0.000 0.652 0.012 0.000 0.336
#> GSM1124892     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.3051      0.766 0.000 0.852 0.028 0.000 0.120
#> GSM1124913     5  0.3242      0.823 0.000 0.000 0.012 0.172 0.816
#> GSM1124916     2  0.1310      0.746 0.000 0.956 0.024 0.000 0.020
#> GSM1124923     3  0.3074      0.797 0.000 0.000 0.804 0.000 0.196
#> GSM1124925     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.893 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     1  0.4749      0.723 0.736 0.192 0.060 0.000 0.012
#> GSM1124937     1  0.0798      0.885 0.976 0.008 0.016 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
#> GSM1124891     3  0.2306     0.7447 0.092 0.004 0.888 0.000 0.000 0.016
#> GSM1124888     3  0.2569     0.7675 0.056 0.008 0.892 0.000 0.008 0.036
#> GSM1124890     3  0.2968     0.7746 0.000 0.004 0.840 0.000 0.128 0.028
#> GSM1124904     5  0.2146     0.7459 0.000 0.004 0.000 0.116 0.880 0.000
#> GSM1124927     2  0.1382     0.5501 0.036 0.948 0.008 0.000 0.000 0.008
#> GSM1124953     3  0.3031     0.7762 0.000 0.032 0.852 0.000 0.100 0.016
#> GSM1124869     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.4196     0.3401 0.340 0.640 0.008 0.000 0.008 0.004
#> GSM1124882     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.6127     0.3379 0.000 0.464 0.008 0.000 0.272 0.256
#> GSM1124898     5  0.2419     0.7347 0.000 0.016 0.000 0.060 0.896 0.028
#> GSM1124903     5  0.2146     0.7459 0.000 0.004 0.000 0.116 0.880 0.000
#> GSM1124905     1  0.1738     0.8633 0.928 0.052 0.004 0.000 0.000 0.016
#> GSM1124910     1  0.1806     0.8604 0.928 0.008 0.044 0.000 0.000 0.020
#> GSM1124919     3  0.4130     0.7009 0.000 0.008 0.716 0.000 0.240 0.036
#> GSM1124932     6  0.3698     0.6521 0.004 0.212 0.000 0.000 0.028 0.756
#> GSM1124933     3  0.1092     0.7749 0.020 0.020 0.960 0.000 0.000 0.000
#> GSM1124867     2  0.4220    -0.0258 0.000 0.520 0.000 0.468 0.004 0.008
#> GSM1124868     4  0.2454     0.7702 0.000 0.000 0.000 0.840 0.160 0.000
#> GSM1124878     5  0.3868     0.0411 0.000 0.000 0.000 0.496 0.504 0.000
#> GSM1124895     4  0.0000     0.9344 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124897     4  0.3890     0.5187 0.000 0.004 0.008 0.692 0.292 0.004
#> GSM1124902     4  0.0000     0.9344 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124908     4  0.0790     0.9175 0.000 0.000 0.000 0.968 0.032 0.000
#> GSM1124921     4  0.0146     0.9328 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM1124939     4  0.0000     0.9344 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0000     0.9344 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124945     3  0.2902     0.7047 0.000 0.000 0.800 0.196 0.004 0.000
#> GSM1124946     4  0.0363     0.9298 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM1124947     4  0.0000     0.9344 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124951     3  0.2664     0.7535 0.000 0.000 0.848 0.136 0.016 0.000
#> GSM1124952     4  0.0000     0.9344 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124957     3  0.2631     0.7176 0.000 0.000 0.820 0.180 0.000 0.000
#> GSM1124900     2  0.4269     0.2164 0.404 0.580 0.008 0.000 0.004 0.004
#> GSM1124914     5  0.3701     0.7337 0.000 0.024 0.020 0.092 0.828 0.036
#> GSM1124871     2  0.5630     0.4264 0.000 0.552 0.004 0.000 0.268 0.176
#> GSM1124874     2  0.4276     0.5530 0.000 0.752 0.004 0.004 0.132 0.108
#> GSM1124875     5  0.4971     0.5487 0.000 0.028 0.072 0.004 0.692 0.204
#> GSM1124880     2  0.5217     0.3478 0.280 0.632 0.044 0.000 0.004 0.040
#> GSM1124881     2  0.4270     0.5498 0.000 0.748 0.008 0.000 0.100 0.144
#> GSM1124885     5  0.2313     0.7459 0.000 0.012 0.000 0.100 0.884 0.004
#> GSM1124886     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.2518     0.7378 0.000 0.004 0.008 0.096 0.880 0.012
#> GSM1124894     4  0.2333     0.8480 0.060 0.032 0.004 0.900 0.000 0.004
#> GSM1124896     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124899     5  0.6088     0.3533 0.000 0.248 0.028 0.004 0.556 0.164
#> GSM1124901     5  0.3126     0.7097 0.000 0.020 0.012 0.036 0.864 0.068
#> GSM1124906     2  0.5414     0.4489 0.000 0.596 0.012 0.000 0.120 0.272
#> GSM1124907     5  0.5431     0.4061 0.000 0.012 0.152 0.016 0.660 0.160
#> GSM1124911     6  0.3722     0.6495 0.000 0.196 0.004 0.000 0.036 0.764
#> GSM1124912     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.4485     0.5629 0.000 0.064 0.004 0.000 0.248 0.684
#> GSM1124917     5  0.6943    -0.1513 0.000 0.236 0.048 0.004 0.360 0.352
#> GSM1124918     6  0.2434     0.5818 0.000 0.056 0.016 0.000 0.032 0.896
#> GSM1124920     1  0.5091     0.0951 0.488 0.012 0.456 0.000 0.004 0.040
#> GSM1124922     5  0.5874     0.4985 0.004 0.200 0.028 0.012 0.628 0.128
#> GSM1124924     2  0.6611    -0.1713 0.004 0.440 0.348 0.000 0.044 0.164
#> GSM1124926     5  0.6177     0.3087 0.000 0.276 0.016 0.016 0.540 0.152
#> GSM1124928     1  0.3369     0.7942 0.832 0.108 0.032 0.000 0.000 0.028
#> GSM1124930     3  0.5831     0.6390 0.000 0.016 0.560 0.000 0.240 0.184
#> GSM1124931     6  0.3925     0.5733 0.000 0.332 0.004 0.000 0.008 0.656
#> GSM1124935     6  0.4011     0.6060 0.000 0.056 0.000 0.000 0.212 0.732
#> GSM1124936     1  0.3888     0.5453 0.672 0.000 0.312 0.000 0.000 0.016
#> GSM1124938     3  0.4882     0.7223 0.000 0.016 0.692 0.000 0.112 0.180
#> GSM1124940     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.5464     0.4473 0.000 0.584 0.012 0.000 0.120 0.284
#> GSM1124942     3  0.5453     0.6880 0.000 0.012 0.616 0.000 0.192 0.180
#> GSM1124943     3  0.5227     0.7142 0.000 0.012 0.648 0.000 0.164 0.176
#> GSM1124948     3  0.6146     0.5983 0.000 0.168 0.580 0.000 0.060 0.192
#> GSM1124949     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.1448     0.5608 0.000 0.948 0.012 0.000 0.016 0.024
#> GSM1124954     6  0.5157     0.2902 0.360 0.000 0.096 0.000 0.000 0.544
#> GSM1124955     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     6  0.3722     0.6495 0.000 0.196 0.004 0.000 0.036 0.764
#> GSM1124872     2  0.1483     0.5525 0.000 0.944 0.012 0.000 0.008 0.036
#> GSM1124873     2  0.4200     0.5479 0.000 0.760 0.012 0.000 0.092 0.136
#> GSM1124876     3  0.1714     0.7494 0.092 0.000 0.908 0.000 0.000 0.000
#> GSM1124877     1  0.3747     0.2471 0.604 0.000 0.000 0.000 0.000 0.396
#> GSM1124879     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.2146     0.7459 0.000 0.004 0.000 0.116 0.880 0.000
#> GSM1124889     2  0.5414     0.4959 0.000 0.628 0.016 0.000 0.200 0.156
#> GSM1124892     1  0.0146     0.8987 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124893     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.3367     0.5172 0.000 0.804 0.012 0.000 0.020 0.164
#> GSM1124913     5  0.2288     0.7456 0.000 0.004 0.000 0.116 0.876 0.004
#> GSM1124916     6  0.4318     0.5099 0.000 0.340 0.008 0.000 0.020 0.632
#> GSM1124923     3  0.4613     0.6889 0.000 0.008 0.676 0.000 0.252 0.064
#> GSM1124925     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9007 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     6  0.4972     0.2264 0.392 0.000 0.072 0.000 0.000 0.536
#> GSM1124937     1  0.3232     0.7924 0.840 0.112 0.008 0.000 0.008 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-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 tissue(p) k
#> CV:skmeans 83  9.38e-02 2
#> CV:skmeans 74  5.17e-12 3
#> CV:skmeans 87  7.43e-06 4
#> CV:skmeans 83  2.69e-07 5
#> CV:skmeans 71  2.04e-05 6

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


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

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

collect_plots(res)

plot of chunk CV-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.669           0.873       0.917         0.3596 0.597   0.597
#> 3 3 0.733           0.800       0.883         0.4258 0.855   0.758
#> 4 4 0.723           0.837       0.910         0.2279 0.847   0.698
#> 5 5 0.708           0.821       0.863         0.1497 0.882   0.716
#> 6 6 0.745           0.732       0.862         0.0912 0.873   0.596

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.2043      0.759 0.968 0.032
#> GSM1124888     1  0.1414      0.760 0.980 0.020
#> GSM1124890     2  0.4022      0.866 0.080 0.920
#> GSM1124904     2  0.0000      0.957 0.000 1.000
#> GSM1124927     2  0.0000      0.957 0.000 1.000
#> GSM1124953     2  0.8713      0.536 0.292 0.708
#> GSM1124869     1  0.8955      0.826 0.688 0.312
#> GSM1124870     2  0.0000      0.957 0.000 1.000
#> GSM1124882     1  0.9580      0.725 0.620 0.380
#> GSM1124884     2  0.0000      0.957 0.000 1.000
#> GSM1124898     2  0.0000      0.957 0.000 1.000
#> GSM1124903     2  0.0000      0.957 0.000 1.000
#> GSM1124905     2  0.9850     -0.214 0.428 0.572
#> GSM1124910     1  0.8955      0.826 0.688 0.312
#> GSM1124919     2  0.0000      0.957 0.000 1.000
#> GSM1124932     2  0.0000      0.957 0.000 1.000
#> GSM1124933     1  0.6973      0.682 0.812 0.188
#> GSM1124867     2  0.0000      0.957 0.000 1.000
#> GSM1124868     2  0.1414      0.942 0.020 0.980
#> GSM1124878     2  0.0000      0.957 0.000 1.000
#> GSM1124895     2  0.1414      0.942 0.020 0.980
#> GSM1124897     2  0.0000      0.957 0.000 1.000
#> GSM1124902     2  0.1414      0.942 0.020 0.980
#> GSM1124908     2  0.1414      0.942 0.020 0.980
#> GSM1124921     2  0.1414      0.942 0.020 0.980
#> GSM1124939     2  0.1414      0.942 0.020 0.980
#> GSM1124944     2  0.1414      0.942 0.020 0.980
#> GSM1124945     2  0.8909      0.521 0.308 0.692
#> GSM1124946     2  0.1414      0.942 0.020 0.980
#> GSM1124947     2  0.1414      0.942 0.020 0.980
#> GSM1124951     2  0.9427      0.412 0.360 0.640
#> GSM1124952     2  0.1414      0.942 0.020 0.980
#> GSM1124957     1  0.1184      0.749 0.984 0.016
#> GSM1124900     2  0.0000      0.957 0.000 1.000
#> GSM1124914     2  0.0000      0.957 0.000 1.000
#> GSM1124871     2  0.0000      0.957 0.000 1.000
#> GSM1124874     2  0.0000      0.957 0.000 1.000
#> GSM1124875     2  0.0000      0.957 0.000 1.000
#> GSM1124880     2  0.0376      0.954 0.004 0.996
#> GSM1124881     2  0.0000      0.957 0.000 1.000
#> GSM1124885     2  0.0000      0.957 0.000 1.000
#> GSM1124886     1  0.8813      0.825 0.700 0.300
#> GSM1124887     2  0.0000      0.957 0.000 1.000
#> GSM1124894     2  0.1414      0.937 0.020 0.980
#> GSM1124896     1  0.9686      0.695 0.604 0.396
#> GSM1124899     2  0.0000      0.957 0.000 1.000
#> GSM1124901     2  0.0000      0.957 0.000 1.000
#> GSM1124906     2  0.0000      0.957 0.000 1.000
#> GSM1124907     2  0.0000      0.957 0.000 1.000
#> GSM1124911     2  0.0000      0.957 0.000 1.000
#> GSM1124912     1  0.8955      0.826 0.688 0.312
#> GSM1124915     2  0.0000      0.957 0.000 1.000
#> GSM1124917     2  0.0000      0.957 0.000 1.000
#> GSM1124918     2  0.0000      0.957 0.000 1.000
#> GSM1124920     1  0.1414      0.760 0.980 0.020
#> GSM1124922     2  0.0000      0.957 0.000 1.000
#> GSM1124924     2  0.0000      0.957 0.000 1.000
#> GSM1124926     2  0.0000      0.957 0.000 1.000
#> GSM1124928     1  0.8955      0.826 0.688 0.312
#> GSM1124930     2  0.0000      0.957 0.000 1.000
#> GSM1124931     2  0.0000      0.957 0.000 1.000
#> GSM1124935     2  0.0000      0.957 0.000 1.000
#> GSM1124936     1  0.1414      0.760 0.980 0.020
#> GSM1124938     2  0.9427      0.407 0.360 0.640
#> GSM1124940     1  0.8955      0.826 0.688 0.312
#> GSM1124941     2  0.0000      0.957 0.000 1.000
#> GSM1124942     2  0.0000      0.957 0.000 1.000
#> GSM1124943     2  0.2603      0.912 0.044 0.956
#> GSM1124948     2  0.0000      0.957 0.000 1.000
#> GSM1124949     1  0.8955      0.826 0.688 0.312
#> GSM1124950     2  0.0000      0.957 0.000 1.000
#> GSM1124954     1  0.1414      0.760 0.980 0.020
#> GSM1124955     1  0.8955      0.826 0.688 0.312
#> GSM1124956     2  0.0000      0.957 0.000 1.000
#> GSM1124872     2  0.0000      0.957 0.000 1.000
#> GSM1124873     2  0.0000      0.957 0.000 1.000
#> GSM1124876     1  0.1414      0.760 0.980 0.020
#> GSM1124877     1  0.8955      0.826 0.688 0.312
#> GSM1124879     1  0.8955      0.826 0.688 0.312
#> GSM1124883     2  0.0000      0.957 0.000 1.000
#> GSM1124889     2  0.0000      0.957 0.000 1.000
#> GSM1124892     1  0.1414      0.760 0.980 0.020
#> GSM1124893     1  0.8955      0.826 0.688 0.312
#> GSM1124909     2  0.0000      0.957 0.000 1.000
#> GSM1124913     2  0.0000      0.957 0.000 1.000
#> GSM1124916     2  0.0000      0.957 0.000 1.000
#> GSM1124923     2  0.0000      0.957 0.000 1.000
#> GSM1124925     1  0.8955      0.826 0.688 0.312
#> GSM1124929     1  0.8955      0.826 0.688 0.312
#> GSM1124934     1  0.8555      0.822 0.720 0.280
#> GSM1124937     2  0.0000      0.957 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
#> GSM1124891     1  0.6896     0.6507 0.588 0.020 0.392
#> GSM1124888     1  0.6095     0.6669 0.608 0.000 0.392
#> GSM1124890     2  0.3038     0.7740 0.000 0.896 0.104
#> GSM1124904     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124927     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124953     2  0.6095     0.2562 0.000 0.608 0.392
#> GSM1124869     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124870     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124882     1  0.0424     0.7978 0.992 0.008 0.000
#> GSM1124884     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124898     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124903     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124905     2  0.6252    -0.1424 0.444 0.556 0.000
#> GSM1124910     1  0.0424     0.7982 0.992 0.008 0.000
#> GSM1124919     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124932     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124933     1  0.9601     0.3862 0.408 0.200 0.392
#> GSM1124867     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124868     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124878     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124895     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124897     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124902     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124908     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124921     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124939     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124944     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124945     2  0.6267     0.1229 0.000 0.548 0.452
#> GSM1124946     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124947     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124951     2  0.6483     0.2413 0.008 0.600 0.392
#> GSM1124952     3  0.6095     0.9155 0.000 0.392 0.608
#> GSM1124957     3  0.5058    -0.2611 0.244 0.000 0.756
#> GSM1124900     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124914     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124871     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124874     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124875     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124880     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124881     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124885     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124886     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124887     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124894     2  0.1031     0.8954 0.024 0.976 0.000
#> GSM1124896     1  0.6215     0.0207 0.572 0.428 0.000
#> GSM1124899     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124901     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124906     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124907     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124911     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124912     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124915     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124917     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124918     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124920     1  0.6095     0.6669 0.608 0.000 0.392
#> GSM1124922     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124924     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124926     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124928     1  0.6095     0.1135 0.608 0.392 0.000
#> GSM1124930     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124931     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124935     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124936     1  0.6095     0.6669 0.608 0.000 0.392
#> GSM1124938     2  0.6314     0.2490 0.004 0.604 0.392
#> GSM1124940     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124941     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124942     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124943     2  0.1860     0.8577 0.000 0.948 0.052
#> GSM1124948     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124949     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124950     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124954     1  0.6095     0.6669 0.608 0.000 0.392
#> GSM1124955     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124956     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124872     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124873     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124876     1  0.6095     0.6669 0.608 0.000 0.392
#> GSM1124877     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124879     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124883     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124889     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124892     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124893     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124909     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124913     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124916     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124923     2  0.0000     0.9311 0.000 1.000 0.000
#> GSM1124925     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124929     1  0.0000     0.8032 1.000 0.000 0.000
#> GSM1124934     1  0.7741     0.2663 0.608 0.324 0.068
#> GSM1124937     2  0.0000     0.9311 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
#> GSM1124891     3  0.3852      0.704 0.192 0.008 0.800 0.000
#> GSM1124888     3  0.3610      0.702 0.200 0.000 0.800 0.000
#> GSM1124890     3  0.4898     -0.103 0.000 0.416 0.584 0.000
#> GSM1124904     2  0.3610      0.831 0.000 0.800 0.200 0.000
#> GSM1124927     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124953     3  0.0000      0.739 0.000 0.000 1.000 0.000
#> GSM1124869     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124870     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124882     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124898     2  0.3528      0.835 0.000 0.808 0.192 0.000
#> GSM1124903     2  0.3610      0.831 0.000 0.800 0.200 0.000
#> GSM1124905     2  0.4830      0.484 0.392 0.608 0.000 0.000
#> GSM1124910     1  0.0592      0.969 0.984 0.016 0.000 0.000
#> GSM1124919     2  0.3610      0.831 0.000 0.800 0.200 0.000
#> GSM1124932     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124933     3  0.0000      0.739 0.000 0.000 1.000 0.000
#> GSM1124867     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124868     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124878     2  0.3569      0.833 0.000 0.804 0.196 0.000
#> GSM1124895     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124897     2  0.3569      0.833 0.000 0.804 0.196 0.000
#> GSM1124902     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.1940      0.857 0.000 0.076 0.000 0.924
#> GSM1124921     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124944     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124945     3  0.0000      0.739 0.000 0.000 1.000 0.000
#> GSM1124946     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124951     3  0.0000      0.739 0.000 0.000 1.000 0.000
#> GSM1124952     4  0.0000      0.985 0.000 0.000 0.000 1.000
#> GSM1124957     3  0.2647      0.676 0.000 0.000 0.880 0.120
#> GSM1124900     2  0.0469      0.880 0.012 0.988 0.000 0.000
#> GSM1124914     2  0.3400      0.839 0.000 0.820 0.180 0.000
#> GSM1124871     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124874     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124875     2  0.3610      0.831 0.000 0.800 0.200 0.000
#> GSM1124880     2  0.2469      0.837 0.108 0.892 0.000 0.000
#> GSM1124881     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124885     2  0.3444      0.838 0.000 0.816 0.184 0.000
#> GSM1124886     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124887     2  0.3610      0.831 0.000 0.800 0.200 0.000
#> GSM1124894     2  0.2921      0.813 0.140 0.860 0.000 0.000
#> GSM1124896     2  0.4877      0.449 0.408 0.592 0.000 0.000
#> GSM1124899     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124901     2  0.3528      0.835 0.000 0.808 0.192 0.000
#> GSM1124906     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124907     2  0.3610      0.831 0.000 0.800 0.200 0.000
#> GSM1124911     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124912     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124917     2  0.1557      0.875 0.000 0.944 0.056 0.000
#> GSM1124918     2  0.1867      0.870 0.000 0.928 0.072 0.000
#> GSM1124920     3  0.4866      0.381 0.404 0.000 0.596 0.000
#> GSM1124922     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124924     2  0.1792      0.859 0.068 0.932 0.000 0.000
#> GSM1124926     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124928     2  0.4866      0.458 0.404 0.596 0.000 0.000
#> GSM1124930     2  0.3610      0.831 0.000 0.800 0.200 0.000
#> GSM1124931     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124935     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124936     3  0.3610      0.702 0.200 0.000 0.800 0.000
#> GSM1124938     3  0.0592      0.737 0.000 0.016 0.984 0.000
#> GSM1124940     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124942     2  0.3873      0.810 0.000 0.772 0.228 0.000
#> GSM1124943     2  0.4103      0.783 0.000 0.744 0.256 0.000
#> GSM1124948     2  0.2868      0.854 0.000 0.864 0.136 0.000
#> GSM1124949     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124954     3  0.6528      0.475 0.300 0.104 0.596 0.000
#> GSM1124955     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124872     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124873     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124876     3  0.3610      0.702 0.200 0.000 0.800 0.000
#> GSM1124877     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124883     2  0.3569      0.833 0.000 0.804 0.196 0.000
#> GSM1124889     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124892     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0469      0.881 0.000 0.988 0.012 0.000
#> GSM1124913     2  0.3610      0.831 0.000 0.800 0.200 0.000
#> GSM1124916     2  0.0000      0.882 0.000 1.000 0.000 0.000
#> GSM1124923     2  0.4500      0.711 0.000 0.684 0.316 0.000
#> GSM1124925     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM1124934     2  0.6660      0.354 0.288 0.592 0.120 0.000
#> GSM1124937     2  0.0707      0.877 0.020 0.980 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
#> GSM1124891     3  0.2769     0.8570 0.092 0.032 0.876 0.000 0.000
#> GSM1124888     3  0.2280     0.8555 0.120 0.000 0.880 0.000 0.000
#> GSM1124890     2  0.6137     0.3773 0.000 0.476 0.392 0.000 0.132
#> GSM1124904     2  0.4801     0.7689 0.000 0.728 0.124 0.000 0.148
#> GSM1124927     2  0.1764     0.7867 0.000 0.928 0.008 0.000 0.064
#> GSM1124953     3  0.0162     0.8625 0.000 0.004 0.996 0.000 0.000
#> GSM1124869     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.1908     0.7832 0.000 0.908 0.000 0.000 0.092
#> GSM1124882     1  0.0703     0.9269 0.976 0.024 0.000 0.000 0.000
#> GSM1124884     2  0.2929     0.7508 0.000 0.820 0.000 0.000 0.180
#> GSM1124898     2  0.4953     0.7626 0.000 0.712 0.124 0.000 0.164
#> GSM1124903     2  0.4840     0.7676 0.000 0.724 0.124 0.000 0.152
#> GSM1124905     2  0.4151     0.5892 0.344 0.652 0.004 0.000 0.000
#> GSM1124910     1  0.1830     0.8874 0.932 0.040 0.028 0.000 0.000
#> GSM1124919     2  0.4801     0.7689 0.000 0.728 0.124 0.000 0.148
#> GSM1124932     5  0.2605     0.9422 0.000 0.148 0.000 0.000 0.852
#> GSM1124933     3  0.0609     0.8654 0.000 0.020 0.980 0.000 0.000
#> GSM1124867     2  0.1792     0.7841 0.000 0.916 0.000 0.000 0.084
#> GSM1124868     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124878     2  0.4617     0.7739 0.000 0.744 0.108 0.000 0.148
#> GSM1124895     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124897     2  0.4665     0.7729 0.000 0.740 0.112 0.000 0.148
#> GSM1124902     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124908     4  0.2450     0.8367 0.000 0.076 0.000 0.896 0.028
#> GSM1124921     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124939     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124944     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124945     3  0.0000     0.8606 0.000 0.000 1.000 0.000 0.000
#> GSM1124946     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124947     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124951     3  0.1768     0.7937 0.000 0.072 0.924 0.000 0.004
#> GSM1124952     4  0.0000     0.9827 0.000 0.000 0.000 1.000 0.000
#> GSM1124957     3  0.1608     0.8444 0.000 0.000 0.928 0.072 0.000
#> GSM1124900     2  0.1857     0.7877 0.004 0.928 0.008 0.000 0.060
#> GSM1124914     2  0.4138     0.7808 0.000 0.780 0.072 0.000 0.148
#> GSM1124871     2  0.2074     0.7804 0.000 0.896 0.000 0.000 0.104
#> GSM1124874     2  0.1671     0.7839 0.000 0.924 0.000 0.000 0.076
#> GSM1124875     2  0.2612     0.7969 0.000 0.868 0.124 0.000 0.008
#> GSM1124880     2  0.1671     0.7838 0.000 0.924 0.076 0.000 0.000
#> GSM1124881     2  0.2230     0.7772 0.000 0.884 0.000 0.000 0.116
#> GSM1124885     2  0.4138     0.7804 0.000 0.780 0.072 0.000 0.148
#> GSM1124886     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     2  0.4801     0.7689 0.000 0.728 0.124 0.000 0.148
#> GSM1124894     2  0.2208     0.7818 0.020 0.908 0.072 0.000 0.000
#> GSM1124896     2  0.4161     0.5171 0.392 0.608 0.000 0.000 0.000
#> GSM1124899     2  0.2424     0.7745 0.000 0.868 0.000 0.000 0.132
#> GSM1124901     2  0.3719     0.7929 0.000 0.816 0.116 0.000 0.068
#> GSM1124906     2  0.2891     0.7527 0.000 0.824 0.000 0.000 0.176
#> GSM1124907     2  0.4801     0.7689 0.000 0.728 0.124 0.000 0.148
#> GSM1124911     5  0.2605     0.9422 0.000 0.148 0.000 0.000 0.852
#> GSM1124912     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.2605     0.9422 0.000 0.148 0.000 0.000 0.852
#> GSM1124917     2  0.3130     0.7921 0.000 0.856 0.048 0.000 0.096
#> GSM1124918     5  0.2605     0.9368 0.000 0.148 0.000 0.000 0.852
#> GSM1124920     3  0.3949     0.5454 0.332 0.000 0.668 0.000 0.000
#> GSM1124922     2  0.1908     0.7892 0.000 0.908 0.000 0.000 0.092
#> GSM1124924     2  0.1671     0.7838 0.000 0.924 0.076 0.000 0.000
#> GSM1124926     2  0.2424     0.7730 0.000 0.868 0.000 0.000 0.132
#> GSM1124928     2  0.4624     0.5793 0.340 0.636 0.024 0.000 0.000
#> GSM1124930     2  0.5093     0.7532 0.000 0.696 0.124 0.000 0.180
#> GSM1124931     5  0.2605     0.9422 0.000 0.148 0.000 0.000 0.852
#> GSM1124935     5  0.2605     0.9422 0.000 0.148 0.000 0.000 0.852
#> GSM1124936     3  0.2329     0.8515 0.124 0.000 0.876 0.000 0.000
#> GSM1124938     3  0.1484     0.8560 0.000 0.048 0.944 0.000 0.008
#> GSM1124940     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.2891     0.7527 0.000 0.824 0.000 0.000 0.176
#> GSM1124942     2  0.4971     0.7695 0.000 0.712 0.144 0.000 0.144
#> GSM1124943     2  0.4879     0.7583 0.000 0.716 0.176 0.000 0.108
#> GSM1124948     2  0.2127     0.8023 0.000 0.892 0.108 0.000 0.000
#> GSM1124949     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.1907     0.7883 0.000 0.928 0.028 0.000 0.044
#> GSM1124954     5  0.2690     0.7456 0.156 0.000 0.000 0.000 0.844
#> GSM1124955     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     5  0.2605     0.9422 0.000 0.148 0.000 0.000 0.852
#> GSM1124872     2  0.1608     0.7843 0.000 0.928 0.072 0.000 0.000
#> GSM1124873     2  0.2605     0.7658 0.000 0.852 0.000 0.000 0.148
#> GSM1124876     3  0.2280     0.8555 0.120 0.000 0.880 0.000 0.000
#> GSM1124877     1  0.4307     0.0394 0.500 0.000 0.000 0.000 0.500
#> GSM1124879     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124883     2  0.4757     0.7707 0.000 0.732 0.120 0.000 0.148
#> GSM1124889     2  0.1732     0.7846 0.000 0.920 0.000 0.000 0.080
#> GSM1124892     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.1410     0.7907 0.000 0.940 0.000 0.000 0.060
#> GSM1124913     2  0.4801     0.7689 0.000 0.728 0.124 0.000 0.148
#> GSM1124916     5  0.2773     0.9285 0.000 0.164 0.000 0.000 0.836
#> GSM1124923     2  0.5125     0.7507 0.000 0.696 0.156 0.000 0.148
#> GSM1124925     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9490 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     5  0.2605     0.7558 0.148 0.000 0.000 0.000 0.852
#> GSM1124937     2  0.1918     0.7879 0.036 0.928 0.000 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.0000     0.8392 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124888     3  0.3841     0.6001 0.000 0.000 0.616 0.000 0.380 0.004
#> GSM1124890     5  0.5434     0.5767 0.000 0.272 0.164 0.000 0.564 0.000
#> GSM1124904     5  0.3717     0.6442 0.000 0.384 0.000 0.000 0.616 0.000
#> GSM1124927     2  0.0000     0.8283 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124953     3  0.2135     0.7916 0.000 0.000 0.872 0.000 0.128 0.000
#> GSM1124869     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.0713     0.8309 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM1124882     1  0.2237     0.8233 0.896 0.068 0.036 0.000 0.000 0.000
#> GSM1124884     2  0.2454     0.7654 0.000 0.840 0.000 0.000 0.000 0.160
#> GSM1124898     5  0.3737     0.6382 0.000 0.392 0.000 0.000 0.608 0.000
#> GSM1124903     5  0.3717     0.6442 0.000 0.384 0.000 0.000 0.616 0.000
#> GSM1124905     2  0.2527     0.6708 0.168 0.832 0.000 0.000 0.000 0.000
#> GSM1124910     1  0.6178     0.2727 0.472 0.080 0.068 0.000 0.380 0.000
#> GSM1124919     5  0.3852     0.6444 0.000 0.384 0.004 0.000 0.612 0.000
#> GSM1124932     6  0.0260     0.9886 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1124933     3  0.0000     0.8392 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     2  0.0713     0.8307 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM1124868     4  0.0000     0.9605 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124878     5  0.3765     0.6292 0.000 0.404 0.000 0.000 0.596 0.000
#> GSM1124895     4  0.0000     0.9605 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124897     5  0.3789     0.6158 0.000 0.416 0.000 0.000 0.584 0.000
#> GSM1124902     4  0.0000     0.9605 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124908     4  0.4114     0.6385 0.000 0.072 0.000 0.732 0.196 0.000
#> GSM1124921     4  0.0632     0.9404 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM1124939     4  0.0000     0.9605 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0000     0.9605 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124945     3  0.2135     0.7916 0.000 0.000 0.872 0.000 0.128 0.000
#> GSM1124946     4  0.0000     0.9605 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124947     4  0.0000     0.9605 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124951     3  0.2697     0.7342 0.000 0.000 0.812 0.000 0.188 0.000
#> GSM1124952     4  0.0000     0.9605 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124957     3  0.0000     0.8392 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     2  0.0000     0.8283 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124914     2  0.3838    -0.3304 0.000 0.552 0.000 0.000 0.448 0.000
#> GSM1124871     2  0.1444     0.8186 0.000 0.928 0.000 0.000 0.000 0.072
#> GSM1124874     2  0.0146     0.8292 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1124875     2  0.2814     0.6493 0.000 0.820 0.000 0.000 0.172 0.008
#> GSM1124880     2  0.1267     0.8054 0.000 0.940 0.060 0.000 0.000 0.000
#> GSM1124881     2  0.1444     0.8186 0.000 0.928 0.000 0.000 0.000 0.072
#> GSM1124885     5  0.3838     0.5629 0.000 0.448 0.000 0.000 0.552 0.000
#> GSM1124886     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.3717     0.6442 0.000 0.384 0.000 0.000 0.616 0.000
#> GSM1124894     2  0.0820     0.8197 0.016 0.972 0.012 0.000 0.000 0.000
#> GSM1124896     2  0.5028     0.4355 0.248 0.636 0.112 0.000 0.004 0.000
#> GSM1124899     2  0.1814     0.8096 0.000 0.900 0.000 0.000 0.000 0.100
#> GSM1124901     2  0.3837     0.5686 0.000 0.752 0.000 0.000 0.196 0.052
#> GSM1124906     2  0.2416     0.7687 0.000 0.844 0.000 0.000 0.000 0.156
#> GSM1124907     5  0.0260     0.3231 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM1124911     6  0.0260     0.9886 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1124912     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.0260     0.9886 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1124917     2  0.2799     0.7778 0.000 0.860 0.000 0.000 0.064 0.076
#> GSM1124918     6  0.0363     0.9855 0.000 0.012 0.000 0.000 0.000 0.988
#> GSM1124920     3  0.5613     0.4445 0.148 0.000 0.468 0.000 0.384 0.000
#> GSM1124922     2  0.0891     0.8305 0.000 0.968 0.000 0.000 0.008 0.024
#> GSM1124924     2  0.4519     0.1823 0.000 0.584 0.024 0.000 0.384 0.008
#> GSM1124926     2  0.1910     0.8057 0.000 0.892 0.000 0.000 0.000 0.108
#> GSM1124928     2  0.2631     0.6535 0.180 0.820 0.000 0.000 0.000 0.000
#> GSM1124930     5  0.0806     0.3296 0.000 0.020 0.000 0.000 0.972 0.008
#> GSM1124931     6  0.0260     0.9886 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1124935     6  0.0260     0.9886 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1124936     3  0.0000     0.8392 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124938     5  0.4982    -0.5255 0.000 0.048 0.456 0.000 0.488 0.008
#> GSM1124940     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.2416     0.7687 0.000 0.844 0.000 0.000 0.000 0.156
#> GSM1124942     5  0.3001     0.3175 0.000 0.128 0.024 0.000 0.840 0.008
#> GSM1124943     5  0.3533     0.2930 0.000 0.196 0.020 0.000 0.776 0.008
#> GSM1124948     5  0.4488    -0.0916 0.000 0.468 0.016 0.000 0.508 0.008
#> GSM1124949     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.0146     0.8297 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1124954     6  0.0806     0.9734 0.000 0.008 0.020 0.000 0.000 0.972
#> GSM1124955     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     6  0.0260     0.9886 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1124872     2  0.0260     0.8251 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM1124873     2  0.2300     0.7783 0.000 0.856 0.000 0.000 0.000 0.144
#> GSM1124876     3  0.0000     0.8392 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     1  0.3869     0.0147 0.500 0.000 0.000 0.000 0.000 0.500
#> GSM1124879     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.3774     0.6170 0.000 0.408 0.000 0.000 0.592 0.000
#> GSM1124889     2  0.0458     0.8315 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM1124892     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.0000     0.8283 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124913     5  0.3717     0.6442 0.000 0.384 0.000 0.000 0.616 0.000
#> GSM1124916     6  0.0713     0.9700 0.000 0.028 0.000 0.000 0.000 0.972
#> GSM1124923     5  0.3945     0.6445 0.000 0.380 0.008 0.000 0.612 0.000
#> GSM1124925     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9093 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     6  0.1307     0.9546 0.032 0.008 0.008 0.000 0.000 0.952
#> GSM1124937     2  0.0000     0.8283 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

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

test_to_known_factors(res)
#>         n tissue(p) k
#> CV:pam 88  1.01e-01 2
#> CV:pam 81  1.24e-09 3
#> CV:pam 84  1.06e-08 4
#> CV:pam 89  2.60e-07 5
#> CV:pam 79  3.31e-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 48983 rows and 91 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.507           0.817       0.891         0.3641 0.693   0.693
#> 3 3 0.396           0.789       0.857         0.5987 0.636   0.486
#> 4 4 0.555           0.741       0.817         0.1124 0.904   0.764
#> 5 5 0.727           0.812       0.866         0.1371 0.901   0.724
#> 6 6 0.780           0.644       0.820         0.0449 0.979   0.920

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

suggest_best_k(res)
#> [1] 5

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.8144      0.777 0.748 0.252
#> GSM1124888     1  1.0000      0.274 0.504 0.496
#> GSM1124890     1  0.7453      0.808 0.788 0.212
#> GSM1124904     1  0.0376      0.856 0.996 0.004
#> GSM1124927     1  0.7950      0.801 0.760 0.240
#> GSM1124953     1  0.7219      0.814 0.800 0.200
#> GSM1124869     1  0.7950      0.801 0.760 0.240
#> GSM1124870     1  0.7950      0.801 0.760 0.240
#> GSM1124882     1  0.7950      0.801 0.760 0.240
#> GSM1124884     1  0.0376      0.857 0.996 0.004
#> GSM1124898     1  0.0000      0.857 1.000 0.000
#> GSM1124903     1  0.1843      0.851 0.972 0.028
#> GSM1124905     1  0.9996      0.346 0.512 0.488
#> GSM1124910     1  0.7528      0.806 0.784 0.216
#> GSM1124919     1  0.0000      0.857 1.000 0.000
#> GSM1124932     1  0.0000      0.857 1.000 0.000
#> GSM1124933     1  1.0000      0.274 0.504 0.496
#> GSM1124867     2  0.8016      0.565 0.244 0.756
#> GSM1124868     2  0.0000      0.929 0.000 1.000
#> GSM1124878     2  0.7602      0.711 0.220 0.780
#> GSM1124895     2  0.0000      0.929 0.000 1.000
#> GSM1124897     2  0.7528      0.714 0.216 0.784
#> GSM1124902     2  0.0000      0.929 0.000 1.000
#> GSM1124908     2  0.0000      0.929 0.000 1.000
#> GSM1124921     2  0.0000      0.929 0.000 1.000
#> GSM1124939     2  0.0000      0.929 0.000 1.000
#> GSM1124944     2  0.0000      0.929 0.000 1.000
#> GSM1124945     2  0.1633      0.918 0.024 0.976
#> GSM1124946     2  0.0000      0.929 0.000 1.000
#> GSM1124947     2  0.0000      0.929 0.000 1.000
#> GSM1124951     2  0.1633      0.918 0.024 0.976
#> GSM1124952     2  0.0000      0.929 0.000 1.000
#> GSM1124957     2  0.1633      0.918 0.024 0.976
#> GSM1124900     1  0.7950      0.801 0.760 0.240
#> GSM1124914     1  0.1184      0.855 0.984 0.016
#> GSM1124871     1  0.0376      0.857 0.996 0.004
#> GSM1124874     1  0.1414      0.854 0.980 0.020
#> GSM1124875     1  0.0000      0.857 1.000 0.000
#> GSM1124880     1  0.7528      0.806 0.784 0.216
#> GSM1124881     1  0.0938      0.856 0.988 0.012
#> GSM1124885     1  0.1184      0.855 0.984 0.016
#> GSM1124886     1  0.7950      0.801 0.760 0.240
#> GSM1124887     1  0.0000      0.857 1.000 0.000
#> GSM1124894     2  0.5737      0.776 0.136 0.864
#> GSM1124896     1  0.7950      0.801 0.760 0.240
#> GSM1124899     1  0.0938      0.856 0.988 0.012
#> GSM1124901     1  0.0000      0.857 1.000 0.000
#> GSM1124906     1  0.0938      0.856 0.988 0.012
#> GSM1124907     1  0.0000      0.857 1.000 0.000
#> GSM1124911     1  0.0000      0.857 1.000 0.000
#> GSM1124912     1  0.7950      0.801 0.760 0.240
#> GSM1124915     1  0.0000      0.857 1.000 0.000
#> GSM1124917     1  0.0000      0.857 1.000 0.000
#> GSM1124918     1  0.0000      0.857 1.000 0.000
#> GSM1124920     1  0.7528      0.806 0.784 0.216
#> GSM1124922     1  0.1633      0.852 0.976 0.024
#> GSM1124924     1  0.7376      0.810 0.792 0.208
#> GSM1124926     1  0.1633      0.852 0.976 0.024
#> GSM1124928     1  0.7883      0.802 0.764 0.236
#> GSM1124930     1  0.0000      0.857 1.000 0.000
#> GSM1124931     1  0.0000      0.857 1.000 0.000
#> GSM1124935     1  0.0000      0.857 1.000 0.000
#> GSM1124936     1  0.7528      0.806 0.784 0.216
#> GSM1124938     1  0.5519      0.834 0.872 0.128
#> GSM1124940     1  0.7950      0.801 0.760 0.240
#> GSM1124941     1  0.0000      0.857 1.000 0.000
#> GSM1124942     1  0.0000      0.857 1.000 0.000
#> GSM1124943     1  0.0000      0.857 1.000 0.000
#> GSM1124948     1  0.0000      0.857 1.000 0.000
#> GSM1124949     1  0.7950      0.801 0.760 0.240
#> GSM1124950     1  0.0000      0.857 1.000 0.000
#> GSM1124954     1  0.7528      0.806 0.784 0.216
#> GSM1124955     1  0.7950      0.801 0.760 0.240
#> GSM1124956     1  0.0000      0.857 1.000 0.000
#> GSM1124872     1  0.0376      0.857 0.996 0.004
#> GSM1124873     1  0.0672      0.857 0.992 0.008
#> GSM1124876     1  1.0000      0.274 0.504 0.496
#> GSM1124877     1  0.7950      0.801 0.760 0.240
#> GSM1124879     1  0.7950      0.801 0.760 0.240
#> GSM1124883     1  0.1184      0.855 0.984 0.016
#> GSM1124889     1  0.0000      0.857 1.000 0.000
#> GSM1124892     1  0.7950      0.801 0.760 0.240
#> GSM1124893     1  0.7950      0.801 0.760 0.240
#> GSM1124909     1  0.0000      0.857 1.000 0.000
#> GSM1124913     1  0.0672      0.857 0.992 0.008
#> GSM1124916     1  0.0000      0.857 1.000 0.000
#> GSM1124923     1  0.0000      0.857 1.000 0.000
#> GSM1124925     1  0.7950      0.801 0.760 0.240
#> GSM1124929     1  0.7950      0.801 0.760 0.240
#> GSM1124934     1  0.7528      0.806 0.784 0.216
#> GSM1124937     1  0.7950      0.801 0.760 0.240

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.9623    -0.1266 0.336 0.216 0.448
#> GSM1124888     3  0.9243    -0.0790 0.368 0.160 0.472
#> GSM1124890     2  0.4473     0.8024 0.008 0.828 0.164
#> GSM1124904     2  0.3816     0.8199 0.000 0.852 0.148
#> GSM1124927     2  0.6577    -0.1476 0.420 0.572 0.008
#> GSM1124953     2  0.4233     0.8084 0.004 0.836 0.160
#> GSM1124869     1  0.4002     0.8878 0.840 0.160 0.000
#> GSM1124870     1  0.5461     0.8353 0.748 0.244 0.008
#> GSM1124882     1  0.4473     0.8890 0.828 0.164 0.008
#> GSM1124884     2  0.0892     0.9063 0.020 0.980 0.000
#> GSM1124898     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124903     2  0.4473     0.8059 0.008 0.828 0.164
#> GSM1124905     1  0.6920     0.6600 0.732 0.104 0.164
#> GSM1124910     1  0.7724     0.7845 0.680 0.164 0.156
#> GSM1124919     2  0.4233     0.8084 0.004 0.836 0.160
#> GSM1124932     2  0.0892     0.9063 0.020 0.980 0.000
#> GSM1124933     3  0.9501    -0.0433 0.324 0.204 0.472
#> GSM1124867     3  0.6920     0.6641 0.164 0.104 0.732
#> GSM1124868     3  0.2636     0.7940 0.020 0.048 0.932
#> GSM1124878     3  0.6226     0.5778 0.028 0.252 0.720
#> GSM1124895     3  0.2066     0.8111 0.060 0.000 0.940
#> GSM1124897     3  0.3850     0.7641 0.028 0.088 0.884
#> GSM1124902     3  0.1860     0.8121 0.052 0.000 0.948
#> GSM1124908     3  0.0424     0.8119 0.008 0.000 0.992
#> GSM1124921     3  0.0000     0.8128 0.000 0.000 1.000
#> GSM1124939     3  0.2066     0.8111 0.060 0.000 0.940
#> GSM1124944     3  0.0747     0.8137 0.016 0.000 0.984
#> GSM1124945     3  0.3551     0.7953 0.132 0.000 0.868
#> GSM1124946     3  0.0000     0.8128 0.000 0.000 1.000
#> GSM1124947     3  0.1860     0.8127 0.052 0.000 0.948
#> GSM1124951     3  0.3412     0.7961 0.124 0.000 0.876
#> GSM1124952     3  0.0592     0.8125 0.012 0.000 0.988
#> GSM1124957     3  0.3551     0.7953 0.132 0.000 0.868
#> GSM1124900     1  0.4645     0.8858 0.816 0.176 0.008
#> GSM1124914     2  0.3459     0.8078 0.012 0.892 0.096
#> GSM1124871     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124874     2  0.0892     0.9063 0.020 0.980 0.000
#> GSM1124875     2  0.0000     0.9012 0.000 1.000 0.000
#> GSM1124880     1  0.7880     0.7759 0.668 0.168 0.164
#> GSM1124881     2  0.0892     0.9063 0.020 0.980 0.000
#> GSM1124885     2  0.0661     0.8951 0.004 0.988 0.008
#> GSM1124886     1  0.4002     0.8878 0.840 0.160 0.000
#> GSM1124887     2  0.4110     0.8148 0.004 0.844 0.152
#> GSM1124894     3  0.1860     0.8048 0.052 0.000 0.948
#> GSM1124896     1  0.4531     0.8880 0.824 0.168 0.008
#> GSM1124899     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124901     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124906     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124907     2  0.4413     0.8066 0.008 0.832 0.160
#> GSM1124911     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124912     1  0.4002     0.8878 0.840 0.160 0.000
#> GSM1124915     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124917     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124918     2  0.1170     0.9038 0.016 0.976 0.008
#> GSM1124920     1  0.8199     0.7337 0.640 0.160 0.200
#> GSM1124922     2  0.0892     0.9063 0.020 0.980 0.000
#> GSM1124924     1  0.9342     0.4575 0.452 0.380 0.168
#> GSM1124926     2  0.1315     0.9022 0.020 0.972 0.008
#> GSM1124928     1  0.4473     0.8890 0.828 0.164 0.008
#> GSM1124930     2  0.4413     0.8066 0.008 0.832 0.160
#> GSM1124931     2  0.1753     0.8837 0.048 0.952 0.000
#> GSM1124935     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124936     1  0.7878     0.7655 0.668 0.160 0.172
#> GSM1124938     2  0.4413     0.8066 0.008 0.832 0.160
#> GSM1124940     1  0.4062     0.8890 0.836 0.164 0.000
#> GSM1124941     2  0.1315     0.9013 0.020 0.972 0.008
#> GSM1124942     2  0.4413     0.8066 0.008 0.832 0.160
#> GSM1124943     2  0.4413     0.8066 0.008 0.832 0.160
#> GSM1124948     2  0.4723     0.8120 0.016 0.824 0.160
#> GSM1124949     1  0.4062     0.8890 0.836 0.164 0.000
#> GSM1124950     2  0.0892     0.9063 0.020 0.980 0.000
#> GSM1124954     1  0.8670     0.7114 0.592 0.240 0.168
#> GSM1124955     1  0.4062     0.8890 0.836 0.164 0.000
#> GSM1124956     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124872     2  0.0892     0.9063 0.020 0.980 0.000
#> GSM1124873     2  0.0892     0.9063 0.020 0.980 0.000
#> GSM1124876     3  0.9243    -0.0790 0.368 0.160 0.472
#> GSM1124877     1  0.4473     0.8890 0.828 0.164 0.008
#> GSM1124879     1  0.4293     0.8893 0.832 0.164 0.004
#> GSM1124883     2  0.0237     0.8997 0.004 0.996 0.000
#> GSM1124889     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124892     1  0.6848     0.8329 0.736 0.164 0.100
#> GSM1124893     1  0.4002     0.8878 0.840 0.160 0.000
#> GSM1124909     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124913     2  0.0829     0.8985 0.004 0.984 0.012
#> GSM1124916     2  0.0747     0.9074 0.016 0.984 0.000
#> GSM1124923     2  0.4413     0.8066 0.008 0.832 0.160
#> GSM1124925     1  0.4062     0.8890 0.836 0.164 0.000
#> GSM1124929     1  0.4062     0.8890 0.836 0.164 0.000
#> GSM1124934     1  0.8495     0.7302 0.612 0.220 0.168
#> GSM1124937     1  0.5502     0.8326 0.744 0.248 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.8622     0.7491 0.236 0.148 0.516 0.100
#> GSM1124888     3  0.8396     0.7611 0.212 0.140 0.548 0.100
#> GSM1124890     2  0.3925     0.7051 0.016 0.808 0.176 0.000
#> GSM1124904     2  0.3037     0.7876 0.036 0.888 0.076 0.000
#> GSM1124927     2  0.5178     0.4550 0.392 0.600 0.004 0.004
#> GSM1124953     2  0.3925     0.7051 0.016 0.808 0.176 0.000
#> GSM1124869     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124870     1  0.2777     0.7818 0.888 0.104 0.004 0.004
#> GSM1124882     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124884     2  0.3280     0.8316 0.124 0.860 0.016 0.000
#> GSM1124898     2  0.3542     0.8301 0.120 0.852 0.028 0.000
#> GSM1124903     2  0.3342     0.7948 0.032 0.880 0.080 0.008
#> GSM1124905     1  0.5274     0.4375 0.724 0.036 0.008 0.232
#> GSM1124910     1  0.1798     0.8309 0.944 0.016 0.040 0.000
#> GSM1124919     2  0.3925     0.7051 0.016 0.808 0.176 0.000
#> GSM1124932     2  0.3842     0.8286 0.128 0.836 0.036 0.000
#> GSM1124933     3  0.8408     0.7593 0.208 0.144 0.548 0.100
#> GSM1124867     2  0.8129     0.0580 0.024 0.424 0.176 0.376
#> GSM1124868     4  0.4439     0.7484 0.004 0.048 0.140 0.808
#> GSM1124878     2  0.7220     0.0777 0.000 0.440 0.140 0.420
#> GSM1124895     4  0.2760     0.8342 0.000 0.000 0.128 0.872
#> GSM1124897     2  0.7252     0.0642 0.000 0.436 0.144 0.420
#> GSM1124902     4  0.2760     0.8342 0.000 0.000 0.128 0.872
#> GSM1124908     4  0.2921     0.8009 0.000 0.000 0.140 0.860
#> GSM1124921     4  0.3764     0.8193 0.000 0.000 0.216 0.784
#> GSM1124939     4  0.2760     0.8342 0.000 0.000 0.128 0.872
#> GSM1124944     4  0.2469     0.8397 0.000 0.000 0.108 0.892
#> GSM1124945     3  0.2921     0.4396 0.000 0.000 0.860 0.140
#> GSM1124946     4  0.3907     0.8194 0.000 0.000 0.232 0.768
#> GSM1124947     4  0.2530     0.8280 0.000 0.000 0.112 0.888
#> GSM1124951     3  0.3311     0.4200 0.000 0.000 0.828 0.172
#> GSM1124952     4  0.1716     0.8266 0.000 0.000 0.064 0.936
#> GSM1124957     3  0.2921     0.4396 0.000 0.000 0.860 0.140
#> GSM1124900     1  0.1576     0.8450 0.948 0.048 0.000 0.004
#> GSM1124914     2  0.4071     0.8002 0.028 0.852 0.036 0.084
#> GSM1124871     2  0.3161     0.8326 0.124 0.864 0.012 0.000
#> GSM1124874     2  0.3842     0.8286 0.128 0.836 0.036 0.000
#> GSM1124875     2  0.3439     0.7919 0.048 0.868 0.084 0.000
#> GSM1124880     1  0.6042     0.1887 0.580 0.368 0.052 0.000
#> GSM1124881     2  0.4071     0.8301 0.104 0.844 0.036 0.016
#> GSM1124885     2  0.3272     0.8035 0.036 0.892 0.052 0.020
#> GSM1124886     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124887     2  0.3161     0.7463 0.012 0.864 0.124 0.000
#> GSM1124894     4  0.5961     0.6686 0.108 0.004 0.188 0.700
#> GSM1124896     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124899     2  0.3787     0.8286 0.124 0.840 0.036 0.000
#> GSM1124901     2  0.3653     0.8293 0.128 0.844 0.028 0.000
#> GSM1124906     2  0.3787     0.8286 0.124 0.840 0.036 0.000
#> GSM1124907     2  0.3597     0.7281 0.016 0.836 0.148 0.000
#> GSM1124911     2  0.3787     0.8286 0.124 0.840 0.036 0.000
#> GSM1124912     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124915     2  0.3542     0.8304 0.120 0.852 0.028 0.000
#> GSM1124917     2  0.2799     0.8347 0.108 0.884 0.008 0.000
#> GSM1124918     2  0.3161     0.8318 0.124 0.864 0.012 0.000
#> GSM1124920     3  0.8262     0.7143 0.288 0.140 0.512 0.060
#> GSM1124922     2  0.3895     0.8303 0.132 0.832 0.036 0.000
#> GSM1124924     2  0.6603     0.4425 0.372 0.548 0.076 0.004
#> GSM1124926     2  0.3731     0.8302 0.120 0.844 0.036 0.000
#> GSM1124928     1  0.0921     0.8622 0.972 0.028 0.000 0.000
#> GSM1124930     2  0.3743     0.7190 0.016 0.824 0.160 0.000
#> GSM1124931     2  0.3787     0.8286 0.124 0.840 0.036 0.000
#> GSM1124935     2  0.3280     0.8311 0.124 0.860 0.016 0.000
#> GSM1124936     3  0.7452     0.5779 0.368 0.128 0.492 0.012
#> GSM1124938     2  0.4035     0.7015 0.020 0.804 0.176 0.000
#> GSM1124940     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124941     2  0.3725     0.8313 0.120 0.848 0.028 0.004
#> GSM1124942     2  0.3790     0.7157 0.016 0.820 0.164 0.000
#> GSM1124943     2  0.3925     0.7051 0.016 0.808 0.176 0.000
#> GSM1124948     2  0.3143     0.7588 0.024 0.876 0.100 0.000
#> GSM1124949     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124950     2  0.3731     0.8302 0.120 0.844 0.036 0.000
#> GSM1124954     1  0.6333     0.2184 0.576 0.364 0.052 0.008
#> GSM1124955     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124956     2  0.3787     0.8286 0.124 0.840 0.036 0.000
#> GSM1124872     2  0.3842     0.8286 0.128 0.836 0.036 0.000
#> GSM1124873     2  0.3842     0.8286 0.128 0.836 0.036 0.000
#> GSM1124876     3  0.8396     0.7611 0.212 0.140 0.548 0.100
#> GSM1124877     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124879     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124883     2  0.3400     0.8038 0.044 0.880 0.068 0.008
#> GSM1124889     2  0.3787     0.8286 0.124 0.840 0.036 0.000
#> GSM1124892     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124893     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124909     2  0.3842     0.8286 0.128 0.836 0.036 0.000
#> GSM1124913     2  0.3641     0.7986 0.052 0.868 0.072 0.008
#> GSM1124916     2  0.3787     0.8286 0.124 0.840 0.036 0.000
#> GSM1124923     2  0.3925     0.7051 0.016 0.808 0.176 0.000
#> GSM1124925     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124929     1  0.0592     0.8715 0.984 0.016 0.000 0.000
#> GSM1124934     1  0.5573     0.4428 0.676 0.272 0.052 0.000
#> GSM1124937     1  0.2654     0.7848 0.888 0.108 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
#> GSM1124891     3  0.4662      0.816 0.208 0.008 0.736 0.004 0.044
#> GSM1124888     3  0.4575      0.824 0.184 0.000 0.744 0.004 0.068
#> GSM1124890     5  0.2605      0.914 0.000 0.148 0.000 0.000 0.852
#> GSM1124904     2  0.3016      0.786 0.000 0.848 0.020 0.000 0.132
#> GSM1124927     2  0.4791      0.230 0.460 0.524 0.004 0.000 0.012
#> GSM1124953     5  0.2648      0.917 0.000 0.152 0.000 0.000 0.848
#> GSM1124869     1  0.0807      0.920 0.976 0.012 0.000 0.000 0.012
#> GSM1124870     1  0.2654      0.888 0.888 0.064 0.048 0.000 0.000
#> GSM1124882     1  0.1341      0.904 0.944 0.000 0.056 0.000 0.000
#> GSM1124884     2  0.0566      0.854 0.000 0.984 0.004 0.000 0.012
#> GSM1124898     2  0.2367      0.834 0.004 0.904 0.020 0.000 0.072
#> GSM1124903     2  0.4838      0.790 0.076 0.768 0.020 0.008 0.128
#> GSM1124905     1  0.2968      0.868 0.896 0.024 0.028 0.028 0.024
#> GSM1124910     1  0.3442      0.813 0.836 0.000 0.104 0.000 0.060
#> GSM1124919     5  0.2648      0.917 0.000 0.152 0.000 0.000 0.848
#> GSM1124932     2  0.0955      0.857 0.028 0.968 0.000 0.000 0.004
#> GSM1124933     3  0.4815      0.819 0.180 0.008 0.740 0.004 0.068
#> GSM1124867     2  0.8407     -0.058 0.208 0.388 0.104 0.284 0.016
#> GSM1124868     4  0.5398      0.617 0.000 0.200 0.088 0.692 0.020
#> GSM1124878     2  0.5902      0.397 0.000 0.588 0.084 0.312 0.016
#> GSM1124895     4  0.0162      0.878 0.000 0.000 0.004 0.996 0.000
#> GSM1124897     2  0.5932      0.375 0.000 0.580 0.084 0.320 0.016
#> GSM1124902     4  0.0324      0.878 0.000 0.000 0.004 0.992 0.004
#> GSM1124908     4  0.2293      0.846 0.000 0.000 0.084 0.900 0.016
#> GSM1124921     4  0.1670      0.864 0.000 0.000 0.052 0.936 0.012
#> GSM1124939     4  0.0000      0.879 0.000 0.000 0.000 1.000 0.000
#> GSM1124944     4  0.0000      0.879 0.000 0.000 0.000 1.000 0.000
#> GSM1124945     3  0.3141      0.646 0.000 0.000 0.852 0.040 0.108
#> GSM1124946     4  0.1740      0.863 0.000 0.000 0.056 0.932 0.012
#> GSM1124947     4  0.0162      0.879 0.000 0.000 0.000 0.996 0.004
#> GSM1124951     3  0.3085      0.648 0.000 0.000 0.852 0.032 0.116
#> GSM1124952     4  0.0290      0.878 0.000 0.000 0.000 0.992 0.008
#> GSM1124957     3  0.3620      0.642 0.000 0.000 0.824 0.068 0.108
#> GSM1124900     1  0.1651      0.907 0.944 0.036 0.008 0.000 0.012
#> GSM1124914     2  0.4080      0.814 0.076 0.808 0.012 0.000 0.104
#> GSM1124871     2  0.1041      0.858 0.032 0.964 0.004 0.000 0.000
#> GSM1124874     2  0.1894      0.841 0.072 0.920 0.000 0.000 0.008
#> GSM1124875     2  0.3209      0.745 0.000 0.812 0.008 0.000 0.180
#> GSM1124880     1  0.3319      0.848 0.864 0.020 0.052 0.000 0.064
#> GSM1124881     2  0.1956      0.839 0.076 0.916 0.000 0.000 0.008
#> GSM1124885     2  0.4363      0.802 0.072 0.792 0.020 0.000 0.116
#> GSM1124886     1  0.1124      0.915 0.960 0.004 0.036 0.000 0.000
#> GSM1124887     2  0.3210      0.709 0.000 0.788 0.000 0.000 0.212
#> GSM1124894     4  0.7931      0.400 0.120 0.260 0.120 0.484 0.016
#> GSM1124896     1  0.0968      0.921 0.972 0.012 0.004 0.000 0.012
#> GSM1124899     2  0.0771      0.858 0.020 0.976 0.000 0.000 0.004
#> GSM1124901     2  0.1830      0.847 0.004 0.932 0.012 0.000 0.052
#> GSM1124906     2  0.0290      0.854 0.000 0.992 0.000 0.000 0.008
#> GSM1124907     5  0.2852      0.900 0.000 0.172 0.000 0.000 0.828
#> GSM1124911     2  0.0404      0.853 0.000 0.988 0.000 0.000 0.012
#> GSM1124912     1  0.0807      0.922 0.976 0.012 0.012 0.000 0.000
#> GSM1124915     2  0.1885      0.848 0.004 0.932 0.020 0.000 0.044
#> GSM1124917     2  0.0955      0.851 0.000 0.968 0.004 0.000 0.028
#> GSM1124918     2  0.1557      0.844 0.000 0.940 0.008 0.000 0.052
#> GSM1124920     3  0.4728      0.788 0.240 0.000 0.700 0.000 0.060
#> GSM1124922     2  0.2172      0.841 0.076 0.908 0.000 0.000 0.016
#> GSM1124924     5  0.7957      0.227 0.260 0.152 0.148 0.000 0.440
#> GSM1124926     2  0.1768      0.843 0.072 0.924 0.000 0.000 0.004
#> GSM1124928     1  0.2446      0.878 0.900 0.000 0.056 0.000 0.044
#> GSM1124930     5  0.2732      0.913 0.000 0.160 0.000 0.000 0.840
#> GSM1124931     2  0.1956      0.839 0.076 0.916 0.000 0.000 0.008
#> GSM1124935     2  0.0798      0.854 0.000 0.976 0.008 0.000 0.016
#> GSM1124936     3  0.4755      0.783 0.244 0.000 0.696 0.000 0.060
#> GSM1124938     5  0.2886      0.909 0.008 0.148 0.000 0.000 0.844
#> GSM1124940     1  0.0807      0.920 0.976 0.012 0.000 0.000 0.012
#> GSM1124941     2  0.0510      0.853 0.000 0.984 0.000 0.000 0.016
#> GSM1124942     5  0.2690      0.916 0.000 0.156 0.000 0.000 0.844
#> GSM1124943     5  0.2648      0.917 0.000 0.152 0.000 0.000 0.848
#> GSM1124948     5  0.4506      0.743 0.028 0.296 0.000 0.000 0.676
#> GSM1124949     1  0.0807      0.920 0.976 0.012 0.000 0.000 0.012
#> GSM1124950     2  0.0880      0.857 0.032 0.968 0.000 0.000 0.000
#> GSM1124954     1  0.2354      0.902 0.916 0.032 0.032 0.000 0.020
#> GSM1124955     1  0.1544      0.894 0.932 0.000 0.068 0.000 0.000
#> GSM1124956     2  0.0404      0.853 0.000 0.988 0.000 0.000 0.012
#> GSM1124872     2  0.1956      0.839 0.076 0.916 0.000 0.000 0.008
#> GSM1124873     2  0.1430      0.852 0.052 0.944 0.000 0.000 0.004
#> GSM1124876     3  0.4575      0.824 0.184 0.000 0.744 0.004 0.068
#> GSM1124877     1  0.1731      0.905 0.932 0.004 0.060 0.000 0.004
#> GSM1124879     1  0.0693      0.921 0.980 0.012 0.000 0.000 0.008
#> GSM1124883     2  0.4515      0.796 0.076 0.780 0.020 0.000 0.124
#> GSM1124889     2  0.0404      0.853 0.000 0.988 0.000 0.000 0.012
#> GSM1124892     1  0.1671      0.887 0.924 0.000 0.076 0.000 0.000
#> GSM1124893     1  0.0693      0.921 0.980 0.012 0.000 0.000 0.008
#> GSM1124909     2  0.0963      0.843 0.000 0.964 0.000 0.000 0.036
#> GSM1124913     2  0.4561      0.793 0.076 0.776 0.020 0.000 0.128
#> GSM1124916     2  0.0404      0.853 0.000 0.988 0.000 0.000 0.012
#> GSM1124923     5  0.2648      0.917 0.000 0.152 0.000 0.000 0.848
#> GSM1124925     1  0.1478      0.898 0.936 0.000 0.064 0.000 0.000
#> GSM1124929     1  0.0693      0.921 0.980 0.012 0.000 0.000 0.008
#> GSM1124934     1  0.3429      0.846 0.860 0.036 0.036 0.000 0.068
#> GSM1124937     1  0.1740      0.886 0.932 0.056 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
#> GSM1124891     3  0.3754     0.6002 0.212 0.000 0.756 0.000 0.016 0.016
#> GSM1124888     3  0.6216     0.6724 0.204 0.000 0.456 0.000 0.016 0.324
#> GSM1124890     5  0.0632     0.9656 0.000 0.024 0.000 0.000 0.976 0.000
#> GSM1124904     2  0.4863     0.4050 0.000 0.624 0.000 0.000 0.092 0.284
#> GSM1124927     2  0.5004     0.0257 0.400 0.548 0.028 0.000 0.004 0.020
#> GSM1124953     5  0.0632     0.9656 0.000 0.024 0.000 0.000 0.976 0.000
#> GSM1124869     1  0.0291     0.8386 0.992 0.004 0.000 0.000 0.004 0.000
#> GSM1124870     1  0.1251     0.8311 0.956 0.012 0.024 0.000 0.000 0.008
#> GSM1124882     1  0.0363     0.8367 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM1124884     2  0.0146     0.7673 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1124898     2  0.3798     0.6161 0.004 0.748 0.000 0.000 0.032 0.216
#> GSM1124903     2  0.4502     0.4627 0.004 0.660 0.000 0.004 0.040 0.292
#> GSM1124905     1  0.2775     0.7933 0.888 0.008 0.020 0.012 0.012 0.060
#> GSM1124910     1  0.4358     0.4254 0.624 0.000 0.348 0.000 0.012 0.016
#> GSM1124919     5  0.0632     0.9656 0.000 0.024 0.000 0.000 0.976 0.000
#> GSM1124932     2  0.0696     0.7660 0.004 0.980 0.004 0.000 0.004 0.008
#> GSM1124933     3  0.6312     0.6723 0.208 0.000 0.444 0.000 0.020 0.328
#> GSM1124867     2  0.8390    -0.6340 0.144 0.420 0.120 0.116 0.008 0.192
#> GSM1124868     4  0.6877    -0.0376 0.000 0.116 0.116 0.416 0.000 0.352
#> GSM1124878     2  0.7152    -0.6748 0.000 0.464 0.116 0.152 0.008 0.260
#> GSM1124895     4  0.0000     0.7881 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124897     6  0.7216     0.0000 0.000 0.336 0.116 0.180 0.000 0.368
#> GSM1124902     4  0.0260     0.7869 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM1124908     4  0.4992     0.6120 0.000 0.000 0.116 0.624 0.000 0.260
#> GSM1124921     4  0.4895     0.6240 0.000 0.000 0.108 0.636 0.000 0.256
#> GSM1124939     4  0.0000     0.7881 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0000     0.7881 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124945     3  0.4720     0.4708 0.000 0.000 0.560 0.052 0.000 0.388
#> GSM1124946     4  0.4895     0.6240 0.000 0.000 0.108 0.636 0.000 0.256
#> GSM1124947     4  0.0547     0.7816 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM1124951     3  0.4602     0.4772 0.000 0.000 0.572 0.044 0.000 0.384
#> GSM1124952     4  0.1152     0.7766 0.000 0.000 0.004 0.952 0.000 0.044
#> GSM1124957     3  0.4756     0.4743 0.000 0.000 0.564 0.056 0.000 0.380
#> GSM1124900     1  0.2774     0.7996 0.884 0.048 0.044 0.000 0.008 0.016
#> GSM1124914     2  0.2917     0.7075 0.004 0.852 0.000 0.000 0.040 0.104
#> GSM1124871     2  0.0935     0.7648 0.004 0.964 0.000 0.000 0.000 0.032
#> GSM1124874     2  0.0436     0.7654 0.004 0.988 0.004 0.000 0.000 0.004
#> GSM1124875     2  0.4134     0.4975 0.000 0.708 0.000 0.000 0.240 0.052
#> GSM1124880     1  0.4682     0.6682 0.760 0.096 0.092 0.000 0.036 0.016
#> GSM1124881     2  0.0665     0.7622 0.004 0.980 0.000 0.000 0.008 0.008
#> GSM1124885     2  0.4365     0.4714 0.004 0.664 0.000 0.000 0.040 0.292
#> GSM1124886     1  0.0000     0.8376 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     2  0.5350    -0.0424 0.000 0.476 0.000 0.000 0.416 0.108
#> GSM1124894     1  0.8906    -0.3967 0.300 0.140 0.128 0.216 0.008 0.208
#> GSM1124896     1  0.2290     0.8119 0.908 0.044 0.032 0.000 0.004 0.012
#> GSM1124899     2  0.0551     0.7683 0.004 0.984 0.000 0.000 0.004 0.008
#> GSM1124901     2  0.3450     0.6446 0.000 0.780 0.000 0.000 0.032 0.188
#> GSM1124906     2  0.0260     0.7670 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1124907     5  0.1168     0.9506 0.000 0.028 0.000 0.000 0.956 0.016
#> GSM1124911     2  0.0632     0.7627 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM1124912     1  0.0000     0.8376 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.3669     0.6263 0.004 0.760 0.000 0.000 0.028 0.208
#> GSM1124917     2  0.2070     0.7443 0.000 0.908 0.000 0.000 0.044 0.048
#> GSM1124918     2  0.2201     0.7430 0.000 0.900 0.000 0.000 0.052 0.048
#> GSM1124920     3  0.3617     0.5590 0.244 0.000 0.736 0.000 0.020 0.000
#> GSM1124922     2  0.1408     0.7640 0.008 0.952 0.008 0.000 0.008 0.024
#> GSM1124924     3  0.6914     0.0208 0.360 0.068 0.400 0.000 0.168 0.004
#> GSM1124926     2  0.0436     0.7666 0.004 0.988 0.000 0.000 0.004 0.004
#> GSM1124928     1  0.2767     0.8016 0.888 0.028 0.048 0.000 0.020 0.016
#> GSM1124930     5  0.0632     0.9656 0.000 0.024 0.000 0.000 0.976 0.000
#> GSM1124931     2  0.1425     0.7515 0.012 0.952 0.020 0.000 0.008 0.008
#> GSM1124935     2  0.1633     0.7577 0.000 0.932 0.000 0.000 0.024 0.044
#> GSM1124936     3  0.3534     0.5362 0.276 0.000 0.716 0.000 0.008 0.000
#> GSM1124938     5  0.1074     0.9507 0.012 0.028 0.000 0.000 0.960 0.000
#> GSM1124940     1  0.0436     0.8380 0.988 0.004 0.000 0.000 0.004 0.004
#> GSM1124941     2  0.1341     0.7628 0.000 0.948 0.000 0.000 0.024 0.028
#> GSM1124942     5  0.0632     0.9656 0.000 0.024 0.000 0.000 0.976 0.000
#> GSM1124943     5  0.0632     0.9656 0.000 0.024 0.000 0.000 0.976 0.000
#> GSM1124948     5  0.3800     0.7182 0.028 0.176 0.000 0.000 0.776 0.020
#> GSM1124949     1  0.0291     0.8386 0.992 0.004 0.000 0.000 0.004 0.000
#> GSM1124950     2  0.0912     0.7640 0.004 0.972 0.012 0.000 0.004 0.008
#> GSM1124954     1  0.6117     0.2669 0.520 0.056 0.356 0.000 0.044 0.024
#> GSM1124955     1  0.0260     0.8356 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM1124956     2  0.0632     0.7627 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM1124872     2  0.0436     0.7654 0.004 0.988 0.004 0.000 0.000 0.004
#> GSM1124873     2  0.0291     0.7659 0.004 0.992 0.000 0.000 0.000 0.004
#> GSM1124876     3  0.6216     0.6724 0.204 0.000 0.456 0.000 0.016 0.324
#> GSM1124877     1  0.0862     0.8354 0.972 0.016 0.004 0.000 0.008 0.000
#> GSM1124879     1  0.0405     0.8385 0.988 0.004 0.008 0.000 0.000 0.000
#> GSM1124883     2  0.4427     0.4647 0.004 0.660 0.000 0.000 0.044 0.292
#> GSM1124889     2  0.0260     0.7670 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1124892     1  0.2697     0.6770 0.812 0.000 0.188 0.000 0.000 0.000
#> GSM1124893     1  0.0291     0.8386 0.992 0.004 0.000 0.000 0.004 0.000
#> GSM1124909     2  0.0692     0.7637 0.000 0.976 0.000 0.000 0.020 0.004
#> GSM1124913     2  0.4486     0.4617 0.004 0.656 0.000 0.000 0.048 0.292
#> GSM1124916     2  0.0405     0.7664 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM1124923     5  0.0777     0.9635 0.000 0.024 0.000 0.000 0.972 0.004
#> GSM1124925     1  0.0000     0.8376 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0291     0.8386 0.992 0.004 0.000 0.000 0.004 0.000
#> GSM1124934     1  0.6277     0.2431 0.500 0.068 0.360 0.000 0.056 0.016
#> GSM1124937     1  0.2374     0.8070 0.904 0.048 0.028 0.000 0.004 0.016

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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 tissue(p) k
#> CV:mclust 87  2.44e-15 2
#> CV:mclust 85  6.01e-14 3
#> CV:mclust 79  7.15e-12 4
#> CV:mclust 85  5.74e-10 5
#> CV:mclust 71  6.17e-11 6

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


CV: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 48983 rows and 91 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 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 CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.670           0.852       0.937         0.4995 0.502   0.502
#> 3 3 0.588           0.724       0.867         0.2468 0.805   0.639
#> 4 4 0.695           0.823       0.906         0.1432 0.746   0.460
#> 5 5 0.765           0.828       0.903         0.0969 0.796   0.442
#> 6 6 0.869           0.871       0.921         0.0580 0.932   0.707

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

suggest_best_k(res)
#> [1] 6

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.0000      0.942 1.000 0.000
#> GSM1124888     1  0.0000      0.942 1.000 0.000
#> GSM1124890     1  0.9393      0.433 0.644 0.356
#> GSM1124904     2  0.0000      0.917 0.000 1.000
#> GSM1124927     1  0.2778      0.901 0.952 0.048
#> GSM1124953     2  0.7674      0.693 0.224 0.776
#> GSM1124869     1  0.0000      0.942 1.000 0.000
#> GSM1124870     1  0.0000      0.942 1.000 0.000
#> GSM1124882     1  0.0000      0.942 1.000 0.000
#> GSM1124884     2  0.0000      0.917 0.000 1.000
#> GSM1124898     2  0.0000      0.917 0.000 1.000
#> GSM1124903     2  0.0000      0.917 0.000 1.000
#> GSM1124905     1  0.0000      0.942 1.000 0.000
#> GSM1124910     1  0.0000      0.942 1.000 0.000
#> GSM1124919     2  0.0000      0.917 0.000 1.000
#> GSM1124932     1  0.7674      0.669 0.776 0.224
#> GSM1124933     1  0.0000      0.942 1.000 0.000
#> GSM1124867     2  0.0938      0.911 0.012 0.988
#> GSM1124868     2  0.0000      0.917 0.000 1.000
#> GSM1124878     2  0.0000      0.917 0.000 1.000
#> GSM1124895     2  0.0000      0.917 0.000 1.000
#> GSM1124897     2  0.0000      0.917 0.000 1.000
#> GSM1124902     2  0.0000      0.917 0.000 1.000
#> GSM1124908     2  0.0000      0.917 0.000 1.000
#> GSM1124921     2  0.0000      0.917 0.000 1.000
#> GSM1124939     2  0.0000      0.917 0.000 1.000
#> GSM1124944     2  0.0000      0.917 0.000 1.000
#> GSM1124945     2  0.9608      0.371 0.384 0.616
#> GSM1124946     2  0.0000      0.917 0.000 1.000
#> GSM1124947     2  0.0000      0.917 0.000 1.000
#> GSM1124951     2  0.9044      0.522 0.320 0.680
#> GSM1124952     2  0.0000      0.917 0.000 1.000
#> GSM1124957     1  0.9552      0.384 0.624 0.376
#> GSM1124900     1  0.0000      0.942 1.000 0.000
#> GSM1124914     2  0.0000      0.917 0.000 1.000
#> GSM1124871     2  0.0000      0.917 0.000 1.000
#> GSM1124874     2  0.6973      0.780 0.188 0.812
#> GSM1124875     2  0.0000      0.917 0.000 1.000
#> GSM1124880     1  0.0000      0.942 1.000 0.000
#> GSM1124881     2  0.2948      0.891 0.052 0.948
#> GSM1124885     2  0.0000      0.917 0.000 1.000
#> GSM1124886     1  0.0000      0.942 1.000 0.000
#> GSM1124887     2  0.0000      0.917 0.000 1.000
#> GSM1124894     2  0.4939      0.845 0.108 0.892
#> GSM1124896     1  0.0000      0.942 1.000 0.000
#> GSM1124899     2  0.6623      0.796 0.172 0.828
#> GSM1124901     2  0.0000      0.917 0.000 1.000
#> GSM1124906     2  0.7376      0.756 0.208 0.792
#> GSM1124907     2  0.0000      0.917 0.000 1.000
#> GSM1124911     2  0.5059      0.850 0.112 0.888
#> GSM1124912     1  0.0000      0.942 1.000 0.000
#> GSM1124915     2  0.0000      0.917 0.000 1.000
#> GSM1124917     2  0.0938      0.911 0.012 0.988
#> GSM1124918     2  0.5946      0.828 0.144 0.856
#> GSM1124920     1  0.0000      0.942 1.000 0.000
#> GSM1124922     2  0.7528      0.747 0.216 0.784
#> GSM1124924     1  0.0000      0.942 1.000 0.000
#> GSM1124926     2  0.5842      0.827 0.140 0.860
#> GSM1124928     1  0.0000      0.942 1.000 0.000
#> GSM1124930     2  0.0000      0.917 0.000 1.000
#> GSM1124931     1  0.4431      0.854 0.908 0.092
#> GSM1124935     2  0.0000      0.917 0.000 1.000
#> GSM1124936     1  0.0000      0.942 1.000 0.000
#> GSM1124938     1  0.1184      0.929 0.984 0.016
#> GSM1124940     1  0.0000      0.942 1.000 0.000
#> GSM1124941     2  0.7219      0.766 0.200 0.800
#> GSM1124942     2  0.0000      0.917 0.000 1.000
#> GSM1124943     2  0.9881      0.223 0.436 0.564
#> GSM1124948     1  0.0000      0.942 1.000 0.000
#> GSM1124949     1  0.0000      0.942 1.000 0.000
#> GSM1124950     2  0.9686      0.396 0.396 0.604
#> GSM1124954     1  0.0000      0.942 1.000 0.000
#> GSM1124955     1  0.0000      0.942 1.000 0.000
#> GSM1124956     2  0.7139      0.771 0.196 0.804
#> GSM1124872     1  0.9896      0.142 0.560 0.440
#> GSM1124873     2  0.6973      0.781 0.188 0.812
#> GSM1124876     1  0.0000      0.942 1.000 0.000
#> GSM1124877     1  0.0000      0.942 1.000 0.000
#> GSM1124879     1  0.0000      0.942 1.000 0.000
#> GSM1124883     2  0.0000      0.917 0.000 1.000
#> GSM1124889     2  0.2423      0.897 0.040 0.960
#> GSM1124892     1  0.0000      0.942 1.000 0.000
#> GSM1124893     1  0.0000      0.942 1.000 0.000
#> GSM1124909     1  0.1843      0.919 0.972 0.028
#> GSM1124913     2  0.0000      0.917 0.000 1.000
#> GSM1124916     1  0.9850      0.181 0.572 0.428
#> GSM1124923     2  0.0000      0.917 0.000 1.000
#> GSM1124925     1  0.0000      0.942 1.000 0.000
#> GSM1124929     1  0.0000      0.942 1.000 0.000
#> GSM1124934     1  0.0000      0.942 1.000 0.000
#> GSM1124937     1  0.0000      0.942 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.5733     0.6462 0.324 0.000 0.676
#> GSM1124888     3  0.5733     0.6462 0.324 0.000 0.676
#> GSM1124890     3  0.4750     0.6733 0.000 0.216 0.784
#> GSM1124904     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124927     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124953     3  0.4555     0.6828 0.000 0.200 0.800
#> GSM1124869     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124870     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124882     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124884     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124898     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124903     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124905     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124910     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124919     2  0.0237     0.8316 0.000 0.996 0.004
#> GSM1124932     1  0.5397     0.5810 0.720 0.280 0.000
#> GSM1124933     3  0.4654     0.7083 0.208 0.000 0.792
#> GSM1124867     2  0.7988     0.6203 0.144 0.656 0.200
#> GSM1124868     2  0.4654     0.7256 0.000 0.792 0.208
#> GSM1124878     2  0.4555     0.7304 0.000 0.800 0.200
#> GSM1124895     2  0.5760     0.6326 0.000 0.672 0.328
#> GSM1124897     2  0.4605     0.7287 0.000 0.796 0.204
#> GSM1124902     2  0.5760     0.6326 0.000 0.672 0.328
#> GSM1124908     2  0.5431     0.6715 0.000 0.716 0.284
#> GSM1124921     2  0.5785     0.6287 0.000 0.668 0.332
#> GSM1124939     2  0.5760     0.6326 0.000 0.672 0.328
#> GSM1124944     2  0.5859     0.6150 0.000 0.656 0.344
#> GSM1124945     3  0.0000     0.6961 0.000 0.000 1.000
#> GSM1124946     2  0.5810     0.6244 0.000 0.664 0.336
#> GSM1124947     2  0.5835     0.6199 0.000 0.660 0.340
#> GSM1124951     3  0.0000     0.6961 0.000 0.000 1.000
#> GSM1124952     2  0.5810     0.6244 0.000 0.664 0.336
#> GSM1124957     3  0.0000     0.6961 0.000 0.000 1.000
#> GSM1124900     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124914     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124871     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124874     2  0.2356     0.7825 0.072 0.928 0.000
#> GSM1124875     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124880     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124881     2  0.0592     0.8264 0.012 0.988 0.000
#> GSM1124885     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124886     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124887     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124894     1  0.8890     0.2327 0.532 0.140 0.328
#> GSM1124896     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124899     2  0.2878     0.7609 0.096 0.904 0.000
#> GSM1124901     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124906     1  0.6095     0.4376 0.608 0.392 0.000
#> GSM1124907     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124911     1  0.6308     0.1804 0.508 0.492 0.000
#> GSM1124912     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124915     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124917     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124918     2  0.3267     0.7405 0.116 0.884 0.000
#> GSM1124920     3  0.6180     0.5103 0.416 0.000 0.584
#> GSM1124922     2  0.5560     0.4717 0.300 0.700 0.000
#> GSM1124924     1  0.3412     0.7104 0.876 0.000 0.124
#> GSM1124926     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124928     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124930     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124931     1  0.4887     0.6359 0.772 0.228 0.000
#> GSM1124935     2  0.0237     0.8310 0.004 0.996 0.000
#> GSM1124936     1  0.3192     0.7265 0.888 0.000 0.112
#> GSM1124938     3  0.7651     0.6918 0.108 0.220 0.672
#> GSM1124940     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124941     2  0.6252     0.0253 0.444 0.556 0.000
#> GSM1124942     2  0.0592     0.8269 0.000 0.988 0.012
#> GSM1124943     3  0.5948     0.5040 0.000 0.360 0.640
#> GSM1124948     3  0.9106     0.5793 0.244 0.208 0.548
#> GSM1124949     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124950     2  0.5785     0.3879 0.332 0.668 0.000
#> GSM1124954     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124955     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124956     1  0.5859     0.5067 0.656 0.344 0.000
#> GSM1124872     1  0.5785     0.5227 0.668 0.332 0.000
#> GSM1124873     2  0.3482     0.7254 0.128 0.872 0.000
#> GSM1124876     3  0.5497     0.6720 0.292 0.000 0.708
#> GSM1124877     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124879     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124883     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124889     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124892     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124893     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124909     1  0.5465     0.5725 0.712 0.288 0.000
#> GSM1124913     2  0.0000     0.8328 0.000 1.000 0.000
#> GSM1124916     1  0.5785     0.5224 0.668 0.332 0.000
#> GSM1124923     2  0.3941     0.7426 0.000 0.844 0.156
#> GSM1124925     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124929     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124934     1  0.0000     0.8510 1.000 0.000 0.000
#> GSM1124937     1  0.0000     0.8510 1.000 0.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
#> GSM1124891     3  0.2589     0.8597 0.116 0.000 0.884 0.000
#> GSM1124888     3  0.2589     0.8597 0.116 0.000 0.884 0.000
#> GSM1124890     3  0.0921     0.8227 0.000 0.028 0.972 0.000
#> GSM1124904     2  0.5850     0.7283 0.000 0.700 0.116 0.184
#> GSM1124927     1  0.4304     0.6252 0.716 0.284 0.000 0.000
#> GSM1124953     3  0.1211     0.8297 0.000 0.040 0.960 0.000
#> GSM1124869     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.2589     0.8509 0.884 0.116 0.000 0.000
#> GSM1124882     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124898     2  0.2589     0.8378 0.000 0.884 0.116 0.000
#> GSM1124903     2  0.5889     0.7238 0.000 0.696 0.116 0.188
#> GSM1124905     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124910     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124919     2  0.3024     0.8270 0.000 0.852 0.148 0.000
#> GSM1124932     2  0.5000    -0.1515 0.496 0.504 0.000 0.000
#> GSM1124933     3  0.2589     0.8597 0.116 0.000 0.884 0.000
#> GSM1124867     4  0.4511     0.6815 0.040 0.176 0.000 0.784
#> GSM1124868     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124878     4  0.3726     0.6583 0.000 0.212 0.000 0.788
#> GSM1124895     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124897     4  0.3606     0.7477 0.000 0.132 0.024 0.844
#> GSM1124902     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.0188     0.8998 0.000 0.000 0.004 0.996
#> GSM1124921     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124944     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124945     4  0.4477     0.5009 0.000 0.000 0.312 0.688
#> GSM1124946     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124951     3  0.1389     0.8187 0.000 0.000 0.952 0.048
#> GSM1124952     4  0.0000     0.9025 0.000 0.000 0.000 1.000
#> GSM1124957     3  0.3444     0.7205 0.000 0.000 0.816 0.184
#> GSM1124900     1  0.2647     0.8473 0.880 0.120 0.000 0.000
#> GSM1124914     2  0.5375     0.7703 0.000 0.744 0.116 0.140
#> GSM1124871     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124874     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124875     2  0.2589     0.8378 0.000 0.884 0.116 0.000
#> GSM1124880     1  0.2589     0.8421 0.884 0.116 0.000 0.000
#> GSM1124881     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124885     2  0.5277     0.7766 0.000 0.752 0.116 0.132
#> GSM1124886     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124887     2  0.5423     0.7670 0.000 0.740 0.116 0.144
#> GSM1124894     4  0.2589     0.7813 0.116 0.000 0.000 0.884
#> GSM1124896     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124899     2  0.1211     0.8561 0.000 0.960 0.040 0.000
#> GSM1124901     2  0.2589     0.8378 0.000 0.884 0.116 0.000
#> GSM1124906     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124907     2  0.5277     0.7766 0.000 0.752 0.116 0.132
#> GSM1124911     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124912     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.0188     0.8585 0.000 0.996 0.004 0.000
#> GSM1124917     2  0.0921     0.8577 0.000 0.972 0.028 0.000
#> GSM1124918     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124920     3  0.3400     0.8110 0.180 0.000 0.820 0.000
#> GSM1124922     2  0.4819     0.8119 0.048 0.808 0.116 0.028
#> GSM1124924     3  0.6084     0.6226 0.096 0.244 0.660 0.000
#> GSM1124926     2  0.2281     0.8280 0.000 0.904 0.000 0.096
#> GSM1124928     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124930     2  0.2589     0.8378 0.000 0.884 0.116 0.000
#> GSM1124931     2  0.4941     0.0833 0.436 0.564 0.000 0.000
#> GSM1124935     2  0.0707     0.8585 0.000 0.980 0.020 0.000
#> GSM1124936     1  0.0592     0.9382 0.984 0.000 0.016 0.000
#> GSM1124938     3  0.0188     0.8328 0.000 0.004 0.996 0.000
#> GSM1124940     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124942     2  0.3400     0.8112 0.000 0.820 0.180 0.000
#> GSM1124943     2  0.4998     0.3259 0.000 0.512 0.488 0.000
#> GSM1124948     2  0.3172     0.7868 0.000 0.840 0.160 0.000
#> GSM1124949     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124954     1  0.4669     0.7778 0.796 0.100 0.104 0.000
#> GSM1124955     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124872     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124873     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124876     3  0.2589     0.8597 0.116 0.000 0.884 0.000
#> GSM1124877     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124883     2  0.5811     0.7326 0.000 0.704 0.116 0.180
#> GSM1124889     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124892     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124913     2  0.5731     0.7409 0.000 0.712 0.116 0.172
#> GSM1124916     2  0.0000     0.8585 0.000 1.000 0.000 0.000
#> GSM1124923     2  0.5036     0.7017 0.000 0.696 0.280 0.024
#> GSM1124925     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9509 1.000 0.000 0.000 0.000
#> GSM1124934     1  0.2281     0.8748 0.904 0.096 0.000 0.000
#> GSM1124937     1  0.0000     0.9509 1.000 0.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
#> GSM1124891     3  0.2536      0.830 0.128 0.000 0.868 0.000 0.004
#> GSM1124888     3  0.0671      0.916 0.016 0.000 0.980 0.000 0.004
#> GSM1124890     3  0.1478      0.890 0.000 0.000 0.936 0.000 0.064
#> GSM1124904     5  0.0794      0.871 0.000 0.000 0.000 0.028 0.972
#> GSM1124927     2  0.3011      0.795 0.140 0.844 0.000 0.000 0.016
#> GSM1124953     3  0.2522      0.831 0.000 0.108 0.880 0.000 0.012
#> GSM1124869     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.2929      0.773 0.180 0.820 0.000 0.000 0.000
#> GSM1124882     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.3081      0.839 0.000 0.832 0.012 0.000 0.156
#> GSM1124898     5  0.0162      0.875 0.000 0.004 0.000 0.000 0.996
#> GSM1124903     5  0.1043      0.863 0.000 0.000 0.000 0.040 0.960
#> GSM1124905     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124910     1  0.0324      0.953 0.992 0.004 0.000 0.000 0.004
#> GSM1124919     5  0.0162      0.875 0.000 0.004 0.000 0.000 0.996
#> GSM1124932     2  0.2351      0.771 0.088 0.896 0.016 0.000 0.000
#> GSM1124933     3  0.0510      0.917 0.016 0.000 0.984 0.000 0.000
#> GSM1124867     2  0.6384      0.340 0.084 0.516 0.000 0.368 0.032
#> GSM1124868     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM1124878     5  0.3983      0.536 0.000 0.000 0.000 0.340 0.660
#> GSM1124895     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM1124897     5  0.3684      0.637 0.000 0.000 0.000 0.280 0.720
#> GSM1124902     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM1124908     5  0.4219      0.354 0.000 0.000 0.000 0.416 0.584
#> GSM1124921     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM1124939     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM1124944     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM1124945     4  0.3074      0.735 0.000 0.000 0.196 0.804 0.000
#> GSM1124946     4  0.0162      0.973 0.000 0.000 0.000 0.996 0.004
#> GSM1124947     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM1124951     3  0.1701      0.895 0.000 0.000 0.936 0.048 0.016
#> GSM1124952     4  0.0000      0.977 0.000 0.000 0.000 1.000 0.000
#> GSM1124957     3  0.3074      0.741 0.000 0.000 0.804 0.196 0.000
#> GSM1124900     2  0.3774      0.640 0.296 0.704 0.000 0.000 0.000
#> GSM1124914     5  0.0404      0.876 0.000 0.000 0.000 0.012 0.988
#> GSM1124871     2  0.2813      0.832 0.000 0.832 0.000 0.000 0.168
#> GSM1124874     2  0.3109      0.809 0.000 0.800 0.000 0.000 0.200
#> GSM1124875     5  0.0000      0.875 0.000 0.000 0.000 0.000 1.000
#> GSM1124880     2  0.2848      0.784 0.156 0.840 0.000 0.000 0.004
#> GSM1124881     2  0.2813      0.832 0.000 0.832 0.000 0.000 0.168
#> GSM1124885     5  0.0162      0.876 0.000 0.000 0.000 0.004 0.996
#> GSM1124886     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.0290      0.876 0.000 0.000 0.000 0.008 0.992
#> GSM1124894     4  0.0162      0.973 0.004 0.000 0.000 0.996 0.000
#> GSM1124896     1  0.0162      0.956 0.996 0.000 0.004 0.000 0.000
#> GSM1124899     5  0.0955      0.861 0.000 0.028 0.004 0.000 0.968
#> GSM1124901     5  0.0162      0.875 0.000 0.004 0.000 0.000 0.996
#> GSM1124906     2  0.2690      0.838 0.000 0.844 0.000 0.000 0.156
#> GSM1124907     5  0.0162      0.876 0.000 0.000 0.000 0.004 0.996
#> GSM1124911     2  0.1012      0.809 0.000 0.968 0.012 0.000 0.020
#> GSM1124912     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.2909      0.753 0.000 0.848 0.012 0.000 0.140
#> GSM1124917     2  0.3336      0.799 0.000 0.772 0.000 0.000 0.228
#> GSM1124918     2  0.1597      0.804 0.000 0.940 0.012 0.000 0.048
#> GSM1124920     1  0.4397      0.181 0.564 0.000 0.432 0.000 0.004
#> GSM1124922     5  0.0609      0.867 0.000 0.020 0.000 0.000 0.980
#> GSM1124924     2  0.3190      0.781 0.008 0.840 0.140 0.000 0.012
#> GSM1124926     5  0.3616      0.628 0.000 0.224 0.004 0.004 0.768
#> GSM1124928     1  0.0880      0.926 0.968 0.032 0.000 0.000 0.000
#> GSM1124930     5  0.0510      0.871 0.000 0.000 0.016 0.000 0.984
#> GSM1124931     2  0.0404      0.808 0.000 0.988 0.012 0.000 0.000
#> GSM1124935     2  0.4065      0.592 0.000 0.720 0.016 0.000 0.264
#> GSM1124936     1  0.0162      0.956 0.996 0.000 0.004 0.000 0.000
#> GSM1124938     3  0.0609      0.913 0.000 0.000 0.980 0.000 0.020
#> GSM1124940     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.2732      0.837 0.000 0.840 0.000 0.000 0.160
#> GSM1124942     5  0.4937      0.260 0.000 0.028 0.428 0.000 0.544
#> GSM1124943     5  0.4235      0.235 0.000 0.000 0.424 0.000 0.576
#> GSM1124948     2  0.3593      0.827 0.000 0.824 0.060 0.000 0.116
#> GSM1124949     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.2690      0.838 0.000 0.844 0.000 0.000 0.156
#> GSM1124954     2  0.3757      0.656 0.208 0.772 0.020 0.000 0.000
#> GSM1124955     1  0.0162      0.956 0.996 0.000 0.004 0.000 0.000
#> GSM1124956     2  0.1117      0.808 0.000 0.964 0.016 0.000 0.020
#> GSM1124872     2  0.2690      0.838 0.000 0.844 0.000 0.000 0.156
#> GSM1124873     2  0.2690      0.838 0.000 0.844 0.000 0.000 0.156
#> GSM1124876     3  0.0510      0.917 0.016 0.000 0.984 0.000 0.000
#> GSM1124877     1  0.3759      0.698 0.764 0.220 0.016 0.000 0.000
#> GSM1124879     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.0794      0.871 0.000 0.000 0.000 0.028 0.972
#> GSM1124889     2  0.3305      0.786 0.000 0.776 0.000 0.000 0.224
#> GSM1124892     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.2690      0.838 0.000 0.844 0.000 0.000 0.156
#> GSM1124913     5  0.0794      0.871 0.000 0.000 0.000 0.028 0.972
#> GSM1124916     2  0.0404      0.809 0.000 0.988 0.012 0.000 0.000
#> GSM1124923     5  0.0880      0.864 0.000 0.000 0.032 0.000 0.968
#> GSM1124925     1  0.0162      0.956 0.996 0.000 0.004 0.000 0.000
#> GSM1124929     1  0.0000      0.958 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     2  0.3596      0.668 0.200 0.784 0.016 0.000 0.000
#> GSM1124937     1  0.0162      0.956 0.996 0.000 0.000 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.4263      0.718 0.144 0.012 0.768 0.000 0.012 0.064
#> GSM1124888     3  0.2803      0.778 0.000 0.016 0.856 0.000 0.012 0.116
#> GSM1124890     3  0.1610      0.773 0.000 0.000 0.916 0.000 0.084 0.000
#> GSM1124904     5  0.0363      0.913 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM1124927     2  0.0717      0.932 0.008 0.976 0.000 0.000 0.000 0.016
#> GSM1124953     3  0.3706      0.350 0.000 0.380 0.620 0.000 0.000 0.000
#> GSM1124869     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.1625      0.900 0.060 0.928 0.000 0.000 0.000 0.012
#> GSM1124882     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.0914      0.932 0.000 0.968 0.000 0.000 0.016 0.016
#> GSM1124898     5  0.0405      0.912 0.000 0.008 0.000 0.004 0.988 0.000
#> GSM1124903     5  0.0363      0.913 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM1124905     1  0.0146      0.956 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124910     1  0.1908      0.876 0.900 0.004 0.000 0.000 0.000 0.096
#> GSM1124919     5  0.2412      0.856 0.000 0.028 0.092 0.000 0.880 0.000
#> GSM1124932     6  0.2048      0.963 0.000 0.120 0.000 0.000 0.000 0.880
#> GSM1124933     3  0.0000      0.789 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     2  0.2597      0.784 0.000 0.824 0.000 0.176 0.000 0.000
#> GSM1124868     4  0.0000      0.955 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124878     5  0.3175      0.686 0.000 0.000 0.000 0.256 0.744 0.000
#> GSM1124895     4  0.0000      0.955 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124897     5  0.2730      0.810 0.000 0.012 0.000 0.152 0.836 0.000
#> GSM1124902     4  0.0000      0.955 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124908     5  0.2378      0.820 0.000 0.000 0.000 0.152 0.848 0.000
#> GSM1124921     4  0.0000      0.955 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124939     4  0.0000      0.955 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0000      0.955 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124945     4  0.3547      0.488 0.000 0.000 0.332 0.668 0.000 0.000
#> GSM1124946     4  0.1141      0.900 0.000 0.000 0.000 0.948 0.052 0.000
#> GSM1124947     4  0.0000      0.955 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124951     3  0.0291      0.788 0.000 0.000 0.992 0.004 0.004 0.000
#> GSM1124952     4  0.0000      0.955 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124957     3  0.2631      0.655 0.000 0.000 0.820 0.180 0.000 0.000
#> GSM1124900     2  0.1531      0.898 0.068 0.928 0.000 0.000 0.000 0.004
#> GSM1124914     5  0.0653      0.913 0.000 0.004 0.000 0.012 0.980 0.004
#> GSM1124871     2  0.0692      0.934 0.000 0.976 0.000 0.000 0.020 0.004
#> GSM1124874     2  0.0632      0.932 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM1124875     5  0.1349      0.884 0.000 0.004 0.000 0.000 0.940 0.056
#> GSM1124880     2  0.1967      0.875 0.000 0.904 0.000 0.000 0.012 0.084
#> GSM1124881     2  0.0458      0.934 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1124885     5  0.0508      0.912 0.000 0.012 0.000 0.004 0.984 0.000
#> GSM1124886     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.0405      0.913 0.000 0.004 0.000 0.008 0.988 0.000
#> GSM1124894     4  0.0508      0.941 0.012 0.000 0.000 0.984 0.000 0.004
#> GSM1124896     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124899     5  0.1267      0.887 0.000 0.060 0.000 0.000 0.940 0.000
#> GSM1124901     5  0.0508      0.912 0.000 0.012 0.000 0.004 0.984 0.000
#> GSM1124906     2  0.0622      0.934 0.000 0.980 0.000 0.000 0.008 0.012
#> GSM1124907     5  0.1584      0.872 0.000 0.008 0.000 0.000 0.928 0.064
#> GSM1124911     6  0.2340      0.941 0.000 0.148 0.000 0.000 0.000 0.852
#> GSM1124912     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.2266      0.960 0.000 0.108 0.000 0.000 0.012 0.880
#> GSM1124917     2  0.2632      0.779 0.000 0.832 0.000 0.000 0.164 0.004
#> GSM1124918     6  0.2003      0.963 0.000 0.116 0.000 0.000 0.000 0.884
#> GSM1124920     1  0.6000      0.218 0.544 0.020 0.308 0.000 0.012 0.116
#> GSM1124922     5  0.1080      0.904 0.004 0.032 0.000 0.000 0.960 0.004
#> GSM1124924     2  0.2402      0.838 0.000 0.868 0.000 0.000 0.012 0.120
#> GSM1124926     5  0.3647      0.461 0.000 0.360 0.000 0.000 0.640 0.000
#> GSM1124928     1  0.2136      0.884 0.904 0.048 0.000 0.000 0.000 0.048
#> GSM1124930     5  0.2536      0.815 0.000 0.020 0.000 0.000 0.864 0.116
#> GSM1124931     6  0.2048      0.963 0.000 0.120 0.000 0.000 0.000 0.880
#> GSM1124935     6  0.2509      0.939 0.000 0.088 0.000 0.000 0.036 0.876
#> GSM1124936     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124938     3  0.2889      0.777 0.000 0.020 0.852 0.000 0.012 0.116
#> GSM1124940     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.0632      0.927 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM1124942     3  0.5400      0.702 0.000 0.084 0.684 0.000 0.116 0.116
#> GSM1124943     3  0.5873      0.279 0.000 0.020 0.452 0.000 0.412 0.116
#> GSM1124948     2  0.2656      0.831 0.000 0.860 0.008 0.000 0.012 0.120
#> GSM1124949     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.0363      0.932 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1124954     6  0.2311      0.959 0.016 0.104 0.000 0.000 0.000 0.880
#> GSM1124955     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     6  0.2048      0.963 0.000 0.120 0.000 0.000 0.000 0.880
#> GSM1124872     2  0.0622      0.934 0.000 0.980 0.000 0.000 0.008 0.012
#> GSM1124873     2  0.0520      0.934 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM1124876     3  0.0000      0.789 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     6  0.2257      0.826 0.116 0.008 0.000 0.000 0.000 0.876
#> GSM1124879     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.0363      0.913 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM1124889     2  0.0790      0.928 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1124892     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.0520      0.935 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM1124913     5  0.0363      0.913 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM1124916     6  0.2219      0.950 0.000 0.136 0.000 0.000 0.000 0.864
#> GSM1124923     5  0.0508      0.910 0.000 0.000 0.012 0.004 0.984 0.000
#> GSM1124925     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     6  0.2301      0.953 0.020 0.096 0.000 0.000 0.000 0.884
#> GSM1124937     1  0.1693      0.914 0.936 0.020 0.000 0.000 0.012 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 tissue(p) k
#> CV:NMF 84  7.76e-03 2
#> CV:NMF 85  2.09e-03 3
#> CV:NMF 88  2.63e-12 4
#> CV:NMF 86  7.94e-09 5
#> CV:NMF 86  8.13e-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 48983 rows and 91 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.432           0.832       0.907         0.2483 0.785   0.785
#> 3 3 0.310           0.691       0.836         1.1641 0.660   0.579
#> 4 4 0.380           0.418       0.726         0.1967 0.958   0.915
#> 5 5 0.421           0.379       0.649         0.1011 0.868   0.713
#> 6 6 0.433           0.346       0.626         0.0452 0.904   0.725

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.8813      0.667 0.700 0.300
#> GSM1124888     1  0.7299      0.722 0.796 0.204
#> GSM1124890     2  0.5842      0.814 0.140 0.860
#> GSM1124904     2  0.0000      0.904 0.000 1.000
#> GSM1124927     2  0.1843      0.903 0.028 0.972
#> GSM1124953     2  0.9129      0.430 0.328 0.672
#> GSM1124869     2  0.7219      0.783 0.200 0.800
#> GSM1124870     2  0.1843      0.903 0.028 0.972
#> GSM1124882     2  0.6438      0.819 0.164 0.836
#> GSM1124884     2  0.2236      0.900 0.036 0.964
#> GSM1124898     2  0.0000      0.904 0.000 1.000
#> GSM1124903     2  0.0000      0.904 0.000 1.000
#> GSM1124905     2  0.5178      0.849 0.116 0.884
#> GSM1124910     2  0.8144      0.707 0.252 0.748
#> GSM1124919     2  0.5737      0.819 0.136 0.864
#> GSM1124932     2  0.2043      0.901 0.032 0.968
#> GSM1124933     1  0.0000      0.727 1.000 0.000
#> GSM1124867     2  0.4161      0.881 0.084 0.916
#> GSM1124868     2  0.0000      0.904 0.000 1.000
#> GSM1124878     2  0.0000      0.904 0.000 1.000
#> GSM1124895     2  0.0000      0.904 0.000 1.000
#> GSM1124897     2  0.0000      0.904 0.000 1.000
#> GSM1124902     2  0.0376      0.905 0.004 0.996
#> GSM1124908     2  0.0376      0.905 0.004 0.996
#> GSM1124921     2  0.1843      0.901 0.028 0.972
#> GSM1124939     2  0.0376      0.905 0.004 0.996
#> GSM1124944     2  0.0376      0.905 0.004 0.996
#> GSM1124945     1  0.5408      0.726 0.876 0.124
#> GSM1124946     2  0.1843      0.901 0.028 0.972
#> GSM1124947     2  0.0938      0.906 0.012 0.988
#> GSM1124951     1  0.5629      0.725 0.868 0.132
#> GSM1124952     2  0.2236      0.900 0.036 0.964
#> GSM1124957     1  0.0000      0.727 1.000 0.000
#> GSM1124900     2  0.2236      0.901 0.036 0.964
#> GSM1124914     2  0.0000      0.904 0.000 1.000
#> GSM1124871     2  0.0000      0.904 0.000 1.000
#> GSM1124874     2  0.0672      0.905 0.008 0.992
#> GSM1124875     2  0.3584      0.886 0.068 0.932
#> GSM1124880     2  0.6623      0.816 0.172 0.828
#> GSM1124881     2  0.0672      0.905 0.008 0.992
#> GSM1124885     2  0.0000      0.904 0.000 1.000
#> GSM1124886     2  0.7602      0.757 0.220 0.780
#> GSM1124887     2  0.1843      0.901 0.028 0.972
#> GSM1124894     2  0.5178      0.849 0.116 0.884
#> GSM1124896     2  0.5059      0.851 0.112 0.888
#> GSM1124899     2  0.0376      0.905 0.004 0.996
#> GSM1124901     2  0.0000      0.904 0.000 1.000
#> GSM1124906     2  0.0938      0.905 0.012 0.988
#> GSM1124907     2  0.2603      0.895 0.044 0.956
#> GSM1124911     2  0.0000      0.904 0.000 1.000
#> GSM1124912     2  0.6247      0.825 0.156 0.844
#> GSM1124915     2  0.0000      0.904 0.000 1.000
#> GSM1124917     2  0.0672      0.905 0.008 0.992
#> GSM1124918     2  0.3584      0.886 0.068 0.932
#> GSM1124920     1  0.9248      0.620 0.660 0.340
#> GSM1124922     2  0.0376      0.905 0.004 0.996
#> GSM1124924     2  0.6973      0.795 0.188 0.812
#> GSM1124926     2  0.0376      0.905 0.004 0.996
#> GSM1124928     2  0.6973      0.800 0.188 0.812
#> GSM1124930     2  0.5178      0.848 0.116 0.884
#> GSM1124931     2  0.2778      0.895 0.048 0.952
#> GSM1124935     2  0.0000      0.904 0.000 1.000
#> GSM1124936     1  0.9998      0.135 0.508 0.492
#> GSM1124938     2  0.5294      0.848 0.120 0.880
#> GSM1124940     2  0.6247      0.825 0.156 0.844
#> GSM1124941     2  0.0938      0.905 0.012 0.988
#> GSM1124942     2  0.5294      0.848 0.120 0.880
#> GSM1124943     2  0.5294      0.846 0.120 0.880
#> GSM1124948     2  0.6247      0.815 0.156 0.844
#> GSM1124949     2  0.7528      0.763 0.216 0.784
#> GSM1124950     2  0.2043      0.901 0.032 0.968
#> GSM1124954     1  0.9209      0.626 0.664 0.336
#> GSM1124955     2  0.6247      0.825 0.156 0.844
#> GSM1124956     2  0.0000      0.904 0.000 1.000
#> GSM1124872     2  0.2043      0.901 0.032 0.968
#> GSM1124873     2  0.0000      0.904 0.000 1.000
#> GSM1124876     1  0.0000      0.727 1.000 0.000
#> GSM1124877     2  0.7299      0.774 0.204 0.796
#> GSM1124879     2  0.8144      0.707 0.252 0.748
#> GSM1124883     2  0.0000      0.904 0.000 1.000
#> GSM1124889     2  0.0000      0.904 0.000 1.000
#> GSM1124892     2  0.8443      0.668 0.272 0.728
#> GSM1124893     2  0.6247      0.825 0.156 0.844
#> GSM1124909     2  0.3879      0.883 0.076 0.924
#> GSM1124913     2  0.0000      0.904 0.000 1.000
#> GSM1124916     2  0.3879      0.883 0.076 0.924
#> GSM1124923     2  0.6973      0.747 0.188 0.812
#> GSM1124925     2  0.5059      0.851 0.112 0.888
#> GSM1124929     2  0.7528      0.763 0.216 0.784
#> GSM1124934     1  0.9608      0.527 0.616 0.384
#> GSM1124937     2  0.6438      0.813 0.164 0.836

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.6180     0.2829 0.416 0.000 0.584
#> GSM1124888     3  0.5363     0.5664 0.276 0.000 0.724
#> GSM1124890     2  0.7535     0.6664 0.176 0.692 0.132
#> GSM1124904     2  0.0424     0.8234 0.008 0.992 0.000
#> GSM1124927     2  0.5291     0.7095 0.268 0.732 0.000
#> GSM1124953     2  0.7491     0.4886 0.056 0.620 0.324
#> GSM1124869     1  0.1647     0.7520 0.960 0.036 0.004
#> GSM1124870     2  0.5291     0.7095 0.268 0.732 0.000
#> GSM1124882     1  0.2261     0.7589 0.932 0.068 0.000
#> GSM1124884     2  0.3686     0.8074 0.140 0.860 0.000
#> GSM1124898     2  0.1643     0.8352 0.044 0.956 0.000
#> GSM1124903     2  0.0424     0.8234 0.008 0.992 0.000
#> GSM1124905     1  0.6155     0.5203 0.664 0.328 0.008
#> GSM1124910     1  0.3263     0.7363 0.912 0.048 0.040
#> GSM1124919     2  0.6383     0.7338 0.104 0.768 0.128
#> GSM1124932     2  0.3551     0.8124 0.132 0.868 0.000
#> GSM1124933     3  0.0000     0.7918 0.000 0.000 1.000
#> GSM1124867     2  0.6476     0.3908 0.448 0.548 0.004
#> GSM1124868     2  0.0424     0.8234 0.008 0.992 0.000
#> GSM1124878     2  0.0424     0.8234 0.008 0.992 0.000
#> GSM1124895     2  0.0747     0.8275 0.016 0.984 0.000
#> GSM1124897     2  0.0424     0.8254 0.008 0.992 0.000
#> GSM1124902     2  0.2448     0.8255 0.076 0.924 0.000
#> GSM1124908     2  0.2165     0.8321 0.064 0.936 0.000
#> GSM1124921     2  0.3276     0.8128 0.068 0.908 0.024
#> GSM1124939     2  0.2448     0.8255 0.076 0.924 0.000
#> GSM1124944     2  0.2448     0.8255 0.076 0.924 0.000
#> GSM1124945     3  0.3412     0.7333 0.000 0.124 0.876
#> GSM1124946     2  0.3276     0.8128 0.068 0.908 0.024
#> GSM1124947     2  0.2625     0.8265 0.084 0.916 0.000
#> GSM1124951     3  0.3551     0.7239 0.000 0.132 0.868
#> GSM1124952     2  0.3686     0.8074 0.140 0.860 0.000
#> GSM1124957     3  0.0000     0.7918 0.000 0.000 1.000
#> GSM1124900     2  0.5397     0.6933 0.280 0.720 0.000
#> GSM1124914     2  0.1289     0.8325 0.032 0.968 0.000
#> GSM1124871     2  0.2448     0.8334 0.076 0.924 0.000
#> GSM1124874     2  0.2261     0.8361 0.068 0.932 0.000
#> GSM1124875     2  0.6880     0.6086 0.304 0.660 0.036
#> GSM1124880     1  0.4861     0.6649 0.800 0.192 0.008
#> GSM1124881     2  0.3500     0.8281 0.116 0.880 0.004
#> GSM1124885     2  0.0424     0.8234 0.008 0.992 0.000
#> GSM1124886     1  0.1315     0.7418 0.972 0.020 0.008
#> GSM1124887     2  0.2564     0.8282 0.036 0.936 0.028
#> GSM1124894     1  0.6275     0.4730 0.644 0.348 0.008
#> GSM1124896     1  0.4605     0.6695 0.796 0.204 0.000
#> GSM1124899     2  0.2711     0.8355 0.088 0.912 0.000
#> GSM1124901     2  0.1163     0.8329 0.028 0.972 0.000
#> GSM1124906     2  0.3816     0.8052 0.148 0.852 0.000
#> GSM1124907     2  0.3921     0.8016 0.080 0.884 0.036
#> GSM1124911     2  0.2356     0.8317 0.072 0.928 0.000
#> GSM1124912     1  0.2448     0.7586 0.924 0.076 0.000
#> GSM1124915     2  0.1964     0.8339 0.056 0.944 0.000
#> GSM1124917     2  0.3349     0.8302 0.108 0.888 0.004
#> GSM1124918     2  0.6880     0.6086 0.304 0.660 0.036
#> GSM1124920     1  0.6295    -0.1125 0.528 0.000 0.472
#> GSM1124922     2  0.3879     0.8114 0.152 0.848 0.000
#> GSM1124924     1  0.5521     0.6613 0.788 0.180 0.032
#> GSM1124926     2  0.2711     0.8355 0.088 0.912 0.000
#> GSM1124928     1  0.4514     0.6988 0.832 0.156 0.012
#> GSM1124930     2  0.8243     0.2685 0.420 0.504 0.076
#> GSM1124931     2  0.4931     0.7465 0.232 0.768 0.000
#> GSM1124935     2  0.1753     0.8358 0.048 0.952 0.000
#> GSM1124936     1  0.5929     0.3471 0.676 0.004 0.320
#> GSM1124938     2  0.8260     0.2478 0.432 0.492 0.076
#> GSM1124940     1  0.2448     0.7586 0.924 0.076 0.000
#> GSM1124941     2  0.3816     0.8052 0.148 0.852 0.000
#> GSM1124942     2  0.8255     0.2622 0.428 0.496 0.076
#> GSM1124943     2  0.8310     0.2600 0.420 0.500 0.080
#> GSM1124948     1  0.6839     0.5209 0.684 0.272 0.044
#> GSM1124949     1  0.1129     0.7427 0.976 0.020 0.004
#> GSM1124950     2  0.5016     0.7358 0.240 0.760 0.000
#> GSM1124954     1  0.6309    -0.1606 0.504 0.000 0.496
#> GSM1124955     1  0.2448     0.7586 0.924 0.076 0.000
#> GSM1124956     2  0.2356     0.8317 0.072 0.928 0.000
#> GSM1124872     2  0.5016     0.7358 0.240 0.760 0.000
#> GSM1124873     2  0.3038     0.8291 0.104 0.896 0.000
#> GSM1124876     3  0.0000     0.7918 0.000 0.000 1.000
#> GSM1124877     1  0.2879     0.7564 0.924 0.052 0.024
#> GSM1124879     1  0.1751     0.7275 0.960 0.012 0.028
#> GSM1124883     2  0.0424     0.8234 0.008 0.992 0.000
#> GSM1124889     2  0.1964     0.8339 0.056 0.944 0.000
#> GSM1124892     1  0.2280     0.7029 0.940 0.008 0.052
#> GSM1124893     1  0.2448     0.7586 0.924 0.076 0.000
#> GSM1124909     2  0.6247     0.5503 0.376 0.620 0.004
#> GSM1124913     2  0.0424     0.8234 0.008 0.992 0.000
#> GSM1124916     2  0.6247     0.5503 0.376 0.620 0.004
#> GSM1124923     2  0.6835     0.6873 0.088 0.732 0.180
#> GSM1124925     1  0.4605     0.6695 0.796 0.204 0.000
#> GSM1124929     1  0.1129     0.7427 0.976 0.020 0.004
#> GSM1124934     1  0.6204     0.0723 0.576 0.000 0.424
#> GSM1124937     1  0.5060     0.6790 0.816 0.156 0.028

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.3464     0.5939 0.124 0.004 0.856 0.016
#> GSM1124888     3  0.3601     0.6408 0.056 0.000 0.860 0.084
#> GSM1124890     2  0.7048    -0.1523 0.044 0.584 0.056 0.316
#> GSM1124904     2  0.3801     0.3493 0.000 0.780 0.000 0.220
#> GSM1124927     2  0.6694     0.4537 0.212 0.660 0.024 0.104
#> GSM1124953     4  0.6491     0.0000 0.000 0.396 0.076 0.528
#> GSM1124869     1  0.2631     0.6448 0.912 0.008 0.064 0.016
#> GSM1124870     2  0.6694     0.4537 0.212 0.660 0.024 0.104
#> GSM1124882     1  0.1139     0.6470 0.972 0.012 0.008 0.008
#> GSM1124884     2  0.4534     0.5619 0.132 0.800 0.000 0.068
#> GSM1124898     2  0.2021     0.5677 0.012 0.932 0.000 0.056
#> GSM1124903     2  0.3172     0.4510 0.000 0.840 0.000 0.160
#> GSM1124905     1  0.6893     0.4158 0.644 0.228 0.032 0.096
#> GSM1124910     1  0.7973     0.4111 0.520 0.040 0.300 0.140
#> GSM1124919     2  0.5815    -0.0583 0.028 0.636 0.012 0.324
#> GSM1124932     2  0.4428     0.5662 0.124 0.808 0.000 0.068
#> GSM1124933     3  0.4624     0.6200 0.000 0.000 0.660 0.340
#> GSM1124867     2  0.8048     0.1814 0.340 0.500 0.068 0.092
#> GSM1124868     2  0.2704     0.4942 0.000 0.876 0.000 0.124
#> GSM1124878     2  0.3942     0.3178 0.000 0.764 0.000 0.236
#> GSM1124895     2  0.2334     0.5300 0.004 0.908 0.000 0.088
#> GSM1124897     2  0.2345     0.5182 0.000 0.900 0.000 0.100
#> GSM1124902     2  0.3806     0.4455 0.020 0.824 0.000 0.156
#> GSM1124908     2  0.3217     0.4990 0.012 0.860 0.000 0.128
#> GSM1124921     2  0.5047     0.0685 0.016 0.668 0.000 0.316
#> GSM1124939     2  0.3757     0.4501 0.020 0.828 0.000 0.152
#> GSM1124944     2  0.3757     0.4501 0.020 0.828 0.000 0.152
#> GSM1124945     3  0.5827     0.5339 0.000 0.032 0.532 0.436
#> GSM1124946     2  0.5047     0.0685 0.016 0.668 0.000 0.316
#> GSM1124947     2  0.3891     0.4604 0.020 0.828 0.004 0.148
#> GSM1124951     3  0.5838     0.5280 0.000 0.032 0.524 0.444
#> GSM1124952     2  0.4534     0.5619 0.132 0.800 0.000 0.068
#> GSM1124957     3  0.4624     0.6200 0.000 0.000 0.660 0.340
#> GSM1124900     2  0.6789     0.4405 0.224 0.648 0.024 0.104
#> GSM1124914     2  0.2345     0.5256 0.000 0.900 0.000 0.100
#> GSM1124871     2  0.3400     0.5906 0.076 0.876 0.004 0.044
#> GSM1124874     2  0.3009     0.5908 0.052 0.892 0.000 0.056
#> GSM1124875     2  0.7949     0.1414 0.088 0.568 0.092 0.252
#> GSM1124880     1  0.9015     0.4235 0.464 0.176 0.252 0.108
#> GSM1124881     2  0.4007     0.5770 0.068 0.856 0.020 0.056
#> GSM1124885     2  0.2814     0.4867 0.000 0.868 0.000 0.132
#> GSM1124886     1  0.2987     0.6336 0.880 0.000 0.104 0.016
#> GSM1124887     2  0.4428     0.2363 0.000 0.720 0.004 0.276
#> GSM1124894     1  0.6849     0.4011 0.640 0.232 0.024 0.104
#> GSM1124896     1  0.4234     0.5467 0.816 0.132 0.000 0.052
#> GSM1124899     2  0.3088     0.5885 0.060 0.888 0.000 0.052
#> GSM1124901     2  0.1637     0.5572 0.000 0.940 0.000 0.060
#> GSM1124906     2  0.4686     0.5548 0.144 0.788 0.000 0.068
#> GSM1124907     2  0.5323    -0.0768 0.020 0.628 0.000 0.352
#> GSM1124911     2  0.3392     0.5850 0.072 0.872 0.000 0.056
#> GSM1124912     1  0.0844     0.6426 0.980 0.012 0.004 0.004
#> GSM1124915     2  0.3081     0.5876 0.064 0.888 0.000 0.048
#> GSM1124917     2  0.4227     0.5751 0.060 0.844 0.020 0.076
#> GSM1124918     2  0.7949     0.1414 0.088 0.568 0.092 0.252
#> GSM1124920     3  0.4188     0.4820 0.244 0.000 0.752 0.004
#> GSM1124922     2  0.4607     0.5721 0.100 0.816 0.012 0.072
#> GSM1124924     1  0.9520     0.3514 0.380 0.156 0.292 0.172
#> GSM1124926     2  0.3088     0.5885 0.060 0.888 0.000 0.052
#> GSM1124928     1  0.8709     0.4489 0.496 0.144 0.260 0.100
#> GSM1124930     2  0.8896    -0.2298 0.072 0.388 0.180 0.360
#> GSM1124931     2  0.6215     0.4947 0.188 0.700 0.020 0.092
#> GSM1124935     2  0.2060     0.5709 0.016 0.932 0.000 0.052
#> GSM1124936     3  0.5913     0.1800 0.352 0.000 0.600 0.048
#> GSM1124938     2  0.8898    -0.2168 0.072 0.384 0.180 0.364
#> GSM1124940     1  0.0657     0.6438 0.984 0.012 0.000 0.004
#> GSM1124941     2  0.4686     0.5548 0.144 0.788 0.000 0.068
#> GSM1124942     2  0.8875    -0.2143 0.072 0.388 0.176 0.364
#> GSM1124943     2  0.8915    -0.2360 0.072 0.388 0.184 0.356
#> GSM1124948     1  0.9921     0.2566 0.296 0.232 0.272 0.200
#> GSM1124949     1  0.2987     0.6348 0.880 0.000 0.104 0.016
#> GSM1124950     2  0.6280     0.4853 0.204 0.692 0.024 0.080
#> GSM1124954     3  0.4549     0.5248 0.188 0.000 0.776 0.036
#> GSM1124955     1  0.0804     0.6425 0.980 0.012 0.000 0.008
#> GSM1124956     2  0.3392     0.5850 0.072 0.872 0.000 0.056
#> GSM1124872     2  0.6280     0.4853 0.204 0.692 0.024 0.080
#> GSM1124873     2  0.4059     0.5863 0.092 0.844 0.008 0.056
#> GSM1124876     3  0.4624     0.6200 0.000 0.000 0.660 0.340
#> GSM1124877     1  0.3697     0.6338 0.868 0.012 0.068 0.052
#> GSM1124879     1  0.7128     0.4311 0.576 0.012 0.288 0.124
#> GSM1124883     2  0.3074     0.4595 0.000 0.848 0.000 0.152
#> GSM1124889     2  0.3081     0.5876 0.064 0.888 0.000 0.048
#> GSM1124892     1  0.4599     0.5284 0.736 0.000 0.248 0.016
#> GSM1124893     1  0.0657     0.6438 0.984 0.012 0.000 0.004
#> GSM1124909     2  0.7759     0.2972 0.240 0.588 0.076 0.096
#> GSM1124913     2  0.3975     0.3112 0.000 0.760 0.000 0.240
#> GSM1124916     2  0.7759     0.2972 0.240 0.588 0.076 0.096
#> GSM1124923     2  0.6631    -0.5996 0.016 0.508 0.048 0.428
#> GSM1124925     1  0.4234     0.5467 0.816 0.132 0.000 0.052
#> GSM1124929     1  0.2987     0.6348 0.880 0.000 0.104 0.016
#> GSM1124934     3  0.5156     0.4378 0.236 0.000 0.720 0.044
#> GSM1124937     1  0.9295     0.3622 0.408 0.152 0.300 0.140

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1124891     3   0.275     0.6040 0.096 0.008 0.880 0.000 0.016
#> GSM1124888     3   0.284     0.6465 0.048 0.000 0.876 0.076 0.000
#> GSM1124890     4   0.708     0.4497 0.004 0.408 0.036 0.420 0.132
#> GSM1124904     5   0.465     0.7732 0.000 0.372 0.000 0.020 0.608
#> GSM1124927     2   0.559     0.3562 0.124 0.724 0.004 0.080 0.068
#> GSM1124953     4   0.658     0.2380 0.000 0.144 0.032 0.568 0.256
#> GSM1124869     1   0.170     0.6190 0.936 0.016 0.048 0.000 0.000
#> GSM1124870     2   0.559     0.3562 0.124 0.724 0.004 0.080 0.068
#> GSM1124882     1   0.173     0.6227 0.940 0.044 0.008 0.004 0.004
#> GSM1124884     2   0.255     0.5302 0.048 0.908 0.004 0.024 0.016
#> GSM1124898     2   0.430     0.3840 0.000 0.744 0.000 0.048 0.208
#> GSM1124903     5   0.489     0.6880 0.000 0.404 0.000 0.028 0.568
#> GSM1124905     1   0.852     0.3218 0.468 0.240 0.068 0.104 0.120
#> GSM1124910     1   0.784     0.3509 0.496 0.056 0.256 0.160 0.032
#> GSM1124919     2   0.656    -0.4158 0.004 0.424 0.000 0.400 0.172
#> GSM1124932     2   0.239     0.5335 0.044 0.916 0.004 0.020 0.016
#> GSM1124933     3   0.468     0.6612 0.000 0.000 0.652 0.316 0.032
#> GSM1124867     2   0.735     0.0654 0.296 0.528 0.032 0.088 0.056
#> GSM1124868     2   0.485    -0.3099 0.000 0.552 0.000 0.024 0.424
#> GSM1124878     5   0.466     0.7911 0.000 0.312 0.000 0.032 0.656
#> GSM1124895     2   0.458     0.1820 0.000 0.672 0.000 0.032 0.296
#> GSM1124897     2   0.499    -0.1698 0.000 0.580 0.000 0.036 0.384
#> GSM1124902     2   0.553     0.2941 0.004 0.656 0.000 0.128 0.212
#> GSM1124908     2   0.523     0.1526 0.000 0.636 0.000 0.076 0.288
#> GSM1124921     2   0.661    -0.2913 0.004 0.432 0.000 0.184 0.380
#> GSM1124939     2   0.556     0.2909 0.004 0.652 0.000 0.128 0.216
#> GSM1124944     2   0.545     0.3197 0.004 0.668 0.000 0.128 0.200
#> GSM1124945     3   0.599     0.6158 0.000 0.004 0.524 0.368 0.104
#> GSM1124946     2   0.661    -0.2913 0.004 0.432 0.000 0.184 0.380
#> GSM1124947     2   0.539     0.3412 0.004 0.676 0.000 0.128 0.192
#> GSM1124951     3   0.607     0.6118 0.000 0.004 0.516 0.368 0.112
#> GSM1124952     2   0.255     0.5302 0.048 0.908 0.004 0.024 0.016
#> GSM1124957     3   0.468     0.6612 0.000 0.000 0.652 0.316 0.032
#> GSM1124900     2   0.572     0.3409 0.136 0.712 0.004 0.080 0.068
#> GSM1124914     2   0.484     0.1433 0.000 0.652 0.000 0.044 0.304
#> GSM1124871     2   0.256     0.5183 0.020 0.884 0.000 0.000 0.096
#> GSM1124874     2   0.241     0.5142 0.004 0.896 0.000 0.012 0.088
#> GSM1124875     2   0.746    -0.3427 0.052 0.504 0.068 0.324 0.052
#> GSM1124880     1   0.893     0.2805 0.412 0.188 0.204 0.144 0.052
#> GSM1124881     2   0.412     0.5250 0.024 0.828 0.012 0.060 0.076
#> GSM1124885     2   0.490    -0.4697 0.000 0.504 0.000 0.024 0.472
#> GSM1124886     1   0.215     0.6072 0.912 0.004 0.076 0.004 0.004
#> GSM1124887     5   0.603     0.5329 0.000 0.388 0.000 0.120 0.492
#> GSM1124894     1   0.838     0.3188 0.476 0.240 0.060 0.084 0.140
#> GSM1124896     1   0.525     0.5097 0.740 0.128 0.000 0.064 0.068
#> GSM1124899     2   0.417     0.4675 0.024 0.788 0.000 0.028 0.160
#> GSM1124901     2   0.462     0.2730 0.000 0.692 0.000 0.044 0.264
#> GSM1124906     2   0.298     0.5341 0.068 0.884 0.004 0.016 0.028
#> GSM1124907     2   0.681    -0.2659 0.004 0.404 0.000 0.236 0.356
#> GSM1124911     2   0.120     0.5332 0.004 0.960 0.000 0.004 0.032
#> GSM1124912     1   0.168     0.6197 0.940 0.048 0.004 0.004 0.004
#> GSM1124915     2   0.172     0.5291 0.004 0.936 0.000 0.008 0.052
#> GSM1124917     2   0.451     0.5141 0.020 0.800 0.012 0.080 0.088
#> GSM1124918     2   0.746    -0.3427 0.052 0.504 0.068 0.324 0.052
#> GSM1124920     3   0.432     0.4586 0.260 0.000 0.716 0.012 0.012
#> GSM1124922     2   0.489     0.5371 0.060 0.776 0.004 0.060 0.100
#> GSM1124924     1   0.920     0.1831 0.328 0.184 0.244 0.200 0.044
#> GSM1124926     2   0.417     0.4675 0.024 0.788 0.000 0.028 0.160
#> GSM1124928     1   0.858     0.3709 0.460 0.152 0.212 0.128 0.048
#> GSM1124930     4   0.754     0.6831 0.028 0.324 0.148 0.468 0.032
#> GSM1124931     2   0.533     0.4198 0.092 0.760 0.020 0.072 0.056
#> GSM1124935     2   0.432     0.3915 0.004 0.748 0.000 0.040 0.208
#> GSM1124936     3   0.581     0.1624 0.360 0.000 0.560 0.064 0.016
#> GSM1124938     4   0.743     0.6766 0.028 0.336 0.148 0.464 0.024
#> GSM1124940     1   0.152     0.6207 0.944 0.048 0.000 0.004 0.004
#> GSM1124941     2   0.298     0.5341 0.068 0.884 0.004 0.016 0.028
#> GSM1124942     4   0.747     0.6783 0.028 0.336 0.144 0.464 0.028
#> GSM1124943     4   0.753     0.6842 0.028 0.320 0.148 0.472 0.032
#> GSM1124948     1   0.920    -0.0991 0.272 0.244 0.224 0.228 0.032
#> GSM1124949     1   0.221     0.6085 0.912 0.004 0.072 0.004 0.008
#> GSM1124950     2   0.488     0.4397 0.108 0.780 0.012 0.060 0.040
#> GSM1124954     3   0.501     0.5325 0.160 0.004 0.748 0.040 0.048
#> GSM1124955     1   0.159     0.6195 0.940 0.052 0.000 0.004 0.004
#> GSM1124956     2   0.120     0.5332 0.004 0.960 0.000 0.004 0.032
#> GSM1124872     2   0.488     0.4397 0.108 0.780 0.012 0.060 0.040
#> GSM1124873     2   0.235     0.5490 0.024 0.920 0.004 0.024 0.028
#> GSM1124876     3   0.468     0.6612 0.000 0.000 0.652 0.316 0.032
#> GSM1124877     1   0.373     0.6083 0.852 0.036 0.044 0.060 0.008
#> GSM1124879     1   0.733     0.3703 0.540 0.028 0.236 0.164 0.032
#> GSM1124883     2   0.483    -0.5120 0.000 0.496 0.000 0.020 0.484
#> GSM1124889     2   0.164     0.5307 0.004 0.940 0.000 0.008 0.048
#> GSM1124892     1   0.372     0.5090 0.776 0.000 0.208 0.004 0.012
#> GSM1124893     1   0.152     0.6207 0.944 0.048 0.000 0.004 0.004
#> GSM1124909     2   0.687     0.2059 0.216 0.616 0.052 0.080 0.036
#> GSM1124913     5   0.471     0.7618 0.000 0.280 0.000 0.044 0.676
#> GSM1124916     2   0.687     0.2059 0.216 0.616 0.052 0.080 0.036
#> GSM1124923     4   0.703     0.3133 0.004 0.268 0.012 0.464 0.252
#> GSM1124925     1   0.525     0.5097 0.740 0.128 0.000 0.064 0.068
#> GSM1124929     1   0.221     0.6085 0.912 0.004 0.072 0.004 0.008
#> GSM1124934     3   0.595     0.4632 0.188 0.012 0.684 0.060 0.056
#> GSM1124937     1   0.898     0.2496 0.376 0.172 0.236 0.176 0.040

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.7410     0.4005 0.272 0.008 0.488 0.048 0.092 0.092
#> GSM1124888     3  0.6130     0.5776 0.176 0.000 0.640 0.044 0.084 0.056
#> GSM1124890     5  0.6222     0.5496 0.072 0.328 0.048 0.020 0.532 0.000
#> GSM1124904     4  0.4590     0.7264 0.000 0.268 0.000 0.668 0.056 0.008
#> GSM1124927     2  0.5030     0.4217 0.120 0.732 0.000 0.012 0.072 0.064
#> GSM1124953     5  0.5263     0.1721 0.000 0.056 0.216 0.036 0.676 0.016
#> GSM1124869     1  0.4403    -0.4642 0.520 0.012 0.000 0.000 0.008 0.460
#> GSM1124870     2  0.5030     0.4217 0.120 0.732 0.000 0.012 0.072 0.064
#> GSM1124882     6  0.4533     0.5552 0.468 0.024 0.000 0.000 0.004 0.504
#> GSM1124884     2  0.2233     0.5704 0.044 0.912 0.000 0.020 0.004 0.020
#> GSM1124898     2  0.4738     0.3886 0.020 0.692 0.000 0.220 0.068 0.000
#> GSM1124903     4  0.4563     0.7093 0.000 0.284 0.000 0.656 0.056 0.004
#> GSM1124905     6  0.5944     0.2485 0.080 0.240 0.000 0.016 0.052 0.612
#> GSM1124910     1  0.2550     0.3668 0.900 0.048 0.008 0.004 0.016 0.024
#> GSM1124919     5  0.5489     0.5035 0.016 0.328 0.044 0.028 0.584 0.000
#> GSM1124932     2  0.2076     0.5734 0.040 0.920 0.000 0.020 0.004 0.016
#> GSM1124933     3  0.0146     0.8109 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1124867     2  0.6085     0.1623 0.340 0.528 0.000 0.012 0.076 0.044
#> GSM1124868     2  0.5082    -0.3981 0.000 0.476 0.000 0.460 0.056 0.008
#> GSM1124878     4  0.4171     0.7009 0.000 0.208 0.000 0.732 0.052 0.008
#> GSM1124895     2  0.5246     0.1181 0.004 0.596 0.000 0.308 0.084 0.008
#> GSM1124897     2  0.5609    -0.2857 0.000 0.492 0.000 0.384 0.116 0.008
#> GSM1124902     2  0.5673     0.2938 0.004 0.584 0.000 0.172 0.232 0.008
#> GSM1124908     2  0.5801     0.1292 0.012 0.572 0.000 0.268 0.140 0.008
#> GSM1124921     2  0.6349    -0.2019 0.004 0.372 0.000 0.296 0.324 0.004
#> GSM1124939     2  0.5721     0.2846 0.004 0.576 0.000 0.176 0.236 0.008
#> GSM1124944     2  0.5609     0.3147 0.004 0.592 0.000 0.160 0.236 0.008
#> GSM1124945     3  0.3060     0.7727 0.000 0.000 0.836 0.020 0.132 0.012
#> GSM1124946     2  0.6349    -0.2019 0.004 0.372 0.000 0.296 0.324 0.004
#> GSM1124947     2  0.5549     0.3344 0.004 0.600 0.000 0.152 0.236 0.008
#> GSM1124951     3  0.3141     0.7691 0.000 0.000 0.828 0.020 0.140 0.012
#> GSM1124952     2  0.2233     0.5704 0.044 0.912 0.000 0.020 0.004 0.020
#> GSM1124957     3  0.0146     0.8109 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1124900     2  0.5147     0.4102 0.132 0.720 0.000 0.012 0.072 0.064
#> GSM1124914     2  0.5551     0.0954 0.012 0.580 0.000 0.304 0.096 0.008
#> GSM1124871     2  0.2909     0.5394 0.008 0.852 0.000 0.120 0.008 0.012
#> GSM1124874     2  0.2965     0.5439 0.012 0.856 0.000 0.108 0.016 0.008
#> GSM1124875     2  0.6111    -0.3206 0.216 0.464 0.000 0.004 0.312 0.004
#> GSM1124880     1  0.4706     0.3478 0.728 0.184 0.000 0.012 0.032 0.044
#> GSM1124881     2  0.3988     0.5581 0.056 0.808 0.000 0.068 0.064 0.004
#> GSM1124885     4  0.5000     0.4932 0.000 0.416 0.000 0.520 0.060 0.004
#> GSM1124886     1  0.4495    -0.3465 0.560 0.008 0.000 0.008 0.008 0.416
#> GSM1124887     4  0.6324     0.4248 0.004 0.284 0.000 0.436 0.268 0.008
#> GSM1124894     6  0.5819     0.2638 0.048 0.244 0.000 0.024 0.060 0.624
#> GSM1124896     6  0.4813     0.5528 0.248 0.104 0.000 0.000 0.000 0.648
#> GSM1124899     2  0.4263     0.4947 0.016 0.764 0.000 0.160 0.048 0.012
#> GSM1124901     2  0.5034     0.2560 0.016 0.632 0.000 0.280 0.072 0.000
#> GSM1124906     2  0.2638     0.5778 0.036 0.896 0.000 0.016 0.020 0.032
#> GSM1124907     5  0.6402    -0.0188 0.008 0.324 0.000 0.272 0.392 0.004
#> GSM1124911     2  0.1364     0.5681 0.000 0.944 0.000 0.048 0.004 0.004
#> GSM1124912     6  0.4593     0.5794 0.456 0.028 0.000 0.000 0.004 0.512
#> GSM1124915     2  0.1858     0.5621 0.000 0.912 0.000 0.076 0.012 0.000
#> GSM1124917     2  0.4646     0.5346 0.056 0.756 0.000 0.080 0.104 0.004
#> GSM1124918     2  0.6111    -0.3206 0.216 0.464 0.000 0.004 0.312 0.004
#> GSM1124920     1  0.6771    -0.2232 0.444 0.000 0.384 0.048 0.080 0.044
#> GSM1124922     2  0.4731     0.5624 0.040 0.772 0.000 0.052 0.072 0.064
#> GSM1124924     1  0.4134     0.3155 0.764 0.176 0.000 0.012 0.032 0.016
#> GSM1124926     2  0.4263     0.4947 0.016 0.764 0.000 0.160 0.048 0.012
#> GSM1124928     1  0.4200     0.3585 0.776 0.148 0.004 0.004 0.028 0.040
#> GSM1124930     5  0.6366     0.6154 0.316 0.280 0.000 0.012 0.392 0.000
#> GSM1124931     2  0.4583     0.4724 0.064 0.768 0.000 0.008 0.076 0.084
#> GSM1124935     2  0.4627     0.4077 0.024 0.704 0.000 0.216 0.056 0.000
#> GSM1124936     1  0.5744     0.1641 0.616 0.000 0.264 0.032 0.060 0.028
#> GSM1124938     5  0.6216     0.6067 0.320 0.292 0.000 0.004 0.384 0.000
#> GSM1124940     6  0.4463     0.5802 0.456 0.028 0.000 0.000 0.000 0.516
#> GSM1124941     2  0.2638     0.5778 0.036 0.896 0.000 0.016 0.020 0.032
#> GSM1124942     5  0.6211     0.6086 0.316 0.292 0.000 0.004 0.388 0.000
#> GSM1124943     5  0.6358     0.6176 0.316 0.276 0.000 0.012 0.396 0.000
#> GSM1124948     1  0.4727     0.0832 0.676 0.224 0.000 0.004 0.096 0.000
#> GSM1124949     1  0.4393    -0.3437 0.564 0.008 0.000 0.004 0.008 0.416
#> GSM1124950     2  0.4311     0.4913 0.104 0.788 0.000 0.016 0.048 0.044
#> GSM1124954     1  0.8911    -0.1759 0.292 0.004 0.176 0.156 0.152 0.220
#> GSM1124955     6  0.4523     0.5821 0.452 0.032 0.000 0.000 0.000 0.516
#> GSM1124956     2  0.1364     0.5681 0.000 0.944 0.000 0.048 0.004 0.004
#> GSM1124872     2  0.4311     0.4913 0.104 0.788 0.000 0.016 0.048 0.044
#> GSM1124873     2  0.2399     0.5880 0.024 0.908 0.000 0.024 0.032 0.012
#> GSM1124876     3  0.0146     0.8109 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1124877     1  0.4123    -0.4171 0.568 0.012 0.000 0.000 0.000 0.420
#> GSM1124879     1  0.1774     0.3419 0.936 0.024 0.000 0.004 0.016 0.020
#> GSM1124883     4  0.4627     0.5615 0.000 0.396 0.000 0.560 0.044 0.000
#> GSM1124889     2  0.1802     0.5640 0.000 0.916 0.000 0.072 0.012 0.000
#> GSM1124892     1  0.5465    -0.0777 0.628 0.008 0.040 0.012 0.032 0.280
#> GSM1124893     6  0.4463     0.5802 0.456 0.028 0.000 0.000 0.000 0.516
#> GSM1124909     2  0.5481     0.2930 0.280 0.616 0.000 0.008 0.060 0.036
#> GSM1124913     4  0.4277     0.6393 0.000 0.172 0.000 0.740 0.080 0.008
#> GSM1124916     2  0.5481     0.2930 0.280 0.616 0.000 0.008 0.060 0.036
#> GSM1124923     5  0.5340     0.4508 0.004 0.180 0.072 0.040 0.692 0.012
#> GSM1124925     6  0.4813     0.5528 0.248 0.104 0.000 0.000 0.000 0.648
#> GSM1124929     1  0.4393    -0.3437 0.564 0.008 0.000 0.004 0.008 0.416
#> GSM1124934     1  0.8729    -0.0831 0.336 0.008 0.104 0.164 0.152 0.236
#> GSM1124937     1  0.3494     0.3668 0.804 0.156 0.000 0.008 0.028 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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

test_to_known_factors(res)
#>             n tissue(p) k
#> MAD:hclust 89    0.0814 2
#> MAD:hclust 79    0.0734 3
#> MAD:hclust 44    0.0352 4
#> MAD:hclust 45    0.1111 5
#> MAD:hclust 39    0.1118 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 48983 rows and 91 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 0.870           0.929       0.969         0.4806 0.512   0.512
#> 3 3 0.611           0.682       0.788         0.2909 0.882   0.775
#> 4 4 0.693           0.832       0.881         0.1729 0.754   0.471
#> 5 5 0.676           0.543       0.721         0.0747 0.899   0.661
#> 6 6 0.718           0.630       0.791         0.0478 0.904   0.619

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
#> GSM1124891     1   0.000     0.9408 1.000 0.000
#> GSM1124888     1   0.000     0.9408 1.000 0.000
#> GSM1124890     1   0.861     0.6572 0.716 0.284
#> GSM1124904     2   0.000     0.9848 0.000 1.000
#> GSM1124927     2   0.000     0.9848 0.000 1.000
#> GSM1124953     2   0.000     0.9848 0.000 1.000
#> GSM1124869     1   0.000     0.9408 1.000 0.000
#> GSM1124870     1   0.184     0.9234 0.972 0.028
#> GSM1124882     1   0.000     0.9408 1.000 0.000
#> GSM1124884     2   0.000     0.9848 0.000 1.000
#> GSM1124898     2   0.000     0.9848 0.000 1.000
#> GSM1124903     2   0.000     0.9848 0.000 1.000
#> GSM1124905     1   0.000     0.9408 1.000 0.000
#> GSM1124910     1   0.000     0.9408 1.000 0.000
#> GSM1124919     2   0.000     0.9848 0.000 1.000
#> GSM1124932     2   0.000     0.9848 0.000 1.000
#> GSM1124933     1   0.000     0.9408 1.000 0.000
#> GSM1124867     2   0.998    -0.0353 0.472 0.528
#> GSM1124868     2   0.000     0.9848 0.000 1.000
#> GSM1124878     2   0.000     0.9848 0.000 1.000
#> GSM1124895     2   0.000     0.9848 0.000 1.000
#> GSM1124897     2   0.000     0.9848 0.000 1.000
#> GSM1124902     2   0.000     0.9848 0.000 1.000
#> GSM1124908     2   0.000     0.9848 0.000 1.000
#> GSM1124921     2   0.000     0.9848 0.000 1.000
#> GSM1124939     2   0.000     0.9848 0.000 1.000
#> GSM1124944     2   0.000     0.9848 0.000 1.000
#> GSM1124945     1   0.855     0.6630 0.720 0.280
#> GSM1124946     2   0.000     0.9848 0.000 1.000
#> GSM1124947     2   0.000     0.9848 0.000 1.000
#> GSM1124951     1   0.866     0.6505 0.712 0.288
#> GSM1124952     2   0.000     0.9848 0.000 1.000
#> GSM1124957     1   0.000     0.9408 1.000 0.000
#> GSM1124900     1   0.184     0.9234 0.972 0.028
#> GSM1124914     2   0.000     0.9848 0.000 1.000
#> GSM1124871     2   0.000     0.9848 0.000 1.000
#> GSM1124874     2   0.000     0.9848 0.000 1.000
#> GSM1124875     2   0.000     0.9848 0.000 1.000
#> GSM1124880     1   0.000     0.9408 1.000 0.000
#> GSM1124881     2   0.000     0.9848 0.000 1.000
#> GSM1124885     2   0.000     0.9848 0.000 1.000
#> GSM1124886     1   0.000     0.9408 1.000 0.000
#> GSM1124887     2   0.000     0.9848 0.000 1.000
#> GSM1124894     2   0.788     0.6677 0.236 0.764
#> GSM1124896     1   0.000     0.9408 1.000 0.000
#> GSM1124899     2   0.000     0.9848 0.000 1.000
#> GSM1124901     2   0.000     0.9848 0.000 1.000
#> GSM1124906     2   0.000     0.9848 0.000 1.000
#> GSM1124907     2   0.000     0.9848 0.000 1.000
#> GSM1124911     2   0.000     0.9848 0.000 1.000
#> GSM1124912     1   0.000     0.9408 1.000 0.000
#> GSM1124915     2   0.000     0.9848 0.000 1.000
#> GSM1124917     2   0.000     0.9848 0.000 1.000
#> GSM1124918     2   0.000     0.9848 0.000 1.000
#> GSM1124920     1   0.000     0.9408 1.000 0.000
#> GSM1124922     2   0.000     0.9848 0.000 1.000
#> GSM1124924     1   0.000     0.9408 1.000 0.000
#> GSM1124926     2   0.000     0.9848 0.000 1.000
#> GSM1124928     1   0.000     0.9408 1.000 0.000
#> GSM1124930     2   0.000     0.9848 0.000 1.000
#> GSM1124931     2   0.184     0.9555 0.028 0.972
#> GSM1124935     2   0.000     0.9848 0.000 1.000
#> GSM1124936     1   0.000     0.9408 1.000 0.000
#> GSM1124938     1   0.861     0.6572 0.716 0.284
#> GSM1124940     1   0.000     0.9408 1.000 0.000
#> GSM1124941     2   0.000     0.9848 0.000 1.000
#> GSM1124942     2   0.000     0.9848 0.000 1.000
#> GSM1124943     1   0.958     0.4639 0.620 0.380
#> GSM1124948     1   0.861     0.6572 0.716 0.284
#> GSM1124949     1   0.000     0.9408 1.000 0.000
#> GSM1124950     2   0.000     0.9848 0.000 1.000
#> GSM1124954     1   0.000     0.9408 1.000 0.000
#> GSM1124955     1   0.000     0.9408 1.000 0.000
#> GSM1124956     2   0.000     0.9848 0.000 1.000
#> GSM1124872     2   0.000     0.9848 0.000 1.000
#> GSM1124873     2   0.000     0.9848 0.000 1.000
#> GSM1124876     1   0.000     0.9408 1.000 0.000
#> GSM1124877     1   0.000     0.9408 1.000 0.000
#> GSM1124879     1   0.000     0.9408 1.000 0.000
#> GSM1124883     2   0.000     0.9848 0.000 1.000
#> GSM1124889     2   0.000     0.9848 0.000 1.000
#> GSM1124892     1   0.000     0.9408 1.000 0.000
#> GSM1124893     1   0.000     0.9408 1.000 0.000
#> GSM1124909     2   0.000     0.9848 0.000 1.000
#> GSM1124913     2   0.000     0.9848 0.000 1.000
#> GSM1124916     2   0.000     0.9848 0.000 1.000
#> GSM1124923     2   0.000     0.9848 0.000 1.000
#> GSM1124925     1   0.184     0.9234 0.972 0.028
#> GSM1124929     1   0.000     0.9408 1.000 0.000
#> GSM1124934     1   0.000     0.9408 1.000 0.000
#> GSM1124937     1   0.625     0.8123 0.844 0.156

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.5397      0.725 0.280 0.000 0.720
#> GSM1124888     3  0.5397      0.725 0.280 0.000 0.720
#> GSM1124890     3  0.5656      0.628 0.008 0.264 0.728
#> GSM1124904     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124927     2  0.9417      0.618 0.224 0.504 0.272
#> GSM1124953     2  0.2448      0.742 0.000 0.924 0.076
#> GSM1124869     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124870     1  0.5216      0.482 0.740 0.000 0.260
#> GSM1124882     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124884     2  0.8770      0.679 0.180 0.584 0.236
#> GSM1124898     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124903     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124905     1  0.0237      0.671 0.996 0.000 0.004
#> GSM1124910     1  0.4178      0.674 0.828 0.000 0.172
#> GSM1124919     2  0.1753      0.758 0.000 0.952 0.048
#> GSM1124932     2  0.9021      0.669 0.184 0.552 0.264
#> GSM1124933     3  0.5397      0.725 0.280 0.000 0.720
#> GSM1124867     1  0.9898     -0.259 0.404 0.308 0.288
#> GSM1124868     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124878     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124895     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124897     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124902     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124908     2  0.0592      0.765 0.000 0.988 0.012
#> GSM1124921     2  0.0592      0.765 0.000 0.988 0.012
#> GSM1124939     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124944     2  0.1529      0.761 0.000 0.960 0.040
#> GSM1124945     3  0.5406      0.654 0.012 0.224 0.764
#> GSM1124946     2  0.0592      0.765 0.000 0.988 0.012
#> GSM1124947     2  0.4994      0.749 0.052 0.836 0.112
#> GSM1124951     3  0.5285      0.641 0.004 0.244 0.752
#> GSM1124952     2  0.8981      0.672 0.180 0.556 0.264
#> GSM1124957     3  0.5397      0.725 0.280 0.000 0.720
#> GSM1124900     1  0.5216      0.482 0.740 0.000 0.260
#> GSM1124914     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124871     2  0.8444      0.693 0.152 0.612 0.236
#> GSM1124874     2  0.8683      0.684 0.172 0.592 0.236
#> GSM1124875     2  0.1643      0.760 0.000 0.956 0.044
#> GSM1124880     1  0.5291      0.476 0.732 0.000 0.268
#> GSM1124881     2  0.9083      0.671 0.180 0.540 0.280
#> GSM1124885     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124886     1  0.4235      0.667 0.824 0.000 0.176
#> GSM1124887     2  0.0592      0.765 0.000 0.988 0.012
#> GSM1124894     1  0.7757      0.343 0.664 0.224 0.112
#> GSM1124896     1  0.0000      0.673 1.000 0.000 0.000
#> GSM1124899     2  0.8883      0.680 0.176 0.568 0.256
#> GSM1124901     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124906     2  0.9007      0.671 0.180 0.552 0.268
#> GSM1124907     2  0.1163      0.763 0.000 0.972 0.028
#> GSM1124911     2  0.8770      0.679 0.180 0.584 0.236
#> GSM1124912     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124915     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124917     2  0.2261      0.764 0.000 0.932 0.068
#> GSM1124918     2  0.8872      0.682 0.156 0.556 0.288
#> GSM1124920     3  0.5678      0.691 0.316 0.000 0.684
#> GSM1124922     2  0.8953      0.676 0.180 0.560 0.260
#> GSM1124924     3  0.2261      0.523 0.068 0.000 0.932
#> GSM1124926     2  0.8683      0.684 0.172 0.592 0.236
#> GSM1124928     1  0.3412      0.702 0.876 0.000 0.124
#> GSM1124930     2  0.1860      0.756 0.000 0.948 0.052
#> GSM1124931     2  0.9112      0.663 0.188 0.540 0.272
#> GSM1124935     2  0.1860      0.766 0.052 0.948 0.000
#> GSM1124936     3  0.5859      0.651 0.344 0.000 0.656
#> GSM1124938     3  0.4861      0.647 0.008 0.192 0.800
#> GSM1124940     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124941     2  0.9007      0.671 0.180 0.552 0.268
#> GSM1124942     2  0.2165      0.750 0.000 0.936 0.064
#> GSM1124943     3  0.5397      0.612 0.000 0.280 0.720
#> GSM1124948     3  0.2176      0.523 0.020 0.032 0.948
#> GSM1124949     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124950     2  0.9058      0.668 0.180 0.544 0.276
#> GSM1124954     3  0.5465      0.718 0.288 0.000 0.712
#> GSM1124955     1  0.0000      0.673 1.000 0.000 0.000
#> GSM1124956     2  0.8770      0.679 0.180 0.584 0.236
#> GSM1124872     2  0.9058      0.668 0.180 0.544 0.276
#> GSM1124873     2  0.8981      0.675 0.180 0.556 0.264
#> GSM1124876     3  0.5397      0.725 0.280 0.000 0.720
#> GSM1124877     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124879     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124883     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124889     2  0.8727      0.682 0.176 0.588 0.236
#> GSM1124892     1  0.4291      0.660 0.820 0.000 0.180
#> GSM1124893     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124909     2  0.9168      0.662 0.184 0.528 0.288
#> GSM1124913     2  0.0000      0.769 0.000 1.000 0.000
#> GSM1124916     2  0.9168      0.662 0.184 0.528 0.288
#> GSM1124923     2  0.2165      0.748 0.000 0.936 0.064
#> GSM1124925     1  0.0000      0.673 1.000 0.000 0.000
#> GSM1124929     1  0.3879      0.704 0.848 0.000 0.152
#> GSM1124934     3  0.5650      0.695 0.312 0.000 0.688
#> GSM1124937     1  0.6969      0.503 0.596 0.024 0.380

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.2466      0.873 0.096 0.004 0.900 0.000
#> GSM1124888     3  0.2466      0.873 0.096 0.004 0.900 0.000
#> GSM1124890     3  0.6041      0.674 0.008 0.076 0.680 0.236
#> GSM1124904     4  0.2334      0.903 0.000 0.088 0.004 0.908
#> GSM1124927     2  0.2505      0.855 0.004 0.920 0.036 0.040
#> GSM1124953     4  0.4072      0.770 0.000 0.052 0.120 0.828
#> GSM1124869     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124870     2  0.5577      0.538 0.328 0.636 0.036 0.000
#> GSM1124882     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.1792      0.850 0.000 0.932 0.000 0.068
#> GSM1124898     4  0.3196      0.880 0.000 0.136 0.008 0.856
#> GSM1124903     4  0.2714      0.899 0.000 0.112 0.004 0.884
#> GSM1124905     1  0.3674      0.821 0.848 0.116 0.036 0.000
#> GSM1124910     1  0.0657      0.966 0.984 0.004 0.012 0.000
#> GSM1124919     4  0.3009      0.832 0.000 0.056 0.052 0.892
#> GSM1124932     2  0.2499      0.856 0.004 0.920 0.032 0.044
#> GSM1124933     3  0.2021      0.871 0.056 0.000 0.932 0.012
#> GSM1124867     2  0.4098      0.815 0.044 0.856 0.040 0.060
#> GSM1124868     4  0.2859      0.898 0.000 0.112 0.008 0.880
#> GSM1124878     4  0.2859      0.898 0.000 0.112 0.008 0.880
#> GSM1124895     4  0.2988      0.898 0.000 0.112 0.012 0.876
#> GSM1124897     4  0.2799      0.900 0.000 0.108 0.008 0.884
#> GSM1124902     4  0.2730      0.903 0.000 0.088 0.016 0.896
#> GSM1124908     4  0.2125      0.902 0.000 0.076 0.004 0.920
#> GSM1124921     4  0.0927      0.881 0.000 0.016 0.008 0.976
#> GSM1124939     4  0.2676      0.903 0.000 0.092 0.012 0.896
#> GSM1124944     4  0.2060      0.861 0.000 0.052 0.016 0.932
#> GSM1124945     3  0.1722      0.853 0.008 0.000 0.944 0.048
#> GSM1124946     4  0.0927      0.881 0.000 0.016 0.008 0.976
#> GSM1124947     2  0.6061      0.284 0.000 0.552 0.048 0.400
#> GSM1124951     3  0.2342      0.847 0.008 0.000 0.912 0.080
#> GSM1124952     2  0.2759      0.853 0.000 0.904 0.044 0.052
#> GSM1124957     3  0.2255      0.873 0.068 0.000 0.920 0.012
#> GSM1124900     2  0.5742      0.460 0.368 0.596 0.036 0.000
#> GSM1124914     4  0.2081      0.903 0.000 0.084 0.000 0.916
#> GSM1124871     2  0.1940      0.846 0.000 0.924 0.000 0.076
#> GSM1124874     2  0.2473      0.847 0.000 0.908 0.012 0.080
#> GSM1124875     4  0.4375      0.759 0.000 0.180 0.032 0.788
#> GSM1124880     2  0.4857      0.721 0.176 0.772 0.048 0.004
#> GSM1124881     2  0.2053      0.839 0.000 0.924 0.004 0.072
#> GSM1124885     4  0.2859      0.898 0.000 0.112 0.008 0.880
#> GSM1124886     1  0.0188      0.974 0.996 0.000 0.004 0.000
#> GSM1124887     4  0.1209      0.887 0.000 0.032 0.004 0.964
#> GSM1124894     2  0.5657      0.663 0.220 0.716 0.048 0.016
#> GSM1124896     1  0.0469      0.968 0.988 0.012 0.000 0.000
#> GSM1124899     2  0.2473      0.849 0.000 0.908 0.012 0.080
#> GSM1124901     4  0.3105      0.887 0.000 0.140 0.004 0.856
#> GSM1124906     2  0.1398      0.856 0.004 0.956 0.000 0.040
#> GSM1124907     4  0.2363      0.852 0.000 0.056 0.024 0.920
#> GSM1124911     2  0.1792      0.850 0.000 0.932 0.000 0.068
#> GSM1124912     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124915     4  0.2921      0.888 0.000 0.140 0.000 0.860
#> GSM1124917     2  0.5573      0.323 0.000 0.604 0.028 0.368
#> GSM1124918     2  0.3787      0.787 0.000 0.840 0.036 0.124
#> GSM1124920     3  0.3539      0.826 0.176 0.004 0.820 0.000
#> GSM1124922     2  0.2587      0.852 0.004 0.908 0.012 0.076
#> GSM1124924     2  0.6441      0.610 0.084 0.668 0.228 0.020
#> GSM1124926     2  0.2216      0.839 0.000 0.908 0.000 0.092
#> GSM1124928     1  0.2596      0.888 0.908 0.068 0.024 0.000
#> GSM1124930     4  0.3301      0.824 0.000 0.076 0.048 0.876
#> GSM1124931     2  0.2505      0.854 0.004 0.920 0.036 0.040
#> GSM1124935     4  0.5220      0.316 0.000 0.424 0.008 0.568
#> GSM1124936     3  0.4088      0.768 0.232 0.004 0.764 0.000
#> GSM1124938     3  0.4807      0.781 0.008 0.088 0.800 0.104
#> GSM1124940     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.1305      0.856 0.004 0.960 0.000 0.036
#> GSM1124942     4  0.3542      0.824 0.000 0.076 0.060 0.864
#> GSM1124943     3  0.6158      0.653 0.008 0.076 0.664 0.252
#> GSM1124948     2  0.6396      0.568 0.008 0.652 0.244 0.096
#> GSM1124949     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.2007      0.851 0.004 0.940 0.036 0.020
#> GSM1124954     3  0.2737      0.870 0.104 0.008 0.888 0.000
#> GSM1124955     1  0.0469      0.968 0.988 0.012 0.000 0.000
#> GSM1124956     2  0.1792      0.850 0.000 0.932 0.000 0.068
#> GSM1124872     2  0.2007      0.851 0.004 0.940 0.036 0.020
#> GSM1124873     2  0.1118      0.856 0.000 0.964 0.000 0.036
#> GSM1124876     3  0.2741      0.872 0.096 0.000 0.892 0.012
#> GSM1124877     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124883     4  0.2466      0.903 0.000 0.096 0.004 0.900
#> GSM1124889     2  0.1792      0.850 0.000 0.932 0.000 0.068
#> GSM1124892     1  0.0524      0.969 0.988 0.004 0.008 0.000
#> GSM1124893     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.2365      0.840 0.004 0.920 0.012 0.064
#> GSM1124913     4  0.2714      0.899 0.000 0.112 0.004 0.884
#> GSM1124916     2  0.2365      0.840 0.004 0.920 0.012 0.064
#> GSM1124923     4  0.2844      0.829 0.000 0.052 0.048 0.900
#> GSM1124925     1  0.0469      0.968 0.988 0.012 0.000 0.000
#> GSM1124929     1  0.0000      0.976 1.000 0.000 0.000 0.000
#> GSM1124934     3  0.3450      0.840 0.156 0.008 0.836 0.000
#> GSM1124937     2  0.6069      0.451 0.352 0.600 0.040 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
#> GSM1124891     3  0.1399     0.9004 0.020 0.000 0.952 0.028 0.000
#> GSM1124888     3  0.0771     0.9020 0.020 0.000 0.976 0.004 0.000
#> GSM1124890     5  0.5556    -0.0617 0.000 0.048 0.388 0.012 0.552
#> GSM1124904     5  0.4747    -0.8237 0.000 0.016 0.000 0.488 0.496
#> GSM1124927     2  0.3578     0.7530 0.000 0.784 0.008 0.204 0.004
#> GSM1124953     5  0.5270     0.2773 0.000 0.008 0.104 0.196 0.692
#> GSM1124869     1  0.0000     0.9386 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.6138     0.6101 0.188 0.596 0.008 0.208 0.000
#> GSM1124882     1  0.0162     0.9383 0.996 0.000 0.000 0.004 0.000
#> GSM1124884     2  0.0880     0.7852 0.000 0.968 0.000 0.032 0.000
#> GSM1124898     5  0.6637    -0.1722 0.000 0.268 0.000 0.280 0.452
#> GSM1124903     4  0.4747     0.8088 0.000 0.016 0.000 0.496 0.488
#> GSM1124905     1  0.6575     0.4503 0.516 0.116 0.028 0.340 0.000
#> GSM1124910     1  0.1478     0.9045 0.936 0.000 0.000 0.064 0.000
#> GSM1124919     5  0.2943     0.2848 0.000 0.036 0.040 0.036 0.888
#> GSM1124932     2  0.2563     0.7781 0.000 0.872 0.008 0.120 0.000
#> GSM1124933     3  0.0833     0.8960 0.004 0.000 0.976 0.016 0.004
#> GSM1124867     2  0.5703     0.6998 0.008 0.676 0.008 0.160 0.148
#> GSM1124868     4  0.4731     0.8721 0.000 0.016 0.000 0.528 0.456
#> GSM1124878     4  0.4718     0.8474 0.000 0.016 0.000 0.540 0.444
#> GSM1124895     4  0.4723     0.8603 0.000 0.016 0.000 0.536 0.448
#> GSM1124897     4  0.4731     0.8721 0.000 0.016 0.000 0.528 0.456
#> GSM1124902     4  0.4718     0.8535 0.000 0.016 0.000 0.540 0.444
#> GSM1124908     5  0.4747    -0.8358 0.000 0.016 0.000 0.484 0.500
#> GSM1124921     5  0.4555    -0.7860 0.000 0.008 0.000 0.472 0.520
#> GSM1124939     4  0.4735     0.8547 0.000 0.016 0.000 0.524 0.460
#> GSM1124944     5  0.3999    -0.4218 0.000 0.000 0.000 0.344 0.656
#> GSM1124945     3  0.3060     0.8153 0.000 0.000 0.848 0.024 0.128
#> GSM1124946     5  0.4552    -0.7818 0.000 0.008 0.000 0.468 0.524
#> GSM1124947     2  0.6806     0.3339 0.000 0.432 0.004 0.312 0.252
#> GSM1124951     3  0.3445     0.7956 0.000 0.000 0.824 0.036 0.140
#> GSM1124952     2  0.3461     0.7503 0.000 0.772 0.004 0.224 0.000
#> GSM1124957     3  0.0833     0.8960 0.004 0.000 0.976 0.016 0.004
#> GSM1124900     2  0.6221     0.5898 0.204 0.584 0.008 0.204 0.000
#> GSM1124914     5  0.4827    -0.8342 0.000 0.020 0.000 0.476 0.504
#> GSM1124871     2  0.1408     0.7765 0.000 0.948 0.000 0.044 0.008
#> GSM1124874     2  0.2612     0.7703 0.000 0.868 0.000 0.124 0.008
#> GSM1124875     5  0.4025     0.3130 0.000 0.232 0.008 0.012 0.748
#> GSM1124880     2  0.6684     0.6608 0.084 0.608 0.008 0.228 0.072
#> GSM1124881     2  0.2629     0.7327 0.000 0.860 0.000 0.004 0.136
#> GSM1124885     4  0.4738     0.8708 0.000 0.016 0.000 0.520 0.464
#> GSM1124886     1  0.0794     0.9277 0.972 0.000 0.000 0.028 0.000
#> GSM1124887     5  0.4560    -0.8091 0.000 0.008 0.000 0.484 0.508
#> GSM1124894     2  0.6173     0.5689 0.060 0.528 0.036 0.376 0.000
#> GSM1124896     1  0.0609     0.9348 0.980 0.000 0.000 0.020 0.000
#> GSM1124899     2  0.1774     0.7728 0.000 0.932 0.000 0.016 0.052
#> GSM1124901     4  0.6099     0.6616 0.000 0.124 0.000 0.452 0.424
#> GSM1124906     2  0.0865     0.7865 0.000 0.972 0.000 0.024 0.004
#> GSM1124907     5  0.2017     0.1715 0.000 0.000 0.008 0.080 0.912
#> GSM1124911     2  0.1082     0.7808 0.000 0.964 0.000 0.028 0.008
#> GSM1124912     1  0.0000     0.9386 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     4  0.5867     0.7413 0.000 0.100 0.000 0.496 0.404
#> GSM1124917     5  0.4559    -0.2042 0.000 0.480 0.000 0.008 0.512
#> GSM1124918     2  0.4967     0.3282 0.000 0.540 0.008 0.016 0.436
#> GSM1124920     3  0.3437     0.8507 0.120 0.000 0.832 0.048 0.000
#> GSM1124922     2  0.2304     0.7765 0.000 0.908 0.000 0.044 0.048
#> GSM1124924     2  0.7862     0.4342 0.008 0.420 0.060 0.224 0.288
#> GSM1124926     2  0.3002     0.7405 0.000 0.856 0.000 0.116 0.028
#> GSM1124928     1  0.4923     0.6543 0.700 0.088 0.000 0.212 0.000
#> GSM1124930     5  0.3340     0.3316 0.000 0.076 0.048 0.016 0.860
#> GSM1124931     2  0.3318     0.7609 0.000 0.800 0.008 0.192 0.000
#> GSM1124935     2  0.6410     0.0274 0.000 0.488 0.000 0.192 0.320
#> GSM1124936     3  0.3988     0.7744 0.196 0.000 0.768 0.036 0.000
#> GSM1124938     5  0.5886    -0.2190 0.000 0.048 0.448 0.024 0.480
#> GSM1124940     1  0.0162     0.9383 0.996 0.000 0.000 0.004 0.000
#> GSM1124941     2  0.0865     0.7865 0.000 0.972 0.000 0.024 0.004
#> GSM1124942     5  0.3003     0.3197 0.000 0.064 0.040 0.016 0.880
#> GSM1124943     5  0.5506    -0.0146 0.000 0.048 0.368 0.012 0.572
#> GSM1124948     5  0.7581    -0.1286 0.000 0.296 0.080 0.168 0.456
#> GSM1124949     1  0.0290     0.9369 0.992 0.000 0.000 0.008 0.000
#> GSM1124950     2  0.3124     0.7684 0.000 0.840 0.008 0.144 0.008
#> GSM1124954     3  0.2504     0.8897 0.040 0.000 0.896 0.064 0.000
#> GSM1124955     1  0.0609     0.9348 0.980 0.000 0.000 0.020 0.000
#> GSM1124956     2  0.0992     0.7818 0.000 0.968 0.000 0.024 0.008
#> GSM1124872     2  0.3210     0.7665 0.000 0.832 0.008 0.152 0.008
#> GSM1124873     2  0.0566     0.7836 0.000 0.984 0.000 0.004 0.012
#> GSM1124876     3  0.1117     0.9003 0.020 0.000 0.964 0.016 0.000
#> GSM1124877     1  0.0404     0.9369 0.988 0.000 0.000 0.012 0.000
#> GSM1124879     1  0.0510     0.9371 0.984 0.000 0.000 0.016 0.000
#> GSM1124883     5  0.4743    -0.8293 0.000 0.016 0.000 0.472 0.512
#> GSM1124889     2  0.0771     0.7819 0.000 0.976 0.000 0.020 0.004
#> GSM1124892     1  0.0794     0.9277 0.972 0.000 0.000 0.028 0.000
#> GSM1124893     1  0.0000     0.9386 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.4019     0.7207 0.000 0.792 0.004 0.052 0.152
#> GSM1124913     4  0.4747     0.8088 0.000 0.016 0.000 0.496 0.488
#> GSM1124916     2  0.4019     0.7207 0.000 0.792 0.004 0.052 0.152
#> GSM1124923     5  0.3037     0.1918 0.000 0.000 0.040 0.100 0.860
#> GSM1124925     1  0.0609     0.9348 0.980 0.000 0.000 0.020 0.000
#> GSM1124929     1  0.0000     0.9386 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.3476     0.8665 0.076 0.000 0.836 0.088 0.000
#> GSM1124937     2  0.8296     0.4570 0.140 0.464 0.020 0.164 0.212

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.1382     0.8485 0.008 0.000 0.948 0.000 0.036 0.008
#> GSM1124888     3  0.1124     0.8496 0.008 0.000 0.956 0.000 0.036 0.000
#> GSM1124890     5  0.3667     0.7105 0.000 0.028 0.088 0.004 0.824 0.056
#> GSM1124904     4  0.1844     0.7902 0.000 0.004 0.000 0.924 0.048 0.024
#> GSM1124927     2  0.3807     0.2866 0.000 0.628 0.000 0.000 0.004 0.368
#> GSM1124953     5  0.5683     0.6030 0.000 0.004 0.044 0.124 0.640 0.188
#> GSM1124869     1  0.0000     0.9390 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.5449    -0.0401 0.108 0.500 0.000 0.000 0.004 0.388
#> GSM1124882     1  0.0146     0.9390 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124884     2  0.1396     0.6415 0.000 0.952 0.008 0.012 0.004 0.024
#> GSM1124898     4  0.6368     0.2094 0.000 0.352 0.000 0.436 0.184 0.028
#> GSM1124903     4  0.1777     0.7902 0.000 0.004 0.000 0.928 0.044 0.024
#> GSM1124905     6  0.5719     0.2401 0.328 0.080 0.016 0.000 0.016 0.560
#> GSM1124910     1  0.2196     0.8822 0.908 0.000 0.016 0.000 0.020 0.056
#> GSM1124919     5  0.3949     0.7154 0.000 0.012 0.000 0.136 0.780 0.072
#> GSM1124932     2  0.2655     0.5850 0.000 0.848 0.008 0.004 0.000 0.140
#> GSM1124933     3  0.1686     0.8421 0.004 0.000 0.932 0.004 0.008 0.052
#> GSM1124867     2  0.5745    -0.1636 0.000 0.460 0.004 0.000 0.148 0.388
#> GSM1124868     4  0.2913     0.7820 0.000 0.012 0.000 0.860 0.036 0.092
#> GSM1124878     4  0.1707     0.7924 0.000 0.004 0.000 0.928 0.012 0.056
#> GSM1124895     4  0.4122     0.7689 0.000 0.008 0.000 0.752 0.068 0.172
#> GSM1124897     4  0.3113     0.7841 0.000 0.008 0.000 0.844 0.048 0.100
#> GSM1124902     4  0.4068     0.7717 0.000 0.004 0.000 0.756 0.080 0.160
#> GSM1124908     4  0.4043     0.7687 0.000 0.000 0.000 0.756 0.128 0.116
#> GSM1124921     4  0.4267     0.7480 0.000 0.000 0.000 0.732 0.152 0.116
#> GSM1124939     4  0.4662     0.7559 0.000 0.008 0.000 0.700 0.100 0.192
#> GSM1124944     4  0.5885     0.3389 0.000 0.000 0.000 0.444 0.348 0.208
#> GSM1124945     3  0.5024     0.5645 0.000 0.000 0.640 0.004 0.240 0.116
#> GSM1124946     4  0.4459     0.7436 0.000 0.000 0.000 0.712 0.156 0.132
#> GSM1124947     6  0.7160     0.2529 0.000 0.200 0.004 0.148 0.172 0.476
#> GSM1124951     3  0.5207     0.5451 0.000 0.000 0.628 0.012 0.252 0.108
#> GSM1124952     2  0.4320     0.3730 0.000 0.668 0.008 0.008 0.016 0.300
#> GSM1124957     3  0.1686     0.8421 0.004 0.000 0.932 0.004 0.008 0.052
#> GSM1124900     2  0.5548    -0.0510 0.108 0.496 0.000 0.000 0.008 0.388
#> GSM1124914     4  0.4050     0.7835 0.000 0.016 0.000 0.780 0.100 0.104
#> GSM1124871     2  0.1232     0.6389 0.000 0.956 0.000 0.024 0.004 0.016
#> GSM1124874     2  0.3242     0.5967 0.000 0.844 0.000 0.040 0.024 0.092
#> GSM1124875     5  0.4243     0.6991 0.000 0.112 0.000 0.072 0.776 0.040
#> GSM1124880     6  0.6075     0.2152 0.036 0.388 0.000 0.000 0.112 0.464
#> GSM1124881     2  0.3453     0.5053 0.000 0.808 0.000 0.008 0.144 0.040
#> GSM1124885     4  0.2604     0.7822 0.000 0.004 0.000 0.872 0.028 0.096
#> GSM1124886     1  0.1003     0.9255 0.964 0.000 0.020 0.000 0.000 0.016
#> GSM1124887     4  0.2771     0.7753 0.000 0.000 0.000 0.852 0.116 0.032
#> GSM1124894     6  0.6172     0.1753 0.056 0.372 0.024 0.016 0.020 0.512
#> GSM1124896     1  0.0820     0.9345 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM1124899     2  0.2818     0.5878 0.000 0.872 0.000 0.024 0.076 0.028
#> GSM1124901     4  0.4425     0.6808 0.000 0.136 0.000 0.744 0.104 0.016
#> GSM1124906     2  0.1268     0.6386 0.000 0.952 0.008 0.000 0.004 0.036
#> GSM1124907     5  0.3741     0.6605 0.000 0.004 0.000 0.208 0.756 0.032
#> GSM1124911     2  0.1377     0.6384 0.000 0.952 0.004 0.024 0.004 0.016
#> GSM1124912     1  0.0000     0.9390 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     4  0.3787     0.7465 0.000 0.100 0.000 0.808 0.028 0.064
#> GSM1124917     5  0.5323     0.3658 0.000 0.344 0.000 0.024 0.568 0.064
#> GSM1124918     5  0.4499     0.4562 0.000 0.288 0.000 0.000 0.652 0.060
#> GSM1124920     3  0.3149     0.8106 0.084 0.000 0.852 0.000 0.036 0.028
#> GSM1124922     2  0.3264     0.5816 0.000 0.844 0.000 0.020 0.080 0.056
#> GSM1124924     6  0.6378     0.3908 0.000 0.260 0.016 0.000 0.304 0.420
#> GSM1124926     2  0.3430     0.5552 0.000 0.836 0.000 0.076 0.028 0.060
#> GSM1124928     1  0.5429    -0.0693 0.492 0.060 0.008 0.000 0.012 0.428
#> GSM1124930     5  0.2456     0.7418 0.000 0.028 0.000 0.076 0.888 0.008
#> GSM1124931     2  0.3772     0.4094 0.000 0.692 0.008 0.004 0.000 0.296
#> GSM1124935     2  0.6274     0.1222 0.000 0.516 0.000 0.264 0.184 0.036
#> GSM1124936     3  0.3509     0.7796 0.128 0.000 0.816 0.000 0.032 0.024
#> GSM1124938     5  0.3273     0.6846 0.000 0.024 0.136 0.000 0.824 0.016
#> GSM1124940     1  0.0146     0.9390 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124941     2  0.1268     0.6386 0.000 0.952 0.008 0.000 0.004 0.036
#> GSM1124942     5  0.3114     0.7392 0.000 0.024 0.004 0.108 0.848 0.016
#> GSM1124943     5  0.2779     0.7151 0.000 0.024 0.088 0.004 0.872 0.012
#> GSM1124948     5  0.4355     0.5408 0.000 0.076 0.012 0.000 0.736 0.176
#> GSM1124949     1  0.0363     0.9357 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1124950     2  0.3844     0.3719 0.000 0.676 0.004 0.000 0.008 0.312
#> GSM1124954     3  0.2384     0.8389 0.008 0.000 0.896 0.000 0.056 0.040
#> GSM1124955     1  0.0820     0.9345 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM1124956     2  0.1377     0.6384 0.000 0.952 0.004 0.024 0.004 0.016
#> GSM1124872     2  0.3878     0.3494 0.000 0.668 0.004 0.000 0.008 0.320
#> GSM1124873     2  0.0622     0.6405 0.000 0.980 0.000 0.000 0.008 0.012
#> GSM1124876     3  0.1484     0.8452 0.008 0.000 0.944 0.004 0.004 0.040
#> GSM1124877     1  0.0725     0.9355 0.976 0.000 0.000 0.000 0.012 0.012
#> GSM1124879     1  0.1196     0.9250 0.952 0.000 0.000 0.000 0.008 0.040
#> GSM1124883     4  0.1924     0.7952 0.000 0.004 0.000 0.920 0.048 0.028
#> GSM1124889     2  0.1237     0.6411 0.000 0.956 0.000 0.020 0.004 0.020
#> GSM1124892     1  0.1624     0.9068 0.936 0.000 0.040 0.000 0.004 0.020
#> GSM1124893     1  0.0146     0.9390 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124909     2  0.5388     0.2277 0.000 0.604 0.004 0.000 0.196 0.196
#> GSM1124913     4  0.1844     0.7888 0.000 0.004 0.000 0.924 0.048 0.024
#> GSM1124916     2  0.5388     0.2277 0.000 0.604 0.004 0.000 0.196 0.196
#> GSM1124923     5  0.4381     0.6275 0.000 0.000 0.000 0.236 0.692 0.072
#> GSM1124925     1  0.0820     0.9345 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM1124929     1  0.0000     0.9390 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.4217     0.7685 0.036 0.000 0.772 0.000 0.060 0.132
#> GSM1124937     6  0.7144     0.3859 0.044 0.256 0.016 0.000 0.296 0.388

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

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.869           0.935       0.970         0.4936 0.508   0.508
#> 3 3 0.564           0.511       0.778         0.3263 0.762   0.565
#> 4 4 0.853           0.856       0.931         0.1451 0.779   0.458
#> 5 5 0.698           0.612       0.791         0.0610 0.977   0.909
#> 6 6 0.683           0.537       0.753         0.0395 0.915   0.652

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
#> GSM1124891     1   0.000      0.968 1.000 0.000
#> GSM1124888     1   0.000      0.968 1.000 0.000
#> GSM1124890     1   0.706      0.790 0.808 0.192
#> GSM1124904     2   0.000      0.969 0.000 1.000
#> GSM1124927     2   0.722      0.760 0.200 0.800
#> GSM1124953     2   0.000      0.969 0.000 1.000
#> GSM1124869     1   0.000      0.968 1.000 0.000
#> GSM1124870     1   0.000      0.968 1.000 0.000
#> GSM1124882     1   0.000      0.968 1.000 0.000
#> GSM1124884     2   0.000      0.969 0.000 1.000
#> GSM1124898     2   0.000      0.969 0.000 1.000
#> GSM1124903     2   0.000      0.969 0.000 1.000
#> GSM1124905     1   0.000      0.968 1.000 0.000
#> GSM1124910     1   0.000      0.968 1.000 0.000
#> GSM1124919     2   0.000      0.969 0.000 1.000
#> GSM1124932     2   0.722      0.760 0.200 0.800
#> GSM1124933     1   0.000      0.968 1.000 0.000
#> GSM1124867     1   0.644      0.822 0.836 0.164
#> GSM1124868     2   0.000      0.969 0.000 1.000
#> GSM1124878     2   0.000      0.969 0.000 1.000
#> GSM1124895     2   0.000      0.969 0.000 1.000
#> GSM1124897     2   0.000      0.969 0.000 1.000
#> GSM1124902     2   0.000      0.969 0.000 1.000
#> GSM1124908     2   0.000      0.969 0.000 1.000
#> GSM1124921     2   0.000      0.969 0.000 1.000
#> GSM1124939     2   0.000      0.969 0.000 1.000
#> GSM1124944     2   0.000      0.969 0.000 1.000
#> GSM1124945     1   0.494      0.882 0.892 0.108
#> GSM1124946     2   0.000      0.969 0.000 1.000
#> GSM1124947     2   0.000      0.969 0.000 1.000
#> GSM1124951     1   0.722      0.779 0.800 0.200
#> GSM1124952     2   0.402      0.897 0.080 0.920
#> GSM1124957     1   0.000      0.968 1.000 0.000
#> GSM1124900     1   0.000      0.968 1.000 0.000
#> GSM1124914     2   0.000      0.969 0.000 1.000
#> GSM1124871     2   0.000      0.969 0.000 1.000
#> GSM1124874     2   0.000      0.969 0.000 1.000
#> GSM1124875     2   0.000      0.969 0.000 1.000
#> GSM1124880     1   0.000      0.968 1.000 0.000
#> GSM1124881     2   0.000      0.969 0.000 1.000
#> GSM1124885     2   0.000      0.969 0.000 1.000
#> GSM1124886     1   0.000      0.968 1.000 0.000
#> GSM1124887     2   0.000      0.969 0.000 1.000
#> GSM1124894     2   0.985      0.299 0.428 0.572
#> GSM1124896     1   0.000      0.968 1.000 0.000
#> GSM1124899     2   0.000      0.969 0.000 1.000
#> GSM1124901     2   0.000      0.969 0.000 1.000
#> GSM1124906     2   0.000      0.969 0.000 1.000
#> GSM1124907     2   0.000      0.969 0.000 1.000
#> GSM1124911     2   0.000      0.969 0.000 1.000
#> GSM1124912     1   0.000      0.968 1.000 0.000
#> GSM1124915     2   0.000      0.969 0.000 1.000
#> GSM1124917     2   0.000      0.969 0.000 1.000
#> GSM1124918     2   0.000      0.969 0.000 1.000
#> GSM1124920     1   0.000      0.968 1.000 0.000
#> GSM1124922     2   0.118      0.957 0.016 0.984
#> GSM1124924     1   0.000      0.968 1.000 0.000
#> GSM1124926     2   0.000      0.969 0.000 1.000
#> GSM1124928     1   0.000      0.968 1.000 0.000
#> GSM1124930     2   0.000      0.969 0.000 1.000
#> GSM1124931     2   0.722      0.760 0.200 0.800
#> GSM1124935     2   0.000      0.969 0.000 1.000
#> GSM1124936     1   0.000      0.968 1.000 0.000
#> GSM1124938     1   0.706      0.790 0.808 0.192
#> GSM1124940     1   0.000      0.968 1.000 0.000
#> GSM1124941     2   0.000      0.969 0.000 1.000
#> GSM1124942     2   0.000      0.969 0.000 1.000
#> GSM1124943     1   0.722      0.779 0.800 0.200
#> GSM1124948     1   0.402      0.906 0.920 0.080
#> GSM1124949     1   0.000      0.968 1.000 0.000
#> GSM1124950     2   0.118      0.957 0.016 0.984
#> GSM1124954     1   0.000      0.968 1.000 0.000
#> GSM1124955     1   0.000      0.968 1.000 0.000
#> GSM1124956     2   0.000      0.969 0.000 1.000
#> GSM1124872     2   0.163      0.950 0.024 0.976
#> GSM1124873     2   0.000      0.969 0.000 1.000
#> GSM1124876     1   0.000      0.968 1.000 0.000
#> GSM1124877     1   0.000      0.968 1.000 0.000
#> GSM1124879     1   0.000      0.968 1.000 0.000
#> GSM1124883     2   0.000      0.969 0.000 1.000
#> GSM1124889     2   0.000      0.969 0.000 1.000
#> GSM1124892     1   0.000      0.968 1.000 0.000
#> GSM1124893     1   0.000      0.968 1.000 0.000
#> GSM1124909     2   0.958      0.359 0.380 0.620
#> GSM1124913     2   0.000      0.969 0.000 1.000
#> GSM1124916     2   0.163      0.951 0.024 0.976
#> GSM1124923     2   0.000      0.969 0.000 1.000
#> GSM1124925     1   0.000      0.968 1.000 0.000
#> GSM1124929     1   0.000      0.968 1.000 0.000
#> GSM1124934     1   0.000      0.968 1.000 0.000
#> GSM1124937     1   0.000      0.968 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.6180     0.1806 0.416 0.000 0.584
#> GSM1124888     3  0.6180     0.1806 0.416 0.000 0.584
#> GSM1124890     3  0.4504     0.5078 0.196 0.000 0.804
#> GSM1124904     2  0.6180     0.5719 0.000 0.584 0.416
#> GSM1124927     2  0.6267    -0.2066 0.452 0.548 0.000
#> GSM1124953     3  0.0000     0.5607 0.000 0.000 1.000
#> GSM1124869     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124870     1  0.6154     0.4737 0.592 0.408 0.000
#> GSM1124882     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124884     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124898     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124903     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124905     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124910     1  0.0424     0.8221 0.992 0.000 0.008
#> GSM1124919     3  0.0424     0.5562 0.000 0.008 0.992
#> GSM1124932     2  0.1411     0.6297 0.036 0.964 0.000
#> GSM1124933     3  0.6168     0.1887 0.412 0.000 0.588
#> GSM1124867     1  0.6950     0.4681 0.572 0.408 0.020
#> GSM1124868     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124878     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124895     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124897     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124902     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124908     2  0.6180     0.5719 0.000 0.584 0.416
#> GSM1124921     3  0.6286    -0.3605 0.000 0.464 0.536
#> GSM1124939     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124944     3  0.2711     0.4760 0.000 0.088 0.912
#> GSM1124945     3  0.4654     0.4974 0.208 0.000 0.792
#> GSM1124946     3  0.6280    -0.3520 0.000 0.460 0.540
#> GSM1124947     3  0.6483    -0.3391 0.004 0.452 0.544
#> GSM1124951     3  0.1753     0.5812 0.048 0.000 0.952
#> GSM1124952     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124957     3  0.6168     0.1887 0.412 0.000 0.588
#> GSM1124900     1  0.6008     0.5160 0.628 0.372 0.000
#> GSM1124914     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124871     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124874     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124875     3  0.6291    -0.3696 0.000 0.468 0.532
#> GSM1124880     1  0.4452     0.6833 0.808 0.192 0.000
#> GSM1124881     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124885     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124886     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124887     2  0.6192     0.5658 0.000 0.580 0.420
#> GSM1124894     1  0.4974     0.6301 0.764 0.236 0.000
#> GSM1124896     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124899     2  0.0892     0.6570 0.000 0.980 0.020
#> GSM1124901     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124906     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124907     3  0.6225    -0.2938 0.000 0.432 0.568
#> GSM1124911     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124912     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124915     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124917     2  0.6180     0.5719 0.000 0.584 0.416
#> GSM1124918     2  0.6280     0.0148 0.000 0.540 0.460
#> GSM1124920     1  0.6215     0.1972 0.572 0.000 0.428
#> GSM1124922     2  0.4527     0.6273 0.052 0.860 0.088
#> GSM1124924     3  0.9550     0.0128 0.340 0.204 0.456
#> GSM1124926     2  0.0892     0.6570 0.000 0.980 0.020
#> GSM1124928     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124930     3  0.0000     0.5607 0.000 0.000 1.000
#> GSM1124931     2  0.1163     0.6390 0.028 0.972 0.000
#> GSM1124935     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124936     1  0.6168     0.2360 0.588 0.000 0.412
#> GSM1124938     3  0.4702     0.4932 0.212 0.000 0.788
#> GSM1124940     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124941     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124942     3  0.4121     0.3506 0.000 0.168 0.832
#> GSM1124943     3  0.2066     0.5844 0.060 0.000 0.940
#> GSM1124948     3  0.8767     0.2769 0.208 0.204 0.588
#> GSM1124949     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124950     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124954     1  0.6267     0.1347 0.548 0.000 0.452
#> GSM1124955     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124956     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124872     2  0.0237     0.6547 0.004 0.996 0.000
#> GSM1124873     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124876     3  0.6180     0.1806 0.416 0.000 0.584
#> GSM1124877     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124879     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124883     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124889     2  0.0000     0.6575 0.000 1.000 0.000
#> GSM1124892     1  0.0237     0.8248 0.996 0.000 0.004
#> GSM1124893     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124909     2  0.6737    -0.0457 0.384 0.600 0.016
#> GSM1124913     2  0.6168     0.5771 0.000 0.588 0.412
#> GSM1124916     2  0.5698     0.3330 0.252 0.736 0.012
#> GSM1124923     3  0.0424     0.5562 0.000 0.008 0.992
#> GSM1124925     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124929     1  0.0000     0.8274 1.000 0.000 0.000
#> GSM1124934     1  0.5591     0.4571 0.696 0.000 0.304
#> GSM1124937     1  0.5435     0.6714 0.784 0.192 0.024

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.1637    0.86522 0.060 0.000 0.940 0.000
#> GSM1124888     3  0.1637    0.86522 0.060 0.000 0.940 0.000
#> GSM1124890     3  0.0469    0.87067 0.000 0.000 0.988 0.012
#> GSM1124904     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124927     2  0.0336    0.91480 0.000 0.992 0.008 0.000
#> GSM1124953     3  0.4994   -0.00182 0.000 0.000 0.520 0.480
#> GSM1124869     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.3196    0.82240 0.856 0.136 0.008 0.000
#> GSM1124882     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000    0.91604 0.000 1.000 0.000 0.000
#> GSM1124898     4  0.1867    0.88462 0.000 0.072 0.000 0.928
#> GSM1124903     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124905     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124910     1  0.1389    0.92015 0.952 0.000 0.048 0.000
#> GSM1124919     4  0.3356    0.77891 0.000 0.000 0.176 0.824
#> GSM1124932     2  0.0336    0.91480 0.000 0.992 0.008 0.000
#> GSM1124933     3  0.0707    0.87252 0.020 0.000 0.980 0.000
#> GSM1124867     2  0.3071    0.84367 0.068 0.888 0.044 0.000
#> GSM1124868     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124878     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124895     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124897     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124902     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124921     4  0.0336    0.93468 0.000 0.000 0.008 0.992
#> GSM1124939     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124944     4  0.0336    0.93484 0.000 0.000 0.008 0.992
#> GSM1124945     3  0.0469    0.87123 0.000 0.000 0.988 0.012
#> GSM1124946     4  0.0336    0.93468 0.000 0.000 0.008 0.992
#> GSM1124947     4  0.0927    0.92870 0.000 0.016 0.008 0.976
#> GSM1124951     3  0.0592    0.87055 0.000 0.000 0.984 0.016
#> GSM1124952     2  0.2926    0.85037 0.004 0.888 0.012 0.096
#> GSM1124957     3  0.0707    0.87252 0.020 0.000 0.980 0.000
#> GSM1124900     1  0.1722    0.91591 0.944 0.048 0.008 0.000
#> GSM1124914     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124871     2  0.0817    0.90931 0.000 0.976 0.000 0.024
#> GSM1124874     2  0.2888    0.83785 0.000 0.872 0.004 0.124
#> GSM1124875     4  0.1489    0.91396 0.000 0.004 0.044 0.952
#> GSM1124880     1  0.2596    0.89191 0.908 0.068 0.024 0.000
#> GSM1124881     2  0.0336    0.91574 0.000 0.992 0.000 0.008
#> GSM1124885     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124886     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124887     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124894     1  0.1209    0.93546 0.964 0.032 0.004 0.000
#> GSM1124896     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124899     2  0.4155    0.69633 0.000 0.756 0.004 0.240
#> GSM1124901     4  0.0524    0.93247 0.000 0.008 0.004 0.988
#> GSM1124906     2  0.0000    0.91604 0.000 1.000 0.000 0.000
#> GSM1124907     4  0.1118    0.92078 0.000 0.000 0.036 0.964
#> GSM1124911     2  0.0469    0.91434 0.000 0.988 0.000 0.012
#> GSM1124912     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124915     4  0.0592    0.92937 0.000 0.016 0.000 0.984
#> GSM1124917     4  0.5955    0.45888 0.000 0.328 0.056 0.616
#> GSM1124918     2  0.2999    0.81891 0.000 0.864 0.132 0.004
#> GSM1124920     3  0.3649    0.75964 0.204 0.000 0.796 0.000
#> GSM1124922     2  0.7940    0.10698 0.172 0.412 0.016 0.400
#> GSM1124924     3  0.2670    0.83787 0.024 0.072 0.904 0.000
#> GSM1124926     2  0.4585    0.54584 0.000 0.668 0.000 0.332
#> GSM1124928     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124930     3  0.4643    0.45184 0.000 0.000 0.656 0.344
#> GSM1124931     2  0.0779    0.91103 0.004 0.980 0.016 0.000
#> GSM1124935     4  0.4920    0.37583 0.000 0.368 0.004 0.628
#> GSM1124936     3  0.4072    0.70212 0.252 0.000 0.748 0.000
#> GSM1124938     3  0.0336    0.87100 0.000 0.000 0.992 0.008
#> GSM1124940     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000    0.91604 0.000 1.000 0.000 0.000
#> GSM1124942     4  0.4103    0.68009 0.000 0.000 0.256 0.744
#> GSM1124943     3  0.0921    0.86507 0.000 0.000 0.972 0.028
#> GSM1124948     3  0.0000    0.87004 0.000 0.000 1.000 0.000
#> GSM1124949     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0336    0.91480 0.000 0.992 0.008 0.000
#> GSM1124954     3  0.3311    0.79039 0.172 0.000 0.828 0.000
#> GSM1124955     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.0188    0.91591 0.000 0.996 0.000 0.004
#> GSM1124872     2  0.0336    0.91480 0.000 0.992 0.008 0.000
#> GSM1124873     2  0.0000    0.91604 0.000 1.000 0.000 0.000
#> GSM1124876     3  0.1637    0.86522 0.060 0.000 0.940 0.000
#> GSM1124877     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124883     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124889     2  0.0469    0.91434 0.000 0.988 0.000 0.012
#> GSM1124892     1  0.0469    0.95175 0.988 0.000 0.012 0.000
#> GSM1124893     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0188    0.91582 0.000 0.996 0.004 0.000
#> GSM1124913     4  0.0000    0.93755 0.000 0.000 0.000 1.000
#> GSM1124916     2  0.0188    0.91582 0.000 0.996 0.004 0.000
#> GSM1124923     4  0.3311    0.78960 0.000 0.000 0.172 0.828
#> GSM1124925     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000    0.95953 1.000 0.000 0.000 0.000
#> GSM1124934     3  0.3942    0.72014 0.236 0.000 0.764 0.000
#> GSM1124937     1  0.6351    0.36528 0.588 0.080 0.332 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
#> GSM1124891     3  0.1270     0.7281 0.052 0.000 0.948 0.000 0.000
#> GSM1124888     3  0.1197     0.7294 0.048 0.000 0.952 0.000 0.000
#> GSM1124890     3  0.3109     0.6355 0.000 0.000 0.800 0.200 0.000
#> GSM1124904     5  0.0510     0.7838 0.000 0.000 0.000 0.016 0.984
#> GSM1124927     2  0.3816     0.5950 0.000 0.696 0.000 0.304 0.000
#> GSM1124953     3  0.6746    -0.1510 0.000 0.000 0.392 0.344 0.264
#> GSM1124869     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.5116     0.5608 0.668 0.084 0.000 0.248 0.000
#> GSM1124882     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.1408     0.6807 0.000 0.948 0.000 0.044 0.008
#> GSM1124898     5  0.4637     0.5667 0.000 0.160 0.000 0.100 0.740
#> GSM1124903     5  0.0451     0.7846 0.000 0.008 0.000 0.004 0.988
#> GSM1124905     1  0.1195     0.8768 0.960 0.000 0.012 0.028 0.000
#> GSM1124910     1  0.3143     0.6988 0.796 0.000 0.204 0.000 0.000
#> GSM1124919     5  0.6268     0.1968 0.000 0.000 0.156 0.360 0.484
#> GSM1124932     2  0.2891     0.6492 0.000 0.824 0.000 0.176 0.000
#> GSM1124933     3  0.0162     0.7249 0.004 0.000 0.996 0.000 0.000
#> GSM1124867     2  0.6264     0.3143 0.052 0.472 0.044 0.432 0.000
#> GSM1124868     5  0.1444     0.7806 0.000 0.012 0.000 0.040 0.948
#> GSM1124878     5  0.0807     0.7845 0.000 0.012 0.000 0.012 0.976
#> GSM1124895     5  0.1830     0.7762 0.000 0.008 0.000 0.068 0.924
#> GSM1124897     5  0.1205     0.7845 0.000 0.004 0.000 0.040 0.956
#> GSM1124902     5  0.1732     0.7783 0.000 0.000 0.000 0.080 0.920
#> GSM1124908     5  0.1792     0.7795 0.000 0.000 0.000 0.084 0.916
#> GSM1124921     5  0.2377     0.7543 0.000 0.000 0.000 0.128 0.872
#> GSM1124939     5  0.1956     0.7759 0.000 0.008 0.000 0.076 0.916
#> GSM1124944     5  0.3430     0.7114 0.000 0.000 0.004 0.220 0.776
#> GSM1124945     3  0.2074     0.6973 0.000 0.000 0.896 0.104 0.000
#> GSM1124946     5  0.2389     0.7495 0.000 0.000 0.004 0.116 0.880
#> GSM1124947     5  0.4350     0.6261 0.000 0.028 0.000 0.268 0.704
#> GSM1124951     3  0.3300     0.6238 0.000 0.000 0.792 0.204 0.004
#> GSM1124952     2  0.5775     0.4832 0.000 0.608 0.000 0.244 0.148
#> GSM1124957     3  0.0566     0.7247 0.004 0.000 0.984 0.012 0.000
#> GSM1124900     1  0.4096     0.6826 0.760 0.040 0.000 0.200 0.000
#> GSM1124914     5  0.1331     0.7856 0.000 0.008 0.000 0.040 0.952
#> GSM1124871     2  0.3578     0.6082 0.000 0.820 0.000 0.048 0.132
#> GSM1124874     2  0.5766     0.4719 0.000 0.616 0.000 0.164 0.220
#> GSM1124875     5  0.5916     0.1735 0.000 0.020 0.056 0.440 0.484
#> GSM1124880     1  0.7204     0.1528 0.452 0.068 0.116 0.364 0.000
#> GSM1124881     2  0.4192     0.5754 0.000 0.736 0.000 0.232 0.032
#> GSM1124885     5  0.0992     0.7846 0.000 0.008 0.000 0.024 0.968
#> GSM1124886     1  0.0880     0.8749 0.968 0.000 0.032 0.000 0.000
#> GSM1124887     5  0.1792     0.7642 0.000 0.000 0.000 0.084 0.916
#> GSM1124894     1  0.7189     0.4279 0.584 0.176 0.044 0.168 0.028
#> GSM1124896     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124899     2  0.5516     0.3984 0.000 0.640 0.000 0.128 0.232
#> GSM1124901     5  0.2653     0.7207 0.000 0.096 0.000 0.024 0.880
#> GSM1124906     2  0.1043     0.6789 0.000 0.960 0.000 0.040 0.000
#> GSM1124907     5  0.4789     0.3945 0.000 0.000 0.024 0.392 0.584
#> GSM1124911     2  0.1399     0.6721 0.000 0.952 0.000 0.028 0.020
#> GSM1124912     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.2753     0.6932 0.000 0.136 0.000 0.008 0.856
#> GSM1124917     4  0.7403     0.1516 0.000 0.292 0.032 0.400 0.276
#> GSM1124918     4  0.5984     0.0706 0.000 0.376 0.068 0.536 0.020
#> GSM1124920     3  0.2966     0.6455 0.184 0.000 0.816 0.000 0.000
#> GSM1124922     2  0.8049     0.1126 0.156 0.404 0.000 0.144 0.296
#> GSM1124924     3  0.4948     0.3494 0.008 0.024 0.612 0.356 0.000
#> GSM1124926     2  0.5723     0.2216 0.000 0.520 0.000 0.088 0.392
#> GSM1124928     1  0.1216     0.8767 0.960 0.000 0.020 0.020 0.000
#> GSM1124930     4  0.6485    -0.0492 0.000 0.000 0.344 0.460 0.196
#> GSM1124931     2  0.4065     0.6042 0.000 0.720 0.016 0.264 0.000
#> GSM1124935     5  0.5912     0.1496 0.000 0.348 0.000 0.116 0.536
#> GSM1124936     3  0.3305     0.6049 0.224 0.000 0.776 0.000 0.000
#> GSM1124938     3  0.3039     0.6517 0.000 0.000 0.808 0.192 0.000
#> GSM1124940     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.1043     0.6789 0.000 0.960 0.000 0.040 0.000
#> GSM1124942     5  0.6465     0.0421 0.000 0.004 0.156 0.416 0.424
#> GSM1124943     3  0.4206     0.5359 0.000 0.000 0.696 0.288 0.016
#> GSM1124948     3  0.4084     0.4952 0.000 0.004 0.668 0.328 0.000
#> GSM1124949     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.3752     0.6036 0.000 0.708 0.000 0.292 0.000
#> GSM1124954     3  0.2424     0.6856 0.132 0.000 0.868 0.000 0.000
#> GSM1124955     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.1300     0.6727 0.000 0.956 0.000 0.028 0.016
#> GSM1124872     2  0.3857     0.5914 0.000 0.688 0.000 0.312 0.000
#> GSM1124873     2  0.2130     0.6647 0.000 0.908 0.000 0.080 0.012
#> GSM1124876     3  0.1197     0.7289 0.048 0.000 0.952 0.000 0.000
#> GSM1124877     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.0451     0.7839 0.000 0.008 0.000 0.004 0.988
#> GSM1124889     2  0.1907     0.6742 0.000 0.928 0.000 0.044 0.028
#> GSM1124892     1  0.2471     0.7831 0.864 0.000 0.136 0.000 0.000
#> GSM1124893     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.4030     0.4732 0.000 0.648 0.000 0.352 0.000
#> GSM1124913     5  0.0451     0.7846 0.000 0.008 0.000 0.004 0.988
#> GSM1124916     2  0.3999     0.4749 0.000 0.656 0.000 0.344 0.000
#> GSM1124923     5  0.6157     0.2131 0.000 0.000 0.140 0.364 0.496
#> GSM1124925     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.8916 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.3093     0.6557 0.168 0.000 0.824 0.008 0.000
#> GSM1124937     4  0.7919     0.0152 0.308 0.072 0.276 0.344 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
#> GSM1124891     3  0.0935    0.77447 0.032 0.000 0.964 0.000 0.000 0.004
#> GSM1124888     3  0.0858    0.77589 0.028 0.000 0.968 0.000 0.004 0.000
#> GSM1124890     3  0.4141    0.46501 0.000 0.000 0.676 0.008 0.296 0.020
#> GSM1124904     4  0.1524    0.73304 0.000 0.000 0.000 0.932 0.060 0.008
#> GSM1124927     6  0.4755   -0.13771 0.000 0.460 0.000 0.000 0.048 0.492
#> GSM1124953     5  0.6151    0.39753 0.000 0.000 0.340 0.124 0.496 0.040
#> GSM1124869     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.5961    0.15498 0.476 0.080 0.000 0.000 0.048 0.396
#> GSM1124882     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.2240    0.56552 0.000 0.904 0.000 0.008 0.032 0.056
#> GSM1124898     4  0.5716    0.48413 0.000 0.180 0.000 0.640 0.072 0.108
#> GSM1124903     4  0.1082    0.73769 0.000 0.000 0.000 0.956 0.040 0.004
#> GSM1124905     1  0.3854    0.74514 0.808 0.000 0.044 0.000 0.056 0.092
#> GSM1124910     1  0.3626    0.54820 0.704 0.000 0.288 0.000 0.004 0.004
#> GSM1124919     5  0.6343    0.52524 0.000 0.008 0.108 0.296 0.532 0.056
#> GSM1124932     2  0.4170    0.42831 0.004 0.732 0.000 0.004 0.048 0.212
#> GSM1124933     3  0.0603    0.76744 0.004 0.000 0.980 0.000 0.016 0.000
#> GSM1124867     6  0.4522    0.43373 0.016 0.176 0.024 0.000 0.040 0.744
#> GSM1124868     4  0.2089    0.74042 0.000 0.020 0.000 0.916 0.044 0.020
#> GSM1124878     4  0.1480    0.74228 0.000 0.000 0.000 0.940 0.040 0.020
#> GSM1124895     4  0.3212    0.71799 0.000 0.012 0.000 0.840 0.100 0.048
#> GSM1124897     4  0.2592    0.73751 0.000 0.012 0.004 0.884 0.080 0.020
#> GSM1124902     4  0.3159    0.71603 0.000 0.004 0.000 0.836 0.108 0.052
#> GSM1124908     4  0.2494    0.72093 0.000 0.000 0.000 0.864 0.120 0.016
#> GSM1124921     4  0.3670    0.56612 0.000 0.000 0.000 0.736 0.240 0.024
#> GSM1124939     4  0.3419    0.71022 0.000 0.008 0.000 0.820 0.116 0.056
#> GSM1124944     4  0.5136    0.45314 0.000 0.004 0.004 0.584 0.332 0.076
#> GSM1124945     3  0.2358    0.70869 0.000 0.000 0.876 0.000 0.108 0.016
#> GSM1124946     4  0.3859    0.50154 0.000 0.000 0.000 0.692 0.288 0.020
#> GSM1124947     4  0.6702    0.33810 0.000 0.072 0.000 0.484 0.264 0.180
#> GSM1124951     3  0.3855    0.49241 0.000 0.000 0.704 0.004 0.276 0.016
#> GSM1124952     2  0.7026    0.25003 0.000 0.500 0.016 0.088 0.156 0.240
#> GSM1124957     3  0.0692    0.76667 0.004 0.000 0.976 0.000 0.020 0.000
#> GSM1124900     1  0.4972    0.38645 0.596 0.044 0.000 0.000 0.020 0.340
#> GSM1124914     4  0.1807    0.74030 0.000 0.000 0.000 0.920 0.060 0.020
#> GSM1124871     2  0.4862    0.48088 0.000 0.684 0.000 0.216 0.020 0.080
#> GSM1124874     2  0.6484    0.36973 0.000 0.492 0.000 0.256 0.044 0.208
#> GSM1124875     5  0.5590    0.53891 0.000 0.028 0.016 0.252 0.628 0.076
#> GSM1124880     6  0.5853    0.39700 0.212 0.032 0.100 0.000 0.024 0.632
#> GSM1124881     2  0.5466    0.27218 0.000 0.588 0.004 0.036 0.056 0.316
#> GSM1124885     4  0.1889    0.74251 0.000 0.004 0.000 0.920 0.056 0.020
#> GSM1124886     1  0.1141    0.83015 0.948 0.000 0.052 0.000 0.000 0.000
#> GSM1124887     4  0.2968    0.65944 0.000 0.000 0.000 0.816 0.168 0.016
#> GSM1124894     1  0.8717   -0.12029 0.316 0.296 0.056 0.032 0.128 0.172
#> GSM1124896     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124899     2  0.6025    0.37363 0.000 0.564 0.000 0.268 0.116 0.052
#> GSM1124901     4  0.3565    0.65847 0.000 0.112 0.000 0.816 0.056 0.016
#> GSM1124906     2  0.1995    0.56735 0.000 0.912 0.000 0.000 0.036 0.052
#> GSM1124907     5  0.3983    0.48113 0.000 0.000 0.008 0.348 0.640 0.004
#> GSM1124911     2  0.2332    0.58226 0.000 0.904 0.000 0.036 0.020 0.040
#> GSM1124912     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     4  0.4235    0.58744 0.000 0.212 0.000 0.728 0.048 0.012
#> GSM1124917     6  0.8024   -0.12082 0.000 0.176 0.024 0.200 0.276 0.324
#> GSM1124918     5  0.6339    0.02684 0.000 0.160 0.020 0.012 0.496 0.312
#> GSM1124920     3  0.2879    0.69888 0.176 0.000 0.816 0.000 0.004 0.004
#> GSM1124922     4  0.8494   -0.12458 0.168 0.284 0.004 0.312 0.164 0.068
#> GSM1124924     6  0.5694   -0.00761 0.004 0.012 0.424 0.000 0.096 0.464
#> GSM1124926     2  0.5821    0.16842 0.000 0.492 0.000 0.392 0.072 0.044
#> GSM1124928     1  0.3587    0.73728 0.804 0.000 0.056 0.000 0.008 0.132
#> GSM1124930     5  0.5100    0.56662 0.000 0.000 0.168 0.084 0.696 0.052
#> GSM1124931     2  0.5096    0.25900 0.000 0.596 0.004 0.004 0.076 0.320
#> GSM1124935     4  0.6652    0.02204 0.000 0.332 0.000 0.444 0.060 0.164
#> GSM1124936     3  0.2933    0.67896 0.200 0.000 0.796 0.000 0.000 0.004
#> GSM1124938     3  0.3547    0.46492 0.000 0.000 0.668 0.000 0.332 0.000
#> GSM1124940     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.1995    0.56735 0.000 0.912 0.000 0.000 0.036 0.052
#> GSM1124942     5  0.4322    0.64947 0.000 0.000 0.076 0.184 0.732 0.008
#> GSM1124943     5  0.4312   -0.13361 0.000 0.000 0.476 0.004 0.508 0.012
#> GSM1124948     3  0.5787    0.19655 0.000 0.000 0.480 0.000 0.324 0.196
#> GSM1124949     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.4264   -0.00648 0.000 0.496 0.000 0.000 0.016 0.488
#> GSM1124954     3  0.2009    0.75668 0.084 0.000 0.904 0.000 0.008 0.004
#> GSM1124955     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.2171    0.58160 0.000 0.912 0.000 0.032 0.016 0.040
#> GSM1124872     6  0.4157   -0.03070 0.000 0.444 0.000 0.000 0.012 0.544
#> GSM1124873     2  0.3418    0.50576 0.000 0.784 0.000 0.016 0.008 0.192
#> GSM1124876     3  0.0993    0.77491 0.024 0.000 0.964 0.000 0.012 0.000
#> GSM1124877     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124883     4  0.1003    0.74009 0.000 0.004 0.000 0.964 0.028 0.004
#> GSM1124889     2  0.3942    0.55273 0.000 0.784 0.000 0.084 0.012 0.120
#> GSM1124892     1  0.2562    0.72917 0.828 0.000 0.172 0.000 0.000 0.000
#> GSM1124893     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     6  0.4499    0.35741 0.000 0.288 0.000 0.000 0.060 0.652
#> GSM1124913     4  0.1265    0.73570 0.000 0.000 0.000 0.948 0.044 0.008
#> GSM1124916     6  0.4587    0.34496 0.000 0.296 0.000 0.000 0.064 0.640
#> GSM1124923     5  0.5324    0.58297 0.000 0.000 0.076 0.284 0.612 0.028
#> GSM1124925     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000    0.85883 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.3219    0.71611 0.132 0.000 0.828 0.000 0.012 0.028
#> GSM1124937     6  0.6724    0.44698 0.152 0.048 0.156 0.000 0.060 0.584

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 tissue(p) k
#> MAD:skmeans 89    0.4885 2
#> MAD:skmeans 65    0.0417 3
#> MAD:skmeans 85    0.0472 4
#> MAD:skmeans 68    0.0120 5
#> MAD:skmeans 57    0.1506 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 48983 rows and 91 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 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-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.655           0.770       0.909         0.3575 0.707   0.707
#> 3 3 0.760           0.888       0.934         0.4928 0.754   0.658
#> 4 4 0.763           0.771       0.910         0.3169 0.815   0.621
#> 5 5 0.833           0.849       0.921         0.0844 0.925   0.756
#> 6 6 0.792           0.735       0.850         0.0643 0.954   0.811

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.0000      0.877 1.000 0.000
#> GSM1124888     1  0.0000      0.877 1.000 0.000
#> GSM1124890     2  0.3274      0.833 0.060 0.940
#> GSM1124904     2  0.0000      0.889 0.000 1.000
#> GSM1124927     2  0.0000      0.889 0.000 1.000
#> GSM1124953     1  0.9896      0.315 0.560 0.440
#> GSM1124869     2  0.9896      0.328 0.440 0.560
#> GSM1124870     2  0.0376      0.887 0.004 0.996
#> GSM1124882     2  0.9896      0.328 0.440 0.560
#> GSM1124884     2  0.0000      0.889 0.000 1.000
#> GSM1124898     2  0.0000      0.889 0.000 1.000
#> GSM1124903     2  0.0000      0.889 0.000 1.000
#> GSM1124905     2  0.8443      0.601 0.272 0.728
#> GSM1124910     1  0.0000      0.877 1.000 0.000
#> GSM1124919     2  0.0000      0.889 0.000 1.000
#> GSM1124932     2  0.0000      0.889 0.000 1.000
#> GSM1124933     1  0.0376      0.875 0.996 0.004
#> GSM1124867     2  0.0000      0.889 0.000 1.000
#> GSM1124868     2  0.0000      0.889 0.000 1.000
#> GSM1124878     2  0.0000      0.889 0.000 1.000
#> GSM1124895     2  0.0000      0.889 0.000 1.000
#> GSM1124897     2  0.0000      0.889 0.000 1.000
#> GSM1124902     2  0.0000      0.889 0.000 1.000
#> GSM1124908     2  0.0000      0.889 0.000 1.000
#> GSM1124921     2  0.0000      0.889 0.000 1.000
#> GSM1124939     2  0.0000      0.889 0.000 1.000
#> GSM1124944     2  0.0000      0.889 0.000 1.000
#> GSM1124945     1  0.9866      0.334 0.568 0.432
#> GSM1124946     2  0.0000      0.889 0.000 1.000
#> GSM1124947     2  0.0000      0.889 0.000 1.000
#> GSM1124951     1  0.8713      0.583 0.708 0.292
#> GSM1124952     2  0.0000      0.889 0.000 1.000
#> GSM1124957     1  0.0000      0.877 1.000 0.000
#> GSM1124900     2  0.0376      0.887 0.004 0.996
#> GSM1124914     2  0.0000      0.889 0.000 1.000
#> GSM1124871     2  0.0000      0.889 0.000 1.000
#> GSM1124874     2  0.0000      0.889 0.000 1.000
#> GSM1124875     2  0.0000      0.889 0.000 1.000
#> GSM1124880     2  0.0000      0.889 0.000 1.000
#> GSM1124881     2  0.0000      0.889 0.000 1.000
#> GSM1124885     2  0.0000      0.889 0.000 1.000
#> GSM1124886     1  0.0000      0.877 1.000 0.000
#> GSM1124887     2  0.0000      0.889 0.000 1.000
#> GSM1124894     2  0.5946      0.758 0.144 0.856
#> GSM1124896     2  0.9580      0.434 0.380 0.620
#> GSM1124899     2  0.0000      0.889 0.000 1.000
#> GSM1124901     2  0.0000      0.889 0.000 1.000
#> GSM1124906     2  0.0000      0.889 0.000 1.000
#> GSM1124907     2  0.0000      0.889 0.000 1.000
#> GSM1124911     2  0.0000      0.889 0.000 1.000
#> GSM1124912     2  0.9896      0.328 0.440 0.560
#> GSM1124915     2  0.0000      0.889 0.000 1.000
#> GSM1124917     2  0.0000      0.889 0.000 1.000
#> GSM1124918     2  0.0000      0.889 0.000 1.000
#> GSM1124920     1  0.0000      0.877 1.000 0.000
#> GSM1124922     2  0.0376      0.887 0.004 0.996
#> GSM1124924     2  0.5946      0.731 0.144 0.856
#> GSM1124926     2  0.0000      0.889 0.000 1.000
#> GSM1124928     2  0.9896      0.328 0.440 0.560
#> GSM1124930     2  0.0000      0.889 0.000 1.000
#> GSM1124931     2  0.0000      0.889 0.000 1.000
#> GSM1124935     2  0.0000      0.889 0.000 1.000
#> GSM1124936     1  0.0000      0.877 1.000 0.000
#> GSM1124938     1  0.9460      0.469 0.636 0.364
#> GSM1124940     2  0.9896      0.328 0.440 0.560
#> GSM1124941     2  0.0000      0.889 0.000 1.000
#> GSM1124942     2  0.0000      0.889 0.000 1.000
#> GSM1124943     2  0.9983     -0.123 0.476 0.524
#> GSM1124948     2  0.0000      0.889 0.000 1.000
#> GSM1124949     2  0.9896      0.328 0.440 0.560
#> GSM1124950     2  0.0000      0.889 0.000 1.000
#> GSM1124954     1  0.0000      0.877 1.000 0.000
#> GSM1124955     2  0.9896      0.328 0.440 0.560
#> GSM1124956     2  0.0000      0.889 0.000 1.000
#> GSM1124872     2  0.0000      0.889 0.000 1.000
#> GSM1124873     2  0.0000      0.889 0.000 1.000
#> GSM1124876     1  0.0000      0.877 1.000 0.000
#> GSM1124877     2  0.9896      0.328 0.440 0.560
#> GSM1124879     2  0.9896      0.328 0.440 0.560
#> GSM1124883     2  0.0000      0.889 0.000 1.000
#> GSM1124889     2  0.0000      0.889 0.000 1.000
#> GSM1124892     1  0.0000      0.877 1.000 0.000
#> GSM1124893     2  0.9896      0.328 0.440 0.560
#> GSM1124909     2  0.0000      0.889 0.000 1.000
#> GSM1124913     2  0.0000      0.889 0.000 1.000
#> GSM1124916     2  0.0000      0.889 0.000 1.000
#> GSM1124923     2  0.0000      0.889 0.000 1.000
#> GSM1124925     2  0.9896      0.328 0.440 0.560
#> GSM1124929     2  0.9963      0.269 0.464 0.536
#> GSM1124934     1  0.0000      0.877 1.000 0.000
#> GSM1124937     2  0.0000      0.889 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
#> GSM1124891     3  0.3116     0.9024 0.108 0.000 0.892
#> GSM1124888     3  0.3340     0.9011 0.120 0.000 0.880
#> GSM1124890     2  0.4399     0.7751 0.000 0.812 0.188
#> GSM1124904     2  0.2537     0.9225 0.000 0.920 0.080
#> GSM1124927     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124953     3  0.2261     0.8294 0.000 0.068 0.932
#> GSM1124869     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124870     1  0.3340     0.7685 0.880 0.120 0.000
#> GSM1124882     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124884     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124898     2  0.2796     0.9205 0.000 0.908 0.092
#> GSM1124903     2  0.3116     0.9127 0.000 0.892 0.108
#> GSM1124905     1  0.6299     0.0178 0.524 0.476 0.000
#> GSM1124910     1  0.0237     0.9323 0.996 0.000 0.004
#> GSM1124919     2  0.2796     0.9205 0.000 0.908 0.092
#> GSM1124932     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124933     3  0.3116     0.9024 0.108 0.000 0.892
#> GSM1124867     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124868     2  0.2959     0.9158 0.000 0.900 0.100
#> GSM1124878     2  0.3116     0.9127 0.000 0.892 0.108
#> GSM1124895     2  0.2959     0.9165 0.000 0.900 0.100
#> GSM1124897     2  0.3116     0.9127 0.000 0.892 0.108
#> GSM1124902     2  0.3116     0.9127 0.000 0.892 0.108
#> GSM1124908     2  0.2537     0.9248 0.000 0.920 0.080
#> GSM1124921     2  0.3340     0.9093 0.000 0.880 0.120
#> GSM1124939     2  0.1643     0.9327 0.000 0.956 0.044
#> GSM1124944     2  0.3340     0.9093 0.000 0.880 0.120
#> GSM1124945     3  0.2959     0.8372 0.000 0.100 0.900
#> GSM1124946     2  0.3340     0.9093 0.000 0.880 0.120
#> GSM1124947     2  0.1289     0.9339 0.000 0.968 0.032
#> GSM1124951     3  0.0000     0.8391 0.000 0.000 1.000
#> GSM1124952     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124957     3  0.3116     0.9024 0.108 0.000 0.892
#> GSM1124900     2  0.4974     0.6722 0.236 0.764 0.000
#> GSM1124914     2  0.1860     0.9321 0.000 0.948 0.052
#> GSM1124871     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124874     2  0.0592     0.9375 0.000 0.988 0.012
#> GSM1124875     2  0.1289     0.9348 0.000 0.968 0.032
#> GSM1124880     2  0.0475     0.9372 0.004 0.992 0.004
#> GSM1124881     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124885     2  0.3340     0.9093 0.000 0.880 0.120
#> GSM1124886     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124887     2  0.2537     0.9225 0.000 0.920 0.080
#> GSM1124894     2  0.3377     0.8830 0.092 0.896 0.012
#> GSM1124896     2  0.6937     0.3310 0.404 0.576 0.020
#> GSM1124899     2  0.0424     0.9374 0.000 0.992 0.008
#> GSM1124901     2  0.0592     0.9365 0.000 0.988 0.012
#> GSM1124906     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124907     2  0.2878     0.9195 0.000 0.904 0.096
#> GSM1124911     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124912     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124915     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124917     2  0.0424     0.9382 0.000 0.992 0.008
#> GSM1124918     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124920     3  0.4121     0.8577 0.168 0.000 0.832
#> GSM1124922     2  0.0592     0.9365 0.000 0.988 0.012
#> GSM1124924     2  0.6577     0.1859 0.008 0.572 0.420
#> GSM1124926     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124928     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124930     2  0.3340     0.9093 0.000 0.880 0.120
#> GSM1124931     2  0.0237     0.9376 0.000 0.996 0.004
#> GSM1124935     2  0.0592     0.9365 0.000 0.988 0.012
#> GSM1124936     3  0.3340     0.9011 0.120 0.000 0.880
#> GSM1124938     3  0.3412     0.8177 0.000 0.124 0.876
#> GSM1124940     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124941     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124942     2  0.3038     0.9045 0.000 0.896 0.104
#> GSM1124943     3  0.5216     0.6390 0.000 0.260 0.740
#> GSM1124948     2  0.0592     0.9365 0.000 0.988 0.012
#> GSM1124949     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124950     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124954     3  0.3340     0.9011 0.120 0.000 0.880
#> GSM1124955     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124956     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124872     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124873     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124876     3  0.3340     0.9011 0.120 0.000 0.880
#> GSM1124877     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124879     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124883     2  0.3340     0.9093 0.000 0.880 0.120
#> GSM1124889     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124892     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124893     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124909     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124913     2  0.2537     0.9225 0.000 0.920 0.080
#> GSM1124916     2  0.0000     0.9385 0.000 1.000 0.000
#> GSM1124923     2  0.2796     0.9205 0.000 0.908 0.092
#> GSM1124925     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9362 1.000 0.000 0.000
#> GSM1124934     3  0.3340     0.9011 0.120 0.000 0.880
#> GSM1124937     2  0.0000     0.9385 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
#> GSM1124891     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124888     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124890     2  0.3743     0.7152 0.000 0.824 0.160 0.016
#> GSM1124904     2  0.4855     0.3311 0.000 0.600 0.000 0.400
#> GSM1124927     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124953     3  0.5328     0.6460 0.000 0.064 0.724 0.212
#> GSM1124869     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.0188     0.9554 0.996 0.004 0.000 0.000
#> GSM1124882     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124898     2  0.4790     0.3713 0.000 0.620 0.000 0.380
#> GSM1124903     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124905     1  0.4977     0.0768 0.540 0.460 0.000 0.000
#> GSM1124910     1  0.0188     0.9565 0.996 0.000 0.004 0.000
#> GSM1124919     2  0.4843     0.3395 0.000 0.604 0.000 0.396
#> GSM1124932     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124933     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124867     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124868     4  0.0469     0.7908 0.000 0.012 0.000 0.988
#> GSM1124878     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124895     4  0.0592     0.7904 0.000 0.016 0.000 0.984
#> GSM1124897     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124902     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.4925     0.2411 0.000 0.428 0.000 0.572
#> GSM1124921     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.4843     0.4311 0.000 0.396 0.000 0.604
#> GSM1124944     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124945     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124946     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.4843     0.4311 0.000 0.396 0.000 0.604
#> GSM1124951     3  0.0469     0.9262 0.000 0.000 0.988 0.012
#> GSM1124952     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124957     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124900     2  0.4661     0.4447 0.348 0.652 0.000 0.000
#> GSM1124914     4  0.4830     0.4332 0.000 0.392 0.000 0.608
#> GSM1124871     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124874     4  0.4989     0.2656 0.000 0.472 0.000 0.528
#> GSM1124875     2  0.2921     0.7312 0.000 0.860 0.000 0.140
#> GSM1124880     2  0.0707     0.8536 0.000 0.980 0.020 0.000
#> GSM1124881     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124885     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124886     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124887     2  0.4843     0.3395 0.000 0.604 0.000 0.396
#> GSM1124894     2  0.4150     0.7094 0.000 0.824 0.056 0.120
#> GSM1124896     2  0.6110     0.3126 0.368 0.576 0.056 0.000
#> GSM1124899     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124901     2  0.0188     0.8619 0.000 0.996 0.000 0.004
#> GSM1124906     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124907     2  0.4977     0.1787 0.000 0.540 0.000 0.460
#> GSM1124911     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124912     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124917     2  0.0469     0.8572 0.000 0.988 0.000 0.012
#> GSM1124918     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124920     3  0.2530     0.8321 0.112 0.000 0.888 0.000
#> GSM1124922     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124924     2  0.4999     0.0283 0.000 0.508 0.492 0.000
#> GSM1124926     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124928     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124930     4  0.0000     0.7944 0.000 0.000 0.000 1.000
#> GSM1124931     2  0.0707     0.8527 0.000 0.980 0.020 0.000
#> GSM1124935     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124936     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124938     3  0.1867     0.8686 0.000 0.072 0.928 0.000
#> GSM1124940     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124942     2  0.5428     0.6416 0.000 0.740 0.120 0.140
#> GSM1124943     3  0.4482     0.6147 0.000 0.264 0.728 0.008
#> GSM1124948     2  0.0469     0.8580 0.000 0.988 0.012 0.000
#> GSM1124949     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124954     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124955     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124872     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124873     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124876     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124877     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124883     4  0.3649     0.6947 0.000 0.204 0.000 0.796
#> GSM1124889     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124892     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124913     4  0.3172     0.6899 0.000 0.160 0.000 0.840
#> GSM1124916     2  0.0000     0.8641 0.000 1.000 0.000 0.000
#> GSM1124923     2  0.5016     0.3341 0.000 0.600 0.004 0.396
#> GSM1124925     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9601 1.000 0.000 0.000 0.000
#> GSM1124934     3  0.0000     0.9331 0.000 0.000 1.000 0.000
#> GSM1124937     2  0.0000     0.8641 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
#> GSM1124891     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM1124888     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM1124890     5  0.2304     0.8428 0.000 0.100 0.000 0.008 0.892
#> GSM1124904     2  0.4884     0.6523 0.000 0.720 0.000 0.128 0.152
#> GSM1124927     2  0.0510     0.9157 0.000 0.984 0.000 0.000 0.016
#> GSM1124953     3  0.4444     0.7523 0.000 0.056 0.800 0.088 0.056
#> GSM1124869     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.0290     0.9496 0.992 0.008 0.000 0.000 0.000
#> GSM1124882     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124898     2  0.5423     0.5504 0.000 0.644 0.000 0.112 0.244
#> GSM1124903     4  0.2424     0.8013 0.000 0.000 0.000 0.868 0.132
#> GSM1124905     1  0.4283     0.0661 0.544 0.456 0.000 0.000 0.000
#> GSM1124910     1  0.0162     0.9541 0.996 0.000 0.004 0.000 0.000
#> GSM1124919     5  0.4219     0.7033 0.000 0.104 0.000 0.116 0.780
#> GSM1124932     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124933     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     2  0.0510     0.9157 0.000 0.984 0.000 0.000 0.016
#> GSM1124868     4  0.0404     0.8385 0.000 0.012 0.000 0.988 0.000
#> GSM1124878     4  0.2424     0.8013 0.000 0.000 0.000 0.868 0.132
#> GSM1124895     4  0.0404     0.8385 0.000 0.012 0.000 0.988 0.000
#> GSM1124897     4  0.0703     0.8369 0.000 0.000 0.000 0.976 0.024
#> GSM1124902     4  0.0000     0.8371 0.000 0.000 0.000 1.000 0.000
#> GSM1124908     4  0.5598     0.3334 0.000 0.376 0.000 0.544 0.080
#> GSM1124921     4  0.2471     0.8018 0.000 0.000 0.000 0.864 0.136
#> GSM1124939     4  0.2338     0.7863 0.000 0.112 0.000 0.884 0.004
#> GSM1124944     4  0.2020     0.7807 0.000 0.000 0.000 0.900 0.100
#> GSM1124945     3  0.0963     0.9317 0.000 0.000 0.964 0.000 0.036
#> GSM1124946     4  0.0703     0.8354 0.000 0.000 0.000 0.976 0.024
#> GSM1124947     4  0.2519     0.7867 0.000 0.100 0.000 0.884 0.016
#> GSM1124951     3  0.1892     0.8948 0.000 0.000 0.916 0.004 0.080
#> GSM1124952     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124957     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     2  0.3966     0.5206 0.336 0.664 0.000 0.000 0.000
#> GSM1124914     4  0.2690     0.7497 0.000 0.156 0.000 0.844 0.000
#> GSM1124871     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124874     4  0.3452     0.6687 0.000 0.244 0.000 0.756 0.000
#> GSM1124875     2  0.5086     0.6445 0.000 0.700 0.000 0.144 0.156
#> GSM1124880     2  0.1934     0.8818 0.004 0.928 0.052 0.000 0.016
#> GSM1124881     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124885     4  0.0000     0.8371 0.000 0.000 0.000 1.000 0.000
#> GSM1124886     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     2  0.4711     0.6716 0.000 0.736 0.000 0.116 0.148
#> GSM1124894     2  0.4058     0.7283 0.000 0.784 0.064 0.152 0.000
#> GSM1124896     2  0.5882     0.3999 0.332 0.572 0.084 0.000 0.012
#> GSM1124899     2  0.0703     0.9091 0.000 0.976 0.000 0.000 0.024
#> GSM1124901     2  0.1121     0.8964 0.000 0.956 0.000 0.000 0.044
#> GSM1124906     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124907     5  0.0510     0.8200 0.000 0.000 0.000 0.016 0.984
#> GSM1124911     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124912     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124917     2  0.1341     0.8959 0.000 0.944 0.000 0.000 0.056
#> GSM1124918     2  0.0703     0.9142 0.000 0.976 0.000 0.000 0.024
#> GSM1124920     3  0.1671     0.8754 0.076 0.000 0.924 0.000 0.000
#> GSM1124922     2  0.1121     0.8964 0.000 0.956 0.000 0.000 0.044
#> GSM1124924     5  0.5137     0.6963 0.000 0.108 0.208 0.000 0.684
#> GSM1124926     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124928     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124930     5  0.2605     0.7887 0.000 0.000 0.000 0.148 0.852
#> GSM1124931     2  0.0609     0.9115 0.000 0.980 0.020 0.000 0.000
#> GSM1124935     2  0.1043     0.8994 0.000 0.960 0.000 0.000 0.040
#> GSM1124936     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM1124938     5  0.3130     0.8388 0.000 0.048 0.096 0.000 0.856
#> GSM1124940     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124942     5  0.2735     0.8438 0.000 0.036 0.084 0.000 0.880
#> GSM1124943     5  0.2879     0.8524 0.000 0.080 0.032 0.008 0.880
#> GSM1124948     5  0.3075     0.8413 0.000 0.092 0.048 0.000 0.860
#> GSM1124949     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.0162     0.9178 0.000 0.996 0.000 0.000 0.004
#> GSM1124954     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM1124955     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124872     2  0.0510     0.9157 0.000 0.984 0.000 0.000 0.016
#> GSM1124873     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124876     3  0.0000     0.9567 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124883     4  0.3953     0.7743 0.000 0.060 0.000 0.792 0.148
#> GSM1124889     2  0.0000     0.9183 0.000 1.000 0.000 0.000 0.000
#> GSM1124892     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.0510     0.9157 0.000 0.984 0.000 0.000 0.016
#> GSM1124913     4  0.3995     0.7628 0.000 0.060 0.000 0.788 0.152
#> GSM1124916     2  0.0510     0.9157 0.000 0.984 0.000 0.000 0.016
#> GSM1124923     5  0.2389     0.7515 0.000 0.004 0.000 0.116 0.880
#> GSM1124925     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9582 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.0290     0.9529 0.000 0.000 0.992 0.000 0.008
#> GSM1124937     2  0.0609     0.9147 0.000 0.980 0.000 0.000 0.020

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124888     3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124890     5  0.4703      0.691 0.000 0.012 0.032 0.004 0.628 0.324
#> GSM1124904     6  0.3182      0.712 0.000 0.012 0.000 0.136 0.024 0.828
#> GSM1124927     2  0.3828      0.628 0.000 0.560 0.000 0.000 0.440 0.000
#> GSM1124953     3  0.3788      0.566 0.000 0.000 0.704 0.004 0.012 0.280
#> GSM1124869     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.0858      0.939 0.968 0.004 0.000 0.000 0.028 0.000
#> GSM1124882     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.0146      0.794 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1124898     6  0.4222      0.403 0.000 0.252 0.000 0.004 0.044 0.700
#> GSM1124903     6  0.2854      0.691 0.000 0.000 0.000 0.208 0.000 0.792
#> GSM1124905     1  0.4683      0.325 0.616 0.320 0.000 0.000 0.064 0.000
#> GSM1124910     1  0.0777      0.942 0.972 0.000 0.004 0.000 0.024 0.000
#> GSM1124919     6  0.3163      0.354 0.000 0.004 0.000 0.000 0.232 0.764
#> GSM1124932     2  0.0260      0.793 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM1124933     3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     2  0.3804      0.638 0.000 0.576 0.000 0.000 0.424 0.000
#> GSM1124868     4  0.0146      0.788 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124878     6  0.2883      0.687 0.000 0.000 0.000 0.212 0.000 0.788
#> GSM1124895     4  0.0146      0.788 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM1124897     4  0.0937      0.764 0.000 0.000 0.000 0.960 0.000 0.040
#> GSM1124902     4  0.0146      0.788 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM1124908     4  0.6545     -0.198 0.000 0.212 0.000 0.404 0.032 0.352
#> GSM1124921     6  0.3819      0.494 0.000 0.000 0.000 0.372 0.004 0.624
#> GSM1124939     4  0.0000      0.788 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124944     4  0.0000      0.788 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124945     3  0.0291      0.930 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM1124946     4  0.3782      0.364 0.000 0.000 0.000 0.636 0.004 0.360
#> GSM1124947     4  0.0000      0.788 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124951     3  0.1152      0.900 0.000 0.000 0.952 0.004 0.000 0.044
#> GSM1124952     2  0.2278      0.741 0.000 0.868 0.000 0.128 0.004 0.000
#> GSM1124957     3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     2  0.3958      0.632 0.220 0.740 0.000 0.000 0.028 0.012
#> GSM1124914     4  0.1267      0.734 0.000 0.060 0.000 0.940 0.000 0.000
#> GSM1124871     2  0.0146      0.794 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1124874     4  0.4161      0.276 0.000 0.448 0.000 0.540 0.000 0.012
#> GSM1124875     2  0.6381      0.411 0.000 0.524 0.000 0.284 0.080 0.112
#> GSM1124880     2  0.4682      0.620 0.000 0.556 0.048 0.000 0.396 0.000
#> GSM1124881     2  0.0458      0.795 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1124885     4  0.0146      0.788 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM1124886     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     6  0.3308      0.649 0.000 0.096 0.000 0.072 0.004 0.828
#> GSM1124894     2  0.5785      0.451 0.000 0.580 0.124 0.264 0.032 0.000
#> GSM1124896     2  0.6508      0.448 0.176 0.424 0.040 0.000 0.360 0.000
#> GSM1124899     2  0.0363      0.792 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1124901     2  0.0603      0.792 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM1124906     2  0.0146      0.794 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM1124907     5  0.3961      0.578 0.000 0.000 0.000 0.004 0.556 0.440
#> GSM1124911     2  0.0363      0.792 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1124912     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     2  0.2562      0.662 0.000 0.828 0.000 0.000 0.000 0.172
#> GSM1124917     2  0.4348      0.623 0.000 0.560 0.000 0.000 0.416 0.024
#> GSM1124918     2  0.4478      0.695 0.000 0.708 0.000 0.004 0.200 0.088
#> GSM1124920     3  0.2003      0.801 0.116 0.000 0.884 0.000 0.000 0.000
#> GSM1124922     2  0.0603      0.794 0.000 0.980 0.000 0.000 0.004 0.016
#> GSM1124924     5  0.5069      0.647 0.000 0.004 0.256 0.000 0.628 0.112
#> GSM1124926     2  0.0363      0.792 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1124928     1  0.0937      0.931 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM1124930     5  0.5543      0.595 0.000 0.000 0.000 0.240 0.556 0.204
#> GSM1124931     2  0.1933      0.782 0.000 0.924 0.032 0.000 0.032 0.012
#> GSM1124935     2  0.0748      0.793 0.000 0.976 0.000 0.004 0.004 0.016
#> GSM1124936     3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124938     5  0.5438      0.722 0.000 0.000 0.200 0.004 0.596 0.200
#> GSM1124940     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000      0.794 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124942     5  0.5341      0.732 0.000 0.000 0.132 0.004 0.588 0.276
#> GSM1124943     5  0.4209      0.740 0.000 0.000 0.044 0.008 0.716 0.232
#> GSM1124948     5  0.2737      0.671 0.000 0.004 0.000 0.004 0.832 0.160
#> GSM1124949     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.3409      0.708 0.000 0.700 0.000 0.000 0.300 0.000
#> GSM1124954     3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124955     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.0363      0.792 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1124872     2  0.3833      0.625 0.000 0.556 0.000 0.000 0.444 0.000
#> GSM1124873     2  0.0260      0.795 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1124876     3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124879     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124883     4  0.4495      0.276 0.000 0.028 0.000 0.580 0.004 0.388
#> GSM1124889     2  0.0146      0.794 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1124892     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.3833      0.625 0.000 0.556 0.000 0.000 0.444 0.000
#> GSM1124913     6  0.2597      0.703 0.000 0.000 0.000 0.176 0.000 0.824
#> GSM1124916     2  0.3797      0.638 0.000 0.580 0.000 0.000 0.420 0.000
#> GSM1124923     6  0.2762      0.359 0.000 0.000 0.000 0.000 0.196 0.804
#> GSM1124925     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.961 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     3  0.1753      0.858 0.000 0.000 0.912 0.000 0.084 0.004
#> GSM1124937     2  0.3833      0.625 0.000 0.556 0.000 0.000 0.444 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 tissue(p) k
#> MAD:pam 74  0.368037 2
#> MAD:pam 88  0.076363 3
#> MAD:pam 76  0.000351 4
#> MAD:pam 88  0.000322 5
#> MAD:pam 79  0.000393 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 48983 rows and 91 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.853           0.952       0.976         0.4560 0.546   0.546
#> 3 3 0.619           0.725       0.841         0.2609 0.892   0.807
#> 4 4 0.541           0.462       0.746         0.2206 0.847   0.678
#> 5 5 0.562           0.510       0.734         0.0932 0.785   0.470
#> 6 6 0.818           0.834       0.901         0.0459 0.892   0.619

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
#> GSM1124891     1  0.1843      0.956 0.972 0.028
#> GSM1124888     1  0.1843      0.956 0.972 0.028
#> GSM1124890     2  0.4815      0.897 0.104 0.896
#> GSM1124904     2  0.0000      0.975 0.000 1.000
#> GSM1124927     2  0.5629      0.874 0.132 0.868
#> GSM1124953     2  0.4161      0.914 0.084 0.916
#> GSM1124869     1  0.0000      0.973 1.000 0.000
#> GSM1124870     1  0.0376      0.971 0.996 0.004
#> GSM1124882     1  0.0000      0.973 1.000 0.000
#> GSM1124884     2  0.0000      0.975 0.000 1.000
#> GSM1124898     2  0.0000      0.975 0.000 1.000
#> GSM1124903     2  0.0000      0.975 0.000 1.000
#> GSM1124905     1  0.0000      0.973 1.000 0.000
#> GSM1124910     1  0.0000      0.973 1.000 0.000
#> GSM1124919     2  0.0000      0.975 0.000 1.000
#> GSM1124932     2  0.5294      0.886 0.120 0.880
#> GSM1124933     1  0.1843      0.956 0.972 0.028
#> GSM1124867     2  0.0000      0.975 0.000 1.000
#> GSM1124868     2  0.0000      0.975 0.000 1.000
#> GSM1124878     2  0.0000      0.975 0.000 1.000
#> GSM1124895     2  0.0000      0.975 0.000 1.000
#> GSM1124897     2  0.0000      0.975 0.000 1.000
#> GSM1124902     2  0.0000      0.975 0.000 1.000
#> GSM1124908     2  0.0376      0.973 0.004 0.996
#> GSM1124921     2  0.0000      0.975 0.000 1.000
#> GSM1124939     2  0.0000      0.975 0.000 1.000
#> GSM1124944     2  0.0000      0.975 0.000 1.000
#> GSM1124945     1  0.9044      0.534 0.680 0.320
#> GSM1124946     2  0.0000      0.975 0.000 1.000
#> GSM1124947     2  0.5178      0.885 0.116 0.884
#> GSM1124951     1  0.8955      0.551 0.688 0.312
#> GSM1124952     2  0.6048      0.856 0.148 0.852
#> GSM1124957     1  0.1843      0.956 0.972 0.028
#> GSM1124900     1  0.0672      0.968 0.992 0.008
#> GSM1124914     2  0.0000      0.975 0.000 1.000
#> GSM1124871     2  0.0000      0.975 0.000 1.000
#> GSM1124874     2  0.1633      0.960 0.024 0.976
#> GSM1124875     2  0.0000      0.975 0.000 1.000
#> GSM1124880     2  0.4939      0.897 0.108 0.892
#> GSM1124881     2  0.0000      0.975 0.000 1.000
#> GSM1124885     2  0.0000      0.975 0.000 1.000
#> GSM1124886     1  0.0000      0.973 1.000 0.000
#> GSM1124887     2  0.0000      0.975 0.000 1.000
#> GSM1124894     1  0.0376      0.971 0.996 0.004
#> GSM1124896     1  0.0000      0.973 1.000 0.000
#> GSM1124899     2  0.0000      0.975 0.000 1.000
#> GSM1124901     2  0.0000      0.975 0.000 1.000
#> GSM1124906     2  0.0672      0.971 0.008 0.992
#> GSM1124907     2  0.0000      0.975 0.000 1.000
#> GSM1124911     2  0.1184      0.965 0.016 0.984
#> GSM1124912     1  0.0000      0.973 1.000 0.000
#> GSM1124915     2  0.0000      0.975 0.000 1.000
#> GSM1124917     2  0.0000      0.975 0.000 1.000
#> GSM1124918     2  0.0000      0.975 0.000 1.000
#> GSM1124920     1  0.0000      0.973 1.000 0.000
#> GSM1124922     2  0.6048      0.856 0.148 0.852
#> GSM1124924     2  0.0938      0.968 0.012 0.988
#> GSM1124926     2  0.5737      0.869 0.136 0.864
#> GSM1124928     1  0.0000      0.973 1.000 0.000
#> GSM1124930     2  0.0000      0.975 0.000 1.000
#> GSM1124931     2  0.6048      0.856 0.148 0.852
#> GSM1124935     2  0.0000      0.975 0.000 1.000
#> GSM1124936     1  0.0000      0.973 1.000 0.000
#> GSM1124938     2  0.4939      0.893 0.108 0.892
#> GSM1124940     1  0.0000      0.973 1.000 0.000
#> GSM1124941     2  0.0000      0.975 0.000 1.000
#> GSM1124942     2  0.0000      0.975 0.000 1.000
#> GSM1124943     2  0.0000      0.975 0.000 1.000
#> GSM1124948     2  0.0000      0.975 0.000 1.000
#> GSM1124949     1  0.0000      0.973 1.000 0.000
#> GSM1124950     2  0.0000      0.975 0.000 1.000
#> GSM1124954     1  0.0000      0.973 1.000 0.000
#> GSM1124955     1  0.0000      0.973 1.000 0.000
#> GSM1124956     2  0.0672      0.971 0.008 0.992
#> GSM1124872     2  0.0000      0.975 0.000 1.000
#> GSM1124873     2  0.0000      0.975 0.000 1.000
#> GSM1124876     1  0.1843      0.956 0.972 0.028
#> GSM1124877     1  0.0000      0.973 1.000 0.000
#> GSM1124879     1  0.0000      0.973 1.000 0.000
#> GSM1124883     2  0.0000      0.975 0.000 1.000
#> GSM1124889     2  0.0000      0.975 0.000 1.000
#> GSM1124892     1  0.0000      0.973 1.000 0.000
#> GSM1124893     1  0.0000      0.973 1.000 0.000
#> GSM1124909     2  0.0000      0.975 0.000 1.000
#> GSM1124913     2  0.0000      0.975 0.000 1.000
#> GSM1124916     2  0.0000      0.975 0.000 1.000
#> GSM1124923     2  0.0000      0.975 0.000 1.000
#> GSM1124925     1  0.0000      0.973 1.000 0.000
#> GSM1124929     1  0.0000      0.973 1.000 0.000
#> GSM1124934     1  0.0000      0.973 1.000 0.000
#> GSM1124937     2  0.0000      0.975 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.6955      0.817 0.332 0.032 0.636
#> GSM1124888     3  0.6906      0.820 0.324 0.032 0.644
#> GSM1124890     2  0.2096      0.830 0.004 0.944 0.052
#> GSM1124904     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124927     1  0.8465      0.176 0.460 0.452 0.088
#> GSM1124953     2  0.4521      0.781 0.004 0.816 0.180
#> GSM1124869     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124870     1  0.4443      0.718 0.864 0.052 0.084
#> GSM1124882     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124884     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124898     2  0.2261      0.847 0.000 0.932 0.068
#> GSM1124903     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124905     1  0.3973      0.731 0.880 0.032 0.088
#> GSM1124910     1  0.2031      0.771 0.952 0.032 0.016
#> GSM1124919     2  0.1964      0.850 0.000 0.944 0.056
#> GSM1124932     2  0.8631     -0.156 0.432 0.468 0.100
#> GSM1124933     3  0.6906      0.820 0.324 0.032 0.644
#> GSM1124867     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124868     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124878     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124895     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124897     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124902     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124908     2  0.5785      0.723 0.000 0.668 0.332
#> GSM1124921     2  0.5760      0.728 0.000 0.672 0.328
#> GSM1124939     2  0.5016      0.787 0.000 0.760 0.240
#> GSM1124944     2  0.4750      0.799 0.000 0.784 0.216
#> GSM1124945     3  0.6541      0.586 0.056 0.212 0.732
#> GSM1124946     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124947     2  0.4390      0.782 0.012 0.840 0.148
#> GSM1124951     3  0.5970      0.615 0.060 0.160 0.780
#> GSM1124952     2  0.8789     -0.134 0.428 0.460 0.112
#> GSM1124957     3  0.6056      0.758 0.224 0.032 0.744
#> GSM1124900     1  0.4339      0.722 0.868 0.048 0.084
#> GSM1124914     2  0.4702      0.800 0.000 0.788 0.212
#> GSM1124871     2  0.0000      0.851 0.000 1.000 0.000
#> GSM1124874     2  0.1289      0.839 0.032 0.968 0.000
#> GSM1124875     2  0.0000      0.851 0.000 1.000 0.000
#> GSM1124880     1  0.5363      0.440 0.724 0.276 0.000
#> GSM1124881     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124885     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124886     1  0.0237      0.797 0.996 0.000 0.004
#> GSM1124887     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124894     1  0.5393      0.669 0.820 0.072 0.108
#> GSM1124896     1  0.2796      0.743 0.908 0.000 0.092
#> GSM1124899     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124901     2  0.2356      0.846 0.000 0.928 0.072
#> GSM1124906     2  0.2165      0.816 0.064 0.936 0.000
#> GSM1124907     2  0.2448      0.847 0.000 0.924 0.076
#> GSM1124911     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124912     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124915     2  0.2448      0.846 0.000 0.924 0.076
#> GSM1124917     2  0.0000      0.851 0.000 1.000 0.000
#> GSM1124918     2  0.0592      0.848 0.000 0.988 0.012
#> GSM1124920     3  0.7263      0.765 0.400 0.032 0.568
#> GSM1124922     2  0.8793     -0.173 0.436 0.452 0.112
#> GSM1124924     2  0.2939      0.819 0.072 0.916 0.012
#> GSM1124926     1  0.9300      0.122 0.428 0.412 0.160
#> GSM1124928     1  0.1525      0.775 0.964 0.032 0.004
#> GSM1124930     2  0.1163      0.851 0.000 0.972 0.028
#> GSM1124931     2  0.8688     -0.163 0.436 0.460 0.104
#> GSM1124935     2  0.1964      0.849 0.000 0.944 0.056
#> GSM1124936     3  0.7377      0.688 0.452 0.032 0.516
#> GSM1124938     2  0.4755      0.687 0.008 0.808 0.184
#> GSM1124940     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124941     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124942     2  0.0592      0.848 0.000 0.988 0.012
#> GSM1124943     2  0.1411      0.839 0.000 0.964 0.036
#> GSM1124948     2  0.0592      0.848 0.000 0.988 0.012
#> GSM1124949     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124950     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124954     3  0.7329      0.735 0.424 0.032 0.544
#> GSM1124955     1  0.0424      0.796 0.992 0.000 0.008
#> GSM1124956     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124872     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124873     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124876     3  0.6906      0.820 0.324 0.032 0.644
#> GSM1124877     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124879     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124883     2  0.4974      0.789 0.000 0.764 0.236
#> GSM1124889     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124892     1  0.0592      0.790 0.988 0.000 0.012
#> GSM1124893     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124909     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124913     2  0.5058      0.785 0.000 0.756 0.244
#> GSM1124916     2  0.0237      0.851 0.004 0.996 0.000
#> GSM1124923     2  0.3412      0.837 0.000 0.876 0.124
#> GSM1124925     1  0.0237      0.799 0.996 0.000 0.004
#> GSM1124929     1  0.0000      0.801 1.000 0.000 0.000
#> GSM1124934     1  0.7337     -0.541 0.540 0.032 0.428
#> GSM1124937     2  0.1753      0.835 0.048 0.952 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.0000    0.67076 0.000 0.000 1.000 0.000
#> GSM1124888     3  0.0000    0.67076 0.000 0.000 1.000 0.000
#> GSM1124890     3  0.7581   -0.08913 0.000 0.380 0.424 0.196
#> GSM1124904     2  0.4477    0.11618 0.000 0.688 0.000 0.312
#> GSM1124927     4  0.6608    0.26256 0.168 0.204 0.000 0.628
#> GSM1124953     4  0.4967    0.50365 0.000 0.452 0.000 0.548
#> GSM1124869     1  0.0000    0.74511 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.7211    0.52360 0.548 0.000 0.204 0.248
#> GSM1124882     1  0.0592    0.74412 0.984 0.000 0.016 0.000
#> GSM1124884     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124898     2  0.3123    0.53919 0.000 0.844 0.000 0.156
#> GSM1124903     2  0.4406    0.14419 0.000 0.700 0.000 0.300
#> GSM1124905     1  0.7088    0.54465 0.568 0.000 0.204 0.228
#> GSM1124910     1  0.6033    0.61645 0.680 0.000 0.204 0.116
#> GSM1124919     2  0.1118    0.45523 0.000 0.964 0.000 0.036
#> GSM1124932     4  0.4920    0.40437 0.068 0.164 0.000 0.768
#> GSM1124933     3  0.0000    0.67076 0.000 0.000 1.000 0.000
#> GSM1124867     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124868     2  0.4522    0.09677 0.000 0.680 0.000 0.320
#> GSM1124878     2  0.4356    0.15912 0.000 0.708 0.000 0.292
#> GSM1124895     2  0.4008    0.23298 0.000 0.756 0.000 0.244
#> GSM1124897     2  0.4356    0.15912 0.000 0.708 0.000 0.292
#> GSM1124902     2  0.4304    0.17336 0.000 0.716 0.000 0.284
#> GSM1124908     4  0.4746    0.50601 0.000 0.368 0.000 0.632
#> GSM1124921     4  0.4730    0.50111 0.000 0.364 0.000 0.636
#> GSM1124939     2  0.3400    0.31083 0.000 0.820 0.000 0.180
#> GSM1124944     4  0.4996    0.42324 0.000 0.484 0.000 0.516
#> GSM1124945     3  0.4874    0.45462 0.000 0.180 0.764 0.056
#> GSM1124946     4  0.4855    0.48229 0.000 0.400 0.000 0.600
#> GSM1124947     4  0.4643    0.51901 0.000 0.344 0.000 0.656
#> GSM1124951     3  0.3505    0.58917 0.000 0.088 0.864 0.048
#> GSM1124952     4  0.4008    0.49849 0.000 0.244 0.000 0.756
#> GSM1124957     3  0.0000    0.67076 0.000 0.000 1.000 0.000
#> GSM1124900     1  0.7234    0.52093 0.544 0.000 0.204 0.252
#> GSM1124914     2  0.3074    0.33720 0.000 0.848 0.000 0.152
#> GSM1124871     2  0.4679    0.57749 0.000 0.648 0.000 0.352
#> GSM1124874     2  0.4981    0.48598 0.000 0.536 0.000 0.464
#> GSM1124875     2  0.3311    0.53694 0.000 0.828 0.000 0.172
#> GSM1124880     1  0.9643    0.04416 0.348 0.152 0.200 0.300
#> GSM1124881     2  0.4697    0.57672 0.000 0.644 0.000 0.356
#> GSM1124885     2  0.4431    0.13543 0.000 0.696 0.000 0.304
#> GSM1124886     1  0.0336    0.74299 0.992 0.000 0.000 0.008
#> GSM1124887     4  0.4830    0.48904 0.000 0.392 0.000 0.608
#> GSM1124894     1  0.7608    0.39401 0.432 0.000 0.204 0.364
#> GSM1124896     1  0.7390    0.48844 0.512 0.000 0.204 0.284
#> GSM1124899     2  0.4866    0.54906 0.000 0.596 0.000 0.404
#> GSM1124901     2  0.1022    0.46966 0.000 0.968 0.000 0.032
#> GSM1124906     2  0.5070    0.56515 0.008 0.620 0.000 0.372
#> GSM1124907     2  0.0336    0.44989 0.000 0.992 0.000 0.008
#> GSM1124911     2  0.4843    0.55561 0.000 0.604 0.000 0.396
#> GSM1124912     1  0.0000    0.74511 1.000 0.000 0.000 0.000
#> GSM1124915     2  0.1474    0.48022 0.000 0.948 0.000 0.052
#> GSM1124917     2  0.4543    0.57965 0.000 0.676 0.000 0.324
#> GSM1124918     2  0.4543    0.57965 0.000 0.676 0.000 0.324
#> GSM1124920     3  0.4961    0.00333 0.448 0.000 0.552 0.000
#> GSM1124922     4  0.3219    0.45261 0.000 0.164 0.000 0.836
#> GSM1124924     2  0.7925    0.32945 0.008 0.456 0.236 0.300
#> GSM1124926     4  0.3074    0.45035 0.000 0.152 0.000 0.848
#> GSM1124928     1  0.4153    0.66043 0.784 0.004 0.204 0.008
#> GSM1124930     2  0.2737    0.50597 0.000 0.888 0.008 0.104
#> GSM1124931     4  0.3123    0.44547 0.000 0.156 0.000 0.844
#> GSM1124935     2  0.4431    0.57392 0.000 0.696 0.000 0.304
#> GSM1124936     3  0.5277   -0.05081 0.460 0.000 0.532 0.008
#> GSM1124938     2  0.6811   -0.02146 0.000 0.496 0.404 0.100
#> GSM1124940     1  0.0188    0.74535 0.996 0.000 0.004 0.000
#> GSM1124941     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124942     2  0.1637    0.47969 0.000 0.940 0.000 0.060
#> GSM1124943     2  0.6400    0.22351 0.000 0.632 0.252 0.116
#> GSM1124948     2  0.4720    0.57857 0.000 0.672 0.004 0.324
#> GSM1124949     1  0.0000    0.74511 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124954     3  0.5263   -0.00907 0.448 0.000 0.544 0.008
#> GSM1124955     1  0.4534    0.67930 0.800 0.000 0.068 0.132
#> GSM1124956     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124872     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124873     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124876     3  0.0000    0.67076 0.000 0.000 1.000 0.000
#> GSM1124877     1  0.0000    0.74511 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.3157    0.69913 0.852 0.004 0.144 0.000
#> GSM1124883     2  0.3356    0.31455 0.000 0.824 0.000 0.176
#> GSM1124889     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124892     1  0.0336    0.74299 0.992 0.000 0.000 0.008
#> GSM1124893     1  0.0000    0.74511 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124913     2  0.4406    0.14419 0.000 0.700 0.000 0.300
#> GSM1124916     2  0.4713    0.57555 0.000 0.640 0.000 0.360
#> GSM1124923     2  0.4454   -0.26052 0.000 0.692 0.000 0.308
#> GSM1124925     1  0.3569    0.66752 0.804 0.000 0.196 0.000
#> GSM1124929     1  0.0000    0.74511 1.000 0.000 0.000 0.000
#> GSM1124934     1  0.5163    0.12326 0.516 0.004 0.480 0.000
#> GSM1124937     2  0.5047    0.57388 0.004 0.636 0.004 0.356

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1124891     3  0.0451     0.8056 0.004 0.000 0.988 0.000 0.008
#> GSM1124888     3  0.0000     0.8071 0.000 0.000 1.000 0.000 0.000
#> GSM1124890     5  0.7502     0.6827 0.000 0.212 0.088 0.196 0.504
#> GSM1124904     4  0.2074     0.7051 0.000 0.104 0.000 0.896 0.000
#> GSM1124927     2  0.6827     0.3209 0.056 0.464 0.000 0.088 0.392
#> GSM1124953     4  0.5762     0.2126 0.000 0.144 0.000 0.608 0.248
#> GSM1124869     1  0.0794     0.7910 0.972 0.000 0.000 0.000 0.028
#> GSM1124870     1  0.8137     0.5812 0.540 0.080 0.164 0.092 0.124
#> GSM1124882     1  0.1725     0.7955 0.936 0.000 0.020 0.000 0.044
#> GSM1124884     2  0.0000     0.5683 0.000 1.000 0.000 0.000 0.000
#> GSM1124898     2  0.2077     0.5150 0.000 0.908 0.000 0.084 0.008
#> GSM1124903     4  0.2329     0.7087 0.000 0.124 0.000 0.876 0.000
#> GSM1124905     1  0.6303     0.6789 0.652 0.000 0.164 0.092 0.092
#> GSM1124910     1  0.5309     0.7238 0.720 0.000 0.168 0.040 0.072
#> GSM1124919     4  0.6765    -0.3241 0.000 0.344 0.000 0.384 0.272
#> GSM1124932     2  0.6840     0.3114 0.048 0.456 0.000 0.100 0.396
#> GSM1124933     3  0.0000     0.8071 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     2  0.4066     0.3535 0.004 0.672 0.000 0.000 0.324
#> GSM1124868     4  0.2677     0.7064 0.000 0.112 0.000 0.872 0.016
#> GSM1124878     4  0.2329     0.7087 0.000 0.124 0.000 0.876 0.000
#> GSM1124895     4  0.3752     0.5524 0.000 0.292 0.000 0.708 0.000
#> GSM1124897     4  0.2377     0.7069 0.000 0.128 0.000 0.872 0.000
#> GSM1124902     4  0.3143     0.6429 0.000 0.204 0.000 0.796 0.000
#> GSM1124908     4  0.3409     0.5828 0.000 0.112 0.000 0.836 0.052
#> GSM1124921     4  0.0880     0.6427 0.000 0.000 0.000 0.968 0.032
#> GSM1124939     4  0.4210     0.3789 0.000 0.412 0.000 0.588 0.000
#> GSM1124944     4  0.4583     0.4859 0.000 0.112 0.000 0.748 0.140
#> GSM1124945     3  0.7294     0.1469 0.000 0.148 0.552 0.120 0.180
#> GSM1124946     4  0.1197     0.6416 0.000 0.000 0.000 0.952 0.048
#> GSM1124947     4  0.6244    -0.0397 0.000 0.412 0.000 0.444 0.144
#> GSM1124951     3  0.4849     0.4603 0.000 0.136 0.724 0.000 0.140
#> GSM1124952     2  0.6080     0.3005 0.000 0.572 0.000 0.200 0.228
#> GSM1124957     3  0.0000     0.8071 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     1  0.7510     0.6359 0.584 0.036 0.164 0.092 0.124
#> GSM1124914     2  0.4045     0.1813 0.000 0.644 0.000 0.356 0.000
#> GSM1124871     2  0.0000     0.5683 0.000 1.000 0.000 0.000 0.000
#> GSM1124874     2  0.3359     0.5202 0.020 0.816 0.000 0.000 0.164
#> GSM1124875     2  0.2149     0.5164 0.000 0.916 0.000 0.048 0.036
#> GSM1124880     2  0.8410    -0.1031 0.216 0.336 0.168 0.000 0.280
#> GSM1124881     2  0.0290     0.5704 0.000 0.992 0.000 0.000 0.008
#> GSM1124885     4  0.2329     0.7087 0.000 0.124 0.000 0.876 0.000
#> GSM1124886     1  0.1331     0.7805 0.952 0.000 0.008 0.000 0.040
#> GSM1124887     4  0.0963     0.6423 0.000 0.000 0.000 0.964 0.036
#> GSM1124894     1  0.9244     0.3220 0.356 0.092 0.164 0.116 0.272
#> GSM1124896     1  0.6742     0.6519 0.612 0.000 0.164 0.096 0.128
#> GSM1124899     2  0.2648     0.5371 0.000 0.848 0.000 0.000 0.152
#> GSM1124901     2  0.4108     0.1887 0.000 0.684 0.000 0.308 0.008
#> GSM1124906     2  0.4697     0.4828 0.036 0.660 0.000 0.000 0.304
#> GSM1124907     2  0.6749    -0.4898 0.000 0.388 0.000 0.348 0.264
#> GSM1124911     2  0.2377     0.5470 0.000 0.872 0.000 0.000 0.128
#> GSM1124912     1  0.1197     0.7884 0.952 0.000 0.000 0.000 0.048
#> GSM1124915     2  0.4517    -0.1730 0.000 0.556 0.000 0.436 0.008
#> GSM1124917     2  0.0703     0.5562 0.000 0.976 0.000 0.024 0.000
#> GSM1124918     2  0.2103     0.5348 0.000 0.920 0.004 0.020 0.056
#> GSM1124920     3  0.3810     0.6942 0.176 0.000 0.788 0.000 0.036
#> GSM1124922     2  0.6049     0.3044 0.000 0.576 0.000 0.192 0.232
#> GSM1124924     2  0.6346    -0.0835 0.004 0.516 0.160 0.000 0.320
#> GSM1124926     2  0.6202     0.2781 0.000 0.552 0.000 0.220 0.228
#> GSM1124928     1  0.4712     0.7301 0.732 0.000 0.168 0.000 0.100
#> GSM1124930     5  0.5868     0.7722 0.000 0.392 0.004 0.088 0.516
#> GSM1124931     2  0.7167     0.2918 0.000 0.444 0.032 0.192 0.332
#> GSM1124935     2  0.1408     0.5477 0.000 0.948 0.000 0.044 0.008
#> GSM1124936     3  0.4587     0.6386 0.204 0.000 0.728 0.000 0.068
#> GSM1124938     5  0.7087     0.8010 0.000 0.292 0.076 0.112 0.520
#> GSM1124940     1  0.1357     0.7899 0.948 0.000 0.004 0.000 0.048
#> GSM1124941     2  0.2516     0.5570 0.000 0.860 0.000 0.000 0.140
#> GSM1124942     2  0.6742    -0.5302 0.000 0.412 0.000 0.296 0.292
#> GSM1124943     5  0.5960     0.7885 0.000 0.396 0.004 0.096 0.504
#> GSM1124948     2  0.4705    -0.0926 0.000 0.504 0.008 0.004 0.484
#> GSM1124949     1  0.0703     0.7895 0.976 0.000 0.000 0.000 0.024
#> GSM1124950     2  0.2516     0.5570 0.000 0.860 0.000 0.000 0.140
#> GSM1124954     3  0.4421     0.6655 0.184 0.000 0.748 0.000 0.068
#> GSM1124955     1  0.3379     0.7856 0.860 0.000 0.076 0.024 0.040
#> GSM1124956     2  0.0510     0.5710 0.000 0.984 0.000 0.000 0.016
#> GSM1124872     2  0.2516     0.5570 0.000 0.860 0.000 0.000 0.140
#> GSM1124873     2  0.0162     0.5698 0.000 0.996 0.000 0.000 0.004
#> GSM1124876     3  0.0000     0.8071 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     1  0.0880     0.7900 0.968 0.000 0.000 0.000 0.032
#> GSM1124879     1  0.3992     0.7629 0.796 0.000 0.124 0.000 0.080
#> GSM1124883     4  0.4161     0.3898 0.000 0.392 0.000 0.608 0.000
#> GSM1124889     2  0.0000     0.5683 0.000 1.000 0.000 0.000 0.000
#> GSM1124892     1  0.1444     0.7792 0.948 0.000 0.012 0.000 0.040
#> GSM1124893     1  0.0404     0.7925 0.988 0.000 0.000 0.000 0.012
#> GSM1124909     2  0.3177     0.5084 0.000 0.792 0.000 0.000 0.208
#> GSM1124913     4  0.2329     0.7087 0.000 0.124 0.000 0.876 0.000
#> GSM1124916     2  0.2561     0.5563 0.000 0.856 0.000 0.000 0.144
#> GSM1124923     4  0.5982     0.1955 0.000 0.132 0.004 0.580 0.284
#> GSM1124925     1  0.3944     0.7485 0.788 0.000 0.160 0.000 0.052
#> GSM1124929     1  0.1043     0.7830 0.960 0.000 0.000 0.000 0.040
#> GSM1124934     1  0.6744     0.1193 0.400 0.000 0.332 0.000 0.268
#> GSM1124937     2  0.4553     0.2233 0.008 0.604 0.004 0.000 0.384

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.0713      0.877 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM1124888     3  0.0000      0.880 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124890     5  0.2725      0.836 0.000 0.020 0.060 0.004 0.884 0.032
#> GSM1124904     4  0.0000      0.927 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124927     2  0.2547      0.852 0.000 0.868 0.000 0.016 0.004 0.112
#> GSM1124953     5  0.1285      0.877 0.000 0.004 0.000 0.052 0.944 0.000
#> GSM1124869     1  0.0603      0.921 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM1124870     1  0.3815      0.838 0.808 0.024 0.040 0.000 0.008 0.120
#> GSM1124882     1  0.0291      0.923 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM1124884     2  0.0291      0.882 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM1124898     2  0.2768      0.765 0.000 0.832 0.000 0.156 0.012 0.000
#> GSM1124903     4  0.0000      0.927 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124905     1  0.2675      0.886 0.876 0.000 0.040 0.000 0.008 0.076
#> GSM1124910     1  0.2925      0.879 0.860 0.000 0.052 0.000 0.008 0.080
#> GSM1124919     5  0.2651      0.866 0.000 0.028 0.000 0.112 0.860 0.000
#> GSM1124932     2  0.2611      0.857 0.000 0.876 0.004 0.016 0.008 0.096
#> GSM1124933     3  0.0000      0.880 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     6  0.3619      0.628 0.000 0.316 0.000 0.000 0.004 0.680
#> GSM1124868     4  0.0000      0.927 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124878     4  0.0000      0.927 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124895     4  0.0146      0.926 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1124897     4  0.0000      0.927 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124902     4  0.1141      0.897 0.000 0.052 0.000 0.948 0.000 0.000
#> GSM1124908     4  0.3107      0.788 0.000 0.116 0.000 0.832 0.052 0.000
#> GSM1124921     4  0.1075      0.908 0.000 0.000 0.000 0.952 0.048 0.000
#> GSM1124939     4  0.3634      0.415 0.000 0.356 0.000 0.644 0.000 0.000
#> GSM1124944     5  0.3445      0.728 0.000 0.012 0.000 0.244 0.744 0.000
#> GSM1124945     3  0.4180      0.513 0.000 0.012 0.632 0.008 0.348 0.000
#> GSM1124946     4  0.1007      0.910 0.000 0.000 0.000 0.956 0.044 0.000
#> GSM1124947     2  0.2443      0.835 0.000 0.880 0.000 0.096 0.020 0.004
#> GSM1124951     3  0.3940      0.558 0.000 0.000 0.652 0.008 0.336 0.004
#> GSM1124952     2  0.2059      0.871 0.000 0.924 0.024 0.024 0.020 0.008
#> GSM1124957     3  0.0405      0.877 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM1124900     1  0.3763      0.834 0.800 0.012 0.040 0.000 0.008 0.140
#> GSM1124914     2  0.3945      0.430 0.000 0.612 0.000 0.380 0.008 0.000
#> GSM1124871     2  0.0551      0.881 0.000 0.984 0.000 0.008 0.004 0.004
#> GSM1124874     2  0.0951      0.880 0.000 0.968 0.000 0.020 0.008 0.004
#> GSM1124875     2  0.2629      0.825 0.000 0.868 0.000 0.040 0.092 0.000
#> GSM1124880     6  0.2081      0.737 0.000 0.036 0.036 0.000 0.012 0.916
#> GSM1124881     2  0.0508      0.882 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM1124885     4  0.0000      0.927 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124886     1  0.0000      0.922 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     4  0.1007      0.910 0.000 0.000 0.000 0.956 0.044 0.000
#> GSM1124894     1  0.5547      0.540 0.648 0.224 0.040 0.000 0.012 0.076
#> GSM1124896     1  0.2051      0.904 0.916 0.000 0.036 0.000 0.008 0.040
#> GSM1124899     2  0.0436      0.882 0.000 0.988 0.000 0.004 0.004 0.004
#> GSM1124901     2  0.3975      0.363 0.000 0.600 0.000 0.392 0.008 0.000
#> GSM1124906     2  0.1732      0.872 0.000 0.920 0.000 0.004 0.004 0.072
#> GSM1124907     5  0.2633      0.868 0.000 0.032 0.000 0.104 0.864 0.000
#> GSM1124911     2  0.0603      0.882 0.000 0.980 0.000 0.016 0.000 0.004
#> GSM1124912     1  0.0603      0.921 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM1124915     4  0.2212      0.834 0.000 0.112 0.000 0.880 0.008 0.000
#> GSM1124917     2  0.0951      0.881 0.000 0.968 0.000 0.008 0.020 0.004
#> GSM1124918     2  0.4159      0.764 0.000 0.776 0.012 0.008 0.072 0.132
#> GSM1124920     3  0.1755      0.865 0.028 0.000 0.932 0.000 0.008 0.032
#> GSM1124922     2  0.1508      0.879 0.000 0.948 0.004 0.016 0.020 0.012
#> GSM1124924     6  0.2535      0.764 0.000 0.064 0.036 0.000 0.012 0.888
#> GSM1124926     2  0.1251      0.878 0.000 0.956 0.000 0.024 0.012 0.008
#> GSM1124928     1  0.3255      0.869 0.840 0.004 0.048 0.000 0.008 0.100
#> GSM1124930     5  0.2216      0.883 0.000 0.016 0.000 0.052 0.908 0.024
#> GSM1124931     2  0.3282      0.838 0.000 0.844 0.020 0.020 0.012 0.104
#> GSM1124935     2  0.2019      0.825 0.000 0.900 0.000 0.088 0.012 0.000
#> GSM1124936     3  0.2563      0.820 0.084 0.000 0.880 0.000 0.008 0.028
#> GSM1124938     5  0.2823      0.835 0.000 0.016 0.060 0.008 0.880 0.036
#> GSM1124940     1  0.0603      0.921 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM1124941     2  0.1753      0.864 0.000 0.912 0.000 0.000 0.004 0.084
#> GSM1124942     5  0.1719      0.880 0.000 0.032 0.000 0.032 0.932 0.004
#> GSM1124943     5  0.2687      0.843 0.000 0.028 0.052 0.004 0.888 0.028
#> GSM1124948     6  0.3150      0.771 0.000 0.096 0.024 0.000 0.032 0.848
#> GSM1124949     1  0.0000      0.922 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.2302      0.846 0.000 0.872 0.000 0.000 0.008 0.120
#> GSM1124954     3  0.1542      0.864 0.004 0.000 0.936 0.000 0.008 0.052
#> GSM1124955     1  0.0870      0.923 0.972 0.000 0.012 0.000 0.012 0.004
#> GSM1124956     2  0.0291      0.882 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM1124872     2  0.2257      0.848 0.000 0.876 0.000 0.000 0.008 0.116
#> GSM1124873     2  0.0508      0.882 0.000 0.984 0.000 0.000 0.004 0.012
#> GSM1124876     3  0.0000      0.880 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     1  0.0146      0.923 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124879     1  0.1262      0.918 0.956 0.000 0.020 0.000 0.008 0.016
#> GSM1124883     4  0.0632      0.914 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM1124889     2  0.0291      0.882 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM1124892     1  0.1434      0.892 0.940 0.000 0.048 0.000 0.000 0.012
#> GSM1124893     1  0.0603      0.921 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM1124909     6  0.3756      0.520 0.000 0.352 0.000 0.000 0.004 0.644
#> GSM1124913     4  0.0000      0.927 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1124916     2  0.2805      0.784 0.000 0.812 0.000 0.000 0.004 0.184
#> GSM1124923     5  0.2889      0.868 0.000 0.020 0.012 0.116 0.852 0.000
#> GSM1124925     1  0.1464      0.918 0.944 0.000 0.036 0.000 0.016 0.004
#> GSM1124929     1  0.0603      0.921 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM1124934     6  0.4249      0.482 0.068 0.000 0.188 0.000 0.008 0.736
#> GSM1124937     6  0.2302      0.772 0.000 0.120 0.000 0.000 0.008 0.872

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 tissue(p) k
#> MAD:mclust 91  0.223736 2
#> MAD:mclust 83  0.053993 3
#> MAD:mclust 51  0.000122 4
#> MAD:mclust 63  0.000433 5
#> MAD:mclust 87  0.034844 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 48983 rows and 91 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 0.844           0.926       0.966         0.4948 0.505   0.505
#> 3 3 0.879           0.919       0.965         0.2352 0.766   0.583
#> 4 4 0.887           0.869       0.943         0.2028 0.790   0.509
#> 5 5 0.825           0.765       0.892         0.0606 0.917   0.705
#> 6 6 0.731           0.525       0.747         0.0482 0.931   0.715

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
#> GSM1124891     1  0.0000      0.957 1.000 0.000
#> GSM1124888     1  0.0000      0.957 1.000 0.000
#> GSM1124890     1  0.6801      0.797 0.820 0.180
#> GSM1124904     2  0.0000      0.968 0.000 1.000
#> GSM1124927     2  0.7815      0.707 0.232 0.768
#> GSM1124953     2  0.8443      0.607 0.272 0.728
#> GSM1124869     1  0.0000      0.957 1.000 0.000
#> GSM1124870     1  0.2236      0.933 0.964 0.036
#> GSM1124882     1  0.0000      0.957 1.000 0.000
#> GSM1124884     2  0.0000      0.968 0.000 1.000
#> GSM1124898     2  0.0000      0.968 0.000 1.000
#> GSM1124903     2  0.0000      0.968 0.000 1.000
#> GSM1124905     1  0.0000      0.957 1.000 0.000
#> GSM1124910     1  0.0000      0.957 1.000 0.000
#> GSM1124919     2  0.0000      0.968 0.000 1.000
#> GSM1124932     2  0.8661      0.614 0.288 0.712
#> GSM1124933     1  0.0000      0.957 1.000 0.000
#> GSM1124867     1  0.8207      0.680 0.744 0.256
#> GSM1124868     2  0.0000      0.968 0.000 1.000
#> GSM1124878     2  0.0000      0.968 0.000 1.000
#> GSM1124895     2  0.0000      0.968 0.000 1.000
#> GSM1124897     2  0.0000      0.968 0.000 1.000
#> GSM1124902     2  0.0000      0.968 0.000 1.000
#> GSM1124908     2  0.0000      0.968 0.000 1.000
#> GSM1124921     2  0.0000      0.968 0.000 1.000
#> GSM1124939     2  0.0000      0.968 0.000 1.000
#> GSM1124944     2  0.0000      0.968 0.000 1.000
#> GSM1124945     1  0.4562      0.884 0.904 0.096
#> GSM1124946     2  0.0000      0.968 0.000 1.000
#> GSM1124947     2  0.0000      0.968 0.000 1.000
#> GSM1124951     1  0.7219      0.772 0.800 0.200
#> GSM1124952     2  0.0376      0.965 0.004 0.996
#> GSM1124957     1  0.0000      0.957 1.000 0.000
#> GSM1124900     1  0.3879      0.900 0.924 0.076
#> GSM1124914     2  0.0000      0.968 0.000 1.000
#> GSM1124871     2  0.0000      0.968 0.000 1.000
#> GSM1124874     2  0.0000      0.968 0.000 1.000
#> GSM1124875     2  0.0000      0.968 0.000 1.000
#> GSM1124880     1  0.0000      0.957 1.000 0.000
#> GSM1124881     2  0.0000      0.968 0.000 1.000
#> GSM1124885     2  0.0000      0.968 0.000 1.000
#> GSM1124886     1  0.0000      0.957 1.000 0.000
#> GSM1124887     2  0.0000      0.968 0.000 1.000
#> GSM1124894     1  0.8499      0.622 0.724 0.276
#> GSM1124896     1  0.0000      0.957 1.000 0.000
#> GSM1124899     2  0.0000      0.968 0.000 1.000
#> GSM1124901     2  0.0000      0.968 0.000 1.000
#> GSM1124906     2  0.0000      0.968 0.000 1.000
#> GSM1124907     2  0.0000      0.968 0.000 1.000
#> GSM1124911     2  0.0000      0.968 0.000 1.000
#> GSM1124912     1  0.0000      0.957 1.000 0.000
#> GSM1124915     2  0.0000      0.968 0.000 1.000
#> GSM1124917     2  0.0000      0.968 0.000 1.000
#> GSM1124918     2  0.0000      0.968 0.000 1.000
#> GSM1124920     1  0.0000      0.957 1.000 0.000
#> GSM1124922     2  0.5519      0.845 0.128 0.872
#> GSM1124924     1  0.0000      0.957 1.000 0.000
#> GSM1124926     2  0.0000      0.968 0.000 1.000
#> GSM1124928     1  0.0000      0.957 1.000 0.000
#> GSM1124930     2  0.2043      0.940 0.032 0.968
#> GSM1124931     2  0.9358      0.480 0.352 0.648
#> GSM1124935     2  0.0000      0.968 0.000 1.000
#> GSM1124936     1  0.0000      0.957 1.000 0.000
#> GSM1124938     1  0.6973      0.787 0.812 0.188
#> GSM1124940     1  0.0000      0.957 1.000 0.000
#> GSM1124941     2  0.0000      0.968 0.000 1.000
#> GSM1124942     2  0.0000      0.968 0.000 1.000
#> GSM1124943     1  0.7299      0.767 0.796 0.204
#> GSM1124948     1  0.0000      0.957 1.000 0.000
#> GSM1124949     1  0.0000      0.957 1.000 0.000
#> GSM1124950     2  0.0376      0.965 0.004 0.996
#> GSM1124954     1  0.0000      0.957 1.000 0.000
#> GSM1124955     1  0.0000      0.957 1.000 0.000
#> GSM1124956     2  0.0000      0.968 0.000 1.000
#> GSM1124872     2  0.0376      0.965 0.004 0.996
#> GSM1124873     2  0.0000      0.968 0.000 1.000
#> GSM1124876     1  0.0000      0.957 1.000 0.000
#> GSM1124877     1  0.0000      0.957 1.000 0.000
#> GSM1124879     1  0.0000      0.957 1.000 0.000
#> GSM1124883     2  0.0000      0.968 0.000 1.000
#> GSM1124889     2  0.0000      0.968 0.000 1.000
#> GSM1124892     1  0.0000      0.957 1.000 0.000
#> GSM1124893     1  0.0000      0.957 1.000 0.000
#> GSM1124909     2  0.7528      0.733 0.216 0.784
#> GSM1124913     2  0.0000      0.968 0.000 1.000
#> GSM1124916     2  0.2423      0.934 0.040 0.960
#> GSM1124923     2  0.0000      0.968 0.000 1.000
#> GSM1124925     1  0.2778      0.924 0.952 0.048
#> GSM1124929     1  0.0000      0.957 1.000 0.000
#> GSM1124934     1  0.0000      0.957 1.000 0.000
#> GSM1124937     1  0.0000      0.957 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.0000      0.942 0.000 0.000 1.000
#> GSM1124888     3  0.0000      0.942 0.000 0.000 1.000
#> GSM1124890     3  0.3551      0.856 0.000 0.132 0.868
#> GSM1124904     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124927     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124953     2  0.2625      0.894 0.000 0.916 0.084
#> GSM1124869     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124870     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124882     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124884     2  0.0237      0.975 0.004 0.996 0.000
#> GSM1124898     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124903     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124905     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124910     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124919     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124932     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124933     3  0.0000      0.942 0.000 0.000 1.000
#> GSM1124867     1  0.0592      0.926 0.988 0.012 0.000
#> GSM1124868     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124878     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124895     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124897     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124902     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124908     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124921     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124939     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124944     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124945     3  0.0000      0.942 0.000 0.000 1.000
#> GSM1124946     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124947     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124951     3  0.0237      0.941 0.000 0.004 0.996
#> GSM1124952     2  0.3619      0.824 0.136 0.864 0.000
#> GSM1124957     3  0.0000      0.942 0.000 0.000 1.000
#> GSM1124900     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124914     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124871     2  0.0237      0.975 0.004 0.996 0.000
#> GSM1124874     2  0.1031      0.958 0.024 0.976 0.000
#> GSM1124875     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124880     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124881     2  0.0424      0.972 0.008 0.992 0.000
#> GSM1124885     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124886     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124887     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124894     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124896     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124899     2  0.0747      0.966 0.016 0.984 0.000
#> GSM1124901     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124906     1  0.4504      0.728 0.804 0.196 0.000
#> GSM1124907     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124911     2  0.4555      0.734 0.200 0.800 0.000
#> GSM1124912     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124915     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124917     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124918     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124920     3  0.1643      0.918 0.044 0.000 0.956
#> GSM1124922     1  0.4887      0.684 0.772 0.228 0.000
#> GSM1124924     1  0.2878      0.856 0.904 0.000 0.096
#> GSM1124926     2  0.0747      0.966 0.016 0.984 0.000
#> GSM1124928     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124930     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124931     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124935     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124936     1  0.5882      0.447 0.652 0.000 0.348
#> GSM1124938     3  0.0424      0.941 0.000 0.008 0.992
#> GSM1124940     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124941     2  0.5465      0.584 0.288 0.712 0.000
#> GSM1124942     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124943     3  0.4399      0.788 0.000 0.188 0.812
#> GSM1124948     3  0.2796      0.891 0.000 0.092 0.908
#> GSM1124949     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124950     2  0.1031      0.958 0.024 0.976 0.000
#> GSM1124954     3  0.3941      0.809 0.156 0.000 0.844
#> GSM1124955     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124956     1  0.5706      0.547 0.680 0.320 0.000
#> GSM1124872     1  0.5363      0.616 0.724 0.276 0.000
#> GSM1124873     2  0.0424      0.972 0.008 0.992 0.000
#> GSM1124876     3  0.0000      0.942 0.000 0.000 1.000
#> GSM1124877     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124879     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124883     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124889     2  0.0237      0.975 0.004 0.996 0.000
#> GSM1124892     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124893     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124909     1  0.2796      0.851 0.908 0.092 0.000
#> GSM1124913     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124916     1  0.3686      0.799 0.860 0.140 0.000
#> GSM1124923     2  0.0000      0.977 0.000 1.000 0.000
#> GSM1124925     1  0.0000      0.935 1.000 0.000 0.000
#> GSM1124929     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124934     1  0.0237      0.935 0.996 0.000 0.004
#> GSM1124937     1  0.0000      0.935 1.000 0.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
#> GSM1124891     3  0.0336    0.89271 0.000 0.008 0.992 0.000
#> GSM1124888     3  0.0336    0.89271 0.000 0.008 0.992 0.000
#> GSM1124890     3  0.1716    0.85805 0.000 0.000 0.936 0.064
#> GSM1124904     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124927     2  0.1302    0.90473 0.044 0.956 0.000 0.000
#> GSM1124953     4  0.7774   -0.07253 0.000 0.240 0.372 0.388
#> GSM1124869     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.1716    0.91760 0.936 0.064 0.000 0.000
#> GSM1124882     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0817    0.92405 0.000 0.976 0.000 0.024
#> GSM1124898     4  0.1557    0.90027 0.000 0.056 0.000 0.944
#> GSM1124903     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124905     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124910     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124919     4  0.0188    0.93589 0.000 0.004 0.000 0.996
#> GSM1124932     2  0.0592    0.92338 0.016 0.984 0.000 0.000
#> GSM1124933     3  0.0000    0.89300 0.000 0.000 1.000 0.000
#> GSM1124867     2  0.0336    0.92468 0.008 0.992 0.000 0.000
#> GSM1124868     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124878     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124895     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124897     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124902     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124908     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124921     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124939     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124944     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124945     3  0.0000    0.89300 0.000 0.000 1.000 0.000
#> GSM1124946     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124947     4  0.0592    0.92891 0.000 0.016 0.000 0.984
#> GSM1124951     3  0.0336    0.89143 0.000 0.000 0.992 0.008
#> GSM1124952     4  0.7456    0.23749 0.200 0.308 0.000 0.492
#> GSM1124957     3  0.0000    0.89300 0.000 0.000 1.000 0.000
#> GSM1124900     1  0.3074    0.80278 0.848 0.152 0.000 0.000
#> GSM1124914     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124871     2  0.2973    0.80884 0.000 0.856 0.000 0.144
#> GSM1124874     2  0.4999   -0.00721 0.000 0.508 0.000 0.492
#> GSM1124875     4  0.0188    0.93589 0.000 0.004 0.000 0.996
#> GSM1124880     2  0.0336    0.92468 0.008 0.992 0.000 0.000
#> GSM1124881     2  0.1474    0.90619 0.000 0.948 0.000 0.052
#> GSM1124885     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124886     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124887     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124894     1  0.0592    0.96260 0.984 0.016 0.000 0.000
#> GSM1124896     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124899     4  0.1211    0.91305 0.000 0.040 0.000 0.960
#> GSM1124901     4  0.0188    0.93589 0.000 0.004 0.000 0.996
#> GSM1124906     2  0.0188    0.92585 0.000 0.996 0.000 0.004
#> GSM1124907     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124911     2  0.1389    0.91064 0.000 0.952 0.000 0.048
#> GSM1124912     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124915     4  0.2408    0.85515 0.000 0.104 0.000 0.896
#> GSM1124917     2  0.2704    0.83695 0.000 0.876 0.000 0.124
#> GSM1124918     2  0.0336    0.92571 0.000 0.992 0.000 0.008
#> GSM1124920     3  0.2480    0.84083 0.088 0.008 0.904 0.000
#> GSM1124922     1  0.2408    0.84962 0.896 0.000 0.000 0.104
#> GSM1124924     2  0.0000    0.92405 0.000 1.000 0.000 0.000
#> GSM1124926     4  0.1902    0.88333 0.064 0.004 0.000 0.932
#> GSM1124928     1  0.1792    0.90954 0.932 0.068 0.000 0.000
#> GSM1124930     4  0.1109    0.91788 0.000 0.004 0.028 0.968
#> GSM1124931     2  0.0592    0.92276 0.016 0.984 0.000 0.000
#> GSM1124935     4  0.4277    0.59134 0.000 0.280 0.000 0.720
#> GSM1124936     3  0.4999    0.09442 0.492 0.000 0.508 0.000
#> GSM1124938     3  0.0592    0.89108 0.000 0.016 0.984 0.000
#> GSM1124940     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0336    0.92657 0.000 0.992 0.000 0.008
#> GSM1124942     4  0.3550    0.83048 0.000 0.096 0.044 0.860
#> GSM1124943     3  0.3249    0.78770 0.000 0.008 0.852 0.140
#> GSM1124948     2  0.0707    0.91570 0.000 0.980 0.020 0.000
#> GSM1124949     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124950     2  0.0336    0.92678 0.000 0.992 0.000 0.008
#> GSM1124954     3  0.1510    0.88153 0.028 0.016 0.956 0.000
#> GSM1124955     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124956     2  0.1151    0.92368 0.008 0.968 0.000 0.024
#> GSM1124872     2  0.0336    0.92678 0.000 0.992 0.000 0.008
#> GSM1124873     2  0.0817    0.92405 0.000 0.976 0.000 0.024
#> GSM1124876     3  0.0000    0.89300 0.000 0.000 1.000 0.000
#> GSM1124877     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124879     1  0.0188    0.97128 0.996 0.004 0.000 0.000
#> GSM1124883     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124889     2  0.1211    0.91528 0.000 0.960 0.000 0.040
#> GSM1124892     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124909     2  0.0524    0.92548 0.008 0.988 0.000 0.004
#> GSM1124913     4  0.0000    0.93742 0.000 0.000 0.000 1.000
#> GSM1124916     2  0.0336    0.92346 0.008 0.992 0.000 0.000
#> GSM1124923     4  0.0188    0.93500 0.000 0.000 0.004 0.996
#> GSM1124925     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000    0.97419 1.000 0.000 0.000 0.000
#> GSM1124934     3  0.7836    0.28173 0.304 0.288 0.408 0.000
#> GSM1124937     2  0.4382    0.54366 0.296 0.704 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
#> GSM1124891     3  0.2813      0.798 0.000 0.000 0.832 0.168 0.000
#> GSM1124888     3  0.2127      0.825 0.000 0.000 0.892 0.108 0.000
#> GSM1124890     3  0.2674      0.742 0.000 0.000 0.856 0.004 0.140
#> GSM1124904     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124927     2  0.0290      0.754 0.000 0.992 0.000 0.008 0.000
#> GSM1124953     2  0.2471      0.635 0.000 0.864 0.136 0.000 0.000
#> GSM1124869     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.3612      0.674 0.732 0.268 0.000 0.000 0.000
#> GSM1124882     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.3816      0.613 0.000 0.696 0.000 0.304 0.000
#> GSM1124898     5  0.0880      0.931 0.000 0.000 0.000 0.032 0.968
#> GSM1124903     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124905     1  0.1012      0.905 0.968 0.020 0.000 0.012 0.000
#> GSM1124910     1  0.0290      0.916 0.992 0.000 0.000 0.008 0.000
#> GSM1124919     5  0.1549      0.918 0.000 0.016 0.040 0.000 0.944
#> GSM1124932     2  0.2929      0.735 0.000 0.820 0.000 0.180 0.000
#> GSM1124933     3  0.0000      0.843 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     2  0.1478      0.768 0.000 0.936 0.000 0.064 0.000
#> GSM1124868     5  0.0794      0.936 0.000 0.028 0.000 0.000 0.972
#> GSM1124878     5  0.0404      0.943 0.000 0.012 0.000 0.000 0.988
#> GSM1124895     5  0.0510      0.942 0.000 0.016 0.000 0.000 0.984
#> GSM1124897     5  0.0880      0.935 0.000 0.032 0.000 0.000 0.968
#> GSM1124902     5  0.0290      0.944 0.000 0.008 0.000 0.000 0.992
#> GSM1124908     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124921     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124939     5  0.0404      0.943 0.000 0.012 0.000 0.000 0.988
#> GSM1124944     5  0.1544      0.906 0.000 0.068 0.000 0.000 0.932
#> GSM1124945     3  0.1197      0.824 0.000 0.048 0.952 0.000 0.000
#> GSM1124946     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124947     2  0.3693      0.574 0.008 0.824 0.044 0.000 0.124
#> GSM1124951     3  0.0000      0.843 0.000 0.000 1.000 0.000 0.000
#> GSM1124952     2  0.1116      0.727 0.028 0.964 0.004 0.000 0.004
#> GSM1124957     3  0.0000      0.843 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     1  0.4045      0.480 0.644 0.356 0.000 0.000 0.000
#> GSM1124914     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124871     2  0.2439      0.760 0.000 0.876 0.000 0.120 0.004
#> GSM1124874     2  0.0451      0.748 0.000 0.988 0.000 0.004 0.008
#> GSM1124875     5  0.0162      0.944 0.000 0.000 0.000 0.004 0.996
#> GSM1124880     2  0.3003      0.732 0.000 0.812 0.000 0.188 0.000
#> GSM1124881     2  0.4101      0.491 0.000 0.628 0.000 0.372 0.000
#> GSM1124885     5  0.0290      0.944 0.000 0.008 0.000 0.000 0.992
#> GSM1124886     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124894     1  0.3983      0.577 0.660 0.340 0.000 0.000 0.000
#> GSM1124896     1  0.0794      0.905 0.972 0.000 0.000 0.028 0.000
#> GSM1124899     5  0.1851      0.883 0.000 0.000 0.000 0.088 0.912
#> GSM1124901     5  0.0162      0.945 0.000 0.000 0.000 0.004 0.996
#> GSM1124906     2  0.4273      0.290 0.000 0.552 0.000 0.448 0.000
#> GSM1124907     5  0.0290      0.943 0.000 0.000 0.000 0.008 0.992
#> GSM1124911     2  0.4551      0.480 0.000 0.616 0.000 0.368 0.016
#> GSM1124912     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.0703      0.934 0.000 0.024 0.000 0.000 0.976
#> GSM1124917     4  0.5341      0.504 0.000 0.212 0.000 0.664 0.124
#> GSM1124918     4  0.1270      0.719 0.000 0.052 0.000 0.948 0.000
#> GSM1124920     3  0.4021      0.753 0.036 0.000 0.764 0.200 0.000
#> GSM1124922     1  0.3323      0.781 0.844 0.000 0.000 0.056 0.100
#> GSM1124924     4  0.4291     -0.109 0.000 0.464 0.000 0.536 0.000
#> GSM1124926     5  0.4489      0.252 0.420 0.008 0.000 0.000 0.572
#> GSM1124928     1  0.0510      0.911 0.984 0.000 0.000 0.016 0.000
#> GSM1124930     5  0.1270      0.915 0.000 0.000 0.000 0.052 0.948
#> GSM1124931     2  0.0963      0.764 0.000 0.964 0.000 0.036 0.000
#> GSM1124935     5  0.4310      0.394 0.000 0.004 0.000 0.392 0.604
#> GSM1124936     1  0.4161      0.338 0.608 0.000 0.392 0.000 0.000
#> GSM1124938     3  0.2852      0.793 0.000 0.000 0.828 0.172 0.000
#> GSM1124940     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     4  0.3636      0.503 0.000 0.272 0.000 0.728 0.000
#> GSM1124942     5  0.3100      0.851 0.000 0.064 0.020 0.040 0.876
#> GSM1124943     3  0.6213      0.255 0.000 0.000 0.452 0.140 0.408
#> GSM1124948     4  0.2535      0.703 0.000 0.076 0.032 0.892 0.000
#> GSM1124949     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.1478      0.768 0.000 0.936 0.000 0.064 0.000
#> GSM1124954     4  0.3906      0.284 0.004 0.000 0.292 0.704 0.000
#> GSM1124955     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     4  0.4306     -0.191 0.000 0.492 0.000 0.508 0.000
#> GSM1124872     2  0.0963      0.765 0.000 0.964 0.000 0.036 0.000
#> GSM1124873     2  0.4161      0.448 0.000 0.608 0.000 0.392 0.000
#> GSM1124876     3  0.0000      0.843 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     1  0.0290      0.916 0.992 0.000 0.000 0.008 0.000
#> GSM1124879     1  0.0162      0.917 0.996 0.000 0.000 0.004 0.000
#> GSM1124883     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124889     2  0.3366      0.695 0.000 0.768 0.000 0.232 0.000
#> GSM1124892     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     4  0.1851      0.702 0.000 0.088 0.000 0.912 0.000
#> GSM1124913     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124916     4  0.0880      0.718 0.000 0.032 0.000 0.968 0.000
#> GSM1124923     5  0.0000      0.945 0.000 0.000 0.000 0.000 1.000
#> GSM1124925     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM1124934     4  0.1461      0.696 0.028 0.004 0.016 0.952 0.000
#> GSM1124937     4  0.0955      0.703 0.028 0.004 0.000 0.968 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
#> GSM1124891     6  0.4902   -0.31015 0.000 0.000 0.460 0.060 0.000 0.480
#> GSM1124888     3  0.3847    0.35072 0.000 0.000 0.544 0.000 0.000 0.456
#> GSM1124890     3  0.2771    0.69570 0.000 0.000 0.868 0.068 0.060 0.004
#> GSM1124904     5  0.0000    0.75530 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1124927     2  0.1910    0.66180 0.000 0.892 0.000 0.108 0.000 0.000
#> GSM1124953     2  0.5847    0.22061 0.000 0.484 0.284 0.232 0.000 0.000
#> GSM1124869     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.3888    0.53717 0.672 0.312 0.000 0.016 0.000 0.000
#> GSM1124882     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.3222    0.67499 0.000 0.844 0.000 0.096 0.024 0.036
#> GSM1124898     5  0.4616    0.44092 0.000 0.000 0.000 0.316 0.624 0.060
#> GSM1124903     5  0.0000    0.75530 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1124905     1  0.5557    0.27532 0.512 0.004 0.000 0.356 0.000 0.128
#> GSM1124910     1  0.3431    0.64818 0.756 0.016 0.000 0.000 0.000 0.228
#> GSM1124919     5  0.5907    0.22446 0.000 0.004 0.320 0.196 0.480 0.000
#> GSM1124932     2  0.1865    0.69692 0.000 0.920 0.000 0.040 0.000 0.040
#> GSM1124933     3  0.0000    0.79650 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     2  0.1713    0.69375 0.000 0.928 0.000 0.044 0.000 0.028
#> GSM1124868     5  0.3499    0.46457 0.000 0.000 0.000 0.320 0.680 0.000
#> GSM1124878     5  0.0146    0.75576 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM1124895     4  0.3868   -0.02913 0.000 0.000 0.000 0.508 0.492 0.000
#> GSM1124897     5  0.3409    0.49908 0.000 0.000 0.000 0.300 0.700 0.000
#> GSM1124902     5  0.3817    0.02934 0.000 0.000 0.000 0.432 0.568 0.000
#> GSM1124908     5  0.0790    0.75088 0.000 0.000 0.000 0.032 0.968 0.000
#> GSM1124921     5  0.0603    0.75490 0.000 0.000 0.000 0.016 0.980 0.004
#> GSM1124939     4  0.3843    0.09644 0.000 0.000 0.000 0.548 0.452 0.000
#> GSM1124944     4  0.3965    0.23139 0.000 0.004 0.004 0.616 0.376 0.000
#> GSM1124945     3  0.0692    0.78598 0.000 0.020 0.976 0.004 0.000 0.000
#> GSM1124946     5  0.0000    0.75530 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1124947     4  0.4460   -0.00639 0.000 0.404 0.004 0.568 0.024 0.000
#> GSM1124951     3  0.0865    0.78019 0.000 0.000 0.964 0.000 0.036 0.000
#> GSM1124952     2  0.3830    0.29854 0.004 0.620 0.000 0.376 0.000 0.000
#> GSM1124957     3  0.0000    0.79650 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     1  0.3371    0.57796 0.708 0.292 0.000 0.000 0.000 0.000
#> GSM1124914     5  0.1007    0.74675 0.000 0.000 0.000 0.044 0.956 0.000
#> GSM1124871     2  0.1492    0.70938 0.000 0.940 0.000 0.036 0.000 0.024
#> GSM1124874     2  0.3695    0.34768 0.000 0.624 0.000 0.376 0.000 0.000
#> GSM1124875     5  0.1716    0.72996 0.000 0.028 0.000 0.004 0.932 0.036
#> GSM1124880     2  0.1265    0.70615 0.000 0.948 0.000 0.008 0.000 0.044
#> GSM1124881     2  0.4913    0.47775 0.000 0.588 0.000 0.332 0.000 0.080
#> GSM1124885     5  0.3175    0.55691 0.000 0.000 0.000 0.256 0.744 0.000
#> GSM1124886     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124887     5  0.0000    0.75530 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1124894     4  0.6288    0.05049 0.324 0.204 0.000 0.452 0.000 0.020
#> GSM1124896     1  0.1257    0.83695 0.952 0.000 0.000 0.020 0.000 0.028
#> GSM1124899     5  0.5130    0.57781 0.000 0.080 0.000 0.124 0.708 0.088
#> GSM1124901     5  0.1701    0.73032 0.000 0.000 0.000 0.072 0.920 0.008
#> GSM1124906     2  0.3367    0.65408 0.000 0.816 0.000 0.080 0.000 0.104
#> GSM1124907     5  0.2219    0.66802 0.000 0.000 0.000 0.000 0.864 0.136
#> GSM1124911     2  0.4940    0.34491 0.000 0.532 0.000 0.400 0.000 0.068
#> GSM1124912     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     5  0.1320    0.74199 0.000 0.036 0.000 0.016 0.948 0.000
#> GSM1124917     4  0.6227   -0.34577 0.000 0.264 0.000 0.524 0.036 0.176
#> GSM1124918     6  0.4513    0.26517 0.000 0.312 0.000 0.044 0.004 0.640
#> GSM1124920     6  0.4473   -0.24810 0.036 0.000 0.380 0.000 0.000 0.584
#> GSM1124922     1  0.3952    0.70344 0.804 0.012 0.000 0.116 0.036 0.032
#> GSM1124924     6  0.4258   -0.02447 0.000 0.468 0.000 0.016 0.000 0.516
#> GSM1124926     1  0.5913    0.06017 0.496 0.004 0.000 0.220 0.280 0.000
#> GSM1124928     1  0.1714    0.81432 0.908 0.000 0.000 0.000 0.000 0.092
#> GSM1124930     5  0.5575    0.35968 0.000 0.000 0.000 0.168 0.528 0.304
#> GSM1124931     2  0.0632    0.70178 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM1124935     5  0.5735    0.21704 0.000 0.000 0.000 0.296 0.504 0.200
#> GSM1124936     1  0.3857    0.16555 0.532 0.000 0.468 0.000 0.000 0.000
#> GSM1124938     3  0.3989    0.32912 0.000 0.004 0.528 0.000 0.000 0.468
#> GSM1124940     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.4897    0.41333 0.000 0.616 0.000 0.092 0.000 0.292
#> GSM1124942     5  0.6170    0.06772 0.000 0.176 0.012 0.004 0.460 0.348
#> GSM1124943     6  0.6602   -0.22384 0.000 0.000 0.368 0.040 0.196 0.396
#> GSM1124948     6  0.3916    0.29578 0.000 0.300 0.000 0.020 0.000 0.680
#> GSM1124949     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.0363    0.70339 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM1124954     6  0.5392    0.38635 0.012 0.000 0.128 0.252 0.000 0.608
#> GSM1124955     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     2  0.5432    0.27195 0.000 0.500 0.000 0.376 0.000 0.124
#> GSM1124872     2  0.0632    0.70298 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM1124873     2  0.4996    0.42706 0.000 0.604 0.000 0.296 0.000 0.100
#> GSM1124876     3  0.0146    0.79587 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM1124877     1  0.0146    0.85837 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124879     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124883     5  0.0363    0.75570 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM1124889     2  0.3395    0.65649 0.000 0.812 0.000 0.136 0.004 0.048
#> GSM1124892     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124893     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     6  0.5937    0.27264 0.000 0.220 0.000 0.352 0.000 0.428
#> GSM1124913     5  0.0000    0.75530 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1124916     6  0.5713    0.34596 0.000 0.172 0.000 0.352 0.000 0.476
#> GSM1124923     5  0.0713    0.74767 0.000 0.000 0.028 0.000 0.972 0.000
#> GSM1124925     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.0000    0.85997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124934     6  0.3878    0.46038 0.004 0.004 0.000 0.348 0.000 0.644
#> GSM1124937     6  0.4365    0.45975 0.024 0.008 0.000 0.332 0.000 0.636

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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.548           0.845       0.919          0.308 0.752   0.752
#> 3 3 0.585           0.780       0.876          0.187 0.993   0.990
#> 4 4 0.518           0.776       0.864          0.585 0.649   0.533
#> 5 5 0.578           0.600       0.809          0.148 0.936   0.845
#> 6 6 0.673           0.692       0.827          0.102 0.892   0.711

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1  0.0000     0.9354 1.000 0.000
#> GSM1124888     1  0.0376     0.9337 0.996 0.004
#> GSM1124890     2  0.8861     0.6759 0.304 0.696
#> GSM1124904     2  0.0000     0.9031 0.000 1.000
#> GSM1124927     2  0.0000     0.9031 0.000 1.000
#> GSM1124953     2  0.8909     0.6701 0.308 0.692
#> GSM1124869     2  0.7299     0.7947 0.204 0.796
#> GSM1124870     2  0.6973     0.8070 0.188 0.812
#> GSM1124882     2  0.7056     0.8042 0.192 0.808
#> GSM1124884     2  0.0000     0.9031 0.000 1.000
#> GSM1124898     2  0.0000     0.9031 0.000 1.000
#> GSM1124903     2  0.0000     0.9031 0.000 1.000
#> GSM1124905     2  0.6801     0.8125 0.180 0.820
#> GSM1124910     2  0.8267     0.7353 0.260 0.740
#> GSM1124919     2  0.8909     0.6701 0.308 0.692
#> GSM1124932     2  0.0376     0.9013 0.004 0.996
#> GSM1124933     1  0.0000     0.9354 1.000 0.000
#> GSM1124867     2  0.6048     0.8346 0.148 0.852
#> GSM1124868     2  0.0000     0.9031 0.000 1.000
#> GSM1124878     2  0.0000     0.9031 0.000 1.000
#> GSM1124895     2  0.0000     0.9031 0.000 1.000
#> GSM1124897     2  0.0000     0.9031 0.000 1.000
#> GSM1124902     2  0.0000     0.9031 0.000 1.000
#> GSM1124908     2  0.0000     0.9031 0.000 1.000
#> GSM1124921     2  0.0376     0.9018 0.004 0.996
#> GSM1124939     2  0.0000     0.9031 0.000 1.000
#> GSM1124944     2  0.0376     0.9018 0.004 0.996
#> GSM1124945     1  0.0000     0.9354 1.000 0.000
#> GSM1124946     2  0.0000     0.9031 0.000 1.000
#> GSM1124947     2  0.0376     0.9020 0.004 0.996
#> GSM1124951     1  0.0000     0.9354 1.000 0.000
#> GSM1124952     2  0.0000     0.9031 0.000 1.000
#> GSM1124957     1  0.0000     0.9354 1.000 0.000
#> GSM1124900     2  0.6973     0.8070 0.188 0.812
#> GSM1124914     2  0.0000     0.9031 0.000 1.000
#> GSM1124871     2  0.0000     0.9031 0.000 1.000
#> GSM1124874     2  0.0000     0.9031 0.000 1.000
#> GSM1124875     2  0.0000     0.9031 0.000 1.000
#> GSM1124880     2  0.7139     0.8010 0.196 0.804
#> GSM1124881     2  0.1843     0.8931 0.028 0.972
#> GSM1124885     2  0.0000     0.9031 0.000 1.000
#> GSM1124886     2  0.9815     0.4482 0.420 0.580
#> GSM1124887     2  0.0000     0.9031 0.000 1.000
#> GSM1124894     2  0.0000     0.9031 0.000 1.000
#> GSM1124896     2  0.0000     0.9031 0.000 1.000
#> GSM1124899     2  0.0000     0.9031 0.000 1.000
#> GSM1124901     2  0.0000     0.9031 0.000 1.000
#> GSM1124906     2  0.0000     0.9031 0.000 1.000
#> GSM1124907     2  0.0000     0.9031 0.000 1.000
#> GSM1124911     2  0.0000     0.9031 0.000 1.000
#> GSM1124912     2  0.6887     0.8097 0.184 0.816
#> GSM1124915     2  0.0000     0.9031 0.000 1.000
#> GSM1124917     2  0.0000     0.9031 0.000 1.000
#> GSM1124918     2  0.0000     0.9031 0.000 1.000
#> GSM1124920     1  0.3114     0.8923 0.944 0.056
#> GSM1124922     2  0.0000     0.9031 0.000 1.000
#> GSM1124924     2  0.8713     0.6944 0.292 0.708
#> GSM1124926     2  0.0000     0.9031 0.000 1.000
#> GSM1124928     2  0.7139     0.8010 0.196 0.804
#> GSM1124930     2  0.7883     0.7633 0.236 0.764
#> GSM1124931     2  0.0000     0.9031 0.000 1.000
#> GSM1124935     2  0.0376     0.9013 0.004 0.996
#> GSM1124936     1  0.0000     0.9354 1.000 0.000
#> GSM1124938     1  0.9866     0.0108 0.568 0.432
#> GSM1124940     2  0.6887     0.8097 0.184 0.816
#> GSM1124941     2  0.0000     0.9031 0.000 1.000
#> GSM1124942     2  0.0000     0.9031 0.000 1.000
#> GSM1124943     2  0.9522     0.5555 0.372 0.628
#> GSM1124948     2  0.8713     0.6944 0.292 0.708
#> GSM1124949     2  0.7299     0.7947 0.204 0.796
#> GSM1124950     2  0.0000     0.9031 0.000 1.000
#> GSM1124954     1  0.0000     0.9354 1.000 0.000
#> GSM1124955     2  0.6887     0.8097 0.184 0.816
#> GSM1124956     2  0.0000     0.9031 0.000 1.000
#> GSM1124872     2  0.0000     0.9031 0.000 1.000
#> GSM1124873     2  0.0000     0.9031 0.000 1.000
#> GSM1124876     1  0.0000     0.9354 1.000 0.000
#> GSM1124877     1  0.5842     0.7956 0.860 0.140
#> GSM1124879     2  0.7299     0.7942 0.204 0.796
#> GSM1124883     2  0.0000     0.9031 0.000 1.000
#> GSM1124889     2  0.0000     0.9031 0.000 1.000
#> GSM1124892     2  0.9815     0.4482 0.420 0.580
#> GSM1124893     2  0.6887     0.8097 0.184 0.816
#> GSM1124909     2  0.3733     0.8731 0.072 0.928
#> GSM1124913     2  0.0000     0.9031 0.000 1.000
#> GSM1124916     2  0.2043     0.8913 0.032 0.968
#> GSM1124923     2  0.8909     0.6701 0.308 0.692
#> GSM1124925     2  0.0000     0.9031 0.000 1.000
#> GSM1124929     2  0.7056     0.8042 0.192 0.808
#> GSM1124934     1  0.1184     0.9266 0.984 0.016
#> GSM1124937     2  0.8144     0.7459 0.252 0.748

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.4974     0.8079 0.236 0.000 0.764
#> GSM1124888     3  0.4702     0.7874 0.212 0.000 0.788
#> GSM1124890     2  0.6373     0.5986 0.004 0.588 0.408
#> GSM1124904     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124927     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124953     2  0.6168     0.5967 0.000 0.588 0.412
#> GSM1124869     2  0.6172     0.7115 0.012 0.680 0.308
#> GSM1124870     2  0.6051     0.7242 0.012 0.696 0.292
#> GSM1124882     2  0.6082     0.7213 0.012 0.692 0.296
#> GSM1124884     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124898     2  0.1015     0.8612 0.012 0.980 0.008
#> GSM1124903     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124905     2  0.5986     0.7297 0.012 0.704 0.284
#> GSM1124910     2  0.6510     0.6509 0.012 0.624 0.364
#> GSM1124919     2  0.6168     0.5967 0.000 0.588 0.412
#> GSM1124932     2  0.0237     0.8615 0.004 0.996 0.000
#> GSM1124933     3  0.4974     0.8079 0.236 0.000 0.764
#> GSM1124867     2  0.5659     0.7550 0.012 0.740 0.248
#> GSM1124868     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124878     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124895     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124897     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124902     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124908     2  0.1170     0.8609 0.016 0.976 0.008
#> GSM1124921     2  0.1337     0.8601 0.012 0.972 0.016
#> GSM1124939     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124944     2  0.1491     0.8593 0.016 0.968 0.016
#> GSM1124945     3  0.4974     0.8079 0.236 0.000 0.764
#> GSM1124946     2  0.1170     0.8609 0.016 0.976 0.008
#> GSM1124947     2  0.1337     0.8604 0.016 0.972 0.012
#> GSM1124951     3  0.4974     0.8079 0.236 0.000 0.764
#> GSM1124952     2  0.0237     0.8629 0.000 0.996 0.004
#> GSM1124957     3  0.4974     0.8079 0.236 0.000 0.764
#> GSM1124900     2  0.6051     0.7242 0.012 0.696 0.292
#> GSM1124914     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124871     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124874     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124875     2  0.1170     0.8609 0.016 0.976 0.008
#> GSM1124880     2  0.6113     0.7180 0.012 0.688 0.300
#> GSM1124881     2  0.2446     0.8485 0.012 0.936 0.052
#> GSM1124885     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124886     2  0.8911     0.4740 0.176 0.564 0.260
#> GSM1124887     2  0.1170     0.8609 0.016 0.976 0.008
#> GSM1124894     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124896     2  0.0237     0.8628 0.004 0.996 0.000
#> GSM1124899     2  0.0983     0.8612 0.016 0.980 0.004
#> GSM1124901     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124906     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124907     2  0.1170     0.8609 0.016 0.976 0.008
#> GSM1124911     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124912     2  0.6019     0.7268 0.012 0.700 0.288
#> GSM1124915     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124917     2  0.1170     0.8609 0.016 0.976 0.008
#> GSM1124918     2  0.0983     0.8612 0.016 0.980 0.004
#> GSM1124920     3  0.2796     0.6046 0.092 0.000 0.908
#> GSM1124922     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124924     2  0.6783     0.6071 0.016 0.588 0.396
#> GSM1124926     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124928     2  0.6113     0.7180 0.012 0.688 0.300
#> GSM1124930     2  0.6521     0.6753 0.016 0.644 0.340
#> GSM1124931     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124935     2  0.0237     0.8615 0.004 0.996 0.000
#> GSM1124936     3  0.4974     0.8079 0.236 0.000 0.764
#> GSM1124938     3  0.7567    -0.0703 0.048 0.376 0.576
#> GSM1124940     2  0.6019     0.7268 0.012 0.700 0.288
#> GSM1124941     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124942     2  0.1170     0.8609 0.016 0.976 0.008
#> GSM1124943     2  0.6513     0.4753 0.004 0.520 0.476
#> GSM1124948     2  0.6783     0.6071 0.016 0.588 0.396
#> GSM1124949     2  0.6172     0.7115 0.012 0.680 0.308
#> GSM1124950     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124954     1  0.2165     0.7802 0.936 0.000 0.064
#> GSM1124955     2  0.6019     0.7268 0.012 0.700 0.288
#> GSM1124956     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124872     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124873     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124876     3  0.4974     0.8079 0.236 0.000 0.764
#> GSM1124877     1  0.5633     0.6589 0.768 0.024 0.208
#> GSM1124879     2  0.6172     0.7110 0.012 0.680 0.308
#> GSM1124883     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124889     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124892     2  0.8911     0.4740 0.176 0.564 0.260
#> GSM1124893     2  0.6019     0.7268 0.012 0.700 0.288
#> GSM1124909     2  0.3845     0.8211 0.012 0.872 0.116
#> GSM1124913     2  0.0000     0.8629 0.000 1.000 0.000
#> GSM1124916     2  0.2939     0.8398 0.012 0.916 0.072
#> GSM1124923     2  0.6168     0.5967 0.000 0.588 0.412
#> GSM1124925     2  0.0237     0.8628 0.004 0.996 0.000
#> GSM1124929     2  0.6082     0.7213 0.012 0.692 0.296
#> GSM1124934     1  0.2261     0.7977 0.932 0.000 0.068
#> GSM1124937     2  0.6608     0.6584 0.016 0.628 0.356

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.0000      0.905 0.000 0.000 1.000 0.000
#> GSM1124888     3  0.3962      0.722 0.152 0.000 0.820 0.028
#> GSM1124890     1  0.5449      0.712 0.756 0.084 0.012 0.148
#> GSM1124904     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124927     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124953     1  0.5100      0.708 0.768 0.076 0.004 0.152
#> GSM1124869     1  0.2704      0.782 0.876 0.124 0.000 0.000
#> GSM1124870     1  0.3873      0.772 0.772 0.228 0.000 0.000
#> GSM1124882     1  0.3400      0.789 0.820 0.180 0.000 0.000
#> GSM1124884     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124898     2  0.4008      0.690 0.244 0.756 0.000 0.000
#> GSM1124903     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124905     1  0.3873      0.774 0.772 0.228 0.000 0.000
#> GSM1124910     1  0.2660      0.757 0.908 0.072 0.008 0.012
#> GSM1124919     1  0.5100      0.708 0.768 0.076 0.004 0.152
#> GSM1124932     2  0.1576      0.850 0.048 0.948 0.000 0.004
#> GSM1124933     3  0.0000      0.905 0.000 0.000 1.000 0.000
#> GSM1124867     1  0.4193      0.683 0.732 0.268 0.000 0.000
#> GSM1124868     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124878     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124895     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124897     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124902     2  0.0592      0.880 0.016 0.984 0.000 0.000
#> GSM1124908     2  0.4193      0.657 0.268 0.732 0.000 0.000
#> GSM1124921     2  0.4222      0.651 0.272 0.728 0.000 0.000
#> GSM1124939     2  0.0592      0.880 0.016 0.984 0.000 0.000
#> GSM1124944     2  0.4222      0.654 0.272 0.728 0.000 0.000
#> GSM1124945     3  0.0000      0.905 0.000 0.000 1.000 0.000
#> GSM1124946     2  0.4134      0.670 0.260 0.740 0.000 0.000
#> GSM1124947     2  0.4981      0.119 0.464 0.536 0.000 0.000
#> GSM1124951     3  0.0000      0.905 0.000 0.000 1.000 0.000
#> GSM1124952     2  0.0707      0.881 0.020 0.980 0.000 0.000
#> GSM1124957     3  0.0000      0.905 0.000 0.000 1.000 0.000
#> GSM1124900     1  0.3764      0.778 0.784 0.216 0.000 0.000
#> GSM1124914     2  0.0817      0.877 0.024 0.976 0.000 0.000
#> GSM1124871     2  0.0188      0.882 0.004 0.996 0.000 0.000
#> GSM1124874     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124875     2  0.4040      0.684 0.248 0.752 0.000 0.000
#> GSM1124880     1  0.3569      0.788 0.804 0.196 0.000 0.000
#> GSM1124881     2  0.4431      0.595 0.304 0.696 0.000 0.000
#> GSM1124885     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124886     1  0.5990      0.620 0.740 0.048 0.144 0.068
#> GSM1124887     2  0.4040      0.687 0.248 0.752 0.000 0.000
#> GSM1124894     2  0.0921      0.877 0.028 0.972 0.000 0.000
#> GSM1124896     2  0.3356      0.761 0.176 0.824 0.000 0.000
#> GSM1124899     2  0.2149      0.847 0.088 0.912 0.000 0.000
#> GSM1124901     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124906     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124907     2  0.4331      0.625 0.288 0.712 0.000 0.000
#> GSM1124911     2  0.1389      0.851 0.048 0.952 0.000 0.000
#> GSM1124912     1  0.4072      0.757 0.748 0.252 0.000 0.000
#> GSM1124915     2  0.1389      0.851 0.048 0.952 0.000 0.000
#> GSM1124917     2  0.4040      0.687 0.248 0.752 0.000 0.000
#> GSM1124918     2  0.2216      0.850 0.092 0.908 0.000 0.000
#> GSM1124920     3  0.5951      0.582 0.152 0.000 0.696 0.152
#> GSM1124922     2  0.1557      0.865 0.056 0.944 0.000 0.000
#> GSM1124924     1  0.5241      0.721 0.780 0.064 0.024 0.132
#> GSM1124926     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124928     1  0.3569      0.788 0.804 0.196 0.000 0.000
#> GSM1124930     1  0.6194      0.734 0.712 0.136 0.020 0.132
#> GSM1124931     2  0.1389      0.851 0.048 0.952 0.000 0.000
#> GSM1124935     2  0.1576      0.850 0.048 0.948 0.000 0.004
#> GSM1124936     3  0.1211      0.879 0.040 0.000 0.960 0.000
#> GSM1124938     1  0.6821      0.330 0.592 0.000 0.256 0.152
#> GSM1124940     1  0.4072      0.757 0.748 0.252 0.000 0.000
#> GSM1124941     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124942     2  0.4331      0.625 0.288 0.712 0.000 0.000
#> GSM1124943     1  0.5967      0.642 0.740 0.048 0.064 0.148
#> GSM1124948     1  0.5241      0.721 0.780 0.064 0.024 0.132
#> GSM1124949     1  0.2704      0.782 0.876 0.124 0.000 0.000
#> GSM1124950     2  0.0592      0.881 0.016 0.984 0.000 0.000
#> GSM1124954     4  0.3074      0.796 0.000 0.000 0.152 0.848
#> GSM1124955     1  0.4072      0.757 0.748 0.252 0.000 0.000
#> GSM1124956     2  0.1389      0.851 0.048 0.952 0.000 0.000
#> GSM1124872     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124873     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124876     3  0.0000      0.905 0.000 0.000 1.000 0.000
#> GSM1124877     4  0.3610      0.691 0.200 0.000 0.000 0.800
#> GSM1124879     1  0.3400      0.791 0.820 0.180 0.000 0.000
#> GSM1124883     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124889     2  0.0469      0.881 0.012 0.988 0.000 0.000
#> GSM1124892     1  0.5990      0.620 0.740 0.048 0.144 0.068
#> GSM1124893     1  0.4072      0.757 0.748 0.252 0.000 0.000
#> GSM1124909     1  0.4972      0.256 0.544 0.456 0.000 0.000
#> GSM1124913     2  0.0000      0.881 0.000 1.000 0.000 0.000
#> GSM1124916     2  0.3569      0.754 0.196 0.804 0.000 0.000
#> GSM1124923     1  0.5100      0.708 0.768 0.076 0.004 0.152
#> GSM1124925     2  0.3356      0.761 0.176 0.824 0.000 0.000
#> GSM1124929     1  0.3444      0.788 0.816 0.184 0.000 0.000
#> GSM1124934     4  0.3161      0.810 0.012 0.000 0.124 0.864
#> GSM1124937     1  0.2821      0.760 0.900 0.076 0.020 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
#> GSM1124891     3  0.0000      0.909 0.000 0.000 1.000 0.000 0.000
#> GSM1124888     3  0.4275      0.733 0.064 0.000 0.788 0.012 0.136
#> GSM1124890     5  0.5936      0.508 0.456 0.076 0.004 0.004 0.460
#> GSM1124904     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124927     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124953     5  0.5648      0.531 0.448 0.076 0.000 0.000 0.476
#> GSM1124869     1  0.0794      0.620 0.972 0.000 0.000 0.000 0.028
#> GSM1124870     1  0.1768      0.662 0.924 0.072 0.000 0.000 0.004
#> GSM1124882     1  0.1243      0.652 0.960 0.028 0.000 0.004 0.008
#> GSM1124884     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124898     2  0.4879      0.599 0.228 0.696 0.000 0.000 0.076
#> GSM1124903     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124905     1  0.1768      0.664 0.924 0.072 0.000 0.000 0.004
#> GSM1124910     1  0.3907      0.375 0.768 0.004 0.004 0.012 0.212
#> GSM1124919     5  0.5648      0.531 0.448 0.076 0.000 0.000 0.476
#> GSM1124932     2  0.4450      0.327 0.000 0.508 0.000 0.004 0.488
#> GSM1124933     3  0.0000      0.909 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     1  0.5080      0.371 0.708 0.176 0.000 0.004 0.112
#> GSM1124868     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124878     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124895     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124897     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124902     2  0.0510      0.795 0.016 0.984 0.000 0.000 0.000
#> GSM1124908     2  0.5218      0.571 0.240 0.672 0.000 0.004 0.084
#> GSM1124921     2  0.5140      0.562 0.252 0.664 0.000 0.000 0.084
#> GSM1124939     2  0.0510      0.795 0.016 0.984 0.000 0.000 0.000
#> GSM1124944     2  0.5243      0.567 0.244 0.668 0.000 0.004 0.084
#> GSM1124945     3  0.0000      0.909 0.000 0.000 1.000 0.000 0.000
#> GSM1124946     2  0.5113      0.585 0.232 0.684 0.000 0.004 0.080
#> GSM1124947     1  0.5746     -0.110 0.472 0.452 0.000 0.004 0.072
#> GSM1124951     3  0.0000      0.909 0.000 0.000 1.000 0.000 0.000
#> GSM1124952     2  0.0703      0.797 0.024 0.976 0.000 0.000 0.000
#> GSM1124957     3  0.0000      0.909 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     1  0.1571      0.665 0.936 0.060 0.000 0.000 0.004
#> GSM1124914     2  0.0794      0.792 0.028 0.972 0.000 0.000 0.000
#> GSM1124871     2  0.0162      0.797 0.004 0.996 0.000 0.000 0.000
#> GSM1124874     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124875     2  0.4933      0.614 0.200 0.712 0.000 0.004 0.084
#> GSM1124880     1  0.2437      0.662 0.904 0.060 0.000 0.004 0.032
#> GSM1124881     2  0.5323      0.500 0.296 0.624 0.000 0.000 0.080
#> GSM1124885     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124886     1  0.5564      0.261 0.676 0.000 0.016 0.196 0.112
#> GSM1124887     2  0.5032      0.595 0.228 0.692 0.000 0.004 0.076
#> GSM1124894     2  0.0880      0.793 0.032 0.968 0.000 0.000 0.000
#> GSM1124896     2  0.3969      0.570 0.304 0.692 0.000 0.000 0.004
#> GSM1124899     2  0.2784      0.746 0.108 0.872 0.000 0.004 0.016
#> GSM1124901     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124906     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124907     2  0.5439      0.544 0.244 0.652 0.000 0.004 0.100
#> GSM1124911     2  0.4305      0.331 0.000 0.512 0.000 0.000 0.488
#> GSM1124912     1  0.2124      0.652 0.900 0.096 0.000 0.000 0.004
#> GSM1124915     2  0.4305      0.331 0.000 0.512 0.000 0.000 0.488
#> GSM1124917     2  0.5032      0.595 0.228 0.692 0.000 0.004 0.076
#> GSM1124918     5  0.5738     -0.361 0.072 0.436 0.000 0.004 0.488
#> GSM1124920     3  0.5288      0.586 0.064 0.000 0.664 0.012 0.260
#> GSM1124922     2  0.2069      0.771 0.076 0.912 0.000 0.000 0.012
#> GSM1124924     1  0.5083     -0.314 0.556 0.004 0.016 0.008 0.416
#> GSM1124926     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124928     1  0.2437      0.662 0.904 0.060 0.000 0.004 0.032
#> GSM1124930     1  0.6402     -0.420 0.508 0.088 0.016 0.008 0.380
#> GSM1124931     2  0.4305      0.331 0.000 0.512 0.000 0.000 0.488
#> GSM1124935     2  0.4450      0.327 0.000 0.508 0.000 0.004 0.488
#> GSM1124936     3  0.1043      0.886 0.000 0.000 0.960 0.000 0.040
#> GSM1124938     5  0.6957      0.332 0.344 0.000 0.224 0.012 0.420
#> GSM1124940     1  0.2124      0.652 0.900 0.096 0.000 0.000 0.004
#> GSM1124941     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124942     2  0.5439      0.544 0.244 0.652 0.000 0.004 0.100
#> GSM1124943     5  0.6159      0.485 0.428 0.048 0.032 0.004 0.488
#> GSM1124948     1  0.5083     -0.314 0.556 0.004 0.016 0.008 0.416
#> GSM1124949     1  0.0794      0.620 0.972 0.000 0.000 0.000 0.028
#> GSM1124950     2  0.0609      0.797 0.020 0.980 0.000 0.000 0.000
#> GSM1124954     4  0.0794      0.845 0.000 0.000 0.028 0.972 0.000
#> GSM1124955     1  0.2124      0.652 0.900 0.096 0.000 0.000 0.004
#> GSM1124956     2  0.4305      0.331 0.000 0.512 0.000 0.000 0.488
#> GSM1124872     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124873     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124876     3  0.0000      0.909 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     4  0.3003      0.729 0.188 0.000 0.000 0.812 0.000
#> GSM1124879     1  0.2459      0.656 0.904 0.052 0.000 0.004 0.040
#> GSM1124883     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124889     2  0.0510      0.797 0.016 0.984 0.000 0.000 0.000
#> GSM1124892     1  0.5564      0.261 0.676 0.000 0.016 0.196 0.112
#> GSM1124893     1  0.2124      0.652 0.900 0.096 0.000 0.000 0.004
#> GSM1124909     1  0.4283      0.240 0.644 0.348 0.000 0.000 0.008
#> GSM1124913     2  0.0000      0.797 0.000 1.000 0.000 0.000 0.000
#> GSM1124916     2  0.6455      0.351 0.236 0.500 0.000 0.000 0.264
#> GSM1124923     5  0.5648      0.531 0.448 0.076 0.000 0.000 0.476
#> GSM1124925     2  0.3969      0.570 0.304 0.692 0.000 0.000 0.004
#> GSM1124929     1  0.1168      0.654 0.960 0.032 0.000 0.000 0.008
#> GSM1124934     4  0.0000      0.848 0.000 0.000 0.000 1.000 0.000
#> GSM1124937     1  0.3292      0.483 0.836 0.000 0.016 0.008 0.140

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.0000      0.901 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124888     3  0.4659      0.685 0.000 0.000 0.704 0.008 0.108 0.180
#> GSM1124890     5  0.1780      0.845 0.028 0.028 0.000 0.000 0.932 0.012
#> GSM1124904     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124927     2  0.0865      0.730 0.036 0.964 0.000 0.000 0.000 0.000
#> GSM1124953     5  0.1401      0.849 0.004 0.028 0.000 0.000 0.948 0.020
#> GSM1124869     1  0.2212      0.782 0.880 0.000 0.000 0.000 0.112 0.008
#> GSM1124870     1  0.0603      0.789 0.980 0.004 0.000 0.000 0.016 0.000
#> GSM1124882     1  0.1923      0.794 0.916 0.000 0.000 0.004 0.064 0.016
#> GSM1124884     2  0.1995      0.711 0.036 0.912 0.000 0.000 0.000 0.052
#> GSM1124898     2  0.5573      0.528 0.068 0.628 0.000 0.000 0.236 0.068
#> GSM1124903     2  0.1141      0.719 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM1124905     1  0.0993      0.793 0.964 0.012 0.000 0.000 0.024 0.000
#> GSM1124910     1  0.4841      0.372 0.544 0.004 0.000 0.008 0.412 0.032
#> GSM1124919     5  0.1401      0.849 0.004 0.028 0.000 0.000 0.948 0.020
#> GSM1124932     6  0.3266      0.867 0.000 0.272 0.000 0.000 0.000 0.728
#> GSM1124933     3  0.0000      0.901 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     1  0.6133      0.268 0.492 0.164 0.000 0.004 0.324 0.016
#> GSM1124868     2  0.1141      0.719 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM1124878     2  0.1141      0.719 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM1124895     2  0.1141      0.719 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM1124897     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124902     2  0.0458      0.733 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1124908     2  0.5749      0.493 0.068 0.592 0.000 0.000 0.272 0.068
#> GSM1124921     2  0.5871      0.487 0.080 0.584 0.000 0.000 0.268 0.068
#> GSM1124939     2  0.0458      0.733 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1124944     2  0.5826      0.492 0.076 0.588 0.000 0.000 0.268 0.068
#> GSM1124945     3  0.0000      0.901 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124946     2  0.5500      0.533 0.064 0.636 0.000 0.000 0.232 0.068
#> GSM1124947     2  0.6941      0.116 0.212 0.396 0.000 0.000 0.324 0.068
#> GSM1124951     3  0.0000      0.901 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124952     2  0.1572      0.727 0.036 0.936 0.000 0.000 0.000 0.028
#> GSM1124957     3  0.0000      0.901 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     1  0.1003      0.794 0.964 0.004 0.000 0.000 0.028 0.004
#> GSM1124914     2  0.0777      0.731 0.004 0.972 0.000 0.000 0.024 0.000
#> GSM1124871     2  0.1285      0.719 0.004 0.944 0.000 0.000 0.000 0.052
#> GSM1124874     2  0.1765      0.716 0.024 0.924 0.000 0.000 0.000 0.052
#> GSM1124875     2  0.5391      0.528 0.048 0.632 0.000 0.000 0.252 0.068
#> GSM1124880     1  0.2884      0.774 0.848 0.008 0.000 0.004 0.128 0.012
#> GSM1124881     2  0.6245      0.446 0.128 0.548 0.000 0.000 0.260 0.064
#> GSM1124885     2  0.1141      0.719 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM1124886     1  0.6159      0.525 0.584 0.000 0.000 0.192 0.156 0.068
#> GSM1124887     2  0.5594      0.525 0.068 0.624 0.000 0.000 0.240 0.068
#> GSM1124894     2  0.2563      0.686 0.072 0.876 0.000 0.000 0.000 0.052
#> GSM1124896     2  0.4807      0.289 0.392 0.556 0.000 0.000 0.004 0.048
#> GSM1124899     2  0.3950      0.660 0.076 0.804 0.000 0.000 0.052 0.068
#> GSM1124901     2  0.1141      0.719 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM1124906     2  0.0865      0.730 0.036 0.964 0.000 0.000 0.000 0.000
#> GSM1124907     2  0.5845      0.465 0.068 0.568 0.000 0.000 0.296 0.068
#> GSM1124911     6  0.3288      0.870 0.000 0.276 0.000 0.000 0.000 0.724
#> GSM1124912     1  0.0520      0.783 0.984 0.008 0.000 0.000 0.008 0.000
#> GSM1124915     6  0.3288      0.870 0.000 0.276 0.000 0.000 0.000 0.724
#> GSM1124917     2  0.5594      0.525 0.068 0.624 0.000 0.000 0.240 0.068
#> GSM1124918     6  0.4514      0.650 0.040 0.264 0.000 0.000 0.016 0.680
#> GSM1124920     3  0.5593      0.530 0.000 0.000 0.580 0.008 0.232 0.180
#> GSM1124922     2  0.2277      0.707 0.076 0.892 0.000 0.000 0.032 0.000
#> GSM1124924     5  0.2734      0.764 0.148 0.000 0.000 0.004 0.840 0.008
#> GSM1124926     2  0.1995      0.711 0.036 0.912 0.000 0.000 0.000 0.052
#> GSM1124928     1  0.2884      0.774 0.848 0.008 0.000 0.004 0.128 0.012
#> GSM1124930     5  0.2594      0.790 0.068 0.040 0.000 0.004 0.884 0.004
#> GSM1124931     6  0.3288      0.870 0.000 0.276 0.000 0.000 0.000 0.724
#> GSM1124935     6  0.3266      0.867 0.000 0.272 0.000 0.000 0.000 0.728
#> GSM1124936     3  0.1196      0.876 0.000 0.000 0.952 0.000 0.008 0.040
#> GSM1124938     5  0.4947      0.595 0.004 0.000 0.140 0.008 0.688 0.160
#> GSM1124940     1  0.0520      0.783 0.984 0.008 0.000 0.000 0.008 0.000
#> GSM1124941     2  0.0865      0.730 0.036 0.964 0.000 0.000 0.000 0.000
#> GSM1124942     2  0.5845      0.465 0.068 0.568 0.000 0.000 0.296 0.068
#> GSM1124943     5  0.1958      0.796 0.004 0.000 0.000 0.000 0.896 0.100
#> GSM1124948     5  0.2734      0.764 0.148 0.000 0.000 0.004 0.840 0.008
#> GSM1124949     1  0.2212      0.782 0.880 0.000 0.000 0.000 0.112 0.008
#> GSM1124950     2  0.1225      0.731 0.036 0.952 0.000 0.000 0.000 0.012
#> GSM1124954     4  0.0909      0.849 0.000 0.000 0.020 0.968 0.000 0.012
#> GSM1124955     1  0.0405      0.780 0.988 0.008 0.000 0.000 0.004 0.000
#> GSM1124956     6  0.3288      0.870 0.000 0.276 0.000 0.000 0.000 0.724
#> GSM1124872     2  0.0865      0.730 0.036 0.964 0.000 0.000 0.000 0.000
#> GSM1124873     2  0.1225      0.730 0.036 0.952 0.000 0.000 0.000 0.012
#> GSM1124876     3  0.0000      0.901 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     4  0.2838      0.734 0.188 0.000 0.000 0.808 0.000 0.004
#> GSM1124879     1  0.2896      0.773 0.840 0.004 0.000 0.004 0.140 0.012
#> GSM1124883     2  0.1141      0.719 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM1124889     2  0.1765      0.716 0.024 0.924 0.000 0.000 0.000 0.052
#> GSM1124892     1  0.6159      0.525 0.584 0.000 0.000 0.192 0.156 0.068
#> GSM1124893     1  0.0520      0.783 0.984 0.008 0.000 0.000 0.008 0.000
#> GSM1124909     1  0.5405      0.393 0.624 0.264 0.000 0.000 0.060 0.052
#> GSM1124913     2  0.1141      0.719 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM1124916     6  0.6209      0.379 0.212 0.348 0.000 0.000 0.012 0.428
#> GSM1124923     5  0.1401      0.849 0.004 0.028 0.000 0.000 0.948 0.020
#> GSM1124925     2  0.4807      0.289 0.392 0.556 0.000 0.000 0.004 0.048
#> GSM1124929     1  0.1327      0.792 0.936 0.000 0.000 0.000 0.064 0.000
#> GSM1124934     4  0.0146      0.851 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM1124937     1  0.4459      0.268 0.516 0.000 0.000 0.004 0.460 0.020

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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.651           0.816       0.859         0.3637 0.666   0.666
#> 3 3 0.559           0.769       0.868         0.6157 0.673   0.536
#> 4 4 0.603           0.425       0.648         0.1724 0.801   0.547
#> 5 5 0.677           0.730       0.834         0.0988 0.802   0.434
#> 6 6 0.748           0.692       0.803         0.0607 0.894   0.594

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1124891     1   0.402      0.929 0.920 0.080
#> GSM1124888     1   0.402      0.929 0.920 0.080
#> GSM1124890     1   0.584      0.884 0.860 0.140
#> GSM1124904     2   0.000      0.894 0.000 1.000
#> GSM1124927     2   0.000      0.894 0.000 1.000
#> GSM1124953     1   0.634      0.864 0.840 0.160
#> GSM1124869     2   0.861      0.610 0.284 0.716
#> GSM1124870     2   0.855      0.616 0.280 0.720
#> GSM1124882     2   0.861      0.610 0.284 0.716
#> GSM1124884     2   0.000      0.894 0.000 1.000
#> GSM1124898     2   0.000      0.894 0.000 1.000
#> GSM1124903     2   0.000      0.894 0.000 1.000
#> GSM1124905     2   0.855      0.616 0.280 0.720
#> GSM1124910     1   0.886      0.623 0.696 0.304
#> GSM1124919     2   0.311      0.854 0.056 0.944
#> GSM1124932     2   0.402      0.837 0.080 0.920
#> GSM1124933     1   0.402      0.929 0.920 0.080
#> GSM1124867     2   0.795      0.670 0.240 0.760
#> GSM1124868     2   0.000      0.894 0.000 1.000
#> GSM1124878     2   0.000      0.894 0.000 1.000
#> GSM1124895     2   0.000      0.894 0.000 1.000
#> GSM1124897     2   0.000      0.894 0.000 1.000
#> GSM1124902     2   0.000      0.894 0.000 1.000
#> GSM1124908     2   0.000      0.894 0.000 1.000
#> GSM1124921     2   0.000      0.894 0.000 1.000
#> GSM1124939     2   0.000      0.894 0.000 1.000
#> GSM1124944     2   0.000      0.894 0.000 1.000
#> GSM1124945     1   0.402      0.929 0.920 0.080
#> GSM1124946     2   0.000      0.894 0.000 1.000
#> GSM1124947     2   0.000      0.894 0.000 1.000
#> GSM1124951     1   0.402      0.929 0.920 0.080
#> GSM1124952     2   0.000      0.894 0.000 1.000
#> GSM1124957     1   0.402      0.929 0.920 0.080
#> GSM1124900     2   0.000      0.894 0.000 1.000
#> GSM1124914     2   0.000      0.894 0.000 1.000
#> GSM1124871     2   0.000      0.894 0.000 1.000
#> GSM1124874     2   0.000      0.894 0.000 1.000
#> GSM1124875     2   0.000      0.894 0.000 1.000
#> GSM1124880     2   0.855      0.616 0.280 0.720
#> GSM1124881     2   0.000      0.894 0.000 1.000
#> GSM1124885     2   0.000      0.894 0.000 1.000
#> GSM1124886     1   0.402      0.929 0.920 0.080
#> GSM1124887     2   0.000      0.894 0.000 1.000
#> GSM1124894     2   0.000      0.894 0.000 1.000
#> GSM1124896     2   0.000      0.894 0.000 1.000
#> GSM1124899     2   0.000      0.894 0.000 1.000
#> GSM1124901     2   0.000      0.894 0.000 1.000
#> GSM1124906     2   0.000      0.894 0.000 1.000
#> GSM1124907     2   0.000      0.894 0.000 1.000
#> GSM1124911     2   0.402      0.837 0.080 0.920
#> GSM1124912     2   0.855      0.616 0.280 0.720
#> GSM1124915     2   0.402      0.837 0.080 0.920
#> GSM1124917     2   0.000      0.894 0.000 1.000
#> GSM1124918     2   0.402      0.837 0.080 0.920
#> GSM1124920     1   0.402      0.929 0.920 0.080
#> GSM1124922     2   0.000      0.894 0.000 1.000
#> GSM1124924     2   0.988      0.233 0.436 0.564
#> GSM1124926     2   0.000      0.894 0.000 1.000
#> GSM1124928     2   0.861      0.610 0.284 0.716
#> GSM1124930     2   0.224      0.870 0.036 0.964
#> GSM1124931     2   0.402      0.837 0.080 0.920
#> GSM1124935     2   0.402      0.837 0.080 0.920
#> GSM1124936     1   0.402      0.929 0.920 0.080
#> GSM1124938     1   0.402      0.929 0.920 0.080
#> GSM1124940     2   0.855      0.616 0.280 0.720
#> GSM1124941     2   0.000      0.894 0.000 1.000
#> GSM1124942     2   0.000      0.894 0.000 1.000
#> GSM1124943     1   0.625      0.868 0.844 0.156
#> GSM1124948     2   0.988      0.233 0.436 0.564
#> GSM1124949     1   0.996      0.138 0.536 0.464
#> GSM1124950     2   0.000      0.894 0.000 1.000
#> GSM1124954     1   0.000      0.858 1.000 0.000
#> GSM1124955     2   0.855      0.616 0.280 0.720
#> GSM1124956     2   0.402      0.837 0.080 0.920
#> GSM1124872     2   0.000      0.894 0.000 1.000
#> GSM1124873     2   0.000      0.894 0.000 1.000
#> GSM1124876     1   0.402      0.929 0.920 0.080
#> GSM1124877     2   0.971      0.466 0.400 0.600
#> GSM1124879     2   0.861      0.610 0.284 0.716
#> GSM1124883     2   0.000      0.894 0.000 1.000
#> GSM1124889     2   0.000      0.894 0.000 1.000
#> GSM1124892     1   0.402      0.929 0.920 0.080
#> GSM1124893     2   0.861      0.610 0.284 0.716
#> GSM1124909     2   0.000      0.894 0.000 1.000
#> GSM1124913     2   0.000      0.894 0.000 1.000
#> GSM1124916     2   0.402      0.837 0.080 0.920
#> GSM1124923     2   0.563      0.773 0.132 0.868
#> GSM1124925     2   0.000      0.894 0.000 1.000
#> GSM1124929     2   0.886      0.597 0.304 0.696
#> GSM1124934     1   0.000      0.858 1.000 0.000
#> GSM1124937     2   0.921      0.511 0.336 0.664

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.2711     0.9379 0.088 0.000 0.912
#> GSM1124888     3  0.2711     0.9379 0.088 0.000 0.912
#> GSM1124890     1  0.5775     0.5722 0.728 0.012 0.260
#> GSM1124904     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124927     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124953     3  0.9421     0.1076 0.388 0.176 0.436
#> GSM1124869     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124870     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124882     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124884     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124898     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124903     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124905     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124910     1  0.3856     0.8441 0.888 0.072 0.040
#> GSM1124919     2  0.6189     0.4211 0.364 0.632 0.004
#> GSM1124932     2  0.7222     0.6319 0.220 0.696 0.084
#> GSM1124933     3  0.2711     0.9379 0.088 0.000 0.912
#> GSM1124867     1  0.3500     0.8428 0.880 0.116 0.004
#> GSM1124868     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124878     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124895     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124897     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124902     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124908     2  0.1643     0.8518 0.044 0.956 0.000
#> GSM1124921     2  0.4654     0.7114 0.208 0.792 0.000
#> GSM1124939     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124944     2  0.6104     0.4614 0.348 0.648 0.004
#> GSM1124945     3  0.2625     0.9359 0.084 0.000 0.916
#> GSM1124946     2  0.0747     0.8662 0.016 0.984 0.000
#> GSM1124947     2  0.5621     0.5533 0.308 0.692 0.000
#> GSM1124951     3  0.2625     0.9359 0.084 0.000 0.916
#> GSM1124952     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124957     3  0.2711     0.9379 0.088 0.000 0.912
#> GSM1124900     1  0.4178     0.7926 0.828 0.172 0.000
#> GSM1124914     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124871     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124874     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124875     2  0.4555     0.7208 0.200 0.800 0.000
#> GSM1124880     1  0.3112     0.8546 0.900 0.096 0.004
#> GSM1124881     2  0.5882     0.4674 0.348 0.652 0.000
#> GSM1124885     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124886     1  0.4605     0.6404 0.796 0.000 0.204
#> GSM1124887     2  0.4504     0.7253 0.196 0.804 0.000
#> GSM1124894     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124896     1  0.4974     0.7385 0.764 0.236 0.000
#> GSM1124899     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124901     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124906     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124907     2  0.4883     0.7084 0.208 0.788 0.004
#> GSM1124911     2  0.6858     0.6712 0.188 0.728 0.084
#> GSM1124912     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124915     2  0.5179     0.7520 0.088 0.832 0.080
#> GSM1124917     2  0.4346     0.7326 0.184 0.816 0.000
#> GSM1124918     2  0.8270     0.4479 0.376 0.540 0.084
#> GSM1124920     3  0.2711     0.9379 0.088 0.000 0.912
#> GSM1124922     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124924     1  0.3539     0.8503 0.888 0.100 0.012
#> GSM1124926     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124928     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124930     1  0.6521     0.0225 0.500 0.496 0.004
#> GSM1124931     2  0.6705     0.6835 0.176 0.740 0.084
#> GSM1124935     2  0.6858     0.6712 0.188 0.728 0.084
#> GSM1124936     3  0.2711     0.9379 0.088 0.000 0.912
#> GSM1124938     3  0.3116     0.9192 0.108 0.000 0.892
#> GSM1124940     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124941     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124942     2  0.5024     0.6937 0.220 0.776 0.004
#> GSM1124943     1  0.6180     0.5640 0.716 0.024 0.260
#> GSM1124948     1  0.3539     0.8503 0.888 0.100 0.012
#> GSM1124949     1  0.3856     0.8441 0.888 0.072 0.040
#> GSM1124950     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124954     3  0.2165     0.8476 0.064 0.000 0.936
#> GSM1124955     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124956     2  0.6858     0.6712 0.188 0.728 0.084
#> GSM1124872     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124873     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124876     3  0.2711     0.9379 0.088 0.000 0.912
#> GSM1124877     1  0.2959     0.7222 0.900 0.000 0.100
#> GSM1124879     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124883     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124889     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124892     1  0.6079     0.2454 0.612 0.000 0.388
#> GSM1124893     1  0.3610     0.8606 0.888 0.096 0.016
#> GSM1124909     1  0.4346     0.7795 0.816 0.184 0.000
#> GSM1124913     2  0.0000     0.8742 0.000 1.000 0.000
#> GSM1124916     1  0.4544     0.7125 0.860 0.056 0.084
#> GSM1124923     2  0.6189     0.4211 0.364 0.632 0.004
#> GSM1124925     2  0.5835     0.3957 0.340 0.660 0.000
#> GSM1124929     1  0.2297     0.8093 0.944 0.036 0.020
#> GSM1124934     1  0.6299    -0.0564 0.524 0.000 0.476
#> GSM1124937     1  0.3295     0.8586 0.896 0.096 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.0921     0.9387 0.028 0.000 0.972 0.000
#> GSM1124888     3  0.0921     0.9387 0.028 0.000 0.972 0.000
#> GSM1124890     1  0.5902     0.5167 0.540 0.004 0.028 0.428
#> GSM1124904     4  0.4996    -0.1793 0.000 0.484 0.000 0.516
#> GSM1124927     4  0.5236     0.0104 0.008 0.432 0.000 0.560
#> GSM1124953     4  0.6224    -0.0444 0.264 0.004 0.084 0.648
#> GSM1124869     1  0.0469     0.8137 0.988 0.000 0.000 0.012
#> GSM1124870     1  0.1004     0.8131 0.972 0.004 0.000 0.024
#> GSM1124882     1  0.0469     0.8137 0.988 0.000 0.000 0.012
#> GSM1124884     2  0.4999     0.2279 0.000 0.508 0.000 0.492
#> GSM1124898     4  0.5372    -0.0212 0.012 0.444 0.000 0.544
#> GSM1124903     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124905     1  0.1109     0.8119 0.968 0.004 0.000 0.028
#> GSM1124910     1  0.3494     0.7581 0.824 0.004 0.000 0.172
#> GSM1124919     4  0.3681     0.3454 0.176 0.008 0.000 0.816
#> GSM1124932     2  0.4059     0.2363 0.096 0.848 0.020 0.036
#> GSM1124933     3  0.0921     0.9387 0.028 0.000 0.972 0.000
#> GSM1124867     1  0.3355     0.7645 0.836 0.004 0.000 0.160
#> GSM1124868     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124878     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124895     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124897     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124902     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124908     4  0.4842     0.3689 0.048 0.192 0.000 0.760
#> GSM1124921     4  0.4106     0.4301 0.084 0.084 0.000 0.832
#> GSM1124939     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124944     4  0.3626     0.3774 0.184 0.004 0.000 0.812
#> GSM1124945     3  0.0921     0.9387 0.028 0.000 0.972 0.000
#> GSM1124946     4  0.4319     0.3501 0.012 0.228 0.000 0.760
#> GSM1124947     4  0.5031     0.4250 0.140 0.092 0.000 0.768
#> GSM1124951     3  0.0921     0.9387 0.028 0.000 0.972 0.000
#> GSM1124952     4  0.5517     0.0634 0.020 0.412 0.000 0.568
#> GSM1124957     3  0.0921     0.9387 0.028 0.000 0.972 0.000
#> GSM1124900     1  0.2401     0.7879 0.904 0.004 0.000 0.092
#> GSM1124914     4  0.4996    -0.1793 0.000 0.484 0.000 0.516
#> GSM1124871     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124874     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124875     4  0.4039     0.4303 0.080 0.084 0.000 0.836
#> GSM1124880     1  0.2999     0.7785 0.864 0.004 0.000 0.132
#> GSM1124881     4  0.5142     0.3980 0.192 0.064 0.000 0.744
#> GSM1124885     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124886     1  0.3194     0.7580 0.888 0.004 0.052 0.056
#> GSM1124887     4  0.5185     0.4049 0.076 0.176 0.000 0.748
#> GSM1124894     4  0.4998    -0.2086 0.000 0.488 0.000 0.512
#> GSM1124896     1  0.3144     0.7746 0.884 0.044 0.000 0.072
#> GSM1124899     4  0.5329     0.0500 0.012 0.420 0.000 0.568
#> GSM1124901     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124906     4  0.4972    -0.0769 0.000 0.456 0.000 0.544
#> GSM1124907     4  0.2376     0.4213 0.068 0.016 0.000 0.916
#> GSM1124911     2  0.3864     0.2404 0.084 0.860 0.020 0.036
#> GSM1124912     1  0.1004     0.8131 0.972 0.004 0.000 0.024
#> GSM1124915     2  0.1798     0.2360 0.000 0.944 0.016 0.040
#> GSM1124917     4  0.5384     0.3893 0.076 0.196 0.000 0.728
#> GSM1124918     2  0.7203     0.0666 0.160 0.612 0.020 0.208
#> GSM1124920     3  0.2764     0.8978 0.036 0.004 0.908 0.052
#> GSM1124922     4  0.5329     0.0500 0.012 0.420 0.000 0.568
#> GSM1124924     1  0.5147     0.5335 0.536 0.004 0.000 0.460
#> GSM1124926     2  0.4999     0.2279 0.000 0.508 0.000 0.492
#> GSM1124928     1  0.0469     0.8137 0.988 0.000 0.000 0.012
#> GSM1124930     4  0.4594     0.0857 0.280 0.008 0.000 0.712
#> GSM1124931     2  0.4516     0.2298 0.080 0.828 0.020 0.072
#> GSM1124935     2  0.4786     0.2222 0.084 0.812 0.020 0.084
#> GSM1124936     3  0.0921     0.9387 0.028 0.000 0.972 0.000
#> GSM1124938     3  0.5940     0.6354 0.052 0.004 0.640 0.304
#> GSM1124940     1  0.0817     0.8137 0.976 0.000 0.000 0.024
#> GSM1124941     4  0.5329     0.0500 0.012 0.420 0.000 0.568
#> GSM1124942     4  0.2450     0.4206 0.072 0.016 0.000 0.912
#> GSM1124943     1  0.6372     0.4764 0.496 0.004 0.052 0.448
#> GSM1124948     1  0.5151     0.5297 0.532 0.004 0.000 0.464
#> GSM1124949     1  0.1004     0.8094 0.972 0.004 0.000 0.024
#> GSM1124950     4  0.5329     0.0500 0.012 0.420 0.000 0.568
#> GSM1124954     3  0.4920     0.7290 0.028 0.228 0.740 0.004
#> GSM1124955     1  0.1510     0.8080 0.956 0.016 0.000 0.028
#> GSM1124956     2  0.3864     0.2404 0.084 0.860 0.020 0.036
#> GSM1124872     4  0.4948    -0.0207 0.000 0.440 0.000 0.560
#> GSM1124873     4  0.4961    -0.0445 0.000 0.448 0.000 0.552
#> GSM1124876     3  0.0921     0.9387 0.028 0.000 0.972 0.000
#> GSM1124877     1  0.5933     0.3127 0.516 0.452 0.028 0.004
#> GSM1124879     1  0.0469     0.8137 0.988 0.000 0.000 0.012
#> GSM1124883     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124889     2  0.4999     0.2279 0.000 0.508 0.000 0.492
#> GSM1124892     1  0.4442     0.7029 0.812 0.004 0.128 0.056
#> GSM1124893     1  0.1004     0.8131 0.972 0.004 0.000 0.024
#> GSM1124909     1  0.3726     0.7430 0.788 0.000 0.000 0.212
#> GSM1124913     2  0.4998     0.2367 0.000 0.512 0.000 0.488
#> GSM1124916     2  0.7339    -0.3818 0.420 0.468 0.020 0.092
#> GSM1124923     4  0.3681     0.3454 0.176 0.008 0.000 0.816
#> GSM1124925     1  0.6824     0.2433 0.556 0.324 0.000 0.120
#> GSM1124929     1  0.0657     0.8132 0.984 0.004 0.000 0.012
#> GSM1124934     1  0.8546     0.1742 0.432 0.352 0.160 0.056
#> GSM1124937     1  0.2593     0.7873 0.892 0.004 0.000 0.104

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1124891     3  0.0000     0.9376 0.000 0.000 1.000 0.000 0.000
#> GSM1124888     3  0.0000     0.9376 0.000 0.000 1.000 0.000 0.000
#> GSM1124890     5  0.4210     0.6074 0.184 0.000 0.016 0.028 0.772
#> GSM1124904     2  0.2378     0.7941 0.000 0.904 0.000 0.048 0.048
#> GSM1124927     2  0.1788     0.7592 0.004 0.932 0.000 0.008 0.056
#> GSM1124953     5  0.4315     0.6678 0.084 0.040 0.040 0.016 0.820
#> GSM1124869     1  0.0162     0.9124 0.996 0.000 0.000 0.000 0.004
#> GSM1124870     1  0.0566     0.9122 0.984 0.000 0.000 0.012 0.004
#> GSM1124882     1  0.0162     0.9124 0.996 0.000 0.000 0.000 0.004
#> GSM1124884     2  0.2280     0.8020 0.000 0.880 0.000 0.120 0.000
#> GSM1124898     2  0.3289     0.7517 0.004 0.852 0.000 0.048 0.096
#> GSM1124903     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124905     1  0.0566     0.9122 0.984 0.000 0.000 0.012 0.004
#> GSM1124910     1  0.3370     0.7927 0.824 0.000 0.000 0.028 0.148
#> GSM1124919     5  0.2974     0.6952 0.052 0.080 0.000 0.000 0.868
#> GSM1124932     4  0.2079     0.7861 0.020 0.064 0.000 0.916 0.000
#> GSM1124933     3  0.0000     0.9376 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     1  0.2949     0.8313 0.876 0.052 0.000 0.004 0.068
#> GSM1124868     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124878     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124895     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124897     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124902     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124908     2  0.5014     0.0594 0.008 0.560 0.000 0.020 0.412
#> GSM1124921     5  0.5170     0.4087 0.012 0.400 0.000 0.024 0.564
#> GSM1124939     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124944     5  0.4512     0.6663 0.040 0.204 0.000 0.012 0.744
#> GSM1124945     3  0.0162     0.9361 0.000 0.000 0.996 0.004 0.000
#> GSM1124946     2  0.4726     0.3472 0.004 0.644 0.000 0.024 0.328
#> GSM1124947     2  0.5253    -0.1066 0.024 0.564 0.000 0.016 0.396
#> GSM1124951     3  0.0162     0.9361 0.000 0.000 0.996 0.004 0.000
#> GSM1124952     2  0.2266     0.7454 0.008 0.912 0.000 0.016 0.064
#> GSM1124957     3  0.0000     0.9376 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     1  0.1267     0.8985 0.960 0.004 0.000 0.012 0.024
#> GSM1124914     2  0.2726     0.7948 0.000 0.884 0.000 0.064 0.052
#> GSM1124871     2  0.3531     0.8091 0.000 0.816 0.000 0.148 0.036
#> GSM1124874     2  0.2377     0.8030 0.000 0.872 0.000 0.128 0.000
#> GSM1124875     5  0.5043     0.3904 0.012 0.420 0.000 0.016 0.552
#> GSM1124880     1  0.1644     0.8864 0.940 0.004 0.000 0.008 0.048
#> GSM1124881     2  0.5651    -0.2749 0.044 0.512 0.000 0.016 0.428
#> GSM1124885     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124886     1  0.2777     0.8249 0.864 0.000 0.000 0.016 0.120
#> GSM1124887     5  0.5313     0.3194 0.012 0.444 0.000 0.028 0.516
#> GSM1124894     2  0.2813     0.7959 0.000 0.868 0.000 0.108 0.024
#> GSM1124896     1  0.1412     0.8952 0.952 0.008 0.000 0.036 0.004
#> GSM1124899     2  0.2238     0.7457 0.004 0.912 0.000 0.020 0.064
#> GSM1124901     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124906     2  0.1408     0.7678 0.000 0.948 0.000 0.008 0.044
#> GSM1124907     5  0.4043     0.6620 0.012 0.220 0.000 0.012 0.756
#> GSM1124911     4  0.2144     0.7860 0.020 0.068 0.000 0.912 0.000
#> GSM1124912     1  0.0566     0.9122 0.984 0.000 0.000 0.012 0.004
#> GSM1124915     4  0.2439     0.7348 0.000 0.120 0.000 0.876 0.004
#> GSM1124917     5  0.5552     0.3275 0.012 0.420 0.000 0.044 0.524
#> GSM1124918     4  0.5333     0.6680 0.028 0.132 0.000 0.720 0.120
#> GSM1124920     3  0.3496     0.7831 0.016 0.000 0.840 0.028 0.116
#> GSM1124922     2  0.2238     0.7457 0.004 0.912 0.000 0.020 0.064
#> GSM1124924     5  0.3985     0.6040 0.196 0.004 0.000 0.028 0.772
#> GSM1124926     2  0.2280     0.8020 0.000 0.880 0.000 0.120 0.000
#> GSM1124928     1  0.0162     0.9124 0.996 0.000 0.000 0.000 0.004
#> GSM1124930     5  0.3512     0.6871 0.088 0.068 0.000 0.004 0.840
#> GSM1124931     4  0.3381     0.7829 0.016 0.160 0.000 0.820 0.004
#> GSM1124935     4  0.3236     0.7820 0.020 0.152 0.000 0.828 0.000
#> GSM1124936     3  0.0000     0.9376 0.000 0.000 1.000 0.000 0.000
#> GSM1124938     5  0.5052     0.2990 0.016 0.000 0.312 0.028 0.644
#> GSM1124940     1  0.0566     0.9122 0.984 0.000 0.000 0.012 0.004
#> GSM1124941     2  0.2141     0.7485 0.004 0.916 0.000 0.016 0.064
#> GSM1124942     5  0.4012     0.6640 0.012 0.216 0.000 0.012 0.760
#> GSM1124943     5  0.4252     0.6231 0.152 0.000 0.032 0.028 0.788
#> GSM1124948     5  0.3985     0.6040 0.196 0.004 0.000 0.028 0.772
#> GSM1124949     1  0.0290     0.9108 0.992 0.000 0.000 0.000 0.008
#> GSM1124950     2  0.2141     0.7485 0.004 0.916 0.000 0.016 0.064
#> GSM1124954     3  0.5537     0.4715 0.000 0.000 0.624 0.264 0.112
#> GSM1124955     1  0.0794     0.9045 0.972 0.000 0.000 0.028 0.000
#> GSM1124956     4  0.2144     0.7860 0.020 0.068 0.000 0.912 0.000
#> GSM1124872     2  0.1628     0.7615 0.000 0.936 0.000 0.008 0.056
#> GSM1124873     2  0.1168     0.7724 0.000 0.960 0.000 0.008 0.032
#> GSM1124876     3  0.0000     0.9376 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     4  0.5426     0.5981 0.252 0.000 0.000 0.640 0.108
#> GSM1124879     1  0.0162     0.9124 0.996 0.000 0.000 0.000 0.004
#> GSM1124883     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124889     2  0.2280     0.8020 0.000 0.880 0.000 0.120 0.000
#> GSM1124892     1  0.3813     0.7979 0.824 0.000 0.032 0.024 0.120
#> GSM1124893     1  0.0566     0.9122 0.984 0.000 0.000 0.012 0.004
#> GSM1124909     1  0.5148     0.6155 0.712 0.180 0.000 0.012 0.096
#> GSM1124913     2  0.3681     0.8096 0.000 0.808 0.000 0.148 0.044
#> GSM1124916     4  0.4704     0.7347 0.104 0.116 0.000 0.764 0.016
#> GSM1124923     5  0.2974     0.6952 0.052 0.080 0.000 0.000 0.868
#> GSM1124925     1  0.5733     0.4041 0.624 0.188 0.000 0.188 0.000
#> GSM1124929     1  0.0404     0.9118 0.988 0.000 0.000 0.012 0.000
#> GSM1124934     4  0.7107     0.4678 0.240 0.000 0.036 0.500 0.224
#> GSM1124937     1  0.0865     0.9035 0.972 0.000 0.000 0.004 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
#> GSM1124891     3  0.0000      0.910 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124888     3  0.0260      0.906 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM1124890     5  0.3168      0.794 0.028 0.012 0.000 0.096 0.852 0.012
#> GSM1124904     4  0.3765      0.861 0.000 0.404 0.000 0.596 0.000 0.000
#> GSM1124927     2  0.0717      0.603 0.000 0.976 0.000 0.016 0.000 0.008
#> GSM1124953     5  0.1779      0.809 0.012 0.016 0.004 0.016 0.940 0.012
#> GSM1124869     1  0.0146      0.905 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM1124870     1  0.0291      0.905 0.992 0.004 0.000 0.000 0.000 0.004
#> GSM1124882     1  0.0436      0.905 0.988 0.004 0.000 0.004 0.004 0.000
#> GSM1124884     2  0.3810     -0.438 0.000 0.572 0.000 0.428 0.000 0.000
#> GSM1124898     2  0.3421      0.267 0.000 0.736 0.000 0.256 0.000 0.008
#> GSM1124903     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124905     1  0.1237      0.905 0.956 0.004 0.000 0.020 0.000 0.020
#> GSM1124910     1  0.4024      0.722 0.752 0.000 0.000 0.064 0.180 0.004
#> GSM1124919     5  0.2187      0.804 0.008 0.036 0.000 0.028 0.916 0.012
#> GSM1124932     6  0.1926      0.809 0.000 0.020 0.000 0.068 0.000 0.912
#> GSM1124933     3  0.0000      0.910 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     1  0.4334      0.551 0.676 0.288 0.000 0.012 0.020 0.004
#> GSM1124868     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124878     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124895     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124897     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124902     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124908     2  0.4261      0.448 0.000 0.692 0.000 0.056 0.252 0.000
#> GSM1124921     2  0.5562      0.310 0.000 0.532 0.000 0.168 0.300 0.000
#> GSM1124939     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124944     5  0.4410      0.322 0.000 0.412 0.000 0.028 0.560 0.000
#> GSM1124945     3  0.0000      0.910 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124946     2  0.5450      0.379 0.000 0.560 0.000 0.276 0.164 0.000
#> GSM1124947     2  0.2653      0.580 0.000 0.844 0.000 0.012 0.144 0.000
#> GSM1124951     3  0.0000      0.910 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124952     2  0.0405      0.609 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM1124957     3  0.0000      0.910 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     1  0.1237      0.905 0.956 0.004 0.000 0.020 0.000 0.020
#> GSM1124914     4  0.3923      0.818 0.000 0.416 0.000 0.580 0.000 0.004
#> GSM1124871     4  0.3607      0.969 0.000 0.348 0.000 0.652 0.000 0.000
#> GSM1124874     2  0.3833     -0.484 0.000 0.556 0.000 0.444 0.000 0.000
#> GSM1124875     2  0.3539      0.481 0.000 0.756 0.000 0.024 0.220 0.000
#> GSM1124880     1  0.2186      0.869 0.908 0.024 0.000 0.056 0.012 0.000
#> GSM1124881     2  0.3264      0.526 0.012 0.796 0.000 0.008 0.184 0.000
#> GSM1124885     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124886     1  0.3627      0.780 0.808 0.000 0.000 0.028 0.132 0.032
#> GSM1124887     2  0.5712      0.406 0.000 0.520 0.000 0.260 0.220 0.000
#> GSM1124894     2  0.3101      0.159 0.000 0.756 0.000 0.244 0.000 0.000
#> GSM1124896     1  0.1666      0.899 0.936 0.008 0.000 0.036 0.000 0.020
#> GSM1124899     2  0.0405      0.609 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM1124901     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124906     2  0.1333      0.571 0.000 0.944 0.000 0.048 0.000 0.008
#> GSM1124907     5  0.3834      0.605 0.000 0.268 0.000 0.024 0.708 0.000
#> GSM1124911     6  0.2265      0.809 0.000 0.024 0.000 0.076 0.004 0.896
#> GSM1124912     1  0.1321      0.904 0.952 0.004 0.000 0.024 0.000 0.020
#> GSM1124915     6  0.3168      0.740 0.000 0.024 0.000 0.172 0.000 0.804
#> GSM1124917     2  0.5628      0.418 0.000 0.540 0.000 0.240 0.220 0.000
#> GSM1124918     6  0.3201      0.725 0.000 0.208 0.000 0.000 0.012 0.780
#> GSM1124920     3  0.4776      0.600 0.000 0.000 0.688 0.108 0.196 0.008
#> GSM1124922     2  0.0405      0.609 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM1124924     5  0.2907      0.789 0.028 0.016 0.000 0.096 0.860 0.000
#> GSM1124926     2  0.3804     -0.428 0.000 0.576 0.000 0.424 0.000 0.000
#> GSM1124928     1  0.0291      0.905 0.992 0.004 0.000 0.000 0.004 0.000
#> GSM1124930     5  0.1426      0.809 0.016 0.028 0.000 0.008 0.948 0.000
#> GSM1124931     6  0.2122      0.812 0.000 0.076 0.000 0.024 0.000 0.900
#> GSM1124935     6  0.1812      0.807 0.000 0.080 0.000 0.008 0.000 0.912
#> GSM1124936     3  0.0000      0.910 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124938     5  0.3508      0.716 0.000 0.000 0.080 0.104 0.812 0.004
#> GSM1124940     1  0.1321      0.904 0.952 0.004 0.000 0.024 0.000 0.020
#> GSM1124941     2  0.0520      0.608 0.000 0.984 0.000 0.008 0.000 0.008
#> GSM1124942     5  0.3834      0.605 0.000 0.268 0.000 0.024 0.708 0.000
#> GSM1124943     5  0.2894      0.787 0.020 0.012 0.000 0.104 0.860 0.004
#> GSM1124948     5  0.2815      0.790 0.028 0.012 0.000 0.096 0.864 0.000
#> GSM1124949     1  0.0146      0.903 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1124950     2  0.0520      0.608 0.000 0.984 0.000 0.008 0.000 0.008
#> GSM1124954     3  0.6458      0.227 0.004 0.000 0.480 0.184 0.032 0.300
#> GSM1124955     1  0.1552      0.901 0.940 0.004 0.000 0.036 0.000 0.020
#> GSM1124956     6  0.2265      0.809 0.000 0.024 0.000 0.076 0.004 0.896
#> GSM1124872     2  0.0806      0.600 0.000 0.972 0.000 0.020 0.000 0.008
#> GSM1124873     2  0.1124      0.586 0.000 0.956 0.000 0.036 0.000 0.008
#> GSM1124876     3  0.0000      0.910 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     6  0.5681      0.589 0.184 0.000 0.000 0.176 0.028 0.612
#> GSM1124879     1  0.0696      0.906 0.980 0.004 0.000 0.004 0.004 0.008
#> GSM1124883     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124889     2  0.3851     -0.530 0.000 0.540 0.000 0.460 0.000 0.000
#> GSM1124892     1  0.3740      0.774 0.800 0.000 0.000 0.032 0.136 0.032
#> GSM1124893     1  0.1321      0.904 0.952 0.004 0.000 0.024 0.000 0.020
#> GSM1124909     2  0.4238      0.233 0.340 0.636 0.000 0.016 0.008 0.000
#> GSM1124913     4  0.3592      0.976 0.000 0.344 0.000 0.656 0.000 0.000
#> GSM1124916     6  0.3037      0.750 0.016 0.176 0.000 0.000 0.000 0.808
#> GSM1124923     5  0.2187      0.804 0.008 0.036 0.000 0.028 0.916 0.012
#> GSM1124925     1  0.6025      0.543 0.620 0.112 0.000 0.124 0.000 0.144
#> GSM1124929     1  0.0551      0.906 0.984 0.004 0.000 0.008 0.000 0.004
#> GSM1124934     6  0.6898      0.483 0.128 0.000 0.004 0.196 0.156 0.516
#> GSM1124937     1  0.1801      0.876 0.924 0.000 0.000 0.056 0.016 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 tissue(p) k
#> ATC:kmeans 87     0.146 2
#> ATC:kmeans 81     0.174 3
#> ATC:kmeans 35     0.231 4
#> ATC:kmeans 79     0.301 5
#> ATC:kmeans 75     0.133 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 48983 rows and 91 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 0.932           0.927       0.972         0.4962 0.505   0.505
#> 3 3 0.807           0.780       0.917         0.2708 0.738   0.531
#> 4 4 0.807           0.836       0.917         0.1146 0.898   0.728
#> 5 5 0.798           0.798       0.905         0.0994 0.897   0.670
#> 6 6 0.781           0.694       0.832         0.0430 0.963   0.845

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
#> GSM1124891     1   0.000      0.967 1.000 0.000
#> GSM1124888     1   0.000      0.967 1.000 0.000
#> GSM1124890     1   0.000      0.967 1.000 0.000
#> GSM1124904     2   0.000      0.972 0.000 1.000
#> GSM1124927     2   0.000      0.972 0.000 1.000
#> GSM1124953     1   0.000      0.967 1.000 0.000
#> GSM1124869     1   0.000      0.967 1.000 0.000
#> GSM1124870     1   0.000      0.967 1.000 0.000
#> GSM1124882     1   0.000      0.967 1.000 0.000
#> GSM1124884     2   0.000      0.972 0.000 1.000
#> GSM1124898     2   0.000      0.972 0.000 1.000
#> GSM1124903     2   0.000      0.972 0.000 1.000
#> GSM1124905     1   0.242      0.931 0.960 0.040
#> GSM1124910     1   0.000      0.967 1.000 0.000
#> GSM1124919     2   0.971      0.333 0.400 0.600
#> GSM1124932     2   0.000      0.972 0.000 1.000
#> GSM1124933     1   0.000      0.967 1.000 0.000
#> GSM1124867     1   0.000      0.967 1.000 0.000
#> GSM1124868     2   0.000      0.972 0.000 1.000
#> GSM1124878     2   0.000      0.972 0.000 1.000
#> GSM1124895     2   0.000      0.972 0.000 1.000
#> GSM1124897     2   0.000      0.972 0.000 1.000
#> GSM1124902     2   0.000      0.972 0.000 1.000
#> GSM1124908     2   0.000      0.972 0.000 1.000
#> GSM1124921     2   0.000      0.972 0.000 1.000
#> GSM1124939     2   0.000      0.972 0.000 1.000
#> GSM1124944     2   0.541      0.837 0.124 0.876
#> GSM1124945     1   0.000      0.967 1.000 0.000
#> GSM1124946     2   0.000      0.972 0.000 1.000
#> GSM1124947     2   0.000      0.972 0.000 1.000
#> GSM1124951     1   0.000      0.967 1.000 0.000
#> GSM1124952     2   0.000      0.972 0.000 1.000
#> GSM1124957     1   0.000      0.967 1.000 0.000
#> GSM1124900     1   0.821      0.657 0.744 0.256
#> GSM1124914     2   0.000      0.972 0.000 1.000
#> GSM1124871     2   0.000      0.972 0.000 1.000
#> GSM1124874     2   0.000      0.972 0.000 1.000
#> GSM1124875     2   0.000      0.972 0.000 1.000
#> GSM1124880     1   0.000      0.967 1.000 0.000
#> GSM1124881     2   0.000      0.972 0.000 1.000
#> GSM1124885     2   0.000      0.972 0.000 1.000
#> GSM1124886     1   0.000      0.967 1.000 0.000
#> GSM1124887     2   0.000      0.972 0.000 1.000
#> GSM1124894     2   0.000      0.972 0.000 1.000
#> GSM1124896     1   0.983      0.276 0.576 0.424
#> GSM1124899     2   0.000      0.972 0.000 1.000
#> GSM1124901     2   0.000      0.972 0.000 1.000
#> GSM1124906     2   0.000      0.972 0.000 1.000
#> GSM1124907     2   0.000      0.972 0.000 1.000
#> GSM1124911     2   0.000      0.972 0.000 1.000
#> GSM1124912     1   0.000      0.967 1.000 0.000
#> GSM1124915     2   0.000      0.972 0.000 1.000
#> GSM1124917     2   0.000      0.972 0.000 1.000
#> GSM1124918     2   0.000      0.972 0.000 1.000
#> GSM1124920     1   0.000      0.967 1.000 0.000
#> GSM1124922     2   0.000      0.972 0.000 1.000
#> GSM1124924     1   0.000      0.967 1.000 0.000
#> GSM1124926     2   0.000      0.972 0.000 1.000
#> GSM1124928     1   0.000      0.967 1.000 0.000
#> GSM1124930     1   0.861      0.588 0.716 0.284
#> GSM1124931     2   0.000      0.972 0.000 1.000
#> GSM1124935     2   0.000      0.972 0.000 1.000
#> GSM1124936     1   0.000      0.967 1.000 0.000
#> GSM1124938     1   0.000      0.967 1.000 0.000
#> GSM1124940     1   0.000      0.967 1.000 0.000
#> GSM1124941     2   0.000      0.972 0.000 1.000
#> GSM1124942     2   0.000      0.972 0.000 1.000
#> GSM1124943     1   0.000      0.967 1.000 0.000
#> GSM1124948     1   0.000      0.967 1.000 0.000
#> GSM1124949     1   0.000      0.967 1.000 0.000
#> GSM1124950     2   0.000      0.972 0.000 1.000
#> GSM1124954     1   0.000      0.967 1.000 0.000
#> GSM1124955     1   0.714      0.750 0.804 0.196
#> GSM1124956     2   0.000      0.972 0.000 1.000
#> GSM1124872     2   0.000      0.972 0.000 1.000
#> GSM1124873     2   0.000      0.972 0.000 1.000
#> GSM1124876     1   0.000      0.967 1.000 0.000
#> GSM1124877     1   0.000      0.967 1.000 0.000
#> GSM1124879     1   0.000      0.967 1.000 0.000
#> GSM1124883     2   0.000      0.972 0.000 1.000
#> GSM1124889     2   0.000      0.972 0.000 1.000
#> GSM1124892     1   0.000      0.967 1.000 0.000
#> GSM1124893     1   0.000      0.967 1.000 0.000
#> GSM1124909     2   0.990      0.172 0.440 0.560
#> GSM1124913     2   0.000      0.972 0.000 1.000
#> GSM1124916     2   0.000      0.972 0.000 1.000
#> GSM1124923     2   0.971      0.333 0.400 0.600
#> GSM1124925     2   0.000      0.972 0.000 1.000
#> GSM1124929     1   0.000      0.967 1.000 0.000
#> GSM1124934     1   0.000      0.967 1.000 0.000
#> GSM1124937     1   0.000      0.967 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124888     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124890     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124904     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124927     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124953     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124869     1  0.6680     0.7307 0.508 0.484 0.008
#> GSM1124870     1  0.6305     0.7318 0.516 0.484 0.000
#> GSM1124882     1  0.6823     0.7284 0.504 0.484 0.012
#> GSM1124884     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124898     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124903     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124905     1  0.6680     0.7307 0.508 0.484 0.008
#> GSM1124910     3  0.2866     0.8792 0.076 0.008 0.916
#> GSM1124919     3  0.3192     0.8198 0.000 0.112 0.888
#> GSM1124932     1  0.0000     0.2271 1.000 0.000 0.000
#> GSM1124933     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124867     3  0.5096     0.8128 0.080 0.084 0.836
#> GSM1124868     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124878     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124895     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124897     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124902     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124908     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124921     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124939     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124944     2  0.9304     0.6649 0.280 0.516 0.204
#> GSM1124945     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124946     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124947     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124951     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124952     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124957     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124900     1  0.6305     0.7318 0.516 0.484 0.000
#> GSM1124914     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124871     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124874     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124875     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124880     3  0.5823     0.7670 0.064 0.144 0.792
#> GSM1124881     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124885     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124886     3  0.7421     0.5842 0.240 0.084 0.676
#> GSM1124887     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124894     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124896     1  0.6305     0.7318 0.516 0.484 0.000
#> GSM1124899     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124901     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124906     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124907     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124911     1  0.3116    -0.0963 0.892 0.108 0.000
#> GSM1124912     1  0.6680     0.7307 0.508 0.484 0.008
#> GSM1124915     2  0.6308     0.9537 0.492 0.508 0.000
#> GSM1124917     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124918     1  0.4931    -0.4651 0.768 0.232 0.000
#> GSM1124920     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124922     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124924     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124926     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124928     1  0.6823     0.7284 0.504 0.484 0.012
#> GSM1124930     3  0.0237     0.9230 0.000 0.004 0.996
#> GSM1124931     1  0.4931    -0.4651 0.768 0.232 0.000
#> GSM1124935     1  0.3116    -0.0963 0.892 0.108 0.000
#> GSM1124936     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124938     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124940     1  0.6680     0.7307 0.508 0.484 0.008
#> GSM1124941     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124942     2  0.7883     0.8905 0.428 0.516 0.056
#> GSM1124943     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124948     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124949     2  0.9152    -0.7207 0.364 0.484 0.152
#> GSM1124950     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124954     3  0.6672     0.1928 0.472 0.008 0.520
#> GSM1124955     1  0.6305     0.7318 0.516 0.484 0.000
#> GSM1124956     1  0.3116    -0.0963 0.892 0.108 0.000
#> GSM1124872     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124873     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124876     3  0.0000     0.9260 0.000 0.000 1.000
#> GSM1124877     1  0.6305     0.7318 0.516 0.484 0.000
#> GSM1124879     1  0.6823     0.7284 0.504 0.484 0.012
#> GSM1124883     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124889     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124892     3  0.2866     0.8792 0.076 0.008 0.916
#> GSM1124893     1  0.6680     0.7307 0.508 0.484 0.008
#> GSM1124909     1  0.6633     0.7097 0.548 0.444 0.008
#> GSM1124913     2  0.6305     0.9625 0.484 0.516 0.000
#> GSM1124916     1  0.5529     0.6509 0.704 0.296 0.000
#> GSM1124923     3  0.3192     0.8198 0.000 0.112 0.888
#> GSM1124925     1  0.5431     0.6441 0.716 0.284 0.000
#> GSM1124929     1  0.6305     0.7318 0.516 0.484 0.000
#> GSM1124934     1  0.7561    -0.0388 0.516 0.040 0.444
#> GSM1124937     3  0.2772     0.8786 0.004 0.080 0.916

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124888     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124890     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124904     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124927     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124953     3  0.0188     0.9316 0.000 0.000 0.996 0.004
#> GSM1124869     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124870     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124882     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124884     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124898     2  0.0188     0.9321 0.000 0.996 0.000 0.004
#> GSM1124903     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124905     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124910     3  0.4967     0.0835 0.452 0.000 0.548 0.000
#> GSM1124919     3  0.0779     0.9189 0.000 0.004 0.980 0.016
#> GSM1124932     4  0.4049     0.8270 0.008 0.212 0.000 0.780
#> GSM1124933     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124867     1  0.4560     0.5837 0.700 0.000 0.296 0.004
#> GSM1124868     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124878     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124895     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124897     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124902     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124908     2  0.0188     0.9320 0.000 0.996 0.000 0.004
#> GSM1124921     2  0.3764     0.7911 0.000 0.784 0.000 0.216
#> GSM1124939     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124944     2  0.3764     0.7911 0.000 0.784 0.000 0.216
#> GSM1124945     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124946     2  0.3764     0.7911 0.000 0.784 0.000 0.216
#> GSM1124947     2  0.3569     0.8075 0.000 0.804 0.000 0.196
#> GSM1124951     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124952     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124957     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124900     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124914     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124871     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124874     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124875     2  0.3764     0.7911 0.000 0.784 0.000 0.216
#> GSM1124880     1  0.3688     0.7153 0.792 0.000 0.208 0.000
#> GSM1124881     2  0.3726     0.7935 0.000 0.788 0.000 0.212
#> GSM1124885     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124886     1  0.4406     0.5799 0.700 0.000 0.300 0.000
#> GSM1124887     2  0.3764     0.7911 0.000 0.784 0.000 0.216
#> GSM1124894     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124896     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124899     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124901     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124906     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124907     2  0.3764     0.7911 0.000 0.784 0.000 0.216
#> GSM1124911     4  0.4049     0.8270 0.008 0.212 0.000 0.780
#> GSM1124912     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124915     4  0.3801     0.8210 0.000 0.220 0.000 0.780
#> GSM1124917     2  0.3764     0.7911 0.000 0.784 0.000 0.216
#> GSM1124918     4  0.0336     0.6601 0.008 0.000 0.000 0.992
#> GSM1124920     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124922     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124924     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124926     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124928     1  0.0188     0.8895 0.996 0.000 0.004 0.000
#> GSM1124930     3  0.0592     0.9223 0.000 0.000 0.984 0.016
#> GSM1124931     4  0.4049     0.8270 0.008 0.212 0.000 0.780
#> GSM1124935     4  0.4049     0.8270 0.008 0.212 0.000 0.780
#> GSM1124936     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124938     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124940     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124941     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124942     2  0.3764     0.7911 0.000 0.784 0.000 0.216
#> GSM1124943     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124948     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124949     1  0.0188     0.8895 0.996 0.000 0.004 0.000
#> GSM1124950     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124954     4  0.5292     0.0773 0.008 0.000 0.480 0.512
#> GSM1124955     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124956     4  0.4049     0.8270 0.008 0.212 0.000 0.780
#> GSM1124872     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124873     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124876     3  0.0000     0.9344 0.000 0.000 1.000 0.000
#> GSM1124877     4  0.3801     0.5961 0.220 0.000 0.000 0.780
#> GSM1124879     1  0.0188     0.8895 0.996 0.000 0.004 0.000
#> GSM1124883     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124889     2  0.0188     0.9333 0.000 0.996 0.000 0.004
#> GSM1124892     3  0.4981     0.0388 0.464 0.000 0.536 0.000
#> GSM1124893     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124909     1  0.2197     0.8076 0.916 0.080 0.000 0.004
#> GSM1124913     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> GSM1124916     4  0.4348     0.8183 0.024 0.196 0.000 0.780
#> GSM1124923     3  0.0779     0.9189 0.000 0.004 0.980 0.016
#> GSM1124925     1  0.6147     0.4623 0.672 0.200 0.000 0.128
#> GSM1124929     1  0.0000     0.8910 1.000 0.000 0.000 0.000
#> GSM1124934     4  0.5172     0.2837 0.008 0.000 0.404 0.588
#> GSM1124937     1  0.4967     0.2234 0.548 0.000 0.452 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
#> GSM1124891     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124888     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124890     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124904     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124927     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124953     3  0.0510     0.9185 0.000 0.000 0.984 0.000 0.016
#> GSM1124869     1  0.0451     0.8687 0.988 0.000 0.000 0.008 0.004
#> GSM1124870     1  0.0451     0.8687 0.988 0.000 0.000 0.008 0.004
#> GSM1124882     1  0.0451     0.8687 0.988 0.000 0.000 0.008 0.004
#> GSM1124884     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124898     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124903     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124905     1  0.0000     0.8687 1.000 0.000 0.000 0.000 0.000
#> GSM1124910     3  0.3662     0.6330 0.252 0.000 0.744 0.004 0.000
#> GSM1124919     5  0.3242     0.6749 0.000 0.000 0.216 0.000 0.784
#> GSM1124932     4  0.0609     0.9034 0.000 0.020 0.000 0.980 0.000
#> GSM1124933     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     1  0.5888     0.1541 0.496 0.064 0.428 0.008 0.004
#> GSM1124868     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124878     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124895     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124897     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124902     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124908     5  0.4305    -0.2014 0.000 0.488 0.000 0.000 0.512
#> GSM1124921     5  0.0880     0.8229 0.000 0.032 0.000 0.000 0.968
#> GSM1124939     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124944     5  0.0162     0.8151 0.000 0.000 0.004 0.000 0.996
#> GSM1124945     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124946     5  0.1251     0.8203 0.000 0.036 0.000 0.008 0.956
#> GSM1124947     2  0.2233     0.7878 0.000 0.892 0.000 0.004 0.104
#> GSM1124951     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124952     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124957     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     1  0.0000     0.8687 1.000 0.000 0.000 0.000 0.000
#> GSM1124914     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124871     2  0.2690     0.8786 0.000 0.844 0.000 0.000 0.156
#> GSM1124874     2  0.0609     0.8790 0.000 0.980 0.000 0.000 0.020
#> GSM1124875     5  0.1697     0.8021 0.000 0.060 0.000 0.008 0.932
#> GSM1124880     1  0.4803     0.0202 0.496 0.000 0.488 0.012 0.004
#> GSM1124881     2  0.4150     0.2684 0.000 0.612 0.000 0.000 0.388
#> GSM1124885     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124886     1  0.4664     0.2070 0.552 0.000 0.436 0.008 0.004
#> GSM1124887     5  0.0880     0.8229 0.000 0.032 0.000 0.000 0.968
#> GSM1124894     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124896     1  0.0162     0.8673 0.996 0.000 0.000 0.004 0.000
#> GSM1124899     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124901     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124906     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124907     5  0.0566     0.8164 0.000 0.004 0.000 0.012 0.984
#> GSM1124911     4  0.0609     0.9034 0.000 0.020 0.000 0.980 0.000
#> GSM1124912     1  0.0000     0.8687 1.000 0.000 0.000 0.000 0.000
#> GSM1124915     4  0.1341     0.8675 0.000 0.056 0.000 0.944 0.000
#> GSM1124917     5  0.0880     0.8229 0.000 0.032 0.000 0.000 0.968
#> GSM1124918     4  0.0404     0.8833 0.000 0.000 0.000 0.988 0.012
#> GSM1124920     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124922     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124924     3  0.0955     0.9133 0.000 0.000 0.968 0.004 0.028
#> GSM1124926     2  0.0162     0.8767 0.000 0.996 0.000 0.000 0.004
#> GSM1124928     1  0.0451     0.8687 0.988 0.000 0.000 0.008 0.004
#> GSM1124930     5  0.4182     0.4122 0.000 0.000 0.352 0.004 0.644
#> GSM1124931     4  0.0609     0.9034 0.000 0.020 0.000 0.980 0.000
#> GSM1124935     4  0.0609     0.9034 0.000 0.020 0.000 0.980 0.000
#> GSM1124936     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124938     3  0.0865     0.9153 0.000 0.000 0.972 0.004 0.024
#> GSM1124940     1  0.0000     0.8687 1.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124942     5  0.0566     0.8145 0.000 0.000 0.004 0.012 0.984
#> GSM1124943     3  0.0955     0.9133 0.000 0.000 0.968 0.004 0.028
#> GSM1124948     3  0.0955     0.9133 0.000 0.000 0.968 0.004 0.028
#> GSM1124949     1  0.0451     0.8687 0.988 0.000 0.000 0.008 0.004
#> GSM1124950     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124954     3  0.4350     0.2783 0.000 0.000 0.588 0.408 0.004
#> GSM1124955     1  0.0000     0.8687 1.000 0.000 0.000 0.000 0.000
#> GSM1124956     4  0.0609     0.9034 0.000 0.020 0.000 0.980 0.000
#> GSM1124872     2  0.0000     0.8758 0.000 1.000 0.000 0.000 0.000
#> GSM1124873     2  0.1197     0.8809 0.000 0.952 0.000 0.000 0.048
#> GSM1124876     3  0.0000     0.9259 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     4  0.3160     0.7295 0.188 0.000 0.000 0.808 0.004
#> GSM1124879     1  0.0290     0.8689 0.992 0.000 0.000 0.008 0.000
#> GSM1124883     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124889     2  0.0404     0.8781 0.000 0.988 0.000 0.000 0.012
#> GSM1124892     3  0.3402     0.7347 0.184 0.000 0.804 0.008 0.004
#> GSM1124893     1  0.0000     0.8687 1.000 0.000 0.000 0.000 0.000
#> GSM1124909     1  0.4468     0.6055 0.716 0.240 0.000 0.044 0.000
#> GSM1124913     2  0.2813     0.8776 0.000 0.832 0.000 0.000 0.168
#> GSM1124916     4  0.0609     0.9034 0.000 0.020 0.000 0.980 0.000
#> GSM1124923     5  0.3366     0.6771 0.000 0.000 0.212 0.004 0.784
#> GSM1124925     1  0.3835     0.6794 0.796 0.156 0.000 0.048 0.000
#> GSM1124929     1  0.0451     0.8687 0.988 0.000 0.000 0.008 0.004
#> GSM1124934     4  0.4415     0.0859 0.000 0.000 0.444 0.552 0.004
#> GSM1124937     3  0.3087     0.7751 0.152 0.000 0.836 0.008 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.0000     0.7228 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124888     3  0.0146     0.7220 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1124890     3  0.0260     0.7203 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM1124904     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124927     2  0.3747     0.6241 0.000 0.604 0.000 0.396 0.000 0.000
#> GSM1124953     3  0.2573     0.6430 0.000 0.000 0.864 0.024 0.112 0.000
#> GSM1124869     1  0.2100     0.8686 0.884 0.000 0.000 0.112 0.000 0.004
#> GSM1124870     1  0.1908     0.8793 0.900 0.000 0.000 0.096 0.000 0.004
#> GSM1124882     1  0.1958     0.8779 0.896 0.000 0.000 0.100 0.000 0.004
#> GSM1124884     2  0.3592     0.6647 0.000 0.656 0.000 0.344 0.000 0.000
#> GSM1124898     2  0.1141     0.7761 0.000 0.948 0.000 0.000 0.052 0.000
#> GSM1124903     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124905     1  0.0935     0.8882 0.964 0.000 0.000 0.032 0.004 0.000
#> GSM1124910     3  0.5525     0.3868 0.168 0.000 0.628 0.180 0.024 0.000
#> GSM1124919     5  0.4368     0.6401 0.000 0.024 0.160 0.068 0.748 0.000
#> GSM1124932     6  0.0146     0.9598 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM1124933     3  0.0000     0.7228 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     4  0.5147     0.5097 0.152 0.000 0.124 0.692 0.028 0.004
#> GSM1124868     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124878     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124895     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124897     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124902     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124908     2  0.3905     0.3928 0.000 0.668 0.000 0.016 0.316 0.000
#> GSM1124921     5  0.3247     0.7468 0.000 0.156 0.000 0.036 0.808 0.000
#> GSM1124939     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124944     5  0.2106     0.7425 0.000 0.064 0.000 0.032 0.904 0.000
#> GSM1124945     3  0.0000     0.7228 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124946     5  0.3373     0.7059 0.000 0.248 0.000 0.008 0.744 0.000
#> GSM1124947     2  0.5075     0.4417 0.000 0.468 0.000 0.456 0.076 0.000
#> GSM1124951     3  0.0000     0.7228 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124952     2  0.3672     0.6492 0.000 0.632 0.000 0.368 0.000 0.000
#> GSM1124957     3  0.0000     0.7228 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     1  0.0436     0.8925 0.988 0.000 0.000 0.004 0.004 0.004
#> GSM1124914     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124871     2  0.0260     0.8050 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1124874     2  0.0865     0.8023 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM1124875     5  0.3797     0.6585 0.000 0.292 0.000 0.016 0.692 0.000
#> GSM1124880     4  0.6658     0.2348 0.244 0.000 0.264 0.448 0.044 0.000
#> GSM1124881     2  0.6081    -0.0182 0.000 0.384 0.000 0.276 0.340 0.000
#> GSM1124885     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124886     3  0.5657    -0.1468 0.412 0.000 0.452 0.132 0.000 0.004
#> GSM1124887     5  0.3071     0.7456 0.000 0.180 0.000 0.016 0.804 0.000
#> GSM1124894     2  0.3706     0.6385 0.000 0.620 0.000 0.380 0.000 0.000
#> GSM1124896     1  0.0291     0.8923 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM1124899     2  0.2996     0.7333 0.000 0.772 0.000 0.228 0.000 0.000
#> GSM1124901     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124906     2  0.3737     0.6282 0.000 0.608 0.000 0.392 0.000 0.000
#> GSM1124907     5  0.2724     0.7340 0.000 0.052 0.000 0.084 0.864 0.000
#> GSM1124911     6  0.0146     0.9598 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM1124912     1  0.0000     0.8951 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.0937     0.9149 0.000 0.040 0.000 0.000 0.000 0.960
#> GSM1124917     5  0.3582     0.7006 0.000 0.252 0.000 0.016 0.732 0.000
#> GSM1124918     6  0.0363     0.9517 0.000 0.000 0.000 0.000 0.012 0.988
#> GSM1124920     3  0.2384     0.6738 0.000 0.000 0.884 0.084 0.032 0.000
#> GSM1124922     2  0.3727     0.6324 0.000 0.612 0.000 0.388 0.000 0.000
#> GSM1124924     3  0.5289     0.3979 0.000 0.000 0.560 0.316 0.124 0.000
#> GSM1124926     2  0.1863     0.7835 0.000 0.896 0.000 0.104 0.000 0.000
#> GSM1124928     1  0.2738     0.8198 0.820 0.000 0.000 0.176 0.000 0.004
#> GSM1124930     5  0.5356     0.3325 0.000 0.000 0.168 0.248 0.584 0.000
#> GSM1124931     6  0.0146     0.9598 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM1124935     6  0.0146     0.9598 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM1124936     3  0.0000     0.7228 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124938     3  0.4061     0.5504 0.000 0.000 0.708 0.248 0.044 0.000
#> GSM1124940     1  0.0000     0.8951 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.3727     0.6319 0.000 0.612 0.000 0.388 0.000 0.000
#> GSM1124942     5  0.2971     0.7275 0.000 0.052 0.000 0.104 0.844 0.000
#> GSM1124943     3  0.5150     0.4570 0.000 0.000 0.608 0.256 0.136 0.000
#> GSM1124948     3  0.5341     0.3943 0.000 0.000 0.556 0.312 0.132 0.000
#> GSM1124949     1  0.2558     0.8375 0.840 0.000 0.000 0.156 0.000 0.004
#> GSM1124950     2  0.3727     0.6322 0.000 0.612 0.000 0.388 0.000 0.000
#> GSM1124954     3  0.5047     0.3016 0.000 0.000 0.564 0.088 0.000 0.348
#> GSM1124955     1  0.0146     0.8940 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1124956     6  0.0146     0.9598 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM1124872     2  0.3482     0.6827 0.000 0.684 0.000 0.316 0.000 0.000
#> GSM1124873     2  0.1007     0.8017 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM1124876     3  0.0000     0.7228 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     6  0.3587     0.7234 0.140 0.000 0.000 0.068 0.000 0.792
#> GSM1124879     1  0.2100     0.8653 0.884 0.000 0.000 0.112 0.004 0.000
#> GSM1124883     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124889     2  0.1267     0.7976 0.000 0.940 0.000 0.060 0.000 0.000
#> GSM1124892     3  0.3818     0.5435 0.084 0.000 0.784 0.128 0.000 0.004
#> GSM1124893     1  0.0146     0.8940 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM1124909     4  0.5534     0.2681 0.356 0.072 0.000 0.548 0.008 0.016
#> GSM1124913     2  0.0363     0.8051 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1124916     6  0.0146     0.9559 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM1124923     5  0.4368     0.6401 0.000 0.024 0.160 0.068 0.748 0.000
#> GSM1124925     1  0.3296     0.6718 0.836 0.088 0.000 0.004 0.004 0.068
#> GSM1124929     1  0.1908     0.8781 0.900 0.000 0.000 0.096 0.000 0.004
#> GSM1124934     3  0.5392     0.0650 0.000 0.000 0.448 0.112 0.000 0.440
#> GSM1124937     3  0.6017     0.1285 0.076 0.000 0.500 0.372 0.048 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 tissue(p) k
#> ATC:skmeans 87    0.4168 2
#> ATC:skmeans 82    0.0571 3
#> ATC:skmeans 85    0.2728 4
#> ATC:skmeans 83    0.4580 5
#> ATC:skmeans 77    0.3931 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 48983 rows and 91 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 0.977           0.945       0.978          0.271 0.752   0.752
#> 3 3 0.939           0.932       0.974          1.119 0.629   0.523
#> 4 4 0.805           0.890       0.936          0.142 0.907   0.788
#> 5 5 0.798           0.864       0.926          0.118 0.906   0.737
#> 6 6 0.723           0.792       0.880          0.032 0.990   0.964

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
#> GSM1124891     1  0.0000      0.982 1.000 0.000
#> GSM1124888     1  0.0000      0.982 1.000 0.000
#> GSM1124890     2  0.9754      0.322 0.408 0.592
#> GSM1124904     2  0.0000      0.976 0.000 1.000
#> GSM1124927     2  0.0000      0.976 0.000 1.000
#> GSM1124953     2  0.9635      0.369 0.388 0.612
#> GSM1124869     2  0.0376      0.975 0.004 0.996
#> GSM1124870     2  0.0376      0.975 0.004 0.996
#> GSM1124882     2  0.0376      0.975 0.004 0.996
#> GSM1124884     2  0.0000      0.976 0.000 1.000
#> GSM1124898     2  0.0000      0.976 0.000 1.000
#> GSM1124903     2  0.0000      0.976 0.000 1.000
#> GSM1124905     2  0.0376      0.975 0.004 0.996
#> GSM1124910     2  0.2236      0.945 0.036 0.964
#> GSM1124919     2  0.0000      0.976 0.000 1.000
#> GSM1124932     2  0.0376      0.975 0.004 0.996
#> GSM1124933     1  0.0000      0.982 1.000 0.000
#> GSM1124867     2  0.0376      0.975 0.004 0.996
#> GSM1124868     2  0.0000      0.976 0.000 1.000
#> GSM1124878     2  0.0000      0.976 0.000 1.000
#> GSM1124895     2  0.0000      0.976 0.000 1.000
#> GSM1124897     2  0.0000      0.976 0.000 1.000
#> GSM1124902     2  0.0000      0.976 0.000 1.000
#> GSM1124908     2  0.0000      0.976 0.000 1.000
#> GSM1124921     2  0.0000      0.976 0.000 1.000
#> GSM1124939     2  0.0000      0.976 0.000 1.000
#> GSM1124944     2  0.0000      0.976 0.000 1.000
#> GSM1124945     1  0.0000      0.982 1.000 0.000
#> GSM1124946     2  0.0000      0.976 0.000 1.000
#> GSM1124947     2  0.0000      0.976 0.000 1.000
#> GSM1124951     1  0.0000      0.982 1.000 0.000
#> GSM1124952     2  0.0000      0.976 0.000 1.000
#> GSM1124957     1  0.0000      0.982 1.000 0.000
#> GSM1124900     2  0.0376      0.975 0.004 0.996
#> GSM1124914     2  0.0000      0.976 0.000 1.000
#> GSM1124871     2  0.0000      0.976 0.000 1.000
#> GSM1124874     2  0.0000      0.976 0.000 1.000
#> GSM1124875     2  0.0000      0.976 0.000 1.000
#> GSM1124880     2  0.0376      0.975 0.004 0.996
#> GSM1124881     2  0.0000      0.976 0.000 1.000
#> GSM1124885     2  0.0000      0.976 0.000 1.000
#> GSM1124886     2  0.9815      0.288 0.420 0.580
#> GSM1124887     2  0.0000      0.976 0.000 1.000
#> GSM1124894     2  0.0000      0.976 0.000 1.000
#> GSM1124896     2  0.0376      0.975 0.004 0.996
#> GSM1124899     2  0.0000      0.976 0.000 1.000
#> GSM1124901     2  0.0000      0.976 0.000 1.000
#> GSM1124906     2  0.0000      0.976 0.000 1.000
#> GSM1124907     2  0.0000      0.976 0.000 1.000
#> GSM1124911     2  0.0000      0.976 0.000 1.000
#> GSM1124912     2  0.0376      0.975 0.004 0.996
#> GSM1124915     2  0.0000      0.976 0.000 1.000
#> GSM1124917     2  0.0000      0.976 0.000 1.000
#> GSM1124918     2  0.0000      0.976 0.000 1.000
#> GSM1124920     1  0.0000      0.982 1.000 0.000
#> GSM1124922     2  0.0000      0.976 0.000 1.000
#> GSM1124924     2  0.0376      0.975 0.004 0.996
#> GSM1124926     2  0.0000      0.976 0.000 1.000
#> GSM1124928     2  0.0376      0.975 0.004 0.996
#> GSM1124930     2  0.0376      0.975 0.004 0.996
#> GSM1124931     2  0.0000      0.976 0.000 1.000
#> GSM1124935     2  0.0000      0.976 0.000 1.000
#> GSM1124936     1  0.0000      0.982 1.000 0.000
#> GSM1124938     1  0.5059      0.877 0.888 0.112
#> GSM1124940     2  0.0376      0.975 0.004 0.996
#> GSM1124941     2  0.0000      0.976 0.000 1.000
#> GSM1124942     2  0.0000      0.976 0.000 1.000
#> GSM1124943     2  0.9795      0.300 0.416 0.584
#> GSM1124948     2  0.0376      0.975 0.004 0.996
#> GSM1124949     2  0.2043      0.949 0.032 0.968
#> GSM1124950     2  0.0000      0.976 0.000 1.000
#> GSM1124954     1  0.0000      0.982 1.000 0.000
#> GSM1124955     2  0.0376      0.975 0.004 0.996
#> GSM1124956     2  0.0000      0.976 0.000 1.000
#> GSM1124872     2  0.0000      0.976 0.000 1.000
#> GSM1124873     2  0.0000      0.976 0.000 1.000
#> GSM1124876     1  0.0000      0.982 1.000 0.000
#> GSM1124877     2  0.0376      0.975 0.004 0.996
#> GSM1124879     2  0.0376      0.975 0.004 0.996
#> GSM1124883     2  0.0000      0.976 0.000 1.000
#> GSM1124889     2  0.0000      0.976 0.000 1.000
#> GSM1124892     1  0.4690      0.891 0.900 0.100
#> GSM1124893     2  0.0376      0.975 0.004 0.996
#> GSM1124909     2  0.0376      0.975 0.004 0.996
#> GSM1124913     2  0.0000      0.976 0.000 1.000
#> GSM1124916     2  0.0376      0.975 0.004 0.996
#> GSM1124923     2  0.0000      0.976 0.000 1.000
#> GSM1124925     2  0.0000      0.976 0.000 1.000
#> GSM1124929     2  0.0376      0.975 0.004 0.996
#> GSM1124934     1  0.0000      0.982 1.000 0.000
#> GSM1124937     2  0.0376      0.975 0.004 0.996

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124888     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124890     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124904     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124927     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124953     2  0.6126      0.357 0.400 0.600 0.000
#> GSM1124869     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124870     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124882     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124884     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124898     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124903     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124905     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124910     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124919     2  0.4555      0.735 0.200 0.800 0.000
#> GSM1124932     2  0.6126      0.334 0.400 0.600 0.000
#> GSM1124933     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124867     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124868     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124878     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124895     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124897     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124902     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124908     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124921     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124939     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124944     2  0.2448      0.886 0.076 0.924 0.000
#> GSM1124945     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124946     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124947     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124951     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124952     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124957     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124900     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124914     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124871     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124874     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124875     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124880     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124881     2  0.0747      0.947 0.016 0.984 0.000
#> GSM1124885     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124886     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124887     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124894     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124896     1  0.4555      0.683 0.800 0.200 0.000
#> GSM1124899     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124901     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124906     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124907     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124911     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124912     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124915     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124917     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124918     2  0.0592      0.951 0.012 0.988 0.000
#> GSM1124920     1  0.5465      0.589 0.712 0.000 0.288
#> GSM1124922     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124924     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124926     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124928     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124930     1  0.4887      0.630 0.772 0.228 0.000
#> GSM1124931     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124935     2  0.0237      0.958 0.004 0.996 0.000
#> GSM1124936     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124938     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124940     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124941     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124942     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124943     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124948     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124949     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124950     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124954     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124955     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124956     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124872     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124873     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124876     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1124877     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124879     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124883     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124889     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124892     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124893     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124909     1  0.0424      0.960 0.992 0.008 0.000
#> GSM1124913     2  0.0000      0.962 0.000 1.000 0.000
#> GSM1124916     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124923     2  0.4555      0.735 0.200 0.800 0.000
#> GSM1124925     2  0.5733      0.519 0.324 0.676 0.000
#> GSM1124929     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124934     1  0.0000      0.969 1.000 0.000 0.000
#> GSM1124937     1  0.0000      0.969 1.000 0.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
#> GSM1124891     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124888     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124890     1  0.3610      0.816 0.800 0.000 0.0 0.200
#> GSM1124904     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124927     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124953     2  0.6855      0.396 0.200 0.600 0.0 0.200
#> GSM1124869     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124870     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124882     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124884     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124898     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124903     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124905     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124910     1  0.3123      0.843 0.844 0.000 0.0 0.156
#> GSM1124919     2  0.3610      0.738 0.000 0.800 0.0 0.200
#> GSM1124932     4  0.3610      0.889 0.000 0.200 0.0 0.800
#> GSM1124933     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124867     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124868     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124878     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124895     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124897     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124902     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124908     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124921     2  0.1211      0.913 0.000 0.960 0.0 0.040
#> GSM1124939     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124944     2  0.3323      0.827 0.064 0.876 0.0 0.060
#> GSM1124945     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124946     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124947     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124951     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124952     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124957     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124900     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124914     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124871     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124874     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124875     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124880     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124881     2  0.0592      0.934 0.016 0.984 0.0 0.000
#> GSM1124885     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124886     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124887     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124894     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124896     1  0.3610      0.663 0.800 0.200 0.0 0.000
#> GSM1124899     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124901     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124906     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124907     2  0.3610      0.738 0.000 0.800 0.0 0.200
#> GSM1124911     4  0.3610      0.889 0.000 0.200 0.0 0.800
#> GSM1124912     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124915     4  0.3610      0.889 0.000 0.200 0.0 0.800
#> GSM1124917     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124918     4  0.4319      0.799 0.012 0.228 0.0 0.760
#> GSM1124920     1  0.5784      0.732 0.700 0.000 0.1 0.200
#> GSM1124922     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124924     1  0.3610      0.816 0.800 0.000 0.0 0.200
#> GSM1124926     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124928     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124930     1  0.7058      0.463 0.572 0.228 0.0 0.200
#> GSM1124931     4  0.3610      0.889 0.000 0.200 0.0 0.800
#> GSM1124935     4  0.3610      0.889 0.000 0.200 0.0 0.800
#> GSM1124936     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124938     1  0.3610      0.816 0.800 0.000 0.0 0.200
#> GSM1124940     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124941     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124942     2  0.3610      0.738 0.000 0.800 0.0 0.200
#> GSM1124943     1  0.3610      0.816 0.800 0.000 0.0 0.200
#> GSM1124948     1  0.3610      0.816 0.800 0.000 0.0 0.200
#> GSM1124949     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124950     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124954     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124955     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124956     4  0.3610      0.889 0.000 0.200 0.0 0.800
#> GSM1124872     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124873     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124876     3  0.0000      1.000 0.000 0.000 1.0 0.000
#> GSM1124877     4  0.3610      0.642 0.200 0.000 0.0 0.800
#> GSM1124879     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124883     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124889     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124892     1  0.1716      0.889 0.936 0.000 0.0 0.064
#> GSM1124893     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124909     1  0.0336      0.908 0.992 0.008 0.0 0.000
#> GSM1124913     2  0.0000      0.949 0.000 1.000 0.0 0.000
#> GSM1124916     4  0.3649      0.639 0.204 0.000 0.0 0.796
#> GSM1124923     2  0.3610      0.738 0.000 0.800 0.0 0.200
#> GSM1124925     2  0.4543      0.399 0.324 0.676 0.0 0.000
#> GSM1124929     1  0.0000      0.914 1.000 0.000 0.0 0.000
#> GSM1124934     1  0.2149      0.843 0.912 0.000 0.0 0.088
#> GSM1124937     1  0.0000      0.914 1.000 0.000 0.0 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
#> GSM1124891     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124888     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124890     5  0.0290     0.8133 0.008 0.000  0 0.000 0.992
#> GSM1124904     2  0.0290     0.9101 0.000 0.992  0 0.000 0.008
#> GSM1124927     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124953     5  0.0162     0.8110 0.000 0.000  0 0.004 0.996
#> GSM1124869     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124870     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124882     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124884     2  0.1608     0.8926 0.000 0.928  0 0.072 0.000
#> GSM1124898     2  0.0404     0.9098 0.000 0.988  0 0.000 0.012
#> GSM1124903     2  0.3209     0.8293 0.000 0.812  0 0.180 0.008
#> GSM1124905     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124910     1  0.3274     0.7124 0.780 0.000  0 0.000 0.220
#> GSM1124919     5  0.4410     0.0512 0.000 0.440  0 0.004 0.556
#> GSM1124932     4  0.2966     0.8375 0.000 0.184  0 0.816 0.000
#> GSM1124933     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124867     1  0.1124     0.9357 0.960 0.000  0 0.004 0.036
#> GSM1124868     2  0.3209     0.8293 0.000 0.812  0 0.180 0.008
#> GSM1124878     2  0.3209     0.8293 0.000 0.812  0 0.180 0.008
#> GSM1124895     2  0.3209     0.8293 0.000 0.812  0 0.180 0.008
#> GSM1124897     2  0.1168     0.9042 0.000 0.960  0 0.032 0.008
#> GSM1124902     2  0.1168     0.9042 0.000 0.960  0 0.032 0.008
#> GSM1124908     2  0.1205     0.8943 0.000 0.956  0 0.004 0.040
#> GSM1124921     2  0.2890     0.8020 0.000 0.836  0 0.004 0.160
#> GSM1124939     2  0.0162     0.9103 0.000 0.996  0 0.000 0.004
#> GSM1124944     2  0.4426     0.7213 0.052 0.748  0 0.004 0.196
#> GSM1124945     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124946     2  0.0671     0.9077 0.000 0.980  0 0.004 0.016
#> GSM1124947     2  0.0451     0.9077 0.000 0.988  0 0.004 0.008
#> GSM1124951     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124952     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124957     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124900     1  0.0963     0.9242 0.964 0.036  0 0.000 0.000
#> GSM1124914     2  0.0162     0.9103 0.000 0.996  0 0.000 0.004
#> GSM1124871     2  0.1041     0.9041 0.000 0.964  0 0.032 0.004
#> GSM1124874     2  0.2471     0.8577 0.000 0.864  0 0.136 0.000
#> GSM1124875     2  0.0566     0.9075 0.000 0.984  0 0.004 0.012
#> GSM1124880     1  0.0963     0.9372 0.964 0.000  0 0.000 0.036
#> GSM1124881     2  0.1059     0.9018 0.020 0.968  0 0.004 0.008
#> GSM1124885     2  0.3132     0.8345 0.000 0.820  0 0.172 0.008
#> GSM1124886     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124887     2  0.2763     0.8076 0.000 0.848  0 0.004 0.148
#> GSM1124894     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124896     1  0.3274     0.6493 0.780 0.220  0 0.000 0.000
#> GSM1124899     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124901     2  0.3086     0.8294 0.000 0.816  0 0.180 0.004
#> GSM1124906     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124907     5  0.1768     0.7737 0.000 0.072  0 0.004 0.924
#> GSM1124911     4  0.1043     0.7836 0.000 0.040  0 0.960 0.000
#> GSM1124912     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124915     4  0.0162     0.7476 0.000 0.004  0 0.996 0.000
#> GSM1124917     2  0.2719     0.8118 0.000 0.852  0 0.004 0.144
#> GSM1124918     4  0.4734     0.7576 0.020 0.228  0 0.720 0.032
#> GSM1124920     5  0.2605     0.7735 0.148 0.000  0 0.000 0.852
#> GSM1124922     2  0.0290     0.9084 0.008 0.992  0 0.000 0.000
#> GSM1124924     5  0.2605     0.7735 0.148 0.000  0 0.000 0.852
#> GSM1124926     2  0.1792     0.8863 0.000 0.916  0 0.084 0.000
#> GSM1124928     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124930     5  0.0162     0.8117 0.000 0.004  0 0.000 0.996
#> GSM1124931     4  0.2966     0.8375 0.000 0.184  0 0.816 0.000
#> GSM1124935     4  0.2966     0.8375 0.000 0.184  0 0.816 0.000
#> GSM1124936     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124938     5  0.2605     0.7735 0.148 0.000  0 0.000 0.852
#> GSM1124940     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124941     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124942     5  0.3177     0.6340 0.000 0.208  0 0.000 0.792
#> GSM1124943     5  0.0290     0.8133 0.008 0.000  0 0.000 0.992
#> GSM1124948     5  0.2605     0.7735 0.148 0.000  0 0.000 0.852
#> GSM1124949     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124950     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124954     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124955     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124956     4  0.2648     0.8354 0.000 0.152  0 0.848 0.000
#> GSM1124872     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124873     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124876     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> GSM1124877     4  0.3109     0.7083 0.200 0.000  0 0.800 0.000
#> GSM1124879     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124883     2  0.3209     0.8293 0.000 0.812  0 0.180 0.008
#> GSM1124889     2  0.0000     0.9105 0.000 1.000  0 0.000 0.000
#> GSM1124892     1  0.1544     0.9035 0.932 0.000  0 0.000 0.068
#> GSM1124893     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124909     1  0.1197     0.9124 0.952 0.048  0 0.000 0.000
#> GSM1124913     2  0.3209     0.8293 0.000 0.812  0 0.180 0.008
#> GSM1124916     4  0.3650     0.7387 0.176 0.028  0 0.796 0.000
#> GSM1124923     5  0.0162     0.8110 0.000 0.000  0 0.004 0.996
#> GSM1124925     2  0.4770     0.4400 0.320 0.644  0 0.036 0.000
#> GSM1124929     1  0.0000     0.9536 1.000 0.000  0 0.000 0.000
#> GSM1124934     1  0.1965     0.8669 0.904 0.000  0 0.096 0.000
#> GSM1124937     1  0.0963     0.9372 0.964 0.000  0 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124888     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124890     5  0.0291      0.735 0.004 0.000 0.000 0.004 0.992 0.000
#> GSM1124904     2  0.1700      0.863 0.000 0.916 0.000 0.080 0.004 0.000
#> GSM1124927     2  0.1462      0.851 0.008 0.936 0.000 0.056 0.000 0.000
#> GSM1124953     5  0.1934      0.716 0.000 0.000 0.000 0.044 0.916 0.040
#> GSM1124869     1  0.0363      0.869 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM1124870     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124882     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.2378      0.849 0.000 0.848 0.000 0.152 0.000 0.000
#> GSM1124898     2  0.0520      0.864 0.000 0.984 0.000 0.008 0.008 0.000
#> GSM1124903     2  0.3221      0.823 0.000 0.772 0.000 0.220 0.004 0.004
#> GSM1124905     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124910     1  0.3647      0.468 0.640 0.000 0.000 0.000 0.360 0.000
#> GSM1124919     5  0.5387      0.109 0.000 0.372 0.000 0.044 0.544 0.040
#> GSM1124932     6  0.1007      0.877 0.000 0.044 0.000 0.000 0.000 0.956
#> GSM1124933     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     1  0.4663      0.659 0.748 0.012 0.000 0.052 0.148 0.040
#> GSM1124868     2  0.3221      0.823 0.000 0.772 0.000 0.220 0.004 0.004
#> GSM1124878     2  0.3221      0.823 0.000 0.772 0.000 0.220 0.004 0.004
#> GSM1124895     2  0.3221      0.823 0.000 0.772 0.000 0.220 0.004 0.004
#> GSM1124897     2  0.2442      0.850 0.000 0.852 0.000 0.144 0.004 0.000
#> GSM1124902     2  0.2234      0.856 0.000 0.872 0.000 0.124 0.004 0.000
#> GSM1124908     2  0.2833      0.830 0.008 0.864 0.000 0.040 0.088 0.000
#> GSM1124921     2  0.3835      0.785 0.012 0.820 0.000 0.040 0.088 0.040
#> GSM1124939     2  0.1444      0.863 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM1124944     2  0.5284      0.669 0.024 0.680 0.000 0.044 0.212 0.040
#> GSM1124945     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124946     2  0.3080      0.846 0.000 0.848 0.000 0.100 0.012 0.040
#> GSM1124947     2  0.3174      0.823 0.012 0.848 0.000 0.096 0.004 0.040
#> GSM1124951     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124952     2  0.1462      0.851 0.008 0.936 0.000 0.056 0.000 0.000
#> GSM1124957     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124900     1  0.2340      0.696 0.852 0.148 0.000 0.000 0.000 0.000
#> GSM1124914     2  0.1531      0.863 0.000 0.928 0.000 0.068 0.004 0.000
#> GSM1124871     2  0.2300      0.850 0.000 0.856 0.000 0.144 0.000 0.000
#> GSM1124874     2  0.2738      0.842 0.000 0.820 0.000 0.176 0.000 0.004
#> GSM1124875     2  0.2647      0.839 0.012 0.892 0.000 0.044 0.012 0.040
#> GSM1124880     1  0.2378      0.760 0.848 0.000 0.000 0.000 0.152 0.000
#> GSM1124881     2  0.3285      0.822 0.012 0.844 0.000 0.096 0.008 0.040
#> GSM1124885     2  0.3221      0.823 0.000 0.772 0.000 0.220 0.004 0.004
#> GSM1124886     1  0.0363      0.869 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM1124887     2  0.4978      0.687 0.008 0.696 0.000 0.048 0.208 0.040
#> GSM1124894     2  0.1267      0.854 0.000 0.940 0.000 0.060 0.000 0.000
#> GSM1124896     1  0.3390      0.475 0.704 0.296 0.000 0.000 0.000 0.000
#> GSM1124899     2  0.1204      0.853 0.000 0.944 0.000 0.056 0.000 0.000
#> GSM1124901     2  0.3081      0.823 0.000 0.776 0.000 0.220 0.000 0.004
#> GSM1124906     2  0.1204      0.853 0.000 0.944 0.000 0.056 0.000 0.000
#> GSM1124907     5  0.3185      0.689 0.004 0.056 0.000 0.040 0.860 0.040
#> GSM1124911     6  0.1010      0.848 0.000 0.004 0.000 0.036 0.000 0.960
#> GSM1124912     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.0937      0.844 0.000 0.000 0.000 0.040 0.000 0.960
#> GSM1124917     2  0.4890      0.697 0.008 0.704 0.000 0.044 0.204 0.040
#> GSM1124918     6  0.3994      0.557 0.012 0.196 0.000 0.040 0.000 0.752
#> GSM1124920     5  0.2854      0.645 0.208 0.000 0.000 0.000 0.792 0.000
#> GSM1124922     2  0.1745      0.847 0.020 0.924 0.000 0.056 0.000 0.000
#> GSM1124924     5  0.2823      0.648 0.204 0.000 0.000 0.000 0.796 0.000
#> GSM1124926     2  0.1765      0.860 0.000 0.904 0.000 0.096 0.000 0.000
#> GSM1124928     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124930     5  0.0000      0.734 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1124931     6  0.1007      0.877 0.000 0.044 0.000 0.000 0.000 0.956
#> GSM1124935     6  0.1007      0.877 0.000 0.044 0.000 0.000 0.000 0.956
#> GSM1124936     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124938     5  0.2854      0.645 0.208 0.000 0.000 0.000 0.792 0.000
#> GSM1124940     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.1204      0.853 0.000 0.944 0.000 0.056 0.000 0.000
#> GSM1124942     5  0.3082      0.634 0.000 0.144 0.000 0.008 0.828 0.020
#> GSM1124943     5  0.0146      0.735 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM1124948     5  0.2854      0.645 0.208 0.000 0.000 0.000 0.792 0.000
#> GSM1124949     1  0.0363      0.869 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM1124950     2  0.1204      0.853 0.000 0.944 0.000 0.056 0.000 0.000
#> GSM1124954     4  0.3547      0.289 0.000 0.000 0.332 0.668 0.000 0.000
#> GSM1124955     1  0.0000      0.872 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     6  0.1007      0.877 0.000 0.044 0.000 0.000 0.000 0.956
#> GSM1124872     2  0.1204      0.853 0.000 0.944 0.000 0.056 0.000 0.000
#> GSM1124873     2  0.0865      0.865 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM1124876     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124877     4  0.4709      0.605 0.188 0.000 0.000 0.680 0.000 0.132
#> GSM1124879     1  0.0146      0.871 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM1124883     2  0.3221      0.823 0.000 0.772 0.000 0.220 0.004 0.004
#> GSM1124889     2  0.0260      0.864 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM1124892     1  0.2019      0.802 0.900 0.000 0.000 0.012 0.088 0.000
#> GSM1124893     1  0.0363      0.869 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM1124909     1  0.2491      0.674 0.836 0.164 0.000 0.000 0.000 0.000
#> GSM1124913     2  0.3221      0.823 0.000 0.772 0.000 0.220 0.004 0.004
#> GSM1124916     6  0.3563      0.675 0.132 0.072 0.000 0.000 0.000 0.796
#> GSM1124923     5  0.1934      0.716 0.000 0.000 0.000 0.044 0.916 0.040
#> GSM1124925     2  0.5458      0.314 0.364 0.544 0.000 0.032 0.000 0.060
#> GSM1124929     1  0.0363      0.869 0.988 0.000 0.000 0.012 0.000 0.000
#> GSM1124934     4  0.3707      0.594 0.312 0.000 0.000 0.680 0.000 0.008
#> GSM1124937     1  0.2340      0.763 0.852 0.000 0.000 0.000 0.148 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 tissue(p) k
#> ATC:pam 87    0.2443 2
#> ATC:pam 89    0.0507 3
#> ATC:pam 88    0.1602 4
#> ATC:pam 89    0.0292 5
#> ATC:pam 86    0.0194 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 48983 rows and 91 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.721           0.944       0.956         0.4007 0.561   0.561
#> 3 3 0.665           0.825       0.887         0.3581 0.827   0.711
#> 4 4 0.824           0.872       0.919         0.2548 0.743   0.507
#> 5 5 0.807           0.843       0.842         0.1451 0.865   0.589
#> 6 6 0.865           0.864       0.907         0.0537 0.921   0.647

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
#> GSM1124891     1  0.6247      0.886 0.844 0.156
#> GSM1124888     1  0.6247      0.886 0.844 0.156
#> GSM1124890     1  0.9323      0.645 0.652 0.348
#> GSM1124904     2  0.0000      0.993 0.000 1.000
#> GSM1124927     2  0.0000      0.993 0.000 1.000
#> GSM1124953     1  0.6247      0.886 0.844 0.156
#> GSM1124869     2  0.0672      0.992 0.008 0.992
#> GSM1124870     2  0.0938      0.989 0.012 0.988
#> GSM1124882     2  0.0672      0.992 0.008 0.992
#> GSM1124884     2  0.0000      0.993 0.000 1.000
#> GSM1124898     2  0.0000      0.993 0.000 1.000
#> GSM1124903     2  0.0000      0.993 0.000 1.000
#> GSM1124905     2  0.0672      0.992 0.008 0.992
#> GSM1124910     2  0.0672      0.992 0.008 0.992
#> GSM1124919     1  0.8016      0.803 0.756 0.244
#> GSM1124932     1  0.0000      0.867 1.000 0.000
#> GSM1124933     1  0.6247      0.886 0.844 0.156
#> GSM1124867     2  0.0672      0.992 0.008 0.992
#> GSM1124868     2  0.0000      0.993 0.000 1.000
#> GSM1124878     2  0.0000      0.993 0.000 1.000
#> GSM1124895     2  0.0000      0.993 0.000 1.000
#> GSM1124897     2  0.0000      0.993 0.000 1.000
#> GSM1124902     2  0.0000      0.993 0.000 1.000
#> GSM1124908     2  0.0000      0.993 0.000 1.000
#> GSM1124921     2  0.0672      0.988 0.008 0.992
#> GSM1124939     2  0.0000      0.993 0.000 1.000
#> GSM1124944     2  0.0000      0.993 0.000 1.000
#> GSM1124945     1  0.6247      0.886 0.844 0.156
#> GSM1124946     2  0.0376      0.993 0.004 0.996
#> GSM1124947     2  0.0000      0.993 0.000 1.000
#> GSM1124951     1  0.6247      0.886 0.844 0.156
#> GSM1124952     2  0.0000      0.993 0.000 1.000
#> GSM1124957     1  0.6247      0.886 0.844 0.156
#> GSM1124900     2  0.0672      0.992 0.008 0.992
#> GSM1124914     2  0.0000      0.993 0.000 1.000
#> GSM1124871     2  0.0000      0.993 0.000 1.000
#> GSM1124874     2  0.0000      0.993 0.000 1.000
#> GSM1124875     2  0.0000      0.993 0.000 1.000
#> GSM1124880     2  0.0672      0.992 0.008 0.992
#> GSM1124881     2  0.0000      0.993 0.000 1.000
#> GSM1124885     2  0.0000      0.993 0.000 1.000
#> GSM1124886     2  0.0672      0.992 0.008 0.992
#> GSM1124887     2  0.5519      0.833 0.128 0.872
#> GSM1124894     2  0.0000      0.993 0.000 1.000
#> GSM1124896     2  0.0672      0.992 0.008 0.992
#> GSM1124899     2  0.0000      0.993 0.000 1.000
#> GSM1124901     2  0.0000      0.993 0.000 1.000
#> GSM1124906     2  0.0000      0.993 0.000 1.000
#> GSM1124907     2  0.0672      0.992 0.008 0.992
#> GSM1124911     1  0.0000      0.867 1.000 0.000
#> GSM1124912     2  0.0672      0.992 0.008 0.992
#> GSM1124915     1  0.0000      0.867 1.000 0.000
#> GSM1124917     1  0.6438      0.883 0.836 0.164
#> GSM1124918     1  0.0938      0.865 0.988 0.012
#> GSM1124920     1  0.9635      0.571 0.612 0.388
#> GSM1124922     2  0.0000      0.993 0.000 1.000
#> GSM1124924     2  0.0672      0.992 0.008 0.992
#> GSM1124926     2  0.0000      0.993 0.000 1.000
#> GSM1124928     2  0.0672      0.992 0.008 0.992
#> GSM1124930     1  0.9000      0.707 0.684 0.316
#> GSM1124931     1  0.0000      0.867 1.000 0.000
#> GSM1124935     1  0.0000      0.867 1.000 0.000
#> GSM1124936     1  0.6247      0.886 0.844 0.156
#> GSM1124938     1  0.6247      0.886 0.844 0.156
#> GSM1124940     2  0.0672      0.992 0.008 0.992
#> GSM1124941     2  0.0000      0.993 0.000 1.000
#> GSM1124942     2  0.0672      0.992 0.008 0.992
#> GSM1124943     1  0.7815      0.820 0.768 0.232
#> GSM1124948     2  0.0672      0.992 0.008 0.992
#> GSM1124949     2  0.0672      0.992 0.008 0.992
#> GSM1124950     2  0.0000      0.993 0.000 1.000
#> GSM1124954     1  0.0000      0.867 1.000 0.000
#> GSM1124955     2  0.0672      0.992 0.008 0.992
#> GSM1124956     1  0.0000      0.867 1.000 0.000
#> GSM1124872     2  0.0000      0.993 0.000 1.000
#> GSM1124873     2  0.0000      0.993 0.000 1.000
#> GSM1124876     1  0.6247      0.886 0.844 0.156
#> GSM1124877     1  0.0000      0.867 1.000 0.000
#> GSM1124879     2  0.0672      0.992 0.008 0.992
#> GSM1124883     2  0.0000      0.993 0.000 1.000
#> GSM1124889     2  0.0000      0.993 0.000 1.000
#> GSM1124892     2  0.0672      0.992 0.008 0.992
#> GSM1124893     2  0.0672      0.992 0.008 0.992
#> GSM1124909     2  0.0672      0.992 0.008 0.992
#> GSM1124913     2  0.0000      0.993 0.000 1.000
#> GSM1124916     1  0.0000      0.867 1.000 0.000
#> GSM1124923     1  0.6247      0.886 0.844 0.156
#> GSM1124925     2  0.1184      0.986 0.016 0.984
#> GSM1124929     1  0.6973      0.786 0.812 0.188
#> GSM1124934     1  0.0000      0.867 1.000 0.000
#> GSM1124937     2  0.0672      0.992 0.008 0.992

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124888     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124890     3  0.4172      0.713 0.004 0.156 0.840
#> GSM1124904     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124927     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124953     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124869     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124870     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124882     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124884     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124898     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124903     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124905     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124910     2  0.4784      0.833 0.200 0.796 0.004
#> GSM1124919     3  0.1411      0.731 0.000 0.036 0.964
#> GSM1124932     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124933     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124867     2  0.1163      0.899 0.028 0.972 0.000
#> GSM1124868     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124878     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124895     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124897     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124902     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124908     2  0.0592      0.898 0.000 0.988 0.012
#> GSM1124921     2  0.6299     -0.295 0.000 0.524 0.476
#> GSM1124939     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124944     3  0.6286      0.429 0.000 0.464 0.536
#> GSM1124945     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124946     2  0.0424      0.901 0.000 0.992 0.008
#> GSM1124947     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124951     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124952     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124957     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124900     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124914     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124871     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124874     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124875     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124880     2  0.3619      0.860 0.136 0.864 0.000
#> GSM1124881     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124885     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124886     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124887     3  0.6302      0.377 0.000 0.480 0.520
#> GSM1124894     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124896     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124899     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124901     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124906     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124907     3  0.6180      0.532 0.000 0.416 0.584
#> GSM1124911     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124912     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124915     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124917     3  0.6045      0.512 0.000 0.380 0.620
#> GSM1124918     1  0.5348      0.954 0.796 0.028 0.176
#> GSM1124920     3  0.4002      0.654 0.160 0.000 0.840
#> GSM1124922     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124924     3  0.4931      0.688 0.004 0.212 0.784
#> GSM1124926     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124928     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124930     3  0.5497      0.624 0.000 0.292 0.708
#> GSM1124931     1  0.4912      0.984 0.796 0.008 0.196
#> GSM1124935     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124936     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124938     3  0.1765      0.734 0.004 0.040 0.956
#> GSM1124940     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124941     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124942     3  0.6192      0.524 0.000 0.420 0.580
#> GSM1124943     3  0.3644      0.722 0.004 0.124 0.872
#> GSM1124948     3  0.4834      0.691 0.004 0.204 0.792
#> GSM1124949     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124950     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124954     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124955     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124956     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124872     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124873     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124876     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124877     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124879     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124883     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124889     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124892     2  0.5486      0.819 0.196 0.780 0.024
#> GSM1124893     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124909     2  0.0424      0.905 0.008 0.992 0.000
#> GSM1124913     2  0.0000      0.907 0.000 1.000 0.000
#> GSM1124916     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124923     3  0.0000      0.728 0.000 0.000 1.000
#> GSM1124925     2  0.4605      0.834 0.204 0.796 0.000
#> GSM1124929     2  0.5810      0.816 0.132 0.796 0.072
#> GSM1124934     1  0.4605      0.994 0.796 0.000 0.204
#> GSM1124937     2  0.4605      0.834 0.204 0.796 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.2021      0.931 0.040 0.000 0.936 0.024
#> GSM1124888     3  0.1820      0.931 0.036 0.000 0.944 0.020
#> GSM1124890     3  0.1042      0.925 0.020 0.008 0.972 0.000
#> GSM1124904     2  0.0707      0.913 0.020 0.980 0.000 0.000
#> GSM1124927     2  0.0921      0.912 0.028 0.972 0.000 0.000
#> GSM1124953     3  0.1339      0.936 0.004 0.008 0.964 0.024
#> GSM1124869     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124870     1  0.1389      0.902 0.952 0.048 0.000 0.000
#> GSM1124882     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124884     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124898     2  0.1584      0.895 0.012 0.952 0.036 0.000
#> GSM1124903     2  0.0336      0.912 0.008 0.992 0.000 0.000
#> GSM1124905     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124910     1  0.5970      0.643 0.668 0.088 0.244 0.000
#> GSM1124919     3  0.1822      0.907 0.008 0.044 0.944 0.004
#> GSM1124932     4  0.0000      0.979 0.000 0.000 0.000 1.000
#> GSM1124933     3  0.2021      0.931 0.040 0.000 0.936 0.024
#> GSM1124867     2  0.6585      0.508 0.188 0.632 0.180 0.000
#> GSM1124868     2  0.0707      0.903 0.000 0.980 0.020 0.000
#> GSM1124878     2  0.0336      0.912 0.008 0.992 0.000 0.000
#> GSM1124895     2  0.0000      0.911 0.000 1.000 0.000 0.000
#> GSM1124897     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124902     2  0.0336      0.912 0.008 0.992 0.000 0.000
#> GSM1124908     2  0.1911      0.899 0.020 0.944 0.032 0.004
#> GSM1124921     2  0.3945      0.818 0.024 0.828 0.144 0.004
#> GSM1124939     2  0.0336      0.912 0.008 0.992 0.000 0.000
#> GSM1124944     2  0.4044      0.812 0.024 0.820 0.152 0.004
#> GSM1124945     3  0.1151      0.936 0.000 0.008 0.968 0.024
#> GSM1124946     2  0.3606      0.830 0.024 0.844 0.132 0.000
#> GSM1124947     2  0.4872      0.654 0.028 0.728 0.244 0.000
#> GSM1124951     3  0.1151      0.936 0.000 0.008 0.968 0.024
#> GSM1124952     2  0.1109      0.912 0.028 0.968 0.000 0.004
#> GSM1124957     3  0.2021      0.931 0.040 0.000 0.936 0.024
#> GSM1124900     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124914     2  0.0336      0.909 0.000 0.992 0.008 0.000
#> GSM1124871     2  0.0336      0.912 0.008 0.992 0.000 0.000
#> GSM1124874     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124875     2  0.1820      0.898 0.020 0.944 0.036 0.000
#> GSM1124880     2  0.6968      0.279 0.308 0.552 0.140 0.000
#> GSM1124881     2  0.0921      0.912 0.028 0.972 0.000 0.000
#> GSM1124885     2  0.0000      0.911 0.000 1.000 0.000 0.000
#> GSM1124886     1  0.1978      0.915 0.928 0.068 0.004 0.000
#> GSM1124887     2  0.4004      0.803 0.024 0.812 0.164 0.000
#> GSM1124894     2  0.2814      0.824 0.132 0.868 0.000 0.000
#> GSM1124896     1  0.1716      0.915 0.936 0.064 0.000 0.000
#> GSM1124899     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124901     2  0.0000      0.911 0.000 1.000 0.000 0.000
#> GSM1124906     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124907     2  0.4687      0.734 0.020 0.752 0.224 0.004
#> GSM1124911     4  0.0707      0.978 0.020 0.000 0.000 0.980
#> GSM1124912     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124915     4  0.0779      0.979 0.016 0.004 0.000 0.980
#> GSM1124917     2  0.6071      0.619 0.012 0.668 0.260 0.060
#> GSM1124918     4  0.2515      0.889 0.004 0.072 0.012 0.912
#> GSM1124920     3  0.1474      0.929 0.052 0.000 0.948 0.000
#> GSM1124922     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124924     3  0.3708      0.768 0.020 0.148 0.832 0.000
#> GSM1124926     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124928     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124930     2  0.5718      0.517 0.012 0.624 0.344 0.020
#> GSM1124931     4  0.0927      0.976 0.016 0.008 0.000 0.976
#> GSM1124935     4  0.0707      0.978 0.020 0.000 0.000 0.980
#> GSM1124936     3  0.2021      0.931 0.040 0.000 0.936 0.024
#> GSM1124938     3  0.0524      0.932 0.004 0.008 0.988 0.000
#> GSM1124940     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124941     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124942     2  0.4789      0.736 0.024 0.748 0.224 0.004
#> GSM1124943     3  0.0712      0.932 0.004 0.008 0.984 0.004
#> GSM1124948     3  0.3606      0.778 0.020 0.140 0.840 0.000
#> GSM1124949     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124950     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124954     4  0.0524      0.978 0.008 0.000 0.004 0.988
#> GSM1124955     1  0.1389      0.902 0.952 0.048 0.000 0.000
#> GSM1124956     4  0.0000      0.979 0.000 0.000 0.000 1.000
#> GSM1124872     2  0.0921      0.912 0.028 0.972 0.000 0.000
#> GSM1124873     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124876     3  0.2021      0.931 0.040 0.000 0.936 0.024
#> GSM1124877     4  0.0376      0.978 0.004 0.000 0.004 0.992
#> GSM1124879     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124883     2  0.0336      0.912 0.008 0.992 0.000 0.000
#> GSM1124889     2  0.0817      0.913 0.024 0.976 0.000 0.000
#> GSM1124892     1  0.5055      0.595 0.712 0.032 0.256 0.000
#> GSM1124893     1  0.1792      0.918 0.932 0.068 0.000 0.000
#> GSM1124909     2  0.1792      0.886 0.068 0.932 0.000 0.000
#> GSM1124913     2  0.0188      0.912 0.004 0.996 0.000 0.000
#> GSM1124916     4  0.0895      0.978 0.020 0.000 0.004 0.976
#> GSM1124923     3  0.0859      0.932 0.008 0.008 0.980 0.004
#> GSM1124925     1  0.1389      0.902 0.952 0.048 0.000 0.000
#> GSM1124929     1  0.4919      0.643 0.752 0.028 0.008 0.212
#> GSM1124934     4  0.0524      0.978 0.008 0.000 0.004 0.988
#> GSM1124937     1  0.6564      0.333 0.536 0.380 0.084 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
#> GSM1124891     3  0.0000     0.8564 0.000 0.000 1.000 0.000 0.000
#> GSM1124888     3  0.2179     0.8806 0.000 0.112 0.888 0.000 0.000
#> GSM1124890     3  0.3741     0.8833 0.000 0.264 0.732 0.004 0.000
#> GSM1124904     5  0.0404     0.8079 0.000 0.012 0.000 0.000 0.988
#> GSM1124927     2  0.3814     0.9215 0.004 0.720 0.000 0.000 0.276
#> GSM1124953     3  0.2471     0.8827 0.000 0.136 0.864 0.000 0.000
#> GSM1124869     1  0.0703     0.9523 0.976 0.000 0.000 0.000 0.024
#> GSM1124870     1  0.0609     0.9500 0.980 0.000 0.000 0.000 0.020
#> GSM1124882     1  0.1121     0.9410 0.956 0.000 0.000 0.000 0.044
#> GSM1124884     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124898     5  0.0703     0.8054 0.000 0.024 0.000 0.000 0.976
#> GSM1124903     5  0.0162     0.8077 0.000 0.004 0.000 0.000 0.996
#> GSM1124905     1  0.0703     0.9523 0.976 0.000 0.000 0.000 0.024
#> GSM1124910     1  0.5030     0.6288 0.688 0.236 0.004 0.000 0.072
#> GSM1124919     3  0.3766     0.8816 0.000 0.268 0.728 0.004 0.000
#> GSM1124932     4  0.0162     0.9744 0.000 0.000 0.004 0.996 0.000
#> GSM1124933     3  0.0000     0.8564 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     2  0.5241     0.7872 0.148 0.696 0.004 0.000 0.152
#> GSM1124868     5  0.0290     0.8080 0.000 0.008 0.000 0.000 0.992
#> GSM1124878     5  0.0162     0.8077 0.000 0.004 0.000 0.000 0.996
#> GSM1124895     5  0.0000     0.8079 0.000 0.000 0.000 0.000 1.000
#> GSM1124897     5  0.0000     0.8079 0.000 0.000 0.000 0.000 1.000
#> GSM1124902     5  0.0880     0.7870 0.000 0.032 0.000 0.000 0.968
#> GSM1124908     5  0.1851     0.7388 0.000 0.088 0.000 0.000 0.912
#> GSM1124921     5  0.5856     0.5210 0.000 0.224 0.172 0.000 0.604
#> GSM1124939     5  0.0880     0.7867 0.000 0.032 0.000 0.000 0.968
#> GSM1124944     5  0.5604     0.5546 0.000 0.240 0.132 0.000 0.628
#> GSM1124945     3  0.1410     0.8746 0.000 0.060 0.940 0.000 0.000
#> GSM1124946     5  0.5740     0.5134 0.000 0.272 0.128 0.000 0.600
#> GSM1124947     2  0.3817     0.9065 0.004 0.740 0.004 0.000 0.252
#> GSM1124951     3  0.1410     0.8746 0.000 0.060 0.940 0.000 0.000
#> GSM1124952     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124957     3  0.0000     0.8564 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     1  0.1403     0.9390 0.952 0.024 0.000 0.000 0.024
#> GSM1124914     5  0.0609     0.7979 0.000 0.020 0.000 0.000 0.980
#> GSM1124871     5  0.0404     0.8038 0.000 0.012 0.000 0.000 0.988
#> GSM1124874     2  0.4250     0.9027 0.028 0.720 0.000 0.000 0.252
#> GSM1124875     5  0.1478     0.7891 0.000 0.064 0.000 0.000 0.936
#> GSM1124880     2  0.5354     0.7428 0.188 0.680 0.004 0.000 0.128
#> GSM1124881     2  0.3730     0.9138 0.000 0.712 0.000 0.000 0.288
#> GSM1124885     5  0.0000     0.8079 0.000 0.000 0.000 0.000 1.000
#> GSM1124886     1  0.0955     0.9506 0.968 0.000 0.004 0.000 0.028
#> GSM1124887     5  0.5839     0.5308 0.000 0.248 0.136 0.004 0.612
#> GSM1124894     2  0.5375     0.7529 0.200 0.664 0.000 0.000 0.136
#> GSM1124896     1  0.0703     0.9523 0.976 0.000 0.000 0.000 0.024
#> GSM1124899     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124901     5  0.0162     0.8071 0.000 0.004 0.000 0.000 0.996
#> GSM1124906     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124907     5  0.6721     0.0702 0.000 0.276 0.304 0.000 0.420
#> GSM1124911     4  0.0324     0.9740 0.004 0.000 0.004 0.992 0.000
#> GSM1124912     1  0.0703     0.9523 0.976 0.000 0.000 0.000 0.024
#> GSM1124915     4  0.0703     0.9676 0.024 0.000 0.000 0.976 0.000
#> GSM1124917     5  0.6392     0.3976 0.000 0.220 0.236 0.004 0.540
#> GSM1124918     4  0.3687     0.8493 0.004 0.036 0.052 0.852 0.056
#> GSM1124920     3  0.3123     0.8848 0.004 0.184 0.812 0.000 0.000
#> GSM1124922     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124924     3  0.3741     0.8826 0.000 0.264 0.732 0.000 0.004
#> GSM1124926     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124928     1  0.1197     0.9374 0.952 0.000 0.000 0.000 0.048
#> GSM1124930     3  0.3814     0.8770 0.000 0.276 0.720 0.000 0.004
#> GSM1124931     4  0.0880     0.9633 0.032 0.000 0.000 0.968 0.000
#> GSM1124935     4  0.0162     0.9744 0.000 0.000 0.004 0.996 0.000
#> GSM1124936     3  0.0000     0.8564 0.000 0.000 1.000 0.000 0.000
#> GSM1124938     3  0.3430     0.8905 0.000 0.220 0.776 0.004 0.000
#> GSM1124940     1  0.0703     0.9523 0.976 0.000 0.000 0.000 0.024
#> GSM1124941     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124942     5  0.6210     0.4108 0.000 0.276 0.184 0.000 0.540
#> GSM1124943     3  0.3612     0.8831 0.000 0.268 0.732 0.000 0.000
#> GSM1124948     3  0.3612     0.8831 0.000 0.268 0.732 0.000 0.000
#> GSM1124949     1  0.0794     0.9513 0.972 0.000 0.000 0.000 0.028
#> GSM1124950     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124954     4  0.0771     0.9702 0.020 0.000 0.004 0.976 0.000
#> GSM1124955     1  0.0609     0.9500 0.980 0.000 0.000 0.000 0.020
#> GSM1124956     4  0.0162     0.9744 0.000 0.000 0.004 0.996 0.000
#> GSM1124872     2  0.3752     0.9099 0.000 0.708 0.000 0.000 0.292
#> GSM1124873     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124876     3  0.0000     0.8564 0.000 0.000 1.000 0.000 0.000
#> GSM1124877     4  0.0162     0.9744 0.000 0.000 0.004 0.996 0.000
#> GSM1124879     1  0.1197     0.9374 0.952 0.000 0.000 0.000 0.048
#> GSM1124883     5  0.0290     0.8054 0.000 0.008 0.000 0.000 0.992
#> GSM1124889     2  0.3661     0.9228 0.000 0.724 0.000 0.000 0.276
#> GSM1124892     1  0.1310     0.9390 0.956 0.000 0.020 0.000 0.024
#> GSM1124893     1  0.0703     0.9523 0.976 0.000 0.000 0.000 0.024
#> GSM1124909     2  0.4676     0.8722 0.072 0.720 0.000 0.000 0.208
#> GSM1124913     5  0.0162     0.8077 0.000 0.004 0.000 0.000 0.996
#> GSM1124916     4  0.0963     0.9628 0.036 0.000 0.000 0.964 0.000
#> GSM1124923     3  0.3766     0.8816 0.000 0.268 0.728 0.004 0.000
#> GSM1124925     1  0.0510     0.9463 0.984 0.000 0.000 0.000 0.016
#> GSM1124929     1  0.4268     0.5542 0.708 0.000 0.024 0.268 0.000
#> GSM1124934     4  0.0771     0.9702 0.020 0.000 0.004 0.976 0.000
#> GSM1124937     2  0.5590     0.5131 0.324 0.592 0.004 0.000 0.080

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.0458      0.935 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM1124888     3  0.2135      0.875 0.000 0.000 0.872 0.000 0.128 0.000
#> GSM1124890     5  0.2260      0.792 0.000 0.000 0.140 0.000 0.860 0.000
#> GSM1124904     4  0.2512      0.886 0.000 0.060 0.000 0.880 0.060 0.000
#> GSM1124927     2  0.1075      0.910 0.000 0.952 0.000 0.000 0.048 0.000
#> GSM1124953     5  0.3778      0.683 0.000 0.000 0.272 0.020 0.708 0.000
#> GSM1124869     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124882     1  0.0146      0.942 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1124884     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124898     4  0.5770      0.410 0.000 0.252 0.000 0.508 0.240 0.000
#> GSM1124903     4  0.0713      0.898 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1124905     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124910     1  0.3623      0.752 0.764 0.008 0.020 0.000 0.208 0.000
#> GSM1124919     5  0.3309      0.788 0.000 0.004 0.172 0.024 0.800 0.000
#> GSM1124932     6  0.0000      0.975 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124933     3  0.0458      0.935 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM1124867     2  0.5258      0.644 0.128 0.652 0.020 0.000 0.200 0.000
#> GSM1124868     4  0.0713      0.898 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1124878     4  0.0713      0.898 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1124895     4  0.1141      0.908 0.000 0.052 0.000 0.948 0.000 0.000
#> GSM1124897     4  0.1757      0.911 0.000 0.076 0.000 0.916 0.008 0.000
#> GSM1124902     4  0.2631      0.866 0.000 0.180 0.000 0.820 0.000 0.000
#> GSM1124908     5  0.5701      0.331 0.000 0.376 0.000 0.164 0.460 0.000
#> GSM1124921     5  0.3213      0.811 0.000 0.032 0.000 0.160 0.808 0.000
#> GSM1124939     4  0.2664      0.862 0.000 0.184 0.000 0.816 0.000 0.000
#> GSM1124944     5  0.3062      0.818 0.000 0.024 0.000 0.160 0.816 0.000
#> GSM1124945     3  0.0909      0.932 0.000 0.000 0.968 0.012 0.020 0.000
#> GSM1124946     5  0.3025      0.820 0.000 0.024 0.000 0.156 0.820 0.000
#> GSM1124947     2  0.2673      0.845 0.004 0.856 0.008 0.004 0.128 0.000
#> GSM1124951     3  0.0909      0.932 0.000 0.000 0.968 0.012 0.020 0.000
#> GSM1124952     2  0.0146      0.928 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1124957     3  0.0458      0.935 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM1124900     1  0.0632      0.925 0.976 0.024 0.000 0.000 0.000 0.000
#> GSM1124914     4  0.2597      0.868 0.000 0.176 0.000 0.824 0.000 0.000
#> GSM1124871     4  0.2340      0.885 0.000 0.148 0.000 0.852 0.000 0.000
#> GSM1124874     2  0.0146      0.927 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM1124875     5  0.3939      0.748 0.000 0.068 0.000 0.180 0.752 0.000
#> GSM1124880     2  0.5964      0.173 0.380 0.468 0.020 0.000 0.132 0.000
#> GSM1124881     2  0.1049      0.903 0.000 0.960 0.000 0.032 0.008 0.000
#> GSM1124885     4  0.1387      0.911 0.000 0.068 0.000 0.932 0.000 0.000
#> GSM1124886     1  0.0146      0.941 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM1124887     5  0.3062      0.818 0.000 0.024 0.000 0.160 0.816 0.000
#> GSM1124894     2  0.1713      0.901 0.028 0.928 0.000 0.000 0.044 0.000
#> GSM1124896     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124899     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124901     4  0.1444      0.912 0.000 0.072 0.000 0.928 0.000 0.000
#> GSM1124906     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124907     5  0.3301      0.830 0.000 0.016 0.032 0.124 0.828 0.000
#> GSM1124911     6  0.0000      0.975 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124912     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.0508      0.968 0.000 0.012 0.000 0.004 0.000 0.984
#> GSM1124917     5  0.3593      0.828 0.000 0.028 0.028 0.136 0.808 0.000
#> GSM1124918     6  0.3331      0.829 0.000 0.028 0.008 0.032 0.084 0.848
#> GSM1124920     3  0.2454      0.850 0.000 0.000 0.840 0.000 0.160 0.000
#> GSM1124922     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124924     5  0.2431      0.791 0.000 0.008 0.132 0.000 0.860 0.000
#> GSM1124926     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124928     1  0.0146      0.942 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1124930     5  0.2531      0.804 0.000 0.008 0.128 0.004 0.860 0.000
#> GSM1124931     6  0.0603      0.965 0.000 0.016 0.000 0.004 0.000 0.980
#> GSM1124935     6  0.0000      0.975 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124936     3  0.0458      0.935 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM1124938     3  0.3371      0.649 0.000 0.000 0.708 0.000 0.292 0.000
#> GSM1124940     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124942     5  0.2704      0.827 0.000 0.016 0.000 0.140 0.844 0.000
#> GSM1124943     5  0.2340      0.789 0.000 0.000 0.148 0.000 0.852 0.000
#> GSM1124948     5  0.2219      0.792 0.000 0.000 0.136 0.000 0.864 0.000
#> GSM1124949     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124954     6  0.0146      0.975 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM1124955     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124956     6  0.0000      0.975 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124872     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124873     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124876     3  0.0458      0.935 0.000 0.000 0.984 0.000 0.016 0.000
#> GSM1124877     6  0.0146      0.975 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM1124879     1  0.0146      0.942 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1124883     4  0.1714      0.909 0.000 0.092 0.000 0.908 0.000 0.000
#> GSM1124889     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1124892     1  0.0291      0.940 0.992 0.004 0.004 0.000 0.000 0.000
#> GSM1124893     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.1921      0.891 0.032 0.916 0.000 0.000 0.052 0.000
#> GSM1124913     4  0.0713      0.898 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1124916     6  0.0692      0.961 0.000 0.020 0.000 0.004 0.000 0.976
#> GSM1124923     5  0.3296      0.782 0.000 0.004 0.180 0.020 0.796 0.000
#> GSM1124925     1  0.0000      0.943 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.3774      0.298 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM1124934     6  0.0146      0.975 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM1124937     1  0.5072      0.611 0.676 0.184 0.020 0.000 0.120 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 tissue(p) k
#> ATC:mclust 91    0.3798 2
#> ATC:mclust 88    0.3062 3
#> ATC:mclust 89    0.0502 4
#> ATC:mclust 88    0.0326 5
#> ATC:mclust 87    0.1412 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 48983 rows and 91 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.720           0.878       0.943         0.4938 0.499   0.499
#> 3 3 0.682           0.799       0.910         0.2903 0.795   0.615
#> 4 4 0.805           0.833       0.918         0.1317 0.807   0.536
#> 5 5 0.751           0.780       0.882         0.0720 0.889   0.647
#> 6 6 0.761           0.728       0.865         0.0599 0.889   0.579

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
#> GSM1124891     1  0.0000     0.9714 1.000 0.000
#> GSM1124888     1  0.0000     0.9714 1.000 0.000
#> GSM1124890     1  0.0000     0.9714 1.000 0.000
#> GSM1124904     2  0.0000     0.9090 0.000 1.000
#> GSM1124927     2  0.2423     0.8942 0.040 0.960
#> GSM1124953     1  0.0000     0.9714 1.000 0.000
#> GSM1124869     1  0.0000     0.9714 1.000 0.000
#> GSM1124870     1  0.0000     0.9714 1.000 0.000
#> GSM1124882     1  0.0000     0.9714 1.000 0.000
#> GSM1124884     2  0.0000     0.9090 0.000 1.000
#> GSM1124898     2  0.0376     0.9079 0.004 0.996
#> GSM1124903     2  0.0000     0.9090 0.000 1.000
#> GSM1124905     1  0.0000     0.9714 1.000 0.000
#> GSM1124910     1  0.0000     0.9714 1.000 0.000
#> GSM1124919     2  1.0000     0.1597 0.500 0.500
#> GSM1124932     2  0.0000     0.9090 0.000 1.000
#> GSM1124933     1  0.0000     0.9714 1.000 0.000
#> GSM1124867     1  0.0000     0.9714 1.000 0.000
#> GSM1124868     2  0.0000     0.9090 0.000 1.000
#> GSM1124878     2  0.0000     0.9090 0.000 1.000
#> GSM1124895     2  0.0000     0.9090 0.000 1.000
#> GSM1124897     2  0.0000     0.9090 0.000 1.000
#> GSM1124902     2  0.0000     0.9090 0.000 1.000
#> GSM1124908     2  0.8016     0.7425 0.244 0.756
#> GSM1124921     2  0.7528     0.7772 0.216 0.784
#> GSM1124939     2  0.0000     0.9090 0.000 1.000
#> GSM1124944     2  0.9686     0.4649 0.396 0.604
#> GSM1124945     1  0.0000     0.9714 1.000 0.000
#> GSM1124946     2  0.0376     0.9079 0.004 0.996
#> GSM1124947     1  0.9963    -0.0581 0.536 0.464
#> GSM1124951     1  0.0000     0.9714 1.000 0.000
#> GSM1124952     2  0.7219     0.7937 0.200 0.800
#> GSM1124957     1  0.0000     0.9714 1.000 0.000
#> GSM1124900     1  0.0000     0.9714 1.000 0.000
#> GSM1124914     2  0.0000     0.9090 0.000 1.000
#> GSM1124871     2  0.0000     0.9090 0.000 1.000
#> GSM1124874     2  0.0000     0.9090 0.000 1.000
#> GSM1124875     2  0.7299     0.7898 0.204 0.796
#> GSM1124880     1  0.0000     0.9714 1.000 0.000
#> GSM1124881     2  0.8661     0.6778 0.288 0.712
#> GSM1124885     2  0.0000     0.9090 0.000 1.000
#> GSM1124886     1  0.0000     0.9714 1.000 0.000
#> GSM1124887     2  0.6531     0.8206 0.168 0.832
#> GSM1124894     2  0.0000     0.9090 0.000 1.000
#> GSM1124896     1  0.0938     0.9592 0.988 0.012
#> GSM1124899     2  0.3274     0.8854 0.060 0.940
#> GSM1124901     2  0.0000     0.9090 0.000 1.000
#> GSM1124906     2  0.0000     0.9090 0.000 1.000
#> GSM1124907     2  0.7299     0.7898 0.204 0.796
#> GSM1124911     2  0.0000     0.9090 0.000 1.000
#> GSM1124912     1  0.0000     0.9714 1.000 0.000
#> GSM1124915     2  0.0000     0.9090 0.000 1.000
#> GSM1124917     2  0.6887     0.8078 0.184 0.816
#> GSM1124918     2  0.7056     0.8011 0.192 0.808
#> GSM1124920     1  0.0000     0.9714 1.000 0.000
#> GSM1124922     2  0.4562     0.8673 0.096 0.904
#> GSM1124924     1  0.0000     0.9714 1.000 0.000
#> GSM1124926     2  0.0000     0.9090 0.000 1.000
#> GSM1124928     1  0.0000     0.9714 1.000 0.000
#> GSM1124930     1  0.9044     0.4420 0.680 0.320
#> GSM1124931     2  0.0000     0.9090 0.000 1.000
#> GSM1124935     2  0.0000     0.9090 0.000 1.000
#> GSM1124936     1  0.0000     0.9714 1.000 0.000
#> GSM1124938     1  0.0000     0.9714 1.000 0.000
#> GSM1124940     1  0.0000     0.9714 1.000 0.000
#> GSM1124941     2  0.6343     0.8265 0.160 0.840
#> GSM1124942     2  0.7674     0.7680 0.224 0.776
#> GSM1124943     1  0.0000     0.9714 1.000 0.000
#> GSM1124948     1  0.0000     0.9714 1.000 0.000
#> GSM1124949     1  0.0000     0.9714 1.000 0.000
#> GSM1124950     2  0.4690     0.8651 0.100 0.900
#> GSM1124954     1  0.0000     0.9714 1.000 0.000
#> GSM1124955     1  0.0000     0.9714 1.000 0.000
#> GSM1124956     2  0.0000     0.9090 0.000 1.000
#> GSM1124872     2  0.0000     0.9090 0.000 1.000
#> GSM1124873     2  0.0000     0.9090 0.000 1.000
#> GSM1124876     1  0.0000     0.9714 1.000 0.000
#> GSM1124877     1  0.0000     0.9714 1.000 0.000
#> GSM1124879     1  0.0000     0.9714 1.000 0.000
#> GSM1124883     2  0.0000     0.9090 0.000 1.000
#> GSM1124889     2  0.0000     0.9090 0.000 1.000
#> GSM1124892     1  0.0000     0.9714 1.000 0.000
#> GSM1124893     1  0.0000     0.9714 1.000 0.000
#> GSM1124909     1  0.6973     0.7217 0.812 0.188
#> GSM1124913     2  0.0000     0.9090 0.000 1.000
#> GSM1124916     2  0.7602     0.7727 0.220 0.780
#> GSM1124923     2  1.0000     0.1741 0.496 0.504
#> GSM1124925     2  0.0000     0.9090 0.000 1.000
#> GSM1124929     1  0.0000     0.9714 1.000 0.000
#> GSM1124934     1  0.0000     0.9714 1.000 0.000
#> GSM1124937     1  0.0000     0.9714 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1124891     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124888     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124890     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124904     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124927     2  0.1753     0.8659 0.000 0.952 0.048
#> GSM1124953     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124869     3  0.5591     0.5330 0.304 0.000 0.696
#> GSM1124870     1  0.0424     0.9519 0.992 0.000 0.008
#> GSM1124882     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124884     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124898     2  0.2711     0.8533 0.000 0.912 0.088
#> GSM1124903     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124905     3  0.6095     0.3191 0.392 0.000 0.608
#> GSM1124910     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124919     3  0.6062     0.2672 0.000 0.384 0.616
#> GSM1124932     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124933     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124867     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124868     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124878     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124895     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124897     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124902     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124908     2  0.5810     0.5965 0.000 0.664 0.336
#> GSM1124921     2  0.5216     0.7194 0.000 0.740 0.260
#> GSM1124939     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124944     2  0.6280     0.2841 0.000 0.540 0.460
#> GSM1124945     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124946     2  0.3412     0.8369 0.000 0.876 0.124
#> GSM1124947     3  0.5968     0.3274 0.000 0.364 0.636
#> GSM1124951     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124952     2  0.4654     0.7801 0.000 0.792 0.208
#> GSM1124957     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124900     3  0.7074     0.0734 0.480 0.020 0.500
#> GSM1124914     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124871     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124874     2  0.2356     0.8425 0.072 0.928 0.000
#> GSM1124875     2  0.4796     0.7681 0.000 0.780 0.220
#> GSM1124880     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124881     2  0.6095     0.4760 0.000 0.608 0.392
#> GSM1124885     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124886     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124887     2  0.4504     0.7909 0.000 0.804 0.196
#> GSM1124894     2  0.4555     0.7449 0.200 0.800 0.000
#> GSM1124896     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124899     2  0.3752     0.8260 0.000 0.856 0.144
#> GSM1124901     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124906     2  0.0424     0.8732 0.000 0.992 0.008
#> GSM1124907     2  0.4842     0.7637 0.000 0.776 0.224
#> GSM1124911     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124912     1  0.2878     0.8746 0.904 0.000 0.096
#> GSM1124915     2  0.6308    -0.0639 0.492 0.508 0.000
#> GSM1124917     2  0.4504     0.7909 0.000 0.804 0.196
#> GSM1124918     1  0.4555     0.7062 0.800 0.000 0.200
#> GSM1124920     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124922     2  0.2625     0.8547 0.000 0.916 0.084
#> GSM1124924     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124926     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124928     3  0.0237     0.8832 0.004 0.000 0.996
#> GSM1124930     3  0.4346     0.6998 0.000 0.184 0.816
#> GSM1124931     1  0.0424     0.9515 0.992 0.008 0.000
#> GSM1124935     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124936     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124938     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124940     3  0.5678     0.5295 0.316 0.000 0.684
#> GSM1124941     2  0.4452     0.7942 0.000 0.808 0.192
#> GSM1124942     2  0.5529     0.6666 0.000 0.704 0.296
#> GSM1124943     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124948     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124949     3  0.1529     0.8539 0.040 0.000 0.960
#> GSM1124950     2  0.4346     0.8003 0.000 0.816 0.184
#> GSM1124954     1  0.2537     0.8845 0.920 0.000 0.080
#> GSM1124955     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124956     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124872     2  0.0237     0.8726 0.004 0.996 0.000
#> GSM1124873     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124876     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124877     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124879     3  0.2261     0.8275 0.068 0.000 0.932
#> GSM1124883     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124889     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124892     3  0.0000     0.8861 0.000 0.000 1.000
#> GSM1124893     1  0.4452     0.7464 0.808 0.000 0.192
#> GSM1124909     3  0.4605     0.6700 0.000 0.204 0.796
#> GSM1124913     2  0.0000     0.8738 0.000 1.000 0.000
#> GSM1124916     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124923     3  0.6180     0.1594 0.000 0.416 0.584
#> GSM1124925     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124929     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124934     1  0.0000     0.9566 1.000 0.000 0.000
#> GSM1124937     3  0.0000     0.8861 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1124891     3  0.0817      0.907 0.024 0.000 0.976 0.000
#> GSM1124888     3  0.0707      0.900 0.020 0.000 0.980 0.000
#> GSM1124890     3  0.0592      0.907 0.016 0.000 0.984 0.000
#> GSM1124904     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124927     1  0.0779      0.888 0.980 0.004 0.016 0.000
#> GSM1124953     3  0.0817      0.907 0.024 0.000 0.976 0.000
#> GSM1124869     1  0.0804      0.889 0.980 0.000 0.012 0.008
#> GSM1124870     1  0.0707      0.890 0.980 0.000 0.000 0.020
#> GSM1124882     1  0.0707      0.888 0.980 0.000 0.020 0.000
#> GSM1124884     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124898     2  0.0188      0.898 0.004 0.996 0.000 0.000
#> GSM1124903     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124905     1  0.1211      0.888 0.960 0.000 0.000 0.040
#> GSM1124910     1  0.4746      0.398 0.632 0.000 0.368 0.000
#> GSM1124919     3  0.4348      0.713 0.024 0.196 0.780 0.000
#> GSM1124932     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM1124933     3  0.0817      0.907 0.024 0.000 0.976 0.000
#> GSM1124867     1  0.1389      0.872 0.952 0.000 0.048 0.000
#> GSM1124868     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124878     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124895     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124897     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124902     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124908     2  0.4776      0.689 0.024 0.732 0.244 0.000
#> GSM1124921     2  0.5105      0.635 0.028 0.696 0.276 0.000
#> GSM1124939     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124944     2  0.5778      0.131 0.028 0.500 0.472 0.000
#> GSM1124945     3  0.0817      0.907 0.024 0.000 0.976 0.000
#> GSM1124946     2  0.3946      0.785 0.020 0.812 0.168 0.000
#> GSM1124947     3  0.7799      0.138 0.260 0.328 0.412 0.000
#> GSM1124951     3  0.0707      0.907 0.020 0.000 0.980 0.000
#> GSM1124952     1  0.6407      0.179 0.520 0.412 0.068 0.000
#> GSM1124957     3  0.0817      0.907 0.024 0.000 0.976 0.000
#> GSM1124900     1  0.1118      0.889 0.964 0.000 0.000 0.036
#> GSM1124914     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124871     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124874     2  0.0707      0.891 0.000 0.980 0.000 0.020
#> GSM1124875     2  0.4079      0.773 0.020 0.800 0.180 0.000
#> GSM1124880     1  0.3172      0.768 0.840 0.000 0.160 0.000
#> GSM1124881     2  0.5036      0.619 0.280 0.696 0.024 0.000
#> GSM1124885     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124886     1  0.0707      0.888 0.980 0.000 0.020 0.000
#> GSM1124887     2  0.3925      0.777 0.016 0.808 0.176 0.000
#> GSM1124894     1  0.1411      0.886 0.960 0.020 0.000 0.020
#> GSM1124896     1  0.1211      0.888 0.960 0.000 0.000 0.040
#> GSM1124899     2  0.1624      0.881 0.020 0.952 0.028 0.000
#> GSM1124901     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124906     1  0.4804      0.363 0.616 0.384 0.000 0.000
#> GSM1124907     2  0.5130      0.589 0.020 0.668 0.312 0.000
#> GSM1124911     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM1124912     1  0.1211      0.888 0.960 0.000 0.000 0.040
#> GSM1124915     4  0.1211      0.941 0.000 0.040 0.000 0.960
#> GSM1124917     2  0.3764      0.783 0.012 0.816 0.172 0.000
#> GSM1124918     4  0.2489      0.904 0.020 0.000 0.068 0.912
#> GSM1124920     3  0.0707      0.900 0.020 0.000 0.980 0.000
#> GSM1124922     1  0.3610      0.718 0.800 0.200 0.000 0.000
#> GSM1124924     3  0.0707      0.900 0.020 0.000 0.980 0.000
#> GSM1124926     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124928     1  0.0804      0.885 0.980 0.000 0.012 0.008
#> GSM1124930     3  0.2706      0.845 0.020 0.080 0.900 0.000
#> GSM1124931     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM1124935     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM1124936     3  0.0817      0.907 0.024 0.000 0.976 0.000
#> GSM1124938     3  0.0707      0.900 0.020 0.000 0.980 0.000
#> GSM1124940     1  0.0707      0.888 0.980 0.000 0.020 0.000
#> GSM1124941     2  0.2345      0.842 0.100 0.900 0.000 0.000
#> GSM1124942     2  0.5306      0.516 0.020 0.632 0.348 0.000
#> GSM1124943     3  0.0707      0.900 0.020 0.000 0.980 0.000
#> GSM1124948     3  0.0707      0.900 0.020 0.000 0.980 0.000
#> GSM1124949     1  0.0592      0.891 0.984 0.000 0.000 0.016
#> GSM1124950     2  0.2002      0.873 0.020 0.936 0.044 0.000
#> GSM1124954     4  0.2813      0.881 0.024 0.000 0.080 0.896
#> GSM1124955     1  0.1302      0.886 0.956 0.000 0.000 0.044
#> GSM1124956     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM1124872     2  0.1022      0.885 0.032 0.968 0.000 0.000
#> GSM1124873     2  0.0188      0.897 0.004 0.996 0.000 0.000
#> GSM1124876     3  0.0817      0.907 0.024 0.000 0.976 0.000
#> GSM1124877     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM1124879     1  0.0927      0.886 0.976 0.000 0.008 0.016
#> GSM1124883     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124889     2  0.0592      0.893 0.016 0.984 0.000 0.000
#> GSM1124892     1  0.1637      0.870 0.940 0.000 0.060 0.000
#> GSM1124893     1  0.1211      0.888 0.960 0.000 0.000 0.040
#> GSM1124909     1  0.2345      0.833 0.900 0.000 0.100 0.000
#> GSM1124913     2  0.0000      0.899 0.000 1.000 0.000 0.000
#> GSM1124916     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM1124923     3  0.4228      0.652 0.008 0.232 0.760 0.000
#> GSM1124925     1  0.1302      0.886 0.956 0.000 0.000 0.044
#> GSM1124929     1  0.1389      0.885 0.952 0.000 0.000 0.048
#> GSM1124934     4  0.0000      0.975 0.000 0.000 0.000 1.000
#> GSM1124937     1  0.3873      0.692 0.772 0.000 0.228 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
#> GSM1124891     3  0.0290      0.910 0.000 0.000 0.992 0.000 0.008
#> GSM1124888     5  0.3508      0.705 0.000 0.000 0.252 0.000 0.748
#> GSM1124890     3  0.0404      0.906 0.000 0.000 0.988 0.000 0.012
#> GSM1124904     2  0.0510      0.824 0.000 0.984 0.000 0.000 0.016
#> GSM1124927     1  0.2970      0.808 0.828 0.004 0.000 0.000 0.168
#> GSM1124953     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1124869     1  0.0000      0.909 1.000 0.000 0.000 0.000 0.000
#> GSM1124870     1  0.1908      0.871 0.908 0.000 0.000 0.000 0.092
#> GSM1124882     1  0.2424      0.842 0.868 0.000 0.000 0.000 0.132
#> GSM1124884     2  0.2773      0.747 0.000 0.836 0.000 0.000 0.164
#> GSM1124898     2  0.0162      0.825 0.000 0.996 0.000 0.000 0.004
#> GSM1124903     2  0.0000      0.826 0.000 1.000 0.000 0.000 0.000
#> GSM1124905     1  0.0162      0.909 0.996 0.000 0.000 0.000 0.004
#> GSM1124910     5  0.4080      0.531 0.252 0.000 0.020 0.000 0.728
#> GSM1124919     3  0.2074      0.820 0.000 0.104 0.896 0.000 0.000
#> GSM1124932     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.000
#> GSM1124933     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1124867     1  0.3586      0.721 0.736 0.000 0.000 0.000 0.264
#> GSM1124868     2  0.0290      0.824 0.000 0.992 0.000 0.000 0.008
#> GSM1124878     2  0.0162      0.826 0.000 0.996 0.000 0.000 0.004
#> GSM1124895     2  0.0290      0.824 0.000 0.992 0.000 0.000 0.008
#> GSM1124897     2  0.0162      0.826 0.000 0.996 0.000 0.000 0.004
#> GSM1124902     2  0.0162      0.825 0.000 0.996 0.000 0.000 0.004
#> GSM1124908     3  0.4003      0.587 0.000 0.288 0.704 0.000 0.008
#> GSM1124921     2  0.3962      0.733 0.000 0.800 0.088 0.000 0.112
#> GSM1124939     2  0.0000      0.826 0.000 1.000 0.000 0.000 0.000
#> GSM1124944     2  0.4183      0.517 0.000 0.668 0.324 0.000 0.008
#> GSM1124945     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1124946     2  0.3424      0.655 0.000 0.760 0.000 0.000 0.240
#> GSM1124947     2  0.5905      0.360 0.088 0.488 0.004 0.000 0.420
#> GSM1124951     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1124952     2  0.7361      0.365 0.112 0.492 0.296 0.000 0.100
#> GSM1124957     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1124900     1  0.0290      0.908 0.992 0.000 0.000 0.000 0.008
#> GSM1124914     2  0.0162      0.825 0.000 0.996 0.000 0.000 0.004
#> GSM1124871     2  0.0880      0.820 0.000 0.968 0.000 0.000 0.032
#> GSM1124874     2  0.0693      0.821 0.012 0.980 0.000 0.000 0.008
#> GSM1124875     2  0.4268      0.398 0.000 0.556 0.000 0.000 0.444
#> GSM1124880     5  0.3210      0.587 0.212 0.000 0.000 0.000 0.788
#> GSM1124881     2  0.6135      0.523 0.236 0.580 0.004 0.000 0.180
#> GSM1124885     2  0.0162      0.826 0.000 0.996 0.000 0.000 0.004
#> GSM1124886     1  0.0000      0.909 1.000 0.000 0.000 0.000 0.000
#> GSM1124887     2  0.3861      0.585 0.000 0.712 0.284 0.000 0.004
#> GSM1124894     1  0.1908      0.871 0.908 0.000 0.000 0.000 0.092
#> GSM1124896     1  0.0162      0.909 0.996 0.000 0.000 0.000 0.004
#> GSM1124899     2  0.4425      0.444 0.004 0.544 0.000 0.000 0.452
#> GSM1124901     2  0.0162      0.825 0.000 0.996 0.000 0.000 0.004
#> GSM1124906     2  0.6443      0.187 0.376 0.444 0.000 0.000 0.180
#> GSM1124907     5  0.3274      0.660 0.000 0.220 0.000 0.000 0.780
#> GSM1124911     4  0.0162      0.952 0.000 0.000 0.000 0.996 0.004
#> GSM1124912     1  0.0162      0.909 0.996 0.000 0.000 0.000 0.004
#> GSM1124915     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.000
#> GSM1124917     2  0.3231      0.702 0.000 0.800 0.196 0.000 0.004
#> GSM1124918     4  0.3003      0.725 0.000 0.000 0.000 0.812 0.188
#> GSM1124920     5  0.3039      0.760 0.000 0.000 0.192 0.000 0.808
#> GSM1124922     1  0.5984      0.466 0.588 0.208 0.000 0.000 0.204
#> GSM1124924     5  0.0613      0.737 0.004 0.004 0.008 0.000 0.984
#> GSM1124926     2  0.1571      0.809 0.004 0.936 0.000 0.000 0.060
#> GSM1124928     1  0.1121      0.897 0.956 0.000 0.000 0.000 0.044
#> GSM1124930     5  0.3278      0.769 0.000 0.020 0.156 0.000 0.824
#> GSM1124931     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.000
#> GSM1124935     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.000
#> GSM1124936     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1124938     5  0.3109      0.756 0.000 0.000 0.200 0.000 0.800
#> GSM1124940     1  0.0324      0.908 0.992 0.000 0.004 0.000 0.004
#> GSM1124941     2  0.5369      0.622 0.124 0.660 0.000 0.000 0.216
#> GSM1124942     5  0.3455      0.670 0.000 0.208 0.008 0.000 0.784
#> GSM1124943     5  0.3074      0.758 0.000 0.000 0.196 0.000 0.804
#> GSM1124948     5  0.2127      0.769 0.000 0.000 0.108 0.000 0.892
#> GSM1124949     1  0.0162      0.909 0.996 0.000 0.000 0.000 0.004
#> GSM1124950     2  0.4341      0.528 0.004 0.592 0.000 0.000 0.404
#> GSM1124954     4  0.3074      0.729 0.000 0.000 0.196 0.804 0.000
#> GSM1124955     1  0.0162      0.909 0.996 0.000 0.000 0.000 0.004
#> GSM1124956     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.000
#> GSM1124872     2  0.4162      0.708 0.056 0.768 0.000 0.000 0.176
#> GSM1124873     2  0.1282      0.815 0.004 0.952 0.000 0.000 0.044
#> GSM1124876     3  0.0162      0.912 0.000 0.000 0.996 0.000 0.004
#> GSM1124877     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.000
#> GSM1124879     1  0.0510      0.905 0.984 0.000 0.000 0.000 0.016
#> GSM1124883     2  0.0162      0.825 0.000 0.996 0.000 0.000 0.004
#> GSM1124889     2  0.0451      0.825 0.008 0.988 0.000 0.000 0.004
#> GSM1124892     1  0.3061      0.800 0.844 0.000 0.136 0.000 0.020
#> GSM1124893     1  0.0162      0.909 0.996 0.000 0.000 0.000 0.004
#> GSM1124909     1  0.3857      0.642 0.688 0.000 0.000 0.000 0.312
#> GSM1124913     2  0.0162      0.826 0.000 0.996 0.000 0.000 0.004
#> GSM1124916     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.000
#> GSM1124923     3  0.3177      0.706 0.000 0.208 0.792 0.000 0.000
#> GSM1124925     1  0.0290      0.908 0.992 0.000 0.000 0.000 0.008
#> GSM1124929     1  0.0579      0.907 0.984 0.000 0.000 0.008 0.008
#> GSM1124934     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.000
#> GSM1124937     5  0.3999      0.497 0.344 0.000 0.000 0.000 0.656

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1124891     3  0.1010     0.8802 0.000 0.004 0.960 0.000 0.036 0.000
#> GSM1124888     5  0.0632     0.8431 0.000 0.000 0.024 0.000 0.976 0.000
#> GSM1124890     3  0.1075     0.8663 0.000 0.000 0.952 0.000 0.048 0.000
#> GSM1124904     4  0.2814     0.6856 0.000 0.172 0.008 0.820 0.000 0.000
#> GSM1124927     2  0.4907     0.5559 0.256 0.644 0.004 0.096 0.000 0.000
#> GSM1124953     3  0.0146     0.8970 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM1124869     1  0.2340     0.8234 0.852 0.148 0.000 0.000 0.000 0.000
#> GSM1124870     2  0.3690     0.3515 0.288 0.700 0.012 0.000 0.000 0.000
#> GSM1124882     2  0.4178     0.2948 0.372 0.608 0.020 0.000 0.000 0.000
#> GSM1124884     2  0.3828     0.3389 0.000 0.560 0.000 0.440 0.000 0.000
#> GSM1124898     4  0.3050     0.6413 0.000 0.236 0.000 0.764 0.000 0.000
#> GSM1124903     4  0.0260     0.7939 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1124905     1  0.0000     0.9162 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124910     5  0.4144     0.4423 0.020 0.360 0.000 0.000 0.620 0.000
#> GSM1124919     3  0.0458     0.8894 0.000 0.000 0.984 0.016 0.000 0.000
#> GSM1124932     6  0.0000     0.9640 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124933     3  0.0000     0.8974 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124867     2  0.1320     0.6611 0.016 0.948 0.000 0.000 0.036 0.000
#> GSM1124868     4  0.0260     0.7926 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1124878     4  0.1663     0.7651 0.000 0.088 0.000 0.912 0.000 0.000
#> GSM1124895     4  0.0260     0.7926 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1124897     4  0.2178     0.7350 0.000 0.132 0.000 0.868 0.000 0.000
#> GSM1124902     4  0.0790     0.7930 0.000 0.032 0.000 0.968 0.000 0.000
#> GSM1124908     4  0.4651     0.1283 0.004 0.032 0.448 0.516 0.000 0.000
#> GSM1124921     4  0.3101     0.6406 0.000 0.244 0.000 0.756 0.000 0.000
#> GSM1124939     4  0.1007     0.7909 0.000 0.044 0.000 0.956 0.000 0.000
#> GSM1124944     4  0.3766     0.6269 0.000 0.232 0.032 0.736 0.000 0.000
#> GSM1124945     3  0.0146     0.8970 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM1124946     4  0.3053     0.6927 0.000 0.020 0.000 0.812 0.168 0.000
#> GSM1124947     2  0.2593     0.7010 0.000 0.844 0.000 0.148 0.008 0.000
#> GSM1124951     3  0.0000     0.8974 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1124952     2  0.5532     0.5110 0.004 0.580 0.204 0.212 0.000 0.000
#> GSM1124957     3  0.0363     0.8944 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM1124900     1  0.0146     0.9146 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1124914     4  0.0632     0.7930 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM1124871     4  0.2300     0.7182 0.000 0.144 0.000 0.856 0.000 0.000
#> GSM1124874     4  0.4047     0.3581 0.384 0.012 0.000 0.604 0.000 0.000
#> GSM1124875     4  0.5595     0.3620 0.000 0.192 0.000 0.540 0.268 0.000
#> GSM1124880     5  0.3455     0.7032 0.036 0.180 0.000 0.000 0.784 0.000
#> GSM1124881     2  0.0935     0.6902 0.000 0.964 0.000 0.032 0.004 0.000
#> GSM1124885     4  0.0363     0.7937 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM1124886     1  0.3742     0.5322 0.648 0.348 0.004 0.000 0.000 0.000
#> GSM1124887     4  0.3420     0.6291 0.000 0.012 0.240 0.748 0.000 0.000
#> GSM1124894     2  0.4407     0.1369 0.480 0.496 0.000 0.024 0.000 0.000
#> GSM1124896     1  0.0000     0.9162 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1124899     2  0.5423     0.1379 0.000 0.444 0.000 0.440 0.116 0.000
#> GSM1124901     4  0.0260     0.7942 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1124906     2  0.1444     0.7152 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM1124907     5  0.3390     0.5315 0.000 0.000 0.000 0.296 0.704 0.000
#> GSM1124911     6  0.0405     0.9599 0.008 0.004 0.000 0.000 0.000 0.988
#> GSM1124912     1  0.0146     0.9171 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1124915     6  0.0458     0.9554 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM1124917     4  0.2571     0.7678 0.000 0.060 0.064 0.876 0.000 0.000
#> GSM1124918     6  0.1092     0.9422 0.000 0.020 0.000 0.000 0.020 0.960
#> GSM1124920     5  0.0146     0.8503 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM1124922     2  0.3056     0.6900 0.008 0.804 0.000 0.184 0.004 0.000
#> GSM1124924     5  0.1141     0.8412 0.000 0.052 0.000 0.000 0.948 0.000
#> GSM1124926     4  0.3838    -0.0556 0.000 0.448 0.000 0.552 0.000 0.000
#> GSM1124928     1  0.3141     0.7531 0.788 0.200 0.000 0.000 0.012 0.000
#> GSM1124930     5  0.1219     0.8410 0.000 0.048 0.000 0.004 0.948 0.000
#> GSM1124931     6  0.0000     0.9640 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124935     6  0.0000     0.9640 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124936     3  0.0146     0.8970 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM1124938     5  0.0146     0.8503 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM1124940     1  0.0363     0.9146 0.988 0.012 0.000 0.000 0.000 0.000
#> GSM1124941     2  0.1806     0.7184 0.000 0.908 0.000 0.088 0.004 0.000
#> GSM1124942     5  0.1267     0.8218 0.000 0.000 0.000 0.060 0.940 0.000
#> GSM1124943     5  0.0146     0.8503 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM1124948     5  0.0363     0.8501 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM1124949     1  0.1610     0.8765 0.916 0.084 0.000 0.000 0.000 0.000
#> GSM1124950     2  0.4201     0.5687 0.000 0.664 0.000 0.300 0.036 0.000
#> GSM1124954     6  0.2608     0.8782 0.000 0.080 0.048 0.000 0.000 0.872
#> GSM1124955     1  0.0146     0.9171 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1124956     6  0.0000     0.9640 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124872     2  0.2631     0.6874 0.000 0.820 0.000 0.180 0.000 0.000
#> GSM1124873     4  0.3151     0.5702 0.000 0.252 0.000 0.748 0.000 0.000
#> GSM1124876     3  0.0146     0.8968 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1124877     6  0.0000     0.9640 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1124879     1  0.0146     0.9171 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1124883     4  0.0260     0.7942 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1124889     4  0.1610     0.7685 0.000 0.084 0.000 0.916 0.000 0.000
#> GSM1124892     3  0.6042     0.0620 0.208 0.392 0.396 0.000 0.004 0.000
#> GSM1124893     1  0.0146     0.9171 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1124909     2  0.1594     0.6747 0.052 0.932 0.000 0.000 0.016 0.000
#> GSM1124913     4  0.0632     0.7919 0.000 0.024 0.000 0.976 0.000 0.000
#> GSM1124916     6  0.0260     0.9615 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1124923     3  0.3897     0.5138 0.000 0.000 0.696 0.280 0.024 0.000
#> GSM1124925     1  0.0260     0.9122 0.992 0.008 0.000 0.000 0.000 0.000
#> GSM1124929     1  0.3215     0.8155 0.828 0.072 0.000 0.000 0.000 0.100
#> GSM1124934     6  0.2219     0.8462 0.000 0.136 0.000 0.000 0.000 0.864
#> GSM1124937     5  0.5468     0.4859 0.244 0.188 0.000 0.000 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-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 tissue(p) k
#> ATC:NMF 86    0.4926 2
#> ATC:NMF 83    0.2908 3
#> ATC:NMF 86    0.2875 4
#> ATC:NMF 84    0.0568 5
#> ATC:NMF 79    0.0465 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