cola Report for GDS5277

Date: 2019-12-25 22:08:15 CET, cola version: 1.3.2

Document is loading...


Summary

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

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

The call of run_all_consensus_partition_methods() was:

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

Dimension of the input matrix:

mat = get_matrix(res_list)
dim(mat)
#> [1] 51941    86

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:pam 3 1.000 1.000 1.000 ** 2
SD:NMF 2 1.000 0.942 0.978 **
ATC:kmeans 2 1.000 1.000 1.000 **
ATC:pam 2 1.000 1.000 1.000 **
ATC:NMF 2 1.000 1.000 1.000 **
CV:NMF 3 0.990 0.963 0.978 ** 2
MAD:pam 4 0.987 0.956 0.983 ** 2,3
CV:pam 6 0.959 0.916 0.968 ** 2,3
ATC:skmeans 5 0.943 0.937 0.939 * 2,3,4
SD:mclust 3 0.941 0.930 0.958 *
SD:skmeans 3 0.940 0.926 0.969 *
MAD:mclust 3 0.940 0.890 0.952 * 2
ATC:hclust 5 0.930 0.842 0.941 * 2,4
MAD:skmeans 4 0.929 0.881 0.949 * 3
ATC:mclust 4 0.923 0.963 0.961 * 2
MAD:NMF 3 0.913 0.906 0.945 * 2
CV:hclust 5 0.865 0.877 0.920
CV:skmeans 3 0.859 0.930 0.967
SD:kmeans 2 0.829 0.953 0.971
MAD:kmeans 2 0.829 0.979 0.989
MAD:hclust 5 0.823 0.774 0.895
SD:hclust 3 0.778 0.843 0.917
CV:kmeans 3 0.714 0.937 0.934
CV:mclust 2 0.693 0.881 0.947

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 1.000           0.942       0.978          0.465 0.540   0.540
#> CV:NMF      2 0.976           0.973       0.987          0.445 0.564   0.564
#> MAD:NMF     2 0.905           0.932       0.972          0.468 0.540   0.540
#> ATC:NMF     2 1.000           1.000       1.000          0.453 0.548   0.548
#> SD:skmeans  2 0.829           0.910       0.962          0.470 0.548   0.548
#> CV:skmeans  2 0.829           0.903       0.958          0.477 0.504   0.504
#> MAD:skmeans 2 0.827           0.953       0.977          0.464 0.548   0.548
#> ATC:skmeans 2 1.000           1.000       1.000          0.453 0.548   0.548
#> SD:mclust   2 0.829           0.944       0.974          0.465 0.548   0.548
#> CV:mclust   2 0.693           0.881       0.947          0.482 0.504   0.504
#> MAD:mclust  2 1.000           0.983       0.991          0.457 0.548   0.548
#> ATC:mclust  2 1.000           1.000       1.000          0.453 0.548   0.548
#> SD:kmeans   2 0.829           0.953       0.971          0.462 0.548   0.548
#> CV:kmeans   2 0.799           0.887       0.928          0.452 0.548   0.548
#> MAD:kmeans  2 0.829           0.979       0.989          0.458 0.548   0.548
#> ATC:kmeans  2 1.000           1.000       1.000          0.453 0.548   0.548
#> SD:pam      2 1.000           1.000       1.000          0.453 0.548   0.548
#> CV:pam      2 1.000           0.992       0.997          0.451 0.548   0.548
#> MAD:pam     2 1.000           1.000       1.000          0.453 0.548   0.548
#> ATC:pam     2 1.000           1.000       1.000          0.453 0.548   0.548
#> SD:hclust   2 0.625           0.842       0.917          0.450 0.521   0.521
#> CV:hclust   2 0.419           0.625       0.851          0.456 0.495   0.495
#> MAD:hclust  2 0.561           0.738       0.892          0.386 0.583   0.583
#> ATC:hclust  2 1.000           1.000       1.000          0.453 0.548   0.548
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.866           0.895       0.951         0.4253 0.785   0.607
#> CV:NMF      3 0.990           0.963       0.978         0.4845 0.773   0.598
#> MAD:NMF     3 0.913           0.906       0.945         0.4111 0.781   0.600
#> ATC:NMF     3 0.873           0.885       0.951         0.4727 0.778   0.595
#> SD:skmeans  3 0.940           0.926       0.969         0.4083 0.783   0.604
#> CV:skmeans  3 0.859           0.930       0.967         0.3930 0.763   0.560
#> MAD:skmeans 3 0.984           0.972       0.984         0.4361 0.781   0.600
#> ATC:skmeans 3 1.000           0.991       0.996         0.4672 0.789   0.615
#> SD:mclust   3 0.941           0.930       0.958         0.2604 0.893   0.804
#> CV:mclust   3 0.822           0.874       0.917         0.2285 0.852   0.715
#> MAD:mclust  3 0.940           0.890       0.952         0.3026 0.871   0.765
#> ATC:mclust  3 0.740           0.766       0.864         0.2684 0.969   0.944
#> SD:kmeans   3 0.833           0.896       0.934         0.3708 0.814   0.660
#> CV:kmeans   3 0.714           0.937       0.934         0.3445 0.805   0.649
#> MAD:kmeans  3 0.749           0.925       0.917         0.4001 0.781   0.600
#> ATC:kmeans  3 0.726           0.949       0.887         0.3619 0.789   0.615
#> SD:pam      3 1.000           1.000       1.000         0.2366 0.893   0.804
#> CV:pam      3 1.000           0.987       0.994         0.2387 0.893   0.804
#> MAD:pam     3 1.000           1.000       1.000         0.2366 0.893   0.804
#> ATC:pam     3 0.827           0.932       0.949         0.1210 0.985   0.973
#> SD:hclust   3 0.778           0.843       0.917         0.4670 0.810   0.635
#> CV:hclust   3 0.494           0.632       0.837         0.2395 0.877   0.763
#> MAD:hclust  3 0.754           0.689       0.851         0.6701 0.590   0.411
#> ATC:hclust  3 1.000           1.000       1.000         0.0326 0.985   0.973
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.769           0.685       0.848         0.0739 0.933   0.809
#> CV:NMF      4 0.826           0.746       0.869         0.0810 0.958   0.876
#> MAD:NMF     4 0.688           0.756       0.839         0.0896 0.868   0.638
#> ATC:NMF     4 0.758           0.752       0.844         0.0831 0.904   0.718
#> SD:skmeans  4 0.871           0.886       0.938         0.0913 0.885   0.681
#> CV:skmeans  4 0.801           0.836       0.923         0.1094 0.843   0.587
#> MAD:skmeans 4 0.929           0.881       0.949         0.0867 0.882   0.674
#> ATC:skmeans 4 1.000           0.977       0.983         0.0919 0.941   0.825
#> SD:mclust   4 0.801           0.863       0.896         0.1989 0.839   0.635
#> CV:mclust   4 0.849           0.767       0.888         0.1636 0.935   0.833
#> MAD:mclust  4 0.836           0.911       0.939         0.2047 0.835   0.616
#> ATC:mclust  4 0.923           0.963       0.961         0.1850 0.789   0.600
#> SD:kmeans   4 0.714           0.783       0.834         0.1194 0.852   0.625
#> CV:kmeans   4 0.745           0.824       0.844         0.1181 0.980   0.947
#> MAD:kmeans  4 0.762           0.787       0.843         0.1153 0.903   0.723
#> ATC:kmeans  4 0.630           0.508       0.838         0.1251 0.982   0.946
#> SD:pam      4 0.823           0.964       0.953         0.2335 0.856   0.672
#> CV:pam      4 0.832           0.935       0.950         0.1581 0.922   0.825
#> MAD:pam     4 0.987           0.956       0.983         0.2571 0.856   0.672
#> ATC:pam     4 0.700           0.785       0.890         0.2294 0.871   0.759
#> SD:hclust   4 0.776           0.837       0.903         0.0645 0.965   0.894
#> CV:hclust   4 0.781           0.746       0.883         0.2707 0.754   0.476
#> MAD:hclust  4 0.749           0.727       0.842         0.0876 0.791   0.528
#> ATC:hclust  4 0.998           0.938       0.974         0.4519 0.793   0.612
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.840           0.804       0.898         0.0607 0.905   0.706
#> CV:NMF      5 0.837           0.831       0.904         0.0525 0.937   0.796
#> MAD:NMF     5 0.809           0.772       0.865         0.0602 0.940   0.783
#> ATC:NMF     5 0.745           0.658       0.819         0.0407 0.879   0.617
#> SD:skmeans  5 0.895           0.854       0.921         0.0697 0.920   0.723
#> CV:skmeans  5 0.862           0.840       0.909         0.0468 0.957   0.842
#> MAD:skmeans 5 0.894           0.884       0.931         0.0672 0.940   0.789
#> ATC:skmeans 5 0.943           0.937       0.939         0.0465 0.962   0.862
#> SD:mclust   5 0.693           0.677       0.782         0.0831 0.874   0.598
#> CV:mclust   5 0.694           0.587       0.755         0.0751 0.952   0.859
#> MAD:mclust  5 0.631           0.695       0.779         0.0571 0.916   0.717
#> ATC:mclust  5 0.832           0.756       0.863         0.0937 0.925   0.769
#> SD:kmeans   5 0.682           0.616       0.715         0.0716 0.904   0.674
#> CV:kmeans   5 0.747           0.847       0.817         0.0984 0.866   0.628
#> MAD:kmeans  5 0.715           0.635       0.738         0.0708 0.925   0.742
#> ATC:kmeans  5 0.799           0.730       0.832         0.0811 0.917   0.750
#> SD:pam      5 0.884           0.918       0.952         0.0764 0.954   0.845
#> CV:pam      5 0.845           0.922       0.943         0.1494 0.881   0.677
#> MAD:pam     5 0.865           0.773       0.893         0.0682 0.962   0.872
#> ATC:pam     5 0.728           0.809       0.883         0.1190 0.889   0.729
#> SD:hclust   5 0.752           0.703       0.819         0.0653 0.930   0.766
#> CV:hclust   5 0.865           0.877       0.920         0.0544 0.904   0.685
#> MAD:hclust  5 0.823           0.774       0.895         0.0829 0.873   0.606
#> ATC:hclust  5 0.930           0.842       0.941         0.0686 0.937   0.814
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.781           0.724       0.859         0.0342 0.919   0.709
#> CV:NMF      6 0.826           0.801       0.890         0.0457 0.922   0.720
#> MAD:NMF     6 0.847           0.779       0.885         0.0250 0.925   0.714
#> ATC:NMF     6 0.657           0.630       0.742         0.0351 0.951   0.817
#> SD:skmeans  6 0.846           0.798       0.880         0.0614 0.928   0.690
#> CV:skmeans  6 0.813           0.706       0.819         0.0495 0.945   0.772
#> MAD:skmeans 6 0.858           0.790       0.882         0.0615 0.916   0.654
#> ATC:skmeans 6 0.849           0.856       0.894         0.0395 0.985   0.938
#> SD:mclust   6 0.796           0.615       0.831         0.0748 0.895   0.587
#> CV:mclust   6 0.723           0.654       0.824         0.0691 0.812   0.448
#> MAD:mclust  6 0.713           0.586       0.768         0.0678 0.917   0.663
#> ATC:mclust  6 0.787           0.687       0.826         0.0563 0.965   0.865
#> SD:kmeans   6 0.753           0.679       0.748         0.0569 0.930   0.692
#> CV:kmeans   6 0.754           0.807       0.839         0.0609 0.953   0.803
#> MAD:kmeans  6 0.745           0.696       0.791         0.0483 0.923   0.680
#> ATC:kmeans  6 0.743           0.626       0.670         0.0362 0.890   0.596
#> SD:pam      6 0.830           0.866       0.922         0.0456 0.982   0.930
#> CV:pam      6 0.959           0.916       0.968         0.0670 0.962   0.846
#> MAD:pam     6 0.780           0.698       0.832         0.0486 0.945   0.794
#> ATC:pam     6 0.855           0.846       0.930         0.0754 0.953   0.847
#> SD:hclust   6 0.706           0.678       0.796         0.0714 0.925   0.700
#> CV:hclust   6 0.867           0.826       0.901         0.0140 0.973   0.891
#> MAD:hclust  6 0.800           0.783       0.849         0.0483 0.925   0.705
#> ATC:hclust  6 0.853           0.780       0.881         0.0432 0.976   0.918

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 other(p) k
#> SD:NMF      83    0.774 2
#> CV:NMF      86    0.416 2
#> MAD:NMF     84    0.728 2
#> ATC:NMF     86    0.744 2
#> SD:skmeans  78    0.572 2
#> CV:skmeans  78    0.572 2
#> MAD:skmeans 85    0.756 2
#> ATC:skmeans 86    0.744 2
#> SD:mclust   86    0.744 2
#> CV:mclust   86    0.303 2
#> MAD:mclust  86    0.744 2
#> ATC:mclust  86    0.744 2
#> SD:kmeans   86    0.744 2
#> CV:kmeans   78    0.572 2
#> MAD:kmeans  86    0.744 2
#> ATC:kmeans  86    0.744 2
#> SD:pam      86    0.744 2
#> CV:pam      86    0.744 2
#> MAD:pam     86    0.744 2
#> ATC:pam     86    0.744 2
#> SD:hclust   81    0.447 2
#> CV:hclust   63    0.309 2
#> MAD:hclust  71    0.531 2
#> ATC:hclust  86    0.744 2
test_to_known_factors(res_list, k = 3)
#>              n other(p) k
#> SD:NMF      82    0.645 3
#> CV:NMF      86    0.153 3
#> MAD:NMF     84    0.788 3
#> ATC:NMF     82    0.914 3
#> SD:skmeans  81    0.677 3
#> CV:skmeans  86    0.153 3
#> MAD:skmeans 86    0.863 3
#> ATC:skmeans 86    0.889 3
#> SD:mclust   85    0.356 3
#> CV:mclust   82    0.168 3
#> MAD:mclust  81    0.322 3
#> ATC:mclust  80    0.591 3
#> SD:kmeans   83    0.592 3
#> CV:kmeans   86    0.266 3
#> MAD:kmeans  86    0.863 3
#> ATC:kmeans  86    0.889 3
#> SD:pam      86    0.326 3
#> CV:pam      86    0.326 3
#> MAD:pam     86    0.326 3
#> ATC:pam     86    0.390 3
#> SD:hclust   80    0.765 3
#> CV:hclust   61    0.252 3
#> MAD:hclust  66    0.491 3
#> ATC:hclust  86    0.390 3
test_to_known_factors(res_list, k = 4)
#>              n other(p) k
#> SD:NMF      67    0.387 4
#> CV:NMF      74    0.359 4
#> MAD:NMF     74    0.823 4
#> ATC:NMF     75    0.863 4
#> SD:skmeans  83    0.490 4
#> CV:skmeans  78    0.630 4
#> MAD:skmeans 77    0.435 4
#> ATC:skmeans 86    0.552 4
#> SD:mclust   79    0.711 4
#> CV:mclust   72    0.412 4
#> MAD:mclust  84    0.600 4
#> ATC:mclust  86    0.463 4
#> SD:kmeans   82    0.556 4
#> CV:kmeans   85    0.218 4
#> MAD:kmeans  78    0.590 4
#> ATC:kmeans  53    0.893 4
#> SD:pam      86    0.394 4
#> CV:pam      86    0.260 4
#> MAD:pam     85    0.453 4
#> ATC:pam     79    0.241 4
#> SD:hclust   80    0.606 4
#> CV:hclust   69    0.334 4
#> MAD:hclust  70    0.571 4
#> ATC:hclust  83    0.318 4
test_to_known_factors(res_list, k = 5)
#>              n other(p) k
#> SD:NMF      79    0.703 5
#> CV:NMF      81    0.199 5
#> MAD:NMF     76    0.384 5
#> ATC:NMF     71    0.684 5
#> SD:skmeans  79    0.418 5
#> CV:skmeans  82    0.401 5
#> MAD:skmeans 81    0.585 5
#> ATC:skmeans 86    0.588 5
#> SD:mclust   77    0.555 5
#> CV:mclust   63    0.268 5
#> MAD:mclust  74    0.453 5
#> ATC:mclust  74    0.615 5
#> SD:kmeans   71    0.683 5
#> CV:kmeans   84    0.484 5
#> MAD:kmeans  65    0.594 5
#> ATC:kmeans  82    0.374 5
#> SD:pam      85    0.302 5
#> CV:pam      84    0.360 5
#> MAD:pam     78    0.614 5
#> ATC:pam     79    0.163 5
#> SD:hclust   73    0.606 5
#> CV:hclust   80    0.239 5
#> MAD:hclust  74    0.318 5
#> ATC:hclust  78    0.402 5
test_to_known_factors(res_list, k = 6)
#>              n other(p) k
#> SD:NMF      70    0.321 6
#> CV:NMF      81    0.472 6
#> MAD:NMF     76    0.454 6
#> ATC:NMF     66    0.695 6
#> SD:skmeans  76    0.545 6
#> CV:skmeans  71    0.266 6
#> MAD:skmeans 76    0.705 6
#> ATC:skmeans 86    0.424 6
#> SD:mclust   50    0.687 6
#> CV:mclust   69    0.113 6
#> MAD:mclust  55    0.356 6
#> ATC:mclust  73    0.348 6
#> SD:kmeans   74    0.375 6
#> CV:kmeans   82    0.624 6
#> MAD:kmeans  74    0.695 6
#> ATC:kmeans  65    0.555 6
#> SD:pam      86    0.414 6
#> CV:pam      82    0.397 6
#> MAD:pam     66    0.545 6
#> ATC:pam     80    0.304 6
#> SD:hclust   68    0.568 6
#> CV:hclust   80    0.250 6
#> MAD:hclust  80    0.393 6
#> ATC:hclust  81    0.286 6

Results for each method


SD:hclust

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 86 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.625           0.842       0.917         0.4496 0.521   0.521
#> 3 3 0.778           0.843       0.917         0.4670 0.810   0.635
#> 4 4 0.776           0.837       0.903         0.0645 0.965   0.894
#> 5 5 0.752           0.703       0.819         0.0653 0.930   0.766
#> 6 6 0.706           0.678       0.796         0.0714 0.925   0.700

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
#> GSM381194     2  0.3274      0.895 0.060 0.940
#> GSM381199     2  0.0000      0.946 0.000 1.000
#> GSM381205     2  0.0000      0.946 0.000 1.000
#> GSM381211     2  0.0000      0.946 0.000 1.000
#> GSM381220     2  0.0000      0.946 0.000 1.000
#> GSM381222     1  0.8499      0.751 0.724 0.276
#> GSM381224     1  0.8499      0.753 0.724 0.276
#> GSM381232     2  0.0000      0.946 0.000 1.000
#> GSM381240     1  0.0376      0.840 0.996 0.004
#> GSM381250     2  0.9393      0.369 0.356 0.644
#> GSM381252     2  0.0000      0.946 0.000 1.000
#> GSM381254     1  0.0000      0.839 1.000 0.000
#> GSM381256     2  0.0000      0.946 0.000 1.000
#> GSM381257     1  0.1184      0.842 0.984 0.016
#> GSM381259     1  0.0000      0.839 1.000 0.000
#> GSM381260     1  0.8555      0.747 0.720 0.280
#> GSM381261     2  0.0000      0.946 0.000 1.000
#> GSM381263     2  0.8555      0.565 0.280 0.720
#> GSM381265     1  0.0000      0.839 1.000 0.000
#> GSM381268     2  0.4298      0.864 0.088 0.912
#> GSM381270     2  0.0000      0.946 0.000 1.000
#> GSM381271     2  0.0000      0.946 0.000 1.000
#> GSM381275     2  0.0000      0.946 0.000 1.000
#> GSM381279     2  0.0000      0.946 0.000 1.000
#> GSM381195     1  0.0000      0.839 1.000 0.000
#> GSM381196     2  0.9427      0.357 0.360 0.640
#> GSM381198     2  0.0000      0.946 0.000 1.000
#> GSM381200     2  0.0000      0.946 0.000 1.000
#> GSM381201     2  0.0938      0.938 0.012 0.988
#> GSM381203     1  0.9460      0.539 0.636 0.364
#> GSM381204     1  0.0000      0.839 1.000 0.000
#> GSM381209     1  0.0000      0.839 1.000 0.000
#> GSM381212     1  0.0000      0.839 1.000 0.000
#> GSM381213     2  0.0000      0.946 0.000 1.000
#> GSM381214     2  0.0000      0.946 0.000 1.000
#> GSM381216     1  0.9087      0.692 0.676 0.324
#> GSM381225     2  0.4298      0.867 0.088 0.912
#> GSM381231     2  0.0000      0.946 0.000 1.000
#> GSM381235     1  0.8909      0.714 0.692 0.308
#> GSM381237     1  0.0000      0.839 1.000 0.000
#> GSM381241     2  0.0000      0.946 0.000 1.000
#> GSM381243     2  0.0000      0.946 0.000 1.000
#> GSM381245     1  0.4161      0.837 0.916 0.084
#> GSM381246     2  0.0000      0.946 0.000 1.000
#> GSM381251     2  0.0672      0.941 0.008 0.992
#> GSM381264     1  0.0000      0.839 1.000 0.000
#> GSM381206     2  0.0000      0.946 0.000 1.000
#> GSM381217     1  0.9922      0.397 0.552 0.448
#> GSM381218     2  0.0000      0.946 0.000 1.000
#> GSM381226     2  0.0000      0.946 0.000 1.000
#> GSM381227     2  0.0000      0.946 0.000 1.000
#> GSM381228     2  0.0000      0.946 0.000 1.000
#> GSM381236     2  0.0000      0.946 0.000 1.000
#> GSM381244     1  0.6801      0.811 0.820 0.180
#> GSM381272     2  0.0000      0.946 0.000 1.000
#> GSM381277     1  0.9000      0.703 0.684 0.316
#> GSM381278     2  0.0376      0.944 0.004 0.996
#> GSM381197     1  0.6973      0.807 0.812 0.188
#> GSM381202     1  0.7219      0.789 0.800 0.200
#> GSM381207     1  0.3733      0.838 0.928 0.072
#> GSM381208     2  0.0000      0.946 0.000 1.000
#> GSM381210     1  0.1184      0.842 0.984 0.016
#> GSM381215     2  0.7602      0.661 0.220 0.780
#> GSM381219     2  0.0000      0.946 0.000 1.000
#> GSM381221     2  0.0000      0.946 0.000 1.000
#> GSM381223     2  0.0000      0.946 0.000 1.000
#> GSM381229     2  0.0672      0.941 0.008 0.992
#> GSM381230     1  0.1843      0.842 0.972 0.028
#> GSM381233     1  0.8499      0.751 0.724 0.276
#> GSM381234     1  0.0000      0.839 1.000 0.000
#> GSM381238     2  0.0000      0.946 0.000 1.000
#> GSM381239     2  0.0000      0.946 0.000 1.000
#> GSM381242     1  0.8555      0.747 0.720 0.280
#> GSM381247     2  0.0000      0.946 0.000 1.000
#> GSM381248     1  0.1843      0.839 0.972 0.028
#> GSM381249     1  0.8081      0.775 0.752 0.248
#> GSM381253     2  0.9393      0.369 0.356 0.644
#> GSM381255     2  0.0000      0.946 0.000 1.000
#> GSM381258     2  0.9608      0.200 0.384 0.616
#> GSM381262     2  0.4161      0.868 0.084 0.916
#> GSM381266     2  0.0376      0.944 0.004 0.996
#> GSM381267     2  0.0000      0.946 0.000 1.000
#> GSM381269     1  0.8144      0.772 0.748 0.252
#> GSM381273     2  0.0672      0.941 0.008 0.992
#> GSM381274     2  0.0000      0.946 0.000 1.000
#> GSM381276     1  0.9000      0.703 0.684 0.316

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM381194     3  0.1964      0.856 0.056 0.000 0.944
#> GSM381199     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381205     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381211     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381220     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381222     1  0.5397      0.728 0.720 0.000 0.280
#> GSM381224     1  0.5397      0.731 0.720 0.000 0.280
#> GSM381232     3  0.0237      0.877 0.000 0.004 0.996
#> GSM381240     1  0.0237      0.826 0.996 0.000 0.004
#> GSM381250     3  0.5905      0.452 0.352 0.000 0.648
#> GSM381252     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381254     1  0.0000      0.825 1.000 0.000 0.000
#> GSM381256     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381257     1  0.0747      0.828 0.984 0.000 0.016
#> GSM381259     1  0.0000      0.825 1.000 0.000 0.000
#> GSM381260     1  0.5431      0.724 0.716 0.000 0.284
#> GSM381261     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381263     3  0.5363      0.613 0.276 0.000 0.724
#> GSM381265     1  0.0000      0.825 1.000 0.000 0.000
#> GSM381268     3  0.2625      0.838 0.084 0.000 0.916
#> GSM381270     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381271     3  0.0237      0.877 0.000 0.004 0.996
#> GSM381275     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381279     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381195     1  0.0237      0.826 0.996 0.000 0.004
#> GSM381196     3  0.5926      0.441 0.356 0.000 0.644
#> GSM381198     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381200     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381201     3  0.0424      0.876 0.008 0.000 0.992
#> GSM381203     1  0.5988      0.458 0.632 0.000 0.368
#> GSM381204     1  0.0000      0.825 1.000 0.000 0.000
#> GSM381209     1  0.0000      0.825 1.000 0.000 0.000
#> GSM381212     1  0.0000      0.825 1.000 0.000 0.000
#> GSM381213     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381214     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381216     1  0.5760      0.671 0.672 0.000 0.328
#> GSM381225     3  0.2625      0.839 0.084 0.000 0.916
#> GSM381231     3  0.0237      0.877 0.000 0.004 0.996
#> GSM381235     1  0.5650      0.692 0.688 0.000 0.312
#> GSM381237     1  0.0000      0.825 1.000 0.000 0.000
#> GSM381241     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381243     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381245     1  0.2711      0.821 0.912 0.000 0.088
#> GSM381246     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381251     3  0.0237      0.877 0.004 0.000 0.996
#> GSM381264     1  0.0237      0.826 0.996 0.000 0.004
#> GSM381206     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381217     1  0.6267      0.346 0.548 0.000 0.452
#> GSM381218     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381226     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381227     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381228     3  0.0237      0.877 0.000 0.004 0.996
#> GSM381236     3  0.0237      0.877 0.000 0.004 0.996
#> GSM381244     1  0.4346      0.791 0.816 0.000 0.184
#> GSM381272     3  0.0237      0.877 0.000 0.004 0.996
#> GSM381277     1  0.5706      0.681 0.680 0.000 0.320
#> GSM381278     3  0.0000      0.877 0.000 0.000 1.000
#> GSM381197     1  0.4452      0.786 0.808 0.000 0.192
#> GSM381202     1  0.4605      0.759 0.796 0.000 0.204
#> GSM381207     1  0.2448      0.822 0.924 0.000 0.076
#> GSM381208     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381210     1  0.0892      0.828 0.980 0.000 0.020
#> GSM381215     3  0.4750      0.671 0.216 0.000 0.784
#> GSM381219     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381221     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381223     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381229     3  0.0237      0.877 0.004 0.000 0.996
#> GSM381230     1  0.1163      0.827 0.972 0.000 0.028
#> GSM381233     1  0.5397      0.728 0.720 0.000 0.280
#> GSM381234     1  0.0000      0.825 1.000 0.000 0.000
#> GSM381238     3  0.0237      0.877 0.000 0.004 0.996
#> GSM381239     3  0.0237      0.877 0.000 0.004 0.996
#> GSM381242     1  0.5431      0.724 0.716 0.000 0.284
#> GSM381247     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381248     1  0.1163      0.822 0.972 0.000 0.028
#> GSM381249     1  0.5138      0.753 0.748 0.000 0.252
#> GSM381253     3  0.5905      0.452 0.352 0.000 0.648
#> GSM381255     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381258     3  0.6045      0.230 0.380 0.000 0.620
#> GSM381262     3  0.2537      0.840 0.080 0.000 0.920
#> GSM381266     3  0.0000      0.877 0.000 0.000 1.000
#> GSM381267     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381269     1  0.5178      0.751 0.744 0.000 0.256
#> GSM381273     3  0.0237      0.877 0.004 0.000 0.996
#> GSM381274     2  0.0000      0.999 0.000 1.000 0.000
#> GSM381276     1  0.5706      0.681 0.680 0.000 0.320

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.3612      0.740 0.044 0.000 0.856 0.100
#> GSM381199     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381205     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381211     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381220     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381222     1  0.5719      0.730 0.712 0.000 0.176 0.112
#> GSM381224     1  0.5719      0.733 0.712 0.000 0.176 0.112
#> GSM381232     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM381240     1  0.0336      0.822 0.992 0.000 0.008 0.000
#> GSM381250     3  0.6219      0.478 0.344 0.000 0.588 0.068
#> GSM381252     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381254     1  0.0000      0.820 1.000 0.000 0.000 0.000
#> GSM381256     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381257     1  0.0592      0.823 0.984 0.000 0.000 0.016
#> GSM381259     1  0.0000      0.820 1.000 0.000 0.000 0.000
#> GSM381260     1  0.5816      0.728 0.708 0.000 0.144 0.148
#> GSM381261     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381263     3  0.5953      0.605 0.268 0.000 0.656 0.076
#> GSM381265     1  0.0000      0.820 1.000 0.000 0.000 0.000
#> GSM381268     3  0.3144      0.753 0.072 0.000 0.884 0.044
#> GSM381270     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381271     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM381275     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381279     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381195     1  0.0188      0.822 0.996 0.000 0.004 0.000
#> GSM381196     3  0.6234      0.468 0.348 0.000 0.584 0.068
#> GSM381198     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381200     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381201     3  0.0895      0.718 0.004 0.000 0.976 0.020
#> GSM381203     1  0.5966      0.399 0.624 0.000 0.316 0.060
#> GSM381204     1  0.0000      0.820 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.820 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.820 1.000 0.000 0.000 0.000
#> GSM381213     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381214     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381216     1  0.6229      0.682 0.664 0.000 0.204 0.132
#> GSM381225     3  0.3691      0.739 0.076 0.000 0.856 0.068
#> GSM381231     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM381235     1  0.6075      0.699 0.680 0.000 0.192 0.128
#> GSM381237     1  0.0000      0.820 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381243     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381245     1  0.2623      0.816 0.908 0.000 0.028 0.064
#> GSM381246     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381251     3  0.0707      0.716 0.000 0.000 0.980 0.020
#> GSM381264     1  0.0188      0.822 0.996 0.000 0.004 0.000
#> GSM381206     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381217     1  0.6750      0.351 0.540 0.000 0.356 0.104
#> GSM381218     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381226     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381227     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381228     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM381236     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM381244     1  0.4525      0.787 0.804 0.000 0.116 0.080
#> GSM381272     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM381277     1  0.6193      0.691 0.672 0.000 0.180 0.148
#> GSM381278     3  0.2149      0.714 0.000 0.000 0.912 0.088
#> GSM381197     1  0.4635      0.779 0.796 0.000 0.124 0.080
#> GSM381202     1  0.4740      0.751 0.788 0.000 0.132 0.080
#> GSM381207     1  0.2300      0.816 0.920 0.000 0.016 0.064
#> GSM381208     2  0.0336      0.992 0.000 0.992 0.000 0.008
#> GSM381210     1  0.0817      0.823 0.976 0.000 0.024 0.000
#> GSM381215     3  0.6118      0.615 0.208 0.000 0.672 0.120
#> GSM381219     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381221     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381223     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381229     3  0.0707      0.716 0.000 0.000 0.980 0.020
#> GSM381230     1  0.0921      0.820 0.972 0.000 0.028 0.000
#> GSM381233     1  0.5719      0.730 0.712 0.000 0.176 0.112
#> GSM381234     1  0.0000      0.820 1.000 0.000 0.000 0.000
#> GSM381238     4  0.0188      0.995 0.000 0.000 0.004 0.996
#> GSM381239     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM381242     1  0.5816      0.728 0.708 0.000 0.144 0.148
#> GSM381247     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381248     1  0.0921      0.814 0.972 0.000 0.028 0.000
#> GSM381249     1  0.5423      0.753 0.740 0.000 0.144 0.116
#> GSM381253     3  0.6219      0.478 0.344 0.000 0.588 0.068
#> GSM381255     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381258     3  0.7200      0.143 0.372 0.000 0.484 0.144
#> GSM381262     3  0.3320      0.753 0.068 0.000 0.876 0.056
#> GSM381266     3  0.2149      0.714 0.000 0.000 0.912 0.088
#> GSM381267     2  0.0336      0.992 0.000 0.992 0.000 0.008
#> GSM381269     1  0.5476      0.751 0.736 0.000 0.144 0.120
#> GSM381273     3  0.0707      0.716 0.000 0.000 0.980 0.020
#> GSM381274     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM381276     1  0.6193      0.691 0.672 0.000 0.180 0.148

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.4238     0.7007 0.028 0.000 0.740 0.004 0.228
#> GSM381199     2  0.2127     0.9225 0.000 0.892 0.000 0.000 0.108
#> GSM381205     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381220     2  0.2127     0.9225 0.000 0.892 0.000 0.000 0.108
#> GSM381222     5  0.4713     0.7348 0.440 0.000 0.016 0.000 0.544
#> GSM381224     5  0.4448     0.6540 0.480 0.000 0.004 0.000 0.516
#> GSM381232     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.1732     0.6875 0.920 0.000 0.000 0.000 0.080
#> GSM381250     3  0.6525     0.3380 0.288 0.000 0.504 0.004 0.204
#> GSM381252     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381254     1  0.0404     0.7306 0.988 0.000 0.000 0.000 0.012
#> GSM381256     2  0.1410     0.9306 0.000 0.940 0.000 0.000 0.060
#> GSM381257     1  0.1043     0.7196 0.960 0.000 0.000 0.000 0.040
#> GSM381259     1  0.0162     0.7249 0.996 0.000 0.000 0.000 0.004
#> GSM381260     1  0.4800    -0.5485 0.508 0.000 0.012 0.004 0.476
#> GSM381261     2  0.3707     0.8040 0.000 0.716 0.000 0.000 0.284
#> GSM381263     3  0.6209     0.4958 0.216 0.000 0.572 0.004 0.208
#> GSM381265     1  0.0404     0.7293 0.988 0.000 0.000 0.000 0.012
#> GSM381268     3  0.3804     0.7121 0.044 0.000 0.796 0.000 0.160
#> GSM381270     2  0.2127     0.9225 0.000 0.892 0.000 0.000 0.108
#> GSM381271     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000
#> GSM381275     2  0.3707     0.8040 0.000 0.716 0.000 0.000 0.284
#> GSM381279     2  0.2127     0.9225 0.000 0.892 0.000 0.000 0.108
#> GSM381195     1  0.0510     0.7298 0.984 0.000 0.000 0.000 0.016
#> GSM381196     3  0.6547     0.3277 0.288 0.000 0.500 0.004 0.208
#> GSM381198     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381200     2  0.1478     0.9310 0.000 0.936 0.000 0.000 0.064
#> GSM381201     3  0.0162     0.6926 0.000 0.000 0.996 0.000 0.004
#> GSM381203     1  0.5983    -0.0546 0.580 0.000 0.252 0.000 0.168
#> GSM381204     1  0.0000     0.7287 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0880     0.7242 0.968 0.000 0.000 0.000 0.032
#> GSM381212     1  0.0000     0.7287 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381214     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381216     5  0.5010     0.7241 0.392 0.000 0.036 0.000 0.572
#> GSM381225     3  0.4801     0.6629 0.048 0.000 0.668 0.000 0.284
#> GSM381231     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000
#> GSM381235     5  0.4909     0.7366 0.412 0.000 0.028 0.000 0.560
#> GSM381237     1  0.0000     0.7287 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0162     0.9328 0.000 0.996 0.000 0.000 0.004
#> GSM381243     2  0.2127     0.9225 0.000 0.892 0.000 0.000 0.108
#> GSM381245     1  0.3010     0.5416 0.824 0.000 0.004 0.000 0.172
#> GSM381246     2  0.0880     0.9332 0.000 0.968 0.000 0.000 0.032
#> GSM381251     3  0.0000     0.6921 0.000 0.000 1.000 0.000 0.000
#> GSM381264     1  0.0290     0.7281 0.992 0.000 0.000 0.000 0.008
#> GSM381206     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381217     5  0.6534     0.4779 0.388 0.000 0.196 0.000 0.416
#> GSM381218     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381226     2  0.0880     0.9332 0.000 0.968 0.000 0.000 0.032
#> GSM381227     2  0.2127     0.9225 0.000 0.892 0.000 0.000 0.108
#> GSM381228     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000
#> GSM381244     1  0.5353    -0.1610 0.604 0.000 0.060 0.004 0.332
#> GSM381272     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000
#> GSM381277     5  0.4695     0.6126 0.464 0.000 0.008 0.004 0.524
#> GSM381278     3  0.3766     0.6641 0.000 0.000 0.728 0.004 0.268
#> GSM381197     1  0.5434    -0.1123 0.604 0.000 0.068 0.004 0.324
#> GSM381202     1  0.5460     0.0568 0.640 0.000 0.092 0.004 0.264
#> GSM381207     1  0.2690     0.5741 0.844 0.000 0.000 0.000 0.156
#> GSM381208     2  0.1557     0.9024 0.000 0.940 0.008 0.000 0.052
#> GSM381210     1  0.2127     0.6626 0.892 0.000 0.000 0.000 0.108
#> GSM381215     3  0.5499     0.4807 0.056 0.000 0.532 0.004 0.408
#> GSM381219     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381221     2  0.1851     0.9273 0.000 0.912 0.000 0.000 0.088
#> GSM381223     2  0.3707     0.8040 0.000 0.716 0.000 0.000 0.284
#> GSM381229     3  0.0162     0.6947 0.000 0.000 0.996 0.000 0.004
#> GSM381230     1  0.1851     0.6783 0.912 0.000 0.000 0.000 0.088
#> GSM381233     5  0.4713     0.7348 0.440 0.000 0.016 0.000 0.544
#> GSM381234     1  0.0404     0.7306 0.988 0.000 0.000 0.000 0.012
#> GSM381238     4  0.0404     0.9879 0.000 0.000 0.000 0.988 0.012
#> GSM381239     4  0.0000     0.9983 0.000 0.000 0.000 1.000 0.000
#> GSM381242     1  0.4800    -0.5485 0.508 0.000 0.012 0.004 0.476
#> GSM381247     2  0.2127     0.9225 0.000 0.892 0.000 0.000 0.108
#> GSM381248     1  0.1197     0.7055 0.952 0.000 0.000 0.000 0.048
#> GSM381249     5  0.4294     0.7007 0.468 0.000 0.000 0.000 0.532
#> GSM381253     3  0.6525     0.3380 0.288 0.000 0.504 0.004 0.204
#> GSM381255     2  0.0000     0.9324 0.000 1.000 0.000 0.000 0.000
#> GSM381258     5  0.5822     0.0841 0.112 0.000 0.292 0.004 0.592
#> GSM381262     3  0.3922     0.7121 0.040 0.000 0.780 0.000 0.180
#> GSM381266     3  0.3766     0.6641 0.000 0.000 0.728 0.004 0.268
#> GSM381267     2  0.1557     0.9024 0.000 0.940 0.008 0.000 0.052
#> GSM381269     5  0.4291     0.7068 0.464 0.000 0.000 0.000 0.536
#> GSM381273     3  0.0000     0.6921 0.000 0.000 1.000 0.000 0.000
#> GSM381274     2  0.3707     0.8040 0.000 0.716 0.000 0.000 0.284
#> GSM381276     5  0.4695     0.6126 0.464 0.000 0.008 0.004 0.524

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.3874      0.666 0.008 0.000 0.704 0.000 0.276 0.012
#> GSM381199     2  0.3804      0.338 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM381205     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381220     2  0.3695      0.416 0.000 0.624 0.000 0.000 0.000 0.376
#> GSM381222     5  0.2834      0.744 0.128 0.000 0.016 0.000 0.848 0.008
#> GSM381224     5  0.3772      0.741 0.160 0.000 0.000 0.000 0.772 0.068
#> GSM381232     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381240     1  0.2668      0.748 0.828 0.000 0.000 0.000 0.168 0.004
#> GSM381250     3  0.5627      0.378 0.132 0.000 0.484 0.000 0.380 0.004
#> GSM381252     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381254     1  0.0458      0.853 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM381256     2  0.2730      0.616 0.000 0.808 0.000 0.000 0.000 0.192
#> GSM381257     1  0.1806      0.810 0.908 0.000 0.000 0.000 0.088 0.004
#> GSM381259     1  0.0146      0.848 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381260     5  0.3900      0.732 0.180 0.000 0.008 0.000 0.764 0.048
#> GSM381261     6  0.2793      1.000 0.000 0.200 0.000 0.000 0.000 0.800
#> GSM381263     3  0.5389      0.485 0.116 0.000 0.552 0.000 0.328 0.004
#> GSM381265     1  0.0405      0.852 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM381268     3  0.3273      0.688 0.008 0.000 0.776 0.000 0.212 0.004
#> GSM381270     2  0.3804      0.338 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM381271     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     6  0.2793      1.000 0.000 0.200 0.000 0.000 0.000 0.800
#> GSM381279     2  0.3804      0.338 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM381195     1  0.0777      0.851 0.972 0.000 0.000 0.000 0.024 0.004
#> GSM381196     3  0.5633      0.368 0.132 0.000 0.480 0.000 0.384 0.004
#> GSM381198     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381200     2  0.3578      0.479 0.000 0.660 0.000 0.000 0.000 0.340
#> GSM381201     3  0.0405      0.690 0.000 0.000 0.988 0.000 0.004 0.008
#> GSM381203     1  0.6000     -0.235 0.420 0.000 0.244 0.000 0.336 0.000
#> GSM381204     1  0.0146      0.852 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM381209     1  0.1267      0.841 0.940 0.000 0.000 0.000 0.060 0.000
#> GSM381212     1  0.0146      0.852 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM381213     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381214     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381216     5  0.2485      0.722 0.084 0.000 0.024 0.000 0.884 0.008
#> GSM381225     3  0.5163      0.623 0.016 0.000 0.628 0.000 0.268 0.088
#> GSM381231     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381235     5  0.2833      0.734 0.104 0.000 0.024 0.000 0.860 0.012
#> GSM381237     1  0.0146      0.852 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM381241     2  0.0146      0.732 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381243     2  0.3804      0.338 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM381245     1  0.3650      0.577 0.716 0.000 0.004 0.000 0.272 0.008
#> GSM381246     2  0.2697      0.637 0.000 0.812 0.000 0.000 0.000 0.188
#> GSM381251     3  0.0260      0.690 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM381264     1  0.0291      0.850 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM381206     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381217     5  0.5275      0.459 0.168 0.000 0.192 0.000 0.632 0.008
#> GSM381218     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381226     2  0.2697      0.637 0.000 0.812 0.000 0.000 0.000 0.188
#> GSM381227     2  0.3804      0.338 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM381228     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     5  0.4830      0.648 0.260 0.000 0.052 0.000 0.664 0.024
#> GSM381272     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     5  0.3883      0.723 0.144 0.000 0.000 0.000 0.768 0.088
#> GSM381278     3  0.4422      0.626 0.000 0.000 0.700 0.000 0.212 0.088
#> GSM381197     5  0.4830      0.631 0.260 0.000 0.052 0.000 0.664 0.024
#> GSM381202     5  0.5371      0.389 0.392 0.000 0.088 0.000 0.512 0.008
#> GSM381207     1  0.3398      0.613 0.740 0.000 0.000 0.000 0.252 0.008
#> GSM381208     2  0.1757      0.657 0.000 0.916 0.008 0.000 0.000 0.076
#> GSM381210     1  0.3023      0.701 0.784 0.000 0.004 0.000 0.212 0.000
#> GSM381215     5  0.3999     -0.424 0.004 0.000 0.496 0.000 0.500 0.000
#> GSM381219     2  0.0146      0.732 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381221     2  0.3563      0.487 0.000 0.664 0.000 0.000 0.000 0.336
#> GSM381223     6  0.2793      1.000 0.000 0.200 0.000 0.000 0.000 0.800
#> GSM381229     3  0.0146      0.691 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM381230     1  0.2482      0.770 0.848 0.000 0.000 0.000 0.148 0.004
#> GSM381233     5  0.2834      0.744 0.128 0.000 0.016 0.000 0.848 0.008
#> GSM381234     1  0.0632      0.853 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM381238     4  0.0458      0.985 0.000 0.000 0.000 0.984 0.016 0.000
#> GSM381239     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     5  0.3900      0.732 0.180 0.000 0.008 0.000 0.764 0.048
#> GSM381247     2  0.3804      0.338 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM381248     1  0.2294      0.816 0.892 0.000 0.000 0.000 0.072 0.036
#> GSM381249     5  0.2734      0.746 0.148 0.000 0.004 0.000 0.840 0.008
#> GSM381253     3  0.5627      0.378 0.132 0.000 0.484 0.000 0.380 0.004
#> GSM381255     2  0.0000      0.733 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381258     5  0.3620      0.270 0.008 0.000 0.248 0.000 0.736 0.008
#> GSM381262     3  0.3481      0.686 0.004 0.000 0.756 0.000 0.228 0.012
#> GSM381266     3  0.4422      0.626 0.000 0.000 0.700 0.000 0.212 0.088
#> GSM381267     2  0.1757      0.657 0.000 0.916 0.008 0.000 0.000 0.076
#> GSM381269     5  0.2695      0.746 0.144 0.000 0.004 0.000 0.844 0.008
#> GSM381273     3  0.0260      0.690 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM381274     6  0.2793      1.000 0.000 0.200 0.000 0.000 0.000 0.800
#> GSM381276     5  0.3883      0.723 0.144 0.000 0.000 0.000 0.768 0.088

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 other(p) k
#> SD:hclust 81    0.447 2
#> SD:hclust 80    0.765 3
#> SD:hclust 80    0.606 4
#> SD:hclust 73    0.606 5
#> SD:hclust 68    0.568 6

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


SD:kmeans

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 86 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.829           0.953       0.971         0.4616 0.548   0.548
#> 3 3 0.833           0.896       0.934         0.3708 0.814   0.660
#> 4 4 0.714           0.783       0.834         0.1194 0.852   0.625
#> 5 5 0.682           0.616       0.715         0.0716 0.904   0.674
#> 6 6 0.753           0.679       0.748         0.0569 0.930   0.692

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM381194     1  0.1414      0.955 0.980 0.020
#> GSM381199     2  0.1414      0.995 0.020 0.980
#> GSM381205     2  0.1414      0.995 0.020 0.980
#> GSM381211     2  0.1414      0.995 0.020 0.980
#> GSM381220     2  0.0000      0.983 0.000 1.000
#> GSM381222     1  0.0000      0.964 1.000 0.000
#> GSM381224     1  0.0000      0.964 1.000 0.000
#> GSM381232     1  0.7745      0.760 0.772 0.228
#> GSM381240     1  0.0000      0.964 1.000 0.000
#> GSM381250     1  0.0000      0.964 1.000 0.000
#> GSM381252     2  0.1414      0.995 0.020 0.980
#> GSM381254     1  0.0000      0.964 1.000 0.000
#> GSM381256     2  0.1414      0.995 0.020 0.980
#> GSM381257     1  0.0000      0.964 1.000 0.000
#> GSM381259     1  0.0000      0.964 1.000 0.000
#> GSM381260     1  0.0000      0.964 1.000 0.000
#> GSM381261     2  0.1414      0.995 0.020 0.980
#> GSM381263     1  0.0000      0.964 1.000 0.000
#> GSM381265     1  0.0000      0.964 1.000 0.000
#> GSM381268     1  0.1414      0.955 0.980 0.020
#> GSM381270     2  0.0000      0.983 0.000 1.000
#> GSM381271     1  0.7745      0.760 0.772 0.228
#> GSM381275     2  0.1414      0.995 0.020 0.980
#> GSM381279     2  0.0000      0.983 0.000 1.000
#> GSM381195     1  0.0000      0.964 1.000 0.000
#> GSM381196     1  0.0000      0.964 1.000 0.000
#> GSM381198     2  0.1414      0.995 0.020 0.980
#> GSM381200     2  0.1414      0.995 0.020 0.980
#> GSM381201     1  0.1414      0.955 0.980 0.020
#> GSM381203     1  0.0000      0.964 1.000 0.000
#> GSM381204     1  0.0000      0.964 1.000 0.000
#> GSM381209     1  0.0000      0.964 1.000 0.000
#> GSM381212     1  0.0000      0.964 1.000 0.000
#> GSM381213     2  0.0000      0.983 0.000 1.000
#> GSM381214     2  0.1414      0.995 0.020 0.980
#> GSM381216     1  0.0000      0.964 1.000 0.000
#> GSM381225     1  0.0000      0.964 1.000 0.000
#> GSM381231     1  0.7745      0.760 0.772 0.228
#> GSM381235     1  0.0000      0.964 1.000 0.000
#> GSM381237     1  0.0000      0.964 1.000 0.000
#> GSM381241     2  0.1414      0.995 0.020 0.980
#> GSM381243     2  0.0000      0.983 0.000 1.000
#> GSM381245     1  0.0000      0.964 1.000 0.000
#> GSM381246     2  0.1414      0.995 0.020 0.980
#> GSM381251     1  0.1414      0.955 0.980 0.020
#> GSM381264     1  0.0000      0.964 1.000 0.000
#> GSM381206     2  0.1414      0.995 0.020 0.980
#> GSM381217     1  0.0000      0.964 1.000 0.000
#> GSM381218     2  0.1414      0.995 0.020 0.980
#> GSM381226     2  0.1414      0.995 0.020 0.980
#> GSM381227     2  0.1414      0.995 0.020 0.980
#> GSM381228     1  0.7745      0.760 0.772 0.228
#> GSM381236     1  0.7745      0.760 0.772 0.228
#> GSM381244     1  0.0000      0.964 1.000 0.000
#> GSM381272     1  0.7745      0.760 0.772 0.228
#> GSM381277     1  0.0000      0.964 1.000 0.000
#> GSM381278     1  0.1414      0.955 0.980 0.020
#> GSM381197     1  0.0000      0.964 1.000 0.000
#> GSM381202     1  0.0000      0.964 1.000 0.000
#> GSM381207     1  0.0000      0.964 1.000 0.000
#> GSM381208     2  0.1414      0.995 0.020 0.980
#> GSM381210     1  0.0000      0.964 1.000 0.000
#> GSM381215     1  0.1414      0.955 0.980 0.020
#> GSM381219     2  0.1414      0.995 0.020 0.980
#> GSM381221     2  0.1414      0.995 0.020 0.980
#> GSM381223     2  0.1414      0.995 0.020 0.980
#> GSM381229     1  0.1414      0.955 0.980 0.020
#> GSM381230     1  0.0000      0.964 1.000 0.000
#> GSM381233     1  0.0000      0.964 1.000 0.000
#> GSM381234     1  0.0000      0.964 1.000 0.000
#> GSM381238     1  0.7745      0.760 0.772 0.228
#> GSM381239     1  0.7745      0.760 0.772 0.228
#> GSM381242     1  0.0000      0.964 1.000 0.000
#> GSM381247     2  0.0000      0.983 0.000 1.000
#> GSM381248     1  0.0000      0.964 1.000 0.000
#> GSM381249     1  0.0000      0.964 1.000 0.000
#> GSM381253     1  0.0000      0.964 1.000 0.000
#> GSM381255     2  0.1414      0.995 0.020 0.980
#> GSM381258     1  0.1414      0.955 0.980 0.020
#> GSM381262     1  0.1414      0.955 0.980 0.020
#> GSM381266     1  0.1414      0.955 0.980 0.020
#> GSM381267     2  0.0000      0.983 0.000 1.000
#> GSM381269     1  0.0000      0.964 1.000 0.000
#> GSM381273     1  0.1414      0.955 0.980 0.020
#> GSM381274     2  0.1414      0.995 0.020 0.980
#> GSM381276     1  0.0938      0.958 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM381194     3  0.3879    0.91833 0.152 0.000 0.848
#> GSM381199     2  0.1753    0.97241 0.000 0.952 0.048
#> GSM381205     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381211     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381220     2  0.0892    0.97820 0.000 0.980 0.020
#> GSM381222     1  0.0592    0.91575 0.988 0.000 0.012
#> GSM381224     1  0.0237    0.91766 0.996 0.000 0.004
#> GSM381232     3  0.2496    0.92453 0.068 0.004 0.928
#> GSM381240     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381250     1  0.4504    0.74596 0.804 0.000 0.196
#> GSM381252     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381254     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381256     2  0.0000    0.97850 0.000 1.000 0.000
#> GSM381257     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381259     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381260     1  0.3412    0.82842 0.876 0.000 0.124
#> GSM381261     2  0.2261    0.96731 0.000 0.932 0.068
#> GSM381263     1  0.5431    0.60310 0.716 0.000 0.284
#> GSM381265     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381268     1  0.6126    0.30570 0.600 0.000 0.400
#> GSM381270     2  0.2165    0.96840 0.000 0.936 0.064
#> GSM381271     3  0.2496    0.92453 0.068 0.004 0.928
#> GSM381275     2  0.2261    0.96731 0.000 0.932 0.068
#> GSM381279     2  0.2165    0.96840 0.000 0.936 0.064
#> GSM381195     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381196     1  0.4452    0.75132 0.808 0.000 0.192
#> GSM381198     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381200     2  0.1753    0.97241 0.000 0.952 0.048
#> GSM381201     3  0.3879    0.91833 0.152 0.000 0.848
#> GSM381203     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381204     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381209     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381212     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381213     2  0.1289    0.97649 0.000 0.968 0.032
#> GSM381214     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381216     1  0.0592    0.91575 0.988 0.000 0.012
#> GSM381225     1  0.5465    0.59535 0.712 0.000 0.288
#> GSM381231     3  0.2496    0.92453 0.068 0.004 0.928
#> GSM381235     1  0.0592    0.91575 0.988 0.000 0.012
#> GSM381237     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381241     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381243     2  0.2165    0.96840 0.000 0.936 0.064
#> GSM381245     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381246     2  0.0237    0.97823 0.000 0.996 0.004
#> GSM381251     3  0.3879    0.91833 0.152 0.000 0.848
#> GSM381264     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381206     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381217     1  0.0592    0.91575 0.988 0.000 0.012
#> GSM381218     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381226     2  0.0592    0.97814 0.000 0.988 0.012
#> GSM381227     2  0.2261    0.96731 0.000 0.932 0.068
#> GSM381228     3  0.2496    0.92453 0.068 0.004 0.928
#> GSM381236     3  0.2496    0.92453 0.068 0.004 0.928
#> GSM381244     1  0.0424    0.91678 0.992 0.000 0.008
#> GSM381272     3  0.2496    0.92453 0.068 0.004 0.928
#> GSM381277     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381278     3  0.3686    0.92387 0.140 0.000 0.860
#> GSM381197     1  0.3340    0.83011 0.880 0.000 0.120
#> GSM381202     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381207     1  0.0424    0.91678 0.992 0.000 0.008
#> GSM381208     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381210     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381215     3  0.6026    0.49387 0.376 0.000 0.624
#> GSM381219     2  0.0000    0.97850 0.000 1.000 0.000
#> GSM381221     2  0.0000    0.97850 0.000 1.000 0.000
#> GSM381223     2  0.2261    0.96731 0.000 0.932 0.068
#> GSM381229     3  0.3879    0.91833 0.152 0.000 0.848
#> GSM381230     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381233     1  0.0592    0.91575 0.988 0.000 0.012
#> GSM381234     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381238     3  0.2496    0.92453 0.068 0.004 0.928
#> GSM381239     3  0.2496    0.92453 0.068 0.004 0.928
#> GSM381242     1  0.3482    0.82560 0.872 0.000 0.128
#> GSM381247     2  0.2165    0.96840 0.000 0.936 0.064
#> GSM381248     1  0.0000    0.91838 1.000 0.000 0.000
#> GSM381249     1  0.0237    0.91766 0.996 0.000 0.004
#> GSM381253     1  0.2959    0.85104 0.900 0.000 0.100
#> GSM381255     2  0.0237    0.97827 0.000 0.996 0.004
#> GSM381258     1  0.6299    0.00288 0.524 0.000 0.476
#> GSM381262     3  0.3879    0.91833 0.152 0.000 0.848
#> GSM381266     3  0.3686    0.92387 0.140 0.000 0.860
#> GSM381267     2  0.0892    0.97820 0.000 0.980 0.020
#> GSM381269     1  0.0592    0.91575 0.988 0.000 0.012
#> GSM381273     3  0.3686    0.92387 0.140 0.000 0.860
#> GSM381274     2  0.2261    0.96731 0.000 0.932 0.068
#> GSM381276     1  0.5465    0.59535 0.712 0.000 0.288

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.5972     0.6685 0.064 0.000 0.632 0.304
#> GSM381199     2  0.3668     0.8743 0.000 0.808 0.188 0.004
#> GSM381205     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381211     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381220     2  0.2589     0.8901 0.000 0.884 0.116 0.000
#> GSM381222     1  0.3032     0.7667 0.868 0.000 0.124 0.008
#> GSM381224     1  0.1211     0.8508 0.960 0.000 0.040 0.000
#> GSM381232     4  0.0804     1.0000 0.012 0.000 0.008 0.980
#> GSM381240     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381250     3  0.5913     0.6998 0.352 0.000 0.600 0.048
#> GSM381252     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381254     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381256     2  0.0188     0.8921 0.000 0.996 0.004 0.000
#> GSM381257     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381259     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381260     1  0.5408    -0.4509 0.500 0.000 0.488 0.012
#> GSM381261     2  0.4914     0.8229 0.000 0.676 0.312 0.012
#> GSM381263     3  0.6375     0.7329 0.312 0.000 0.600 0.088
#> GSM381265     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381268     3  0.6216     0.7672 0.220 0.000 0.660 0.120
#> GSM381270     2  0.4356     0.8416 0.000 0.708 0.292 0.000
#> GSM381271     4  0.0804     1.0000 0.012 0.000 0.008 0.980
#> GSM381275     2  0.4820     0.8309 0.000 0.692 0.296 0.012
#> GSM381279     2  0.4356     0.8416 0.000 0.708 0.292 0.000
#> GSM381195     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381196     3  0.5855     0.6952 0.356 0.000 0.600 0.044
#> GSM381198     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381200     2  0.3494     0.8778 0.000 0.824 0.172 0.004
#> GSM381201     3  0.5972     0.6685 0.064 0.000 0.632 0.304
#> GSM381203     1  0.4830    -0.0769 0.608 0.000 0.392 0.000
#> GSM381204     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381213     2  0.2814     0.8770 0.000 0.868 0.132 0.000
#> GSM381214     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381216     3  0.5112     0.6152 0.384 0.000 0.608 0.008
#> GSM381225     3  0.6056     0.7576 0.248 0.000 0.660 0.092
#> GSM381231     4  0.0804     1.0000 0.012 0.000 0.008 0.980
#> GSM381235     3  0.4936     0.6764 0.340 0.000 0.652 0.008
#> GSM381237     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381243     2  0.4356     0.8416 0.000 0.708 0.292 0.000
#> GSM381245     1  0.0188     0.8750 0.996 0.000 0.004 0.000
#> GSM381246     2  0.0895     0.8926 0.000 0.976 0.020 0.004
#> GSM381251     3  0.5972     0.6685 0.064 0.000 0.632 0.304
#> GSM381264     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381206     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381217     3  0.5112     0.6152 0.384 0.000 0.608 0.008
#> GSM381218     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381226     2  0.2831     0.8882 0.000 0.876 0.120 0.004
#> GSM381227     2  0.4382     0.8399 0.000 0.704 0.296 0.000
#> GSM381228     4  0.0804     1.0000 0.012 0.000 0.008 0.980
#> GSM381236     4  0.0804     1.0000 0.012 0.000 0.008 0.980
#> GSM381244     3  0.5105     0.5246 0.432 0.000 0.564 0.004
#> GSM381272     4  0.0804     1.0000 0.012 0.000 0.008 0.980
#> GSM381277     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381278     3  0.5697     0.6708 0.056 0.000 0.664 0.280
#> GSM381197     1  0.5408    -0.4524 0.500 0.000 0.488 0.012
#> GSM381202     1  0.4250     0.3859 0.724 0.000 0.276 0.000
#> GSM381207     1  0.0657     0.8673 0.984 0.000 0.012 0.004
#> GSM381208     2  0.0657     0.8853 0.000 0.984 0.012 0.004
#> GSM381210     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381215     3  0.6243     0.7547 0.160 0.000 0.668 0.172
#> GSM381219     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381221     2  0.2081     0.8926 0.000 0.916 0.084 0.000
#> GSM381223     2  0.4820     0.8309 0.000 0.692 0.296 0.012
#> GSM381229     3  0.5972     0.6685 0.064 0.000 0.632 0.304
#> GSM381230     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381233     1  0.3032     0.7667 0.868 0.000 0.124 0.008
#> GSM381234     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381238     4  0.0804     1.0000 0.012 0.000 0.008 0.980
#> GSM381239     4  0.0804     1.0000 0.012 0.000 0.008 0.980
#> GSM381242     3  0.5398     0.5886 0.404 0.000 0.580 0.016
#> GSM381247     2  0.4356     0.8416 0.000 0.708 0.292 0.000
#> GSM381248     1  0.0000     0.8774 1.000 0.000 0.000 0.000
#> GSM381249     1  0.2281     0.8026 0.904 0.000 0.096 0.000
#> GSM381253     3  0.5138     0.6427 0.392 0.000 0.600 0.008
#> GSM381255     2  0.0000     0.8917 0.000 1.000 0.000 0.000
#> GSM381258     3  0.6260     0.7694 0.192 0.000 0.664 0.144
#> GSM381262     3  0.5972     0.6685 0.064 0.000 0.632 0.304
#> GSM381266     3  0.5898     0.6517 0.056 0.000 0.628 0.316
#> GSM381267     2  0.2593     0.8900 0.000 0.892 0.104 0.004
#> GSM381269     1  0.3032     0.7667 0.868 0.000 0.124 0.008
#> GSM381273     3  0.5878     0.6539 0.056 0.000 0.632 0.312
#> GSM381274     2  0.4795     0.8324 0.000 0.696 0.292 0.012
#> GSM381276     3  0.6494     0.7063 0.340 0.000 0.572 0.088

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.1121     0.6906 0.044 0.000 0.956 0.000 0.000
#> GSM381199     2  0.3379     0.4694 0.000 0.828 0.016 0.008 0.148
#> GSM381205     5  0.4446     0.9640 0.000 0.476 0.000 0.004 0.520
#> GSM381211     5  0.4911     0.9551 0.000 0.476 0.012 0.008 0.504
#> GSM381220     2  0.4086    -0.0272 0.000 0.704 0.012 0.000 0.284
#> GSM381222     1  0.5117     0.6119 0.652 0.000 0.072 0.276 0.000
#> GSM381224     1  0.4422     0.6514 0.680 0.000 0.016 0.300 0.004
#> GSM381232     4  0.6664     0.7657 0.012 0.000 0.156 0.420 0.412
#> GSM381240     1  0.0404     0.8464 0.988 0.000 0.000 0.012 0.000
#> GSM381250     3  0.4645     0.7052 0.204 0.000 0.724 0.072 0.000
#> GSM381252     5  0.4446     0.9634 0.000 0.476 0.004 0.000 0.520
#> GSM381254     1  0.0162     0.8472 0.996 0.000 0.000 0.004 0.000
#> GSM381256     5  0.4704     0.9507 0.000 0.480 0.008 0.004 0.508
#> GSM381257     1  0.0162     0.8470 0.996 0.000 0.000 0.000 0.004
#> GSM381259     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.7219     0.3921 0.308 0.000 0.348 0.328 0.016
#> GSM381261     2  0.2830     0.6176 0.000 0.884 0.016 0.080 0.020
#> GSM381263     3  0.4514     0.7091 0.188 0.000 0.740 0.072 0.000
#> GSM381265     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.3019     0.7210 0.108 0.000 0.864 0.012 0.016
#> GSM381270     2  0.0162     0.6408 0.000 0.996 0.004 0.000 0.000
#> GSM381271     4  0.6664     0.7660 0.012 0.000 0.156 0.424 0.408
#> GSM381275     2  0.3009     0.6174 0.000 0.876 0.016 0.080 0.028
#> GSM381279     2  0.0162     0.6408 0.000 0.996 0.004 0.000 0.000
#> GSM381195     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.4645     0.7052 0.204 0.000 0.724 0.072 0.000
#> GSM381198     5  0.4446     0.9634 0.000 0.476 0.004 0.000 0.520
#> GSM381200     2  0.3870     0.4612 0.000 0.808 0.024 0.020 0.148
#> GSM381201     3  0.1830     0.6903 0.052 0.000 0.932 0.012 0.004
#> GSM381203     1  0.5534    -0.2291 0.508 0.000 0.424 0.068 0.000
#> GSM381204     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.4152    -0.1441 0.000 0.692 0.012 0.000 0.296
#> GSM381214     5  0.4911     0.9551 0.000 0.476 0.012 0.008 0.504
#> GSM381216     3  0.6459     0.5106 0.180 0.000 0.420 0.400 0.000
#> GSM381225     3  0.3554     0.7217 0.136 0.000 0.828 0.020 0.016
#> GSM381231     4  0.6664     0.7660 0.012 0.000 0.156 0.424 0.408
#> GSM381235     3  0.6344     0.5287 0.160 0.000 0.440 0.400 0.000
#> GSM381237     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381241     5  0.4446     0.9634 0.000 0.476 0.004 0.000 0.520
#> GSM381243     2  0.0162     0.6408 0.000 0.996 0.004 0.000 0.000
#> GSM381245     1  0.1740     0.8266 0.932 0.000 0.000 0.056 0.012
#> GSM381246     2  0.5567    -0.8480 0.000 0.484 0.020 0.032 0.464
#> GSM381251     3  0.1717     0.6901 0.052 0.000 0.936 0.008 0.004
#> GSM381264     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381206     5  0.4446     0.9640 0.000 0.476 0.000 0.004 0.520
#> GSM381217     3  0.6480     0.5070 0.184 0.000 0.416 0.400 0.000
#> GSM381218     5  0.4744     0.9604 0.000 0.476 0.016 0.000 0.508
#> GSM381226     2  0.5276    -0.2293 0.000 0.624 0.024 0.028 0.324
#> GSM381227     2  0.0486     0.6399 0.000 0.988 0.004 0.004 0.004
#> GSM381228     4  0.6656     0.7660 0.012 0.000 0.156 0.440 0.392
#> GSM381236     4  0.6659     0.7656 0.012 0.000 0.156 0.436 0.396
#> GSM381244     4  0.7182    -0.5167 0.248 0.000 0.328 0.404 0.020
#> GSM381272     4  0.6664     0.7660 0.012 0.000 0.156 0.424 0.408
#> GSM381277     1  0.3789     0.7135 0.760 0.000 0.000 0.224 0.016
#> GSM381278     3  0.2694     0.6890 0.040 0.000 0.884 0.076 0.000
#> GSM381197     3  0.7279     0.4046 0.324 0.000 0.360 0.296 0.020
#> GSM381202     1  0.6362     0.1482 0.496 0.000 0.184 0.320 0.000
#> GSM381207     1  0.2304     0.8046 0.892 0.000 0.008 0.100 0.000
#> GSM381208     5  0.5544     0.8274 0.000 0.452 0.008 0.048 0.492
#> GSM381210     1  0.0404     0.8460 0.988 0.000 0.000 0.012 0.000
#> GSM381215     3  0.3569     0.7143 0.068 0.000 0.828 0.104 0.000
#> GSM381219     5  0.5097     0.9531 0.000 0.476 0.016 0.012 0.496
#> GSM381221     2  0.4676    -0.5580 0.000 0.592 0.012 0.004 0.392
#> GSM381223     2  0.3009     0.6174 0.000 0.876 0.016 0.080 0.028
#> GSM381229     3  0.1557     0.6914 0.052 0.000 0.940 0.008 0.000
#> GSM381230     1  0.0000     0.8481 1.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.5117     0.6119 0.652 0.000 0.072 0.276 0.000
#> GSM381234     1  0.0162     0.8472 0.996 0.000 0.000 0.004 0.000
#> GSM381238     4  0.6656     0.7660 0.012 0.000 0.156 0.440 0.392
#> GSM381239     4  0.6659     0.7656 0.012 0.000 0.156 0.436 0.396
#> GSM381242     4  0.6972    -0.5494 0.200 0.000 0.384 0.400 0.016
#> GSM381247     2  0.0162     0.6408 0.000 0.996 0.004 0.000 0.000
#> GSM381248     1  0.1041     0.8403 0.964 0.000 0.000 0.032 0.004
#> GSM381249     1  0.4823     0.6353 0.672 0.000 0.052 0.276 0.000
#> GSM381253     3  0.4736     0.6989 0.216 0.000 0.712 0.072 0.000
#> GSM381255     5  0.4446     0.9633 0.000 0.476 0.004 0.000 0.520
#> GSM381258     3  0.5691     0.5529 0.084 0.000 0.516 0.400 0.000
#> GSM381262     3  0.1197     0.6923 0.048 0.000 0.952 0.000 0.000
#> GSM381266     3  0.1282     0.6896 0.044 0.000 0.952 0.004 0.000
#> GSM381267     2  0.5208    -0.1114 0.000 0.640 0.012 0.044 0.304
#> GSM381269     1  0.5691     0.4065 0.516 0.000 0.084 0.400 0.000
#> GSM381273     3  0.1717     0.6901 0.052 0.000 0.936 0.008 0.004
#> GSM381274     2  0.3093     0.6155 0.000 0.872 0.016 0.080 0.032
#> GSM381276     3  0.7051     0.5365 0.236 0.000 0.428 0.320 0.016

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.1138    0.86476 0.012 0.000 0.960 0.024 0.004 0.000
#> GSM381199     2  0.3789    0.51506 0.000 0.784 0.016 0.004 0.028 0.168
#> GSM381205     6  0.3774    0.94592 0.000 0.328 0.000 0.000 0.008 0.664
#> GSM381211     6  0.4046    0.94305 0.000 0.328 0.004 0.008 0.004 0.656
#> GSM381220     2  0.3713    0.28080 0.000 0.704 0.000 0.004 0.008 0.284
#> GSM381222     1  0.5077   -0.04090 0.468 0.000 0.064 0.000 0.464 0.004
#> GSM381224     5  0.4821   -0.07412 0.468 0.000 0.008 0.000 0.488 0.036
#> GSM381232     4  0.1485    0.98890 0.000 0.000 0.024 0.944 0.004 0.028
#> GSM381240     1  0.2094    0.75139 0.900 0.000 0.000 0.000 0.020 0.080
#> GSM381250     3  0.4006    0.76370 0.084 0.000 0.792 0.000 0.096 0.028
#> GSM381252     6  0.3910    0.94413 0.000 0.328 0.008 0.000 0.004 0.660
#> GSM381254     1  0.0146    0.80193 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM381256     6  0.4438    0.93305 0.000 0.332 0.016 0.004 0.012 0.636
#> GSM381257     1  0.0146    0.80129 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM381259     1  0.0000    0.80301 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381260     5  0.7345    0.65708 0.176 0.000 0.208 0.000 0.420 0.196
#> GSM381261     2  0.3284    0.62797 0.000 0.784 0.000 0.000 0.196 0.020
#> GSM381263     3  0.3951    0.76957 0.076 0.000 0.796 0.000 0.100 0.028
#> GSM381265     1  0.0000    0.80301 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.1082    0.85852 0.040 0.000 0.956 0.000 0.004 0.000
#> GSM381270     2  0.0260    0.67307 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM381271     4  0.1176    0.98989 0.000 0.000 0.024 0.956 0.000 0.020
#> GSM381275     2  0.3512    0.62641 0.000 0.772 0.000 0.000 0.196 0.032
#> GSM381279     2  0.0260    0.67307 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM381195     1  0.0000    0.80301 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.4006    0.76370 0.084 0.000 0.792 0.000 0.096 0.028
#> GSM381198     6  0.3910    0.94525 0.000 0.328 0.004 0.000 0.008 0.660
#> GSM381200     2  0.4318    0.49306 0.000 0.740 0.016 0.004 0.048 0.192
#> GSM381201     3  0.2359    0.85892 0.012 0.000 0.908 0.028 0.012 0.040
#> GSM381203     1  0.5533   -0.17413 0.464 0.000 0.432 0.000 0.092 0.012
#> GSM381204     1  0.0000    0.80301 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000    0.80301 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000    0.80301 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.4132   -0.02919 0.000 0.632 0.004 0.008 0.004 0.352
#> GSM381214     6  0.4046    0.94305 0.000 0.328 0.004 0.008 0.004 0.656
#> GSM381216     5  0.4451    0.65775 0.072 0.000 0.248 0.000 0.680 0.000
#> GSM381225     3  0.2798    0.82533 0.048 0.000 0.876 0.000 0.020 0.056
#> GSM381231     4  0.1485    0.98890 0.000 0.000 0.024 0.944 0.004 0.028
#> GSM381235     5  0.4408    0.63010 0.056 0.000 0.280 0.000 0.664 0.000
#> GSM381237     1  0.0000    0.80301 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     6  0.3941    0.94560 0.000 0.328 0.004 0.004 0.004 0.660
#> GSM381243     2  0.0260    0.67307 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM381245     1  0.3616    0.65125 0.792 0.000 0.000 0.000 0.076 0.132
#> GSM381246     6  0.5493    0.76177 0.000 0.348 0.008 0.004 0.096 0.544
#> GSM381251     3  0.2258    0.85859 0.012 0.000 0.912 0.028 0.008 0.040
#> GSM381264     1  0.0000    0.80301 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381206     6  0.3774    0.94592 0.000 0.328 0.000 0.000 0.008 0.664
#> GSM381217     5  0.4537    0.65029 0.072 0.000 0.264 0.000 0.664 0.000
#> GSM381218     6  0.4151    0.94154 0.000 0.328 0.004 0.008 0.008 0.652
#> GSM381226     2  0.5714   -0.34017 0.000 0.480 0.012 0.004 0.100 0.404
#> GSM381227     2  0.0146    0.67187 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM381228     4  0.0632    0.98985 0.000 0.000 0.024 0.976 0.000 0.000
#> GSM381236     4  0.0922    0.98995 0.000 0.000 0.024 0.968 0.004 0.004
#> GSM381244     5  0.6925    0.68693 0.104 0.000 0.204 0.000 0.480 0.212
#> GSM381272     4  0.1176    0.98989 0.000 0.000 0.024 0.956 0.000 0.020
#> GSM381277     1  0.5955   -0.04654 0.476 0.000 0.004 0.000 0.308 0.212
#> GSM381278     3  0.3790    0.76029 0.012 0.000 0.812 0.020 0.116 0.040
#> GSM381197     5  0.7381    0.64260 0.180 0.000 0.208 0.000 0.412 0.200
#> GSM381202     5  0.6903    0.57741 0.288 0.000 0.116 0.000 0.460 0.136
#> GSM381207     1  0.4596    0.56338 0.728 0.000 0.016 0.000 0.128 0.128
#> GSM381208     6  0.5193    0.81083 0.000 0.300 0.016 0.012 0.052 0.620
#> GSM381210     1  0.0993    0.78987 0.964 0.000 0.000 0.000 0.024 0.012
#> GSM381215     3  0.2487    0.82247 0.032 0.000 0.876 0.000 0.092 0.000
#> GSM381219     6  0.4683    0.92206 0.000 0.328 0.012 0.008 0.024 0.628
#> GSM381221     2  0.4923   -0.46374 0.000 0.504 0.016 0.004 0.024 0.452
#> GSM381223     2  0.3512    0.62641 0.000 0.772 0.000 0.000 0.196 0.032
#> GSM381229     3  0.2187    0.85973 0.012 0.000 0.916 0.028 0.008 0.036
#> GSM381230     1  0.0146    0.80112 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM381233     1  0.5077   -0.04090 0.468 0.000 0.064 0.000 0.464 0.004
#> GSM381234     1  0.0146    0.80193 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM381238     4  0.0922    0.98995 0.000 0.000 0.024 0.968 0.004 0.004
#> GSM381239     4  0.0632    0.98985 0.000 0.000 0.024 0.976 0.000 0.000
#> GSM381242     5  0.6697    0.68595 0.084 0.000 0.216 0.000 0.508 0.192
#> GSM381247     2  0.0260    0.67307 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM381248     1  0.1745    0.76914 0.924 0.000 0.000 0.000 0.020 0.056
#> GSM381249     1  0.4885   -0.00318 0.484 0.000 0.048 0.000 0.464 0.004
#> GSM381253     3  0.4006    0.76370 0.084 0.000 0.792 0.000 0.096 0.028
#> GSM381255     6  0.3668    0.94608 0.000 0.328 0.000 0.004 0.000 0.668
#> GSM381258     5  0.4146    0.61057 0.036 0.000 0.288 0.000 0.676 0.000
#> GSM381262     3  0.0993    0.86433 0.012 0.000 0.964 0.024 0.000 0.000
#> GSM381266     3  0.2074    0.86061 0.012 0.000 0.920 0.028 0.004 0.036
#> GSM381267     2  0.5336    0.15608 0.000 0.592 0.016 0.012 0.056 0.324
#> GSM381269     5  0.4451    0.52384 0.248 0.000 0.072 0.000 0.680 0.000
#> GSM381273     3  0.2258    0.85859 0.012 0.000 0.912 0.028 0.008 0.040
#> GSM381274     2  0.3512    0.62641 0.000 0.772 0.000 0.000 0.196 0.032
#> GSM381276     5  0.7273    0.63062 0.124 0.000 0.264 0.000 0.404 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-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 other(p) k
#> SD:kmeans 86    0.744 2
#> SD:kmeans 83    0.592 3
#> SD:kmeans 82    0.556 4
#> SD:kmeans 71    0.683 5
#> SD:kmeans 74    0.375 6

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


SD:skmeans*

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

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

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

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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.829           0.910       0.962         0.4705 0.548   0.548
#> 3 3 0.940           0.926       0.969         0.4083 0.783   0.604
#> 4 4 0.871           0.886       0.938         0.0913 0.885   0.681
#> 5 5 0.895           0.854       0.921         0.0697 0.920   0.723
#> 6 6 0.846           0.798       0.880         0.0614 0.928   0.690

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
#> GSM381194     1   0.000      0.940 1.000 0.000
#> GSM381199     2   0.000      1.000 0.000 1.000
#> GSM381205     2   0.000      1.000 0.000 1.000
#> GSM381211     2   0.000      1.000 0.000 1.000
#> GSM381220     2   0.000      1.000 0.000 1.000
#> GSM381222     1   0.000      0.940 1.000 0.000
#> GSM381224     1   0.000      0.940 1.000 0.000
#> GSM381232     1   0.973      0.407 0.596 0.404
#> GSM381240     1   0.000      0.940 1.000 0.000
#> GSM381250     1   0.000      0.940 1.000 0.000
#> GSM381252     2   0.000      1.000 0.000 1.000
#> GSM381254     1   0.000      0.940 1.000 0.000
#> GSM381256     2   0.000      1.000 0.000 1.000
#> GSM381257     1   0.000      0.940 1.000 0.000
#> GSM381259     1   0.000      0.940 1.000 0.000
#> GSM381260     1   0.000      0.940 1.000 0.000
#> GSM381261     2   0.000      1.000 0.000 1.000
#> GSM381263     1   0.000      0.940 1.000 0.000
#> GSM381265     1   0.000      0.940 1.000 0.000
#> GSM381268     1   0.000      0.940 1.000 0.000
#> GSM381270     2   0.000      1.000 0.000 1.000
#> GSM381271     1   0.973      0.407 0.596 0.404
#> GSM381275     2   0.000      1.000 0.000 1.000
#> GSM381279     2   0.000      1.000 0.000 1.000
#> GSM381195     1   0.000      0.940 1.000 0.000
#> GSM381196     1   0.000      0.940 1.000 0.000
#> GSM381198     2   0.000      1.000 0.000 1.000
#> GSM381200     2   0.000      1.000 0.000 1.000
#> GSM381201     1   0.000      0.940 1.000 0.000
#> GSM381203     1   0.000      0.940 1.000 0.000
#> GSM381204     1   0.000      0.940 1.000 0.000
#> GSM381209     1   0.000      0.940 1.000 0.000
#> GSM381212     1   0.000      0.940 1.000 0.000
#> GSM381213     2   0.000      1.000 0.000 1.000
#> GSM381214     2   0.000      1.000 0.000 1.000
#> GSM381216     1   0.000      0.940 1.000 0.000
#> GSM381225     1   0.000      0.940 1.000 0.000
#> GSM381231     1   0.973      0.407 0.596 0.404
#> GSM381235     1   0.000      0.940 1.000 0.000
#> GSM381237     1   0.000      0.940 1.000 0.000
#> GSM381241     2   0.000      1.000 0.000 1.000
#> GSM381243     2   0.000      1.000 0.000 1.000
#> GSM381245     1   0.000      0.940 1.000 0.000
#> GSM381246     2   0.000      1.000 0.000 1.000
#> GSM381251     1   0.000      0.940 1.000 0.000
#> GSM381264     1   0.000      0.940 1.000 0.000
#> GSM381206     2   0.000      1.000 0.000 1.000
#> GSM381217     1   0.000      0.940 1.000 0.000
#> GSM381218     2   0.000      1.000 0.000 1.000
#> GSM381226     2   0.000      1.000 0.000 1.000
#> GSM381227     2   0.000      1.000 0.000 1.000
#> GSM381228     1   0.973      0.407 0.596 0.404
#> GSM381236     1   0.973      0.407 0.596 0.404
#> GSM381244     1   0.000      0.940 1.000 0.000
#> GSM381272     1   0.973      0.407 0.596 0.404
#> GSM381277     1   0.000      0.940 1.000 0.000
#> GSM381278     1   0.000      0.940 1.000 0.000
#> GSM381197     1   0.000      0.940 1.000 0.000
#> GSM381202     1   0.000      0.940 1.000 0.000
#> GSM381207     1   0.000      0.940 1.000 0.000
#> GSM381208     2   0.000      1.000 0.000 1.000
#> GSM381210     1   0.000      0.940 1.000 0.000
#> GSM381215     1   0.000      0.940 1.000 0.000
#> GSM381219     2   0.000      1.000 0.000 1.000
#> GSM381221     2   0.000      1.000 0.000 1.000
#> GSM381223     2   0.000      1.000 0.000 1.000
#> GSM381229     1   0.000      0.940 1.000 0.000
#> GSM381230     1   0.000      0.940 1.000 0.000
#> GSM381233     1   0.000      0.940 1.000 0.000
#> GSM381234     1   0.000      0.940 1.000 0.000
#> GSM381238     1   0.973      0.407 0.596 0.404
#> GSM381239     1   0.973      0.407 0.596 0.404
#> GSM381242     1   0.000      0.940 1.000 0.000
#> GSM381247     2   0.000      1.000 0.000 1.000
#> GSM381248     1   0.000      0.940 1.000 0.000
#> GSM381249     1   0.000      0.940 1.000 0.000
#> GSM381253     1   0.000      0.940 1.000 0.000
#> GSM381255     2   0.000      1.000 0.000 1.000
#> GSM381258     1   0.000      0.940 1.000 0.000
#> GSM381262     1   0.000      0.940 1.000 0.000
#> GSM381266     1   0.000      0.940 1.000 0.000
#> GSM381267     2   0.000      1.000 0.000 1.000
#> GSM381269     1   0.000      0.940 1.000 0.000
#> GSM381273     1   0.000      0.940 1.000 0.000
#> GSM381274     2   0.000      1.000 0.000 1.000
#> GSM381276     1   0.000      0.940 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
#> GSM381194     3  0.0000      0.904 0.000  0 1.000
#> GSM381199     2  0.0000      1.000 0.000  1 0.000
#> GSM381205     2  0.0000      1.000 0.000  1 0.000
#> GSM381211     2  0.0000      1.000 0.000  1 0.000
#> GSM381220     2  0.0000      1.000 0.000  1 0.000
#> GSM381222     1  0.0000      0.977 1.000  0 0.000
#> GSM381224     1  0.0000      0.977 1.000  0 0.000
#> GSM381232     3  0.0000      0.904 0.000  0 1.000
#> GSM381240     1  0.0000      0.977 1.000  0 0.000
#> GSM381250     3  0.6126      0.420 0.400  0 0.600
#> GSM381252     2  0.0000      1.000 0.000  1 0.000
#> GSM381254     1  0.0000      0.977 1.000  0 0.000
#> GSM381256     2  0.0000      1.000 0.000  1 0.000
#> GSM381257     1  0.0000      0.977 1.000  0 0.000
#> GSM381259     1  0.0000      0.977 1.000  0 0.000
#> GSM381260     1  0.3412      0.844 0.876  0 0.124
#> GSM381261     2  0.0000      1.000 0.000  1 0.000
#> GSM381263     3  0.6126      0.420 0.400  0 0.600
#> GSM381265     1  0.0000      0.977 1.000  0 0.000
#> GSM381268     3  0.1031      0.888 0.024  0 0.976
#> GSM381270     2  0.0000      1.000 0.000  1 0.000
#> GSM381271     3  0.0000      0.904 0.000  0 1.000
#> GSM381275     2  0.0000      1.000 0.000  1 0.000
#> GSM381279     2  0.0000      1.000 0.000  1 0.000
#> GSM381195     1  0.0000      0.977 1.000  0 0.000
#> GSM381196     3  0.6126      0.420 0.400  0 0.600
#> GSM381198     2  0.0000      1.000 0.000  1 0.000
#> GSM381200     2  0.0000      1.000 0.000  1 0.000
#> GSM381201     3  0.0000      0.904 0.000  0 1.000
#> GSM381203     1  0.0000      0.977 1.000  0 0.000
#> GSM381204     1  0.0000      0.977 1.000  0 0.000
#> GSM381209     1  0.0000      0.977 1.000  0 0.000
#> GSM381212     1  0.0000      0.977 1.000  0 0.000
#> GSM381213     2  0.0000      1.000 0.000  1 0.000
#> GSM381214     2  0.0000      1.000 0.000  1 0.000
#> GSM381216     1  0.0000      0.977 1.000  0 0.000
#> GSM381225     3  0.6126      0.420 0.400  0 0.600
#> GSM381231     3  0.0000      0.904 0.000  0 1.000
#> GSM381235     1  0.0000      0.977 1.000  0 0.000
#> GSM381237     1  0.0000      0.977 1.000  0 0.000
#> GSM381241     2  0.0000      1.000 0.000  1 0.000
#> GSM381243     2  0.0000      1.000 0.000  1 0.000
#> GSM381245     1  0.0000      0.977 1.000  0 0.000
#> GSM381246     2  0.0000      1.000 0.000  1 0.000
#> GSM381251     3  0.0000      0.904 0.000  0 1.000
#> GSM381264     1  0.0000      0.977 1.000  0 0.000
#> GSM381206     2  0.0000      1.000 0.000  1 0.000
#> GSM381217     1  0.0000      0.977 1.000  0 0.000
#> GSM381218     2  0.0000      1.000 0.000  1 0.000
#> GSM381226     2  0.0000      1.000 0.000  1 0.000
#> GSM381227     2  0.0000      1.000 0.000  1 0.000
#> GSM381228     3  0.0000      0.904 0.000  0 1.000
#> GSM381236     3  0.0000      0.904 0.000  0 1.000
#> GSM381244     1  0.0000      0.977 1.000  0 0.000
#> GSM381272     3  0.0000      0.904 0.000  0 1.000
#> GSM381277     1  0.0000      0.977 1.000  0 0.000
#> GSM381278     3  0.0000      0.904 0.000  0 1.000
#> GSM381197     1  0.3412      0.844 0.876  0 0.124
#> GSM381202     1  0.0000      0.977 1.000  0 0.000
#> GSM381207     1  0.0000      0.977 1.000  0 0.000
#> GSM381208     2  0.0000      1.000 0.000  1 0.000
#> GSM381210     1  0.0000      0.977 1.000  0 0.000
#> GSM381215     3  0.0000      0.904 0.000  0 1.000
#> GSM381219     2  0.0000      1.000 0.000  1 0.000
#> GSM381221     2  0.0000      1.000 0.000  1 0.000
#> GSM381223     2  0.0000      1.000 0.000  1 0.000
#> GSM381229     3  0.0000      0.904 0.000  0 1.000
#> GSM381230     1  0.0000      0.977 1.000  0 0.000
#> GSM381233     1  0.0000      0.977 1.000  0 0.000
#> GSM381234     1  0.0000      0.977 1.000  0 0.000
#> GSM381238     3  0.0000      0.904 0.000  0 1.000
#> GSM381239     3  0.0000      0.904 0.000  0 1.000
#> GSM381242     1  0.3116      0.864 0.892  0 0.108
#> GSM381247     2  0.0000      1.000 0.000  1 0.000
#> GSM381248     1  0.0000      0.977 1.000  0 0.000
#> GSM381249     1  0.0000      0.977 1.000  0 0.000
#> GSM381253     1  0.5529      0.530 0.704  0 0.296
#> GSM381255     2  0.0000      1.000 0.000  1 0.000
#> GSM381258     3  0.0237      0.902 0.004  0 0.996
#> GSM381262     3  0.0000      0.904 0.000  0 1.000
#> GSM381266     3  0.0000      0.904 0.000  0 1.000
#> GSM381267     2  0.0000      1.000 0.000  1 0.000
#> GSM381269     1  0.0000      0.977 1.000  0 0.000
#> GSM381273     3  0.0000      0.904 0.000  0 1.000
#> GSM381274     2  0.0000      1.000 0.000  1 0.000
#> GSM381276     3  0.6126      0.420 0.400  0 0.600

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.2081      0.807 0.000 0.000 0.916 0.084
#> GSM381199     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381205     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381211     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381220     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381222     1  0.3400      0.795 0.820 0.000 0.180 0.000
#> GSM381224     1  0.1940      0.882 0.924 0.000 0.076 0.000
#> GSM381232     4  0.0469      1.000 0.000 0.000 0.012 0.988
#> GSM381240     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381250     3  0.3172      0.794 0.160 0.000 0.840 0.000
#> GSM381252     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381254     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381256     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381257     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381260     3  0.4500      0.654 0.316 0.000 0.684 0.000
#> GSM381261     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381263     3  0.3172      0.794 0.160 0.000 0.840 0.000
#> GSM381265     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381268     3  0.0469      0.812 0.000 0.000 0.988 0.012
#> GSM381270     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381271     4  0.0469      1.000 0.000 0.000 0.012 0.988
#> GSM381275     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381279     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381195     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381196     3  0.3402      0.792 0.164 0.000 0.832 0.004
#> GSM381198     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381200     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381201     3  0.2081      0.807 0.000 0.000 0.916 0.084
#> GSM381203     3  0.4989      0.332 0.472 0.000 0.528 0.000
#> GSM381204     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381213     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381214     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381216     3  0.4843      0.239 0.396 0.000 0.604 0.000
#> GSM381225     3  0.0657      0.812 0.012 0.000 0.984 0.004
#> GSM381231     4  0.0469      1.000 0.000 0.000 0.012 0.988
#> GSM381235     3  0.1940      0.792 0.076 0.000 0.924 0.000
#> GSM381237     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381243     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381245     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381246     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381251     3  0.2081      0.807 0.000 0.000 0.916 0.084
#> GSM381264     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381206     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381217     1  0.4992      0.201 0.524 0.000 0.476 0.000
#> GSM381218     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381226     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381227     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381228     4  0.0469      1.000 0.000 0.000 0.012 0.988
#> GSM381236     4  0.0469      1.000 0.000 0.000 0.012 0.988
#> GSM381244     1  0.4406      0.622 0.700 0.000 0.300 0.000
#> GSM381272     4  0.0469      1.000 0.000 0.000 0.012 0.988
#> GSM381277     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381278     3  0.1557      0.803 0.000 0.000 0.944 0.056
#> GSM381197     3  0.4543      0.647 0.324 0.000 0.676 0.000
#> GSM381202     1  0.1867      0.873 0.928 0.000 0.072 0.000
#> GSM381207     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381208     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381210     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381215     3  0.0336      0.812 0.000 0.000 0.992 0.008
#> GSM381219     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381221     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381223     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381229     3  0.2081      0.807 0.000 0.000 0.916 0.084
#> GSM381230     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381233     1  0.3486      0.788 0.812 0.000 0.188 0.000
#> GSM381234     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381238     4  0.0469      1.000 0.000 0.000 0.012 0.988
#> GSM381239     4  0.0469      1.000 0.000 0.000 0.012 0.988
#> GSM381242     3  0.3688      0.713 0.208 0.000 0.792 0.000
#> GSM381247     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381248     1  0.0000      0.928 1.000 0.000 0.000 0.000
#> GSM381249     1  0.3074      0.820 0.848 0.000 0.152 0.000
#> GSM381253     3  0.3266      0.791 0.168 0.000 0.832 0.000
#> GSM381255     2  0.0469      0.994 0.000 0.988 0.000 0.012
#> GSM381258     3  0.0000      0.811 0.000 0.000 1.000 0.000
#> GSM381262     3  0.2011      0.808 0.000 0.000 0.920 0.080
#> GSM381266     3  0.2704      0.783 0.000 0.000 0.876 0.124
#> GSM381267     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381269     1  0.3610      0.779 0.800 0.000 0.200 0.000
#> GSM381273     3  0.2704      0.783 0.000 0.000 0.876 0.124
#> GSM381274     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM381276     3  0.4283      0.725 0.256 0.000 0.740 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
#> GSM381194     5  0.0290      0.932 0.000 0.000 0.000 0.008 0.992
#> GSM381199     2  0.1628      0.960 0.000 0.936 0.056 0.000 0.008
#> GSM381205     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381220     2  0.1357      0.962 0.000 0.948 0.048 0.000 0.004
#> GSM381222     3  0.4747      0.221 0.484 0.000 0.500 0.000 0.016
#> GSM381224     1  0.4305     -0.237 0.512 0.000 0.488 0.000 0.000
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381250     5  0.1195      0.917 0.028 0.000 0.012 0.000 0.960
#> GSM381252     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381254     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381256     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381257     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.5082      0.638 0.220 0.000 0.684 0.000 0.096
#> GSM381261     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381263     5  0.1018      0.924 0.016 0.000 0.016 0.000 0.968
#> GSM381265     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381268     5  0.0290      0.931 0.000 0.000 0.008 0.000 0.992
#> GSM381270     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381275     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381279     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381195     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381196     5  0.0912      0.925 0.016 0.000 0.012 0.000 0.972
#> GSM381198     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381200     2  0.1697      0.959 0.000 0.932 0.060 0.000 0.008
#> GSM381201     5  0.0290      0.932 0.000 0.000 0.000 0.008 0.992
#> GSM381203     5  0.4557      0.135 0.476 0.000 0.008 0.000 0.516
#> GSM381204     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.1197      0.959 0.000 0.952 0.048 0.000 0.000
#> GSM381214     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381216     3  0.2304      0.721 0.044 0.000 0.908 0.000 0.048
#> GSM381225     5  0.0404      0.930 0.000 0.000 0.012 0.000 0.988
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381235     3  0.2488      0.689 0.004 0.000 0.872 0.000 0.124
#> GSM381237     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381243     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381245     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381246     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381251     5  0.0290      0.932 0.000 0.000 0.000 0.008 0.992
#> GSM381264     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381217     3  0.3075      0.723 0.092 0.000 0.860 0.000 0.048
#> GSM381218     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381226     2  0.0865      0.964 0.000 0.972 0.024 0.000 0.004
#> GSM381227     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381244     3  0.2450      0.727 0.076 0.000 0.896 0.000 0.028
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381277     1  0.3837      0.365 0.692 0.000 0.308 0.000 0.000
#> GSM381278     5  0.2890      0.767 0.000 0.000 0.160 0.004 0.836
#> GSM381197     3  0.6471      0.462 0.296 0.000 0.488 0.000 0.216
#> GSM381202     3  0.4196      0.502 0.356 0.000 0.640 0.000 0.004
#> GSM381207     1  0.0510      0.924 0.984 0.000 0.016 0.000 0.000
#> GSM381208     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381210     1  0.0703      0.913 0.976 0.000 0.024 0.000 0.000
#> GSM381215     5  0.1197      0.908 0.000 0.000 0.048 0.000 0.952
#> GSM381219     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381221     2  0.0865      0.964 0.000 0.972 0.024 0.000 0.004
#> GSM381223     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381229     5  0.0290      0.932 0.000 0.000 0.000 0.008 0.992
#> GSM381230     1  0.0510      0.922 0.984 0.000 0.016 0.000 0.000
#> GSM381233     3  0.4746      0.230 0.480 0.000 0.504 0.000 0.016
#> GSM381234     1  0.0000      0.935 1.000 0.000 0.000 0.000 0.000
#> GSM381238     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381242     3  0.2260      0.714 0.028 0.000 0.908 0.000 0.064
#> GSM381247     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381248     1  0.0404      0.925 0.988 0.000 0.012 0.000 0.000
#> GSM381249     3  0.4450      0.217 0.488 0.000 0.508 0.000 0.004
#> GSM381253     5  0.1364      0.910 0.036 0.000 0.012 0.000 0.952
#> GSM381255     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> GSM381258     3  0.1965      0.695 0.000 0.000 0.904 0.000 0.096
#> GSM381262     5  0.0324      0.931 0.000 0.000 0.004 0.004 0.992
#> GSM381266     5  0.0451      0.931 0.000 0.000 0.004 0.008 0.988
#> GSM381267     2  0.1484      0.961 0.000 0.944 0.048 0.000 0.008
#> GSM381269     3  0.2172      0.723 0.076 0.000 0.908 0.000 0.016
#> GSM381273     5  0.0290      0.932 0.000 0.000 0.000 0.008 0.992
#> GSM381274     2  0.2193      0.951 0.000 0.900 0.092 0.000 0.008
#> GSM381276     3  0.5867      0.574 0.180 0.000 0.604 0.000 0.216

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.0291     0.9716 0.000 0.000 0.992 0.004 0.004 0.000
#> GSM381199     6  0.3986     0.4518 0.000 0.464 0.000 0.000 0.004 0.532
#> GSM381205     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381220     2  0.3890    -0.0123 0.000 0.596 0.000 0.000 0.004 0.400
#> GSM381222     5  0.3515     0.5397 0.324 0.000 0.000 0.000 0.676 0.000
#> GSM381224     5  0.4209     0.4249 0.396 0.000 0.004 0.000 0.588 0.012
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381240     1  0.0405     0.9210 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM381250     3  0.0653     0.9685 0.004 0.000 0.980 0.000 0.004 0.012
#> GSM381252     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381254     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381256     2  0.0865     0.8203 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM381257     1  0.0146     0.9247 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381259     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381260     5  0.5764     0.6072 0.180 0.000 0.024 0.000 0.592 0.204
#> GSM381261     6  0.2941     0.9159 0.000 0.220 0.000 0.000 0.000 0.780
#> GSM381263     3  0.0964     0.9630 0.004 0.000 0.968 0.000 0.016 0.012
#> GSM381265     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.0146     0.9719 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM381270     6  0.3081     0.9156 0.000 0.220 0.000 0.000 0.004 0.776
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     6  0.3023     0.9116 0.000 0.232 0.000 0.000 0.000 0.768
#> GSM381279     6  0.2941     0.9159 0.000 0.220 0.000 0.000 0.000 0.780
#> GSM381195     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.0653     0.9685 0.004 0.000 0.980 0.000 0.004 0.012
#> GSM381198     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381200     6  0.3950     0.5615 0.000 0.432 0.000 0.000 0.004 0.564
#> GSM381201     3  0.0405     0.9720 0.000 0.000 0.988 0.004 0.000 0.008
#> GSM381203     1  0.4284     0.1494 0.544 0.000 0.440 0.000 0.004 0.012
#> GSM381204     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.3765    -0.0364 0.000 0.596 0.000 0.000 0.000 0.404
#> GSM381214     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381216     5  0.0146     0.7025 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM381225     3  0.1082     0.9509 0.000 0.000 0.956 0.000 0.004 0.040
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381235     5  0.0858     0.6970 0.000 0.000 0.028 0.000 0.968 0.004
#> GSM381237     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381243     6  0.3081     0.9156 0.000 0.220 0.000 0.000 0.004 0.776
#> GSM381245     1  0.0935     0.9018 0.964 0.000 0.004 0.000 0.000 0.032
#> GSM381246     2  0.1814     0.7566 0.000 0.900 0.000 0.000 0.000 0.100
#> GSM381251     3  0.0291     0.9719 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM381264     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381217     5  0.1531     0.7025 0.068 0.000 0.004 0.000 0.928 0.000
#> GSM381218     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381226     2  0.3371     0.4161 0.000 0.708 0.000 0.000 0.000 0.292
#> GSM381227     6  0.2941     0.9159 0.000 0.220 0.000 0.000 0.000 0.780
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     5  0.3643     0.6748 0.024 0.000 0.008 0.000 0.768 0.200
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     1  0.5634     0.1694 0.560 0.000 0.004 0.000 0.236 0.200
#> GSM381278     3  0.3121     0.7665 0.000 0.000 0.804 0.004 0.180 0.012
#> GSM381197     5  0.7454     0.4381 0.224 0.000 0.184 0.000 0.392 0.200
#> GSM381202     5  0.5067     0.5557 0.268 0.000 0.000 0.000 0.612 0.120
#> GSM381207     1  0.1552     0.8798 0.940 0.000 0.004 0.000 0.020 0.036
#> GSM381208     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381210     1  0.0260     0.9218 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM381215     3  0.1010     0.9559 0.000 0.000 0.960 0.000 0.036 0.004
#> GSM381219     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381221     2  0.3221     0.4945 0.000 0.736 0.000 0.000 0.000 0.264
#> GSM381223     6  0.3023     0.9116 0.000 0.232 0.000 0.000 0.000 0.768
#> GSM381229     3  0.0405     0.9714 0.000 0.000 0.988 0.004 0.000 0.008
#> GSM381230     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381233     5  0.3499     0.5451 0.320 0.000 0.000 0.000 0.680 0.000
#> GSM381234     1  0.0000     0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     5  0.3043     0.6731 0.000 0.000 0.008 0.000 0.792 0.200
#> GSM381247     6  0.3081     0.9156 0.000 0.220 0.000 0.000 0.004 0.776
#> GSM381248     1  0.0405     0.9210 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM381249     5  0.3464     0.5541 0.312 0.000 0.000 0.000 0.688 0.000
#> GSM381253     3  0.0862     0.9624 0.016 0.000 0.972 0.000 0.004 0.008
#> GSM381255     2  0.0000     0.8446 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381258     5  0.0146     0.7025 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM381262     3  0.0291     0.9719 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM381266     3  0.0405     0.9714 0.000 0.000 0.988 0.004 0.000 0.008
#> GSM381267     2  0.3636     0.3249 0.000 0.676 0.000 0.000 0.004 0.320
#> GSM381269     5  0.0146     0.7033 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM381273     3  0.0405     0.9714 0.000 0.000 0.988 0.004 0.000 0.008
#> GSM381274     6  0.3101     0.8999 0.000 0.244 0.000 0.000 0.000 0.756
#> GSM381276     5  0.6909     0.5612 0.172 0.000 0.128 0.000 0.496 0.204

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 other(p) k
#> SD:skmeans 78    0.572 2
#> SD:skmeans 81    0.677 3
#> SD:skmeans 83    0.490 4
#> SD:skmeans 79    0.418 5
#> SD:skmeans 76    0.545 6

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


SD:pam**

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

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

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

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

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4528 0.548   0.548
#> 3 3 1.000           1.000       1.000         0.2366 0.893   0.804
#> 4 4 0.823           0.964       0.953         0.2335 0.856   0.672
#> 5 5 0.884           0.918       0.952         0.0764 0.954   0.845
#> 6 6 0.830           0.866       0.922         0.0456 0.982   0.930

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
#> GSM381194     1       0          1  1  0
#> GSM381199     2       0          1  0  1
#> GSM381205     2       0          1  0  1
#> GSM381211     2       0          1  0  1
#> GSM381220     2       0          1  0  1
#> GSM381222     1       0          1  1  0
#> GSM381224     1       0          1  1  0
#> GSM381232     1       0          1  1  0
#> GSM381240     1       0          1  1  0
#> GSM381250     1       0          1  1  0
#> GSM381252     2       0          1  0  1
#> GSM381254     1       0          1  1  0
#> GSM381256     2       0          1  0  1
#> GSM381257     1       0          1  1  0
#> GSM381259     1       0          1  1  0
#> GSM381260     1       0          1  1  0
#> GSM381261     2       0          1  0  1
#> GSM381263     1       0          1  1  0
#> GSM381265     1       0          1  1  0
#> GSM381268     1       0          1  1  0
#> GSM381270     2       0          1  0  1
#> GSM381271     1       0          1  1  0
#> GSM381275     2       0          1  0  1
#> GSM381279     2       0          1  0  1
#> GSM381195     1       0          1  1  0
#> GSM381196     1       0          1  1  0
#> GSM381198     2       0          1  0  1
#> GSM381200     2       0          1  0  1
#> GSM381201     1       0          1  1  0
#> GSM381203     1       0          1  1  0
#> GSM381204     1       0          1  1  0
#> GSM381209     1       0          1  1  0
#> GSM381212     1       0          1  1  0
#> GSM381213     2       0          1  0  1
#> GSM381214     2       0          1  0  1
#> GSM381216     1       0          1  1  0
#> GSM381225     1       0          1  1  0
#> GSM381231     1       0          1  1  0
#> GSM381235     1       0          1  1  0
#> GSM381237     1       0          1  1  0
#> GSM381241     2       0          1  0  1
#> GSM381243     2       0          1  0  1
#> GSM381245     1       0          1  1  0
#> GSM381246     2       0          1  0  1
#> GSM381251     1       0          1  1  0
#> GSM381264     1       0          1  1  0
#> GSM381206     2       0          1  0  1
#> GSM381217     1       0          1  1  0
#> GSM381218     2       0          1  0  1
#> GSM381226     2       0          1  0  1
#> GSM381227     2       0          1  0  1
#> GSM381228     1       0          1  1  0
#> GSM381236     1       0          1  1  0
#> GSM381244     1       0          1  1  0
#> GSM381272     1       0          1  1  0
#> GSM381277     1       0          1  1  0
#> GSM381278     1       0          1  1  0
#> GSM381197     1       0          1  1  0
#> GSM381202     1       0          1  1  0
#> GSM381207     1       0          1  1  0
#> GSM381208     2       0          1  0  1
#> GSM381210     1       0          1  1  0
#> GSM381215     1       0          1  1  0
#> GSM381219     2       0          1  0  1
#> GSM381221     2       0          1  0  1
#> GSM381223     2       0          1  0  1
#> GSM381229     1       0          1  1  0
#> GSM381230     1       0          1  1  0
#> GSM381233     1       0          1  1  0
#> GSM381234     1       0          1  1  0
#> GSM381238     1       0          1  1  0
#> GSM381239     1       0          1  1  0
#> GSM381242     1       0          1  1  0
#> GSM381247     2       0          1  0  1
#> GSM381248     1       0          1  1  0
#> GSM381249     1       0          1  1  0
#> GSM381253     1       0          1  1  0
#> GSM381255     2       0          1  0  1
#> GSM381258     1       0          1  1  0
#> GSM381262     1       0          1  1  0
#> GSM381266     1       0          1  1  0
#> GSM381267     2       0          1  0  1
#> GSM381269     1       0          1  1  0
#> GSM381273     1       0          1  1  0
#> GSM381274     2       0          1  0  1
#> GSM381276     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette p1 p2 p3
#> GSM381194     1       0          1  1  0  0
#> GSM381199     2       0          1  0  1  0
#> GSM381205     2       0          1  0  1  0
#> GSM381211     2       0          1  0  1  0
#> GSM381220     2       0          1  0  1  0
#> GSM381222     1       0          1  1  0  0
#> GSM381224     1       0          1  1  0  0
#> GSM381232     3       0          1  0  0  1
#> GSM381240     1       0          1  1  0  0
#> GSM381250     1       0          1  1  0  0
#> GSM381252     2       0          1  0  1  0
#> GSM381254     1       0          1  1  0  0
#> GSM381256     2       0          1  0  1  0
#> GSM381257     1       0          1  1  0  0
#> GSM381259     1       0          1  1  0  0
#> GSM381260     1       0          1  1  0  0
#> GSM381261     2       0          1  0  1  0
#> GSM381263     1       0          1  1  0  0
#> GSM381265     1       0          1  1  0  0
#> GSM381268     1       0          1  1  0  0
#> GSM381270     2       0          1  0  1  0
#> GSM381271     3       0          1  0  0  1
#> GSM381275     2       0          1  0  1  0
#> GSM381279     2       0          1  0  1  0
#> GSM381195     1       0          1  1  0  0
#> GSM381196     1       0          1  1  0  0
#> GSM381198     2       0          1  0  1  0
#> GSM381200     2       0          1  0  1  0
#> GSM381201     1       0          1  1  0  0
#> GSM381203     1       0          1  1  0  0
#> GSM381204     1       0          1  1  0  0
#> GSM381209     1       0          1  1  0  0
#> GSM381212     1       0          1  1  0  0
#> GSM381213     2       0          1  0  1  0
#> GSM381214     2       0          1  0  1  0
#> GSM381216     1       0          1  1  0  0
#> GSM381225     1       0          1  1  0  0
#> GSM381231     3       0          1  0  0  1
#> GSM381235     1       0          1  1  0  0
#> GSM381237     1       0          1  1  0  0
#> GSM381241     2       0          1  0  1  0
#> GSM381243     2       0          1  0  1  0
#> GSM381245     1       0          1  1  0  0
#> GSM381246     2       0          1  0  1  0
#> GSM381251     1       0          1  1  0  0
#> GSM381264     1       0          1  1  0  0
#> GSM381206     2       0          1  0  1  0
#> GSM381217     1       0          1  1  0  0
#> GSM381218     2       0          1  0  1  0
#> GSM381226     2       0          1  0  1  0
#> GSM381227     2       0          1  0  1  0
#> GSM381228     3       0          1  0  0  1
#> GSM381236     3       0          1  0  0  1
#> GSM381244     1       0          1  1  0  0
#> GSM381272     3       0          1  0  0  1
#> GSM381277     1       0          1  1  0  0
#> GSM381278     1       0          1  1  0  0
#> GSM381197     1       0          1  1  0  0
#> GSM381202     1       0          1  1  0  0
#> GSM381207     1       0          1  1  0  0
#> GSM381208     2       0          1  0  1  0
#> GSM381210     1       0          1  1  0  0
#> GSM381215     1       0          1  1  0  0
#> GSM381219     2       0          1  0  1  0
#> GSM381221     2       0          1  0  1  0
#> GSM381223     2       0          1  0  1  0
#> GSM381229     1       0          1  1  0  0
#> GSM381230     1       0          1  1  0  0
#> GSM381233     1       0          1  1  0  0
#> GSM381234     1       0          1  1  0  0
#> GSM381238     3       0          1  0  0  1
#> GSM381239     3       0          1  0  0  1
#> GSM381242     1       0          1  1  0  0
#> GSM381247     2       0          1  0  1  0
#> GSM381248     1       0          1  1  0  0
#> GSM381249     1       0          1  1  0  0
#> GSM381253     1       0          1  1  0  0
#> GSM381255     2       0          1  0  1  0
#> GSM381258     1       0          1  1  0  0
#> GSM381262     1       0          1  1  0  0
#> GSM381266     1       0          1  1  0  0
#> GSM381267     2       0          1  0  1  0
#> GSM381269     1       0          1  1  0  0
#> GSM381273     1       0          1  1  0  0
#> GSM381274     2       0          1  0  1  0
#> GSM381276     1       0          1  1  0  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381199     2  0.2921      0.908 0.140 0.860 0.000 0.000
#> GSM381205     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381211     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381220     2  0.1716      0.938 0.064 0.936 0.000 0.000
#> GSM381222     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381224     1  0.3942      0.884 0.764 0.000 0.236 0.000
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381240     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381250     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381252     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381254     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381256     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381257     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381259     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381260     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381261     2  0.2921      0.908 0.140 0.860 0.000 0.000
#> GSM381263     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381265     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381268     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381270     2  0.2921      0.908 0.140 0.860 0.000 0.000
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381275     2  0.2216      0.927 0.092 0.908 0.000 0.000
#> GSM381279     2  0.2921      0.908 0.140 0.860 0.000 0.000
#> GSM381195     1  0.3074      0.965 0.848 0.000 0.152 0.000
#> GSM381196     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381198     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381200     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381201     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381203     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381204     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381209     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381212     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381213     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381214     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381216     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381225     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381235     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381237     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381241     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381243     2  0.2921      0.908 0.140 0.860 0.000 0.000
#> GSM381245     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381246     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381251     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381264     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381206     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381217     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381218     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381226     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381227     2  0.2921      0.908 0.140 0.860 0.000 0.000
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381244     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381277     1  0.3356      0.947 0.824 0.000 0.176 0.000
#> GSM381278     3  0.0188      0.985 0.004 0.000 0.996 0.000
#> GSM381197     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381202     3  0.1389      0.934 0.048 0.000 0.952 0.000
#> GSM381207     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381208     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381210     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381215     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381219     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381221     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381223     2  0.2921      0.908 0.140 0.860 0.000 0.000
#> GSM381229     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381230     1  0.2921      0.973 0.860 0.000 0.140 0.000
#> GSM381233     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381234     1  0.3873      0.895 0.772 0.000 0.228 0.000
#> GSM381238     4  0.0188      0.997 0.004 0.000 0.000 0.996
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381242     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381247     2  0.2921      0.908 0.140 0.860 0.000 0.000
#> GSM381248     3  0.3726      0.660 0.212 0.000 0.788 0.000
#> GSM381249     1  0.3610      0.925 0.800 0.000 0.200 0.000
#> GSM381253     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381255     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381258     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381262     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381266     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381267     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381269     3  0.0188      0.986 0.004 0.000 0.996 0.000
#> GSM381273     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM381274     2  0.0000      0.960 0.000 1.000 0.000 0.000
#> GSM381276     3  0.0000      0.990 0.000 0.000 1.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
#> GSM381194     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381199     5  0.4171      0.661 0.000 0.396 0.000 0.000 0.604
#> GSM381205     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381220     5  0.3949      0.778 0.000 0.332 0.000 0.000 0.668
#> GSM381222     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381224     1  0.3395      0.704 0.764 0.000 0.236 0.000 0.000
#> GSM381232     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381252     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381254     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381256     2  0.0162      0.935 0.000 0.996 0.000 0.000 0.004
#> GSM381257     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381259     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381261     5  0.0162      0.644 0.000 0.004 0.000 0.000 0.996
#> GSM381263     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381265     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381270     5  0.3336      0.888 0.000 0.228 0.000 0.000 0.772
#> GSM381271     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381275     2  0.4015      0.502 0.000 0.652 0.000 0.000 0.348
#> GSM381279     5  0.3210      0.895 0.000 0.212 0.000 0.000 0.788
#> GSM381195     1  0.0404      0.910 0.988 0.000 0.012 0.000 0.000
#> GSM381196     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381198     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381200     2  0.0162      0.935 0.000 0.996 0.000 0.000 0.004
#> GSM381201     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381203     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381204     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.0290      0.933 0.000 0.992 0.000 0.000 0.008
#> GSM381214     2  0.0162      0.935 0.000 0.996 0.000 0.000 0.004
#> GSM381216     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381225     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381231     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381235     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381237     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381243     5  0.3242      0.895 0.000 0.216 0.000 0.000 0.784
#> GSM381245     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381246     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381251     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381264     1  0.0162      0.916 0.996 0.000 0.004 0.000 0.000
#> GSM381206     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381217     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381218     2  0.0162      0.935 0.000 0.996 0.000 0.000 0.004
#> GSM381226     2  0.0162      0.935 0.000 0.996 0.000 0.000 0.004
#> GSM381227     5  0.3242      0.895 0.000 0.216 0.000 0.000 0.784
#> GSM381228     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381244     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381272     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381277     1  0.2813      0.780 0.832 0.000 0.168 0.000 0.000
#> GSM381278     3  0.0162      0.984 0.000 0.000 0.996 0.000 0.004
#> GSM381197     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381202     3  0.2561      0.821 0.144 0.000 0.856 0.000 0.000
#> GSM381207     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381208     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381210     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381215     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381219     2  0.0162      0.935 0.000 0.996 0.000 0.000 0.004
#> GSM381221     2  0.0162      0.935 0.000 0.996 0.000 0.000 0.004
#> GSM381223     2  0.4268      0.296 0.000 0.556 0.000 0.000 0.444
#> GSM381229     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381230     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000
#> GSM381233     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381234     1  0.3336      0.716 0.772 0.000 0.228 0.000 0.000
#> GSM381238     4  0.0162      0.996 0.000 0.000 0.000 0.996 0.004
#> GSM381239     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381242     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381247     5  0.3210      0.895 0.000 0.212 0.000 0.000 0.788
#> GSM381248     3  0.3210      0.705 0.212 0.000 0.788 0.000 0.000
#> GSM381249     1  0.3109      0.748 0.800 0.000 0.200 0.000 0.000
#> GSM381253     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381255     2  0.0000      0.935 0.000 1.000 0.000 0.000 0.000
#> GSM381258     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381262     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381266     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381267     2  0.0162      0.935 0.000 0.996 0.000 0.000 0.004
#> GSM381269     3  0.0162      0.984 0.004 0.000 0.996 0.000 0.000
#> GSM381273     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000
#> GSM381274     2  0.3366      0.670 0.000 0.768 0.000 0.000 0.232
#> GSM381276     3  0.0000      0.987 0.000 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381199     6  0.2527      0.661 0.000 0.168 0.000 0.000 0.000 0.832
#> GSM381205     2  0.0260      0.879 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM381211     2  0.0146      0.879 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM381220     6  0.1863      0.762 0.000 0.104 0.000 0.000 0.000 0.896
#> GSM381222     3  0.1610      0.900 0.000 0.000 0.916 0.000 0.084 0.000
#> GSM381224     1  0.3163      0.687 0.764 0.000 0.232 0.000 0.004 0.000
#> GSM381232     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381240     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381252     2  0.0260      0.879 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM381254     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381256     2  0.3431      0.780 0.000 0.756 0.000 0.000 0.016 0.228
#> GSM381257     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.0260      0.926 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM381261     5  0.3636      0.505 0.000 0.004 0.000 0.000 0.676 0.320
#> GSM381263     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381265     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381270     6  0.0000      0.861 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM381271     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     5  0.4707      0.731 0.000 0.204 0.000 0.000 0.676 0.120
#> GSM381279     6  0.0000      0.861 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM381195     1  0.0363      0.912 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM381196     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381198     2  0.0260      0.879 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM381200     2  0.2805      0.841 0.000 0.828 0.000 0.000 0.012 0.160
#> GSM381201     3  0.1141      0.911 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM381203     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381204     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.3345      0.729 0.000 0.776 0.000 0.000 0.204 0.020
#> GSM381214     2  0.0909      0.879 0.000 0.968 0.000 0.000 0.012 0.020
#> GSM381216     3  0.3175      0.770 0.000 0.000 0.744 0.000 0.256 0.000
#> GSM381225     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381231     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381235     3  0.1957      0.884 0.000 0.000 0.888 0.000 0.112 0.000
#> GSM381237     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.2513      0.849 0.000 0.852 0.000 0.000 0.008 0.140
#> GSM381243     6  0.0260      0.858 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM381245     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381246     2  0.0363      0.879 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM381251     3  0.1141      0.911 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM381264     1  0.0146      0.919 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM381206     2  0.0260      0.879 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM381217     3  0.1501      0.904 0.000 0.000 0.924 0.000 0.076 0.000
#> GSM381218     2  0.2805      0.841 0.000 0.828 0.000 0.000 0.012 0.160
#> GSM381226     2  0.1151      0.879 0.000 0.956 0.000 0.000 0.012 0.032
#> GSM381227     6  0.2454      0.665 0.000 0.160 0.000 0.000 0.000 0.840
#> GSM381228     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     3  0.1267      0.909 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM381272     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     1  0.2778      0.762 0.824 0.000 0.168 0.000 0.008 0.000
#> GSM381278     3  0.2006      0.886 0.000 0.000 0.892 0.000 0.104 0.004
#> GSM381197     3  0.1267      0.909 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM381202     3  0.2300      0.833 0.144 0.000 0.856 0.000 0.000 0.000
#> GSM381207     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381208     2  0.0146      0.879 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM381210     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381215     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381219     2  0.2805      0.841 0.000 0.828 0.000 0.000 0.012 0.160
#> GSM381221     2  0.3046      0.822 0.000 0.800 0.000 0.000 0.012 0.188
#> GSM381223     5  0.4614      0.709 0.000 0.108 0.000 0.000 0.684 0.208
#> GSM381229     3  0.1141      0.911 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM381230     1  0.0000      0.921 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381233     3  0.3126      0.775 0.000 0.000 0.752 0.000 0.248 0.000
#> GSM381234     1  0.2996      0.697 0.772 0.000 0.228 0.000 0.000 0.000
#> GSM381238     4  0.0146      0.995 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM381239     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     3  0.3023      0.788 0.000 0.000 0.768 0.000 0.232 0.000
#> GSM381247     6  0.0000      0.861 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM381248     3  0.2883      0.698 0.212 0.000 0.788 0.000 0.000 0.000
#> GSM381249     1  0.3713      0.707 0.744 0.000 0.032 0.000 0.224 0.000
#> GSM381253     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381255     2  0.0260      0.879 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM381258     3  0.3175      0.770 0.000 0.000 0.744 0.000 0.256 0.000
#> GSM381262     3  0.0000      0.927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381266     3  0.0632      0.921 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM381267     2  0.3201      0.803 0.000 0.780 0.000 0.000 0.012 0.208
#> GSM381269     3  0.3314      0.767 0.004 0.000 0.740 0.000 0.256 0.000
#> GSM381273     3  0.1141      0.911 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM381274     5  0.3482      0.597 0.000 0.316 0.000 0.000 0.684 0.000
#> GSM381276     3  0.0260      0.926 0.000 0.000 0.992 0.000 0.008 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

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

test_to_known_factors(res)
#>         n other(p) k
#> SD:pam 86    0.744 2
#> SD:pam 86    0.326 3
#> SD:pam 86    0.394 4
#> SD:pam 85    0.302 5
#> SD:pam 86    0.414 6

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


SD:mclust*

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 86 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.829           0.944       0.974         0.4652 0.548   0.548
#> 3 3 0.941           0.930       0.958         0.2604 0.893   0.804
#> 4 4 0.801           0.863       0.896         0.1989 0.839   0.635
#> 5 5 0.693           0.677       0.782         0.0831 0.874   0.598
#> 6 6 0.796           0.615       0.831         0.0748 0.895   0.587

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
#> GSM381194     1   0.000      0.958 1.000 0.000
#> GSM381199     2   0.000      1.000 0.000 1.000
#> GSM381205     2   0.000      1.000 0.000 1.000
#> GSM381211     2   0.000      1.000 0.000 1.000
#> GSM381220     2   0.000      1.000 0.000 1.000
#> GSM381222     1   0.000      0.958 1.000 0.000
#> GSM381224     1   0.000      0.958 1.000 0.000
#> GSM381232     1   0.861      0.653 0.716 0.284
#> GSM381240     1   0.000      0.958 1.000 0.000
#> GSM381250     1   0.000      0.958 1.000 0.000
#> GSM381252     2   0.000      1.000 0.000 1.000
#> GSM381254     1   0.000      0.958 1.000 0.000
#> GSM381256     2   0.000      1.000 0.000 1.000
#> GSM381257     1   0.000      0.958 1.000 0.000
#> GSM381259     1   0.000      0.958 1.000 0.000
#> GSM381260     1   0.000      0.958 1.000 0.000
#> GSM381261     2   0.000      1.000 0.000 1.000
#> GSM381263     1   0.000      0.958 1.000 0.000
#> GSM381265     1   0.000      0.958 1.000 0.000
#> GSM381268     1   0.000      0.958 1.000 0.000
#> GSM381270     2   0.000      1.000 0.000 1.000
#> GSM381271     1   0.861      0.653 0.716 0.284
#> GSM381275     2   0.000      1.000 0.000 1.000
#> GSM381279     2   0.000      1.000 0.000 1.000
#> GSM381195     1   0.000      0.958 1.000 0.000
#> GSM381196     1   0.000      0.958 1.000 0.000
#> GSM381198     2   0.000      1.000 0.000 1.000
#> GSM381200     2   0.000      1.000 0.000 1.000
#> GSM381201     1   0.000      0.958 1.000 0.000
#> GSM381203     1   0.000      0.958 1.000 0.000
#> GSM381204     1   0.000      0.958 1.000 0.000
#> GSM381209     1   0.000      0.958 1.000 0.000
#> GSM381212     1   0.000      0.958 1.000 0.000
#> GSM381213     2   0.000      1.000 0.000 1.000
#> GSM381214     2   0.000      1.000 0.000 1.000
#> GSM381216     1   0.000      0.958 1.000 0.000
#> GSM381225     1   0.000      0.958 1.000 0.000
#> GSM381231     1   0.861      0.653 0.716 0.284
#> GSM381235     1   0.000      0.958 1.000 0.000
#> GSM381237     1   0.000      0.958 1.000 0.000
#> GSM381241     2   0.000      1.000 0.000 1.000
#> GSM381243     2   0.000      1.000 0.000 1.000
#> GSM381245     1   0.000      0.958 1.000 0.000
#> GSM381246     2   0.000      1.000 0.000 1.000
#> GSM381251     1   0.000      0.958 1.000 0.000
#> GSM381264     1   0.000      0.958 1.000 0.000
#> GSM381206     2   0.000      1.000 0.000 1.000
#> GSM381217     1   0.000      0.958 1.000 0.000
#> GSM381218     2   0.000      1.000 0.000 1.000
#> GSM381226     2   0.000      1.000 0.000 1.000
#> GSM381227     2   0.000      1.000 0.000 1.000
#> GSM381228     1   0.861      0.653 0.716 0.284
#> GSM381236     1   0.861      0.653 0.716 0.284
#> GSM381244     1   0.000      0.958 1.000 0.000
#> GSM381272     1   0.861      0.653 0.716 0.284
#> GSM381277     1   0.000      0.958 1.000 0.000
#> GSM381278     1   0.000      0.958 1.000 0.000
#> GSM381197     1   0.000      0.958 1.000 0.000
#> GSM381202     1   0.000      0.958 1.000 0.000
#> GSM381207     1   0.000      0.958 1.000 0.000
#> GSM381208     2   0.000      1.000 0.000 1.000
#> GSM381210     1   0.000      0.958 1.000 0.000
#> GSM381215     1   0.000      0.958 1.000 0.000
#> GSM381219     2   0.000      1.000 0.000 1.000
#> GSM381221     2   0.000      1.000 0.000 1.000
#> GSM381223     2   0.000      1.000 0.000 1.000
#> GSM381229     1   0.000      0.958 1.000 0.000
#> GSM381230     1   0.000      0.958 1.000 0.000
#> GSM381233     1   0.000      0.958 1.000 0.000
#> GSM381234     1   0.000      0.958 1.000 0.000
#> GSM381238     1   0.861      0.653 0.716 0.284
#> GSM381239     1   0.861      0.653 0.716 0.284
#> GSM381242     1   0.000      0.958 1.000 0.000
#> GSM381247     2   0.000      1.000 0.000 1.000
#> GSM381248     1   0.000      0.958 1.000 0.000
#> GSM381249     1   0.000      0.958 1.000 0.000
#> GSM381253     1   0.000      0.958 1.000 0.000
#> GSM381255     2   0.000      1.000 0.000 1.000
#> GSM381258     1   0.000      0.958 1.000 0.000
#> GSM381262     1   0.000      0.958 1.000 0.000
#> GSM381266     1   0.000      0.958 1.000 0.000
#> GSM381267     2   0.000      1.000 0.000 1.000
#> GSM381269     1   0.000      0.958 1.000 0.000
#> GSM381273     1   0.000      0.958 1.000 0.000
#> GSM381274     2   0.000      1.000 0.000 1.000
#> GSM381276     1   0.000      0.958 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
#> GSM381194     1  0.4842      0.759 0.776 0.000 0.224
#> GSM381199     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381205     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381211     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381220     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381222     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381224     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381232     3  0.0747      1.000 0.000 0.016 0.984
#> GSM381240     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381250     1  0.1643      0.919 0.956 0.000 0.044
#> GSM381252     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381254     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381256     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381257     1  0.0237      0.931 0.996 0.000 0.004
#> GSM381259     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381260     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381261     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381263     1  0.1643      0.919 0.956 0.000 0.044
#> GSM381265     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381268     1  0.1643      0.919 0.956 0.000 0.044
#> GSM381270     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381271     3  0.0747      1.000 0.000 0.016 0.984
#> GSM381275     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381279     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381195     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381196     1  0.1643      0.919 0.956 0.000 0.044
#> GSM381198     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381200     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381201     1  0.1643      0.919 0.956 0.000 0.044
#> GSM381203     1  0.1643      0.919 0.956 0.000 0.044
#> GSM381204     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381209     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381212     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381213     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381214     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381216     1  0.1529      0.921 0.960 0.000 0.040
#> GSM381225     1  0.5905      0.564 0.648 0.000 0.352
#> GSM381231     3  0.0747      1.000 0.000 0.016 0.984
#> GSM381235     1  0.1643      0.919 0.956 0.000 0.044
#> GSM381237     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381241     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381243     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381245     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381246     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381251     1  0.5497      0.666 0.708 0.000 0.292
#> GSM381264     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381206     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381217     1  0.1411      0.922 0.964 0.000 0.036
#> GSM381218     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381226     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381227     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381228     3  0.0747      1.000 0.000 0.016 0.984
#> GSM381236     3  0.0747      1.000 0.000 0.016 0.984
#> GSM381244     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381272     3  0.0747      1.000 0.000 0.016 0.984
#> GSM381277     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381278     1  0.4931      0.749 0.768 0.000 0.232
#> GSM381197     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381202     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381207     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381208     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381210     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381215     1  0.2537      0.898 0.920 0.000 0.080
#> GSM381219     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381221     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381223     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381229     1  0.4931      0.749 0.768 0.000 0.232
#> GSM381230     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381233     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381234     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381238     3  0.0747      1.000 0.000 0.016 0.984
#> GSM381239     3  0.0747      1.000 0.000 0.016 0.984
#> GSM381242     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381247     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381248     1  0.0747      0.930 0.984 0.000 0.016
#> GSM381249     1  0.0237      0.931 0.996 0.000 0.004
#> GSM381253     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381255     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381258     1  0.2356      0.903 0.928 0.000 0.072
#> GSM381262     1  0.4842      0.759 0.776 0.000 0.224
#> GSM381266     1  0.6008      0.520 0.628 0.000 0.372
#> GSM381267     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381269     1  0.0000      0.931 1.000 0.000 0.000
#> GSM381273     1  0.6305      0.224 0.516 0.000 0.484
#> GSM381274     2  0.0000      1.000 0.000 1.000 0.000
#> GSM381276     1  0.2066      0.911 0.940 0.000 0.060

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.3356     0.8865 0.176 0.000 0.824 0.000
#> GSM381199     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381205     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381211     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381220     2  0.0000     0.9873 0.000 1.000 0.000 0.000
#> GSM381222     1  0.2216     0.8424 0.908 0.000 0.092 0.000
#> GSM381224     1  0.2814     0.8154 0.868 0.000 0.132 0.000
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM381240     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381250     3  0.3569     0.8949 0.196 0.000 0.804 0.000
#> GSM381252     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381254     1  0.1474     0.8476 0.948 0.000 0.052 0.000
#> GSM381256     2  0.0336     0.9861 0.000 0.992 0.008 0.000
#> GSM381257     1  0.1716     0.8427 0.936 0.000 0.064 0.000
#> GSM381259     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381260     1  0.4855     0.0693 0.600 0.000 0.400 0.000
#> GSM381261     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381263     3  0.3726     0.8844 0.212 0.000 0.788 0.000
#> GSM381265     1  0.0469     0.8605 0.988 0.000 0.012 0.000
#> GSM381268     3  0.3569     0.8949 0.196 0.000 0.804 0.000
#> GSM381270     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM381275     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381279     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381195     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381196     3  0.3486     0.8924 0.188 0.000 0.812 0.000
#> GSM381198     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381200     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381201     3  0.3569     0.8949 0.196 0.000 0.804 0.000
#> GSM381203     3  0.3356     0.8865 0.176 0.000 0.824 0.000
#> GSM381204     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381213     2  0.0000     0.9873 0.000 1.000 0.000 0.000
#> GSM381214     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381216     3  0.4746     0.3327 0.368 0.000 0.632 0.000
#> GSM381225     3  0.4171     0.8348 0.116 0.000 0.824 0.060
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM381235     3  0.4543     0.4563 0.324 0.000 0.676 0.000
#> GSM381237     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381243     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381245     1  0.2011     0.8334 0.920 0.000 0.080 0.000
#> GSM381246     2  0.0000     0.9873 0.000 1.000 0.000 0.000
#> GSM381251     3  0.3569     0.8949 0.196 0.000 0.804 0.000
#> GSM381264     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381206     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381217     3  0.4585     0.5825 0.332 0.000 0.668 0.000
#> GSM381218     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381226     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381227     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM381244     1  0.1557     0.8454 0.944 0.000 0.056 0.000
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM381277     1  0.1557     0.8454 0.944 0.000 0.056 0.000
#> GSM381278     3  0.2081     0.8107 0.084 0.000 0.916 0.000
#> GSM381197     1  0.3219     0.7306 0.836 0.000 0.164 0.000
#> GSM381202     1  0.4277     0.4957 0.720 0.000 0.280 0.000
#> GSM381207     1  0.4500     0.4387 0.684 0.000 0.316 0.000
#> GSM381208     2  0.0188     0.9868 0.000 0.996 0.004 0.000
#> GSM381210     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381215     3  0.3569     0.8949 0.196 0.000 0.804 0.000
#> GSM381219     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381221     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381223     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381229     3  0.3569     0.8949 0.196 0.000 0.804 0.000
#> GSM381230     1  0.0000     0.8617 1.000 0.000 0.000 0.000
#> GSM381233     1  0.3569     0.7610 0.804 0.000 0.196 0.000
#> GSM381234     1  0.0188     0.8616 0.996 0.000 0.004 0.000
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> GSM381242     1  0.4948    -0.1062 0.560 0.000 0.440 0.000
#> GSM381247     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381248     1  0.4500     0.4673 0.684 0.000 0.316 0.000
#> GSM381249     1  0.2408     0.7930 0.896 0.000 0.104 0.000
#> GSM381253     3  0.4222     0.8186 0.272 0.000 0.728 0.000
#> GSM381255     2  0.0921     0.9809 0.000 0.972 0.028 0.000
#> GSM381258     3  0.3528     0.6945 0.192 0.000 0.808 0.000
#> GSM381262     3  0.3569     0.8949 0.196 0.000 0.804 0.000
#> GSM381266     3  0.3569     0.8949 0.196 0.000 0.804 0.000
#> GSM381267     2  0.0336     0.9869 0.000 0.992 0.008 0.000
#> GSM381269     1  0.3688     0.7557 0.792 0.000 0.208 0.000
#> GSM381273     3  0.4136     0.8881 0.196 0.000 0.788 0.016
#> GSM381274     2  0.0336     0.9877 0.000 0.992 0.008 0.000
#> GSM381276     3  0.3356     0.8865 0.176 0.000 0.824 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
#> GSM381194     3  0.4735     0.5711 0.048 0.000 0.680 0.000 0.272
#> GSM381199     5  0.3857     0.9350 0.000 0.312 0.000 0.000 0.688
#> GSM381205     2  0.0000     0.7948 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0000     0.7948 0.000 1.000 0.000 0.000 0.000
#> GSM381220     2  0.1043     0.7890 0.000 0.960 0.000 0.000 0.040
#> GSM381222     1  0.4392    -0.1792 0.612 0.000 0.380 0.000 0.008
#> GSM381224     1  0.4354    -0.1601 0.624 0.000 0.368 0.000 0.008
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.3752     0.8141 0.708 0.000 0.292 0.000 0.000
#> GSM381250     3  0.1341     0.6302 0.056 0.000 0.944 0.000 0.000
#> GSM381252     2  0.1732     0.7694 0.000 0.920 0.000 0.000 0.080
#> GSM381254     1  0.4030     0.7893 0.648 0.000 0.352 0.000 0.000
#> GSM381256     2  0.4268    -0.2366 0.000 0.556 0.000 0.000 0.444
#> GSM381257     1  0.4138     0.7699 0.616 0.000 0.384 0.000 0.000
#> GSM381259     1  0.3774     0.8138 0.704 0.000 0.296 0.000 0.000
#> GSM381260     3  0.2074     0.5792 0.104 0.000 0.896 0.000 0.000
#> GSM381261     5  0.3684     0.9336 0.000 0.280 0.000 0.000 0.720
#> GSM381263     3  0.1197     0.6344 0.048 0.000 0.952 0.000 0.000
#> GSM381265     1  0.3774     0.8138 0.704 0.000 0.296 0.000 0.000
#> GSM381268     3  0.1670     0.6342 0.052 0.000 0.936 0.000 0.012
#> GSM381270     5  0.3796     0.9398 0.000 0.300 0.000 0.000 0.700
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM381275     5  0.3684     0.9336 0.000 0.280 0.000 0.000 0.720
#> GSM381279     5  0.3796     0.9398 0.000 0.300 0.000 0.000 0.700
#> GSM381195     1  0.3752     0.8141 0.708 0.000 0.292 0.000 0.000
#> GSM381196     3  0.1638     0.6258 0.064 0.000 0.932 0.000 0.004
#> GSM381198     2  0.1197     0.7885 0.000 0.952 0.000 0.000 0.048
#> GSM381200     5  0.4015     0.9065 0.000 0.348 0.000 0.000 0.652
#> GSM381201     3  0.2974     0.6074 0.080 0.000 0.868 0.000 0.052
#> GSM381203     3  0.2179     0.5654 0.112 0.000 0.888 0.000 0.000
#> GSM381204     1  0.3752     0.8141 0.708 0.000 0.292 0.000 0.000
#> GSM381209     1  0.3752     0.8141 0.708 0.000 0.292 0.000 0.000
#> GSM381212     1  0.3752     0.8141 0.708 0.000 0.292 0.000 0.000
#> GSM381213     2  0.2773     0.6994 0.000 0.836 0.000 0.000 0.164
#> GSM381214     2  0.0000     0.7948 0.000 1.000 0.000 0.000 0.000
#> GSM381216     3  0.4025     0.5876 0.292 0.000 0.700 0.000 0.008
#> GSM381225     3  0.5954     0.5798 0.056 0.000 0.652 0.068 0.224
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM381235     3  0.4025     0.5876 0.292 0.000 0.700 0.000 0.008
#> GSM381237     1  0.3752     0.8141 0.708 0.000 0.292 0.000 0.000
#> GSM381241     2  0.1965     0.7559 0.000 0.904 0.000 0.000 0.096
#> GSM381243     5  0.4210     0.7667 0.000 0.412 0.000 0.000 0.588
#> GSM381245     1  0.4126     0.7732 0.620 0.000 0.380 0.000 0.000
#> GSM381246     2  0.4262    -0.3891 0.000 0.560 0.000 0.000 0.440
#> GSM381251     3  0.4800     0.5297 0.052 0.000 0.676 0.000 0.272
#> GSM381264     1  0.3752     0.8141 0.708 0.000 0.292 0.000 0.000
#> GSM381206     2  0.0000     0.7948 0.000 1.000 0.000 0.000 0.000
#> GSM381217     3  0.3796     0.5894 0.300 0.000 0.700 0.000 0.000
#> GSM381218     2  0.0963     0.7929 0.000 0.964 0.000 0.000 0.036
#> GSM381226     5  0.4045     0.8968 0.000 0.356 0.000 0.000 0.644
#> GSM381227     2  0.4305    -0.5723 0.000 0.512 0.000 0.000 0.488
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM381244     1  0.4307     0.6049 0.504 0.000 0.496 0.000 0.000
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM381277     1  0.4161     0.7595 0.608 0.000 0.392 0.000 0.000
#> GSM381278     3  0.6683     0.4937 0.292 0.000 0.436 0.000 0.272
#> GSM381197     3  0.3684     0.0941 0.280 0.000 0.720 0.000 0.000
#> GSM381202     3  0.2852     0.4572 0.172 0.000 0.828 0.000 0.000
#> GSM381207     1  0.4235     0.7258 0.576 0.000 0.424 0.000 0.000
#> GSM381208     2  0.1043     0.7890 0.000 0.960 0.000 0.000 0.040
#> GSM381210     1  0.3752     0.8141 0.708 0.000 0.292 0.000 0.000
#> GSM381215     3  0.1012     0.6518 0.020 0.000 0.968 0.000 0.012
#> GSM381219     2  0.3366     0.5537 0.000 0.768 0.000 0.000 0.232
#> GSM381221     5  0.4030     0.9015 0.000 0.352 0.000 0.000 0.648
#> GSM381223     5  0.3707     0.9344 0.000 0.284 0.000 0.000 0.716
#> GSM381229     3  0.4735     0.5331 0.048 0.000 0.680 0.000 0.272
#> GSM381230     1  0.1043     0.5281 0.960 0.000 0.040 0.000 0.000
#> GSM381233     3  0.4446     0.5029 0.400 0.000 0.592 0.000 0.008
#> GSM381234     1  0.3816     0.8116 0.696 0.000 0.304 0.000 0.000
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM381242     3  0.4067     0.5847 0.300 0.000 0.692 0.000 0.008
#> GSM381247     5  0.3774     0.9399 0.000 0.296 0.000 0.000 0.704
#> GSM381248     1  0.4201     0.7461 0.592 0.000 0.408 0.000 0.000
#> GSM381249     1  0.2462     0.3386 0.880 0.000 0.112 0.000 0.008
#> GSM381253     3  0.1410     0.6260 0.060 0.000 0.940 0.000 0.000
#> GSM381255     2  0.0000     0.7948 0.000 1.000 0.000 0.000 0.000
#> GSM381258     3  0.4130     0.5880 0.292 0.000 0.696 0.000 0.012
#> GSM381262     3  0.4167     0.5786 0.024 0.000 0.724 0.000 0.252
#> GSM381266     3  0.5987     0.5570 0.156 0.000 0.572 0.000 0.272
#> GSM381267     2  0.1410     0.7777 0.000 0.940 0.000 0.000 0.060
#> GSM381269     3  0.4183     0.5727 0.324 0.000 0.668 0.000 0.008
#> GSM381273     3  0.5271     0.5186 0.052 0.000 0.660 0.016 0.272
#> GSM381274     5  0.3684     0.9336 0.000 0.280 0.000 0.000 0.720
#> GSM381276     3  0.1430     0.6330 0.052 0.000 0.944 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
#> GSM381194     6  0.3862     0.4295 0.000 0.000 0.476 0.000 0.000 0.524
#> GSM381199     2  0.1387     0.8284 0.000 0.932 0.000 0.000 0.068 0.000
#> GSM381205     5  0.0000     0.8683 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM381211     5  0.0000     0.8683 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM381220     5  0.1007     0.8532 0.000 0.044 0.000 0.000 0.956 0.000
#> GSM381222     3  0.5521     0.2218 0.132 0.000 0.468 0.000 0.000 0.400
#> GSM381224     3  0.5112     0.2922 0.084 0.000 0.516 0.000 0.000 0.400
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381240     1  0.0000     0.8692 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.0291     0.4968 0.004 0.000 0.992 0.000 0.000 0.004
#> GSM381252     5  0.2941     0.7285 0.000 0.220 0.000 0.000 0.780 0.000
#> GSM381254     1  0.1297     0.8601 0.948 0.000 0.040 0.000 0.000 0.012
#> GSM381256     2  0.3563     0.4660 0.000 0.664 0.000 0.000 0.336 0.000
#> GSM381257     1  0.1910     0.8221 0.892 0.000 0.108 0.000 0.000 0.000
#> GSM381259     1  0.0363     0.8650 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM381260     3  0.4246     0.2279 0.400 0.000 0.580 0.000 0.000 0.020
#> GSM381261     2  0.0865     0.8245 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM381263     3  0.2006     0.4439 0.016 0.000 0.904 0.000 0.000 0.080
#> GSM381265     1  0.1297     0.8601 0.948 0.000 0.040 0.000 0.000 0.012
#> GSM381268     3  0.0146     0.4939 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM381270     2  0.0632     0.8312 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     2  0.0865     0.8245 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM381279     2  0.0632     0.8312 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM381195     1  0.0000     0.8692 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.0146     0.4941 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM381198     5  0.2454     0.7925 0.000 0.160 0.000 0.000 0.840 0.000
#> GSM381200     2  0.1501     0.8268 0.000 0.924 0.000 0.000 0.076 0.000
#> GSM381201     3  0.0146     0.4941 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM381203     3  0.0405     0.4922 0.004 0.000 0.988 0.000 0.000 0.008
#> GSM381204     1  0.0000     0.8692 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.8692 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.8692 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     5  0.3371     0.6775 0.000 0.292 0.000 0.000 0.708 0.000
#> GSM381214     5  0.0146     0.8680 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM381216     3  0.3843     0.3110 0.000 0.000 0.548 0.000 0.000 0.452
#> GSM381225     6  0.3995     0.4243 0.000 0.000 0.480 0.004 0.000 0.516
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381235     6  0.3789    -0.2241 0.000 0.000 0.416 0.000 0.000 0.584
#> GSM381237     1  0.0000     0.8692 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     5  0.3371     0.6038 0.000 0.292 0.000 0.000 0.708 0.000
#> GSM381243     2  0.1610     0.7970 0.000 0.916 0.000 0.000 0.084 0.000
#> GSM381245     1  0.2912     0.6959 0.784 0.000 0.216 0.000 0.000 0.000
#> GSM381246     2  0.3868     0.0875 0.000 0.508 0.000 0.000 0.492 0.000
#> GSM381251     3  0.3620    -0.2005 0.000 0.000 0.648 0.000 0.000 0.352
#> GSM381264     1  0.0000     0.8692 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381206     5  0.0000     0.8683 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM381217     3  0.3823     0.3255 0.000 0.000 0.564 0.000 0.000 0.436
#> GSM381218     5  0.2527     0.7862 0.000 0.168 0.000 0.000 0.832 0.000
#> GSM381226     2  0.1501     0.8268 0.000 0.924 0.000 0.000 0.076 0.000
#> GSM381227     2  0.3857     0.1850 0.000 0.532 0.000 0.000 0.468 0.000
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     1  0.2219     0.7897 0.864 0.000 0.136 0.000 0.000 0.000
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     1  0.1075     0.8571 0.952 0.000 0.048 0.000 0.000 0.000
#> GSM381278     6  0.2597     0.3281 0.000 0.000 0.176 0.000 0.000 0.824
#> GSM381197     1  0.4294     0.1284 0.552 0.000 0.428 0.000 0.000 0.020
#> GSM381202     3  0.4246     0.2279 0.400 0.000 0.580 0.000 0.000 0.020
#> GSM381207     1  0.3860     0.2174 0.528 0.000 0.472 0.000 0.000 0.000
#> GSM381208     5  0.1075     0.8520 0.000 0.048 0.000 0.000 0.952 0.000
#> GSM381210     1  0.0000     0.8692 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381215     3  0.2178     0.3272 0.000 0.000 0.868 0.000 0.000 0.132
#> GSM381219     2  0.3864     0.0427 0.000 0.520 0.000 0.000 0.480 0.000
#> GSM381221     2  0.1501     0.8268 0.000 0.924 0.000 0.000 0.076 0.000
#> GSM381223     2  0.0972     0.8266 0.000 0.964 0.000 0.000 0.008 0.028
#> GSM381229     6  0.3866     0.4247 0.000 0.000 0.484 0.000 0.000 0.516
#> GSM381230     1  0.1387     0.8281 0.932 0.000 0.000 0.000 0.000 0.068
#> GSM381233     3  0.4893     0.3104 0.064 0.000 0.536 0.000 0.000 0.400
#> GSM381234     1  0.1225     0.8613 0.952 0.000 0.036 0.000 0.000 0.012
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     3  0.3789     0.3383 0.000 0.000 0.584 0.000 0.000 0.416
#> GSM381247     2  0.0632     0.8312 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM381248     1  0.4076     0.3569 0.592 0.000 0.396 0.000 0.000 0.012
#> GSM381249     6  0.5997    -0.0748 0.344 0.000 0.240 0.000 0.000 0.416
#> GSM381253     3  0.0260     0.4963 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM381255     5  0.0000     0.8683 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM381258     6  0.3409    -0.0142 0.000 0.000 0.300 0.000 0.000 0.700
#> GSM381262     6  0.3864     0.4275 0.000 0.000 0.480 0.000 0.000 0.520
#> GSM381266     3  0.2996     0.1494 0.000 0.000 0.772 0.000 0.000 0.228
#> GSM381267     5  0.1141     0.8501 0.000 0.052 0.000 0.000 0.948 0.000
#> GSM381269     3  0.4123     0.3324 0.012 0.000 0.568 0.000 0.000 0.420
#> GSM381273     3  0.3103     0.1801 0.000 0.000 0.784 0.008 0.000 0.208
#> GSM381274     2  0.0865     0.8245 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM381276     3  0.0291     0.4953 0.004 0.000 0.992 0.000 0.000 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

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

test_to_known_factors(res)
#>            n other(p) k
#> SD:mclust 86    0.744 2
#> SD:mclust 85    0.356 3
#> SD:mclust 79    0.711 4
#> SD:mclust 77    0.555 5
#> SD:mclust 50    0.687 6

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


SD:NMF**

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

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

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

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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.942       0.978         0.4650 0.540   0.540
#> 3 3 0.866           0.895       0.951         0.4253 0.785   0.607
#> 4 4 0.769           0.685       0.848         0.0739 0.933   0.809
#> 5 5 0.840           0.804       0.898         0.0607 0.905   0.706
#> 6 6 0.781           0.724       0.859         0.0342 0.919   0.709

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM381194     1   0.000     0.9739 1.000 0.000
#> GSM381199     2   0.000     0.9823 0.000 1.000
#> GSM381205     2   0.000     0.9823 0.000 1.000
#> GSM381211     2   0.000     0.9823 0.000 1.000
#> GSM381220     2   0.000     0.9823 0.000 1.000
#> GSM381222     1   0.000     0.9739 1.000 0.000
#> GSM381224     1   0.000     0.9739 1.000 0.000
#> GSM381232     1   0.563     0.8428 0.868 0.132
#> GSM381240     1   0.000     0.9739 1.000 0.000
#> GSM381250     1   0.000     0.9739 1.000 0.000
#> GSM381252     2   0.000     0.9823 0.000 1.000
#> GSM381254     1   0.000     0.9739 1.000 0.000
#> GSM381256     2   0.000     0.9823 0.000 1.000
#> GSM381257     1   0.000     0.9739 1.000 0.000
#> GSM381259     1   0.000     0.9739 1.000 0.000
#> GSM381260     1   0.000     0.9739 1.000 0.000
#> GSM381261     2   0.000     0.9823 0.000 1.000
#> GSM381263     1   0.000     0.9739 1.000 0.000
#> GSM381265     1   0.000     0.9739 1.000 0.000
#> GSM381268     1   0.000     0.9739 1.000 0.000
#> GSM381270     2   0.000     0.9823 0.000 1.000
#> GSM381271     1   0.402     0.9015 0.920 0.080
#> GSM381275     2   0.000     0.9823 0.000 1.000
#> GSM381279     2   0.000     0.9823 0.000 1.000
#> GSM381195     1   0.000     0.9739 1.000 0.000
#> GSM381196     1   0.000     0.9739 1.000 0.000
#> GSM381198     2   0.000     0.9823 0.000 1.000
#> GSM381200     2   0.000     0.9823 0.000 1.000
#> GSM381201     1   0.000     0.9739 1.000 0.000
#> GSM381203     1   0.000     0.9739 1.000 0.000
#> GSM381204     1   0.000     0.9739 1.000 0.000
#> GSM381209     1   0.000     0.9739 1.000 0.000
#> GSM381212     1   0.000     0.9739 1.000 0.000
#> GSM381213     2   0.000     0.9823 0.000 1.000
#> GSM381214     2   0.000     0.9823 0.000 1.000
#> GSM381216     1   0.000     0.9739 1.000 0.000
#> GSM381225     1   0.000     0.9739 1.000 0.000
#> GSM381231     2   1.000    -0.0257 0.488 0.512
#> GSM381235     1   0.000     0.9739 1.000 0.000
#> GSM381237     1   0.000     0.9739 1.000 0.000
#> GSM381241     2   0.000     0.9823 0.000 1.000
#> GSM381243     2   0.000     0.9823 0.000 1.000
#> GSM381245     1   0.000     0.9739 1.000 0.000
#> GSM381246     2   0.000     0.9823 0.000 1.000
#> GSM381251     1   0.000     0.9739 1.000 0.000
#> GSM381264     1   0.000     0.9739 1.000 0.000
#> GSM381206     2   0.000     0.9823 0.000 1.000
#> GSM381217     1   0.000     0.9739 1.000 0.000
#> GSM381218     2   0.000     0.9823 0.000 1.000
#> GSM381226     2   0.000     0.9823 0.000 1.000
#> GSM381227     2   0.000     0.9823 0.000 1.000
#> GSM381228     1   0.996     0.1569 0.536 0.464
#> GSM381236     1   0.358     0.9137 0.932 0.068
#> GSM381244     1   0.000     0.9739 1.000 0.000
#> GSM381272     1   0.278     0.9324 0.952 0.048
#> GSM381277     1   0.000     0.9739 1.000 0.000
#> GSM381278     1   0.000     0.9739 1.000 0.000
#> GSM381197     1   0.000     0.9739 1.000 0.000
#> GSM381202     1   0.000     0.9739 1.000 0.000
#> GSM381207     1   0.000     0.9739 1.000 0.000
#> GSM381208     2   0.000     0.9823 0.000 1.000
#> GSM381210     1   0.000     0.9739 1.000 0.000
#> GSM381215     1   0.000     0.9739 1.000 0.000
#> GSM381219     2   0.000     0.9823 0.000 1.000
#> GSM381221     2   0.000     0.9823 0.000 1.000
#> GSM381223     2   0.000     0.9823 0.000 1.000
#> GSM381229     1   0.000     0.9739 1.000 0.000
#> GSM381230     1   0.000     0.9739 1.000 0.000
#> GSM381233     1   0.000     0.9739 1.000 0.000
#> GSM381234     1   0.000     0.9739 1.000 0.000
#> GSM381238     1   0.961     0.3943 0.616 0.384
#> GSM381239     1   0.767     0.7155 0.776 0.224
#> GSM381242     1   0.000     0.9739 1.000 0.000
#> GSM381247     2   0.000     0.9823 0.000 1.000
#> GSM381248     1   0.000     0.9739 1.000 0.000
#> GSM381249     1   0.000     0.9739 1.000 0.000
#> GSM381253     1   0.000     0.9739 1.000 0.000
#> GSM381255     2   0.000     0.9823 0.000 1.000
#> GSM381258     1   0.000     0.9739 1.000 0.000
#> GSM381262     1   0.000     0.9739 1.000 0.000
#> GSM381266     1   0.000     0.9739 1.000 0.000
#> GSM381267     2   0.000     0.9823 0.000 1.000
#> GSM381269     1   0.000     0.9739 1.000 0.000
#> GSM381273     1   0.000     0.9739 1.000 0.000
#> GSM381274     2   0.000     0.9823 0.000 1.000
#> GSM381276     1   0.000     0.9739 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
#> GSM381194     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381199     2  0.0424     0.9870 0.000 0.992 0.008
#> GSM381205     2  0.0424     0.9859 0.008 0.992 0.000
#> GSM381211     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381220     2  0.0237     0.9894 0.000 0.996 0.004
#> GSM381222     1  0.1289     0.9187 0.968 0.000 0.032
#> GSM381224     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381232     3  0.0592     0.9162 0.000 0.012 0.988
#> GSM381240     1  0.0237     0.9236 0.996 0.000 0.004
#> GSM381250     1  0.3752     0.8388 0.856 0.000 0.144
#> GSM381252     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381254     1  0.0237     0.9237 0.996 0.000 0.004
#> GSM381256     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381257     1  0.0592     0.9231 0.988 0.000 0.012
#> GSM381259     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381260     1  0.3116     0.8702 0.892 0.000 0.108
#> GSM381261     2  0.0237     0.9894 0.000 0.996 0.004
#> GSM381263     3  0.5968     0.4254 0.364 0.000 0.636
#> GSM381265     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381268     3  0.3482     0.8079 0.128 0.000 0.872
#> GSM381270     2  0.0424     0.9871 0.000 0.992 0.008
#> GSM381271     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381275     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381279     2  0.0424     0.9871 0.000 0.992 0.008
#> GSM381195     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381196     1  0.5733     0.5582 0.676 0.000 0.324
#> GSM381198     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381200     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381201     3  0.0747     0.9157 0.016 0.000 0.984
#> GSM381203     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381204     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381209     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381212     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381213     2  0.0237     0.9894 0.000 0.996 0.004
#> GSM381214     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381216     1  0.5138     0.7101 0.748 0.000 0.252
#> GSM381225     3  0.6305     0.0595 0.484 0.000 0.516
#> GSM381231     3  0.0237     0.9203 0.000 0.004 0.996
#> GSM381235     1  0.4750     0.7600 0.784 0.000 0.216
#> GSM381237     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381241     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381243     2  0.1643     0.9547 0.000 0.956 0.044
#> GSM381245     1  0.0592     0.9231 0.988 0.000 0.012
#> GSM381246     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381251     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381264     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381206     2  0.0424     0.9859 0.008 0.992 0.000
#> GSM381217     1  0.2625     0.8908 0.916 0.000 0.084
#> GSM381218     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381226     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381227     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381228     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381236     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381244     1  0.5835     0.5575 0.660 0.000 0.340
#> GSM381272     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381277     1  0.1411     0.9161 0.964 0.000 0.036
#> GSM381278     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381197     1  0.6095     0.3688 0.608 0.000 0.392
#> GSM381202     1  0.0592     0.9231 0.988 0.000 0.012
#> GSM381207     1  0.1643     0.9136 0.956 0.000 0.044
#> GSM381208     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381210     1  0.0237     0.9236 0.996 0.000 0.004
#> GSM381215     3  0.0892     0.9125 0.020 0.000 0.980
#> GSM381219     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381221     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381223     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381229     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381230     1  0.0000     0.9231 1.000 0.000 0.000
#> GSM381233     1  0.3116     0.8695 0.892 0.000 0.108
#> GSM381234     1  0.0237     0.9236 0.996 0.000 0.004
#> GSM381238     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381239     3  0.1163     0.9049 0.000 0.028 0.972
#> GSM381242     1  0.2537     0.8917 0.920 0.000 0.080
#> GSM381247     2  0.4121     0.8103 0.000 0.832 0.168
#> GSM381248     1  0.1411     0.9176 0.964 0.000 0.036
#> GSM381249     1  0.0592     0.9234 0.988 0.000 0.012
#> GSM381253     1  0.2959     0.8797 0.900 0.000 0.100
#> GSM381255     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381258     3  0.0592     0.9178 0.012 0.000 0.988
#> GSM381262     3  0.0237     0.9216 0.004 0.000 0.996
#> GSM381266     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381267     2  0.0237     0.9894 0.000 0.996 0.004
#> GSM381269     1  0.3482     0.8596 0.872 0.000 0.128
#> GSM381273     3  0.0000     0.9231 0.000 0.000 1.000
#> GSM381274     2  0.0000     0.9908 0.000 1.000 0.000
#> GSM381276     3  0.6079     0.3771 0.388 0.000 0.612

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.4999    -0.3374 0.000 0.000 0.508 0.492
#> GSM381199     2  0.0707     0.9670 0.000 0.980 0.020 0.000
#> GSM381205     2  0.0672     0.9690 0.008 0.984 0.008 0.000
#> GSM381211     2  0.0524     0.9693 0.000 0.988 0.004 0.008
#> GSM381220     2  0.0779     0.9673 0.000 0.980 0.004 0.016
#> GSM381222     1  0.3099     0.7472 0.876 0.000 0.104 0.020
#> GSM381224     1  0.2216     0.7605 0.908 0.000 0.092 0.000
#> GSM381232     4  0.0188     0.7204 0.000 0.000 0.004 0.996
#> GSM381240     1  0.1305     0.7760 0.960 0.000 0.036 0.004
#> GSM381250     1  0.7188    -0.2427 0.432 0.000 0.432 0.136
#> GSM381252     2  0.0188     0.9699 0.000 0.996 0.004 0.000
#> GSM381254     1  0.0895     0.7669 0.976 0.000 0.020 0.004
#> GSM381256     2  0.0336     0.9695 0.000 0.992 0.008 0.000
#> GSM381257     1  0.2596     0.7639 0.908 0.000 0.068 0.024
#> GSM381259     1  0.0336     0.7705 0.992 0.000 0.008 0.000
#> GSM381260     1  0.5599     0.4418 0.644 0.000 0.316 0.040
#> GSM381261     2  0.3123     0.8691 0.000 0.844 0.156 0.000
#> GSM381263     3  0.7270     0.4425 0.304 0.000 0.520 0.176
#> GSM381265     1  0.0592     0.7671 0.984 0.000 0.016 0.000
#> GSM381268     4  0.5626     0.4529 0.028 0.000 0.384 0.588
#> GSM381270     2  0.1807     0.9500 0.000 0.940 0.052 0.008
#> GSM381271     4  0.0000     0.7198 0.000 0.000 0.000 1.000
#> GSM381275     2  0.3356     0.8484 0.000 0.824 0.176 0.000
#> GSM381279     2  0.0336     0.9699 0.000 0.992 0.008 0.000
#> GSM381195     1  0.0707     0.7649 0.980 0.000 0.020 0.000
#> GSM381196     3  0.7900     0.3207 0.308 0.000 0.372 0.320
#> GSM381198     2  0.0564     0.9701 0.004 0.988 0.004 0.004
#> GSM381200     2  0.0336     0.9693 0.000 0.992 0.008 0.000
#> GSM381201     4  0.4252     0.6460 0.004 0.000 0.252 0.744
#> GSM381203     1  0.4477     0.4935 0.688 0.000 0.312 0.000
#> GSM381204     1  0.0817     0.7766 0.976 0.000 0.024 0.000
#> GSM381209     1  0.0000     0.7730 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0188     0.7719 0.996 0.000 0.004 0.000
#> GSM381213     2  0.0469     0.9696 0.000 0.988 0.000 0.012
#> GSM381214     2  0.0524     0.9693 0.000 0.988 0.004 0.008
#> GSM381216     3  0.3743     0.5126 0.160 0.000 0.824 0.016
#> GSM381225     3  0.6425     0.1456 0.424 0.000 0.508 0.068
#> GSM381231     4  0.0376     0.7195 0.000 0.004 0.004 0.992
#> GSM381235     3  0.4248     0.5091 0.220 0.000 0.768 0.012
#> GSM381237     1  0.0707     0.7766 0.980 0.000 0.020 0.000
#> GSM381241     2  0.0376     0.9698 0.000 0.992 0.004 0.004
#> GSM381243     2  0.0188     0.9699 0.000 0.996 0.004 0.000
#> GSM381245     1  0.1174     0.7732 0.968 0.000 0.012 0.020
#> GSM381246     2  0.0657     0.9687 0.004 0.984 0.012 0.000
#> GSM381251     4  0.4679     0.5568 0.000 0.000 0.352 0.648
#> GSM381264     1  0.0707     0.7649 0.980 0.000 0.020 0.000
#> GSM381206     2  0.0779     0.9673 0.016 0.980 0.004 0.000
#> GSM381217     1  0.5345     0.2410 0.560 0.000 0.428 0.012
#> GSM381218     2  0.0524     0.9693 0.000 0.988 0.004 0.008
#> GSM381226     2  0.1022     0.9629 0.000 0.968 0.032 0.000
#> GSM381227     2  0.0707     0.9669 0.000 0.980 0.020 0.000
#> GSM381228     4  0.0336     0.7130 0.000 0.008 0.000 0.992
#> GSM381236     4  0.0000     0.7198 0.000 0.000 0.000 1.000
#> GSM381244     1  0.6474     0.0871 0.536 0.000 0.076 0.388
#> GSM381272     4  0.0188     0.7208 0.000 0.000 0.004 0.996
#> GSM381277     1  0.1584     0.7748 0.952 0.000 0.012 0.036
#> GSM381278     3  0.4500     0.0968 0.000 0.000 0.684 0.316
#> GSM381197     1  0.7806    -0.2946 0.408 0.000 0.332 0.260
#> GSM381202     1  0.3958     0.7028 0.816 0.000 0.160 0.024
#> GSM381207     1  0.1510     0.7734 0.956 0.000 0.016 0.028
#> GSM381208     2  0.1545     0.9510 0.000 0.952 0.008 0.040
#> GSM381210     1  0.2198     0.7678 0.920 0.000 0.072 0.008
#> GSM381215     4  0.5931     0.2177 0.036 0.000 0.460 0.504
#> GSM381219     2  0.0000     0.9699 0.000 1.000 0.000 0.000
#> GSM381221     2  0.0188     0.9696 0.000 0.996 0.004 0.000
#> GSM381223     2  0.1557     0.9514 0.000 0.944 0.056 0.000
#> GSM381229     4  0.4776     0.5255 0.000 0.000 0.376 0.624
#> GSM381230     1  0.0921     0.7766 0.972 0.000 0.028 0.000
#> GSM381233     1  0.3925     0.7007 0.808 0.000 0.176 0.016
#> GSM381234     1  0.1042     0.7684 0.972 0.000 0.020 0.008
#> GSM381238     4  0.0188     0.7208 0.000 0.000 0.004 0.996
#> GSM381239     4  0.1109     0.6849 0.000 0.028 0.004 0.968
#> GSM381242     1  0.5933     0.2394 0.552 0.000 0.408 0.040
#> GSM381247     2  0.3448     0.8399 0.000 0.828 0.168 0.004
#> GSM381248     1  0.1624     0.7714 0.952 0.000 0.028 0.020
#> GSM381249     1  0.2737     0.7552 0.888 0.000 0.104 0.008
#> GSM381253     1  0.5990     0.3447 0.608 0.000 0.336 0.056
#> GSM381255     2  0.0524     0.9693 0.000 0.988 0.004 0.008
#> GSM381258     3  0.2843     0.4197 0.020 0.000 0.892 0.088
#> GSM381262     4  0.5236     0.4047 0.008 0.000 0.432 0.560
#> GSM381266     4  0.4632     0.6014 0.004 0.000 0.308 0.688
#> GSM381267     2  0.1489     0.9509 0.000 0.952 0.004 0.044
#> GSM381269     1  0.5488     0.2377 0.532 0.000 0.452 0.016
#> GSM381273     4  0.4103     0.6473 0.000 0.000 0.256 0.744
#> GSM381274     2  0.1389     0.9556 0.000 0.952 0.048 0.000
#> GSM381276     1  0.7168     0.2641 0.556 0.000 0.236 0.208

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.1845      0.833 0.000 0.000 0.928 0.016 0.056
#> GSM381199     2  0.0404      0.955 0.000 0.988 0.000 0.000 0.012
#> GSM381205     2  0.0613      0.954 0.004 0.984 0.000 0.004 0.008
#> GSM381211     2  0.0162      0.956 0.000 0.996 0.000 0.004 0.000
#> GSM381220     2  0.0880      0.944 0.000 0.968 0.000 0.032 0.000
#> GSM381222     1  0.3299      0.767 0.828 0.000 0.004 0.016 0.152
#> GSM381224     1  0.3582      0.691 0.768 0.000 0.000 0.008 0.224
#> GSM381232     4  0.0740      0.982 0.008 0.000 0.008 0.980 0.004
#> GSM381240     1  0.1892      0.809 0.916 0.000 0.000 0.004 0.080
#> GSM381250     3  0.1329      0.841 0.032 0.000 0.956 0.004 0.008
#> GSM381252     2  0.0162      0.956 0.000 0.996 0.000 0.004 0.000
#> GSM381254     1  0.1173      0.803 0.964 0.000 0.004 0.012 0.020
#> GSM381256     2  0.1043      0.937 0.000 0.960 0.040 0.000 0.000
#> GSM381257     1  0.3129      0.805 0.872 0.000 0.032 0.020 0.076
#> GSM381259     1  0.0613      0.814 0.984 0.000 0.004 0.008 0.004
#> GSM381260     1  0.5682      0.415 0.616 0.000 0.072 0.016 0.296
#> GSM381261     2  0.3895      0.613 0.000 0.680 0.000 0.000 0.320
#> GSM381263     3  0.3888      0.699 0.056 0.000 0.796 0.000 0.148
#> GSM381265     1  0.0510      0.812 0.984 0.000 0.000 0.000 0.016
#> GSM381268     3  0.0404      0.843 0.000 0.000 0.988 0.012 0.000
#> GSM381270     2  0.1544      0.926 0.000 0.932 0.000 0.000 0.068
#> GSM381271     4  0.0609      0.991 0.000 0.000 0.020 0.980 0.000
#> GSM381275     2  0.4150      0.487 0.000 0.612 0.000 0.000 0.388
#> GSM381279     2  0.0671      0.954 0.000 0.980 0.000 0.004 0.016
#> GSM381195     1  0.1405      0.799 0.956 0.000 0.008 0.016 0.020
#> GSM381196     3  0.0727      0.845 0.012 0.000 0.980 0.004 0.004
#> GSM381198     2  0.0162      0.956 0.004 0.996 0.000 0.000 0.000
#> GSM381200     2  0.0404      0.955 0.000 0.988 0.000 0.000 0.012
#> GSM381201     3  0.1908      0.822 0.000 0.000 0.908 0.092 0.000
#> GSM381203     3  0.4525      0.329 0.360 0.000 0.624 0.016 0.000
#> GSM381204     1  0.1628      0.818 0.936 0.000 0.000 0.008 0.056
#> GSM381209     1  0.0566      0.819 0.984 0.000 0.000 0.004 0.012
#> GSM381212     1  0.0324      0.818 0.992 0.000 0.000 0.004 0.004
#> GSM381213     2  0.0404      0.956 0.000 0.988 0.000 0.012 0.000
#> GSM381214     2  0.0290      0.956 0.000 0.992 0.000 0.008 0.000
#> GSM381216     5  0.2416      0.715 0.100 0.000 0.000 0.012 0.888
#> GSM381225     3  0.0771      0.841 0.020 0.000 0.976 0.004 0.000
#> GSM381231     4  0.0833      0.991 0.000 0.004 0.016 0.976 0.004
#> GSM381235     5  0.3650      0.722 0.176 0.000 0.028 0.000 0.796
#> GSM381237     1  0.1571      0.816 0.936 0.000 0.000 0.004 0.060
#> GSM381241     2  0.0162      0.956 0.000 0.996 0.000 0.004 0.000
#> GSM381243     2  0.0510      0.955 0.000 0.984 0.000 0.000 0.016
#> GSM381245     1  0.0566      0.813 0.984 0.000 0.000 0.004 0.012
#> GSM381246     2  0.0510      0.954 0.000 0.984 0.000 0.000 0.016
#> GSM381251     3  0.0290      0.843 0.000 0.000 0.992 0.008 0.000
#> GSM381264     1  0.1405      0.799 0.956 0.000 0.008 0.016 0.020
#> GSM381206     2  0.0162      0.956 0.000 0.996 0.000 0.004 0.000
#> GSM381217     1  0.4574      0.246 0.576 0.000 0.012 0.000 0.412
#> GSM381218     2  0.0162      0.956 0.000 0.996 0.000 0.004 0.000
#> GSM381226     2  0.0510      0.954 0.000 0.984 0.000 0.000 0.016
#> GSM381227     2  0.0290      0.955 0.000 0.992 0.000 0.000 0.008
#> GSM381228     4  0.0609      0.991 0.000 0.000 0.020 0.980 0.000
#> GSM381236     4  0.0693      0.988 0.008 0.000 0.012 0.980 0.000
#> GSM381244     1  0.5928      0.575 0.672 0.000 0.048 0.104 0.176
#> GSM381272     4  0.0771      0.990 0.000 0.000 0.020 0.976 0.004
#> GSM381277     1  0.2770      0.795 0.880 0.000 0.000 0.076 0.044
#> GSM381278     3  0.4527      0.515 0.000 0.000 0.596 0.012 0.392
#> GSM381197     3  0.5072      0.697 0.124 0.000 0.752 0.072 0.052
#> GSM381202     1  0.4064      0.616 0.716 0.000 0.004 0.008 0.272
#> GSM381207     1  0.1106      0.816 0.964 0.000 0.000 0.024 0.012
#> GSM381208     2  0.0290      0.955 0.000 0.992 0.008 0.000 0.000
#> GSM381210     1  0.2741      0.783 0.860 0.000 0.004 0.004 0.132
#> GSM381215     3  0.1408      0.838 0.000 0.000 0.948 0.008 0.044
#> GSM381219     2  0.0162      0.956 0.000 0.996 0.000 0.004 0.000
#> GSM381221     2  0.0000      0.956 0.000 1.000 0.000 0.000 0.000
#> GSM381223     2  0.1197      0.940 0.000 0.952 0.000 0.000 0.048
#> GSM381229     3  0.0290      0.843 0.000 0.000 0.992 0.008 0.000
#> GSM381230     1  0.1757      0.819 0.936 0.000 0.004 0.012 0.048
#> GSM381233     1  0.4015      0.633 0.708 0.000 0.004 0.004 0.284
#> GSM381234     1  0.1059      0.806 0.968 0.000 0.004 0.008 0.020
#> GSM381238     4  0.0798      0.990 0.000 0.000 0.016 0.976 0.008
#> GSM381239     4  0.0671      0.989 0.000 0.004 0.016 0.980 0.000
#> GSM381242     5  0.4821      0.116 0.464 0.000 0.000 0.020 0.516
#> GSM381247     2  0.2124      0.903 0.000 0.900 0.004 0.000 0.096
#> GSM381248     1  0.1106      0.811 0.964 0.000 0.000 0.012 0.024
#> GSM381249     1  0.3809      0.648 0.736 0.000 0.000 0.008 0.256
#> GSM381253     3  0.5175      0.178 0.408 0.000 0.548 0.000 0.044
#> GSM381255     2  0.0162      0.956 0.000 0.996 0.000 0.004 0.000
#> GSM381258     5  0.1299      0.620 0.020 0.000 0.008 0.012 0.960
#> GSM381262     3  0.0324      0.842 0.000 0.000 0.992 0.004 0.004
#> GSM381266     3  0.2124      0.820 0.000 0.000 0.900 0.096 0.004
#> GSM381267     2  0.0794      0.946 0.000 0.972 0.028 0.000 0.000
#> GSM381269     5  0.4046      0.620 0.296 0.000 0.000 0.008 0.696
#> GSM381273     3  0.1851      0.823 0.000 0.000 0.912 0.088 0.000
#> GSM381274     2  0.2377      0.868 0.000 0.872 0.000 0.000 0.128
#> GSM381276     1  0.6964      0.209 0.532 0.000 0.048 0.152 0.268

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.1787     0.8342 0.000 0.000 0.920 0.008 0.068 0.004
#> GSM381199     2  0.0146     0.9581 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM381205     2  0.0291     0.9575 0.004 0.992 0.000 0.004 0.000 0.000
#> GSM381211     2  0.0146     0.9578 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381220     2  0.1765     0.9020 0.000 0.904 0.000 0.096 0.000 0.000
#> GSM381222     5  0.3998    -0.1627 0.492 0.000 0.000 0.000 0.504 0.004
#> GSM381224     5  0.2278     0.6117 0.128 0.000 0.000 0.000 0.868 0.004
#> GSM381232     4  0.0260     0.9914 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM381240     5  0.2882     0.5744 0.180 0.000 0.000 0.000 0.812 0.008
#> GSM381250     3  0.1152     0.8430 0.000 0.000 0.952 0.004 0.044 0.000
#> GSM381252     2  0.0000     0.9580 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381254     1  0.2340     0.7186 0.852 0.000 0.000 0.000 0.148 0.000
#> GSM381256     2  0.1970     0.9012 0.008 0.900 0.092 0.000 0.000 0.000
#> GSM381257     1  0.3996     0.1438 0.512 0.000 0.004 0.000 0.484 0.000
#> GSM381259     1  0.3309     0.6829 0.720 0.000 0.000 0.000 0.280 0.000
#> GSM381260     5  0.0837     0.6384 0.000 0.000 0.020 0.004 0.972 0.004
#> GSM381261     2  0.2446     0.8820 0.000 0.864 0.000 0.000 0.012 0.124
#> GSM381263     3  0.3668     0.4688 0.000 0.000 0.668 0.000 0.328 0.004
#> GSM381265     1  0.3409     0.6785 0.700 0.000 0.000 0.000 0.300 0.000
#> GSM381268     3  0.0000     0.8352 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381270     2  0.0713     0.9538 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM381271     4  0.0000     0.9956 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     2  0.2664     0.8667 0.000 0.848 0.000 0.000 0.016 0.136
#> GSM381279     2  0.1049     0.9473 0.000 0.960 0.000 0.032 0.000 0.008
#> GSM381195     1  0.2730     0.7152 0.808 0.000 0.000 0.000 0.192 0.000
#> GSM381196     3  0.1082     0.8432 0.000 0.000 0.956 0.000 0.040 0.004
#> GSM381198     2  0.0000     0.9580 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381200     2  0.0260     0.9573 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM381201     3  0.4613     0.7280 0.076 0.000 0.764 0.008 0.096 0.056
#> GSM381203     3  0.3991     0.6008 0.088 0.000 0.756 0.000 0.156 0.000
#> GSM381204     5  0.3620     0.2590 0.352 0.000 0.000 0.000 0.648 0.000
#> GSM381209     5  0.3371     0.4223 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM381212     1  0.3851     0.3609 0.540 0.000 0.000 0.000 0.460 0.000
#> GSM381213     2  0.0458     0.9564 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM381214     2  0.0146     0.9578 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381216     5  0.3302     0.4852 0.000 0.000 0.004 0.004 0.760 0.232
#> GSM381225     3  0.1327     0.8278 0.000 0.000 0.936 0.000 0.064 0.000
#> GSM381231     4  0.0146     0.9953 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM381235     6  0.4382     0.2570 0.012 0.000 0.020 0.000 0.332 0.636
#> GSM381237     5  0.3672     0.2065 0.368 0.000 0.000 0.000 0.632 0.000
#> GSM381241     2  0.0146     0.9578 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381243     2  0.1700     0.9321 0.000 0.928 0.000 0.024 0.000 0.048
#> GSM381245     5  0.3871     0.3524 0.308 0.000 0.000 0.000 0.676 0.016
#> GSM381246     2  0.0363     0.9572 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381251     3  0.0837     0.8414 0.004 0.000 0.972 0.000 0.020 0.004
#> GSM381264     1  0.2219     0.7084 0.864 0.000 0.000 0.000 0.136 0.000
#> GSM381206     2  0.0000     0.9580 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381217     5  0.3748     0.6086 0.092 0.000 0.004 0.000 0.792 0.112
#> GSM381218     2  0.0146     0.9578 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381226     2  0.0260     0.9573 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM381227     2  0.0363     0.9570 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381228     4  0.0000     0.9956 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000     0.9956 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     5  0.3935     0.5356 0.080 0.000 0.020 0.016 0.812 0.072
#> GSM381272     4  0.0146     0.9953 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM381277     5  0.4319     0.5210 0.052 0.000 0.000 0.148 0.760 0.040
#> GSM381278     6  0.3339     0.4066 0.008 0.000 0.188 0.004 0.008 0.792
#> GSM381197     5  0.4983     0.3769 0.076 0.000 0.152 0.000 0.712 0.060
#> GSM381202     5  0.1332     0.6434 0.028 0.000 0.008 0.000 0.952 0.012
#> GSM381207     5  0.5386    -0.1060 0.388 0.000 0.000 0.116 0.496 0.000
#> GSM381208     2  0.2420     0.8802 0.076 0.884 0.000 0.000 0.000 0.040
#> GSM381210     5  0.3515     0.4204 0.324 0.000 0.000 0.000 0.676 0.000
#> GSM381215     3  0.2937     0.7870 0.100 0.000 0.852 0.000 0.044 0.004
#> GSM381219     2  0.0000     0.9580 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381221     2  0.0146     0.9578 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381223     2  0.1610     0.9232 0.000 0.916 0.000 0.000 0.000 0.084
#> GSM381229     3  0.0260     0.8333 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM381230     1  0.2772     0.7206 0.816 0.000 0.000 0.000 0.180 0.004
#> GSM381233     1  0.5552     0.1876 0.460 0.000 0.000 0.000 0.404 0.136
#> GSM381234     1  0.2883     0.7041 0.788 0.000 0.000 0.000 0.212 0.000
#> GSM381238     4  0.0146     0.9953 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM381239     4  0.0000     0.9956 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     5  0.1332     0.6306 0.000 0.000 0.012 0.008 0.952 0.028
#> GSM381247     2  0.2536     0.8852 0.000 0.864 0.020 0.000 0.000 0.116
#> GSM381248     1  0.3758     0.6574 0.764 0.004 0.000 0.000 0.192 0.040
#> GSM381249     5  0.2631     0.5992 0.152 0.000 0.000 0.000 0.840 0.008
#> GSM381253     3  0.4579     0.5021 0.092 0.000 0.696 0.004 0.208 0.000
#> GSM381255     2  0.0291     0.9582 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM381258     5  0.4889     0.0779 0.044 0.000 0.008 0.004 0.592 0.352
#> GSM381262     3  0.0713     0.8332 0.028 0.000 0.972 0.000 0.000 0.000
#> GSM381266     3  0.1989     0.8302 0.016 0.000 0.928 0.012 0.020 0.024
#> GSM381267     2  0.3191     0.8474 0.072 0.852 0.028 0.000 0.000 0.048
#> GSM381269     5  0.2845     0.5774 0.004 0.000 0.000 0.004 0.820 0.172
#> GSM381273     3  0.3961     0.7534 0.068 0.000 0.804 0.000 0.060 0.068
#> GSM381274     2  0.1462     0.9360 0.000 0.936 0.000 0.000 0.008 0.056
#> GSM381276     5  0.2188     0.6252 0.000 0.000 0.020 0.032 0.912 0.036

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 other(p) k
#> SD:NMF 83    0.774 2
#> SD:NMF 82    0.645 3
#> SD:NMF 67    0.387 4
#> SD:NMF 79    0.703 5
#> SD:NMF 70    0.321 6

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


CV:hclust

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 86 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 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-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.419           0.625       0.851         0.4562 0.495   0.495
#> 3 3 0.494           0.632       0.837         0.2395 0.877   0.763
#> 4 4 0.781           0.746       0.883         0.2707 0.754   0.476
#> 5 5 0.865           0.877       0.920         0.0544 0.904   0.685
#> 6 6 0.867           0.826       0.901         0.0140 0.973   0.891

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
#> GSM381194     2  0.9944     0.0975 0.456 0.544
#> GSM381199     2  0.0000     0.7927 0.000 1.000
#> GSM381205     2  0.0000     0.7927 0.000 1.000
#> GSM381211     2  0.0000     0.7927 0.000 1.000
#> GSM381220     2  0.0000     0.7927 0.000 1.000
#> GSM381222     1  0.9635     0.4112 0.612 0.388
#> GSM381224     1  0.6048     0.7343 0.852 0.148
#> GSM381232     2  0.9686     0.3060 0.396 0.604
#> GSM381240     1  0.0000     0.7904 1.000 0.000
#> GSM381250     1  0.9000     0.5512 0.684 0.316
#> GSM381252     2  0.0000     0.7927 0.000 1.000
#> GSM381254     1  0.0000     0.7904 1.000 0.000
#> GSM381256     2  0.0000     0.7927 0.000 1.000
#> GSM381257     1  0.0000     0.7904 1.000 0.000
#> GSM381259     1  0.0000     0.7904 1.000 0.000
#> GSM381260     1  0.7453     0.6886 0.788 0.212
#> GSM381261     2  0.0000     0.7927 0.000 1.000
#> GSM381263     1  0.9248     0.5115 0.660 0.340
#> GSM381265     1  0.0000     0.7904 1.000 0.000
#> GSM381268     2  0.9954     0.0807 0.460 0.540
#> GSM381270     2  0.0000     0.7927 0.000 1.000
#> GSM381271     2  0.9686     0.3060 0.396 0.604
#> GSM381275     2  0.0000     0.7927 0.000 1.000
#> GSM381279     2  0.0000     0.7927 0.000 1.000
#> GSM381195     1  0.0376     0.7897 0.996 0.004
#> GSM381196     1  0.9209     0.5190 0.664 0.336
#> GSM381198     2  0.0000     0.7927 0.000 1.000
#> GSM381200     2  0.0000     0.7927 0.000 1.000
#> GSM381201     1  0.0000     0.7904 1.000 0.000
#> GSM381203     1  0.7299     0.6883 0.796 0.204
#> GSM381204     1  0.0000     0.7904 1.000 0.000
#> GSM381209     1  0.0000     0.7904 1.000 0.000
#> GSM381212     1  0.0000     0.7904 1.000 0.000
#> GSM381213     2  0.0000     0.7927 0.000 1.000
#> GSM381214     2  0.0000     0.7927 0.000 1.000
#> GSM381216     1  0.9909     0.2703 0.556 0.444
#> GSM381225     2  0.9996    -0.0413 0.488 0.512
#> GSM381231     2  0.9686     0.3060 0.396 0.604
#> GSM381235     1  0.9933     0.2482 0.548 0.452
#> GSM381237     1  0.0000     0.7904 1.000 0.000
#> GSM381241     2  0.0000     0.7927 0.000 1.000
#> GSM381243     2  0.0000     0.7927 0.000 1.000
#> GSM381245     1  0.0000     0.7904 1.000 0.000
#> GSM381246     2  0.0000     0.7927 0.000 1.000
#> GSM381251     1  0.0000     0.7904 1.000 0.000
#> GSM381264     1  0.0000     0.7904 1.000 0.000
#> GSM381206     2  0.0000     0.7927 0.000 1.000
#> GSM381217     1  0.9944     0.2353 0.544 0.456
#> GSM381218     2  0.0000     0.7927 0.000 1.000
#> GSM381226     2  0.0000     0.7927 0.000 1.000
#> GSM381227     2  0.0000     0.7927 0.000 1.000
#> GSM381228     2  0.9686     0.3060 0.396 0.604
#> GSM381236     2  0.9686     0.3060 0.396 0.604
#> GSM381244     1  0.0000     0.7904 1.000 0.000
#> GSM381272     2  0.9686     0.3060 0.396 0.604
#> GSM381277     1  0.7219     0.6988 0.800 0.200
#> GSM381278     2  0.9686     0.3060 0.396 0.604
#> GSM381197     1  0.0000     0.7904 1.000 0.000
#> GSM381202     1  0.6343     0.7243 0.840 0.160
#> GSM381207     1  0.0000     0.7904 1.000 0.000
#> GSM381208     1  0.0000     0.7904 1.000 0.000
#> GSM381210     1  0.3431     0.7739 0.936 0.064
#> GSM381215     1  0.9993     0.1315 0.516 0.484
#> GSM381219     2  0.0000     0.7927 0.000 1.000
#> GSM381221     2  0.0000     0.7927 0.000 1.000
#> GSM381223     2  0.0000     0.7927 0.000 1.000
#> GSM381229     1  0.7950     0.6347 0.760 0.240
#> GSM381230     1  0.2423     0.7807 0.960 0.040
#> GSM381233     1  0.9635     0.4112 0.612 0.388
#> GSM381234     1  0.0000     0.7904 1.000 0.000
#> GSM381238     2  0.9686     0.3060 0.396 0.604
#> GSM381239     2  0.9686     0.3060 0.396 0.604
#> GSM381242     1  0.7453     0.6886 0.788 0.212
#> GSM381247     2  0.0000     0.7927 0.000 1.000
#> GSM381248     1  0.1633     0.7836 0.976 0.024
#> GSM381249     1  0.9909     0.2703 0.556 0.444
#> GSM381253     1  0.9000     0.5512 0.684 0.316
#> GSM381255     2  0.0000     0.7927 0.000 1.000
#> GSM381258     1  0.9988     0.1477 0.520 0.480
#> GSM381262     2  0.9944     0.0975 0.456 0.544
#> GSM381266     2  0.9686     0.3060 0.396 0.604
#> GSM381267     1  0.0000     0.7904 1.000 0.000
#> GSM381269     1  0.9909     0.2703 0.556 0.444
#> GSM381273     1  0.0000     0.7904 1.000 0.000
#> GSM381274     2  0.0000     0.7927 0.000 1.000
#> GSM381276     1  0.7219     0.6988 0.800 0.200

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM381194     2  0.8202     0.0942 0.376 0.544 0.080
#> GSM381199     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381205     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381211     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381220     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381222     1  0.7114     0.4346 0.584 0.388 0.028
#> GSM381224     1  0.5173     0.7128 0.816 0.148 0.036
#> GSM381232     2  0.6314     0.4770 0.004 0.604 0.392
#> GSM381240     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381250     1  0.7850     0.5311 0.608 0.316 0.076
#> GSM381252     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381254     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381256     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381257     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381259     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381260     1  0.6633     0.6688 0.728 0.212 0.060
#> GSM381261     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381263     1  0.7981     0.4924 0.584 0.340 0.076
#> GSM381265     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381268     2  0.8157     0.0719 0.384 0.540 0.076
#> GSM381270     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381271     2  0.6314     0.4770 0.004 0.604 0.392
#> GSM381275     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381279     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381195     1  0.0237     0.7222 0.996 0.004 0.000
#> GSM381196     1  0.7961     0.4999 0.588 0.336 0.076
#> GSM381198     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381200     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381201     3  0.0000     0.9542 0.000 0.000 1.000
#> GSM381203     1  0.6887     0.6595 0.720 0.204 0.076
#> GSM381204     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381209     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381212     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381213     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381214     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381216     1  0.8271     0.2508 0.480 0.444 0.076
#> GSM381225     2  0.8288    -0.0300 0.408 0.512 0.080
#> GSM381231     2  0.6314     0.4770 0.004 0.604 0.392
#> GSM381235     1  0.8275     0.2295 0.472 0.452 0.076
#> GSM381237     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381241     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381243     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381245     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381246     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381251     3  0.0000     0.9542 0.000 0.000 1.000
#> GSM381264     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381206     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381217     1  0.8277     0.2167 0.468 0.456 0.076
#> GSM381218     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381226     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381227     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381228     2  0.6314     0.4770 0.004 0.604 0.392
#> GSM381236     2  0.6314     0.4770 0.004 0.604 0.392
#> GSM381244     3  0.0000     0.9542 0.000 0.000 1.000
#> GSM381272     2  0.6314     0.4770 0.004 0.604 0.392
#> GSM381277     1  0.6495     0.6776 0.740 0.200 0.060
#> GSM381278     2  0.8020     0.2943 0.308 0.604 0.088
#> GSM381197     3  0.0000     0.9542 0.000 0.000 1.000
#> GSM381202     1  0.6324     0.6918 0.764 0.160 0.076
#> GSM381207     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381208     3  0.0000     0.9542 0.000 0.000 1.000
#> GSM381210     1  0.2165     0.7250 0.936 0.064 0.000
#> GSM381215     2  0.8268    -0.1568 0.440 0.484 0.076
#> GSM381219     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381221     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381223     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381229     3  0.5244     0.5735 0.004 0.240 0.756
#> GSM381230     1  0.1529     0.7235 0.960 0.040 0.000
#> GSM381233     1  0.7114     0.4346 0.584 0.388 0.028
#> GSM381234     1  0.0000     0.7216 1.000 0.000 0.000
#> GSM381238     2  0.6314     0.4770 0.004 0.604 0.392
#> GSM381239     2  0.6314     0.4770 0.004 0.604 0.392
#> GSM381242     1  0.6633     0.6688 0.728 0.212 0.060
#> GSM381247     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381248     1  0.1031     0.7192 0.976 0.024 0.000
#> GSM381249     1  0.8271     0.2508 0.480 0.444 0.076
#> GSM381253     1  0.7850     0.5311 0.608 0.316 0.076
#> GSM381255     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381258     2  0.8334    -0.1646 0.440 0.480 0.080
#> GSM381262     2  0.8202     0.0942 0.376 0.544 0.080
#> GSM381266     2  0.8020     0.2943 0.308 0.604 0.088
#> GSM381267     3  0.0000     0.9542 0.000 0.000 1.000
#> GSM381269     1  0.8271     0.2508 0.480 0.444 0.076
#> GSM381273     3  0.0000     0.9542 0.000 0.000 1.000
#> GSM381274     2  0.0000     0.8000 0.000 1.000 0.000
#> GSM381276     1  0.6495     0.6776 0.740 0.200 0.060

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1 p2    p3    p4
#> GSM381194     3  0.2081     0.7023 0.084  0 0.916 0.000
#> GSM381199     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381205     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381211     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381220     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381222     3  0.4925     0.3391 0.428  0 0.572 0.000
#> GSM381224     1  0.4522     0.4301 0.680  0 0.320 0.000
#> GSM381232     3  0.4382     0.4516 0.000  0 0.704 0.296
#> GSM381240     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381250     3  0.4543     0.5159 0.324  0 0.676 0.000
#> GSM381252     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381254     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381256     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381257     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381259     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381260     1  0.5000    -0.0295 0.504  0 0.496 0.000
#> GSM381261     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381263     3  0.4406     0.5547 0.300  0 0.700 0.000
#> GSM381265     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381268     3  0.2469     0.7032 0.108  0 0.892 0.000
#> GSM381270     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381271     3  0.4382     0.4516 0.000  0 0.704 0.296
#> GSM381275     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381279     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381195     1  0.0188     0.8258 0.996  0 0.004 0.000
#> GSM381196     3  0.4522     0.5349 0.320  0 0.680 0.000
#> GSM381198     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381200     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381201     4  0.0336     0.9564 0.000  0 0.008 0.992
#> GSM381203     3  0.4972     0.1953 0.456  0 0.544 0.000
#> GSM381204     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381209     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381212     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381213     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381214     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381216     3  0.3873     0.6544 0.228  0 0.772 0.000
#> GSM381225     3  0.2589     0.7000 0.116  0 0.884 0.000
#> GSM381231     3  0.4382     0.4516 0.000  0 0.704 0.296
#> GSM381235     3  0.3801     0.6613 0.220  0 0.780 0.000
#> GSM381237     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381241     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381243     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381245     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381246     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381251     4  0.0336     0.9564 0.000  0 0.008 0.992
#> GSM381264     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381206     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381217     3  0.3726     0.6662 0.212  0 0.788 0.000
#> GSM381218     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381226     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381227     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381228     3  0.4382     0.4516 0.000  0 0.704 0.296
#> GSM381236     3  0.4382     0.4516 0.000  0 0.704 0.296
#> GSM381244     4  0.0000     0.9570 0.000  0 0.000 1.000
#> GSM381272     3  0.4382     0.4516 0.000  0 0.704 0.296
#> GSM381277     1  0.4996     0.0137 0.516  0 0.484 0.000
#> GSM381278     3  0.0336     0.6844 0.008  0 0.992 0.000
#> GSM381197     4  0.0000     0.9570 0.000  0 0.000 1.000
#> GSM381202     1  0.4996    -0.0525 0.516  0 0.484 0.000
#> GSM381207     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381208     4  0.0000     0.9570 0.000  0 0.000 1.000
#> GSM381210     1  0.1716     0.7804 0.936  0 0.064 0.000
#> GSM381215     3  0.3219     0.6884 0.164  0 0.836 0.000
#> GSM381219     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381221     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381223     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381229     4  0.4072     0.6449 0.000  0 0.252 0.748
#> GSM381230     1  0.1302     0.7976 0.956  0 0.044 0.000
#> GSM381233     3  0.4925     0.3391 0.428  0 0.572 0.000
#> GSM381234     1  0.0000     0.8283 1.000  0 0.000 0.000
#> GSM381238     3  0.4382     0.4516 0.000  0 0.704 0.296
#> GSM381239     3  0.4382     0.4516 0.000  0 0.704 0.296
#> GSM381242     1  0.5000    -0.0295 0.504  0 0.496 0.000
#> GSM381247     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381248     1  0.1022     0.8059 0.968  0 0.032 0.000
#> GSM381249     3  0.3873     0.6544 0.228  0 0.772 0.000
#> GSM381253     3  0.4543     0.5159 0.324  0 0.676 0.000
#> GSM381255     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381258     3  0.3024     0.6914 0.148  0 0.852 0.000
#> GSM381262     3  0.2081     0.7023 0.084  0 0.916 0.000
#> GSM381266     3  0.0336     0.6844 0.008  0 0.992 0.000
#> GSM381267     4  0.0000     0.9570 0.000  0 0.000 1.000
#> GSM381269     3  0.3873     0.6544 0.228  0 0.772 0.000
#> GSM381273     4  0.0336     0.9564 0.000  0 0.008 0.992
#> GSM381274     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381276     1  0.4996     0.0137 0.516  0 0.484 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
#> GSM381194     3  0.0609      0.740 0.020  0 0.980 0.000 0.000
#> GSM381199     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381205     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381211     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381220     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381222     3  0.4126      0.585 0.380  0 0.620 0.000 0.000
#> GSM381224     1  0.3999      0.183 0.656  0 0.344 0.000 0.000
#> GSM381232     4  0.0162      1.000 0.000  0 0.004 0.996 0.000
#> GSM381240     1  0.0290      0.952 0.992  0 0.008 0.000 0.000
#> GSM381250     3  0.3561      0.737 0.260  0 0.740 0.000 0.000
#> GSM381252     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381254     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381256     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381257     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381260     3  0.4302      0.435 0.480  0 0.520 0.000 0.000
#> GSM381261     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381263     3  0.3395      0.752 0.236  0 0.764 0.000 0.000
#> GSM381265     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381268     3  0.1121      0.756 0.044  0 0.956 0.000 0.000
#> GSM381270     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381271     4  0.0162      1.000 0.000  0 0.004 0.996 0.000
#> GSM381275     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381279     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381195     1  0.0404      0.948 0.988  0 0.012 0.000 0.000
#> GSM381196     3  0.3534      0.746 0.256  0 0.744 0.000 0.000
#> GSM381198     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381200     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381201     5  0.0404      0.955 0.000  0 0.000 0.012 0.988
#> GSM381203     3  0.4161      0.604 0.392  0 0.608 0.000 0.000
#> GSM381204     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381213     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381214     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381216     3  0.3535      0.779 0.164  0 0.808 0.028 0.000
#> GSM381225     3  0.1270      0.761 0.052  0 0.948 0.000 0.000
#> GSM381231     4  0.0162      1.000 0.000  0 0.004 0.996 0.000
#> GSM381235     3  0.2690      0.785 0.156  0 0.844 0.000 0.000
#> GSM381237     1  0.0290      0.952 0.992  0 0.008 0.000 0.000
#> GSM381241     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381243     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381245     1  0.0404      0.949 0.988  0 0.012 0.000 0.000
#> GSM381246     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381251     5  0.0404      0.955 0.000  0 0.000 0.012 0.988
#> GSM381264     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381206     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381217     3  0.2763      0.786 0.148  0 0.848 0.004 0.000
#> GSM381218     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381226     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381227     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381228     4  0.0162      1.000 0.000  0 0.004 0.996 0.000
#> GSM381236     4  0.0162      1.000 0.000  0 0.004 0.996 0.000
#> GSM381244     5  0.0000      0.956 0.000  0 0.000 0.000 1.000
#> GSM381272     4  0.0162      1.000 0.000  0 0.004 0.996 0.000
#> GSM381277     3  0.4306      0.409 0.492  0 0.508 0.000 0.000
#> GSM381278     3  0.1410      0.694 0.000  0 0.940 0.060 0.000
#> GSM381197     5  0.0000      0.956 0.000  0 0.000 0.000 1.000
#> GSM381202     3  0.4965      0.497 0.452  0 0.520 0.028 0.000
#> GSM381207     1  0.0404      0.949 0.988  0 0.012 0.000 0.000
#> GSM381208     5  0.0000      0.956 0.000  0 0.000 0.000 1.000
#> GSM381210     1  0.1792      0.868 0.916  0 0.084 0.000 0.000
#> GSM381215     3  0.2707      0.781 0.100  0 0.876 0.024 0.000
#> GSM381219     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381221     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381223     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381229     5  0.3835      0.704 0.000  0 0.244 0.012 0.744
#> GSM381230     1  0.1121      0.916 0.956  0 0.044 0.000 0.000
#> GSM381233     3  0.4126      0.585 0.380  0 0.620 0.000 0.000
#> GSM381234     1  0.0000      0.955 1.000  0 0.000 0.000 0.000
#> GSM381238     4  0.0162      1.000 0.000  0 0.004 0.996 0.000
#> GSM381239     4  0.0162      1.000 0.000  0 0.004 0.996 0.000
#> GSM381242     3  0.4302      0.435 0.480  0 0.520 0.000 0.000
#> GSM381247     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381248     1  0.0963      0.924 0.964  0 0.036 0.000 0.000
#> GSM381249     3  0.3535      0.779 0.164  0 0.808 0.028 0.000
#> GSM381253     3  0.3561      0.737 0.260  0 0.740 0.000 0.000
#> GSM381255     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381258     3  0.2570      0.779 0.084  0 0.888 0.028 0.000
#> GSM381262     3  0.0609      0.740 0.020  0 0.980 0.000 0.000
#> GSM381266     3  0.1410      0.694 0.000  0 0.940 0.060 0.000
#> GSM381267     5  0.0000      0.956 0.000  0 0.000 0.000 1.000
#> GSM381269     3  0.3535      0.779 0.164  0 0.808 0.028 0.000
#> GSM381273     5  0.0404      0.955 0.000  0 0.000 0.012 0.988
#> GSM381274     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> GSM381276     3  0.4306      0.409 0.492  0 0.508 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
#> GSM381194     3  0.2744      0.702 0.016  0 0.840 0.000 0.000 0.144
#> GSM381199     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381205     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381220     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381222     3  0.3927      0.531 0.344  0 0.644 0.000 0.000 0.012
#> GSM381224     1  0.3620      0.283 0.648  0 0.352 0.000 0.000 0.000
#> GSM381232     4  0.0000      1.000 0.000  0 0.000 1.000 0.000 0.000
#> GSM381240     1  0.0260      0.885 0.992  0 0.008 0.000 0.000 0.000
#> GSM381250     3  0.3979      0.710 0.256  0 0.708 0.000 0.000 0.036
#> GSM381252     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381254     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381256     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381257     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381260     3  0.4534      0.265 0.472  0 0.496 0.000 0.000 0.032
#> GSM381261     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381263     3  0.4085      0.724 0.232  0 0.716 0.000 0.000 0.052
#> GSM381265     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381268     3  0.3351      0.714 0.040  0 0.800 0.000 0.000 0.160
#> GSM381270     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381271     4  0.0000      1.000 0.000  0 0.000 1.000 0.000 0.000
#> GSM381275     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381279     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381195     1  0.0363      0.881 0.988  0 0.012 0.000 0.000 0.000
#> GSM381196     3  0.4145      0.717 0.252  0 0.700 0.000 0.000 0.048
#> GSM381198     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381200     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381201     6  0.3737      0.562 0.000  0 0.000 0.000 0.392 0.608
#> GSM381203     3  0.3965      0.557 0.388  0 0.604 0.000 0.000 0.008
#> GSM381204     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381213     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381214     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381216     3  0.3393      0.748 0.124  0 0.824 0.028 0.000 0.024
#> GSM381225     3  0.2629      0.731 0.040  0 0.868 0.000 0.000 0.092
#> GSM381231     4  0.0000      1.000 0.000  0 0.000 1.000 0.000 0.000
#> GSM381235     3  0.2494      0.766 0.120  0 0.864 0.000 0.000 0.016
#> GSM381237     1  0.0260      0.885 0.992  0 0.008 0.000 0.000 0.000
#> GSM381241     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381243     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381245     1  0.0363      0.883 0.988  0 0.012 0.000 0.000 0.000
#> GSM381246     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381251     6  0.2883      0.778 0.000  0 0.000 0.000 0.212 0.788
#> GSM381264     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381217     3  0.2547      0.766 0.112  0 0.868 0.004 0.000 0.016
#> GSM381218     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381226     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381227     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381228     4  0.0000      1.000 0.000  0 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000      1.000 0.000  0 0.000 1.000 0.000 0.000
#> GSM381244     5  0.0790      0.972 0.000  0 0.000 0.000 0.968 0.032
#> GSM381272     4  0.0000      1.000 0.000  0 0.000 1.000 0.000 0.000
#> GSM381277     1  0.4535     -0.298 0.484  0 0.484 0.000 0.000 0.032
#> GSM381278     3  0.3276      0.646 0.000  0 0.816 0.052 0.000 0.132
#> GSM381197     5  0.0790      0.972 0.000  0 0.000 0.000 0.968 0.032
#> GSM381202     3  0.4588      0.431 0.448  0 0.520 0.028 0.000 0.004
#> GSM381207     1  0.0363      0.883 0.988  0 0.012 0.000 0.000 0.000
#> GSM381208     5  0.0000      0.972 0.000  0 0.000 0.000 1.000 0.000
#> GSM381210     1  0.1663      0.812 0.912  0 0.088 0.000 0.000 0.000
#> GSM381215     3  0.2934      0.746 0.064  0 0.868 0.024 0.000 0.044
#> GSM381219     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381221     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381223     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381229     6  0.1967      0.600 0.000  0 0.084 0.000 0.012 0.904
#> GSM381230     1  0.1075      0.852 0.952  0 0.048 0.000 0.000 0.000
#> GSM381233     3  0.3912      0.534 0.340  0 0.648 0.000 0.000 0.012
#> GSM381234     1  0.0000      0.887 1.000  0 0.000 0.000 0.000 0.000
#> GSM381238     4  0.0000      1.000 0.000  0 0.000 1.000 0.000 0.000
#> GSM381239     4  0.0000      1.000 0.000  0 0.000 1.000 0.000 0.000
#> GSM381242     3  0.4534      0.265 0.472  0 0.496 0.000 0.000 0.032
#> GSM381247     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381248     1  0.1391      0.840 0.944  0 0.016 0.000 0.000 0.040
#> GSM381249     3  0.3393      0.748 0.124  0 0.824 0.028 0.000 0.024
#> GSM381253     3  0.3979      0.710 0.256  0 0.708 0.000 0.000 0.036
#> GSM381255     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381258     3  0.2335      0.735 0.044  0 0.904 0.028 0.000 0.024
#> GSM381262     3  0.2744      0.702 0.016  0 0.840 0.000 0.000 0.144
#> GSM381266     3  0.3276      0.646 0.000  0 0.816 0.052 0.000 0.132
#> GSM381267     5  0.0000      0.972 0.000  0 0.000 0.000 1.000 0.000
#> GSM381269     3  0.3393      0.748 0.124  0 0.824 0.028 0.000 0.024
#> GSM381273     6  0.2883      0.778 0.000  0 0.000 0.000 0.212 0.788
#> GSM381274     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> GSM381276     1  0.4535     -0.298 0.484  0 0.484 0.000 0.000 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-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 other(p) k
#> CV:hclust 63    0.309 2
#> CV:hclust 61    0.252 3
#> CV:hclust 69    0.334 4
#> CV:hclust 80    0.239 5
#> CV:hclust 80    0.250 6

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


CV:kmeans

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 86 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.799           0.887       0.928         0.4522 0.548   0.548
#> 3 3 0.714           0.937       0.934         0.3445 0.805   0.649
#> 4 4 0.745           0.824       0.844         0.1181 0.980   0.947
#> 5 5 0.747           0.847       0.817         0.0984 0.866   0.628
#> 6 6 0.754           0.807       0.839         0.0609 0.953   0.803

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
#> GSM381194     1  0.0376      0.926 0.996 0.004
#> GSM381199     2  0.3879      0.983 0.076 0.924
#> GSM381205     2  0.3879      0.983 0.076 0.924
#> GSM381211     2  0.3879      0.983 0.076 0.924
#> GSM381220     2  0.3733      0.981 0.072 0.928
#> GSM381222     1  0.0000      0.928 1.000 0.000
#> GSM381224     1  0.0000      0.928 1.000 0.000
#> GSM381232     1  0.9754      0.401 0.592 0.408
#> GSM381240     1  0.0000      0.928 1.000 0.000
#> GSM381250     1  0.0000      0.928 1.000 0.000
#> GSM381252     2  0.3879      0.983 0.076 0.924
#> GSM381254     1  0.0000      0.928 1.000 0.000
#> GSM381256     2  0.3879      0.983 0.076 0.924
#> GSM381257     1  0.0000      0.928 1.000 0.000
#> GSM381259     1  0.0000      0.928 1.000 0.000
#> GSM381260     1  0.0000      0.928 1.000 0.000
#> GSM381261     2  0.3879      0.983 0.076 0.924
#> GSM381263     1  0.0000      0.928 1.000 0.000
#> GSM381265     1  0.0000      0.928 1.000 0.000
#> GSM381268     1  0.0376      0.926 0.996 0.004
#> GSM381270     2  0.3733      0.981 0.072 0.928
#> GSM381271     1  0.9754      0.401 0.592 0.408
#> GSM381275     2  0.3879      0.983 0.076 0.924
#> GSM381279     2  0.3733      0.981 0.072 0.928
#> GSM381195     1  0.0000      0.928 1.000 0.000
#> GSM381196     1  0.0000      0.928 1.000 0.000
#> GSM381198     2  0.3879      0.983 0.076 0.924
#> GSM381200     2  0.3879      0.983 0.076 0.924
#> GSM381201     1  0.3879      0.878 0.924 0.076
#> GSM381203     1  0.0000      0.928 1.000 0.000
#> GSM381204     1  0.0000      0.928 1.000 0.000
#> GSM381209     1  0.0000      0.928 1.000 0.000
#> GSM381212     1  0.0000      0.928 1.000 0.000
#> GSM381213     2  0.3733      0.981 0.072 0.928
#> GSM381214     2  0.3879      0.983 0.076 0.924
#> GSM381216     1  0.0000      0.928 1.000 0.000
#> GSM381225     1  0.0000      0.928 1.000 0.000
#> GSM381231     1  0.9754      0.401 0.592 0.408
#> GSM381235     1  0.0000      0.928 1.000 0.000
#> GSM381237     1  0.0000      0.928 1.000 0.000
#> GSM381241     2  0.3879      0.983 0.076 0.924
#> GSM381243     2  0.3733      0.981 0.072 0.928
#> GSM381245     1  0.0000      0.928 1.000 0.000
#> GSM381246     2  0.3879      0.983 0.076 0.924
#> GSM381251     1  0.3879      0.878 0.924 0.076
#> GSM381264     1  0.0000      0.928 1.000 0.000
#> GSM381206     2  0.3879      0.983 0.076 0.924
#> GSM381217     1  0.0000      0.928 1.000 0.000
#> GSM381218     2  0.3879      0.983 0.076 0.924
#> GSM381226     2  0.3879      0.983 0.076 0.924
#> GSM381227     2  0.3879      0.983 0.076 0.924
#> GSM381228     1  0.9754      0.401 0.592 0.408
#> GSM381236     1  0.9754      0.401 0.592 0.408
#> GSM381244     1  0.3879      0.878 0.924 0.076
#> GSM381272     1  0.9754      0.401 0.592 0.408
#> GSM381277     1  0.0000      0.928 1.000 0.000
#> GSM381278     1  0.0376      0.926 0.996 0.004
#> GSM381197     1  0.3879      0.878 0.924 0.076
#> GSM381202     1  0.0000      0.928 1.000 0.000
#> GSM381207     1  0.0000      0.928 1.000 0.000
#> GSM381208     2  0.8499      0.526 0.276 0.724
#> GSM381210     1  0.0000      0.928 1.000 0.000
#> GSM381215     1  0.0376      0.926 0.996 0.004
#> GSM381219     2  0.3879      0.983 0.076 0.924
#> GSM381221     2  0.3879      0.983 0.076 0.924
#> GSM381223     2  0.3879      0.983 0.076 0.924
#> GSM381229     1  0.3879      0.878 0.924 0.076
#> GSM381230     1  0.0000      0.928 1.000 0.000
#> GSM381233     1  0.0000      0.928 1.000 0.000
#> GSM381234     1  0.0000      0.928 1.000 0.000
#> GSM381238     1  0.9754      0.401 0.592 0.408
#> GSM381239     1  0.9754      0.401 0.592 0.408
#> GSM381242     1  0.0000      0.928 1.000 0.000
#> GSM381247     2  0.3733      0.981 0.072 0.928
#> GSM381248     1  0.0000      0.928 1.000 0.000
#> GSM381249     1  0.0000      0.928 1.000 0.000
#> GSM381253     1  0.0000      0.928 1.000 0.000
#> GSM381255     2  0.3879      0.983 0.076 0.924
#> GSM381258     1  0.0376      0.926 0.996 0.004
#> GSM381262     1  0.0376      0.926 0.996 0.004
#> GSM381266     1  0.3114      0.891 0.944 0.056
#> GSM381267     2  0.2948      0.887 0.052 0.948
#> GSM381269     1  0.0000      0.928 1.000 0.000
#> GSM381273     1  0.3879      0.878 0.924 0.076
#> GSM381274     2  0.3879      0.983 0.076 0.924
#> GSM381276     1  0.0376      0.926 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM381194     1  0.3482      0.854 0.872 0.000 0.128
#> GSM381199     2  0.1878      0.969 0.004 0.952 0.044
#> GSM381205     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381211     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381220     2  0.1267      0.974 0.004 0.972 0.024
#> GSM381222     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381224     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381232     3  0.6793      0.882 0.160 0.100 0.740
#> GSM381240     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381250     1  0.1289      0.951 0.968 0.000 0.032
#> GSM381252     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381254     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381256     2  0.0661      0.975 0.004 0.988 0.008
#> GSM381257     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381259     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381260     1  0.0424      0.967 0.992 0.000 0.008
#> GSM381261     2  0.2682      0.959 0.004 0.920 0.076
#> GSM381263     1  0.1289      0.951 0.968 0.000 0.032
#> GSM381265     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381268     1  0.2878      0.885 0.904 0.000 0.096
#> GSM381270     2  0.2301      0.965 0.004 0.936 0.060
#> GSM381271     3  0.6793      0.882 0.160 0.100 0.740
#> GSM381275     2  0.2682      0.959 0.004 0.920 0.076
#> GSM381279     2  0.2301      0.965 0.004 0.936 0.060
#> GSM381195     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381196     1  0.1289      0.951 0.968 0.000 0.032
#> GSM381198     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381200     2  0.1525      0.972 0.004 0.964 0.032
#> GSM381201     3  0.4351      0.864 0.168 0.004 0.828
#> GSM381203     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381204     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381209     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381212     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381213     2  0.1267      0.974 0.004 0.972 0.024
#> GSM381214     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381216     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381225     1  0.1529      0.949 0.960 0.000 0.040
#> GSM381231     3  0.6737      0.880 0.156 0.100 0.744
#> GSM381235     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381237     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381241     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381243     2  0.2301      0.965 0.004 0.936 0.060
#> GSM381245     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381246     2  0.0983      0.973 0.004 0.980 0.016
#> GSM381251     3  0.4351      0.864 0.168 0.004 0.828
#> GSM381264     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381206     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381217     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381218     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381226     2  0.0983      0.974 0.004 0.980 0.016
#> GSM381227     2  0.2301      0.965 0.004 0.936 0.060
#> GSM381228     3  0.6793      0.882 0.160 0.100 0.740
#> GSM381236     3  0.6793      0.882 0.160 0.100 0.740
#> GSM381244     3  0.4409      0.863 0.172 0.004 0.824
#> GSM381272     3  0.6793      0.882 0.160 0.100 0.740
#> GSM381277     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381278     1  0.4555      0.738 0.800 0.000 0.200
#> GSM381197     3  0.4409      0.863 0.172 0.004 0.824
#> GSM381202     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381207     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381208     3  0.4891      0.775 0.040 0.124 0.836
#> GSM381210     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381215     1  0.3267      0.869 0.884 0.000 0.116
#> GSM381219     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381221     2  0.0661      0.975 0.004 0.988 0.008
#> GSM381223     2  0.2682      0.959 0.004 0.920 0.076
#> GSM381229     3  0.4575      0.860 0.184 0.004 0.812
#> GSM381230     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381233     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381234     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381238     3  0.6737      0.880 0.156 0.100 0.744
#> GSM381239     3  0.6793      0.882 0.160 0.100 0.740
#> GSM381242     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381247     2  0.2301      0.965 0.004 0.936 0.060
#> GSM381248     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381249     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381253     1  0.0000      0.971 1.000 0.000 0.000
#> GSM381255     2  0.0661      0.974 0.004 0.988 0.008
#> GSM381258     1  0.3267      0.869 0.884 0.000 0.116
#> GSM381262     1  0.3340      0.865 0.880 0.000 0.120
#> GSM381266     3  0.5529      0.755 0.296 0.000 0.704
#> GSM381267     3  0.3752      0.724 0.000 0.144 0.856
#> GSM381269     1  0.0424      0.968 0.992 0.000 0.008
#> GSM381273     3  0.4351      0.864 0.168 0.004 0.828
#> GSM381274     2  0.2590      0.961 0.004 0.924 0.072
#> GSM381276     1  0.1289      0.951 0.968 0.000 0.032

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     1  0.6106      0.657 0.604 0.000 0.332 0.064
#> GSM381199     2  0.3764      0.862 0.000 0.784 0.216 0.000
#> GSM381205     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381211     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381220     2  0.1743      0.883 0.000 0.940 0.056 0.004
#> GSM381222     1  0.1389      0.832 0.952 0.000 0.048 0.000
#> GSM381224     1  0.0592      0.838 0.984 0.000 0.016 0.000
#> GSM381232     4  0.1833      0.999 0.032 0.024 0.000 0.944
#> GSM381240     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381250     1  0.5131      0.738 0.692 0.000 0.280 0.028
#> GSM381252     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381254     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381256     2  0.0469      0.891 0.000 0.988 0.012 0.000
#> GSM381257     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381260     1  0.4855      0.757 0.712 0.000 0.268 0.020
#> GSM381261     2  0.4690      0.843 0.000 0.724 0.260 0.016
#> GSM381263     1  0.5182      0.734 0.684 0.000 0.288 0.028
#> GSM381265     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381268     1  0.5658      0.689 0.632 0.000 0.328 0.040
#> GSM381270     2  0.4304      0.841 0.000 0.716 0.284 0.000
#> GSM381271     4  0.1833      0.999 0.032 0.024 0.000 0.944
#> GSM381275     2  0.4661      0.845 0.000 0.728 0.256 0.016
#> GSM381279     2  0.4277      0.843 0.000 0.720 0.280 0.000
#> GSM381195     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381196     1  0.5105      0.740 0.696 0.000 0.276 0.028
#> GSM381198     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381200     2  0.3942      0.858 0.000 0.764 0.236 0.000
#> GSM381201     3  0.6315      0.770 0.064 0.000 0.540 0.396
#> GSM381203     1  0.3311      0.810 0.828 0.000 0.172 0.000
#> GSM381204     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381213     2  0.1902      0.886 0.000 0.932 0.064 0.004
#> GSM381214     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381216     1  0.3975      0.791 0.760 0.000 0.240 0.000
#> GSM381225     1  0.5343      0.719 0.656 0.000 0.316 0.028
#> GSM381231     4  0.1833      0.999 0.032 0.024 0.000 0.944
#> GSM381235     1  0.3975      0.791 0.760 0.000 0.240 0.000
#> GSM381237     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381243     2  0.4304      0.841 0.000 0.716 0.284 0.000
#> GSM381245     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381246     2  0.0000      0.890 0.000 1.000 0.000 0.000
#> GSM381251     3  0.6315      0.770 0.064 0.000 0.540 0.396
#> GSM381264     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381206     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381217     1  0.3942      0.793 0.764 0.000 0.236 0.000
#> GSM381218     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381226     2  0.2589      0.882 0.000 0.884 0.116 0.000
#> GSM381227     2  0.4193      0.848 0.000 0.732 0.268 0.000
#> GSM381228     4  0.1833      0.999 0.032 0.024 0.000 0.944
#> GSM381236     4  0.1833      0.999 0.032 0.024 0.000 0.944
#> GSM381244     3  0.6597      0.769 0.088 0.000 0.540 0.372
#> GSM381272     4  0.1833      0.999 0.032 0.024 0.000 0.944
#> GSM381277     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381278     1  0.6547      0.601 0.568 0.000 0.340 0.092
#> GSM381197     3  0.6597      0.769 0.088 0.000 0.540 0.372
#> GSM381202     1  0.2530      0.825 0.888 0.000 0.112 0.000
#> GSM381207     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381208     3  0.7086      0.570 0.008 0.108 0.532 0.352
#> GSM381210     1  0.0188      0.838 0.996 0.000 0.004 0.000
#> GSM381215     1  0.5677      0.688 0.628 0.000 0.332 0.040
#> GSM381219     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381221     2  0.1118      0.891 0.000 0.964 0.036 0.000
#> GSM381223     2  0.4661      0.845 0.000 0.728 0.256 0.016
#> GSM381229     3  0.5900      0.649 0.076 0.000 0.664 0.260
#> GSM381230     1  0.0188      0.838 0.996 0.000 0.004 0.000
#> GSM381233     1  0.1474      0.832 0.948 0.000 0.052 0.000
#> GSM381234     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381238     4  0.2019      0.992 0.032 0.024 0.004 0.940
#> GSM381239     4  0.1833      0.999 0.032 0.024 0.000 0.944
#> GSM381242     1  0.4535      0.759 0.704 0.000 0.292 0.004
#> GSM381247     2  0.4304      0.841 0.000 0.716 0.284 0.000
#> GSM381248     1  0.0000      0.839 1.000 0.000 0.000 0.000
#> GSM381249     1  0.0921      0.835 0.972 0.000 0.028 0.000
#> GSM381253     1  0.4502      0.778 0.748 0.000 0.236 0.016
#> GSM381255     2  0.0188      0.890 0.000 0.996 0.000 0.004
#> GSM381258     1  0.5677      0.688 0.628 0.000 0.332 0.040
#> GSM381262     1  0.6041      0.663 0.608 0.000 0.332 0.060
#> GSM381266     3  0.7137      0.475 0.188 0.000 0.556 0.256
#> GSM381267     3  0.6831      0.553 0.000 0.112 0.536 0.352
#> GSM381269     1  0.3528      0.808 0.808 0.000 0.192 0.000
#> GSM381273     3  0.6315      0.770 0.064 0.000 0.540 0.396
#> GSM381274     2  0.4661      0.845 0.000 0.728 0.256 0.016
#> GSM381276     1  0.5050      0.751 0.704 0.000 0.268 0.028

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.4265      0.871 0.268 0.000 0.712 0.008 0.012
#> GSM381199     2  0.6184      0.761 0.000 0.656 0.180 0.084 0.080
#> GSM381205     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381220     2  0.1978      0.804 0.000 0.928 0.024 0.004 0.044
#> GSM381222     1  0.2570      0.806 0.880 0.000 0.108 0.008 0.004
#> GSM381224     1  0.1153      0.918 0.964 0.000 0.024 0.008 0.004
#> GSM381232     4  0.2929      0.998 0.004 0.008 0.004 0.860 0.124
#> GSM381240     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.4114      0.838 0.376 0.000 0.624 0.000 0.000
#> GSM381252     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381254     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381256     2  0.0798      0.814 0.000 0.976 0.000 0.008 0.016
#> GSM381257     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.4264      0.841 0.376 0.000 0.620 0.000 0.004
#> GSM381261     2  0.7019      0.729 0.000 0.556 0.244 0.112 0.088
#> GSM381263     3  0.4030      0.857 0.352 0.000 0.648 0.000 0.000
#> GSM381265     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.4170      0.873 0.272 0.000 0.712 0.004 0.012
#> GSM381270     2  0.7127      0.727 0.000 0.552 0.232 0.100 0.116
#> GSM381271     4  0.2929      0.998 0.004 0.008 0.004 0.860 0.124
#> GSM381275     2  0.6951      0.732 0.000 0.564 0.240 0.112 0.084
#> GSM381279     2  0.7064      0.728 0.000 0.552 0.244 0.092 0.112
#> GSM381195     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.4126      0.834 0.380 0.000 0.620 0.000 0.000
#> GSM381198     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381200     2  0.6567      0.752 0.000 0.612 0.212 0.092 0.084
#> GSM381201     5  0.2968      0.945 0.012 0.000 0.112 0.012 0.864
#> GSM381203     3  0.4307      0.624 0.500 0.000 0.500 0.000 0.000
#> GSM381204     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.2910      0.801 0.000 0.888 0.052 0.024 0.036
#> GSM381214     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381216     3  0.4353      0.862 0.328 0.000 0.660 0.008 0.004
#> GSM381225     3  0.3730      0.876 0.288 0.000 0.712 0.000 0.000
#> GSM381231     4  0.2929      0.998 0.004 0.008 0.004 0.860 0.124
#> GSM381235     3  0.4353      0.862 0.328 0.000 0.660 0.008 0.004
#> GSM381237     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381243     2  0.7127      0.727 0.000 0.552 0.232 0.100 0.116
#> GSM381245     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381246     2  0.0566      0.814 0.000 0.984 0.004 0.012 0.000
#> GSM381251     5  0.2907      0.943 0.012 0.000 0.116 0.008 0.864
#> GSM381264     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381217     3  0.4370      0.858 0.332 0.000 0.656 0.008 0.004
#> GSM381218     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381226     2  0.4552      0.790 0.000 0.780 0.132 0.056 0.032
#> GSM381227     2  0.6896      0.736 0.000 0.568 0.244 0.092 0.096
#> GSM381228     4  0.2929      0.998 0.004 0.008 0.004 0.860 0.124
#> GSM381236     4  0.2929      0.998 0.004 0.008 0.004 0.860 0.124
#> GSM381244     5  0.2967      0.943 0.016 0.000 0.104 0.012 0.868
#> GSM381272     4  0.2929      0.998 0.004 0.008 0.004 0.860 0.124
#> GSM381277     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381278     3  0.4509      0.843 0.232 0.000 0.728 0.024 0.016
#> GSM381197     5  0.2967      0.943 0.016 0.000 0.104 0.012 0.868
#> GSM381202     1  0.4211     -0.185 0.636 0.000 0.360 0.000 0.004
#> GSM381207     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381208     5  0.2679      0.872 0.000 0.048 0.056 0.004 0.892
#> GSM381210     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381215     3  0.4170      0.873 0.272 0.000 0.712 0.004 0.012
#> GSM381219     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381221     2  0.1419      0.814 0.000 0.956 0.012 0.016 0.016
#> GSM381223     2  0.6951      0.732 0.000 0.564 0.240 0.112 0.084
#> GSM381229     3  0.4609      0.367 0.024 0.000 0.688 0.008 0.280
#> GSM381230     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.2672      0.793 0.872 0.000 0.116 0.008 0.004
#> GSM381234     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> GSM381238     4  0.2831      0.989 0.004 0.008 0.004 0.868 0.116
#> GSM381239     4  0.2929      0.998 0.004 0.008 0.004 0.860 0.124
#> GSM381242     3  0.4220      0.873 0.300 0.000 0.688 0.008 0.004
#> GSM381247     2  0.7127      0.727 0.000 0.552 0.232 0.100 0.116
#> GSM381248     1  0.0162      0.947 0.996 0.000 0.000 0.004 0.000
#> GSM381249     1  0.1569      0.896 0.944 0.000 0.044 0.008 0.004
#> GSM381253     3  0.4192      0.811 0.404 0.000 0.596 0.000 0.000
#> GSM381255     2  0.0000      0.814 0.000 1.000 0.000 0.000 0.000
#> GSM381258     3  0.4419      0.873 0.276 0.000 0.700 0.012 0.012
#> GSM381262     3  0.4265      0.871 0.268 0.000 0.712 0.008 0.012
#> GSM381266     3  0.5126      0.565 0.084 0.000 0.708 0.012 0.196
#> GSM381267     5  0.2679      0.872 0.000 0.048 0.056 0.004 0.892
#> GSM381269     3  0.4464      0.832 0.356 0.000 0.632 0.008 0.004
#> GSM381273     5  0.2968      0.945 0.012 0.000 0.112 0.012 0.864
#> GSM381274     2  0.6951      0.732 0.000 0.564 0.240 0.112 0.084
#> GSM381276     3  0.4074      0.851 0.364 0.000 0.636 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
#> GSM381194     3  0.3141      0.814 0.124 0.000 0.832 0.004 0.000 0.040
#> GSM381199     2  0.5841     -0.643 0.000 0.488 0.064 0.000 0.052 0.396
#> GSM381205     2  0.0146      0.867 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM381211     2  0.0260      0.867 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM381220     2  0.3897      0.640 0.000 0.808 0.056 0.000 0.060 0.076
#> GSM381222     1  0.5362      0.513 0.636 0.000 0.156 0.000 0.016 0.192
#> GSM381224     1  0.3800      0.705 0.764 0.000 0.036 0.000 0.008 0.192
#> GSM381232     4  0.0291      0.996 0.000 0.000 0.004 0.992 0.000 0.004
#> GSM381240     1  0.0260      0.903 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM381250     3  0.3215      0.792 0.240 0.000 0.756 0.000 0.000 0.004
#> GSM381252     2  0.0146      0.867 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM381254     1  0.0146      0.904 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381256     2  0.0862      0.860 0.000 0.972 0.016 0.000 0.008 0.004
#> GSM381257     1  0.1296      0.872 0.952 0.000 0.032 0.000 0.004 0.012
#> GSM381259     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.5102      0.750 0.264 0.000 0.632 0.000 0.012 0.092
#> GSM381261     6  0.4406      0.837 0.000 0.316 0.028 0.004 0.004 0.648
#> GSM381263     3  0.2969      0.803 0.224 0.000 0.776 0.000 0.000 0.000
#> GSM381265     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.3083      0.816 0.132 0.000 0.828 0.000 0.000 0.040
#> GSM381270     6  0.5799      0.853 0.000 0.344 0.060 0.000 0.060 0.536
#> GSM381271     4  0.0146      0.997 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM381275     6  0.4521      0.833 0.000 0.348 0.028 0.004 0.004 0.616
#> GSM381279     6  0.5488      0.859 0.000 0.344 0.048 0.000 0.048 0.560
#> GSM381195     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.3151      0.782 0.252 0.000 0.748 0.000 0.000 0.000
#> GSM381198     2  0.0146      0.867 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM381200     6  0.4772      0.731 0.000 0.452 0.004 0.000 0.040 0.504
#> GSM381201     5  0.2483      0.955 0.004 0.000 0.060 0.024 0.896 0.016
#> GSM381203     3  0.3862      0.592 0.388 0.000 0.608 0.000 0.000 0.004
#> GSM381204     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.2944      0.650 0.000 0.832 0.012 0.000 0.008 0.148
#> GSM381214     2  0.0260      0.867 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM381216     3  0.5291      0.768 0.144 0.000 0.644 0.000 0.016 0.196
#> GSM381225     3  0.3235      0.816 0.128 0.000 0.820 0.000 0.000 0.052
#> GSM381231     4  0.0291      0.996 0.000 0.000 0.004 0.992 0.000 0.004
#> GSM381235     3  0.5264      0.770 0.144 0.000 0.648 0.000 0.016 0.192
#> GSM381237     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0146      0.867 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM381243     6  0.5799      0.853 0.000 0.344 0.060 0.000 0.060 0.536
#> GSM381245     1  0.0260      0.903 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM381246     2  0.1615      0.809 0.000 0.928 0.004 0.000 0.004 0.064
#> GSM381251     5  0.2482      0.946 0.004 0.000 0.072 0.012 0.892 0.020
#> GSM381264     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0146      0.867 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM381217     3  0.5264      0.770 0.144 0.000 0.648 0.000 0.016 0.192
#> GSM381218     2  0.0260      0.867 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM381226     2  0.3693      0.242 0.000 0.708 0.008 0.000 0.004 0.280
#> GSM381227     6  0.5374      0.861 0.000 0.344 0.040 0.000 0.048 0.568
#> GSM381228     4  0.0291      0.998 0.000 0.000 0.004 0.992 0.004 0.000
#> GSM381236     4  0.0291      0.998 0.000 0.000 0.004 0.992 0.004 0.000
#> GSM381244     5  0.2063      0.955 0.008 0.000 0.060 0.020 0.912 0.000
#> GSM381272     4  0.0146      0.997 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM381277     1  0.0547      0.897 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM381278     3  0.2773      0.764 0.064 0.000 0.868 0.004 0.000 0.064
#> GSM381197     5  0.2063      0.955 0.008 0.000 0.060 0.020 0.912 0.000
#> GSM381202     1  0.5880     -0.105 0.512 0.000 0.328 0.000 0.016 0.144
#> GSM381207     1  0.0260      0.903 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM381208     5  0.2489      0.908 0.000 0.016 0.028 0.020 0.904 0.032
#> GSM381210     1  0.0146      0.904 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381215     3  0.2278      0.820 0.128 0.000 0.868 0.000 0.000 0.004
#> GSM381219     2  0.0000      0.867 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381221     2  0.1410      0.824 0.000 0.944 0.004 0.000 0.008 0.044
#> GSM381223     6  0.4521      0.833 0.000 0.348 0.028 0.004 0.004 0.616
#> GSM381229     3  0.4084      0.595 0.004 0.000 0.764 0.008 0.164 0.060
#> GSM381230     1  0.0000      0.904 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.5507      0.474 0.616 0.000 0.172 0.000 0.016 0.196
#> GSM381234     1  0.0146      0.904 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381238     4  0.0291      0.998 0.000 0.000 0.004 0.992 0.004 0.000
#> GSM381239     4  0.0291      0.998 0.000 0.000 0.004 0.992 0.004 0.000
#> GSM381242     3  0.5368      0.767 0.144 0.000 0.632 0.000 0.016 0.208
#> GSM381247     6  0.5799      0.853 0.000 0.344 0.060 0.000 0.060 0.536
#> GSM381248     1  0.0363      0.900 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM381249     1  0.4615      0.634 0.712 0.000 0.080 0.000 0.016 0.192
#> GSM381253     3  0.3290      0.785 0.252 0.000 0.744 0.000 0.000 0.004
#> GSM381255     2  0.0458      0.865 0.000 0.984 0.016 0.000 0.000 0.000
#> GSM381258     3  0.5124      0.774 0.128 0.000 0.664 0.000 0.016 0.192
#> GSM381262     3  0.3141      0.814 0.124 0.000 0.832 0.004 0.000 0.040
#> GSM381266     3  0.3381      0.671 0.008 0.000 0.836 0.008 0.096 0.052
#> GSM381267     5  0.2489      0.908 0.000 0.016 0.028 0.020 0.904 0.032
#> GSM381269     3  0.5507      0.741 0.172 0.000 0.616 0.000 0.016 0.196
#> GSM381273     5  0.2571      0.954 0.004 0.000 0.060 0.024 0.892 0.020
#> GSM381274     6  0.4521      0.833 0.000 0.348 0.028 0.004 0.004 0.616
#> GSM381276     3  0.4142      0.792 0.232 0.000 0.712 0.000 0.000 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-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 other(p) k
#> CV:kmeans 78    0.572 2
#> CV:kmeans 86    0.266 3
#> CV:kmeans 85    0.218 4
#> CV:kmeans 84    0.484 5
#> CV:kmeans 82    0.624 6

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


CV:skmeans

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

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

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

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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.829           0.903       0.958         0.4768 0.504   0.504
#> 3 3 0.859           0.930       0.967         0.3930 0.763   0.560
#> 4 4 0.801           0.836       0.923         0.1094 0.843   0.587
#> 5 5 0.862           0.840       0.909         0.0468 0.957   0.842
#> 6 6 0.813           0.706       0.819         0.0495 0.945   0.772

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
#> GSM381194     1   0.000      1.000 1.000 0.000
#> GSM381199     2   0.000      0.895 0.000 1.000
#> GSM381205     2   0.000      0.895 0.000 1.000
#> GSM381211     2   0.000      0.895 0.000 1.000
#> GSM381220     2   0.000      0.895 0.000 1.000
#> GSM381222     1   0.000      1.000 1.000 0.000
#> GSM381224     1   0.000      1.000 1.000 0.000
#> GSM381232     2   0.993      0.336 0.452 0.548
#> GSM381240     1   0.000      1.000 1.000 0.000
#> GSM381250     1   0.000      1.000 1.000 0.000
#> GSM381252     2   0.000      0.895 0.000 1.000
#> GSM381254     1   0.000      1.000 1.000 0.000
#> GSM381256     2   0.000      0.895 0.000 1.000
#> GSM381257     1   0.000      1.000 1.000 0.000
#> GSM381259     1   0.000      1.000 1.000 0.000
#> GSM381260     1   0.000      1.000 1.000 0.000
#> GSM381261     2   0.000      0.895 0.000 1.000
#> GSM381263     1   0.000      1.000 1.000 0.000
#> GSM381265     1   0.000      1.000 1.000 0.000
#> GSM381268     1   0.000      1.000 1.000 0.000
#> GSM381270     2   0.000      0.895 0.000 1.000
#> GSM381271     2   0.993      0.336 0.452 0.548
#> GSM381275     2   0.000      0.895 0.000 1.000
#> GSM381279     2   0.000      0.895 0.000 1.000
#> GSM381195     1   0.000      1.000 1.000 0.000
#> GSM381196     1   0.000      1.000 1.000 0.000
#> GSM381198     2   0.000      0.895 0.000 1.000
#> GSM381200     2   0.000      0.895 0.000 1.000
#> GSM381201     1   0.000      1.000 1.000 0.000
#> GSM381203     1   0.000      1.000 1.000 0.000
#> GSM381204     1   0.000      1.000 1.000 0.000
#> GSM381209     1   0.000      1.000 1.000 0.000
#> GSM381212     1   0.000      1.000 1.000 0.000
#> GSM381213     2   0.000      0.895 0.000 1.000
#> GSM381214     2   0.000      0.895 0.000 1.000
#> GSM381216     1   0.000      1.000 1.000 0.000
#> GSM381225     1   0.000      1.000 1.000 0.000
#> GSM381231     2   0.993      0.336 0.452 0.548
#> GSM381235     1   0.000      1.000 1.000 0.000
#> GSM381237     1   0.000      1.000 1.000 0.000
#> GSM381241     2   0.000      0.895 0.000 1.000
#> GSM381243     2   0.000      0.895 0.000 1.000
#> GSM381245     1   0.000      1.000 1.000 0.000
#> GSM381246     2   0.000      0.895 0.000 1.000
#> GSM381251     1   0.000      1.000 1.000 0.000
#> GSM381264     1   0.000      1.000 1.000 0.000
#> GSM381206     2   0.000      0.895 0.000 1.000
#> GSM381217     1   0.000      1.000 1.000 0.000
#> GSM381218     2   0.000      0.895 0.000 1.000
#> GSM381226     2   0.000      0.895 0.000 1.000
#> GSM381227     2   0.000      0.895 0.000 1.000
#> GSM381228     2   0.993      0.336 0.452 0.548
#> GSM381236     2   0.993      0.336 0.452 0.548
#> GSM381244     1   0.000      1.000 1.000 0.000
#> GSM381272     2   0.993      0.336 0.452 0.548
#> GSM381277     1   0.000      1.000 1.000 0.000
#> GSM381278     1   0.000      1.000 1.000 0.000
#> GSM381197     1   0.000      1.000 1.000 0.000
#> GSM381202     1   0.000      1.000 1.000 0.000
#> GSM381207     1   0.000      1.000 1.000 0.000
#> GSM381208     2   0.000      0.895 0.000 1.000
#> GSM381210     1   0.000      1.000 1.000 0.000
#> GSM381215     1   0.000      1.000 1.000 0.000
#> GSM381219     2   0.000      0.895 0.000 1.000
#> GSM381221     2   0.000      0.895 0.000 1.000
#> GSM381223     2   0.000      0.895 0.000 1.000
#> GSM381229     1   0.000      1.000 1.000 0.000
#> GSM381230     1   0.000      1.000 1.000 0.000
#> GSM381233     1   0.000      1.000 1.000 0.000
#> GSM381234     1   0.000      1.000 1.000 0.000
#> GSM381238     2   0.993      0.336 0.452 0.548
#> GSM381239     2   0.993      0.336 0.452 0.548
#> GSM381242     1   0.000      1.000 1.000 0.000
#> GSM381247     2   0.000      0.895 0.000 1.000
#> GSM381248     1   0.000      1.000 1.000 0.000
#> GSM381249     1   0.000      1.000 1.000 0.000
#> GSM381253     1   0.000      1.000 1.000 0.000
#> GSM381255     2   0.000      0.895 0.000 1.000
#> GSM381258     1   0.000      1.000 1.000 0.000
#> GSM381262     1   0.000      1.000 1.000 0.000
#> GSM381266     1   0.000      1.000 1.000 0.000
#> GSM381267     2   0.000      0.895 0.000 1.000
#> GSM381269     1   0.000      1.000 1.000 0.000
#> GSM381273     1   0.000      1.000 1.000 0.000
#> GSM381274     2   0.000      0.895 0.000 1.000
#> GSM381276     1   0.000      1.000 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
#> GSM381194     3   0.000      0.951 0.000 0.000 1.000
#> GSM381199     2   0.000      1.000 0.000 1.000 0.000
#> GSM381205     2   0.000      1.000 0.000 1.000 0.000
#> GSM381211     2   0.000      1.000 0.000 1.000 0.000
#> GSM381220     2   0.000      1.000 0.000 1.000 0.000
#> GSM381222     1   0.000      0.943 1.000 0.000 0.000
#> GSM381224     1   0.000      0.943 1.000 0.000 0.000
#> GSM381232     3   0.000      0.951 0.000 0.000 1.000
#> GSM381240     1   0.000      0.943 1.000 0.000 0.000
#> GSM381250     1   0.536      0.678 0.724 0.000 0.276
#> GSM381252     2   0.000      1.000 0.000 1.000 0.000
#> GSM381254     1   0.000      0.943 1.000 0.000 0.000
#> GSM381256     2   0.000      1.000 0.000 1.000 0.000
#> GSM381257     1   0.000      0.943 1.000 0.000 0.000
#> GSM381259     1   0.000      0.943 1.000 0.000 0.000
#> GSM381260     1   0.450      0.774 0.804 0.000 0.196
#> GSM381261     2   0.000      1.000 0.000 1.000 0.000
#> GSM381263     1   0.536      0.678 0.724 0.000 0.276
#> GSM381265     1   0.000      0.943 1.000 0.000 0.000
#> GSM381268     3   0.429      0.755 0.180 0.000 0.820
#> GSM381270     2   0.000      1.000 0.000 1.000 0.000
#> GSM381271     3   0.000      0.951 0.000 0.000 1.000
#> GSM381275     2   0.000      1.000 0.000 1.000 0.000
#> GSM381279     2   0.000      1.000 0.000 1.000 0.000
#> GSM381195     1   0.000      0.943 1.000 0.000 0.000
#> GSM381196     1   0.536      0.678 0.724 0.000 0.276
#> GSM381198     2   0.000      1.000 0.000 1.000 0.000
#> GSM381200     2   0.000      1.000 0.000 1.000 0.000
#> GSM381201     3   0.000      0.951 0.000 0.000 1.000
#> GSM381203     1   0.000      0.943 1.000 0.000 0.000
#> GSM381204     1   0.000      0.943 1.000 0.000 0.000
#> GSM381209     1   0.000      0.943 1.000 0.000 0.000
#> GSM381212     1   0.000      0.943 1.000 0.000 0.000
#> GSM381213     2   0.000      1.000 0.000 1.000 0.000
#> GSM381214     2   0.000      1.000 0.000 1.000 0.000
#> GSM381216     1   0.000      0.943 1.000 0.000 0.000
#> GSM381225     1   0.536      0.678 0.724 0.000 0.276
#> GSM381231     3   0.000      0.951 0.000 0.000 1.000
#> GSM381235     1   0.000      0.943 1.000 0.000 0.000
#> GSM381237     1   0.000      0.943 1.000 0.000 0.000
#> GSM381241     2   0.000      1.000 0.000 1.000 0.000
#> GSM381243     2   0.000      1.000 0.000 1.000 0.000
#> GSM381245     1   0.000      0.943 1.000 0.000 0.000
#> GSM381246     2   0.000      1.000 0.000 1.000 0.000
#> GSM381251     3   0.000      0.951 0.000 0.000 1.000
#> GSM381264     1   0.000      0.943 1.000 0.000 0.000
#> GSM381206     2   0.000      1.000 0.000 1.000 0.000
#> GSM381217     1   0.000      0.943 1.000 0.000 0.000
#> GSM381218     2   0.000      1.000 0.000 1.000 0.000
#> GSM381226     2   0.000      1.000 0.000 1.000 0.000
#> GSM381227     2   0.000      1.000 0.000 1.000 0.000
#> GSM381228     3   0.000      0.951 0.000 0.000 1.000
#> GSM381236     3   0.000      0.951 0.000 0.000 1.000
#> GSM381244     3   0.000      0.951 0.000 0.000 1.000
#> GSM381272     3   0.000      0.951 0.000 0.000 1.000
#> GSM381277     1   0.000      0.943 1.000 0.000 0.000
#> GSM381278     3   0.000      0.951 0.000 0.000 1.000
#> GSM381197     3   0.000      0.951 0.000 0.000 1.000
#> GSM381202     1   0.000      0.943 1.000 0.000 0.000
#> GSM381207     1   0.000      0.943 1.000 0.000 0.000
#> GSM381208     3   0.536      0.605 0.000 0.276 0.724
#> GSM381210     1   0.000      0.943 1.000 0.000 0.000
#> GSM381215     3   0.000      0.951 0.000 0.000 1.000
#> GSM381219     2   0.000      1.000 0.000 1.000 0.000
#> GSM381221     2   0.000      1.000 0.000 1.000 0.000
#> GSM381223     2   0.000      1.000 0.000 1.000 0.000
#> GSM381229     3   0.000      0.951 0.000 0.000 1.000
#> GSM381230     1   0.000      0.943 1.000 0.000 0.000
#> GSM381233     1   0.000      0.943 1.000 0.000 0.000
#> GSM381234     1   0.000      0.943 1.000 0.000 0.000
#> GSM381238     3   0.000      0.951 0.000 0.000 1.000
#> GSM381239     3   0.000      0.951 0.000 0.000 1.000
#> GSM381242     1   0.103      0.927 0.976 0.000 0.024
#> GSM381247     2   0.000      1.000 0.000 1.000 0.000
#> GSM381248     1   0.000      0.943 1.000 0.000 0.000
#> GSM381249     1   0.000      0.943 1.000 0.000 0.000
#> GSM381253     1   0.522      0.699 0.740 0.000 0.260
#> GSM381255     2   0.000      1.000 0.000 1.000 0.000
#> GSM381258     3   0.355      0.823 0.132 0.000 0.868
#> GSM381262     3   0.319      0.847 0.112 0.000 0.888
#> GSM381266     3   0.000      0.951 0.000 0.000 1.000
#> GSM381267     3   0.536      0.605 0.000 0.276 0.724
#> GSM381269     1   0.000      0.943 1.000 0.000 0.000
#> GSM381273     3   0.000      0.951 0.000 0.000 1.000
#> GSM381274     2   0.000      1.000 0.000 1.000 0.000
#> GSM381276     1   0.536      0.678 0.724 0.000 0.276

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.0336     0.7377 0.000 0.000 0.992 0.008
#> GSM381199     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381205     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381211     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381220     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381222     1  0.2647     0.8427 0.880 0.000 0.120 0.000
#> GSM381224     1  0.1118     0.9206 0.964 0.000 0.036 0.000
#> GSM381232     4  0.0000     0.9556 0.000 0.000 0.000 1.000
#> GSM381240     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381250     3  0.3356     0.7261 0.176 0.000 0.824 0.000
#> GSM381252     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381254     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381256     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381257     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381259     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381260     3  0.3907     0.6958 0.232 0.000 0.768 0.000
#> GSM381261     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381263     3  0.3219     0.7321 0.164 0.000 0.836 0.000
#> GSM381265     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381268     3  0.0188     0.7394 0.004 0.000 0.996 0.000
#> GSM381270     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381271     4  0.0000     0.9556 0.000 0.000 0.000 1.000
#> GSM381275     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381279     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381195     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381196     3  0.2814     0.7296 0.132 0.000 0.868 0.000
#> GSM381198     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381200     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381201     3  0.4977     0.2015 0.000 0.000 0.540 0.460
#> GSM381203     1  0.4877     0.1874 0.592 0.000 0.408 0.000
#> GSM381204     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381213     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381214     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381216     3  0.3266     0.7064 0.168 0.000 0.832 0.000
#> GSM381225     3  0.1302     0.7444 0.044 0.000 0.956 0.000
#> GSM381231     4  0.0000     0.9556 0.000 0.000 0.000 1.000
#> GSM381235     3  0.2973     0.7209 0.144 0.000 0.856 0.000
#> GSM381237     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381243     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381245     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381246     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381251     3  0.4941     0.2570 0.000 0.000 0.564 0.436
#> GSM381264     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381206     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381217     3  0.4382     0.5154 0.296 0.000 0.704 0.000
#> GSM381218     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381226     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381227     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381228     4  0.0000     0.9556 0.000 0.000 0.000 1.000
#> GSM381236     4  0.0000     0.9556 0.000 0.000 0.000 1.000
#> GSM381244     3  0.4977     0.2015 0.000 0.000 0.540 0.460
#> GSM381272     4  0.0000     0.9556 0.000 0.000 0.000 1.000
#> GSM381277     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381278     3  0.0707     0.7366 0.000 0.000 0.980 0.020
#> GSM381197     3  0.4977     0.2015 0.000 0.000 0.540 0.460
#> GSM381202     1  0.3726     0.6791 0.788 0.000 0.212 0.000
#> GSM381207     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381208     4  0.4487     0.8084 0.000 0.100 0.092 0.808
#> GSM381210     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381215     3  0.0000     0.7375 0.000 0.000 1.000 0.000
#> GSM381219     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381221     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381223     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381229     3  0.2469     0.6947 0.000 0.000 0.892 0.108
#> GSM381230     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381233     1  0.3123     0.8024 0.844 0.000 0.156 0.000
#> GSM381234     1  0.0000     0.9464 1.000 0.000 0.000 0.000
#> GSM381238     4  0.0000     0.9556 0.000 0.000 0.000 1.000
#> GSM381239     4  0.0000     0.9556 0.000 0.000 0.000 1.000
#> GSM381242     3  0.2530     0.7343 0.112 0.000 0.888 0.000
#> GSM381247     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381248     1  0.0188     0.9430 0.996 0.000 0.004 0.000
#> GSM381249     1  0.2408     0.8588 0.896 0.000 0.104 0.000
#> GSM381253     3  0.3942     0.6899 0.236 0.000 0.764 0.000
#> GSM381255     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381258     3  0.0592     0.7424 0.016 0.000 0.984 0.000
#> GSM381262     3  0.0188     0.7394 0.004 0.000 0.996 0.000
#> GSM381266     3  0.4500     0.4689 0.000 0.000 0.684 0.316
#> GSM381267     4  0.4547     0.8039 0.000 0.104 0.092 0.804
#> GSM381269     3  0.4998    -0.0467 0.488 0.000 0.512 0.000
#> GSM381273     3  0.4977     0.2015 0.000 0.000 0.540 0.460
#> GSM381274     2  0.0000     1.0000 0.000 1.000 0.000 0.000
#> GSM381276     3  0.3942     0.6876 0.236 0.000 0.764 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
#> GSM381194     3  0.3010      0.753 0.000 0.000 0.824 0.004 0.172
#> GSM381199     2  0.1124      0.977 0.000 0.960 0.004 0.000 0.036
#> GSM381205     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381211     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381220     2  0.0609      0.979 0.000 0.980 0.000 0.000 0.020
#> GSM381222     1  0.3999      0.548 0.656 0.000 0.344 0.000 0.000
#> GSM381224     1  0.2690      0.772 0.844 0.000 0.156 0.000 0.000
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.0162      0.884 0.996 0.000 0.000 0.000 0.004
#> GSM381250     3  0.5756      0.670 0.204 0.000 0.620 0.000 0.176
#> GSM381252     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381254     1  0.0162      0.884 0.996 0.000 0.000 0.000 0.004
#> GSM381256     2  0.0162      0.982 0.000 0.996 0.004 0.000 0.000
#> GSM381257     1  0.0865      0.873 0.972 0.000 0.024 0.000 0.004
#> GSM381259     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.4679      0.687 0.216 0.000 0.716 0.000 0.068
#> GSM381261     2  0.1124      0.976 0.000 0.960 0.004 0.000 0.036
#> GSM381263     3  0.5339      0.707 0.176 0.000 0.672 0.000 0.152
#> GSM381265     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.3816      0.633 0.000 0.000 0.696 0.000 0.304
#> GSM381270     2  0.1357      0.972 0.000 0.948 0.004 0.000 0.048
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381275     2  0.1124      0.976 0.000 0.960 0.004 0.000 0.036
#> GSM381279     2  0.1357      0.972 0.000 0.948 0.004 0.000 0.048
#> GSM381195     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.6059      0.621 0.184 0.000 0.572 0.000 0.244
#> GSM381198     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381200     2  0.0865      0.979 0.000 0.972 0.004 0.000 0.024
#> GSM381201     5  0.1893      0.869 0.000 0.000 0.048 0.024 0.928
#> GSM381203     1  0.5680     -0.214 0.492 0.000 0.428 0.000 0.080
#> GSM381204     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.0794      0.980 0.000 0.972 0.000 0.000 0.028
#> GSM381214     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381216     3  0.1043      0.752 0.040 0.000 0.960 0.000 0.000
#> GSM381225     3  0.2763      0.762 0.004 0.000 0.848 0.000 0.148
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381235     3  0.0771      0.755 0.020 0.000 0.976 0.000 0.004
#> GSM381237     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381243     2  0.1357      0.972 0.000 0.948 0.004 0.000 0.048
#> GSM381245     1  0.0162      0.884 0.996 0.000 0.000 0.000 0.004
#> GSM381246     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381251     5  0.1484      0.860 0.000 0.000 0.048 0.008 0.944
#> GSM381264     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381217     3  0.1121      0.750 0.044 0.000 0.956 0.000 0.000
#> GSM381218     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381226     2  0.0451      0.981 0.000 0.988 0.004 0.000 0.008
#> GSM381227     2  0.1282      0.974 0.000 0.952 0.004 0.000 0.044
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381244     5  0.2570      0.851 0.000 0.000 0.084 0.028 0.888
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381277     1  0.0671      0.877 0.980 0.000 0.016 0.000 0.004
#> GSM381278     3  0.3197      0.754 0.000 0.000 0.836 0.024 0.140
#> GSM381197     5  0.2104      0.867 0.000 0.000 0.060 0.024 0.916
#> GSM381202     1  0.4256      0.169 0.564 0.000 0.436 0.000 0.000
#> GSM381207     1  0.0162      0.884 0.996 0.000 0.000 0.000 0.004
#> GSM381208     5  0.3323      0.764 0.000 0.056 0.000 0.100 0.844
#> GSM381210     1  0.0162      0.884 0.996 0.000 0.004 0.000 0.000
#> GSM381215     3  0.3242      0.726 0.000 0.000 0.784 0.000 0.216
#> GSM381219     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381221     2  0.0162      0.982 0.000 0.996 0.004 0.000 0.000
#> GSM381223     2  0.1124      0.976 0.000 0.960 0.004 0.000 0.036
#> GSM381229     5  0.2124      0.821 0.000 0.000 0.096 0.004 0.900
#> GSM381230     1  0.0000      0.885 1.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.4126      0.487 0.620 0.000 0.380 0.000 0.000
#> GSM381234     1  0.0162      0.884 0.996 0.000 0.000 0.000 0.004
#> GSM381238     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381242     3  0.1357      0.751 0.048 0.000 0.948 0.000 0.004
#> GSM381247     2  0.1357      0.972 0.000 0.948 0.004 0.000 0.048
#> GSM381248     1  0.2230      0.798 0.884 0.000 0.000 0.000 0.116
#> GSM381249     1  0.4015      0.545 0.652 0.000 0.348 0.000 0.000
#> GSM381253     3  0.5754      0.642 0.260 0.000 0.604 0.000 0.136
#> GSM381255     2  0.0162      0.981 0.000 0.996 0.000 0.000 0.004
#> GSM381258     3  0.0451      0.756 0.004 0.000 0.988 0.000 0.008
#> GSM381262     3  0.3266      0.741 0.004 0.000 0.796 0.000 0.200
#> GSM381266     5  0.5000      0.171 0.000 0.000 0.388 0.036 0.576
#> GSM381267     5  0.3269      0.764 0.000 0.056 0.000 0.096 0.848
#> GSM381269     3  0.2561      0.671 0.144 0.000 0.856 0.000 0.000
#> GSM381273     5  0.1893      0.869 0.000 0.000 0.048 0.024 0.928
#> GSM381274     2  0.1124      0.976 0.000 0.960 0.004 0.000 0.036
#> GSM381276     3  0.4901      0.714 0.196 0.000 0.708 0.000 0.096

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     6  0.4844     0.6757 0.000 0.000 0.440 0.000 0.056 0.504
#> GSM381199     2  0.2020     0.7785 0.000 0.896 0.000 0.000 0.008 0.096
#> GSM381205     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381211     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381220     2  0.3898     0.8097 0.000 0.652 0.000 0.000 0.012 0.336
#> GSM381222     3  0.4123     0.2269 0.420 0.000 0.568 0.000 0.000 0.012
#> GSM381224     1  0.3936     0.5021 0.688 0.000 0.288 0.000 0.000 0.024
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381240     1  0.0260     0.9300 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM381250     6  0.6363     0.7442 0.136 0.000 0.304 0.000 0.056 0.504
#> GSM381252     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381254     1  0.0260     0.9300 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM381256     2  0.3592     0.8164 0.000 0.656 0.000 0.000 0.000 0.344
#> GSM381257     1  0.1421     0.8920 0.944 0.000 0.028 0.000 0.000 0.028
#> GSM381259     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.6031     0.0255 0.216 0.000 0.568 0.000 0.036 0.180
#> GSM381261     2  0.0146     0.7566 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM381263     6  0.6267     0.7288 0.124 0.000 0.344 0.000 0.048 0.484
#> GSM381265     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381268     6  0.5258     0.7038 0.004 0.000 0.384 0.000 0.088 0.524
#> GSM381270     2  0.0725     0.7475 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     2  0.0146     0.7596 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381279     2  0.0725     0.7475 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM381195     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381196     6  0.6430     0.7425 0.132 0.000 0.276 0.000 0.072 0.520
#> GSM381198     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381200     2  0.2146     0.7873 0.000 0.880 0.000 0.000 0.004 0.116
#> GSM381201     5  0.0363     0.8449 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM381203     6  0.6608     0.3899 0.352 0.000 0.200 0.000 0.040 0.408
#> GSM381204     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.3690     0.8026 0.000 0.684 0.000 0.000 0.008 0.308
#> GSM381214     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381216     3  0.0000     0.4967 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381225     6  0.4802     0.6912 0.000 0.000 0.404 0.000 0.056 0.540
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381235     3  0.0937     0.4764 0.000 0.000 0.960 0.000 0.000 0.040
#> GSM381237     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381243     2  0.0725     0.7475 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM381245     1  0.0363     0.9287 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM381246     2  0.3774     0.8118 0.000 0.592 0.000 0.000 0.000 0.408
#> GSM381251     5  0.0632     0.8404 0.000 0.000 0.000 0.000 0.976 0.024
#> GSM381264     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381217     3  0.1265     0.4754 0.008 0.000 0.948 0.000 0.000 0.044
#> GSM381218     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381226     2  0.2941     0.8050 0.000 0.780 0.000 0.000 0.000 0.220
#> GSM381227     2  0.0622     0.7493 0.000 0.980 0.000 0.000 0.008 0.012
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     5  0.0891     0.8361 0.000 0.000 0.024 0.000 0.968 0.008
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     1  0.1418     0.8978 0.944 0.000 0.024 0.000 0.000 0.032
#> GSM381278     3  0.4943    -0.4541 0.000 0.000 0.564 0.016 0.040 0.380
#> GSM381197     5  0.0508     0.8446 0.000 0.000 0.004 0.000 0.984 0.012
#> GSM381202     1  0.4592    -0.0811 0.496 0.000 0.468 0.000 0.000 0.036
#> GSM381207     1  0.0363     0.9288 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM381208     5  0.1010     0.8193 0.000 0.000 0.000 0.004 0.960 0.036
#> GSM381210     1  0.0458     0.9234 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM381215     3  0.4872    -0.4840 0.000 0.000 0.548 0.000 0.064 0.388
#> GSM381219     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381221     2  0.3309     0.8138 0.000 0.720 0.000 0.000 0.000 0.280
#> GSM381223     2  0.0146     0.7596 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381229     5  0.4396     0.3472 0.000 0.000 0.036 0.000 0.612 0.352
#> GSM381230     1  0.0000     0.9321 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381233     3  0.4057     0.2997 0.388 0.000 0.600 0.000 0.000 0.012
#> GSM381234     1  0.0146     0.9311 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     3  0.1562     0.5036 0.032 0.000 0.940 0.000 0.004 0.024
#> GSM381247     2  0.0725     0.7475 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM381248     1  0.2389     0.7962 0.864 0.000 0.000 0.000 0.128 0.008
#> GSM381249     3  0.4025     0.2422 0.416 0.000 0.576 0.000 0.000 0.008
#> GSM381253     6  0.6378     0.7206 0.164 0.000 0.280 0.000 0.048 0.508
#> GSM381255     2  0.3817     0.8084 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM381258     3  0.0363     0.4925 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM381262     6  0.4868     0.6925 0.000 0.000 0.416 0.000 0.060 0.524
#> GSM381266     5  0.6684    -0.1889 0.000 0.000 0.212 0.044 0.412 0.332
#> GSM381267     5  0.1268     0.8152 0.000 0.008 0.000 0.004 0.952 0.036
#> GSM381269     3  0.1588     0.5093 0.072 0.000 0.924 0.000 0.000 0.004
#> GSM381273     5  0.0363     0.8449 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM381274     2  0.0458     0.7635 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM381276     3  0.6129    -0.4619 0.160 0.000 0.452 0.000 0.020 0.368

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 other(p) k
#> CV:skmeans 78    0.572 2
#> CV:skmeans 86    0.153 3
#> CV:skmeans 78    0.630 4
#> CV:skmeans 82    0.401 5
#> CV:skmeans 71    0.266 6

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


CV:pam**

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

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

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

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

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.992       0.997          0.451 0.548   0.548
#> 3 3 1.000           0.987       0.994          0.239 0.893   0.804
#> 4 4 0.832           0.935       0.950          0.158 0.922   0.825
#> 5 5 0.845           0.922       0.943          0.149 0.881   0.677
#> 6 6 0.959           0.916       0.968          0.067 0.962   0.846

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM381194     1    0.00      1.000 1.000 0.000
#> GSM381199     2    0.00      0.990 0.000 1.000
#> GSM381205     2    0.00      0.990 0.000 1.000
#> GSM381211     2    0.00      0.990 0.000 1.000
#> GSM381220     2    0.00      0.990 0.000 1.000
#> GSM381222     1    0.00      1.000 1.000 0.000
#> GSM381224     1    0.00      1.000 1.000 0.000
#> GSM381232     1    0.00      1.000 1.000 0.000
#> GSM381240     1    0.00      1.000 1.000 0.000
#> GSM381250     1    0.00      1.000 1.000 0.000
#> GSM381252     2    0.00      0.990 0.000 1.000
#> GSM381254     1    0.00      1.000 1.000 0.000
#> GSM381256     2    0.00      0.990 0.000 1.000
#> GSM381257     1    0.00      1.000 1.000 0.000
#> GSM381259     1    0.00      1.000 1.000 0.000
#> GSM381260     1    0.00      1.000 1.000 0.000
#> GSM381261     2    0.00      0.990 0.000 1.000
#> GSM381263     1    0.00      1.000 1.000 0.000
#> GSM381265     1    0.00      1.000 1.000 0.000
#> GSM381268     1    0.00      1.000 1.000 0.000
#> GSM381270     2    0.00      0.990 0.000 1.000
#> GSM381271     1    0.00      1.000 1.000 0.000
#> GSM381275     2    0.00      0.990 0.000 1.000
#> GSM381279     2    0.00      0.990 0.000 1.000
#> GSM381195     1    0.00      1.000 1.000 0.000
#> GSM381196     1    0.00      1.000 1.000 0.000
#> GSM381198     2    0.00      0.990 0.000 1.000
#> GSM381200     2    0.00      0.990 0.000 1.000
#> GSM381201     1    0.00      1.000 1.000 0.000
#> GSM381203     1    0.00      1.000 1.000 0.000
#> GSM381204     1    0.00      1.000 1.000 0.000
#> GSM381209     1    0.00      1.000 1.000 0.000
#> GSM381212     1    0.00      1.000 1.000 0.000
#> GSM381213     2    0.00      0.990 0.000 1.000
#> GSM381214     2    0.00      0.990 0.000 1.000
#> GSM381216     1    0.00      1.000 1.000 0.000
#> GSM381225     1    0.00      1.000 1.000 0.000
#> GSM381231     1    0.00      1.000 1.000 0.000
#> GSM381235     1    0.00      1.000 1.000 0.000
#> GSM381237     1    0.00      1.000 1.000 0.000
#> GSM381241     2    0.00      0.990 0.000 1.000
#> GSM381243     2    0.00      0.990 0.000 1.000
#> GSM381245     1    0.00      1.000 1.000 0.000
#> GSM381246     2    0.00      0.990 0.000 1.000
#> GSM381251     1    0.00      1.000 1.000 0.000
#> GSM381264     1    0.00      1.000 1.000 0.000
#> GSM381206     2    0.00      0.990 0.000 1.000
#> GSM381217     1    0.00      1.000 1.000 0.000
#> GSM381218     2    0.00      0.990 0.000 1.000
#> GSM381226     2    0.00      0.990 0.000 1.000
#> GSM381227     2    0.00      0.990 0.000 1.000
#> GSM381228     1    0.00      1.000 1.000 0.000
#> GSM381236     1    0.00      1.000 1.000 0.000
#> GSM381244     1    0.00      1.000 1.000 0.000
#> GSM381272     1    0.00      1.000 1.000 0.000
#> GSM381277     1    0.00      1.000 1.000 0.000
#> GSM381278     1    0.00      1.000 1.000 0.000
#> GSM381197     1    0.00      1.000 1.000 0.000
#> GSM381202     1    0.00      1.000 1.000 0.000
#> GSM381207     1    0.00      1.000 1.000 0.000
#> GSM381208     2    0.85      0.619 0.276 0.724
#> GSM381210     1    0.00      1.000 1.000 0.000
#> GSM381215     1    0.00      1.000 1.000 0.000
#> GSM381219     2    0.00      0.990 0.000 1.000
#> GSM381221     2    0.00      0.990 0.000 1.000
#> GSM381223     2    0.00      0.990 0.000 1.000
#> GSM381229     1    0.00      1.000 1.000 0.000
#> GSM381230     1    0.00      1.000 1.000 0.000
#> GSM381233     1    0.00      1.000 1.000 0.000
#> GSM381234     1    0.00      1.000 1.000 0.000
#> GSM381238     1    0.00      1.000 1.000 0.000
#> GSM381239     1    0.00      1.000 1.000 0.000
#> GSM381242     1    0.00      1.000 1.000 0.000
#> GSM381247     2    0.00      0.990 0.000 1.000
#> GSM381248     1    0.00      1.000 1.000 0.000
#> GSM381249     1    0.00      1.000 1.000 0.000
#> GSM381253     1    0.00      1.000 1.000 0.000
#> GSM381255     2    0.00      0.990 0.000 1.000
#> GSM381258     1    0.00      1.000 1.000 0.000
#> GSM381262     1    0.00      1.000 1.000 0.000
#> GSM381266     1    0.00      1.000 1.000 0.000
#> GSM381267     2    0.00      0.990 0.000 1.000
#> GSM381269     1    0.00      1.000 1.000 0.000
#> GSM381273     1    0.00      1.000 1.000 0.000
#> GSM381274     2    0.00      0.990 0.000 1.000
#> GSM381276     1    0.00      1.000 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
#> GSM381194     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381199     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381205     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381211     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381220     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381222     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381224     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381232     3  0.0747      1.000 0.016 0.000 0.984
#> GSM381240     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381250     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381252     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381254     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381256     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381257     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381259     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381260     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381261     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381263     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381265     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381268     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381270     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381271     3  0.0747      1.000 0.016 0.000 0.984
#> GSM381275     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381279     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381195     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381196     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381198     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381200     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381201     1  0.0747      0.985 0.984 0.000 0.016
#> GSM381203     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381204     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381209     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381212     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381213     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381214     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381216     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381225     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381231     3  0.0747      1.000 0.016 0.000 0.984
#> GSM381235     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381237     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381241     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381243     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381245     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381246     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381251     1  0.0747      0.985 0.984 0.000 0.016
#> GSM381264     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381206     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381217     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381218     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381226     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381227     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381228     3  0.0747      1.000 0.016 0.000 0.984
#> GSM381236     3  0.0747      1.000 0.016 0.000 0.984
#> GSM381244     1  0.0747      0.985 0.984 0.000 0.016
#> GSM381272     3  0.0747      1.000 0.016 0.000 0.984
#> GSM381277     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381278     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381197     1  0.0747      0.985 0.984 0.000 0.016
#> GSM381202     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381207     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381208     2  0.6161      0.518 0.272 0.708 0.020
#> GSM381210     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381215     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381219     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381221     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381223     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381229     1  0.0592      0.988 0.988 0.000 0.012
#> GSM381230     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381233     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381234     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381238     3  0.0747      1.000 0.016 0.000 0.984
#> GSM381239     3  0.0747      1.000 0.016 0.000 0.984
#> GSM381242     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381247     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381248     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381249     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381253     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381255     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381258     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381262     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381266     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381267     2  0.0747      0.970 0.000 0.984 0.016
#> GSM381269     1  0.0000      0.998 1.000 0.000 0.000
#> GSM381273     1  0.0747      0.985 0.984 0.000 0.016
#> GSM381274     2  0.0000      0.985 0.000 1.000 0.000
#> GSM381276     1  0.0000      0.998 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
#> GSM381194     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381199     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381205     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381211     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381220     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381222     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381224     1  0.2973      0.881 0.856 0.000 0.144  0
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000  1
#> GSM381240     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381250     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381252     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381254     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381256     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381257     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381259     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381260     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381261     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381263     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381265     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381268     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381270     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000  1
#> GSM381275     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381279     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381195     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381196     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381198     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381200     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381201     3  0.3356      0.897 0.176 0.000 0.824  0
#> GSM381203     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381204     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381209     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381212     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381213     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381214     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381216     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381225     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000  1
#> GSM381235     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381237     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381241     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381243     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381245     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381246     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381251     3  0.3356      0.897 0.176 0.000 0.824  0
#> GSM381264     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381206     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381217     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381218     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381226     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381227     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000  1
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000  1
#> GSM381244     3  0.3356      0.897 0.176 0.000 0.824  0
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000  1
#> GSM381277     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381278     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381197     3  0.3356      0.897 0.176 0.000 0.824  0
#> GSM381202     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381207     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381208     3  0.4037      0.752 0.040 0.136 0.824  0
#> GSM381210     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381215     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381219     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381221     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381223     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381229     1  0.2704      0.787 0.876 0.000 0.124  0
#> GSM381230     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381233     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381234     1  0.3356      0.870 0.824 0.000 0.176  0
#> GSM381238     4  0.0000      1.000 0.000 0.000 0.000  1
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000  1
#> GSM381242     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381247     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381248     1  0.3172      0.876 0.840 0.000 0.160  0
#> GSM381249     1  0.3266      0.873 0.832 0.000 0.168  0
#> GSM381253     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381255     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381258     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381262     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381266     1  0.0000      0.918 1.000 0.000 0.000  0
#> GSM381267     3  0.3356      0.684 0.000 0.176 0.824  0
#> GSM381269     1  0.0188      0.917 0.996 0.000 0.004  0
#> GSM381273     3  0.3356      0.897 0.176 0.000 0.824  0
#> GSM381274     2  0.0000      1.000 0.000 1.000 0.000  0
#> GSM381276     1  0.0000      0.918 1.000 0.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3 p4    p5
#> GSM381194     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381199     2  0.2561     0.9019 0.144 0.856 0.000  0 0.000
#> GSM381205     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381211     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381220     2  0.2377     0.9100 0.128 0.872 0.000  0 0.000
#> GSM381222     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381224     3  0.4297    -0.2193 0.472 0.000 0.528  0 0.000
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381240     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381250     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381252     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381254     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381256     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381257     3  0.0290     0.9412 0.008 0.000 0.992  0 0.000
#> GSM381259     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381260     3  0.1478     0.8837 0.064 0.000 0.936  0 0.000
#> GSM381261     2  0.1121     0.9446 0.044 0.956 0.000  0 0.000
#> GSM381263     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381265     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381268     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381270     2  0.2561     0.9019 0.144 0.856 0.000  0 0.000
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381275     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381279     2  0.2561     0.9019 0.144 0.856 0.000  0 0.000
#> GSM381195     1  0.3274     0.8882 0.780 0.000 0.220  0 0.000
#> GSM381196     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381198     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381200     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381201     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000
#> GSM381203     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381204     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381209     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381212     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381213     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381214     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381216     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381225     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381235     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381237     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381241     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381243     2  0.2561     0.9019 0.144 0.856 0.000  0 0.000
#> GSM381245     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381246     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381251     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000
#> GSM381264     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381206     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381217     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381218     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381226     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381227     2  0.2561     0.9019 0.144 0.856 0.000  0 0.000
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381244     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381277     1  0.2605     0.9572 0.852 0.000 0.148  0 0.000
#> GSM381278     3  0.0290     0.9398 0.008 0.000 0.992  0 0.000
#> GSM381197     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000
#> GSM381202     3  0.1792     0.8614 0.084 0.000 0.916  0 0.000
#> GSM381207     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381208     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000
#> GSM381210     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381215     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381219     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381221     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381223     2  0.2377     0.9101 0.128 0.872 0.000  0 0.000
#> GSM381229     3  0.2329     0.8100 0.000 0.000 0.876  0 0.124
#> GSM381230     1  0.2561     0.9603 0.856 0.000 0.144  0 0.000
#> GSM381233     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381234     1  0.3210     0.8976 0.788 0.000 0.212  0 0.000
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381242     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381247     2  0.2561     0.9019 0.144 0.856 0.000  0 0.000
#> GSM381248     3  0.4242    -0.0433 0.428 0.000 0.572  0 0.000
#> GSM381249     1  0.4210     0.5348 0.588 0.000 0.412  0 0.000
#> GSM381253     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381255     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381258     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381262     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381266     3  0.0000     0.9475 0.000 0.000 1.000  0 0.000
#> GSM381267     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000
#> GSM381269     3  0.0162     0.9444 0.004 0.000 0.996  0 0.000
#> GSM381273     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000
#> GSM381274     2  0.0000     0.9600 0.000 1.000 0.000  0 0.000
#> GSM381276     3  0.0000     0.9475 0.000 0.000 1.000  0 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
#> GSM381194     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381199     6  0.0937     0.9543 0.000 0.040 0.000  0 0.000 0.960
#> GSM381205     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381211     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381220     6  0.0632     0.9663 0.000 0.024 0.000  0 0.000 0.976
#> GSM381222     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381224     3  0.3862     0.0225 0.476 0.000 0.524  0 0.000 0.000
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381240     1  0.0000     0.9276 1.000 0.000 0.000  0 0.000 0.000
#> GSM381250     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381252     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381254     1  0.0260     0.9257 0.992 0.000 0.008  0 0.000 0.000
#> GSM381256     2  0.0363     0.9574 0.000 0.988 0.000  0 0.000 0.012
#> GSM381257     3  0.0260     0.9464 0.008 0.000 0.992  0 0.000 0.000
#> GSM381259     1  0.0000     0.9276 1.000 0.000 0.000  0 0.000 0.000
#> GSM381260     3  0.1387     0.8948 0.068 0.000 0.932  0 0.000 0.000
#> GSM381261     2  0.3804     0.2910 0.000 0.576 0.000  0 0.000 0.424
#> GSM381263     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381265     1  0.0000     0.9276 1.000 0.000 0.000  0 0.000 0.000
#> GSM381268     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381270     6  0.0000     0.9838 0.000 0.000 0.000  0 0.000 1.000
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381275     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381279     6  0.0000     0.9838 0.000 0.000 0.000  0 0.000 1.000
#> GSM381195     1  0.2300     0.7908 0.856 0.000 0.144  0 0.000 0.000
#> GSM381196     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381198     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381200     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381201     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000 0.000
#> GSM381203     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381204     1  0.0000     0.9276 1.000 0.000 0.000  0 0.000 0.000
#> GSM381209     1  0.0000     0.9276 1.000 0.000 0.000  0 0.000 0.000
#> GSM381212     1  0.0000     0.9276 1.000 0.000 0.000  0 0.000 0.000
#> GSM381213     2  0.0790     0.9461 0.000 0.968 0.000  0 0.000 0.032
#> GSM381214     2  0.0146     0.9608 0.000 0.996 0.000  0 0.000 0.004
#> GSM381216     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381225     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381235     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381237     1  0.0000     0.9276 1.000 0.000 0.000  0 0.000 0.000
#> GSM381241     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381243     6  0.0000     0.9838 0.000 0.000 0.000  0 0.000 1.000
#> GSM381245     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381246     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381251     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000 0.000
#> GSM381264     1  0.0146     0.9271 0.996 0.000 0.004  0 0.000 0.000
#> GSM381206     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381217     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381218     2  0.0363     0.9574 0.000 0.988 0.000  0 0.000 0.012
#> GSM381226     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381227     6  0.0363     0.9780 0.000 0.012 0.000  0 0.000 0.988
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381244     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000 0.000
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381277     1  0.0632     0.9140 0.976 0.000 0.024  0 0.000 0.000
#> GSM381278     3  0.0260     0.9463 0.000 0.000 0.992  0 0.000 0.008
#> GSM381197     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000 0.000
#> GSM381202     3  0.1957     0.8509 0.112 0.000 0.888  0 0.000 0.000
#> GSM381207     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381208     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000 0.000
#> GSM381210     1  0.0260     0.9260 0.992 0.000 0.008  0 0.000 0.000
#> GSM381215     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381219     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381221     2  0.0000     0.9622 0.000 1.000 0.000  0 0.000 0.000
#> GSM381223     2  0.2562     0.7941 0.000 0.828 0.000  0 0.000 0.172
#> GSM381229     3  0.2092     0.8306 0.000 0.000 0.876  0 0.124 0.000
#> GSM381230     1  0.0260     0.9258 0.992 0.000 0.008  0 0.000 0.000
#> GSM381233     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381234     1  0.2300     0.7936 0.856 0.000 0.144  0 0.000 0.000
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381242     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381247     6  0.0000     0.9838 0.000 0.000 0.000  0 0.000 1.000
#> GSM381248     3  0.3823     0.1680 0.436 0.000 0.564  0 0.000 0.000
#> GSM381249     1  0.3756     0.3378 0.600 0.000 0.400  0 0.000 0.000
#> GSM381253     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381255     2  0.0713     0.9483 0.000 0.972 0.000  0 0.000 0.028
#> GSM381258     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381262     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381266     3  0.0000     0.9518 0.000 0.000 1.000  0 0.000 0.000
#> GSM381267     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000 0.000
#> GSM381269     3  0.0146     0.9492 0.004 0.000 0.996  0 0.000 0.000
#> GSM381273     5  0.0000     1.0000 0.000 0.000 0.000  0 1.000 0.000
#> GSM381274     2  0.0790     0.9461 0.000 0.968 0.000  0 0.000 0.032
#> GSM381276     3  0.0000     0.9518 0.000 0.000 1.000  0 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 other(p) k
#> CV:pam 86    0.744 2
#> CV:pam 86    0.326 3
#> CV:pam 86    0.260 4
#> CV:pam 84    0.360 5
#> CV:pam 82    0.397 6

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


CV:mclust

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

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

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

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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.693           0.881       0.947         0.4821 0.504   0.504
#> 3 3 0.822           0.874       0.917         0.2285 0.852   0.715
#> 4 4 0.849           0.767       0.888         0.1636 0.935   0.833
#> 5 5 0.694           0.587       0.755         0.0751 0.952   0.859
#> 6 6 0.723           0.654       0.824         0.0691 0.812   0.448

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
#> GSM381194     1  0.0376      0.960 0.996 0.004
#> GSM381199     2  0.0000      0.907 0.000 1.000
#> GSM381205     2  0.0000      0.907 0.000 1.000
#> GSM381211     2  0.0000      0.907 0.000 1.000
#> GSM381220     2  0.0000      0.907 0.000 1.000
#> GSM381222     1  0.0000      0.963 1.000 0.000
#> GSM381224     1  0.0000      0.963 1.000 0.000
#> GSM381232     2  0.9460      0.502 0.364 0.636
#> GSM381240     1  0.0000      0.963 1.000 0.000
#> GSM381250     1  0.0000      0.963 1.000 0.000
#> GSM381252     2  0.0000      0.907 0.000 1.000
#> GSM381254     1  0.0000      0.963 1.000 0.000
#> GSM381256     2  0.0000      0.907 0.000 1.000
#> GSM381257     1  0.0000      0.963 1.000 0.000
#> GSM381259     1  0.0000      0.963 1.000 0.000
#> GSM381260     1  0.0000      0.963 1.000 0.000
#> GSM381261     2  0.0000      0.907 0.000 1.000
#> GSM381263     1  0.0000      0.963 1.000 0.000
#> GSM381265     1  0.0000      0.963 1.000 0.000
#> GSM381268     1  0.0000      0.963 1.000 0.000
#> GSM381270     2  0.0000      0.907 0.000 1.000
#> GSM381271     2  0.9460      0.502 0.364 0.636
#> GSM381275     2  0.0000      0.907 0.000 1.000
#> GSM381279     2  0.0000      0.907 0.000 1.000
#> GSM381195     1  0.0000      0.963 1.000 0.000
#> GSM381196     1  0.0000      0.963 1.000 0.000
#> GSM381198     2  0.0000      0.907 0.000 1.000
#> GSM381200     2  0.0000      0.907 0.000 1.000
#> GSM381201     1  0.7453      0.727 0.788 0.212
#> GSM381203     1  0.0000      0.963 1.000 0.000
#> GSM381204     1  0.0000      0.963 1.000 0.000
#> GSM381209     1  0.0000      0.963 1.000 0.000
#> GSM381212     1  0.0000      0.963 1.000 0.000
#> GSM381213     2  0.0000      0.907 0.000 1.000
#> GSM381214     2  0.0000      0.907 0.000 1.000
#> GSM381216     1  0.0000      0.963 1.000 0.000
#> GSM381225     1  0.0938      0.954 0.988 0.012
#> GSM381231     2  0.9460      0.502 0.364 0.636
#> GSM381235     1  0.0000      0.963 1.000 0.000
#> GSM381237     1  0.0000      0.963 1.000 0.000
#> GSM381241     2  0.0000      0.907 0.000 1.000
#> GSM381243     2  0.0000      0.907 0.000 1.000
#> GSM381245     1  0.0000      0.963 1.000 0.000
#> GSM381246     2  0.0000      0.907 0.000 1.000
#> GSM381251     1  0.7453      0.727 0.788 0.212
#> GSM381264     1  0.0000      0.963 1.000 0.000
#> GSM381206     2  0.0000      0.907 0.000 1.000
#> GSM381217     1  0.0000      0.963 1.000 0.000
#> GSM381218     2  0.0000      0.907 0.000 1.000
#> GSM381226     2  0.0000      0.907 0.000 1.000
#> GSM381227     2  0.0000      0.907 0.000 1.000
#> GSM381228     2  0.9460      0.502 0.364 0.636
#> GSM381236     2  0.9460      0.502 0.364 0.636
#> GSM381244     1  0.7453      0.727 0.788 0.212
#> GSM381272     2  0.9460      0.502 0.364 0.636
#> GSM381277     1  0.0000      0.963 1.000 0.000
#> GSM381278     1  0.0938      0.954 0.988 0.012
#> GSM381197     1  0.7453      0.727 0.788 0.212
#> GSM381202     1  0.0000      0.963 1.000 0.000
#> GSM381207     1  0.0000      0.963 1.000 0.000
#> GSM381208     2  0.2778      0.876 0.048 0.952
#> GSM381210     1  0.0000      0.963 1.000 0.000
#> GSM381215     1  0.0000      0.963 1.000 0.000
#> GSM381219     2  0.0000      0.907 0.000 1.000
#> GSM381221     2  0.0000      0.907 0.000 1.000
#> GSM381223     2  0.0000      0.907 0.000 1.000
#> GSM381229     1  0.7453      0.727 0.788 0.212
#> GSM381230     1  0.0000      0.963 1.000 0.000
#> GSM381233     1  0.0000      0.963 1.000 0.000
#> GSM381234     1  0.0000      0.963 1.000 0.000
#> GSM381238     2  0.9460      0.502 0.364 0.636
#> GSM381239     2  0.9460      0.502 0.364 0.636
#> GSM381242     1  0.0000      0.963 1.000 0.000
#> GSM381247     2  0.0000      0.907 0.000 1.000
#> GSM381248     1  0.0000      0.963 1.000 0.000
#> GSM381249     1  0.0000      0.963 1.000 0.000
#> GSM381253     1  0.0000      0.963 1.000 0.000
#> GSM381255     2  0.0000      0.907 0.000 1.000
#> GSM381258     1  0.0000      0.963 1.000 0.000
#> GSM381262     1  0.0000      0.963 1.000 0.000
#> GSM381266     1  0.7376      0.733 0.792 0.208
#> GSM381267     2  0.2778      0.876 0.048 0.952
#> GSM381269     1  0.0000      0.963 1.000 0.000
#> GSM381273     1  0.7453      0.727 0.788 0.212
#> GSM381274     2  0.0000      0.907 0.000 1.000
#> GSM381276     1  0.0000      0.963 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
#> GSM381194     1  0.3340      0.810 0.880 0.000 0.120
#> GSM381199     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381205     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381211     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381220     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381222     1  0.0592      0.922 0.988 0.000 0.012
#> GSM381224     1  0.0237      0.922 0.996 0.000 0.004
#> GSM381232     3  0.6976      0.771 0.236 0.064 0.700
#> GSM381240     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381250     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381252     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381254     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381256     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381257     1  0.0892      0.922 0.980 0.000 0.020
#> GSM381259     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381260     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381261     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381263     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381265     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381268     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381270     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381271     3  0.6976      0.771 0.236 0.064 0.700
#> GSM381275     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381279     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381195     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381196     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381198     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381200     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381201     3  0.6026      0.529 0.376 0.000 0.624
#> GSM381203     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381204     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381209     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381212     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381213     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381214     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381216     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381225     1  0.3340      0.810 0.880 0.000 0.120
#> GSM381231     3  0.6976      0.771 0.236 0.064 0.700
#> GSM381235     1  0.1163      0.917 0.972 0.000 0.028
#> GSM381237     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381241     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381243     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381245     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381246     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381251     3  0.6111      0.489 0.396 0.000 0.604
#> GSM381264     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381206     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381217     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381218     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381226     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381227     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381228     3  0.6976      0.771 0.236 0.064 0.700
#> GSM381236     3  0.6976      0.771 0.236 0.064 0.700
#> GSM381244     3  0.6062      0.515 0.384 0.000 0.616
#> GSM381272     3  0.6976      0.771 0.236 0.064 0.700
#> GSM381277     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381278     1  0.5431      0.441 0.716 0.000 0.284
#> GSM381197     3  0.6026      0.529 0.376 0.000 0.624
#> GSM381202     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381207     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381208     3  0.2680      0.627 0.008 0.068 0.924
#> GSM381210     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381215     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381219     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381221     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381223     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381229     1  0.5835      0.256 0.660 0.000 0.340
#> GSM381230     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381233     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381234     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381238     3  0.6976      0.771 0.236 0.064 0.700
#> GSM381239     3  0.6976      0.771 0.236 0.064 0.700
#> GSM381242     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381247     2  0.2261      0.919 0.000 0.932 0.068
#> GSM381248     1  0.1529      0.919 0.960 0.000 0.040
#> GSM381249     1  0.1163      0.921 0.972 0.000 0.028
#> GSM381253     1  0.1031      0.919 0.976 0.000 0.024
#> GSM381255     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381258     1  0.1753      0.901 0.952 0.000 0.048
#> GSM381262     1  0.2878      0.844 0.904 0.000 0.096
#> GSM381266     1  0.5835      0.252 0.660 0.000 0.340
#> GSM381267     3  0.2680      0.627 0.008 0.068 0.924
#> GSM381269     1  0.1163      0.917 0.972 0.000 0.028
#> GSM381273     3  0.6026      0.529 0.376 0.000 0.624
#> GSM381274     2  0.0000      0.997 0.000 1.000 0.000
#> GSM381276     1  0.0237      0.922 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     1  0.7003     0.0789 0.460 0.000 0.424 0.116
#> GSM381199     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381205     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381211     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381220     2  0.0188     0.9693 0.000 0.996 0.004 0.000
#> GSM381222     1  0.1022     0.8214 0.968 0.000 0.032 0.000
#> GSM381224     1  0.1209     0.8199 0.964 0.000 0.032 0.004
#> GSM381232     4  0.0469     0.8260 0.012 0.000 0.000 0.988
#> GSM381240     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381250     1  0.4713     0.4779 0.640 0.000 0.360 0.000
#> GSM381252     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381254     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381256     2  0.0000     0.9693 0.000 1.000 0.000 0.000
#> GSM381257     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381259     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381260     1  0.5028     0.4168 0.596 0.000 0.400 0.004
#> GSM381261     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381263     1  0.4843     0.4459 0.604 0.000 0.396 0.000
#> GSM381265     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381268     1  0.4830     0.4520 0.608 0.000 0.392 0.000
#> GSM381270     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381271     4  0.0000     0.8341 0.000 0.000 0.000 1.000
#> GSM381275     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381279     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381195     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381196     1  0.0188     0.8254 0.996 0.000 0.004 0.000
#> GSM381198     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381200     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381201     3  0.2773     0.7290 0.004 0.000 0.880 0.116
#> GSM381203     1  0.0336     0.8241 0.992 0.000 0.008 0.000
#> GSM381204     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381213     2  0.1118     0.9660 0.000 0.964 0.036 0.000
#> GSM381214     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381216     1  0.5268     0.4394 0.592 0.000 0.396 0.012
#> GSM381225     3  0.7043     0.1829 0.368 0.000 0.504 0.128
#> GSM381231     4  0.0000     0.8341 0.000 0.000 0.000 1.000
#> GSM381235     1  0.4560     0.5938 0.700 0.000 0.296 0.004
#> GSM381237     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381241     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381243     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381245     1  0.0188     0.8243 0.996 0.000 0.004 0.000
#> GSM381246     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381251     3  0.2773     0.7290 0.004 0.000 0.880 0.116
#> GSM381264     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381206     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381217     1  0.4328     0.6505 0.748 0.000 0.244 0.008
#> GSM381218     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381226     2  0.0188     0.9693 0.000 0.996 0.004 0.000
#> GSM381227     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381228     4  0.0000     0.8341 0.000 0.000 0.000 1.000
#> GSM381236     4  0.0000     0.8341 0.000 0.000 0.000 1.000
#> GSM381244     3  0.2773     0.7290 0.004 0.000 0.880 0.116
#> GSM381272     4  0.0000     0.8341 0.000 0.000 0.000 1.000
#> GSM381277     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381278     4  0.7841    -0.3117 0.356 0.000 0.264 0.380
#> GSM381197     3  0.2773     0.7290 0.004 0.000 0.880 0.116
#> GSM381202     1  0.0592     0.8249 0.984 0.000 0.016 0.000
#> GSM381207     1  0.0817     0.8238 0.976 0.000 0.024 0.000
#> GSM381208     4  0.4585     0.5308 0.000 0.000 0.332 0.668
#> GSM381210     1  0.0817     0.8238 0.976 0.000 0.024 0.000
#> GSM381215     1  0.4877     0.4368 0.592 0.000 0.408 0.000
#> GSM381219     2  0.1792     0.9611 0.000 0.932 0.068 0.000
#> GSM381221     2  0.0188     0.9693 0.000 0.996 0.004 0.000
#> GSM381223     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381229     3  0.5434     0.6518 0.132 0.000 0.740 0.128
#> GSM381230     1  0.0921     0.8227 0.972 0.000 0.028 0.000
#> GSM381233     1  0.1022     0.8214 0.968 0.000 0.032 0.000
#> GSM381234     1  0.0000     0.8261 1.000 0.000 0.000 0.000
#> GSM381238     4  0.0592     0.8216 0.016 0.000 0.000 0.984
#> GSM381239     4  0.0336     0.8311 0.000 0.000 0.008 0.992
#> GSM381242     1  0.5080     0.4037 0.576 0.000 0.420 0.004
#> GSM381247     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381248     1  0.0188     0.8243 0.996 0.000 0.004 0.000
#> GSM381249     1  0.1022     0.8214 0.968 0.000 0.032 0.000
#> GSM381253     1  0.0817     0.8238 0.976 0.000 0.024 0.000
#> GSM381255     2  0.1867     0.9603 0.000 0.928 0.072 0.000
#> GSM381258     1  0.5550     0.3555 0.552 0.000 0.428 0.020
#> GSM381262     1  0.5888     0.3294 0.540 0.000 0.424 0.036
#> GSM381266     3  0.7527     0.3015 0.356 0.000 0.452 0.192
#> GSM381267     4  0.4585     0.5308 0.000 0.000 0.332 0.668
#> GSM381269     1  0.5435     0.3779 0.564 0.000 0.420 0.016
#> GSM381273     3  0.2831     0.7252 0.004 0.000 0.876 0.120
#> GSM381274     2  0.0336     0.9689 0.000 0.992 0.008 0.000
#> GSM381276     1  0.1118     0.8204 0.964 0.000 0.036 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
#> GSM381194     3  0.7160     -0.051 0.388 0.000 0.436 0.108 0.068
#> GSM381199     2  0.1732      0.813 0.000 0.920 0.000 0.000 0.080
#> GSM381205     2  0.4210      0.794 0.000 0.588 0.000 0.000 0.412
#> GSM381211     2  0.4201      0.795 0.000 0.592 0.000 0.000 0.408
#> GSM381220     2  0.1851      0.817 0.000 0.912 0.000 0.000 0.088
#> GSM381222     1  0.2230      0.688 0.884 0.000 0.116 0.000 0.000
#> GSM381224     1  0.2612      0.683 0.868 0.000 0.124 0.008 0.000
#> GSM381232     4  0.0000      0.841 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.2074      0.667 0.896 0.000 0.000 0.000 0.104
#> GSM381250     1  0.4201      0.391 0.592 0.000 0.408 0.000 0.000
#> GSM381252     2  0.4192      0.797 0.000 0.596 0.000 0.000 0.404
#> GSM381254     1  0.0703      0.698 0.976 0.000 0.000 0.000 0.024
#> GSM381256     2  0.3305      0.820 0.000 0.776 0.000 0.000 0.224
#> GSM381257     1  0.0794      0.702 0.972 0.000 0.028 0.000 0.000
#> GSM381259     1  0.2074      0.667 0.896 0.000 0.000 0.000 0.104
#> GSM381260     1  0.4549      0.304 0.528 0.000 0.464 0.000 0.008
#> GSM381261     2  0.1410      0.778 0.000 0.940 0.000 0.000 0.060
#> GSM381263     1  0.4907      0.252 0.492 0.000 0.484 0.000 0.024
#> GSM381265     1  0.2074      0.667 0.896 0.000 0.000 0.000 0.104
#> GSM381268     1  0.5103      0.284 0.512 0.000 0.452 0.000 0.036
#> GSM381270     2  0.0880      0.792 0.000 0.968 0.000 0.000 0.032
#> GSM381271     4  0.0000      0.841 0.000 0.000 0.000 1.000 0.000
#> GSM381275     2  0.1121      0.788 0.000 0.956 0.000 0.000 0.044
#> GSM381279     2  0.0703      0.799 0.000 0.976 0.000 0.000 0.024
#> GSM381195     1  0.0992      0.698 0.968 0.000 0.008 0.000 0.024
#> GSM381196     1  0.3816      0.534 0.696 0.000 0.304 0.000 0.000
#> GSM381198     2  0.4210      0.794 0.000 0.588 0.000 0.000 0.412
#> GSM381200     2  0.3636      0.818 0.000 0.728 0.000 0.000 0.272
#> GSM381201     3  0.6222      0.192 0.016 0.000 0.528 0.100 0.356
#> GSM381203     1  0.3932      0.508 0.672 0.000 0.328 0.000 0.000
#> GSM381204     1  0.2074      0.667 0.896 0.000 0.000 0.000 0.104
#> GSM381209     1  0.2358      0.666 0.888 0.000 0.008 0.000 0.104
#> GSM381212     1  0.2358      0.666 0.888 0.000 0.008 0.000 0.104
#> GSM381213     2  0.2852      0.821 0.000 0.828 0.000 0.000 0.172
#> GSM381214     2  0.4201      0.795 0.000 0.592 0.000 0.000 0.408
#> GSM381216     1  0.4747      0.278 0.496 0.000 0.488 0.016 0.000
#> GSM381225     3  0.6650      0.117 0.324 0.000 0.536 0.060 0.080
#> GSM381231     4  0.0000      0.841 0.000 0.000 0.000 1.000 0.000
#> GSM381235     1  0.4989      0.336 0.520 0.000 0.456 0.016 0.008
#> GSM381237     1  0.2074      0.667 0.896 0.000 0.000 0.000 0.104
#> GSM381241     2  0.4201      0.795 0.000 0.592 0.000 0.000 0.408
#> GSM381243     2  0.0880      0.795 0.000 0.968 0.000 0.000 0.032
#> GSM381245     1  0.1041      0.702 0.964 0.000 0.032 0.000 0.004
#> GSM381246     2  0.4182      0.799 0.000 0.600 0.000 0.000 0.400
#> GSM381251     3  0.5783      0.198 0.000 0.000 0.540 0.100 0.360
#> GSM381264     1  0.2074      0.667 0.896 0.000 0.000 0.000 0.104
#> GSM381206     2  0.4182      0.798 0.000 0.600 0.000 0.000 0.400
#> GSM381217     1  0.4689      0.404 0.560 0.000 0.424 0.016 0.000
#> GSM381218     2  0.4210      0.794 0.000 0.588 0.000 0.000 0.412
#> GSM381226     2  0.1851      0.821 0.000 0.912 0.000 0.000 0.088
#> GSM381227     2  0.1043      0.809 0.000 0.960 0.000 0.000 0.040
#> GSM381228     4  0.0000      0.841 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.0000      0.841 0.000 0.000 0.000 1.000 0.000
#> GSM381244     3  0.6375      0.186 0.024 0.000 0.524 0.100 0.352
#> GSM381272     4  0.0000      0.841 0.000 0.000 0.000 1.000 0.000
#> GSM381277     1  0.0703      0.702 0.976 0.000 0.024 0.000 0.000
#> GSM381278     4  0.8026     -0.256 0.188 0.000 0.320 0.380 0.112
#> GSM381197     3  0.5986      0.195 0.016 0.000 0.596 0.100 0.288
#> GSM381202     1  0.3039      0.647 0.808 0.000 0.192 0.000 0.000
#> GSM381207     1  0.1671      0.697 0.924 0.000 0.076 0.000 0.000
#> GSM381208     4  0.5119      0.510 0.000 0.000 0.360 0.592 0.048
#> GSM381210     1  0.3255      0.675 0.848 0.000 0.052 0.000 0.100
#> GSM381215     1  0.5368      0.239 0.480 0.000 0.476 0.008 0.036
#> GSM381219     2  0.4126      0.802 0.000 0.620 0.000 0.000 0.380
#> GSM381221     2  0.2074      0.823 0.000 0.896 0.000 0.000 0.104
#> GSM381223     2  0.1270      0.788 0.000 0.948 0.000 0.000 0.052
#> GSM381229     3  0.6380      0.317 0.108 0.000 0.652 0.132 0.108
#> GSM381230     1  0.3506      0.669 0.832 0.000 0.064 0.000 0.104
#> GSM381233     1  0.2929      0.663 0.820 0.000 0.180 0.000 0.000
#> GSM381234     1  0.1197      0.691 0.952 0.000 0.000 0.000 0.048
#> GSM381238     4  0.0000      0.841 0.000 0.000 0.000 1.000 0.000
#> GSM381239     4  0.0510      0.833 0.000 0.000 0.016 0.984 0.000
#> GSM381242     3  0.4706     -0.331 0.492 0.000 0.496 0.004 0.008
#> GSM381247     2  0.1341      0.780 0.000 0.944 0.000 0.000 0.056
#> GSM381248     1  0.1357      0.700 0.948 0.000 0.048 0.004 0.000
#> GSM381249     1  0.2389      0.688 0.880 0.000 0.116 0.000 0.004
#> GSM381253     1  0.4015      0.514 0.652 0.000 0.348 0.000 0.000
#> GSM381255     2  0.4171      0.797 0.000 0.604 0.000 0.000 0.396
#> GSM381258     3  0.5898     -0.201 0.444 0.000 0.484 0.044 0.028
#> GSM381262     3  0.6362     -0.205 0.440 0.000 0.456 0.040 0.064
#> GSM381266     3  0.8380      0.315 0.272 0.000 0.352 0.172 0.204
#> GSM381267     4  0.5168      0.510 0.000 0.000 0.356 0.592 0.052
#> GSM381269     1  0.4989      0.303 0.520 0.000 0.456 0.016 0.008
#> GSM381273     3  0.6006      0.182 0.004 0.000 0.496 0.100 0.400
#> GSM381274     2  0.1197      0.790 0.000 0.952 0.000 0.000 0.048
#> GSM381276     1  0.4375      0.493 0.628 0.000 0.364 0.004 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
#> GSM381194     3  0.2189     0.7249 0.028 0.000 0.916 0.024 0.028 0.004
#> GSM381199     6  0.3717     0.5384 0.000 0.384 0.000 0.000 0.000 0.616
#> GSM381205     2  0.0000     0.7906 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0458     0.7863 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM381220     2  0.3851    -0.1302 0.000 0.540 0.000 0.000 0.000 0.460
#> GSM381222     3  0.3864    -0.1484 0.480 0.000 0.520 0.000 0.000 0.000
#> GSM381224     3  0.3804    -0.0612 0.424 0.000 0.576 0.000 0.000 0.000
#> GSM381232     4  0.0000     0.8854 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381240     1  0.0260     0.7939 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM381250     3  0.2969     0.7540 0.224 0.000 0.776 0.000 0.000 0.000
#> GSM381252     2  0.0000     0.7906 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381254     1  0.2454     0.7245 0.840 0.000 0.160 0.000 0.000 0.000
#> GSM381256     6  0.3854     0.2339 0.000 0.464 0.000 0.000 0.000 0.536
#> GSM381257     1  0.3684     0.4404 0.628 0.000 0.372 0.000 0.000 0.000
#> GSM381259     1  0.0458     0.7971 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM381260     3  0.3078     0.7612 0.192 0.000 0.796 0.000 0.012 0.000
#> GSM381261     6  0.2135     0.6849 0.000 0.128 0.000 0.000 0.000 0.872
#> GSM381263     3  0.3230     0.7620 0.212 0.000 0.776 0.000 0.012 0.000
#> GSM381265     1  0.0260     0.7939 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM381268     3  0.2793     0.7626 0.200 0.000 0.800 0.000 0.000 0.000
#> GSM381270     6  0.3620     0.5547 0.000 0.352 0.000 0.000 0.000 0.648
#> GSM381271     4  0.0000     0.8854 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     6  0.2664     0.6908 0.000 0.184 0.000 0.000 0.000 0.816
#> GSM381279     6  0.3695     0.5287 0.000 0.376 0.000 0.000 0.000 0.624
#> GSM381195     1  0.2219     0.7429 0.864 0.000 0.136 0.000 0.000 0.000
#> GSM381196     3  0.2941     0.7581 0.220 0.000 0.780 0.000 0.000 0.000
#> GSM381198     2  0.1007     0.7493 0.000 0.956 0.000 0.000 0.000 0.044
#> GSM381200     2  0.2260     0.6632 0.000 0.860 0.000 0.000 0.000 0.140
#> GSM381201     5  0.0767     0.9872 0.012 0.000 0.008 0.004 0.976 0.000
#> GSM381203     3  0.2597     0.7664 0.176 0.000 0.824 0.000 0.000 0.000
#> GSM381204     1  0.0458     0.7971 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM381209     1  0.0458     0.7960 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM381212     1  0.0363     0.7961 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM381213     2  0.3804     0.0105 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM381214     2  0.0363     0.7872 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381216     3  0.1511     0.7498 0.044 0.000 0.940 0.004 0.012 0.000
#> GSM381225     3  0.2711     0.7075 0.036 0.000 0.884 0.016 0.060 0.004
#> GSM381231     4  0.0000     0.8854 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381235     3  0.1578     0.7478 0.048 0.000 0.936 0.004 0.012 0.000
#> GSM381237     1  0.0458     0.7971 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM381241     2  0.0000     0.7906 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381243     6  0.3620     0.5547 0.000 0.352 0.000 0.000 0.000 0.648
#> GSM381245     1  0.3515     0.5220 0.676 0.000 0.324 0.000 0.000 0.000
#> GSM381246     2  0.0146     0.7899 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381251     5  0.0935     0.9754 0.000 0.000 0.032 0.004 0.964 0.000
#> GSM381264     1  0.0458     0.7971 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM381206     2  0.0000     0.7906 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381217     3  0.1477     0.7492 0.048 0.000 0.940 0.004 0.008 0.000
#> GSM381218     2  0.0146     0.7903 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381226     2  0.3737    -0.0468 0.000 0.608 0.000 0.000 0.000 0.392
#> GSM381227     6  0.3817     0.4283 0.000 0.432 0.000 0.000 0.000 0.568
#> GSM381228     4  0.0000     0.8854 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000     0.8854 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     5  0.0870     0.9857 0.012 0.000 0.012 0.004 0.972 0.000
#> GSM381272     4  0.0000     0.8854 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     1  0.3647     0.4618 0.640 0.000 0.360 0.000 0.000 0.000
#> GSM381278     3  0.5388     0.2923 0.024 0.000 0.612 0.284 0.076 0.004
#> GSM381197     5  0.0767     0.9872 0.012 0.000 0.008 0.004 0.976 0.000
#> GSM381202     3  0.3023     0.7381 0.232 0.000 0.768 0.000 0.000 0.000
#> GSM381207     1  0.3774     0.3943 0.592 0.000 0.408 0.000 0.000 0.000
#> GSM381208     4  0.5441     0.2512 0.008 0.000 0.008 0.516 0.396 0.072
#> GSM381210     1  0.1141     0.7920 0.948 0.000 0.052 0.000 0.000 0.000
#> GSM381215     3  0.2416     0.7745 0.156 0.000 0.844 0.000 0.000 0.000
#> GSM381219     2  0.1610     0.7272 0.000 0.916 0.000 0.000 0.000 0.084
#> GSM381221     2  0.3804    -0.1525 0.000 0.576 0.000 0.000 0.000 0.424
#> GSM381223     6  0.2664     0.6908 0.000 0.184 0.000 0.000 0.000 0.816
#> GSM381229     3  0.5780     0.2756 0.144 0.000 0.488 0.008 0.360 0.000
#> GSM381230     1  0.0790     0.7948 0.968 0.000 0.032 0.000 0.000 0.000
#> GSM381233     3  0.2996     0.7378 0.228 0.000 0.772 0.000 0.000 0.000
#> GSM381234     1  0.1267     0.7855 0.940 0.000 0.060 0.000 0.000 0.000
#> GSM381238     4  0.0146     0.8827 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM381239     4  0.0547     0.8736 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM381242     3  0.2980     0.7685 0.180 0.000 0.808 0.000 0.012 0.000
#> GSM381247     6  0.1700     0.6621 0.000 0.080 0.000 0.000 0.004 0.916
#> GSM381248     1  0.3728     0.4957 0.652 0.000 0.344 0.000 0.004 0.000
#> GSM381249     1  0.3867     0.1168 0.512 0.000 0.488 0.000 0.000 0.000
#> GSM381253     3  0.2996     0.7520 0.228 0.000 0.772 0.000 0.000 0.000
#> GSM381255     2  0.0363     0.7872 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381258     3  0.2653     0.7733 0.100 0.000 0.868 0.004 0.028 0.000
#> GSM381262     3  0.2450     0.7555 0.064 0.000 0.896 0.012 0.024 0.004
#> GSM381266     3  0.5680     0.5304 0.144 0.000 0.572 0.016 0.268 0.000
#> GSM381267     4  0.5441     0.2512 0.008 0.000 0.008 0.516 0.396 0.072
#> GSM381269     3  0.2631     0.7772 0.128 0.000 0.856 0.004 0.012 0.000
#> GSM381273     5  0.1036     0.9830 0.008 0.000 0.024 0.004 0.964 0.000
#> GSM381274     6  0.2823     0.6828 0.000 0.204 0.000 0.000 0.000 0.796
#> GSM381276     3  0.2378     0.7643 0.152 0.000 0.848 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-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 other(p) k
#> CV:mclust 86    0.303 2
#> CV:mclust 82    0.168 3
#> CV:mclust 72    0.412 4
#> CV:mclust 63    0.268 5
#> CV:mclust 69    0.113 6

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


CV:NMF**

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

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

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

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

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.976           0.973       0.987         0.4446 0.564   0.564
#> 3 3 0.990           0.963       0.978         0.4845 0.773   0.598
#> 4 4 0.826           0.746       0.869         0.0810 0.958   0.876
#> 5 5 0.837           0.831       0.904         0.0525 0.937   0.796
#> 6 6 0.826           0.801       0.890         0.0457 0.922   0.720

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
#> GSM381194     1  0.0000      0.980 1.000 0.000
#> GSM381199     2  0.0000      1.000 0.000 1.000
#> GSM381205     2  0.0000      1.000 0.000 1.000
#> GSM381211     2  0.0000      1.000 0.000 1.000
#> GSM381220     2  0.0000      1.000 0.000 1.000
#> GSM381222     1  0.0000      0.980 1.000 0.000
#> GSM381224     1  0.0000      0.980 1.000 0.000
#> GSM381232     1  0.6531      0.815 0.832 0.168
#> GSM381240     1  0.0000      0.980 1.000 0.000
#> GSM381250     1  0.0000      0.980 1.000 0.000
#> GSM381252     2  0.0000      1.000 0.000 1.000
#> GSM381254     1  0.0000      0.980 1.000 0.000
#> GSM381256     2  0.0000      1.000 0.000 1.000
#> GSM381257     1  0.0000      0.980 1.000 0.000
#> GSM381259     1  0.0000      0.980 1.000 0.000
#> GSM381260     1  0.0000      0.980 1.000 0.000
#> GSM381261     2  0.0000      1.000 0.000 1.000
#> GSM381263     1  0.0000      0.980 1.000 0.000
#> GSM381265     1  0.0000      0.980 1.000 0.000
#> GSM381268     1  0.0000      0.980 1.000 0.000
#> GSM381270     2  0.0000      1.000 0.000 1.000
#> GSM381271     1  0.2043      0.955 0.968 0.032
#> GSM381275     2  0.0000      1.000 0.000 1.000
#> GSM381279     2  0.0000      1.000 0.000 1.000
#> GSM381195     1  0.0000      0.980 1.000 0.000
#> GSM381196     1  0.0000      0.980 1.000 0.000
#> GSM381198     2  0.0000      1.000 0.000 1.000
#> GSM381200     2  0.0000      1.000 0.000 1.000
#> GSM381201     1  0.0000      0.980 1.000 0.000
#> GSM381203     1  0.0000      0.980 1.000 0.000
#> GSM381204     1  0.0000      0.980 1.000 0.000
#> GSM381209     1  0.0000      0.980 1.000 0.000
#> GSM381212     1  0.0000      0.980 1.000 0.000
#> GSM381213     2  0.0000      1.000 0.000 1.000
#> GSM381214     2  0.0000      1.000 0.000 1.000
#> GSM381216     1  0.0000      0.980 1.000 0.000
#> GSM381225     1  0.0000      0.980 1.000 0.000
#> GSM381231     1  0.6887      0.795 0.816 0.184
#> GSM381235     1  0.0000      0.980 1.000 0.000
#> GSM381237     1  0.0000      0.980 1.000 0.000
#> GSM381241     2  0.0000      1.000 0.000 1.000
#> GSM381243     2  0.0000      1.000 0.000 1.000
#> GSM381245     1  0.0000      0.980 1.000 0.000
#> GSM381246     2  0.0000      1.000 0.000 1.000
#> GSM381251     1  0.0000      0.980 1.000 0.000
#> GSM381264     1  0.0000      0.980 1.000 0.000
#> GSM381206     2  0.0000      1.000 0.000 1.000
#> GSM381217     1  0.0000      0.980 1.000 0.000
#> GSM381218     2  0.0000      1.000 0.000 1.000
#> GSM381226     2  0.0000      1.000 0.000 1.000
#> GSM381227     2  0.0000      1.000 0.000 1.000
#> GSM381228     1  0.5519      0.863 0.872 0.128
#> GSM381236     1  0.5059      0.880 0.888 0.112
#> GSM381244     1  0.0000      0.980 1.000 0.000
#> GSM381272     1  0.2948      0.938 0.948 0.052
#> GSM381277     1  0.0000      0.980 1.000 0.000
#> GSM381278     1  0.0000      0.980 1.000 0.000
#> GSM381197     1  0.0000      0.980 1.000 0.000
#> GSM381202     1  0.0000      0.980 1.000 0.000
#> GSM381207     1  0.0000      0.980 1.000 0.000
#> GSM381208     1  0.0000      0.980 1.000 0.000
#> GSM381210     1  0.0000      0.980 1.000 0.000
#> GSM381215     1  0.0000      0.980 1.000 0.000
#> GSM381219     2  0.0000      1.000 0.000 1.000
#> GSM381221     2  0.0000      1.000 0.000 1.000
#> GSM381223     2  0.0000      1.000 0.000 1.000
#> GSM381229     1  0.0000      0.980 1.000 0.000
#> GSM381230     1  0.0000      0.980 1.000 0.000
#> GSM381233     1  0.0000      0.980 1.000 0.000
#> GSM381234     1  0.0000      0.980 1.000 0.000
#> GSM381238     1  0.8207      0.687 0.744 0.256
#> GSM381239     1  0.7139      0.779 0.804 0.196
#> GSM381242     1  0.0000      0.980 1.000 0.000
#> GSM381247     2  0.0000      1.000 0.000 1.000
#> GSM381248     1  0.0000      0.980 1.000 0.000
#> GSM381249     1  0.0000      0.980 1.000 0.000
#> GSM381253     1  0.0000      0.980 1.000 0.000
#> GSM381255     2  0.0000      1.000 0.000 1.000
#> GSM381258     1  0.0000      0.980 1.000 0.000
#> GSM381262     1  0.0000      0.980 1.000 0.000
#> GSM381266     1  0.0000      0.980 1.000 0.000
#> GSM381267     1  0.0938      0.971 0.988 0.012
#> GSM381269     1  0.0000      0.980 1.000 0.000
#> GSM381273     1  0.0000      0.980 1.000 0.000
#> GSM381274     2  0.0000      1.000 0.000 1.000
#> GSM381276     1  0.0000      0.980 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
#> GSM381194     3  0.1529      0.946 0.040 0.000 0.960
#> GSM381199     2  0.0237      0.993 0.000 0.996 0.004
#> GSM381205     2  0.0237      0.994 0.004 0.996 0.000
#> GSM381211     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381220     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381222     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381224     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381232     3  0.0592      0.949 0.000 0.012 0.988
#> GSM381240     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381250     1  0.1643      0.952 0.956 0.000 0.044
#> GSM381252     2  0.0237      0.994 0.004 0.996 0.000
#> GSM381254     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381256     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381257     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381259     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381260     1  0.0892      0.971 0.980 0.000 0.020
#> GSM381261     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381263     1  0.1964      0.941 0.944 0.000 0.056
#> GSM381265     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381268     3  0.1964      0.945 0.056 0.000 0.944
#> GSM381270     2  0.1163      0.976 0.000 0.972 0.028
#> GSM381271     3  0.0000      0.952 0.000 0.000 1.000
#> GSM381275     2  0.0237      0.994 0.004 0.996 0.000
#> GSM381279     2  0.1031      0.979 0.000 0.976 0.024
#> GSM381195     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381196     1  0.4452      0.773 0.808 0.000 0.192
#> GSM381198     2  0.0237      0.994 0.004 0.996 0.000
#> GSM381200     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381201     3  0.1289      0.956 0.032 0.000 0.968
#> GSM381203     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381204     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381209     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381212     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381213     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381214     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381216     1  0.0747      0.974 0.984 0.000 0.016
#> GSM381225     1  0.0592      0.976 0.988 0.000 0.012
#> GSM381231     3  0.0000      0.952 0.000 0.000 1.000
#> GSM381235     1  0.1163      0.964 0.972 0.000 0.028
#> GSM381237     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381241     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381243     2  0.1289      0.973 0.000 0.968 0.032
#> GSM381245     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381246     2  0.0237      0.994 0.004 0.996 0.000
#> GSM381251     3  0.1289      0.956 0.032 0.000 0.968
#> GSM381264     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381206     2  0.0237      0.994 0.004 0.996 0.000
#> GSM381217     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381218     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381226     2  0.0237      0.994 0.004 0.996 0.000
#> GSM381227     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381228     3  0.0000      0.952 0.000 0.000 1.000
#> GSM381236     3  0.0000      0.952 0.000 0.000 1.000
#> GSM381244     3  0.1411      0.954 0.036 0.000 0.964
#> GSM381272     3  0.0237      0.951 0.000 0.004 0.996
#> GSM381277     1  0.0592      0.976 0.988 0.000 0.012
#> GSM381278     3  0.2796      0.907 0.092 0.000 0.908
#> GSM381197     3  0.1289      0.956 0.032 0.000 0.968
#> GSM381202     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381207     1  0.0592      0.976 0.988 0.000 0.012
#> GSM381208     3  0.1289      0.956 0.032 0.000 0.968
#> GSM381210     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381215     3  0.2448      0.923 0.076 0.000 0.924
#> GSM381219     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381221     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381223     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381229     3  0.1289      0.956 0.032 0.000 0.968
#> GSM381230     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381233     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381234     1  0.0237      0.979 0.996 0.000 0.004
#> GSM381238     3  0.1289      0.938 0.000 0.032 0.968
#> GSM381239     3  0.0237      0.951 0.000 0.004 0.996
#> GSM381242     1  0.0747      0.974 0.984 0.000 0.016
#> GSM381247     2  0.1289      0.973 0.000 0.968 0.032
#> GSM381248     1  0.3192      0.882 0.888 0.000 0.112
#> GSM381249     1  0.0000      0.978 1.000 0.000 0.000
#> GSM381253     1  0.0747      0.974 0.984 0.000 0.016
#> GSM381255     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381258     3  0.5058      0.705 0.244 0.000 0.756
#> GSM381262     3  0.4062      0.826 0.164 0.000 0.836
#> GSM381266     3  0.0000      0.952 0.000 0.000 1.000
#> GSM381267     3  0.1525      0.955 0.032 0.004 0.964
#> GSM381269     1  0.0424      0.977 0.992 0.000 0.008
#> GSM381273     3  0.1289      0.956 0.032 0.000 0.968
#> GSM381274     2  0.0000      0.995 0.000 1.000 0.000
#> GSM381276     1  0.4399      0.776 0.812 0.000 0.188

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.0672     0.5080 0.008 0.000 0.984 0.008
#> GSM381199     2  0.0336     0.9681 0.000 0.992 0.008 0.000
#> GSM381205     2  0.0188     0.9688 0.000 0.996 0.004 0.000
#> GSM381211     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381220     2  0.0188     0.9691 0.000 0.996 0.004 0.000
#> GSM381222     1  0.1211     0.8867 0.960 0.000 0.040 0.000
#> GSM381224     1  0.0188     0.8947 0.996 0.000 0.004 0.000
#> GSM381232     4  0.4713     0.5268 0.000 0.000 0.360 0.640
#> GSM381240     1  0.0000     0.8950 1.000 0.000 0.000 0.000
#> GSM381250     1  0.5070     0.4183 0.620 0.000 0.372 0.008
#> GSM381252     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381254     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381256     2  0.0188     0.9693 0.000 0.996 0.004 0.000
#> GSM381257     1  0.0817     0.8904 0.976 0.000 0.024 0.000
#> GSM381259     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381260     1  0.2466     0.8517 0.900 0.000 0.096 0.004
#> GSM381261     2  0.0921     0.9564 0.000 0.972 0.028 0.000
#> GSM381263     1  0.5143     0.2095 0.540 0.000 0.456 0.004
#> GSM381265     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381268     3  0.7258     0.3476 0.328 0.000 0.508 0.164
#> GSM381270     2  0.2466     0.8916 0.000 0.900 0.096 0.004
#> GSM381271     4  0.4713     0.5268 0.000 0.000 0.360 0.640
#> GSM381275     2  0.0469     0.9661 0.000 0.988 0.012 0.000
#> GSM381279     2  0.1716     0.9266 0.000 0.936 0.064 0.000
#> GSM381195     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381196     1  0.5530     0.4275 0.632 0.000 0.336 0.032
#> GSM381198     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381200     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381201     4  0.3801     0.5172 0.000 0.000 0.220 0.780
#> GSM381203     1  0.1474     0.8796 0.948 0.000 0.052 0.000
#> GSM381204     1  0.0000     0.8950 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381212     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381213     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381214     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381216     1  0.4477     0.6138 0.688 0.000 0.312 0.000
#> GSM381225     3  0.5220     0.0766 0.424 0.000 0.568 0.008
#> GSM381231     4  0.4713     0.5268 0.000 0.000 0.360 0.640
#> GSM381235     1  0.4843     0.4419 0.604 0.000 0.396 0.000
#> GSM381237     1  0.0000     0.8950 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381243     2  0.2814     0.8522 0.000 0.868 0.132 0.000
#> GSM381245     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381246     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381251     4  0.3801     0.5172 0.000 0.000 0.220 0.780
#> GSM381264     1  0.0000     0.8950 1.000 0.000 0.000 0.000
#> GSM381206     2  0.0188     0.9688 0.000 0.996 0.004 0.000
#> GSM381217     1  0.3975     0.7171 0.760 0.000 0.240 0.000
#> GSM381218     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381226     2  0.0188     0.9693 0.000 0.996 0.004 0.000
#> GSM381227     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381228     4  0.4713     0.5268 0.000 0.000 0.360 0.640
#> GSM381236     4  0.4713     0.5268 0.000 0.000 0.360 0.640
#> GSM381244     4  0.3801     0.5172 0.000 0.000 0.220 0.780
#> GSM381272     4  0.4713     0.5268 0.000 0.000 0.360 0.640
#> GSM381277     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381278     3  0.2593     0.4394 0.004 0.000 0.892 0.104
#> GSM381197     4  0.3801     0.5172 0.000 0.000 0.220 0.780
#> GSM381202     1  0.1022     0.8881 0.968 0.000 0.032 0.000
#> GSM381207     1  0.0469     0.8930 0.988 0.000 0.012 0.000
#> GSM381208     4  0.3982     0.5137 0.000 0.004 0.220 0.776
#> GSM381210     1  0.0000     0.8950 1.000 0.000 0.000 0.000
#> GSM381215     3  0.3820     0.5099 0.064 0.000 0.848 0.088
#> GSM381219     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381221     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381223     2  0.1302     0.9467 0.000 0.956 0.044 0.000
#> GSM381229     4  0.4761     0.2218 0.000 0.000 0.372 0.628
#> GSM381230     1  0.0000     0.8950 1.000 0.000 0.000 0.000
#> GSM381233     1  0.1792     0.8752 0.932 0.000 0.068 0.000
#> GSM381234     1  0.0188     0.8943 0.996 0.000 0.004 0.000
#> GSM381238     4  0.4830     0.4830 0.000 0.000 0.392 0.608
#> GSM381239     4  0.4697     0.5265 0.000 0.000 0.356 0.644
#> GSM381242     1  0.3105     0.8192 0.856 0.000 0.140 0.004
#> GSM381247     2  0.4790     0.4950 0.000 0.620 0.380 0.000
#> GSM381248     1  0.1978     0.8468 0.928 0.000 0.004 0.068
#> GSM381249     1  0.0336     0.8941 0.992 0.000 0.008 0.000
#> GSM381253     1  0.2647     0.8382 0.880 0.000 0.120 0.000
#> GSM381255     2  0.0000     0.9704 0.000 1.000 0.000 0.000
#> GSM381258     3  0.2843     0.4682 0.020 0.000 0.892 0.088
#> GSM381262     3  0.2300     0.5081 0.016 0.000 0.920 0.064
#> GSM381266     3  0.4998    -0.4507 0.000 0.000 0.512 0.488
#> GSM381267     4  0.3801     0.5172 0.000 0.000 0.220 0.780
#> GSM381269     1  0.2921     0.8255 0.860 0.000 0.140 0.000
#> GSM381273     4  0.3801     0.5172 0.000 0.000 0.220 0.780
#> GSM381274     2  0.0336     0.9680 0.000 0.992 0.008 0.000
#> GSM381276     1  0.3577     0.7987 0.832 0.000 0.156 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.2446      0.698 0.000 0.000 0.900 0.056 0.044
#> GSM381199     2  0.0290      0.962 0.000 0.992 0.008 0.000 0.000
#> GSM381205     2  0.0162      0.963 0.004 0.996 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381220     2  0.0794      0.949 0.000 0.972 0.000 0.028 0.000
#> GSM381222     1  0.2416      0.826 0.888 0.000 0.100 0.000 0.012
#> GSM381224     1  0.1671      0.838 0.924 0.000 0.076 0.000 0.000
#> GSM381232     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.0290      0.857 0.992 0.000 0.008 0.000 0.000
#> GSM381250     1  0.5353      0.390 0.600 0.000 0.328 0.000 0.072
#> GSM381252     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381254     1  0.0865      0.853 0.972 0.000 0.000 0.004 0.024
#> GSM381256     2  0.0451      0.960 0.000 0.988 0.008 0.000 0.004
#> GSM381257     1  0.2953      0.819 0.868 0.000 0.100 0.028 0.004
#> GSM381259     1  0.0510      0.856 0.984 0.000 0.000 0.000 0.016
#> GSM381260     1  0.3336      0.716 0.772 0.000 0.228 0.000 0.000
#> GSM381261     2  0.2124      0.913 0.000 0.916 0.056 0.000 0.028
#> GSM381263     3  0.4893      0.309 0.404 0.000 0.568 0.000 0.028
#> GSM381265     1  0.0609      0.855 0.980 0.000 0.000 0.000 0.020
#> GSM381268     3  0.6400      0.539 0.292 0.000 0.544 0.012 0.152
#> GSM381270     2  0.2523      0.907 0.000 0.908 0.040 0.028 0.024
#> GSM381271     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381275     2  0.1830      0.925 0.000 0.932 0.040 0.000 0.028
#> GSM381279     2  0.0162      0.963 0.000 0.996 0.004 0.000 0.000
#> GSM381195     1  0.0703      0.854 0.976 0.000 0.000 0.000 0.024
#> GSM381196     1  0.5309      0.542 0.656 0.000 0.240 0.000 0.104
#> GSM381198     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381200     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381201     5  0.2280      0.922 0.000 0.000 0.000 0.120 0.880
#> GSM381203     1  0.3954      0.722 0.772 0.000 0.192 0.000 0.036
#> GSM381204     1  0.0290      0.857 0.992 0.000 0.008 0.000 0.000
#> GSM381209     1  0.0162      0.858 0.996 0.000 0.000 0.000 0.004
#> GSM381212     1  0.0510      0.856 0.984 0.000 0.000 0.000 0.016
#> GSM381213     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381214     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381216     3  0.4114      0.701 0.176 0.000 0.776 0.004 0.044
#> GSM381225     3  0.4637      0.689 0.196 0.000 0.728 0.000 0.076
#> GSM381231     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381235     3  0.2110      0.716 0.072 0.000 0.912 0.000 0.016
#> GSM381237     1  0.0162      0.858 0.996 0.000 0.004 0.000 0.000
#> GSM381241     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381243     2  0.1399      0.937 0.000 0.952 0.020 0.028 0.000
#> GSM381245     1  0.0703      0.854 0.976 0.000 0.000 0.000 0.024
#> GSM381246     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381251     5  0.1915      0.870 0.000 0.000 0.040 0.032 0.928
#> GSM381264     1  0.0703      0.854 0.976 0.000 0.000 0.000 0.024
#> GSM381206     2  0.0162      0.963 0.004 0.996 0.000 0.000 0.000
#> GSM381217     3  0.4210      0.309 0.412 0.000 0.588 0.000 0.000
#> GSM381218     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381226     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381227     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381228     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381244     5  0.2280      0.922 0.000 0.000 0.000 0.120 0.880
#> GSM381272     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381277     1  0.0404      0.857 0.988 0.000 0.000 0.012 0.000
#> GSM381278     3  0.2661      0.669 0.000 0.000 0.888 0.056 0.056
#> GSM381197     5  0.2280      0.922 0.000 0.000 0.000 0.120 0.880
#> GSM381202     1  0.2852      0.773 0.828 0.000 0.172 0.000 0.000
#> GSM381207     1  0.0609      0.855 0.980 0.000 0.000 0.000 0.020
#> GSM381208     5  0.2280      0.922 0.000 0.000 0.000 0.120 0.880
#> GSM381210     1  0.0880      0.853 0.968 0.000 0.032 0.000 0.000
#> GSM381215     3  0.3030      0.687 0.004 0.000 0.868 0.040 0.088
#> GSM381219     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381221     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381223     2  0.1877      0.917 0.000 0.924 0.064 0.000 0.012
#> GSM381229     5  0.2020      0.825 0.000 0.000 0.100 0.000 0.900
#> GSM381230     1  0.0566      0.858 0.984 0.000 0.004 0.000 0.012
#> GSM381233     1  0.3628      0.727 0.772 0.000 0.216 0.000 0.012
#> GSM381234     1  0.0703      0.854 0.976 0.000 0.000 0.000 0.024
#> GSM381238     4  0.0324      0.990 0.000 0.000 0.004 0.992 0.004
#> GSM381239     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM381242     1  0.4309      0.573 0.676 0.000 0.308 0.000 0.016
#> GSM381247     2  0.5051      0.146 0.000 0.492 0.480 0.024 0.004
#> GSM381248     1  0.1914      0.823 0.924 0.000 0.000 0.016 0.060
#> GSM381249     1  0.1732      0.836 0.920 0.000 0.080 0.000 0.000
#> GSM381253     1  0.4269      0.671 0.732 0.000 0.232 0.000 0.036
#> GSM381255     2  0.0000      0.964 0.000 1.000 0.000 0.000 0.000
#> GSM381258     3  0.2492      0.694 0.024 0.000 0.908 0.020 0.048
#> GSM381262     3  0.2408      0.681 0.000 0.000 0.892 0.016 0.092
#> GSM381266     5  0.5295      0.649 0.000 0.000 0.200 0.128 0.672
#> GSM381267     5  0.2280      0.922 0.000 0.000 0.000 0.120 0.880
#> GSM381269     1  0.5195      0.315 0.564 0.000 0.388 0.000 0.048
#> GSM381273     5  0.2280      0.922 0.000 0.000 0.000 0.120 0.880
#> GSM381274     2  0.0865      0.951 0.000 0.972 0.024 0.000 0.004
#> GSM381276     1  0.3878      0.692 0.748 0.000 0.236 0.016 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
#> GSM381194     3  0.1225      0.728 0.000 0.000 0.952 0.012 0.000 0.036
#> GSM381199     2  0.0508      0.947 0.000 0.984 0.012 0.000 0.000 0.004
#> GSM381205     2  0.0146      0.953 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0146      0.953 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM381220     2  0.0713      0.940 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM381222     1  0.3705      0.743 0.740 0.000 0.020 0.004 0.000 0.236
#> GSM381224     1  0.3217      0.728 0.768 0.000 0.008 0.000 0.000 0.224
#> GSM381232     4  0.0146      0.996 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM381240     1  0.2454      0.777 0.840 0.000 0.000 0.000 0.000 0.160
#> GSM381250     3  0.4858      0.524 0.228 0.000 0.652 0.000 0.000 0.120
#> GSM381252     2  0.0146      0.953 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM381254     1  0.1625      0.763 0.928 0.000 0.012 0.000 0.000 0.060
#> GSM381256     2  0.0547      0.944 0.000 0.980 0.020 0.000 0.000 0.000
#> GSM381257     1  0.5189      0.611 0.652 0.000 0.152 0.012 0.000 0.184
#> GSM381259     1  0.1151      0.785 0.956 0.000 0.012 0.000 0.000 0.032
#> GSM381260     1  0.4569      0.525 0.624 0.000 0.036 0.008 0.000 0.332
#> GSM381261     2  0.3101      0.724 0.000 0.756 0.000 0.000 0.000 0.244
#> GSM381263     3  0.5362      0.396 0.184 0.000 0.588 0.000 0.000 0.228
#> GSM381265     1  0.0632      0.783 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM381268     3  0.1542      0.739 0.052 0.000 0.936 0.000 0.008 0.004
#> GSM381270     2  0.3488      0.720 0.000 0.744 0.000 0.004 0.008 0.244
#> GSM381271     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     2  0.3659      0.534 0.000 0.636 0.000 0.000 0.000 0.364
#> GSM381279     2  0.0291      0.952 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM381195     1  0.0632      0.779 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM381196     3  0.3141      0.702 0.112 0.000 0.836 0.000 0.004 0.048
#> GSM381198     2  0.0146      0.953 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM381200     2  0.0000      0.953 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381201     5  0.0405      0.991 0.000 0.000 0.004 0.008 0.988 0.000
#> GSM381203     3  0.4885      0.360 0.372 0.000 0.560 0.000 0.000 0.068
#> GSM381204     1  0.2178      0.789 0.868 0.000 0.000 0.000 0.000 0.132
#> GSM381209     1  0.1556      0.799 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM381212     1  0.0547      0.796 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM381213     2  0.0146      0.953 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381214     2  0.0146      0.953 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381216     6  0.2579      0.727 0.088 0.004 0.032 0.000 0.000 0.876
#> GSM381225     3  0.1285      0.739 0.052 0.000 0.944 0.000 0.000 0.004
#> GSM381231     4  0.0146      0.996 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM381235     6  0.3672      0.628 0.056 0.000 0.168 0.000 0.000 0.776
#> GSM381237     1  0.2135      0.791 0.872 0.000 0.000 0.000 0.000 0.128
#> GSM381241     2  0.0146      0.953 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM381243     2  0.0146      0.953 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381245     1  0.0547      0.792 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM381246     2  0.0000      0.953 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381251     5  0.1007      0.955 0.000 0.000 0.044 0.000 0.956 0.000
#> GSM381264     1  0.1745      0.756 0.924 0.000 0.020 0.000 0.000 0.056
#> GSM381206     2  0.0146      0.953 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM381217     1  0.4823      0.452 0.584 0.000 0.068 0.000 0.000 0.348
#> GSM381218     2  0.0146      0.953 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM381226     2  0.0000      0.953 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381227     2  0.0146      0.953 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381228     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     5  0.0363      0.989 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM381272     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     1  0.2604      0.795 0.872 0.000 0.004 0.028 0.000 0.096
#> GSM381278     3  0.3650      0.533 0.000 0.000 0.708 0.000 0.012 0.280
#> GSM381197     5  0.0405      0.991 0.000 0.000 0.004 0.008 0.988 0.000
#> GSM381202     1  0.4011      0.610 0.672 0.000 0.024 0.000 0.000 0.304
#> GSM381207     1  0.0806      0.789 0.972 0.000 0.000 0.020 0.000 0.008
#> GSM381208     5  0.0363      0.989 0.000 0.000 0.000 0.012 0.988 0.000
#> GSM381210     1  0.3320      0.762 0.772 0.000 0.016 0.000 0.000 0.212
#> GSM381215     3  0.1674      0.727 0.000 0.000 0.924 0.004 0.004 0.068
#> GSM381219     2  0.0146      0.953 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381221     2  0.0146      0.953 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381223     2  0.1075      0.926 0.000 0.952 0.000 0.000 0.000 0.048
#> GSM381229     3  0.2092      0.694 0.000 0.000 0.876 0.000 0.124 0.000
#> GSM381230     1  0.1802      0.783 0.916 0.000 0.012 0.000 0.000 0.072
#> GSM381233     1  0.3990      0.677 0.676 0.000 0.016 0.000 0.004 0.304
#> GSM381234     1  0.0632      0.779 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM381238     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381239     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     6  0.4461     -0.124 0.464 0.000 0.020 0.004 0.000 0.512
#> GSM381247     2  0.2905      0.844 0.000 0.852 0.064 0.000 0.000 0.084
#> GSM381248     1  0.2882      0.651 0.848 0.000 0.004 0.000 0.120 0.028
#> GSM381249     1  0.3490      0.683 0.724 0.000 0.008 0.000 0.000 0.268
#> GSM381253     3  0.4601      0.472 0.312 0.000 0.628 0.000 0.000 0.060
#> GSM381255     2  0.0146      0.953 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381258     6  0.1644      0.680 0.012 0.000 0.052 0.004 0.000 0.932
#> GSM381262     3  0.0935      0.723 0.000 0.000 0.964 0.000 0.004 0.032
#> GSM381266     3  0.3637      0.642 0.000 0.000 0.780 0.056 0.164 0.000
#> GSM381267     5  0.0405      0.991 0.000 0.000 0.004 0.008 0.988 0.000
#> GSM381269     6  0.2859      0.711 0.156 0.000 0.016 0.000 0.000 0.828
#> GSM381273     5  0.0405      0.991 0.000 0.000 0.004 0.008 0.988 0.000
#> GSM381274     2  0.1814      0.884 0.000 0.900 0.000 0.000 0.000 0.100
#> GSM381276     1  0.5312      0.563 0.632 0.000 0.068 0.040 0.000 0.260

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 other(p) k
#> CV:NMF 86    0.416 2
#> CV:NMF 86    0.153 3
#> CV:NMF 74    0.359 4
#> CV:NMF 81    0.199 5
#> CV:NMF 81    0.472 6

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


MAD:hclust

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-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.561           0.738       0.892         0.3856 0.583   0.583
#> 3 3 0.754           0.689       0.851         0.6701 0.590   0.411
#> 4 4 0.749           0.727       0.842         0.0876 0.791   0.528
#> 5 5 0.823           0.774       0.895         0.0829 0.873   0.606
#> 6 6 0.800           0.783       0.849         0.0483 0.925   0.705

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
#> GSM381194     2  0.1633    0.88985 0.024 0.976
#> GSM381199     2  0.0000    0.90200 0.000 1.000
#> GSM381205     2  0.0000    0.90200 0.000 1.000
#> GSM381211     2  0.0000    0.90200 0.000 1.000
#> GSM381220     2  0.0000    0.90200 0.000 1.000
#> GSM381222     1  0.9815    0.49412 0.580 0.420
#> GSM381224     1  0.9754    0.51941 0.592 0.408
#> GSM381232     2  0.0376    0.90129 0.004 0.996
#> GSM381240     1  0.8443    0.68602 0.728 0.272
#> GSM381250     2  0.4815    0.81396 0.104 0.896
#> GSM381252     2  0.0000    0.90200 0.000 1.000
#> GSM381254     1  0.3431    0.76088 0.936 0.064
#> GSM381256     2  0.0000    0.90200 0.000 1.000
#> GSM381257     1  0.4690    0.75023 0.900 0.100
#> GSM381259     1  0.0000    0.75652 1.000 0.000
#> GSM381260     2  0.9881   -0.02332 0.436 0.564
#> GSM381261     2  0.0000    0.90200 0.000 1.000
#> GSM381263     2  0.4815    0.81262 0.104 0.896
#> GSM381265     1  0.0000    0.75652 1.000 0.000
#> GSM381268     2  0.2236    0.88121 0.036 0.964
#> GSM381270     2  0.0000    0.90200 0.000 1.000
#> GSM381271     2  0.0376    0.90129 0.004 0.996
#> GSM381275     2  0.0000    0.90200 0.000 1.000
#> GSM381279     2  0.0000    0.90200 0.000 1.000
#> GSM381195     1  0.0000    0.75652 1.000 0.000
#> GSM381196     2  0.5294    0.79379 0.120 0.880
#> GSM381198     2  0.0000    0.90200 0.000 1.000
#> GSM381200     2  0.0000    0.90200 0.000 1.000
#> GSM381201     2  0.2236    0.88121 0.036 0.964
#> GSM381203     2  0.8861    0.48845 0.304 0.696
#> GSM381204     1  0.0000    0.75652 1.000 0.000
#> GSM381209     1  0.0672    0.75789 0.992 0.008
#> GSM381212     1  0.0000    0.75652 1.000 0.000
#> GSM381213     2  0.0000    0.90200 0.000 1.000
#> GSM381214     2  0.0000    0.90200 0.000 1.000
#> GSM381216     2  0.9866   -0.00741 0.432 0.568
#> GSM381225     2  0.2948    0.86758 0.052 0.948
#> GSM381231     2  0.0376    0.90129 0.004 0.996
#> GSM381235     2  0.9775    0.07072 0.412 0.588
#> GSM381237     1  0.0000    0.75652 1.000 0.000
#> GSM381241     2  0.0000    0.90200 0.000 1.000
#> GSM381243     2  0.0000    0.90200 0.000 1.000
#> GSM381245     1  0.8499    0.68352 0.724 0.276
#> GSM381246     2  0.0000    0.90200 0.000 1.000
#> GSM381251     2  0.1414    0.89243 0.020 0.980
#> GSM381264     1  0.0000    0.75652 1.000 0.000
#> GSM381206     2  0.0000    0.90200 0.000 1.000
#> GSM381217     2  0.8861    0.43656 0.304 0.696
#> GSM381218     2  0.0000    0.90200 0.000 1.000
#> GSM381226     2  0.0000    0.90200 0.000 1.000
#> GSM381227     2  0.0000    0.90200 0.000 1.000
#> GSM381228     2  0.0376    0.90129 0.004 0.996
#> GSM381236     2  0.0376    0.90129 0.004 0.996
#> GSM381244     1  0.9286    0.61358 0.656 0.344
#> GSM381272     2  0.0376    0.90129 0.004 0.996
#> GSM381277     1  0.9993    0.31809 0.516 0.484
#> GSM381278     2  0.0376    0.90129 0.004 0.996
#> GSM381197     2  0.9909   -0.05418 0.444 0.556
#> GSM381202     2  0.9909   -0.05724 0.444 0.556
#> GSM381207     1  0.8861    0.65884 0.696 0.304
#> GSM381208     2  0.0000    0.90200 0.000 1.000
#> GSM381210     1  0.8555    0.68041 0.720 0.280
#> GSM381215     2  0.4562    0.82351 0.096 0.904
#> GSM381219     2  0.0000    0.90200 0.000 1.000
#> GSM381221     2  0.0000    0.90200 0.000 1.000
#> GSM381223     2  0.0000    0.90200 0.000 1.000
#> GSM381229     2  0.1414    0.89243 0.020 0.980
#> GSM381230     1  0.0000    0.75652 1.000 0.000
#> GSM381233     1  0.9815    0.49412 0.580 0.420
#> GSM381234     1  0.3584    0.76058 0.932 0.068
#> GSM381238     2  0.0376    0.90129 0.004 0.996
#> GSM381239     2  0.0376    0.90129 0.004 0.996
#> GSM381242     2  0.9881   -0.02332 0.436 0.564
#> GSM381247     2  0.0000    0.90200 0.000 1.000
#> GSM381248     1  0.4431    0.75234 0.908 0.092
#> GSM381249     1  0.9866    0.46583 0.568 0.432
#> GSM381253     2  0.4815    0.81396 0.104 0.896
#> GSM381255     2  0.0000    0.90200 0.000 1.000
#> GSM381258     2  0.9710    0.11900 0.400 0.600
#> GSM381262     2  0.1414    0.89243 0.020 0.980
#> GSM381266     2  0.0376    0.90129 0.004 0.996
#> GSM381267     2  0.0000    0.90200 0.000 1.000
#> GSM381269     1  0.9881    0.45665 0.564 0.436
#> GSM381273     2  0.1414    0.89243 0.020 0.980
#> GSM381274     2  0.0000    0.90200 0.000 1.000
#> GSM381276     1  0.9993    0.31809 0.516 0.484

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1 p2    p3
#> GSM381194     1  0.6154      0.675 0.592  0 0.408
#> GSM381199     2  0.0000      1.000 0.000  1 0.000
#> GSM381205     2  0.0000      1.000 0.000  1 0.000
#> GSM381211     2  0.0000      1.000 0.000  1 0.000
#> GSM381220     2  0.0000      1.000 0.000  1 0.000
#> GSM381222     1  0.3879      0.157 0.848  0 0.152
#> GSM381224     1  0.4291      0.107 0.820  0 0.180
#> GSM381232     1  0.6215      0.670 0.572  0 0.428
#> GSM381240     1  0.5560     -0.378 0.700  0 0.300
#> GSM381250     1  0.5760      0.668 0.672  0 0.328
#> GSM381252     2  0.0000      1.000 0.000  1 0.000
#> GSM381254     3  0.6309      0.891 0.496  0 0.504
#> GSM381256     2  0.0000      1.000 0.000  1 0.000
#> GSM381257     1  0.6295     -0.845 0.528  0 0.472
#> GSM381259     3  0.6215      0.966 0.428  0 0.572
#> GSM381260     1  0.0592      0.458 0.988  0 0.012
#> GSM381261     2  0.0000      1.000 0.000  1 0.000
#> GSM381263     1  0.5760      0.668 0.672  0 0.328
#> GSM381265     3  0.6215      0.966 0.428  0 0.572
#> GSM381268     1  0.6111      0.675 0.604  0 0.396
#> GSM381270     2  0.0000      1.000 0.000  1 0.000
#> GSM381271     1  0.6215      0.670 0.572  0 0.428
#> GSM381275     2  0.0000      1.000 0.000  1 0.000
#> GSM381279     2  0.0000      1.000 0.000  1 0.000
#> GSM381195     3  0.6215      0.966 0.428  0 0.572
#> GSM381196     1  0.5650      0.664 0.688  0 0.312
#> GSM381198     2  0.0000      1.000 0.000  1 0.000
#> GSM381200     2  0.0000      1.000 0.000  1 0.000
#> GSM381201     1  0.6111      0.675 0.604  0 0.396
#> GSM381203     1  0.5529      0.566 0.704  0 0.296
#> GSM381204     3  0.6215      0.966 0.428  0 0.572
#> GSM381209     3  0.6235      0.961 0.436  0 0.564
#> GSM381212     3  0.6215      0.966 0.428  0 0.572
#> GSM381213     2  0.0000      1.000 0.000  1 0.000
#> GSM381214     2  0.0000      1.000 0.000  1 0.000
#> GSM381216     1  0.0000      0.463 1.000  0 0.000
#> GSM381225     1  0.6045      0.675 0.620  0 0.380
#> GSM381231     1  0.6215      0.670 0.572  0 0.428
#> GSM381235     1  0.1163      0.480 0.972  0 0.028
#> GSM381237     3  0.6215      0.966 0.428  0 0.572
#> GSM381241     2  0.0000      1.000 0.000  1 0.000
#> GSM381243     2  0.0000      1.000 0.000  1 0.000
#> GSM381245     1  0.5529     -0.366 0.704  0 0.296
#> GSM381246     2  0.0000      1.000 0.000  1 0.000
#> GSM381251     1  0.6168      0.674 0.588  0 0.412
#> GSM381264     3  0.6215      0.966 0.428  0 0.572
#> GSM381206     2  0.0000      1.000 0.000  1 0.000
#> GSM381217     1  0.3752      0.569 0.856  0 0.144
#> GSM381218     2  0.0000      1.000 0.000  1 0.000
#> GSM381226     2  0.0000      1.000 0.000  1 0.000
#> GSM381227     2  0.0000      1.000 0.000  1 0.000
#> GSM381228     1  0.6215      0.670 0.572  0 0.428
#> GSM381236     1  0.6215      0.670 0.572  0 0.428
#> GSM381244     1  0.4887     -0.129 0.772  0 0.228
#> GSM381272     1  0.6215      0.670 0.572  0 0.428
#> GSM381277     1  0.2959      0.321 0.900  0 0.100
#> GSM381278     1  0.6215      0.670 0.572  0 0.428
#> GSM381197     1  0.0892      0.450 0.980  0 0.020
#> GSM381202     1  0.0892      0.449 0.980  0 0.020
#> GSM381207     1  0.5291     -0.271 0.732  0 0.268
#> GSM381208     2  0.0000      1.000 0.000  1 0.000
#> GSM381210     1  0.5497     -0.351 0.708  0 0.292
#> GSM381215     1  0.5810      0.670 0.664  0 0.336
#> GSM381219     2  0.0000      1.000 0.000  1 0.000
#> GSM381221     2  0.0000      1.000 0.000  1 0.000
#> GSM381223     2  0.0000      1.000 0.000  1 0.000
#> GSM381229     1  0.6168      0.674 0.588  0 0.412
#> GSM381230     3  0.6215      0.966 0.428  0 0.572
#> GSM381233     1  0.3879      0.157 0.848  0 0.152
#> GSM381234     3  0.6309      0.885 0.500  0 0.500
#> GSM381238     1  0.6215      0.670 0.572  0 0.428
#> GSM381239     1  0.6215      0.670 0.572  0 0.428
#> GSM381242     1  0.0592      0.458 0.988  0 0.012
#> GSM381247     2  0.0000      1.000 0.000  1 0.000
#> GSM381248     3  0.6299      0.871 0.476  0 0.524
#> GSM381249     1  0.3686      0.195 0.860  0 0.140
#> GSM381253     1  0.5760      0.668 0.672  0 0.328
#> GSM381255     2  0.0000      1.000 0.000  1 0.000
#> GSM381258     1  0.1289      0.491 0.968  0 0.032
#> GSM381262     1  0.6168      0.674 0.588  0 0.412
#> GSM381266     1  0.6215      0.670 0.572  0 0.428
#> GSM381267     2  0.0000      1.000 0.000  1 0.000
#> GSM381269     1  0.3619      0.204 0.864  0 0.136
#> GSM381273     1  0.6168      0.674 0.588  0 0.412
#> GSM381274     2  0.0000      1.000 0.000  1 0.000
#> GSM381276     1  0.2959      0.321 0.900  0 0.100

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1 p2    p3    p4
#> GSM381194     3  0.0376     0.6733 0.004  0 0.992 0.004
#> GSM381199     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381205     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381211     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381220     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381222     1  0.5435     0.3911 0.564  0 0.420 0.016
#> GSM381224     1  0.5310     0.4198 0.576  0 0.412 0.012
#> GSM381232     4  0.2760     1.0000 0.000  0 0.128 0.872
#> GSM381240     1  0.4594     0.6044 0.712  0 0.280 0.008
#> GSM381250     3  0.2266     0.6679 0.084  0 0.912 0.004
#> GSM381252     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381254     1  0.1902     0.6990 0.932  0 0.064 0.004
#> GSM381256     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381257     1  0.2345     0.6801 0.900  0 0.100 0.000
#> GSM381259     1  0.0000     0.6975 1.000  0 0.000 0.000
#> GSM381260     3  0.6292     0.0653 0.416  0 0.524 0.060
#> GSM381261     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381263     3  0.2266     0.6670 0.084  0 0.912 0.004
#> GSM381265     1  0.0000     0.6975 1.000  0 0.000 0.000
#> GSM381268     3  0.0779     0.6750 0.016  0 0.980 0.004
#> GSM381270     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381271     4  0.2760     1.0000 0.000  0 0.128 0.872
#> GSM381275     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381279     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381195     1  0.0000     0.6975 1.000  0 0.000 0.000
#> GSM381196     3  0.2530     0.6593 0.100  0 0.896 0.004
#> GSM381198     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381200     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381201     3  0.0779     0.6750 0.016  0 0.980 0.004
#> GSM381203     3  0.4844     0.4710 0.300  0 0.688 0.012
#> GSM381204     1  0.0000     0.6975 1.000  0 0.000 0.000
#> GSM381209     1  0.0817     0.7008 0.976  0 0.024 0.000
#> GSM381212     1  0.0000     0.6975 1.000  0 0.000 0.000
#> GSM381213     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381214     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381216     3  0.6285     0.0751 0.412  0 0.528 0.060
#> GSM381225     3  0.3694     0.6423 0.032  0 0.844 0.124
#> GSM381231     4  0.2760     1.0000 0.000  0 0.128 0.872
#> GSM381235     3  0.6179     0.1254 0.392  0 0.552 0.056
#> GSM381237     1  0.0000     0.6975 1.000  0 0.000 0.000
#> GSM381241     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381243     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381245     1  0.4621     0.6013 0.708  0 0.284 0.008
#> GSM381246     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381251     3  0.2704     0.6312 0.000  0 0.876 0.124
#> GSM381264     1  0.0000     0.6975 1.000  0 0.000 0.000
#> GSM381206     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381217     3  0.5649     0.3930 0.284  0 0.664 0.052
#> GSM381218     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381226     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381227     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381228     4  0.2760     1.0000 0.000  0 0.128 0.872
#> GSM381236     4  0.2760     1.0000 0.000  0 0.128 0.872
#> GSM381244     1  0.4990     0.5244 0.640  0 0.352 0.008
#> GSM381272     4  0.2760     1.0000 0.000  0 0.128 0.872
#> GSM381277     1  0.6268     0.2292 0.496  0 0.448 0.056
#> GSM381278     3  0.3266     0.5934 0.000  0 0.832 0.168
#> GSM381197     3  0.6305     0.0432 0.424  0 0.516 0.060
#> GSM381202     3  0.6305     0.0395 0.424  0 0.516 0.060
#> GSM381207     1  0.4792     0.5757 0.680  0 0.312 0.008
#> GSM381208     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381210     1  0.4647     0.5975 0.704  0 0.288 0.008
#> GSM381215     3  0.2125     0.6697 0.076  0 0.920 0.004
#> GSM381219     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381221     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381223     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381229     3  0.2760     0.6302 0.000  0 0.872 0.128
#> GSM381230     1  0.0000     0.6975 1.000  0 0.000 0.000
#> GSM381233     1  0.5435     0.3911 0.564  0 0.420 0.016
#> GSM381234     1  0.1978     0.6983 0.928  0 0.068 0.004
#> GSM381238     4  0.2760     1.0000 0.000  0 0.128 0.872
#> GSM381239     4  0.2760     1.0000 0.000  0 0.128 0.872
#> GSM381242     3  0.6292     0.0653 0.416  0 0.524 0.060
#> GSM381247     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381248     1  0.2759     0.6844 0.904  0 0.052 0.044
#> GSM381249     1  0.5865     0.3764 0.552  0 0.412 0.036
#> GSM381253     3  0.2266     0.6679 0.084  0 0.912 0.004
#> GSM381255     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381258     3  0.6212     0.1581 0.380  0 0.560 0.060
#> GSM381262     3  0.2081     0.6494 0.000  0 0.916 0.084
#> GSM381266     3  0.3266     0.5934 0.000  0 0.832 0.168
#> GSM381267     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381269     1  0.5873     0.3677 0.548  0 0.416 0.036
#> GSM381273     3  0.2760     0.6302 0.000  0 0.872 0.128
#> GSM381274     2  0.0000     1.0000 0.000  1 0.000 0.000
#> GSM381276     1  0.6268     0.2292 0.496  0 0.448 0.056

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     5  0.4249     0.4338 0.000 0.000 0.432 0.000 0.568
#> GSM381199     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381205     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381220     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381222     3  0.3231     0.6628 0.196 0.000 0.800 0.000 0.004
#> GSM381224     3  0.3878     0.6424 0.236 0.000 0.748 0.000 0.016
#> GSM381232     4  0.0290     1.0000 0.000 0.000 0.008 0.992 0.000
#> GSM381240     3  0.4235     0.3774 0.424 0.000 0.576 0.000 0.000
#> GSM381250     3  0.4242    -0.1141 0.000 0.000 0.572 0.000 0.428
#> GSM381252     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381254     1  0.2488     0.8425 0.872 0.000 0.124 0.000 0.004
#> GSM381256     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381257     1  0.2471     0.8280 0.864 0.000 0.136 0.000 0.000
#> GSM381259     1  0.0290     0.9350 0.992 0.000 0.008 0.000 0.000
#> GSM381260     3  0.0579     0.6559 0.008 0.000 0.984 0.000 0.008
#> GSM381261     2  0.0290     0.9939 0.000 0.992 0.000 0.008 0.000
#> GSM381263     3  0.4242    -0.0975 0.000 0.000 0.572 0.000 0.428
#> GSM381265     1  0.0290     0.9350 0.992 0.000 0.008 0.000 0.000
#> GSM381268     5  0.4192     0.5081 0.000 0.000 0.404 0.000 0.596
#> GSM381270     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381271     4  0.0290     1.0000 0.000 0.000 0.008 0.992 0.000
#> GSM381275     2  0.0290     0.9939 0.000 0.992 0.000 0.008 0.000
#> GSM381279     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381195     1  0.0290     0.9350 0.992 0.000 0.008 0.000 0.000
#> GSM381196     3  0.4367    -0.0763 0.004 0.000 0.580 0.000 0.416
#> GSM381198     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381200     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381201     5  0.4161     0.5279 0.000 0.000 0.392 0.000 0.608
#> GSM381203     3  0.6351     0.0612 0.192 0.000 0.508 0.000 0.300
#> GSM381204     1  0.0290     0.9350 0.992 0.000 0.008 0.000 0.000
#> GSM381209     1  0.1965     0.8796 0.904 0.000 0.096 0.000 0.000
#> GSM381212     1  0.0290     0.9350 0.992 0.000 0.008 0.000 0.000
#> GSM381213     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381214     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381216     3  0.0162     0.6528 0.000 0.000 0.996 0.000 0.004
#> GSM381225     5  0.2773     0.7429 0.000 0.000 0.164 0.000 0.836
#> GSM381231     4  0.0290     1.0000 0.000 0.000 0.008 0.992 0.000
#> GSM381235     3  0.1041     0.6482 0.004 0.000 0.964 0.000 0.032
#> GSM381237     1  0.0290     0.9350 0.992 0.000 0.008 0.000 0.000
#> GSM381241     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381243     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381245     3  0.4242     0.3702 0.428 0.000 0.572 0.000 0.000
#> GSM381246     2  0.0290     0.9939 0.000 0.992 0.000 0.008 0.000
#> GSM381251     5  0.1792     0.7760 0.000 0.000 0.084 0.000 0.916
#> GSM381264     1  0.0290     0.9350 0.992 0.000 0.008 0.000 0.000
#> GSM381206     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381217     3  0.3381     0.4997 0.016 0.000 0.808 0.000 0.176
#> GSM381218     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381226     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381227     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381228     4  0.0290     1.0000 0.000 0.000 0.008 0.992 0.000
#> GSM381236     4  0.0290     1.0000 0.000 0.000 0.008 0.992 0.000
#> GSM381244     3  0.3752     0.5847 0.292 0.000 0.708 0.000 0.000
#> GSM381272     4  0.0290     1.0000 0.000 0.000 0.008 0.992 0.000
#> GSM381277     3  0.2616     0.6745 0.100 0.000 0.880 0.000 0.020
#> GSM381278     5  0.1082     0.7230 0.008 0.000 0.028 0.000 0.964
#> GSM381197     3  0.1168     0.6578 0.032 0.000 0.960 0.000 0.008
#> GSM381202     3  0.0992     0.6603 0.024 0.000 0.968 0.000 0.008
#> GSM381207     3  0.4138     0.4581 0.384 0.000 0.616 0.000 0.000
#> GSM381208     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381210     3  0.4219     0.3939 0.416 0.000 0.584 0.000 0.000
#> GSM381215     3  0.4305    -0.2998 0.000 0.000 0.512 0.000 0.488
#> GSM381219     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381221     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381223     2  0.0290     0.9939 0.000 0.992 0.000 0.008 0.000
#> GSM381229     5  0.1732     0.7760 0.000 0.000 0.080 0.000 0.920
#> GSM381230     1  0.0510     0.9316 0.984 0.000 0.016 0.000 0.000
#> GSM381233     3  0.3231     0.6628 0.196 0.000 0.800 0.000 0.004
#> GSM381234     1  0.2536     0.8370 0.868 0.000 0.128 0.000 0.004
#> GSM381238     4  0.0290     1.0000 0.000 0.000 0.008 0.992 0.000
#> GSM381239     4  0.0290     1.0000 0.000 0.000 0.008 0.992 0.000
#> GSM381242     3  0.0579     0.6559 0.008 0.000 0.984 0.000 0.008
#> GSM381247     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381248     1  0.3536     0.8207 0.832 0.000 0.084 0.000 0.084
#> GSM381249     3  0.2674     0.6737 0.140 0.000 0.856 0.000 0.004
#> GSM381253     3  0.4242    -0.1141 0.000 0.000 0.572 0.000 0.428
#> GSM381255     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381258     3  0.0963     0.6423 0.000 0.000 0.964 0.000 0.036
#> GSM381262     5  0.3561     0.6879 0.000 0.000 0.260 0.000 0.740
#> GSM381266     5  0.0579     0.7201 0.008 0.000 0.008 0.000 0.984
#> GSM381267     2  0.0000     0.9987 0.000 1.000 0.000 0.000 0.000
#> GSM381269     3  0.2629     0.6733 0.136 0.000 0.860 0.000 0.004
#> GSM381273     5  0.1732     0.7760 0.000 0.000 0.080 0.000 0.920
#> GSM381274     2  0.0290     0.9939 0.000 0.992 0.000 0.008 0.000
#> GSM381276     3  0.2616     0.6745 0.100 0.000 0.880 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
#> GSM381194     3  0.4971      0.664 0.000 0.000 0.604  0 0.300 0.096
#> GSM381199     2  0.1327      0.904 0.000 0.936 0.000  0 0.000 0.064
#> GSM381205     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381211     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381220     2  0.1267      0.907 0.000 0.940 0.000  0 0.000 0.060
#> GSM381222     5  0.3377      0.733 0.188 0.000 0.000  0 0.784 0.028
#> GSM381224     5  0.4500      0.689 0.224 0.000 0.000  0 0.688 0.088
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381240     5  0.4537      0.464 0.412 0.000 0.000  0 0.552 0.036
#> GSM381250     3  0.5186      0.559 0.000 0.000 0.476  0 0.436 0.088
#> GSM381252     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381254     1  0.2454      0.841 0.876 0.000 0.004  0 0.104 0.016
#> GSM381256     2  0.1075      0.912 0.000 0.952 0.000  0 0.000 0.048
#> GSM381257     1  0.2135      0.814 0.872 0.000 0.000  0 0.128 0.000
#> GSM381259     1  0.0000      0.932 1.000 0.000 0.000  0 0.000 0.000
#> GSM381260     5  0.1429      0.686 0.004 0.000 0.004  0 0.940 0.052
#> GSM381261     6  0.3774      0.996 0.000 0.408 0.000  0 0.000 0.592
#> GSM381263     3  0.5223      0.546 0.000 0.000 0.472  0 0.436 0.092
#> GSM381265     1  0.0000      0.932 1.000 0.000 0.000  0 0.000 0.000
#> GSM381268     3  0.4309      0.676 0.000 0.000 0.660  0 0.296 0.044
#> GSM381270     2  0.1327      0.904 0.000 0.936 0.000  0 0.000 0.064
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381275     6  0.3774      0.996 0.000 0.408 0.000  0 0.000 0.592
#> GSM381279     2  0.1327      0.904 0.000 0.936 0.000  0 0.000 0.064
#> GSM381195     1  0.0000      0.932 1.000 0.000 0.000  0 0.000 0.000
#> GSM381196     3  0.5318      0.535 0.004 0.000 0.460  0 0.448 0.088
#> GSM381198     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381200     2  0.1610      0.877 0.000 0.916 0.000  0 0.000 0.084
#> GSM381201     3  0.3835      0.676 0.000 0.000 0.684  0 0.300 0.016
#> GSM381203     5  0.7300     -0.266 0.200 0.000 0.232  0 0.420 0.148
#> GSM381204     1  0.0000      0.932 1.000 0.000 0.000  0 0.000 0.000
#> GSM381209     1  0.1951      0.875 0.908 0.000 0.000  0 0.076 0.016
#> GSM381212     1  0.0000      0.932 1.000 0.000 0.000  0 0.000 0.000
#> GSM381213     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381214     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381216     5  0.0458      0.693 0.000 0.000 0.000  0 0.984 0.016
#> GSM381225     3  0.2932      0.642 0.000 0.000 0.820  0 0.016 0.164
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381235     5  0.1313      0.687 0.004 0.000 0.028  0 0.952 0.016
#> GSM381237     1  0.0146      0.931 0.996 0.000 0.000  0 0.000 0.004
#> GSM381241     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381243     2  0.1327      0.904 0.000 0.936 0.000  0 0.000 0.064
#> GSM381245     5  0.4488      0.450 0.420 0.000 0.000  0 0.548 0.032
#> GSM381246     6  0.3789      0.985 0.000 0.416 0.000  0 0.000 0.584
#> GSM381251     3  0.0291      0.668 0.000 0.000 0.992  0 0.004 0.004
#> GSM381264     1  0.0000      0.932 1.000 0.000 0.000  0 0.000 0.000
#> GSM381206     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381217     5  0.4297      0.439 0.016 0.000 0.132  0 0.756 0.096
#> GSM381218     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381226     2  0.3634     -0.261 0.000 0.644 0.000  0 0.000 0.356
#> GSM381227     2  0.1327      0.904 0.000 0.936 0.000  0 0.000 0.064
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381244     5  0.4368      0.659 0.272 0.000 0.000  0 0.672 0.056
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381277     5  0.3579      0.720 0.072 0.000 0.004  0 0.804 0.120
#> GSM381278     3  0.2703      0.595 0.000 0.000 0.824  0 0.004 0.172
#> GSM381197     5  0.1642      0.690 0.028 0.000 0.004  0 0.936 0.032
#> GSM381202     5  0.1485      0.693 0.024 0.000 0.004  0 0.944 0.028
#> GSM381207     5  0.4453      0.540 0.372 0.000 0.000  0 0.592 0.036
#> GSM381208     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381210     5  0.4468      0.478 0.408 0.000 0.000  0 0.560 0.032
#> GSM381215     3  0.4808      0.577 0.000 0.000 0.536  0 0.408 0.056
#> GSM381219     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381221     2  0.1141      0.911 0.000 0.948 0.000  0 0.000 0.052
#> GSM381223     6  0.3774      0.996 0.000 0.408 0.000  0 0.000 0.592
#> GSM381229     3  0.0713      0.658 0.000 0.000 0.972  0 0.000 0.028
#> GSM381230     1  0.0260      0.929 0.992 0.000 0.000  0 0.008 0.000
#> GSM381233     5  0.3377      0.733 0.188 0.000 0.000  0 0.784 0.028
#> GSM381234     1  0.2501      0.836 0.872 0.000 0.004  0 0.108 0.016
#> GSM381238     4  0.0000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381242     5  0.1429      0.686 0.004 0.000 0.004  0 0.940 0.052
#> GSM381247     2  0.1327      0.904 0.000 0.936 0.000  0 0.000 0.064
#> GSM381248     1  0.3633      0.791 0.800 0.000 0.004  0 0.076 0.120
#> GSM381249     5  0.2831      0.741 0.136 0.000 0.000  0 0.840 0.024
#> GSM381253     3  0.5186      0.559 0.000 0.000 0.476  0 0.436 0.088
#> GSM381255     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381258     5  0.1245      0.679 0.000 0.000 0.032  0 0.952 0.016
#> GSM381262     3  0.3694      0.699 0.000 0.000 0.784  0 0.140 0.076
#> GSM381266     3  0.2191      0.615 0.000 0.000 0.876  0 0.004 0.120
#> GSM381267     2  0.0000      0.926 0.000 1.000 0.000  0 0.000 0.000
#> GSM381269     5  0.2790      0.741 0.132 0.000 0.000  0 0.844 0.024
#> GSM381273     3  0.0713      0.658 0.000 0.000 0.972  0 0.000 0.028
#> GSM381274     6  0.3774      0.996 0.000 0.408 0.000  0 0.000 0.592
#> GSM381276     5  0.3579      0.720 0.072 0.000 0.004  0 0.804 0.120

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 other(p) k
#> MAD:hclust 71    0.531 2
#> MAD:hclust 66    0.491 3
#> MAD:hclust 70    0.571 4
#> MAD:hclust 74    0.318 5
#> MAD:hclust 80    0.393 6

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


MAD:kmeans

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 51941 rows and 86 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.829           0.979       0.989         0.4580 0.548   0.548
#> 3 3 0.749           0.925       0.917         0.4001 0.781   0.600
#> 4 4 0.762           0.787       0.843         0.1153 0.903   0.723
#> 5 5 0.715           0.635       0.738         0.0708 0.925   0.742
#> 6 6 0.745           0.696       0.791         0.0483 0.923   0.680

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
#> GSM381194     1   0.000      0.983 1.00 0.00
#> GSM381199     2   0.000      1.000 0.00 1.00
#> GSM381205     2   0.000      1.000 0.00 1.00
#> GSM381211     2   0.000      1.000 0.00 1.00
#> GSM381220     2   0.000      1.000 0.00 1.00
#> GSM381222     1   0.000      0.983 1.00 0.00
#> GSM381224     1   0.000      0.983 1.00 0.00
#> GSM381232     1   0.529      0.881 0.88 0.12
#> GSM381240     1   0.000      0.983 1.00 0.00
#> GSM381250     1   0.000      0.983 1.00 0.00
#> GSM381252     2   0.000      1.000 0.00 1.00
#> GSM381254     1   0.000      0.983 1.00 0.00
#> GSM381256     2   0.000      1.000 0.00 1.00
#> GSM381257     1   0.000      0.983 1.00 0.00
#> GSM381259     1   0.000      0.983 1.00 0.00
#> GSM381260     1   0.000      0.983 1.00 0.00
#> GSM381261     2   0.000      1.000 0.00 1.00
#> GSM381263     1   0.000      0.983 1.00 0.00
#> GSM381265     1   0.000      0.983 1.00 0.00
#> GSM381268     1   0.000      0.983 1.00 0.00
#> GSM381270     2   0.000      1.000 0.00 1.00
#> GSM381271     1   0.529      0.881 0.88 0.12
#> GSM381275     2   0.000      1.000 0.00 1.00
#> GSM381279     2   0.000      1.000 0.00 1.00
#> GSM381195     1   0.000      0.983 1.00 0.00
#> GSM381196     1   0.000      0.983 1.00 0.00
#> GSM381198     2   0.000      1.000 0.00 1.00
#> GSM381200     2   0.000      1.000 0.00 1.00
#> GSM381201     1   0.000      0.983 1.00 0.00
#> GSM381203     1   0.000      0.983 1.00 0.00
#> GSM381204     1   0.000      0.983 1.00 0.00
#> GSM381209     1   0.000      0.983 1.00 0.00
#> GSM381212     1   0.000      0.983 1.00 0.00
#> GSM381213     2   0.000      1.000 0.00 1.00
#> GSM381214     2   0.000      1.000 0.00 1.00
#> GSM381216     1   0.000      0.983 1.00 0.00
#> GSM381225     1   0.000      0.983 1.00 0.00
#> GSM381231     1   0.529      0.881 0.88 0.12
#> GSM381235     1   0.000      0.983 1.00 0.00
#> GSM381237     1   0.000      0.983 1.00 0.00
#> GSM381241     2   0.000      1.000 0.00 1.00
#> GSM381243     2   0.000      1.000 0.00 1.00
#> GSM381245     1   0.000      0.983 1.00 0.00
#> GSM381246     2   0.000      1.000 0.00 1.00
#> GSM381251     1   0.000      0.983 1.00 0.00
#> GSM381264     1   0.000      0.983 1.00 0.00
#> GSM381206     2   0.000      1.000 0.00 1.00
#> GSM381217     1   0.000      0.983 1.00 0.00
#> GSM381218     2   0.000      1.000 0.00 1.00
#> GSM381226     2   0.000      1.000 0.00 1.00
#> GSM381227     2   0.000      1.000 0.00 1.00
#> GSM381228     1   0.529      0.881 0.88 0.12
#> GSM381236     1   0.529      0.881 0.88 0.12
#> GSM381244     1   0.000      0.983 1.00 0.00
#> GSM381272     1   0.529      0.881 0.88 0.12
#> GSM381277     1   0.000      0.983 1.00 0.00
#> GSM381278     1   0.000      0.983 1.00 0.00
#> GSM381197     1   0.000      0.983 1.00 0.00
#> GSM381202     1   0.000      0.983 1.00 0.00
#> GSM381207     1   0.000      0.983 1.00 0.00
#> GSM381208     2   0.000      1.000 0.00 1.00
#> GSM381210     1   0.000      0.983 1.00 0.00
#> GSM381215     1   0.000      0.983 1.00 0.00
#> GSM381219     2   0.000      1.000 0.00 1.00
#> GSM381221     2   0.000      1.000 0.00 1.00
#> GSM381223     2   0.000      1.000 0.00 1.00
#> GSM381229     1   0.000      0.983 1.00 0.00
#> GSM381230     1   0.000      0.983 1.00 0.00
#> GSM381233     1   0.000      0.983 1.00 0.00
#> GSM381234     1   0.000      0.983 1.00 0.00
#> GSM381238     1   0.529      0.881 0.88 0.12
#> GSM381239     1   0.529      0.881 0.88 0.12
#> GSM381242     1   0.000      0.983 1.00 0.00
#> GSM381247     2   0.000      1.000 0.00 1.00
#> GSM381248     1   0.000      0.983 1.00 0.00
#> GSM381249     1   0.000      0.983 1.00 0.00
#> GSM381253     1   0.000      0.983 1.00 0.00
#> GSM381255     2   0.000      1.000 0.00 1.00
#> GSM381258     1   0.000      0.983 1.00 0.00
#> GSM381262     1   0.000      0.983 1.00 0.00
#> GSM381266     1   0.000      0.983 1.00 0.00
#> GSM381267     2   0.000      1.000 0.00 1.00
#> GSM381269     1   0.000      0.983 1.00 0.00
#> GSM381273     1   0.000      0.983 1.00 0.00
#> GSM381274     2   0.000      1.000 0.00 1.00
#> GSM381276     1   0.000      0.983 1.00 0.00

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM381194     3  0.4235      0.881 0.176 0.000 0.824
#> GSM381199     2  0.1860      0.967 0.000 0.948 0.052
#> GSM381205     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381211     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381220     2  0.1289      0.970 0.000 0.968 0.032
#> GSM381222     1  0.1031      0.970 0.976 0.000 0.024
#> GSM381224     1  0.0424      0.978 0.992 0.000 0.008
#> GSM381232     3  0.4196      0.867 0.112 0.024 0.864
#> GSM381240     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381250     3  0.6079      0.684 0.388 0.000 0.612
#> GSM381252     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381254     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381256     2  0.0000      0.970 0.000 1.000 0.000
#> GSM381257     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381259     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381260     1  0.3116      0.858 0.892 0.000 0.108
#> GSM381261     2  0.3116      0.952 0.000 0.892 0.108
#> GSM381263     3  0.6079      0.684 0.388 0.000 0.612
#> GSM381265     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381268     3  0.4931      0.849 0.232 0.000 0.768
#> GSM381270     2  0.2878      0.956 0.000 0.904 0.096
#> GSM381271     3  0.4196      0.867 0.112 0.024 0.864
#> GSM381275     2  0.3038      0.954 0.000 0.896 0.104
#> GSM381279     2  0.2878      0.956 0.000 0.904 0.096
#> GSM381195     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381196     3  0.6079      0.684 0.388 0.000 0.612
#> GSM381198     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381200     2  0.2066      0.965 0.000 0.940 0.060
#> GSM381201     3  0.4235      0.881 0.176 0.000 0.824
#> GSM381203     1  0.0424      0.977 0.992 0.000 0.008
#> GSM381204     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381209     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381212     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381213     2  0.1860      0.965 0.000 0.948 0.052
#> GSM381214     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381216     1  0.1289      0.965 0.968 0.000 0.032
#> GSM381225     3  0.6045      0.696 0.380 0.000 0.620
#> GSM381231     3  0.4121      0.864 0.108 0.024 0.868
#> GSM381235     1  0.1289      0.965 0.968 0.000 0.032
#> GSM381237     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381241     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381243     2  0.2878      0.956 0.000 0.904 0.096
#> GSM381245     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381246     2  0.0747      0.970 0.000 0.984 0.016
#> GSM381251     3  0.4235      0.881 0.176 0.000 0.824
#> GSM381264     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381206     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381217     1  0.1289      0.965 0.968 0.000 0.032
#> GSM381218     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381226     2  0.1163      0.970 0.000 0.972 0.028
#> GSM381227     2  0.2959      0.955 0.000 0.900 0.100
#> GSM381228     3  0.4196      0.867 0.112 0.024 0.864
#> GSM381236     3  0.4196      0.867 0.112 0.024 0.864
#> GSM381244     1  0.0892      0.973 0.980 0.000 0.020
#> GSM381272     3  0.4196      0.867 0.112 0.024 0.864
#> GSM381277     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381278     3  0.3752      0.880 0.144 0.000 0.856
#> GSM381197     1  0.2356      0.904 0.928 0.000 0.072
#> GSM381202     1  0.0424      0.978 0.992 0.000 0.008
#> GSM381207     1  0.0424      0.978 0.992 0.000 0.008
#> GSM381208     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381210     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381215     3  0.4235      0.881 0.176 0.000 0.824
#> GSM381219     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381221     2  0.0892      0.970 0.000 0.980 0.020
#> GSM381223     2  0.3038      0.954 0.000 0.896 0.104
#> GSM381229     3  0.4235      0.881 0.176 0.000 0.824
#> GSM381230     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381233     1  0.1031      0.970 0.976 0.000 0.024
#> GSM381234     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381238     3  0.4121      0.864 0.108 0.024 0.868
#> GSM381239     3  0.4196      0.867 0.112 0.024 0.864
#> GSM381242     1  0.2796      0.890 0.908 0.000 0.092
#> GSM381247     2  0.2878      0.956 0.000 0.904 0.096
#> GSM381248     1  0.0000      0.980 1.000 0.000 0.000
#> GSM381249     1  0.0747      0.975 0.984 0.000 0.016
#> GSM381253     3  0.6180      0.628 0.416 0.000 0.584
#> GSM381255     2  0.0237      0.970 0.000 0.996 0.004
#> GSM381258     3  0.5327      0.817 0.272 0.000 0.728
#> GSM381262     3  0.4235      0.881 0.176 0.000 0.824
#> GSM381266     3  0.3752      0.880 0.144 0.000 0.856
#> GSM381267     2  0.1289      0.970 0.000 0.968 0.032
#> GSM381269     1  0.1031      0.970 0.976 0.000 0.024
#> GSM381273     3  0.3752      0.880 0.144 0.000 0.856
#> GSM381274     2  0.2959      0.955 0.000 0.900 0.100
#> GSM381276     3  0.6062      0.694 0.384 0.000 0.616

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.5923      0.700 0.044 0.000 0.580 0.376
#> GSM381199     2  0.4040      0.845 0.000 0.752 0.248 0.000
#> GSM381205     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381211     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381220     2  0.3688      0.853 0.000 0.792 0.208 0.000
#> GSM381222     1  0.2216      0.848 0.908 0.000 0.092 0.000
#> GSM381224     1  0.0921      0.897 0.972 0.000 0.028 0.000
#> GSM381232     4  0.0592      1.000 0.016 0.000 0.000 0.984
#> GSM381240     1  0.0188      0.910 0.996 0.000 0.004 0.000
#> GSM381250     3  0.6950      0.744 0.180 0.000 0.584 0.236
#> GSM381252     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381254     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381256     2  0.0469      0.863 0.000 0.988 0.012 0.000
#> GSM381257     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381260     3  0.5853      0.350 0.460 0.000 0.508 0.032
#> GSM381261     2  0.5284      0.796 0.000 0.616 0.368 0.016
#> GSM381263     3  0.6950      0.744 0.180 0.000 0.584 0.236
#> GSM381265     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381268     3  0.6407      0.727 0.084 0.000 0.584 0.332
#> GSM381270     2  0.4697      0.812 0.000 0.644 0.356 0.000
#> GSM381271     4  0.0592      1.000 0.016 0.000 0.000 0.984
#> GSM381275     2  0.5253      0.800 0.000 0.624 0.360 0.016
#> GSM381279     2  0.4697      0.812 0.000 0.644 0.356 0.000
#> GSM381195     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381196     3  0.6950      0.744 0.180 0.000 0.584 0.236
#> GSM381198     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381200     2  0.4252      0.844 0.000 0.744 0.252 0.004
#> GSM381201     3  0.5923      0.700 0.044 0.000 0.580 0.376
#> GSM381203     1  0.4998     -0.277 0.512 0.000 0.488 0.000
#> GSM381204     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381213     2  0.3444      0.847 0.000 0.816 0.184 0.000
#> GSM381214     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381216     3  0.4933      0.380 0.432 0.000 0.568 0.000
#> GSM381225     3  0.6823      0.744 0.160 0.000 0.596 0.244
#> GSM381231     4  0.0592      1.000 0.016 0.000 0.000 0.984
#> GSM381235     3  0.4830      0.465 0.392 0.000 0.608 0.000
#> GSM381237     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381243     2  0.4697      0.812 0.000 0.644 0.356 0.000
#> GSM381245     1  0.0336      0.909 0.992 0.000 0.008 0.000
#> GSM381246     2  0.0657      0.863 0.000 0.984 0.012 0.004
#> GSM381251     3  0.5923      0.700 0.044 0.000 0.580 0.376
#> GSM381264     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381206     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381217     3  0.4941      0.370 0.436 0.000 0.564 0.000
#> GSM381218     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381226     2  0.2401      0.864 0.000 0.904 0.092 0.004
#> GSM381227     2  0.4697      0.812 0.000 0.644 0.356 0.000
#> GSM381228     4  0.0592      1.000 0.016 0.000 0.000 0.984
#> GSM381236     4  0.0592      1.000 0.016 0.000 0.000 0.984
#> GSM381244     1  0.2011      0.862 0.920 0.000 0.080 0.000
#> GSM381272     4  0.0592      1.000 0.016 0.000 0.000 0.984
#> GSM381277     1  0.0336      0.909 0.992 0.000 0.008 0.000
#> GSM381278     3  0.5660      0.668 0.028 0.000 0.576 0.396
#> GSM381197     1  0.5497     -0.226 0.524 0.000 0.460 0.016
#> GSM381202     1  0.4830      0.103 0.608 0.000 0.392 0.000
#> GSM381207     1  0.0469      0.908 0.988 0.000 0.012 0.000
#> GSM381208     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381210     1  0.0188      0.910 0.996 0.000 0.004 0.000
#> GSM381215     3  0.5855      0.707 0.044 0.000 0.600 0.356
#> GSM381219     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381221     2  0.2216      0.864 0.000 0.908 0.092 0.000
#> GSM381223     2  0.5253      0.800 0.000 0.624 0.360 0.016
#> GSM381229     3  0.5923      0.700 0.044 0.000 0.580 0.376
#> GSM381230     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381233     1  0.2216      0.848 0.908 0.000 0.092 0.000
#> GSM381234     1  0.0000      0.911 1.000 0.000 0.000 0.000
#> GSM381238     4  0.0592      1.000 0.016 0.000 0.000 0.984
#> GSM381239     4  0.0592      1.000 0.016 0.000 0.000 0.984
#> GSM381242     3  0.5466      0.369 0.436 0.000 0.548 0.016
#> GSM381247     2  0.4697      0.812 0.000 0.644 0.356 0.000
#> GSM381248     1  0.0188      0.910 0.996 0.000 0.004 0.000
#> GSM381249     1  0.1118      0.894 0.964 0.000 0.036 0.000
#> GSM381253     3  0.6973      0.735 0.196 0.000 0.584 0.220
#> GSM381255     2  0.0000      0.862 0.000 1.000 0.000 0.000
#> GSM381258     3  0.6436      0.736 0.100 0.000 0.608 0.292
#> GSM381262     3  0.5923      0.700 0.044 0.000 0.580 0.376
#> GSM381266     3  0.5660      0.668 0.028 0.000 0.576 0.396
#> GSM381267     2  0.3688      0.853 0.000 0.792 0.208 0.000
#> GSM381269     1  0.2216      0.848 0.908 0.000 0.092 0.000
#> GSM381273     3  0.5660      0.668 0.028 0.000 0.576 0.396
#> GSM381274     2  0.5253      0.800 0.000 0.624 0.360 0.016
#> GSM381276     3  0.7129      0.732 0.196 0.000 0.560 0.244

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.0867     0.8527 0.008 0.000 0.976 0.008 0.008
#> GSM381199     2  0.4570     0.5908 0.000 0.632 0.000 0.020 0.348
#> GSM381205     2  0.0404     0.7900 0.000 0.988 0.000 0.012 0.000
#> GSM381211     2  0.0324     0.7905 0.000 0.992 0.000 0.004 0.004
#> GSM381220     2  0.4196     0.5897 0.000 0.640 0.000 0.004 0.356
#> GSM381222     1  0.4639     0.6880 0.708 0.000 0.056 0.000 0.236
#> GSM381224     1  0.4096     0.7051 0.724 0.000 0.012 0.004 0.260
#> GSM381232     4  0.3328     0.9921 0.004 0.000 0.176 0.812 0.008
#> GSM381240     1  0.0566     0.8455 0.984 0.000 0.000 0.004 0.012
#> GSM381250     3  0.2983     0.8296 0.056 0.000 0.868 0.000 0.076
#> GSM381252     2  0.0162     0.7907 0.000 0.996 0.000 0.004 0.000
#> GSM381254     1  0.0451     0.8442 0.988 0.000 0.000 0.004 0.008
#> GSM381256     2  0.1106     0.7882 0.000 0.964 0.000 0.012 0.024
#> GSM381257     1  0.0880     0.8395 0.968 0.000 0.000 0.000 0.032
#> GSM381259     1  0.0000     0.8465 1.000 0.000 0.000 0.000 0.000
#> GSM381260     5  0.7006    -0.1174 0.272 0.000 0.344 0.008 0.376
#> GSM381261     2  0.6421     0.4168 0.000 0.464 0.008 0.136 0.392
#> GSM381263     3  0.2983     0.8296 0.056 0.000 0.868 0.000 0.076
#> GSM381265     1  0.0000     0.8465 1.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.0865     0.8541 0.024 0.000 0.972 0.004 0.000
#> GSM381270     5  0.4300    -0.4179 0.000 0.476 0.000 0.000 0.524
#> GSM381271     4  0.3365     0.9943 0.004 0.000 0.180 0.808 0.008
#> GSM381275     2  0.6315     0.4440 0.000 0.484 0.004 0.140 0.372
#> GSM381279     5  0.4300    -0.4179 0.000 0.476 0.000 0.000 0.524
#> GSM381195     1  0.0162     0.8456 0.996 0.000 0.000 0.000 0.004
#> GSM381196     3  0.3051     0.8293 0.060 0.000 0.864 0.000 0.076
#> GSM381198     2  0.0162     0.7907 0.000 0.996 0.000 0.004 0.000
#> GSM381200     2  0.5005     0.6255 0.000 0.660 0.000 0.064 0.276
#> GSM381201     3  0.0579     0.8522 0.008 0.000 0.984 0.008 0.000
#> GSM381203     3  0.5434     0.4276 0.336 0.000 0.588 0.000 0.076
#> GSM381204     1  0.0000     0.8465 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.8465 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.8465 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.3906     0.6302 0.000 0.704 0.000 0.004 0.292
#> GSM381214     2  0.0324     0.7905 0.000 0.992 0.000 0.004 0.004
#> GSM381216     5  0.6584    -0.1218 0.208 0.000 0.380 0.000 0.412
#> GSM381225     3  0.1830     0.8429 0.052 0.000 0.932 0.012 0.004
#> GSM381231     4  0.3365     0.9943 0.004 0.000 0.180 0.808 0.008
#> GSM381235     5  0.6460    -0.1759 0.180 0.000 0.408 0.000 0.412
#> GSM381237     1  0.0000     0.8465 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000     0.7905 0.000 1.000 0.000 0.000 0.000
#> GSM381243     5  0.4300    -0.4179 0.000 0.476 0.000 0.000 0.524
#> GSM381245     1  0.1168     0.8421 0.960 0.000 0.000 0.008 0.032
#> GSM381246     2  0.1831     0.7752 0.000 0.920 0.000 0.076 0.004
#> GSM381251     3  0.0579     0.8522 0.008 0.000 0.984 0.008 0.000
#> GSM381264     1  0.0162     0.8456 0.996 0.000 0.000 0.000 0.004
#> GSM381206     2  0.0404     0.7900 0.000 0.988 0.000 0.012 0.000
#> GSM381217     5  0.6536    -0.1423 0.196 0.000 0.392 0.000 0.412
#> GSM381218     2  0.0451     0.7899 0.000 0.988 0.000 0.004 0.008
#> GSM381226     2  0.3586     0.7432 0.000 0.828 0.000 0.076 0.096
#> GSM381227     5  0.4302    -0.4228 0.000 0.480 0.000 0.000 0.520
#> GSM381228     4  0.3086     0.9939 0.004 0.000 0.180 0.816 0.000
#> GSM381236     4  0.3048     0.9936 0.004 0.000 0.176 0.820 0.000
#> GSM381244     1  0.5594     0.4993 0.532 0.000 0.048 0.012 0.408
#> GSM381272     4  0.3365     0.9943 0.004 0.000 0.180 0.808 0.008
#> GSM381277     1  0.2361     0.8129 0.892 0.000 0.000 0.012 0.096
#> GSM381278     3  0.0740     0.8504 0.008 0.000 0.980 0.008 0.004
#> GSM381197     1  0.7056    -0.0866 0.348 0.000 0.316 0.008 0.328
#> GSM381202     1  0.6696     0.0991 0.388 0.000 0.240 0.000 0.372
#> GSM381207     1  0.2362     0.8218 0.900 0.000 0.008 0.008 0.084
#> GSM381208     2  0.0566     0.7904 0.000 0.984 0.000 0.012 0.004
#> GSM381210     1  0.1478     0.8308 0.936 0.000 0.000 0.000 0.064
#> GSM381215     3  0.1830     0.8410 0.008 0.000 0.924 0.000 0.068
#> GSM381219     2  0.0404     0.7901 0.000 0.988 0.000 0.012 0.000
#> GSM381221     2  0.2753     0.7504 0.000 0.856 0.000 0.008 0.136
#> GSM381223     2  0.6315     0.4440 0.000 0.484 0.004 0.140 0.372
#> GSM381229     3  0.0579     0.8522 0.008 0.000 0.984 0.008 0.000
#> GSM381230     1  0.0000     0.8465 1.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.4639     0.6880 0.708 0.000 0.056 0.000 0.236
#> GSM381234     1  0.0451     0.8442 0.988 0.000 0.000 0.004 0.008
#> GSM381238     4  0.3048     0.9936 0.004 0.000 0.176 0.820 0.000
#> GSM381239     4  0.3048     0.9936 0.004 0.000 0.176 0.820 0.000
#> GSM381242     5  0.6852    -0.1125 0.216 0.000 0.364 0.008 0.412
#> GSM381247     5  0.4300    -0.4179 0.000 0.476 0.000 0.000 0.524
#> GSM381248     1  0.0992     0.8432 0.968 0.000 0.000 0.008 0.024
#> GSM381249     1  0.4058     0.7144 0.740 0.000 0.024 0.000 0.236
#> GSM381253     3  0.3051     0.8261 0.060 0.000 0.864 0.000 0.076
#> GSM381255     2  0.0324     0.7905 0.000 0.992 0.000 0.004 0.004
#> GSM381258     3  0.4982     0.4189 0.032 0.000 0.556 0.000 0.412
#> GSM381262     3  0.0579     0.8522 0.008 0.000 0.984 0.008 0.000
#> GSM381266     3  0.0579     0.8522 0.008 0.000 0.984 0.008 0.000
#> GSM381267     2  0.4196     0.5897 0.000 0.640 0.000 0.004 0.356
#> GSM381269     1  0.5359     0.4843 0.532 0.000 0.056 0.000 0.412
#> GSM381273     3  0.0579     0.8522 0.008 0.000 0.984 0.008 0.000
#> GSM381274     2  0.6315     0.4440 0.000 0.484 0.004 0.140 0.372
#> GSM381276     3  0.5912     0.4176 0.088 0.000 0.544 0.008 0.360

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.0696     0.8907 0.004 0.000 0.980 0.004 0.008 0.004
#> GSM381199     2  0.5133    -0.3127 0.000 0.480 0.000 0.032 0.028 0.460
#> GSM381205     2  0.0870     0.7432 0.000 0.972 0.004 0.012 0.012 0.000
#> GSM381211     2  0.0891     0.7446 0.000 0.968 0.000 0.008 0.024 0.000
#> GSM381220     2  0.4338    -0.2948 0.000 0.496 0.000 0.000 0.020 0.484
#> GSM381222     1  0.5051     0.2952 0.544 0.000 0.020 0.000 0.396 0.040
#> GSM381224     1  0.4995     0.2681 0.528 0.000 0.008 0.000 0.412 0.052
#> GSM381232     4  0.1411     0.9897 0.004 0.000 0.060 0.936 0.000 0.000
#> GSM381240     1  0.2630     0.7976 0.872 0.000 0.000 0.004 0.032 0.092
#> GSM381250     3  0.3074     0.8356 0.020 0.000 0.856 0.000 0.080 0.044
#> GSM381252     2  0.0405     0.7458 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM381254     1  0.0547     0.8265 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM381256     2  0.2274     0.7175 0.000 0.908 0.000 0.028 0.028 0.036
#> GSM381257     1  0.2988     0.7685 0.852 0.000 0.004 0.000 0.060 0.084
#> GSM381259     1  0.0000     0.8313 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381260     5  0.7060     0.7276 0.188 0.000 0.232 0.004 0.472 0.104
#> GSM381261     6  0.5809     0.7195 0.000 0.272 0.000 0.000 0.232 0.496
#> GSM381263     3  0.3228     0.8233 0.020 0.000 0.844 0.000 0.092 0.044
#> GSM381265     1  0.0000     0.8313 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.1074     0.8878 0.012 0.000 0.960 0.000 0.000 0.028
#> GSM381270     6  0.3409     0.7761 0.000 0.300 0.000 0.000 0.000 0.700
#> GSM381271     4  0.1411     0.9897 0.004 0.000 0.060 0.936 0.000 0.000
#> GSM381275     6  0.5901     0.7036 0.000 0.304 0.000 0.000 0.232 0.464
#> GSM381279     6  0.3409     0.7761 0.000 0.300 0.000 0.000 0.000 0.700
#> GSM381195     1  0.0146     0.8307 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381196     3  0.3074     0.8356 0.020 0.000 0.856 0.000 0.080 0.044
#> GSM381198     2  0.0405     0.7458 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM381200     2  0.5521    -0.2543 0.000 0.516 0.000 0.020 0.080 0.384
#> GSM381201     3  0.1003     0.8885 0.004 0.000 0.964 0.004 0.000 0.028
#> GSM381203     3  0.5476     0.3657 0.252 0.000 0.624 0.000 0.080 0.044
#> GSM381204     1  0.0000     0.8313 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.8313 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.8313 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.4537    -0.0589 0.000 0.576 0.000 0.008 0.024 0.392
#> GSM381214     2  0.0993     0.7441 0.000 0.964 0.000 0.012 0.024 0.000
#> GSM381216     5  0.4789     0.7280 0.092 0.000 0.268 0.000 0.640 0.000
#> GSM381225     3  0.1552     0.8787 0.020 0.000 0.940 0.004 0.000 0.036
#> GSM381231     4  0.1668     0.9878 0.004 0.000 0.060 0.928 0.008 0.000
#> GSM381235     5  0.5049     0.6897 0.060 0.000 0.300 0.000 0.620 0.020
#> GSM381237     1  0.0000     0.8313 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0405     0.7458 0.000 0.988 0.000 0.008 0.004 0.000
#> GSM381243     6  0.3547     0.7758 0.000 0.300 0.000 0.004 0.000 0.696
#> GSM381245     1  0.3328     0.7763 0.832 0.000 0.008 0.004 0.044 0.112
#> GSM381246     2  0.3282     0.6754 0.000 0.836 0.004 0.028 0.116 0.016
#> GSM381251     3  0.0436     0.8884 0.004 0.000 0.988 0.004 0.000 0.004
#> GSM381264     1  0.0146     0.8307 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381206     2  0.0870     0.7432 0.000 0.972 0.004 0.012 0.012 0.000
#> GSM381217     5  0.5235     0.7171 0.084 0.000 0.276 0.000 0.620 0.020
#> GSM381218     2  0.0972     0.7454 0.000 0.964 0.000 0.008 0.028 0.000
#> GSM381226     2  0.4609     0.5391 0.000 0.744 0.004 0.024 0.104 0.124
#> GSM381227     6  0.3409     0.7761 0.000 0.300 0.000 0.000 0.000 0.700
#> GSM381228     4  0.2094     0.9897 0.004 0.000 0.060 0.912 0.004 0.020
#> GSM381236     4  0.2094     0.9897 0.004 0.000 0.060 0.912 0.004 0.020
#> GSM381244     5  0.6011     0.3033 0.328 0.000 0.016 0.004 0.508 0.144
#> GSM381272     4  0.1411     0.9897 0.004 0.000 0.060 0.936 0.000 0.000
#> GSM381277     1  0.4845     0.6233 0.692 0.000 0.004 0.004 0.148 0.152
#> GSM381278     3  0.1194     0.8788 0.004 0.000 0.956 0.008 0.000 0.032
#> GSM381197     5  0.7402     0.6682 0.236 0.000 0.240 0.004 0.400 0.120
#> GSM381202     5  0.6848     0.7259 0.220 0.000 0.200 0.004 0.496 0.080
#> GSM381207     1  0.4175     0.7234 0.768 0.000 0.008 0.004 0.100 0.120
#> GSM381208     2  0.1924     0.7323 0.000 0.920 0.004 0.028 0.048 0.000
#> GSM381210     1  0.2909     0.7886 0.868 0.000 0.008 0.004 0.060 0.060
#> GSM381215     3  0.2474     0.8513 0.004 0.000 0.884 0.000 0.080 0.032
#> GSM381219     2  0.1549     0.7360 0.000 0.936 0.000 0.020 0.044 0.000
#> GSM381221     2  0.3955     0.5550 0.000 0.768 0.000 0.028 0.028 0.176
#> GSM381223     6  0.5901     0.7036 0.000 0.304 0.000 0.000 0.232 0.464
#> GSM381229     3  0.0922     0.8843 0.004 0.000 0.968 0.004 0.000 0.024
#> GSM381230     1  0.0146     0.8306 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381233     1  0.5051     0.2952 0.544 0.000 0.020 0.000 0.396 0.040
#> GSM381234     1  0.0547     0.8265 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM381238     4  0.2307     0.9878 0.004 0.000 0.060 0.904 0.012 0.020
#> GSM381239     4  0.2094     0.9897 0.004 0.000 0.060 0.912 0.004 0.020
#> GSM381242     5  0.6528     0.7464 0.120 0.000 0.240 0.004 0.544 0.092
#> GSM381247     6  0.3547     0.7758 0.000 0.300 0.000 0.004 0.000 0.696
#> GSM381248     1  0.2981     0.7955 0.856 0.000 0.004 0.004 0.044 0.092
#> GSM381249     1  0.4672     0.2875 0.548 0.000 0.012 0.000 0.416 0.024
#> GSM381253     3  0.3074     0.8356 0.020 0.000 0.856 0.000 0.080 0.044
#> GSM381255     2  0.0520     0.7457 0.000 0.984 0.000 0.008 0.008 0.000
#> GSM381258     5  0.3954     0.6030 0.012 0.000 0.352 0.000 0.636 0.000
#> GSM381262     3  0.0291     0.8897 0.004 0.000 0.992 0.000 0.000 0.004
#> GSM381266     3  0.1036     0.8822 0.004 0.000 0.964 0.008 0.000 0.024
#> GSM381267     2  0.4721    -0.2895 0.000 0.492 0.000 0.012 0.024 0.472
#> GSM381269     5  0.4274     0.3853 0.336 0.000 0.024 0.000 0.636 0.004
#> GSM381273     3  0.1036     0.8822 0.004 0.000 0.964 0.008 0.000 0.024
#> GSM381274     6  0.5910     0.6985 0.000 0.308 0.000 0.000 0.232 0.460
#> GSM381276     5  0.6597     0.5504 0.052 0.000 0.376 0.004 0.428 0.140

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 other(p) k
#> MAD:kmeans 86    0.744 2
#> MAD:kmeans 86    0.863 3
#> MAD:kmeans 78    0.590 4
#> MAD:kmeans 65    0.594 5
#> MAD:kmeans 74    0.695 6

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


MAD:skmeans*

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-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.827           0.953       0.977         0.4642 0.548   0.548
#> 3 3 0.984           0.972       0.984         0.4361 0.781   0.600
#> 4 4 0.929           0.881       0.949         0.0867 0.882   0.674
#> 5 5 0.894           0.884       0.931         0.0672 0.940   0.789
#> 6 6 0.858           0.790       0.882         0.0615 0.916   0.654

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM381194     1   0.000      0.963 1.000 0.000
#> GSM381199     2   0.000      1.000 0.000 1.000
#> GSM381205     2   0.000      1.000 0.000 1.000
#> GSM381211     2   0.000      1.000 0.000 1.000
#> GSM381220     2   0.000      1.000 0.000 1.000
#> GSM381222     1   0.000      0.963 1.000 0.000
#> GSM381224     1   0.000      0.963 1.000 0.000
#> GSM381232     1   0.730      0.774 0.796 0.204
#> GSM381240     1   0.000      0.963 1.000 0.000
#> GSM381250     1   0.000      0.963 1.000 0.000
#> GSM381252     2   0.000      1.000 0.000 1.000
#> GSM381254     1   0.000      0.963 1.000 0.000
#> GSM381256     2   0.000      1.000 0.000 1.000
#> GSM381257     1   0.000      0.963 1.000 0.000
#> GSM381259     1   0.000      0.963 1.000 0.000
#> GSM381260     1   0.000      0.963 1.000 0.000
#> GSM381261     2   0.000      1.000 0.000 1.000
#> GSM381263     1   0.000      0.963 1.000 0.000
#> GSM381265     1   0.000      0.963 1.000 0.000
#> GSM381268     1   0.000      0.963 1.000 0.000
#> GSM381270     2   0.000      1.000 0.000 1.000
#> GSM381271     1   0.730      0.774 0.796 0.204
#> GSM381275     2   0.000      1.000 0.000 1.000
#> GSM381279     2   0.000      1.000 0.000 1.000
#> GSM381195     1   0.000      0.963 1.000 0.000
#> GSM381196     1   0.000      0.963 1.000 0.000
#> GSM381198     2   0.000      1.000 0.000 1.000
#> GSM381200     2   0.000      1.000 0.000 1.000
#> GSM381201     1   0.000      0.963 1.000 0.000
#> GSM381203     1   0.000      0.963 1.000 0.000
#> GSM381204     1   0.000      0.963 1.000 0.000
#> GSM381209     1   0.000      0.963 1.000 0.000
#> GSM381212     1   0.000      0.963 1.000 0.000
#> GSM381213     2   0.000      1.000 0.000 1.000
#> GSM381214     2   0.000      1.000 0.000 1.000
#> GSM381216     1   0.000      0.963 1.000 0.000
#> GSM381225     1   0.929      0.481 0.656 0.344
#> GSM381231     1   0.730      0.774 0.796 0.204
#> GSM381235     1   0.000      0.963 1.000 0.000
#> GSM381237     1   0.000      0.963 1.000 0.000
#> GSM381241     2   0.000      1.000 0.000 1.000
#> GSM381243     2   0.000      1.000 0.000 1.000
#> GSM381245     1   0.000      0.963 1.000 0.000
#> GSM381246     2   0.000      1.000 0.000 1.000
#> GSM381251     1   0.000      0.963 1.000 0.000
#> GSM381264     1   0.000      0.963 1.000 0.000
#> GSM381206     2   0.000      1.000 0.000 1.000
#> GSM381217     1   0.000      0.963 1.000 0.000
#> GSM381218     2   0.000      1.000 0.000 1.000
#> GSM381226     2   0.000      1.000 0.000 1.000
#> GSM381227     2   0.000      1.000 0.000 1.000
#> GSM381228     1   0.730      0.774 0.796 0.204
#> GSM381236     1   0.730      0.774 0.796 0.204
#> GSM381244     1   0.000      0.963 1.000 0.000
#> GSM381272     1   0.730      0.774 0.796 0.204
#> GSM381277     1   0.000      0.963 1.000 0.000
#> GSM381278     1   0.000      0.963 1.000 0.000
#> GSM381197     1   0.000      0.963 1.000 0.000
#> GSM381202     1   0.000      0.963 1.000 0.000
#> GSM381207     1   0.000      0.963 1.000 0.000
#> GSM381208     2   0.000      1.000 0.000 1.000
#> GSM381210     1   0.000      0.963 1.000 0.000
#> GSM381215     1   0.000      0.963 1.000 0.000
#> GSM381219     2   0.000      1.000 0.000 1.000
#> GSM381221     2   0.000      1.000 0.000 1.000
#> GSM381223     2   0.000      1.000 0.000 1.000
#> GSM381229     1   0.000      0.963 1.000 0.000
#> GSM381230     1   0.000      0.963 1.000 0.000
#> GSM381233     1   0.000      0.963 1.000 0.000
#> GSM381234     1   0.000      0.963 1.000 0.000
#> GSM381238     1   0.730      0.774 0.796 0.204
#> GSM381239     1   0.730      0.774 0.796 0.204
#> GSM381242     1   0.000      0.963 1.000 0.000
#> GSM381247     2   0.000      1.000 0.000 1.000
#> GSM381248     1   0.000      0.963 1.000 0.000
#> GSM381249     1   0.000      0.963 1.000 0.000
#> GSM381253     1   0.000      0.963 1.000 0.000
#> GSM381255     2   0.000      1.000 0.000 1.000
#> GSM381258     1   0.000      0.963 1.000 0.000
#> GSM381262     1   0.000      0.963 1.000 0.000
#> GSM381266     1   0.000      0.963 1.000 0.000
#> GSM381267     2   0.000      1.000 0.000 1.000
#> GSM381269     1   0.000      0.963 1.000 0.000
#> GSM381273     1   0.000      0.963 1.000 0.000
#> GSM381274     2   0.000      1.000 0.000 1.000
#> GSM381276     1   0.000      0.963 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
#> GSM381194     3  0.0000      0.943 0.000  0 1.000
#> GSM381199     2  0.0000      1.000 0.000  1 0.000
#> GSM381205     2  0.0000      1.000 0.000  1 0.000
#> GSM381211     2  0.0000      1.000 0.000  1 0.000
#> GSM381220     2  0.0000      1.000 0.000  1 0.000
#> GSM381222     1  0.0000      0.999 1.000  0 0.000
#> GSM381224     1  0.0000      0.999 1.000  0 0.000
#> GSM381232     3  0.0000      0.943 0.000  0 1.000
#> GSM381240     1  0.0000      0.999 1.000  0 0.000
#> GSM381250     3  0.4605      0.800 0.204  0 0.796
#> GSM381252     2  0.0000      1.000 0.000  1 0.000
#> GSM381254     1  0.0000      0.999 1.000  0 0.000
#> GSM381256     2  0.0000      1.000 0.000  1 0.000
#> GSM381257     1  0.0000      0.999 1.000  0 0.000
#> GSM381259     1  0.0000      0.999 1.000  0 0.000
#> GSM381260     1  0.1289      0.964 0.968  0 0.032
#> GSM381261     2  0.0000      1.000 0.000  1 0.000
#> GSM381263     3  0.4555      0.804 0.200  0 0.800
#> GSM381265     1  0.0000      0.999 1.000  0 0.000
#> GSM381268     3  0.0237      0.941 0.004  0 0.996
#> GSM381270     2  0.0000      1.000 0.000  1 0.000
#> GSM381271     3  0.0000      0.943 0.000  0 1.000
#> GSM381275     2  0.0000      1.000 0.000  1 0.000
#> GSM381279     2  0.0000      1.000 0.000  1 0.000
#> GSM381195     1  0.0000      0.999 1.000  0 0.000
#> GSM381196     3  0.4605      0.800 0.204  0 0.796
#> GSM381198     2  0.0000      1.000 0.000  1 0.000
#> GSM381200     2  0.0000      1.000 0.000  1 0.000
#> GSM381201     3  0.0000      0.943 0.000  0 1.000
#> GSM381203     1  0.0000      0.999 1.000  0 0.000
#> GSM381204     1  0.0000      0.999 1.000  0 0.000
#> GSM381209     1  0.0000      0.999 1.000  0 0.000
#> GSM381212     1  0.0000      0.999 1.000  0 0.000
#> GSM381213     2  0.0000      1.000 0.000  1 0.000
#> GSM381214     2  0.0000      1.000 0.000  1 0.000
#> GSM381216     1  0.0000      0.999 1.000  0 0.000
#> GSM381225     3  0.4504      0.808 0.196  0 0.804
#> GSM381231     3  0.0000      0.943 0.000  0 1.000
#> GSM381235     1  0.0000      0.999 1.000  0 0.000
#> GSM381237     1  0.0000      0.999 1.000  0 0.000
#> GSM381241     2  0.0000      1.000 0.000  1 0.000
#> GSM381243     2  0.0000      1.000 0.000  1 0.000
#> GSM381245     1  0.0000      0.999 1.000  0 0.000
#> GSM381246     2  0.0000      1.000 0.000  1 0.000
#> GSM381251     3  0.0000      0.943 0.000  0 1.000
#> GSM381264     1  0.0000      0.999 1.000  0 0.000
#> GSM381206     2  0.0000      1.000 0.000  1 0.000
#> GSM381217     1  0.0000      0.999 1.000  0 0.000
#> GSM381218     2  0.0000      1.000 0.000  1 0.000
#> GSM381226     2  0.0000      1.000 0.000  1 0.000
#> GSM381227     2  0.0000      1.000 0.000  1 0.000
#> GSM381228     3  0.0000      0.943 0.000  0 1.000
#> GSM381236     3  0.0000      0.943 0.000  0 1.000
#> GSM381244     1  0.0000      0.999 1.000  0 0.000
#> GSM381272     3  0.0000      0.943 0.000  0 1.000
#> GSM381277     1  0.0000      0.999 1.000  0 0.000
#> GSM381278     3  0.0000      0.943 0.000  0 1.000
#> GSM381197     1  0.0000      0.999 1.000  0 0.000
#> GSM381202     1  0.0000      0.999 1.000  0 0.000
#> GSM381207     1  0.0000      0.999 1.000  0 0.000
#> GSM381208     2  0.0000      1.000 0.000  1 0.000
#> GSM381210     1  0.0000      0.999 1.000  0 0.000
#> GSM381215     3  0.0000      0.943 0.000  0 1.000
#> GSM381219     2  0.0000      1.000 0.000  1 0.000
#> GSM381221     2  0.0000      1.000 0.000  1 0.000
#> GSM381223     2  0.0000      1.000 0.000  1 0.000
#> GSM381229     3  0.0000      0.943 0.000  0 1.000
#> GSM381230     1  0.0000      0.999 1.000  0 0.000
#> GSM381233     1  0.0000      0.999 1.000  0 0.000
#> GSM381234     1  0.0000      0.999 1.000  0 0.000
#> GSM381238     3  0.0000      0.943 0.000  0 1.000
#> GSM381239     3  0.0000      0.943 0.000  0 1.000
#> GSM381242     1  0.0000      0.999 1.000  0 0.000
#> GSM381247     2  0.0000      1.000 0.000  1 0.000
#> GSM381248     1  0.0000      0.999 1.000  0 0.000
#> GSM381249     1  0.0000      0.999 1.000  0 0.000
#> GSM381253     3  0.5058      0.745 0.244  0 0.756
#> GSM381255     2  0.0000      1.000 0.000  1 0.000
#> GSM381258     3  0.2537      0.898 0.080  0 0.920
#> GSM381262     3  0.0000      0.943 0.000  0 1.000
#> GSM381266     3  0.0000      0.943 0.000  0 1.000
#> GSM381267     2  0.0000      1.000 0.000  1 0.000
#> GSM381269     1  0.0000      0.999 1.000  0 0.000
#> GSM381273     3  0.0000      0.943 0.000  0 1.000
#> GSM381274     2  0.0000      1.000 0.000  1 0.000
#> GSM381276     3  0.4555      0.804 0.200  0 0.800

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1 p2    p3    p4
#> GSM381194     3  0.0592      0.790 0.000  0 0.984 0.016
#> GSM381199     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381205     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381211     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381220     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381222     1  0.0707      0.965 0.980  0 0.020 0.000
#> GSM381224     1  0.0469      0.970 0.988  0 0.012 0.000
#> GSM381232     4  0.0000      1.000 0.000  0 0.000 1.000
#> GSM381240     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381250     3  0.0336      0.791 0.008  0 0.992 0.000
#> GSM381252     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381254     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381256     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381257     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381259     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381260     3  0.4855      0.404 0.400  0 0.600 0.000
#> GSM381261     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381263     3  0.0188      0.791 0.004  0 0.996 0.000
#> GSM381265     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381268     3  0.0817      0.789 0.000  0 0.976 0.024
#> GSM381270     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381271     4  0.0000      1.000 0.000  0 0.000 1.000
#> GSM381275     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381279     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381195     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381196     3  0.0592      0.790 0.016  0 0.984 0.000
#> GSM381198     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381200     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381201     3  0.1022      0.785 0.000  0 0.968 0.032
#> GSM381203     3  0.2868      0.728 0.136  0 0.864 0.000
#> GSM381204     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381209     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381212     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381213     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381214     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381216     3  0.4992      0.173 0.476  0 0.524 0.000
#> GSM381225     3  0.0336      0.791 0.000  0 0.992 0.008
#> GSM381231     4  0.0000      1.000 0.000  0 0.000 1.000
#> GSM381235     3  0.0336      0.790 0.008  0 0.992 0.000
#> GSM381237     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381241     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381243     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381245     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381246     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381251     3  0.0817      0.789 0.000  0 0.976 0.024
#> GSM381264     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381206     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381217     3  0.4941      0.290 0.436  0 0.564 0.000
#> GSM381218     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381226     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381227     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381228     4  0.0000      1.000 0.000  0 0.000 1.000
#> GSM381236     4  0.0000      1.000 0.000  0 0.000 1.000
#> GSM381244     1  0.0592      0.968 0.984  0 0.016 0.000
#> GSM381272     4  0.0000      1.000 0.000  0 0.000 1.000
#> GSM381277     1  0.0188      0.974 0.996  0 0.004 0.000
#> GSM381278     3  0.4713      0.379 0.000  0 0.640 0.360
#> GSM381197     3  0.4877      0.394 0.408  0 0.592 0.000
#> GSM381202     1  0.4790      0.265 0.620  0 0.380 0.000
#> GSM381207     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381208     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381210     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381215     3  0.0592      0.790 0.000  0 0.984 0.016
#> GSM381219     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381221     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381223     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381229     3  0.0921      0.787 0.000  0 0.972 0.028
#> GSM381230     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381233     1  0.0707      0.965 0.980  0 0.020 0.000
#> GSM381234     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381238     4  0.0000      1.000 0.000  0 0.000 1.000
#> GSM381239     4  0.0000      1.000 0.000  0 0.000 1.000
#> GSM381242     3  0.4948      0.301 0.440  0 0.560 0.000
#> GSM381247     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381248     1  0.0000      0.976 1.000  0 0.000 0.000
#> GSM381249     1  0.0469      0.970 0.988  0 0.012 0.000
#> GSM381253     3  0.0524      0.792 0.008  0 0.988 0.004
#> GSM381255     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381258     3  0.0000      0.790 0.000  0 1.000 0.000
#> GSM381262     3  0.0817      0.789 0.000  0 0.976 0.024
#> GSM381266     3  0.4713      0.379 0.000  0 0.640 0.360
#> GSM381267     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381269     1  0.1211      0.948 0.960  0 0.040 0.000
#> GSM381273     3  0.4697      0.387 0.000  0 0.644 0.356
#> GSM381274     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381276     3  0.5473      0.642 0.192  0 0.724 0.084

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     5  0.0290      0.957 0.000 0.000 0.008 0.000 0.992
#> GSM381199     2  0.1270      0.958 0.000 0.948 0.052 0.000 0.000
#> GSM381205     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381211     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381220     2  0.0880      0.961 0.000 0.968 0.032 0.000 0.000
#> GSM381222     1  0.4192      0.328 0.596 0.000 0.404 0.000 0.000
#> GSM381224     1  0.4256      0.246 0.564 0.000 0.436 0.000 0.000
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.0510      0.884 0.984 0.000 0.016 0.000 0.000
#> GSM381250     5  0.0404      0.955 0.000 0.000 0.012 0.000 0.988
#> GSM381252     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381254     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381256     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM381257     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381259     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381260     3  0.4421      0.787 0.184 0.000 0.748 0.000 0.068
#> GSM381261     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381263     5  0.0963      0.938 0.000 0.000 0.036 0.000 0.964
#> GSM381265     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381268     5  0.0000      0.959 0.000 0.000 0.000 0.000 1.000
#> GSM381270     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381275     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381279     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381195     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381196     5  0.0404      0.955 0.000 0.000 0.012 0.000 0.988
#> GSM381198     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381200     2  0.1608      0.954 0.000 0.928 0.072 0.000 0.000
#> GSM381201     5  0.0000      0.959 0.000 0.000 0.000 0.000 1.000
#> GSM381203     5  0.3779      0.620 0.236 0.000 0.012 0.000 0.752
#> GSM381204     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.1671      0.951 0.000 0.924 0.076 0.000 0.000
#> GSM381214     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381216     3  0.2708      0.837 0.072 0.000 0.884 0.000 0.044
#> GSM381225     5  0.0162      0.958 0.000 0.000 0.004 0.000 0.996
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381235     3  0.2848      0.787 0.004 0.000 0.840 0.000 0.156
#> GSM381237     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381243     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381245     1  0.0404      0.886 0.988 0.000 0.012 0.000 0.000
#> GSM381246     2  0.0404      0.962 0.000 0.988 0.012 0.000 0.000
#> GSM381251     5  0.0000      0.959 0.000 0.000 0.000 0.000 1.000
#> GSM381264     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381217     3  0.3110      0.837 0.080 0.000 0.860 0.000 0.060
#> GSM381218     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381226     2  0.0794      0.961 0.000 0.972 0.028 0.000 0.000
#> GSM381227     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381244     3  0.2471      0.800 0.136 0.000 0.864 0.000 0.000
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381277     1  0.2020      0.803 0.900 0.000 0.100 0.000 0.000
#> GSM381278     5  0.1544      0.914 0.000 0.000 0.000 0.068 0.932
#> GSM381197     3  0.5874      0.477 0.364 0.000 0.528 0.000 0.108
#> GSM381202     3  0.4451      0.734 0.248 0.000 0.712 0.000 0.040
#> GSM381207     1  0.0703      0.878 0.976 0.000 0.024 0.000 0.000
#> GSM381208     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381210     1  0.0609      0.878 0.980 0.000 0.020 0.000 0.000
#> GSM381215     5  0.0162      0.958 0.000 0.000 0.004 0.000 0.996
#> GSM381219     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381221     2  0.0162      0.962 0.000 0.996 0.004 0.000 0.000
#> GSM381223     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381229     5  0.0000      0.959 0.000 0.000 0.000 0.000 1.000
#> GSM381230     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.4192      0.328 0.596 0.000 0.404 0.000 0.000
#> GSM381234     1  0.0000      0.892 1.000 0.000 0.000 0.000 0.000
#> GSM381238     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM381242     3  0.2569      0.832 0.040 0.000 0.892 0.000 0.068
#> GSM381247     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381248     1  0.0404      0.886 0.988 0.000 0.012 0.000 0.000
#> GSM381249     1  0.4256      0.241 0.564 0.000 0.436 0.000 0.000
#> GSM381253     5  0.0162      0.958 0.000 0.000 0.004 0.000 0.996
#> GSM381255     2  0.0162      0.961 0.000 0.996 0.004 0.000 0.000
#> GSM381258     3  0.2377      0.800 0.000 0.000 0.872 0.000 0.128
#> GSM381262     5  0.0000      0.959 0.000 0.000 0.000 0.000 1.000
#> GSM381266     5  0.1410      0.920 0.000 0.000 0.000 0.060 0.940
#> GSM381267     2  0.0963      0.960 0.000 0.964 0.036 0.000 0.000
#> GSM381269     3  0.2377      0.808 0.128 0.000 0.872 0.000 0.000
#> GSM381273     5  0.1341      0.923 0.000 0.000 0.000 0.056 0.944
#> GSM381274     2  0.2074      0.945 0.000 0.896 0.104 0.000 0.000
#> GSM381276     3  0.5152      0.744 0.104 0.000 0.696 0.004 0.196

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.0935      0.944 0.000 0.000 0.964 0.000 0.032 0.004
#> GSM381199     2  0.3862     -0.207 0.000 0.524 0.000 0.000 0.000 0.476
#> GSM381205     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381220     2  0.3765      0.108 0.000 0.596 0.000 0.000 0.000 0.404
#> GSM381222     5  0.4095      0.219 0.480 0.000 0.000 0.000 0.512 0.008
#> GSM381224     5  0.4407      0.192 0.484 0.000 0.000 0.000 0.492 0.024
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381240     1  0.1285      0.940 0.944 0.000 0.000 0.000 0.004 0.052
#> GSM381250     3  0.1480      0.939 0.000 0.000 0.940 0.000 0.020 0.040
#> GSM381252     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381254     1  0.0405      0.961 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM381256     2  0.1765      0.751 0.000 0.904 0.000 0.000 0.000 0.096
#> GSM381257     1  0.0405      0.960 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM381259     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381260     5  0.4393      0.651 0.140 0.000 0.000 0.000 0.720 0.140
#> GSM381261     6  0.2996      0.937 0.000 0.228 0.000 0.000 0.000 0.772
#> GSM381263     3  0.1970      0.918 0.000 0.000 0.912 0.000 0.060 0.028
#> GSM381265     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381268     3  0.0363      0.950 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM381270     6  0.2912      0.938 0.000 0.216 0.000 0.000 0.000 0.784
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     6  0.3050      0.933 0.000 0.236 0.000 0.000 0.000 0.764
#> GSM381279     6  0.2883      0.936 0.000 0.212 0.000 0.000 0.000 0.788
#> GSM381195     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.1391      0.941 0.000 0.000 0.944 0.000 0.016 0.040
#> GSM381198     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381200     6  0.3843      0.426 0.000 0.452 0.000 0.000 0.000 0.548
#> GSM381201     3  0.0363      0.950 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM381203     3  0.4507      0.611 0.248 0.000 0.692 0.000 0.020 0.040
#> GSM381204     1  0.0146      0.964 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381209     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0146      0.964 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381213     2  0.3866     -0.326 0.000 0.516 0.000 0.000 0.000 0.484
#> GSM381214     2  0.0146      0.815 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381216     5  0.0291      0.696 0.004 0.000 0.000 0.000 0.992 0.004
#> GSM381225     3  0.0603      0.947 0.000 0.000 0.980 0.000 0.004 0.016
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381235     5  0.1218      0.688 0.004 0.000 0.028 0.000 0.956 0.012
#> GSM381237     1  0.0146      0.964 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM381241     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381243     6  0.2912      0.938 0.000 0.216 0.000 0.000 0.000 0.784
#> GSM381245     1  0.1219      0.941 0.948 0.000 0.000 0.000 0.004 0.048
#> GSM381246     2  0.1007      0.789 0.000 0.956 0.000 0.000 0.000 0.044
#> GSM381251     3  0.0000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381264     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381217     5  0.0692      0.695 0.004 0.000 0.000 0.000 0.976 0.020
#> GSM381218     2  0.0146      0.815 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381226     2  0.2912      0.598 0.000 0.784 0.000 0.000 0.000 0.216
#> GSM381227     6  0.2912      0.936 0.000 0.216 0.000 0.000 0.000 0.784
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     5  0.3381      0.689 0.044 0.000 0.000 0.000 0.800 0.156
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     1  0.4061      0.668 0.748 0.000 0.000 0.000 0.088 0.164
#> GSM381278     3  0.1738      0.915 0.000 0.000 0.928 0.052 0.016 0.004
#> GSM381197     5  0.5691      0.487 0.284 0.000 0.012 0.000 0.556 0.148
#> GSM381202     5  0.4026      0.663 0.160 0.000 0.000 0.000 0.752 0.088
#> GSM381207     1  0.1745      0.923 0.920 0.000 0.000 0.000 0.012 0.068
#> GSM381208     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381210     1  0.1297      0.927 0.948 0.000 0.000 0.000 0.040 0.012
#> GSM381215     3  0.1088      0.946 0.000 0.000 0.960 0.000 0.016 0.024
#> GSM381219     2  0.0146      0.815 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381221     2  0.3101      0.557 0.000 0.756 0.000 0.000 0.000 0.244
#> GSM381223     6  0.3050      0.933 0.000 0.236 0.000 0.000 0.000 0.764
#> GSM381229     3  0.0146      0.949 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM381230     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381233     5  0.4093      0.229 0.476 0.000 0.000 0.000 0.516 0.008
#> GSM381234     1  0.0291      0.963 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM381238     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     5  0.2135      0.678 0.000 0.000 0.000 0.000 0.872 0.128
#> GSM381247     6  0.2912      0.938 0.000 0.216 0.000 0.000 0.000 0.784
#> GSM381248     1  0.1010      0.949 0.960 0.000 0.000 0.000 0.004 0.036
#> GSM381249     5  0.4086      0.258 0.464 0.000 0.000 0.000 0.528 0.008
#> GSM381253     3  0.1010      0.946 0.000 0.000 0.960 0.000 0.004 0.036
#> GSM381255     2  0.0000      0.816 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381258     5  0.0291      0.695 0.000 0.000 0.004 0.000 0.992 0.004
#> GSM381262     3  0.0000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381266     3  0.1285      0.923 0.000 0.000 0.944 0.052 0.000 0.004
#> GSM381267     2  0.3756      0.123 0.000 0.600 0.000 0.000 0.000 0.400
#> GSM381269     5  0.0363      0.698 0.012 0.000 0.000 0.000 0.988 0.000
#> GSM381273     3  0.0603      0.945 0.000 0.000 0.980 0.016 0.000 0.004
#> GSM381274     6  0.3151      0.915 0.000 0.252 0.000 0.000 0.000 0.748
#> GSM381276     5  0.6130      0.587 0.096 0.000 0.144 0.000 0.604 0.156

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 other(p) k
#> MAD:skmeans 85    0.756 2
#> MAD:skmeans 86    0.863 3
#> MAD:skmeans 77    0.435 4
#> MAD:skmeans 81    0.585 5
#> MAD:skmeans 76    0.705 6

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


MAD:pam**

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4528 0.548   0.548
#> 3 3 1.000           1.000       1.000         0.2366 0.893   0.804
#> 4 4 0.987           0.956       0.983         0.2571 0.856   0.672
#> 5 5 0.865           0.773       0.893         0.0682 0.962   0.872
#> 6 6 0.780           0.698       0.832         0.0486 0.945   0.794

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette p1 p2
#> GSM381194     1       0          1  1  0
#> GSM381199     2       0          1  0  1
#> GSM381205     2       0          1  0  1
#> GSM381211     2       0          1  0  1
#> GSM381220     2       0          1  0  1
#> GSM381222     1       0          1  1  0
#> GSM381224     1       0          1  1  0
#> GSM381232     1       0          1  1  0
#> GSM381240     1       0          1  1  0
#> GSM381250     1       0          1  1  0
#> GSM381252     2       0          1  0  1
#> GSM381254     1       0          1  1  0
#> GSM381256     2       0          1  0  1
#> GSM381257     1       0          1  1  0
#> GSM381259     1       0          1  1  0
#> GSM381260     1       0          1  1  0
#> GSM381261     2       0          1  0  1
#> GSM381263     1       0          1  1  0
#> GSM381265     1       0          1  1  0
#> GSM381268     1       0          1  1  0
#> GSM381270     2       0          1  0  1
#> GSM381271     1       0          1  1  0
#> GSM381275     2       0          1  0  1
#> GSM381279     2       0          1  0  1
#> GSM381195     1       0          1  1  0
#> GSM381196     1       0          1  1  0
#> GSM381198     2       0          1  0  1
#> GSM381200     2       0          1  0  1
#> GSM381201     1       0          1  1  0
#> GSM381203     1       0          1  1  0
#> GSM381204     1       0          1  1  0
#> GSM381209     1       0          1  1  0
#> GSM381212     1       0          1  1  0
#> GSM381213     2       0          1  0  1
#> GSM381214     2       0          1  0  1
#> GSM381216     1       0          1  1  0
#> GSM381225     1       0          1  1  0
#> GSM381231     1       0          1  1  0
#> GSM381235     1       0          1  1  0
#> GSM381237     1       0          1  1  0
#> GSM381241     2       0          1  0  1
#> GSM381243     2       0          1  0  1
#> GSM381245     1       0          1  1  0
#> GSM381246     2       0          1  0  1
#> GSM381251     1       0          1  1  0
#> GSM381264     1       0          1  1  0
#> GSM381206     2       0          1  0  1
#> GSM381217     1       0          1  1  0
#> GSM381218     2       0          1  0  1
#> GSM381226     2       0          1  0  1
#> GSM381227     2       0          1  0  1
#> GSM381228     1       0          1  1  0
#> GSM381236     1       0          1  1  0
#> GSM381244     1       0          1  1  0
#> GSM381272     1       0          1  1  0
#> GSM381277     1       0          1  1  0
#> GSM381278     1       0          1  1  0
#> GSM381197     1       0          1  1  0
#> GSM381202     1       0          1  1  0
#> GSM381207     1       0          1  1  0
#> GSM381208     2       0          1  0  1
#> GSM381210     1       0          1  1  0
#> GSM381215     1       0          1  1  0
#> GSM381219     2       0          1  0  1
#> GSM381221     2       0          1  0  1
#> GSM381223     2       0          1  0  1
#> GSM381229     1       0          1  1  0
#> GSM381230     1       0          1  1  0
#> GSM381233     1       0          1  1  0
#> GSM381234     1       0          1  1  0
#> GSM381238     1       0          1  1  0
#> GSM381239     1       0          1  1  0
#> GSM381242     1       0          1  1  0
#> GSM381247     2       0          1  0  1
#> GSM381248     1       0          1  1  0
#> GSM381249     1       0          1  1  0
#> GSM381253     1       0          1  1  0
#> GSM381255     2       0          1  0  1
#> GSM381258     1       0          1  1  0
#> GSM381262     1       0          1  1  0
#> GSM381266     1       0          1  1  0
#> GSM381267     2       0          1  0  1
#> GSM381269     1       0          1  1  0
#> GSM381273     1       0          1  1  0
#> GSM381274     2       0          1  0  1
#> GSM381276     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette p1 p2 p3
#> GSM381194     1       0          1  1  0  0
#> GSM381199     2       0          1  0  1  0
#> GSM381205     2       0          1  0  1  0
#> GSM381211     2       0          1  0  1  0
#> GSM381220     2       0          1  0  1  0
#> GSM381222     1       0          1  1  0  0
#> GSM381224     1       0          1  1  0  0
#> GSM381232     3       0          1  0  0  1
#> GSM381240     1       0          1  1  0  0
#> GSM381250     1       0          1  1  0  0
#> GSM381252     2       0          1  0  1  0
#> GSM381254     1       0          1  1  0  0
#> GSM381256     2       0          1  0  1  0
#> GSM381257     1       0          1  1  0  0
#> GSM381259     1       0          1  1  0  0
#> GSM381260     1       0          1  1  0  0
#> GSM381261     2       0          1  0  1  0
#> GSM381263     1       0          1  1  0  0
#> GSM381265     1       0          1  1  0  0
#> GSM381268     1       0          1  1  0  0
#> GSM381270     2       0          1  0  1  0
#> GSM381271     3       0          1  0  0  1
#> GSM381275     2       0          1  0  1  0
#> GSM381279     2       0          1  0  1  0
#> GSM381195     1       0          1  1  0  0
#> GSM381196     1       0          1  1  0  0
#> GSM381198     2       0          1  0  1  0
#> GSM381200     2       0          1  0  1  0
#> GSM381201     1       0          1  1  0  0
#> GSM381203     1       0          1  1  0  0
#> GSM381204     1       0          1  1  0  0
#> GSM381209     1       0          1  1  0  0
#> GSM381212     1       0          1  1  0  0
#> GSM381213     2       0          1  0  1  0
#> GSM381214     2       0          1  0  1  0
#> GSM381216     1       0          1  1  0  0
#> GSM381225     1       0          1  1  0  0
#> GSM381231     3       0          1  0  0  1
#> GSM381235     1       0          1  1  0  0
#> GSM381237     1       0          1  1  0  0
#> GSM381241     2       0          1  0  1  0
#> GSM381243     2       0          1  0  1  0
#> GSM381245     1       0          1  1  0  0
#> GSM381246     2       0          1  0  1  0
#> GSM381251     1       0          1  1  0  0
#> GSM381264     1       0          1  1  0  0
#> GSM381206     2       0          1  0  1  0
#> GSM381217     1       0          1  1  0  0
#> GSM381218     2       0          1  0  1  0
#> GSM381226     2       0          1  0  1  0
#> GSM381227     2       0          1  0  1  0
#> GSM381228     3       0          1  0  0  1
#> GSM381236     3       0          1  0  0  1
#> GSM381244     1       0          1  1  0  0
#> GSM381272     3       0          1  0  0  1
#> GSM381277     1       0          1  1  0  0
#> GSM381278     1       0          1  1  0  0
#> GSM381197     1       0          1  1  0  0
#> GSM381202     1       0          1  1  0  0
#> GSM381207     1       0          1  1  0  0
#> GSM381208     2       0          1  0  1  0
#> GSM381210     1       0          1  1  0  0
#> GSM381215     1       0          1  1  0  0
#> GSM381219     2       0          1  0  1  0
#> GSM381221     2       0          1  0  1  0
#> GSM381223     2       0          1  0  1  0
#> GSM381229     1       0          1  1  0  0
#> GSM381230     1       0          1  1  0  0
#> GSM381233     1       0          1  1  0  0
#> GSM381234     1       0          1  1  0  0
#> GSM381238     3       0          1  0  0  1
#> GSM381239     3       0          1  0  0  1
#> GSM381242     1       0          1  1  0  0
#> GSM381247     2       0          1  0  1  0
#> GSM381248     1       0          1  1  0  0
#> GSM381249     1       0          1  1  0  0
#> GSM381253     1       0          1  1  0  0
#> GSM381255     2       0          1  0  1  0
#> GSM381258     1       0          1  1  0  0
#> GSM381262     1       0          1  1  0  0
#> GSM381266     1       0          1  1  0  0
#> GSM381267     2       0          1  0  1  0
#> GSM381269     1       0          1  1  0  0
#> GSM381273     1       0          1  1  0  0
#> GSM381274     2       0          1  0  1  0
#> GSM381276     1       0          1  1  0  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1 p2    p3 p4
#> GSM381194     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381199     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381205     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381211     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381220     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381222     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381224     1  0.3801     0.7179 0.780  0 0.220  0
#> GSM381232     4  0.0000     1.0000 0.000  0 0.000  1
#> GSM381240     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381250     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381252     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381254     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381256     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381257     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381259     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381260     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381261     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381263     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381265     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381268     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381270     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381271     4  0.0000     1.0000 0.000  0 0.000  1
#> GSM381275     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381279     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381195     1  0.2921     0.8208 0.860  0 0.140  0
#> GSM381196     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381198     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381200     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381201     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381203     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381204     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381209     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381212     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381213     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381214     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381216     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381225     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381231     4  0.0000     1.0000 0.000  0 0.000  1
#> GSM381235     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381237     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381241     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381243     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381245     3  0.0188     0.9708 0.004  0 0.996  0
#> GSM381246     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381251     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381264     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381206     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381217     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381218     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381226     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381227     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381228     4  0.0000     1.0000 0.000  0 0.000  1
#> GSM381236     4  0.0000     1.0000 0.000  0 0.000  1
#> GSM381244     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381272     4  0.0000     1.0000 0.000  0 0.000  1
#> GSM381277     1  0.0707     0.9244 0.980  0 0.020  0
#> GSM381278     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381197     3  0.0188     0.9708 0.004  0 0.996  0
#> GSM381202     3  0.0817     0.9510 0.024  0 0.976  0
#> GSM381207     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381208     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381210     1  0.1118     0.9150 0.964  0 0.036  0
#> GSM381215     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381219     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381221     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381223     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381229     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381230     1  0.0000     0.9348 1.000  0 0.000  0
#> GSM381233     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381234     1  0.2973     0.8087 0.856  0 0.144  0
#> GSM381238     4  0.0000     1.0000 0.000  0 0.000  1
#> GSM381239     4  0.0000     1.0000 0.000  0 0.000  1
#> GSM381242     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381247     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381248     3  0.4977     0.0594 0.460  0 0.540  0
#> GSM381249     1  0.2814     0.8291 0.868  0 0.132  0
#> GSM381253     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381255     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381258     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381262     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381266     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381267     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381269     3  0.4164     0.6138 0.264  0 0.736  0
#> GSM381273     3  0.0000     0.9741 0.000  0 1.000  0
#> GSM381274     2  0.0000     1.0000 0.000  1 0.000  0
#> GSM381276     3  0.0000     0.9741 0.000  0 1.000  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3 p4    p5
#> GSM381194     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381199     2  0.3480     0.1670 0.000 0.752 0.000  0 0.248
#> GSM381205     2  0.3949     0.5953 0.000 0.668 0.000  0 0.332
#> GSM381211     2  0.3949     0.5953 0.000 0.668 0.000  0 0.332
#> GSM381220     2  0.4300     0.1411 0.000 0.524 0.000  0 0.476
#> GSM381222     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381224     1  0.3274     0.7098 0.780 0.000 0.220  0 0.000
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381240     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381250     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381252     2  0.3949     0.5953 0.000 0.668 0.000  0 0.332
#> GSM381254     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381256     2  0.0000     0.6101 0.000 1.000 0.000  0 0.000
#> GSM381257     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381259     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381260     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381261     5  0.3949     0.6022 0.000 0.332 0.000  0 0.668
#> GSM381263     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381265     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381268     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381270     2  0.3752     0.0278 0.000 0.708 0.000  0 0.292
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381275     5  0.4249     0.1888 0.000 0.432 0.000  0 0.568
#> GSM381279     5  0.4273     0.5999 0.000 0.448 0.000  0 0.552
#> GSM381195     1  0.2516     0.8158 0.860 0.000 0.140  0 0.000
#> GSM381196     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381198     2  0.3949     0.5953 0.000 0.668 0.000  0 0.332
#> GSM381200     2  0.0000     0.6101 0.000 1.000 0.000  0 0.000
#> GSM381201     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381203     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381204     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381209     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381212     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381213     2  0.1908     0.5157 0.000 0.908 0.000  0 0.092
#> GSM381214     2  0.1965     0.6201 0.000 0.904 0.000  0 0.096
#> GSM381216     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381225     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381235     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381237     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381241     2  0.2127     0.6208 0.000 0.892 0.000  0 0.108
#> GSM381243     5  0.3003     0.5556 0.000 0.188 0.000  0 0.812
#> GSM381245     3  0.0162     0.9703 0.004 0.000 0.996  0 0.000
#> GSM381246     2  0.3895     0.5981 0.000 0.680 0.000  0 0.320
#> GSM381251     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381264     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381206     2  0.3949     0.5953 0.000 0.668 0.000  0 0.332
#> GSM381217     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381218     2  0.0000     0.6101 0.000 1.000 0.000  0 0.000
#> GSM381226     2  0.1792     0.6212 0.000 0.916 0.000  0 0.084
#> GSM381227     5  0.1908     0.4744 0.000 0.092 0.000  0 0.908
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381244     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381277     1  0.0609     0.9224 0.980 0.000 0.020  0 0.000
#> GSM381278     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381197     3  0.0162     0.9703 0.004 0.000 0.996  0 0.000
#> GSM381202     3  0.0703     0.9503 0.024 0.000 0.976  0 0.000
#> GSM381207     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381208     2  0.3949     0.5953 0.000 0.668 0.000  0 0.332
#> GSM381210     1  0.0963     0.9127 0.964 0.000 0.036  0 0.000
#> GSM381215     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381219     2  0.0000     0.6101 0.000 1.000 0.000  0 0.000
#> GSM381221     2  0.0290     0.6039 0.000 0.992 0.000  0 0.008
#> GSM381223     2  0.4306    -0.4945 0.000 0.508 0.000  0 0.492
#> GSM381229     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381230     1  0.0000     0.9331 1.000 0.000 0.000  0 0.000
#> GSM381233     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381234     1  0.2561     0.8031 0.856 0.000 0.144  0 0.000
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000
#> GSM381242     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381247     5  0.4235     0.6209 0.000 0.424 0.000  0 0.576
#> GSM381248     3  0.4287     0.0594 0.460 0.000 0.540  0 0.000
#> GSM381249     1  0.2424     0.8244 0.868 0.000 0.132  0 0.000
#> GSM381253     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381255     2  0.3949     0.5953 0.000 0.668 0.000  0 0.332
#> GSM381258     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381262     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381266     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381267     2  0.0000     0.6101 0.000 1.000 0.000  0 0.000
#> GSM381269     3  0.3586     0.6138 0.264 0.000 0.736  0 0.000
#> GSM381273     3  0.0000     0.9738 0.000 0.000 1.000  0 0.000
#> GSM381274     2  0.4201    -0.3329 0.000 0.592 0.000  0 0.408
#> GSM381276     3  0.0000     0.9738 0.000 0.000 1.000  0 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
#> GSM381194     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381199     2  0.4270     0.4598 0.000 0.684 0.000  0 0.052 0.264
#> GSM381205     6  0.3838     0.4679 0.000 0.448 0.000  0 0.000 0.552
#> GSM381211     6  0.3838     0.4679 0.000 0.448 0.000  0 0.000 0.552
#> GSM381220     2  0.4508     0.4386 0.000 0.632 0.000  0 0.052 0.316
#> GSM381222     3  0.2416     0.8211 0.000 0.000 0.844  0 0.156 0.000
#> GSM381224     1  0.4191     0.7009 0.732 0.000 0.180  0 0.088 0.000
#> GSM381232     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381240     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381250     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381252     6  0.3843     0.4629 0.000 0.452 0.000  0 0.000 0.548
#> GSM381254     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381256     2  0.1610     0.6404 0.000 0.916 0.000  0 0.000 0.084
#> GSM381257     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381259     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381260     3  0.2527     0.8182 0.000 0.000 0.832  0 0.168 0.000
#> GSM381261     5  0.3874     0.6206 0.000 0.008 0.000  0 0.636 0.356
#> GSM381263     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381265     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381268     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381270     2  0.4371     0.4359 0.000 0.664 0.000  0 0.052 0.284
#> GSM381271     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381275     5  0.5325     0.7183 0.000 0.156 0.000  0 0.584 0.260
#> GSM381279     6  0.5392    -0.2302 0.000 0.440 0.000  0 0.112 0.448
#> GSM381195     1  0.2178     0.8158 0.868 0.000 0.132  0 0.000 0.000
#> GSM381196     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381198     6  0.3838     0.4679 0.000 0.448 0.000  0 0.000 0.552
#> GSM381200     2  0.0000     0.6426 0.000 1.000 0.000  0 0.000 0.000
#> GSM381201     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381203     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381204     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381209     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381212     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381213     5  0.3868     0.2336 0.000 0.492 0.000  0 0.508 0.000
#> GSM381214     2  0.3804    -0.3446 0.000 0.576 0.000  0 0.000 0.424
#> GSM381216     3  0.3659     0.6757 0.000 0.000 0.636  0 0.364 0.000
#> GSM381225     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381231     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381235     3  0.2454     0.8185 0.000 0.000 0.840  0 0.160 0.000
#> GSM381237     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381241     2  0.1501     0.5772 0.000 0.924 0.000  0 0.000 0.076
#> GSM381243     6  0.5355    -0.2252 0.000 0.424 0.000  0 0.108 0.468
#> GSM381245     3  0.0260     0.8911 0.008 0.000 0.992  0 0.000 0.000
#> GSM381246     6  0.3869     0.3888 0.000 0.500 0.000  0 0.000 0.500
#> GSM381251     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381264     1  0.0000     0.9267 1.000 0.000 0.000  0 0.000 0.000
#> GSM381206     6  0.3838     0.4679 0.000 0.448 0.000  0 0.000 0.552
#> GSM381217     3  0.2003     0.8436 0.000 0.000 0.884  0 0.116 0.000
#> GSM381218     2  0.0000     0.6426 0.000 1.000 0.000  0 0.000 0.000
#> GSM381226     2  0.3695    -0.2395 0.000 0.624 0.000  0 0.000 0.376
#> GSM381227     6  0.1765    -0.1167 0.000 0.000 0.000  0 0.096 0.904
#> GSM381228     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381236     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381244     3  0.2730     0.8082 0.000 0.000 0.808  0 0.192 0.000
#> GSM381272     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381277     1  0.1333     0.8986 0.944 0.000 0.008  0 0.048 0.000
#> GSM381278     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381197     3  0.2778     0.8156 0.008 0.000 0.824  0 0.168 0.000
#> GSM381202     3  0.2506     0.8474 0.052 0.000 0.880  0 0.068 0.000
#> GSM381207     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381208     6  0.3838     0.4679 0.000 0.448 0.000  0 0.000 0.552
#> GSM381210     1  0.2257     0.8584 0.876 0.000 0.008  0 0.116 0.000
#> GSM381215     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381219     2  0.0000     0.6426 0.000 1.000 0.000  0 0.000 0.000
#> GSM381221     2  0.0713     0.6490 0.000 0.972 0.000  0 0.000 0.028
#> GSM381223     5  0.5257     0.7312 0.000 0.136 0.000  0 0.584 0.280
#> GSM381229     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381230     1  0.0547     0.9197 0.980 0.000 0.000  0 0.020 0.000
#> GSM381233     3  0.2762     0.7905 0.000 0.000 0.804  0 0.196 0.000
#> GSM381234     1  0.2378     0.7839 0.848 0.000 0.152  0 0.000 0.000
#> GSM381238     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381239     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> GSM381242     3  0.3464     0.7241 0.000 0.000 0.688  0 0.312 0.000
#> GSM381247     6  0.5392    -0.2302 0.000 0.440 0.000  0 0.112 0.448
#> GSM381248     3  0.3854     0.0263 0.464 0.000 0.536  0 0.000 0.000
#> GSM381249     1  0.2902     0.7924 0.800 0.000 0.004  0 0.196 0.000
#> GSM381253     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381255     6  0.3838     0.4679 0.000 0.448 0.000  0 0.000 0.552
#> GSM381258     3  0.3547     0.7068 0.000 0.000 0.668  0 0.332 0.000
#> GSM381262     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381266     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381267     2  0.1610     0.6404 0.000 0.916 0.000  0 0.000 0.084
#> GSM381269     3  0.5949     0.3240 0.220 0.000 0.416  0 0.364 0.000
#> GSM381273     3  0.0000     0.8943 0.000 0.000 1.000  0 0.000 0.000
#> GSM381274     5  0.5395     0.7309 0.000 0.220 0.000  0 0.584 0.196
#> GSM381276     3  0.2527     0.8182 0.000 0.000 0.832  0 0.168 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 other(p) k
#> MAD:pam 86    0.744 2
#> MAD:pam 86    0.326 3
#> MAD:pam 85    0.453 4
#> MAD:pam 78    0.614 5
#> MAD:pam 66    0.545 6

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


MAD:mclust*

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.983       0.991         0.4570 0.548   0.548
#> 3 3 0.940           0.890       0.952         0.3026 0.871   0.765
#> 4 4 0.836           0.911       0.939         0.2047 0.835   0.616
#> 5 5 0.631           0.695       0.779         0.0571 0.916   0.717
#> 6 6 0.713           0.586       0.768         0.0678 0.917   0.663

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
#> GSM381194     1   0.000      0.986 1.000 0.000
#> GSM381199     2   0.000      1.000 0.000 1.000
#> GSM381205     2   0.000      1.000 0.000 1.000
#> GSM381211     2   0.000      1.000 0.000 1.000
#> GSM381220     2   0.000      1.000 0.000 1.000
#> GSM381222     1   0.000      0.986 1.000 0.000
#> GSM381224     1   0.000      0.986 1.000 0.000
#> GSM381232     1   0.456      0.907 0.904 0.096
#> GSM381240     1   0.000      0.986 1.000 0.000
#> GSM381250     1   0.000      0.986 1.000 0.000
#> GSM381252     2   0.000      1.000 0.000 1.000
#> GSM381254     1   0.000      0.986 1.000 0.000
#> GSM381256     2   0.000      1.000 0.000 1.000
#> GSM381257     1   0.000      0.986 1.000 0.000
#> GSM381259     1   0.000      0.986 1.000 0.000
#> GSM381260     1   0.000      0.986 1.000 0.000
#> GSM381261     2   0.000      1.000 0.000 1.000
#> GSM381263     1   0.000      0.986 1.000 0.000
#> GSM381265     1   0.000      0.986 1.000 0.000
#> GSM381268     1   0.000      0.986 1.000 0.000
#> GSM381270     2   0.000      1.000 0.000 1.000
#> GSM381271     1   0.456      0.907 0.904 0.096
#> GSM381275     2   0.000      1.000 0.000 1.000
#> GSM381279     2   0.000      1.000 0.000 1.000
#> GSM381195     1   0.000      0.986 1.000 0.000
#> GSM381196     1   0.000      0.986 1.000 0.000
#> GSM381198     2   0.000      1.000 0.000 1.000
#> GSM381200     2   0.000      1.000 0.000 1.000
#> GSM381201     1   0.000      0.986 1.000 0.000
#> GSM381203     1   0.000      0.986 1.000 0.000
#> GSM381204     1   0.000      0.986 1.000 0.000
#> GSM381209     1   0.000      0.986 1.000 0.000
#> GSM381212     1   0.000      0.986 1.000 0.000
#> GSM381213     2   0.000      1.000 0.000 1.000
#> GSM381214     2   0.000      1.000 0.000 1.000
#> GSM381216     1   0.000      0.986 1.000 0.000
#> GSM381225     1   0.000      0.986 1.000 0.000
#> GSM381231     1   0.456      0.907 0.904 0.096
#> GSM381235     1   0.000      0.986 1.000 0.000
#> GSM381237     1   0.000      0.986 1.000 0.000
#> GSM381241     2   0.000      1.000 0.000 1.000
#> GSM381243     2   0.000      1.000 0.000 1.000
#> GSM381245     1   0.000      0.986 1.000 0.000
#> GSM381246     2   0.000      1.000 0.000 1.000
#> GSM381251     1   0.000      0.986 1.000 0.000
#> GSM381264     1   0.000      0.986 1.000 0.000
#> GSM381206     2   0.000      1.000 0.000 1.000
#> GSM381217     1   0.000      0.986 1.000 0.000
#> GSM381218     2   0.000      1.000 0.000 1.000
#> GSM381226     2   0.000      1.000 0.000 1.000
#> GSM381227     2   0.000      1.000 0.000 1.000
#> GSM381228     1   0.456      0.907 0.904 0.096
#> GSM381236     1   0.456      0.907 0.904 0.096
#> GSM381244     1   0.000      0.986 1.000 0.000
#> GSM381272     1   0.456      0.907 0.904 0.096
#> GSM381277     1   0.000      0.986 1.000 0.000
#> GSM381278     1   0.000      0.986 1.000 0.000
#> GSM381197     1   0.000      0.986 1.000 0.000
#> GSM381202     1   0.000      0.986 1.000 0.000
#> GSM381207     1   0.000      0.986 1.000 0.000
#> GSM381208     2   0.000      1.000 0.000 1.000
#> GSM381210     1   0.000      0.986 1.000 0.000
#> GSM381215     1   0.000      0.986 1.000 0.000
#> GSM381219     2   0.000      1.000 0.000 1.000
#> GSM381221     2   0.000      1.000 0.000 1.000
#> GSM381223     2   0.000      1.000 0.000 1.000
#> GSM381229     1   0.000      0.986 1.000 0.000
#> GSM381230     1   0.000      0.986 1.000 0.000
#> GSM381233     1   0.000      0.986 1.000 0.000
#> GSM381234     1   0.000      0.986 1.000 0.000
#> GSM381238     1   0.456      0.907 0.904 0.096
#> GSM381239     1   0.456      0.907 0.904 0.096
#> GSM381242     1   0.000      0.986 1.000 0.000
#> GSM381247     2   0.000      1.000 0.000 1.000
#> GSM381248     1   0.000      0.986 1.000 0.000
#> GSM381249     1   0.000      0.986 1.000 0.000
#> GSM381253     1   0.000      0.986 1.000 0.000
#> GSM381255     2   0.000      1.000 0.000 1.000
#> GSM381258     1   0.000      0.986 1.000 0.000
#> GSM381262     1   0.000      0.986 1.000 0.000
#> GSM381266     1   0.000      0.986 1.000 0.000
#> GSM381267     2   0.000      1.000 0.000 1.000
#> GSM381269     1   0.000      0.986 1.000 0.000
#> GSM381273     1   0.000      0.986 1.000 0.000
#> GSM381274     2   0.000      1.000 0.000 1.000
#> GSM381276     1   0.000      0.986 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
#> GSM381194     1  0.5216     0.6371 0.740 0.000 0.260
#> GSM381199     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381205     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381211     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381220     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381222     1  0.0237     0.9279 0.996 0.000 0.004
#> GSM381224     1  0.0000     0.9281 1.000 0.000 0.000
#> GSM381232     3  0.1163     0.8811 0.000 0.028 0.972
#> GSM381240     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381250     1  0.0892     0.9240 0.980 0.000 0.020
#> GSM381252     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381254     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381256     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381257     1  0.0592     0.9274 0.988 0.000 0.012
#> GSM381259     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381260     1  0.0424     0.9275 0.992 0.000 0.008
#> GSM381261     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381263     1  0.0892     0.9240 0.980 0.000 0.020
#> GSM381265     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381268     1  0.2066     0.8971 0.940 0.000 0.060
#> GSM381270     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381271     3  0.1163     0.8811 0.000 0.028 0.972
#> GSM381275     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381279     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381195     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381196     1  0.0892     0.9240 0.980 0.000 0.020
#> GSM381198     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381200     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381201     1  0.2066     0.8955 0.940 0.000 0.060
#> GSM381203     1  0.0892     0.9251 0.980 0.000 0.020
#> GSM381204     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381209     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381212     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381213     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381214     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381216     1  0.0747     0.9255 0.984 0.000 0.016
#> GSM381225     3  0.6140     0.2782 0.404 0.000 0.596
#> GSM381231     3  0.1163     0.8811 0.000 0.028 0.972
#> GSM381235     1  0.0747     0.9255 0.984 0.000 0.016
#> GSM381237     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381241     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381243     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381245     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381246     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381251     1  0.5591     0.5569 0.696 0.000 0.304
#> GSM381264     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381206     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381217     1  0.0747     0.9255 0.984 0.000 0.016
#> GSM381218     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381226     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381227     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381228     3  0.1163     0.8811 0.000 0.028 0.972
#> GSM381236     3  0.1163     0.8811 0.000 0.028 0.972
#> GSM381244     1  0.0000     0.9281 1.000 0.000 0.000
#> GSM381272     3  0.1163     0.8811 0.000 0.028 0.972
#> GSM381277     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381278     1  0.6286     0.1132 0.536 0.000 0.464
#> GSM381197     1  0.0237     0.9279 0.996 0.000 0.004
#> GSM381202     1  0.0237     0.9279 0.996 0.000 0.004
#> GSM381207     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381208     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381210     1  0.0747     0.9269 0.984 0.000 0.016
#> GSM381215     1  0.2165     0.8936 0.936 0.000 0.064
#> GSM381219     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381221     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381223     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381229     1  0.6180     0.2757 0.584 0.000 0.416
#> GSM381230     1  0.0747     0.9269 0.984 0.000 0.016
#> GSM381233     1  0.0424     0.9275 0.992 0.000 0.008
#> GSM381234     1  0.0892     0.9261 0.980 0.000 0.020
#> GSM381238     3  0.1163     0.8811 0.000 0.028 0.972
#> GSM381239     3  0.1163     0.8811 0.000 0.028 0.972
#> GSM381242     1  0.0424     0.9275 0.992 0.000 0.008
#> GSM381247     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381248     1  0.3340     0.8303 0.880 0.000 0.120
#> GSM381249     1  0.0000     0.9281 1.000 0.000 0.000
#> GSM381253     1  0.0424     0.9275 0.992 0.000 0.008
#> GSM381255     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381258     1  0.1289     0.9175 0.968 0.000 0.032
#> GSM381262     1  0.5216     0.6371 0.740 0.000 0.260
#> GSM381266     1  0.6244     0.2006 0.560 0.000 0.440
#> GSM381267     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381269     1  0.0424     0.9275 0.992 0.000 0.008
#> GSM381273     3  0.6299     0.0186 0.476 0.000 0.524
#> GSM381274     2  0.0000     1.0000 0.000 1.000 0.000
#> GSM381276     1  0.0592     0.9267 0.988 0.000 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.2654      0.875 0.108 0.000 0.888 0.004
#> GSM381199     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381205     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381211     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381220     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381222     1  0.0188      0.950 0.996 0.000 0.004 0.000
#> GSM381224     1  0.1716      0.904 0.936 0.000 0.064 0.000
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381240     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381250     3  0.2469      0.875 0.108 0.000 0.892 0.000
#> GSM381252     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381254     1  0.0188      0.950 0.996 0.000 0.004 0.000
#> GSM381256     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381257     1  0.0188      0.950 0.996 0.000 0.004 0.000
#> GSM381259     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381260     3  0.4985      0.341 0.468 0.000 0.532 0.000
#> GSM381261     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381263     3  0.2530      0.874 0.112 0.000 0.888 0.000
#> GSM381265     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381268     3  0.2469      0.875 0.108 0.000 0.892 0.000
#> GSM381270     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381275     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381279     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381195     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381196     3  0.2469      0.875 0.108 0.000 0.892 0.000
#> GSM381198     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381200     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381201     3  0.2654      0.875 0.108 0.000 0.888 0.004
#> GSM381203     3  0.2675      0.872 0.100 0.000 0.892 0.008
#> GSM381204     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381213     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381214     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381216     3  0.3688      0.726 0.208 0.000 0.792 0.000
#> GSM381225     3  0.3311      0.736 0.000 0.000 0.828 0.172
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381235     3  0.2814      0.791 0.132 0.000 0.868 0.000
#> GSM381237     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381243     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381245     1  0.0188      0.950 0.996 0.000 0.004 0.000
#> GSM381246     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381251     3  0.2928      0.872 0.108 0.000 0.880 0.012
#> GSM381264     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381206     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381217     3  0.2011      0.821 0.080 0.000 0.920 0.000
#> GSM381218     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381226     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381227     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381244     1  0.0188      0.950 0.996 0.000 0.004 0.000
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381277     1  0.0188      0.950 0.996 0.000 0.004 0.000
#> GSM381278     3  0.4574      0.628 0.024 0.000 0.756 0.220
#> GSM381197     1  0.3801      0.661 0.780 0.000 0.220 0.000
#> GSM381202     1  0.4331      0.501 0.712 0.000 0.288 0.000
#> GSM381207     1  0.2760      0.817 0.872 0.000 0.128 0.000
#> GSM381208     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381210     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381215     3  0.2469      0.875 0.108 0.000 0.892 0.000
#> GSM381219     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381221     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381223     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381229     3  0.4667      0.824 0.108 0.000 0.796 0.096
#> GSM381230     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381233     1  0.2281      0.873 0.904 0.000 0.096 0.000
#> GSM381234     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> GSM381238     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM381242     3  0.4933      0.444 0.432 0.000 0.568 0.000
#> GSM381247     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381248     1  0.1716      0.896 0.936 0.000 0.064 0.000
#> GSM381249     1  0.1118      0.925 0.964 0.000 0.036 0.000
#> GSM381253     3  0.2760      0.868 0.128 0.000 0.872 0.000
#> GSM381255     2  0.0592      0.991 0.000 0.984 0.016 0.000
#> GSM381258     3  0.2216      0.813 0.092 0.000 0.908 0.000
#> GSM381262     3  0.2654      0.875 0.108 0.000 0.888 0.004
#> GSM381266     3  0.5857      0.728 0.108 0.000 0.696 0.196
#> GSM381267     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381269     1  0.2345      0.872 0.900 0.000 0.100 0.000
#> GSM381273     3  0.6245      0.668 0.108 0.000 0.648 0.244
#> GSM381274     2  0.0000      0.994 0.000 1.000 0.000 0.000
#> GSM381276     3  0.2469      0.875 0.108 0.000 0.892 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
#> GSM381194     3  0.5556     0.7739 0.184 0.000 0.660 0.004 0.152
#> GSM381199     2  0.4304    -0.5214 0.000 0.516 0.000 0.000 0.484
#> GSM381205     2  0.0000     0.6416 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0162     0.6397 0.000 0.996 0.000 0.000 0.004
#> GSM381220     2  0.2377     0.5380 0.000 0.872 0.000 0.000 0.128
#> GSM381222     1  0.4227     0.5674 0.580 0.000 0.420 0.000 0.000
#> GSM381224     1  0.3612     0.6714 0.732 0.000 0.268 0.000 0.000
#> GSM381232     4  0.0000     0.9693 0.000 0.000 0.000 1.000 0.000
#> GSM381240     1  0.0000     0.8516 1.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.3231     0.7978 0.196 0.000 0.800 0.000 0.004
#> GSM381252     2  0.2127     0.6467 0.000 0.892 0.000 0.000 0.108
#> GSM381254     1  0.2677     0.8304 0.872 0.000 0.112 0.000 0.016
#> GSM381256     2  0.3983     0.1539 0.000 0.660 0.000 0.000 0.340
#> GSM381257     1  0.2516     0.8139 0.860 0.000 0.140 0.000 0.000
#> GSM381259     1  0.0963     0.8503 0.964 0.000 0.036 0.000 0.000
#> GSM381260     3  0.3689     0.7585 0.256 0.000 0.740 0.000 0.004
#> GSM381261     5  0.3913     0.8514 0.000 0.324 0.000 0.000 0.676
#> GSM381263     3  0.3427     0.7984 0.192 0.000 0.796 0.000 0.012
#> GSM381265     1  0.2416     0.8349 0.888 0.000 0.100 0.000 0.012
#> GSM381268     3  0.3795     0.8019 0.192 0.000 0.780 0.000 0.028
#> GSM381270     5  0.4150     0.8709 0.000 0.388 0.000 0.000 0.612
#> GSM381271     4  0.0000     0.9693 0.000 0.000 0.000 1.000 0.000
#> GSM381275     5  0.3913     0.8514 0.000 0.324 0.000 0.000 0.676
#> GSM381279     5  0.4150     0.8709 0.000 0.388 0.000 0.000 0.612
#> GSM381195     1  0.0000     0.8516 1.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.3656     0.8009 0.196 0.000 0.784 0.000 0.020
#> GSM381198     2  0.2127     0.6467 0.000 0.892 0.000 0.000 0.108
#> GSM381200     2  0.4045     0.1087 0.000 0.644 0.000 0.000 0.356
#> GSM381201     3  0.4170     0.8011 0.192 0.000 0.760 0.000 0.048
#> GSM381203     3  0.3665     0.7978 0.200 0.000 0.784 0.008 0.008
#> GSM381204     1  0.0000     0.8516 1.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.8516 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.8516 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.3612     0.4438 0.000 0.732 0.000 0.000 0.268
#> GSM381214     2  0.1043     0.6505 0.000 0.960 0.000 0.000 0.040
#> GSM381216     3  0.0510     0.7214 0.000 0.000 0.984 0.000 0.016
#> GSM381225     3  0.5482     0.6256 0.000 0.000 0.652 0.204 0.144
#> GSM381231     4  0.0000     0.9693 0.000 0.000 0.000 1.000 0.000
#> GSM381235     3  0.0510     0.7214 0.000 0.000 0.984 0.000 0.016
#> GSM381237     1  0.0000     0.8516 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.2127     0.6467 0.000 0.892 0.000 0.000 0.108
#> GSM381243     5  0.4287     0.7443 0.000 0.460 0.000 0.000 0.540
#> GSM381245     1  0.2677     0.8304 0.872 0.000 0.112 0.000 0.016
#> GSM381246     2  0.3661     0.3385 0.000 0.724 0.000 0.000 0.276
#> GSM381251     3  0.5838     0.7690 0.192 0.000 0.644 0.012 0.152
#> GSM381264     1  0.0000     0.8516 1.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000     0.6416 0.000 1.000 0.000 0.000 0.000
#> GSM381217     3  0.0290     0.7240 0.000 0.000 0.992 0.000 0.008
#> GSM381218     2  0.1965     0.6492 0.000 0.904 0.000 0.000 0.096
#> GSM381226     2  0.3983     0.1762 0.000 0.660 0.000 0.000 0.340
#> GSM381227     2  0.3913     0.0245 0.000 0.676 0.000 0.000 0.324
#> GSM381228     4  0.0000     0.9693 0.000 0.000 0.000 1.000 0.000
#> GSM381236     4  0.2020     0.9482 0.000 0.000 0.000 0.900 0.100
#> GSM381244     1  0.2690     0.7954 0.844 0.000 0.156 0.000 0.000
#> GSM381272     4  0.0000     0.9693 0.000 0.000 0.000 1.000 0.000
#> GSM381277     1  0.2677     0.8304 0.872 0.000 0.112 0.000 0.016
#> GSM381278     3  0.5583     0.4693 0.000 0.000 0.640 0.208 0.152
#> GSM381197     3  0.4273     0.4415 0.448 0.000 0.552 0.000 0.000
#> GSM381202     3  0.3816     0.7162 0.304 0.000 0.696 0.000 0.000
#> GSM381207     1  0.3264     0.7948 0.820 0.000 0.164 0.000 0.016
#> GSM381208     2  0.2424     0.5319 0.000 0.868 0.000 0.000 0.132
#> GSM381210     1  0.0000     0.8516 1.000 0.000 0.000 0.000 0.000
#> GSM381215     3  0.4031     0.8039 0.184 0.000 0.772 0.000 0.044
#> GSM381219     2  0.2179     0.6438 0.000 0.888 0.000 0.000 0.112
#> GSM381221     2  0.4074     0.0693 0.000 0.636 0.000 0.000 0.364
#> GSM381223     5  0.4192     0.8439 0.000 0.404 0.000 0.000 0.596
#> GSM381229     3  0.6769     0.7431 0.192 0.000 0.592 0.064 0.152
#> GSM381230     1  0.2329     0.7654 0.876 0.000 0.124 0.000 0.000
#> GSM381233     1  0.4298     0.5820 0.640 0.000 0.352 0.000 0.008
#> GSM381234     1  0.2625     0.8327 0.876 0.000 0.108 0.000 0.016
#> GSM381238     4  0.2020     0.9482 0.000 0.000 0.000 0.900 0.100
#> GSM381239     4  0.2020     0.9482 0.000 0.000 0.000 0.900 0.100
#> GSM381242     3  0.1628     0.7257 0.056 0.000 0.936 0.000 0.008
#> GSM381247     5  0.4150     0.8709 0.000 0.388 0.000 0.000 0.612
#> GSM381248     1  0.3241     0.8088 0.832 0.000 0.144 0.000 0.024
#> GSM381249     1  0.3774     0.6987 0.704 0.000 0.296 0.000 0.000
#> GSM381253     3  0.3196     0.7987 0.192 0.000 0.804 0.000 0.004
#> GSM381255     2  0.0162     0.6397 0.000 0.996 0.000 0.000 0.004
#> GSM381258     3  0.0404     0.7227 0.000 0.000 0.988 0.000 0.012
#> GSM381262     3  0.5618     0.7717 0.192 0.000 0.652 0.004 0.152
#> GSM381266     3  0.7814     0.6429 0.176 0.000 0.484 0.188 0.152
#> GSM381267     2  0.3816     0.1048 0.000 0.696 0.000 0.000 0.304
#> GSM381269     3  0.3700     0.4715 0.240 0.000 0.752 0.000 0.008
#> GSM381273     3  0.8181     0.5680 0.192 0.000 0.404 0.252 0.152
#> GSM381274     5  0.3913     0.8514 0.000 0.324 0.000 0.000 0.676
#> GSM381276     3  0.3795     0.8027 0.192 0.000 0.780 0.000 0.028

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     6  0.3672      0.642 0.000 0.000 0.368 0.000 0.000 0.632
#> GSM381199     5  0.3428      0.601 0.000 0.304 0.000 0.000 0.696 0.000
#> GSM381205     2  0.0000      0.664 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0146      0.665 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM381220     2  0.2597      0.561 0.000 0.824 0.000 0.000 0.176 0.000
#> GSM381222     1  0.3860      0.332 0.528 0.000 0.472 0.000 0.000 0.000
#> GSM381224     1  0.3695      0.466 0.624 0.000 0.376 0.000 0.000 0.000
#> GSM381232     4  0.1686      0.958 0.000 0.000 0.012 0.924 0.000 0.064
#> GSM381240     1  0.0000      0.819 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.3917      0.442 0.024 0.000 0.692 0.000 0.000 0.284
#> GSM381252     2  0.3076      0.570 0.000 0.760 0.000 0.000 0.240 0.000
#> GSM381254     1  0.4625      0.724 0.692 0.000 0.060 0.000 0.016 0.232
#> GSM381256     5  0.3843      0.223 0.000 0.452 0.000 0.000 0.548 0.000
#> GSM381257     1  0.2482      0.751 0.848 0.000 0.148 0.000 0.000 0.004
#> GSM381259     1  0.1501      0.799 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM381260     3  0.3694      0.432 0.232 0.000 0.740 0.000 0.000 0.028
#> GSM381261     5  0.1225      0.657 0.000 0.036 0.000 0.000 0.952 0.012
#> GSM381263     3  0.3917      0.442 0.024 0.000 0.692 0.000 0.000 0.284
#> GSM381265     1  0.3586      0.774 0.796 0.000 0.080 0.000 0.000 0.124
#> GSM381268     3  0.3371      0.397 0.000 0.000 0.708 0.000 0.000 0.292
#> GSM381270     5  0.2491      0.673 0.000 0.164 0.000 0.000 0.836 0.000
#> GSM381271     4  0.1327      0.968 0.000 0.000 0.000 0.936 0.000 0.064
#> GSM381275     5  0.1225      0.657 0.000 0.036 0.000 0.000 0.952 0.012
#> GSM381279     5  0.2454      0.675 0.000 0.160 0.000 0.000 0.840 0.000
#> GSM381195     1  0.0146      0.818 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM381196     3  0.3351      0.403 0.000 0.000 0.712 0.000 0.000 0.288
#> GSM381198     2  0.3050      0.575 0.000 0.764 0.000 0.000 0.236 0.000
#> GSM381200     5  0.3866      0.243 0.000 0.484 0.000 0.000 0.516 0.000
#> GSM381201     3  0.3446      0.361 0.000 0.000 0.692 0.000 0.000 0.308
#> GSM381203     3  0.3555      0.410 0.008 0.000 0.712 0.000 0.000 0.280
#> GSM381204     1  0.0000      0.819 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000      0.819 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.819 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.3833      0.310 0.000 0.556 0.000 0.000 0.444 0.000
#> GSM381214     2  0.1714      0.656 0.000 0.908 0.000 0.000 0.092 0.000
#> GSM381216     3  0.1088      0.497 0.024 0.000 0.960 0.000 0.000 0.016
#> GSM381225     6  0.5662      0.556 0.000 0.000 0.384 0.156 0.000 0.460
#> GSM381231     4  0.1327      0.968 0.000 0.000 0.000 0.936 0.000 0.064
#> GSM381235     3  0.0993      0.497 0.024 0.000 0.964 0.000 0.000 0.012
#> GSM381237     1  0.0000      0.819 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.3076      0.570 0.000 0.760 0.000 0.000 0.240 0.000
#> GSM381243     5  0.3515      0.468 0.000 0.324 0.000 0.000 0.676 0.000
#> GSM381245     1  0.3752      0.776 0.800 0.000 0.060 0.000 0.016 0.124
#> GSM381246     2  0.3647      0.186 0.000 0.640 0.000 0.000 0.360 0.000
#> GSM381251     6  0.3634      0.653 0.000 0.000 0.356 0.000 0.000 0.644
#> GSM381264     1  0.0000      0.819 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000      0.664 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381217     3  0.1176      0.498 0.024 0.000 0.956 0.000 0.000 0.020
#> GSM381218     2  0.2969      0.585 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381226     5  0.3868      0.201 0.000 0.496 0.000 0.000 0.504 0.000
#> GSM381227     2  0.3659      0.227 0.000 0.636 0.000 0.000 0.364 0.000
#> GSM381228     4  0.0865      0.967 0.000 0.000 0.000 0.964 0.000 0.036
#> GSM381236     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     1  0.3351      0.717 0.800 0.000 0.168 0.000 0.004 0.028
#> GSM381272     4  0.1327      0.968 0.000 0.000 0.000 0.936 0.000 0.064
#> GSM381277     1  0.3950      0.768 0.780 0.000 0.060 0.000 0.016 0.144
#> GSM381278     6  0.5431      0.523 0.000 0.000 0.344 0.132 0.000 0.524
#> GSM381197     3  0.4396      0.165 0.456 0.000 0.520 0.000 0.000 0.024
#> GSM381202     3  0.3076      0.433 0.240 0.000 0.760 0.000 0.000 0.000
#> GSM381207     1  0.5173      0.537 0.576 0.000 0.064 0.000 0.016 0.344
#> GSM381208     2  0.2562      0.564 0.000 0.828 0.000 0.000 0.172 0.000
#> GSM381210     1  0.0146      0.818 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM381215     3  0.3578      0.256 0.000 0.000 0.660 0.000 0.000 0.340
#> GSM381219     2  0.3221      0.528 0.000 0.736 0.000 0.000 0.264 0.000
#> GSM381221     5  0.3717      0.490 0.000 0.384 0.000 0.000 0.616 0.000
#> GSM381223     5  0.2092      0.664 0.000 0.124 0.000 0.000 0.876 0.000
#> GSM381229     6  0.3871      0.684 0.000 0.000 0.308 0.016 0.000 0.676
#> GSM381230     1  0.1007      0.805 0.956 0.000 0.044 0.000 0.000 0.000
#> GSM381233     3  0.3868     -0.253 0.496 0.000 0.504 0.000 0.000 0.000
#> GSM381234     1  0.4108      0.760 0.756 0.000 0.060 0.000 0.012 0.172
#> GSM381238     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381239     4  0.0000      0.960 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     3  0.1492      0.480 0.036 0.000 0.940 0.000 0.000 0.024
#> GSM381247     5  0.2378      0.678 0.000 0.152 0.000 0.000 0.848 0.000
#> GSM381248     1  0.5204      0.544 0.548 0.000 0.060 0.000 0.016 0.376
#> GSM381249     1  0.3838      0.396 0.552 0.000 0.448 0.000 0.000 0.000
#> GSM381253     3  0.3690      0.423 0.012 0.000 0.700 0.000 0.000 0.288
#> GSM381255     2  0.0000      0.664 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381258     3  0.2527      0.413 0.024 0.000 0.868 0.000 0.000 0.108
#> GSM381262     6  0.3647      0.650 0.000 0.000 0.360 0.000 0.000 0.640
#> GSM381266     6  0.5301      0.597 0.000 0.000 0.268 0.148 0.000 0.584
#> GSM381267     2  0.3647      0.264 0.000 0.640 0.000 0.000 0.360 0.000
#> GSM381269     3  0.3665      0.312 0.252 0.000 0.728 0.000 0.000 0.020
#> GSM381273     6  0.5395      0.569 0.000 0.000 0.196 0.220 0.000 0.584
#> GSM381274     5  0.1225      0.657 0.000 0.036 0.000 0.000 0.952 0.012
#> GSM381276     3  0.3330      0.406 0.000 0.000 0.716 0.000 0.000 0.284

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 other(p) k
#> MAD:mclust 86    0.744 2
#> MAD:mclust 81    0.322 3
#> MAD:mclust 84    0.600 4
#> MAD:mclust 74    0.453 5
#> MAD:mclust 55    0.356 6

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


MAD:NMF*

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.905           0.932       0.972         0.4676 0.540   0.540
#> 3 3 0.913           0.906       0.945         0.4111 0.781   0.600
#> 4 4 0.688           0.756       0.839         0.0896 0.868   0.638
#> 5 5 0.809           0.772       0.865         0.0602 0.940   0.783
#> 6 6 0.847           0.779       0.885         0.0250 0.925   0.714

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
#> GSM381194     1   0.000      0.964 1.000 0.000
#> GSM381199     2   0.000      0.983 0.000 1.000
#> GSM381205     2   0.000      0.983 0.000 1.000
#> GSM381211     2   0.000      0.983 0.000 1.000
#> GSM381220     2   0.000      0.983 0.000 1.000
#> GSM381222     1   0.000      0.964 1.000 0.000
#> GSM381224     1   0.000      0.964 1.000 0.000
#> GSM381232     1   0.697      0.779 0.812 0.188
#> GSM381240     1   0.000      0.964 1.000 0.000
#> GSM381250     1   0.000      0.964 1.000 0.000
#> GSM381252     2   0.000      0.983 0.000 1.000
#> GSM381254     1   0.000      0.964 1.000 0.000
#> GSM381256     2   0.000      0.983 0.000 1.000
#> GSM381257     1   0.000      0.964 1.000 0.000
#> GSM381259     1   0.000      0.964 1.000 0.000
#> GSM381260     1   0.000      0.964 1.000 0.000
#> GSM381261     2   0.000      0.983 0.000 1.000
#> GSM381263     1   0.000      0.964 1.000 0.000
#> GSM381265     1   0.000      0.964 1.000 0.000
#> GSM381268     1   0.000      0.964 1.000 0.000
#> GSM381270     2   0.000      0.983 0.000 1.000
#> GSM381271     1   0.730      0.758 0.796 0.204
#> GSM381275     2   0.000      0.983 0.000 1.000
#> GSM381279     2   0.000      0.983 0.000 1.000
#> GSM381195     1   0.000      0.964 1.000 0.000
#> GSM381196     1   0.000      0.964 1.000 0.000
#> GSM381198     2   0.000      0.983 0.000 1.000
#> GSM381200     2   0.000      0.983 0.000 1.000
#> GSM381201     1   0.000      0.964 1.000 0.000
#> GSM381203     1   0.000      0.964 1.000 0.000
#> GSM381204     1   0.000      0.964 1.000 0.000
#> GSM381209     1   0.000      0.964 1.000 0.000
#> GSM381212     1   0.000      0.964 1.000 0.000
#> GSM381213     2   0.000      0.983 0.000 1.000
#> GSM381214     2   0.000      0.983 0.000 1.000
#> GSM381216     1   0.000      0.964 1.000 0.000
#> GSM381225     1   0.781      0.697 0.768 0.232
#> GSM381231     1   0.999      0.124 0.520 0.480
#> GSM381235     1   0.000      0.964 1.000 0.000
#> GSM381237     1   0.000      0.964 1.000 0.000
#> GSM381241     2   0.000      0.983 0.000 1.000
#> GSM381243     2   0.000      0.983 0.000 1.000
#> GSM381245     1   0.000      0.964 1.000 0.000
#> GSM381246     2   0.000      0.983 0.000 1.000
#> GSM381251     1   0.000      0.964 1.000 0.000
#> GSM381264     1   0.000      0.964 1.000 0.000
#> GSM381206     2   0.000      0.983 0.000 1.000
#> GSM381217     1   0.000      0.964 1.000 0.000
#> GSM381218     2   0.000      0.983 0.000 1.000
#> GSM381226     2   0.000      0.983 0.000 1.000
#> GSM381227     2   0.000      0.983 0.000 1.000
#> GSM381228     2   0.997      0.030 0.468 0.532
#> GSM381236     1   0.706      0.774 0.808 0.192
#> GSM381244     1   0.000      0.964 1.000 0.000
#> GSM381272     1   0.730      0.758 0.796 0.204
#> GSM381277     1   0.000      0.964 1.000 0.000
#> GSM381278     1   0.000      0.964 1.000 0.000
#> GSM381197     1   0.000      0.964 1.000 0.000
#> GSM381202     1   0.000      0.964 1.000 0.000
#> GSM381207     1   0.000      0.964 1.000 0.000
#> GSM381208     2   0.000      0.983 0.000 1.000
#> GSM381210     1   0.000      0.964 1.000 0.000
#> GSM381215     1   0.000      0.964 1.000 0.000
#> GSM381219     2   0.000      0.983 0.000 1.000
#> GSM381221     2   0.000      0.983 0.000 1.000
#> GSM381223     2   0.000      0.983 0.000 1.000
#> GSM381229     1   0.000      0.964 1.000 0.000
#> GSM381230     1   0.000      0.964 1.000 0.000
#> GSM381233     1   0.000      0.964 1.000 0.000
#> GSM381234     1   0.000      0.964 1.000 0.000
#> GSM381238     1   0.738      0.753 0.792 0.208
#> GSM381239     1   0.745      0.747 0.788 0.212
#> GSM381242     1   0.000      0.964 1.000 0.000
#> GSM381247     2   0.000      0.983 0.000 1.000
#> GSM381248     1   0.000      0.964 1.000 0.000
#> GSM381249     1   0.000      0.964 1.000 0.000
#> GSM381253     1   0.000      0.964 1.000 0.000
#> GSM381255     2   0.000      0.983 0.000 1.000
#> GSM381258     1   0.000      0.964 1.000 0.000
#> GSM381262     1   0.000      0.964 1.000 0.000
#> GSM381266     1   0.000      0.964 1.000 0.000
#> GSM381267     2   0.000      0.983 0.000 1.000
#> GSM381269     1   0.000      0.964 1.000 0.000
#> GSM381273     1   0.000      0.964 1.000 0.000
#> GSM381274     2   0.000      0.983 0.000 1.000
#> GSM381276     1   0.000      0.964 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
#> GSM381194     3  0.1711      0.911 0.032 0.008 0.960
#> GSM381199     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381205     2  0.1453      0.967 0.008 0.968 0.024
#> GSM381211     2  0.1031      0.970 0.000 0.976 0.024
#> GSM381220     2  0.1411      0.971 0.000 0.964 0.036
#> GSM381222     1  0.0892      0.945 0.980 0.000 0.020
#> GSM381224     1  0.0237      0.946 0.996 0.000 0.004
#> GSM381232     3  0.1182      0.905 0.012 0.012 0.976
#> GSM381240     1  0.0000      0.945 1.000 0.000 0.000
#> GSM381250     1  0.6244      0.126 0.560 0.000 0.440
#> GSM381252     2  0.0747      0.974 0.000 0.984 0.016
#> GSM381254     1  0.0592      0.946 0.988 0.000 0.012
#> GSM381256     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381257     1  0.1031      0.944 0.976 0.000 0.024
#> GSM381259     1  0.1620      0.922 0.964 0.012 0.024
#> GSM381260     1  0.3482      0.858 0.872 0.000 0.128
#> GSM381261     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381263     3  0.5785      0.569 0.332 0.000 0.668
#> GSM381265     1  0.0237      0.946 0.996 0.000 0.004
#> GSM381268     3  0.2878      0.880 0.096 0.000 0.904
#> GSM381270     2  0.2066      0.955 0.000 0.940 0.060
#> GSM381271     3  0.1182      0.905 0.012 0.012 0.976
#> GSM381275     2  0.0592      0.975 0.000 0.988 0.012
#> GSM381279     2  0.1964      0.958 0.000 0.944 0.056
#> GSM381195     1  0.0237      0.943 0.996 0.000 0.004
#> GSM381196     3  0.6307      0.121 0.488 0.000 0.512
#> GSM381198     2  0.1453      0.967 0.008 0.968 0.024
#> GSM381200     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381201     3  0.2066      0.904 0.060 0.000 0.940
#> GSM381203     1  0.0829      0.942 0.984 0.004 0.012
#> GSM381204     1  0.0983      0.934 0.980 0.004 0.016
#> GSM381209     1  0.1774      0.919 0.960 0.016 0.024
#> GSM381212     1  0.1337      0.929 0.972 0.012 0.016
#> GSM381213     2  0.1289      0.973 0.000 0.968 0.032
#> GSM381214     2  0.0237      0.977 0.000 0.996 0.004
#> GSM381216     1  0.2448      0.916 0.924 0.000 0.076
#> GSM381225     3  0.6161      0.660 0.272 0.020 0.708
#> GSM381231     3  0.1163      0.893 0.000 0.028 0.972
#> GSM381235     1  0.2625      0.909 0.916 0.000 0.084
#> GSM381237     1  0.0237      0.943 0.996 0.000 0.004
#> GSM381241     2  0.0424      0.976 0.000 0.992 0.008
#> GSM381243     2  0.1964      0.958 0.000 0.944 0.056
#> GSM381245     1  0.0592      0.946 0.988 0.000 0.012
#> GSM381246     2  0.1170      0.971 0.008 0.976 0.016
#> GSM381251     3  0.1529      0.911 0.040 0.000 0.960
#> GSM381264     1  0.0661      0.940 0.988 0.004 0.008
#> GSM381206     2  0.1453      0.967 0.008 0.968 0.024
#> GSM381217     1  0.1031      0.944 0.976 0.000 0.024
#> GSM381218     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381226     2  0.0892      0.977 0.000 0.980 0.020
#> GSM381227     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381228     3  0.1031      0.896 0.000 0.024 0.976
#> GSM381236     3  0.1482      0.908 0.020 0.012 0.968
#> GSM381244     1  0.2625      0.908 0.916 0.000 0.084
#> GSM381272     3  0.1182      0.905 0.012 0.012 0.976
#> GSM381277     1  0.1163      0.942 0.972 0.000 0.028
#> GSM381278     3  0.1289      0.911 0.032 0.000 0.968
#> GSM381197     1  0.3412      0.863 0.876 0.000 0.124
#> GSM381202     1  0.0592      0.946 0.988 0.000 0.012
#> GSM381207     1  0.1753      0.933 0.952 0.000 0.048
#> GSM381208     2  0.0592      0.975 0.000 0.988 0.012
#> GSM381210     1  0.0237      0.946 0.996 0.000 0.004
#> GSM381215     3  0.2537      0.893 0.080 0.000 0.920
#> GSM381219     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381221     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381223     2  0.0747      0.978 0.000 0.984 0.016
#> GSM381229     3  0.1765      0.911 0.040 0.004 0.956
#> GSM381230     1  0.0000      0.945 1.000 0.000 0.000
#> GSM381233     1  0.0592      0.946 0.988 0.000 0.012
#> GSM381234     1  0.0237      0.946 0.996 0.000 0.004
#> GSM381238     3  0.1337      0.907 0.016 0.012 0.972
#> GSM381239     3  0.1781      0.904 0.020 0.020 0.960
#> GSM381242     1  0.2878      0.893 0.904 0.000 0.096
#> GSM381247     2  0.3551      0.881 0.000 0.868 0.132
#> GSM381248     1  0.1031      0.944 0.976 0.000 0.024
#> GSM381249     1  0.0424      0.946 0.992 0.000 0.008
#> GSM381253     1  0.4702      0.737 0.788 0.000 0.212
#> GSM381255     2  0.0592      0.975 0.000 0.988 0.012
#> GSM381258     3  0.2448      0.895 0.076 0.000 0.924
#> GSM381262     3  0.1529      0.911 0.040 0.000 0.960
#> GSM381266     3  0.1643      0.910 0.044 0.000 0.956
#> GSM381267     2  0.1163      0.975 0.000 0.972 0.028
#> GSM381269     1  0.1753      0.934 0.952 0.000 0.048
#> GSM381273     3  0.1529      0.911 0.040 0.000 0.960
#> GSM381274     2  0.0592      0.978 0.000 0.988 0.012
#> GSM381276     3  0.5733      0.585 0.324 0.000 0.676

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.4387     0.4721 0.024 0.000 0.776 0.200
#> GSM381199     2  0.1724     0.9445 0.000 0.948 0.032 0.020
#> GSM381205     2  0.2409     0.9321 0.032 0.924 0.004 0.040
#> GSM381211     2  0.1743     0.9386 0.004 0.940 0.000 0.056
#> GSM381220     2  0.3831     0.8397 0.000 0.792 0.004 0.204
#> GSM381222     1  0.3123     0.8044 0.844 0.000 0.156 0.000
#> GSM381224     1  0.3024     0.8136 0.852 0.000 0.148 0.000
#> GSM381232     4  0.2921     0.8259 0.000 0.000 0.140 0.860
#> GSM381240     1  0.1211     0.8840 0.960 0.000 0.040 0.000
#> GSM381250     3  0.4420     0.6936 0.240 0.000 0.748 0.012
#> GSM381252     2  0.0524     0.9432 0.004 0.988 0.000 0.008
#> GSM381254     1  0.0336     0.8852 0.992 0.000 0.008 0.000
#> GSM381256     2  0.2048     0.9418 0.000 0.928 0.008 0.064
#> GSM381257     1  0.3123     0.8031 0.844 0.000 0.156 0.000
#> GSM381259     1  0.0707     0.8700 0.980 0.020 0.000 0.000
#> GSM381260     3  0.4741     0.6175 0.328 0.000 0.668 0.004
#> GSM381261     2  0.3691     0.8979 0.000 0.856 0.068 0.076
#> GSM381263     3  0.4638     0.6796 0.180 0.000 0.776 0.044
#> GSM381265     1  0.0188     0.8861 0.996 0.000 0.004 0.000
#> GSM381268     3  0.6097     0.1866 0.056 0.000 0.580 0.364
#> GSM381270     2  0.2376     0.9423 0.000 0.916 0.016 0.068
#> GSM381271     4  0.2469     0.8288 0.000 0.000 0.108 0.892
#> GSM381275     2  0.3439     0.8968 0.000 0.868 0.048 0.084
#> GSM381279     2  0.1940     0.9427 0.000 0.924 0.000 0.076
#> GSM381195     1  0.0000     0.8847 1.000 0.000 0.000 0.000
#> GSM381196     3  0.5657     0.6835 0.244 0.000 0.688 0.068
#> GSM381198     2  0.0376     0.9430 0.004 0.992 0.000 0.004
#> GSM381200     2  0.1824     0.9361 0.000 0.936 0.004 0.060
#> GSM381201     4  0.5856     0.4130 0.036 0.000 0.408 0.556
#> GSM381203     3  0.5143     0.3257 0.456 0.004 0.540 0.000
#> GSM381204     1  0.1256     0.8858 0.964 0.008 0.028 0.000
#> GSM381209     1  0.1174     0.8762 0.968 0.020 0.012 0.000
#> GSM381212     1  0.0672     0.8839 0.984 0.008 0.008 0.000
#> GSM381213     2  0.2345     0.9353 0.000 0.900 0.000 0.100
#> GSM381214     2  0.2197     0.9362 0.004 0.916 0.000 0.080
#> GSM381216     3  0.3991     0.6028 0.120 0.000 0.832 0.048
#> GSM381225     3  0.5662     0.6792 0.200 0.020 0.728 0.052
#> GSM381231     4  0.2921     0.8281 0.000 0.000 0.140 0.860
#> GSM381235     3  0.3610     0.6788 0.200 0.000 0.800 0.000
#> GSM381237     1  0.0707     0.8885 0.980 0.000 0.020 0.000
#> GSM381241     2  0.0779     0.9448 0.004 0.980 0.000 0.016
#> GSM381243     2  0.2530     0.9248 0.000 0.888 0.000 0.112
#> GSM381245     1  0.0469     0.8870 0.988 0.000 0.012 0.000
#> GSM381246     2  0.1792     0.9290 0.000 0.932 0.000 0.068
#> GSM381251     3  0.5660     0.0452 0.028 0.000 0.576 0.396
#> GSM381264     1  0.0188     0.8829 0.996 0.004 0.000 0.000
#> GSM381206     2  0.1174     0.9422 0.020 0.968 0.000 0.012
#> GSM381217     3  0.4936     0.5632 0.340 0.000 0.652 0.008
#> GSM381218     2  0.2081     0.9360 0.000 0.916 0.000 0.084
#> GSM381226     2  0.1118     0.9385 0.000 0.964 0.000 0.036
#> GSM381227     2  0.1722     0.9454 0.000 0.944 0.008 0.048
#> GSM381228     4  0.2654     0.8283 0.000 0.004 0.108 0.888
#> GSM381236     4  0.2466     0.8188 0.000 0.004 0.096 0.900
#> GSM381244     1  0.4018     0.6889 0.772 0.000 0.224 0.004
#> GSM381272     4  0.2868     0.8281 0.000 0.000 0.136 0.864
#> GSM381277     1  0.1929     0.8725 0.940 0.000 0.036 0.024
#> GSM381278     4  0.5168     0.4016 0.004 0.000 0.492 0.504
#> GSM381197     3  0.5080     0.4524 0.420 0.000 0.576 0.004
#> GSM381202     1  0.5163    -0.1540 0.516 0.000 0.480 0.004
#> GSM381207     1  0.1767     0.8739 0.944 0.000 0.044 0.012
#> GSM381208     2  0.2926     0.9233 0.012 0.888 0.004 0.096
#> GSM381210     1  0.2973     0.8192 0.856 0.000 0.144 0.000
#> GSM381215     3  0.5599     0.4057 0.052 0.000 0.672 0.276
#> GSM381219     2  0.1118     0.9456 0.000 0.964 0.000 0.036
#> GSM381221     2  0.1022     0.9454 0.000 0.968 0.000 0.032
#> GSM381223     2  0.2742     0.9215 0.000 0.900 0.024 0.076
#> GSM381229     3  0.5691    -0.0149 0.028 0.000 0.564 0.408
#> GSM381230     1  0.0707     0.8885 0.980 0.000 0.020 0.000
#> GSM381233     1  0.3852     0.7601 0.800 0.000 0.192 0.008
#> GSM381234     1  0.0592     0.8862 0.984 0.000 0.016 0.000
#> GSM381238     4  0.2593     0.8250 0.000 0.004 0.104 0.892
#> GSM381239     4  0.2483     0.7737 0.000 0.032 0.052 0.916
#> GSM381242     3  0.4632     0.6341 0.308 0.000 0.688 0.004
#> GSM381247     2  0.3497     0.9126 0.000 0.860 0.036 0.104
#> GSM381248     1  0.1059     0.8819 0.972 0.000 0.016 0.012
#> GSM381249     1  0.3688     0.7388 0.792 0.000 0.208 0.000
#> GSM381253     3  0.6362     0.6589 0.288 0.000 0.616 0.096
#> GSM381255     2  0.1576     0.9402 0.004 0.948 0.000 0.048
#> GSM381258     3  0.1209     0.5009 0.004 0.000 0.964 0.032
#> GSM381262     3  0.5565     0.2096 0.032 0.000 0.624 0.344
#> GSM381266     4  0.5645     0.5308 0.032 0.000 0.364 0.604
#> GSM381267     2  0.2469     0.9270 0.000 0.892 0.000 0.108
#> GSM381269     3  0.5055     0.3956 0.368 0.000 0.624 0.008
#> GSM381273     4  0.4995     0.7136 0.032 0.000 0.248 0.720
#> GSM381274     2  0.2402     0.9214 0.000 0.912 0.012 0.076
#> GSM381276     3  0.7269     0.6019 0.296 0.000 0.524 0.180

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     5  0.0693     0.9288 0.000 0.000 0.012 0.008 0.980
#> GSM381199     2  0.1041     0.9539 0.000 0.964 0.032 0.000 0.004
#> GSM381205     2  0.2130     0.9414 0.016 0.924 0.044 0.016 0.000
#> GSM381211     2  0.1356     0.9524 0.004 0.956 0.012 0.028 0.000
#> GSM381220     2  0.3445     0.8583 0.000 0.824 0.036 0.140 0.000
#> GSM381222     1  0.4586     0.3901 0.644 0.000 0.336 0.004 0.016
#> GSM381224     1  0.4627     0.0467 0.544 0.000 0.444 0.000 0.012
#> GSM381232     4  0.0865     0.9700 0.000 0.000 0.024 0.972 0.004
#> GSM381240     1  0.3861     0.5487 0.728 0.000 0.264 0.000 0.008
#> GSM381250     5  0.0162     0.9279 0.004 0.000 0.000 0.000 0.996
#> GSM381252     2  0.0671     0.9545 0.004 0.980 0.016 0.000 0.000
#> GSM381254     1  0.0771     0.6864 0.976 0.000 0.020 0.000 0.004
#> GSM381256     2  0.1942     0.9298 0.000 0.920 0.012 0.000 0.068
#> GSM381257     1  0.3994     0.6187 0.772 0.000 0.188 0.000 0.040
#> GSM381259     1  0.1251     0.7034 0.956 0.008 0.036 0.000 0.000
#> GSM381260     3  0.6742     0.5587 0.344 0.000 0.512 0.056 0.088
#> GSM381261     2  0.2280     0.9059 0.000 0.880 0.120 0.000 0.000
#> GSM381263     5  0.2970     0.7500 0.004 0.000 0.168 0.000 0.828
#> GSM381265     1  0.0290     0.6979 0.992 0.000 0.008 0.000 0.000
#> GSM381268     5  0.0324     0.9296 0.004 0.000 0.000 0.004 0.992
#> GSM381270     2  0.1568     0.9511 0.000 0.944 0.020 0.036 0.000
#> GSM381271     4  0.0162     0.9803 0.000 0.000 0.000 0.996 0.004
#> GSM381275     2  0.2929     0.8467 0.000 0.820 0.180 0.000 0.000
#> GSM381279     2  0.1082     0.9546 0.000 0.964 0.008 0.028 0.000
#> GSM381195     1  0.0771     0.6833 0.976 0.000 0.020 0.000 0.004
#> GSM381196     5  0.0290     0.9289 0.008 0.000 0.000 0.000 0.992
#> GSM381198     2  0.0324     0.9542 0.004 0.992 0.004 0.000 0.000
#> GSM381200     2  0.1357     0.9462 0.000 0.948 0.048 0.004 0.000
#> GSM381201     5  0.1209     0.9259 0.012 0.000 0.012 0.012 0.964
#> GSM381203     5  0.1365     0.9091 0.040 0.004 0.004 0.000 0.952
#> GSM381204     1  0.3305     0.6098 0.776 0.000 0.224 0.000 0.000
#> GSM381209     1  0.2770     0.6907 0.864 0.008 0.124 0.000 0.004
#> GSM381212     1  0.1571     0.7063 0.936 0.004 0.060 0.000 0.000
#> GSM381213     2  0.1043     0.9526 0.000 0.960 0.000 0.040 0.000
#> GSM381214     2  0.1412     0.9517 0.004 0.952 0.008 0.036 0.000
#> GSM381216     3  0.3451     0.5945 0.080 0.000 0.856 0.032 0.032
#> GSM381225     5  0.0671     0.9220 0.000 0.016 0.004 0.000 0.980
#> GSM381231     4  0.0771     0.9744 0.000 0.000 0.020 0.976 0.004
#> GSM381235     3  0.6106     0.4355 0.080 0.000 0.560 0.024 0.336
#> GSM381237     1  0.2561     0.6811 0.856 0.000 0.144 0.000 0.000
#> GSM381241     2  0.0671     0.9546 0.000 0.980 0.016 0.000 0.004
#> GSM381243     2  0.1893     0.9476 0.000 0.928 0.024 0.048 0.000
#> GSM381245     1  0.1216     0.7017 0.960 0.000 0.020 0.000 0.020
#> GSM381246     2  0.1638     0.9377 0.004 0.932 0.064 0.000 0.000
#> GSM381251     5  0.0290     0.9278 0.000 0.000 0.000 0.008 0.992
#> GSM381264     1  0.0771     0.6833 0.976 0.000 0.020 0.000 0.004
#> GSM381206     2  0.0798     0.9541 0.016 0.976 0.008 0.000 0.000
#> GSM381217     3  0.5799     0.5189 0.360 0.000 0.548 0.004 0.088
#> GSM381218     2  0.1865     0.9490 0.000 0.936 0.024 0.032 0.008
#> GSM381226     2  0.0963     0.9487 0.000 0.964 0.036 0.000 0.000
#> GSM381227     2  0.1444     0.9513 0.000 0.948 0.012 0.040 0.000
#> GSM381228     4  0.0162     0.9803 0.000 0.000 0.000 0.996 0.004
#> GSM381236     4  0.0162     0.9803 0.000 0.000 0.000 0.996 0.004
#> GSM381244     1  0.6628    -0.1040 0.492 0.000 0.372 0.100 0.036
#> GSM381272     4  0.0771     0.9744 0.000 0.000 0.020 0.976 0.004
#> GSM381277     1  0.5245     0.3961 0.648 0.000 0.044 0.292 0.016
#> GSM381278     5  0.4946     0.6765 0.004 0.000 0.076 0.216 0.704
#> GSM381197     3  0.7008     0.4236 0.388 0.000 0.412 0.024 0.176
#> GSM381202     3  0.5519     0.3611 0.424 0.000 0.520 0.008 0.048
#> GSM381207     1  0.3354     0.6718 0.864 0.000 0.044 0.064 0.028
#> GSM381208     2  0.2104     0.9391 0.000 0.916 0.024 0.060 0.000
#> GSM381210     1  0.4505     0.2724 0.604 0.000 0.384 0.000 0.012
#> GSM381215     5  0.2766     0.8766 0.012 0.000 0.056 0.040 0.892
#> GSM381219     2  0.0324     0.9539 0.000 0.992 0.004 0.004 0.000
#> GSM381221     2  0.0693     0.9540 0.000 0.980 0.012 0.000 0.008
#> GSM381223     2  0.1732     0.9325 0.000 0.920 0.080 0.000 0.000
#> GSM381229     5  0.0486     0.9254 0.000 0.004 0.004 0.004 0.988
#> GSM381230     1  0.1851     0.7037 0.912 0.000 0.088 0.000 0.000
#> GSM381233     1  0.4585     0.2720 0.592 0.000 0.396 0.004 0.008
#> GSM381234     1  0.0865     0.6798 0.972 0.000 0.024 0.000 0.004
#> GSM381238     4  0.0324     0.9802 0.000 0.000 0.004 0.992 0.004
#> GSM381239     4  0.1041     0.9433 0.000 0.032 0.000 0.964 0.004
#> GSM381242     3  0.5942     0.6170 0.276 0.000 0.620 0.064 0.040
#> GSM381247     2  0.1173     0.9531 0.000 0.964 0.012 0.004 0.020
#> GSM381248     1  0.1365     0.6734 0.952 0.000 0.040 0.004 0.004
#> GSM381249     1  0.4656    -0.1215 0.508 0.000 0.480 0.000 0.012
#> GSM381253     5  0.1981     0.8866 0.048 0.000 0.028 0.000 0.924
#> GSM381255     2  0.1372     0.9519 0.004 0.956 0.016 0.024 0.000
#> GSM381258     3  0.3474     0.5697 0.024 0.000 0.856 0.068 0.052
#> GSM381262     5  0.0162     0.9273 0.000 0.004 0.000 0.000 0.996
#> GSM381266     5  0.3361     0.8415 0.012 0.000 0.020 0.128 0.840
#> GSM381267     2  0.1872     0.9453 0.000 0.928 0.020 0.052 0.000
#> GSM381269     3  0.4494     0.6217 0.164 0.000 0.768 0.048 0.020
#> GSM381273     5  0.1281     0.9202 0.000 0.000 0.012 0.032 0.956
#> GSM381274     2  0.1908     0.9234 0.000 0.908 0.092 0.000 0.000
#> GSM381276     3  0.7670     0.5591 0.292 0.000 0.452 0.164 0.092

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.0508     0.9062 0.000 0.000 0.984 0.004 0.012 0.000
#> GSM381199     2  0.1155     0.9538 0.004 0.956 0.004 0.000 0.000 0.036
#> GSM381205     2  0.1757     0.9397 0.052 0.928 0.000 0.012 0.000 0.008
#> GSM381211     2  0.0935     0.9557 0.000 0.964 0.000 0.032 0.000 0.004
#> GSM381220     2  0.3301     0.7846 0.008 0.772 0.000 0.216 0.000 0.004
#> GSM381222     5  0.3804     0.5361 0.336 0.000 0.000 0.000 0.656 0.008
#> GSM381224     5  0.2487     0.7765 0.092 0.000 0.000 0.000 0.876 0.032
#> GSM381232     4  0.0632     0.8875 0.000 0.000 0.000 0.976 0.024 0.000
#> GSM381240     5  0.2907     0.7514 0.152 0.000 0.000 0.000 0.828 0.020
#> GSM381250     3  0.0260     0.9088 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM381252     2  0.0146     0.9554 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381254     1  0.1152     0.7613 0.952 0.000 0.000 0.004 0.044 0.000
#> GSM381256     2  0.1957     0.8887 0.000 0.888 0.112 0.000 0.000 0.000
#> GSM381257     5  0.3956     0.6004 0.292 0.000 0.024 0.000 0.684 0.000
#> GSM381259     1  0.2597     0.7019 0.824 0.000 0.000 0.000 0.176 0.000
#> GSM381260     5  0.1121     0.7706 0.004 0.000 0.008 0.016 0.964 0.008
#> GSM381261     2  0.1863     0.9218 0.000 0.920 0.000 0.004 0.016 0.060
#> GSM381263     3  0.3240     0.3704 0.000 0.000 0.752 0.004 0.244 0.000
#> GSM381265     1  0.2260     0.7377 0.860 0.000 0.000 0.000 0.140 0.000
#> GSM381268     3  0.0000     0.9078 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381270     2  0.1367     0.9521 0.000 0.944 0.000 0.044 0.000 0.012
#> GSM381271     4  0.0363     0.8968 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM381275     2  0.2189     0.9088 0.000 0.904 0.000 0.004 0.032 0.060
#> GSM381279     2  0.1082     0.9548 0.000 0.956 0.000 0.040 0.000 0.004
#> GSM381195     1  0.0790     0.7545 0.968 0.000 0.000 0.000 0.032 0.000
#> GSM381196     3  0.0146     0.9085 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM381198     2  0.0405     0.9559 0.008 0.988 0.000 0.000 0.000 0.004
#> GSM381200     2  0.0146     0.9548 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381201     3  0.1152     0.8870 0.000 0.000 0.952 0.004 0.044 0.000
#> GSM381203     3  0.0291     0.9084 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM381204     5  0.3727     0.4325 0.388 0.000 0.000 0.000 0.612 0.000
#> GSM381209     5  0.3371     0.6273 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM381212     1  0.3672     0.3152 0.632 0.000 0.000 0.000 0.368 0.000
#> GSM381213     2  0.0865     0.9562 0.000 0.964 0.000 0.036 0.000 0.000
#> GSM381214     2  0.0692     0.9569 0.000 0.976 0.000 0.020 0.000 0.004
#> GSM381216     5  0.0935     0.7696 0.000 0.000 0.000 0.004 0.964 0.032
#> GSM381225     3  0.2493     0.7636 0.000 0.004 0.884 0.000 0.076 0.036
#> GSM381231     4  0.0458     0.8958 0.000 0.000 0.000 0.984 0.016 0.000
#> GSM381235     6  0.6246     0.3754 0.004 0.000 0.312 0.000 0.332 0.352
#> GSM381237     5  0.3868     0.1076 0.496 0.000 0.000 0.000 0.504 0.000
#> GSM381241     2  0.0146     0.9554 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM381243     2  0.2697     0.9014 0.000 0.864 0.000 0.092 0.000 0.044
#> GSM381245     1  0.4407    -0.0600 0.496 0.000 0.000 0.000 0.480 0.024
#> GSM381246     2  0.0405     0.9536 0.000 0.988 0.000 0.004 0.008 0.000
#> GSM381251     3  0.0000     0.9078 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM381264     1  0.1387     0.7686 0.932 0.000 0.000 0.000 0.068 0.000
#> GSM381206     2  0.0653     0.9561 0.012 0.980 0.000 0.004 0.000 0.004
#> GSM381217     5  0.3590     0.7574 0.068 0.000 0.020 0.000 0.820 0.092
#> GSM381218     2  0.0972     0.9562 0.000 0.964 0.000 0.028 0.000 0.008
#> GSM381226     2  0.0146     0.9548 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381227     2  0.1265     0.9527 0.000 0.948 0.000 0.044 0.000 0.008
#> GSM381228     4  0.0146     0.8964 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM381236     4  0.0146     0.8964 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM381244     5  0.2480     0.7658 0.028 0.000 0.000 0.028 0.896 0.048
#> GSM381272     4  0.0458     0.8958 0.000 0.000 0.000 0.984 0.016 0.000
#> GSM381277     4  0.6216    -0.0598 0.096 0.000 0.000 0.432 0.416 0.056
#> GSM381278     6  0.4989     0.2446 0.000 0.000 0.388 0.028 0.028 0.556
#> GSM381197     5  0.2095     0.7589 0.016 0.000 0.052 0.012 0.916 0.004
#> GSM381202     5  0.0964     0.7774 0.012 0.000 0.000 0.004 0.968 0.016
#> GSM381207     1  0.6231     0.1306 0.368 0.000 0.004 0.296 0.332 0.000
#> GSM381208     2  0.1668     0.9448 0.004 0.928 0.000 0.060 0.000 0.008
#> GSM381210     5  0.2340     0.7600 0.148 0.000 0.000 0.000 0.852 0.000
#> GSM381215     3  0.1429     0.8759 0.000 0.000 0.940 0.004 0.052 0.004
#> GSM381219     2  0.0146     0.9548 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381221     2  0.0146     0.9560 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM381223     2  0.1194     0.9455 0.000 0.956 0.000 0.004 0.008 0.032
#> GSM381229     3  0.0146     0.9073 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM381230     1  0.1501     0.7691 0.924 0.000 0.000 0.000 0.076 0.000
#> GSM381233     5  0.5906     0.0354 0.368 0.000 0.000 0.000 0.424 0.208
#> GSM381234     1  0.0603     0.7396 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM381238     4  0.0291     0.8923 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM381239     4  0.0146     0.8929 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM381242     5  0.0520     0.7698 0.000 0.000 0.000 0.008 0.984 0.008
#> GSM381247     2  0.2100     0.9391 0.000 0.916 0.032 0.036 0.000 0.016
#> GSM381248     1  0.1644     0.6739 0.920 0.000 0.000 0.000 0.004 0.076
#> GSM381249     5  0.2201     0.7852 0.076 0.000 0.000 0.000 0.896 0.028
#> GSM381253     3  0.1267     0.8584 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM381255     2  0.1296     0.9528 0.004 0.948 0.000 0.044 0.000 0.004
#> GSM381258     5  0.2103     0.7353 0.000 0.000 0.020 0.012 0.912 0.056
#> GSM381262     3  0.0146     0.9073 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM381266     3  0.2051     0.8437 0.000 0.000 0.916 0.040 0.008 0.036
#> GSM381267     2  0.1411     0.9469 0.000 0.936 0.000 0.060 0.000 0.004
#> GSM381269     5  0.1480     0.7786 0.020 0.000 0.000 0.000 0.940 0.040
#> GSM381273     3  0.1434     0.8809 0.000 0.000 0.948 0.020 0.008 0.024
#> GSM381274     2  0.1511     0.9357 0.000 0.940 0.000 0.004 0.012 0.044
#> GSM381276     5  0.2806     0.7154 0.000 0.000 0.012 0.056 0.872 0.060

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 other(p) k
#> MAD:NMF 84    0.728 2
#> MAD:NMF 84    0.788 3
#> MAD:NMF 74    0.823 4
#> MAD:NMF 76    0.384 5
#> MAD:NMF 76    0.454 6

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


ATC:hclust*

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4528 0.548   0.548
#> 3 3 1.000           1.000       1.000         0.0326 0.985   0.973
#> 4 4 0.998           0.938       0.974         0.4519 0.793   0.612
#> 5 5 0.930           0.842       0.941         0.0686 0.937   0.814
#> 6 6 0.853           0.780       0.881         0.0432 0.976   0.918

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette p1 p2
#> GSM381194     1       0          1  1  0
#> GSM381199     2       0          1  0  1
#> GSM381205     2       0          1  0  1
#> GSM381211     2       0          1  0  1
#> GSM381220     2       0          1  0  1
#> GSM381222     1       0          1  1  0
#> GSM381224     1       0          1  1  0
#> GSM381232     1       0          1  1  0
#> GSM381240     1       0          1  1  0
#> GSM381250     1       0          1  1  0
#> GSM381252     2       0          1  0  1
#> GSM381254     1       0          1  1  0
#> GSM381256     2       0          1  0  1
#> GSM381257     1       0          1  1  0
#> GSM381259     1       0          1  1  0
#> GSM381260     1       0          1  1  0
#> GSM381261     2       0          1  0  1
#> GSM381263     1       0          1  1  0
#> GSM381265     1       0          1  1  0
#> GSM381268     1       0          1  1  0
#> GSM381270     2       0          1  0  1
#> GSM381271     1       0          1  1  0
#> GSM381275     2       0          1  0  1
#> GSM381279     2       0          1  0  1
#> GSM381195     1       0          1  1  0
#> GSM381196     1       0          1  1  0
#> GSM381198     2       0          1  0  1
#> GSM381200     2       0          1  0  1
#> GSM381201     1       0          1  1  0
#> GSM381203     1       0          1  1  0
#> GSM381204     1       0          1  1  0
#> GSM381209     1       0          1  1  0
#> GSM381212     1       0          1  1  0
#> GSM381213     2       0          1  0  1
#> GSM381214     2       0          1  0  1
#> GSM381216     1       0          1  1  0
#> GSM381225     1       0          1  1  0
#> GSM381231     1       0          1  1  0
#> GSM381235     1       0          1  1  0
#> GSM381237     1       0          1  1  0
#> GSM381241     2       0          1  0  1
#> GSM381243     2       0          1  0  1
#> GSM381245     1       0          1  1  0
#> GSM381246     2       0          1  0  1
#> GSM381251     1       0          1  1  0
#> GSM381264     1       0          1  1  0
#> GSM381206     2       0          1  0  1
#> GSM381217     1       0          1  1  0
#> GSM381218     2       0          1  0  1
#> GSM381226     2       0          1  0  1
#> GSM381227     2       0          1  0  1
#> GSM381228     1       0          1  1  0
#> GSM381236     1       0          1  1  0
#> GSM381244     1       0          1  1  0
#> GSM381272     1       0          1  1  0
#> GSM381277     1       0          1  1  0
#> GSM381278     1       0          1  1  0
#> GSM381197     1       0          1  1  0
#> GSM381202     1       0          1  1  0
#> GSM381207     1       0          1  1  0
#> GSM381208     2       0          1  0  1
#> GSM381210     1       0          1  1  0
#> GSM381215     1       0          1  1  0
#> GSM381219     2       0          1  0  1
#> GSM381221     2       0          1  0  1
#> GSM381223     2       0          1  0  1
#> GSM381229     1       0          1  1  0
#> GSM381230     1       0          1  1  0
#> GSM381233     1       0          1  1  0
#> GSM381234     1       0          1  1  0
#> GSM381238     1       0          1  1  0
#> GSM381239     1       0          1  1  0
#> GSM381242     1       0          1  1  0
#> GSM381247     2       0          1  0  1
#> GSM381248     1       0          1  1  0
#> GSM381249     1       0          1  1  0
#> GSM381253     1       0          1  1  0
#> GSM381255     2       0          1  0  1
#> GSM381258     1       0          1  1  0
#> GSM381262     1       0          1  1  0
#> GSM381266     1       0          1  1  0
#> GSM381267     2       0          1  0  1
#> GSM381269     1       0          1  1  0
#> GSM381273     1       0          1  1  0
#> GSM381274     2       0          1  0  1
#> GSM381276     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette p1 p2 p3
#> GSM381194     1       0          1  1  0  0
#> GSM381199     2       0          1  0  1  0
#> GSM381205     2       0          1  0  1  0
#> GSM381211     2       0          1  0  1  0
#> GSM381220     2       0          1  0  1  0
#> GSM381222     1       0          1  1  0  0
#> GSM381224     1       0          1  1  0  0
#> GSM381232     1       0          1  1  0  0
#> GSM381240     1       0          1  1  0  0
#> GSM381250     1       0          1  1  0  0
#> GSM381252     2       0          1  0  1  0
#> GSM381254     1       0          1  1  0  0
#> GSM381256     2       0          1  0  1  0
#> GSM381257     1       0          1  1  0  0
#> GSM381259     1       0          1  1  0  0
#> GSM381260     1       0          1  1  0  0
#> GSM381261     2       0          1  0  1  0
#> GSM381263     1       0          1  1  0  0
#> GSM381265     1       0          1  1  0  0
#> GSM381268     1       0          1  1  0  0
#> GSM381270     2       0          1  0  1  0
#> GSM381271     1       0          1  1  0  0
#> GSM381275     2       0          1  0  1  0
#> GSM381279     2       0          1  0  1  0
#> GSM381195     1       0          1  1  0  0
#> GSM381196     1       0          1  1  0  0
#> GSM381198     2       0          1  0  1  0
#> GSM381200     2       0          1  0  1  0
#> GSM381201     1       0          1  1  0  0
#> GSM381203     1       0          1  1  0  0
#> GSM381204     1       0          1  1  0  0
#> GSM381209     1       0          1  1  0  0
#> GSM381212     1       0          1  1  0  0
#> GSM381213     2       0          1  0  1  0
#> GSM381214     2       0          1  0  1  0
#> GSM381216     1       0          1  1  0  0
#> GSM381225     1       0          1  1  0  0
#> GSM381231     1       0          1  1  0  0
#> GSM381235     1       0          1  1  0  0
#> GSM381237     1       0          1  1  0  0
#> GSM381241     2       0          1  0  1  0
#> GSM381243     2       0          1  0  1  0
#> GSM381245     1       0          1  1  0  0
#> GSM381246     2       0          1  0  1  0
#> GSM381251     1       0          1  1  0  0
#> GSM381264     1       0          1  1  0  0
#> GSM381206     2       0          1  0  1  0
#> GSM381217     1       0          1  1  0  0
#> GSM381218     2       0          1  0  1  0
#> GSM381226     2       0          1  0  1  0
#> GSM381227     2       0          1  0  1  0
#> GSM381228     1       0          1  1  0  0
#> GSM381236     1       0          1  1  0  0
#> GSM381244     1       0          1  1  0  0
#> GSM381272     1       0          1  1  0  0
#> GSM381277     1       0          1  1  0  0
#> GSM381278     1       0          1  1  0  0
#> GSM381197     1       0          1  1  0  0
#> GSM381202     1       0          1  1  0  0
#> GSM381207     1       0          1  1  0  0
#> GSM381208     3       0          1  0  0  1
#> GSM381210     1       0          1  1  0  0
#> GSM381215     1       0          1  1  0  0
#> GSM381219     2       0          1  0  1  0
#> GSM381221     2       0          1  0  1  0
#> GSM381223     2       0          1  0  1  0
#> GSM381229     1       0          1  1  0  0
#> GSM381230     1       0          1  1  0  0
#> GSM381233     1       0          1  1  0  0
#> GSM381234     1       0          1  1  0  0
#> GSM381238     1       0          1  1  0  0
#> GSM381239     1       0          1  1  0  0
#> GSM381242     1       0          1  1  0  0
#> GSM381247     2       0          1  0  1  0
#> GSM381248     1       0          1  1  0  0
#> GSM381249     1       0          1  1  0  0
#> GSM381253     1       0          1  1  0  0
#> GSM381255     2       0          1  0  1  0
#> GSM381258     1       0          1  1  0  0
#> GSM381262     1       0          1  1  0  0
#> GSM381266     1       0          1  1  0  0
#> GSM381267     3       0          1  0  0  1
#> GSM381269     1       0          1  1  0  0
#> GSM381273     1       0          1  1  0  0
#> GSM381274     2       0          1  0  1  0
#> GSM381276     1       0          1  1  0  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1 p2    p3 p4
#> GSM381194     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381199     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381205     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381211     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381220     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381222     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381224     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381232     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381240     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381250     3  0.0336      0.926 0.008  0 0.992  0
#> GSM381252     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381254     1  0.0188      0.990 0.996  0 0.004  0
#> GSM381256     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381257     1  0.1716      0.899 0.936  0 0.064  0
#> GSM381259     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381260     3  0.1022      0.917 0.032  0 0.968  0
#> GSM381261     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381263     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381265     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381268     3  0.0469      0.924 0.012  0 0.988  0
#> GSM381270     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381271     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381275     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381279     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381195     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381196     3  0.0336      0.926 0.008  0 0.992  0
#> GSM381198     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381200     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381201     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381203     3  0.0469      0.925 0.012  0 0.988  0
#> GSM381204     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381209     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381212     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381213     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381214     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381216     3  0.0592      0.924 0.016  0 0.984  0
#> GSM381225     3  0.3486      0.759 0.188  0 0.812  0
#> GSM381231     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381235     3  0.1637      0.899 0.060  0 0.940  0
#> GSM381237     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381241     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381243     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381245     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381246     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381251     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381264     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381206     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381217     3  0.0707      0.923 0.020  0 0.980  0
#> GSM381218     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381226     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381227     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381228     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381236     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381244     3  0.4994      0.201 0.480  0 0.520  0
#> GSM381272     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381277     3  0.4972      0.275 0.456  0 0.544  0
#> GSM381278     3  0.2011      0.882 0.080  0 0.920  0
#> GSM381197     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381202     3  0.0592      0.924 0.016  0 0.984  0
#> GSM381207     1  0.0188      0.990 0.996  0 0.004  0
#> GSM381208     4  0.0000      1.000 0.000  0 0.000  1
#> GSM381210     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381215     3  0.0336      0.926 0.008  0 0.992  0
#> GSM381219     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381221     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381223     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381229     3  0.1940      0.885 0.076  0 0.924  0
#> GSM381230     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381233     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381234     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381238     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381239     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381242     3  0.1022      0.917 0.032  0 0.968  0
#> GSM381247     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381248     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381249     1  0.0000      0.995 1.000  0 0.000  0
#> GSM381253     3  0.0336      0.926 0.008  0 0.992  0
#> GSM381255     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381258     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381262     3  0.0000      0.926 0.000  0 1.000  0
#> GSM381266     3  0.1557      0.901 0.056  0 0.944  0
#> GSM381267     4  0.0000      1.000 0.000  0 0.000  1
#> GSM381269     3  0.2345      0.862 0.100  0 0.900  0
#> GSM381273     3  0.1557      0.901 0.056  0 0.944  0
#> GSM381274     2  0.0000      1.000 0.000  1 0.000  0
#> GSM381276     3  0.4948      0.320 0.440  0 0.560  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1 p2    p3 p4    p5
#> GSM381194     3  0.0162     0.8805 0.000  0 0.996  0 0.004
#> GSM381199     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381205     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381211     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381220     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381222     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381224     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381232     3  0.0290     0.8813 0.000  0 0.992  0 0.008
#> GSM381240     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381250     3  0.1082     0.8746 0.008  0 0.964  0 0.028
#> GSM381252     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381254     1  0.0162     0.9329 0.996  0 0.004  0 0.000
#> GSM381256     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381257     1  0.1628     0.8536 0.936  0 0.056  0 0.008
#> GSM381259     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381260     3  0.4485     0.5121 0.028  0 0.680  0 0.292
#> GSM381261     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381263     3  0.0162     0.8805 0.000  0 0.996  0 0.004
#> GSM381265     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381268     3  0.0566     0.8773 0.012  0 0.984  0 0.004
#> GSM381270     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381271     3  0.0290     0.8813 0.000  0 0.992  0 0.008
#> GSM381275     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381279     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381195     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381196     3  0.0992     0.8762 0.008  0 0.968  0 0.024
#> GSM381198     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381200     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381201     3  0.2516     0.7597 0.000  0 0.860  0 0.140
#> GSM381203     3  0.1281     0.8717 0.012  0 0.956  0 0.032
#> GSM381204     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381209     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381212     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381213     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381214     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381216     3  0.1469     0.8693 0.016  0 0.948  0 0.036
#> GSM381225     5  0.0290     0.3097 0.000  0 0.008  0 0.992
#> GSM381231     3  0.0290     0.8813 0.000  0 0.992  0 0.008
#> GSM381235     3  0.4083     0.6401 0.028  0 0.744  0 0.228
#> GSM381237     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381241     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381243     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381245     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381246     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381251     3  0.3661     0.5415 0.000  0 0.724  0 0.276
#> GSM381264     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381206     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381217     3  0.1485     0.8672 0.020  0 0.948  0 0.032
#> GSM381218     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381226     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381227     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381228     3  0.0290     0.8813 0.000  0 0.992  0 0.008
#> GSM381236     3  0.0290     0.8813 0.000  0 0.992  0 0.008
#> GSM381244     1  0.6081    -0.1843 0.476  0 0.124  0 0.400
#> GSM381272     3  0.0290     0.8813 0.000  0 0.992  0 0.008
#> GSM381277     1  0.6100    -0.2639 0.448  0 0.124  0 0.428
#> GSM381278     5  0.2732     0.4780 0.000  0 0.160  0 0.840
#> GSM381197     3  0.0290     0.8798 0.000  0 0.992  0 0.008
#> GSM381202     3  0.1469     0.8693 0.016  0 0.948  0 0.036
#> GSM381207     1  0.0162     0.9329 0.996  0 0.004  0 0.000
#> GSM381208     4  0.0000     1.0000 0.000  0 0.000  1 0.000
#> GSM381210     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381215     3  0.0992     0.8762 0.008  0 0.968  0 0.024
#> GSM381219     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381221     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381223     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381229     5  0.3752     0.4193 0.000  0 0.292  0 0.708
#> GSM381230     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381233     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381234     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381238     3  0.0290     0.8813 0.000  0 0.992  0 0.008
#> GSM381239     3  0.0290     0.8813 0.000  0 0.992  0 0.008
#> GSM381242     3  0.4485     0.5121 0.028  0 0.680  0 0.292
#> GSM381247     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381248     1  0.0510     0.9216 0.984  0 0.000  0 0.016
#> GSM381249     1  0.0000     0.9370 1.000  0 0.000  0 0.000
#> GSM381253     3  0.0992     0.8762 0.008  0 0.968  0 0.024
#> GSM381255     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381258     3  0.0162     0.8805 0.000  0 0.996  0 0.004
#> GSM381262     3  0.0162     0.8805 0.000  0 0.996  0 0.004
#> GSM381266     3  0.4306     0.0185 0.000  0 0.508  0 0.492
#> GSM381267     4  0.0000     1.0000 0.000  0 0.000  1 0.000
#> GSM381269     3  0.2959     0.7737 0.100  0 0.864  0 0.036
#> GSM381273     3  0.4306     0.0185 0.000  0 0.508  0 0.492
#> GSM381274     2  0.0000     1.0000 0.000  1 0.000  0 0.000
#> GSM381276     5  0.6101     0.0337 0.432  0 0.124  0 0.444

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.0777     0.7842 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM381199     2  0.0000     0.9483 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381205     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381211     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381220     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381222     1  0.0000     0.8772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381224     1  0.0000     0.8772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381232     3  0.3531     0.6675 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM381240     1  0.0000     0.8772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.0405     0.7827 0.008 0.000 0.988 0.000 0.000 0.004
#> GSM381252     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381254     1  0.0146     0.8755 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM381256     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381257     1  0.4117     0.6636 0.716 0.000 0.056 0.000 0.000 0.228
#> GSM381259     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381260     3  0.4181     0.5179 0.028 0.000 0.704 0.000 0.256 0.012
#> GSM381261     2  0.3221     0.7377 0.000 0.736 0.000 0.264 0.000 0.000
#> GSM381263     3  0.0777     0.7842 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM381265     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381268     3  0.1010     0.7831 0.000 0.000 0.960 0.000 0.004 0.036
#> GSM381270     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381271     3  0.3531     0.6675 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM381275     2  0.3221     0.7377 0.000 0.736 0.000 0.264 0.000 0.000
#> GSM381279     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381195     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381196     3  0.0260     0.7838 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM381198     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381200     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381201     3  0.3806     0.5981 0.000 0.000 0.776 0.000 0.136 0.088
#> GSM381203     3  0.0622     0.7807 0.012 0.000 0.980 0.000 0.000 0.008
#> GSM381204     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381209     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381212     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381213     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381214     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381216     3  0.0820     0.7793 0.016 0.000 0.972 0.000 0.000 0.012
#> GSM381225     5  0.0000     0.4308 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM381231     3  0.3531     0.6675 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM381235     3  0.4037     0.6072 0.028 0.000 0.752 0.000 0.196 0.024
#> GSM381237     1  0.0000     0.8772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000     0.9483 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381243     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381245     1  0.0000     0.8772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381246     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381251     3  0.5826    -0.2393 0.000 0.000 0.492 0.000 0.272 0.236
#> GSM381264     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381206     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381217     3  0.0806     0.7766 0.020 0.000 0.972 0.000 0.000 0.008
#> GSM381218     2  0.0000     0.9483 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381226     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381227     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381228     3  0.3531     0.6675 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM381236     3  0.3531     0.6675 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM381244     1  0.5899     0.1310 0.476 0.000 0.148 0.000 0.364 0.012
#> GSM381272     3  0.3531     0.6675 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM381277     1  0.5931     0.0626 0.448 0.000 0.148 0.000 0.392 0.012
#> GSM381278     5  0.2831     0.6600 0.000 0.000 0.136 0.000 0.840 0.024
#> GSM381197     3  0.1584     0.7710 0.000 0.000 0.928 0.000 0.008 0.064
#> GSM381202     3  0.0820     0.7793 0.016 0.000 0.972 0.000 0.000 0.012
#> GSM381207     1  0.0146     0.8755 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM381208     4  0.3221     1.0000 0.000 0.000 0.000 0.736 0.000 0.264
#> GSM381210     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381215     3  0.0260     0.7838 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM381219     2  0.0363     0.9474 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM381221     2  0.0000     0.9483 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381223     2  0.3221     0.7377 0.000 0.736 0.000 0.264 0.000 0.000
#> GSM381229     5  0.4474     0.7004 0.000 0.000 0.172 0.000 0.708 0.120
#> GSM381230     1  0.0000     0.8772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.0000     0.8772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381234     1  0.0000     0.8772 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381238     3  0.3531     0.6675 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM381239     3  0.3531     0.6675 0.000 0.000 0.672 0.000 0.000 0.328
#> GSM381242     3  0.4181     0.5179 0.028 0.000 0.704 0.000 0.256 0.012
#> GSM381247     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381248     1  0.2793     0.7229 0.800 0.000 0.000 0.000 0.000 0.200
#> GSM381249     1  0.1204     0.8743 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM381253     3  0.0260     0.7838 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM381255     2  0.0632     0.9459 0.000 0.976 0.000 0.024 0.000 0.000
#> GSM381258     3  0.0777     0.7842 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM381262     3  0.0777     0.7842 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM381266     5  0.5794     0.6657 0.000 0.000 0.296 0.000 0.492 0.212
#> GSM381267     4  0.3221     1.0000 0.000 0.000 0.000 0.736 0.000 0.264
#> GSM381269     3  0.2170     0.7006 0.100 0.000 0.888 0.000 0.000 0.012
#> GSM381273     5  0.5794     0.6657 0.000 0.000 0.296 0.000 0.492 0.212
#> GSM381274     2  0.3221     0.7377 0.000 0.736 0.000 0.264 0.000 0.000
#> GSM381276     1  0.5939     0.0199 0.432 0.000 0.148 0.000 0.408 0.012

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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 other(p) k
#> ATC:hclust 86    0.744 2
#> ATC:hclust 86    0.390 3
#> ATC:hclust 83    0.318 4
#> ATC:hclust 78    0.402 5
#> ATC:hclust 81    0.286 6

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


ATC:kmeans**

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4528 0.548   0.548
#> 3 3 0.726           0.949       0.887         0.3619 0.789   0.615
#> 4 4 0.630           0.508       0.838         0.1251 0.982   0.946
#> 5 5 0.799           0.730       0.832         0.0811 0.917   0.750
#> 6 6 0.743           0.626       0.670         0.0362 0.890   0.596

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
#> GSM381194     1       0          1  1  0
#> GSM381199     2       0          1  0  1
#> GSM381205     2       0          1  0  1
#> GSM381211     2       0          1  0  1
#> GSM381220     2       0          1  0  1
#> GSM381222     1       0          1  1  0
#> GSM381224     1       0          1  1  0
#> GSM381232     1       0          1  1  0
#> GSM381240     1       0          1  1  0
#> GSM381250     1       0          1  1  0
#> GSM381252     2       0          1  0  1
#> GSM381254     1       0          1  1  0
#> GSM381256     2       0          1  0  1
#> GSM381257     1       0          1  1  0
#> GSM381259     1       0          1  1  0
#> GSM381260     1       0          1  1  0
#> GSM381261     2       0          1  0  1
#> GSM381263     1       0          1  1  0
#> GSM381265     1       0          1  1  0
#> GSM381268     1       0          1  1  0
#> GSM381270     2       0          1  0  1
#> GSM381271     1       0          1  1  0
#> GSM381275     2       0          1  0  1
#> GSM381279     2       0          1  0  1
#> GSM381195     1       0          1  1  0
#> GSM381196     1       0          1  1  0
#> GSM381198     2       0          1  0  1
#> GSM381200     2       0          1  0  1
#> GSM381201     1       0          1  1  0
#> GSM381203     1       0          1  1  0
#> GSM381204     1       0          1  1  0
#> GSM381209     1       0          1  1  0
#> GSM381212     1       0          1  1  0
#> GSM381213     2       0          1  0  1
#> GSM381214     2       0          1  0  1
#> GSM381216     1       0          1  1  0
#> GSM381225     1       0          1  1  0
#> GSM381231     1       0          1  1  0
#> GSM381235     1       0          1  1  0
#> GSM381237     1       0          1  1  0
#> GSM381241     2       0          1  0  1
#> GSM381243     2       0          1  0  1
#> GSM381245     1       0          1  1  0
#> GSM381246     2       0          1  0  1
#> GSM381251     1       0          1  1  0
#> GSM381264     1       0          1  1  0
#> GSM381206     2       0          1  0  1
#> GSM381217     1       0          1  1  0
#> GSM381218     2       0          1  0  1
#> GSM381226     2       0          1  0  1
#> GSM381227     2       0          1  0  1
#> GSM381228     1       0          1  1  0
#> GSM381236     1       0          1  1  0
#> GSM381244     1       0          1  1  0
#> GSM381272     1       0          1  1  0
#> GSM381277     1       0          1  1  0
#> GSM381278     1       0          1  1  0
#> GSM381197     1       0          1  1  0
#> GSM381202     1       0          1  1  0
#> GSM381207     1       0          1  1  0
#> GSM381208     2       0          1  0  1
#> GSM381210     1       0          1  1  0
#> GSM381215     1       0          1  1  0
#> GSM381219     2       0          1  0  1
#> GSM381221     2       0          1  0  1
#> GSM381223     2       0          1  0  1
#> GSM381229     1       0          1  1  0
#> GSM381230     1       0          1  1  0
#> GSM381233     1       0          1  1  0
#> GSM381234     1       0          1  1  0
#> GSM381238     1       0          1  1  0
#> GSM381239     1       0          1  1  0
#> GSM381242     1       0          1  1  0
#> GSM381247     2       0          1  0  1
#> GSM381248     1       0          1  1  0
#> GSM381249     1       0          1  1  0
#> GSM381253     1       0          1  1  0
#> GSM381255     2       0          1  0  1
#> GSM381258     1       0          1  1  0
#> GSM381262     1       0          1  1  0
#> GSM381266     1       0          1  1  0
#> GSM381267     2       0          1  0  1
#> GSM381269     1       0          1  1  0
#> GSM381273     1       0          1  1  0
#> GSM381274     2       0          1  0  1
#> GSM381276     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM381194     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381199     2  0.0000      0.936 0.000 1.000 0.000
#> GSM381205     2  0.1031      0.932 0.024 0.976 0.000
#> GSM381211     2  0.1031      0.932 0.024 0.976 0.000
#> GSM381220     2  0.4178      0.922 0.172 0.828 0.000
#> GSM381222     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381224     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381232     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381240     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381250     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381252     2  0.0000      0.936 0.000 1.000 0.000
#> GSM381254     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381256     2  0.2066      0.936 0.060 0.940 0.000
#> GSM381257     3  0.2356      0.897 0.072 0.000 0.928
#> GSM381259     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381260     3  0.0892      0.950 0.020 0.000 0.980
#> GSM381261     2  0.4235      0.921 0.176 0.824 0.000
#> GSM381263     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381265     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381268     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381270     2  0.4178      0.922 0.172 0.828 0.000
#> GSM381271     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381275     2  0.4002      0.925 0.160 0.840 0.000
#> GSM381279     2  0.4235      0.921 0.176 0.824 0.000
#> GSM381195     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381196     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381198     2  0.1031      0.932 0.024 0.976 0.000
#> GSM381200     2  0.1031      0.932 0.024 0.976 0.000
#> GSM381201     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381203     3  0.0237      0.962 0.004 0.000 0.996
#> GSM381204     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381209     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381212     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381213     2  0.4178      0.922 0.172 0.828 0.000
#> GSM381214     2  0.0000      0.936 0.000 1.000 0.000
#> GSM381216     3  0.3686      0.797 0.140 0.000 0.860
#> GSM381225     3  0.0237      0.962 0.004 0.000 0.996
#> GSM381231     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381235     3  0.2448      0.891 0.076 0.000 0.924
#> GSM381237     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381241     2  0.1031      0.932 0.024 0.976 0.000
#> GSM381243     2  0.4178      0.922 0.172 0.828 0.000
#> GSM381245     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381246     2  0.0237      0.936 0.004 0.996 0.000
#> GSM381251     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381264     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381206     2  0.1031      0.932 0.024 0.976 0.000
#> GSM381217     3  0.3686      0.797 0.140 0.000 0.860
#> GSM381218     2  0.1031      0.932 0.024 0.976 0.000
#> GSM381226     2  0.0237      0.936 0.004 0.996 0.000
#> GSM381227     2  0.3941      0.925 0.156 0.844 0.000
#> GSM381228     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381236     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381244     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381272     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381277     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381278     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381197     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381202     3  0.3686      0.797 0.140 0.000 0.860
#> GSM381207     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381208     2  0.3551      0.891 0.132 0.868 0.000
#> GSM381210     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381215     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381219     2  0.0000      0.936 0.000 1.000 0.000
#> GSM381221     2  0.2066      0.936 0.060 0.940 0.000
#> GSM381223     2  0.3879      0.926 0.152 0.848 0.000
#> GSM381229     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381230     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381233     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381234     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381238     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381239     3  0.2625      0.866 0.084 0.000 0.916
#> GSM381242     3  0.1031      0.947 0.024 0.000 0.976
#> GSM381247     2  0.4178      0.922 0.172 0.828 0.000
#> GSM381248     1  0.5431      0.994 0.716 0.000 0.284
#> GSM381249     1  0.5465      1.000 0.712 0.000 0.288
#> GSM381253     3  0.0237      0.962 0.004 0.000 0.996
#> GSM381255     2  0.3879      0.926 0.152 0.848 0.000
#> GSM381258     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381262     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381266     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381267     2  0.3551      0.891 0.132 0.868 0.000
#> GSM381269     3  0.3686      0.797 0.140 0.000 0.860
#> GSM381273     3  0.0000      0.964 0.000 0.000 1.000
#> GSM381274     2  0.4002      0.925 0.160 0.840 0.000
#> GSM381276     3  0.0892      0.950 0.020 0.000 0.980

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.6894    -0.1530 0.112 0.000 0.512 0.376
#> GSM381199     2  0.0000     0.8811 0.000 1.000 0.000 0.000
#> GSM381205     2  0.0707     0.8791 0.000 0.980 0.000 0.020
#> GSM381211     2  0.0469     0.8791 0.000 0.988 0.000 0.012
#> GSM381220     2  0.4356     0.8577 0.000 0.708 0.000 0.292
#> GSM381222     1  0.0000     0.9932 1.000 0.000 0.000 0.000
#> GSM381224     1  0.0336     0.9910 0.992 0.000 0.000 0.008
#> GSM381232     3  0.3219     0.2213 0.112 0.000 0.868 0.020
#> GSM381240     1  0.0188     0.9925 0.996 0.000 0.000 0.004
#> GSM381250     3  0.6843    -0.1816 0.112 0.000 0.532 0.356
#> GSM381252     2  0.0469     0.8811 0.000 0.988 0.000 0.012
#> GSM381254     1  0.0469     0.9900 0.988 0.000 0.000 0.012
#> GSM381256     2  0.1940     0.8813 0.000 0.924 0.000 0.076
#> GSM381257     3  0.7220    -0.3398 0.144 0.000 0.472 0.384
#> GSM381259     1  0.0188     0.9930 0.996 0.000 0.000 0.004
#> GSM381260     3  0.7098    -0.2615 0.132 0.000 0.492 0.376
#> GSM381261     2  0.4677     0.8513 0.000 0.680 0.004 0.316
#> GSM381263     3  0.6894    -0.1530 0.112 0.000 0.512 0.376
#> GSM381265     1  0.0188     0.9930 0.996 0.000 0.000 0.004
#> GSM381268     3  0.6843    -0.1816 0.112 0.000 0.532 0.356
#> GSM381270     2  0.4382     0.8566 0.000 0.704 0.000 0.296
#> GSM381271     3  0.3219     0.2213 0.112 0.000 0.868 0.020
#> GSM381275     2  0.4655     0.8527 0.000 0.684 0.004 0.312
#> GSM381279     2  0.4477     0.8520 0.000 0.688 0.000 0.312
#> GSM381195     1  0.0188     0.9930 0.996 0.000 0.000 0.004
#> GSM381196     3  0.6843    -0.1816 0.112 0.000 0.532 0.356
#> GSM381198     2  0.0707     0.8791 0.000 0.980 0.000 0.020
#> GSM381200     2  0.0469     0.8791 0.000 0.988 0.000 0.012
#> GSM381201     3  0.6403    -0.0573 0.112 0.000 0.628 0.260
#> GSM381203     3  0.6843    -0.1816 0.112 0.000 0.532 0.356
#> GSM381204     1  0.0188     0.9930 0.996 0.000 0.000 0.004
#> GSM381209     1  0.0188     0.9930 0.996 0.000 0.000 0.004
#> GSM381212     1  0.0000     0.9932 1.000 0.000 0.000 0.000
#> GSM381213     2  0.4382     0.8566 0.000 0.704 0.000 0.296
#> GSM381214     2  0.0000     0.8811 0.000 1.000 0.000 0.000
#> GSM381216     3  0.7534    -0.4157 0.188 0.000 0.432 0.380
#> GSM381225     3  0.6970    -0.6601 0.112 0.000 0.444 0.444
#> GSM381231     3  0.3219     0.2213 0.112 0.000 0.868 0.020
#> GSM381235     4  0.7458     0.6834 0.176 0.000 0.380 0.444
#> GSM381237     1  0.0000     0.9932 1.000 0.000 0.000 0.000
#> GSM381241     2  0.0469     0.8791 0.000 0.988 0.000 0.012
#> GSM381243     2  0.4382     0.8566 0.000 0.704 0.000 0.296
#> GSM381245     1  0.0707     0.9867 0.980 0.000 0.000 0.020
#> GSM381246     2  0.0592     0.8811 0.000 0.984 0.000 0.016
#> GSM381251     3  0.6476    -0.0880 0.112 0.000 0.616 0.272
#> GSM381264     1  0.0188     0.9930 0.996 0.000 0.000 0.004
#> GSM381206     2  0.0707     0.8791 0.000 0.980 0.000 0.020
#> GSM381217     3  0.7515    -0.4615 0.188 0.000 0.448 0.364
#> GSM381218     2  0.0469     0.8791 0.000 0.988 0.000 0.012
#> GSM381226     2  0.0592     0.8811 0.000 0.984 0.000 0.016
#> GSM381227     2  0.4331     0.8600 0.000 0.712 0.000 0.288
#> GSM381228     3  0.3523     0.2025 0.112 0.000 0.856 0.032
#> GSM381236     3  0.3793     0.1988 0.112 0.000 0.844 0.044
#> GSM381244     1  0.0707     0.9867 0.980 0.000 0.000 0.020
#> GSM381272     3  0.3219     0.2213 0.112 0.000 0.868 0.020
#> GSM381277     1  0.0707     0.9867 0.980 0.000 0.000 0.020
#> GSM381278     3  0.6764    -0.2127 0.112 0.000 0.556 0.332
#> GSM381197     3  0.6894    -0.1530 0.112 0.000 0.512 0.376
#> GSM381202     3  0.7534    -0.4157 0.188 0.000 0.432 0.380
#> GSM381207     1  0.0469     0.9900 0.988 0.000 0.000 0.012
#> GSM381208     2  0.6074     0.7374 0.000 0.668 0.104 0.228
#> GSM381210     1  0.0188     0.9930 0.996 0.000 0.000 0.004
#> GSM381215     3  0.6843    -0.1816 0.112 0.000 0.532 0.356
#> GSM381219     2  0.0000     0.8811 0.000 1.000 0.000 0.000
#> GSM381221     2  0.2081     0.8811 0.000 0.916 0.000 0.084
#> GSM381223     2  0.4483     0.8592 0.000 0.712 0.004 0.284
#> GSM381229     3  0.6764    -0.2185 0.112 0.000 0.556 0.332
#> GSM381230     1  0.0000     0.9932 1.000 0.000 0.000 0.000
#> GSM381233     1  0.0000     0.9932 1.000 0.000 0.000 0.000
#> GSM381234     1  0.0469     0.9900 0.988 0.000 0.000 0.012
#> GSM381238     3  0.3793     0.1988 0.112 0.000 0.844 0.044
#> GSM381239     3  0.4669     0.1390 0.168 0.000 0.780 0.052
#> GSM381242     3  0.7113    -0.3062 0.132 0.000 0.484 0.384
#> GSM381247     2  0.4382     0.8566 0.000 0.704 0.000 0.296
#> GSM381248     1  0.1004     0.9822 0.972 0.000 0.004 0.024
#> GSM381249     1  0.0188     0.9930 0.996 0.000 0.000 0.004
#> GSM381253     3  0.6843    -0.1816 0.112 0.000 0.532 0.356
#> GSM381255     2  0.4250     0.8615 0.000 0.724 0.000 0.276
#> GSM381258     3  0.6894    -0.1530 0.112 0.000 0.512 0.376
#> GSM381262     3  0.6843    -0.1816 0.112 0.000 0.532 0.356
#> GSM381266     3  0.6566    -0.1229 0.112 0.000 0.600 0.288
#> GSM381267     2  0.6074     0.7374 0.000 0.668 0.104 0.228
#> GSM381269     3  0.7534    -0.4157 0.188 0.000 0.432 0.380
#> GSM381273     3  0.6733    -0.1951 0.112 0.000 0.564 0.324
#> GSM381274     2  0.4655     0.8527 0.000 0.684 0.004 0.312
#> GSM381276     4  0.7153     0.6418 0.132 0.000 0.424 0.444

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.0703      0.762 0.000 0.000 0.976 0.024 0.000
#> GSM381199     2  0.3983      0.577 0.000 0.660 0.000 0.000 0.340
#> GSM381205     2  0.4074      0.552 0.000 0.636 0.000 0.000 0.364
#> GSM381211     2  0.4074      0.552 0.000 0.636 0.000 0.000 0.364
#> GSM381220     2  0.0609      0.548 0.000 0.980 0.000 0.000 0.020
#> GSM381222     1  0.0703      0.960 0.976 0.000 0.024 0.000 0.000
#> GSM381224     1  0.1997      0.951 0.932 0.000 0.024 0.016 0.028
#> GSM381232     4  0.4060      0.907 0.000 0.000 0.360 0.640 0.000
#> GSM381240     1  0.1597      0.956 0.948 0.000 0.024 0.008 0.020
#> GSM381250     3  0.1357      0.768 0.000 0.000 0.948 0.004 0.048
#> GSM381252     2  0.3999      0.577 0.000 0.656 0.000 0.000 0.344
#> GSM381254     1  0.1393      0.959 0.956 0.000 0.024 0.008 0.012
#> GSM381256     2  0.3561      0.582 0.000 0.740 0.000 0.000 0.260
#> GSM381257     3  0.3761      0.673 0.028 0.000 0.840 0.068 0.064
#> GSM381259     1  0.2060      0.954 0.928 0.000 0.024 0.012 0.036
#> GSM381260     3  0.1710      0.757 0.012 0.000 0.944 0.024 0.020
#> GSM381261     2  0.2095      0.509 0.024 0.928 0.000 0.028 0.020
#> GSM381263     3  0.0992      0.755 0.000 0.000 0.968 0.024 0.008
#> GSM381265     1  0.2060      0.954 0.928 0.000 0.024 0.012 0.036
#> GSM381268     3  0.1357      0.768 0.000 0.000 0.948 0.004 0.048
#> GSM381270     2  0.0324      0.536 0.000 0.992 0.000 0.004 0.004
#> GSM381271     4  0.4060      0.907 0.000 0.000 0.360 0.640 0.000
#> GSM381275     2  0.1997      0.514 0.024 0.932 0.000 0.028 0.016
#> GSM381279     2  0.1012      0.518 0.000 0.968 0.000 0.012 0.020
#> GSM381195     1  0.2060      0.954 0.928 0.000 0.024 0.012 0.036
#> GSM381196     3  0.1197      0.769 0.000 0.000 0.952 0.000 0.048
#> GSM381198     2  0.4074      0.552 0.000 0.636 0.000 0.000 0.364
#> GSM381200     2  0.4074      0.552 0.000 0.636 0.000 0.000 0.364
#> GSM381201     3  0.4083      0.617 0.000 0.000 0.788 0.132 0.080
#> GSM381203     3  0.1270      0.769 0.000 0.000 0.948 0.000 0.052
#> GSM381204     1  0.2060      0.954 0.928 0.000 0.024 0.012 0.036
#> GSM381209     1  0.2060      0.954 0.928 0.000 0.024 0.012 0.036
#> GSM381212     1  0.0865      0.960 0.972 0.000 0.024 0.000 0.004
#> GSM381213     2  0.0324      0.536 0.000 0.992 0.000 0.004 0.004
#> GSM381214     2  0.3999      0.573 0.000 0.656 0.000 0.000 0.344
#> GSM381216     3  0.2581      0.725 0.048 0.000 0.904 0.020 0.028
#> GSM381225     3  0.5460      0.552 0.004 0.000 0.640 0.092 0.264
#> GSM381231     4  0.4060      0.907 0.000 0.000 0.360 0.640 0.000
#> GSM381235     3  0.5465      0.601 0.020 0.000 0.680 0.084 0.216
#> GSM381237     1  0.0703      0.960 0.976 0.000 0.024 0.000 0.000
#> GSM381241     2  0.4074      0.552 0.000 0.636 0.000 0.000 0.364
#> GSM381243     2  0.0162      0.540 0.000 0.996 0.000 0.000 0.004
#> GSM381245     1  0.2535      0.940 0.908 0.000 0.028 0.032 0.032
#> GSM381246     2  0.4045      0.574 0.000 0.644 0.000 0.000 0.356
#> GSM381251     3  0.5329      0.536 0.000 0.000 0.672 0.144 0.184
#> GSM381264     1  0.2060      0.954 0.928 0.000 0.024 0.012 0.036
#> GSM381206     2  0.4074      0.552 0.000 0.636 0.000 0.000 0.364
#> GSM381217     3  0.2086      0.741 0.048 0.000 0.924 0.008 0.020
#> GSM381218     2  0.4074      0.552 0.000 0.636 0.000 0.000 0.364
#> GSM381226     2  0.4030      0.576 0.000 0.648 0.000 0.000 0.352
#> GSM381227     2  0.1043      0.552 0.000 0.960 0.000 0.000 0.040
#> GSM381228     4  0.4624      0.896 0.000 0.000 0.340 0.636 0.024
#> GSM381236     4  0.4925      0.894 0.000 0.000 0.324 0.632 0.044
#> GSM381244     1  0.3054      0.924 0.880 0.000 0.028 0.032 0.060
#> GSM381272     4  0.4060      0.907 0.000 0.000 0.360 0.640 0.000
#> GSM381277     1  0.3054      0.924 0.880 0.000 0.028 0.032 0.060
#> GSM381278     3  0.6319      0.361 0.000 0.000 0.524 0.204 0.272
#> GSM381197     3  0.1281      0.754 0.000 0.000 0.956 0.032 0.012
#> GSM381202     3  0.2581      0.725 0.048 0.000 0.904 0.020 0.028
#> GSM381207     1  0.2450      0.946 0.912 0.000 0.028 0.028 0.032
#> GSM381208     5  0.6480      1.000 0.000 0.400 0.000 0.184 0.416
#> GSM381210     1  0.2060      0.954 0.928 0.000 0.024 0.012 0.036
#> GSM381215     3  0.1197      0.769 0.000 0.000 0.952 0.000 0.048
#> GSM381219     2  0.3983      0.577 0.000 0.660 0.000 0.000 0.340
#> GSM381221     2  0.3661      0.583 0.000 0.724 0.000 0.000 0.276
#> GSM381223     2  0.2355      0.532 0.024 0.916 0.000 0.024 0.036
#> GSM381229     3  0.6135      0.412 0.000 0.000 0.560 0.192 0.248
#> GSM381230     1  0.0703      0.960 0.976 0.000 0.024 0.000 0.000
#> GSM381233     1  0.1026      0.959 0.968 0.000 0.024 0.004 0.004
#> GSM381234     1  0.1904      0.952 0.936 0.000 0.028 0.020 0.016
#> GSM381238     4  0.4925      0.894 0.000 0.000 0.324 0.632 0.044
#> GSM381239     4  0.5768      0.809 0.052 0.000 0.264 0.640 0.044
#> GSM381242     3  0.2152      0.750 0.012 0.000 0.924 0.032 0.032
#> GSM381247     2  0.0324      0.536 0.000 0.992 0.000 0.004 0.004
#> GSM381248     1  0.4123      0.878 0.816 0.000 0.028 0.072 0.084
#> GSM381249     1  0.2060      0.954 0.928 0.000 0.024 0.012 0.036
#> GSM381253     3  0.1557      0.769 0.000 0.000 0.940 0.008 0.052
#> GSM381255     2  0.1270      0.556 0.000 0.948 0.000 0.000 0.052
#> GSM381258     3  0.1082      0.754 0.000 0.000 0.964 0.028 0.008
#> GSM381262     3  0.1484      0.768 0.000 0.000 0.944 0.008 0.048
#> GSM381266     3  0.5921      0.434 0.000 0.000 0.596 0.184 0.220
#> GSM381267     5  0.6480      1.000 0.000 0.400 0.000 0.184 0.416
#> GSM381269     3  0.2998      0.710 0.052 0.000 0.884 0.028 0.036
#> GSM381273     3  0.6236      0.380 0.000 0.000 0.544 0.208 0.248
#> GSM381274     2  0.1997      0.514 0.024 0.932 0.000 0.028 0.016
#> GSM381276     3  0.5726      0.553 0.016 0.000 0.632 0.088 0.264

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     6  0.6680     0.4367 0.032 0.000 0.308 0.280 0.000 0.380
#> GSM381199     2  0.1621     0.7862 0.000 0.944 0.012 0.016 0.020 0.008
#> GSM381205     2  0.1059     0.7975 0.000 0.964 0.000 0.016 0.004 0.016
#> GSM381211     2  0.0603     0.7973 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM381220     5  0.3971     0.8462 0.000 0.448 0.000 0.004 0.548 0.000
#> GSM381222     1  0.0000     0.9385 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381224     1  0.1718     0.9267 0.932 0.000 0.016 0.000 0.044 0.008
#> GSM381232     4  0.1642     0.8004 0.032 0.000 0.004 0.936 0.000 0.028
#> GSM381240     1  0.1707     0.9259 0.928 0.000 0.004 0.000 0.056 0.012
#> GSM381250     3  0.6627    -0.0634 0.032 0.000 0.408 0.260 0.000 0.300
#> GSM381252     2  0.1957     0.7827 0.000 0.928 0.012 0.024 0.028 0.008
#> GSM381254     1  0.2001     0.9305 0.920 0.000 0.000 0.020 0.044 0.016
#> GSM381256     2  0.3294     0.5658 0.000 0.820 0.012 0.012 0.148 0.008
#> GSM381257     6  0.7304     0.3978 0.044 0.000 0.228 0.196 0.056 0.476
#> GSM381259     1  0.1693     0.9300 0.932 0.000 0.004 0.000 0.044 0.020
#> GSM381260     6  0.6883     0.5841 0.048 0.000 0.268 0.256 0.004 0.424
#> GSM381261     5  0.6174     0.7733 0.000 0.404 0.132 0.000 0.432 0.032
#> GSM381263     6  0.6597     0.5509 0.032 0.000 0.264 0.280 0.000 0.424
#> GSM381265     1  0.1693     0.9300 0.932 0.000 0.004 0.000 0.044 0.020
#> GSM381268     3  0.6627    -0.0634 0.032 0.000 0.408 0.260 0.000 0.300
#> GSM381270     5  0.3804     0.8684 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM381271     4  0.1699     0.8087 0.032 0.000 0.016 0.936 0.000 0.016
#> GSM381275     5  0.6231     0.7672 0.000 0.408 0.132 0.000 0.424 0.036
#> GSM381279     5  0.3737     0.8605 0.000 0.392 0.000 0.000 0.608 0.000
#> GSM381195     1  0.1693     0.9300 0.932 0.000 0.004 0.000 0.044 0.020
#> GSM381196     3  0.6627    -0.0634 0.032 0.000 0.408 0.260 0.000 0.300
#> GSM381198     2  0.0964     0.7981 0.000 0.968 0.000 0.012 0.004 0.016
#> GSM381200     2  0.0603     0.7973 0.000 0.980 0.000 0.004 0.000 0.016
#> GSM381201     4  0.7122    -0.4952 0.032 0.000 0.344 0.380 0.028 0.216
#> GSM381203     3  0.6627    -0.0634 0.032 0.000 0.408 0.260 0.000 0.300
#> GSM381204     1  0.1296     0.9334 0.952 0.000 0.004 0.000 0.032 0.012
#> GSM381209     1  0.1296     0.9334 0.952 0.000 0.004 0.000 0.032 0.012
#> GSM381212     1  0.0000     0.9385 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     5  0.3804     0.8684 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM381214     2  0.0951     0.7966 0.000 0.968 0.000 0.004 0.020 0.008
#> GSM381216     6  0.6978     0.5907 0.080 0.000 0.252 0.232 0.000 0.436
#> GSM381225     3  0.3922     0.4292 0.036 0.000 0.792 0.144 0.016 0.012
#> GSM381231     4  0.1699     0.8087 0.032 0.000 0.016 0.936 0.000 0.016
#> GSM381235     3  0.5201     0.3643 0.072 0.000 0.724 0.108 0.016 0.080
#> GSM381237     1  0.0000     0.9385 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0717     0.7981 0.000 0.976 0.000 0.008 0.000 0.016
#> GSM381243     5  0.3937     0.8683 0.000 0.424 0.000 0.004 0.572 0.000
#> GSM381245     1  0.2900     0.9033 0.876 0.000 0.020 0.024 0.068 0.012
#> GSM381246     2  0.2452     0.7544 0.000 0.900 0.008 0.020 0.056 0.016
#> GSM381251     3  0.6518     0.3821 0.032 0.000 0.488 0.344 0.028 0.108
#> GSM381264     1  0.1693     0.9300 0.932 0.000 0.004 0.000 0.044 0.020
#> GSM381206     2  0.1059     0.7975 0.000 0.964 0.000 0.016 0.004 0.016
#> GSM381217     6  0.7076     0.5097 0.084 0.000 0.304 0.216 0.000 0.396
#> GSM381218     2  0.0717     0.7981 0.000 0.976 0.000 0.008 0.000 0.016
#> GSM381226     2  0.2635     0.7516 0.000 0.892 0.012 0.024 0.056 0.016
#> GSM381227     5  0.4308     0.8343 0.000 0.452 0.008 0.008 0.532 0.000
#> GSM381228     4  0.3007     0.7890 0.032 0.000 0.080 0.864 0.020 0.004
#> GSM381236     4  0.2917     0.7942 0.032 0.000 0.048 0.876 0.040 0.004
#> GSM381244     1  0.3277     0.8900 0.852 0.000 0.024 0.028 0.084 0.012
#> GSM381272     4  0.1699     0.8087 0.032 0.000 0.016 0.936 0.000 0.016
#> GSM381277     1  0.3277     0.8900 0.852 0.000 0.024 0.028 0.084 0.012
#> GSM381278     3  0.4475     0.3346 0.032 0.000 0.692 0.252 0.024 0.000
#> GSM381197     6  0.6994     0.5174 0.032 0.000 0.268 0.284 0.016 0.400
#> GSM381202     6  0.6978     0.5907 0.080 0.000 0.252 0.232 0.000 0.436
#> GSM381207     1  0.2753     0.9069 0.876 0.000 0.004 0.028 0.080 0.012
#> GSM381208     2  0.6049     0.0761 0.000 0.416 0.012 0.000 0.168 0.404
#> GSM381210     1  0.1053     0.9359 0.964 0.000 0.004 0.000 0.020 0.012
#> GSM381215     3  0.6627    -0.0634 0.032 0.000 0.408 0.260 0.000 0.300
#> GSM381219     2  0.1425     0.7874 0.000 0.952 0.008 0.012 0.020 0.008
#> GSM381221     2  0.2964     0.6468 0.000 0.852 0.012 0.012 0.116 0.008
#> GSM381223     2  0.6333    -0.7685 0.000 0.424 0.140 0.000 0.396 0.040
#> GSM381229     3  0.4907     0.3622 0.032 0.000 0.672 0.256 0.028 0.012
#> GSM381230     1  0.0603     0.9384 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM381233     1  0.0146     0.9384 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM381234     1  0.2196     0.9245 0.908 0.000 0.000 0.020 0.056 0.016
#> GSM381238     4  0.2917     0.7942 0.032 0.000 0.048 0.876 0.040 0.004
#> GSM381239     4  0.3548     0.7469 0.072 0.000 0.048 0.836 0.040 0.004
#> GSM381242     6  0.7106     0.5777 0.052 0.000 0.276 0.248 0.012 0.412
#> GSM381247     5  0.3804     0.8684 0.000 0.424 0.000 0.000 0.576 0.000
#> GSM381248     1  0.5303     0.7807 0.712 0.000 0.040 0.028 0.136 0.084
#> GSM381249     1  0.1296     0.9334 0.952 0.000 0.004 0.000 0.032 0.012
#> GSM381253     3  0.6672    -0.0808 0.036 0.000 0.408 0.256 0.000 0.300
#> GSM381255     5  0.4320     0.8137 0.000 0.468 0.008 0.008 0.516 0.000
#> GSM381258     6  0.6586     0.5545 0.032 0.000 0.260 0.280 0.000 0.428
#> GSM381262     3  0.6627    -0.0634 0.032 0.000 0.408 0.260 0.000 0.300
#> GSM381266     3  0.5899     0.3649 0.032 0.000 0.568 0.316 0.028 0.056
#> GSM381267     6  0.5903    -0.5126 0.000 0.416 0.008 0.000 0.156 0.420
#> GSM381269     6  0.7144     0.5679 0.080 0.000 0.248 0.220 0.008 0.444
#> GSM381273     3  0.5229     0.3284 0.032 0.000 0.640 0.276 0.036 0.016
#> GSM381274     5  0.6175     0.7712 0.000 0.408 0.132 0.000 0.428 0.032
#> GSM381276     3  0.5342     0.3869 0.060 0.000 0.716 0.128 0.064 0.032

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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 other(p) k
#> ATC:kmeans 86    0.744 2
#> ATC:kmeans 86    0.889 3
#> ATC:kmeans 53    0.893 4
#> ATC:kmeans 82    0.374 5
#> ATC:kmeans 65    0.555 6

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


ATC:skmeans*

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4528 0.548   0.548
#> 3 3 1.000           0.991       0.996         0.4672 0.789   0.615
#> 4 4 1.000           0.977       0.983         0.0919 0.941   0.825
#> 5 5 0.943           0.937       0.939         0.0465 0.962   0.862
#> 6 6 0.849           0.856       0.894         0.0395 0.985   0.938

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette p1 p2
#> GSM381194     1       0          1  1  0
#> GSM381199     2       0          1  0  1
#> GSM381205     2       0          1  0  1
#> GSM381211     2       0          1  0  1
#> GSM381220     2       0          1  0  1
#> GSM381222     1       0          1  1  0
#> GSM381224     1       0          1  1  0
#> GSM381232     1       0          1  1  0
#> GSM381240     1       0          1  1  0
#> GSM381250     1       0          1  1  0
#> GSM381252     2       0          1  0  1
#> GSM381254     1       0          1  1  0
#> GSM381256     2       0          1  0  1
#> GSM381257     1       0          1  1  0
#> GSM381259     1       0          1  1  0
#> GSM381260     1       0          1  1  0
#> GSM381261     2       0          1  0  1
#> GSM381263     1       0          1  1  0
#> GSM381265     1       0          1  1  0
#> GSM381268     1       0          1  1  0
#> GSM381270     2       0          1  0  1
#> GSM381271     1       0          1  1  0
#> GSM381275     2       0          1  0  1
#> GSM381279     2       0          1  0  1
#> GSM381195     1       0          1  1  0
#> GSM381196     1       0          1  1  0
#> GSM381198     2       0          1  0  1
#> GSM381200     2       0          1  0  1
#> GSM381201     1       0          1  1  0
#> GSM381203     1       0          1  1  0
#> GSM381204     1       0          1  1  0
#> GSM381209     1       0          1  1  0
#> GSM381212     1       0          1  1  0
#> GSM381213     2       0          1  0  1
#> GSM381214     2       0          1  0  1
#> GSM381216     1       0          1  1  0
#> GSM381225     1       0          1  1  0
#> GSM381231     1       0          1  1  0
#> GSM381235     1       0          1  1  0
#> GSM381237     1       0          1  1  0
#> GSM381241     2       0          1  0  1
#> GSM381243     2       0          1  0  1
#> GSM381245     1       0          1  1  0
#> GSM381246     2       0          1  0  1
#> GSM381251     1       0          1  1  0
#> GSM381264     1       0          1  1  0
#> GSM381206     2       0          1  0  1
#> GSM381217     1       0          1  1  0
#> GSM381218     2       0          1  0  1
#> GSM381226     2       0          1  0  1
#> GSM381227     2       0          1  0  1
#> GSM381228     1       0          1  1  0
#> GSM381236     1       0          1  1  0
#> GSM381244     1       0          1  1  0
#> GSM381272     1       0          1  1  0
#> GSM381277     1       0          1  1  0
#> GSM381278     1       0          1  1  0
#> GSM381197     1       0          1  1  0
#> GSM381202     1       0          1  1  0
#> GSM381207     1       0          1  1  0
#> GSM381208     2       0          1  0  1
#> GSM381210     1       0          1  1  0
#> GSM381215     1       0          1  1  0
#> GSM381219     2       0          1  0  1
#> GSM381221     2       0          1  0  1
#> GSM381223     2       0          1  0  1
#> GSM381229     1       0          1  1  0
#> GSM381230     1       0          1  1  0
#> GSM381233     1       0          1  1  0
#> GSM381234     1       0          1  1  0
#> GSM381238     1       0          1  1  0
#> GSM381239     1       0          1  1  0
#> GSM381242     1       0          1  1  0
#> GSM381247     2       0          1  0  1
#> GSM381248     1       0          1  1  0
#> GSM381249     1       0          1  1  0
#> GSM381253     1       0          1  1  0
#> GSM381255     2       0          1  0  1
#> GSM381258     1       0          1  1  0
#> GSM381262     1       0          1  1  0
#> GSM381266     1       0          1  1  0
#> GSM381267     2       0          1  0  1
#> GSM381269     1       0          1  1  0
#> GSM381273     1       0          1  1  0
#> GSM381274     2       0          1  0  1
#> GSM381276     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1 p2    p3
#> GSM381194     3  0.0000      0.990 0.000  0 1.000
#> GSM381199     2  0.0000      1.000 0.000  1 0.000
#> GSM381205     2  0.0000      1.000 0.000  1 0.000
#> GSM381211     2  0.0000      1.000 0.000  1 0.000
#> GSM381220     2  0.0000      1.000 0.000  1 0.000
#> GSM381222     1  0.0000      1.000 1.000  0 0.000
#> GSM381224     1  0.0000      1.000 1.000  0 0.000
#> GSM381232     3  0.0000      0.990 0.000  0 1.000
#> GSM381240     1  0.0000      1.000 1.000  0 0.000
#> GSM381250     3  0.0000      0.990 0.000  0 1.000
#> GSM381252     2  0.0000      1.000 0.000  1 0.000
#> GSM381254     1  0.0000      1.000 1.000  0 0.000
#> GSM381256     2  0.0000      1.000 0.000  1 0.000
#> GSM381257     3  0.0000      0.990 0.000  0 1.000
#> GSM381259     1  0.0000      1.000 1.000  0 0.000
#> GSM381260     3  0.0000      0.990 0.000  0 1.000
#> GSM381261     2  0.0000      1.000 0.000  1 0.000
#> GSM381263     3  0.0000      0.990 0.000  0 1.000
#> GSM381265     1  0.0000      1.000 1.000  0 0.000
#> GSM381268     3  0.0000      0.990 0.000  0 1.000
#> GSM381270     2  0.0000      1.000 0.000  1 0.000
#> GSM381271     3  0.0000      0.990 0.000  0 1.000
#> GSM381275     2  0.0000      1.000 0.000  1 0.000
#> GSM381279     2  0.0000      1.000 0.000  1 0.000
#> GSM381195     1  0.0000      1.000 1.000  0 0.000
#> GSM381196     3  0.0000      0.990 0.000  0 1.000
#> GSM381198     2  0.0000      1.000 0.000  1 0.000
#> GSM381200     2  0.0000      1.000 0.000  1 0.000
#> GSM381201     3  0.0000      0.990 0.000  0 1.000
#> GSM381203     3  0.0000      0.990 0.000  0 1.000
#> GSM381204     1  0.0000      1.000 1.000  0 0.000
#> GSM381209     1  0.0000      1.000 1.000  0 0.000
#> GSM381212     1  0.0000      1.000 1.000  0 0.000
#> GSM381213     2  0.0000      1.000 0.000  1 0.000
#> GSM381214     2  0.0000      1.000 0.000  1 0.000
#> GSM381216     3  0.0000      0.990 0.000  0 1.000
#> GSM381225     3  0.0000      0.990 0.000  0 1.000
#> GSM381231     3  0.0000      0.990 0.000  0 1.000
#> GSM381235     3  0.0592      0.979 0.012  0 0.988
#> GSM381237     1  0.0000      1.000 1.000  0 0.000
#> GSM381241     2  0.0000      1.000 0.000  1 0.000
#> GSM381243     2  0.0000      1.000 0.000  1 0.000
#> GSM381245     1  0.0000      1.000 1.000  0 0.000
#> GSM381246     2  0.0000      1.000 0.000  1 0.000
#> GSM381251     3  0.0000      0.990 0.000  0 1.000
#> GSM381264     1  0.0000      1.000 1.000  0 0.000
#> GSM381206     2  0.0000      1.000 0.000  1 0.000
#> GSM381217     3  0.0000      0.990 0.000  0 1.000
#> GSM381218     2  0.0000      1.000 0.000  1 0.000
#> GSM381226     2  0.0000      1.000 0.000  1 0.000
#> GSM381227     2  0.0000      1.000 0.000  1 0.000
#> GSM381228     3  0.0000      0.990 0.000  0 1.000
#> GSM381236     3  0.0000      0.990 0.000  0 1.000
#> GSM381244     1  0.0000      1.000 1.000  0 0.000
#> GSM381272     3  0.0000      0.990 0.000  0 1.000
#> GSM381277     1  0.0000      1.000 1.000  0 0.000
#> GSM381278     3  0.0000      0.990 0.000  0 1.000
#> GSM381197     3  0.0000      0.990 0.000  0 1.000
#> GSM381202     3  0.0000      0.990 0.000  0 1.000
#> GSM381207     1  0.0000      1.000 1.000  0 0.000
#> GSM381208     2  0.0000      1.000 0.000  1 0.000
#> GSM381210     1  0.0000      1.000 1.000  0 0.000
#> GSM381215     3  0.0000      0.990 0.000  0 1.000
#> GSM381219     2  0.0000      1.000 0.000  1 0.000
#> GSM381221     2  0.0000      1.000 0.000  1 0.000
#> GSM381223     2  0.0000      1.000 0.000  1 0.000
#> GSM381229     3  0.0000      0.990 0.000  0 1.000
#> GSM381230     1  0.0000      1.000 1.000  0 0.000
#> GSM381233     1  0.0000      1.000 1.000  0 0.000
#> GSM381234     1  0.0000      1.000 1.000  0 0.000
#> GSM381238     3  0.0000      0.990 0.000  0 1.000
#> GSM381239     3  0.5706      0.530 0.320  0 0.680
#> GSM381242     3  0.0000      0.990 0.000  0 1.000
#> GSM381247     2  0.0000      1.000 0.000  1 0.000
#> GSM381248     1  0.0000      1.000 1.000  0 0.000
#> GSM381249     1  0.0000      1.000 1.000  0 0.000
#> GSM381253     3  0.0000      0.990 0.000  0 1.000
#> GSM381255     2  0.0000      1.000 0.000  1 0.000
#> GSM381258     3  0.0000      0.990 0.000  0 1.000
#> GSM381262     3  0.0000      0.990 0.000  0 1.000
#> GSM381266     3  0.0000      0.990 0.000  0 1.000
#> GSM381267     2  0.0000      1.000 0.000  1 0.000
#> GSM381269     3  0.0000      0.990 0.000  0 1.000
#> GSM381273     3  0.0000      0.990 0.000  0 1.000
#> GSM381274     2  0.0000      1.000 0.000  1 0.000
#> GSM381276     3  0.0000      0.990 0.000  0 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1 p2    p3    p4
#> GSM381194     3  0.0000      0.958 0.000  0 1.000 0.000
#> GSM381199     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381205     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381211     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381220     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381222     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381224     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381232     4  0.1211      0.992 0.000  0 0.040 0.960
#> GSM381240     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381250     3  0.0188      0.958 0.000  0 0.996 0.004
#> GSM381252     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381254     1  0.0188      0.996 0.996  0 0.000 0.004
#> GSM381256     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381257     3  0.0188      0.958 0.000  0 0.996 0.004
#> GSM381259     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381260     3  0.0336      0.955 0.000  0 0.992 0.008
#> GSM381261     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381263     3  0.0000      0.958 0.000  0 1.000 0.000
#> GSM381265     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381268     3  0.0469      0.956 0.000  0 0.988 0.012
#> GSM381270     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381271     4  0.1118      0.994 0.000  0 0.036 0.964
#> GSM381275     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381279     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381195     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381196     3  0.0000      0.958 0.000  0 1.000 0.000
#> GSM381198     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381200     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381201     3  0.0707      0.953 0.000  0 0.980 0.020
#> GSM381203     3  0.0336      0.957 0.000  0 0.992 0.008
#> GSM381204     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381209     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381212     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381213     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381214     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381216     3  0.0000      0.958 0.000  0 1.000 0.000
#> GSM381225     3  0.2216      0.915 0.000  0 0.908 0.092
#> GSM381231     4  0.1118      0.994 0.000  0 0.036 0.964
#> GSM381235     3  0.1022      0.944 0.000  0 0.968 0.032
#> GSM381237     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381241     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381243     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381245     1  0.0336      0.994 0.992  0 0.000 0.008
#> GSM381246     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381251     3  0.0817      0.951 0.000  0 0.976 0.024
#> GSM381264     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381206     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381217     3  0.0336      0.954 0.008  0 0.992 0.000
#> GSM381218     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381226     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381227     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381228     4  0.1118      0.994 0.000  0 0.036 0.964
#> GSM381236     4  0.0921      0.992 0.000  0 0.028 0.972
#> GSM381244     1  0.0469      0.992 0.988  0 0.000 0.012
#> GSM381272     4  0.1118      0.994 0.000  0 0.036 0.964
#> GSM381277     1  0.0469      0.992 0.988  0 0.000 0.012
#> GSM381278     3  0.3907      0.775 0.000  0 0.768 0.232
#> GSM381197     3  0.0000      0.958 0.000  0 1.000 0.000
#> GSM381202     3  0.0000      0.958 0.000  0 1.000 0.000
#> GSM381207     1  0.0336      0.994 0.992  0 0.000 0.008
#> GSM381208     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381210     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381215     3  0.0336      0.957 0.000  0 0.992 0.008
#> GSM381219     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381221     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381223     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381229     3  0.2814      0.881 0.000  0 0.868 0.132
#> GSM381230     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381233     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381234     1  0.0188      0.996 0.996  0 0.000 0.004
#> GSM381238     4  0.0921      0.992 0.000  0 0.028 0.972
#> GSM381239     4  0.1042      0.984 0.008  0 0.020 0.972
#> GSM381242     3  0.0188      0.957 0.000  0 0.996 0.004
#> GSM381247     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381248     1  0.0336      0.994 0.992  0 0.000 0.008
#> GSM381249     1  0.0000      0.998 1.000  0 0.000 0.000
#> GSM381253     3  0.0336      0.957 0.000  0 0.992 0.008
#> GSM381255     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381258     3  0.0000      0.958 0.000  0 1.000 0.000
#> GSM381262     3  0.0336      0.957 0.000  0 0.992 0.008
#> GSM381266     3  0.3219      0.836 0.000  0 0.836 0.164
#> GSM381267     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381269     3  0.0336      0.954 0.008  0 0.992 0.000
#> GSM381273     3  0.3610      0.812 0.000  0 0.800 0.200
#> GSM381274     2  0.0000      1.000 0.000  1 0.000 0.000
#> GSM381276     3  0.3444      0.833 0.000  0 0.816 0.184

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.0609      0.888 0.000 0.000 0.980 0.000 0.020
#> GSM381199     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381205     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381220     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381222     1  0.0162      0.990 0.996 0.000 0.000 0.000 0.004
#> GSM381224     1  0.0162      0.990 0.996 0.000 0.000 0.000 0.004
#> GSM381232     4  0.0290      0.995 0.000 0.000 0.008 0.992 0.000
#> GSM381240     1  0.0609      0.984 0.980 0.000 0.000 0.000 0.020
#> GSM381250     3  0.2516      0.856 0.000 0.000 0.860 0.000 0.140
#> GSM381252     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381254     1  0.0162      0.990 0.996 0.000 0.000 0.000 0.004
#> GSM381256     2  0.0794      0.960 0.000 0.972 0.000 0.000 0.028
#> GSM381257     3  0.0865      0.886 0.004 0.000 0.972 0.000 0.024
#> GSM381259     1  0.0290      0.990 0.992 0.000 0.000 0.000 0.008
#> GSM381260     3  0.0162      0.883 0.000 0.000 0.996 0.000 0.004
#> GSM381261     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381263     3  0.0162      0.886 0.000 0.000 0.996 0.000 0.004
#> GSM381265     1  0.0290      0.990 0.992 0.000 0.000 0.000 0.008
#> GSM381268     3  0.2690      0.841 0.000 0.000 0.844 0.000 0.156
#> GSM381270     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381271     4  0.0290      0.995 0.000 0.000 0.008 0.992 0.000
#> GSM381275     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381279     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381195     1  0.0290      0.990 0.992 0.000 0.000 0.000 0.008
#> GSM381196     3  0.2329      0.863 0.000 0.000 0.876 0.000 0.124
#> GSM381198     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381200     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381201     3  0.2890      0.834 0.000 0.000 0.836 0.004 0.160
#> GSM381203     3  0.2516      0.856 0.000 0.000 0.860 0.000 0.140
#> GSM381204     1  0.0290      0.990 0.992 0.000 0.000 0.000 0.008
#> GSM381209     1  0.0290      0.990 0.992 0.000 0.000 0.000 0.008
#> GSM381212     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381214     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381216     3  0.0290      0.880 0.000 0.000 0.992 0.000 0.008
#> GSM381225     5  0.3814      0.903 0.000 0.000 0.276 0.004 0.720
#> GSM381231     4  0.0290      0.995 0.000 0.000 0.008 0.992 0.000
#> GSM381235     5  0.3990      0.884 0.004 0.000 0.308 0.000 0.688
#> GSM381237     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381243     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381245     1  0.0609      0.984 0.980 0.000 0.000 0.000 0.020
#> GSM381246     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381251     3  0.3123      0.798 0.000 0.000 0.812 0.004 0.184
#> GSM381264     1  0.0290      0.990 0.992 0.000 0.000 0.000 0.008
#> GSM381206     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381217     3  0.0609      0.886 0.000 0.000 0.980 0.000 0.020
#> GSM381218     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381226     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381227     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381228     4  0.0324      0.994 0.000 0.000 0.004 0.992 0.004
#> GSM381236     4  0.0162      0.993 0.000 0.000 0.000 0.996 0.004
#> GSM381244     1  0.1243      0.972 0.960 0.000 0.008 0.004 0.028
#> GSM381272     4  0.0290      0.995 0.000 0.000 0.008 0.992 0.000
#> GSM381277     1  0.0865      0.980 0.972 0.000 0.000 0.004 0.024
#> GSM381278     5  0.4795      0.900 0.000 0.000 0.224 0.072 0.704
#> GSM381197     3  0.0703      0.889 0.000 0.000 0.976 0.000 0.024
#> GSM381202     3  0.0290      0.880 0.000 0.000 0.992 0.000 0.008
#> GSM381207     1  0.0771      0.982 0.976 0.000 0.000 0.004 0.020
#> GSM381208     2  0.3300      0.781 0.000 0.792 0.000 0.004 0.204
#> GSM381210     1  0.0290      0.990 0.992 0.000 0.000 0.000 0.008
#> GSM381215     3  0.2516      0.856 0.000 0.000 0.860 0.000 0.140
#> GSM381219     2  0.0000      0.960 0.000 1.000 0.000 0.000 0.000
#> GSM381221     2  0.0963      0.960 0.000 0.964 0.000 0.000 0.036
#> GSM381223     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381229     5  0.4615      0.917 0.000 0.000 0.252 0.048 0.700
#> GSM381230     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM381234     1  0.0404      0.987 0.988 0.000 0.000 0.000 0.012
#> GSM381238     4  0.0162      0.993 0.000 0.000 0.000 0.996 0.004
#> GSM381239     4  0.0162      0.993 0.000 0.000 0.000 0.996 0.004
#> GSM381242     3  0.0162      0.883 0.000 0.000 0.996 0.000 0.004
#> GSM381247     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381248     1  0.0771      0.982 0.976 0.000 0.000 0.004 0.020
#> GSM381249     1  0.0290      0.990 0.992 0.000 0.000 0.000 0.008
#> GSM381253     3  0.2516      0.856 0.000 0.000 0.860 0.000 0.140
#> GSM381255     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381258     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> GSM381262     3  0.2852      0.821 0.000 0.000 0.828 0.000 0.172
#> GSM381266     5  0.5341      0.739 0.000 0.000 0.376 0.060 0.564
#> GSM381267     2  0.3300      0.781 0.000 0.792 0.000 0.004 0.204
#> GSM381269     3  0.0290      0.880 0.000 0.000 0.992 0.000 0.008
#> GSM381273     5  0.4788      0.912 0.000 0.000 0.240 0.064 0.696
#> GSM381274     2  0.1478      0.957 0.000 0.936 0.000 0.000 0.064
#> GSM381276     5  0.4479      0.901 0.000 0.000 0.264 0.036 0.700

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM381194     3  0.2190      0.825 0.000 0.000 0.900 0.000 0.040 0.060
#> GSM381199     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381205     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381220     2  0.2854      0.800 0.000 0.792 0.000 0.000 0.208 0.000
#> GSM381222     1  0.0713      0.935 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM381224     1  0.1408      0.929 0.944 0.000 0.000 0.000 0.036 0.020
#> GSM381232     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381240     1  0.2605      0.900 0.864 0.000 0.000 0.000 0.108 0.028
#> GSM381250     3  0.3221      0.789 0.000 0.000 0.792 0.000 0.020 0.188
#> GSM381252     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381254     1  0.1643      0.921 0.924 0.000 0.000 0.000 0.068 0.008
#> GSM381256     2  0.1501      0.814 0.000 0.924 0.000 0.000 0.076 0.000
#> GSM381257     3  0.1418      0.824 0.000 0.000 0.944 0.000 0.024 0.032
#> GSM381259     1  0.1124      0.931 0.956 0.000 0.000 0.000 0.036 0.008
#> GSM381260     3  0.2474      0.775 0.000 0.000 0.880 0.000 0.080 0.040
#> GSM381261     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381263     3  0.1124      0.823 0.000 0.000 0.956 0.000 0.036 0.008
#> GSM381265     1  0.1049      0.932 0.960 0.000 0.000 0.000 0.032 0.008
#> GSM381268     3  0.3368      0.759 0.000 0.000 0.756 0.000 0.012 0.232
#> GSM381270     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381271     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381275     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381279     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381195     1  0.1049      0.932 0.960 0.000 0.000 0.000 0.032 0.008
#> GSM381196     3  0.3017      0.799 0.000 0.000 0.816 0.000 0.020 0.164
#> GSM381198     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381200     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381201     3  0.3533      0.751 0.000 0.000 0.748 0.004 0.012 0.236
#> GSM381203     3  0.3189      0.791 0.000 0.000 0.796 0.000 0.020 0.184
#> GSM381204     1  0.1049      0.931 0.960 0.000 0.000 0.000 0.032 0.008
#> GSM381209     1  0.1049      0.931 0.960 0.000 0.000 0.000 0.032 0.008
#> GSM381212     1  0.0363      0.935 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM381213     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381214     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381216     3  0.1780      0.805 0.000 0.000 0.924 0.000 0.048 0.028
#> GSM381225     6  0.2255      0.902 0.000 0.000 0.088 0.004 0.016 0.892
#> GSM381231     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381235     6  0.2624      0.880 0.000 0.000 0.124 0.000 0.020 0.856
#> GSM381237     1  0.0146      0.935 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM381241     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381243     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381245     1  0.2752      0.895 0.856 0.000 0.000 0.000 0.108 0.036
#> GSM381246     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381251     3  0.3724      0.713 0.000 0.000 0.716 0.004 0.012 0.268
#> GSM381264     1  0.1049      0.932 0.960 0.000 0.000 0.000 0.032 0.008
#> GSM381206     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381217     3  0.1498      0.819 0.000 0.000 0.940 0.000 0.032 0.028
#> GSM381218     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381226     2  0.0146      0.810 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM381227     2  0.2941      0.797 0.000 0.780 0.000 0.000 0.220 0.000
#> GSM381228     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381236     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381244     1  0.4241      0.816 0.756 0.000 0.016 0.000 0.152 0.076
#> GSM381272     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381277     1  0.3587      0.850 0.792 0.000 0.000 0.000 0.140 0.068
#> GSM381278     6  0.2362      0.899 0.000 0.000 0.080 0.016 0.012 0.892
#> GSM381197     3  0.1418      0.828 0.000 0.000 0.944 0.000 0.024 0.032
#> GSM381202     3  0.1856      0.802 0.000 0.000 0.920 0.000 0.048 0.032
#> GSM381207     1  0.2605      0.900 0.864 0.000 0.000 0.000 0.108 0.028
#> GSM381208     5  0.4520      1.000 0.000 0.448 0.000 0.000 0.520 0.032
#> GSM381210     1  0.0993      0.934 0.964 0.000 0.000 0.000 0.024 0.012
#> GSM381215     3  0.3284      0.784 0.000 0.000 0.784 0.000 0.020 0.196
#> GSM381219     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381221     2  0.1714      0.814 0.000 0.908 0.000 0.000 0.092 0.000
#> GSM381223     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381229     6  0.2313      0.901 0.000 0.000 0.100 0.012 0.004 0.884
#> GSM381230     1  0.0713      0.935 0.972 0.000 0.000 0.000 0.028 0.000
#> GSM381233     1  0.1010      0.934 0.960 0.000 0.000 0.000 0.036 0.004
#> GSM381234     1  0.2333      0.909 0.884 0.000 0.000 0.000 0.092 0.024
#> GSM381238     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381239     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM381242     3  0.2527      0.772 0.000 0.000 0.876 0.000 0.084 0.040
#> GSM381247     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381248     1  0.2726      0.897 0.856 0.000 0.000 0.000 0.112 0.032
#> GSM381249     1  0.1049      0.931 0.960 0.000 0.000 0.000 0.032 0.008
#> GSM381253     3  0.3284      0.784 0.000 0.000 0.784 0.000 0.020 0.196
#> GSM381255     2  0.2793      0.802 0.000 0.800 0.000 0.000 0.200 0.000
#> GSM381258     3  0.1265      0.818 0.000 0.000 0.948 0.000 0.044 0.008
#> GSM381262     3  0.3582      0.736 0.000 0.000 0.732 0.000 0.016 0.252
#> GSM381266     6  0.4034      0.663 0.000 0.000 0.260 0.024 0.008 0.708
#> GSM381267     5  0.4520      1.000 0.000 0.448 0.000 0.000 0.520 0.032
#> GSM381269     3  0.1765      0.805 0.000 0.000 0.924 0.000 0.052 0.024
#> GSM381273     6  0.2383      0.900 0.000 0.000 0.096 0.024 0.000 0.880
#> GSM381274     2  0.2969      0.795 0.000 0.776 0.000 0.000 0.224 0.000
#> GSM381276     6  0.3321      0.786 0.008 0.000 0.088 0.000 0.072 0.832

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 other(p) k
#> ATC:skmeans 86    0.744 2
#> ATC:skmeans 86    0.889 3
#> ATC:skmeans 86    0.552 4
#> ATC:skmeans 86    0.588 5
#> ATC:skmeans 86    0.424 6

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


ATC:pam**

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4528 0.548   0.548
#> 3 3 0.827           0.932       0.949         0.1210 0.985   0.973
#> 4 4 0.700           0.785       0.890         0.2294 0.871   0.759
#> 5 5 0.728           0.809       0.883         0.1190 0.889   0.729
#> 6 6 0.855           0.846       0.930         0.0754 0.953   0.847

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
#> GSM381194     1       0          1  1  0
#> GSM381199     2       0          1  0  1
#> GSM381205     2       0          1  0  1
#> GSM381211     2       0          1  0  1
#> GSM381220     2       0          1  0  1
#> GSM381222     1       0          1  1  0
#> GSM381224     1       0          1  1  0
#> GSM381232     1       0          1  1  0
#> GSM381240     1       0          1  1  0
#> GSM381250     1       0          1  1  0
#> GSM381252     2       0          1  0  1
#> GSM381254     1       0          1  1  0
#> GSM381256     2       0          1  0  1
#> GSM381257     1       0          1  1  0
#> GSM381259     1       0          1  1  0
#> GSM381260     1       0          1  1  0
#> GSM381261     2       0          1  0  1
#> GSM381263     1       0          1  1  0
#> GSM381265     1       0          1  1  0
#> GSM381268     1       0          1  1  0
#> GSM381270     2       0          1  0  1
#> GSM381271     1       0          1  1  0
#> GSM381275     2       0          1  0  1
#> GSM381279     2       0          1  0  1
#> GSM381195     1       0          1  1  0
#> GSM381196     1       0          1  1  0
#> GSM381198     2       0          1  0  1
#> GSM381200     2       0          1  0  1
#> GSM381201     1       0          1  1  0
#> GSM381203     1       0          1  1  0
#> GSM381204     1       0          1  1  0
#> GSM381209     1       0          1  1  0
#> GSM381212     1       0          1  1  0
#> GSM381213     2       0          1  0  1
#> GSM381214     2       0          1  0  1
#> GSM381216     1       0          1  1  0
#> GSM381225     1       0          1  1  0
#> GSM381231     1       0          1  1  0
#> GSM381235     1       0          1  1  0
#> GSM381237     1       0          1  1  0
#> GSM381241     2       0          1  0  1
#> GSM381243     2       0          1  0  1
#> GSM381245     1       0          1  1  0
#> GSM381246     2       0          1  0  1
#> GSM381251     1       0          1  1  0
#> GSM381264     1       0          1  1  0
#> GSM381206     2       0          1  0  1
#> GSM381217     1       0          1  1  0
#> GSM381218     2       0          1  0  1
#> GSM381226     2       0          1  0  1
#> GSM381227     2       0          1  0  1
#> GSM381228     1       0          1  1  0
#> GSM381236     1       0          1  1  0
#> GSM381244     1       0          1  1  0
#> GSM381272     1       0          1  1  0
#> GSM381277     1       0          1  1  0
#> GSM381278     1       0          1  1  0
#> GSM381197     1       0          1  1  0
#> GSM381202     1       0          1  1  0
#> GSM381207     1       0          1  1  0
#> GSM381208     2       0          1  0  1
#> GSM381210     1       0          1  1  0
#> GSM381215     1       0          1  1  0
#> GSM381219     2       0          1  0  1
#> GSM381221     2       0          1  0  1
#> GSM381223     2       0          1  0  1
#> GSM381229     1       0          1  1  0
#> GSM381230     1       0          1  1  0
#> GSM381233     1       0          1  1  0
#> GSM381234     1       0          1  1  0
#> GSM381238     1       0          1  1  0
#> GSM381239     1       0          1  1  0
#> GSM381242     1       0          1  1  0
#> GSM381247     2       0          1  0  1
#> GSM381248     1       0          1  1  0
#> GSM381249     1       0          1  1  0
#> GSM381253     1       0          1  1  0
#> GSM381255     2       0          1  0  1
#> GSM381258     1       0          1  1  0
#> GSM381262     1       0          1  1  0
#> GSM381266     1       0          1  1  0
#> GSM381267     2       0          1  0  1
#> GSM381269     1       0          1  1  0
#> GSM381273     1       0          1  1  0
#> GSM381274     2       0          1  0  1
#> GSM381276     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM381194     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381199     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381205     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381211     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381220     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381222     1  0.0747      0.933 0.984 0.000 0.016
#> GSM381224     1  0.1163      0.929 0.972 0.000 0.028
#> GSM381232     1  0.2356      0.900 0.928 0.000 0.072
#> GSM381240     1  0.1529      0.925 0.960 0.000 0.040
#> GSM381250     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381252     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381254     1  0.4702      0.808 0.788 0.000 0.212
#> GSM381256     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381257     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381259     1  0.5058      0.786 0.756 0.000 0.244
#> GSM381260     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381261     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381263     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381265     1  0.4974      0.791 0.764 0.000 0.236
#> GSM381268     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381270     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381271     1  0.2356      0.900 0.928 0.000 0.072
#> GSM381275     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381279     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381195     1  0.4842      0.800 0.776 0.000 0.224
#> GSM381196     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381198     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381200     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381201     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381203     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381204     1  0.5058      0.786 0.756 0.000 0.244
#> GSM381209     1  0.5058      0.786 0.756 0.000 0.244
#> GSM381212     1  0.5058      0.786 0.756 0.000 0.244
#> GSM381213     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381214     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381216     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381225     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381231     1  0.2356      0.900 0.928 0.000 0.072
#> GSM381235     1  0.0424      0.935 0.992 0.000 0.008
#> GSM381237     1  0.5058      0.786 0.756 0.000 0.244
#> GSM381241     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381243     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381245     1  0.1031      0.931 0.976 0.000 0.024
#> GSM381246     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381251     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381264     1  0.4654      0.809 0.792 0.000 0.208
#> GSM381206     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381217     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381218     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381226     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381227     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381228     1  0.2356      0.900 0.928 0.000 0.072
#> GSM381236     1  0.2356      0.900 0.928 0.000 0.072
#> GSM381244     1  0.0592      0.934 0.988 0.000 0.012
#> GSM381272     1  0.2356      0.900 0.928 0.000 0.072
#> GSM381277     1  0.1163      0.929 0.972 0.000 0.028
#> GSM381278     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381197     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381202     1  0.0592      0.934 0.988 0.000 0.012
#> GSM381207     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381208     3  0.5733      1.000 0.000 0.324 0.676
#> GSM381210     1  0.1529      0.925 0.960 0.000 0.040
#> GSM381215     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381219     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381221     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381223     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381229     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381230     1  0.5058      0.786 0.756 0.000 0.244
#> GSM381233     1  0.0747      0.933 0.984 0.000 0.016
#> GSM381234     1  0.4750      0.806 0.784 0.000 0.216
#> GSM381238     1  0.2356      0.900 0.928 0.000 0.072
#> GSM381239     1  0.2356      0.900 0.928 0.000 0.072
#> GSM381242     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381247     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381248     1  0.1529      0.926 0.960 0.000 0.040
#> GSM381249     1  0.5058      0.786 0.756 0.000 0.244
#> GSM381253     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381255     2  0.0000      0.996 0.000 1.000 0.000
#> GSM381258     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381262     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381266     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381267     3  0.5733      1.000 0.000 0.324 0.676
#> GSM381269     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381273     1  0.0000      0.936 1.000 0.000 0.000
#> GSM381274     2  0.0424      0.991 0.000 0.992 0.008
#> GSM381276     1  0.0000      0.936 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
#> GSM381194     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381199     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM381205     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM381211     2  0.0188      0.973 0.004 0.996 0.000 0.000
#> GSM381220     2  0.1211      0.964 0.040 0.960 0.000 0.000
#> GSM381222     3  0.3837      0.588 0.224 0.000 0.776 0.000
#> GSM381224     3  0.4500      0.416 0.316 0.000 0.684 0.000
#> GSM381232     3  0.5531      0.607 0.140 0.000 0.732 0.128
#> GSM381240     3  0.4697      0.312 0.356 0.000 0.644 0.000
#> GSM381250     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381252     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM381254     3  0.4989     -0.385 0.472 0.000 0.528 0.000
#> GSM381256     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM381257     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381259     1  0.3569      0.886 0.804 0.000 0.196 0.000
#> GSM381260     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381261     2  0.2142      0.953 0.056 0.928 0.000 0.016
#> GSM381263     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381265     1  0.4790      0.698 0.620 0.000 0.380 0.000
#> GSM381268     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381270     2  0.1389      0.963 0.048 0.952 0.000 0.000
#> GSM381271     3  0.5531      0.607 0.140 0.000 0.732 0.128
#> GSM381275     2  0.1182      0.964 0.016 0.968 0.000 0.016
#> GSM381279     2  0.2142      0.953 0.056 0.928 0.000 0.016
#> GSM381195     1  0.4661      0.762 0.652 0.000 0.348 0.000
#> GSM381196     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381198     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM381200     2  0.0188      0.973 0.004 0.996 0.000 0.000
#> GSM381201     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381203     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381204     1  0.3569      0.886 0.804 0.000 0.196 0.000
#> GSM381209     1  0.3649      0.885 0.796 0.000 0.204 0.000
#> GSM381212     1  0.3569      0.886 0.804 0.000 0.196 0.000
#> GSM381213     2  0.1211      0.964 0.040 0.960 0.000 0.000
#> GSM381214     2  0.0188      0.973 0.004 0.996 0.000 0.000
#> GSM381216     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381225     3  0.2814      0.709 0.132 0.000 0.868 0.000
#> GSM381231     3  0.5531      0.607 0.140 0.000 0.732 0.128
#> GSM381235     3  0.3400      0.651 0.180 0.000 0.820 0.000
#> GSM381237     1  0.3569      0.886 0.804 0.000 0.196 0.000
#> GSM381241     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM381243     2  0.1211      0.964 0.040 0.960 0.000 0.000
#> GSM381245     3  0.4406      0.452 0.300 0.000 0.700 0.000
#> GSM381246     2  0.1182      0.964 0.016 0.968 0.000 0.016
#> GSM381251     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381264     3  0.4981     -0.360 0.464 0.000 0.536 0.000
#> GSM381206     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM381217     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381218     2  0.0188      0.973 0.004 0.996 0.000 0.000
#> GSM381226     2  0.1182      0.964 0.016 0.968 0.000 0.016
#> GSM381227     2  0.2142      0.953 0.056 0.928 0.000 0.016
#> GSM381228     3  0.5531      0.607 0.140 0.000 0.732 0.128
#> GSM381236     3  0.5531      0.607 0.140 0.000 0.732 0.128
#> GSM381244     3  0.2760      0.714 0.128 0.000 0.872 0.000
#> GSM381272     3  0.5531      0.607 0.140 0.000 0.732 0.128
#> GSM381277     3  0.4500      0.416 0.316 0.000 0.684 0.000
#> GSM381278     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381197     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381202     3  0.1211      0.789 0.040 0.000 0.960 0.000
#> GSM381207     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381208     4  0.2973      1.000 0.000 0.144 0.000 0.856
#> GSM381210     3  0.4072      0.533 0.252 0.000 0.748 0.000
#> GSM381215     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381219     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM381221     2  0.0336      0.972 0.000 0.992 0.000 0.008
#> GSM381223     2  0.1182      0.964 0.016 0.968 0.000 0.016
#> GSM381229     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381230     1  0.3569      0.886 0.804 0.000 0.196 0.000
#> GSM381233     3  0.3688      0.614 0.208 0.000 0.792 0.000
#> GSM381234     1  0.4679      0.748 0.648 0.000 0.352 0.000
#> GSM381238     3  0.5483      0.611 0.136 0.000 0.736 0.128
#> GSM381239     3  0.5483      0.611 0.136 0.000 0.736 0.128
#> GSM381242     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381247     2  0.1211      0.964 0.040 0.960 0.000 0.000
#> GSM381248     3  0.4697      0.284 0.356 0.000 0.644 0.000
#> GSM381249     1  0.4164      0.847 0.736 0.000 0.264 0.000
#> GSM381253     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381255     2  0.1118      0.965 0.036 0.964 0.000 0.000
#> GSM381258     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381262     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381266     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381267     4  0.2973      1.000 0.000 0.144 0.000 0.856
#> GSM381269     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381273     3  0.0000      0.817 0.000 0.000 1.000 0.000
#> GSM381274     2  0.2142      0.953 0.056 0.928 0.000 0.016
#> GSM381276     3  0.0000      0.817 0.000 0.000 1.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
#> GSM381194     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381199     2  0.0000      0.898 0.000 1.000 0.000 0.000  0
#> GSM381205     2  0.0000      0.898 0.000 1.000 0.000 0.000  0
#> GSM381211     2  0.0290      0.899 0.000 0.992 0.000 0.008  0
#> GSM381220     2  0.3305      0.832 0.000 0.776 0.000 0.224  0
#> GSM381222     3  0.3636      0.632 0.272 0.000 0.728 0.000  0
#> GSM381224     3  0.4161      0.457 0.392 0.000 0.608 0.000  0
#> GSM381232     4  0.3636      0.991 0.000 0.000 0.272 0.728  0
#> GSM381240     3  0.4291      0.300 0.464 0.000 0.536 0.000  0
#> GSM381250     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381252     2  0.0000      0.898 0.000 1.000 0.000 0.000  0
#> GSM381254     1  0.4268      0.382 0.556 0.000 0.444 0.000  0
#> GSM381256     2  0.0000      0.898 0.000 1.000 0.000 0.000  0
#> GSM381257     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381259     1  0.0000      0.725 1.000 0.000 0.000 0.000  0
#> GSM381260     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381261     2  0.3636      0.816 0.000 0.728 0.000 0.272  0
#> GSM381263     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381265     1  0.3366      0.602 0.768 0.000 0.232 0.000  0
#> GSM381268     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381270     2  0.3452      0.826 0.000 0.756 0.000 0.244  0
#> GSM381271     4  0.3636      0.991 0.000 0.000 0.272 0.728  0
#> GSM381275     2  0.1270      0.887 0.000 0.948 0.000 0.052  0
#> GSM381279     2  0.3636      0.816 0.000 0.728 0.000 0.272  0
#> GSM381195     1  0.3177      0.655 0.792 0.000 0.208 0.000  0
#> GSM381196     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381198     2  0.0000      0.898 0.000 1.000 0.000 0.000  0
#> GSM381200     2  0.0290      0.899 0.000 0.992 0.000 0.008  0
#> GSM381201     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381203     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381204     1  0.0000      0.725 1.000 0.000 0.000 0.000  0
#> GSM381209     1  0.0703      0.725 0.976 0.000 0.024 0.000  0
#> GSM381212     1  0.0000      0.725 1.000 0.000 0.000 0.000  0
#> GSM381213     2  0.3305      0.832 0.000 0.776 0.000 0.224  0
#> GSM381214     2  0.0290      0.899 0.000 0.992 0.000 0.008  0
#> GSM381216     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381225     3  0.2813      0.741 0.168 0.000 0.832 0.000  0
#> GSM381231     4  0.3636      0.991 0.000 0.000 0.272 0.728  0
#> GSM381235     3  0.3305      0.692 0.224 0.000 0.776 0.000  0
#> GSM381237     1  0.0000      0.725 1.000 0.000 0.000 0.000  0
#> GSM381241     2  0.0000      0.898 0.000 1.000 0.000 0.000  0
#> GSM381243     2  0.3305      0.832 0.000 0.776 0.000 0.224  0
#> GSM381245     3  0.4101      0.493 0.372 0.000 0.628 0.000  0
#> GSM381246     2  0.1121      0.888 0.000 0.956 0.000 0.044  0
#> GSM381251     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381264     1  0.4262      0.379 0.560 0.000 0.440 0.000  0
#> GSM381206     2  0.0000      0.898 0.000 1.000 0.000 0.000  0
#> GSM381217     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381218     2  0.0290      0.899 0.000 0.992 0.000 0.008  0
#> GSM381226     2  0.1121      0.888 0.000 0.956 0.000 0.044  0
#> GSM381227     2  0.3612      0.818 0.000 0.732 0.000 0.268  0
#> GSM381228     4  0.3636      0.991 0.000 0.000 0.272 0.728  0
#> GSM381236     4  0.3636      0.991 0.000 0.000 0.272 0.728  0
#> GSM381244     3  0.2561      0.765 0.144 0.000 0.856 0.000  0
#> GSM381272     4  0.3636      0.991 0.000 0.000 0.272 0.728  0
#> GSM381277     3  0.4161      0.457 0.392 0.000 0.608 0.000  0
#> GSM381278     3  0.0162      0.863 0.004 0.000 0.996 0.000  0
#> GSM381197     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381202     3  0.1478      0.805 0.064 0.000 0.936 0.000  0
#> GSM381207     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381208     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM381210     3  0.3913      0.540 0.324 0.000 0.676 0.000  0
#> GSM381215     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381219     2  0.0000      0.898 0.000 1.000 0.000 0.000  0
#> GSM381221     2  0.0404      0.897 0.000 0.988 0.000 0.012  0
#> GSM381223     2  0.1197      0.887 0.000 0.952 0.000 0.048  0
#> GSM381229     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381230     1  0.0000      0.725 1.000 0.000 0.000 0.000  0
#> GSM381233     3  0.3534      0.654 0.256 0.000 0.744 0.000  0
#> GSM381234     1  0.3305      0.633 0.776 0.000 0.224 0.000  0
#> GSM381238     4  0.3730      0.974 0.000 0.000 0.288 0.712  0
#> GSM381239     4  0.3730      0.974 0.000 0.000 0.288 0.712  0
#> GSM381242     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381247     2  0.3395      0.829 0.000 0.764 0.000 0.236  0
#> GSM381248     3  0.4256      0.329 0.436 0.000 0.564 0.000  0
#> GSM381249     1  0.2020      0.695 0.900 0.000 0.100 0.000  0
#> GSM381253     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381255     2  0.3242      0.834 0.000 0.784 0.000 0.216  0
#> GSM381258     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381262     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381266     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381267     5  0.0000      1.000 0.000 0.000 0.000 0.000  1
#> GSM381269     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381273     3  0.0000      0.865 0.000 0.000 1.000 0.000  0
#> GSM381274     2  0.3636      0.816 0.000 0.728 0.000 0.272  0
#> GSM381276     3  0.0162      0.863 0.004 0.000 0.996 0.000  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM381194     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381199     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000  0
#> GSM381205     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000  0
#> GSM381211     2  0.0260      0.979 0.000 0.992 0.000 0.000 0.008  0
#> GSM381220     5  0.1267      0.943 0.000 0.060 0.000 0.000 0.940  0
#> GSM381222     3  0.3266      0.651 0.272 0.000 0.728 0.000 0.000  0
#> GSM381224     3  0.3737      0.474 0.392 0.000 0.608 0.000 0.000  0
#> GSM381232     4  0.0000      0.980 0.000 0.000 0.000 1.000 0.000  0
#> GSM381240     3  0.3854      0.318 0.464 0.000 0.536 0.000 0.000  0
#> GSM381250     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381252     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000  0
#> GSM381254     1  0.3817      0.445 0.568 0.000 0.432 0.000 0.000  0
#> GSM381256     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000  0
#> GSM381257     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381259     1  0.0000      0.738 1.000 0.000 0.000 0.000 0.000  0
#> GSM381260     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381261     5  0.1204      0.920 0.000 0.056 0.000 0.000 0.944  0
#> GSM381263     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381265     1  0.2941      0.630 0.780 0.000 0.220 0.000 0.000  0
#> GSM381268     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381270     5  0.0865      0.945 0.000 0.036 0.000 0.000 0.964  0
#> GSM381271     4  0.0000      0.980 0.000 0.000 0.000 1.000 0.000  0
#> GSM381275     2  0.1327      0.942 0.000 0.936 0.000 0.000 0.064  0
#> GSM381279     5  0.0146      0.927 0.000 0.004 0.000 0.000 0.996  0
#> GSM381195     1  0.2854      0.667 0.792 0.000 0.208 0.000 0.000  0
#> GSM381196     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381198     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000  0
#> GSM381200     2  0.0260      0.979 0.000 0.992 0.000 0.000 0.008  0
#> GSM381201     3  0.0146      0.882 0.000 0.000 0.996 0.000 0.004  0
#> GSM381203     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381204     1  0.0000      0.738 1.000 0.000 0.000 0.000 0.000  0
#> GSM381209     1  0.0632      0.739 0.976 0.000 0.024 0.000 0.000  0
#> GSM381212     1  0.0000      0.738 1.000 0.000 0.000 0.000 0.000  0
#> GSM381213     5  0.1957      0.906 0.000 0.112 0.000 0.000 0.888  0
#> GSM381214     2  0.0260      0.979 0.000 0.992 0.000 0.000 0.008  0
#> GSM381216     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381225     3  0.2527      0.762 0.168 0.000 0.832 0.000 0.000  0
#> GSM381231     4  0.0000      0.980 0.000 0.000 0.000 1.000 0.000  0
#> GSM381235     3  0.2969      0.707 0.224 0.000 0.776 0.000 0.000  0
#> GSM381237     1  0.0000      0.738 1.000 0.000 0.000 0.000 0.000  0
#> GSM381241     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000  0
#> GSM381243     5  0.1267      0.943 0.000 0.060 0.000 0.000 0.940  0
#> GSM381245     3  0.3684      0.509 0.372 0.000 0.628 0.000 0.000  0
#> GSM381246     2  0.1075      0.953 0.000 0.952 0.000 0.000 0.048  0
#> GSM381251     3  0.0146      0.882 0.000 0.000 0.996 0.000 0.004  0
#> GSM381264     1  0.3810      0.457 0.572 0.000 0.428 0.000 0.000  0
#> GSM381206     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000  0
#> GSM381217     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381218     2  0.0260      0.979 0.000 0.992 0.000 0.000 0.008  0
#> GSM381226     2  0.1075      0.953 0.000 0.952 0.000 0.000 0.048  0
#> GSM381227     5  0.0260      0.931 0.000 0.008 0.000 0.000 0.992  0
#> GSM381228     4  0.0000      0.980 0.000 0.000 0.000 1.000 0.000  0
#> GSM381236     4  0.0260      0.975 0.000 0.000 0.008 0.992 0.000  0
#> GSM381244     3  0.2340      0.782 0.148 0.000 0.852 0.000 0.000  0
#> GSM381272     4  0.0000      0.980 0.000 0.000 0.000 1.000 0.000  0
#> GSM381277     3  0.3737      0.474 0.392 0.000 0.608 0.000 0.000  0
#> GSM381278     3  0.0458      0.875 0.016 0.000 0.984 0.000 0.000  0
#> GSM381197     3  0.0146      0.882 0.000 0.000 0.996 0.000 0.004  0
#> GSM381202     3  0.1327      0.832 0.064 0.000 0.936 0.000 0.000  0
#> GSM381207     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381208     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000  1
#> GSM381210     3  0.3547      0.538 0.332 0.000 0.668 0.000 0.000  0
#> GSM381215     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381219     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000  0
#> GSM381221     2  0.0363      0.977 0.000 0.988 0.000 0.000 0.012  0
#> GSM381223     2  0.1204      0.947 0.000 0.944 0.000 0.000 0.056  0
#> GSM381229     3  0.0146      0.882 0.000 0.000 0.996 0.000 0.004  0
#> GSM381230     1  0.0000      0.738 1.000 0.000 0.000 0.000 0.000  0
#> GSM381233     3  0.3175      0.672 0.256 0.000 0.744 0.000 0.000  0
#> GSM381234     1  0.2969      0.645 0.776 0.000 0.224 0.000 0.000  0
#> GSM381238     4  0.0790      0.948 0.000 0.000 0.032 0.968 0.000  0
#> GSM381239     4  0.0790      0.948 0.000 0.000 0.032 0.968 0.000  0
#> GSM381242     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381247     5  0.1007      0.946 0.000 0.044 0.000 0.000 0.956  0
#> GSM381248     3  0.3823      0.350 0.436 0.000 0.564 0.000 0.000  0
#> GSM381249     1  0.1714      0.714 0.908 0.000 0.092 0.000 0.000  0
#> GSM381253     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381255     5  0.1444      0.939 0.000 0.072 0.000 0.000 0.928  0
#> GSM381258     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381262     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381266     3  0.0146      0.882 0.000 0.000 0.996 0.000 0.004  0
#> GSM381267     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000  1
#> GSM381269     3  0.0000      0.883 0.000 0.000 1.000 0.000 0.000  0
#> GSM381273     3  0.0146      0.882 0.000 0.000 0.996 0.000 0.004  0
#> GSM381274     5  0.1204      0.920 0.000 0.056 0.000 0.000 0.944  0
#> GSM381276     3  0.0458      0.875 0.016 0.000 0.984 0.000 0.000  0

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 other(p) k
#> ATC:pam 86    0.744 2
#> ATC:pam 86    0.390 3
#> ATC:pam 79    0.241 4
#> ATC:pam 79    0.163 5
#> ATC:pam 80    0.304 6

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


ATC:mclust*

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4528 0.548   0.548
#> 3 3 0.740           0.766       0.864         0.2684 0.969   0.944
#> 4 4 0.923           0.963       0.961         0.1850 0.789   0.600
#> 5 5 0.832           0.756       0.863         0.0937 0.925   0.769
#> 6 6 0.787           0.687       0.826         0.0563 0.965   0.865

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette p1 p2
#> GSM381194     1       0          1  1  0
#> GSM381199     2       0          1  0  1
#> GSM381205     2       0          1  0  1
#> GSM381211     2       0          1  0  1
#> GSM381220     2       0          1  0  1
#> GSM381222     1       0          1  1  0
#> GSM381224     1       0          1  1  0
#> GSM381232     1       0          1  1  0
#> GSM381240     1       0          1  1  0
#> GSM381250     1       0          1  1  0
#> GSM381252     2       0          1  0  1
#> GSM381254     1       0          1  1  0
#> GSM381256     2       0          1  0  1
#> GSM381257     1       0          1  1  0
#> GSM381259     1       0          1  1  0
#> GSM381260     1       0          1  1  0
#> GSM381261     2       0          1  0  1
#> GSM381263     1       0          1  1  0
#> GSM381265     1       0          1  1  0
#> GSM381268     1       0          1  1  0
#> GSM381270     2       0          1  0  1
#> GSM381271     1       0          1  1  0
#> GSM381275     2       0          1  0  1
#> GSM381279     2       0          1  0  1
#> GSM381195     1       0          1  1  0
#> GSM381196     1       0          1  1  0
#> GSM381198     2       0          1  0  1
#> GSM381200     2       0          1  0  1
#> GSM381201     1       0          1  1  0
#> GSM381203     1       0          1  1  0
#> GSM381204     1       0          1  1  0
#> GSM381209     1       0          1  1  0
#> GSM381212     1       0          1  1  0
#> GSM381213     2       0          1  0  1
#> GSM381214     2       0          1  0  1
#> GSM381216     1       0          1  1  0
#> GSM381225     1       0          1  1  0
#> GSM381231     1       0          1  1  0
#> GSM381235     1       0          1  1  0
#> GSM381237     1       0          1  1  0
#> GSM381241     2       0          1  0  1
#> GSM381243     2       0          1  0  1
#> GSM381245     1       0          1  1  0
#> GSM381246     2       0          1  0  1
#> GSM381251     1       0          1  1  0
#> GSM381264     1       0          1  1  0
#> GSM381206     2       0          1  0  1
#> GSM381217     1       0          1  1  0
#> GSM381218     2       0          1  0  1
#> GSM381226     2       0          1  0  1
#> GSM381227     2       0          1  0  1
#> GSM381228     1       0          1  1  0
#> GSM381236     1       0          1  1  0
#> GSM381244     1       0          1  1  0
#> GSM381272     1       0          1  1  0
#> GSM381277     1       0          1  1  0
#> GSM381278     1       0          1  1  0
#> GSM381197     1       0          1  1  0
#> GSM381202     1       0          1  1  0
#> GSM381207     1       0          1  1  0
#> GSM381208     2       0          1  0  1
#> GSM381210     1       0          1  1  0
#> GSM381215     1       0          1  1  0
#> GSM381219     2       0          1  0  1
#> GSM381221     2       0          1  0  1
#> GSM381223     2       0          1  0  1
#> GSM381229     1       0          1  1  0
#> GSM381230     1       0          1  1  0
#> GSM381233     1       0          1  1  0
#> GSM381234     1       0          1  1  0
#> GSM381238     1       0          1  1  0
#> GSM381239     1       0          1  1  0
#> GSM381242     1       0          1  1  0
#> GSM381247     2       0          1  0  1
#> GSM381248     1       0          1  1  0
#> GSM381249     1       0          1  1  0
#> GSM381253     1       0          1  1  0
#> GSM381255     2       0          1  0  1
#> GSM381258     1       0          1  1  0
#> GSM381262     1       0          1  1  0
#> GSM381266     1       0          1  1  0
#> GSM381267     2       0          1  0  1
#> GSM381269     1       0          1  1  0
#> GSM381273     1       0          1  1  0
#> GSM381274     2       0          1  0  1
#> GSM381276     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM381194     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381199     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381205     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381211     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381220     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381222     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381224     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381232     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381240     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381250     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381252     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381254     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381256     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381257     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381259     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381260     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381261     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381263     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381265     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381268     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381270     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381271     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381275     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381279     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381195     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381196     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381198     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381200     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381201     1   0.296     0.6650 0.900 0.000 0.100
#> GSM381203     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381204     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381209     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381212     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381213     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381214     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381216     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381225     3   0.631     0.0222 0.496 0.000 0.504
#> GSM381231     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381235     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381237     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381241     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381243     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381245     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381246     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381251     1   0.296     0.6650 0.900 0.000 0.100
#> GSM381264     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381206     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381217     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381218     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381226     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381227     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381228     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381236     1   0.186     0.7114 0.948 0.000 0.052
#> GSM381244     1   0.226     0.7355 0.932 0.000 0.068
#> GSM381272     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381277     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381278     1   0.502     0.4498 0.760 0.000 0.240
#> GSM381197     1   0.296     0.6650 0.900 0.000 0.100
#> GSM381202     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381207     1   0.619     0.6338 0.580 0.000 0.420
#> GSM381208     3   0.620     0.4147 0.000 0.424 0.576
#> GSM381210     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381215     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381219     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381221     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381223     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381229     1   0.470     0.5077 0.788 0.000 0.212
#> GSM381230     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381233     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381234     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381238     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381239     1   0.226     0.6967 0.932 0.000 0.068
#> GSM381242     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381247     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381248     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381249     1   0.620     0.6328 0.576 0.000 0.424
#> GSM381253     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381255     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381258     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381262     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381266     1   0.480     0.4936 0.780 0.000 0.220
#> GSM381267     3   0.620     0.4147 0.000 0.424 0.576
#> GSM381269     1   0.000     0.7511 1.000 0.000 0.000
#> GSM381273     1   0.536     0.3773 0.724 0.000 0.276
#> GSM381274     2   0.000     1.0000 0.000 1.000 0.000
#> GSM381276     1   0.000     0.7511 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
#> GSM381194     3  0.1256      0.935 0.028 0.00 0.964 0.008
#> GSM381199     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381205     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381211     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381220     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381222     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381224     1  0.0336      0.983 0.992 0.00 0.008 0.000
#> GSM381232     3  0.1256      0.935 0.028 0.00 0.964 0.008
#> GSM381240     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381250     3  0.3088      0.926 0.060 0.00 0.888 0.052
#> GSM381252     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381254     1  0.0921      0.963 0.972 0.00 0.028 0.000
#> GSM381256     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381257     3  0.2926      0.922 0.048 0.00 0.896 0.056
#> GSM381259     1  0.0469      0.980 0.988 0.00 0.012 0.000
#> GSM381260     3  0.3323      0.923 0.064 0.00 0.876 0.060
#> GSM381261     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381263     3  0.0921      0.936 0.028 0.00 0.972 0.000
#> GSM381265     1  0.0921      0.963 0.972 0.00 0.028 0.000
#> GSM381268     3  0.0817      0.936 0.024 0.00 0.976 0.000
#> GSM381270     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381271     3  0.1042      0.933 0.020 0.00 0.972 0.008
#> GSM381275     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381279     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381195     1  0.0000      0.988 1.000 0.00 0.000 0.000
#> GSM381196     3  0.3164      0.925 0.064 0.00 0.884 0.052
#> GSM381198     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381200     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381201     3  0.0524      0.928 0.004 0.00 0.988 0.008
#> GSM381203     3  0.3312      0.921 0.072 0.00 0.876 0.052
#> GSM381204     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381209     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381212     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381213     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381214     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381216     3  0.4462      0.879 0.064 0.00 0.804 0.132
#> GSM381225     3  0.2647      0.889 0.000 0.00 0.880 0.120
#> GSM381231     3  0.1256      0.935 0.028 0.00 0.964 0.008
#> GSM381235     3  0.3453      0.918 0.080 0.00 0.868 0.052
#> GSM381237     1  0.0469      0.980 0.988 0.00 0.012 0.000
#> GSM381241     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381243     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381245     1  0.0000      0.988 1.000 0.00 0.000 0.000
#> GSM381246     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381251     3  0.0524      0.928 0.004 0.00 0.988 0.008
#> GSM381264     1  0.0336      0.983 0.992 0.00 0.008 0.000
#> GSM381206     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381217     3  0.3667      0.912 0.088 0.00 0.856 0.056
#> GSM381218     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381226     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381227     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381228     3  0.1256      0.935 0.028 0.00 0.964 0.008
#> GSM381236     3  0.1975      0.924 0.016 0.00 0.936 0.048
#> GSM381244     3  0.3239      0.910 0.068 0.00 0.880 0.052
#> GSM381272     3  0.0524      0.928 0.004 0.00 0.988 0.008
#> GSM381277     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381278     3  0.1975      0.924 0.016 0.00 0.936 0.048
#> GSM381197     3  0.0524      0.928 0.004 0.00 0.988 0.008
#> GSM381202     3  0.4462      0.879 0.064 0.00 0.804 0.132
#> GSM381207     1  0.1388      0.958 0.960 0.00 0.012 0.028
#> GSM381208     4  0.2921      1.000 0.000 0.14 0.000 0.860
#> GSM381210     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381215     3  0.3009      0.925 0.056 0.00 0.892 0.052
#> GSM381219     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381221     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381223     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381229     3  0.1975      0.924 0.016 0.00 0.936 0.048
#> GSM381230     1  0.0000      0.988 1.000 0.00 0.000 0.000
#> GSM381233     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381234     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381238     3  0.2222      0.934 0.060 0.00 0.924 0.016
#> GSM381239     3  0.3071      0.923 0.068 0.00 0.888 0.044
#> GSM381242     3  0.3617      0.918 0.064 0.00 0.860 0.076
#> GSM381247     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381248     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381249     1  0.0188      0.989 0.996 0.00 0.004 0.000
#> GSM381253     3  0.3312      0.919 0.072 0.00 0.876 0.052
#> GSM381255     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381258     3  0.1256      0.935 0.028 0.00 0.964 0.008
#> GSM381262     3  0.1256      0.935 0.028 0.00 0.964 0.008
#> GSM381266     3  0.1305      0.922 0.004 0.00 0.960 0.036
#> GSM381267     4  0.2921      1.000 0.000 0.14 0.000 0.860
#> GSM381269     3  0.2660      0.923 0.036 0.00 0.908 0.056
#> GSM381273     3  0.1474      0.914 0.000 0.00 0.948 0.052
#> GSM381274     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM381276     3  0.3164      0.925 0.064 0.00 0.884 0.052

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.4659     -0.427 0.000 0.000 0.496 0.492 0.012
#> GSM381199     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381205     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381211     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381220     2  0.1386      0.918 0.000 0.952 0.000 0.032 0.016
#> GSM381222     1  0.0290      0.983 0.992 0.000 0.008 0.000 0.000
#> GSM381224     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381232     3  0.4656     -0.392 0.000 0.000 0.508 0.480 0.012
#> GSM381240     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.1121      0.679 0.000 0.000 0.956 0.044 0.000
#> GSM381252     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381254     1  0.0771      0.973 0.976 0.000 0.004 0.020 0.000
#> GSM381256     2  0.0404      0.928 0.000 0.988 0.000 0.000 0.012
#> GSM381257     3  0.2198      0.677 0.012 0.000 0.920 0.020 0.048
#> GSM381259     1  0.0510      0.979 0.984 0.000 0.016 0.000 0.000
#> GSM381260     3  0.1857      0.679 0.004 0.000 0.928 0.008 0.060
#> GSM381261     2  0.3656      0.827 0.000 0.784 0.000 0.196 0.020
#> GSM381263     3  0.4637     -0.290 0.000 0.000 0.536 0.452 0.012
#> GSM381265     1  0.1018      0.968 0.968 0.000 0.016 0.016 0.000
#> GSM381268     3  0.3949      0.313 0.004 0.000 0.696 0.300 0.000
#> GSM381270     2  0.3318      0.845 0.000 0.808 0.000 0.180 0.012
#> GSM381271     4  0.4126      0.774 0.000 0.000 0.380 0.620 0.000
#> GSM381275     2  0.3656      0.826 0.000 0.784 0.000 0.196 0.020
#> GSM381279     2  0.3355      0.843 0.000 0.804 0.000 0.184 0.012
#> GSM381195     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.0404      0.688 0.012 0.000 0.988 0.000 0.000
#> GSM381198     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381200     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381201     4  0.3508      0.842 0.000 0.000 0.252 0.748 0.000
#> GSM381203     3  0.0609      0.685 0.020 0.000 0.980 0.000 0.000
#> GSM381204     1  0.0510      0.978 0.984 0.000 0.016 0.000 0.000
#> GSM381209     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.3318      0.845 0.000 0.808 0.000 0.180 0.012
#> GSM381214     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381216     3  0.2597      0.660 0.004 0.000 0.896 0.040 0.060
#> GSM381225     3  0.5047     -0.377 0.000 0.000 0.496 0.472 0.032
#> GSM381231     4  0.4088      0.795 0.000 0.000 0.368 0.632 0.000
#> GSM381235     3  0.0404      0.688 0.012 0.000 0.988 0.000 0.000
#> GSM381237     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381243     2  0.1597      0.913 0.000 0.940 0.000 0.048 0.012
#> GSM381245     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381246     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381251     4  0.3508      0.842 0.000 0.000 0.252 0.748 0.000
#> GSM381264     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381217     3  0.0671      0.687 0.016 0.000 0.980 0.000 0.004
#> GSM381218     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381226     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381227     2  0.0703      0.925 0.000 0.976 0.000 0.024 0.000
#> GSM381228     4  0.4387      0.793 0.012 0.000 0.348 0.640 0.000
#> GSM381236     3  0.4262      0.387 0.012 0.000 0.696 0.288 0.004
#> GSM381244     3  0.3805      0.489 0.184 0.000 0.784 0.032 0.000
#> GSM381272     4  0.3730      0.847 0.000 0.000 0.288 0.712 0.000
#> GSM381277     1  0.0404      0.980 0.988 0.000 0.012 0.000 0.000
#> GSM381278     4  0.4803      0.358 0.012 0.000 0.488 0.496 0.004
#> GSM381197     4  0.3612      0.835 0.000 0.000 0.268 0.732 0.000
#> GSM381202     3  0.2597      0.660 0.004 0.000 0.896 0.040 0.060
#> GSM381207     1  0.1792      0.898 0.916 0.000 0.084 0.000 0.000
#> GSM381208     5  0.1872      1.000 0.000 0.052 0.000 0.020 0.928
#> GSM381210     1  0.0290      0.984 0.992 0.000 0.008 0.000 0.000
#> GSM381215     3  0.0162      0.687 0.004 0.000 0.996 0.000 0.000
#> GSM381219     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381221     2  0.0000      0.931 0.000 1.000 0.000 0.000 0.000
#> GSM381223     2  0.3282      0.840 0.000 0.804 0.000 0.188 0.008
#> GSM381229     4  0.4251      0.823 0.012 0.000 0.316 0.672 0.000
#> GSM381230     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.0000      0.987 1.000 0.000 0.000 0.000 0.000
#> GSM381234     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> GSM381238     3  0.4016      0.420 0.012 0.000 0.716 0.272 0.000
#> GSM381239     3  0.4103      0.490 0.012 0.000 0.748 0.228 0.012
#> GSM381242     3  0.1857      0.679 0.004 0.000 0.928 0.008 0.060
#> GSM381247     2  0.3318      0.845 0.000 0.808 0.000 0.180 0.012
#> GSM381248     1  0.0290      0.983 0.992 0.000 0.008 0.000 0.000
#> GSM381249     1  0.0609      0.976 0.980 0.000 0.020 0.000 0.000
#> GSM381253     3  0.0290      0.688 0.008 0.000 0.992 0.000 0.000
#> GSM381255     2  0.0404      0.929 0.000 0.988 0.000 0.012 0.000
#> GSM381258     3  0.4653     -0.366 0.000 0.000 0.516 0.472 0.012
#> GSM381262     3  0.4597     -0.191 0.012 0.000 0.564 0.424 0.000
#> GSM381266     4  0.3395      0.834 0.000 0.000 0.236 0.764 0.000
#> GSM381267     5  0.1872      1.000 0.000 0.052 0.000 0.020 0.928
#> GSM381269     3  0.3494      0.650 0.012 0.000 0.848 0.084 0.056
#> GSM381273     4  0.3395      0.834 0.000 0.000 0.236 0.764 0.000
#> GSM381274     2  0.3745      0.823 0.000 0.780 0.000 0.196 0.024
#> GSM381276     3  0.0404      0.688 0.012 0.000 0.988 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
#> GSM381194     3  0.5548    -0.1841 0.000 0.000 0.464 0.400 0.136 0.000
#> GSM381199     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381205     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381211     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381220     2  0.3371     0.2400 0.000 0.708 0.000 0.000 0.292 0.000
#> GSM381222     1  0.0547     0.9654 0.980 0.000 0.000 0.020 0.000 0.000
#> GSM381224     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381232     3  0.5271     0.1952 0.000 0.000 0.576 0.292 0.132 0.000
#> GSM381240     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381250     3  0.2234     0.6995 0.000 0.000 0.872 0.124 0.000 0.004
#> GSM381252     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381254     1  0.0146     0.9772 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM381256     2  0.2823     0.4771 0.000 0.796 0.000 0.000 0.204 0.000
#> GSM381257     3  0.2698     0.6971 0.008 0.000 0.860 0.120 0.008 0.004
#> GSM381259     1  0.1267     0.9301 0.940 0.000 0.000 0.060 0.000 0.000
#> GSM381260     3  0.2495     0.6717 0.000 0.000 0.892 0.060 0.032 0.016
#> GSM381261     5  0.3515     0.8721 0.000 0.324 0.000 0.000 0.676 0.000
#> GSM381263     3  0.4552     0.4764 0.000 0.000 0.700 0.172 0.128 0.000
#> GSM381265     1  0.1444     0.9189 0.928 0.000 0.000 0.072 0.000 0.000
#> GSM381268     3  0.3101     0.6636 0.000 0.000 0.756 0.244 0.000 0.000
#> GSM381270     2  0.3867    -0.5550 0.000 0.512 0.000 0.000 0.488 0.000
#> GSM381271     4  0.3563     0.7866 0.000 0.000 0.092 0.800 0.108 0.000
#> GSM381275     5  0.3706     0.8158 0.000 0.380 0.000 0.000 0.620 0.000
#> GSM381279     5  0.3817     0.7177 0.000 0.432 0.000 0.000 0.568 0.000
#> GSM381195     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381196     3  0.1957     0.7012 0.000 0.000 0.888 0.112 0.000 0.000
#> GSM381198     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381200     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381201     4  0.1814     0.8092 0.000 0.000 0.100 0.900 0.000 0.000
#> GSM381203     3  0.5293     0.6254 0.036 0.000 0.672 0.152 0.140 0.000
#> GSM381204     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381209     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381212     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381213     2  0.3867    -0.5550 0.000 0.512 0.000 0.000 0.488 0.000
#> GSM381214     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381216     3  0.2649     0.6685 0.000 0.000 0.884 0.052 0.048 0.016
#> GSM381225     3  0.5938     0.5605 0.000 0.000 0.620 0.164 0.140 0.076
#> GSM381231     4  0.3602     0.7844 0.000 0.000 0.088 0.796 0.116 0.000
#> GSM381235     3  0.5746     0.5987 0.088 0.000 0.648 0.128 0.136 0.000
#> GSM381237     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381241     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381243     2  0.3647    -0.0513 0.000 0.640 0.000 0.000 0.360 0.000
#> GSM381245     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381246     2  0.0146     0.7828 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM381251     4  0.1616     0.8066 0.000 0.000 0.048 0.932 0.000 0.020
#> GSM381264     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381206     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381217     3  0.2968     0.6886 0.052 0.000 0.852 0.092 0.000 0.004
#> GSM381218     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381226     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381227     2  0.0937     0.7461 0.000 0.960 0.000 0.000 0.040 0.000
#> GSM381228     4  0.5879     0.7072 0.000 0.000 0.084 0.612 0.216 0.088
#> GSM381236     3  0.5735     0.5437 0.000 0.000 0.632 0.196 0.104 0.068
#> GSM381244     3  0.5127     0.3466 0.384 0.000 0.528 0.088 0.000 0.000
#> GSM381272     4  0.3196     0.7939 0.000 0.000 0.064 0.828 0.108 0.000
#> GSM381277     1  0.1531     0.9188 0.928 0.000 0.004 0.068 0.000 0.000
#> GSM381278     3  0.6352     0.4193 0.000 0.000 0.540 0.252 0.140 0.068
#> GSM381197     4  0.2662     0.7859 0.000 0.000 0.152 0.840 0.004 0.004
#> GSM381202     3  0.2775     0.6654 0.000 0.000 0.876 0.052 0.056 0.016
#> GSM381207     1  0.2066     0.8931 0.904 0.000 0.024 0.072 0.000 0.000
#> GSM381208     6  0.0458     1.0000 0.000 0.016 0.000 0.000 0.000 0.984
#> GSM381210     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381215     3  0.2416     0.6919 0.000 0.000 0.844 0.156 0.000 0.000
#> GSM381219     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381221     2  0.0000     0.7865 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM381223     2  0.3810    -0.3533 0.000 0.572 0.000 0.000 0.428 0.000
#> GSM381229     4  0.5694     0.6344 0.000 0.000 0.224 0.624 0.084 0.068
#> GSM381230     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381233     1  0.0000     0.9787 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM381234     1  0.0146     0.9772 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM381238     3  0.5780     0.5646 0.000 0.000 0.636 0.156 0.140 0.068
#> GSM381239     3  0.5733     0.5721 0.000 0.000 0.644 0.144 0.140 0.072
#> GSM381242     3  0.2649     0.6680 0.000 0.000 0.884 0.052 0.048 0.016
#> GSM381247     2  0.3867    -0.5550 0.000 0.512 0.000 0.000 0.488 0.000
#> GSM381248     1  0.0146     0.9772 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM381249     1  0.0146     0.9772 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM381253     3  0.3125     0.6824 0.080 0.000 0.836 0.084 0.000 0.000
#> GSM381255     2  0.0260     0.7800 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM381258     3  0.4771     0.4088 0.000 0.000 0.664 0.220 0.116 0.000
#> GSM381262     3  0.4525     0.6587 0.000 0.000 0.684 0.228 0.088 0.000
#> GSM381266     4  0.3118     0.7908 0.000 0.000 0.092 0.836 0.000 0.072
#> GSM381267     6  0.0458     1.0000 0.000 0.016 0.000 0.000 0.000 0.984
#> GSM381269     3  0.2089     0.6833 0.004 0.000 0.908 0.072 0.012 0.004
#> GSM381273     4  0.3426     0.7792 0.000 0.000 0.124 0.808 0.000 0.068
#> GSM381274     5  0.3464     0.8649 0.000 0.312 0.000 0.000 0.688 0.000
#> GSM381276     3  0.3785     0.6813 0.004 0.000 0.780 0.152 0.064 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 other(p) k
#> ATC:mclust 86    0.744 2
#> ATC:mclust 80    0.591 3
#> ATC:mclust 86    0.463 4
#> ATC:mclust 74    0.615 5
#> ATC:mclust 73    0.348 6

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


ATC:NMF**

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4528 0.548   0.548
#> 3 3 0.873           0.885       0.951         0.4727 0.778   0.595
#> 4 4 0.758           0.752       0.844         0.0831 0.904   0.718
#> 5 5 0.745           0.658       0.819         0.0407 0.879   0.617
#> 6 6 0.657           0.630       0.742         0.0351 0.951   0.817

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
#> GSM381194     1       0          1  1  0
#> GSM381199     2       0          1  0  1
#> GSM381205     2       0          1  0  1
#> GSM381211     2       0          1  0  1
#> GSM381220     2       0          1  0  1
#> GSM381222     1       0          1  1  0
#> GSM381224     1       0          1  1  0
#> GSM381232     1       0          1  1  0
#> GSM381240     1       0          1  1  0
#> GSM381250     1       0          1  1  0
#> GSM381252     2       0          1  0  1
#> GSM381254     1       0          1  1  0
#> GSM381256     2       0          1  0  1
#> GSM381257     1       0          1  1  0
#> GSM381259     1       0          1  1  0
#> GSM381260     1       0          1  1  0
#> GSM381261     2       0          1  0  1
#> GSM381263     1       0          1  1  0
#> GSM381265     1       0          1  1  0
#> GSM381268     1       0          1  1  0
#> GSM381270     2       0          1  0  1
#> GSM381271     1       0          1  1  0
#> GSM381275     2       0          1  0  1
#> GSM381279     2       0          1  0  1
#> GSM381195     1       0          1  1  0
#> GSM381196     1       0          1  1  0
#> GSM381198     2       0          1  0  1
#> GSM381200     2       0          1  0  1
#> GSM381201     1       0          1  1  0
#> GSM381203     1       0          1  1  0
#> GSM381204     1       0          1  1  0
#> GSM381209     1       0          1  1  0
#> GSM381212     1       0          1  1  0
#> GSM381213     2       0          1  0  1
#> GSM381214     2       0          1  0  1
#> GSM381216     1       0          1  1  0
#> GSM381225     1       0          1  1  0
#> GSM381231     1       0          1  1  0
#> GSM381235     1       0          1  1  0
#> GSM381237     1       0          1  1  0
#> GSM381241     2       0          1  0  1
#> GSM381243     2       0          1  0  1
#> GSM381245     1       0          1  1  0
#> GSM381246     2       0          1  0  1
#> GSM381251     1       0          1  1  0
#> GSM381264     1       0          1  1  0
#> GSM381206     2       0          1  0  1
#> GSM381217     1       0          1  1  0
#> GSM381218     2       0          1  0  1
#> GSM381226     2       0          1  0  1
#> GSM381227     2       0          1  0  1
#> GSM381228     1       0          1  1  0
#> GSM381236     1       0          1  1  0
#> GSM381244     1       0          1  1  0
#> GSM381272     1       0          1  1  0
#> GSM381277     1       0          1  1  0
#> GSM381278     1       0          1  1  0
#> GSM381197     1       0          1  1  0
#> GSM381202     1       0          1  1  0
#> GSM381207     1       0          1  1  0
#> GSM381208     2       0          1  0  1
#> GSM381210     1       0          1  1  0
#> GSM381215     1       0          1  1  0
#> GSM381219     2       0          1  0  1
#> GSM381221     2       0          1  0  1
#> GSM381223     2       0          1  0  1
#> GSM381229     1       0          1  1  0
#> GSM381230     1       0          1  1  0
#> GSM381233     1       0          1  1  0
#> GSM381234     1       0          1  1  0
#> GSM381238     1       0          1  1  0
#> GSM381239     1       0          1  1  0
#> GSM381242     1       0          1  1  0
#> GSM381247     2       0          1  0  1
#> GSM381248     1       0          1  1  0
#> GSM381249     1       0          1  1  0
#> GSM381253     1       0          1  1  0
#> GSM381255     2       0          1  0  1
#> GSM381258     1       0          1  1  0
#> GSM381262     1       0          1  1  0
#> GSM381266     1       0          1  1  0
#> GSM381267     2       0          1  0  1
#> GSM381269     1       0          1  1  0
#> GSM381273     1       0          1  1  0
#> GSM381274     2       0          1  0  1
#> GSM381276     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1  p2    p3
#> GSM381194     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381199     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381205     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381211     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381220     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381222     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381224     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381232     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381240     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381250     3  0.2878    0.83921 0.096 0.0 0.904
#> GSM381252     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381254     1  0.0237    0.92757 0.996 0.0 0.004
#> GSM381256     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381257     1  0.4555    0.76721 0.800 0.0 0.200
#> GSM381259     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381260     3  0.6309   -0.00269 0.500 0.0 0.500
#> GSM381261     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381263     3  0.0237    0.89841 0.004 0.0 0.996
#> GSM381265     1  0.0237    0.92757 0.996 0.0 0.004
#> GSM381268     3  0.0424    0.89744 0.008 0.0 0.992
#> GSM381270     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381271     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381275     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381279     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381195     1  0.0237    0.92757 0.996 0.0 0.004
#> GSM381196     3  0.2878    0.83935 0.096 0.0 0.904
#> GSM381198     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381200     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381201     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381203     3  0.6307    0.04858 0.488 0.0 0.512
#> GSM381204     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381209     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381212     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381213     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381214     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381216     1  0.4504    0.77274 0.804 0.0 0.196
#> GSM381225     3  0.0747    0.89421 0.016 0.0 0.984
#> GSM381231     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381235     1  0.4504    0.77252 0.804 0.0 0.196
#> GSM381237     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381241     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381243     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381245     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381246     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381251     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381264     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381206     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381217     1  0.3551    0.84122 0.868 0.0 0.132
#> GSM381218     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381226     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381227     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381228     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381236     3  0.0747    0.89440 0.016 0.0 0.984
#> GSM381244     1  0.1860    0.90192 0.948 0.0 0.052
#> GSM381272     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381277     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381278     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381197     3  0.0747    0.89404 0.016 0.0 0.984
#> GSM381202     1  0.4062    0.80996 0.836 0.0 0.164
#> GSM381207     1  0.1643    0.90678 0.956 0.0 0.044
#> GSM381208     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381210     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381215     3  0.5098    0.65478 0.248 0.0 0.752
#> GSM381219     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381221     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381223     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381229     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381230     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381233     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381234     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381238     3  0.2261    0.86179 0.068 0.0 0.932
#> GSM381239     3  0.5760    0.51267 0.328 0.0 0.672
#> GSM381242     1  0.5905    0.46749 0.648 0.0 0.352
#> GSM381247     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381248     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381249     1  0.0000    0.92871 1.000 0.0 0.000
#> GSM381253     1  0.5431    0.62469 0.716 0.0 0.284
#> GSM381255     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381258     3  0.0237    0.89841 0.004 0.0 0.996
#> GSM381262     3  0.0237    0.89841 0.004 0.0 0.996
#> GSM381266     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381267     2  0.2959    0.89357 0.000 0.9 0.100
#> GSM381269     1  0.3752    0.83025 0.856 0.0 0.144
#> GSM381273     3  0.0000    0.89863 0.000 0.0 1.000
#> GSM381274     2  0.0000    0.99654 0.000 1.0 0.000
#> GSM381276     3  0.6252    0.21006 0.444 0.0 0.556

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM381194     3  0.5026      0.271 0.016 0.000 0.672 0.312
#> GSM381199     2  0.0188      0.976 0.000 0.996 0.004 0.000
#> GSM381205     2  0.0469      0.973 0.000 0.988 0.012 0.000
#> GSM381211     2  0.0000      0.977 0.000 1.000 0.000 0.000
#> GSM381220     2  0.0336      0.975 0.000 0.992 0.008 0.000
#> GSM381222     1  0.1474      0.858 0.948 0.000 0.052 0.000
#> GSM381224     1  0.2469      0.822 0.892 0.000 0.108 0.000
#> GSM381232     4  0.2662      0.755 0.016 0.000 0.084 0.900
#> GSM381240     1  0.1302      0.860 0.956 0.000 0.044 0.000
#> GSM381250     3  0.6586      0.221 0.088 0.000 0.544 0.368
#> GSM381252     2  0.0000      0.977 0.000 1.000 0.000 0.000
#> GSM381254     1  0.1356      0.838 0.960 0.000 0.032 0.008
#> GSM381256     2  0.0000      0.977 0.000 1.000 0.000 0.000
#> GSM381257     3  0.5781      0.280 0.484 0.000 0.488 0.028
#> GSM381259     1  0.2011      0.845 0.920 0.000 0.080 0.000
#> GSM381260     3  0.4932      0.664 0.240 0.000 0.728 0.032
#> GSM381261     2  0.1474      0.954 0.000 0.948 0.052 0.000
#> GSM381263     3  0.4804      0.554 0.072 0.000 0.780 0.148
#> GSM381265     1  0.1576      0.859 0.948 0.000 0.048 0.004
#> GSM381268     4  0.4599      0.715 0.016 0.000 0.248 0.736
#> GSM381270     2  0.0000      0.977 0.000 1.000 0.000 0.000
#> GSM381271     4  0.1042      0.768 0.008 0.000 0.020 0.972
#> GSM381275     2  0.1211      0.962 0.000 0.960 0.040 0.000
#> GSM381279     2  0.0707      0.972 0.000 0.980 0.020 0.000
#> GSM381195     1  0.1489      0.859 0.952 0.000 0.044 0.004
#> GSM381196     4  0.6400      0.283 0.068 0.000 0.408 0.524
#> GSM381198     2  0.0000      0.977 0.000 1.000 0.000 0.000
#> GSM381200     2  0.0336      0.976 0.000 0.992 0.008 0.000
#> GSM381201     4  0.4328      0.726 0.008 0.000 0.244 0.748
#> GSM381203     3  0.7389      0.460 0.212 0.000 0.516 0.272
#> GSM381204     1  0.3610      0.706 0.800 0.000 0.200 0.000
#> GSM381209     1  0.3074      0.774 0.848 0.000 0.152 0.000
#> GSM381212     1  0.1211      0.861 0.960 0.000 0.040 0.000
#> GSM381213     2  0.0707      0.972 0.000 0.980 0.020 0.000
#> GSM381214     2  0.0000      0.977 0.000 1.000 0.000 0.000
#> GSM381216     3  0.4567      0.655 0.244 0.000 0.740 0.016
#> GSM381225     4  0.4826      0.708 0.020 0.000 0.264 0.716
#> GSM381231     4  0.0592      0.763 0.000 0.000 0.016 0.984
#> GSM381235     3  0.6009      0.332 0.468 0.000 0.492 0.040
#> GSM381237     1  0.1389      0.859 0.952 0.000 0.048 0.000
#> GSM381241     2  0.0188      0.976 0.000 0.996 0.004 0.000
#> GSM381243     2  0.0188      0.976 0.000 0.996 0.004 0.000
#> GSM381245     1  0.1474      0.822 0.948 0.000 0.052 0.000
#> GSM381246     2  0.0921      0.969 0.000 0.972 0.028 0.000
#> GSM381251     4  0.4456      0.701 0.004 0.000 0.280 0.716
#> GSM381264     1  0.0188      0.855 0.996 0.000 0.004 0.000
#> GSM381206     2  0.0000      0.977 0.000 1.000 0.000 0.000
#> GSM381217     3  0.5047      0.616 0.316 0.000 0.668 0.016
#> GSM381218     2  0.0188      0.976 0.000 0.996 0.004 0.000
#> GSM381226     2  0.0188      0.977 0.000 0.996 0.004 0.000
#> GSM381227     2  0.0188      0.977 0.000 0.996 0.004 0.000
#> GSM381228     4  0.0188      0.757 0.000 0.000 0.004 0.996
#> GSM381236     4  0.1452      0.752 0.036 0.000 0.008 0.956
#> GSM381244     1  0.2635      0.834 0.904 0.000 0.076 0.020
#> GSM381272     4  0.1042      0.768 0.008 0.000 0.020 0.972
#> GSM381277     1  0.1356      0.838 0.960 0.000 0.032 0.008
#> GSM381278     4  0.1661      0.772 0.004 0.000 0.052 0.944
#> GSM381197     3  0.6207     -0.129 0.052 0.000 0.496 0.452
#> GSM381202     3  0.4748      0.639 0.268 0.000 0.716 0.016
#> GSM381207     1  0.0895      0.850 0.976 0.000 0.004 0.020
#> GSM381208     2  0.4261      0.819 0.000 0.820 0.112 0.068
#> GSM381210     1  0.3873      0.655 0.772 0.000 0.228 0.000
#> GSM381215     4  0.7066      0.286 0.152 0.000 0.304 0.544
#> GSM381219     2  0.0336      0.976 0.000 0.992 0.008 0.000
#> GSM381221     2  0.0000      0.977 0.000 1.000 0.000 0.000
#> GSM381223     2  0.0921      0.969 0.000 0.972 0.028 0.000
#> GSM381229     4  0.3610      0.747 0.000 0.000 0.200 0.800
#> GSM381230     1  0.0336      0.849 0.992 0.000 0.008 0.000
#> GSM381233     1  0.0592      0.858 0.984 0.000 0.016 0.000
#> GSM381234     1  0.2466      0.781 0.900 0.000 0.096 0.004
#> GSM381238     4  0.1452      0.752 0.036 0.000 0.008 0.956
#> GSM381239     4  0.3441      0.651 0.120 0.000 0.024 0.856
#> GSM381242     3  0.5137      0.616 0.296 0.000 0.680 0.024
#> GSM381247     2  0.0336      0.976 0.000 0.992 0.008 0.000
#> GSM381248     1  0.3166      0.752 0.868 0.000 0.116 0.016
#> GSM381249     1  0.4679      0.365 0.648 0.000 0.352 0.000
#> GSM381253     1  0.7359     -0.155 0.508 0.000 0.188 0.304
#> GSM381255     2  0.0336      0.976 0.000 0.992 0.008 0.000
#> GSM381258     3  0.5632      0.542 0.092 0.000 0.712 0.196
#> GSM381262     4  0.4978      0.628 0.012 0.000 0.324 0.664
#> GSM381266     4  0.3401      0.766 0.008 0.000 0.152 0.840
#> GSM381267     2  0.5613      0.682 0.000 0.724 0.120 0.156
#> GSM381269     3  0.5496      0.535 0.372 0.000 0.604 0.024
#> GSM381273     4  0.2589      0.769 0.000 0.000 0.116 0.884
#> GSM381274     2  0.1118      0.965 0.000 0.964 0.036 0.000
#> GSM381276     4  0.7142      0.132 0.324 0.000 0.152 0.524

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM381194     3  0.5283     0.5780 0.048 0.000 0.712 0.048 0.192
#> GSM381199     2  0.0794     0.9665 0.000 0.972 0.000 0.000 0.028
#> GSM381205     2  0.1981     0.9433 0.000 0.920 0.000 0.016 0.064
#> GSM381211     2  0.0703     0.9672 0.000 0.976 0.000 0.000 0.024
#> GSM381220     2  0.1364     0.9675 0.000 0.952 0.000 0.012 0.036
#> GSM381222     1  0.0613     0.6525 0.984 0.000 0.004 0.004 0.008
#> GSM381224     1  0.1408     0.6295 0.948 0.000 0.008 0.000 0.044
#> GSM381232     4  0.2238     0.9533 0.020 0.000 0.064 0.912 0.004
#> GSM381240     1  0.0566     0.6517 0.984 0.000 0.000 0.004 0.012
#> GSM381250     3  0.4330     0.6389 0.116 0.000 0.796 0.024 0.064
#> GSM381252     2  0.0404     0.9692 0.000 0.988 0.000 0.000 0.012
#> GSM381254     1  0.3875     0.5725 0.804 0.000 0.000 0.072 0.124
#> GSM381256     2  0.0290     0.9696 0.000 0.992 0.000 0.000 0.008
#> GSM381257     1  0.6502    -0.4886 0.560 0.000 0.160 0.020 0.260
#> GSM381259     1  0.1205     0.6403 0.956 0.000 0.000 0.004 0.040
#> GSM381260     5  0.6990     0.8127 0.400 0.000 0.172 0.024 0.404
#> GSM381261     2  0.2563     0.9096 0.000 0.872 0.000 0.008 0.120
#> GSM381263     3  0.7281    -0.5253 0.228 0.000 0.392 0.028 0.352
#> GSM381265     1  0.0727     0.6527 0.980 0.000 0.004 0.004 0.012
#> GSM381268     3  0.3321     0.7265 0.040 0.000 0.856 0.092 0.012
#> GSM381270     2  0.1018     0.9689 0.000 0.968 0.000 0.016 0.016
#> GSM381271     4  0.2054     0.9577 0.008 0.000 0.072 0.916 0.004
#> GSM381275     2  0.1830     0.9498 0.000 0.924 0.000 0.008 0.068
#> GSM381279     2  0.1522     0.9615 0.000 0.944 0.000 0.012 0.044
#> GSM381195     1  0.1828     0.6461 0.936 0.000 0.028 0.004 0.032
#> GSM381196     3  0.4474     0.6134 0.140 0.000 0.780 0.024 0.056
#> GSM381198     2  0.1725     0.9520 0.000 0.936 0.000 0.020 0.044
#> GSM381200     2  0.0955     0.9690 0.000 0.968 0.000 0.004 0.028
#> GSM381201     3  0.2464     0.7272 0.016 0.000 0.888 0.096 0.000
#> GSM381203     3  0.3649     0.6288 0.152 0.000 0.808 0.000 0.040
#> GSM381204     1  0.3419     0.4455 0.804 0.000 0.016 0.000 0.180
#> GSM381209     1  0.2011     0.5979 0.908 0.000 0.004 0.000 0.088
#> GSM381212     1  0.0703     0.6515 0.976 0.000 0.000 0.000 0.024
#> GSM381213     2  0.1364     0.9640 0.000 0.952 0.000 0.012 0.036
#> GSM381214     2  0.0404     0.9698 0.000 0.988 0.000 0.000 0.012
#> GSM381216     5  0.6560     0.8108 0.416 0.000 0.140 0.012 0.432
#> GSM381225     3  0.2507     0.7085 0.028 0.000 0.908 0.020 0.044
#> GSM381231     4  0.1830     0.9590 0.008 0.000 0.068 0.924 0.000
#> GSM381235     3  0.4323     0.4854 0.240 0.000 0.728 0.004 0.028
#> GSM381237     1  0.0451     0.6532 0.988 0.000 0.000 0.004 0.008
#> GSM381241     2  0.0609     0.9677 0.000 0.980 0.000 0.000 0.020
#> GSM381243     2  0.1399     0.9678 0.000 0.952 0.000 0.020 0.028
#> GSM381245     1  0.3343     0.5756 0.812 0.000 0.000 0.016 0.172
#> GSM381246     2  0.1357     0.9618 0.000 0.948 0.000 0.004 0.048
#> GSM381251     3  0.1901     0.7273 0.012 0.000 0.928 0.056 0.004
#> GSM381264     1  0.0865     0.6515 0.972 0.000 0.000 0.004 0.024
#> GSM381206     2  0.1300     0.9621 0.000 0.956 0.000 0.016 0.028
#> GSM381217     1  0.6697    -0.7290 0.460 0.000 0.224 0.004 0.312
#> GSM381218     2  0.1043     0.9632 0.000 0.960 0.000 0.000 0.040
#> GSM381226     2  0.0000     0.9698 0.000 1.000 0.000 0.000 0.000
#> GSM381227     2  0.0912     0.9680 0.000 0.972 0.000 0.016 0.012
#> GSM381228     4  0.1831     0.9483 0.004 0.000 0.076 0.920 0.000
#> GSM381236     4  0.1893     0.9481 0.048 0.000 0.024 0.928 0.000
#> GSM381244     1  0.1949     0.6291 0.932 0.000 0.040 0.016 0.012
#> GSM381272     4  0.1990     0.9594 0.008 0.000 0.068 0.920 0.004
#> GSM381277     1  0.4290     0.5150 0.756 0.000 0.004 0.196 0.044
#> GSM381278     3  0.4904     0.5798 0.024 0.000 0.704 0.240 0.032
#> GSM381197     3  0.3064     0.7043 0.052 0.000 0.880 0.024 0.044
#> GSM381202     5  0.6474     0.7930 0.424 0.000 0.128 0.012 0.436
#> GSM381207     1  0.3752     0.5297 0.780 0.000 0.004 0.200 0.016
#> GSM381208     3  0.7178     0.1984 0.000 0.344 0.448 0.040 0.168
#> GSM381210     1  0.3841     0.3869 0.780 0.000 0.032 0.000 0.188
#> GSM381215     3  0.5742     0.4228 0.228 0.000 0.664 0.052 0.056
#> GSM381219     2  0.0404     0.9696 0.000 0.988 0.000 0.000 0.012
#> GSM381221     2  0.0451     0.9701 0.000 0.988 0.000 0.004 0.008
#> GSM381223     2  0.1502     0.9572 0.000 0.940 0.000 0.004 0.056
#> GSM381229     3  0.2576     0.7124 0.008 0.000 0.900 0.056 0.036
#> GSM381230     1  0.1768     0.6367 0.924 0.000 0.000 0.004 0.072
#> GSM381233     1  0.1525     0.6516 0.948 0.000 0.012 0.004 0.036
#> GSM381234     1  0.4090     0.4930 0.716 0.000 0.000 0.016 0.268
#> GSM381238     4  0.1893     0.9481 0.048 0.000 0.024 0.928 0.000
#> GSM381239     4  0.2012     0.9363 0.060 0.000 0.020 0.920 0.000
#> GSM381242     1  0.6618    -0.8503 0.424 0.000 0.136 0.016 0.424
#> GSM381247     2  0.1300     0.9651 0.000 0.956 0.000 0.016 0.028
#> GSM381248     1  0.4919     0.4334 0.652 0.000 0.004 0.040 0.304
#> GSM381249     1  0.4650     0.0675 0.684 0.000 0.032 0.004 0.280
#> GSM381253     1  0.5584    -0.0555 0.628 0.000 0.292 0.020 0.060
#> GSM381255     2  0.1018     0.9678 0.000 0.968 0.000 0.016 0.016
#> GSM381258     5  0.7735     0.6223 0.296 0.000 0.324 0.052 0.328
#> GSM381262     3  0.3138     0.7223 0.032 0.000 0.876 0.060 0.032
#> GSM381266     3  0.4000     0.6869 0.020 0.000 0.784 0.180 0.016
#> GSM381267     3  0.5494     0.5362 0.000 0.132 0.716 0.044 0.108
#> GSM381269     1  0.6585    -0.6367 0.512 0.000 0.152 0.016 0.320
#> GSM381273     3  0.3934     0.6720 0.008 0.000 0.792 0.168 0.032
#> GSM381274     2  0.1830     0.9498 0.000 0.924 0.000 0.008 0.068
#> GSM381276     1  0.7099    -0.1508 0.464 0.000 0.320 0.184 0.032

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM381194     3  0.5068     0.5878 0.028 0.000 0.708 0.012 0.164 NA
#> GSM381199     2  0.0713     0.9004 0.000 0.972 0.000 0.000 0.000 NA
#> GSM381205     2  0.3109     0.7838 0.000 0.772 0.000 0.000 0.004 NA
#> GSM381211     2  0.1610     0.8820 0.000 0.916 0.000 0.000 0.000 NA
#> GSM381220     2  0.1738     0.8996 0.000 0.928 0.000 0.016 0.004 NA
#> GSM381222     1  0.3504     0.5724 0.776 0.000 0.024 0.000 0.196 NA
#> GSM381224     1  0.3222     0.5945 0.844 0.000 0.024 0.000 0.096 NA
#> GSM381232     4  0.2957     0.9076 0.008 0.000 0.020 0.860 0.100 NA
#> GSM381240     1  0.2573     0.6002 0.864 0.000 0.000 0.000 0.112 NA
#> GSM381250     3  0.5235     0.4948 0.084 0.000 0.620 0.020 0.276 NA
#> GSM381252     2  0.0260     0.9002 0.000 0.992 0.000 0.000 0.000 NA
#> GSM381254     1  0.4359     0.5840 0.784 0.000 0.020 0.032 0.108 NA
#> GSM381256     2  0.1007     0.9016 0.000 0.956 0.000 0.000 0.000 NA
#> GSM381257     5  0.5596     0.5999 0.260 0.000 0.120 0.024 0.596 NA
#> GSM381259     1  0.4731     0.2226 0.532 0.000 0.008 0.000 0.428 NA
#> GSM381260     5  0.7553     0.5766 0.224 0.000 0.172 0.008 0.412 NA
#> GSM381261     2  0.4559     0.6514 0.000 0.628 0.000 0.004 0.044 NA
#> GSM381263     3  0.6936     0.1480 0.092 0.000 0.452 0.012 0.332 NA
#> GSM381265     1  0.5209     0.3395 0.564 0.000 0.032 0.004 0.368 NA
#> GSM381268     3  0.4430     0.6167 0.084 0.000 0.748 0.024 0.144 NA
#> GSM381270     2  0.1444     0.8958 0.000 0.928 0.000 0.000 0.000 NA
#> GSM381271     4  0.2715     0.8932 0.000 0.000 0.024 0.860 0.112 NA
#> GSM381275     2  0.3570     0.7914 0.000 0.752 0.000 0.004 0.016 NA
#> GSM381279     2  0.2613     0.8644 0.000 0.848 0.000 0.012 0.000 NA
#> GSM381195     1  0.5170     0.4373 0.612 0.000 0.032 0.000 0.304 NA
#> GSM381196     3  0.5089     0.5408 0.108 0.000 0.660 0.016 0.216 NA
#> GSM381198     2  0.2278     0.8591 0.000 0.868 0.000 0.004 0.000 NA
#> GSM381200     2  0.1753     0.8855 0.000 0.912 0.000 0.004 0.000 NA
#> GSM381201     3  0.4834     0.6065 0.024 0.000 0.708 0.076 0.188 NA
#> GSM381203     3  0.4710     0.5497 0.104 0.000 0.684 0.004 0.208 NA
#> GSM381204     1  0.4315     0.0510 0.492 0.000 0.004 0.000 0.492 NA
#> GSM381209     1  0.4242     0.2043 0.536 0.000 0.000 0.000 0.448 NA
#> GSM381212     1  0.3534     0.5351 0.740 0.000 0.000 0.000 0.244 NA
#> GSM381213     2  0.1594     0.8995 0.000 0.932 0.000 0.016 0.000 NA
#> GSM381214     2  0.0937     0.8966 0.000 0.960 0.000 0.000 0.000 NA
#> GSM381216     5  0.5547     0.6227 0.168 0.000 0.048 0.008 0.668 NA
#> GSM381225     3  0.3867     0.5542 0.176 0.000 0.768 0.000 0.008 NA
#> GSM381231     4  0.0976     0.9357 0.000 0.000 0.008 0.968 0.016 NA
#> GSM381235     3  0.4938     0.3708 0.344 0.000 0.596 0.000 0.024 NA
#> GSM381237     1  0.2491     0.5923 0.836 0.000 0.000 0.000 0.164 NA
#> GSM381241     2  0.0790     0.8977 0.000 0.968 0.000 0.000 0.000 NA
#> GSM381243     2  0.2255     0.8882 0.000 0.892 0.000 0.016 0.004 NA
#> GSM381245     1  0.2849     0.5545 0.876 0.000 0.016 0.004 0.044 NA
#> GSM381246     2  0.1204     0.9016 0.000 0.944 0.000 0.000 0.000 NA
#> GSM381251     3  0.2619     0.6442 0.008 0.000 0.884 0.032 0.072 NA
#> GSM381264     1  0.5020     0.4214 0.616 0.000 0.028 0.000 0.312 NA
#> GSM381206     2  0.2527     0.8344 0.000 0.832 0.000 0.000 0.000 NA
#> GSM381217     5  0.5658     0.6164 0.252 0.000 0.156 0.008 0.580 NA
#> GSM381218     2  0.1501     0.8869 0.000 0.924 0.000 0.000 0.000 NA
#> GSM381226     2  0.0260     0.9014 0.000 0.992 0.000 0.000 0.000 NA
#> GSM381227     2  0.1501     0.8954 0.000 0.924 0.000 0.000 0.000 NA
#> GSM381228     4  0.0914     0.9382 0.000 0.000 0.016 0.968 0.016 NA
#> GSM381236     4  0.1026     0.9393 0.008 0.000 0.004 0.968 0.012 NA
#> GSM381244     1  0.3951     0.5776 0.816 0.000 0.052 0.012 0.072 NA
#> GSM381272     4  0.2373     0.9160 0.004 0.000 0.024 0.888 0.084 NA
#> GSM381277     1  0.3078     0.5553 0.864 0.000 0.016 0.032 0.012 NA
#> GSM381278     3  0.5455     0.4604 0.248 0.000 0.636 0.048 0.004 NA
#> GSM381197     3  0.5593     0.4033 0.060 0.000 0.560 0.036 0.340 NA
#> GSM381202     5  0.5776     0.6400 0.208 0.000 0.052 0.004 0.628 NA
#> GSM381207     1  0.5004     0.5508 0.728 0.000 0.032 0.100 0.124 NA
#> GSM381208     2  0.6617     0.3237 0.000 0.460 0.140 0.036 0.016 NA
#> GSM381210     1  0.4412     0.0367 0.500 0.000 0.008 0.000 0.480 NA
#> GSM381215     3  0.6098     0.2707 0.156 0.000 0.516 0.028 0.300 NA
#> GSM381219     2  0.0260     0.9007 0.000 0.992 0.000 0.000 0.000 NA
#> GSM381221     2  0.0260     0.9015 0.000 0.992 0.000 0.000 0.000 NA
#> GSM381223     2  0.1910     0.8841 0.000 0.892 0.000 0.000 0.000 NA
#> GSM381229     3  0.1370     0.6349 0.036 0.000 0.948 0.004 0.000 NA
#> GSM381230     1  0.1970     0.6047 0.912 0.000 0.000 0.000 0.060 NA
#> GSM381233     1  0.2519     0.6106 0.888 0.000 0.020 0.000 0.072 NA
#> GSM381234     1  0.3260     0.5485 0.848 0.000 0.028 0.000 0.056 NA
#> GSM381238     4  0.0653     0.9402 0.004 0.000 0.004 0.980 0.012 NA
#> GSM381239     4  0.1294     0.9272 0.024 0.000 0.004 0.956 0.008 NA
#> GSM381242     5  0.7511     0.5259 0.260 0.000 0.120 0.008 0.388 NA
#> GSM381247     2  0.2100     0.8815 0.000 0.884 0.000 0.004 0.000 NA
#> GSM381248     1  0.4699     0.4748 0.760 0.000 0.044 0.016 0.072 NA
#> GSM381249     5  0.4306    -0.0120 0.464 0.000 0.004 0.000 0.520 NA
#> GSM381253     1  0.6376    -0.2901 0.368 0.000 0.348 0.012 0.272 NA
#> GSM381255     2  0.1327     0.8980 0.000 0.936 0.000 0.000 0.000 NA
#> GSM381258     5  0.6042     0.3339 0.124 0.000 0.296 0.032 0.544 NA
#> GSM381262     3  0.2920     0.6541 0.040 0.000 0.864 0.016 0.080 NA
#> GSM381266     3  0.3317     0.6486 0.036 0.000 0.852 0.072 0.032 NA
#> GSM381267     3  0.7238     0.1119 0.000 0.304 0.380 0.036 0.028 NA
#> GSM381269     5  0.5234     0.6200 0.240 0.000 0.088 0.020 0.648 NA
#> GSM381273     3  0.3530     0.6212 0.056 0.000 0.840 0.064 0.008 NA
#> GSM381274     2  0.3259     0.8075 0.000 0.772 0.000 0.000 0.012 NA
#> GSM381276     1  0.5752     0.1881 0.560 0.000 0.328 0.020 0.016 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 other(p) k
#> ATC:NMF 86    0.744 2
#> ATC:NMF 82    0.914 3
#> ATC:NMF 75    0.863 4
#> ATC:NMF 71    0.684 5
#> ATC:NMF 66    0.695 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