cola Report for GDS4379

Date: 2019-12-25 21:32:11 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 62 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    62

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:kmeans 2 1.000 0.976 0.982 **
CV:kmeans 2 1.000 0.977 0.988 **
MAD:kmeans 2 1.000 0.982 0.992 **
MAD:skmeans 3 1.000 0.962 0.980 ** 2
ATC:skmeans 2 1.000 0.982 0.992 **
ATC:pam 2 1.000 0.971 0.982 **
CV:skmeans 3 0.980 0.933 0.967 ** 2
SD:skmeans 3 0.978 0.952 0.979 ** 2
MAD:mclust 3 0.951 0.923 0.969 **
SD:mclust 3 0.938 0.897 0.942 *
CV:NMF 2 0.933 0.963 0.982 *
SD:NMF 2 0.932 0.959 0.981 *
MAD:NMF 2 0.932 0.954 0.979 *
ATC:kmeans 2 0.914 0.961 0.981 *
CV:mclust 2 0.861 0.927 0.966
SD:pam 2 0.835 0.841 0.936
ATC:NMF 2 0.771 0.831 0.933
CV:pam 2 0.701 0.854 0.931
MAD:hclust 2 0.628 0.868 0.920
MAD:pam 2 0.601 0.836 0.914
CV:hclust 5 0.565 0.708 0.804
ATC:hclust 3 0.553 0.782 0.838
SD:hclust 3 0.462 0.728 0.860
ATC:mclust 3 0.230 0.643 0.769

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 0.932           0.959       0.981          0.507 0.492   0.492
#> CV:NMF      2 0.933           0.963       0.982          0.508 0.492   0.492
#> MAD:NMF     2 0.932           0.954       0.979          0.506 0.494   0.494
#> ATC:NMF     2 0.771           0.831       0.933          0.492 0.497   0.497
#> SD:skmeans  2 1.000           0.985       0.993          0.509 0.492   0.492
#> CV:skmeans  2 1.000           0.983       0.993          0.509 0.492   0.492
#> MAD:skmeans 2 1.000           0.973       0.989          0.508 0.492   0.492
#> ATC:skmeans 2 1.000           0.982       0.992          0.509 0.492   0.492
#> SD:mclust   2 0.876           0.915       0.964          0.490 0.511   0.511
#> CV:mclust   2 0.861           0.927       0.966          0.478 0.526   0.526
#> MAD:mclust  2 0.541           0.862       0.915          0.472 0.500   0.500
#> ATC:mclust  2 0.331           0.669       0.829          0.379 0.645   0.645
#> SD:kmeans   2 1.000           0.976       0.982          0.505 0.492   0.492
#> CV:kmeans   2 1.000           0.977       0.988          0.508 0.492   0.492
#> MAD:kmeans  2 1.000           0.982       0.992          0.508 0.492   0.492
#> ATC:kmeans  2 0.914           0.961       0.981          0.505 0.492   0.492
#> SD:pam      2 0.835           0.841       0.936          0.428 0.545   0.545
#> CV:pam      2 0.701           0.854       0.931          0.429 0.581   0.581
#> MAD:pam     2 0.601           0.836       0.914          0.425 0.627   0.627
#> ATC:pam     2 1.000           0.971       0.982          0.436 0.568   0.568
#> SD:hclust   2 0.380           0.759       0.800          0.387 0.494   0.494
#> CV:hclust   2 0.408           0.780       0.794          0.361 0.492   0.492
#> MAD:hclust  2 0.628           0.868       0.920          0.474 0.492   0.492
#> ATC:hclust  2 0.474           0.701       0.873          0.409 0.545   0.545
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.860           0.872       0.948          0.292 0.801   0.617
#> CV:NMF      3 0.745           0.876       0.941          0.293 0.801   0.617
#> MAD:NMF     3 0.884           0.884       0.945          0.282 0.775   0.574
#> ATC:NMF     3 0.719           0.793       0.902          0.278 0.835   0.679
#> SD:skmeans  3 0.978           0.952       0.979          0.311 0.773   0.568
#> CV:skmeans  3 0.980           0.933       0.967          0.314 0.769   0.562
#> MAD:skmeans 3 1.000           0.962       0.980          0.306 0.791   0.597
#> ATC:skmeans 3 0.763           0.740       0.875          0.231 0.903   0.802
#> SD:mclust   3 0.938           0.897       0.942          0.331 0.775   0.577
#> CV:mclust   3 0.537           0.824       0.769          0.252 0.777   0.585
#> MAD:mclust  3 0.951           0.923       0.969          0.406 0.773   0.572
#> ATC:mclust  3 0.230           0.643       0.769          0.468 0.685   0.548
#> SD:kmeans   3 0.534           0.663       0.828          0.256 0.879   0.758
#> CV:kmeans   3 0.511           0.673       0.825          0.254 0.864   0.728
#> MAD:kmeans  3 0.567           0.767       0.855          0.282 0.791   0.597
#> ATC:kmeans  3 0.670           0.773       0.902          0.273 0.708   0.494
#> SD:pam      3 0.682           0.798       0.905          0.361 0.846   0.722
#> CV:pam      3 0.712           0.811       0.919          0.350 0.833   0.713
#> MAD:pam     3 0.476           0.742       0.844          0.405 0.835   0.737
#> ATC:pam     3 0.829           0.828       0.935          0.454 0.668   0.474
#> SD:hclust   3 0.462           0.728       0.860          0.446 0.870   0.757
#> CV:hclust   3 0.373           0.688       0.842          0.536 0.877   0.760
#> MAD:hclust  3 0.641           0.791       0.891          0.216 0.941   0.880
#> ATC:hclust  3 0.553           0.782       0.838          0.430 0.729   0.557
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.739           0.776       0.903        0.11309 0.795   0.500
#> CV:NMF      4 0.805           0.822       0.922        0.11180 0.813   0.533
#> MAD:NMF     4 0.796           0.836       0.912        0.12485 0.918   0.765
#> ATC:NMF     4 0.577           0.677       0.821        0.17352 0.847   0.606
#> SD:skmeans  4 0.792           0.744       0.833        0.09789 0.929   0.791
#> CV:skmeans  4 0.803           0.819       0.852        0.10636 0.875   0.646
#> MAD:skmeans 4 0.733           0.575       0.773        0.10145 0.896   0.708
#> ATC:skmeans 4 0.744           0.760       0.868        0.11612 0.884   0.714
#> SD:mclust   4 0.526           0.410       0.717        0.00828 0.718   0.390
#> CV:mclust   4 0.563           0.548       0.704        0.08480 0.707   0.452
#> MAD:mclust  4 0.790           0.743       0.866        0.06530 0.870   0.651
#> ATC:mclust  4 0.560           0.600       0.796        0.21603 0.701   0.451
#> SD:kmeans   4 0.583           0.465       0.654        0.11799 0.789   0.511
#> CV:kmeans   4 0.566           0.539       0.700        0.11752 0.825   0.569
#> MAD:kmeans  4 0.580           0.587       0.718        0.10731 0.924   0.799
#> ATC:kmeans  4 0.645           0.686       0.836        0.13677 0.813   0.537
#> SD:pam      4 0.600           0.642       0.829        0.16699 0.873   0.704
#> CV:pam      4 0.528           0.562       0.790        0.13738 0.876   0.718
#> MAD:pam     4 0.545           0.602       0.809        0.21263 0.704   0.421
#> ATC:pam     4 0.797           0.783       0.897        0.15410 0.821   0.559
#> SD:hclust   4 0.558           0.742       0.886        0.11774 0.945   0.877
#> CV:hclust   4 0.525           0.760       0.866        0.12127 0.966   0.916
#> MAD:hclust  4 0.577           0.666       0.836        0.13358 0.957   0.901
#> ATC:hclust  4 0.589           0.564       0.782        0.18974 0.869   0.679
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.758           0.725       0.871         0.0858 0.828   0.469
#> CV:NMF      5 0.745           0.777       0.880         0.0876 0.840   0.498
#> MAD:NMF     5 0.703           0.661       0.838         0.0878 0.859   0.551
#> ATC:NMF     5 0.561           0.531       0.721         0.0562 0.905   0.658
#> SD:skmeans  5 0.827           0.800       0.894         0.0776 0.903   0.673
#> CV:skmeans  5 0.823           0.802       0.886         0.0704 0.955   0.823
#> MAD:skmeans 5 0.771           0.779       0.856         0.0756 0.846   0.524
#> ATC:skmeans 5 0.737           0.697       0.859         0.0602 0.956   0.856
#> SD:mclust   5 0.768           0.763       0.856         0.1688 0.804   0.463
#> CV:mclust   5 0.771           0.717       0.888         0.1703 0.696   0.379
#> MAD:mclust  5 0.842           0.759       0.869         0.0932 0.901   0.675
#> ATC:mclust  5 0.615           0.465       0.739         0.1018 0.843   0.589
#> SD:kmeans   5 0.673           0.715       0.833         0.0841 0.907   0.686
#> CV:kmeans   5 0.699           0.734       0.847         0.0852 0.896   0.644
#> MAD:kmeans  5 0.652           0.674       0.793         0.0740 0.852   0.583
#> ATC:kmeans  5 0.712           0.657       0.811         0.0732 0.912   0.682
#> SD:pam      5 0.698           0.667       0.854         0.0717 0.953   0.857
#> CV:pam      5 0.657           0.669       0.846         0.0949 0.898   0.720
#> MAD:pam     5 0.613           0.486       0.752         0.0488 0.958   0.848
#> ATC:pam     5 0.818           0.704       0.841         0.0531 0.877   0.591
#> SD:hclust   5 0.570           0.694       0.841         0.1422 0.881   0.706
#> CV:hclust   5 0.565           0.708       0.804         0.1478 0.895   0.725
#> MAD:hclust  5 0.631           0.704       0.845         0.1143 0.905   0.756
#> ATC:hclust  5 0.618           0.622       0.758         0.0720 0.852   0.561
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.689           0.627       0.773         0.0415 0.924   0.673
#> CV:NMF      6 0.722           0.648       0.810         0.0445 0.923   0.668
#> MAD:NMF     6 0.690           0.621       0.757         0.0421 0.948   0.760
#> ATC:NMF     6 0.590           0.531       0.740         0.0355 0.918   0.656
#> SD:skmeans  6 0.803           0.670       0.830         0.0419 0.961   0.826
#> CV:skmeans  6 0.798           0.658       0.836         0.0407 0.959   0.819
#> MAD:skmeans 6 0.754           0.634       0.810         0.0413 0.941   0.749
#> ATC:skmeans 6 0.787           0.640       0.832         0.0370 0.946   0.810
#> SD:mclust   6 0.854           0.817       0.909         0.0333 0.930   0.717
#> CV:mclust   6 0.780           0.746       0.862         0.0463 0.951   0.793
#> MAD:mclust  6 0.875           0.844       0.905         0.0244 0.979   0.908
#> ATC:mclust  6 0.684           0.625       0.791         0.0689 0.846   0.481
#> SD:kmeans   6 0.711           0.696       0.793         0.0558 0.955   0.806
#> CV:kmeans   6 0.750           0.704       0.811         0.0497 0.964   0.840
#> MAD:kmeans  6 0.675           0.601       0.759         0.0545 0.965   0.850
#> ATC:kmeans  6 0.708           0.541       0.692         0.0410 0.903   0.603
#> SD:pam      6 0.721           0.611       0.830         0.0490 0.910   0.703
#> CV:pam      6 0.659           0.591       0.828         0.0544 0.893   0.660
#> MAD:pam     6 0.650           0.403       0.676         0.0524 0.870   0.545
#> ATC:pam     6 0.757           0.607       0.788         0.0340 0.934   0.718
#> SD:hclust   6 0.655           0.647       0.776         0.0576 0.993   0.975
#> CV:hclust   6 0.627           0.577       0.782         0.0694 0.976   0.912
#> MAD:hclust  6 0.701           0.692       0.833         0.0624 0.925   0.759
#> ATC:hclust  6 0.661           0.603       0.769         0.0513 0.896   0.622

Following heatmap plots the partition for each combination of methods and the lightness correspond to the silhouette scores for samples in each method. On top the consensus subgroup is inferred from all methods by taking the mean silhouette scores as weight.

collect_stats(res_list, k = 2)

plot of chunk tab-collect-stats-from-consensus-partition-list-1

collect_stats(res_list, k = 3)

plot of chunk tab-collect-stats-from-consensus-partition-list-2

collect_stats(res_list, k = 4)

plot of chunk tab-collect-stats-from-consensus-partition-list-3

collect_stats(res_list, k = 5)

plot of chunk tab-collect-stats-from-consensus-partition-list-4

collect_stats(res_list, k = 6)

plot of chunk tab-collect-stats-from-consensus-partition-list-5

Partition from all methods

Collect partitions from all methods:

collect_classes(res_list, k = 2)

plot of chunk tab-collect-classes-from-consensus-partition-list-1

collect_classes(res_list, k = 3)

plot of chunk tab-collect-classes-from-consensus-partition-list-2

collect_classes(res_list, k = 4)

plot of chunk tab-collect-classes-from-consensus-partition-list-3

collect_classes(res_list, k = 5)

plot of chunk tab-collect-classes-from-consensus-partition-list-4

collect_classes(res_list, k = 6)

plot of chunk tab-collect-classes-from-consensus-partition-list-5

Top rows overlap

Overlap of top rows from different top-row methods:

top_rows_overlap(res_list, top_n = 1000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-1

top_rows_overlap(res_list, top_n = 2000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-2

top_rows_overlap(res_list, top_n = 3000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-3

top_rows_overlap(res_list, top_n = 4000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-4

top_rows_overlap(res_list, top_n = 5000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-5

Also visualize the correspondance of rankings between different top-row methods:

top_rows_overlap(res_list, top_n = 1000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-1

top_rows_overlap(res_list, top_n = 2000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-2

top_rows_overlap(res_list, top_n = 3000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-3

top_rows_overlap(res_list, top_n = 4000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-4

top_rows_overlap(res_list, top_n = 5000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-5

Heatmaps of the top rows:

top_rows_heatmap(res_list, top_n = 1000)

plot of chunk tab-top-rows-heatmap-1

top_rows_heatmap(res_list, top_n = 2000)

plot of chunk tab-top-rows-heatmap-2

top_rows_heatmap(res_list, top_n = 3000)

plot of chunk tab-top-rows-heatmap-3

top_rows_heatmap(res_list, top_n = 4000)

plot of chunk tab-top-rows-heatmap-4

top_rows_heatmap(res_list, top_n = 5000)

plot of chunk tab-top-rows-heatmap-5

Test to known annotations

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

test_to_known_factors(res_list, k = 2)
#>              n disease.state(p) genotype/variation(p) other(p) k
#> SD:NMF      62            0.684                0.5466 2.24e-08 2
#> CV:NMF      62            0.684                0.5466 2.24e-08 2
#> MAD:NMF     62            0.425                0.5399 8.26e-08 2
#> ATC:NMF     54            0.188                0.3887 5.63e-06 2
#> SD:skmeans  62            0.219                0.5296 7.89e-08 2
#> CV:skmeans  62            0.219                0.5296 7.89e-08 2
#> MAD:skmeans 61            0.199                0.5482 1.14e-07 2
#> ATC:skmeans 62            0.219                0.5296 7.89e-08 2
#> SD:mclust   59            0.170                0.1301 2.28e-08 2
#> CV:mclust   62            0.158                0.0919 8.91e-07 2
#> MAD:mclust  60            0.243                0.1417 1.63e-08 2
#> ATC:mclust  55            0.794                0.0723 3.46e-03 2
#> SD:kmeans   62            0.219                0.5296 7.89e-08 2
#> CV:kmeans   62            0.219                0.5296 7.89e-08 2
#> MAD:kmeans  62            0.224                0.5665 1.86e-07 2
#> ATC:kmeans  61            0.222                0.5482 1.14e-07 2
#> SD:pam      54            0.722                0.6810 1.50e-08 2
#> CV:pam      57            0.728                0.6512 7.18e-07 2
#> MAD:pam     59            0.791                0.6301 8.48e-07 2
#> ATC:pam     62            0.750                0.7226 8.81e-06 2
#> SD:hclust   59            0.216                0.5894 6.61e-07 2
#> CV:hclust   58            0.212                0.6048 7.12e-07 2
#> MAD:hclust  59            0.321                0.6210 1.03e-07 2
#> ATC:hclust  53            0.375                0.7156 3.81e-07 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) genotype/variation(p) other(p) k
#> SD:NMF      59         1.72e-01               0.31257 2.65e-11 3
#> CV:NMF      60         7.40e-02               0.32248 3.00e-10 3
#> MAD:NMF     59         1.00e-01               0.31403 4.69e-12 3
#> ATC:NMF     56         8.39e-02               0.00826 6.86e-08 3
#> SD:skmeans  61         8.83e-02               0.02748 2.39e-12 3
#> CV:skmeans  60         8.51e-02               0.03966 3.81e-13 3
#> MAD:skmeans 62         8.03e-02               0.02468 6.48e-12 3
#> ATC:skmeans 52         7.12e-02               0.87261 2.33e-06 3
#> SD:mclust   58         5.98e-01               0.22125 6.21e-13 3
#> CV:mclust   58         4.58e-01               0.19477 3.25e-11 3
#> MAD:mclust  60         5.67e-01               0.19562 1.57e-13 3
#> ATC:mclust  52         9.23e-01               0.25688 4.98e-08 3
#> SD:kmeans   48         4.51e-09               0.71099 3.52e-06 3
#> CV:kmeans   55         1.60e-01               0.01815 2.40e-08 3
#> MAD:kmeans  57         2.47e-02               0.02072 5.97e-10 3
#> ATC:kmeans  53         5.39e-01               0.60729 6.61e-08 3
#> SD:pam      54         5.80e-02               0.79266 5.83e-11 3
#> CV:pam      57         5.11e-02               0.80561 3.93e-10 3
#> MAD:pam     57         8.02e-02               0.68904 4.50e-11 3
#> ATC:pam     56         5.54e-01               0.67229 1.96e-08 3
#> SD:hclust   54         1.83e-01               0.51298 5.82e-06 3
#> CV:hclust   49         2.97e-01               0.63491 8.38e-06 3
#> MAD:hclust  57         2.70e-01               0.20484 1.78e-07 3
#> ATC:hclust  58         2.43e-01               0.80568 1.17e-08 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) genotype/variation(p) other(p) k
#> SD:NMF      56           0.2423              0.001516 1.84e-12 4
#> CV:NMF      59           0.1903              0.002851 3.54e-13 4
#> MAD:NMF     58           0.3407              0.000869 2.06e-13 4
#> ATC:NMF     51           0.1437              0.040898 3.08e-09 4
#> SD:skmeans  57           0.0283              0.006366 5.60e-14 4
#> CV:skmeans  57           0.2109              0.019378 2.44e-18 4
#> MAD:skmeans 40           1.0000              0.350902 1.49e-05 4
#> ATC:skmeans 56           0.4253              0.008334 1.26e-13 4
#> SD:mclust   36           0.4372              0.155639 1.17e-10 4
#> CV:mclust   36           0.2896              0.296984 1.24e-04 4
#> MAD:mclust  53           0.3063              0.452153 2.35e-14 4
#> ATC:mclust  50           0.8130              0.054727 2.56e-08 4
#> SD:kmeans   36           0.0548              0.549625 2.74e-06 4
#> CV:kmeans   45           0.1265              0.367286 4.30e-12 4
#> MAD:kmeans  50           0.0115              0.013024 9.44e-12 4
#> ATC:kmeans  48           0.2905              0.154731 1.09e-06 4
#> SD:pam      46           0.1962              0.730803 1.28e-18 4
#> CV:pam      43           0.0365              0.863691 1.25e-08 4
#> MAD:pam     48           0.2829              0.613113 2.13e-15 4
#> ATC:pam     53           0.4139              0.672367 4.77e-07 4
#> SD:hclust   54           0.5746              0.704514 1.11e-06 4
#> CV:hclust   57           0.3028              0.915559 8.65e-08 4
#> MAD:hclust  53           0.5083              0.412642 4.53e-07 4
#> ATC:hclust  41           0.2748              0.394679 2.03e-05 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) genotype/variation(p) other(p) k
#> SD:NMF      54           0.3256               0.27002 1.36e-16 5
#> CV:NMF      56           0.2786               0.25985 8.76e-17 5
#> MAD:NMF     51           0.3317               0.16006 1.47e-15 5
#> ATC:NMF     41           0.2724               0.32770 1.49e-09 5
#> SD:skmeans  55           0.1039               0.00234 1.32e-20 5
#> CV:skmeans  55           0.1039               0.00234 1.32e-20 5
#> MAD:skmeans 57           0.1768               0.01133 6.49e-22 5
#> ATC:skmeans 51           0.7140               0.00467 2.17e-11 5
#> SD:mclust   56           0.2319               0.28595 2.51e-17 5
#> CV:mclust   51           0.0596               0.14372 1.91e-14 5
#> MAD:mclust  53           0.2196               0.50468 2.23e-16 5
#> ATC:mclust  36           0.6389               0.46321 2.90e-10 5
#> SD:kmeans   53           0.0889               0.24504 1.13e-16 5
#> CV:kmeans   54           0.0943               0.11070 1.18e-17 5
#> MAD:kmeans  55           0.0971               0.02302 7.15e-16 5
#> ATC:kmeans  51           0.2496               0.03467 1.71e-07 5
#> SD:pam      47           0.0340               0.95094 9.96e-17 5
#> CV:pam      51           0.3669               0.89524 1.22e-17 5
#> MAD:pam     35           0.3573               0.52295 3.66e-15 5
#> ATC:pam     49           0.8431               0.50587 5.74e-07 5
#> SD:hclust   52           0.1352               0.77464 1.20e-10 5
#> CV:hclust   57           0.1373               0.31402 2.40e-13 5
#> MAD:hclust  52           0.0333               0.54732 3.28e-11 5
#> ATC:hclust  46           0.0102               0.67521 3.08e-08 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) genotype/variation(p) other(p) k
#> SD:NMF      45         0.317159              0.382031 2.78e-16 6
#> CV:NMF      50         0.066619              0.525988 5.35e-18 6
#> MAD:NMF     43         0.457592              0.508849 5.34e-19 6
#> ATC:NMF     43         0.102784              0.325933 1.66e-12 6
#> SD:skmeans  47         0.137522              0.010317 1.94e-18 6
#> CV:skmeans  49         0.109751              0.007621 1.22e-19 6
#> MAD:skmeans 47         0.153664              0.003399 2.62e-20 6
#> ATC:skmeans 48         0.924546              0.024491 1.34e-09 6
#> SD:mclust   56         0.014534              0.016059 4.59e-15 6
#> CV:mclust   55         0.041023              0.016116 1.10e-16 6
#> MAD:mclust  56         0.001433              0.054958 2.49e-14 6
#> ATC:mclust  47         0.017834              0.580619 2.56e-10 6
#> SD:kmeans   50         0.115912              0.347675 5.25e-17 6
#> CV:kmeans   54         0.076062              0.296765 8.68e-17 6
#> MAD:kmeans  44         0.172304              0.296958 6.79e-17 6
#> ATC:kmeans  42         0.762699              0.059025 2.10e-06 6
#> SD:pam      45         0.045648              0.844278 2.19e-16 6
#> CV:pam      48         0.347874              0.166341 2.71e-18 6
#> MAD:pam     33         0.110226              0.561064 1.62e-10 6
#> ATC:pam     42         0.687353              0.959739 5.64e-07 6
#> SD:hclust   54         0.296543              0.000967 3.02e-10 6
#> CV:hclust   42         0.015084              0.736548 2.00e-16 6
#> MAD:hclust  53         0.000239              0.595612 9.92e-12 6
#> ATC:hclust  38         0.267244              0.120345 2.35e-06 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 62 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.380           0.759       0.800         0.3867 0.494   0.494
#> 3 3 0.462           0.728       0.860         0.4458 0.870   0.757
#> 4 4 0.558           0.742       0.886         0.1177 0.945   0.877
#> 5 5 0.570           0.694       0.841         0.1422 0.881   0.706
#> 6 6 0.655           0.647       0.776         0.0576 0.993   0.975

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
#> GSM877144     1  0.9286      0.975 0.656 0.344
#> GSM877128     1  0.9286      0.975 0.656 0.344
#> GSM877164     1  0.9286      0.975 0.656 0.344
#> GSM877162     2  0.3114      0.746 0.056 0.944
#> GSM877127     2  0.9996     -0.650 0.488 0.512
#> GSM877138     1  0.9608      0.939 0.616 0.384
#> GSM877140     1  0.9608      0.939 0.616 0.384
#> GSM877156     2  0.5059      0.685 0.112 0.888
#> GSM877130     2  0.8443      0.614 0.272 0.728
#> GSM877141     2  0.3879      0.753 0.076 0.924
#> GSM877142     2  0.9286      0.561 0.344 0.656
#> GSM877145     2  0.6531      0.574 0.168 0.832
#> GSM877151     2  0.0376      0.764 0.004 0.996
#> GSM877158     2  0.8955      0.585 0.312 0.688
#> GSM877173     2  0.3733      0.755 0.072 0.928
#> GSM877176     2  0.3431      0.734 0.064 0.936
#> GSM877179     2  0.9286      0.561 0.344 0.656
#> GSM877181     2  0.3274      0.740 0.060 0.940
#> GSM877185     2  0.7950      0.634 0.240 0.760
#> GSM877131     2  0.2603      0.753 0.044 0.956
#> GSM877147     1  0.9286      0.975 0.656 0.344
#> GSM877155     2  0.6801      0.672 0.180 0.820
#> GSM877159     2  0.3114      0.746 0.056 0.944
#> GSM877170     2  0.6531      0.577 0.168 0.832
#> GSM877186     1  0.9286      0.975 0.656 0.344
#> GSM877132     2  0.4298      0.719 0.088 0.912
#> GSM877143     2  0.0672      0.765 0.008 0.992
#> GSM877146     2  0.0672      0.765 0.008 0.992
#> GSM877148     2  0.0376      0.764 0.004 0.996
#> GSM877152     2  0.0938      0.765 0.012 0.988
#> GSM877168     2  0.0938      0.765 0.012 0.988
#> GSM877180     2  0.0938      0.765 0.012 0.988
#> GSM877126     1  0.9286      0.975 0.656 0.344
#> GSM877129     1  0.9286      0.975 0.656 0.344
#> GSM877133     1  0.9552      0.949 0.624 0.376
#> GSM877153     1  0.9286      0.975 0.656 0.344
#> GSM877169     1  0.9286      0.975 0.656 0.344
#> GSM877171     1  0.9286      0.975 0.656 0.344
#> GSM877174     1  0.9286      0.975 0.656 0.344
#> GSM877134     2  0.9775     -0.428 0.412 0.588
#> GSM877135     1  0.9323      0.973 0.652 0.348
#> GSM877136     1  0.9286      0.975 0.656 0.344
#> GSM877137     1  0.9661      0.931 0.608 0.392
#> GSM877139     1  0.9661      0.931 0.608 0.392
#> GSM877149     1  0.9850      0.863 0.572 0.428
#> GSM877154     2  0.4815      0.694 0.104 0.896
#> GSM877157     1  0.9580      0.945 0.620 0.380
#> GSM877160     1  0.9286      0.975 0.656 0.344
#> GSM877161     1  0.9286      0.975 0.656 0.344
#> GSM877163     1  0.9608      0.941 0.616 0.384
#> GSM877166     1  0.9286      0.975 0.656 0.344
#> GSM877167     2  0.0938      0.765 0.012 0.988
#> GSM877175     1  0.9286      0.975 0.656 0.344
#> GSM877177     1  0.9608      0.941 0.616 0.384
#> GSM877184     2  0.9963     -0.587 0.464 0.536
#> GSM877187     2  0.2236      0.756 0.036 0.964
#> GSM877188     1  0.9286      0.975 0.656 0.344
#> GSM877150     1  0.9286      0.975 0.656 0.344
#> GSM877165     2  0.7815      0.639 0.232 0.768
#> GSM877183     2  0.5519      0.662 0.128 0.872
#> GSM877178     1  0.9286      0.975 0.656 0.344
#> GSM877182     2  0.6531      0.577 0.168 0.832

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.8436      0.976 0.108 0.324 0.568
#> GSM877128     1  0.2564      0.841 0.936 0.028 0.036
#> GSM877164     1  0.0000      0.856 1.000 0.000 0.000
#> GSM877162     2  0.2356      0.742 0.000 0.928 0.072
#> GSM877127     1  0.6598      0.130 0.564 0.428 0.008
#> GSM877138     1  0.8825      0.163 0.560 0.288 0.152
#> GSM877140     1  0.8872      0.150 0.556 0.288 0.156
#> GSM877156     2  0.3715      0.722 0.128 0.868 0.004
#> GSM877130     2  0.5785      0.552 0.004 0.696 0.300
#> GSM877141     2  0.4982      0.742 0.064 0.840 0.096
#> GSM877142     2  0.6225      0.355 0.000 0.568 0.432
#> GSM877145     2  0.4750      0.576 0.216 0.784 0.000
#> GSM877151     2  0.1163      0.787 0.028 0.972 0.000
#> GSM877158     2  0.5905      0.483 0.000 0.648 0.352
#> GSM877173     2  0.4737      0.750 0.064 0.852 0.084
#> GSM877176     2  0.3030      0.761 0.092 0.904 0.004
#> GSM877179     2  0.6225      0.355 0.000 0.568 0.432
#> GSM877181     2  0.3181      0.772 0.024 0.912 0.064
#> GSM877185     2  0.5115      0.622 0.004 0.768 0.228
#> GSM877131     2  0.2066      0.750 0.000 0.940 0.060
#> GSM877147     3  0.8436      0.976 0.108 0.324 0.568
#> GSM877155     2  0.4062      0.677 0.000 0.836 0.164
#> GSM877159     2  0.2356      0.742 0.000 0.928 0.072
#> GSM877170     2  0.4861      0.617 0.192 0.800 0.008
#> GSM877186     1  0.3896      0.814 0.888 0.052 0.060
#> GSM877132     2  0.3965      0.730 0.132 0.860 0.008
#> GSM877143     2  0.1289      0.788 0.032 0.968 0.000
#> GSM877146     2  0.1289      0.788 0.032 0.968 0.000
#> GSM877148     2  0.1163      0.787 0.028 0.972 0.000
#> GSM877152     2  0.1411      0.789 0.036 0.964 0.000
#> GSM877168     2  0.1411      0.789 0.036 0.964 0.000
#> GSM877180     2  0.1411      0.789 0.036 0.964 0.000
#> GSM877126     1  0.2564      0.841 0.936 0.028 0.036
#> GSM877129     1  0.0000      0.856 1.000 0.000 0.000
#> GSM877133     1  0.2625      0.831 0.916 0.084 0.000
#> GSM877153     3  0.8645      0.954 0.132 0.300 0.568
#> GSM877169     1  0.0424      0.861 0.992 0.008 0.000
#> GSM877171     1  0.0000      0.856 1.000 0.000 0.000
#> GSM877174     1  0.0000      0.856 1.000 0.000 0.000
#> GSM877134     1  0.5968      0.386 0.636 0.364 0.000
#> GSM877135     1  0.0592      0.861 0.988 0.012 0.000
#> GSM877136     1  0.0424      0.861 0.992 0.008 0.000
#> GSM877137     1  0.2796      0.827 0.908 0.092 0.000
#> GSM877139     1  0.2796      0.827 0.908 0.092 0.000
#> GSM877149     1  0.3941      0.758 0.844 0.156 0.000
#> GSM877154     2  0.3482      0.726 0.128 0.872 0.000
#> GSM877157     1  0.2356      0.840 0.928 0.072 0.000
#> GSM877160     1  0.0424      0.861 0.992 0.008 0.000
#> GSM877161     1  0.0424      0.861 0.992 0.008 0.000
#> GSM877163     1  0.2448      0.838 0.924 0.076 0.000
#> GSM877166     1  0.0424      0.861 0.992 0.008 0.000
#> GSM877167     2  0.1411      0.789 0.036 0.964 0.000
#> GSM877175     1  0.0424      0.861 0.992 0.008 0.000
#> GSM877177     1  0.2448      0.839 0.924 0.076 0.000
#> GSM877184     1  0.5926      0.387 0.644 0.356 0.000
#> GSM877187     2  0.2066      0.781 0.060 0.940 0.000
#> GSM877188     1  0.0424      0.861 0.992 0.008 0.000
#> GSM877150     1  0.0424      0.861 0.992 0.008 0.000
#> GSM877165     2  0.4978      0.634 0.004 0.780 0.216
#> GSM877183     2  0.4099      0.702 0.140 0.852 0.008
#> GSM877178     1  0.0000      0.856 1.000 0.000 0.000
#> GSM877182     2  0.4861      0.617 0.192 0.800 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.0336     0.9767 0.008 0.000 0.992 0.000
#> GSM877128     1  0.2311     0.8373 0.916 0.004 0.076 0.004
#> GSM877164     1  0.0672     0.8631 0.984 0.000 0.008 0.008
#> GSM877162     2  0.2408     0.7939 0.000 0.896 0.104 0.000
#> GSM877127     1  0.5630     0.2209 0.548 0.432 0.016 0.004
#> GSM877138     1  0.6930     0.3501 0.544 0.108 0.344 0.004
#> GSM877140     1  0.6943     0.3404 0.540 0.108 0.348 0.004
#> GSM877156     2  0.3052     0.8022 0.104 0.880 0.012 0.004
#> GSM877130     4  0.5000    -0.0236 0.000 0.500 0.000 0.500
#> GSM877141     2  0.4692     0.6887 0.040 0.780 0.004 0.176
#> GSM877142     4  0.0592     0.5933 0.000 0.016 0.000 0.984
#> GSM877145     2  0.3892     0.6934 0.192 0.800 0.004 0.004
#> GSM877151     2  0.0000     0.8319 0.000 1.000 0.000 0.000
#> GSM877158     4  0.3123     0.6056 0.000 0.156 0.000 0.844
#> GSM877173     2  0.4167     0.7383 0.040 0.824 0.004 0.132
#> GSM877176     2  0.2310     0.8232 0.068 0.920 0.004 0.008
#> GSM877179     4  0.0592     0.5933 0.000 0.016 0.000 0.984
#> GSM877181     2  0.2216     0.7828 0.000 0.908 0.000 0.092
#> GSM877185     2  0.4898     0.0946 0.000 0.584 0.000 0.416
#> GSM877131     2  0.2216     0.7999 0.000 0.908 0.092 0.000
#> GSM877147     3  0.0336     0.9767 0.008 0.000 0.992 0.000
#> GSM877155     2  0.4720     0.5025 0.000 0.720 0.016 0.264
#> GSM877159     2  0.2408     0.7939 0.000 0.896 0.104 0.000
#> GSM877170     2  0.3916     0.7311 0.168 0.816 0.008 0.008
#> GSM877186     1  0.3402     0.7652 0.832 0.000 0.164 0.004
#> GSM877132     2  0.2737     0.8016 0.104 0.888 0.000 0.008
#> GSM877143     2  0.0188     0.8344 0.004 0.996 0.000 0.000
#> GSM877146     2  0.0188     0.8344 0.004 0.996 0.000 0.000
#> GSM877148     2  0.0000     0.8319 0.000 1.000 0.000 0.000
#> GSM877152     2  0.0336     0.8355 0.008 0.992 0.000 0.000
#> GSM877168     2  0.0336     0.8355 0.008 0.992 0.000 0.000
#> GSM877180     2  0.0336     0.8355 0.008 0.992 0.000 0.000
#> GSM877126     1  0.2311     0.8373 0.916 0.004 0.076 0.004
#> GSM877129     1  0.0672     0.8631 0.984 0.000 0.008 0.008
#> GSM877133     1  0.2197     0.8396 0.916 0.080 0.000 0.004
#> GSM877153     3  0.1118     0.9534 0.036 0.000 0.964 0.000
#> GSM877169     1  0.0188     0.8652 0.996 0.000 0.000 0.004
#> GSM877171     1  0.0672     0.8631 0.984 0.000 0.008 0.008
#> GSM877174     1  0.0672     0.8631 0.984 0.000 0.008 0.008
#> GSM877134     1  0.4920     0.4627 0.628 0.368 0.000 0.004
#> GSM877135     1  0.0336     0.8651 0.992 0.008 0.000 0.000
#> GSM877136     1  0.0188     0.8652 0.996 0.000 0.000 0.004
#> GSM877137     1  0.2281     0.8345 0.904 0.096 0.000 0.000
#> GSM877139     1  0.2281     0.8345 0.904 0.096 0.000 0.000
#> GSM877149     1  0.3583     0.7579 0.816 0.180 0.000 0.004
#> GSM877154     2  0.2777     0.8030 0.104 0.888 0.004 0.004
#> GSM877157     1  0.1940     0.8452 0.924 0.076 0.000 0.000
#> GSM877160     1  0.0000     0.8648 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0188     0.8652 0.996 0.000 0.000 0.004
#> GSM877163     1  0.2011     0.8435 0.920 0.080 0.000 0.000
#> GSM877166     1  0.0188     0.8652 0.996 0.000 0.000 0.004
#> GSM877167     2  0.0336     0.8355 0.008 0.992 0.000 0.000
#> GSM877175     1  0.0188     0.8652 0.996 0.000 0.000 0.004
#> GSM877177     1  0.2011     0.8445 0.920 0.080 0.000 0.000
#> GSM877184     1  0.4790     0.4253 0.620 0.380 0.000 0.000
#> GSM877187     2  0.1118     0.8347 0.036 0.964 0.000 0.000
#> GSM877188     1  0.0188     0.8652 0.996 0.000 0.000 0.004
#> GSM877150     1  0.0188     0.8652 0.996 0.000 0.000 0.004
#> GSM877165     2  0.4661     0.3078 0.000 0.652 0.000 0.348
#> GSM877183     2  0.3350     0.7893 0.116 0.864 0.016 0.004
#> GSM877178     1  0.0672     0.8631 0.984 0.000 0.008 0.008
#> GSM877182     2  0.3916     0.7311 0.168 0.816 0.008 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0162    0.97000 0.004 0.000 0.000 0.996 0.000
#> GSM877128     3  0.4044    0.75756 0.160 0.004 0.792 0.040 0.004
#> GSM877164     3  0.2516    0.80236 0.140 0.000 0.860 0.000 0.000
#> GSM877162     5  0.3741    0.75476 0.000 0.040 0.060 0.056 0.844
#> GSM877127     5  0.6676   -0.03456 0.168 0.004 0.408 0.004 0.416
#> GSM877138     3  0.7921    0.24943 0.168 0.004 0.396 0.340 0.092
#> GSM877140     3  0.7925    0.24228 0.168 0.004 0.392 0.344 0.092
#> GSM877156     5  0.2664    0.78242 0.020 0.004 0.092 0.000 0.884
#> GSM877130     2  0.4542    0.00288 0.000 0.536 0.008 0.000 0.456
#> GSM877141     5  0.4394    0.66516 0.008 0.212 0.036 0.000 0.744
#> GSM877142     2  0.1329    0.60901 0.000 0.956 0.032 0.004 0.008
#> GSM877145     5  0.4131    0.67854 0.144 0.004 0.064 0.000 0.788
#> GSM877151     5  0.0451    0.80596 0.004 0.000 0.008 0.000 0.988
#> GSM877158     2  0.2230    0.61832 0.000 0.884 0.000 0.000 0.116
#> GSM877173     5  0.4087    0.70917 0.008 0.168 0.040 0.000 0.784
#> GSM877176     5  0.3452    0.78815 0.036 0.044 0.060 0.000 0.860
#> GSM877179     2  0.1329    0.60901 0.000 0.956 0.032 0.004 0.008
#> GSM877181     5  0.3250    0.73831 0.008 0.128 0.020 0.000 0.844
#> GSM877185     5  0.5069    0.01462 0.008 0.452 0.020 0.000 0.520
#> GSM877131     5  0.3530    0.75947 0.000 0.040 0.060 0.044 0.856
#> GSM877147     4  0.0162    0.97000 0.004 0.000 0.000 0.996 0.000
#> GSM877155     5  0.4445    0.46177 0.000 0.300 0.024 0.000 0.676
#> GSM877159     5  0.3741    0.75476 0.000 0.040 0.060 0.056 0.844
#> GSM877170     5  0.4938    0.73318 0.044 0.044 0.152 0.004 0.756
#> GSM877186     1  0.3053    0.72153 0.828 0.000 0.008 0.164 0.000
#> GSM877132     5  0.4026    0.77068 0.088 0.040 0.048 0.000 0.824
#> GSM877143     5  0.0579    0.80714 0.008 0.000 0.008 0.000 0.984
#> GSM877146     5  0.0579    0.80714 0.008 0.000 0.008 0.000 0.984
#> GSM877148     5  0.0451    0.80596 0.004 0.000 0.008 0.000 0.988
#> GSM877152     5  0.0693    0.80712 0.012 0.000 0.008 0.000 0.980
#> GSM877168     5  0.0693    0.80712 0.012 0.000 0.008 0.000 0.980
#> GSM877180     5  0.0693    0.80712 0.012 0.000 0.008 0.000 0.980
#> GSM877126     3  0.4044    0.75756 0.160 0.004 0.792 0.040 0.004
#> GSM877129     3  0.2516    0.80236 0.140 0.000 0.860 0.000 0.000
#> GSM877133     1  0.5674    0.12544 0.536 0.004 0.388 0.000 0.072
#> GSM877153     4  0.1757    0.93960 0.012 0.004 0.048 0.936 0.000
#> GSM877169     1  0.0404    0.83368 0.988 0.000 0.012 0.000 0.000
#> GSM877171     3  0.2516    0.80236 0.140 0.000 0.860 0.000 0.000
#> GSM877174     3  0.2516    0.80236 0.140 0.000 0.860 0.000 0.000
#> GSM877134     1  0.5421    0.43202 0.584 0.004 0.060 0.000 0.352
#> GSM877135     1  0.0671    0.83275 0.980 0.000 0.016 0.000 0.004
#> GSM877136     1  0.0404    0.83368 0.988 0.000 0.012 0.000 0.000
#> GSM877137     1  0.2903    0.80190 0.872 0.000 0.048 0.000 0.080
#> GSM877139     1  0.2903    0.80190 0.872 0.000 0.048 0.000 0.080
#> GSM877149     1  0.4326    0.69497 0.772 0.008 0.056 0.000 0.164
#> GSM877154     5  0.2610    0.78266 0.028 0.004 0.076 0.000 0.892
#> GSM877157     1  0.2079    0.81824 0.916 0.000 0.020 0.000 0.064
#> GSM877160     1  0.0510    0.83282 0.984 0.000 0.016 0.000 0.000
#> GSM877161     1  0.0404    0.83368 0.988 0.000 0.012 0.000 0.000
#> GSM877163     1  0.2654    0.81063 0.888 0.000 0.048 0.000 0.064
#> GSM877166     1  0.0404    0.83368 0.988 0.000 0.012 0.000 0.000
#> GSM877167     5  0.0693    0.80712 0.012 0.000 0.008 0.000 0.980
#> GSM877175     1  0.0404    0.83368 0.988 0.000 0.012 0.000 0.000
#> GSM877177     1  0.2236    0.81763 0.908 0.000 0.024 0.000 0.068
#> GSM877184     1  0.5204    0.39579 0.580 0.000 0.052 0.000 0.368
#> GSM877187     5  0.1300    0.80392 0.028 0.000 0.016 0.000 0.956
#> GSM877188     1  0.0404    0.83368 0.988 0.000 0.012 0.000 0.000
#> GSM877150     1  0.0404    0.83368 0.988 0.000 0.012 0.000 0.000
#> GSM877165     5  0.4950    0.24135 0.008 0.384 0.020 0.000 0.588
#> GSM877183     5  0.3248    0.77198 0.032 0.004 0.104 0.004 0.856
#> GSM877178     3  0.2516    0.80236 0.140 0.000 0.860 0.000 0.000
#> GSM877182     5  0.4938    0.73318 0.044 0.044 0.152 0.004 0.756

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0000     0.8662 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877128     3  0.3515     0.7532 0.064 0.000 0.828 0.024 0.000 0.084
#> GSM877164     3  0.0146     0.9175 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877162     5  0.4234     0.5307 0.000 0.000 0.004 0.016 0.608 0.372
#> GSM877127     5  0.7322    -0.3544 0.112 0.000 0.252 0.000 0.372 0.264
#> GSM877138     6  0.8008     0.9930 0.108 0.000 0.260 0.120 0.096 0.416
#> GSM877140     6  0.7997     0.9930 0.108 0.000 0.256 0.120 0.096 0.420
#> GSM877156     5  0.3109     0.6860 0.004 0.000 0.000 0.000 0.772 0.224
#> GSM877130     2  0.4939     0.0226 0.000 0.496 0.000 0.000 0.440 0.064
#> GSM877141     5  0.4830     0.6054 0.000 0.172 0.000 0.000 0.668 0.160
#> GSM877142     2  0.0000     0.6072 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877145     5  0.4299     0.6195 0.092 0.000 0.000 0.000 0.720 0.188
#> GSM877151     5  0.0146     0.7282 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM877158     2  0.2985     0.6159 0.000 0.844 0.000 0.000 0.100 0.056
#> GSM877173     5  0.4488     0.6401 0.000 0.128 0.000 0.000 0.708 0.164
#> GSM877176     5  0.3266     0.6777 0.000 0.000 0.000 0.000 0.728 0.272
#> GSM877179     2  0.0000     0.6072 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877181     5  0.3991     0.6384 0.000 0.088 0.000 0.000 0.756 0.156
#> GSM877185     5  0.5608    -0.1283 0.000 0.412 0.000 0.000 0.444 0.144
#> GSM877131     5  0.3954     0.5411 0.000 0.000 0.004 0.004 0.620 0.372
#> GSM877147     4  0.0000     0.8662 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877155     5  0.5354     0.2460 0.000 0.260 0.000 0.000 0.580 0.160
#> GSM877159     5  0.4234     0.5307 0.000 0.000 0.004 0.016 0.608 0.372
#> GSM877170     5  0.3930     0.6061 0.000 0.000 0.004 0.000 0.576 0.420
#> GSM877186     1  0.4286     0.5697 0.728 0.000 0.000 0.164 0.000 0.108
#> GSM877132     5  0.4026     0.6675 0.032 0.004 0.000 0.000 0.712 0.252
#> GSM877143     5  0.0260     0.7284 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM877146     5  0.0260     0.7284 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM877148     5  0.0146     0.7282 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM877152     5  0.0405     0.7284 0.004 0.000 0.000 0.000 0.988 0.008
#> GSM877168     5  0.0405     0.7284 0.004 0.000 0.000 0.000 0.988 0.008
#> GSM877180     5  0.0405     0.7284 0.004 0.000 0.000 0.000 0.988 0.008
#> GSM877126     3  0.3463     0.7577 0.064 0.000 0.832 0.024 0.000 0.080
#> GSM877129     3  0.0146     0.9175 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877133     1  0.6671    -0.1558 0.496 0.000 0.256 0.000 0.076 0.172
#> GSM877153     4  0.3834     0.6884 0.000 0.000 0.024 0.708 0.000 0.268
#> GSM877169     1  0.0000     0.8058 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877171     3  0.0146     0.9175 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877174     3  0.0146     0.9175 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877134     1  0.5660     0.2765 0.516 0.000 0.000 0.000 0.300 0.184
#> GSM877135     1  0.0891     0.8023 0.968 0.000 0.000 0.000 0.008 0.024
#> GSM877136     1  0.0000     0.8058 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.3227     0.7583 0.828 0.000 0.000 0.000 0.084 0.088
#> GSM877139     1  0.3227     0.7583 0.828 0.000 0.000 0.000 0.084 0.088
#> GSM877149     1  0.4459     0.6210 0.712 0.000 0.000 0.000 0.132 0.156
#> GSM877154     5  0.2738     0.7004 0.004 0.000 0.000 0.000 0.820 0.176
#> GSM877157     1  0.2629     0.7782 0.872 0.000 0.000 0.000 0.068 0.060
#> GSM877160     1  0.0146     0.8055 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM877161     1  0.0000     0.8058 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.3013     0.7688 0.844 0.000 0.000 0.000 0.068 0.088
#> GSM877166     1  0.0000     0.8058 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.0405     0.7284 0.004 0.000 0.000 0.000 0.988 0.008
#> GSM877175     1  0.0000     0.8058 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.2886     0.7757 0.860 0.000 0.004 0.000 0.072 0.064
#> GSM877184     1  0.5564     0.2536 0.516 0.000 0.000 0.000 0.328 0.156
#> GSM877187     5  0.1152     0.7275 0.004 0.000 0.000 0.000 0.952 0.044
#> GSM877188     1  0.0000     0.8058 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.8058 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877165     5  0.5519     0.0931 0.000 0.344 0.000 0.000 0.512 0.144
#> GSM877183     5  0.3329     0.6700 0.004 0.000 0.004 0.000 0.756 0.236
#> GSM877178     3  0.0146     0.9175 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877182     5  0.3930     0.6061 0.000 0.000 0.004 0.000 0.576 0.420

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) genotype/variation(p) other(p) k
#> SD:hclust 59            0.216              0.589362 6.61e-07 2
#> SD:hclust 54            0.183              0.512981 5.82e-06 3
#> SD:hclust 54            0.575              0.704514 1.11e-06 4
#> SD:hclust 52            0.135              0.774642 1.20e-10 5
#> SD:hclust 54            0.297              0.000967 3.02e-10 6

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


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

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.976       0.982         0.5048 0.492   0.492
#> 3 3 0.534           0.663       0.828         0.2561 0.879   0.758
#> 4 4 0.583           0.465       0.654         0.1180 0.789   0.511
#> 5 5 0.673           0.715       0.833         0.0841 0.907   0.686
#> 6 6 0.711           0.696       0.793         0.0558 0.955   0.806

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
#> GSM877144     1  0.0376      0.976 0.996 0.004
#> GSM877128     1  0.0000      0.978 1.000 0.000
#> GSM877164     1  0.0000      0.978 1.000 0.000
#> GSM877162     2  0.1633      0.970 0.024 0.976
#> GSM877127     1  0.1414      0.984 0.980 0.020
#> GSM877138     1  0.1414      0.984 0.980 0.020
#> GSM877140     1  0.0000      0.978 1.000 0.000
#> GSM877156     2  0.0376      0.987 0.004 0.996
#> GSM877130     2  0.0376      0.987 0.004 0.996
#> GSM877141     2  0.0672      0.986 0.008 0.992
#> GSM877142     2  0.0376      0.984 0.004 0.996
#> GSM877145     2  0.0376      0.987 0.004 0.996
#> GSM877151     2  0.0376      0.987 0.004 0.996
#> GSM877158     2  0.0672      0.986 0.008 0.992
#> GSM877173     2  0.0376      0.987 0.004 0.996
#> GSM877176     2  0.0376      0.987 0.004 0.996
#> GSM877179     2  0.0672      0.986 0.008 0.992
#> GSM877181     2  0.0376      0.987 0.004 0.996
#> GSM877185     2  0.0376      0.987 0.004 0.996
#> GSM877131     2  0.1633      0.970 0.024 0.976
#> GSM877147     2  0.1843      0.969 0.028 0.972
#> GSM877155     2  0.0376      0.984 0.004 0.996
#> GSM877159     2  0.1633      0.970 0.024 0.976
#> GSM877170     2  0.0672      0.986 0.008 0.992
#> GSM877186     1  0.0376      0.979 0.996 0.004
#> GSM877132     2  0.0376      0.987 0.004 0.996
#> GSM877143     2  0.0376      0.987 0.004 0.996
#> GSM877146     2  0.0376      0.987 0.004 0.996
#> GSM877148     2  0.0376      0.987 0.004 0.996
#> GSM877152     2  0.0376      0.987 0.004 0.996
#> GSM877168     2  0.0376      0.987 0.004 0.996
#> GSM877180     2  0.0376      0.987 0.004 0.996
#> GSM877126     1  0.0000      0.978 1.000 0.000
#> GSM877129     1  0.0000      0.978 1.000 0.000
#> GSM877133     1  0.1633      0.985 0.976 0.024
#> GSM877153     1  0.0376      0.976 0.996 0.004
#> GSM877169     1  0.1633      0.985 0.976 0.024
#> GSM877171     1  0.0000      0.978 1.000 0.000
#> GSM877174     1  0.0000      0.978 1.000 0.000
#> GSM877134     1  0.7139      0.780 0.804 0.196
#> GSM877135     1  0.1633      0.985 0.976 0.024
#> GSM877136     1  0.1633      0.985 0.976 0.024
#> GSM877137     1  0.1633      0.985 0.976 0.024
#> GSM877139     1  0.1633      0.985 0.976 0.024
#> GSM877149     1  0.1633      0.985 0.976 0.024
#> GSM877154     2  0.0376      0.987 0.004 0.996
#> GSM877157     1  0.1633      0.985 0.976 0.024
#> GSM877160     1  0.1633      0.985 0.976 0.024
#> GSM877161     1  0.1633      0.985 0.976 0.024
#> GSM877163     1  0.1633      0.985 0.976 0.024
#> GSM877166     1  0.1633      0.985 0.976 0.024
#> GSM877167     2  0.0376      0.987 0.004 0.996
#> GSM877175     1  0.1633      0.985 0.976 0.024
#> GSM877177     1  0.1633      0.985 0.976 0.024
#> GSM877184     1  0.1633      0.985 0.976 0.024
#> GSM877187     2  0.0376      0.987 0.004 0.996
#> GSM877188     1  0.1633      0.985 0.976 0.024
#> GSM877150     1  0.1633      0.985 0.976 0.024
#> GSM877165     2  0.0376      0.987 0.004 0.996
#> GSM877183     2  0.6048      0.834 0.148 0.852
#> GSM877178     1  0.0000      0.978 1.000 0.000
#> GSM877182     2  0.4815      0.885 0.104 0.896

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.6854      0.568 0.216 0.068 0.716
#> GSM877128     1  0.6192      0.237 0.580 0.000 0.420
#> GSM877164     1  0.4605      0.639 0.796 0.000 0.204
#> GSM877162     3  0.4796      0.417 0.000 0.220 0.780
#> GSM877127     3  0.9167      0.243 0.392 0.148 0.460
#> GSM877138     3  0.9304      0.421 0.280 0.204 0.516
#> GSM877140     3  0.8803      0.443 0.320 0.136 0.544
#> GSM877156     2  0.1643      0.792 0.000 0.956 0.044
#> GSM877130     2  0.4796      0.797 0.000 0.780 0.220
#> GSM877141     2  0.4121      0.810 0.000 0.832 0.168
#> GSM877142     2  0.4796      0.797 0.000 0.780 0.220
#> GSM877145     2  0.1031      0.807 0.000 0.976 0.024
#> GSM877151     2  0.4750      0.798 0.000 0.784 0.216
#> GSM877158     2  0.4796      0.797 0.000 0.780 0.220
#> GSM877173     2  0.4291      0.807 0.000 0.820 0.180
#> GSM877176     2  0.3816      0.811 0.000 0.852 0.148
#> GSM877179     2  0.4796      0.797 0.000 0.780 0.220
#> GSM877181     2  0.4654      0.801 0.000 0.792 0.208
#> GSM877185     2  0.4750      0.799 0.000 0.784 0.216
#> GSM877131     2  0.5988      0.676 0.000 0.632 0.368
#> GSM877147     3  0.5070      0.474 0.004 0.224 0.772
#> GSM877155     2  0.4750      0.798 0.000 0.784 0.216
#> GSM877159     3  0.4702      0.429 0.000 0.212 0.788
#> GSM877170     2  0.5363      0.722 0.000 0.724 0.276
#> GSM877186     1  0.0424      0.775 0.992 0.000 0.008
#> GSM877132     2  0.0892      0.807 0.000 0.980 0.020
#> GSM877143     2  0.1753      0.794 0.000 0.952 0.048
#> GSM877146     2  0.1753      0.794 0.000 0.952 0.048
#> GSM877148     2  0.1860      0.793 0.000 0.948 0.052
#> GSM877152     2  0.1860      0.788 0.000 0.948 0.052
#> GSM877168     2  0.1964      0.790 0.000 0.944 0.056
#> GSM877180     2  0.1964      0.790 0.000 0.944 0.056
#> GSM877126     1  0.6192      0.237 0.580 0.000 0.420
#> GSM877129     1  0.6451      0.171 0.560 0.004 0.436
#> GSM877133     1  0.0592      0.773 0.988 0.000 0.012
#> GSM877153     3  0.5360      0.499 0.220 0.012 0.768
#> GSM877169     1  0.0592      0.773 0.988 0.000 0.012
#> GSM877171     1  0.4291      0.662 0.820 0.000 0.180
#> GSM877174     1  0.4605      0.639 0.796 0.000 0.204
#> GSM877134     1  0.6527      0.436 0.660 0.320 0.020
#> GSM877135     1  0.5036      0.669 0.808 0.172 0.020
#> GSM877136     1  0.0000      0.777 1.000 0.000 0.000
#> GSM877137     1  0.5356      0.643 0.784 0.196 0.020
#> GSM877139     1  0.5200      0.658 0.796 0.184 0.020
#> GSM877149     1  0.1950      0.764 0.952 0.040 0.008
#> GSM877154     2  0.1860      0.788 0.000 0.948 0.052
#> GSM877157     1  0.5200      0.658 0.796 0.184 0.020
#> GSM877160     1  0.0000      0.777 1.000 0.000 0.000
#> GSM877161     1  0.0000      0.777 1.000 0.000 0.000
#> GSM877163     1  0.2537      0.745 0.920 0.080 0.000
#> GSM877166     1  0.0000      0.777 1.000 0.000 0.000
#> GSM877167     2  0.0424      0.798 0.000 0.992 0.008
#> GSM877175     1  0.0000      0.777 1.000 0.000 0.000
#> GSM877177     1  0.4280      0.705 0.856 0.124 0.020
#> GSM877184     1  0.5455      0.632 0.776 0.204 0.020
#> GSM877187     2  0.1964      0.785 0.000 0.944 0.056
#> GSM877188     1  0.0000      0.777 1.000 0.000 0.000
#> GSM877150     1  0.0000      0.777 1.000 0.000 0.000
#> GSM877165     2  0.4702      0.800 0.000 0.788 0.212
#> GSM877183     2  0.7850      0.071 0.076 0.608 0.316
#> GSM877178     1  0.6140      0.277 0.596 0.000 0.404
#> GSM877182     2  0.6379      0.480 0.032 0.712 0.256

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.6140      0.153 0.000 0.048 0.500 0.452
#> GSM877128     3  0.4477      0.646 0.312 0.000 0.688 0.000
#> GSM877164     3  0.4941      0.548 0.436 0.000 0.564 0.000
#> GSM877162     4  0.6360     -0.192 0.000 0.064 0.420 0.516
#> GSM877127     2  0.9578     -0.230 0.168 0.352 0.316 0.164
#> GSM877138     2  0.9288     -0.186 0.088 0.372 0.288 0.252
#> GSM877140     3  0.8534      0.262 0.044 0.220 0.460 0.276
#> GSM877156     2  0.0672      0.640 0.008 0.984 0.000 0.008
#> GSM877130     4  0.4972      0.371 0.000 0.456 0.000 0.544
#> GSM877141     2  0.4936      0.272 0.000 0.672 0.012 0.316
#> GSM877142     4  0.4961      0.378 0.000 0.448 0.000 0.552
#> GSM877145     2  0.3266      0.528 0.000 0.832 0.000 0.168
#> GSM877151     4  0.4994      0.336 0.000 0.480 0.000 0.520
#> GSM877158     4  0.4961      0.378 0.000 0.448 0.000 0.552
#> GSM877173     2  0.4564      0.241 0.000 0.672 0.000 0.328
#> GSM877176     2  0.4277      0.326 0.000 0.720 0.000 0.280
#> GSM877179     4  0.4961      0.378 0.000 0.448 0.000 0.552
#> GSM877181     2  0.4972     -0.255 0.000 0.544 0.000 0.456
#> GSM877185     4  0.4994      0.310 0.000 0.480 0.000 0.520
#> GSM877131     4  0.6315      0.265 0.000 0.432 0.060 0.508
#> GSM877147     4  0.6305     -0.193 0.000 0.060 0.424 0.516
#> GSM877155     4  0.4985      0.355 0.000 0.468 0.000 0.532
#> GSM877159     4  0.6360     -0.192 0.000 0.064 0.420 0.516
#> GSM877170     2  0.6587      0.279 0.000 0.596 0.112 0.292
#> GSM877186     1  0.0804      0.765 0.980 0.000 0.012 0.008
#> GSM877132     2  0.3266      0.528 0.000 0.832 0.000 0.168
#> GSM877143     2  0.1909      0.637 0.004 0.940 0.008 0.048
#> GSM877146     2  0.1909      0.637 0.004 0.940 0.008 0.048
#> GSM877148     2  0.1543      0.639 0.008 0.956 0.004 0.032
#> GSM877152     2  0.0992      0.640 0.008 0.976 0.004 0.012
#> GSM877168     2  0.1639      0.638 0.008 0.952 0.004 0.036
#> GSM877180     2  0.1543      0.639 0.008 0.956 0.004 0.032
#> GSM877126     3  0.4477      0.646 0.312 0.000 0.688 0.000
#> GSM877129     3  0.4655      0.646 0.312 0.000 0.684 0.004
#> GSM877133     1  0.1940      0.691 0.924 0.000 0.076 0.000
#> GSM877153     3  0.4941      0.225 0.000 0.000 0.564 0.436
#> GSM877169     1  0.2149      0.676 0.912 0.000 0.088 0.000
#> GSM877171     3  0.4941      0.548 0.436 0.000 0.564 0.000
#> GSM877174     3  0.4941      0.548 0.436 0.000 0.564 0.000
#> GSM877134     1  0.5497      0.489 0.572 0.412 0.008 0.008
#> GSM877135     1  0.4355      0.682 0.772 0.212 0.012 0.004
#> GSM877136     1  0.0469      0.761 0.988 0.000 0.012 0.000
#> GSM877137     1  0.5456      0.500 0.588 0.396 0.008 0.008
#> GSM877139     1  0.4374      0.674 0.760 0.228 0.008 0.004
#> GSM877149     1  0.1878      0.758 0.944 0.040 0.008 0.008
#> GSM877154     2  0.0672      0.639 0.008 0.984 0.000 0.008
#> GSM877157     1  0.4408      0.674 0.756 0.232 0.008 0.004
#> GSM877160     1  0.0469      0.761 0.988 0.000 0.012 0.000
#> GSM877161     1  0.0188      0.766 0.996 0.000 0.004 0.000
#> GSM877163     1  0.1114      0.766 0.972 0.016 0.008 0.004
#> GSM877166     1  0.0188      0.766 0.996 0.000 0.004 0.000
#> GSM877167     2  0.1109      0.640 0.004 0.968 0.000 0.028
#> GSM877175     1  0.0188      0.766 0.996 0.000 0.004 0.000
#> GSM877177     1  0.4279      0.686 0.780 0.204 0.012 0.004
#> GSM877184     1  0.5614      0.484 0.568 0.412 0.012 0.008
#> GSM877187     2  0.1394      0.629 0.012 0.964 0.016 0.008
#> GSM877188     1  0.0469      0.761 0.988 0.000 0.012 0.000
#> GSM877150     1  0.0469      0.761 0.988 0.000 0.012 0.000
#> GSM877165     2  0.4998     -0.345 0.000 0.512 0.000 0.488
#> GSM877183     2  0.4478      0.497 0.044 0.820 0.120 0.016
#> GSM877178     3  0.4624      0.637 0.340 0.000 0.660 0.000
#> GSM877182     2  0.5154      0.535 0.024 0.772 0.040 0.164

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0324      0.976 0.004 0.000 0.000 0.992 0.004
#> GSM877128     3  0.3010      0.957 0.116 0.000 0.860 0.016 0.008
#> GSM877164     3  0.2690      0.964 0.156 0.000 0.844 0.000 0.000
#> GSM877162     4  0.1299      0.969 0.000 0.008 0.020 0.960 0.012
#> GSM877127     5  0.4696      0.527 0.020 0.000 0.116 0.096 0.768
#> GSM877138     5  0.4649      0.531 0.020 0.000 0.076 0.136 0.768
#> GSM877140     5  0.6345     -0.153 0.012 0.000 0.112 0.428 0.448
#> GSM877156     5  0.2949      0.669 0.000 0.068 0.052 0.004 0.876
#> GSM877130     2  0.1281      0.830 0.000 0.956 0.012 0.000 0.032
#> GSM877141     2  0.5109     -0.038 0.000 0.504 0.036 0.000 0.460
#> GSM877142     2  0.1041      0.811 0.000 0.964 0.032 0.004 0.000
#> GSM877145     5  0.6021      0.218 0.000 0.428 0.088 0.008 0.476
#> GSM877151     2  0.1410      0.828 0.000 0.940 0.000 0.000 0.060
#> GSM877158     2  0.0771      0.816 0.000 0.976 0.020 0.004 0.000
#> GSM877173     2  0.4374      0.445 0.000 0.700 0.028 0.000 0.272
#> GSM877176     5  0.5997      0.140 0.000 0.404 0.088 0.008 0.500
#> GSM877179     2  0.0771      0.816 0.000 0.976 0.020 0.004 0.000
#> GSM877181     2  0.3622      0.733 0.000 0.816 0.048 0.000 0.136
#> GSM877185     2  0.2291      0.824 0.000 0.908 0.036 0.000 0.056
#> GSM877131     2  0.4448      0.716 0.000 0.788 0.020 0.096 0.096
#> GSM877147     4  0.0324      0.976 0.004 0.000 0.000 0.992 0.004
#> GSM877155     2  0.1597      0.829 0.000 0.940 0.012 0.000 0.048
#> GSM877159     4  0.1854      0.954 0.000 0.008 0.020 0.936 0.036
#> GSM877170     5  0.6406      0.118 0.000 0.380 0.136 0.008 0.476
#> GSM877186     1  0.1701      0.856 0.944 0.000 0.016 0.012 0.028
#> GSM877132     5  0.6018      0.223 0.000 0.424 0.088 0.008 0.480
#> GSM877143     5  0.3734      0.669 0.004 0.204 0.004 0.008 0.780
#> GSM877146     5  0.3734      0.669 0.004 0.204 0.004 0.008 0.780
#> GSM877148     5  0.3666      0.672 0.004 0.196 0.004 0.008 0.788
#> GSM877152     5  0.3485      0.678 0.004 0.176 0.004 0.008 0.808
#> GSM877168     5  0.3631      0.672 0.004 0.192 0.004 0.008 0.792
#> GSM877180     5  0.3631      0.672 0.004 0.192 0.004 0.008 0.792
#> GSM877126     3  0.2959      0.958 0.112 0.000 0.864 0.016 0.008
#> GSM877129     3  0.2677      0.960 0.112 0.000 0.872 0.016 0.000
#> GSM877133     1  0.1331      0.835 0.952 0.000 0.040 0.000 0.008
#> GSM877153     4  0.0671      0.966 0.004 0.000 0.016 0.980 0.000
#> GSM877169     1  0.1894      0.807 0.920 0.000 0.072 0.000 0.008
#> GSM877171     3  0.2890      0.958 0.160 0.000 0.836 0.000 0.004
#> GSM877174     3  0.2690      0.964 0.156 0.000 0.844 0.000 0.000
#> GSM877134     1  0.5848      0.554 0.608 0.004 0.092 0.008 0.288
#> GSM877135     1  0.2864      0.826 0.852 0.000 0.012 0.000 0.136
#> GSM877136     1  0.0404      0.856 0.988 0.000 0.000 0.000 0.012
#> GSM877137     1  0.4565      0.448 0.580 0.000 0.012 0.000 0.408
#> GSM877139     1  0.2997      0.815 0.840 0.000 0.012 0.000 0.148
#> GSM877149     1  0.3384      0.820 0.852 0.000 0.084 0.008 0.056
#> GSM877154     5  0.3589      0.681 0.000 0.132 0.040 0.004 0.824
#> GSM877157     1  0.3002      0.839 0.872 0.000 0.048 0.004 0.076
#> GSM877160     1  0.0290      0.857 0.992 0.000 0.000 0.000 0.008
#> GSM877161     1  0.0510      0.857 0.984 0.000 0.000 0.000 0.016
#> GSM877163     1  0.2005      0.851 0.924 0.000 0.056 0.004 0.016
#> GSM877166     1  0.0510      0.857 0.984 0.000 0.000 0.000 0.016
#> GSM877167     5  0.3795      0.669 0.000 0.192 0.028 0.000 0.780
#> GSM877175     1  0.0290      0.857 0.992 0.000 0.000 0.000 0.008
#> GSM877177     1  0.2773      0.834 0.868 0.000 0.020 0.000 0.112
#> GSM877184     1  0.5552      0.516 0.588 0.000 0.064 0.008 0.340
#> GSM877187     5  0.1412      0.673 0.000 0.036 0.004 0.008 0.952
#> GSM877188     1  0.0290      0.857 0.992 0.000 0.000 0.000 0.008
#> GSM877150     1  0.0404      0.856 0.988 0.000 0.000 0.000 0.012
#> GSM877165     2  0.2473      0.810 0.000 0.896 0.032 0.000 0.072
#> GSM877183     5  0.2277      0.661 0.000 0.016 0.052 0.016 0.916
#> GSM877178     3  0.2798      0.967 0.140 0.000 0.852 0.008 0.000
#> GSM877182     5  0.6187      0.339 0.012 0.276 0.108 0.008 0.596

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0000      0.953 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877128     3  0.2044      0.950 0.040 0.000 0.920 0.004 0.008 0.028
#> GSM877164     3  0.1387      0.963 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM877162     4  0.1579      0.941 0.000 0.008 0.020 0.944 0.004 0.024
#> GSM877127     5  0.6054      0.406 0.048 0.000 0.044 0.028 0.536 0.344
#> GSM877138     5  0.6223      0.398 0.052 0.000 0.028 0.052 0.520 0.348
#> GSM877140     5  0.7489      0.247 0.048 0.000 0.056 0.168 0.380 0.348
#> GSM877156     5  0.4242      0.127 0.000 0.016 0.000 0.000 0.536 0.448
#> GSM877130     2  0.1921      0.790 0.000 0.916 0.000 0.000 0.032 0.052
#> GSM877141     6  0.6568      0.258 0.000 0.380 0.036 0.000 0.200 0.384
#> GSM877142     2  0.0551      0.772 0.000 0.984 0.004 0.000 0.004 0.008
#> GSM877145     6  0.5469      0.583 0.000 0.144 0.000 0.000 0.324 0.532
#> GSM877151     2  0.2250      0.782 0.000 0.888 0.000 0.000 0.092 0.020
#> GSM877158     2  0.0837      0.773 0.000 0.972 0.020 0.000 0.004 0.004
#> GSM877173     2  0.5561      0.355 0.000 0.608 0.016 0.000 0.176 0.200
#> GSM877176     6  0.4969      0.664 0.000 0.156 0.000 0.000 0.196 0.648
#> GSM877179     2  0.0837      0.773 0.000 0.972 0.020 0.000 0.004 0.004
#> GSM877181     2  0.5515      0.243 0.000 0.528 0.000 0.000 0.152 0.320
#> GSM877185     2  0.3481      0.721 0.000 0.792 0.000 0.000 0.048 0.160
#> GSM877131     2  0.4541      0.695 0.000 0.772 0.032 0.028 0.052 0.116
#> GSM877147     4  0.0000      0.953 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877155     2  0.2197      0.788 0.000 0.900 0.000 0.000 0.056 0.044
#> GSM877159     4  0.3344      0.871 0.000 0.008 0.020 0.844 0.036 0.092
#> GSM877170     6  0.4599      0.632 0.000 0.120 0.024 0.000 0.120 0.736
#> GSM877186     1  0.4272      0.794 0.772 0.000 0.012 0.036 0.032 0.148
#> GSM877132     6  0.5491      0.574 0.000 0.144 0.000 0.000 0.332 0.524
#> GSM877143     5  0.4106      0.588 0.008 0.112 0.008 0.000 0.780 0.092
#> GSM877146     5  0.4106      0.588 0.008 0.112 0.008 0.000 0.780 0.092
#> GSM877148     5  0.1765      0.618 0.000 0.096 0.000 0.000 0.904 0.000
#> GSM877152     5  0.1951      0.616 0.000 0.076 0.000 0.000 0.908 0.016
#> GSM877168     5  0.1765      0.618 0.000 0.096 0.000 0.000 0.904 0.000
#> GSM877180     5  0.1765      0.618 0.000 0.096 0.000 0.000 0.904 0.000
#> GSM877126     3  0.1629      0.948 0.028 0.000 0.940 0.004 0.004 0.024
#> GSM877129     3  0.0508      0.945 0.012 0.000 0.984 0.004 0.000 0.000
#> GSM877133     1  0.1448      0.847 0.948 0.000 0.016 0.000 0.012 0.024
#> GSM877153     4  0.0405      0.953 0.000 0.000 0.004 0.988 0.000 0.008
#> GSM877169     1  0.1036      0.847 0.964 0.000 0.024 0.000 0.004 0.008
#> GSM877171     3  0.1387      0.963 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM877174     3  0.1387      0.963 0.068 0.000 0.932 0.000 0.000 0.000
#> GSM877134     1  0.4639      0.297 0.512 0.000 0.000 0.000 0.040 0.448
#> GSM877135     1  0.3615      0.816 0.796 0.000 0.004 0.000 0.060 0.140
#> GSM877136     1  0.2936      0.820 0.852 0.000 0.016 0.000 0.020 0.112
#> GSM877137     1  0.3989      0.654 0.720 0.000 0.000 0.000 0.236 0.044
#> GSM877139     1  0.2190      0.832 0.900 0.000 0.000 0.000 0.060 0.040
#> GSM877149     1  0.3221      0.707 0.736 0.000 0.000 0.000 0.000 0.264
#> GSM877154     5  0.4268      0.379 0.008 0.036 0.000 0.000 0.692 0.264
#> GSM877157     1  0.2009      0.839 0.908 0.000 0.000 0.000 0.024 0.068
#> GSM877160     1  0.0862      0.848 0.972 0.000 0.016 0.000 0.004 0.008
#> GSM877161     1  0.2936      0.820 0.852 0.000 0.016 0.000 0.020 0.112
#> GSM877163     1  0.2146      0.827 0.880 0.000 0.000 0.000 0.004 0.116
#> GSM877166     1  0.2936      0.820 0.852 0.000 0.016 0.000 0.020 0.112
#> GSM877167     5  0.4012      0.427 0.000 0.076 0.000 0.000 0.748 0.176
#> GSM877175     1  0.0964      0.848 0.968 0.000 0.016 0.000 0.004 0.012
#> GSM877177     1  0.2563      0.823 0.876 0.000 0.000 0.000 0.072 0.052
#> GSM877184     1  0.4931      0.468 0.576 0.000 0.004 0.000 0.064 0.356
#> GSM877187     5  0.3418      0.573 0.016 0.008 0.000 0.000 0.784 0.192
#> GSM877188     1  0.0964      0.848 0.968 0.000 0.016 0.000 0.004 0.012
#> GSM877150     1  0.2039      0.836 0.908 0.000 0.016 0.000 0.004 0.072
#> GSM877165     2  0.4344      0.651 0.000 0.716 0.000 0.000 0.096 0.188
#> GSM877183     5  0.4817      0.410 0.012 0.008 0.024 0.000 0.584 0.372
#> GSM877178     3  0.1219      0.964 0.048 0.000 0.948 0.004 0.000 0.000
#> GSM877182     6  0.4062      0.553 0.056 0.040 0.000 0.000 0.116 0.788

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-kmeans-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) genotype/variation(p) other(p) k
#> SD:kmeans 62         2.19e-01                 0.530 7.89e-08 2
#> SD:kmeans 48         4.51e-09                 0.711 3.52e-06 3
#> SD:kmeans 36         5.48e-02                 0.550 2.74e-06 4
#> SD:kmeans 53         8.89e-02                 0.245 1.13e-16 5
#> SD:kmeans 50         1.16e-01                 0.348 5.25e-17 6

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


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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.985       0.993         0.5086 0.492   0.492
#> 3 3 0.978           0.952       0.979         0.3110 0.773   0.568
#> 4 4 0.792           0.744       0.833         0.0979 0.929   0.791
#> 5 5 0.827           0.800       0.894         0.0776 0.903   0.673
#> 6 6 0.803           0.670       0.830         0.0419 0.961   0.826

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
#> GSM877144     1   0.000      0.993 1.000 0.000
#> GSM877128     1   0.000      0.993 1.000 0.000
#> GSM877164     1   0.000      0.993 1.000 0.000
#> GSM877162     2   0.000      0.993 0.000 1.000
#> GSM877127     1   0.000      0.993 1.000 0.000
#> GSM877138     1   0.000      0.993 1.000 0.000
#> GSM877140     1   0.000      0.993 1.000 0.000
#> GSM877156     2   0.000      0.993 0.000 1.000
#> GSM877130     2   0.000      0.993 0.000 1.000
#> GSM877141     2   0.000      0.993 0.000 1.000
#> GSM877142     2   0.000      0.993 0.000 1.000
#> GSM877145     2   0.000      0.993 0.000 1.000
#> GSM877151     2   0.000      0.993 0.000 1.000
#> GSM877158     2   0.000      0.993 0.000 1.000
#> GSM877173     2   0.000      0.993 0.000 1.000
#> GSM877176     2   0.000      0.993 0.000 1.000
#> GSM877179     2   0.000      0.993 0.000 1.000
#> GSM877181     2   0.000      0.993 0.000 1.000
#> GSM877185     2   0.000      0.993 0.000 1.000
#> GSM877131     2   0.000      0.993 0.000 1.000
#> GSM877147     2   0.000      0.993 0.000 1.000
#> GSM877155     2   0.000      0.993 0.000 1.000
#> GSM877159     2   0.000      0.993 0.000 1.000
#> GSM877170     2   0.000      0.993 0.000 1.000
#> GSM877186     1   0.000      0.993 1.000 0.000
#> GSM877132     2   0.000      0.993 0.000 1.000
#> GSM877143     2   0.000      0.993 0.000 1.000
#> GSM877146     2   0.000      0.993 0.000 1.000
#> GSM877148     2   0.000      0.993 0.000 1.000
#> GSM877152     2   0.000      0.993 0.000 1.000
#> GSM877168     2   0.000      0.993 0.000 1.000
#> GSM877180     2   0.000      0.993 0.000 1.000
#> GSM877126     1   0.000      0.993 1.000 0.000
#> GSM877129     1   0.000      0.993 1.000 0.000
#> GSM877133     1   0.000      0.993 1.000 0.000
#> GSM877153     1   0.000      0.993 1.000 0.000
#> GSM877169     1   0.000      0.993 1.000 0.000
#> GSM877171     1   0.000      0.993 1.000 0.000
#> GSM877174     1   0.000      0.993 1.000 0.000
#> GSM877134     1   0.722      0.749 0.800 0.200
#> GSM877135     1   0.000      0.993 1.000 0.000
#> GSM877136     1   0.000      0.993 1.000 0.000
#> GSM877137     1   0.000      0.993 1.000 0.000
#> GSM877139     1   0.000      0.993 1.000 0.000
#> GSM877149     1   0.000      0.993 1.000 0.000
#> GSM877154     2   0.000      0.993 0.000 1.000
#> GSM877157     1   0.000      0.993 1.000 0.000
#> GSM877160     1   0.000      0.993 1.000 0.000
#> GSM877161     1   0.000      0.993 1.000 0.000
#> GSM877163     1   0.000      0.993 1.000 0.000
#> GSM877166     1   0.000      0.993 1.000 0.000
#> GSM877167     2   0.000      0.993 0.000 1.000
#> GSM877175     1   0.000      0.993 1.000 0.000
#> GSM877177     1   0.000      0.993 1.000 0.000
#> GSM877184     1   0.000      0.993 1.000 0.000
#> GSM877187     2   0.000      0.993 0.000 1.000
#> GSM877188     1   0.000      0.993 1.000 0.000
#> GSM877150     1   0.000      0.993 1.000 0.000
#> GSM877165     2   0.000      0.993 0.000 1.000
#> GSM877183     2   0.552      0.854 0.128 0.872
#> GSM877178     1   0.000      0.993 1.000 0.000
#> GSM877182     2   0.416      0.908 0.084 0.916

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.0237      0.952 0.004 0.000 0.996
#> GSM877128     3  0.0592      0.948 0.012 0.000 0.988
#> GSM877164     1  0.4555      0.759 0.800 0.000 0.200
#> GSM877162     3  0.0424      0.949 0.000 0.008 0.992
#> GSM877127     3  0.0237      0.952 0.004 0.000 0.996
#> GSM877138     3  0.0237      0.952 0.004 0.000 0.996
#> GSM877140     3  0.0237      0.952 0.004 0.000 0.996
#> GSM877156     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877130     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877141     2  0.3619      0.838 0.000 0.864 0.136
#> GSM877142     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877145     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877151     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877158     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877173     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877176     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877179     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877181     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877185     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877131     3  0.6291      0.124 0.000 0.468 0.532
#> GSM877147     3  0.0237      0.951 0.000 0.004 0.996
#> GSM877155     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877159     3  0.0237      0.951 0.000 0.004 0.996
#> GSM877170     3  0.3038      0.865 0.000 0.104 0.896
#> GSM877186     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877132     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877143     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877146     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877148     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877152     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877168     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877180     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877126     3  0.0237      0.952 0.004 0.000 0.996
#> GSM877129     3  0.0237      0.952 0.004 0.000 0.996
#> GSM877133     1  0.0237      0.977 0.996 0.000 0.004
#> GSM877153     3  0.0237      0.952 0.004 0.000 0.996
#> GSM877169     1  0.0237      0.977 0.996 0.000 0.004
#> GSM877171     1  0.0237      0.977 0.996 0.000 0.004
#> GSM877174     1  0.4346      0.781 0.816 0.000 0.184
#> GSM877134     1  0.0892      0.962 0.980 0.020 0.000
#> GSM877135     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877136     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877137     1  0.0237      0.976 0.996 0.004 0.000
#> GSM877139     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877149     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877154     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877157     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877160     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877161     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877163     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877166     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877167     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877175     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877177     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877184     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877187     2  0.0000      0.992 0.000 1.000 0.000
#> GSM877188     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877150     1  0.0000      0.979 1.000 0.000 0.000
#> GSM877165     2  0.0237      0.992 0.000 0.996 0.004
#> GSM877183     3  0.0000      0.951 0.000 0.000 1.000
#> GSM877178     3  0.0747      0.945 0.016 0.000 0.984
#> GSM877182     3  0.1832      0.927 0.008 0.036 0.956

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     4  0.4907      0.714 0.000 0.000 0.420 0.580
#> GSM877128     3  0.1209      0.592 0.032 0.000 0.964 0.004
#> GSM877164     3  0.4072      0.589 0.252 0.000 0.748 0.000
#> GSM877162     4  0.6078      0.710 0.000 0.068 0.312 0.620
#> GSM877127     3  0.4406     -0.225 0.000 0.000 0.700 0.300
#> GSM877138     4  0.4948      0.700 0.000 0.000 0.440 0.560
#> GSM877140     4  0.4972      0.692 0.000 0.000 0.456 0.544
#> GSM877156     2  0.3074      0.786 0.000 0.848 0.000 0.152
#> GSM877130     2  0.0336      0.808 0.000 0.992 0.000 0.008
#> GSM877141     2  0.2635      0.740 0.000 0.904 0.076 0.020
#> GSM877142     2  0.0336      0.808 0.000 0.992 0.000 0.008
#> GSM877145     2  0.0469      0.812 0.000 0.988 0.000 0.012
#> GSM877151     2  0.1940      0.805 0.000 0.924 0.000 0.076
#> GSM877158     2  0.0336      0.808 0.000 0.992 0.000 0.008
#> GSM877173     2  0.0336      0.808 0.000 0.992 0.000 0.008
#> GSM877176     2  0.1118      0.791 0.000 0.964 0.000 0.036
#> GSM877179     2  0.0927      0.801 0.000 0.976 0.016 0.008
#> GSM877181     2  0.0188      0.811 0.000 0.996 0.000 0.004
#> GSM877185     2  0.0000      0.811 0.000 1.000 0.000 0.000
#> GSM877131     4  0.7135      0.370 0.000 0.400 0.132 0.468
#> GSM877147     4  0.5630      0.729 0.000 0.032 0.360 0.608
#> GSM877155     2  0.1211      0.809 0.000 0.960 0.000 0.040
#> GSM877159     4  0.5713      0.726 0.000 0.040 0.340 0.620
#> GSM877170     3  0.6016      0.215 0.000 0.412 0.544 0.044
#> GSM877186     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM877132     2  0.0469      0.812 0.000 0.988 0.000 0.012
#> GSM877143     2  0.4855      0.706 0.000 0.600 0.000 0.400
#> GSM877146     2  0.4855      0.706 0.000 0.600 0.000 0.400
#> GSM877148     2  0.4888      0.701 0.000 0.588 0.000 0.412
#> GSM877152     2  0.4888      0.701 0.000 0.588 0.000 0.412
#> GSM877168     2  0.4888      0.701 0.000 0.588 0.000 0.412
#> GSM877180     2  0.4888      0.701 0.000 0.588 0.000 0.412
#> GSM877126     3  0.0524      0.564 0.008 0.000 0.988 0.004
#> GSM877129     3  0.0336      0.569 0.008 0.000 0.992 0.000
#> GSM877133     1  0.3123      0.795 0.844 0.000 0.156 0.000
#> GSM877153     4  0.4961      0.699 0.000 0.000 0.448 0.552
#> GSM877169     1  0.3801      0.692 0.780 0.000 0.220 0.000
#> GSM877171     3  0.4522      0.531 0.320 0.000 0.680 0.000
#> GSM877174     3  0.4103      0.587 0.256 0.000 0.744 0.000
#> GSM877134     1  0.2266      0.871 0.912 0.084 0.000 0.004
#> GSM877135     1  0.0592      0.951 0.984 0.000 0.000 0.016
#> GSM877136     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM877137     1  0.2197      0.895 0.916 0.000 0.004 0.080
#> GSM877139     1  0.1109      0.944 0.968 0.000 0.004 0.028
#> GSM877149     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM877154     2  0.4730      0.722 0.000 0.636 0.000 0.364
#> GSM877157     1  0.0469      0.954 0.988 0.000 0.000 0.012
#> GSM877160     1  0.0188      0.958 0.996 0.000 0.004 0.000
#> GSM877161     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM877163     1  0.0188      0.958 0.996 0.000 0.004 0.000
#> GSM877166     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM877167     2  0.4804      0.714 0.000 0.616 0.000 0.384
#> GSM877175     1  0.0188      0.958 0.996 0.000 0.004 0.000
#> GSM877177     1  0.0707      0.949 0.980 0.000 0.000 0.020
#> GSM877184     1  0.0000      0.958 1.000 0.000 0.000 0.000
#> GSM877187     2  0.4948      0.676 0.000 0.560 0.000 0.440
#> GSM877188     1  0.0188      0.958 0.996 0.000 0.004 0.000
#> GSM877150     1  0.0188      0.958 0.996 0.000 0.004 0.000
#> GSM877165     2  0.0000      0.811 0.000 1.000 0.000 0.000
#> GSM877183     4  0.4994      0.479 0.000 0.000 0.480 0.520
#> GSM877178     3  0.1211      0.597 0.040 0.000 0.960 0.000
#> GSM877182     4  0.6773      0.343 0.012 0.388 0.068 0.532

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0703     0.8234 0.000 0.000 0.024 0.976 0.000
#> GSM877128     3  0.1251     0.9088 0.008 0.000 0.956 0.036 0.000
#> GSM877164     3  0.1205     0.9014 0.040 0.000 0.956 0.004 0.000
#> GSM877162     4  0.0162     0.8240 0.000 0.000 0.000 0.996 0.004
#> GSM877127     3  0.4806     0.2402 0.000 0.004 0.572 0.408 0.016
#> GSM877138     4  0.1800     0.8157 0.000 0.000 0.048 0.932 0.020
#> GSM877140     4  0.2248     0.7949 0.000 0.000 0.088 0.900 0.012
#> GSM877156     2  0.5355     0.2816 0.000 0.576 0.016 0.032 0.376
#> GSM877130     2  0.2305     0.8637 0.000 0.896 0.000 0.012 0.092
#> GSM877141     2  0.2854     0.8561 0.000 0.880 0.008 0.028 0.084
#> GSM877142     2  0.2597     0.8605 0.000 0.884 0.000 0.024 0.092
#> GSM877145     2  0.1579     0.8437 0.000 0.944 0.024 0.000 0.032
#> GSM877151     2  0.3789     0.7644 0.000 0.768 0.000 0.020 0.212
#> GSM877158     2  0.2390     0.8616 0.000 0.896 0.000 0.020 0.084
#> GSM877173     2  0.2248     0.8640 0.000 0.900 0.000 0.012 0.088
#> GSM877176     2  0.1211     0.8386 0.000 0.960 0.024 0.000 0.016
#> GSM877179     2  0.2331     0.8612 0.000 0.900 0.000 0.020 0.080
#> GSM877181     2  0.1845     0.8549 0.000 0.928 0.016 0.000 0.056
#> GSM877185     2  0.2077     0.8610 0.000 0.908 0.008 0.000 0.084
#> GSM877131     4  0.5232    -0.0991 0.000 0.456 0.000 0.500 0.044
#> GSM877147     4  0.0162     0.8245 0.000 0.000 0.000 0.996 0.004
#> GSM877155     2  0.2915     0.8509 0.000 0.860 0.000 0.024 0.116
#> GSM877159     4  0.0000     0.8242 0.000 0.000 0.000 1.000 0.000
#> GSM877170     2  0.4380     0.5136 0.000 0.676 0.304 0.020 0.000
#> GSM877186     1  0.0579     0.9252 0.984 0.000 0.008 0.008 0.000
#> GSM877132     2  0.1568     0.8399 0.000 0.944 0.020 0.000 0.036
#> GSM877143     5  0.2228     0.8833 0.000 0.068 0.012 0.008 0.912
#> GSM877146     5  0.2228     0.8833 0.000 0.068 0.012 0.008 0.912
#> GSM877148     5  0.0703     0.9080 0.000 0.024 0.000 0.000 0.976
#> GSM877152     5  0.0880     0.9068 0.000 0.032 0.000 0.000 0.968
#> GSM877168     5  0.0510     0.9066 0.000 0.016 0.000 0.000 0.984
#> GSM877180     5  0.0510     0.9066 0.000 0.016 0.000 0.000 0.984
#> GSM877126     3  0.1251     0.9088 0.008 0.000 0.956 0.036 0.000
#> GSM877129     3  0.1251     0.9088 0.008 0.000 0.956 0.036 0.000
#> GSM877133     1  0.4151     0.4660 0.652 0.000 0.344 0.000 0.004
#> GSM877153     4  0.1671     0.8063 0.000 0.000 0.076 0.924 0.000
#> GSM877169     1  0.4297     0.1078 0.528 0.000 0.472 0.000 0.000
#> GSM877171     3  0.1197     0.8963 0.048 0.000 0.952 0.000 0.000
#> GSM877174     3  0.1197     0.8963 0.048 0.000 0.952 0.000 0.000
#> GSM877134     1  0.2756     0.8510 0.880 0.092 0.024 0.000 0.004
#> GSM877135     1  0.0451     0.9268 0.988 0.000 0.004 0.000 0.008
#> GSM877136     1  0.0000     0.9290 1.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.2074     0.8555 0.896 0.000 0.000 0.000 0.104
#> GSM877139     1  0.0609     0.9228 0.980 0.000 0.000 0.000 0.020
#> GSM877149     1  0.1728     0.9020 0.940 0.036 0.020 0.000 0.004
#> GSM877154     5  0.4157     0.7103 0.000 0.264 0.020 0.000 0.716
#> GSM877157     1  0.0566     0.9256 0.984 0.000 0.012 0.000 0.004
#> GSM877160     1  0.0162     0.9278 0.996 0.000 0.004 0.000 0.000
#> GSM877161     1  0.0000     0.9290 1.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.0000     0.9290 1.000 0.000 0.000 0.000 0.000
#> GSM877166     1  0.0000     0.9290 1.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.3496     0.7726 0.000 0.200 0.012 0.000 0.788
#> GSM877175     1  0.0000     0.9290 1.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.0290     0.9281 0.992 0.000 0.000 0.000 0.008
#> GSM877184     1  0.1728     0.9048 0.940 0.020 0.036 0.000 0.004
#> GSM877187     5  0.1623     0.8921 0.000 0.020 0.016 0.016 0.948
#> GSM877188     1  0.0000     0.9290 1.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.9290 1.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.1845     0.8566 0.000 0.928 0.016 0.000 0.056
#> GSM877183     4  0.6679     0.3359 0.000 0.016 0.252 0.528 0.204
#> GSM877178     3  0.1281     0.9091 0.012 0.000 0.956 0.032 0.000
#> GSM877182     2  0.5088     0.4646 0.004 0.664 0.040 0.284 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0146      0.885 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM877128     3  0.0692      0.908 0.000 0.000 0.976 0.020 0.000 0.004
#> GSM877164     3  0.0000      0.924 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877162     4  0.0405      0.884 0.000 0.004 0.000 0.988 0.000 0.008
#> GSM877127     3  0.5932      0.149 0.000 0.000 0.504 0.352 0.028 0.116
#> GSM877138     4  0.2345      0.853 0.000 0.000 0.016 0.896 0.016 0.072
#> GSM877140     4  0.2209      0.856 0.000 0.000 0.040 0.904 0.004 0.052
#> GSM877156     6  0.6361      0.227 0.000 0.312 0.000 0.012 0.280 0.396
#> GSM877130     2  0.1141      0.653 0.000 0.948 0.000 0.000 0.000 0.052
#> GSM877141     2  0.1501      0.629 0.000 0.924 0.000 0.000 0.000 0.076
#> GSM877142     2  0.0458      0.666 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM877145     2  0.4264     -0.353 0.000 0.492 0.000 0.000 0.016 0.492
#> GSM877151     2  0.2094      0.609 0.000 0.900 0.000 0.000 0.080 0.020
#> GSM877158     2  0.0547      0.664 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM877173     2  0.0632      0.666 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM877176     6  0.3982      0.249 0.000 0.460 0.000 0.000 0.004 0.536
#> GSM877179     2  0.0790      0.659 0.000 0.968 0.000 0.000 0.000 0.032
#> GSM877181     2  0.3953      0.220 0.000 0.656 0.000 0.000 0.016 0.328
#> GSM877185     2  0.3245      0.449 0.000 0.764 0.000 0.000 0.008 0.228
#> GSM877131     2  0.3969      0.236 0.000 0.652 0.000 0.332 0.000 0.016
#> GSM877147     4  0.0146      0.885 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM877155     2  0.0935      0.664 0.000 0.964 0.000 0.000 0.004 0.032
#> GSM877159     4  0.0405      0.884 0.000 0.004 0.000 0.988 0.000 0.008
#> GSM877170     2  0.6053     -0.136 0.000 0.452 0.236 0.004 0.000 0.308
#> GSM877186     1  0.1232      0.877 0.956 0.000 0.000 0.024 0.004 0.016
#> GSM877132     6  0.4099      0.411 0.000 0.372 0.000 0.000 0.016 0.612
#> GSM877143     5  0.3792      0.731 0.000 0.112 0.000 0.000 0.780 0.108
#> GSM877146     5  0.3792      0.731 0.000 0.112 0.000 0.000 0.780 0.108
#> GSM877148     5  0.1812      0.797 0.000 0.080 0.000 0.000 0.912 0.008
#> GSM877152     5  0.1682      0.785 0.000 0.020 0.000 0.000 0.928 0.052
#> GSM877168     5  0.0865      0.803 0.000 0.036 0.000 0.000 0.964 0.000
#> GSM877180     5  0.0865      0.803 0.000 0.036 0.000 0.000 0.964 0.000
#> GSM877126     3  0.0146      0.922 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM877129     3  0.0000      0.924 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877133     1  0.4087      0.628 0.704 0.000 0.264 0.004 0.004 0.024
#> GSM877153     4  0.0692      0.881 0.000 0.000 0.020 0.976 0.000 0.004
#> GSM877169     1  0.4386      0.424 0.600 0.000 0.372 0.000 0.004 0.024
#> GSM877171     3  0.0146      0.921 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877174     3  0.0000      0.924 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877134     1  0.4172      0.423 0.564 0.008 0.000 0.000 0.004 0.424
#> GSM877135     1  0.0632      0.882 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM877136     1  0.0260      0.882 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM877137     1  0.3286      0.810 0.836 0.016 0.000 0.000 0.104 0.044
#> GSM877139     1  0.1196      0.879 0.952 0.000 0.000 0.000 0.008 0.040
#> GSM877149     1  0.3151      0.713 0.748 0.000 0.000 0.000 0.000 0.252
#> GSM877154     5  0.4993      0.379 0.000 0.084 0.000 0.000 0.572 0.344
#> GSM877157     1  0.1196      0.878 0.952 0.000 0.000 0.000 0.008 0.040
#> GSM877160     1  0.1485      0.875 0.944 0.000 0.024 0.000 0.004 0.028
#> GSM877161     1  0.0458      0.882 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM877163     1  0.1843      0.867 0.912 0.000 0.004 0.000 0.004 0.080
#> GSM877166     1  0.0363      0.882 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM877167     5  0.4746      0.519 0.000 0.116 0.000 0.000 0.668 0.216
#> GSM877175     1  0.0767      0.881 0.976 0.000 0.008 0.000 0.004 0.012
#> GSM877177     1  0.0692      0.882 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM877184     1  0.3521      0.714 0.724 0.000 0.004 0.000 0.004 0.268
#> GSM877187     5  0.3282      0.751 0.000 0.016 0.000 0.012 0.808 0.164
#> GSM877188     1  0.1138      0.879 0.960 0.000 0.012 0.000 0.004 0.024
#> GSM877150     1  0.0291      0.882 0.992 0.000 0.004 0.000 0.004 0.000
#> GSM877165     2  0.3853      0.280 0.000 0.680 0.000 0.000 0.016 0.304
#> GSM877183     4  0.7634      0.183 0.000 0.004 0.188 0.372 0.228 0.208
#> GSM877178     3  0.0000      0.924 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877182     6  0.5323      0.432 0.008 0.156 0.012 0.136 0.008 0.680

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) genotype/variation(p) other(p) k
#> SD:skmeans 62           0.2193               0.52956 7.89e-08 2
#> SD:skmeans 61           0.0883               0.02748 2.39e-12 3
#> SD:skmeans 57           0.0283               0.00637 5.60e-14 4
#> SD:skmeans 55           0.1039               0.00234 1.32e-20 5
#> SD:skmeans 47           0.1375               0.01032 1.94e-18 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 62 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 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-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.835           0.841       0.936         0.4281 0.545   0.545
#> 3 3 0.682           0.798       0.905         0.3610 0.846   0.722
#> 4 4 0.600           0.642       0.829         0.1670 0.873   0.704
#> 5 5 0.698           0.667       0.854         0.0717 0.953   0.857
#> 6 6 0.721           0.611       0.830         0.0490 0.910   0.703

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM877144     1  0.0376     0.9646 0.996 0.004
#> GSM877128     1  0.0000     0.9648 1.000 0.000
#> GSM877164     1  0.0000     0.9648 1.000 0.000
#> GSM877162     2  0.0000     0.8483 0.000 1.000
#> GSM877127     1  0.0938     0.9620 0.988 0.012
#> GSM877138     1  0.0376     0.9646 0.996 0.004
#> GSM877140     1  0.0376     0.9646 0.996 0.004
#> GSM877156     2  0.0938     0.8422 0.012 0.988
#> GSM877130     2  0.0000     0.8483 0.000 1.000
#> GSM877141     1  0.9833     0.0782 0.576 0.424
#> GSM877142     2  0.0000     0.8483 0.000 1.000
#> GSM877145     2  0.9866     0.3620 0.432 0.568
#> GSM877151     2  0.0000     0.8483 0.000 1.000
#> GSM877158     2  0.0000     0.8483 0.000 1.000
#> GSM877173     2  0.9970     0.2676 0.468 0.532
#> GSM877176     2  0.0000     0.8483 0.000 1.000
#> GSM877179     2  0.0672     0.8443 0.008 0.992
#> GSM877181     2  0.0000     0.8483 0.000 1.000
#> GSM877185     2  0.0000     0.8483 0.000 1.000
#> GSM877131     2  0.0000     0.8483 0.000 1.000
#> GSM877147     2  0.0000     0.8483 0.000 1.000
#> GSM877155     2  0.0000     0.8483 0.000 1.000
#> GSM877159     2  0.0000     0.8483 0.000 1.000
#> GSM877170     2  1.0000     0.1815 0.496 0.504
#> GSM877186     1  0.0000     0.9648 1.000 0.000
#> GSM877132     2  0.9993     0.2185 0.484 0.516
#> GSM877143     1  0.1414     0.9568 0.980 0.020
#> GSM877146     1  0.2043     0.9456 0.968 0.032
#> GSM877148     1  0.5408     0.8282 0.876 0.124
#> GSM877152     1  0.0938     0.9620 0.988 0.012
#> GSM877168     1  0.1184     0.9598 0.984 0.016
#> GSM877180     1  0.0938     0.9620 0.988 0.012
#> GSM877126     1  0.0938     0.9619 0.988 0.012
#> GSM877129     1  0.0376     0.9638 0.996 0.004
#> GSM877133     1  0.0000     0.9648 1.000 0.000
#> GSM877153     1  0.0000     0.9648 1.000 0.000
#> GSM877169     1  0.0000     0.9648 1.000 0.000
#> GSM877171     1  0.0000     0.9648 1.000 0.000
#> GSM877174     1  0.0000     0.9648 1.000 0.000
#> GSM877134     1  0.2423     0.9376 0.960 0.040
#> GSM877135     1  0.0000     0.9648 1.000 0.000
#> GSM877136     1  0.0000     0.9648 1.000 0.000
#> GSM877137     1  0.0938     0.9620 0.988 0.012
#> GSM877139     1  0.0376     0.9646 0.996 0.004
#> GSM877149     1  0.1184     0.9600 0.984 0.016
#> GSM877154     1  0.9635     0.2224 0.612 0.388
#> GSM877157     1  0.0938     0.9620 0.988 0.012
#> GSM877160     1  0.0000     0.9648 1.000 0.000
#> GSM877161     1  0.0000     0.9648 1.000 0.000
#> GSM877163     1  0.0672     0.9633 0.992 0.008
#> GSM877166     1  0.0000     0.9648 1.000 0.000
#> GSM877167     2  0.9866     0.3621 0.432 0.568
#> GSM877175     1  0.0000     0.9648 1.000 0.000
#> GSM877177     1  0.0000     0.9648 1.000 0.000
#> GSM877184     1  0.0376     0.9646 0.996 0.004
#> GSM877187     1  0.1184     0.9604 0.984 0.016
#> GSM877188     1  0.0000     0.9648 1.000 0.000
#> GSM877150     1  0.0000     0.9648 1.000 0.000
#> GSM877165     2  0.0000     0.8483 0.000 1.000
#> GSM877183     1  0.1414     0.9578 0.980 0.020
#> GSM877178     1  0.0000     0.9648 1.000 0.000
#> GSM877182     2  0.9866     0.3620 0.432 0.568

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     1  0.0424     0.9164 0.992 0.008 0.000
#> GSM877128     1  0.6062     0.4453 0.616 0.000 0.384
#> GSM877164     3  0.0000     0.9915 0.000 0.000 1.000
#> GSM877162     2  0.0237     0.7869 0.004 0.996 0.000
#> GSM877127     1  0.0747     0.9132 0.984 0.016 0.000
#> GSM877138     1  0.1163     0.9099 0.972 0.028 0.000
#> GSM877140     1  0.2599     0.8912 0.932 0.016 0.052
#> GSM877156     2  0.3116     0.7417 0.108 0.892 0.000
#> GSM877130     2  0.0000     0.7878 0.000 1.000 0.000
#> GSM877141     2  0.6295     0.2324 0.472 0.528 0.000
#> GSM877142     2  0.0000     0.7878 0.000 1.000 0.000
#> GSM877145     2  0.6204     0.4332 0.424 0.576 0.000
#> GSM877151     2  0.0000     0.7878 0.000 1.000 0.000
#> GSM877158     2  0.0000     0.7878 0.000 1.000 0.000
#> GSM877173     2  0.5859     0.5285 0.344 0.656 0.000
#> GSM877176     2  0.2878     0.7428 0.096 0.904 0.000
#> GSM877179     2  0.1163     0.7743 0.028 0.972 0.000
#> GSM877181     2  0.0892     0.7797 0.020 0.980 0.000
#> GSM877185     2  0.0000     0.7878 0.000 1.000 0.000
#> GSM877131     2  0.0000     0.7878 0.000 1.000 0.000
#> GSM877147     2  0.0237     0.7869 0.004 0.996 0.000
#> GSM877155     2  0.0000     0.7878 0.000 1.000 0.000
#> GSM877159     2  0.0592     0.7852 0.012 0.988 0.000
#> GSM877170     2  0.9975     0.2076 0.312 0.368 0.320
#> GSM877186     1  0.1289     0.9181 0.968 0.000 0.032
#> GSM877132     2  0.6267     0.3649 0.452 0.548 0.000
#> GSM877143     1  0.3116     0.8571 0.892 0.108 0.000
#> GSM877146     1  0.3412     0.8414 0.876 0.124 0.000
#> GSM877148     1  0.5216     0.6260 0.740 0.260 0.000
#> GSM877152     1  0.2537     0.8768 0.920 0.080 0.000
#> GSM877168     1  0.3038     0.8576 0.896 0.104 0.000
#> GSM877180     1  0.2537     0.8768 0.920 0.080 0.000
#> GSM877126     3  0.0237     0.9901 0.004 0.000 0.996
#> GSM877129     3  0.1163     0.9653 0.028 0.000 0.972
#> GSM877133     1  0.2959     0.8676 0.900 0.000 0.100
#> GSM877153     3  0.0424     0.9880 0.008 0.000 0.992
#> GSM877169     1  0.4178     0.8154 0.828 0.000 0.172
#> GSM877171     3  0.0000     0.9915 0.000 0.000 1.000
#> GSM877174     3  0.0000     0.9915 0.000 0.000 1.000
#> GSM877134     1  0.1643     0.9040 0.956 0.044 0.000
#> GSM877135     1  0.0424     0.9180 0.992 0.000 0.008
#> GSM877136     1  0.1289     0.9181 0.968 0.000 0.032
#> GSM877137     1  0.0237     0.9171 0.996 0.000 0.004
#> GSM877139     1  0.0000     0.9165 1.000 0.000 0.000
#> GSM877149     1  0.1163     0.9182 0.972 0.000 0.028
#> GSM877154     1  0.6180     0.0773 0.584 0.416 0.000
#> GSM877157     1  0.1163     0.9182 0.972 0.000 0.028
#> GSM877160     1  0.1289     0.9181 0.968 0.000 0.032
#> GSM877161     1  0.1289     0.9181 0.968 0.000 0.032
#> GSM877163     1  0.1163     0.9185 0.972 0.000 0.028
#> GSM877166     1  0.1289     0.9181 0.968 0.000 0.032
#> GSM877167     2  0.6095     0.4776 0.392 0.608 0.000
#> GSM877175     1  0.1289     0.9181 0.968 0.000 0.032
#> GSM877177     1  0.0424     0.9183 0.992 0.000 0.008
#> GSM877184     1  0.0000     0.9165 1.000 0.000 0.000
#> GSM877187     1  0.1289     0.9111 0.968 0.032 0.000
#> GSM877188     1  0.1289     0.9181 0.968 0.000 0.032
#> GSM877150     1  0.1289     0.9181 0.968 0.000 0.032
#> GSM877165     2  0.0000     0.7878 0.000 1.000 0.000
#> GSM877183     1  0.1031     0.9128 0.976 0.024 0.000
#> GSM877178     3  0.0000     0.9915 0.000 0.000 1.000
#> GSM877182     2  0.6204     0.4332 0.424 0.576 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     1  0.4980     0.4325 0.680 0.000 0.016 0.304
#> GSM877128     1  0.4998     0.0971 0.512 0.000 0.488 0.000
#> GSM877164     3  0.0592     0.8811 0.016 0.000 0.984 0.000
#> GSM877162     2  0.4175     0.5996 0.000 0.784 0.016 0.200
#> GSM877127     1  0.4103     0.4599 0.744 0.000 0.000 0.256
#> GSM877138     1  0.2589     0.7067 0.884 0.000 0.000 0.116
#> GSM877140     1  0.4837     0.2028 0.648 0.000 0.004 0.348
#> GSM877156     2  0.6167     0.5459 0.256 0.648 0.000 0.096
#> GSM877130     2  0.0000     0.7244 0.000 1.000 0.000 0.000
#> GSM877141     2  0.7149     0.2454 0.416 0.452 0.000 0.132
#> GSM877142     2  0.0000     0.7244 0.000 1.000 0.000 0.000
#> GSM877145     2  0.4898     0.4628 0.416 0.584 0.000 0.000
#> GSM877151     2  0.2281     0.6904 0.000 0.904 0.000 0.096
#> GSM877158     2  0.0000     0.7244 0.000 1.000 0.000 0.000
#> GSM877173     2  0.3691     0.6722 0.076 0.856 0.000 0.068
#> GSM877176     2  0.4624     0.5377 0.340 0.660 0.000 0.000
#> GSM877179     2  0.1059     0.7149 0.016 0.972 0.000 0.012
#> GSM877181     2  0.0000     0.7244 0.000 1.000 0.000 0.000
#> GSM877185     2  0.0000     0.7244 0.000 1.000 0.000 0.000
#> GSM877131     2  0.2859     0.6675 0.000 0.880 0.008 0.112
#> GSM877147     2  0.5352     0.4778 0.000 0.596 0.016 0.388
#> GSM877155     2  0.0000     0.7244 0.000 1.000 0.000 0.000
#> GSM877159     4  0.5149     0.0322 0.000 0.336 0.016 0.648
#> GSM877170     3  0.5835     0.2997 0.028 0.356 0.608 0.008
#> GSM877186     1  0.0779     0.8153 0.980 0.000 0.016 0.004
#> GSM877132     2  0.5070     0.4590 0.416 0.580 0.000 0.004
#> GSM877143     4  0.4356     0.8065 0.292 0.000 0.000 0.708
#> GSM877146     4  0.4509     0.8047 0.288 0.004 0.000 0.708
#> GSM877148     4  0.4431     0.7964 0.304 0.000 0.000 0.696
#> GSM877152     1  0.4713     0.1288 0.640 0.000 0.000 0.360
#> GSM877168     4  0.4356     0.8065 0.292 0.000 0.000 0.708
#> GSM877180     4  0.4830     0.6458 0.392 0.000 0.000 0.608
#> GSM877126     3  0.0707     0.8791 0.020 0.000 0.980 0.000
#> GSM877129     3  0.1174     0.8580 0.020 0.000 0.968 0.012
#> GSM877133     1  0.5057     0.3428 0.648 0.000 0.340 0.012
#> GSM877153     3  0.4356     0.6605 0.000 0.000 0.708 0.292
#> GSM877169     1  0.4877     0.2776 0.592 0.000 0.408 0.000
#> GSM877171     3  0.0592     0.8811 0.016 0.000 0.984 0.000
#> GSM877174     3  0.0592     0.8811 0.016 0.000 0.984 0.000
#> GSM877134     1  0.1474     0.7800 0.948 0.052 0.000 0.000
#> GSM877135     1  0.0336     0.8096 0.992 0.000 0.000 0.008
#> GSM877136     1  0.0592     0.8169 0.984 0.000 0.016 0.000
#> GSM877137     1  0.0469     0.8074 0.988 0.000 0.000 0.012
#> GSM877139     1  0.0469     0.8074 0.988 0.000 0.000 0.012
#> GSM877149     1  0.0779     0.8152 0.980 0.004 0.016 0.000
#> GSM877154     2  0.7740    -0.0636 0.236 0.416 0.000 0.348
#> GSM877157     1  0.0592     0.8169 0.984 0.000 0.016 0.000
#> GSM877160     1  0.0592     0.8169 0.984 0.000 0.016 0.000
#> GSM877161     1  0.0592     0.8169 0.984 0.000 0.016 0.000
#> GSM877163     1  0.0469     0.8163 0.988 0.000 0.012 0.000
#> GSM877166     1  0.0592     0.8169 0.984 0.000 0.016 0.000
#> GSM877167     2  0.6391     0.4159 0.084 0.588 0.000 0.328
#> GSM877175     1  0.0592     0.8169 0.984 0.000 0.016 0.000
#> GSM877177     1  0.0188     0.8115 0.996 0.000 0.000 0.004
#> GSM877184     1  0.0657     0.8056 0.984 0.004 0.000 0.012
#> GSM877187     1  0.4199     0.6208 0.804 0.032 0.000 0.164
#> GSM877188     1  0.0592     0.8169 0.984 0.000 0.016 0.000
#> GSM877150     1  0.0592     0.8169 0.984 0.000 0.016 0.000
#> GSM877165     2  0.0000     0.7244 0.000 1.000 0.000 0.000
#> GSM877183     1  0.3257     0.6588 0.844 0.000 0.004 0.152
#> GSM877178     3  0.0592     0.8811 0.016 0.000 0.984 0.000
#> GSM877182     2  0.4898     0.4628 0.416 0.584 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0880     0.8874 0.032 0.000 0.000 0.968 0.000
#> GSM877128     3  0.4528     0.1047 0.444 0.000 0.548 0.008 0.000
#> GSM877164     3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000
#> GSM877162     2  0.4126     0.2334 0.000 0.620 0.000 0.380 0.000
#> GSM877127     1  0.4716     0.5201 0.656 0.000 0.000 0.036 0.308
#> GSM877138     1  0.3517     0.7687 0.832 0.000 0.000 0.068 0.100
#> GSM877140     1  0.5553     0.1155 0.484 0.000 0.000 0.068 0.448
#> GSM877156     2  0.5921     0.5233 0.312 0.596 0.000 0.036 0.056
#> GSM877130     2  0.0000     0.6982 0.000 1.000 0.000 0.000 0.000
#> GSM877141     2  0.7255     0.3099 0.372 0.428 0.000 0.052 0.148
#> GSM877142     2  0.0880     0.6865 0.000 0.968 0.000 0.000 0.032
#> GSM877145     2  0.4219     0.4644 0.416 0.584 0.000 0.000 0.000
#> GSM877151     2  0.1341     0.6880 0.000 0.944 0.000 0.000 0.056
#> GSM877158     2  0.0000     0.6982 0.000 1.000 0.000 0.000 0.000
#> GSM877173     2  0.1544     0.6841 0.000 0.932 0.000 0.000 0.068
#> GSM877176     2  0.4182     0.4897 0.400 0.600 0.000 0.000 0.000
#> GSM877179     2  0.1043     0.6887 0.000 0.960 0.000 0.000 0.040
#> GSM877181     2  0.0000     0.6982 0.000 1.000 0.000 0.000 0.000
#> GSM877185     2  0.0000     0.6982 0.000 1.000 0.000 0.000 0.000
#> GSM877131     2  0.2471     0.5942 0.000 0.864 0.000 0.136 0.000
#> GSM877147     4  0.0794     0.8896 0.000 0.028 0.000 0.972 0.000
#> GSM877155     2  0.0404     0.6950 0.000 0.988 0.000 0.000 0.012
#> GSM877159     5  0.6569     0.0881 0.000 0.240 0.000 0.292 0.468
#> GSM877170     3  0.2536     0.6972 0.000 0.128 0.868 0.004 0.000
#> GSM877186     1  0.0404     0.8544 0.988 0.000 0.000 0.012 0.000
#> GSM877132     2  0.4974     0.4586 0.408 0.560 0.000 0.000 0.032
#> GSM877143     5  0.1041     0.7681 0.000 0.004 0.000 0.032 0.964
#> GSM877146     5  0.1041     0.7681 0.000 0.004 0.000 0.032 0.964
#> GSM877148     5  0.0162     0.7675 0.004 0.000 0.000 0.000 0.996
#> GSM877152     1  0.4268     0.2618 0.556 0.000 0.000 0.000 0.444
#> GSM877168     5  0.0000     0.7679 0.000 0.000 0.000 0.000 1.000
#> GSM877180     5  0.3452     0.4990 0.244 0.000 0.000 0.000 0.756
#> GSM877126     3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000
#> GSM877129     3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000
#> GSM877133     1  0.5086     0.2875 0.564 0.000 0.396 0.000 0.040
#> GSM877153     4  0.2377     0.8460 0.000 0.000 0.128 0.872 0.000
#> GSM877169     1  0.4182     0.2776 0.600 0.000 0.400 0.000 0.000
#> GSM877171     3  0.0162     0.8549 0.004 0.000 0.996 0.000 0.000
#> GSM877174     3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000
#> GSM877134     1  0.2236     0.8169 0.908 0.068 0.000 0.000 0.024
#> GSM877135     1  0.1043     0.8516 0.960 0.000 0.000 0.000 0.040
#> GSM877136     1  0.0000     0.8575 1.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.1043     0.8516 0.960 0.000 0.000 0.000 0.040
#> GSM877139     1  0.1043     0.8516 0.960 0.000 0.000 0.000 0.040
#> GSM877149     1  0.0609     0.8495 0.980 0.020 0.000 0.000 0.000
#> GSM877154     2  0.7010     0.1120 0.144 0.436 0.000 0.036 0.384
#> GSM877157     1  0.0000     0.8575 1.000 0.000 0.000 0.000 0.000
#> GSM877160     1  0.0000     0.8575 1.000 0.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.8575 1.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.0000     0.8575 1.000 0.000 0.000 0.000 0.000
#> GSM877166     1  0.0000     0.8575 1.000 0.000 0.000 0.000 0.000
#> GSM877167     2  0.4768     0.3547 0.024 0.592 0.000 0.000 0.384
#> GSM877175     1  0.0000     0.8575 1.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.0963     0.8526 0.964 0.000 0.000 0.000 0.036
#> GSM877184     1  0.1043     0.8516 0.960 0.000 0.000 0.000 0.040
#> GSM877187     1  0.3616     0.7273 0.804 0.032 0.000 0.000 0.164
#> GSM877188     1  0.0000     0.8575 1.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.1197     0.8354 0.952 0.000 0.048 0.000 0.000
#> GSM877165     2  0.0000     0.6982 0.000 1.000 0.000 0.000 0.000
#> GSM877183     1  0.3772     0.7275 0.792 0.000 0.000 0.036 0.172
#> GSM877178     3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000
#> GSM877182     2  0.4219     0.4644 0.416 0.584 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0146    0.94015 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM877128     3  0.3866   -0.02705 0.484 0.000 0.516 0.000 0.000 0.000
#> GSM877164     3  0.0000    0.84023 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877162     2  0.3531    0.36702 0.000 0.672 0.000 0.328 0.000 0.000
#> GSM877127     1  0.3898    0.44273 0.652 0.012 0.000 0.000 0.336 0.000
#> GSM877138     6  0.4808   -0.00202 0.472 0.000 0.000 0.000 0.052 0.476
#> GSM877140     6  0.2266    0.46527 0.108 0.000 0.000 0.000 0.012 0.880
#> GSM877156     2  0.5629    0.23956 0.412 0.456 0.000 0.000 0.004 0.128
#> GSM877130     2  0.0146    0.68368 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM877141     6  0.6962   -0.02002 0.312 0.252 0.000 0.000 0.060 0.376
#> GSM877142     2  0.1219    0.67188 0.000 0.948 0.000 0.000 0.004 0.048
#> GSM877145     2  0.4222    0.14712 0.472 0.516 0.000 0.000 0.008 0.004
#> GSM877151     2  0.0520    0.68261 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM877158     2  0.2738    0.61383 0.000 0.820 0.000 0.000 0.004 0.176
#> GSM877173     2  0.3730    0.58512 0.000 0.772 0.000 0.000 0.060 0.168
#> GSM877176     2  0.4144    0.31560 0.408 0.580 0.000 0.000 0.008 0.004
#> GSM877179     2  0.3679    0.58563 0.000 0.772 0.000 0.000 0.052 0.176
#> GSM877181     2  0.0260    0.68371 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM877185     2  0.0260    0.68371 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM877131     2  0.4603    0.53133 0.000 0.704 0.000 0.116 0.004 0.176
#> GSM877147     4  0.0146    0.94001 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM877155     2  0.1082    0.67670 0.000 0.956 0.000 0.000 0.004 0.040
#> GSM877159     6  0.3359    0.26904 0.000 0.012 0.000 0.196 0.008 0.784
#> GSM877170     3  0.3948    0.63351 0.004 0.080 0.780 0.000 0.004 0.132
#> GSM877186     1  0.0458    0.83510 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM877132     2  0.5467    0.23077 0.408 0.488 0.000 0.000 0.008 0.096
#> GSM877143     6  0.2631    0.42356 0.000 0.000 0.000 0.000 0.180 0.820
#> GSM877146     6  0.2631    0.42356 0.000 0.000 0.000 0.000 0.180 0.820
#> GSM877148     5  0.0363    0.75688 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM877152     5  0.2762    0.66350 0.196 0.000 0.000 0.000 0.804 0.000
#> GSM877168     5  0.1327    0.71936 0.000 0.000 0.000 0.000 0.936 0.064
#> GSM877180     5  0.1714    0.77265 0.092 0.000 0.000 0.000 0.908 0.000
#> GSM877126     3  0.0000    0.84023 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877129     3  0.0547    0.82804 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM877133     1  0.4882    0.18578 0.540 0.000 0.404 0.004 0.052 0.000
#> GSM877153     4  0.1714    0.88799 0.000 0.000 0.092 0.908 0.000 0.000
#> GSM877169     1  0.4033    0.19818 0.588 0.000 0.404 0.004 0.004 0.000
#> GSM877171     3  0.0146    0.83826 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877174     3  0.0000    0.84023 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877134     1  0.2507    0.78821 0.884 0.072 0.000 0.000 0.040 0.004
#> GSM877135     1  0.1075    0.82915 0.952 0.000 0.000 0.000 0.048 0.000
#> GSM877136     1  0.0146    0.83883 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM877137     1  0.1500    0.82408 0.936 0.012 0.000 0.000 0.052 0.000
#> GSM877139     1  0.1500    0.82408 0.936 0.012 0.000 0.000 0.052 0.000
#> GSM877149     1  0.0922    0.83089 0.968 0.024 0.000 0.000 0.004 0.004
#> GSM877154     5  0.4186    0.66198 0.080 0.192 0.000 0.000 0.728 0.000
#> GSM877157     1  0.0146    0.83858 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM877160     1  0.0291    0.83902 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM877161     1  0.0291    0.83848 0.992 0.000 0.000 0.004 0.000 0.004
#> GSM877163     1  0.0291    0.83915 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM877166     1  0.0146    0.83883 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM877167     2  0.4326   -0.08735 0.008 0.496 0.000 0.000 0.488 0.008
#> GSM877175     1  0.0146    0.83883 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM877177     1  0.1267    0.82579 0.940 0.000 0.000 0.000 0.060 0.000
#> GSM877184     1  0.1719    0.82387 0.924 0.000 0.000 0.000 0.060 0.016
#> GSM877187     1  0.3590    0.69704 0.808 0.032 0.000 0.000 0.024 0.136
#> GSM877188     1  0.0146    0.83883 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM877150     1  0.1152    0.81623 0.952 0.000 0.044 0.004 0.000 0.000
#> GSM877165     2  0.0260    0.68371 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM877183     1  0.4940    0.54268 0.684 0.012 0.000 0.000 0.160 0.144
#> GSM877178     3  0.0000    0.84023 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877182     1  0.5293   -0.14795 0.484 0.432 0.000 0.000 0.008 0.076

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) genotype/variation(p) other(p) k
#> SD:pam 54           0.7216                 0.681 1.50e-08 2
#> SD:pam 54           0.0580                 0.793 5.83e-11 3
#> SD:pam 46           0.1962                 0.731 1.28e-18 4
#> SD:pam 47           0.0340                 0.951 9.96e-17 5
#> SD:pam 45           0.0456                 0.844 2.19e-16 6

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


SD: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 62 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.876           0.915       0.964        0.48968 0.511   0.511
#> 3 3 0.938           0.897       0.942        0.33074 0.775   0.577
#> 4 4 0.526           0.410       0.717        0.00828 0.718   0.390
#> 5 5 0.768           0.763       0.856        0.16881 0.804   0.463
#> 6 6 0.854           0.817       0.909        0.03326 0.930   0.717

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
#> GSM877144     1  0.0000     0.9650 1.000 0.000
#> GSM877128     1  0.0672     0.9626 0.992 0.008
#> GSM877164     1  0.0000     0.9650 1.000 0.000
#> GSM877162     1  0.0000     0.9650 1.000 0.000
#> GSM877127     1  0.4690     0.8839 0.900 0.100
#> GSM877138     1  0.3274     0.9246 0.940 0.060
#> GSM877140     1  0.0376     0.9644 0.996 0.004
#> GSM877156     2  0.0000     0.9578 0.000 1.000
#> GSM877130     2  0.5408     0.8523 0.124 0.876
#> GSM877141     1  0.0376     0.9644 0.996 0.004
#> GSM877142     1  0.4690     0.8803 0.900 0.100
#> GSM877145     2  0.0000     0.9578 0.000 1.000
#> GSM877151     2  0.1843     0.9442 0.028 0.972
#> GSM877158     1  0.0376     0.9644 0.996 0.004
#> GSM877173     1  0.9815     0.2405 0.580 0.420
#> GSM877176     2  0.4939     0.8648 0.108 0.892
#> GSM877179     1  0.0000     0.9650 1.000 0.000
#> GSM877181     2  0.0000     0.9578 0.000 1.000
#> GSM877185     2  0.0000     0.9578 0.000 1.000
#> GSM877131     1  0.0000     0.9650 1.000 0.000
#> GSM877147     1  0.0000     0.9650 1.000 0.000
#> GSM877155     1  0.0938     0.9604 0.988 0.012
#> GSM877159     1  0.0000     0.9650 1.000 0.000
#> GSM877170     1  0.0000     0.9650 1.000 0.000
#> GSM877186     1  0.1414     0.9557 0.980 0.020
#> GSM877132     2  0.0000     0.9578 0.000 1.000
#> GSM877143     2  0.0000     0.9578 0.000 1.000
#> GSM877146     2  0.0000     0.9578 0.000 1.000
#> GSM877148     2  0.0000     0.9578 0.000 1.000
#> GSM877152     2  0.0000     0.9578 0.000 1.000
#> GSM877168     2  0.0000     0.9578 0.000 1.000
#> GSM877180     2  0.0000     0.9578 0.000 1.000
#> GSM877126     1  0.0000     0.9650 1.000 0.000
#> GSM877129     1  0.0000     0.9650 1.000 0.000
#> GSM877133     2  0.5737     0.8363 0.136 0.864
#> GSM877153     1  0.0000     0.9650 1.000 0.000
#> GSM877169     2  0.9998     0.0182 0.492 0.508
#> GSM877171     1  0.0376     0.9644 0.996 0.004
#> GSM877174     1  0.0000     0.9650 1.000 0.000
#> GSM877134     2  0.0672     0.9584 0.008 0.992
#> GSM877135     2  0.0938     0.9586 0.012 0.988
#> GSM877136     2  0.0938     0.9586 0.012 0.988
#> GSM877137     2  0.0938     0.9586 0.012 0.988
#> GSM877139     2  0.0938     0.9586 0.012 0.988
#> GSM877149     2  0.0938     0.9586 0.012 0.988
#> GSM877154     2  0.0000     0.9578 0.000 1.000
#> GSM877157     2  0.0938     0.9586 0.012 0.988
#> GSM877160     2  0.0938     0.9586 0.012 0.988
#> GSM877161     2  0.0938     0.9586 0.012 0.988
#> GSM877163     2  0.0938     0.9586 0.012 0.988
#> GSM877166     2  0.0938     0.9586 0.012 0.988
#> GSM877167     2  0.0000     0.9578 0.000 1.000
#> GSM877175     2  0.0938     0.9586 0.012 0.988
#> GSM877177     2  0.0938     0.9586 0.012 0.988
#> GSM877184     2  0.0938     0.9586 0.012 0.988
#> GSM877187     2  0.0000     0.9578 0.000 1.000
#> GSM877188     2  0.0938     0.9586 0.012 0.988
#> GSM877150     2  0.0938     0.9586 0.012 0.988
#> GSM877165     2  0.0000     0.9578 0.000 1.000
#> GSM877183     1  0.3274     0.9246 0.940 0.060
#> GSM877178     1  0.0000     0.9650 1.000 0.000
#> GSM877182     2  0.9580     0.3923 0.380 0.620

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3   0.164      0.967 0.000 0.044 0.956
#> GSM877128     3   0.116      0.969 0.028 0.000 0.972
#> GSM877164     3   0.000      0.975 0.000 0.000 1.000
#> GSM877162     3   0.164      0.967 0.000 0.044 0.956
#> GSM877127     3   0.129      0.966 0.032 0.000 0.968
#> GSM877138     3   0.153      0.959 0.040 0.000 0.960
#> GSM877140     3   0.127      0.970 0.024 0.004 0.972
#> GSM877156     2   0.188      0.890 0.044 0.952 0.004
#> GSM877130     2   0.767      0.217 0.044 0.488 0.468
#> GSM877141     3   0.000      0.975 0.000 0.000 1.000
#> GSM877142     3   0.116      0.969 0.028 0.000 0.972
#> GSM877145     2   0.164      0.892 0.044 0.956 0.000
#> GSM877151     2   0.757      0.394 0.044 0.552 0.404
#> GSM877158     3   0.000      0.975 0.000 0.000 1.000
#> GSM877173     2   0.750      0.381 0.040 0.548 0.412
#> GSM877176     2   0.721      0.551 0.044 0.632 0.324
#> GSM877179     3   0.000      0.975 0.000 0.000 1.000
#> GSM877181     2   0.164      0.892 0.044 0.956 0.000
#> GSM877185     2   0.164      0.892 0.044 0.956 0.000
#> GSM877131     3   0.000      0.975 0.000 0.000 1.000
#> GSM877147     3   0.164      0.967 0.000 0.044 0.956
#> GSM877155     3   0.116      0.969 0.028 0.000 0.972
#> GSM877159     3   0.164      0.967 0.000 0.044 0.956
#> GSM877170     3   0.000      0.975 0.000 0.000 1.000
#> GSM877186     3   0.304      0.897 0.104 0.000 0.896
#> GSM877132     2   0.164      0.892 0.044 0.956 0.000
#> GSM877143     2   0.164      0.892 0.044 0.956 0.000
#> GSM877146     2   0.164      0.892 0.044 0.956 0.000
#> GSM877148     2   0.164      0.892 0.044 0.956 0.000
#> GSM877152     2   0.164      0.892 0.044 0.956 0.000
#> GSM877168     2   0.164      0.892 0.044 0.956 0.000
#> GSM877180     2   0.164      0.892 0.044 0.956 0.000
#> GSM877126     3   0.000      0.975 0.000 0.000 1.000
#> GSM877129     3   0.000      0.975 0.000 0.000 1.000
#> GSM877133     1   0.153      0.923 0.960 0.000 0.040
#> GSM877153     3   0.164      0.967 0.000 0.044 0.956
#> GSM877169     1   0.595      0.426 0.640 0.000 0.360
#> GSM877171     3   0.000      0.975 0.000 0.000 1.000
#> GSM877174     3   0.000      0.975 0.000 0.000 1.000
#> GSM877134     1   0.418      0.768 0.828 0.172 0.000
#> GSM877135     1   0.000      0.961 1.000 0.000 0.000
#> GSM877136     1   0.000      0.961 1.000 0.000 0.000
#> GSM877137     1   0.000      0.961 1.000 0.000 0.000
#> GSM877139     1   0.000      0.961 1.000 0.000 0.000
#> GSM877149     1   0.000      0.961 1.000 0.000 0.000
#> GSM877154     2   0.164      0.892 0.044 0.956 0.000
#> GSM877157     1   0.000      0.961 1.000 0.000 0.000
#> GSM877160     1   0.000      0.961 1.000 0.000 0.000
#> GSM877161     1   0.000      0.961 1.000 0.000 0.000
#> GSM877163     1   0.000      0.961 1.000 0.000 0.000
#> GSM877166     1   0.000      0.961 1.000 0.000 0.000
#> GSM877167     2   0.164      0.892 0.044 0.956 0.000
#> GSM877175     1   0.000      0.961 1.000 0.000 0.000
#> GSM877177     1   0.000      0.961 1.000 0.000 0.000
#> GSM877184     1   0.000      0.961 1.000 0.000 0.000
#> GSM877187     2   0.164      0.892 0.044 0.956 0.000
#> GSM877188     1   0.000      0.961 1.000 0.000 0.000
#> GSM877150     1   0.000      0.961 1.000 0.000 0.000
#> GSM877165     2   0.164      0.892 0.044 0.956 0.000
#> GSM877183     3   0.129      0.966 0.032 0.000 0.968
#> GSM877178     3   0.000      0.975 0.000 0.000 1.000
#> GSM877182     3   0.164      0.954 0.044 0.000 0.956

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     4  0.6817    -0.2430 0.000 0.100 0.408 0.492
#> GSM877128     3  0.1174     0.7149 0.012 0.020 0.968 0.000
#> GSM877164     3  0.4193     0.6009 0.000 0.268 0.732 0.000
#> GSM877162     4  0.6817    -0.2430 0.000 0.100 0.408 0.492
#> GSM877127     3  0.2224     0.7044 0.032 0.040 0.928 0.000
#> GSM877138     3  0.2360     0.6952 0.020 0.052 0.924 0.004
#> GSM877140     3  0.1767     0.7044 0.012 0.044 0.944 0.000
#> GSM877156     1  0.7095     0.0520 0.480 0.088 0.012 0.420
#> GSM877130     2  0.7301     0.7345 0.080 0.628 0.224 0.068
#> GSM877141     3  0.4737     0.3298 0.000 0.252 0.728 0.020
#> GSM877142     2  0.6367     0.7747 0.000 0.540 0.392 0.068
#> GSM877145     1  0.6313     0.0122 0.488 0.048 0.004 0.460
#> GSM877151     2  0.7229     0.7311 0.048 0.632 0.216 0.104
#> GSM877158     2  0.6234     0.7919 0.000 0.584 0.348 0.068
#> GSM877173     1  0.9092     0.1157 0.440 0.236 0.232 0.092
#> GSM877176     1  0.9450     0.0911 0.396 0.228 0.124 0.252
#> GSM877179     2  0.6384     0.4641 0.000 0.496 0.440 0.064
#> GSM877181     1  0.8770     0.1935 0.488 0.192 0.084 0.236
#> GSM877185     1  0.8869     0.1907 0.488 0.164 0.108 0.240
#> GSM877131     3  0.1610     0.7026 0.000 0.016 0.952 0.032
#> GSM877147     4  0.6817    -0.2430 0.000 0.100 0.408 0.492
#> GSM877155     2  0.6277     0.7938 0.000 0.572 0.360 0.068
#> GSM877159     4  0.6650    -0.2739 0.000 0.084 0.432 0.484
#> GSM877170     3  0.2924     0.6884 0.000 0.100 0.884 0.016
#> GSM877186     1  0.3266     0.5580 0.832 0.000 0.168 0.000
#> GSM877132     4  0.5167    -0.0656 0.488 0.004 0.000 0.508
#> GSM877143     4  0.5167    -0.0656 0.488 0.004 0.000 0.508
#> GSM877146     4  0.5167    -0.0656 0.488 0.004 0.000 0.508
#> GSM877148     1  0.5938    -0.0072 0.488 0.036 0.000 0.476
#> GSM877152     4  0.5167    -0.0656 0.488 0.004 0.000 0.508
#> GSM877168     4  0.5167    -0.0656 0.488 0.004 0.000 0.508
#> GSM877180     4  0.4999    -0.0762 0.492 0.000 0.000 0.508
#> GSM877126     3  0.0921     0.7169 0.000 0.028 0.972 0.000
#> GSM877129     3  0.2216     0.7005 0.000 0.092 0.908 0.000
#> GSM877133     1  0.1389     0.6680 0.952 0.000 0.048 0.000
#> GSM877153     4  0.6817    -0.2430 0.000 0.100 0.408 0.492
#> GSM877169     1  0.4040     0.4105 0.752 0.000 0.248 0.000
#> GSM877171     3  0.4193     0.6009 0.000 0.268 0.732 0.000
#> GSM877174     3  0.4193     0.6009 0.000 0.268 0.732 0.000
#> GSM877134     1  0.2149     0.6575 0.912 0.000 0.000 0.088
#> GSM877135     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877136     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877137     1  0.0336     0.7076 0.992 0.000 0.008 0.000
#> GSM877139     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877149     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877154     1  0.5506     0.0289 0.512 0.016 0.000 0.472
#> GSM877157     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877160     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877163     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877166     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877167     4  0.5167    -0.0656 0.488 0.004 0.000 0.508
#> GSM877175     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877177     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877184     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877187     1  0.5288     0.0501 0.520 0.008 0.000 0.472
#> GSM877188     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.7124 1.000 0.000 0.000 0.000
#> GSM877165     1  0.8919     0.1984 0.488 0.196 0.108 0.208
#> GSM877183     3  0.2853     0.6692 0.016 0.076 0.900 0.008
#> GSM877178     3  0.3528     0.6550 0.000 0.192 0.808 0.000
#> GSM877182     3  0.7785    -0.1685 0.392 0.064 0.476 0.068

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0000     0.9903 0.000 0.000 0.000 1.000 0.000
#> GSM877128     3  0.7633     0.5930 0.144 0.096 0.444 0.316 0.000
#> GSM877164     3  0.0794     0.5504 0.000 0.028 0.972 0.000 0.000
#> GSM877162     4  0.0000     0.9903 0.000 0.000 0.000 1.000 0.000
#> GSM877127     3  0.7885     0.5724 0.152 0.068 0.452 0.308 0.020
#> GSM877138     3  0.8385     0.5568 0.088 0.072 0.432 0.316 0.092
#> GSM877140     3  0.7724     0.5722 0.140 0.104 0.412 0.344 0.000
#> GSM877156     5  0.0290     0.8632 0.000 0.008 0.000 0.000 0.992
#> GSM877130     2  0.2605     0.7240 0.000 0.852 0.000 0.000 0.148
#> GSM877141     2  0.5904     0.2462 0.000 0.636 0.196 0.156 0.012
#> GSM877142     2  0.0579     0.7942 0.000 0.984 0.000 0.008 0.008
#> GSM877145     5  0.1043     0.8432 0.000 0.040 0.000 0.000 0.960
#> GSM877151     2  0.2230     0.7437 0.000 0.884 0.000 0.000 0.116
#> GSM877158     2  0.0451     0.7910 0.000 0.988 0.004 0.008 0.000
#> GSM877173     2  0.4680     0.0184 0.000 0.540 0.004 0.008 0.448
#> GSM877176     5  0.3861     0.5964 0.000 0.264 0.000 0.008 0.728
#> GSM877179     2  0.0451     0.7910 0.000 0.988 0.004 0.008 0.000
#> GSM877181     5  0.3949     0.5300 0.000 0.332 0.000 0.000 0.668
#> GSM877185     5  0.4030     0.4966 0.000 0.352 0.000 0.000 0.648
#> GSM877131     2  0.2127     0.7079 0.000 0.892 0.000 0.108 0.000
#> GSM877147     4  0.0000     0.9903 0.000 0.000 0.000 1.000 0.000
#> GSM877155     2  0.0579     0.7942 0.000 0.984 0.000 0.008 0.008
#> GSM877159     4  0.0703     0.9604 0.000 0.024 0.000 0.976 0.000
#> GSM877170     3  0.7108     0.4321 0.000 0.360 0.384 0.240 0.016
#> GSM877186     1  0.1357     0.9049 0.948 0.048 0.000 0.004 0.000
#> GSM877132     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877143     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877146     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877148     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877152     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877168     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877180     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877126     3  0.5409     0.6028 0.000 0.080 0.604 0.316 0.000
#> GSM877129     3  0.4679     0.5950 0.000 0.032 0.652 0.316 0.000
#> GSM877133     1  0.0955     0.9293 0.968 0.000 0.028 0.000 0.004
#> GSM877153     4  0.0000     0.9903 0.000 0.000 0.000 1.000 0.000
#> GSM877169     1  0.3461     0.6528 0.772 0.000 0.224 0.000 0.004
#> GSM877171     3  0.0794     0.5504 0.000 0.028 0.972 0.000 0.000
#> GSM877174     3  0.0794     0.5504 0.000 0.028 0.972 0.000 0.000
#> GSM877134     1  0.3534     0.6595 0.744 0.000 0.000 0.000 0.256
#> GSM877135     1  0.0000     0.9470 1.000 0.000 0.000 0.000 0.000
#> GSM877136     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877137     1  0.2280     0.8363 0.880 0.000 0.000 0.000 0.120
#> GSM877139     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877149     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877154     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877157     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877160     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877161     1  0.0000     0.9470 1.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877166     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877167     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877175     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877177     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877184     1  0.1341     0.9085 0.944 0.000 0.000 0.000 0.056
#> GSM877187     5  0.0000     0.8670 0.000 0.000 0.000 0.000 1.000
#> GSM877188     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877150     1  0.0162     0.9497 0.996 0.000 0.000 0.000 0.004
#> GSM877165     5  0.4030     0.4966 0.000 0.352 0.000 0.000 0.648
#> GSM877183     3  0.8422     0.5533 0.088 0.072 0.428 0.316 0.096
#> GSM877178     3  0.3193     0.5928 0.000 0.028 0.840 0.132 0.000
#> GSM877182     5  0.6734     0.3003 0.024 0.080 0.028 0.316 0.552

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0260     0.9929 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM877128     6  0.3101     0.6693 0.056 0.000 0.068 0.020 0.000 0.856
#> GSM877164     3  0.1663     0.9936 0.000 0.000 0.912 0.000 0.000 0.088
#> GSM877162     4  0.0260     0.9929 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM877127     6  0.1501     0.6889 0.076 0.000 0.000 0.000 0.000 0.924
#> GSM877138     6  0.1716     0.7017 0.036 0.000 0.000 0.004 0.028 0.932
#> GSM877140     6  0.2644     0.6865 0.028 0.000 0.012 0.072 0.004 0.884
#> GSM877156     5  0.0405     0.9203 0.000 0.008 0.004 0.000 0.988 0.000
#> GSM877130     2  0.1910     0.7681 0.000 0.892 0.000 0.000 0.108 0.000
#> GSM877141     2  0.4189     0.0541 0.000 0.552 0.004 0.008 0.000 0.436
#> GSM877142     2  0.1194     0.8116 0.000 0.956 0.004 0.000 0.032 0.008
#> GSM877145     5  0.0363     0.9204 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM877151     2  0.2772     0.6831 0.000 0.816 0.000 0.000 0.180 0.004
#> GSM877158     2  0.1268     0.7961 0.000 0.952 0.004 0.008 0.000 0.036
#> GSM877173     5  0.3999     0.6793 0.000 0.200 0.004 0.008 0.752 0.036
#> GSM877176     5  0.2876     0.7872 0.004 0.148 0.004 0.000 0.836 0.008
#> GSM877179     2  0.1382     0.7950 0.000 0.948 0.008 0.008 0.000 0.036
#> GSM877181     5  0.1398     0.8970 0.000 0.052 0.000 0.000 0.940 0.008
#> GSM877185     5  0.1398     0.8964 0.000 0.052 0.000 0.000 0.940 0.008
#> GSM877131     6  0.5376     0.2481 0.000 0.372 0.008 0.092 0.000 0.528
#> GSM877147     4  0.0260     0.9929 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM877155     2  0.0935     0.8119 0.000 0.964 0.004 0.000 0.032 0.000
#> GSM877159     4  0.0865     0.9712 0.000 0.000 0.000 0.964 0.000 0.036
#> GSM877170     6  0.4629     0.0119 0.024 0.460 0.008 0.000 0.000 0.508
#> GSM877186     1  0.3858     0.7815 0.780 0.000 0.084 0.004 0.000 0.132
#> GSM877132     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877143     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877146     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877148     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877152     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877168     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877180     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877126     6  0.4084     0.1741 0.000 0.000 0.400 0.012 0.000 0.588
#> GSM877129     3  0.2101     0.9740 0.000 0.004 0.892 0.004 0.000 0.100
#> GSM877133     1  0.1951     0.8874 0.908 0.000 0.016 0.000 0.000 0.076
#> GSM877153     4  0.0260     0.9929 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM877169     1  0.1753     0.8822 0.912 0.000 0.004 0.000 0.000 0.084
#> GSM877171     3  0.1663     0.9936 0.000 0.000 0.912 0.000 0.000 0.088
#> GSM877174     3  0.1663     0.9936 0.000 0.000 0.912 0.000 0.000 0.088
#> GSM877134     5  0.3847     0.1044 0.456 0.000 0.000 0.000 0.544 0.000
#> GSM877135     1  0.0000     0.9464 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877136     1  0.0000     0.9464 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.2454     0.8023 0.840 0.000 0.000 0.000 0.160 0.000
#> GSM877139     1  0.0632     0.9340 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM877149     1  0.0000     0.9464 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877154     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877157     1  0.0632     0.9340 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM877160     1  0.0458     0.9420 0.984 0.000 0.016 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.9464 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.0725     0.9372 0.976 0.012 0.000 0.000 0.012 0.000
#> GSM877166     1  0.0000     0.9464 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877175     1  0.0260     0.9445 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM877177     1  0.0000     0.9464 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877184     1  0.2562     0.7860 0.828 0.000 0.000 0.000 0.172 0.000
#> GSM877187     5  0.0000     0.9248 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877188     1  0.0000     0.9464 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.9464 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877165     5  0.1812     0.8768 0.000 0.080 0.000 0.000 0.912 0.008
#> GSM877183     6  0.1644     0.7017 0.040 0.000 0.000 0.000 0.028 0.932
#> GSM877178     3  0.1663     0.9936 0.000 0.000 0.912 0.000 0.000 0.088
#> GSM877182     6  0.4301     0.4215 0.024 0.004 0.000 0.004 0.308 0.660

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) genotype/variation(p) other(p) k
#> SD:mclust 59           0.1701                0.1301 2.28e-08 2
#> SD:mclust 58           0.5976                0.2213 6.21e-13 3
#> SD:mclust 36           0.4372                0.1556 1.17e-10 4
#> SD:mclust 56           0.2319                0.2859 2.51e-17 5
#> SD:mclust 56           0.0145                0.0161 4.59e-15 6

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


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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.932           0.959       0.981         0.5069 0.492   0.492
#> 3 3 0.860           0.872       0.948         0.2924 0.801   0.617
#> 4 4 0.739           0.776       0.903         0.1131 0.795   0.500
#> 5 5 0.758           0.725       0.871         0.0858 0.828   0.469
#> 6 6 0.689           0.627       0.773         0.0415 0.924   0.673

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
#> GSM877144     2  0.0000      0.978 0.000 1.000
#> GSM877128     1  0.0000      0.981 1.000 0.000
#> GSM877164     1  0.0000      0.981 1.000 0.000
#> GSM877162     2  0.0000      0.978 0.000 1.000
#> GSM877127     1  0.0000      0.981 1.000 0.000
#> GSM877138     2  0.6438      0.815 0.164 0.836
#> GSM877140     1  0.2043      0.955 0.968 0.032
#> GSM877156     2  0.0000      0.978 0.000 1.000
#> GSM877130     2  0.0000      0.978 0.000 1.000
#> GSM877141     2  0.5519      0.862 0.128 0.872
#> GSM877142     2  0.0000      0.978 0.000 1.000
#> GSM877145     2  0.0376      0.975 0.004 0.996
#> GSM877151     2  0.0000      0.978 0.000 1.000
#> GSM877158     2  0.0000      0.978 0.000 1.000
#> GSM877173     2  0.0000      0.978 0.000 1.000
#> GSM877176     2  0.0000      0.978 0.000 1.000
#> GSM877179     2  0.0000      0.978 0.000 1.000
#> GSM877181     2  0.0000      0.978 0.000 1.000
#> GSM877185     2  0.0000      0.978 0.000 1.000
#> GSM877131     2  0.0000      0.978 0.000 1.000
#> GSM877147     2  0.0000      0.978 0.000 1.000
#> GSM877155     2  0.0000      0.978 0.000 1.000
#> GSM877159     2  0.0000      0.978 0.000 1.000
#> GSM877170     2  0.5946      0.843 0.144 0.856
#> GSM877186     1  0.0000      0.981 1.000 0.000
#> GSM877132     2  0.0000      0.978 0.000 1.000
#> GSM877143     2  0.0000      0.978 0.000 1.000
#> GSM877146     2  0.0000      0.978 0.000 1.000
#> GSM877148     2  0.0000      0.978 0.000 1.000
#> GSM877152     2  0.6801      0.796 0.180 0.820
#> GSM877168     2  0.0000      0.978 0.000 1.000
#> GSM877180     2  0.0000      0.978 0.000 1.000
#> GSM877126     1  0.0000      0.981 1.000 0.000
#> GSM877129     1  0.0000      0.981 1.000 0.000
#> GSM877133     1  0.0000      0.981 1.000 0.000
#> GSM877153     1  0.4690      0.884 0.900 0.100
#> GSM877169     1  0.0000      0.981 1.000 0.000
#> GSM877171     1  0.0000      0.981 1.000 0.000
#> GSM877174     1  0.0000      0.981 1.000 0.000
#> GSM877134     1  0.4161      0.902 0.916 0.084
#> GSM877135     1  0.0000      0.981 1.000 0.000
#> GSM877136     1  0.0000      0.981 1.000 0.000
#> GSM877137     1  0.0000      0.981 1.000 0.000
#> GSM877139     1  0.0000      0.981 1.000 0.000
#> GSM877149     1  0.0000      0.981 1.000 0.000
#> GSM877154     2  0.2236      0.951 0.036 0.964
#> GSM877157     1  0.0000      0.981 1.000 0.000
#> GSM877160     1  0.0000      0.981 1.000 0.000
#> GSM877161     1  0.0000      0.981 1.000 0.000
#> GSM877163     1  0.0000      0.981 1.000 0.000
#> GSM877166     1  0.0000      0.981 1.000 0.000
#> GSM877167     2  0.0000      0.978 0.000 1.000
#> GSM877175     1  0.0000      0.981 1.000 0.000
#> GSM877177     1  0.0000      0.981 1.000 0.000
#> GSM877184     1  0.0000      0.981 1.000 0.000
#> GSM877187     2  0.0376      0.975 0.004 0.996
#> GSM877188     1  0.0000      0.981 1.000 0.000
#> GSM877150     1  0.0000      0.981 1.000 0.000
#> GSM877165     2  0.0000      0.978 0.000 1.000
#> GSM877183     1  0.8861      0.550 0.696 0.304
#> GSM877178     1  0.0000      0.981 1.000 0.000
#> GSM877182     2  0.1184      0.967 0.016 0.984

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.6267      0.130 0.000 0.452 0.548
#> GSM877128     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877164     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877162     2  0.1643      0.901 0.000 0.956 0.044
#> GSM877127     3  0.0475      0.942 0.004 0.004 0.992
#> GSM877138     2  0.5138      0.649 0.000 0.748 0.252
#> GSM877140     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877156     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877130     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877141     3  0.3619      0.810 0.000 0.136 0.864
#> GSM877142     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877145     2  0.1529      0.908 0.040 0.960 0.000
#> GSM877151     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877158     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877173     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877176     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877179     2  0.5178      0.647 0.000 0.744 0.256
#> GSM877181     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877185     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877131     2  0.3752      0.814 0.000 0.856 0.144
#> GSM877147     2  0.1031      0.914 0.000 0.976 0.024
#> GSM877155     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877159     2  0.6286      0.103 0.000 0.536 0.464
#> GSM877170     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877186     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877132     2  0.1964      0.897 0.056 0.944 0.000
#> GSM877143     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877146     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877148     2  0.1411      0.910 0.036 0.964 0.000
#> GSM877152     1  0.6111      0.294 0.604 0.396 0.000
#> GSM877168     2  0.1411      0.910 0.036 0.964 0.000
#> GSM877180     2  0.5529      0.590 0.296 0.704 0.000
#> GSM877126     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877129     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877133     1  0.1753      0.914 0.952 0.000 0.048
#> GSM877153     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877169     1  0.5621      0.545 0.692 0.000 0.308
#> GSM877171     3  0.0237      0.942 0.004 0.000 0.996
#> GSM877174     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877134     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877135     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877136     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877137     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877139     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877149     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877154     2  0.3619      0.820 0.136 0.864 0.000
#> GSM877157     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877160     1  0.0237      0.952 0.996 0.000 0.004
#> GSM877161     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877163     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877166     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877167     2  0.0592      0.921 0.012 0.988 0.000
#> GSM877175     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877177     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877184     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877187     2  0.1860      0.902 0.052 0.948 0.000
#> GSM877188     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877150     1  0.0000      0.955 1.000 0.000 0.000
#> GSM877165     2  0.0000      0.925 0.000 1.000 0.000
#> GSM877183     3  0.1289      0.922 0.000 0.032 0.968
#> GSM877178     3  0.0000      0.945 0.000 0.000 1.000
#> GSM877182     2  0.0000      0.925 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     4  0.0336      0.842 0.000 0.008 0.000 0.992
#> GSM877128     3  0.0188      0.880 0.000 0.000 0.996 0.004
#> GSM877164     3  0.0000      0.881 0.000 0.000 1.000 0.000
#> GSM877162     4  0.0188      0.842 0.000 0.004 0.000 0.996
#> GSM877127     4  0.1396      0.832 0.004 0.004 0.032 0.960
#> GSM877138     4  0.2266      0.797 0.004 0.084 0.000 0.912
#> GSM877140     4  0.0469      0.840 0.000 0.000 0.012 0.988
#> GSM877156     2  0.3217      0.811 0.012 0.860 0.000 0.128
#> GSM877130     2  0.0000      0.870 0.000 1.000 0.000 0.000
#> GSM877141     3  0.0707      0.869 0.000 0.020 0.980 0.000
#> GSM877142     2  0.0188      0.870 0.000 0.996 0.000 0.004
#> GSM877145     2  0.0188      0.870 0.004 0.996 0.000 0.000
#> GSM877151     2  0.1716      0.846 0.000 0.936 0.000 0.064
#> GSM877158     2  0.0000      0.870 0.000 1.000 0.000 0.000
#> GSM877173     2  0.0000      0.870 0.000 1.000 0.000 0.000
#> GSM877176     2  0.1022      0.862 0.000 0.968 0.000 0.032
#> GSM877179     2  0.2149      0.821 0.000 0.912 0.088 0.000
#> GSM877181     2  0.0188      0.869 0.000 0.996 0.000 0.004
#> GSM877185     2  0.0000      0.870 0.000 1.000 0.000 0.000
#> GSM877131     4  0.5296     -0.180 0.000 0.492 0.008 0.500
#> GSM877147     4  0.0469      0.841 0.000 0.012 0.000 0.988
#> GSM877155     2  0.2760      0.801 0.000 0.872 0.000 0.128
#> GSM877159     4  0.0376      0.841 0.000 0.004 0.004 0.992
#> GSM877170     3  0.3208      0.751 0.000 0.148 0.848 0.004
#> GSM877186     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM877132     2  0.3257      0.758 0.152 0.844 0.000 0.004
#> GSM877143     1  0.6830      0.188 0.508 0.388 0.000 0.104
#> GSM877146     1  0.6794      0.242 0.524 0.372 0.000 0.104
#> GSM877148     2  0.6233      0.596 0.124 0.660 0.000 0.216
#> GSM877152     1  0.4105      0.756 0.812 0.156 0.000 0.032
#> GSM877168     2  0.6289      0.577 0.116 0.648 0.000 0.236
#> GSM877180     1  0.5979      0.620 0.692 0.136 0.000 0.172
#> GSM877126     3  0.0336      0.878 0.000 0.000 0.992 0.008
#> GSM877129     3  0.0188      0.880 0.000 0.000 0.996 0.004
#> GSM877133     3  0.5028      0.363 0.400 0.000 0.596 0.004
#> GSM877153     4  0.2647      0.750 0.000 0.000 0.120 0.880
#> GSM877169     3  0.4382      0.594 0.296 0.000 0.704 0.000
#> GSM877171     3  0.0000      0.881 0.000 0.000 1.000 0.000
#> GSM877174     3  0.0000      0.881 0.000 0.000 1.000 0.000
#> GSM877134     1  0.2164      0.864 0.924 0.068 0.004 0.004
#> GSM877135     1  0.0188      0.907 0.996 0.000 0.000 0.004
#> GSM877136     1  0.0188      0.908 0.996 0.000 0.004 0.000
#> GSM877137     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM877139     1  0.0188      0.907 0.996 0.000 0.000 0.004
#> GSM877149     1  0.1492      0.888 0.956 0.036 0.004 0.004
#> GSM877154     2  0.7878      0.138 0.324 0.384 0.000 0.292
#> GSM877157     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM877160     1  0.0000      0.908 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0188      0.908 0.996 0.000 0.004 0.000
#> GSM877163     1  0.0469      0.904 0.988 0.000 0.012 0.000
#> GSM877166     1  0.0188      0.908 0.996 0.000 0.004 0.000
#> GSM877167     2  0.3428      0.777 0.144 0.844 0.000 0.012
#> GSM877175     1  0.0188      0.908 0.996 0.000 0.004 0.000
#> GSM877177     1  0.0188      0.907 0.996 0.000 0.000 0.004
#> GSM877184     1  0.0188      0.908 0.996 0.000 0.004 0.000
#> GSM877187     1  0.2871      0.842 0.896 0.072 0.000 0.032
#> GSM877188     1  0.0188      0.908 0.996 0.000 0.004 0.000
#> GSM877150     1  0.0336      0.907 0.992 0.000 0.008 0.000
#> GSM877165     2  0.0188      0.869 0.000 0.996 0.000 0.004
#> GSM877183     4  0.4948      0.175 0.000 0.000 0.440 0.560
#> GSM877178     3  0.0188      0.880 0.000 0.000 0.996 0.004
#> GSM877182     2  0.1118      0.860 0.000 0.964 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0324     0.8506 0.000 0.004 0.000 0.992 0.004
#> GSM877128     3  0.1478     0.8997 0.000 0.000 0.936 0.064 0.000
#> GSM877164     3  0.0000     0.9313 0.000 0.000 1.000 0.000 0.000
#> GSM877162     4  0.0671     0.8444 0.000 0.016 0.000 0.980 0.004
#> GSM877127     5  0.5466     0.4278 0.000 0.004 0.284 0.084 0.628
#> GSM877138     5  0.0963     0.7607 0.000 0.000 0.000 0.036 0.964
#> GSM877140     4  0.5779    -0.0309 0.000 0.000 0.088 0.456 0.456
#> GSM877156     2  0.5670     0.1742 0.020 0.548 0.000 0.044 0.388
#> GSM877130     2  0.2233     0.7814 0.000 0.892 0.000 0.004 0.104
#> GSM877141     3  0.0794     0.9164 0.000 0.000 0.972 0.000 0.028
#> GSM877142     2  0.3741     0.6378 0.000 0.732 0.000 0.004 0.264
#> GSM877145     2  0.0162     0.7883 0.000 0.996 0.000 0.000 0.004
#> GSM877151     5  0.1430     0.7592 0.000 0.052 0.000 0.004 0.944
#> GSM877158     2  0.2389     0.7759 0.000 0.880 0.000 0.004 0.116
#> GSM877173     2  0.3664     0.7645 0.000 0.828 0.064 0.004 0.104
#> GSM877176     2  0.1341     0.7726 0.000 0.944 0.000 0.056 0.000
#> GSM877179     2  0.5269     0.6652 0.000 0.688 0.188 0.004 0.120
#> GSM877181     2  0.0162     0.7871 0.000 0.996 0.000 0.004 0.000
#> GSM877185     2  0.2068     0.7843 0.000 0.904 0.000 0.004 0.092
#> GSM877131     5  0.4386     0.6498 0.000 0.096 0.000 0.140 0.764
#> GSM877147     4  0.0324     0.8506 0.000 0.004 0.000 0.992 0.004
#> GSM877155     5  0.3421     0.6543 0.000 0.204 0.000 0.008 0.788
#> GSM877159     5  0.4192     0.2833 0.000 0.000 0.000 0.404 0.596
#> GSM877170     2  0.3766     0.5695 0.000 0.728 0.268 0.004 0.000
#> GSM877186     1  0.4126     0.4067 0.620 0.000 0.000 0.380 0.000
#> GSM877132     2  0.1430     0.7731 0.052 0.944 0.000 0.004 0.000
#> GSM877143     5  0.0290     0.7723 0.008 0.000 0.000 0.000 0.992
#> GSM877146     5  0.0290     0.7723 0.008 0.000 0.000 0.000 0.992
#> GSM877148     5  0.0579     0.7703 0.000 0.008 0.000 0.008 0.984
#> GSM877152     5  0.1965     0.7446 0.096 0.000 0.000 0.000 0.904
#> GSM877168     5  0.0451     0.7708 0.004 0.000 0.000 0.008 0.988
#> GSM877180     5  0.1341     0.7636 0.056 0.000 0.000 0.000 0.944
#> GSM877126     3  0.2648     0.8181 0.000 0.000 0.848 0.152 0.000
#> GSM877129     3  0.0000     0.9313 0.000 0.000 1.000 0.000 0.000
#> GSM877133     3  0.3464     0.7935 0.096 0.000 0.836 0.000 0.068
#> GSM877153     4  0.0671     0.8435 0.000 0.000 0.004 0.980 0.016
#> GSM877169     3  0.2389     0.8354 0.116 0.000 0.880 0.000 0.004
#> GSM877171     3  0.0000     0.9313 0.000 0.000 1.000 0.000 0.000
#> GSM877174     3  0.0000     0.9313 0.000 0.000 1.000 0.000 0.000
#> GSM877134     1  0.4276     0.3709 0.616 0.380 0.000 0.004 0.000
#> GSM877135     1  0.1197     0.8777 0.952 0.000 0.000 0.000 0.048
#> GSM877136     1  0.0000     0.8978 1.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.1732     0.8589 0.920 0.000 0.000 0.000 0.080
#> GSM877139     1  0.1608     0.8621 0.928 0.000 0.000 0.000 0.072
#> GSM877149     1  0.4890     0.6532 0.720 0.140 0.000 0.140 0.000
#> GSM877154     5  0.6822     0.1099 0.404 0.144 0.000 0.024 0.428
#> GSM877157     1  0.0290     0.8951 0.992 0.008 0.000 0.000 0.000
#> GSM877160     1  0.0000     0.8978 1.000 0.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.8978 1.000 0.000 0.000 0.000 0.000
#> GSM877163     2  0.4452    -0.0591 0.496 0.500 0.004 0.000 0.000
#> GSM877166     1  0.0000     0.8978 1.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.3667     0.7123 0.048 0.140 0.000 0.000 0.812
#> GSM877175     1  0.0000     0.8978 1.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.1608     0.8627 0.928 0.000 0.000 0.000 0.072
#> GSM877184     1  0.1197     0.8735 0.952 0.048 0.000 0.000 0.000
#> GSM877187     5  0.3884     0.5613 0.288 0.000 0.000 0.004 0.708
#> GSM877188     1  0.0000     0.8978 1.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.8978 1.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.0451     0.7878 0.000 0.988 0.000 0.008 0.004
#> GSM877183     5  0.5746     0.5047 0.000 0.040 0.068 0.232 0.660
#> GSM877178     3  0.0000     0.9313 0.000 0.000 1.000 0.000 0.000
#> GSM877182     2  0.3449     0.6880 0.024 0.812 0.000 0.164 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
#> GSM877144     4  0.0508     0.7446 0.000 0.000 0.000 0.984 0.004 0.012
#> GSM877128     3  0.3671     0.7906 0.000 0.100 0.816 0.056 0.000 0.028
#> GSM877164     3  0.0146     0.8826 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM877162     4  0.1821     0.7456 0.000 0.040 0.000 0.928 0.008 0.024
#> GSM877127     5  0.5769     0.5262 0.004 0.068 0.224 0.028 0.644 0.032
#> GSM877138     5  0.2915     0.6612 0.000 0.184 0.000 0.008 0.808 0.000
#> GSM877140     4  0.7371     0.3283 0.000 0.304 0.036 0.360 0.264 0.036
#> GSM877156     6  0.5679     0.1875 0.004 0.064 0.000 0.040 0.332 0.560
#> GSM877130     2  0.4419     0.8965 0.000 0.584 0.000 0.000 0.032 0.384
#> GSM877141     3  0.3565     0.7626 0.000 0.112 0.816 0.000 0.016 0.056
#> GSM877142     2  0.4747     0.8852 0.000 0.584 0.000 0.000 0.060 0.356
#> GSM877145     6  0.2113     0.3997 0.004 0.092 0.000 0.000 0.008 0.896
#> GSM877151     5  0.3829     0.6440 0.000 0.180 0.000 0.000 0.760 0.060
#> GSM877158     2  0.4419     0.9001 0.000 0.584 0.000 0.000 0.032 0.384
#> GSM877173     2  0.5629     0.8383 0.000 0.576 0.092 0.000 0.032 0.300
#> GSM877176     6  0.1657     0.4828 0.000 0.016 0.000 0.056 0.000 0.928
#> GSM877179     2  0.5749     0.8131 0.000 0.580 0.116 0.000 0.032 0.272
#> GSM877181     6  0.3101     0.0486 0.000 0.244 0.000 0.000 0.000 0.756
#> GSM877185     2  0.4362     0.8976 0.000 0.584 0.000 0.000 0.028 0.388
#> GSM877131     5  0.6225     0.3077 0.000 0.072 0.024 0.264 0.580 0.060
#> GSM877147     4  0.1065     0.7410 0.000 0.008 0.000 0.964 0.008 0.020
#> GSM877155     5  0.4513     0.5868 0.000 0.096 0.000 0.000 0.692 0.212
#> GSM877159     4  0.5701     0.3580 0.000 0.132 0.004 0.512 0.348 0.004
#> GSM877170     6  0.5067     0.0696 0.000 0.076 0.436 0.000 0.000 0.488
#> GSM877186     1  0.4866     0.3577 0.584 0.048 0.000 0.360 0.004 0.004
#> GSM877132     6  0.4283     0.3254 0.180 0.096 0.000 0.000 0.000 0.724
#> GSM877143     5  0.3852     0.6496 0.064 0.176 0.000 0.000 0.760 0.000
#> GSM877146     5  0.4238     0.6257 0.092 0.180 0.000 0.000 0.728 0.000
#> GSM877148     5  0.1552     0.7239 0.020 0.036 0.000 0.000 0.940 0.004
#> GSM877152     5  0.2501     0.7163 0.072 0.012 0.000 0.000 0.888 0.028
#> GSM877168     5  0.0862     0.7225 0.004 0.016 0.000 0.000 0.972 0.008
#> GSM877180     5  0.1410     0.7245 0.044 0.004 0.000 0.000 0.944 0.008
#> GSM877126     3  0.4640     0.7240 0.000 0.072 0.752 0.084 0.000 0.092
#> GSM877129     3  0.0146     0.8824 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM877133     3  0.4660     0.6630 0.064 0.044 0.732 0.000 0.160 0.000
#> GSM877153     4  0.3454     0.7240 0.000 0.160 0.024 0.804 0.008 0.004
#> GSM877169     3  0.2257     0.8453 0.060 0.028 0.904 0.000 0.004 0.004
#> GSM877171     3  0.0547     0.8770 0.000 0.020 0.980 0.000 0.000 0.000
#> GSM877174     3  0.0363     0.8822 0.000 0.012 0.988 0.000 0.000 0.000
#> GSM877134     1  0.4037     0.3814 0.608 0.012 0.000 0.000 0.000 0.380
#> GSM877135     1  0.2237     0.7756 0.896 0.036 0.000 0.000 0.068 0.000
#> GSM877136     1  0.0405     0.7962 0.988 0.008 0.000 0.000 0.004 0.000
#> GSM877137     1  0.4271     0.6266 0.732 0.028 0.032 0.000 0.208 0.000
#> GSM877139     1  0.2772     0.7040 0.816 0.000 0.000 0.000 0.180 0.004
#> GSM877149     6  0.5473    -0.1503 0.452 0.036 0.000 0.048 0.000 0.464
#> GSM877154     6  0.5792     0.2065 0.048 0.028 0.000 0.032 0.316 0.576
#> GSM877157     1  0.3940     0.6266 0.728 0.016 0.000 0.000 0.016 0.240
#> GSM877160     1  0.2201     0.7888 0.916 0.016 0.036 0.000 0.024 0.008
#> GSM877161     1  0.0291     0.7965 0.992 0.004 0.000 0.000 0.004 0.000
#> GSM877163     1  0.4524     0.4140 0.616 0.048 0.000 0.000 0.000 0.336
#> GSM877166     1  0.0291     0.7965 0.992 0.004 0.000 0.000 0.004 0.000
#> GSM877167     5  0.5106     0.5605 0.052 0.040 0.000 0.004 0.668 0.236
#> GSM877175     1  0.2527     0.7552 0.868 0.024 0.000 0.000 0.000 0.108
#> GSM877177     1  0.2821     0.7363 0.832 0.000 0.000 0.000 0.152 0.016
#> GSM877184     1  0.3231     0.6840 0.784 0.016 0.000 0.000 0.000 0.200
#> GSM877187     5  0.4526     0.6553 0.144 0.036 0.000 0.016 0.760 0.044
#> GSM877188     1  0.1138     0.7946 0.960 0.024 0.004 0.000 0.000 0.012
#> GSM877150     1  0.0665     0.7969 0.980 0.008 0.008 0.000 0.000 0.004
#> GSM877165     6  0.1950     0.4401 0.000 0.064 0.000 0.000 0.024 0.912
#> GSM877183     5  0.6258     0.3872 0.000 0.088 0.016 0.048 0.540 0.308
#> GSM877178     3  0.0146     0.8824 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM877182     6  0.4549     0.4619 0.036 0.068 0.000 0.156 0.000 0.740

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) genotype/variation(p) other(p) k
#> SD:NMF 62            0.684               0.54657 2.24e-08 2
#> SD:NMF 59            0.172               0.31257 2.65e-11 3
#> SD:NMF 56            0.242               0.00152 1.84e-12 4
#> SD:NMF 54            0.326               0.27002 1.36e-16 5
#> SD:NMF 45            0.317               0.38203 2.78e-16 6

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


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 62 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.408           0.780       0.794         0.3613 0.492   0.492
#> 3 3 0.373           0.688       0.842         0.5362 0.877   0.760
#> 4 4 0.525           0.760       0.866         0.1213 0.966   0.916
#> 5 5 0.565           0.708       0.804         0.1478 0.895   0.725
#> 6 6 0.627           0.577       0.782         0.0694 0.976   0.912

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
#> GSM877144     1  0.9881     0.9888 0.564 0.436
#> GSM877128     1  0.9881     0.9888 0.564 0.436
#> GSM877164     1  0.9881     0.9888 0.564 0.436
#> GSM877162     2  0.1843     0.7236 0.028 0.972
#> GSM877127     1  0.9944     0.9606 0.544 0.456
#> GSM877138     1  0.9881     0.9888 0.564 0.436
#> GSM877140     1  0.9881     0.9888 0.564 0.436
#> GSM877156     2  0.4022     0.6560 0.080 0.920
#> GSM877130     2  0.8909     0.5967 0.308 0.692
#> GSM877141     2  0.8386     0.6587 0.268 0.732
#> GSM877142     2  0.9881     0.5112 0.436 0.564
#> GSM877145     2  0.6247     0.4956 0.156 0.844
#> GSM877151     2  0.0000     0.7441 0.000 1.000
#> GSM877158     2  0.9686     0.5385 0.396 0.604
#> GSM877173     2  0.8443     0.6578 0.272 0.728
#> GSM877176     2  0.5737     0.6496 0.136 0.864
#> GSM877179     2  0.9881     0.5112 0.436 0.564
#> GSM877181     2  0.4815     0.7295 0.104 0.896
#> GSM877185     2  0.9087     0.5865 0.324 0.676
#> GSM877131     2  0.2236     0.7447 0.036 0.964
#> GSM877147     1  0.9881     0.9888 0.564 0.436
#> GSM877155     2  0.4298     0.7274 0.088 0.912
#> GSM877159     2  0.2236     0.7447 0.036 0.964
#> GSM877170     2  0.9170    -0.0115 0.332 0.668
#> GSM877186     1  0.9881     0.9888 0.564 0.436
#> GSM877132     2  0.5294     0.7222 0.120 0.880
#> GSM877143     2  0.0000     0.7441 0.000 1.000
#> GSM877146     2  0.0000     0.7441 0.000 1.000
#> GSM877148     2  0.0000     0.7441 0.000 1.000
#> GSM877152     2  0.0938     0.7380 0.012 0.988
#> GSM877168     2  0.0376     0.7425 0.004 0.996
#> GSM877180     2  0.0376     0.7425 0.004 0.996
#> GSM877126     1  0.9881     0.9888 0.564 0.436
#> GSM877129     1  0.9881     0.9888 0.564 0.436
#> GSM877133     1  0.9881     0.9888 0.564 0.436
#> GSM877153     1  0.9881     0.9888 0.564 0.436
#> GSM877169     1  0.9881     0.9888 0.564 0.436
#> GSM877171     1  0.9881     0.9888 0.564 0.436
#> GSM877174     1  0.9881     0.9888 0.564 0.436
#> GSM877134     2  0.9983    -0.8289 0.476 0.524
#> GSM877135     1  0.9881     0.9888 0.564 0.436
#> GSM877136     1  0.9881     0.9888 0.564 0.436
#> GSM877137     1  0.9963     0.9488 0.536 0.464
#> GSM877139     1  0.9954     0.9555 0.540 0.460
#> GSM877149     1  0.9922     0.9640 0.552 0.448
#> GSM877154     2  0.3584     0.6743 0.068 0.932
#> GSM877157     1  0.9881     0.9888 0.564 0.436
#> GSM877160     1  0.9881     0.9888 0.564 0.436
#> GSM877161     1  0.9881     0.9888 0.564 0.436
#> GSM877163     1  0.9963     0.9488 0.536 0.464
#> GSM877166     1  0.9881     0.9888 0.564 0.436
#> GSM877167     2  0.0938     0.7380 0.012 0.988
#> GSM877175     1  0.9881     0.9888 0.564 0.436
#> GSM877177     1  0.9881     0.9888 0.564 0.436
#> GSM877184     1  0.9998     0.8792 0.508 0.492
#> GSM877187     2  0.1184     0.7347 0.016 0.984
#> GSM877188     1  0.9881     0.9888 0.564 0.436
#> GSM877150     1  0.9881     0.9888 0.564 0.436
#> GSM877165     2  0.5178     0.7130 0.116 0.884
#> GSM877183     2  0.4562     0.6272 0.096 0.904
#> GSM877178     1  0.9881     0.9888 0.564 0.436
#> GSM877182     2  0.9248    -0.1237 0.340 0.660

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.9862    0.39539 0.316 0.272 0.412
#> GSM877128     1  0.0424    0.88278 0.992 0.008 0.000
#> GSM877164     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877162     2  0.1585    0.73935 0.008 0.964 0.028
#> GSM877127     1  0.3784    0.81295 0.864 0.132 0.004
#> GSM877138     1  0.4045    0.82225 0.872 0.104 0.024
#> GSM877140     1  0.4172    0.81891 0.868 0.104 0.028
#> GSM877156     2  0.3412    0.72853 0.124 0.876 0.000
#> GSM877130     2  0.6777    0.26939 0.020 0.616 0.364
#> GSM877141     2  0.7664    0.50727 0.104 0.668 0.228
#> GSM877142     3  0.6168    0.18555 0.000 0.412 0.588
#> GSM877145     2  0.5785    0.45936 0.300 0.696 0.004
#> GSM877151     2  0.1411    0.77710 0.036 0.964 0.000
#> GSM877158     3  0.7069    0.00405 0.020 0.472 0.508
#> GSM877173     2  0.7731    0.50549 0.108 0.664 0.228
#> GSM877176     2  0.4994    0.68088 0.160 0.816 0.024
#> GSM877179     3  0.6168    0.18555 0.000 0.412 0.588
#> GSM877181     2  0.4007    0.73596 0.036 0.880 0.084
#> GSM877185     2  0.6215    0.08092 0.000 0.572 0.428
#> GSM877131     2  0.2313    0.76153 0.024 0.944 0.032
#> GSM877147     3  0.9862    0.39539 0.316 0.272 0.412
#> GSM877155     2  0.3415    0.72966 0.020 0.900 0.080
#> GSM877159     2  0.2313    0.76153 0.024 0.944 0.032
#> GSM877170     2  0.7245    0.29060 0.368 0.596 0.036
#> GSM877186     1  0.0424    0.88322 0.992 0.008 0.000
#> GSM877132     2  0.4887    0.72916 0.096 0.844 0.060
#> GSM877143     2  0.1411    0.77710 0.036 0.964 0.000
#> GSM877146     2  0.1411    0.77710 0.036 0.964 0.000
#> GSM877148     2  0.1411    0.77710 0.036 0.964 0.000
#> GSM877152     2  0.1860    0.77645 0.052 0.948 0.000
#> GSM877168     2  0.1529    0.77693 0.040 0.960 0.000
#> GSM877180     2  0.1529    0.77693 0.040 0.960 0.000
#> GSM877126     1  0.0424    0.88278 0.992 0.008 0.000
#> GSM877129     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877133     1  0.2448    0.86113 0.924 0.076 0.000
#> GSM877153     3  0.9862    0.39539 0.316 0.272 0.412
#> GSM877169     1  0.1289    0.88169 0.968 0.032 0.000
#> GSM877171     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877174     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877134     1  0.5859    0.48011 0.656 0.344 0.000
#> GSM877135     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877136     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877137     1  0.4654    0.71916 0.792 0.208 0.000
#> GSM877139     1  0.4555    0.73014 0.800 0.200 0.000
#> GSM877149     1  0.5706    0.54723 0.680 0.320 0.000
#> GSM877154     2  0.3482    0.72982 0.128 0.872 0.000
#> GSM877157     1  0.2448    0.86161 0.924 0.076 0.000
#> GSM877160     1  0.0892    0.88339 0.980 0.020 0.000
#> GSM877161     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877163     1  0.4702    0.71362 0.788 0.212 0.000
#> GSM877166     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877167     2  0.1860    0.77645 0.052 0.948 0.000
#> GSM877175     1  0.1289    0.88169 0.968 0.032 0.000
#> GSM877177     1  0.2165    0.86901 0.936 0.064 0.000
#> GSM877184     1  0.5968    0.44984 0.636 0.364 0.000
#> GSM877187     2  0.2066    0.77396 0.060 0.940 0.000
#> GSM877188     1  0.1289    0.88169 0.968 0.032 0.000
#> GSM877150     1  0.0892    0.88339 0.980 0.020 0.000
#> GSM877165     2  0.4063    0.70667 0.020 0.868 0.112
#> GSM877183     2  0.3851    0.71229 0.136 0.860 0.004
#> GSM877178     1  0.0000    0.88267 1.000 0.000 0.000
#> GSM877182     2  0.7099    0.26431 0.384 0.588 0.028

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.2699      0.996 0.028 0.068 0.904 0.000
#> GSM877128     1  0.2847      0.834 0.896 0.004 0.084 0.016
#> GSM877164     1  0.2915      0.832 0.892 0.004 0.088 0.016
#> GSM877162     2  0.2973      0.728 0.000 0.856 0.144 0.000
#> GSM877127     1  0.3984      0.812 0.828 0.132 0.040 0.000
#> GSM877138     1  0.5219      0.772 0.764 0.072 0.156 0.008
#> GSM877140     1  0.5265      0.767 0.760 0.072 0.160 0.008
#> GSM877156     2  0.2469      0.796 0.108 0.892 0.000 0.000
#> GSM877130     4  0.4933      0.288 0.000 0.432 0.000 0.568
#> GSM877141     2  0.5910      0.542 0.084 0.672 0.000 0.244
#> GSM877142     4  0.0779      0.647 0.000 0.016 0.004 0.980
#> GSM877145     2  0.4799      0.592 0.284 0.704 0.008 0.004
#> GSM877151     2  0.0707      0.821 0.020 0.980 0.000 0.000
#> GSM877158     4  0.2216      0.673 0.000 0.092 0.000 0.908
#> GSM877173     2  0.5970      0.541 0.088 0.668 0.000 0.244
#> GSM877176     2  0.4441      0.747 0.136 0.816 0.020 0.028
#> GSM877179     4  0.0779      0.647 0.000 0.016 0.004 0.980
#> GSM877181     2  0.2981      0.776 0.016 0.888 0.004 0.092
#> GSM877185     4  0.4103      0.602 0.000 0.256 0.000 0.744
#> GSM877131     2  0.2032      0.791 0.000 0.936 0.036 0.028
#> GSM877147     3  0.2699      0.996 0.028 0.068 0.904 0.000
#> GSM877155     2  0.3257      0.710 0.000 0.844 0.004 0.152
#> GSM877159     2  0.2032      0.791 0.000 0.936 0.036 0.028
#> GSM877170     2  0.6526      0.448 0.336 0.596 0.032 0.036
#> GSM877186     1  0.2149      0.821 0.912 0.000 0.088 0.000
#> GSM877132     2  0.3801      0.778 0.076 0.856 0.004 0.064
#> GSM877143     2  0.0707      0.821 0.020 0.980 0.000 0.000
#> GSM877146     2  0.0707      0.821 0.020 0.980 0.000 0.000
#> GSM877148     2  0.0707      0.821 0.020 0.980 0.000 0.000
#> GSM877152     2  0.1118      0.822 0.036 0.964 0.000 0.000
#> GSM877168     2  0.0817      0.822 0.024 0.976 0.000 0.000
#> GSM877180     2  0.0817      0.822 0.024 0.976 0.000 0.000
#> GSM877126     1  0.2847      0.834 0.896 0.004 0.084 0.016
#> GSM877129     1  0.2915      0.832 0.892 0.004 0.088 0.016
#> GSM877133     1  0.3037      0.846 0.888 0.076 0.036 0.000
#> GSM877153     3  0.2797      0.992 0.032 0.068 0.900 0.000
#> GSM877169     1  0.1211      0.856 0.960 0.040 0.000 0.000
#> GSM877171     1  0.2915      0.832 0.892 0.004 0.088 0.016
#> GSM877174     1  0.2915      0.832 0.892 0.004 0.088 0.016
#> GSM877134     1  0.4990      0.491 0.640 0.352 0.008 0.000
#> GSM877135     1  0.0469      0.852 0.988 0.000 0.012 0.000
#> GSM877136     1  0.0469      0.852 0.988 0.000 0.012 0.000
#> GSM877137     1  0.3764      0.737 0.784 0.216 0.000 0.000
#> GSM877139     1  0.3688      0.746 0.792 0.208 0.000 0.000
#> GSM877149     1  0.5349      0.570 0.656 0.320 0.020 0.004
#> GSM877154     2  0.2530      0.795 0.112 0.888 0.000 0.000
#> GSM877157     1  0.2412      0.844 0.908 0.084 0.008 0.000
#> GSM877160     1  0.0921      0.857 0.972 0.028 0.000 0.000
#> GSM877161     1  0.0469      0.852 0.988 0.000 0.012 0.000
#> GSM877163     1  0.3837      0.726 0.776 0.224 0.000 0.000
#> GSM877166     1  0.0469      0.852 0.988 0.000 0.012 0.000
#> GSM877167     2  0.1118      0.822 0.036 0.964 0.000 0.000
#> GSM877175     1  0.1211      0.856 0.960 0.040 0.000 0.000
#> GSM877177     1  0.2198      0.850 0.920 0.072 0.008 0.000
#> GSM877184     1  0.5443      0.464 0.616 0.364 0.016 0.004
#> GSM877187     2  0.1302      0.821 0.044 0.956 0.000 0.000
#> GSM877188     1  0.1211      0.856 0.960 0.040 0.000 0.000
#> GSM877150     1  0.1109      0.856 0.968 0.028 0.004 0.000
#> GSM877165     2  0.3668      0.675 0.000 0.808 0.004 0.188
#> GSM877183     2  0.2831      0.786 0.120 0.876 0.004 0.000
#> GSM877178     1  0.2915      0.832 0.892 0.004 0.088 0.016
#> GSM877182     2  0.6420      0.404 0.352 0.588 0.032 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
#> GSM877144     4  0.0162      0.998 0.000 0.000 0.000 0.996 0.004
#> GSM877128     3  0.3462      0.807 0.196 0.000 0.792 0.012 0.000
#> GSM877164     3  0.2471      0.807 0.136 0.000 0.864 0.000 0.000
#> GSM877162     5  0.5182      0.536 0.000 0.000 0.112 0.208 0.680
#> GSM877127     3  0.6411      0.559 0.348 0.000 0.508 0.012 0.132
#> GSM877138     3  0.7069      0.665 0.284 0.000 0.524 0.124 0.068
#> GSM877140     3  0.7089      0.667 0.280 0.000 0.524 0.128 0.068
#> GSM877156     5  0.2929      0.776 0.076 0.000 0.044 0.004 0.876
#> GSM877130     2  0.4590      0.245 0.000 0.568 0.012 0.000 0.420
#> GSM877141     5  0.5844      0.519 0.020 0.244 0.100 0.000 0.636
#> GSM877142     2  0.0000      0.647 0.000 1.000 0.000 0.000 0.000
#> GSM877145     5  0.5212      0.581 0.232 0.004 0.076 0.004 0.684
#> GSM877151     5  0.0609      0.797 0.020 0.000 0.000 0.000 0.980
#> GSM877158     2  0.2006      0.674 0.000 0.916 0.012 0.000 0.072
#> GSM877173     5  0.5889      0.517 0.020 0.244 0.104 0.000 0.632
#> GSM877176     5  0.4863      0.729 0.064 0.024 0.112 0.020 0.780
#> GSM877179     2  0.0000      0.647 0.000 1.000 0.000 0.000 0.000
#> GSM877181     5  0.3571      0.749 0.016 0.088 0.036 0.008 0.852
#> GSM877185     2  0.3662      0.610 0.000 0.744 0.004 0.000 0.252
#> GSM877131     5  0.4202      0.679 0.000 0.024 0.116 0.056 0.804
#> GSM877147     4  0.0162      0.998 0.000 0.000 0.000 0.996 0.004
#> GSM877155     5  0.4939      0.594 0.000 0.148 0.112 0.008 0.732
#> GSM877159     5  0.4202      0.679 0.000 0.024 0.116 0.056 0.804
#> GSM877170     5  0.6630      0.458 0.064 0.032 0.324 0.024 0.556
#> GSM877186     1  0.2017      0.718 0.912 0.000 0.008 0.080 0.000
#> GSM877132     5  0.4185      0.748 0.024 0.060 0.088 0.008 0.820
#> GSM877143     5  0.0609      0.797 0.020 0.000 0.000 0.000 0.980
#> GSM877146     5  0.0609      0.797 0.020 0.000 0.000 0.000 0.980
#> GSM877148     5  0.0609      0.797 0.020 0.000 0.000 0.000 0.980
#> GSM877152     5  0.0963      0.797 0.036 0.000 0.000 0.000 0.964
#> GSM877168     5  0.0703      0.797 0.024 0.000 0.000 0.000 0.976
#> GSM877180     5  0.0703      0.797 0.024 0.000 0.000 0.000 0.976
#> GSM877126     3  0.3462      0.807 0.196 0.000 0.792 0.012 0.000
#> GSM877129     3  0.2471      0.807 0.136 0.000 0.864 0.000 0.000
#> GSM877133     3  0.5882      0.511 0.420 0.000 0.496 0.008 0.076
#> GSM877153     4  0.0324      0.995 0.000 0.000 0.004 0.992 0.004
#> GSM877169     1  0.1741      0.781 0.936 0.000 0.024 0.000 0.040
#> GSM877171     3  0.2471      0.807 0.136 0.000 0.864 0.000 0.000
#> GSM877174     3  0.2471      0.807 0.136 0.000 0.864 0.000 0.000
#> GSM877134     1  0.6087      0.462 0.540 0.000 0.124 0.004 0.332
#> GSM877135     1  0.0451      0.767 0.988 0.000 0.008 0.004 0.000
#> GSM877136     1  0.0451      0.767 0.988 0.000 0.008 0.004 0.000
#> GSM877137     1  0.5045      0.661 0.696 0.000 0.108 0.000 0.196
#> GSM877139     1  0.4981      0.667 0.704 0.000 0.108 0.000 0.188
#> GSM877149     1  0.6355      0.511 0.564 0.000 0.128 0.020 0.288
#> GSM877154     5  0.3209      0.771 0.076 0.000 0.060 0.004 0.860
#> GSM877157     1  0.1792      0.778 0.916 0.000 0.000 0.000 0.084
#> GSM877160     1  0.1493      0.779 0.948 0.000 0.024 0.000 0.028
#> GSM877161     1  0.0451      0.767 0.988 0.000 0.008 0.004 0.000
#> GSM877163     1  0.5107      0.654 0.688 0.000 0.108 0.000 0.204
#> GSM877166     1  0.0451      0.767 0.988 0.000 0.008 0.004 0.000
#> GSM877167     5  0.0963      0.797 0.036 0.000 0.000 0.000 0.964
#> GSM877175     1  0.1741      0.781 0.936 0.000 0.024 0.000 0.040
#> GSM877177     1  0.1638      0.783 0.932 0.000 0.004 0.000 0.064
#> GSM877184     1  0.6543      0.428 0.516 0.000 0.132 0.020 0.332
#> GSM877187     5  0.1357      0.796 0.048 0.000 0.000 0.004 0.948
#> GSM877188     1  0.1741      0.781 0.936 0.000 0.024 0.000 0.040
#> GSM877150     1  0.1195      0.782 0.960 0.000 0.012 0.000 0.028
#> GSM877165     5  0.4160      0.661 0.000 0.184 0.036 0.008 0.772
#> GSM877183     5  0.3197      0.770 0.076 0.000 0.052 0.008 0.864
#> GSM877178     3  0.2471      0.807 0.136 0.000 0.864 0.000 0.000
#> GSM877182     5  0.6671      0.447 0.080 0.024 0.320 0.024 0.552

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0000     0.9946 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877128     3  0.2152     0.7468 0.068 0.000 0.904 0.004 0.000 0.024
#> GSM877164     3  0.0000     0.7497 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877162     5  0.5486     0.2757 0.000 0.000 0.000 0.208 0.568 0.224
#> GSM877127     3  0.6991     0.4512 0.204 0.000 0.484 0.000 0.136 0.176
#> GSM877138     3  0.7542     0.5581 0.164 0.000 0.504 0.100 0.068 0.164
#> GSM877140     3  0.7553     0.5587 0.160 0.000 0.504 0.104 0.068 0.164
#> GSM877156     5  0.3122     0.5198 0.020 0.000 0.000 0.000 0.804 0.176
#> GSM877130     2  0.5291     0.1974 0.000 0.552 0.000 0.000 0.328 0.120
#> GSM877141     5  0.6004     0.0208 0.000 0.228 0.012 0.000 0.516 0.244
#> GSM877142     2  0.0000     0.6848 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877145     5  0.5388    -0.0218 0.168 0.000 0.004 0.000 0.600 0.228
#> GSM877151     5  0.0000     0.6379 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877158     2  0.2060     0.6954 0.000 0.900 0.000 0.000 0.016 0.084
#> GSM877173     5  0.6004     0.0202 0.000 0.228 0.012 0.000 0.516 0.244
#> GSM877176     5  0.4361    -0.1413 0.024 0.000 0.000 0.000 0.552 0.424
#> GSM877179     2  0.0000     0.6848 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877181     5  0.4325     0.3684 0.000 0.064 0.000 0.000 0.692 0.244
#> GSM877185     2  0.3925     0.5857 0.000 0.744 0.000 0.000 0.200 0.056
#> GSM877131     5  0.4392     0.3709 0.000 0.000 0.000 0.040 0.628 0.332
#> GSM877147     4  0.0000     0.9946 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877155     5  0.5228     0.2856 0.000 0.120 0.000 0.000 0.572 0.308
#> GSM877159     5  0.4392     0.3709 0.000 0.000 0.000 0.040 0.628 0.332
#> GSM877170     6  0.5369     0.9326 0.012 0.000 0.100 0.000 0.308 0.580
#> GSM877186     1  0.4284     0.4534 0.688 0.000 0.000 0.056 0.000 0.256
#> GSM877132     5  0.4285     0.2379 0.000 0.036 0.000 0.000 0.644 0.320
#> GSM877143     5  0.0000     0.6379 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877146     5  0.0000     0.6379 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877148     5  0.0000     0.6379 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877152     5  0.0508     0.6335 0.012 0.000 0.000 0.000 0.984 0.004
#> GSM877168     5  0.0146     0.6373 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM877180     5  0.0146     0.6373 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM877126     3  0.2152     0.7468 0.068 0.000 0.904 0.004 0.000 0.024
#> GSM877129     3  0.0146     0.7487 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM877133     3  0.6694     0.4756 0.280 0.000 0.488 0.000 0.088 0.144
#> GSM877153     4  0.0363     0.9892 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM877169     1  0.2265     0.7782 0.904 0.000 0.028 0.000 0.056 0.012
#> GSM877171     3  0.0000     0.7497 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877174     3  0.0000     0.7497 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877134     1  0.6018     0.2661 0.472 0.000 0.004 0.000 0.260 0.264
#> GSM877135     1  0.0363     0.7604 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM877136     1  0.0363     0.7604 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM877137     1  0.5223     0.5782 0.628 0.000 0.004 0.000 0.200 0.168
#> GSM877139     1  0.5171     0.5899 0.636 0.000 0.004 0.000 0.192 0.168
#> GSM877149     1  0.5558     0.3858 0.524 0.000 0.000 0.000 0.160 0.316
#> GSM877154     5  0.3253     0.4969 0.020 0.000 0.000 0.000 0.788 0.192
#> GSM877157     1  0.2480     0.7683 0.872 0.000 0.000 0.000 0.104 0.024
#> GSM877160     1  0.1564     0.7761 0.936 0.000 0.024 0.000 0.040 0.000
#> GSM877161     1  0.0363     0.7604 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM877163     1  0.5280     0.5689 0.620 0.000 0.004 0.000 0.200 0.176
#> GSM877166     1  0.0363     0.7604 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM877167     5  0.0508     0.6335 0.012 0.000 0.000 0.000 0.984 0.004
#> GSM877175     1  0.2265     0.7782 0.904 0.000 0.028 0.000 0.056 0.012
#> GSM877177     1  0.2006     0.7792 0.904 0.000 0.000 0.000 0.080 0.016
#> GSM877184     1  0.5844     0.2461 0.476 0.000 0.000 0.000 0.216 0.308
#> GSM877187     5  0.1391     0.6211 0.016 0.000 0.000 0.000 0.944 0.040
#> GSM877188     1  0.2265     0.7782 0.904 0.000 0.028 0.000 0.056 0.012
#> GSM877150     1  0.1340     0.7781 0.948 0.000 0.008 0.000 0.040 0.004
#> GSM877165     5  0.5173     0.2243 0.000 0.160 0.000 0.000 0.616 0.224
#> GSM877183     5  0.3329     0.5000 0.020 0.000 0.004 0.000 0.792 0.184
#> GSM877178     3  0.0000     0.7497 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877182     6  0.5629     0.9335 0.024 0.000 0.100 0.000 0.316 0.560

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) genotype/variation(p) other(p) k
#> CV:hclust 58           0.2123                 0.605 7.12e-07 2
#> CV:hclust 49           0.2972                 0.635 8.38e-06 3
#> CV:hclust 57           0.3028                 0.916 8.65e-08 4
#> CV:hclust 57           0.1373                 0.314 2.40e-13 5
#> CV:hclust 42           0.0151                 0.737 2.00e-16 6

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


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

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.977       0.988         0.5083 0.492   0.492
#> 3 3 0.511           0.673       0.825         0.2536 0.864   0.728
#> 4 4 0.566           0.539       0.700         0.1175 0.825   0.569
#> 5 5 0.699           0.734       0.847         0.0852 0.896   0.644
#> 6 6 0.750           0.704       0.811         0.0497 0.964   0.840

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
#> GSM877144     1  0.0376      0.989 0.996 0.004
#> GSM877128     1  0.0376      0.989 0.996 0.004
#> GSM877164     1  0.0376      0.989 0.996 0.004
#> GSM877162     2  0.0376      0.983 0.004 0.996
#> GSM877127     1  0.0000      0.990 1.000 0.000
#> GSM877138     1  0.0000      0.990 1.000 0.000
#> GSM877140     1  0.0376      0.989 0.996 0.004
#> GSM877156     2  0.0376      0.986 0.004 0.996
#> GSM877130     2  0.0000      0.985 0.000 1.000
#> GSM877141     2  0.0000      0.985 0.000 1.000
#> GSM877142     2  0.0000      0.985 0.000 1.000
#> GSM877145     2  0.0376      0.986 0.004 0.996
#> GSM877151     2  0.0376      0.986 0.004 0.996
#> GSM877158     2  0.0000      0.985 0.000 1.000
#> GSM877173     2  0.0000      0.985 0.000 1.000
#> GSM877176     2  0.0000      0.985 0.000 1.000
#> GSM877179     2  0.0000      0.985 0.000 1.000
#> GSM877181     2  0.0376      0.986 0.004 0.996
#> GSM877185     2  0.0376      0.986 0.004 0.996
#> GSM877131     2  0.0376      0.983 0.004 0.996
#> GSM877147     2  0.0376      0.983 0.004 0.996
#> GSM877155     2  0.0000      0.985 0.000 1.000
#> GSM877159     2  0.0376      0.983 0.004 0.996
#> GSM877170     2  0.0000      0.985 0.000 1.000
#> GSM877186     1  0.0000      0.990 1.000 0.000
#> GSM877132     2  0.0376      0.986 0.004 0.996
#> GSM877143     2  0.0376      0.986 0.004 0.996
#> GSM877146     2  0.0376      0.986 0.004 0.996
#> GSM877148     2  0.0376      0.986 0.004 0.996
#> GSM877152     2  0.0376      0.986 0.004 0.996
#> GSM877168     2  0.0376      0.986 0.004 0.996
#> GSM877180     2  0.0376      0.986 0.004 0.996
#> GSM877126     1  0.0376      0.989 0.996 0.004
#> GSM877129     1  0.0376      0.989 0.996 0.004
#> GSM877133     1  0.0000      0.990 1.000 0.000
#> GSM877153     1  0.0376      0.989 0.996 0.004
#> GSM877169     1  0.0376      0.990 0.996 0.004
#> GSM877171     1  0.0376      0.989 0.996 0.004
#> GSM877174     1  0.0376      0.989 0.996 0.004
#> GSM877134     1  0.7219      0.749 0.800 0.200
#> GSM877135     1  0.0376      0.990 0.996 0.004
#> GSM877136     1  0.0376      0.990 0.996 0.004
#> GSM877137     1  0.0376      0.990 0.996 0.004
#> GSM877139     1  0.0376      0.990 0.996 0.004
#> GSM877149     1  0.0376      0.990 0.996 0.004
#> GSM877154     2  0.0376      0.986 0.004 0.996
#> GSM877157     1  0.0376      0.990 0.996 0.004
#> GSM877160     1  0.0376      0.990 0.996 0.004
#> GSM877161     1  0.0376      0.990 0.996 0.004
#> GSM877163     1  0.0376      0.990 0.996 0.004
#> GSM877166     1  0.0376      0.990 0.996 0.004
#> GSM877167     2  0.0376      0.986 0.004 0.996
#> GSM877175     1  0.0376      0.990 0.996 0.004
#> GSM877177     1  0.0376      0.990 0.996 0.004
#> GSM877184     1  0.0376      0.990 0.996 0.004
#> GSM877187     2  0.0376      0.986 0.004 0.996
#> GSM877188     1  0.0376      0.990 0.996 0.004
#> GSM877150     1  0.0376      0.990 0.996 0.004
#> GSM877165     2  0.0376      0.986 0.004 0.996
#> GSM877183     2  0.7299      0.748 0.204 0.796
#> GSM877178     1  0.0376      0.989 0.996 0.004
#> GSM877182     2  0.6048      0.824 0.148 0.852

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.4796   0.638156 0.220 0.000 0.780
#> GSM877128     1  0.6280   0.072774 0.540 0.000 0.460
#> GSM877164     1  0.4702   0.629209 0.788 0.000 0.212
#> GSM877162     3  0.5216   0.527627 0.000 0.260 0.740
#> GSM877127     3  0.6204   0.402619 0.424 0.000 0.576
#> GSM877138     3  0.6333   0.461954 0.332 0.012 0.656
#> GSM877140     3  0.5926   0.511604 0.356 0.000 0.644
#> GSM877156     2  0.6535   0.741696 0.052 0.728 0.220
#> GSM877130     2  0.2448   0.779281 0.000 0.924 0.076
#> GSM877141     2  0.1643   0.804006 0.000 0.956 0.044
#> GSM877142     2  0.2448   0.779281 0.000 0.924 0.076
#> GSM877145     2  0.3116   0.799857 0.000 0.892 0.108
#> GSM877151     2  0.1411   0.793896 0.000 0.964 0.036
#> GSM877158     2  0.2448   0.779281 0.000 0.924 0.076
#> GSM877173     2  0.0237   0.801501 0.000 0.996 0.004
#> GSM877176     2  0.1411   0.804026 0.000 0.964 0.036
#> GSM877179     2  0.2448   0.779281 0.000 0.924 0.076
#> GSM877181     2  0.0747   0.799121 0.000 0.984 0.016
#> GSM877185     2  0.2448   0.779281 0.000 0.924 0.076
#> GSM877131     2  0.5650   0.597572 0.000 0.688 0.312
#> GSM877147     3  0.5147   0.613076 0.020 0.180 0.800
#> GSM877155     2  0.1411   0.793896 0.000 0.964 0.036
#> GSM877159     3  0.5216   0.527627 0.000 0.260 0.740
#> GSM877170     2  0.4002   0.719627 0.000 0.840 0.160
#> GSM877186     1  0.0424   0.802596 0.992 0.000 0.008
#> GSM877132     2  0.3116   0.799857 0.000 0.892 0.108
#> GSM877143     2  0.5849   0.758401 0.028 0.756 0.216
#> GSM877146     2  0.5849   0.758401 0.028 0.756 0.216
#> GSM877148     2  0.7106   0.714856 0.072 0.696 0.232
#> GSM877152     2  0.7306   0.704432 0.080 0.684 0.236
#> GSM877168     2  0.7266   0.706866 0.080 0.688 0.232
#> GSM877180     2  0.7266   0.706866 0.080 0.688 0.232
#> GSM877126     1  0.6286   0.067657 0.536 0.000 0.464
#> GSM877129     1  0.6302   0.000579 0.520 0.000 0.480
#> GSM877133     1  0.0000   0.803763 1.000 0.000 0.000
#> GSM877153     3  0.4555   0.607496 0.200 0.000 0.800
#> GSM877169     1  0.0000   0.803763 1.000 0.000 0.000
#> GSM877171     1  0.3619   0.711863 0.864 0.000 0.136
#> GSM877174     1  0.4654   0.634370 0.792 0.000 0.208
#> GSM877134     1  0.6325   0.612387 0.772 0.112 0.116
#> GSM877135     1  0.3918   0.742883 0.868 0.012 0.120
#> GSM877136     1  0.0237   0.803307 0.996 0.000 0.004
#> GSM877137     1  0.4563   0.721650 0.852 0.036 0.112
#> GSM877139     1  0.3921   0.742062 0.872 0.016 0.112
#> GSM877149     1  0.0747   0.801044 0.984 0.000 0.016
#> GSM877154     2  0.7496   0.689339 0.088 0.672 0.240
#> GSM877157     1  0.3995   0.740128 0.868 0.016 0.116
#> GSM877160     1  0.0000   0.803763 1.000 0.000 0.000
#> GSM877161     1  0.0237   0.803307 0.996 0.000 0.004
#> GSM877163     1  0.3272   0.762166 0.904 0.016 0.080
#> GSM877166     1  0.0237   0.803307 0.996 0.000 0.004
#> GSM877167     2  0.5178   0.777703 0.028 0.808 0.164
#> GSM877175     1  0.0000   0.803763 1.000 0.000 0.000
#> GSM877177     1  0.2878   0.765708 0.904 0.000 0.096
#> GSM877184     1  0.4519   0.723904 0.852 0.032 0.116
#> GSM877187     2  0.7344   0.700218 0.080 0.680 0.240
#> GSM877188     1  0.0000   0.803763 1.000 0.000 0.000
#> GSM877150     1  0.0000   0.803763 1.000 0.000 0.000
#> GSM877165     2  0.1411   0.793896 0.000 0.964 0.036
#> GSM877183     3  0.8933   0.381998 0.168 0.276 0.556
#> GSM877178     1  0.6274   0.090782 0.544 0.000 0.456
#> GSM877182     2  0.6659   0.535590 0.028 0.668 0.304

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.5257     0.5650 0.008 0.000 0.548 0.444
#> GSM877128     3  0.4761     0.2838 0.372 0.000 0.628 0.000
#> GSM877164     1  0.4999    -0.0342 0.508 0.000 0.492 0.000
#> GSM877162     3  0.5685     0.5472 0.000 0.024 0.516 0.460
#> GSM877127     4  0.7228    -0.0576 0.156 0.000 0.340 0.504
#> GSM877138     4  0.6920     0.0318 0.132 0.000 0.316 0.552
#> GSM877140     3  0.6583     0.4133 0.084 0.000 0.528 0.388
#> GSM877156     4  0.6101     0.7215 0.068 0.284 0.004 0.644
#> GSM877130     2  0.0188     0.7319 0.000 0.996 0.004 0.000
#> GSM877141     2  0.4122     0.6264 0.000 0.760 0.004 0.236
#> GSM877142     2  0.0336     0.7306 0.000 0.992 0.008 0.000
#> GSM877145     2  0.5279     0.2750 0.000 0.588 0.012 0.400
#> GSM877151     2  0.1302     0.7390 0.000 0.956 0.000 0.044
#> GSM877158     2  0.0469     0.7306 0.000 0.988 0.012 0.000
#> GSM877173     2  0.3668     0.6763 0.000 0.808 0.004 0.188
#> GSM877176     2  0.4718     0.5811 0.000 0.708 0.012 0.280
#> GSM877179     2  0.0469     0.7306 0.000 0.988 0.012 0.000
#> GSM877181     2  0.3591     0.6982 0.000 0.824 0.008 0.168
#> GSM877185     2  0.0469     0.7331 0.000 0.988 0.012 0.000
#> GSM877131     2  0.6703     0.3436 0.000 0.612 0.156 0.232
#> GSM877147     3  0.5396     0.5486 0.000 0.012 0.524 0.464
#> GSM877155     2  0.1118     0.7389 0.000 0.964 0.000 0.036
#> GSM877159     3  0.5771     0.5472 0.000 0.028 0.512 0.460
#> GSM877170     2  0.6352     0.5385 0.000 0.632 0.108 0.260
#> GSM877186     1  0.0336     0.7264 0.992 0.000 0.000 0.008
#> GSM877132     2  0.5279     0.2750 0.000 0.588 0.012 0.400
#> GSM877143     4  0.5633     0.5721 0.016 0.380 0.008 0.596
#> GSM877146     4  0.5633     0.5721 0.016 0.380 0.008 0.596
#> GSM877148     4  0.6058     0.7265 0.072 0.296 0.000 0.632
#> GSM877152     4  0.5941     0.7303 0.072 0.276 0.000 0.652
#> GSM877168     4  0.6058     0.7265 0.072 0.296 0.000 0.632
#> GSM877180     4  0.6058     0.7265 0.072 0.296 0.000 0.632
#> GSM877126     3  0.4730     0.2972 0.364 0.000 0.636 0.000
#> GSM877129     3  0.4661     0.3145 0.348 0.000 0.652 0.000
#> GSM877133     1  0.2741     0.6605 0.892 0.000 0.096 0.012
#> GSM877153     3  0.5237     0.5802 0.016 0.000 0.628 0.356
#> GSM877169     1  0.2149     0.6635 0.912 0.000 0.088 0.000
#> GSM877171     1  0.4981     0.0456 0.536 0.000 0.464 0.000
#> GSM877174     1  0.4998    -0.0229 0.512 0.000 0.488 0.000
#> GSM877134     1  0.5558     0.1755 0.528 0.004 0.012 0.456
#> GSM877135     1  0.4072     0.6063 0.748 0.000 0.000 0.252
#> GSM877136     1  0.0000     0.7252 1.000 0.000 0.000 0.000
#> GSM877137     1  0.4925     0.2848 0.572 0.000 0.000 0.428
#> GSM877139     1  0.4072     0.6063 0.748 0.000 0.000 0.252
#> GSM877149     1  0.1256     0.7191 0.964 0.000 0.008 0.028
#> GSM877154     4  0.6117     0.7268 0.072 0.276 0.004 0.648
#> GSM877157     1  0.4343     0.5922 0.732 0.000 0.004 0.264
#> GSM877160     1  0.0000     0.7252 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0336     0.7266 0.992 0.000 0.000 0.008
#> GSM877163     1  0.0779     0.7237 0.980 0.000 0.004 0.016
#> GSM877166     1  0.0336     0.7266 0.992 0.000 0.000 0.008
#> GSM877167     4  0.5723     0.6429 0.032 0.340 0.004 0.624
#> GSM877175     1  0.0000     0.7252 1.000 0.000 0.000 0.000
#> GSM877177     1  0.3975     0.6184 0.760 0.000 0.000 0.240
#> GSM877184     1  0.5220     0.2851 0.568 0.000 0.008 0.424
#> GSM877187     4  0.5916     0.7295 0.072 0.272 0.000 0.656
#> GSM877188     1  0.0000     0.7252 1.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.7252 1.000 0.000 0.000 0.000
#> GSM877165     2  0.2048     0.7362 0.000 0.928 0.008 0.064
#> GSM877183     4  0.6723     0.5285 0.084 0.064 0.160 0.692
#> GSM877178     3  0.4817     0.2560 0.388 0.000 0.612 0.000
#> GSM877182     2  0.6619     0.0495 0.032 0.504 0.028 0.436

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0451     0.9211 0.000 0.000 0.004 0.988 0.008
#> GSM877128     3  0.2152     0.9722 0.044 0.000 0.920 0.032 0.004
#> GSM877164     3  0.1557     0.9753 0.052 0.000 0.940 0.008 0.000
#> GSM877162     4  0.0798     0.9219 0.000 0.008 0.000 0.976 0.016
#> GSM877127     5  0.6368     0.3749 0.072 0.000 0.084 0.220 0.624
#> GSM877138     5  0.5631     0.3885 0.072 0.000 0.020 0.268 0.640
#> GSM877140     4  0.5550     0.6293 0.040 0.000 0.064 0.684 0.212
#> GSM877156     5  0.2820     0.7022 0.052 0.044 0.008 0.004 0.892
#> GSM877130     2  0.0451     0.7806 0.000 0.988 0.008 0.000 0.004
#> GSM877141     2  0.5209     0.3045 0.020 0.584 0.020 0.000 0.376
#> GSM877142     2  0.0854     0.7785 0.000 0.976 0.012 0.008 0.004
#> GSM877145     5  0.6136     0.0358 0.064 0.404 0.028 0.000 0.504
#> GSM877151     2  0.1628     0.7763 0.000 0.936 0.008 0.000 0.056
#> GSM877158     2  0.0960     0.7778 0.000 0.972 0.016 0.008 0.004
#> GSM877173     2  0.4673     0.5075 0.020 0.680 0.012 0.000 0.288
#> GSM877176     5  0.6164    -0.1118 0.064 0.432 0.028 0.000 0.476
#> GSM877179     2  0.0960     0.7778 0.000 0.972 0.016 0.008 0.004
#> GSM877181     2  0.4834     0.5742 0.020 0.688 0.024 0.000 0.268
#> GSM877185     2  0.0898     0.7811 0.000 0.972 0.008 0.000 0.020
#> GSM877131     2  0.4557     0.5089 0.000 0.700 0.004 0.264 0.032
#> GSM877147     4  0.0451     0.9217 0.000 0.004 0.000 0.988 0.008
#> GSM877155     2  0.1430     0.7779 0.000 0.944 0.004 0.000 0.052
#> GSM877159     4  0.0798     0.9219 0.000 0.008 0.000 0.976 0.016
#> GSM877170     2  0.6363     0.0593 0.064 0.448 0.040 0.000 0.448
#> GSM877186     1  0.2635     0.8967 0.900 0.004 0.064 0.012 0.020
#> GSM877132     5  0.6136     0.0358 0.064 0.404 0.028 0.000 0.504
#> GSM877143     5  0.4364     0.7041 0.020 0.132 0.020 0.028 0.800
#> GSM877146     5  0.4364     0.7041 0.020 0.132 0.020 0.028 0.800
#> GSM877148     5  0.3977     0.7227 0.028 0.088 0.016 0.032 0.836
#> GSM877152     5  0.3657     0.7277 0.040 0.052 0.016 0.032 0.860
#> GSM877168     5  0.4060     0.7226 0.032 0.088 0.016 0.032 0.832
#> GSM877180     5  0.4060     0.7226 0.032 0.088 0.016 0.032 0.832
#> GSM877126     3  0.1836     0.9733 0.036 0.000 0.932 0.032 0.000
#> GSM877129     3  0.1750     0.9661 0.028 0.000 0.936 0.036 0.000
#> GSM877133     1  0.3437     0.8572 0.832 0.000 0.120 0.000 0.048
#> GSM877153     4  0.1041     0.8951 0.000 0.000 0.032 0.964 0.004
#> GSM877169     1  0.2338     0.8825 0.884 0.000 0.112 0.000 0.004
#> GSM877171     3  0.1410     0.9668 0.060 0.000 0.940 0.000 0.000
#> GSM877174     3  0.1557     0.9753 0.052 0.000 0.940 0.008 0.000
#> GSM877134     1  0.3769     0.7448 0.796 0.004 0.028 0.000 0.172
#> GSM877135     1  0.1908     0.8827 0.908 0.000 0.000 0.000 0.092
#> GSM877136     1  0.1956     0.9004 0.916 0.000 0.076 0.000 0.008
#> GSM877137     1  0.3210     0.7812 0.788 0.000 0.000 0.000 0.212
#> GSM877139     1  0.1792     0.8839 0.916 0.000 0.000 0.000 0.084
#> GSM877149     1  0.2012     0.8536 0.920 0.000 0.020 0.000 0.060
#> GSM877154     5  0.2934     0.7169 0.068 0.036 0.004 0.008 0.884
#> GSM877157     1  0.0880     0.8877 0.968 0.000 0.000 0.000 0.032
#> GSM877160     1  0.1831     0.9017 0.920 0.000 0.076 0.000 0.004
#> GSM877161     1  0.2006     0.9028 0.916 0.000 0.072 0.000 0.012
#> GSM877163     1  0.0671     0.8871 0.980 0.000 0.004 0.000 0.016
#> GSM877166     1  0.2006     0.9028 0.916 0.000 0.072 0.000 0.012
#> GSM877167     5  0.2456     0.7112 0.024 0.064 0.008 0.000 0.904
#> GSM877175     1  0.1768     0.9026 0.924 0.000 0.072 0.000 0.004
#> GSM877177     1  0.2674     0.8622 0.868 0.000 0.012 0.000 0.120
#> GSM877184     1  0.3106     0.7942 0.840 0.000 0.020 0.000 0.140
#> GSM877187     5  0.2721     0.7264 0.036 0.020 0.008 0.032 0.904
#> GSM877188     1  0.1831     0.9017 0.920 0.000 0.076 0.000 0.004
#> GSM877150     1  0.1831     0.9010 0.920 0.000 0.076 0.000 0.004
#> GSM877165     2  0.2672     0.7482 0.004 0.872 0.008 0.000 0.116
#> GSM877183     5  0.2925     0.7139 0.056 0.004 0.012 0.040 0.888
#> GSM877178     3  0.1661     0.9768 0.036 0.000 0.940 0.024 0.000
#> GSM877182     5  0.6461     0.1849 0.096 0.320 0.028 0.004 0.552

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0363     0.8440 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM877128     3  0.2007     0.9502 0.032 0.000 0.920 0.012 0.000 0.036
#> GSM877164     3  0.0790     0.9857 0.032 0.000 0.968 0.000 0.000 0.000
#> GSM877162     4  0.1737     0.8365 0.000 0.000 0.008 0.932 0.020 0.040
#> GSM877127     5  0.6883     0.4189 0.072 0.000 0.032 0.092 0.488 0.316
#> GSM877138     5  0.6821     0.3831 0.060 0.000 0.020 0.124 0.480 0.316
#> GSM877140     4  0.7509     0.0567 0.044 0.000 0.040 0.340 0.252 0.324
#> GSM877156     5  0.4585     0.3997 0.012 0.020 0.004 0.000 0.612 0.352
#> GSM877130     2  0.0363     0.7107 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM877141     2  0.6128    -0.3589 0.000 0.464 0.016 0.000 0.180 0.340
#> GSM877142     2  0.0837     0.7084 0.000 0.972 0.004 0.004 0.000 0.020
#> GSM877145     6  0.6004     0.7859 0.004 0.264 0.000 0.000 0.256 0.476
#> GSM877151     2  0.1753     0.6878 0.000 0.912 0.000 0.000 0.084 0.004
#> GSM877158     2  0.0922     0.7079 0.000 0.968 0.004 0.004 0.000 0.024
#> GSM877173     2  0.5008     0.1884 0.000 0.640 0.000 0.000 0.148 0.212
#> GSM877176     6  0.5587     0.8163 0.004 0.252 0.000 0.000 0.180 0.564
#> GSM877179     2  0.0922     0.7079 0.000 0.968 0.004 0.004 0.000 0.024
#> GSM877181     2  0.5583    -0.2366 0.000 0.508 0.000 0.000 0.156 0.336
#> GSM877185     2  0.1387     0.6899 0.000 0.932 0.000 0.000 0.000 0.068
#> GSM877131     2  0.6365     0.3913 0.000 0.588 0.008 0.188 0.084 0.132
#> GSM877147     4  0.0363     0.8440 0.000 0.000 0.000 0.988 0.012 0.000
#> GSM877155     2  0.1442     0.7047 0.000 0.944 0.004 0.000 0.040 0.012
#> GSM877159     4  0.3095     0.7919 0.000 0.000 0.008 0.840 0.036 0.116
#> GSM877170     6  0.5734     0.7956 0.004 0.244 0.016 0.000 0.148 0.588
#> GSM877186     1  0.3284     0.8166 0.784 0.000 0.000 0.020 0.000 0.196
#> GSM877132     6  0.6031     0.7734 0.004 0.264 0.000 0.000 0.264 0.468
#> GSM877143     5  0.3800     0.6291 0.000 0.076 0.016 0.000 0.800 0.108
#> GSM877146     5  0.3800     0.6291 0.000 0.076 0.016 0.000 0.800 0.108
#> GSM877148     5  0.0937     0.7081 0.000 0.040 0.000 0.000 0.960 0.000
#> GSM877152     5  0.1003     0.7073 0.004 0.028 0.000 0.000 0.964 0.004
#> GSM877168     5  0.1082     0.7080 0.004 0.040 0.000 0.000 0.956 0.000
#> GSM877180     5  0.1082     0.7080 0.004 0.040 0.000 0.000 0.956 0.000
#> GSM877126     3  0.0858     0.9850 0.028 0.000 0.968 0.000 0.000 0.004
#> GSM877129     3  0.0858     0.9850 0.028 0.000 0.968 0.000 0.000 0.004
#> GSM877133     1  0.3164     0.8091 0.844 0.000 0.020 0.000 0.032 0.104
#> GSM877153     4  0.0622     0.8352 0.000 0.000 0.012 0.980 0.000 0.008
#> GSM877169     1  0.0547     0.8750 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM877171     3  0.0937     0.9789 0.040 0.000 0.960 0.000 0.000 0.000
#> GSM877174     3  0.0790     0.9857 0.032 0.000 0.968 0.000 0.000 0.000
#> GSM877134     1  0.4251     0.5317 0.624 0.000 0.000 0.000 0.028 0.348
#> GSM877135     1  0.3279     0.8442 0.816 0.000 0.000 0.008 0.028 0.148
#> GSM877136     1  0.2685     0.8462 0.852 0.000 0.008 0.008 0.000 0.132
#> GSM877137     1  0.2404     0.8361 0.872 0.000 0.000 0.000 0.112 0.016
#> GSM877139     1  0.1245     0.8723 0.952 0.000 0.000 0.000 0.032 0.016
#> GSM877149     1  0.3136     0.7584 0.768 0.000 0.000 0.000 0.004 0.228
#> GSM877154     5  0.4047     0.5239 0.016 0.020 0.000 0.000 0.720 0.244
#> GSM877157     1  0.1616     0.8755 0.932 0.000 0.000 0.000 0.020 0.048
#> GSM877160     1  0.0363     0.8761 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM877161     1  0.2685     0.8462 0.852 0.000 0.008 0.008 0.000 0.132
#> GSM877163     1  0.1588     0.8627 0.924 0.000 0.000 0.000 0.004 0.072
#> GSM877166     1  0.2685     0.8462 0.852 0.000 0.008 0.008 0.000 0.132
#> GSM877167     5  0.3283     0.5815 0.000 0.036 0.000 0.000 0.804 0.160
#> GSM877175     1  0.0363     0.8761 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM877177     1  0.2451     0.8616 0.884 0.000 0.000 0.000 0.060 0.056
#> GSM877184     1  0.3907     0.6596 0.704 0.000 0.000 0.000 0.028 0.268
#> GSM877187     5  0.2706     0.6710 0.008 0.000 0.000 0.000 0.832 0.160
#> GSM877188     1  0.0363     0.8761 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM877150     1  0.1049     0.8754 0.960 0.000 0.008 0.000 0.000 0.032
#> GSM877165     2  0.3841     0.5419 0.000 0.764 0.000 0.000 0.068 0.168
#> GSM877183     5  0.4558     0.5177 0.020 0.000 0.016 0.000 0.604 0.360
#> GSM877178     3  0.0713     0.9859 0.028 0.000 0.972 0.000 0.000 0.000
#> GSM877182     6  0.5613     0.7538 0.040 0.172 0.000 0.000 0.152 0.636

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-kmeans-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) genotype/variation(p) other(p) k
#> CV:kmeans 62           0.2193                0.5296 7.89e-08 2
#> CV:kmeans 55           0.1596                0.0181 2.40e-08 3
#> CV:kmeans 45           0.1265                0.3673 4.30e-12 4
#> CV:kmeans 54           0.0943                0.1107 1.18e-17 5
#> CV:kmeans 54           0.0761                0.2968 8.68e-17 6

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


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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.983       0.993         0.5087 0.492   0.492
#> 3 3 0.980           0.933       0.967         0.3136 0.769   0.562
#> 4 4 0.803           0.819       0.852         0.1064 0.875   0.646
#> 5 5 0.823           0.802       0.886         0.0704 0.955   0.823
#> 6 6 0.798           0.658       0.836         0.0407 0.959   0.819

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
#> GSM877144     1   0.000      0.993 1.00 0.00
#> GSM877128     1   0.000      0.993 1.00 0.00
#> GSM877164     1   0.000      0.993 1.00 0.00
#> GSM877162     2   0.000      0.991 0.00 1.00
#> GSM877127     1   0.000      0.993 1.00 0.00
#> GSM877138     1   0.000      0.993 1.00 0.00
#> GSM877140     1   0.000      0.993 1.00 0.00
#> GSM877156     2   0.000      0.991 0.00 1.00
#> GSM877130     2   0.000      0.991 0.00 1.00
#> GSM877141     2   0.000      0.991 0.00 1.00
#> GSM877142     2   0.000      0.991 0.00 1.00
#> GSM877145     2   0.000      0.991 0.00 1.00
#> GSM877151     2   0.000      0.991 0.00 1.00
#> GSM877158     2   0.000      0.991 0.00 1.00
#> GSM877173     2   0.000      0.991 0.00 1.00
#> GSM877176     2   0.000      0.991 0.00 1.00
#> GSM877179     2   0.000      0.991 0.00 1.00
#> GSM877181     2   0.000      0.991 0.00 1.00
#> GSM877185     2   0.000      0.991 0.00 1.00
#> GSM877131     2   0.000      0.991 0.00 1.00
#> GSM877147     2   0.000      0.991 0.00 1.00
#> GSM877155     2   0.000      0.991 0.00 1.00
#> GSM877159     2   0.000      0.991 0.00 1.00
#> GSM877170     2   0.000      0.991 0.00 1.00
#> GSM877186     1   0.000      0.993 1.00 0.00
#> GSM877132     2   0.000      0.991 0.00 1.00
#> GSM877143     2   0.000      0.991 0.00 1.00
#> GSM877146     2   0.000      0.991 0.00 1.00
#> GSM877148     2   0.000      0.991 0.00 1.00
#> GSM877152     2   0.000      0.991 0.00 1.00
#> GSM877168     2   0.000      0.991 0.00 1.00
#> GSM877180     2   0.000      0.991 0.00 1.00
#> GSM877126     1   0.000      0.993 1.00 0.00
#> GSM877129     1   0.000      0.993 1.00 0.00
#> GSM877133     1   0.000      0.993 1.00 0.00
#> GSM877153     1   0.000      0.993 1.00 0.00
#> GSM877169     1   0.000      0.993 1.00 0.00
#> GSM877171     1   0.000      0.993 1.00 0.00
#> GSM877174     1   0.000      0.993 1.00 0.00
#> GSM877134     1   0.722      0.747 0.80 0.20
#> GSM877135     1   0.000      0.993 1.00 0.00
#> GSM877136     1   0.000      0.993 1.00 0.00
#> GSM877137     1   0.000      0.993 1.00 0.00
#> GSM877139     1   0.000      0.993 1.00 0.00
#> GSM877149     1   0.000      0.993 1.00 0.00
#> GSM877154     2   0.000      0.991 0.00 1.00
#> GSM877157     1   0.000      0.993 1.00 0.00
#> GSM877160     1   0.000      0.993 1.00 0.00
#> GSM877161     1   0.000      0.993 1.00 0.00
#> GSM877163     1   0.000      0.993 1.00 0.00
#> GSM877166     1   0.000      0.993 1.00 0.00
#> GSM877167     2   0.000      0.991 0.00 1.00
#> GSM877175     1   0.000      0.993 1.00 0.00
#> GSM877177     1   0.000      0.993 1.00 0.00
#> GSM877184     1   0.000      0.993 1.00 0.00
#> GSM877187     2   0.000      0.991 0.00 1.00
#> GSM877188     1   0.000      0.993 1.00 0.00
#> GSM877150     1   0.000      0.993 1.00 0.00
#> GSM877165     2   0.000      0.991 0.00 1.00
#> GSM877183     2   0.722      0.750 0.20 0.80
#> GSM877178     1   0.000      0.993 1.00 0.00
#> GSM877182     2   0.327      0.932 0.06 0.94

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.0424      0.931 0.008 0.000 0.992
#> GSM877128     3  0.0424      0.931 0.008 0.000 0.992
#> GSM877164     3  0.5363      0.625 0.276 0.000 0.724
#> GSM877162     3  0.0747      0.926 0.000 0.016 0.984
#> GSM877127     3  0.0237      0.931 0.004 0.000 0.996
#> GSM877138     3  0.0237      0.928 0.004 0.000 0.996
#> GSM877140     3  0.0237      0.931 0.004 0.000 0.996
#> GSM877156     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877130     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877141     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877142     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877145     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877151     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877158     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877173     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877176     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877179     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877181     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877185     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877131     2  0.6079      0.359 0.000 0.612 0.388
#> GSM877147     3  0.0747      0.926 0.000 0.016 0.984
#> GSM877155     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877159     3  0.0747      0.926 0.000 0.016 0.984
#> GSM877170     3  0.3941      0.808 0.000 0.156 0.844
#> GSM877186     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877132     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877143     2  0.0848      0.964 0.008 0.984 0.008
#> GSM877146     2  0.0848      0.964 0.008 0.984 0.008
#> GSM877148     2  0.0848      0.964 0.008 0.984 0.008
#> GSM877152     2  0.2584      0.925 0.064 0.928 0.008
#> GSM877168     2  0.2384      0.932 0.056 0.936 0.008
#> GSM877180     2  0.2384      0.932 0.056 0.936 0.008
#> GSM877126     3  0.0424      0.931 0.008 0.000 0.992
#> GSM877129     3  0.0424      0.931 0.008 0.000 0.992
#> GSM877133     1  0.0892      0.982 0.980 0.000 0.020
#> GSM877153     3  0.0424      0.931 0.008 0.000 0.992
#> GSM877169     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877171     1  0.2066      0.939 0.940 0.000 0.060
#> GSM877174     3  0.6111      0.371 0.396 0.000 0.604
#> GSM877134     1  0.1163      0.965 0.972 0.028 0.000
#> GSM877135     1  0.0000      0.988 1.000 0.000 0.000
#> GSM877136     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877137     1  0.0237      0.985 0.996 0.000 0.004
#> GSM877139     1  0.0237      0.985 0.996 0.000 0.004
#> GSM877149     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877154     2  0.2680      0.921 0.068 0.924 0.008
#> GSM877157     1  0.0000      0.988 1.000 0.000 0.000
#> GSM877160     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877161     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877163     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877166     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877167     2  0.0848      0.964 0.008 0.984 0.008
#> GSM877175     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877177     1  0.0237      0.990 0.996 0.000 0.004
#> GSM877184     1  0.0237      0.990 0.996 0.000 0.004
#> GSM877187     2  0.0848      0.964 0.008 0.984 0.008
#> GSM877188     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877150     1  0.0424      0.992 0.992 0.000 0.008
#> GSM877165     2  0.0000      0.969 0.000 1.000 0.000
#> GSM877183     3  0.0000      0.929 0.000 0.000 1.000
#> GSM877178     3  0.0424      0.931 0.008 0.000 0.992
#> GSM877182     3  0.4473      0.795 0.008 0.164 0.828

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.0592     0.7882 0.000 0.016 0.984 0.000
#> GSM877128     3  0.5231     0.7431 0.028 0.296 0.676 0.000
#> GSM877164     3  0.7412     0.5849 0.200 0.296 0.504 0.000
#> GSM877162     3  0.2521     0.7588 0.000 0.064 0.912 0.024
#> GSM877127     3  0.3505     0.7878 0.016 0.108 0.864 0.012
#> GSM877138     3  0.1118     0.7816 0.000 0.000 0.964 0.036
#> GSM877140     3  0.0336     0.7917 0.000 0.008 0.992 0.000
#> GSM877156     4  0.5038     0.1057 0.000 0.336 0.012 0.652
#> GSM877130     2  0.4500     0.9046 0.000 0.684 0.000 0.316
#> GSM877141     2  0.4222     0.8615 0.000 0.728 0.000 0.272
#> GSM877142     2  0.4500     0.9046 0.000 0.684 0.000 0.316
#> GSM877145     2  0.4477     0.9042 0.000 0.688 0.000 0.312
#> GSM877151     2  0.4830     0.7989 0.000 0.608 0.000 0.392
#> GSM877158     2  0.4500     0.9046 0.000 0.684 0.000 0.316
#> GSM877173     2  0.4500     0.9046 0.000 0.684 0.000 0.316
#> GSM877176     2  0.4535     0.8881 0.000 0.704 0.004 0.292
#> GSM877179     2  0.4500     0.9046 0.000 0.684 0.000 0.316
#> GSM877181     2  0.4477     0.9042 0.000 0.688 0.000 0.312
#> GSM877185     2  0.4500     0.9046 0.000 0.684 0.000 0.316
#> GSM877131     3  0.6499     0.0744 0.000 0.400 0.524 0.076
#> GSM877147     3  0.1706     0.7779 0.000 0.036 0.948 0.016
#> GSM877155     2  0.4624     0.8790 0.000 0.660 0.000 0.340
#> GSM877159     3  0.2197     0.7685 0.000 0.048 0.928 0.024
#> GSM877170     2  0.0000     0.5117 0.000 1.000 0.000 0.000
#> GSM877186     1  0.0469     0.9411 0.988 0.000 0.012 0.000
#> GSM877132     2  0.4477     0.9042 0.000 0.688 0.000 0.312
#> GSM877143     4  0.0707     0.9167 0.000 0.020 0.000 0.980
#> GSM877146     4  0.0707     0.9167 0.000 0.020 0.000 0.980
#> GSM877148     4  0.0000     0.9238 0.000 0.000 0.000 1.000
#> GSM877152     4  0.0000     0.9238 0.000 0.000 0.000 1.000
#> GSM877168     4  0.0000     0.9238 0.000 0.000 0.000 1.000
#> GSM877180     4  0.0000     0.9238 0.000 0.000 0.000 1.000
#> GSM877126     3  0.4933     0.7470 0.016 0.296 0.688 0.000
#> GSM877129     3  0.5038     0.7460 0.020 0.296 0.684 0.000
#> GSM877133     1  0.3587     0.8359 0.860 0.088 0.052 0.000
#> GSM877153     3  0.0000     0.7902 0.000 0.000 1.000 0.000
#> GSM877169     1  0.3160     0.8504 0.872 0.108 0.020 0.000
#> GSM877171     1  0.6457     0.4461 0.604 0.296 0.100 0.000
#> GSM877174     3  0.7894     0.3190 0.332 0.296 0.372 0.000
#> GSM877134     1  0.2198     0.8921 0.920 0.072 0.000 0.008
#> GSM877135     1  0.1118     0.9318 0.964 0.000 0.000 0.036
#> GSM877136     1  0.0000     0.9445 1.000 0.000 0.000 0.000
#> GSM877137     1  0.2589     0.8673 0.884 0.000 0.000 0.116
#> GSM877139     1  0.0707     0.9385 0.980 0.000 0.000 0.020
#> GSM877149     1  0.0188     0.9437 0.996 0.004 0.000 0.000
#> GSM877154     4  0.1209     0.9098 0.004 0.032 0.000 0.964
#> GSM877157     1  0.1118     0.9318 0.964 0.000 0.000 0.036
#> GSM877160     1  0.0000     0.9445 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.9445 1.000 0.000 0.000 0.000
#> GSM877163     1  0.0000     0.9445 1.000 0.000 0.000 0.000
#> GSM877166     1  0.0000     0.9445 1.000 0.000 0.000 0.000
#> GSM877167     4  0.1302     0.8923 0.000 0.044 0.000 0.956
#> GSM877175     1  0.0000     0.9445 1.000 0.000 0.000 0.000
#> GSM877177     1  0.1389     0.9254 0.952 0.000 0.000 0.048
#> GSM877184     1  0.0524     0.9426 0.988 0.004 0.000 0.008
#> GSM877187     4  0.0469     0.9120 0.000 0.000 0.012 0.988
#> GSM877188     1  0.0000     0.9445 1.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.9445 1.000 0.000 0.000 0.000
#> GSM877165     2  0.4477     0.9042 0.000 0.688 0.000 0.312
#> GSM877183     3  0.4683     0.7657 0.008 0.100 0.808 0.084
#> GSM877178     3  0.5231     0.7433 0.028 0.296 0.676 0.000
#> GSM877182     2  0.4422     0.4858 0.008 0.736 0.256 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
#> GSM877144     4  0.1478      0.777 0.000 0.000 0.064 0.936 0.000
#> GSM877128     3  0.2046      0.942 0.016 0.000 0.916 0.068 0.000
#> GSM877164     3  0.1818      0.940 0.044 0.000 0.932 0.024 0.000
#> GSM877162     4  0.1372      0.778 0.000 0.024 0.016 0.956 0.004
#> GSM877127     4  0.4650      0.146 0.000 0.000 0.468 0.520 0.012
#> GSM877138     4  0.3154      0.761 0.008 0.000 0.088 0.864 0.040
#> GSM877140     4  0.2929      0.721 0.000 0.000 0.180 0.820 0.000
#> GSM877156     5  0.5993      0.186 0.000 0.440 0.024 0.056 0.480
#> GSM877130     2  0.1469      0.894 0.000 0.948 0.000 0.016 0.036
#> GSM877141     2  0.2086      0.889 0.000 0.924 0.008 0.020 0.048
#> GSM877142     2  0.1872      0.890 0.000 0.928 0.000 0.020 0.052
#> GSM877145     2  0.2689      0.862 0.000 0.900 0.040 0.024 0.036
#> GSM877151     2  0.3099      0.830 0.000 0.848 0.000 0.028 0.124
#> GSM877158     2  0.1701      0.891 0.000 0.936 0.000 0.016 0.048
#> GSM877173     2  0.1251      0.894 0.000 0.956 0.000 0.008 0.036
#> GSM877176     2  0.2634      0.858 0.000 0.900 0.056 0.020 0.024
#> GSM877179     2  0.1701      0.891 0.000 0.936 0.000 0.016 0.048
#> GSM877181     2  0.2234      0.876 0.000 0.920 0.036 0.012 0.032
#> GSM877185     2  0.1646      0.892 0.000 0.944 0.020 0.004 0.032
#> GSM877131     4  0.4944      0.174 0.000 0.416 0.012 0.560 0.012
#> GSM877147     4  0.1278      0.779 0.000 0.016 0.020 0.960 0.004
#> GSM877155     2  0.2221      0.883 0.000 0.912 0.000 0.036 0.052
#> GSM877159     4  0.1173      0.777 0.000 0.020 0.012 0.964 0.004
#> GSM877170     2  0.3699      0.729 0.000 0.780 0.204 0.008 0.008
#> GSM877186     1  0.0693      0.914 0.980 0.000 0.008 0.012 0.000
#> GSM877132     2  0.3474      0.840 0.000 0.856 0.068 0.024 0.052
#> GSM877143     5  0.2685      0.845 0.000 0.092 0.000 0.028 0.880
#> GSM877146     5  0.2685      0.845 0.000 0.092 0.000 0.028 0.880
#> GSM877148     5  0.1282      0.865 0.000 0.044 0.000 0.004 0.952
#> GSM877152     5  0.1059      0.865 0.000 0.020 0.004 0.008 0.968
#> GSM877168     5  0.0609      0.866 0.000 0.020 0.000 0.000 0.980
#> GSM877180     5  0.0609      0.866 0.000 0.020 0.000 0.000 0.980
#> GSM877126     3  0.1608      0.934 0.000 0.000 0.928 0.072 0.000
#> GSM877129     3  0.1697      0.940 0.000 0.008 0.932 0.060 0.000
#> GSM877133     1  0.4278      0.183 0.548 0.000 0.452 0.000 0.000
#> GSM877153     4  0.2179      0.765 0.000 0.000 0.112 0.888 0.000
#> GSM877169     1  0.4182      0.337 0.600 0.000 0.400 0.000 0.000
#> GSM877171     3  0.1732      0.896 0.080 0.000 0.920 0.000 0.000
#> GSM877174     3  0.1872      0.934 0.052 0.000 0.928 0.020 0.000
#> GSM877134     1  0.3520      0.836 0.864 0.040 0.060 0.024 0.012
#> GSM877135     1  0.0510      0.916 0.984 0.000 0.000 0.000 0.016
#> GSM877136     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.2674      0.813 0.856 0.000 0.004 0.000 0.140
#> GSM877139     1  0.0324      0.919 0.992 0.000 0.004 0.000 0.004
#> GSM877149     1  0.2409      0.879 0.916 0.008 0.044 0.020 0.012
#> GSM877154     5  0.3616      0.811 0.004 0.120 0.024 0.016 0.836
#> GSM877157     1  0.0404      0.917 0.988 0.000 0.012 0.000 0.000
#> GSM877160     1  0.0510      0.916 0.984 0.000 0.016 0.000 0.000
#> GSM877161     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.0609      0.917 0.980 0.000 0.020 0.000 0.000
#> GSM877166     1  0.0000      0.919 1.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.3592      0.802 0.000 0.168 0.012 0.012 0.808
#> GSM877175     1  0.0162      0.918 0.996 0.000 0.004 0.000 0.000
#> GSM877177     1  0.0510      0.916 0.984 0.000 0.000 0.000 0.016
#> GSM877184     1  0.2015      0.890 0.932 0.004 0.036 0.020 0.008
#> GSM877187     5  0.2305      0.855 0.000 0.028 0.012 0.044 0.916
#> GSM877188     1  0.0510      0.916 0.984 0.000 0.016 0.000 0.000
#> GSM877150     1  0.0162      0.918 0.996 0.000 0.004 0.000 0.000
#> GSM877165     2  0.2204      0.878 0.000 0.920 0.036 0.008 0.036
#> GSM877183     4  0.6409      0.373 0.000 0.004 0.276 0.528 0.192
#> GSM877178     3  0.1697      0.945 0.008 0.000 0.932 0.060 0.000
#> GSM877182     2  0.6606      0.473 0.020 0.588 0.100 0.268 0.024

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0520     0.8561 0.000 0.000 0.008 0.984 0.000 0.008
#> GSM877128     3  0.1155     0.8804 0.004 0.000 0.956 0.036 0.000 0.004
#> GSM877164     3  0.0146     0.9075 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877162     4  0.1036     0.8539 0.000 0.004 0.008 0.964 0.000 0.024
#> GSM877127     3  0.5907    -0.0769 0.004 0.000 0.444 0.408 0.008 0.136
#> GSM877138     4  0.3026     0.8115 0.000 0.000 0.024 0.856 0.028 0.092
#> GSM877140     4  0.2842     0.8079 0.000 0.000 0.104 0.852 0.000 0.044
#> GSM877156     6  0.6770     0.0372 0.000 0.212 0.000 0.052 0.324 0.412
#> GSM877130     2  0.0790     0.6783 0.000 0.968 0.000 0.000 0.000 0.032
#> GSM877141     2  0.1524     0.6615 0.000 0.932 0.008 0.000 0.000 0.060
#> GSM877142     2  0.0260     0.6821 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM877145     2  0.4066     0.1213 0.000 0.596 0.000 0.000 0.012 0.392
#> GSM877151     2  0.2149     0.6173 0.000 0.900 0.000 0.004 0.080 0.016
#> GSM877158     2  0.0363     0.6824 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM877173     2  0.1007     0.6791 0.000 0.956 0.000 0.000 0.000 0.044
#> GSM877176     2  0.3868    -0.1565 0.000 0.504 0.000 0.000 0.000 0.496
#> GSM877179     2  0.0790     0.6786 0.000 0.968 0.000 0.000 0.000 0.032
#> GSM877181     2  0.3578     0.3112 0.000 0.660 0.000 0.000 0.000 0.340
#> GSM877185     2  0.2135     0.6198 0.000 0.872 0.000 0.000 0.000 0.128
#> GSM877131     2  0.4853     0.0663 0.000 0.536 0.008 0.420 0.004 0.032
#> GSM877147     4  0.0436     0.8552 0.000 0.004 0.004 0.988 0.000 0.004
#> GSM877155     2  0.1078     0.6767 0.000 0.964 0.000 0.008 0.012 0.016
#> GSM877159     4  0.1065     0.8539 0.000 0.008 0.008 0.964 0.000 0.020
#> GSM877170     2  0.5802     0.1116 0.000 0.540 0.196 0.008 0.000 0.256
#> GSM877186     1  0.2344     0.8522 0.896 0.000 0.000 0.052 0.004 0.048
#> GSM877132     6  0.4080    -0.0495 0.000 0.456 0.000 0.000 0.008 0.536
#> GSM877143     5  0.4156     0.7111 0.000 0.088 0.004 0.008 0.768 0.132
#> GSM877146     5  0.4156     0.7111 0.000 0.088 0.004 0.008 0.768 0.132
#> GSM877148     5  0.1434     0.7897 0.000 0.048 0.000 0.000 0.940 0.012
#> GSM877152     5  0.1524     0.7778 0.000 0.000 0.000 0.008 0.932 0.060
#> GSM877168     5  0.0146     0.7953 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM877180     5  0.0146     0.7953 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM877126     3  0.0291     0.9079 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM877129     3  0.0291     0.9079 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM877133     1  0.5254     0.4453 0.576 0.000 0.328 0.004 0.004 0.088
#> GSM877153     4  0.1462     0.8454 0.000 0.000 0.056 0.936 0.000 0.008
#> GSM877169     1  0.4436     0.5272 0.640 0.000 0.312 0.000 0.000 0.048
#> GSM877171     3  0.0146     0.9075 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877174     3  0.0146     0.9075 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877134     1  0.3954     0.5395 0.620 0.004 0.000 0.000 0.004 0.372
#> GSM877135     1  0.1268     0.8698 0.952 0.000 0.000 0.004 0.008 0.036
#> GSM877136     1  0.0405     0.8718 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM877137     1  0.3551     0.7505 0.784 0.000 0.000 0.000 0.168 0.048
#> GSM877139     1  0.1141     0.8703 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM877149     1  0.3163     0.7441 0.764 0.000 0.004 0.000 0.000 0.232
#> GSM877154     5  0.5008     0.4222 0.004 0.040 0.000 0.020 0.608 0.328
#> GSM877157     1  0.1124     0.8690 0.956 0.000 0.000 0.000 0.008 0.036
#> GSM877160     1  0.1500     0.8676 0.936 0.000 0.012 0.000 0.000 0.052
#> GSM877161     1  0.0922     0.8708 0.968 0.000 0.000 0.004 0.004 0.024
#> GSM877163     1  0.1843     0.8619 0.912 0.004 0.004 0.000 0.000 0.080
#> GSM877166     1  0.0603     0.8712 0.980 0.000 0.000 0.000 0.004 0.016
#> GSM877167     5  0.4468     0.5923 0.000 0.076 0.000 0.008 0.712 0.204
#> GSM877175     1  0.0790     0.8713 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM877177     1  0.1933     0.8619 0.920 0.000 0.000 0.004 0.044 0.032
#> GSM877184     1  0.3543     0.7008 0.720 0.000 0.004 0.000 0.004 0.272
#> GSM877187     5  0.4145     0.7173 0.000 0.004 0.004 0.052 0.740 0.200
#> GSM877188     1  0.1049     0.8689 0.960 0.000 0.008 0.000 0.000 0.032
#> GSM877150     1  0.0508     0.8717 0.984 0.000 0.004 0.000 0.000 0.012
#> GSM877165     2  0.3409     0.3922 0.000 0.700 0.000 0.000 0.000 0.300
#> GSM877183     4  0.7556     0.1883 0.000 0.000 0.224 0.364 0.204 0.208
#> GSM877178     3  0.0291     0.9079 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM877182     6  0.5758     0.3566 0.000 0.176 0.036 0.176 0.000 0.612

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-skmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) genotype/variation(p) other(p) k
#> CV:skmeans 62           0.2193               0.52956 7.89e-08 2
#> CV:skmeans 60           0.0851               0.03966 3.81e-13 3
#> CV:skmeans 57           0.2109               0.01938 2.44e-18 4
#> CV:skmeans 55           0.1039               0.00234 1.32e-20 5
#> CV:skmeans 49           0.1098               0.00762 1.22e-19 6

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


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

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.701           0.854       0.931         0.4293 0.581   0.581
#> 3 3 0.712           0.811       0.919         0.3497 0.833   0.713
#> 4 4 0.528           0.562       0.790         0.1374 0.876   0.718
#> 5 5 0.657           0.669       0.846         0.0949 0.898   0.720
#> 6 6 0.659           0.591       0.828         0.0544 0.893   0.660

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
#> GSM877144     1  0.1633      0.925 0.976 0.024
#> GSM877128     1  0.0376      0.929 0.996 0.004
#> GSM877164     1  0.2043      0.920 0.968 0.032
#> GSM877162     2  0.0000      0.910 0.000 1.000
#> GSM877127     1  0.0000      0.929 1.000 0.000
#> GSM877138     1  0.2236      0.920 0.964 0.036
#> GSM877140     1  0.2236      0.920 0.964 0.036
#> GSM877156     2  0.4298      0.875 0.088 0.912
#> GSM877130     2  0.0376      0.909 0.004 0.996
#> GSM877141     1  0.8081      0.718 0.752 0.248
#> GSM877142     2  0.0000      0.910 0.000 1.000
#> GSM877145     2  0.9358      0.485 0.352 0.648
#> GSM877151     2  0.0000      0.910 0.000 1.000
#> GSM877158     2  0.0376      0.909 0.004 0.996
#> GSM877173     1  0.8016      0.723 0.756 0.244
#> GSM877176     2  0.2043      0.907 0.032 0.968
#> GSM877179     2  0.3114      0.882 0.056 0.944
#> GSM877181     2  0.2043      0.907 0.032 0.968
#> GSM877185     2  0.2043      0.907 0.032 0.968
#> GSM877131     2  0.0376      0.909 0.004 0.996
#> GSM877147     2  0.2236      0.905 0.036 0.964
#> GSM877155     2  0.0000      0.910 0.000 1.000
#> GSM877159     2  0.0000      0.910 0.000 1.000
#> GSM877170     1  0.8327      0.697 0.736 0.264
#> GSM877186     1  0.0376      0.929 0.996 0.004
#> GSM877132     2  0.9427      0.467 0.360 0.640
#> GSM877143     1  0.5059      0.859 0.888 0.112
#> GSM877146     1  0.5294      0.851 0.880 0.120
#> GSM877148     1  0.5519      0.863 0.872 0.128
#> GSM877152     1  0.1633      0.923 0.976 0.024
#> GSM877168     1  0.2043      0.920 0.968 0.032
#> GSM877180     1  0.1414      0.925 0.980 0.020
#> GSM877126     1  0.2236      0.920 0.964 0.036
#> GSM877129     1  0.2043      0.920 0.968 0.032
#> GSM877133     1  0.0000      0.929 1.000 0.000
#> GSM877153     1  0.2043      0.920 0.968 0.032
#> GSM877169     1  0.0000      0.929 1.000 0.000
#> GSM877171     1  0.2043      0.920 0.968 0.032
#> GSM877174     1  0.2043      0.920 0.968 0.032
#> GSM877134     1  0.5408      0.852 0.876 0.124
#> GSM877135     1  0.0376      0.929 0.996 0.004
#> GSM877136     1  0.0000      0.929 1.000 0.000
#> GSM877137     1  0.0000      0.929 1.000 0.000
#> GSM877139     1  0.0000      0.929 1.000 0.000
#> GSM877149     1  0.1184      0.927 0.984 0.016
#> GSM877154     1  1.0000     -0.117 0.504 0.496
#> GSM877157     1  0.0938      0.928 0.988 0.012
#> GSM877160     1  0.0000      0.929 1.000 0.000
#> GSM877161     1  0.0376      0.929 0.996 0.004
#> GSM877163     1  0.0376      0.929 0.996 0.004
#> GSM877166     1  0.0376      0.929 0.996 0.004
#> GSM877167     1  0.9815      0.252 0.580 0.420
#> GSM877175     1  0.0376      0.929 0.996 0.004
#> GSM877177     1  0.0376      0.929 0.996 0.004
#> GSM877184     1  0.1414      0.926 0.980 0.020
#> GSM877187     1  0.7056      0.771 0.808 0.192
#> GSM877188     1  0.0376      0.929 0.996 0.004
#> GSM877150     1  0.0000      0.929 1.000 0.000
#> GSM877165     2  0.2043      0.907 0.032 0.968
#> GSM877183     1  0.2043      0.926 0.968 0.032
#> GSM877178     1  0.2043      0.920 0.968 0.032
#> GSM877182     2  0.9358      0.485 0.352 0.648

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     1  0.1753      0.892 0.952 0.048 0.000
#> GSM877128     3  0.6215      0.300 0.428 0.000 0.572
#> GSM877164     3  0.0747      0.855 0.016 0.000 0.984
#> GSM877162     2  0.0237      0.888 0.004 0.996 0.000
#> GSM877127     1  0.0237      0.911 0.996 0.000 0.004
#> GSM877138     1  0.1482      0.905 0.968 0.020 0.012
#> GSM877140     1  0.0747      0.910 0.984 0.000 0.016
#> GSM877156     2  0.3482      0.794 0.128 0.872 0.000
#> GSM877130     2  0.0237      0.888 0.000 0.996 0.004
#> GSM877141     1  0.5763      0.631 0.716 0.276 0.008
#> GSM877142     2  0.0237      0.888 0.000 0.996 0.004
#> GSM877145     2  0.5785      0.512 0.332 0.668 0.000
#> GSM877151     2  0.0475      0.888 0.004 0.992 0.004
#> GSM877158     2  0.0424      0.887 0.000 0.992 0.008
#> GSM877173     1  0.5797      0.625 0.712 0.280 0.008
#> GSM877176     2  0.1163      0.874 0.028 0.972 0.000
#> GSM877179     2  0.2774      0.834 0.072 0.920 0.008
#> GSM877181     2  0.0237      0.888 0.004 0.996 0.000
#> GSM877185     2  0.0592      0.885 0.012 0.988 0.000
#> GSM877131     2  0.0661      0.887 0.004 0.988 0.008
#> GSM877147     2  0.0892      0.883 0.020 0.980 0.000
#> GSM877155     2  0.0237      0.888 0.000 0.996 0.004
#> GSM877159     2  0.0661      0.887 0.004 0.988 0.008
#> GSM877170     3  0.9442      0.240 0.360 0.184 0.456
#> GSM877186     1  0.0237      0.912 0.996 0.000 0.004
#> GSM877132     2  0.5882      0.477 0.348 0.652 0.000
#> GSM877143     1  0.3528      0.860 0.892 0.092 0.016
#> GSM877146     1  0.3846      0.846 0.876 0.108 0.016
#> GSM877148     1  0.1905      0.899 0.956 0.028 0.016
#> GSM877152     1  0.1620      0.904 0.964 0.024 0.012
#> GSM877168     1  0.1877      0.900 0.956 0.032 0.012
#> GSM877180     1  0.1877      0.900 0.956 0.032 0.012
#> GSM877126     3  0.0747      0.854 0.016 0.000 0.984
#> GSM877129     3  0.0747      0.852 0.016 0.000 0.984
#> GSM877133     1  0.1031      0.904 0.976 0.000 0.024
#> GSM877153     3  0.1031      0.851 0.024 0.000 0.976
#> GSM877169     1  0.2796      0.847 0.908 0.000 0.092
#> GSM877171     3  0.0747      0.855 0.016 0.000 0.984
#> GSM877174     3  0.0747      0.855 0.016 0.000 0.984
#> GSM877134     1  0.3340      0.838 0.880 0.120 0.000
#> GSM877135     1  0.0661      0.912 0.988 0.004 0.008
#> GSM877136     1  0.0475      0.912 0.992 0.004 0.004
#> GSM877137     1  0.0237      0.912 0.996 0.004 0.000
#> GSM877139     1  0.0475      0.912 0.992 0.004 0.004
#> GSM877149     1  0.0983      0.909 0.980 0.016 0.004
#> GSM877154     1  0.6816     -0.025 0.516 0.472 0.012
#> GSM877157     1  0.0237      0.912 0.996 0.000 0.004
#> GSM877160     1  0.0237      0.912 0.996 0.000 0.004
#> GSM877161     1  0.0237      0.912 0.996 0.000 0.004
#> GSM877163     1  0.0475      0.912 0.992 0.004 0.004
#> GSM877166     1  0.0237      0.912 0.996 0.000 0.004
#> GSM877167     1  0.6260      0.157 0.552 0.448 0.000
#> GSM877175     1  0.0237      0.912 0.996 0.000 0.004
#> GSM877177     1  0.0237      0.912 0.996 0.000 0.004
#> GSM877184     1  0.0747      0.910 0.984 0.016 0.000
#> GSM877187     1  0.3918      0.815 0.856 0.140 0.004
#> GSM877188     1  0.0475      0.912 0.992 0.004 0.004
#> GSM877150     1  0.0237      0.912 0.996 0.000 0.004
#> GSM877165     2  0.0000      0.888 0.000 1.000 0.000
#> GSM877183     1  0.2878      0.843 0.904 0.000 0.096
#> GSM877178     3  0.0592      0.854 0.012 0.000 0.988
#> GSM877182     2  0.5785      0.512 0.332 0.668 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     1  0.6662    -0.0309 0.504 0.020 0.432 0.044
#> GSM877128     4  0.7748    -0.2331 0.324 0.000 0.248 0.428
#> GSM877164     3  0.5792     0.7623 0.032 0.000 0.552 0.416
#> GSM877162     2  0.5334     0.4485 0.008 0.588 0.400 0.004
#> GSM877127     1  0.2742     0.7372 0.900 0.000 0.024 0.076
#> GSM877138     1  0.2742     0.7446 0.900 0.000 0.024 0.076
#> GSM877140     1  0.5638    -0.0358 0.584 0.000 0.028 0.388
#> GSM877156     2  0.5331     0.6081 0.224 0.728 0.012 0.036
#> GSM877130     2  0.0000     0.7264 0.000 1.000 0.000 0.000
#> GSM877141     1  0.6210     0.2814 0.636 0.300 0.016 0.048
#> GSM877142     2  0.0000     0.7264 0.000 1.000 0.000 0.000
#> GSM877145     2  0.5232     0.4901 0.340 0.644 0.004 0.012
#> GSM877151     2  0.1211     0.7233 0.000 0.960 0.000 0.040
#> GSM877158     2  0.0592     0.7206 0.000 0.984 0.016 0.000
#> GSM877173     1  0.5993     0.0593 0.528 0.440 0.016 0.016
#> GSM877176     2  0.3760     0.6687 0.156 0.828 0.004 0.012
#> GSM877179     2  0.2923     0.6952 0.080 0.896 0.016 0.008
#> GSM877181     2  0.1124     0.7281 0.012 0.972 0.004 0.012
#> GSM877185     2  0.0804     0.7280 0.008 0.980 0.000 0.012
#> GSM877131     2  0.4655     0.5416 0.000 0.684 0.312 0.004
#> GSM877147     2  0.7435     0.4088 0.040 0.468 0.424 0.068
#> GSM877155     2  0.0000     0.7264 0.000 1.000 0.000 0.000
#> GSM877159     3  0.7844    -0.1111 0.000 0.264 0.368 0.368
#> GSM877170     4  0.9707    -0.2871 0.192 0.192 0.244 0.372
#> GSM877186     1  0.2174     0.7491 0.928 0.000 0.052 0.020
#> GSM877132     2  0.5302     0.4646 0.356 0.628 0.004 0.012
#> GSM877143     4  0.5244     0.3546 0.436 0.008 0.000 0.556
#> GSM877146     4  0.5250     0.3495 0.440 0.008 0.000 0.552
#> GSM877148     1  0.5127     0.1854 0.632 0.012 0.000 0.356
#> GSM877152     1  0.3810     0.5974 0.804 0.000 0.008 0.188
#> GSM877168     4  0.4933     0.3405 0.432 0.000 0.000 0.568
#> GSM877180     1  0.3975     0.5513 0.760 0.000 0.000 0.240
#> GSM877126     3  0.5203     0.7670 0.008 0.000 0.576 0.416
#> GSM877129     3  0.5203     0.7670 0.008 0.000 0.576 0.416
#> GSM877133     1  0.3300     0.6160 0.848 0.000 0.144 0.008
#> GSM877153     3  0.1059     0.4401 0.012 0.000 0.972 0.016
#> GSM877169     1  0.4405     0.5304 0.800 0.000 0.152 0.048
#> GSM877171     3  0.5950     0.7551 0.040 0.000 0.544 0.416
#> GSM877174     3  0.5792     0.7623 0.032 0.000 0.552 0.416
#> GSM877134     1  0.3345     0.6719 0.860 0.124 0.004 0.012
#> GSM877135     1  0.1302     0.7775 0.956 0.000 0.000 0.044
#> GSM877136     1  0.0469     0.7807 0.988 0.000 0.000 0.012
#> GSM877137     1  0.0779     0.7807 0.980 0.004 0.000 0.016
#> GSM877139     1  0.0592     0.7804 0.984 0.000 0.000 0.016
#> GSM877149     1  0.1443     0.7767 0.960 0.008 0.004 0.028
#> GSM877154     2  0.7851     0.0998 0.348 0.444 0.008 0.200
#> GSM877157     1  0.0895     0.7799 0.976 0.000 0.004 0.020
#> GSM877160     1  0.0336     0.7804 0.992 0.000 0.000 0.008
#> GSM877161     1  0.0707     0.7796 0.980 0.000 0.000 0.020
#> GSM877163     1  0.0779     0.7805 0.980 0.000 0.004 0.016
#> GSM877166     1  0.0592     0.7797 0.984 0.000 0.000 0.016
#> GSM877167     2  0.7129     0.1343 0.424 0.460 0.004 0.112
#> GSM877175     1  0.0817     0.7801 0.976 0.000 0.000 0.024
#> GSM877177     1  0.0707     0.7796 0.980 0.000 0.000 0.020
#> GSM877184     1  0.1697     0.7671 0.952 0.028 0.004 0.016
#> GSM877187     1  0.4956     0.5772 0.780 0.140 0.004 0.076
#> GSM877188     1  0.0336     0.7806 0.992 0.000 0.000 0.008
#> GSM877150     1  0.0336     0.7804 0.992 0.000 0.000 0.008
#> GSM877165     2  0.0188     0.7269 0.000 0.996 0.000 0.004
#> GSM877183     1  0.4502     0.6552 0.808 0.012 0.036 0.144
#> GSM877178     3  0.5203     0.7670 0.008 0.000 0.576 0.416
#> GSM877182     2  0.5232     0.4901 0.340 0.644 0.004 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
#> GSM877144     4  0.0963     0.7320 0.036 0.000 0.000 0.964 0.000
#> GSM877128     3  0.3099     0.8206 0.124 0.000 0.848 0.028 0.000
#> GSM877164     3  0.0794     0.9244 0.028 0.000 0.972 0.000 0.000
#> GSM877162     4  0.3003     0.7420 0.000 0.188 0.000 0.812 0.000
#> GSM877127     1  0.4248     0.6779 0.784 0.000 0.024 0.032 0.160
#> GSM877138     1  0.3787     0.7562 0.844 0.004 0.028 0.068 0.056
#> GSM877140     1  0.6611    -0.0877 0.456 0.000 0.048 0.076 0.420
#> GSM877156     2  0.5449     0.5120 0.376 0.572 0.000 0.028 0.024
#> GSM877130     2  0.0000     0.6582 0.000 1.000 0.000 0.000 0.000
#> GSM877141     1  0.5689     0.0920 0.572 0.368 0.028 0.008 0.024
#> GSM877142     2  0.0000     0.6582 0.000 1.000 0.000 0.000 0.000
#> GSM877145     2  0.4607     0.5454 0.368 0.616 0.000 0.012 0.004
#> GSM877151     2  0.0609     0.6580 0.000 0.980 0.000 0.000 0.020
#> GSM877158     2  0.0794     0.6419 0.000 0.972 0.028 0.000 0.000
#> GSM877173     2  0.5207     0.4188 0.308 0.640 0.028 0.000 0.024
#> GSM877176     2  0.4403     0.5858 0.316 0.668 0.000 0.012 0.004
#> GSM877179     2  0.2142     0.6337 0.048 0.920 0.028 0.000 0.004
#> GSM877181     2  0.1074     0.6630 0.016 0.968 0.000 0.012 0.004
#> GSM877185     2  0.0740     0.6626 0.008 0.980 0.000 0.008 0.004
#> GSM877131     4  0.4909     0.4864 0.000 0.412 0.028 0.560 0.000
#> GSM877147     4  0.1281     0.7546 0.012 0.032 0.000 0.956 0.000
#> GSM877155     2  0.0000     0.6582 0.000 1.000 0.000 0.000 0.000
#> GSM877159     4  0.5661     0.6458 0.000 0.132 0.028 0.688 0.152
#> GSM877170     3  0.3383     0.8146 0.052 0.068 0.860 0.020 0.000
#> GSM877186     1  0.1892     0.7961 0.916 0.000 0.000 0.080 0.004
#> GSM877132     2  0.5444     0.5238 0.368 0.576 0.000 0.012 0.044
#> GSM877143     5  0.1525     0.7526 0.012 0.004 0.000 0.036 0.948
#> GSM877146     5  0.1630     0.7538 0.016 0.004 0.000 0.036 0.944
#> GSM877148     5  0.3990     0.4483 0.308 0.004 0.000 0.000 0.688
#> GSM877152     1  0.4639     0.3512 0.612 0.000 0.000 0.020 0.368
#> GSM877168     5  0.1522     0.7456 0.044 0.000 0.000 0.012 0.944
#> GSM877180     1  0.4582     0.2622 0.572 0.000 0.000 0.012 0.416
#> GSM877126     3  0.0162     0.9224 0.004 0.000 0.996 0.000 0.000
#> GSM877129     3  0.0000     0.9183 0.000 0.000 1.000 0.000 0.000
#> GSM877133     1  0.4240     0.4890 0.684 0.000 0.304 0.004 0.008
#> GSM877153     4  0.2389     0.7053 0.004 0.000 0.116 0.880 0.000
#> GSM877169     1  0.4029     0.4722 0.680 0.000 0.316 0.000 0.004
#> GSM877171     3  0.1410     0.9077 0.060 0.000 0.940 0.000 0.000
#> GSM877174     3  0.0794     0.9244 0.028 0.000 0.972 0.000 0.000
#> GSM877134     1  0.3145     0.7245 0.844 0.136 0.000 0.012 0.008
#> GSM877135     1  0.1522     0.8135 0.944 0.000 0.000 0.012 0.044
#> GSM877136     1  0.0162     0.8235 0.996 0.000 0.000 0.000 0.004
#> GSM877137     1  0.0290     0.8233 0.992 0.000 0.000 0.000 0.008
#> GSM877139     1  0.0290     0.8233 0.992 0.000 0.000 0.000 0.008
#> GSM877149     1  0.0932     0.8218 0.972 0.004 0.000 0.020 0.004
#> GSM877154     2  0.7304     0.0256 0.200 0.404 0.000 0.036 0.360
#> GSM877157     1  0.0865     0.8232 0.972 0.000 0.000 0.024 0.004
#> GSM877160     1  0.0486     0.8229 0.988 0.000 0.004 0.004 0.004
#> GSM877161     1  0.0771     0.8234 0.976 0.000 0.000 0.020 0.004
#> GSM877163     1  0.0324     0.8239 0.992 0.000 0.000 0.004 0.004
#> GSM877166     1  0.0609     0.8236 0.980 0.000 0.000 0.020 0.000
#> GSM877167     2  0.6181     0.3810 0.392 0.484 0.000 0.004 0.120
#> GSM877175     1  0.0771     0.8234 0.976 0.000 0.000 0.020 0.004
#> GSM877177     1  0.0898     0.8238 0.972 0.000 0.000 0.020 0.008
#> GSM877184     1  0.2116     0.7961 0.924 0.052 0.004 0.012 0.008
#> GSM877187     1  0.4828     0.6432 0.748 0.136 0.000 0.012 0.104
#> GSM877188     1  0.0290     0.8237 0.992 0.000 0.000 0.008 0.000
#> GSM877150     1  0.0324     0.8231 0.992 0.000 0.000 0.004 0.004
#> GSM877165     2  0.0451     0.6617 0.008 0.988 0.000 0.000 0.004
#> GSM877183     1  0.5833     0.6190 0.700 0.008 0.120 0.040 0.132
#> GSM877178     3  0.0162     0.9224 0.004 0.000 0.996 0.000 0.000
#> GSM877182     2  0.4607     0.5454 0.368 0.616 0.000 0.012 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
#> GSM877144     4  0.0000     0.6812 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877128     3  0.3133     0.7218 0.212 0.000 0.780 0.008 0.000 0.000
#> GSM877164     3  0.1141     0.8911 0.052 0.000 0.948 0.000 0.000 0.000
#> GSM877162     4  0.3426     0.6140 0.000 0.276 0.000 0.720 0.004 0.000
#> GSM877127     1  0.4417     0.5000 0.704 0.000 0.044 0.016 0.236 0.000
#> GSM877138     6  0.6086     0.3099 0.360 0.000 0.052 0.016 0.056 0.516
#> GSM877140     6  0.4435     0.6094 0.132 0.000 0.072 0.016 0.016 0.764
#> GSM877156     1  0.4615    -0.0327 0.512 0.460 0.000 0.016 0.008 0.004
#> GSM877130     2  0.0146     0.6383 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM877141     1  0.6426     0.1372 0.524 0.272 0.052 0.000 0.148 0.004
#> GSM877142     2  0.2520     0.5608 0.000 0.844 0.000 0.000 0.152 0.004
#> GSM877145     2  0.4257     0.0530 0.484 0.504 0.000 0.004 0.004 0.004
#> GSM877151     2  0.0777     0.6343 0.000 0.972 0.004 0.000 0.000 0.024
#> GSM877158     2  0.3647     0.5116 0.000 0.788 0.052 0.000 0.156 0.004
#> GSM877173     2  0.3460     0.5453 0.096 0.832 0.052 0.000 0.016 0.004
#> GSM877176     2  0.4257     0.0530 0.484 0.504 0.000 0.004 0.004 0.004
#> GSM877179     2  0.3858     0.5045 0.004 0.776 0.052 0.000 0.164 0.004
#> GSM877181     2  0.0837     0.6377 0.020 0.972 0.000 0.004 0.000 0.004
#> GSM877185     2  0.0260     0.6417 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM877131     4  0.5845     0.3767 0.000 0.412 0.052 0.480 0.052 0.004
#> GSM877147     4  0.0458     0.6863 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM877155     2  0.0935     0.6316 0.000 0.964 0.004 0.000 0.032 0.000
#> GSM877159     4  0.6094     0.3338 0.000 0.076 0.052 0.528 0.008 0.336
#> GSM877170     3  0.2594     0.8058 0.012 0.076 0.888 0.016 0.004 0.004
#> GSM877186     1  0.0865     0.7733 0.964 0.000 0.000 0.036 0.000 0.000
#> GSM877132     1  0.5063    -0.0894 0.484 0.456 0.000 0.004 0.004 0.052
#> GSM877143     6  0.0260     0.6291 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM877146     6  0.0260     0.6291 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM877148     5  0.3655     0.7764 0.096 0.000 0.000 0.000 0.792 0.112
#> GSM877152     5  0.2527     0.7597 0.168 0.000 0.000 0.000 0.832 0.000
#> GSM877168     5  0.2527     0.7027 0.000 0.000 0.000 0.000 0.832 0.168
#> GSM877180     5  0.2783     0.7840 0.148 0.000 0.000 0.000 0.836 0.016
#> GSM877126     3  0.0146     0.8875 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM877129     3  0.0000     0.8840 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877133     1  0.4181    -0.1355 0.512 0.000 0.476 0.000 0.012 0.000
#> GSM877153     4  0.0777     0.6772 0.004 0.000 0.024 0.972 0.000 0.000
#> GSM877169     1  0.3993    -0.1360 0.520 0.000 0.476 0.000 0.004 0.000
#> GSM877171     3  0.1957     0.8505 0.112 0.000 0.888 0.000 0.000 0.000
#> GSM877174     3  0.1141     0.8911 0.052 0.000 0.948 0.000 0.000 0.000
#> GSM877134     1  0.3229     0.6376 0.796 0.188 0.000 0.004 0.008 0.004
#> GSM877135     1  0.2377     0.7223 0.868 0.000 0.000 0.004 0.124 0.004
#> GSM877136     1  0.0146     0.7864 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM877137     1  0.0363     0.7854 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM877139     1  0.0508     0.7859 0.984 0.004 0.000 0.000 0.012 0.000
#> GSM877149     1  0.0582     0.7848 0.984 0.004 0.000 0.004 0.004 0.004
#> GSM877154     5  0.3209     0.6779 0.012 0.156 0.000 0.016 0.816 0.000
#> GSM877157     1  0.0696     0.7845 0.980 0.004 0.000 0.004 0.008 0.004
#> GSM877160     1  0.0291     0.7852 0.992 0.000 0.004 0.000 0.004 0.000
#> GSM877161     1  0.0000     0.7868 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.0436     0.7871 0.988 0.000 0.000 0.004 0.004 0.004
#> GSM877166     1  0.0291     0.7871 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM877167     2  0.6164     0.1586 0.356 0.424 0.000 0.004 0.212 0.004
#> GSM877175     1  0.0000     0.7868 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.0260     0.7867 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM877184     1  0.2975     0.6804 0.832 0.148 0.000 0.004 0.012 0.004
#> GSM877187     1  0.4453     0.5854 0.732 0.184 0.000 0.004 0.012 0.068
#> GSM877188     1  0.0146     0.7864 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM877150     1  0.0146     0.7864 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM877165     2  0.0260     0.6417 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM877183     1  0.5894     0.4250 0.616 0.004 0.160 0.024 0.188 0.008
#> GSM877178     3  0.0260     0.8897 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM877182     2  0.4257     0.0530 0.484 0.504 0.000 0.004 0.004 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) genotype/variation(p) other(p) k
#> CV:pam 57           0.7282                 0.651 7.18e-07 2
#> CV:pam 57           0.0511                 0.806 3.93e-10 3
#> CV:pam 43           0.0365                 0.864 1.25e-08 4
#> CV:pam 51           0.3669                 0.895 1.22e-17 5
#> CV:pam 48           0.3479                 0.166 2.71e-18 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 62 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.861           0.927       0.966         0.4775 0.526   0.526
#> 3 3 0.537           0.824       0.769         0.2515 0.777   0.585
#> 4 4 0.563           0.548       0.704         0.0848 0.707   0.452
#> 5 5 0.771           0.717       0.888         0.1703 0.696   0.379
#> 6 6 0.780           0.746       0.862         0.0463 0.951   0.793

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
#> GSM877144     1   0.000      0.962 1.000 0.000
#> GSM877128     1   0.000      0.962 1.000 0.000
#> GSM877164     1   0.000      0.962 1.000 0.000
#> GSM877162     1   0.000      0.962 1.000 0.000
#> GSM877127     1   0.814      0.679 0.748 0.252
#> GSM877138     1   0.913      0.534 0.672 0.328
#> GSM877140     1   0.000      0.962 1.000 0.000
#> GSM877156     2   0.000      0.963 0.000 1.000
#> GSM877130     2   0.722      0.767 0.200 0.800
#> GSM877141     1   0.000      0.962 1.000 0.000
#> GSM877142     1   0.204      0.938 0.968 0.032
#> GSM877145     2   0.000      0.963 0.000 1.000
#> GSM877151     2   0.494      0.871 0.108 0.892
#> GSM877158     1   0.000      0.962 1.000 0.000
#> GSM877173     2   0.821      0.678 0.256 0.744
#> GSM877176     2   0.343      0.918 0.064 0.936
#> GSM877179     1   0.000      0.962 1.000 0.000
#> GSM877181     2   0.000      0.963 0.000 1.000
#> GSM877185     2   0.000      0.963 0.000 1.000
#> GSM877131     1   0.000      0.962 1.000 0.000
#> GSM877147     1   0.000      0.962 1.000 0.000
#> GSM877155     1   0.184      0.942 0.972 0.028
#> GSM877159     1   0.000      0.962 1.000 0.000
#> GSM877170     1   0.000      0.962 1.000 0.000
#> GSM877186     2   0.753      0.739 0.216 0.784
#> GSM877132     2   0.000      0.963 0.000 1.000
#> GSM877143     2   0.000      0.963 0.000 1.000
#> GSM877146     2   0.000      0.963 0.000 1.000
#> GSM877148     2   0.000      0.963 0.000 1.000
#> GSM877152     2   0.000      0.963 0.000 1.000
#> GSM877168     2   0.000      0.963 0.000 1.000
#> GSM877180     2   0.000      0.963 0.000 1.000
#> GSM877126     1   0.000      0.962 1.000 0.000
#> GSM877129     1   0.000      0.962 1.000 0.000
#> GSM877133     2   0.295      0.925 0.052 0.948
#> GSM877153     1   0.000      0.962 1.000 0.000
#> GSM877169     2   0.802      0.679 0.244 0.756
#> GSM877171     1   0.000      0.962 1.000 0.000
#> GSM877174     1   0.000      0.962 1.000 0.000
#> GSM877134     2   0.000      0.963 0.000 1.000
#> GSM877135     2   0.000      0.963 0.000 1.000
#> GSM877136     2   0.000      0.963 0.000 1.000
#> GSM877137     2   0.000      0.963 0.000 1.000
#> GSM877139     2   0.000      0.963 0.000 1.000
#> GSM877149     2   0.000      0.963 0.000 1.000
#> GSM877154     2   0.000      0.963 0.000 1.000
#> GSM877157     2   0.000      0.963 0.000 1.000
#> GSM877160     2   0.000      0.963 0.000 1.000
#> GSM877161     2   0.000      0.963 0.000 1.000
#> GSM877163     2   0.456      0.889 0.096 0.904
#> GSM877166     2   0.000      0.963 0.000 1.000
#> GSM877167     2   0.000      0.963 0.000 1.000
#> GSM877175     2   0.000      0.963 0.000 1.000
#> GSM877177     2   0.000      0.963 0.000 1.000
#> GSM877184     2   0.000      0.963 0.000 1.000
#> GSM877187     2   0.000      0.963 0.000 1.000
#> GSM877188     2   0.000      0.963 0.000 1.000
#> GSM877150     2   0.000      0.963 0.000 1.000
#> GSM877165     2   0.000      0.963 0.000 1.000
#> GSM877183     1   0.644      0.801 0.836 0.164
#> GSM877178     1   0.000      0.962 1.000 0.000
#> GSM877182     2   0.443      0.895 0.092 0.908

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.5560      0.793 0.300 0.000 0.700
#> GSM877128     3  0.4095      0.842 0.056 0.064 0.880
#> GSM877164     3  0.1643      0.852 0.044 0.000 0.956
#> GSM877162     3  0.5560      0.793 0.300 0.000 0.700
#> GSM877127     3  0.5826      0.696 0.032 0.204 0.764
#> GSM877138     3  0.5656      0.612 0.008 0.264 0.728
#> GSM877140     3  0.5505      0.822 0.088 0.096 0.816
#> GSM877156     2  0.0237      0.835 0.000 0.996 0.004
#> GSM877130     2  0.6298      0.374 0.004 0.608 0.388
#> GSM877141     3  0.1289      0.846 0.032 0.000 0.968
#> GSM877142     3  0.5467      0.745 0.032 0.176 0.792
#> GSM877145     2  0.0747      0.828 0.000 0.984 0.016
#> GSM877151     2  0.7559      0.449 0.056 0.608 0.336
#> GSM877158     3  0.1289      0.846 0.032 0.000 0.968
#> GSM877173     2  0.6252      0.260 0.000 0.556 0.444
#> GSM877176     2  0.5291      0.578 0.000 0.732 0.268
#> GSM877179     3  0.1529      0.848 0.040 0.000 0.960
#> GSM877181     2  0.2703      0.795 0.056 0.928 0.016
#> GSM877185     2  0.2173      0.804 0.008 0.944 0.048
#> GSM877131     3  0.3816      0.842 0.148 0.000 0.852
#> GSM877147     3  0.5560      0.793 0.300 0.000 0.700
#> GSM877155     3  0.4865      0.786 0.032 0.136 0.832
#> GSM877159     3  0.5560      0.793 0.300 0.000 0.700
#> GSM877170     3  0.1163      0.847 0.028 0.000 0.972
#> GSM877186     1  0.7114      0.939 0.584 0.388 0.028
#> GSM877132     2  0.0000      0.835 0.000 1.000 0.000
#> GSM877143     2  0.0000      0.835 0.000 1.000 0.000
#> GSM877146     2  0.0000      0.835 0.000 1.000 0.000
#> GSM877148     2  0.0000      0.835 0.000 1.000 0.000
#> GSM877152     2  0.0237      0.832 0.004 0.996 0.000
#> GSM877168     2  0.0000      0.835 0.000 1.000 0.000
#> GSM877180     2  0.0000      0.835 0.000 1.000 0.000
#> GSM877126     3  0.2356      0.851 0.072 0.000 0.928
#> GSM877129     3  0.1643      0.852 0.044 0.000 0.956
#> GSM877133     1  0.6881      0.950 0.592 0.388 0.020
#> GSM877153     3  0.5560      0.793 0.300 0.000 0.700
#> GSM877169     1  0.9353      0.663 0.444 0.388 0.168
#> GSM877171     3  0.1289      0.846 0.032 0.000 0.968
#> GSM877174     3  0.0237      0.850 0.004 0.000 0.996
#> GSM877134     1  0.6192      0.934 0.580 0.420 0.000
#> GSM877135     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877136     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877137     1  0.6298      0.968 0.608 0.388 0.004
#> GSM877139     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877149     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877154     2  0.0237      0.832 0.004 0.996 0.000
#> GSM877157     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877160     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877161     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877163     1  0.7295      0.930 0.584 0.380 0.036
#> GSM877166     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877167     2  0.0000      0.835 0.000 1.000 0.000
#> GSM877175     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877177     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877184     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877187     2  0.0000      0.835 0.000 1.000 0.000
#> GSM877188     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877150     1  0.6079      0.972 0.612 0.388 0.000
#> GSM877165     2  0.3692      0.780 0.056 0.896 0.048
#> GSM877183     3  0.4782      0.762 0.016 0.164 0.820
#> GSM877178     3  0.1643      0.852 0.044 0.000 0.956
#> GSM877182     3  0.5859      0.434 0.000 0.344 0.656

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3 p4
#> GSM877144     3  0.0188     1.0000 0.000 0.004 0.996 NA
#> GSM877128     2  0.8028     0.1868 0.100 0.476 0.368 NA
#> GSM877164     2  0.7894     0.2023 0.000 0.364 0.344 NA
#> GSM877162     3  0.0188     1.0000 0.000 0.004 0.996 NA
#> GSM877127     2  0.7456     0.1984 0.200 0.492 0.308 NA
#> GSM877138     2  0.7456     0.1985 0.200 0.492 0.308 NA
#> GSM877140     2  0.7218     0.1316 0.140 0.444 0.416 NA
#> GSM877156     1  0.5432     0.7133 0.652 0.032 0.000 NA
#> GSM877130     2  0.6450     0.2233 0.052 0.572 0.012 NA
#> GSM877141     2  0.6903     0.1659 0.000 0.592 0.224 NA
#> GSM877142     2  0.5159     0.2302 0.000 0.624 0.012 NA
#> GSM877145     1  0.7408     0.6178 0.556 0.196 0.008 NA
#> GSM877151     2  0.5728     0.2289 0.036 0.600 0.000 NA
#> GSM877158     2  0.5174     0.2304 0.000 0.620 0.012 NA
#> GSM877173     2  0.5372    -0.3444 0.444 0.544 0.012 NA
#> GSM877176     1  0.7707     0.3852 0.428 0.408 0.012 NA
#> GSM877179     2  0.5408     0.2062 0.000 0.500 0.012 NA
#> GSM877181     1  0.5281     0.4619 0.528 0.464 0.000 NA
#> GSM877185     1  0.5277     0.4591 0.532 0.460 0.008 NA
#> GSM877131     2  0.4977     0.0634 0.000 0.540 0.460 NA
#> GSM877147     3  0.0188     1.0000 0.000 0.004 0.996 NA
#> GSM877155     2  0.5159     0.2302 0.000 0.624 0.012 NA
#> GSM877159     3  0.0188     1.0000 0.000 0.004 0.996 NA
#> GSM877170     2  0.6911     0.2009 0.000 0.540 0.336 NA
#> GSM877186     1  0.0188     0.7960 0.996 0.000 0.004 NA
#> GSM877132     1  0.6454     0.6589 0.572 0.084 0.000 NA
#> GSM877143     1  0.5807     0.6905 0.612 0.044 0.000 NA
#> GSM877146     1  0.6091     0.6788 0.596 0.060 0.000 NA
#> GSM877148     1  0.5018     0.7142 0.656 0.012 0.000 NA
#> GSM877152     1  0.4624     0.7145 0.660 0.000 0.000 NA
#> GSM877168     1  0.4955     0.7097 0.648 0.008 0.000 NA
#> GSM877180     1  0.4643     0.7129 0.656 0.000 0.000 NA
#> GSM877126     2  0.7892     0.2029 0.000 0.368 0.340 NA
#> GSM877129     2  0.7892     0.2029 0.000 0.368 0.340 NA
#> GSM877133     1  0.0469     0.7894 0.988 0.012 0.000 NA
#> GSM877153     3  0.0188     1.0000 0.000 0.004 0.996 NA
#> GSM877169     1  0.2469     0.6980 0.892 0.108 0.000 NA
#> GSM877171     2  0.7880     0.2031 0.000 0.372 0.344 NA
#> GSM877174     2  0.7894     0.2023 0.000 0.364 0.344 NA
#> GSM877134     1  0.0469     0.7955 0.988 0.000 0.000 NA
#> GSM877135     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877136     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877137     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877139     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877149     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877154     1  0.4454     0.7250 0.692 0.000 0.000 NA
#> GSM877157     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877160     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877161     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877163     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877166     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877167     1  0.5632     0.6979 0.624 0.036 0.000 NA
#> GSM877175     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877177     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877184     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877187     1  0.4624     0.7145 0.660 0.000 0.000 NA
#> GSM877188     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877150     1  0.0000     0.7972 1.000 0.000 0.000 NA
#> GSM877165     1  0.4989     0.4559 0.528 0.472 0.000 NA
#> GSM877183     2  0.7501     0.2028 0.172 0.492 0.332 NA
#> GSM877178     2  0.7894     0.2023 0.000 0.364 0.344 NA
#> GSM877182     1  0.6911     0.2793 0.540 0.124 0.336 NA

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0000     0.9127 0.000 0.000 0.000 1.000 0.000
#> GSM877128     3  0.4182     0.3781 0.352 0.000 0.644 0.004 0.000
#> GSM877164     3  0.0000     0.9061 0.000 0.000 1.000 0.000 0.000
#> GSM877162     4  0.0000     0.9127 0.000 0.000 0.000 1.000 0.000
#> GSM877127     1  0.7810     0.1232 0.432 0.000 0.084 0.232 0.252
#> GSM877138     5  0.6827     0.2435 0.384 0.000 0.084 0.060 0.472
#> GSM877140     4  0.5091     0.5020 0.244 0.000 0.084 0.672 0.000
#> GSM877156     5  0.1117     0.7730 0.016 0.020 0.000 0.000 0.964
#> GSM877130     2  0.0290     0.7236 0.000 0.992 0.000 0.000 0.008
#> GSM877141     2  0.5756     0.1760 0.004 0.512 0.076 0.000 0.408
#> GSM877142     2  0.0000     0.7207 0.000 1.000 0.000 0.000 0.000
#> GSM877145     5  0.2966     0.6170 0.000 0.184 0.000 0.000 0.816
#> GSM877151     2  0.2471     0.7131 0.000 0.864 0.000 0.000 0.136
#> GSM877158     2  0.0000     0.7207 0.000 1.000 0.000 0.000 0.000
#> GSM877173     2  0.4306     0.0463 0.000 0.508 0.000 0.000 0.492
#> GSM877176     5  0.3884     0.4456 0.004 0.288 0.000 0.000 0.708
#> GSM877179     2  0.0000     0.7207 0.000 1.000 0.000 0.000 0.000
#> GSM877181     5  0.3949     0.3497 0.000 0.332 0.000 0.000 0.668
#> GSM877185     2  0.3521     0.6499 0.004 0.764 0.000 0.000 0.232
#> GSM877131     2  0.3422     0.5851 0.000 0.792 0.004 0.200 0.004
#> GSM877147     4  0.0000     0.9127 0.000 0.000 0.000 1.000 0.000
#> GSM877155     2  0.0671     0.7248 0.004 0.980 0.000 0.000 0.016
#> GSM877159     4  0.0000     0.9127 0.000 0.000 0.000 1.000 0.000
#> GSM877170     2  0.5866     0.1184 0.004 0.488 0.084 0.000 0.424
#> GSM877186     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877132     5  0.0000     0.7827 0.000 0.000 0.000 0.000 1.000
#> GSM877143     5  0.0000     0.7827 0.000 0.000 0.000 0.000 1.000
#> GSM877146     5  0.0000     0.7827 0.000 0.000 0.000 0.000 1.000
#> GSM877148     5  0.0162     0.7837 0.004 0.000 0.000 0.000 0.996
#> GSM877152     5  0.0162     0.7837 0.004 0.000 0.000 0.000 0.996
#> GSM877168     5  0.0000     0.7827 0.000 0.000 0.000 0.000 1.000
#> GSM877180     5  0.0000     0.7827 0.000 0.000 0.000 0.000 1.000
#> GSM877126     3  0.0162     0.9032 0.000 0.000 0.996 0.004 0.000
#> GSM877129     3  0.0000     0.9061 0.000 0.000 1.000 0.000 0.000
#> GSM877133     1  0.0510     0.9081 0.984 0.000 0.016 0.000 0.000
#> GSM877153     4  0.0000     0.9127 0.000 0.000 0.000 1.000 0.000
#> GSM877169     1  0.0703     0.9008 0.976 0.000 0.024 0.000 0.000
#> GSM877171     3  0.0000     0.9061 0.000 0.000 1.000 0.000 0.000
#> GSM877174     3  0.0000     0.9061 0.000 0.000 1.000 0.000 0.000
#> GSM877134     5  0.4425     0.2210 0.452 0.004 0.000 0.000 0.544
#> GSM877135     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877136     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.3231     0.6872 0.800 0.004 0.000 0.000 0.196
#> GSM877139     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877149     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877154     5  0.1410     0.7567 0.060 0.000 0.000 0.000 0.940
#> GSM877157     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877160     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.0162     0.9163 0.996 0.004 0.000 0.000 0.000
#> GSM877166     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.0162     0.7837 0.004 0.000 0.000 0.000 0.996
#> GSM877175     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877184     1  0.4161     0.2194 0.608 0.000 0.000 0.000 0.392
#> GSM877187     5  0.0162     0.7837 0.004 0.000 0.000 0.000 0.996
#> GSM877188     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.9202 1.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.3508     0.6315 0.000 0.748 0.000 0.000 0.252
#> GSM877183     5  0.6769     0.2600 0.380 0.000 0.084 0.056 0.480
#> GSM877178     3  0.0000     0.9061 0.000 0.000 1.000 0.000 0.000
#> GSM877182     5  0.5241     0.5951 0.188 0.056 0.000 0.040 0.716

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0000      0.997 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877128     3  0.4488      0.501 0.052 0.000 0.664 0.004 0.000 0.280
#> GSM877164     3  0.0000      0.922 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877162     4  0.0000      0.997 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877127     6  0.6779      0.716 0.132 0.000 0.052 0.140 0.084 0.592
#> GSM877138     6  0.6205      0.754 0.112 0.000 0.044 0.024 0.220 0.600
#> GSM877140     6  0.6335      0.408 0.096 0.000 0.052 0.356 0.008 0.488
#> GSM877156     5  0.1313      0.823 0.016 0.028 0.000 0.000 0.952 0.004
#> GSM877130     2  0.0405      0.756 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM877141     2  0.5730      0.570 0.000 0.616 0.036 0.000 0.172 0.176
#> GSM877142     2  0.0622      0.755 0.000 0.980 0.000 0.000 0.008 0.012
#> GSM877145     5  0.3594      0.626 0.020 0.204 0.000 0.000 0.768 0.008
#> GSM877151     2  0.1765      0.742 0.000 0.904 0.000 0.000 0.096 0.000
#> GSM877158     2  0.1643      0.744 0.000 0.924 0.000 0.000 0.008 0.068
#> GSM877173     2  0.4799      0.476 0.000 0.592 0.000 0.000 0.340 0.068
#> GSM877176     5  0.3852      0.258 0.000 0.384 0.000 0.000 0.612 0.004
#> GSM877179     2  0.1812      0.742 0.000 0.912 0.000 0.000 0.008 0.080
#> GSM877181     5  0.4097     -0.142 0.000 0.492 0.000 0.000 0.500 0.008
#> GSM877185     2  0.3575      0.592 0.000 0.708 0.000 0.000 0.284 0.008
#> GSM877131     2  0.5150      0.591 0.000 0.680 0.020 0.176 0.004 0.120
#> GSM877147     4  0.0000      0.997 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877155     2  0.0508      0.757 0.000 0.984 0.000 0.000 0.012 0.004
#> GSM877159     4  0.0363      0.986 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM877170     2  0.5963      0.552 0.000 0.596 0.048 0.000 0.172 0.184
#> GSM877186     1  0.1714      0.828 0.908 0.000 0.000 0.000 0.000 0.092
#> GSM877132     5  0.0779      0.831 0.008 0.008 0.000 0.000 0.976 0.008
#> GSM877143     5  0.0520      0.833 0.008 0.000 0.000 0.000 0.984 0.008
#> GSM877146     5  0.0520      0.833 0.008 0.000 0.000 0.000 0.984 0.008
#> GSM877148     5  0.0653      0.833 0.012 0.004 0.000 0.000 0.980 0.004
#> GSM877152     5  0.0692      0.830 0.020 0.000 0.000 0.000 0.976 0.004
#> GSM877168     5  0.0405      0.834 0.008 0.000 0.000 0.000 0.988 0.004
#> GSM877180     5  0.0520      0.833 0.008 0.000 0.000 0.000 0.984 0.008
#> GSM877126     3  0.1411      0.887 0.000 0.000 0.936 0.000 0.004 0.060
#> GSM877129     3  0.0405      0.915 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM877133     1  0.1367      0.856 0.944 0.000 0.044 0.000 0.000 0.012
#> GSM877153     4  0.0000      0.997 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877169     1  0.1633      0.856 0.932 0.000 0.044 0.000 0.000 0.024
#> GSM877171     3  0.0260      0.919 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM877174     3  0.0146      0.921 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM877134     1  0.4025      0.233 0.576 0.008 0.000 0.000 0.416 0.000
#> GSM877135     1  0.0508      0.874 0.984 0.000 0.012 0.000 0.000 0.004
#> GSM877136     1  0.2300      0.829 0.856 0.000 0.000 0.000 0.000 0.144
#> GSM877137     1  0.2883      0.634 0.788 0.000 0.000 0.000 0.212 0.000
#> GSM877139     1  0.0000      0.874 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877149     1  0.0146      0.874 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM877154     5  0.1003      0.827 0.020 0.000 0.000 0.000 0.964 0.016
#> GSM877157     1  0.0551      0.873 0.984 0.008 0.000 0.000 0.004 0.004
#> GSM877160     1  0.0909      0.873 0.968 0.000 0.012 0.000 0.000 0.020
#> GSM877161     1  0.2003      0.844 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM877163     1  0.0000      0.874 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877166     1  0.1967      0.855 0.904 0.000 0.012 0.000 0.000 0.084
#> GSM877167     5  0.0779      0.831 0.008 0.008 0.000 0.000 0.976 0.008
#> GSM877175     1  0.1686      0.865 0.924 0.000 0.012 0.000 0.000 0.064
#> GSM877177     1  0.0000      0.874 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877184     1  0.3595      0.495 0.704 0.008 0.000 0.000 0.288 0.000
#> GSM877187     5  0.0622      0.833 0.012 0.000 0.000 0.000 0.980 0.008
#> GSM877188     1  0.2019      0.854 0.900 0.000 0.012 0.000 0.000 0.088
#> GSM877150     1  0.2165      0.847 0.884 0.000 0.008 0.000 0.000 0.108
#> GSM877165     2  0.3634      0.573 0.000 0.696 0.000 0.000 0.296 0.008
#> GSM877183     6  0.5991      0.743 0.112 0.000 0.044 0.012 0.224 0.608
#> GSM877178     3  0.0000      0.922 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877182     5  0.6204     -0.191 0.096 0.056 0.000 0.000 0.456 0.392

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-mclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) genotype/variation(p) other(p) k
#> CV:mclust 62           0.1582                0.0919 8.91e-07 2
#> CV:mclust 58           0.4583                0.1948 3.25e-11 3
#> CV:mclust 36           0.2896                0.2970 1.24e-04 4
#> CV:mclust 51           0.0596                0.1437 1.91e-14 5
#> CV:mclust 55           0.0410                0.0161 1.10e-16 6

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


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

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.933           0.963       0.982         0.5075 0.492   0.492
#> 3 3 0.745           0.876       0.941         0.2933 0.801   0.617
#> 4 4 0.805           0.822       0.922         0.1118 0.813   0.533
#> 5 5 0.745           0.777       0.880         0.0876 0.840   0.498
#> 6 6 0.722           0.648       0.810         0.0445 0.923   0.668

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
#> GSM877144     2  0.0000      0.975 0.000 1.000
#> GSM877128     1  0.0000      0.988 1.000 0.000
#> GSM877164     1  0.0000      0.988 1.000 0.000
#> GSM877162     2  0.0000      0.975 0.000 1.000
#> GSM877127     1  0.0000      0.988 1.000 0.000
#> GSM877138     2  0.8443      0.644 0.272 0.728
#> GSM877140     1  0.0000      0.988 1.000 0.000
#> GSM877156     2  0.0000      0.975 0.000 1.000
#> GSM877130     2  0.0000      0.975 0.000 1.000
#> GSM877141     2  0.6887      0.791 0.184 0.816
#> GSM877142     2  0.0000      0.975 0.000 1.000
#> GSM877145     2  0.0376      0.973 0.004 0.996
#> GSM877151     2  0.0000      0.975 0.000 1.000
#> GSM877158     2  0.0000      0.975 0.000 1.000
#> GSM877173     2  0.0000      0.975 0.000 1.000
#> GSM877176     2  0.0000      0.975 0.000 1.000
#> GSM877179     2  0.0000      0.975 0.000 1.000
#> GSM877181     2  0.0000      0.975 0.000 1.000
#> GSM877185     2  0.0000      0.975 0.000 1.000
#> GSM877131     2  0.0000      0.975 0.000 1.000
#> GSM877147     2  0.0000      0.975 0.000 1.000
#> GSM877155     2  0.0000      0.975 0.000 1.000
#> GSM877159     2  0.0000      0.975 0.000 1.000
#> GSM877170     2  0.3114      0.933 0.056 0.944
#> GSM877186     1  0.0000      0.988 1.000 0.000
#> GSM877132     2  0.0000      0.975 0.000 1.000
#> GSM877143     2  0.0000      0.975 0.000 1.000
#> GSM877146     2  0.0000      0.975 0.000 1.000
#> GSM877148     2  0.0000      0.975 0.000 1.000
#> GSM877152     2  0.5519      0.861 0.128 0.872
#> GSM877168     2  0.0000      0.975 0.000 1.000
#> GSM877180     2  0.0000      0.975 0.000 1.000
#> GSM877126     1  0.0000      0.988 1.000 0.000
#> GSM877129     1  0.0000      0.988 1.000 0.000
#> GSM877133     1  0.0000      0.988 1.000 0.000
#> GSM877153     1  0.0000      0.988 1.000 0.000
#> GSM877169     1  0.0000      0.988 1.000 0.000
#> GSM877171     1  0.0000      0.988 1.000 0.000
#> GSM877174     1  0.0000      0.988 1.000 0.000
#> GSM877134     1  0.6048      0.824 0.852 0.148
#> GSM877135     1  0.0000      0.988 1.000 0.000
#> GSM877136     1  0.0000      0.988 1.000 0.000
#> GSM877137     1  0.0000      0.988 1.000 0.000
#> GSM877139     1  0.0000      0.988 1.000 0.000
#> GSM877149     1  0.0000      0.988 1.000 0.000
#> GSM877154     2  0.4690      0.891 0.100 0.900
#> GSM877157     1  0.0000      0.988 1.000 0.000
#> GSM877160     1  0.0000      0.988 1.000 0.000
#> GSM877161     1  0.0000      0.988 1.000 0.000
#> GSM877163     1  0.0000      0.988 1.000 0.000
#> GSM877166     1  0.0000      0.988 1.000 0.000
#> GSM877167     2  0.0000      0.975 0.000 1.000
#> GSM877175     1  0.0000      0.988 1.000 0.000
#> GSM877177     1  0.0000      0.988 1.000 0.000
#> GSM877184     1  0.0000      0.988 1.000 0.000
#> GSM877187     2  0.0376      0.973 0.004 0.996
#> GSM877188     1  0.0000      0.988 1.000 0.000
#> GSM877150     1  0.0000      0.988 1.000 0.000
#> GSM877165     2  0.0000      0.975 0.000 1.000
#> GSM877183     1  0.6801      0.773 0.820 0.180
#> GSM877178     1  0.0000      0.988 1.000 0.000
#> GSM877182     2  0.0938      0.968 0.012 0.988

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.5706      0.524 0.000 0.320 0.680
#> GSM877128     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877164     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877162     2  0.3619      0.800 0.000 0.864 0.136
#> GSM877127     3  0.0747      0.943 0.016 0.000 0.984
#> GSM877138     2  0.5698      0.645 0.012 0.736 0.252
#> GSM877140     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877156     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877130     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877141     3  0.4235      0.754 0.000 0.176 0.824
#> GSM877142     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877145     2  0.0892      0.885 0.020 0.980 0.000
#> GSM877151     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877158     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877173     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877176     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877179     2  0.3412      0.823 0.000 0.876 0.124
#> GSM877181     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877185     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877131     2  0.3551      0.815 0.000 0.868 0.132
#> GSM877147     2  0.2959      0.831 0.000 0.900 0.100
#> GSM877155     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877159     2  0.6192      0.262 0.000 0.580 0.420
#> GSM877170     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877186     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877132     2  0.2878      0.855 0.096 0.904 0.000
#> GSM877143     2  0.1163      0.883 0.028 0.972 0.000
#> GSM877146     2  0.1163      0.883 0.028 0.972 0.000
#> GSM877148     2  0.4452      0.775 0.192 0.808 0.000
#> GSM877152     1  0.5327      0.577 0.728 0.272 0.000
#> GSM877168     2  0.4504      0.770 0.196 0.804 0.000
#> GSM877180     2  0.6192      0.349 0.420 0.580 0.000
#> GSM877126     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877129     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877133     1  0.1031      0.955 0.976 0.000 0.024
#> GSM877153     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877169     1  0.3551      0.840 0.868 0.000 0.132
#> GSM877171     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877174     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877134     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877135     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877136     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877137     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877139     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877149     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877154     2  0.4842      0.736 0.224 0.776 0.000
#> GSM877157     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877160     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877161     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877163     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877166     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877167     2  0.3752      0.820 0.144 0.856 0.000
#> GSM877175     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877177     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877184     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877187     2  0.4121      0.807 0.168 0.832 0.000
#> GSM877188     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877150     1  0.0000      0.975 1.000 0.000 0.000
#> GSM877165     2  0.0000      0.889 0.000 1.000 0.000
#> GSM877183     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877178     3  0.0000      0.957 0.000 0.000 1.000
#> GSM877182     2  0.0000      0.889 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     4  0.0000     0.8831 0.000 0.000 0.000 1.000
#> GSM877128     3  0.0000     0.8984 0.000 0.000 1.000 0.000
#> GSM877164     3  0.0000     0.8984 0.000 0.000 1.000 0.000
#> GSM877162     4  0.0000     0.8831 0.000 0.000 0.000 1.000
#> GSM877127     4  0.0000     0.8831 0.000 0.000 0.000 1.000
#> GSM877138     4  0.1733     0.8559 0.028 0.024 0.000 0.948
#> GSM877140     4  0.1557     0.8559 0.000 0.000 0.056 0.944
#> GSM877156     2  0.3649     0.7268 0.000 0.796 0.000 0.204
#> GSM877130     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877141     3  0.2281     0.8267 0.000 0.096 0.904 0.000
#> GSM877142     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877145     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877151     2  0.0188     0.8760 0.000 0.996 0.000 0.004
#> GSM877158     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877173     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877176     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877179     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877181     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877185     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877131     4  0.4866     0.1954 0.000 0.404 0.000 0.596
#> GSM877147     4  0.0000     0.8831 0.000 0.000 0.000 1.000
#> GSM877155     2  0.2868     0.7909 0.000 0.864 0.000 0.136
#> GSM877159     4  0.0000     0.8831 0.000 0.000 0.000 1.000
#> GSM877170     3  0.2011     0.8480 0.000 0.080 0.920 0.000
#> GSM877186     1  0.0188     0.9383 0.996 0.000 0.000 0.004
#> GSM877132     2  0.1792     0.8422 0.068 0.932 0.000 0.000
#> GSM877143     2  0.5764     0.5714 0.304 0.644 0.000 0.052
#> GSM877146     2  0.5492     0.5403 0.328 0.640 0.000 0.032
#> GSM877148     2  0.6423     0.6068 0.196 0.648 0.000 0.156
#> GSM877152     1  0.2124     0.8783 0.924 0.068 0.000 0.008
#> GSM877168     2  0.6613     0.5722 0.172 0.628 0.000 0.200
#> GSM877180     1  0.5272     0.6888 0.752 0.136 0.000 0.112
#> GSM877126     3  0.0000     0.8984 0.000 0.000 1.000 0.000
#> GSM877129     3  0.0000     0.8984 0.000 0.000 1.000 0.000
#> GSM877133     3  0.4746     0.4529 0.368 0.000 0.632 0.000
#> GSM877153     4  0.2011     0.8353 0.000 0.000 0.080 0.920
#> GSM877169     3  0.3907     0.6859 0.232 0.000 0.768 0.000
#> GSM877171     3  0.0000     0.8984 0.000 0.000 1.000 0.000
#> GSM877174     3  0.0000     0.8984 0.000 0.000 1.000 0.000
#> GSM877134     1  0.0469     0.9336 0.988 0.012 0.000 0.000
#> GSM877135     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877136     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877137     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877139     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877149     1  0.0524     0.9346 0.988 0.004 0.000 0.008
#> GSM877154     1  0.7883    -0.0918 0.376 0.288 0.000 0.336
#> GSM877157     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877160     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877163     1  0.1211     0.9097 0.960 0.000 0.040 0.000
#> GSM877166     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877167     2  0.3569     0.7475 0.196 0.804 0.000 0.000
#> GSM877175     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877177     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877184     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877187     1  0.2739     0.8680 0.904 0.060 0.000 0.036
#> GSM877188     1  0.0000     0.9400 1.000 0.000 0.000 0.000
#> GSM877150     1  0.0592     0.9296 0.984 0.000 0.016 0.000
#> GSM877165     2  0.0000     0.8776 0.000 1.000 0.000 0.000
#> GSM877183     4  0.4431     0.5348 0.000 0.000 0.304 0.696
#> GSM877178     3  0.0000     0.8984 0.000 0.000 1.000 0.000
#> GSM877182     2  0.0336     0.8741 0.000 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0000      0.890 0.000 0.000 0.000 1.000 0.000
#> GSM877128     3  0.2020      0.883 0.000 0.000 0.900 0.100 0.000
#> GSM877164     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM877162     4  0.0510      0.883 0.000 0.016 0.000 0.984 0.000
#> GSM877127     5  0.6393      0.377 0.000 0.008 0.292 0.164 0.536
#> GSM877138     5  0.2230      0.756 0.000 0.000 0.000 0.116 0.884
#> GSM877140     4  0.6128      0.459 0.000 0.000 0.252 0.560 0.188
#> GSM877156     5  0.4193      0.635 0.000 0.304 0.000 0.012 0.684
#> GSM877130     2  0.2773      0.855 0.000 0.836 0.000 0.000 0.164
#> GSM877141     3  0.1764      0.889 0.000 0.008 0.928 0.000 0.064
#> GSM877142     2  0.3336      0.806 0.000 0.772 0.000 0.000 0.228
#> GSM877145     2  0.0162      0.864 0.000 0.996 0.000 0.000 0.004
#> GSM877151     5  0.0510      0.781 0.000 0.016 0.000 0.000 0.984
#> GSM877158     2  0.2813      0.853 0.000 0.832 0.000 0.000 0.168
#> GSM877173     2  0.3731      0.847 0.000 0.800 0.040 0.000 0.160
#> GSM877176     2  0.0451      0.862 0.000 0.988 0.000 0.008 0.004
#> GSM877179     2  0.4021      0.835 0.000 0.780 0.052 0.000 0.168
#> GSM877181     2  0.0162      0.864 0.000 0.996 0.000 0.000 0.004
#> GSM877185     2  0.2648      0.859 0.000 0.848 0.000 0.000 0.152
#> GSM877131     5  0.3694      0.706 0.000 0.032 0.000 0.172 0.796
#> GSM877147     4  0.0162      0.890 0.000 0.004 0.000 0.996 0.000
#> GSM877155     5  0.2732      0.737 0.000 0.160 0.000 0.000 0.840
#> GSM877159     5  0.4291      0.267 0.000 0.000 0.000 0.464 0.536
#> GSM877170     2  0.3461      0.694 0.000 0.772 0.224 0.004 0.000
#> GSM877186     1  0.4297      0.130 0.528 0.000 0.000 0.472 0.000
#> GSM877132     2  0.1638      0.834 0.064 0.932 0.000 0.000 0.004
#> GSM877143     5  0.0566      0.786 0.012 0.004 0.000 0.000 0.984
#> GSM877146     5  0.0566      0.786 0.012 0.004 0.000 0.000 0.984
#> GSM877148     5  0.0727      0.787 0.012 0.004 0.000 0.004 0.980
#> GSM877152     5  0.2516      0.750 0.140 0.000 0.000 0.000 0.860
#> GSM877168     5  0.1082      0.789 0.028 0.000 0.000 0.008 0.964
#> GSM877180     5  0.1908      0.774 0.092 0.000 0.000 0.000 0.908
#> GSM877126     3  0.2338      0.870 0.000 0.004 0.884 0.112 0.000
#> GSM877129     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM877133     3  0.2491      0.862 0.068 0.000 0.896 0.000 0.036
#> GSM877153     4  0.0162      0.888 0.000 0.000 0.000 0.996 0.004
#> GSM877169     3  0.1197      0.914 0.048 0.000 0.952 0.000 0.000
#> GSM877171     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM877174     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM877134     1  0.3636      0.645 0.728 0.272 0.000 0.000 0.000
#> GSM877135     1  0.0510      0.866 0.984 0.000 0.000 0.000 0.016
#> GSM877136     1  0.0000      0.870 1.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.1544      0.832 0.932 0.000 0.000 0.000 0.068
#> GSM877139     1  0.0963      0.856 0.964 0.000 0.000 0.000 0.036
#> GSM877149     1  0.5263      0.607 0.680 0.176 0.000 0.144 0.000
#> GSM877154     5  0.6374      0.462 0.280 0.168 0.000 0.008 0.544
#> GSM877157     1  0.0609      0.865 0.980 0.020 0.000 0.000 0.000
#> GSM877160     1  0.0290      0.869 0.992 0.000 0.008 0.000 0.000
#> GSM877161     1  0.0000      0.870 1.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.4306      0.107 0.508 0.492 0.000 0.000 0.000
#> GSM877166     1  0.0000      0.870 1.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.3370      0.757 0.028 0.148 0.000 0.000 0.824
#> GSM877175     1  0.0162      0.870 0.996 0.004 0.000 0.000 0.000
#> GSM877177     1  0.1608      0.829 0.928 0.000 0.000 0.000 0.072
#> GSM877184     1  0.1608      0.835 0.928 0.072 0.000 0.000 0.000
#> GSM877187     5  0.3480      0.658 0.248 0.000 0.000 0.000 0.752
#> GSM877188     1  0.0000      0.870 1.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.0000      0.870 1.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.0324      0.863 0.000 0.992 0.000 0.004 0.004
#> GSM877183     5  0.5798      0.660 0.000 0.084 0.084 0.132 0.700
#> GSM877178     3  0.0000      0.942 0.000 0.000 1.000 0.000 0.000
#> GSM877182     2  0.1202      0.851 0.004 0.960 0.000 0.032 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
#> GSM877144     4  0.0713     0.7907 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM877128     3  0.2649     0.8617 0.000 0.004 0.876 0.068 0.000 0.052
#> GSM877164     3  0.0692     0.9127 0.000 0.000 0.976 0.004 0.000 0.020
#> GSM877162     4  0.1219     0.7885 0.000 0.000 0.000 0.948 0.004 0.048
#> GSM877127     5  0.5607     0.6169 0.000 0.000 0.144 0.048 0.644 0.164
#> GSM877138     5  0.2275     0.7178 0.000 0.008 0.000 0.008 0.888 0.096
#> GSM877140     4  0.6832     0.2331 0.000 0.008 0.056 0.400 0.380 0.156
#> GSM877156     6  0.3930     0.3810 0.000 0.012 0.000 0.028 0.216 0.744
#> GSM877130     2  0.0405     0.8430 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM877141     3  0.2980     0.7398 0.000 0.192 0.800 0.000 0.000 0.008
#> GSM877142     2  0.0458     0.8421 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM877145     6  0.3899     0.4323 0.008 0.364 0.000 0.000 0.000 0.628
#> GSM877151     5  0.3385     0.6749 0.000 0.180 0.000 0.000 0.788 0.032
#> GSM877158     2  0.0260     0.8447 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM877173     2  0.2039     0.7989 0.000 0.916 0.052 0.000 0.012 0.020
#> GSM877176     6  0.3679     0.5303 0.004 0.260 0.000 0.012 0.000 0.724
#> GSM877179     2  0.1757     0.7963 0.000 0.916 0.076 0.000 0.008 0.000
#> GSM877181     2  0.3860    -0.2591 0.000 0.528 0.000 0.000 0.000 0.472
#> GSM877185     2  0.0260     0.8447 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM877131     5  0.5343     0.1340 0.000 0.028 0.016 0.364 0.564 0.028
#> GSM877147     4  0.0713     0.7907 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM877155     5  0.5044     0.5028 0.000 0.096 0.000 0.000 0.584 0.320
#> GSM877159     4  0.4740     0.5240 0.000 0.008 0.000 0.644 0.288 0.060
#> GSM877170     6  0.6041     0.2191 0.000 0.252 0.360 0.000 0.000 0.388
#> GSM877186     1  0.4269     0.2799 0.568 0.000 0.000 0.412 0.000 0.020
#> GSM877132     6  0.5778     0.3411 0.184 0.352 0.000 0.000 0.000 0.464
#> GSM877143     5  0.2875     0.7145 0.060 0.024 0.000 0.000 0.872 0.044
#> GSM877146     5  0.3013     0.7108 0.064 0.028 0.000 0.000 0.864 0.044
#> GSM877148     5  0.1196     0.7533 0.000 0.008 0.000 0.000 0.952 0.040
#> GSM877152     5  0.2872     0.7365 0.024 0.000 0.000 0.000 0.836 0.140
#> GSM877168     5  0.1196     0.7536 0.000 0.008 0.000 0.000 0.952 0.040
#> GSM877180     5  0.1606     0.7548 0.008 0.004 0.000 0.000 0.932 0.056
#> GSM877126     3  0.3017     0.8406 0.000 0.000 0.844 0.072 0.000 0.084
#> GSM877129     3  0.0146     0.9150 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM877133     3  0.3434     0.8203 0.028 0.000 0.836 0.000 0.072 0.064
#> GSM877153     4  0.2291     0.7768 0.000 0.008 0.016 0.904 0.008 0.064
#> GSM877169     3  0.1434     0.9023 0.008 0.000 0.948 0.000 0.020 0.024
#> GSM877171     3  0.0458     0.9122 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM877174     3  0.0363     0.9154 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM877134     1  0.4316     0.5089 0.648 0.040 0.000 0.000 0.000 0.312
#> GSM877135     1  0.0909     0.8130 0.968 0.000 0.000 0.000 0.020 0.012
#> GSM877136     1  0.0291     0.8142 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM877137     1  0.3852     0.6778 0.764 0.000 0.020 0.000 0.192 0.024
#> GSM877139     1  0.2402     0.7497 0.856 0.000 0.000 0.000 0.140 0.004
#> GSM877149     6  0.4446     0.2109 0.348 0.000 0.000 0.040 0.000 0.612
#> GSM877154     6  0.3551     0.5117 0.040 0.000 0.000 0.012 0.144 0.804
#> GSM877157     1  0.3508     0.6137 0.704 0.000 0.000 0.000 0.004 0.292
#> GSM877160     1  0.1767     0.8109 0.932 0.000 0.036 0.000 0.020 0.012
#> GSM877161     1  0.0291     0.8142 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM877163     1  0.4745     0.6413 0.712 0.128 0.016 0.000 0.000 0.144
#> GSM877166     1  0.0291     0.8142 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM877167     5  0.4357     0.2332 0.004 0.008 0.000 0.004 0.500 0.484
#> GSM877175     1  0.2320     0.7829 0.864 0.000 0.000 0.000 0.004 0.132
#> GSM877177     1  0.3213     0.7599 0.820 0.000 0.000 0.000 0.132 0.048
#> GSM877184     1  0.3468     0.6367 0.712 0.000 0.000 0.000 0.004 0.284
#> GSM877187     5  0.4819     0.6730 0.096 0.004 0.000 0.016 0.708 0.176
#> GSM877188     1  0.1226     0.8123 0.952 0.000 0.004 0.000 0.004 0.040
#> GSM877150     1  0.1564     0.8095 0.936 0.000 0.040 0.000 0.000 0.024
#> GSM877165     6  0.3426     0.5249 0.000 0.276 0.000 0.000 0.004 0.720
#> GSM877183     6  0.4518    -0.0956 0.000 0.000 0.012 0.020 0.376 0.592
#> GSM877178     3  0.0291     0.9148 0.000 0.000 0.992 0.004 0.000 0.004
#> GSM877182     6  0.4792     0.4787 0.008 0.288 0.000 0.064 0.000 0.640

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-NMF-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) genotype/variation(p) other(p) k
#> CV:NMF 62           0.6842               0.54657 2.24e-08 2
#> CV:NMF 60           0.0740               0.32248 3.00e-10 3
#> CV:NMF 59           0.1903               0.00285 3.54e-13 4
#> CV:NMF 56           0.2786               0.25985 8.76e-17 5
#> CV:NMF 50           0.0666               0.52599 5.35e-18 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 62 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 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-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.628           0.868       0.920         0.4740 0.492   0.492
#> 3 3 0.641           0.791       0.891         0.2161 0.941   0.880
#> 4 4 0.577           0.666       0.836         0.1336 0.957   0.901
#> 5 5 0.631           0.704       0.845         0.1143 0.905   0.756
#> 6 6 0.701           0.692       0.833         0.0624 0.925   0.759

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM877144     1  0.0938      0.951 0.988 0.012
#> GSM877128     1  0.0000      0.955 1.000 0.000
#> GSM877164     1  0.0000      0.955 1.000 0.000
#> GSM877162     2  0.5294      0.887 0.120 0.880
#> GSM877127     1  0.8443      0.576 0.728 0.272
#> GSM877138     1  0.2948      0.930 0.948 0.052
#> GSM877140     1  0.1414      0.949 0.980 0.020
#> GSM877156     2  0.9286      0.594 0.344 0.656
#> GSM877130     2  0.0672      0.867 0.008 0.992
#> GSM877141     2  0.6531      0.839 0.168 0.832
#> GSM877142     2  0.0000      0.862 0.000 1.000
#> GSM877145     2  0.4161      0.900 0.084 0.916
#> GSM877151     2  0.3879      0.901 0.076 0.924
#> GSM877158     2  0.0000      0.862 0.000 1.000
#> GSM877173     2  0.4298      0.900 0.088 0.912
#> GSM877176     2  0.7815      0.771 0.232 0.768
#> GSM877179     2  0.0000      0.862 0.000 1.000
#> GSM877181     2  0.3733      0.900 0.072 0.928
#> GSM877185     2  0.0672      0.867 0.008 0.992
#> GSM877131     2  0.5294      0.887 0.120 0.880
#> GSM877147     1  0.0938      0.951 0.988 0.012
#> GSM877155     2  0.3274      0.892 0.060 0.940
#> GSM877159     2  0.5294      0.887 0.120 0.880
#> GSM877170     2  0.9993      0.242 0.484 0.516
#> GSM877186     1  0.0000      0.955 1.000 0.000
#> GSM877132     2  0.5408      0.884 0.124 0.876
#> GSM877143     2  0.4022      0.901 0.080 0.920
#> GSM877146     2  0.4022      0.901 0.080 0.920
#> GSM877148     2  0.3879      0.901 0.076 0.924
#> GSM877152     2  0.3879      0.901 0.076 0.924
#> GSM877168     2  0.3879      0.901 0.076 0.924
#> GSM877180     2  0.3879      0.901 0.076 0.924
#> GSM877126     1  0.0000      0.955 1.000 0.000
#> GSM877129     1  0.0000      0.955 1.000 0.000
#> GSM877133     1  0.2603      0.936 0.956 0.044
#> GSM877153     1  0.0000      0.955 1.000 0.000
#> GSM877169     1  0.0000      0.955 1.000 0.000
#> GSM877171     1  0.0000      0.955 1.000 0.000
#> GSM877174     1  0.0000      0.955 1.000 0.000
#> GSM877134     1  0.7376      0.721 0.792 0.208
#> GSM877135     1  0.0000      0.955 1.000 0.000
#> GSM877136     1  0.0000      0.955 1.000 0.000
#> GSM877137     1  0.2603      0.936 0.956 0.044
#> GSM877139     1  0.2603      0.936 0.956 0.044
#> GSM877149     1  0.5178      0.857 0.884 0.116
#> GSM877154     2  0.5519      0.881 0.128 0.872
#> GSM877157     1  0.3114      0.925 0.944 0.056
#> GSM877160     1  0.0000      0.955 1.000 0.000
#> GSM877161     1  0.0000      0.955 1.000 0.000
#> GSM877163     1  0.2423      0.938 0.960 0.040
#> GSM877166     1  0.0000      0.955 1.000 0.000
#> GSM877167     2  0.3879      0.901 0.076 0.924
#> GSM877175     1  0.0000      0.955 1.000 0.000
#> GSM877177     1  0.2603      0.936 0.956 0.044
#> GSM877184     1  0.7453      0.714 0.788 0.212
#> GSM877187     2  0.4690      0.896 0.100 0.900
#> GSM877188     1  0.0000      0.955 1.000 0.000
#> GSM877150     1  0.0000      0.955 1.000 0.000
#> GSM877165     2  0.0938      0.870 0.012 0.988
#> GSM877183     2  0.9896      0.382 0.440 0.560
#> GSM877178     1  0.0000      0.955 1.000 0.000
#> GSM877182     2  0.9993      0.242 0.484 0.516

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.6567      0.895 0.160 0.088 0.752
#> GSM877128     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877164     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877162     2  0.1753      0.844 0.000 0.952 0.048
#> GSM877127     1  0.8181      0.227 0.584 0.324 0.092
#> GSM877138     1  0.8173      0.198 0.600 0.100 0.300
#> GSM877140     3  0.8125      0.714 0.340 0.084 0.576
#> GSM877156     2  0.6596      0.540 0.256 0.704 0.040
#> GSM877130     2  0.3816      0.798 0.000 0.852 0.148
#> GSM877141     2  0.5576      0.768 0.104 0.812 0.084
#> GSM877142     2  0.4842      0.737 0.000 0.776 0.224
#> GSM877145     2  0.1267      0.853 0.004 0.972 0.024
#> GSM877151     2  0.0424      0.855 0.000 0.992 0.008
#> GSM877158     2  0.4346      0.784 0.000 0.816 0.184
#> GSM877173     2  0.2486      0.851 0.008 0.932 0.060
#> GSM877176     2  0.4874      0.722 0.144 0.828 0.028
#> GSM877179     2  0.5016      0.738 0.000 0.760 0.240
#> GSM877181     2  0.2448      0.834 0.000 0.924 0.076
#> GSM877185     2  0.3752      0.800 0.000 0.856 0.144
#> GSM877131     2  0.1860      0.844 0.000 0.948 0.052
#> GSM877147     3  0.6567      0.895 0.160 0.088 0.752
#> GSM877155     2  0.2356      0.845 0.000 0.928 0.072
#> GSM877159     2  0.1753      0.844 0.000 0.952 0.048
#> GSM877170     2  0.8013      0.282 0.364 0.564 0.072
#> GSM877186     1  0.1163      0.888 0.972 0.000 0.028
#> GSM877132     2  0.2492      0.838 0.048 0.936 0.016
#> GSM877143     2  0.0237      0.855 0.000 0.996 0.004
#> GSM877146     2  0.0237      0.855 0.000 0.996 0.004
#> GSM877148     2  0.0424      0.855 0.000 0.992 0.008
#> GSM877152     2  0.0000      0.855 0.000 1.000 0.000
#> GSM877168     2  0.0000      0.855 0.000 1.000 0.000
#> GSM877180     2  0.0000      0.855 0.000 1.000 0.000
#> GSM877126     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877129     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877133     1  0.3028      0.856 0.920 0.048 0.032
#> GSM877153     3  0.6767      0.879 0.216 0.064 0.720
#> GSM877169     1  0.0000      0.896 1.000 0.000 0.000
#> GSM877171     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877174     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877134     1  0.5940      0.617 0.760 0.204 0.036
#> GSM877135     1  0.0661      0.893 0.988 0.004 0.008
#> GSM877136     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877137     1  0.2663      0.864 0.932 0.044 0.024
#> GSM877139     1  0.2663      0.864 0.932 0.044 0.024
#> GSM877149     1  0.4708      0.754 0.844 0.120 0.036
#> GSM877154     2  0.2689      0.836 0.032 0.932 0.036
#> GSM877157     1  0.2793      0.858 0.928 0.044 0.028
#> GSM877160     1  0.0000      0.896 1.000 0.000 0.000
#> GSM877161     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877163     1  0.2297      0.871 0.944 0.036 0.020
#> GSM877166     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877167     2  0.0237      0.855 0.000 0.996 0.004
#> GSM877175     1  0.0237      0.894 0.996 0.000 0.004
#> GSM877177     1  0.2663      0.865 0.932 0.044 0.024
#> GSM877184     1  0.6303      0.534 0.720 0.248 0.032
#> GSM877187     2  0.1647      0.850 0.004 0.960 0.036
#> GSM877188     1  0.0000      0.896 1.000 0.000 0.000
#> GSM877150     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877165     2  0.3752      0.801 0.000 0.856 0.144
#> GSM877183     2  0.7797      0.381 0.320 0.608 0.072
#> GSM877178     1  0.0237      0.896 0.996 0.000 0.004
#> GSM877182     2  0.8013      0.282 0.364 0.564 0.072

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.1042     0.7897 0.020 0.008 0.972 0.000
#> GSM877128     1  0.4332     0.7603 0.792 0.000 0.032 0.176
#> GSM877164     1  0.4238     0.7624 0.796 0.000 0.028 0.176
#> GSM877162     2  0.1833     0.7535 0.000 0.944 0.024 0.032
#> GSM877127     1  0.9316     0.1218 0.360 0.312 0.092 0.236
#> GSM877138     1  0.9243    -0.0509 0.352 0.088 0.340 0.220
#> GSM877140     3  0.6067     0.5782 0.264 0.052 0.668 0.016
#> GSM877156     2  0.5545     0.5203 0.028 0.696 0.016 0.260
#> GSM877130     2  0.4843    -0.1966 0.000 0.604 0.000 0.396
#> GSM877141     2  0.3978     0.6458 0.012 0.796 0.000 0.192
#> GSM877142     4  0.4356     0.9131 0.000 0.292 0.000 0.708
#> GSM877145     2  0.1256     0.7627 0.000 0.964 0.008 0.028
#> GSM877151     2  0.0336     0.7635 0.000 0.992 0.000 0.008
#> GSM877158     4  0.4661     0.8602 0.000 0.348 0.000 0.652
#> GSM877173     2  0.1867     0.7483 0.000 0.928 0.000 0.072
#> GSM877176     2  0.4237     0.6555 0.020 0.824 0.020 0.136
#> GSM877179     4  0.4193     0.9108 0.000 0.268 0.000 0.732
#> GSM877181     2  0.2921     0.6132 0.000 0.860 0.000 0.140
#> GSM877185     2  0.4817    -0.1706 0.000 0.612 0.000 0.388
#> GSM877131     2  0.2021     0.7501 0.000 0.936 0.024 0.040
#> GSM877147     3  0.1042     0.7897 0.020 0.008 0.972 0.000
#> GSM877155     2  0.3311     0.5983 0.000 0.828 0.000 0.172
#> GSM877159     2  0.1833     0.7535 0.000 0.944 0.024 0.032
#> GSM877170     2  0.7840     0.3499 0.132 0.552 0.044 0.272
#> GSM877186     1  0.1867     0.7901 0.928 0.000 0.072 0.000
#> GSM877132     2  0.2269     0.7481 0.032 0.932 0.008 0.028
#> GSM877143     2  0.0188     0.7652 0.000 0.996 0.004 0.000
#> GSM877146     2  0.0188     0.7652 0.000 0.996 0.004 0.000
#> GSM877148     2  0.0336     0.7635 0.000 0.992 0.000 0.008
#> GSM877152     2  0.0000     0.7650 0.000 1.000 0.000 0.000
#> GSM877168     2  0.0000     0.7650 0.000 1.000 0.000 0.000
#> GSM877180     2  0.0000     0.7650 0.000 1.000 0.000 0.000
#> GSM877126     1  0.4332     0.7603 0.792 0.000 0.032 0.176
#> GSM877129     1  0.4238     0.7624 0.796 0.000 0.028 0.176
#> GSM877133     1  0.6200     0.7057 0.700 0.044 0.048 0.208
#> GSM877153     3  0.2345     0.7704 0.100 0.000 0.900 0.000
#> GSM877169     1  0.0469     0.8089 0.988 0.000 0.012 0.000
#> GSM877171     1  0.4238     0.7624 0.796 0.000 0.028 0.176
#> GSM877174     1  0.4238     0.7624 0.796 0.000 0.028 0.176
#> GSM877134     1  0.5911     0.6028 0.716 0.200 0.024 0.060
#> GSM877135     1  0.0376     0.8078 0.992 0.004 0.004 0.000
#> GSM877136     1  0.0000     0.8075 1.000 0.000 0.000 0.000
#> GSM877137     1  0.3218     0.7903 0.896 0.044 0.032 0.028
#> GSM877139     1  0.3218     0.7903 0.896 0.044 0.032 0.028
#> GSM877149     1  0.6092     0.6976 0.724 0.116 0.024 0.136
#> GSM877154     2  0.2222     0.7473 0.000 0.924 0.016 0.060
#> GSM877157     1  0.2910     0.7894 0.908 0.044 0.020 0.028
#> GSM877160     1  0.0336     0.8085 0.992 0.000 0.008 0.000
#> GSM877161     1  0.0000     0.8075 1.000 0.000 0.000 0.000
#> GSM877163     1  0.2828     0.7967 0.912 0.036 0.020 0.032
#> GSM877166     1  0.0000     0.8075 1.000 0.000 0.000 0.000
#> GSM877167     2  0.0188     0.7643 0.000 0.996 0.000 0.004
#> GSM877175     1  0.0469     0.8086 0.988 0.000 0.012 0.000
#> GSM877177     1  0.2411     0.7959 0.920 0.040 0.040 0.000
#> GSM877184     1  0.7464     0.4987 0.592 0.248 0.036 0.124
#> GSM877187     2  0.1510     0.7616 0.000 0.956 0.016 0.028
#> GSM877188     1  0.0336     0.8085 0.992 0.000 0.008 0.000
#> GSM877150     1  0.0000     0.8075 1.000 0.000 0.000 0.000
#> GSM877165     2  0.4830    -0.1809 0.000 0.608 0.000 0.392
#> GSM877183     2  0.7212     0.4137 0.092 0.600 0.036 0.272
#> GSM877178     1  0.4238     0.7624 0.796 0.000 0.028 0.176
#> GSM877182     2  0.7840     0.3499 0.132 0.552 0.044 0.272

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0000     0.7962 0.000 0.000 0.000 1.000 0.000
#> GSM877128     3  0.2970     0.7709 0.168 0.000 0.828 0.004 0.000
#> GSM877164     3  0.2852     0.7738 0.172 0.000 0.828 0.000 0.000
#> GSM877162     5  0.1690     0.7903 0.000 0.024 0.008 0.024 0.944
#> GSM877127     3  0.7314     0.2499 0.084 0.028 0.552 0.072 0.264
#> GSM877138     3  0.6723     0.1484 0.064 0.020 0.556 0.316 0.044
#> GSM877140     4  0.6045     0.5253 0.060 0.008 0.256 0.636 0.040
#> GSM877156     5  0.4822     0.5652 0.004 0.028 0.332 0.000 0.636
#> GSM877130     5  0.4434     0.1056 0.000 0.460 0.004 0.000 0.536
#> GSM877141     5  0.4123     0.7099 0.000 0.108 0.104 0.000 0.788
#> GSM877142     2  0.1410     0.9164 0.000 0.940 0.000 0.000 0.060
#> GSM877145     5  0.2074     0.7906 0.000 0.016 0.060 0.004 0.920
#> GSM877151     5  0.0290     0.7968 0.000 0.008 0.000 0.000 0.992
#> GSM877158     2  0.2230     0.8725 0.000 0.884 0.000 0.000 0.116
#> GSM877173     5  0.2209     0.7900 0.000 0.056 0.032 0.000 0.912
#> GSM877176     5  0.4055     0.7014 0.020 0.004 0.192 0.008 0.776
#> GSM877179     2  0.0963     0.9066 0.000 0.964 0.000 0.000 0.036
#> GSM877181     5  0.2674     0.7168 0.000 0.140 0.004 0.000 0.856
#> GSM877185     5  0.4425     0.1269 0.000 0.452 0.004 0.000 0.544
#> GSM877131     5  0.1865     0.7890 0.000 0.032 0.008 0.024 0.936
#> GSM877147     4  0.0000     0.7962 0.000 0.000 0.000 1.000 0.000
#> GSM877155     5  0.3132     0.6882 0.000 0.172 0.008 0.000 0.820
#> GSM877159     5  0.1690     0.7903 0.000 0.024 0.008 0.024 0.944
#> GSM877170     5  0.6618     0.3198 0.028 0.040 0.412 0.036 0.484
#> GSM877186     1  0.2011     0.8534 0.908 0.000 0.004 0.088 0.000
#> GSM877132     5  0.2728     0.7780 0.032 0.004 0.068 0.004 0.892
#> GSM877143     5  0.0162     0.7978 0.000 0.000 0.000 0.004 0.996
#> GSM877146     5  0.0162     0.7978 0.000 0.000 0.000 0.004 0.996
#> GSM877148     5  0.0290     0.7968 0.000 0.008 0.000 0.000 0.992
#> GSM877152     5  0.0000     0.7975 0.000 0.000 0.000 0.000 1.000
#> GSM877168     5  0.0000     0.7975 0.000 0.000 0.000 0.000 1.000
#> GSM877180     5  0.0000     0.7975 0.000 0.000 0.000 0.000 1.000
#> GSM877126     3  0.2970     0.7709 0.168 0.000 0.828 0.004 0.000
#> GSM877129     3  0.2852     0.7738 0.172 0.000 0.828 0.000 0.000
#> GSM877133     3  0.5467     0.0641 0.456 0.012 0.500 0.028 0.004
#> GSM877153     4  0.2903     0.7769 0.048 0.000 0.080 0.872 0.000
#> GSM877169     1  0.0703     0.8756 0.976 0.000 0.024 0.000 0.000
#> GSM877171     3  0.2852     0.7738 0.172 0.000 0.828 0.000 0.000
#> GSM877174     3  0.2852     0.7738 0.172 0.000 0.828 0.000 0.000
#> GSM877134     1  0.5194     0.6520 0.720 0.008 0.132 0.004 0.136
#> GSM877135     1  0.0613     0.8802 0.984 0.000 0.008 0.004 0.004
#> GSM877136     1  0.0290     0.8806 0.992 0.000 0.008 0.000 0.000
#> GSM877137     1  0.2925     0.8449 0.880 0.004 0.084 0.024 0.008
#> GSM877139     1  0.2925     0.8449 0.880 0.004 0.084 0.024 0.008
#> GSM877149     1  0.4894     0.6637 0.724 0.008 0.204 0.004 0.060
#> GSM877154     5  0.2835     0.7663 0.004 0.016 0.112 0.000 0.868
#> GSM877157     1  0.1792     0.8545 0.916 0.000 0.084 0.000 0.000
#> GSM877160     1  0.0510     0.8794 0.984 0.000 0.016 0.000 0.000
#> GSM877161     1  0.0290     0.8806 0.992 0.000 0.008 0.000 0.000
#> GSM877163     1  0.1991     0.8606 0.916 0.004 0.076 0.000 0.004
#> GSM877166     1  0.0290     0.8806 0.992 0.000 0.008 0.000 0.000
#> GSM877167     5  0.0162     0.7975 0.000 0.004 0.000 0.000 0.996
#> GSM877175     1  0.0404     0.8807 0.988 0.000 0.012 0.000 0.000
#> GSM877177     1  0.2548     0.8527 0.896 0.000 0.072 0.028 0.004
#> GSM877184     1  0.6723     0.3758 0.572 0.004 0.184 0.028 0.212
#> GSM877187     5  0.2166     0.7865 0.000 0.012 0.072 0.004 0.912
#> GSM877188     1  0.0510     0.8794 0.984 0.000 0.016 0.000 0.000
#> GSM877150     1  0.0290     0.8806 0.992 0.000 0.008 0.000 0.000
#> GSM877165     5  0.4430     0.1189 0.000 0.456 0.004 0.000 0.540
#> GSM877183     5  0.5908     0.4217 0.012 0.036 0.392 0.020 0.540
#> GSM877178     3  0.2852     0.7738 0.172 0.000 0.828 0.000 0.000
#> GSM877182     5  0.6562     0.3135 0.028 0.036 0.420 0.036 0.480

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0000      0.770 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877128     3  0.0603      0.980 0.000 0.000 0.980 0.004 0.000 0.016
#> GSM877164     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877162     5  0.2982      0.644 0.000 0.004 0.000 0.012 0.820 0.164
#> GSM877127     6  0.6657      0.465 0.032 0.000 0.216 0.032 0.180 0.540
#> GSM877138     6  0.6272     -0.135 0.016 0.000 0.236 0.208 0.012 0.528
#> GSM877140     4  0.5917      0.541 0.000 0.000 0.236 0.520 0.008 0.236
#> GSM877156     6  0.3862      0.321 0.000 0.000 0.000 0.000 0.476 0.524
#> GSM877130     5  0.4256      0.184 0.000 0.464 0.000 0.000 0.520 0.016
#> GSM877141     5  0.4261      0.544 0.000 0.112 0.000 0.000 0.732 0.156
#> GSM877142     2  0.0713      0.915 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM877145     5  0.2882      0.654 0.000 0.008 0.000 0.000 0.812 0.180
#> GSM877151     5  0.0260      0.745 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM877158     2  0.1753      0.869 0.000 0.912 0.000 0.000 0.084 0.004
#> GSM877173     5  0.3130      0.689 0.000 0.048 0.000 0.000 0.828 0.124
#> GSM877176     5  0.3647      0.276 0.000 0.000 0.000 0.000 0.640 0.360
#> GSM877179     2  0.0146      0.901 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM877181     5  0.2949      0.681 0.000 0.140 0.000 0.000 0.832 0.028
#> GSM877185     5  0.4396      0.188 0.000 0.456 0.000 0.000 0.520 0.024
#> GSM877131     5  0.3191      0.639 0.000 0.012 0.000 0.012 0.812 0.164
#> GSM877147     4  0.0000      0.770 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM877155     5  0.4302      0.586 0.000 0.156 0.000 0.000 0.728 0.116
#> GSM877159     5  0.2982      0.644 0.000 0.004 0.000 0.012 0.820 0.164
#> GSM877170     6  0.3360      0.638 0.000 0.004 0.000 0.000 0.264 0.732
#> GSM877186     1  0.3123      0.772 0.836 0.000 0.000 0.088 0.000 0.076
#> GSM877132     5  0.3302      0.588 0.004 0.004 0.000 0.000 0.760 0.232
#> GSM877143     5  0.0790      0.739 0.000 0.000 0.000 0.000 0.968 0.032
#> GSM877146     5  0.0790      0.739 0.000 0.000 0.000 0.000 0.968 0.032
#> GSM877148     5  0.0260      0.745 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM877152     5  0.0000      0.744 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877168     5  0.0000      0.744 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877180     5  0.0000      0.744 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877126     3  0.0777      0.974 0.000 0.000 0.972 0.004 0.000 0.024
#> GSM877129     3  0.0363      0.984 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM877133     1  0.6244      0.118 0.404 0.000 0.204 0.008 0.004 0.380
#> GSM877153     4  0.3735      0.749 0.000 0.000 0.124 0.784 0.000 0.092
#> GSM877169     1  0.1082      0.848 0.956 0.000 0.040 0.000 0.000 0.004
#> GSM877171     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877174     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877134     1  0.4047      0.670 0.676 0.000 0.000 0.000 0.028 0.296
#> GSM877135     1  0.0632      0.849 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM877136     1  0.0000      0.848 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.3447      0.818 0.816 0.000 0.036 0.004 0.008 0.136
#> GSM877139     1  0.3447      0.818 0.816 0.000 0.036 0.004 0.008 0.136
#> GSM877149     1  0.3601      0.678 0.684 0.000 0.000 0.000 0.004 0.312
#> GSM877154     5  0.3050      0.553 0.000 0.000 0.000 0.000 0.764 0.236
#> GSM877157     1  0.2048      0.837 0.880 0.000 0.000 0.000 0.000 0.120
#> GSM877160     1  0.0935      0.850 0.964 0.000 0.032 0.000 0.000 0.004
#> GSM877161     1  0.0000      0.848 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.2592      0.835 0.864 0.000 0.016 0.000 0.004 0.116
#> GSM877166     1  0.0000      0.848 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.0405      0.745 0.000 0.004 0.000 0.000 0.988 0.008
#> GSM877175     1  0.1049      0.850 0.960 0.000 0.032 0.000 0.000 0.008
#> GSM877177     1  0.3365      0.821 0.832 0.000 0.052 0.008 0.004 0.104
#> GSM877184     1  0.6363      0.342 0.500 0.000 0.036 0.004 0.156 0.304
#> GSM877187     5  0.2178      0.700 0.000 0.000 0.000 0.000 0.868 0.132
#> GSM877188     1  0.0935      0.850 0.964 0.000 0.032 0.000 0.000 0.004
#> GSM877150     1  0.0000      0.848 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877165     5  0.4328      0.191 0.000 0.460 0.000 0.000 0.520 0.020
#> GSM877183     6  0.4417      0.537 0.000 0.000 0.024 0.004 0.384 0.588
#> GSM877178     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM877182     6  0.3198      0.639 0.000 0.000 0.000 0.000 0.260 0.740

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) genotype/variation(p) other(p) k
#> MAD:hclust 59         0.321285                 0.621 1.03e-07 2
#> MAD:hclust 57         0.269960                 0.205 1.78e-07 3
#> MAD:hclust 53         0.508344                 0.413 4.53e-07 4
#> MAD:hclust 52         0.033256                 0.547 3.28e-11 5
#> MAD:hclust 53         0.000239                 0.596 9.92e-12 6

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


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

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.982       0.992         0.5080 0.492   0.492
#> 3 3 0.567           0.767       0.855         0.2818 0.791   0.597
#> 4 4 0.580           0.587       0.718         0.1073 0.924   0.799
#> 5 5 0.652           0.674       0.793         0.0740 0.852   0.583
#> 6 6 0.675           0.601       0.759         0.0545 0.965   0.850

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
#> GSM877144     1   0.000      0.990 1.000 0.000
#> GSM877128     1   0.000      0.990 1.000 0.000
#> GSM877164     1   0.000      0.990 1.000 0.000
#> GSM877162     2   0.000      0.994 0.000 1.000
#> GSM877127     1   0.000      0.990 1.000 0.000
#> GSM877138     1   0.000      0.990 1.000 0.000
#> GSM877140     1   0.000      0.990 1.000 0.000
#> GSM877156     2   0.000      0.994 0.000 1.000
#> GSM877130     2   0.000      0.994 0.000 1.000
#> GSM877141     2   0.000      0.994 0.000 1.000
#> GSM877142     2   0.000      0.994 0.000 1.000
#> GSM877145     2   0.000      0.994 0.000 1.000
#> GSM877151     2   0.000      0.994 0.000 1.000
#> GSM877158     2   0.000      0.994 0.000 1.000
#> GSM877173     2   0.000      0.994 0.000 1.000
#> GSM877176     2   0.000      0.994 0.000 1.000
#> GSM877179     2   0.000      0.994 0.000 1.000
#> GSM877181     2   0.000      0.994 0.000 1.000
#> GSM877185     2   0.000      0.994 0.000 1.000
#> GSM877131     2   0.000      0.994 0.000 1.000
#> GSM877147     2   0.680      0.776 0.180 0.820
#> GSM877155     2   0.000      0.994 0.000 1.000
#> GSM877159     2   0.000      0.994 0.000 1.000
#> GSM877170     2   0.000      0.994 0.000 1.000
#> GSM877186     1   0.000      0.990 1.000 0.000
#> GSM877132     2   0.000      0.994 0.000 1.000
#> GSM877143     2   0.000      0.994 0.000 1.000
#> GSM877146     2   0.000      0.994 0.000 1.000
#> GSM877148     2   0.000      0.994 0.000 1.000
#> GSM877152     2   0.000      0.994 0.000 1.000
#> GSM877168     2   0.000      0.994 0.000 1.000
#> GSM877180     2   0.000      0.994 0.000 1.000
#> GSM877126     1   0.000      0.990 1.000 0.000
#> GSM877129     1   0.000      0.990 1.000 0.000
#> GSM877133     1   0.000      0.990 1.000 0.000
#> GSM877153     1   0.000      0.990 1.000 0.000
#> GSM877169     1   0.000      0.990 1.000 0.000
#> GSM877171     1   0.000      0.990 1.000 0.000
#> GSM877174     1   0.000      0.990 1.000 0.000
#> GSM877134     1   0.141      0.971 0.980 0.020
#> GSM877135     1   0.000      0.990 1.000 0.000
#> GSM877136     1   0.000      0.990 1.000 0.000
#> GSM877137     1   0.000      0.990 1.000 0.000
#> GSM877139     1   0.000      0.990 1.000 0.000
#> GSM877149     1   0.000      0.990 1.000 0.000
#> GSM877154     2   0.000      0.994 0.000 1.000
#> GSM877157     1   0.000      0.990 1.000 0.000
#> GSM877160     1   0.000      0.990 1.000 0.000
#> GSM877161     1   0.000      0.990 1.000 0.000
#> GSM877163     1   0.000      0.990 1.000 0.000
#> GSM877166     1   0.000      0.990 1.000 0.000
#> GSM877167     2   0.000      0.994 0.000 1.000
#> GSM877175     1   0.000      0.990 1.000 0.000
#> GSM877177     1   0.000      0.990 1.000 0.000
#> GSM877184     1   0.000      0.990 1.000 0.000
#> GSM877187     2   0.000      0.994 0.000 1.000
#> GSM877188     1   0.000      0.990 1.000 0.000
#> GSM877150     1   0.000      0.990 1.000 0.000
#> GSM877165     2   0.000      0.994 0.000 1.000
#> GSM877183     2   0.000      0.994 0.000 1.000
#> GSM877178     1   0.000      0.990 1.000 0.000
#> GSM877182     1   0.850      0.615 0.724 0.276

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3   0.440      0.655 0.188 0.000 0.812
#> GSM877128     3   0.588      0.530 0.348 0.000 0.652
#> GSM877164     1   0.440      0.711 0.812 0.000 0.188
#> GSM877162     3   0.608      0.345 0.000 0.388 0.612
#> GSM877127     3   0.399      0.669 0.108 0.020 0.872
#> GSM877138     3   0.406      0.671 0.112 0.020 0.868
#> GSM877140     3   0.382      0.667 0.148 0.000 0.852
#> GSM877156     2   0.296      0.890 0.000 0.900 0.100
#> GSM877130     2   0.263      0.867 0.000 0.916 0.084
#> GSM877141     2   0.400      0.784 0.000 0.840 0.160
#> GSM877142     2   0.280      0.863 0.000 0.908 0.092
#> GSM877145     2   0.319      0.885 0.000 0.888 0.112
#> GSM877151     2   0.254      0.868 0.000 0.920 0.080
#> GSM877158     2   0.288      0.862 0.000 0.904 0.096
#> GSM877173     2   0.129      0.891 0.000 0.968 0.032
#> GSM877176     2   0.216      0.891 0.000 0.936 0.064
#> GSM877179     2   0.288      0.862 0.000 0.904 0.096
#> GSM877181     2   0.129      0.883 0.000 0.968 0.032
#> GSM877185     2   0.196      0.878 0.000 0.944 0.056
#> GSM877131     2   0.271      0.865 0.000 0.912 0.088
#> GSM877147     3   0.536      0.620 0.032 0.168 0.800
#> GSM877155     2   0.263      0.866 0.000 0.916 0.084
#> GSM877159     3   0.581      0.421 0.000 0.336 0.664
#> GSM877170     3   0.625      0.316 0.000 0.444 0.556
#> GSM877186     1   0.186      0.861 0.948 0.000 0.052
#> GSM877132     2   0.327      0.883 0.000 0.884 0.116
#> GSM877143     2   0.327      0.884 0.000 0.884 0.116
#> GSM877146     2   0.327      0.884 0.000 0.884 0.116
#> GSM877148     2   0.280      0.892 0.000 0.908 0.092
#> GSM877152     2   0.319      0.887 0.000 0.888 0.112
#> GSM877168     2   0.312      0.888 0.000 0.892 0.108
#> GSM877180     2   0.312      0.888 0.000 0.892 0.108
#> GSM877126     3   0.581      0.541 0.336 0.000 0.664
#> GSM877129     3   0.586      0.534 0.344 0.000 0.656
#> GSM877133     1   0.254      0.826 0.920 0.000 0.080
#> GSM877153     3   0.502      0.622 0.240 0.000 0.760
#> GSM877169     1   0.254      0.826 0.920 0.000 0.080
#> GSM877171     1   0.406      0.742 0.836 0.000 0.164
#> GSM877174     1   0.440      0.711 0.812 0.000 0.188
#> GSM877134     1   0.718      0.650 0.712 0.104 0.184
#> GSM877135     1   0.362      0.827 0.864 0.000 0.136
#> GSM877136     1   0.000      0.868 1.000 0.000 0.000
#> GSM877137     1   0.619      0.728 0.764 0.060 0.176
#> GSM877139     1   0.466      0.800 0.828 0.016 0.156
#> GSM877149     1   0.280      0.851 0.908 0.000 0.092
#> GSM877154     2   0.362      0.870 0.000 0.864 0.136
#> GSM877157     1   0.423      0.809 0.836 0.004 0.160
#> GSM877160     1   0.000      0.868 1.000 0.000 0.000
#> GSM877161     1   0.000      0.868 1.000 0.000 0.000
#> GSM877163     1   0.188      0.862 0.952 0.004 0.044
#> GSM877166     1   0.000      0.868 1.000 0.000 0.000
#> GSM877167     2   0.280      0.892 0.000 0.908 0.092
#> GSM877175     1   0.000      0.868 1.000 0.000 0.000
#> GSM877177     1   0.304      0.845 0.896 0.000 0.104
#> GSM877184     1   0.595      0.736 0.772 0.048 0.180
#> GSM877187     2   0.424      0.829 0.000 0.824 0.176
#> GSM877188     1   0.000      0.868 1.000 0.000 0.000
#> GSM877150     1   0.000      0.868 1.000 0.000 0.000
#> GSM877165     2   0.186      0.878 0.000 0.948 0.052
#> GSM877183     3   0.579      0.436 0.000 0.332 0.668
#> GSM877178     3   0.627      0.331 0.456 0.000 0.544
#> GSM877182     3   0.722      0.511 0.052 0.296 0.652

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.1575     0.7580 0.028 0.012 0.956 0.004
#> GSM877128     4  0.7751     0.8622 0.240 0.000 0.344 0.416
#> GSM877164     1  0.6600    -0.4150 0.520 0.000 0.084 0.396
#> GSM877162     3  0.4015     0.7335 0.000 0.052 0.832 0.116
#> GSM877127     3  0.6624     0.4808 0.012 0.104 0.640 0.244
#> GSM877138     3  0.5132     0.6580 0.012 0.060 0.772 0.156
#> GSM877140     3  0.3556     0.7230 0.012 0.020 0.864 0.104
#> GSM877156     2  0.2596     0.7158 0.000 0.908 0.024 0.068
#> GSM877130     2  0.4830     0.6613 0.000 0.608 0.000 0.392
#> GSM877141     2  0.4609     0.7119 0.000 0.788 0.056 0.156
#> GSM877142     2  0.4888     0.6538 0.000 0.588 0.000 0.412
#> GSM877145     2  0.2342     0.7256 0.000 0.912 0.008 0.080
#> GSM877151     2  0.5028     0.6596 0.000 0.596 0.004 0.400
#> GSM877158     2  0.4888     0.6538 0.000 0.588 0.000 0.412
#> GSM877173     2  0.2647     0.7336 0.000 0.880 0.000 0.120
#> GSM877176     2  0.3384     0.7245 0.000 0.860 0.024 0.116
#> GSM877179     2  0.4888     0.6538 0.000 0.588 0.000 0.412
#> GSM877181     2  0.4382     0.6929 0.000 0.704 0.000 0.296
#> GSM877185     2  0.4730     0.6706 0.000 0.636 0.000 0.364
#> GSM877131     2  0.5691     0.6521 0.000 0.564 0.028 0.408
#> GSM877147     3  0.2456     0.7689 0.008 0.028 0.924 0.040
#> GSM877155     2  0.5028     0.6597 0.000 0.596 0.004 0.400
#> GSM877159     3  0.4015     0.7335 0.000 0.052 0.832 0.116
#> GSM877170     2  0.6603     0.4029 0.000 0.572 0.100 0.328
#> GSM877186     1  0.2844     0.6652 0.900 0.000 0.048 0.052
#> GSM877132     2  0.2611     0.7214 0.000 0.896 0.008 0.096
#> GSM877143     2  0.3383     0.7032 0.000 0.872 0.052 0.076
#> GSM877146     2  0.3383     0.7032 0.000 0.872 0.052 0.076
#> GSM877148     2  0.2411     0.7268 0.000 0.920 0.040 0.040
#> GSM877152     2  0.2214     0.7213 0.000 0.928 0.044 0.028
#> GSM877168     2  0.2589     0.7243 0.000 0.912 0.044 0.044
#> GSM877180     2  0.2500     0.7239 0.000 0.916 0.044 0.040
#> GSM877126     4  0.7581     0.8121 0.200 0.000 0.360 0.440
#> GSM877129     4  0.7728     0.8653 0.252 0.000 0.308 0.440
#> GSM877133     1  0.3958     0.4557 0.824 0.000 0.032 0.144
#> GSM877153     3  0.2131     0.6865 0.032 0.000 0.932 0.036
#> GSM877169     1  0.4579     0.3407 0.768 0.000 0.032 0.200
#> GSM877171     1  0.6600    -0.4150 0.520 0.000 0.084 0.396
#> GSM877174     1  0.6600    -0.4150 0.520 0.000 0.084 0.396
#> GSM877134     1  0.7775     0.3741 0.520 0.304 0.024 0.152
#> GSM877135     1  0.4855     0.6505 0.804 0.024 0.052 0.120
#> GSM877136     1  0.0524     0.6703 0.988 0.000 0.004 0.008
#> GSM877137     1  0.7624     0.4027 0.552 0.284 0.028 0.136
#> GSM877139     1  0.5085     0.6395 0.788 0.048 0.028 0.136
#> GSM877149     1  0.4569     0.6494 0.808 0.016 0.036 0.140
#> GSM877154     2  0.2871     0.7062 0.000 0.896 0.032 0.072
#> GSM877157     1  0.5121     0.6361 0.780 0.032 0.036 0.152
#> GSM877160     1  0.0188     0.6719 0.996 0.000 0.000 0.004
#> GSM877161     1  0.0376     0.6718 0.992 0.000 0.004 0.004
#> GSM877163     1  0.3617     0.6650 0.852 0.012 0.012 0.124
#> GSM877166     1  0.0376     0.6718 0.992 0.000 0.004 0.004
#> GSM877167     2  0.0188     0.7349 0.000 0.996 0.000 0.004
#> GSM877175     1  0.0188     0.6719 0.996 0.000 0.000 0.004
#> GSM877177     1  0.4468     0.6548 0.820 0.012 0.052 0.116
#> GSM877184     1  0.7891     0.4100 0.552 0.252 0.040 0.156
#> GSM877187     2  0.4804     0.6154 0.000 0.776 0.064 0.160
#> GSM877188     1  0.0188     0.6719 0.996 0.000 0.000 0.004
#> GSM877150     1  0.0524     0.6703 0.988 0.000 0.004 0.008
#> GSM877165     2  0.4730     0.6706 0.000 0.636 0.000 0.364
#> GSM877183     2  0.7733    -0.1963 0.000 0.412 0.356 0.232
#> GSM877178     4  0.7706     0.7507 0.364 0.000 0.224 0.412
#> GSM877182     2  0.8631     0.0418 0.064 0.472 0.284 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
#> GSM877144     4  0.0865      0.844 0.004 0.000 0.024 0.972 0.000
#> GSM877128     3  0.5064      0.786 0.060 0.000 0.748 0.140 0.052
#> GSM877164     3  0.2690      0.852 0.156 0.000 0.844 0.000 0.000
#> GSM877162     4  0.2827      0.833 0.000 0.044 0.020 0.892 0.044
#> GSM877127     5  0.7346     -0.281 0.048 0.000 0.188 0.312 0.452
#> GSM877138     4  0.5868      0.636 0.016 0.000 0.108 0.628 0.248
#> GSM877140     4  0.5253      0.703 0.008 0.000 0.108 0.696 0.188
#> GSM877156     5  0.3340      0.601 0.000 0.156 0.016 0.004 0.824
#> GSM877130     2  0.1331      0.821 0.000 0.952 0.008 0.000 0.040
#> GSM877141     5  0.5554      0.432 0.000 0.344 0.056 0.012 0.588
#> GSM877142     2  0.0771      0.816 0.000 0.976 0.020 0.004 0.000
#> GSM877145     5  0.5030      0.504 0.016 0.356 0.012 0.004 0.612
#> GSM877151     2  0.0955      0.823 0.000 0.968 0.000 0.004 0.028
#> GSM877158     2  0.1243      0.814 0.000 0.960 0.028 0.008 0.004
#> GSM877173     2  0.4883     -0.332 0.000 0.516 0.016 0.004 0.464
#> GSM877176     5  0.4481      0.541 0.008 0.248 0.020 0.004 0.720
#> GSM877179     2  0.1243      0.814 0.000 0.960 0.028 0.008 0.004
#> GSM877181     2  0.3957      0.432 0.000 0.712 0.008 0.000 0.280
#> GSM877185     2  0.1894      0.806 0.000 0.920 0.008 0.000 0.072
#> GSM877131     2  0.2476      0.787 0.000 0.904 0.020 0.012 0.064
#> GSM877147     4  0.0854      0.846 0.004 0.012 0.008 0.976 0.000
#> GSM877155     2  0.1455      0.822 0.000 0.952 0.008 0.008 0.032
#> GSM877159     4  0.2825      0.835 0.000 0.040 0.020 0.892 0.048
#> GSM877170     5  0.6129      0.452 0.024 0.156 0.136 0.016 0.668
#> GSM877186     1  0.3183      0.815 0.872 0.000 0.020 0.060 0.048
#> GSM877132     5  0.5016      0.507 0.016 0.352 0.012 0.004 0.616
#> GSM877143     5  0.5965      0.532 0.008 0.356 0.064 0.012 0.560
#> GSM877146     5  0.5965      0.532 0.008 0.356 0.064 0.012 0.560
#> GSM877148     5  0.5858      0.514 0.004 0.380 0.060 0.012 0.544
#> GSM877152     5  0.5772      0.547 0.004 0.348 0.060 0.012 0.576
#> GSM877168     5  0.5849      0.516 0.004 0.376 0.060 0.012 0.548
#> GSM877180     5  0.5849      0.516 0.004 0.376 0.060 0.012 0.548
#> GSM877126     3  0.4849      0.779 0.052 0.000 0.764 0.132 0.052
#> GSM877129     3  0.3377      0.834 0.056 0.000 0.856 0.076 0.012
#> GSM877133     1  0.3039      0.709 0.808 0.000 0.192 0.000 0.000
#> GSM877153     4  0.0955      0.843 0.004 0.000 0.028 0.968 0.000
#> GSM877169     1  0.4192      0.233 0.596 0.000 0.404 0.000 0.000
#> GSM877171     3  0.2690      0.852 0.156 0.000 0.844 0.000 0.000
#> GSM877174     3  0.2690      0.852 0.156 0.000 0.844 0.000 0.000
#> GSM877134     1  0.4691      0.585 0.656 0.008 0.012 0.004 0.320
#> GSM877135     1  0.2228      0.832 0.912 0.000 0.012 0.008 0.068
#> GSM877136     1  0.2426      0.824 0.900 0.000 0.064 0.000 0.036
#> GSM877137     1  0.3509      0.733 0.792 0.000 0.008 0.004 0.196
#> GSM877139     1  0.2124      0.819 0.900 0.000 0.004 0.000 0.096
#> GSM877149     1  0.2899      0.807 0.872 0.000 0.008 0.020 0.100
#> GSM877154     5  0.4049      0.592 0.004 0.264 0.004 0.004 0.724
#> GSM877157     1  0.2170      0.824 0.904 0.000 0.004 0.004 0.088
#> GSM877160     1  0.1478      0.830 0.936 0.000 0.064 0.000 0.000
#> GSM877161     1  0.2221      0.829 0.912 0.000 0.052 0.000 0.036
#> GSM877163     1  0.1956      0.826 0.916 0.000 0.008 0.000 0.076
#> GSM877166     1  0.2221      0.829 0.912 0.000 0.052 0.000 0.036
#> GSM877167     5  0.4430      0.529 0.000 0.360 0.012 0.000 0.628
#> GSM877175     1  0.1410      0.831 0.940 0.000 0.060 0.000 0.000
#> GSM877177     1  0.1644      0.833 0.940 0.000 0.004 0.008 0.048
#> GSM877184     1  0.4305      0.628 0.688 0.000 0.012 0.004 0.296
#> GSM877187     5  0.4025      0.594 0.020 0.080 0.056 0.012 0.832
#> GSM877188     1  0.1478      0.830 0.936 0.000 0.064 0.000 0.000
#> GSM877150     1  0.2426      0.824 0.900 0.000 0.064 0.000 0.036
#> GSM877165     2  0.2017      0.801 0.000 0.912 0.008 0.000 0.080
#> GSM877183     5  0.4140      0.526 0.008 0.024 0.068 0.076 0.824
#> GSM877178     3  0.3441      0.857 0.088 0.000 0.848 0.056 0.008
#> GSM877182     5  0.5822      0.458 0.124 0.040 0.036 0.076 0.724

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0508    0.78085 0.000 0.000 0.004 0.984 0.000 0.012
#> GSM877128     3  0.3231    0.82602 0.024 0.000 0.848 0.052 0.000 0.076
#> GSM877164     3  0.1765    0.87905 0.096 0.000 0.904 0.000 0.000 0.000
#> GSM877162     4  0.3192    0.75040 0.000 0.028 0.004 0.844 0.016 0.108
#> GSM877127     6  0.7202    0.39829 0.012 0.000 0.116 0.192 0.196 0.484
#> GSM877138     6  0.6480    0.04640 0.008 0.000 0.088 0.380 0.068 0.456
#> GSM877140     4  0.5734   -0.05938 0.004 0.000 0.096 0.500 0.016 0.384
#> GSM877156     5  0.3421    0.37739 0.000 0.028 0.004 0.004 0.804 0.160
#> GSM877130     2  0.1556    0.84493 0.000 0.920 0.000 0.000 0.080 0.000
#> GSM877141     5  0.7199    0.00642 0.000 0.260 0.060 0.008 0.352 0.320
#> GSM877142     2  0.0405    0.83785 0.000 0.988 0.000 0.000 0.004 0.008
#> GSM877145     5  0.4070    0.43751 0.004 0.092 0.000 0.000 0.760 0.144
#> GSM877151     2  0.1563    0.84646 0.000 0.932 0.000 0.000 0.056 0.012
#> GSM877158     2  0.0862    0.83364 0.000 0.972 0.008 0.000 0.004 0.016
#> GSM877173     5  0.4825    0.20447 0.000 0.392 0.012 0.000 0.560 0.036
#> GSM877176     5  0.4843    0.27806 0.004 0.092 0.000 0.000 0.652 0.252
#> GSM877179     2  0.0964    0.83269 0.000 0.968 0.012 0.000 0.004 0.016
#> GSM877181     2  0.4473    0.10786 0.000 0.492 0.000 0.000 0.480 0.028
#> GSM877185     2  0.2730    0.80096 0.000 0.836 0.000 0.000 0.152 0.012
#> GSM877131     2  0.3525    0.78048 0.000 0.816 0.000 0.008 0.080 0.096
#> GSM877147     4  0.0508    0.78085 0.000 0.000 0.004 0.984 0.000 0.012
#> GSM877155     2  0.2209    0.84087 0.000 0.900 0.000 0.004 0.072 0.024
#> GSM877159     4  0.3460    0.74093 0.000 0.024 0.004 0.820 0.020 0.132
#> GSM877170     5  0.6147   -0.17543 0.004 0.048 0.072 0.004 0.464 0.408
#> GSM877186     1  0.3993    0.77503 0.776 0.004 0.012 0.052 0.000 0.156
#> GSM877132     5  0.4185    0.41602 0.004 0.084 0.000 0.000 0.744 0.168
#> GSM877143     5  0.5460    0.47445 0.004 0.116 0.000 0.000 0.524 0.356
#> GSM877146     5  0.5460    0.47445 0.004 0.116 0.000 0.000 0.524 0.356
#> GSM877148     5  0.4979    0.53552 0.000 0.116 0.004 0.000 0.648 0.232
#> GSM877152     5  0.4731    0.53738 0.000 0.092 0.004 0.000 0.672 0.232
#> GSM877168     5  0.5001    0.53486 0.000 0.116 0.004 0.000 0.644 0.236
#> GSM877180     5  0.5001    0.53486 0.000 0.116 0.004 0.000 0.644 0.236
#> GSM877126     3  0.3203    0.82155 0.020 0.000 0.848 0.052 0.000 0.080
#> GSM877129     3  0.1116    0.86788 0.008 0.000 0.960 0.004 0.000 0.028
#> GSM877133     1  0.3254    0.73544 0.820 0.000 0.124 0.000 0.000 0.056
#> GSM877153     4  0.1334    0.77322 0.000 0.000 0.032 0.948 0.000 0.020
#> GSM877169     1  0.4101    0.44081 0.664 0.000 0.308 0.000 0.000 0.028
#> GSM877171     3  0.1814    0.87533 0.100 0.000 0.900 0.000 0.000 0.000
#> GSM877174     3  0.1765    0.87905 0.096 0.000 0.904 0.000 0.000 0.000
#> GSM877134     1  0.5968    0.35056 0.484 0.000 0.000 0.004 0.236 0.276
#> GSM877135     1  0.3056    0.78914 0.804 0.004 0.000 0.000 0.008 0.184
#> GSM877136     1  0.2011    0.78976 0.912 0.004 0.020 0.000 0.000 0.064
#> GSM877137     1  0.4596    0.69154 0.672 0.000 0.000 0.000 0.088 0.240
#> GSM877139     1  0.3534    0.76918 0.772 0.000 0.004 0.000 0.024 0.200
#> GSM877149     1  0.4616    0.67753 0.684 0.000 0.000 0.004 0.084 0.228
#> GSM877154     5  0.1777    0.52085 0.000 0.044 0.004 0.000 0.928 0.024
#> GSM877157     1  0.3158    0.77943 0.812 0.000 0.004 0.000 0.020 0.164
#> GSM877160     1  0.1418    0.79787 0.944 0.000 0.032 0.000 0.000 0.024
#> GSM877161     1  0.2069    0.78985 0.908 0.004 0.020 0.000 0.000 0.068
#> GSM877163     1  0.3621    0.76592 0.772 0.000 0.004 0.000 0.032 0.192
#> GSM877166     1  0.2126    0.79087 0.904 0.004 0.020 0.000 0.000 0.072
#> GSM877167     5  0.2558    0.54292 0.000 0.104 0.000 0.000 0.868 0.028
#> GSM877175     1  0.1341    0.79915 0.948 0.000 0.028 0.000 0.000 0.024
#> GSM877177     1  0.2755    0.79186 0.844 0.000 0.000 0.004 0.012 0.140
#> GSM877184     1  0.5280    0.56611 0.572 0.000 0.000 0.004 0.108 0.316
#> GSM877187     5  0.3835    0.36941 0.004 0.000 0.004 0.000 0.656 0.336
#> GSM877188     1  0.1334    0.79839 0.948 0.000 0.032 0.000 0.000 0.020
#> GSM877150     1  0.2011    0.78976 0.912 0.004 0.020 0.000 0.000 0.064
#> GSM877165     2  0.3141    0.75502 0.000 0.788 0.000 0.000 0.200 0.012
#> GSM877183     5  0.5290   -0.15328 0.004 0.000 0.052 0.016 0.520 0.408
#> GSM877178     3  0.1003    0.88464 0.028 0.000 0.964 0.004 0.000 0.004
#> GSM877182     6  0.5352   -0.05703 0.036 0.000 0.008 0.024 0.452 0.480

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-kmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) genotype/variation(p) other(p) k
#> MAD:kmeans 62           0.2236                0.5665 1.86e-07 2
#> MAD:kmeans 57           0.0247                0.0207 5.97e-10 3
#> MAD:kmeans 50           0.0115                0.0130 9.44e-12 4
#> MAD:kmeans 55           0.0971                0.0230 7.15e-16 5
#> MAD:kmeans 44           0.1723                0.2970 6.79e-17 6

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


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

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.973       0.989         0.5082 0.492   0.492
#> 3 3 1.000           0.962       0.980         0.3063 0.791   0.597
#> 4 4 0.733           0.575       0.773         0.1014 0.896   0.708
#> 5 5 0.771           0.779       0.856         0.0756 0.846   0.524
#> 6 6 0.754           0.634       0.810         0.0413 0.941   0.749

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
#> GSM877144     1   0.000      0.985 1.000 0.000
#> GSM877128     1   0.000      0.985 1.000 0.000
#> GSM877164     1   0.000      0.985 1.000 0.000
#> GSM877162     2   0.000      0.993 0.000 1.000
#> GSM877127     1   0.000      0.985 1.000 0.000
#> GSM877138     1   0.000      0.985 1.000 0.000
#> GSM877140     1   0.000      0.985 1.000 0.000
#> GSM877156     2   0.000      0.993 0.000 1.000
#> GSM877130     2   0.000      0.993 0.000 1.000
#> GSM877141     2   0.000      0.993 0.000 1.000
#> GSM877142     2   0.000      0.993 0.000 1.000
#> GSM877145     2   0.000      0.993 0.000 1.000
#> GSM877151     2   0.000      0.993 0.000 1.000
#> GSM877158     2   0.000      0.993 0.000 1.000
#> GSM877173     2   0.000      0.993 0.000 1.000
#> GSM877176     2   0.000      0.993 0.000 1.000
#> GSM877179     2   0.000      0.993 0.000 1.000
#> GSM877181     2   0.000      0.993 0.000 1.000
#> GSM877185     2   0.000      0.993 0.000 1.000
#> GSM877131     2   0.000      0.993 0.000 1.000
#> GSM877147     2   0.706      0.759 0.192 0.808
#> GSM877155     2   0.000      0.993 0.000 1.000
#> GSM877159     2   0.000      0.993 0.000 1.000
#> GSM877170     2   0.000      0.993 0.000 1.000
#> GSM877186     1   0.000      0.985 1.000 0.000
#> GSM877132     2   0.000      0.993 0.000 1.000
#> GSM877143     2   0.000      0.993 0.000 1.000
#> GSM877146     2   0.000      0.993 0.000 1.000
#> GSM877148     2   0.000      0.993 0.000 1.000
#> GSM877152     2   0.000      0.993 0.000 1.000
#> GSM877168     2   0.000      0.993 0.000 1.000
#> GSM877180     2   0.000      0.993 0.000 1.000
#> GSM877126     1   0.000      0.985 1.000 0.000
#> GSM877129     1   0.000      0.985 1.000 0.000
#> GSM877133     1   0.000      0.985 1.000 0.000
#> GSM877153     1   0.000      0.985 1.000 0.000
#> GSM877169     1   0.000      0.985 1.000 0.000
#> GSM877171     1   0.000      0.985 1.000 0.000
#> GSM877174     1   0.000      0.985 1.000 0.000
#> GSM877134     1   0.311      0.930 0.944 0.056
#> GSM877135     1   0.000      0.985 1.000 0.000
#> GSM877136     1   0.000      0.985 1.000 0.000
#> GSM877137     1   0.000      0.985 1.000 0.000
#> GSM877139     1   0.000      0.985 1.000 0.000
#> GSM877149     1   0.000      0.985 1.000 0.000
#> GSM877154     2   0.000      0.993 0.000 1.000
#> GSM877157     1   0.000      0.985 1.000 0.000
#> GSM877160     1   0.000      0.985 1.000 0.000
#> GSM877161     1   0.000      0.985 1.000 0.000
#> GSM877163     1   0.000      0.985 1.000 0.000
#> GSM877166     1   0.000      0.985 1.000 0.000
#> GSM877167     2   0.000      0.993 0.000 1.000
#> GSM877175     1   0.000      0.985 1.000 0.000
#> GSM877177     1   0.000      0.985 1.000 0.000
#> GSM877184     1   0.000      0.985 1.000 0.000
#> GSM877187     2   0.000      0.993 0.000 1.000
#> GSM877188     1   0.000      0.985 1.000 0.000
#> GSM877150     1   0.000      0.985 1.000 0.000
#> GSM877165     2   0.000      0.993 0.000 1.000
#> GSM877183     2   0.000      0.993 0.000 1.000
#> GSM877178     1   0.000      0.985 1.000 0.000
#> GSM877182     1   0.973      0.315 0.596 0.404

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.0424      0.963 0.008 0.000 0.992
#> GSM877128     3  0.1411      0.949 0.036 0.000 0.964
#> GSM877164     1  0.1411      0.969 0.964 0.000 0.036
#> GSM877162     3  0.1753      0.941 0.000 0.048 0.952
#> GSM877127     3  0.0424      0.963 0.008 0.000 0.992
#> GSM877138     3  0.0475      0.962 0.004 0.004 0.992
#> GSM877140     3  0.0424      0.963 0.008 0.000 0.992
#> GSM877156     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877130     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877141     2  0.5529      0.572 0.000 0.704 0.296
#> GSM877142     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877145     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877151     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877158     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877173     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877176     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877179     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877181     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877185     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877131     2  0.4346      0.765 0.000 0.816 0.184
#> GSM877147     3  0.0000      0.961 0.000 0.000 1.000
#> GSM877155     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877159     3  0.1643      0.946 0.000 0.044 0.956
#> GSM877170     3  0.3412      0.857 0.000 0.124 0.876
#> GSM877186     1  0.0237      0.992 0.996 0.000 0.004
#> GSM877132     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877143     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877146     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877148     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877152     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877168     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877180     2  0.0000      0.975 0.000 1.000 0.000
#> GSM877126     3  0.0424      0.963 0.008 0.000 0.992
#> GSM877129     3  0.0892      0.959 0.020 0.000 0.980
#> GSM877133     1  0.0892      0.981 0.980 0.000 0.020
#> GSM877153     3  0.0424      0.963 0.008 0.000 0.992
#> GSM877169     1  0.0237      0.992 0.996 0.000 0.004
#> GSM877171     1  0.1031      0.979 0.976 0.000 0.024
#> GSM877174     1  0.1411      0.969 0.964 0.000 0.036
#> GSM877134     1  0.0424      0.987 0.992 0.000 0.008
#> GSM877135     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877136     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877137     1  0.0237      0.991 0.996 0.004 0.000
#> GSM877139     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877149     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877154     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877157     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877160     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877161     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877163     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877166     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877167     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877175     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877177     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877184     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877187     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877188     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877150     1  0.0000      0.994 1.000 0.000 0.000
#> GSM877165     2  0.0424      0.975 0.000 0.992 0.008
#> GSM877183     3  0.1860      0.936 0.000 0.052 0.948
#> GSM877178     3  0.4062      0.815 0.164 0.000 0.836
#> GSM877182     3  0.0661      0.961 0.008 0.004 0.988

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     4  0.4967    0.00112 0.000 0.000 0.452 0.548
#> GSM877128     3  0.1118    0.48572 0.036 0.000 0.964 0.000
#> GSM877164     3  0.4679    0.32338 0.352 0.000 0.648 0.000
#> GSM877162     4  0.6023    0.20149 0.000 0.056 0.344 0.600
#> GSM877127     3  0.5088    0.06136 0.004 0.000 0.572 0.424
#> GSM877138     3  0.5168   -0.05480 0.000 0.004 0.504 0.492
#> GSM877140     3  0.4996   -0.02888 0.000 0.000 0.516 0.484
#> GSM877156     2  0.4955    0.72264 0.000 0.556 0.000 0.444
#> GSM877130     2  0.4776    0.77981 0.000 0.624 0.000 0.376
#> GSM877141     2  0.6102    0.62684 0.000 0.532 0.048 0.420
#> GSM877142     2  0.4543    0.78540 0.000 0.676 0.000 0.324
#> GSM877145     2  0.4925    0.74488 0.000 0.572 0.000 0.428
#> GSM877151     2  0.3907    0.78485 0.000 0.768 0.000 0.232
#> GSM877158     2  0.4564    0.78480 0.000 0.672 0.000 0.328
#> GSM877173     2  0.4564    0.78827 0.000 0.672 0.000 0.328
#> GSM877176     4  0.5000   -0.72434 0.000 0.500 0.000 0.500
#> GSM877179     2  0.4585    0.78456 0.000 0.668 0.000 0.332
#> GSM877181     2  0.4790    0.77750 0.000 0.620 0.000 0.380
#> GSM877185     2  0.4761    0.78057 0.000 0.628 0.000 0.372
#> GSM877131     4  0.5408   -0.52512 0.000 0.488 0.012 0.500
#> GSM877147     4  0.5517    0.09831 0.000 0.020 0.412 0.568
#> GSM877155     2  0.4331    0.78578 0.000 0.712 0.000 0.288
#> GSM877159     4  0.6163    0.17738 0.000 0.060 0.364 0.576
#> GSM877170     4  0.5000   -0.07795 0.000 0.000 0.500 0.500
#> GSM877186     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877132     2  0.4925    0.74488 0.000 0.572 0.000 0.428
#> GSM877143     2  0.0469    0.69242 0.000 0.988 0.000 0.012
#> GSM877146     2  0.0469    0.69242 0.000 0.988 0.000 0.012
#> GSM877148     2  0.0188    0.70415 0.000 0.996 0.000 0.004
#> GSM877152     2  0.0000    0.70199 0.000 1.000 0.000 0.000
#> GSM877168     2  0.0000    0.70199 0.000 1.000 0.000 0.000
#> GSM877180     2  0.0000    0.70199 0.000 1.000 0.000 0.000
#> GSM877126     3  0.0000    0.46212 0.000 0.000 1.000 0.000
#> GSM877129     3  0.0817    0.48067 0.024 0.000 0.976 0.000
#> GSM877133     1  0.4661    0.41648 0.652 0.000 0.348 0.000
#> GSM877153     3  0.4992   -0.01711 0.000 0.000 0.524 0.476
#> GSM877169     1  0.4941    0.19432 0.564 0.000 0.436 0.000
#> GSM877171     3  0.4713    0.30544 0.360 0.000 0.640 0.000
#> GSM877174     3  0.4697    0.31511 0.356 0.000 0.644 0.000
#> GSM877134     1  0.2973    0.78595 0.856 0.000 0.000 0.144
#> GSM877135     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877136     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877137     1  0.0592    0.92130 0.984 0.016 0.000 0.000
#> GSM877139     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877149     1  0.1557    0.88698 0.944 0.000 0.000 0.056
#> GSM877154     2  0.3356    0.74573 0.000 0.824 0.000 0.176
#> GSM877157     1  0.0336    0.92847 0.992 0.000 0.000 0.008
#> GSM877160     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877163     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877166     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877167     2  0.4072    0.77685 0.000 0.748 0.000 0.252
#> GSM877175     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877177     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877184     1  0.0336    0.92885 0.992 0.000 0.000 0.008
#> GSM877187     2  0.2281    0.66576 0.000 0.904 0.000 0.096
#> GSM877188     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877150     1  0.0000    0.93337 1.000 0.000 0.000 0.000
#> GSM877165     2  0.4776    0.77889 0.000 0.624 0.000 0.376
#> GSM877183     4  0.6375    0.17982 0.000 0.088 0.312 0.600
#> GSM877178     3  0.2589    0.48769 0.116 0.000 0.884 0.000
#> GSM877182     4  0.3988    0.20712 0.020 0.004 0.156 0.820

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.1410     0.8731 0.000 0.000 0.060 0.940 0.000
#> GSM877128     3  0.2171     0.8002 0.024 0.000 0.912 0.064 0.000
#> GSM877164     3  0.1792     0.8284 0.084 0.000 0.916 0.000 0.000
#> GSM877162     4  0.1648     0.8529 0.000 0.040 0.000 0.940 0.020
#> GSM877127     4  0.4046     0.6515 0.000 0.000 0.296 0.696 0.008
#> GSM877138     4  0.2305     0.8699 0.000 0.000 0.092 0.896 0.012
#> GSM877140     4  0.2818     0.8544 0.000 0.000 0.132 0.856 0.012
#> GSM877156     2  0.4387     0.6529 0.000 0.744 0.004 0.044 0.208
#> GSM877130     2  0.2727     0.7495 0.000 0.888 0.012 0.020 0.080
#> GSM877141     2  0.4519     0.7172 0.000 0.784 0.036 0.052 0.128
#> GSM877142     2  0.3359     0.7330 0.000 0.848 0.016 0.024 0.112
#> GSM877145     2  0.3547     0.6994 0.000 0.824 0.016 0.016 0.144
#> GSM877151     2  0.4296     0.6726 0.000 0.756 0.016 0.024 0.204
#> GSM877158     2  0.3282     0.7375 0.000 0.860 0.024 0.024 0.092
#> GSM877173     2  0.3095     0.7471 0.000 0.868 0.024 0.016 0.092
#> GSM877176     2  0.3495     0.6991 0.000 0.844 0.024 0.024 0.108
#> GSM877179     2  0.3391     0.7378 0.000 0.852 0.024 0.024 0.100
#> GSM877181     2  0.1697     0.7375 0.000 0.932 0.008 0.000 0.060
#> GSM877185     2  0.1591     0.7445 0.000 0.940 0.004 0.004 0.052
#> GSM877131     2  0.5161     0.6730 0.000 0.728 0.020 0.136 0.116
#> GSM877147     4  0.0771     0.8687 0.000 0.004 0.020 0.976 0.000
#> GSM877155     2  0.3942     0.7204 0.000 0.804 0.016 0.032 0.148
#> GSM877159     4  0.1211     0.8603 0.000 0.024 0.000 0.960 0.016
#> GSM877170     2  0.6696     0.2218 0.000 0.476 0.392 0.056 0.076
#> GSM877186     1  0.0798     0.9495 0.976 0.000 0.016 0.008 0.000
#> GSM877132     2  0.3856     0.6907 0.000 0.812 0.032 0.016 0.140
#> GSM877143     5  0.3218     0.9162 0.000 0.128 0.004 0.024 0.844
#> GSM877146     5  0.3218     0.9162 0.000 0.128 0.004 0.024 0.844
#> GSM877148     5  0.2813     0.9022 0.000 0.168 0.000 0.000 0.832
#> GSM877152     5  0.2605     0.9194 0.000 0.148 0.000 0.000 0.852
#> GSM877168     5  0.2230     0.9332 0.000 0.116 0.000 0.000 0.884
#> GSM877180     5  0.2230     0.9332 0.000 0.116 0.000 0.000 0.884
#> GSM877126     3  0.1952     0.7730 0.004 0.000 0.912 0.084 0.000
#> GSM877129     3  0.1571     0.7884 0.004 0.000 0.936 0.060 0.000
#> GSM877133     3  0.4304     0.2050 0.484 0.000 0.516 0.000 0.000
#> GSM877153     4  0.2773     0.8368 0.000 0.000 0.164 0.836 0.000
#> GSM877169     3  0.3966     0.5829 0.336 0.000 0.664 0.000 0.000
#> GSM877171     3  0.1851     0.8265 0.088 0.000 0.912 0.000 0.000
#> GSM877174     3  0.1792     0.8284 0.084 0.000 0.916 0.000 0.000
#> GSM877134     1  0.4852     0.7684 0.792 0.072 0.048 0.020 0.068
#> GSM877135     1  0.0290     0.9509 0.992 0.000 0.008 0.000 0.000
#> GSM877136     1  0.0162     0.9522 0.996 0.000 0.004 0.000 0.000
#> GSM877137     1  0.1549     0.9317 0.944 0.000 0.016 0.000 0.040
#> GSM877139     1  0.0703     0.9475 0.976 0.000 0.024 0.000 0.000
#> GSM877149     1  0.3031     0.8795 0.888 0.008 0.036 0.020 0.048
#> GSM877154     2  0.4899     0.0334 0.000 0.524 0.008 0.012 0.456
#> GSM877157     1  0.1041     0.9397 0.964 0.000 0.032 0.000 0.004
#> GSM877160     1  0.1965     0.8825 0.904 0.000 0.096 0.000 0.000
#> GSM877161     1  0.0162     0.9522 0.996 0.000 0.004 0.000 0.000
#> GSM877163     1  0.1041     0.9453 0.964 0.000 0.032 0.000 0.004
#> GSM877166     1  0.0162     0.9522 0.996 0.000 0.004 0.000 0.000
#> GSM877167     2  0.4268     0.3699 0.000 0.648 0.008 0.000 0.344
#> GSM877175     1  0.0703     0.9471 0.976 0.000 0.024 0.000 0.000
#> GSM877177     1  0.0290     0.9525 0.992 0.000 0.008 0.000 0.000
#> GSM877184     1  0.1267     0.9436 0.960 0.004 0.024 0.000 0.012
#> GSM877187     5  0.3570     0.8716 0.000 0.124 0.004 0.044 0.828
#> GSM877188     1  0.1270     0.9280 0.948 0.000 0.052 0.000 0.000
#> GSM877150     1  0.0290     0.9518 0.992 0.000 0.008 0.000 0.000
#> GSM877165     2  0.1502     0.7410 0.000 0.940 0.004 0.000 0.056
#> GSM877183     4  0.5109     0.7001 0.000 0.052 0.040 0.728 0.180
#> GSM877178     3  0.1981     0.8201 0.048 0.000 0.924 0.028 0.000
#> GSM877182     2  0.8399     0.2122 0.048 0.448 0.120 0.280 0.104

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.1176     0.8013 0.000 0.000 0.024 0.956 0.000 0.020
#> GSM877128     3  0.1692     0.8683 0.012 0.000 0.932 0.048 0.000 0.008
#> GSM877164     3  0.1007     0.8898 0.044 0.000 0.956 0.000 0.000 0.000
#> GSM877162     4  0.2898     0.7652 0.000 0.060 0.000 0.868 0.016 0.056
#> GSM877127     4  0.5632     0.5365 0.000 0.000 0.308 0.568 0.028 0.096
#> GSM877138     4  0.3275     0.7961 0.000 0.000 0.064 0.844 0.020 0.072
#> GSM877140     4  0.2933     0.7942 0.000 0.000 0.108 0.852 0.008 0.032
#> GSM877156     6  0.6111     0.0335 0.000 0.404 0.004 0.012 0.156 0.424
#> GSM877130     2  0.1807     0.6218 0.000 0.920 0.000 0.000 0.020 0.060
#> GSM877141     2  0.3820     0.4637 0.000 0.808 0.012 0.028 0.028 0.124
#> GSM877142     2  0.0858     0.6306 0.000 0.968 0.000 0.004 0.028 0.000
#> GSM877145     2  0.4535    -0.0932 0.000 0.488 0.000 0.000 0.032 0.480
#> GSM877151     2  0.1814     0.5975 0.000 0.900 0.000 0.000 0.100 0.000
#> GSM877158     2  0.0964     0.6248 0.000 0.968 0.000 0.004 0.012 0.016
#> GSM877173     2  0.1398     0.6286 0.000 0.940 0.000 0.000 0.008 0.052
#> GSM877176     2  0.4434    -0.0201 0.000 0.520 0.004 0.004 0.012 0.460
#> GSM877179     2  0.1370     0.6143 0.000 0.948 0.000 0.004 0.012 0.036
#> GSM877181     2  0.4040     0.4212 0.000 0.688 0.000 0.000 0.032 0.280
#> GSM877185     2  0.3364     0.5217 0.000 0.780 0.000 0.000 0.024 0.196
#> GSM877131     2  0.4373     0.3943 0.000 0.752 0.000 0.152 0.028 0.068
#> GSM877147     4  0.0820     0.7996 0.000 0.000 0.012 0.972 0.000 0.016
#> GSM877155     2  0.2122     0.6216 0.000 0.916 0.000 0.024 0.032 0.028
#> GSM877159     4  0.2958     0.7657 0.000 0.060 0.000 0.864 0.016 0.060
#> GSM877170     6  0.6528     0.2626 0.000 0.328 0.300 0.012 0.004 0.356
#> GSM877186     1  0.2164     0.8524 0.900 0.000 0.000 0.068 0.000 0.032
#> GSM877132     6  0.4555    -0.0303 0.000 0.424 0.000 0.000 0.036 0.540
#> GSM877143     5  0.4253     0.7310 0.000 0.100 0.008 0.016 0.776 0.100
#> GSM877146     5  0.4253     0.7310 0.000 0.100 0.008 0.016 0.776 0.100
#> GSM877148     5  0.2980     0.7103 0.000 0.180 0.000 0.000 0.808 0.012
#> GSM877152     5  0.2629     0.7496 0.000 0.068 0.000 0.000 0.872 0.060
#> GSM877168     5  0.1625     0.7754 0.000 0.060 0.000 0.000 0.928 0.012
#> GSM877180     5  0.1625     0.7754 0.000 0.060 0.000 0.000 0.928 0.012
#> GSM877126     3  0.0858     0.8655 0.000 0.000 0.968 0.028 0.000 0.004
#> GSM877129     3  0.1053     0.8750 0.004 0.012 0.964 0.020 0.000 0.000
#> GSM877133     1  0.4446     0.0719 0.532 0.000 0.444 0.004 0.000 0.020
#> GSM877153     4  0.2593     0.7738 0.000 0.000 0.148 0.844 0.000 0.008
#> GSM877169     3  0.4343     0.3332 0.384 0.000 0.592 0.000 0.004 0.020
#> GSM877171     3  0.1141     0.8844 0.052 0.000 0.948 0.000 0.000 0.000
#> GSM877174     3  0.1007     0.8898 0.044 0.000 0.956 0.000 0.000 0.000
#> GSM877134     1  0.4245     0.5308 0.604 0.000 0.016 0.000 0.004 0.376
#> GSM877135     1  0.0363     0.8865 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM877136     1  0.0000     0.8863 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.2078     0.8723 0.912 0.000 0.004 0.000 0.044 0.040
#> GSM877139     1  0.1226     0.8848 0.952 0.000 0.004 0.000 0.004 0.040
#> GSM877149     1  0.4013     0.6900 0.712 0.000 0.016 0.008 0.004 0.260
#> GSM877154     5  0.6089    -0.1245 0.000 0.236 0.000 0.004 0.432 0.328
#> GSM877157     1  0.1471     0.8756 0.932 0.000 0.000 0.000 0.004 0.064
#> GSM877160     1  0.2290     0.8438 0.892 0.000 0.084 0.000 0.004 0.020
#> GSM877161     1  0.0146     0.8861 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM877163     1  0.2656     0.8544 0.860 0.000 0.012 0.000 0.008 0.120
#> GSM877166     1  0.0000     0.8863 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877167     2  0.6083    -0.0941 0.000 0.396 0.000 0.000 0.308 0.296
#> GSM877175     1  0.1390     0.8796 0.948 0.000 0.032 0.000 0.004 0.016
#> GSM877177     1  0.0993     0.8854 0.964 0.000 0.000 0.012 0.000 0.024
#> GSM877184     1  0.3023     0.8273 0.828 0.000 0.032 0.000 0.000 0.140
#> GSM877187     5  0.4009     0.6824 0.000 0.024 0.004 0.024 0.764 0.184
#> GSM877188     1  0.1624     0.8736 0.936 0.000 0.040 0.000 0.004 0.020
#> GSM877150     1  0.0260     0.8863 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM877165     2  0.4024     0.4369 0.000 0.700 0.000 0.000 0.036 0.264
#> GSM877183     4  0.6584     0.4342 0.000 0.028 0.020 0.516 0.188 0.248
#> GSM877178     3  0.0972     0.8893 0.028 0.000 0.964 0.008 0.000 0.000
#> GSM877182     6  0.6034     0.2984 0.020 0.104 0.032 0.208 0.008 0.628

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-skmeans-collect-classes

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

test_to_known_factors(res)
#>              n disease.state(p) genotype/variation(p) other(p) k
#> MAD:skmeans 61           0.1989                0.5482 1.14e-07 2
#> MAD:skmeans 62           0.0803                0.0247 6.48e-12 3
#> MAD:skmeans 40           1.0000                0.3509 1.49e-05 4
#> MAD:skmeans 57           0.1768                0.0113 6.49e-22 5
#> MAD:skmeans 47           0.1537                0.0034 2.62e-20 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 62 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 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-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.601           0.836       0.914         0.4253 0.627   0.627
#> 3 3 0.476           0.742       0.844         0.4052 0.835   0.737
#> 4 4 0.545           0.602       0.809         0.2126 0.704   0.421
#> 5 5 0.613           0.486       0.752         0.0488 0.958   0.848
#> 6 6 0.650           0.403       0.676         0.0524 0.870   0.545

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM877144     1  0.0000      0.877 1.000 0.000
#> GSM877128     1  0.0000      0.877 1.000 0.000
#> GSM877164     1  0.0000      0.877 1.000 0.000
#> GSM877162     2  0.0000      0.995 0.000 1.000
#> GSM877127     1  0.0000      0.877 1.000 0.000
#> GSM877138     1  0.0376      0.876 0.996 0.004
#> GSM877140     1  0.0000      0.877 1.000 0.000
#> GSM877156     2  0.0376      0.992 0.004 0.996
#> GSM877130     2  0.0000      0.995 0.000 1.000
#> GSM877141     1  0.9661      0.540 0.608 0.392
#> GSM877142     2  0.0000      0.995 0.000 1.000
#> GSM877145     1  0.9732      0.521 0.596 0.404
#> GSM877151     2  0.0000      0.995 0.000 1.000
#> GSM877158     2  0.0000      0.995 0.000 1.000
#> GSM877173     1  0.9866      0.465 0.568 0.432
#> GSM877176     2  0.0000      0.995 0.000 1.000
#> GSM877179     2  0.0000      0.995 0.000 1.000
#> GSM877181     2  0.0000      0.995 0.000 1.000
#> GSM877185     2  0.0000      0.995 0.000 1.000
#> GSM877131     2  0.0000      0.995 0.000 1.000
#> GSM877147     2  0.1633      0.972 0.024 0.976
#> GSM877155     2  0.0000      0.995 0.000 1.000
#> GSM877159     2  0.1633      0.972 0.024 0.976
#> GSM877170     1  0.9608      0.551 0.616 0.384
#> GSM877186     1  0.0000      0.877 1.000 0.000
#> GSM877132     1  0.9732      0.521 0.596 0.404
#> GSM877143     1  0.8144      0.712 0.748 0.252
#> GSM877146     1  0.9044      0.637 0.680 0.320
#> GSM877148     1  0.9427      0.585 0.640 0.360
#> GSM877152     1  0.5737      0.811 0.864 0.136
#> GSM877168     1  0.9661      0.543 0.608 0.392
#> GSM877180     1  0.5842      0.808 0.860 0.140
#> GSM877126     1  0.0000      0.877 1.000 0.000
#> GSM877129     1  0.0000      0.877 1.000 0.000
#> GSM877133     1  0.0000      0.877 1.000 0.000
#> GSM877153     1  0.0000      0.877 1.000 0.000
#> GSM877169     1  0.0000      0.877 1.000 0.000
#> GSM877171     1  0.0000      0.877 1.000 0.000
#> GSM877174     1  0.0000      0.877 1.000 0.000
#> GSM877134     1  0.5178      0.820 0.884 0.116
#> GSM877135     1  0.0000      0.877 1.000 0.000
#> GSM877136     1  0.0000      0.877 1.000 0.000
#> GSM877137     1  0.0000      0.877 1.000 0.000
#> GSM877139     1  0.0000      0.877 1.000 0.000
#> GSM877149     1  0.0000      0.877 1.000 0.000
#> GSM877154     1  0.9815      0.491 0.580 0.420
#> GSM877157     1  0.0000      0.877 1.000 0.000
#> GSM877160     1  0.0000      0.877 1.000 0.000
#> GSM877161     1  0.0000      0.877 1.000 0.000
#> GSM877163     1  0.0000      0.877 1.000 0.000
#> GSM877166     1  0.0000      0.877 1.000 0.000
#> GSM877167     1  0.9795      0.499 0.584 0.416
#> GSM877175     1  0.0000      0.877 1.000 0.000
#> GSM877177     1  0.0000      0.877 1.000 0.000
#> GSM877184     1  0.0376      0.876 0.996 0.004
#> GSM877187     1  0.6623      0.786 0.828 0.172
#> GSM877188     1  0.0000      0.877 1.000 0.000
#> GSM877150     1  0.0000      0.877 1.000 0.000
#> GSM877165     2  0.0000      0.995 0.000 1.000
#> GSM877183     1  0.6048      0.804 0.852 0.148
#> GSM877178     1  0.0000      0.877 1.000 0.000
#> GSM877182     1  0.9580      0.555 0.620 0.380

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     1  0.3043     0.7562 0.908 0.008 0.084
#> GSM877128     3  0.5254     0.6514 0.264 0.000 0.736
#> GSM877164     3  0.0000     0.8855 0.000 0.000 1.000
#> GSM877162     2  0.0000     0.9513 0.000 1.000 0.000
#> GSM877127     1  0.1129     0.7507 0.976 0.020 0.004
#> GSM877138     1  0.1031     0.7492 0.976 0.024 0.000
#> GSM877140     1  0.6777     0.0481 0.616 0.020 0.364
#> GSM877156     2  0.0237     0.9494 0.004 0.996 0.000
#> GSM877130     2  0.0000     0.9513 0.000 1.000 0.000
#> GSM877141     1  0.5591     0.6092 0.696 0.304 0.000
#> GSM877142     2  0.0000     0.9513 0.000 1.000 0.000
#> GSM877145     1  0.6140     0.5474 0.596 0.404 0.000
#> GSM877151     2  0.0000     0.9513 0.000 1.000 0.000
#> GSM877158     2  0.2165     0.9170 0.064 0.936 0.000
#> GSM877173     1  0.6026     0.5303 0.624 0.376 0.000
#> GSM877176     2  0.1031     0.9349 0.024 0.976 0.000
#> GSM877179     2  0.2537     0.9053 0.080 0.920 0.000
#> GSM877181     2  0.0892     0.9380 0.020 0.980 0.000
#> GSM877185     2  0.0000     0.9513 0.000 1.000 0.000
#> GSM877131     2  0.2165     0.9170 0.064 0.936 0.000
#> GSM877147     2  0.3116     0.8572 0.108 0.892 0.000
#> GSM877155     2  0.0000     0.9513 0.000 1.000 0.000
#> GSM877159     2  0.4235     0.7949 0.176 0.824 0.000
#> GSM877170     1  0.9335     0.2322 0.492 0.184 0.324
#> GSM877186     1  0.4452     0.7328 0.808 0.000 0.192
#> GSM877132     1  0.6140     0.5474 0.596 0.404 0.000
#> GSM877143     1  0.3941     0.7157 0.844 0.156 0.000
#> GSM877146     1  0.4750     0.6766 0.784 0.216 0.000
#> GSM877148     1  0.4887     0.6595 0.772 0.228 0.000
#> GSM877152     1  0.4235     0.7472 0.824 0.176 0.000
#> GSM877168     1  0.6079     0.5678 0.612 0.388 0.000
#> GSM877180     1  0.4235     0.7472 0.824 0.176 0.000
#> GSM877126     3  0.3941     0.8325 0.156 0.000 0.844
#> GSM877129     3  0.4291     0.8147 0.180 0.000 0.820
#> GSM877133     1  0.6180     0.4296 0.584 0.000 0.416
#> GSM877153     3  0.3116     0.8601 0.108 0.000 0.892
#> GSM877169     1  0.6252     0.3674 0.556 0.000 0.444
#> GSM877171     3  0.0000     0.8855 0.000 0.000 1.000
#> GSM877174     3  0.0000     0.8855 0.000 0.000 1.000
#> GSM877134     1  0.2537     0.7614 0.920 0.080 0.000
#> GSM877135     1  0.2537     0.7546 0.920 0.000 0.080
#> GSM877136     1  0.4452     0.7328 0.808 0.000 0.192
#> GSM877137     1  0.0000     0.7514 1.000 0.000 0.000
#> GSM877139     1  0.0747     0.7545 0.984 0.000 0.016
#> GSM877149     1  0.2878     0.7521 0.904 0.000 0.096
#> GSM877154     1  0.6252     0.4972 0.556 0.444 0.000
#> GSM877157     1  0.2878     0.7521 0.904 0.000 0.096
#> GSM877160     1  0.4605     0.7290 0.796 0.000 0.204
#> GSM877161     1  0.4452     0.7328 0.808 0.000 0.192
#> GSM877163     1  0.4235     0.7381 0.824 0.000 0.176
#> GSM877166     1  0.4452     0.7328 0.808 0.000 0.192
#> GSM877167     1  0.6235     0.5090 0.564 0.436 0.000
#> GSM877175     1  0.4452     0.7328 0.808 0.000 0.192
#> GSM877177     1  0.2537     0.7546 0.920 0.000 0.080
#> GSM877184     1  0.0000     0.7514 1.000 0.000 0.000
#> GSM877187     1  0.4452     0.7412 0.808 0.192 0.000
#> GSM877188     1  0.4452     0.7328 0.808 0.000 0.192
#> GSM877150     1  0.5397     0.6908 0.720 0.000 0.280
#> GSM877165     2  0.0000     0.9513 0.000 1.000 0.000
#> GSM877183     1  0.2261     0.7489 0.932 0.068 0.000
#> GSM877178     3  0.0000     0.8855 0.000 0.000 1.000
#> GSM877182     1  0.5363     0.6424 0.724 0.276 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     1  0.6686     0.3740 0.596 0.000 0.128 0.276
#> GSM877128     3  0.4500     0.6360 0.316 0.000 0.684 0.000
#> GSM877164     3  0.3486     0.7834 0.188 0.000 0.812 0.000
#> GSM877162     2  0.0000     0.8117 0.000 1.000 0.000 0.000
#> GSM877127     1  0.7545    -0.0626 0.440 0.000 0.192 0.368
#> GSM877138     4  0.7210     0.4360 0.276 0.000 0.184 0.540
#> GSM877140     4  0.5070     0.7073 0.060 0.000 0.192 0.748
#> GSM877156     2  0.6150     0.3092 0.060 0.580 0.000 0.360
#> GSM877130     2  0.0000     0.8117 0.000 1.000 0.000 0.000
#> GSM877141     4  0.7141     0.6170 0.072 0.160 0.104 0.664
#> GSM877142     2  0.0000     0.8117 0.000 1.000 0.000 0.000
#> GSM877145     1  0.4843     0.3505 0.604 0.396 0.000 0.000
#> GSM877151     2  0.4713     0.3828 0.000 0.640 0.000 0.360
#> GSM877158     2  0.1716     0.7840 0.000 0.936 0.064 0.000
#> GSM877173     2  0.7723     0.1821 0.068 0.508 0.064 0.360
#> GSM877176     1  0.4994     0.1332 0.520 0.480 0.000 0.000
#> GSM877179     2  0.1716     0.7840 0.000 0.936 0.064 0.000
#> GSM877181     2  0.0000     0.8117 0.000 1.000 0.000 0.000
#> GSM877185     2  0.0000     0.8117 0.000 1.000 0.000 0.000
#> GSM877131     2  0.1716     0.7840 0.000 0.936 0.064 0.000
#> GSM877147     4  0.4816     0.7221 0.004 0.080 0.124 0.792
#> GSM877155     2  0.0188     0.8107 0.000 0.996 0.004 0.000
#> GSM877159     4  0.3479     0.7330 0.000 0.012 0.148 0.840
#> GSM877170     3  0.5727     0.5235 0.096 0.200 0.704 0.000
#> GSM877186     1  0.0336     0.6932 0.992 0.000 0.008 0.000
#> GSM877132     1  0.5268     0.3351 0.592 0.396 0.000 0.012
#> GSM877143     4  0.0000     0.7370 0.000 0.000 0.000 1.000
#> GSM877146     4  0.0000     0.7370 0.000 0.000 0.000 1.000
#> GSM877148     4  0.4401     0.6864 0.076 0.112 0.000 0.812
#> GSM877152     4  0.4356     0.5444 0.292 0.000 0.000 0.708
#> GSM877168     4  0.0000     0.7370 0.000 0.000 0.000 1.000
#> GSM877180     4  0.1302     0.7462 0.044 0.000 0.000 0.956
#> GSM877126     3  0.0188     0.7099 0.004 0.000 0.996 0.000
#> GSM877129     3  0.0188     0.7111 0.004 0.000 0.996 0.000
#> GSM877133     3  0.4998     0.4860 0.488 0.000 0.512 0.000
#> GSM877153     3  0.1557     0.7478 0.056 0.000 0.944 0.000
#> GSM877169     3  0.4989     0.5207 0.472 0.000 0.528 0.000
#> GSM877171     3  0.3486     0.7834 0.188 0.000 0.812 0.000
#> GSM877174     3  0.3486     0.7834 0.188 0.000 0.812 0.000
#> GSM877134     1  0.4356     0.7025 0.812 0.064 0.124 0.000
#> GSM877135     1  0.3161     0.7141 0.864 0.000 0.124 0.012
#> GSM877136     1  0.0336     0.6932 0.992 0.000 0.008 0.000
#> GSM877137     1  0.3946     0.7005 0.812 0.000 0.168 0.020
#> GSM877139     1  0.3806     0.7057 0.824 0.000 0.156 0.020
#> GSM877149     1  0.2704     0.7141 0.876 0.000 0.124 0.000
#> GSM877154     4  0.7631     0.1711 0.224 0.320 0.000 0.456
#> GSM877157     1  0.2704     0.7141 0.876 0.000 0.124 0.000
#> GSM877160     1  0.4500     0.0628 0.684 0.000 0.316 0.000
#> GSM877161     1  0.0336     0.6932 0.992 0.000 0.008 0.000
#> GSM877163     1  0.0000     0.6952 1.000 0.000 0.000 0.000
#> GSM877166     1  0.0336     0.6932 0.992 0.000 0.008 0.000
#> GSM877167     2  0.6971     0.1393 0.120 0.508 0.000 0.372
#> GSM877175     1  0.0336     0.6932 0.992 0.000 0.008 0.000
#> GSM877177     1  0.2704     0.7141 0.876 0.000 0.124 0.000
#> GSM877184     1  0.3626     0.6958 0.812 0.000 0.184 0.004
#> GSM877187     4  0.5676     0.6243 0.136 0.144 0.000 0.720
#> GSM877188     1  0.2530     0.5803 0.888 0.000 0.112 0.000
#> GSM877150     1  0.3356     0.5132 0.824 0.000 0.176 0.000
#> GSM877165     2  0.0000     0.8117 0.000 1.000 0.000 0.000
#> GSM877183     1  0.7509    -0.0324 0.452 0.000 0.188 0.360
#> GSM877178     3  0.3486     0.7834 0.188 0.000 0.812 0.000
#> GSM877182     1  0.6758     0.5313 0.604 0.240 0.156 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
#> GSM877144     4  0.3636     0.3853 0.272 0.000 0.000 0.728 0.000
#> GSM877128     3  0.5754     0.5321 0.292 0.000 0.588 0.120 0.000
#> GSM877164     3  0.1478     0.7381 0.064 0.000 0.936 0.000 0.000
#> GSM877162     2  0.3242     0.6064 0.000 0.784 0.000 0.216 0.000
#> GSM877127     1  0.6615    -0.1693 0.520 0.000 0.076 0.348 0.056
#> GSM877138     1  0.7827    -0.3792 0.352 0.000 0.064 0.320 0.264
#> GSM877140     5  0.6487     0.2123 0.116 0.000 0.064 0.200 0.620
#> GSM877156     2  0.6128     0.2162 0.044 0.568 0.000 0.332 0.056
#> GSM877130     2  0.0000     0.7997 0.000 1.000 0.000 0.000 0.000
#> GSM877141     5  0.8768    -0.0723 0.076 0.176 0.064 0.332 0.352
#> GSM877142     2  0.0000     0.7997 0.000 1.000 0.000 0.000 0.000
#> GSM877145     1  0.4299     0.2772 0.608 0.388 0.000 0.004 0.000
#> GSM877151     2  0.3714     0.6410 0.000 0.812 0.000 0.132 0.056
#> GSM877158     2  0.1478     0.7756 0.000 0.936 0.064 0.000 0.000
#> GSM877173     2  0.6896     0.4396 0.076 0.644 0.064 0.160 0.056
#> GSM877176     1  0.4437     0.1174 0.532 0.464 0.000 0.004 0.000
#> GSM877179     2  0.2260     0.7617 0.000 0.908 0.064 0.028 0.000
#> GSM877181     2  0.0324     0.7978 0.004 0.992 0.000 0.004 0.000
#> GSM877185     2  0.0162     0.7994 0.000 0.996 0.000 0.004 0.000
#> GSM877131     2  0.1478     0.7756 0.000 0.936 0.064 0.000 0.000
#> GSM877147     4  0.5665     0.2808 0.104 0.060 0.000 0.708 0.128
#> GSM877155     2  0.0162     0.7998 0.000 0.996 0.004 0.000 0.000
#> GSM877159     5  0.6889     0.2199 0.072 0.008 0.064 0.332 0.524
#> GSM877170     3  0.4492     0.5113 0.196 0.056 0.744 0.004 0.000
#> GSM877186     1  0.3821     0.6365 0.764 0.000 0.020 0.216 0.000
#> GSM877132     1  0.4564     0.2669 0.600 0.388 0.000 0.004 0.008
#> GSM877143     5  0.0000     0.4916 0.000 0.000 0.000 0.000 1.000
#> GSM877146     5  0.0000     0.4916 0.000 0.000 0.000 0.000 1.000
#> GSM877148     5  0.6214     0.4161 0.076 0.088 0.000 0.184 0.652
#> GSM877152     5  0.6432     0.1747 0.304 0.000 0.000 0.204 0.492
#> GSM877168     5  0.2966     0.5024 0.000 0.000 0.000 0.184 0.816
#> GSM877180     5  0.4031     0.4992 0.044 0.000 0.000 0.184 0.772
#> GSM877126     3  0.0566     0.6965 0.004 0.000 0.984 0.012 0.000
#> GSM877129     3  0.1251     0.6859 0.008 0.000 0.956 0.036 0.000
#> GSM877133     3  0.6386     0.3360 0.340 0.000 0.480 0.180 0.000
#> GSM877153     3  0.4470     0.4478 0.012 0.000 0.616 0.372 0.000
#> GSM877169     3  0.6117     0.3601 0.360 0.000 0.504 0.136 0.000
#> GSM877171     3  0.1478     0.7381 0.064 0.000 0.936 0.000 0.000
#> GSM877174     3  0.1478     0.7381 0.064 0.000 0.936 0.000 0.000
#> GSM877134     1  0.1478     0.6319 0.936 0.064 0.000 0.000 0.000
#> GSM877135     1  0.0290     0.6600 0.992 0.000 0.000 0.000 0.008
#> GSM877136     1  0.3586     0.6461 0.792 0.000 0.020 0.188 0.000
#> GSM877137     1  0.1725     0.6354 0.936 0.000 0.044 0.000 0.020
#> GSM877139     1  0.1750     0.6361 0.936 0.000 0.036 0.000 0.028
#> GSM877149     1  0.0000     0.6616 1.000 0.000 0.000 0.000 0.000
#> GSM877154     4  0.8243     0.0924 0.168 0.308 0.000 0.360 0.164
#> GSM877157     1  0.0000     0.6616 1.000 0.000 0.000 0.000 0.000
#> GSM877160     1  0.6066     0.3086 0.572 0.000 0.240 0.188 0.000
#> GSM877161     1  0.3586     0.6461 0.792 0.000 0.020 0.188 0.000
#> GSM877163     1  0.1892     0.6648 0.916 0.000 0.004 0.080 0.000
#> GSM877166     1  0.3586     0.6461 0.792 0.000 0.020 0.188 0.000
#> GSM877167     2  0.7747     0.0532 0.116 0.480 0.000 0.184 0.220
#> GSM877175     1  0.3586     0.6461 0.792 0.000 0.020 0.188 0.000
#> GSM877177     1  0.0162     0.6626 0.996 0.000 0.000 0.004 0.000
#> GSM877184     1  0.1628     0.6323 0.936 0.000 0.056 0.000 0.008
#> GSM877187     5  0.7505     0.1062 0.296 0.124 0.000 0.104 0.476
#> GSM877188     1  0.4395     0.6116 0.748 0.000 0.064 0.188 0.000
#> GSM877150     1  0.5900     0.4523 0.600 0.000 0.212 0.188 0.000
#> GSM877165     2  0.0162     0.7994 0.000 0.996 0.000 0.004 0.000
#> GSM877183     1  0.6690    -0.1527 0.536 0.008 0.064 0.336 0.056
#> GSM877178     3  0.1877     0.7355 0.064 0.000 0.924 0.012 0.000
#> GSM877182     1  0.4451     0.3717 0.712 0.248 0.040 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
#> GSM877144     4  0.2941     0.6152 0.000 0.000 0.000 0.780 0.000 0.220
#> GSM877128     3  0.4647     0.5252 0.184 0.000 0.704 0.008 0.000 0.104
#> GSM877164     3  0.2941     0.6334 0.220 0.000 0.780 0.000 0.000 0.000
#> GSM877162     2  0.2277     0.5679 0.000 0.892 0.000 0.076 0.000 0.032
#> GSM877127     6  0.5902     0.1644 0.092 0.000 0.248 0.024 0.028 0.608
#> GSM877138     6  0.6680     0.0658 0.036 0.000 0.052 0.196 0.148 0.568
#> GSM877140     5  0.5870     0.0653 0.000 0.000 0.000 0.200 0.436 0.364
#> GSM877156     2  0.4709     0.0683 0.012 0.516 0.000 0.024 0.000 0.448
#> GSM877130     2  0.0000     0.6123 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877141     6  0.6539     0.1283 0.024 0.104 0.000 0.184 0.096 0.592
#> GSM877142     2  0.0000     0.6123 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877145     2  0.5902    -0.0961 0.392 0.404 0.000 0.000 0.000 0.204
#> GSM877151     2  0.3244     0.3513 0.000 0.732 0.000 0.000 0.000 0.268
#> GSM877158     2  0.3126     0.4332 0.000 0.752 0.000 0.000 0.000 0.248
#> GSM877173     6  0.4444    -0.0600 0.028 0.436 0.000 0.000 0.000 0.536
#> GSM877176     2  0.5917    -0.0903 0.388 0.404 0.000 0.000 0.000 0.208
#> GSM877179     2  0.3266     0.4106 0.000 0.728 0.000 0.000 0.000 0.272
#> GSM877181     2  0.0632     0.6119 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM877185     2  0.0632     0.6119 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM877131     2  0.3126     0.4332 0.000 0.752 0.000 0.000 0.000 0.248
#> GSM877147     4  0.1807     0.6168 0.000 0.020 0.000 0.920 0.000 0.060
#> GSM877155     2  0.0146     0.6116 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM877159     6  0.5901    -0.0231 0.000 0.024 0.004 0.224 0.164 0.584
#> GSM877170     3  0.5282     0.3652 0.012 0.032 0.520 0.020 0.000 0.416
#> GSM877186     1  0.0000     0.5667 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877132     2  0.5902    -0.0961 0.392 0.404 0.000 0.000 0.000 0.204
#> GSM877143     5  0.3081     0.3724 0.000 0.000 0.004 0.220 0.776 0.000
#> GSM877146     5  0.3081     0.3724 0.000 0.000 0.004 0.220 0.776 0.000
#> GSM877148     5  0.4670     0.3405 0.028 0.012 0.000 0.000 0.580 0.380
#> GSM877152     6  0.7172    -0.0519 0.060 0.000 0.188 0.020 0.300 0.432
#> GSM877168     5  0.3620     0.3846 0.000 0.000 0.000 0.000 0.648 0.352
#> GSM877180     5  0.4264     0.3702 0.028 0.000 0.000 0.000 0.620 0.352
#> GSM877126     3  0.2994     0.5779 0.004 0.000 0.788 0.000 0.000 0.208
#> GSM877129     3  0.3101     0.5568 0.000 0.000 0.756 0.000 0.000 0.244
#> GSM877133     3  0.4736     0.3794 0.396 0.000 0.552 0.000 0.000 0.052
#> GSM877153     4  0.3690     0.5067 0.000 0.000 0.308 0.684 0.000 0.008
#> GSM877169     3  0.4380     0.4344 0.220 0.000 0.700 0.000 0.000 0.080
#> GSM877171     3  0.2941     0.6334 0.220 0.000 0.780 0.000 0.000 0.000
#> GSM877174     3  0.2941     0.6334 0.220 0.000 0.780 0.000 0.000 0.000
#> GSM877134     1  0.5871     0.6608 0.464 0.000 0.216 0.000 0.000 0.320
#> GSM877135     1  0.5871     0.6608 0.464 0.000 0.216 0.000 0.000 0.320
#> GSM877136     1  0.0000     0.5667 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.5871     0.6608 0.464 0.000 0.216 0.000 0.000 0.320
#> GSM877139     1  0.5871     0.6608 0.464 0.000 0.216 0.000 0.000 0.320
#> GSM877149     1  0.5871     0.6608 0.464 0.000 0.216 0.000 0.000 0.320
#> GSM877154     6  0.6614    -0.0571 0.004 0.324 0.000 0.024 0.240 0.408
#> GSM877157     1  0.5798     0.6602 0.484 0.000 0.204 0.000 0.000 0.312
#> GSM877160     1  0.5044     0.3202 0.536 0.000 0.384 0.000 0.000 0.080
#> GSM877161     1  0.0000     0.5667 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877163     1  0.5764     0.6613 0.504 0.000 0.216 0.000 0.000 0.280
#> GSM877166     1  0.0000     0.5667 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877167     2  0.6193    -0.0814 0.012 0.420 0.000 0.000 0.204 0.364
#> GSM877175     1  0.0000     0.5667 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.5834     0.6625 0.480 0.000 0.216 0.000 0.000 0.304
#> GSM877184     1  0.5871     0.6608 0.464 0.000 0.216 0.000 0.000 0.320
#> GSM877187     5  0.9126     0.0596 0.148 0.076 0.056 0.144 0.304 0.272
#> GSM877188     1  0.2696     0.5809 0.856 0.000 0.116 0.000 0.000 0.028
#> GSM877150     1  0.0713     0.5308 0.972 0.000 0.028 0.000 0.000 0.000
#> GSM877165     2  0.0632     0.6119 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM877183     6  0.3161     0.2563 0.068 0.024 0.000 0.024 0.020 0.864
#> GSM877178     3  0.3787     0.6316 0.100 0.000 0.780 0.000 0.000 0.120
#> GSM877182     6  0.6054    -0.3267 0.412 0.132 0.024 0.000 0.000 0.432

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) genotype/variation(p) other(p) k
#> MAD:pam 59           0.7910                 0.630 8.48e-07 2
#> MAD:pam 57           0.0802                 0.689 4.50e-11 3
#> MAD:pam 48           0.2829                 0.613 2.13e-15 4
#> MAD:pam 35           0.3573                 0.523 3.66e-15 5
#> MAD:pam 33           0.1102                 0.561 1.62e-10 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


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 62 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-mclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.541           0.862       0.915         0.4722 0.500   0.500
#> 3 3 0.951           0.923       0.969         0.4059 0.773   0.572
#> 4 4 0.790           0.743       0.866         0.0653 0.870   0.651
#> 5 5 0.842           0.759       0.869         0.0932 0.901   0.675
#> 6 6 0.875           0.844       0.905         0.0244 0.979   0.908

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
#> GSM877144     1  0.0000      0.948 1.000 0.000
#> GSM877128     1  0.0000      0.948 1.000 0.000
#> GSM877164     1  0.0000      0.948 1.000 0.000
#> GSM877162     1  0.0000      0.948 1.000 0.000
#> GSM877127     1  0.0938      0.941 0.988 0.012
#> GSM877138     1  0.0938      0.941 0.988 0.012
#> GSM877140     1  0.0000      0.948 1.000 0.000
#> GSM877156     2  0.0000      0.855 0.000 1.000
#> GSM877130     2  0.7299      0.859 0.204 0.796
#> GSM877141     1  0.0000      0.948 1.000 0.000
#> GSM877142     1  0.6247      0.768 0.844 0.156
#> GSM877145     2  0.0000      0.855 0.000 1.000
#> GSM877151     1  0.9608      0.203 0.616 0.384
#> GSM877158     1  0.0000      0.948 1.000 0.000
#> GSM877173     2  0.9248      0.667 0.340 0.660
#> GSM877176     2  0.1633      0.857 0.024 0.976
#> GSM877179     1  0.0000      0.948 1.000 0.000
#> GSM877181     2  0.0000      0.855 0.000 1.000
#> GSM877185     2  0.0000      0.855 0.000 1.000
#> GSM877131     1  0.0000      0.948 1.000 0.000
#> GSM877147     1  0.0000      0.948 1.000 0.000
#> GSM877155     1  0.0938      0.941 0.988 0.012
#> GSM877159     1  0.0000      0.948 1.000 0.000
#> GSM877170     1  0.0000      0.948 1.000 0.000
#> GSM877186     1  0.5059      0.835 0.888 0.112
#> GSM877132     2  0.0000      0.855 0.000 1.000
#> GSM877143     2  0.0000      0.855 0.000 1.000
#> GSM877146     2  0.0000      0.855 0.000 1.000
#> GSM877148     2  0.0000      0.855 0.000 1.000
#> GSM877152     2  0.0000      0.855 0.000 1.000
#> GSM877168     2  0.0000      0.855 0.000 1.000
#> GSM877180     2  0.0000      0.855 0.000 1.000
#> GSM877126     1  0.0000      0.948 1.000 0.000
#> GSM877129     1  0.0000      0.948 1.000 0.000
#> GSM877133     1  0.9522      0.261 0.628 0.372
#> GSM877153     1  0.0000      0.948 1.000 0.000
#> GSM877169     1  0.2423      0.918 0.960 0.040
#> GSM877171     1  0.0000      0.948 1.000 0.000
#> GSM877174     1  0.0000      0.948 1.000 0.000
#> GSM877134     2  0.7299      0.859 0.204 0.796
#> GSM877135     2  0.8081      0.813 0.248 0.752
#> GSM877136     2  0.7299      0.859 0.204 0.796
#> GSM877137     2  0.7299      0.859 0.204 0.796
#> GSM877139     2  0.7299      0.859 0.204 0.796
#> GSM877149     2  0.7299      0.859 0.204 0.796
#> GSM877154     2  0.0000      0.855 0.000 1.000
#> GSM877157     2  0.7299      0.859 0.204 0.796
#> GSM877160     2  0.7299      0.859 0.204 0.796
#> GSM877161     2  0.7299      0.859 0.204 0.796
#> GSM877163     2  0.7815      0.831 0.232 0.768
#> GSM877166     2  0.7299      0.859 0.204 0.796
#> GSM877167     2  0.0000      0.855 0.000 1.000
#> GSM877175     2  0.7299      0.859 0.204 0.796
#> GSM877177     2  0.7299      0.859 0.204 0.796
#> GSM877184     2  0.7299      0.859 0.204 0.796
#> GSM877187     2  0.0672      0.856 0.008 0.992
#> GSM877188     2  0.7299      0.859 0.204 0.796
#> GSM877150     2  0.7299      0.859 0.204 0.796
#> GSM877165     2  0.0000      0.855 0.000 1.000
#> GSM877183     1  0.1414      0.935 0.980 0.020
#> GSM877178     1  0.0000      0.948 1.000 0.000
#> GSM877182     2  0.8386      0.787 0.268 0.732

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3   0.000      0.968 0.000 0.000 1.000
#> GSM877128     3   0.000      0.968 0.000 0.000 1.000
#> GSM877164     3   0.000      0.968 0.000 0.000 1.000
#> GSM877162     3   0.000      0.968 0.000 0.000 1.000
#> GSM877127     3   0.000      0.968 0.000 0.000 1.000
#> GSM877138     3   0.000      0.968 0.000 0.000 1.000
#> GSM877140     3   0.000      0.968 0.000 0.000 1.000
#> GSM877156     2   0.000      0.964 0.000 1.000 0.000
#> GSM877130     2   0.445      0.771 0.000 0.808 0.192
#> GSM877141     3   0.000      0.968 0.000 0.000 1.000
#> GSM877142     3   0.000      0.968 0.000 0.000 1.000
#> GSM877145     2   0.000      0.964 0.000 1.000 0.000
#> GSM877151     3   0.613      0.274 0.000 0.400 0.600
#> GSM877158     3   0.000      0.968 0.000 0.000 1.000
#> GSM877173     2   0.536      0.637 0.000 0.724 0.276
#> GSM877176     2   0.245      0.901 0.000 0.924 0.076
#> GSM877179     3   0.000      0.968 0.000 0.000 1.000
#> GSM877181     2   0.000      0.964 0.000 1.000 0.000
#> GSM877185     2   0.000      0.964 0.000 1.000 0.000
#> GSM877131     3   0.000      0.968 0.000 0.000 1.000
#> GSM877147     3   0.000      0.968 0.000 0.000 1.000
#> GSM877155     3   0.000      0.968 0.000 0.000 1.000
#> GSM877159     3   0.000      0.968 0.000 0.000 1.000
#> GSM877170     3   0.000      0.968 0.000 0.000 1.000
#> GSM877186     1   0.489      0.703 0.772 0.000 0.228
#> GSM877132     2   0.000      0.964 0.000 1.000 0.000
#> GSM877143     2   0.000      0.964 0.000 1.000 0.000
#> GSM877146     2   0.000      0.964 0.000 1.000 0.000
#> GSM877148     2   0.000      0.964 0.000 1.000 0.000
#> GSM877152     2   0.000      0.964 0.000 1.000 0.000
#> GSM877168     2   0.000      0.964 0.000 1.000 0.000
#> GSM877180     2   0.000      0.964 0.000 1.000 0.000
#> GSM877126     3   0.000      0.968 0.000 0.000 1.000
#> GSM877129     3   0.000      0.968 0.000 0.000 1.000
#> GSM877133     1   0.610      0.370 0.608 0.000 0.392
#> GSM877153     3   0.000      0.968 0.000 0.000 1.000
#> GSM877169     3   0.550      0.546 0.292 0.000 0.708
#> GSM877171     3   0.000      0.968 0.000 0.000 1.000
#> GSM877174     3   0.000      0.968 0.000 0.000 1.000
#> GSM877134     1   0.000      0.959 1.000 0.000 0.000
#> GSM877135     1   0.000      0.959 1.000 0.000 0.000
#> GSM877136     1   0.000      0.959 1.000 0.000 0.000
#> GSM877137     1   0.000      0.959 1.000 0.000 0.000
#> GSM877139     1   0.000      0.959 1.000 0.000 0.000
#> GSM877149     1   0.000      0.959 1.000 0.000 0.000
#> GSM877154     2   0.000      0.964 0.000 1.000 0.000
#> GSM877157     1   0.000      0.959 1.000 0.000 0.000
#> GSM877160     1   0.000      0.959 1.000 0.000 0.000
#> GSM877161     1   0.000      0.959 1.000 0.000 0.000
#> GSM877163     1   0.000      0.959 1.000 0.000 0.000
#> GSM877166     1   0.000      0.959 1.000 0.000 0.000
#> GSM877167     2   0.000      0.964 0.000 1.000 0.000
#> GSM877175     1   0.000      0.959 1.000 0.000 0.000
#> GSM877177     1   0.000      0.959 1.000 0.000 0.000
#> GSM877184     1   0.000      0.959 1.000 0.000 0.000
#> GSM877187     2   0.000      0.964 0.000 1.000 0.000
#> GSM877188     1   0.000      0.959 1.000 0.000 0.000
#> GSM877150     1   0.000      0.959 1.000 0.000 0.000
#> GSM877165     2   0.000      0.964 0.000 1.000 0.000
#> GSM877183     3   0.000      0.968 0.000 0.000 1.000
#> GSM877178     3   0.000      0.968 0.000 0.000 1.000
#> GSM877182     3   0.188      0.924 0.004 0.044 0.952

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     4  0.3907     0.9913 0.000 0.000 0.232 0.768
#> GSM877128     3  0.1516     0.7424 0.016 0.008 0.960 0.016
#> GSM877164     3  0.3626     0.6374 0.004 0.000 0.812 0.184
#> GSM877162     4  0.3907     0.9903 0.000 0.000 0.232 0.768
#> GSM877127     3  0.1356     0.7459 0.008 0.032 0.960 0.000
#> GSM877138     3  0.1917     0.7410 0.008 0.036 0.944 0.012
#> GSM877140     3  0.4856     0.3770 0.008 0.008 0.712 0.272
#> GSM877156     2  0.1557     0.8229 0.056 0.944 0.000 0.000
#> GSM877130     2  0.4959     0.6279 0.008 0.768 0.180 0.044
#> GSM877141     3  0.0657     0.7483 0.004 0.012 0.984 0.000
#> GSM877142     2  0.6137     0.0915 0.000 0.504 0.448 0.048
#> GSM877145     2  0.1867     0.8297 0.072 0.928 0.000 0.000
#> GSM877151     2  0.6229     0.1276 0.004 0.512 0.440 0.044
#> GSM877158     2  0.6248     0.0473 0.004 0.480 0.472 0.044
#> GSM877173     2  0.6698     0.5182 0.076 0.604 0.304 0.016
#> GSM877176     2  0.3888     0.8023 0.072 0.860 0.052 0.016
#> GSM877179     3  0.5223     0.1797 0.004 0.408 0.584 0.004
#> GSM877181     2  0.2053     0.8293 0.072 0.924 0.004 0.000
#> GSM877185     2  0.3130     0.8213 0.072 0.892 0.012 0.024
#> GSM877131     3  0.3221     0.6765 0.004 0.020 0.876 0.100
#> GSM877147     4  0.3907     0.9913 0.000 0.000 0.232 0.768
#> GSM877155     2  0.6068     0.0990 0.000 0.508 0.448 0.044
#> GSM877159     4  0.3975     0.9840 0.000 0.000 0.240 0.760
#> GSM877170     3  0.0524     0.7485 0.004 0.008 0.988 0.000
#> GSM877186     1  0.0469     0.9560 0.988 0.000 0.012 0.000
#> GSM877132     2  0.2345     0.8137 0.100 0.900 0.000 0.000
#> GSM877143     2  0.1940     0.8285 0.076 0.924 0.000 0.000
#> GSM877146     2  0.1940     0.8285 0.076 0.924 0.000 0.000
#> GSM877148     2  0.1867     0.8297 0.072 0.928 0.000 0.000
#> GSM877152     2  0.1867     0.8297 0.072 0.928 0.000 0.000
#> GSM877168     2  0.1867     0.8297 0.072 0.928 0.000 0.000
#> GSM877180     2  0.2216     0.8198 0.092 0.908 0.000 0.000
#> GSM877126     3  0.0859     0.7463 0.008 0.008 0.980 0.004
#> GSM877129     3  0.0376     0.7462 0.004 0.000 0.992 0.004
#> GSM877133     1  0.4888     0.2511 0.588 0.000 0.412 0.000
#> GSM877153     4  0.4053     0.9898 0.004 0.000 0.228 0.768
#> GSM877169     3  0.4925     0.1779 0.428 0.000 0.572 0.000
#> GSM877171     3  0.3626     0.6374 0.004 0.000 0.812 0.184
#> GSM877174     3  0.3626     0.6374 0.004 0.000 0.812 0.184
#> GSM877134     1  0.0188     0.9635 0.996 0.004 0.000 0.000
#> GSM877135     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877136     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877137     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877139     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877149     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877154     2  0.1867     0.8297 0.072 0.928 0.000 0.000
#> GSM877157     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877160     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877163     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877166     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877167     2  0.1867     0.8297 0.072 0.928 0.000 0.000
#> GSM877175     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877177     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877184     1  0.1042     0.9395 0.972 0.020 0.008 0.000
#> GSM877187     2  0.2760     0.7877 0.128 0.872 0.000 0.000
#> GSM877188     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.9680 1.000 0.000 0.000 0.000
#> GSM877165     2  0.3424     0.8173 0.072 0.880 0.012 0.036
#> GSM877183     3  0.2480     0.7060 0.008 0.088 0.904 0.000
#> GSM877178     3  0.0524     0.7460 0.004 0.000 0.988 0.008
#> GSM877182     3  0.6748    -0.1976 0.092 0.432 0.476 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
#> GSM877144     4  0.4291     0.9972 0.000 0.000 0.464 0.536 0.000
#> GSM877128     3  0.1205     0.5831 0.040 0.000 0.956 0.004 0.000
#> GSM877164     3  0.4738     0.5016 0.000 0.016 0.520 0.464 0.000
#> GSM877162     4  0.4291     0.9972 0.000 0.000 0.464 0.536 0.000
#> GSM877127     3  0.1116     0.5863 0.000 0.004 0.964 0.004 0.028
#> GSM877138     3  0.1267     0.5753 0.000 0.004 0.960 0.012 0.024
#> GSM877140     3  0.3177     0.0695 0.000 0.000 0.792 0.208 0.000
#> GSM877156     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877130     2  0.3366     0.6743 0.000 0.768 0.000 0.000 0.232
#> GSM877141     3  0.4402     0.4161 0.004 0.372 0.620 0.000 0.004
#> GSM877142     2  0.1282     0.9179 0.000 0.952 0.004 0.000 0.044
#> GSM877145     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877151     2  0.1608     0.9009 0.000 0.928 0.000 0.000 0.072
#> GSM877158     2  0.0324     0.9014 0.004 0.992 0.004 0.000 0.000
#> GSM877173     5  0.4567     0.2326 0.004 0.448 0.004 0.000 0.544
#> GSM877176     5  0.0290     0.8643 0.000 0.008 0.000 0.000 0.992
#> GSM877179     2  0.0162     0.9015 0.000 0.996 0.004 0.000 0.000
#> GSM877181     5  0.2929     0.7093 0.000 0.180 0.000 0.000 0.820
#> GSM877185     5  0.4219     0.3187 0.000 0.416 0.000 0.000 0.584
#> GSM877131     2  0.1430     0.8912 0.000 0.944 0.052 0.004 0.000
#> GSM877147     4  0.4291     0.9972 0.000 0.000 0.464 0.536 0.000
#> GSM877155     2  0.1282     0.9179 0.000 0.952 0.004 0.000 0.044
#> GSM877159     4  0.4297     0.9887 0.000 0.000 0.472 0.528 0.000
#> GSM877170     3  0.3317     0.5176 0.004 0.188 0.804 0.000 0.004
#> GSM877186     1  0.0162     0.9345 0.996 0.000 0.004 0.000 0.000
#> GSM877132     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877143     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877146     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877148     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877152     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877168     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877180     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877126     3  0.0000     0.5781 0.000 0.000 1.000 0.000 0.000
#> GSM877129     3  0.1549     0.6021 0.000 0.016 0.944 0.040 0.000
#> GSM877133     1  0.4288     0.3437 0.612 0.000 0.384 0.000 0.004
#> GSM877153     4  0.4291     0.9972 0.000 0.000 0.464 0.536 0.000
#> GSM877169     1  0.4390     0.2346 0.568 0.000 0.428 0.000 0.004
#> GSM877171     3  0.4738     0.5016 0.000 0.016 0.520 0.464 0.000
#> GSM877174     3  0.4738     0.5016 0.000 0.016 0.520 0.464 0.000
#> GSM877134     1  0.0794     0.9216 0.972 0.000 0.000 0.000 0.028
#> GSM877135     1  0.0162     0.9359 0.996 0.000 0.000 0.000 0.004
#> GSM877136     1  0.0000     0.9352 1.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.0703     0.9235 0.976 0.000 0.000 0.000 0.024
#> GSM877139     1  0.0162     0.9371 0.996 0.000 0.000 0.000 0.004
#> GSM877149     1  0.0290     0.9360 0.992 0.000 0.000 0.000 0.008
#> GSM877154     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877157     1  0.0162     0.9359 0.996 0.000 0.000 0.000 0.004
#> GSM877160     1  0.0162     0.9371 0.996 0.000 0.000 0.000 0.004
#> GSM877161     1  0.0162     0.9359 0.996 0.000 0.000 0.000 0.004
#> GSM877163     1  0.0162     0.9371 0.996 0.000 0.000 0.000 0.004
#> GSM877166     1  0.0162     0.9371 0.996 0.000 0.000 0.000 0.004
#> GSM877167     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877175     1  0.0162     0.9371 0.996 0.000 0.000 0.000 0.004
#> GSM877177     1  0.0290     0.9360 0.992 0.000 0.000 0.000 0.008
#> GSM877184     1  0.2020     0.8406 0.900 0.000 0.000 0.000 0.100
#> GSM877187     5  0.0000     0.8691 0.000 0.000 0.000 0.000 1.000
#> GSM877188     1  0.0162     0.9371 0.996 0.000 0.000 0.000 0.004
#> GSM877150     1  0.0162     0.9371 0.996 0.000 0.000 0.000 0.004
#> GSM877165     5  0.4242     0.2886 0.000 0.428 0.000 0.000 0.572
#> GSM877183     3  0.3390     0.5000 0.000 0.060 0.840 0.000 0.100
#> GSM877178     3  0.3934     0.5842 0.000 0.016 0.740 0.244 0.000
#> GSM877182     5  0.4730     0.2126 0.012 0.004 0.416 0.000 0.568

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.1444      0.987 0.000 0.000 0.000 0.928 0.000 0.072
#> GSM877128     6  0.2763      0.731 0.052 0.004 0.028 0.032 0.000 0.884
#> GSM877164     3  0.1908      0.891 0.000 0.004 0.900 0.000 0.000 0.096
#> GSM877162     4  0.1556      0.988 0.000 0.000 0.000 0.920 0.000 0.080
#> GSM877127     6  0.0790      0.770 0.000 0.000 0.000 0.032 0.000 0.968
#> GSM877138     6  0.0790      0.770 0.000 0.000 0.000 0.032 0.000 0.968
#> GSM877140     6  0.2454      0.714 0.000 0.000 0.000 0.160 0.000 0.840
#> GSM877156     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877130     2  0.3695      0.325 0.000 0.624 0.000 0.000 0.376 0.000
#> GSM877141     6  0.5286      0.258 0.000 0.436 0.008 0.048 0.012 0.496
#> GSM877142     2  0.1007      0.828 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM877145     5  0.0291      0.918 0.004 0.000 0.004 0.000 0.992 0.000
#> GSM877151     2  0.1075      0.827 0.000 0.952 0.000 0.000 0.048 0.000
#> GSM877158     2  0.1434      0.794 0.000 0.940 0.000 0.048 0.000 0.012
#> GSM877173     5  0.3733      0.751 0.000 0.140 0.000 0.048 0.796 0.016
#> GSM877176     5  0.0146      0.918 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM877179     2  0.1957      0.788 0.000 0.920 0.008 0.048 0.000 0.024
#> GSM877181     5  0.1908      0.854 0.000 0.096 0.004 0.000 0.900 0.000
#> GSM877185     5  0.2667      0.813 0.000 0.128 0.020 0.000 0.852 0.000
#> GSM877131     2  0.3122      0.666 0.000 0.816 0.000 0.020 0.004 0.160
#> GSM877147     4  0.1444      0.987 0.000 0.000 0.000 0.928 0.000 0.072
#> GSM877155     2  0.1007      0.828 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM877159     4  0.1814      0.973 0.000 0.000 0.000 0.900 0.000 0.100
#> GSM877170     6  0.4807      0.439 0.000 0.368 0.008 0.024 0.012 0.588
#> GSM877186     1  0.1434      0.943 0.940 0.000 0.048 0.000 0.000 0.012
#> GSM877132     5  0.0260      0.918 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM877143     5  0.0146      0.919 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM877146     5  0.0146      0.919 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM877148     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877152     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877168     5  0.0146      0.919 0.004 0.000 0.000 0.000 0.996 0.000
#> GSM877180     5  0.0146      0.919 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM877126     6  0.2344      0.755 0.000 0.004 0.028 0.076 0.000 0.892
#> GSM877129     3  0.4893      0.454 0.000 0.000 0.584 0.076 0.000 0.340
#> GSM877133     1  0.2170      0.872 0.888 0.000 0.012 0.000 0.000 0.100
#> GSM877153     4  0.1610      0.987 0.000 0.000 0.000 0.916 0.000 0.084
#> GSM877169     1  0.2889      0.832 0.848 0.000 0.044 0.000 0.000 0.108
#> GSM877171     3  0.1765      0.892 0.000 0.000 0.904 0.000 0.000 0.096
#> GSM877174     3  0.1765      0.892 0.000 0.000 0.904 0.000 0.000 0.096
#> GSM877134     1  0.0692      0.962 0.976 0.000 0.004 0.000 0.020 0.000
#> GSM877135     1  0.0725      0.964 0.976 0.000 0.012 0.000 0.012 0.000
#> GSM877136     1  0.0891      0.959 0.968 0.000 0.000 0.024 0.000 0.008
#> GSM877137     1  0.0260      0.966 0.992 0.000 0.000 0.000 0.008 0.000
#> GSM877139     1  0.0146      0.966 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM877149     1  0.0146      0.966 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM877154     5  0.0000      0.919 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877157     1  0.0458      0.964 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM877160     1  0.0146      0.966 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM877161     1  0.0891      0.959 0.968 0.000 0.000 0.024 0.000 0.008
#> GSM877163     1  0.0146      0.966 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM877166     1  0.0551      0.966 0.984 0.000 0.004 0.004 0.000 0.008
#> GSM877167     5  0.0291      0.918 0.004 0.000 0.004 0.000 0.992 0.000
#> GSM877175     1  0.0405      0.967 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM877177     1  0.0405      0.966 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM877184     1  0.1267      0.925 0.940 0.000 0.000 0.000 0.060 0.000
#> GSM877187     5  0.0146      0.919 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM877188     1  0.0405      0.966 0.988 0.000 0.004 0.000 0.000 0.008
#> GSM877150     1  0.0891      0.959 0.968 0.000 0.000 0.024 0.000 0.008
#> GSM877165     5  0.4018      0.488 0.000 0.324 0.020 0.000 0.656 0.000
#> GSM877183     6  0.1950      0.765 0.000 0.016 0.000 0.032 0.028 0.924
#> GSM877178     3  0.2048      0.879 0.000 0.000 0.880 0.000 0.000 0.120
#> GSM877182     5  0.4447      0.279 0.012 0.000 0.000 0.012 0.556 0.420

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-mclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) genotype/variation(p) other(p) k
#> MAD:mclust 60          0.24325                 0.142 1.63e-08 2
#> MAD:mclust 60          0.56704                 0.196 1.57e-13 3
#> MAD:mclust 53          0.30629                 0.452 2.35e-14 4
#> MAD:mclust 53          0.21961                 0.505 2.23e-16 5
#> MAD:mclust 56          0.00143                 0.055 2.49e-14 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


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 62 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-NMF-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.932           0.954       0.979         0.5056 0.494   0.494
#> 3 3 0.884           0.884       0.945         0.2817 0.775   0.574
#> 4 4 0.796           0.836       0.912         0.1249 0.918   0.765
#> 5 5 0.703           0.661       0.838         0.0878 0.859   0.551
#> 6 6 0.690           0.621       0.757         0.0421 0.948   0.760

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM877144     2  0.0000      0.973 0.000 1.000
#> GSM877128     1  0.0000      0.983 1.000 0.000
#> GSM877164     1  0.0000      0.983 1.000 0.000
#> GSM877162     2  0.0000      0.973 0.000 1.000
#> GSM877127     1  0.1843      0.958 0.972 0.028
#> GSM877138     2  0.8207      0.674 0.256 0.744
#> GSM877140     1  0.7815      0.693 0.768 0.232
#> GSM877156     2  0.0000      0.973 0.000 1.000
#> GSM877130     2  0.0000      0.973 0.000 1.000
#> GSM877141     2  0.0000      0.973 0.000 1.000
#> GSM877142     2  0.0000      0.973 0.000 1.000
#> GSM877145     2  0.0000      0.973 0.000 1.000
#> GSM877151     2  0.0000      0.973 0.000 1.000
#> GSM877158     2  0.0000      0.973 0.000 1.000
#> GSM877173     2  0.0000      0.973 0.000 1.000
#> GSM877176     2  0.0000      0.973 0.000 1.000
#> GSM877179     2  0.0000      0.973 0.000 1.000
#> GSM877181     2  0.0000      0.973 0.000 1.000
#> GSM877185     2  0.0000      0.973 0.000 1.000
#> GSM877131     2  0.0000      0.973 0.000 1.000
#> GSM877147     2  0.0000      0.973 0.000 1.000
#> GSM877155     2  0.0000      0.973 0.000 1.000
#> GSM877159     2  0.0000      0.973 0.000 1.000
#> GSM877170     2  0.7815      0.714 0.232 0.768
#> GSM877186     1  0.0000      0.983 1.000 0.000
#> GSM877132     2  0.0000      0.973 0.000 1.000
#> GSM877143     2  0.0000      0.973 0.000 1.000
#> GSM877146     2  0.0000      0.973 0.000 1.000
#> GSM877148     2  0.0000      0.973 0.000 1.000
#> GSM877152     2  0.0672      0.966 0.008 0.992
#> GSM877168     2  0.0000      0.973 0.000 1.000
#> GSM877180     2  0.0000      0.973 0.000 1.000
#> GSM877126     1  0.0000      0.983 1.000 0.000
#> GSM877129     1  0.0000      0.983 1.000 0.000
#> GSM877133     1  0.0000      0.983 1.000 0.000
#> GSM877153     1  0.0376      0.980 0.996 0.004
#> GSM877169     1  0.0000      0.983 1.000 0.000
#> GSM877171     1  0.0000      0.983 1.000 0.000
#> GSM877174     1  0.0000      0.983 1.000 0.000
#> GSM877134     1  0.6973      0.765 0.812 0.188
#> GSM877135     1  0.0000      0.983 1.000 0.000
#> GSM877136     1  0.0000      0.983 1.000 0.000
#> GSM877137     1  0.0000      0.983 1.000 0.000
#> GSM877139     1  0.0000      0.983 1.000 0.000
#> GSM877149     1  0.0000      0.983 1.000 0.000
#> GSM877154     2  0.0000      0.973 0.000 1.000
#> GSM877157     1  0.0000      0.983 1.000 0.000
#> GSM877160     1  0.0000      0.983 1.000 0.000
#> GSM877161     1  0.0000      0.983 1.000 0.000
#> GSM877163     1  0.0000      0.983 1.000 0.000
#> GSM877166     1  0.0000      0.983 1.000 0.000
#> GSM877167     2  0.0000      0.973 0.000 1.000
#> GSM877175     1  0.0000      0.983 1.000 0.000
#> GSM877177     1  0.0000      0.983 1.000 0.000
#> GSM877184     1  0.0000      0.983 1.000 0.000
#> GSM877187     2  0.0000      0.973 0.000 1.000
#> GSM877188     1  0.0000      0.983 1.000 0.000
#> GSM877150     1  0.0000      0.983 1.000 0.000
#> GSM877165     2  0.0000      0.973 0.000 1.000
#> GSM877183     2  0.8081      0.689 0.248 0.752
#> GSM877178     1  0.0000      0.983 1.000 0.000
#> GSM877182     2  0.4939      0.871 0.108 0.892

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.4796      0.710 0.000 0.220 0.780
#> GSM877128     3  0.0424      0.821 0.008 0.000 0.992
#> GSM877164     3  0.0424      0.821 0.008 0.000 0.992
#> GSM877162     2  0.2878      0.886 0.000 0.904 0.096
#> GSM877127     3  0.1585      0.819 0.008 0.028 0.964
#> GSM877138     3  0.6305      0.221 0.000 0.484 0.516
#> GSM877140     3  0.0000      0.821 0.000 0.000 1.000
#> GSM877156     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877130     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877141     3  0.6247      0.504 0.004 0.376 0.620
#> GSM877142     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877145     2  0.2537      0.907 0.080 0.920 0.000
#> GSM877151     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877158     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877173     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877176     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877179     2  0.0892      0.961 0.000 0.980 0.020
#> GSM877181     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877185     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877131     2  0.3551      0.838 0.000 0.868 0.132
#> GSM877147     2  0.1753      0.939 0.000 0.952 0.048
#> GSM877155     2  0.0237      0.972 0.000 0.996 0.004
#> GSM877159     3  0.5810      0.565 0.000 0.336 0.664
#> GSM877170     3  0.3941      0.767 0.000 0.156 0.844
#> GSM877186     1  0.0000      0.982 1.000 0.000 0.000
#> GSM877132     2  0.2796      0.893 0.092 0.908 0.000
#> GSM877143     2  0.0661      0.971 0.008 0.988 0.004
#> GSM877146     2  0.0661      0.971 0.008 0.988 0.004
#> GSM877148     2  0.0475      0.971 0.004 0.992 0.004
#> GSM877152     2  0.1878      0.945 0.044 0.952 0.004
#> GSM877168     2  0.0475      0.971 0.004 0.992 0.004
#> GSM877180     2  0.1267      0.961 0.024 0.972 0.004
#> GSM877126     3  0.0424      0.821 0.008 0.000 0.992
#> GSM877129     3  0.0237      0.821 0.004 0.000 0.996
#> GSM877133     1  0.4555      0.751 0.800 0.000 0.200
#> GSM877153     3  0.0000      0.821 0.000 0.000 1.000
#> GSM877169     3  0.6154      0.257 0.408 0.000 0.592
#> GSM877171     3  0.1753      0.794 0.048 0.000 0.952
#> GSM877174     3  0.0424      0.821 0.008 0.000 0.992
#> GSM877134     1  0.0592      0.972 0.988 0.012 0.000
#> GSM877135     1  0.0000      0.982 1.000 0.000 0.000
#> GSM877136     1  0.0000      0.982 1.000 0.000 0.000
#> GSM877137     1  0.0000      0.982 1.000 0.000 0.000
#> GSM877139     1  0.0000      0.982 1.000 0.000 0.000
#> GSM877149     1  0.0237      0.981 0.996 0.000 0.004
#> GSM877154     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877157     1  0.0237      0.980 0.996 0.004 0.000
#> GSM877160     1  0.1643      0.947 0.956 0.000 0.044
#> GSM877161     1  0.0000      0.982 1.000 0.000 0.000
#> GSM877163     1  0.0237      0.981 0.996 0.000 0.004
#> GSM877166     1  0.0000      0.982 1.000 0.000 0.000
#> GSM877167     2  0.0237      0.972 0.004 0.996 0.000
#> GSM877175     1  0.0237      0.981 0.996 0.000 0.004
#> GSM877177     1  0.0000      0.982 1.000 0.000 0.000
#> GSM877184     1  0.0237      0.980 0.996 0.004 0.000
#> GSM877187     2  0.1031      0.961 0.024 0.976 0.000
#> GSM877188     1  0.0237      0.981 0.996 0.000 0.004
#> GSM877150     1  0.0237      0.981 0.996 0.000 0.004
#> GSM877165     2  0.0000      0.973 0.000 1.000 0.000
#> GSM877183     3  0.6398      0.421 0.004 0.416 0.580
#> GSM877178     3  0.0237      0.821 0.004 0.000 0.996
#> GSM877182     2  0.0000      0.973 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     4  0.0000      0.931 0.000 0.000 0.000 1.000
#> GSM877128     3  0.0000      0.910 0.000 0.000 1.000 0.000
#> GSM877164     3  0.0000      0.910 0.000 0.000 1.000 0.000
#> GSM877162     4  0.0000      0.931 0.000 0.000 0.000 1.000
#> GSM877127     4  0.3873      0.697 0.000 0.000 0.228 0.772
#> GSM877138     4  0.1474      0.901 0.000 0.052 0.000 0.948
#> GSM877140     4  0.1022      0.923 0.000 0.000 0.032 0.968
#> GSM877156     2  0.0817      0.845 0.000 0.976 0.000 0.024
#> GSM877130     2  0.0336      0.847 0.000 0.992 0.000 0.008
#> GSM877141     3  0.2408      0.825 0.000 0.104 0.896 0.000
#> GSM877142     2  0.0921      0.844 0.000 0.972 0.000 0.028
#> GSM877145     2  0.0707      0.846 0.000 0.980 0.000 0.020
#> GSM877151     2  0.1557      0.835 0.000 0.944 0.000 0.056
#> GSM877158     2  0.0000      0.847 0.000 1.000 0.000 0.000
#> GSM877173     2  0.0000      0.847 0.000 1.000 0.000 0.000
#> GSM877176     2  0.1022      0.842 0.000 0.968 0.000 0.032
#> GSM877179     2  0.1302      0.835 0.000 0.956 0.044 0.000
#> GSM877181     2  0.0707      0.846 0.000 0.980 0.000 0.020
#> GSM877185     2  0.0336      0.847 0.000 0.992 0.000 0.008
#> GSM877131     2  0.3610      0.749 0.000 0.800 0.000 0.200
#> GSM877147     4  0.0000      0.931 0.000 0.000 0.000 1.000
#> GSM877155     2  0.2081      0.823 0.000 0.916 0.000 0.084
#> GSM877159     4  0.0707      0.925 0.000 0.020 0.000 0.980
#> GSM877170     3  0.3325      0.806 0.000 0.112 0.864 0.024
#> GSM877186     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877132     2  0.3554      0.768 0.136 0.844 0.000 0.020
#> GSM877143     2  0.7456      0.353 0.360 0.460 0.000 0.180
#> GSM877146     2  0.7416      0.285 0.392 0.440 0.000 0.168
#> GSM877148     2  0.3123      0.780 0.000 0.844 0.000 0.156
#> GSM877152     2  0.5833      0.671 0.212 0.692 0.000 0.096
#> GSM877168     2  0.3219      0.774 0.000 0.836 0.000 0.164
#> GSM877180     2  0.6954      0.540 0.280 0.568 0.000 0.152
#> GSM877126     3  0.0921      0.899 0.000 0.000 0.972 0.028
#> GSM877129     3  0.0000      0.910 0.000 0.000 1.000 0.000
#> GSM877133     3  0.1637      0.877 0.060 0.000 0.940 0.000
#> GSM877153     4  0.2216      0.873 0.000 0.000 0.092 0.908
#> GSM877169     3  0.1474      0.883 0.052 0.000 0.948 0.000
#> GSM877171     3  0.0000      0.910 0.000 0.000 1.000 0.000
#> GSM877174     3  0.0000      0.910 0.000 0.000 1.000 0.000
#> GSM877134     1  0.3757      0.809 0.828 0.152 0.000 0.020
#> GSM877135     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877136     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877137     1  0.0469      0.960 0.988 0.012 0.000 0.000
#> GSM877139     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877149     1  0.4137      0.812 0.824 0.140 0.008 0.028
#> GSM877154     2  0.4199      0.786 0.032 0.804 0.000 0.164
#> GSM877157     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877160     1  0.1557      0.927 0.944 0.000 0.056 0.000
#> GSM877161     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877163     1  0.1639      0.937 0.952 0.036 0.008 0.004
#> GSM877166     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877167     2  0.0000      0.847 0.000 1.000 0.000 0.000
#> GSM877175     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877177     1  0.0921      0.946 0.972 0.000 0.000 0.028
#> GSM877184     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877187     2  0.6097      0.436 0.364 0.580 0.000 0.056
#> GSM877188     1  0.0188      0.964 0.996 0.000 0.004 0.000
#> GSM877150     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM877165     2  0.0707      0.846 0.000 0.980 0.000 0.020
#> GSM877183     3  0.6751      0.165 0.000 0.096 0.508 0.396
#> GSM877178     3  0.0188      0.909 0.000 0.000 0.996 0.004
#> GSM877182     2  0.1302      0.838 0.000 0.956 0.000 0.044

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0404     0.7826 0.000 0.012 0.000 0.988 0.000
#> GSM877128     3  0.0404     0.9312 0.000 0.000 0.988 0.012 0.000
#> GSM877164     3  0.0000     0.9365 0.000 0.000 1.000 0.000 0.000
#> GSM877162     4  0.1410     0.7652 0.000 0.060 0.000 0.940 0.000
#> GSM877127     5  0.7484     0.0204 0.000 0.048 0.260 0.252 0.440
#> GSM877138     5  0.2561     0.5284 0.000 0.000 0.000 0.144 0.856
#> GSM877140     4  0.4467     0.5364 0.000 0.000 0.016 0.640 0.344
#> GSM877156     2  0.2036     0.7048 0.000 0.920 0.000 0.056 0.024
#> GSM877130     2  0.3003     0.6602 0.000 0.812 0.000 0.000 0.188
#> GSM877141     3  0.3389     0.7731 0.000 0.048 0.836 0.000 0.116
#> GSM877142     5  0.4227     0.2333 0.000 0.420 0.000 0.000 0.580
#> GSM877145     2  0.0579     0.7153 0.008 0.984 0.000 0.000 0.008
#> GSM877151     5  0.2929     0.6500 0.000 0.180 0.000 0.000 0.820
#> GSM877158     2  0.3452     0.6076 0.000 0.756 0.000 0.000 0.244
#> GSM877173     2  0.3143     0.6500 0.000 0.796 0.000 0.000 0.204
#> GSM877176     2  0.2339     0.6782 0.004 0.892 0.000 0.100 0.004
#> GSM877179     2  0.4847     0.5655 0.000 0.692 0.068 0.000 0.240
#> GSM877181     2  0.0324     0.7150 0.004 0.992 0.000 0.000 0.004
#> GSM877185     2  0.3210     0.6435 0.000 0.788 0.000 0.000 0.212
#> GSM877131     5  0.4830     0.5692 0.000 0.256 0.000 0.060 0.684
#> GSM877147     4  0.0963     0.7798 0.000 0.036 0.000 0.964 0.000
#> GSM877155     5  0.4173     0.5134 0.000 0.300 0.000 0.012 0.688
#> GSM877159     4  0.4262     0.2910 0.000 0.000 0.000 0.560 0.440
#> GSM877170     2  0.4118     0.3936 0.000 0.660 0.336 0.000 0.004
#> GSM877186     1  0.2561     0.7808 0.856 0.000 0.000 0.144 0.000
#> GSM877132     2  0.2074     0.6790 0.104 0.896 0.000 0.000 0.000
#> GSM877143     5  0.0798     0.6694 0.016 0.008 0.000 0.000 0.976
#> GSM877146     5  0.0912     0.6714 0.016 0.012 0.000 0.000 0.972
#> GSM877148     5  0.1792     0.6838 0.000 0.084 0.000 0.000 0.916
#> GSM877152     5  0.3060     0.6501 0.128 0.024 0.000 0.000 0.848
#> GSM877168     5  0.1365     0.6822 0.004 0.040 0.000 0.004 0.952
#> GSM877180     5  0.2575     0.6601 0.100 0.012 0.000 0.004 0.884
#> GSM877126     3  0.3850     0.7308 0.000 0.032 0.792 0.172 0.004
#> GSM877129     3  0.0000     0.9365 0.000 0.000 1.000 0.000 0.000
#> GSM877133     3  0.1943     0.8874 0.020 0.000 0.924 0.000 0.056
#> GSM877153     4  0.1845     0.7655 0.000 0.000 0.016 0.928 0.056
#> GSM877169     3  0.0955     0.9222 0.004 0.000 0.968 0.000 0.028
#> GSM877171     3  0.0000     0.9365 0.000 0.000 1.000 0.000 0.000
#> GSM877174     3  0.0000     0.9365 0.000 0.000 1.000 0.000 0.000
#> GSM877134     1  0.4283     0.1900 0.544 0.456 0.000 0.000 0.000
#> GSM877135     1  0.1608     0.8501 0.928 0.000 0.000 0.000 0.072
#> GSM877136     1  0.0162     0.8800 0.996 0.000 0.000 0.000 0.004
#> GSM877137     1  0.2074     0.8312 0.896 0.000 0.000 0.000 0.104
#> GSM877139     1  0.1732     0.8454 0.920 0.000 0.000 0.000 0.080
#> GSM877149     1  0.6415     0.3342 0.524 0.284 0.000 0.188 0.004
#> GSM877154     2  0.7724     0.1146 0.136 0.480 0.000 0.140 0.244
#> GSM877157     1  0.0880     0.8719 0.968 0.032 0.000 0.000 0.000
#> GSM877160     1  0.3489     0.7689 0.820 0.000 0.144 0.000 0.036
#> GSM877161     1  0.0162     0.8800 0.996 0.000 0.000 0.000 0.004
#> GSM877163     2  0.5123    -0.0708 0.476 0.492 0.028 0.000 0.004
#> GSM877166     1  0.0000     0.8800 1.000 0.000 0.000 0.000 0.000
#> GSM877167     2  0.3684     0.5049 0.000 0.720 0.000 0.000 0.280
#> GSM877175     1  0.0000     0.8800 1.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.0162     0.8801 0.996 0.000 0.000 0.000 0.004
#> GSM877184     1  0.1124     0.8686 0.960 0.036 0.000 0.000 0.004
#> GSM877187     5  0.6093     0.3977 0.332 0.080 0.000 0.024 0.564
#> GSM877188     1  0.1205     0.8686 0.956 0.004 0.040 0.000 0.000
#> GSM877150     1  0.0000     0.8800 1.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.0798     0.7154 0.000 0.976 0.000 0.008 0.016
#> GSM877183     5  0.8248    -0.0511 0.000 0.132 0.228 0.276 0.364
#> GSM877178     3  0.0000     0.9365 0.000 0.000 1.000 0.000 0.000
#> GSM877182     2  0.4550     0.4927 0.024 0.704 0.004 0.264 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
#> GSM877144     4  0.0508     0.8152 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM877128     3  0.2513     0.8477 0.000 0.060 0.888 0.044 0.000 0.008
#> GSM877164     3  0.0777     0.8772 0.000 0.024 0.972 0.000 0.004 0.000
#> GSM877162     4  0.0717     0.8133 0.000 0.000 0.000 0.976 0.008 0.016
#> GSM877127     5  0.5458     0.4658 0.000 0.032 0.176 0.028 0.684 0.080
#> GSM877138     5  0.4089     0.5604 0.000 0.264 0.000 0.040 0.696 0.000
#> GSM877140     4  0.6106     0.4915 0.000 0.316 0.020 0.492 0.172 0.000
#> GSM877156     6  0.5375     0.3328 0.000 0.060 0.016 0.012 0.320 0.592
#> GSM877130     2  0.4946     0.8852 0.000 0.528 0.000 0.000 0.068 0.404
#> GSM877141     3  0.5323     0.5305 0.000 0.204 0.648 0.000 0.024 0.124
#> GSM877142     2  0.5250     0.8445 0.000 0.540 0.000 0.000 0.108 0.352
#> GSM877145     6  0.1649     0.4488 0.016 0.040 0.000 0.000 0.008 0.936
#> GSM877151     5  0.5418     0.2771 0.000 0.368 0.000 0.000 0.508 0.124
#> GSM877158     2  0.4543     0.9107 0.000 0.576 0.000 0.000 0.040 0.384
#> GSM877173     2  0.4524     0.9082 0.000 0.560 0.000 0.000 0.036 0.404
#> GSM877176     6  0.1759     0.4943 0.004 0.004 0.000 0.064 0.004 0.924
#> GSM877179     2  0.5417     0.8344 0.000 0.592 0.060 0.000 0.040 0.308
#> GSM877181     6  0.3161     0.0514 0.008 0.216 0.000 0.000 0.000 0.776
#> GSM877185     2  0.4537     0.9002 0.000 0.552 0.000 0.000 0.036 0.412
#> GSM877131     5  0.7100     0.3957 0.000 0.204 0.000 0.156 0.468 0.172
#> GSM877147     4  0.0603     0.8145 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM877155     5  0.4813     0.4442 0.000 0.104 0.000 0.000 0.648 0.248
#> GSM877159     4  0.4941     0.5808 0.000 0.124 0.000 0.640 0.236 0.000
#> GSM877170     6  0.5280    -0.0132 0.000 0.084 0.444 0.000 0.004 0.468
#> GSM877186     1  0.4732     0.5809 0.672 0.040 0.000 0.264 0.020 0.004
#> GSM877132     6  0.5008     0.0986 0.212 0.148 0.000 0.000 0.000 0.640
#> GSM877143     5  0.4593     0.5389 0.056 0.324 0.000 0.000 0.620 0.000
#> GSM877146     5  0.4747     0.5321 0.068 0.324 0.000 0.000 0.608 0.000
#> GSM877148     5  0.2122     0.6776 0.000 0.076 0.000 0.000 0.900 0.024
#> GSM877152     5  0.2147     0.6589 0.032 0.012 0.000 0.000 0.912 0.044
#> GSM877168     5  0.1820     0.6797 0.008 0.056 0.000 0.000 0.924 0.012
#> GSM877180     5  0.2001     0.6737 0.044 0.016 0.000 0.000 0.920 0.020
#> GSM877126     3  0.4740     0.6494 0.000 0.032 0.728 0.072 0.004 0.164
#> GSM877129     3  0.0858     0.8805 0.000 0.028 0.968 0.004 0.000 0.000
#> GSM877133     3  0.3374     0.7796 0.012 0.044 0.824 0.000 0.120 0.000
#> GSM877153     4  0.1956     0.8008 0.000 0.080 0.004 0.908 0.008 0.000
#> GSM877169     3  0.1269     0.8742 0.020 0.012 0.956 0.000 0.012 0.000
#> GSM877171     3  0.0632     0.8810 0.000 0.024 0.976 0.000 0.000 0.000
#> GSM877174     3  0.0458     0.8801 0.000 0.016 0.984 0.000 0.000 0.000
#> GSM877134     1  0.3742     0.4862 0.648 0.004 0.000 0.000 0.000 0.348
#> GSM877135     1  0.2831     0.7537 0.840 0.024 0.000 0.000 0.136 0.000
#> GSM877136     1  0.1092     0.7996 0.960 0.020 0.000 0.000 0.020 0.000
#> GSM877137     1  0.3309     0.7259 0.800 0.024 0.004 0.000 0.172 0.000
#> GSM877139     1  0.3110     0.7095 0.792 0.012 0.000 0.000 0.196 0.000
#> GSM877149     1  0.5373     0.1673 0.484 0.016 0.000 0.068 0.000 0.432
#> GSM877154     6  0.5149     0.2865 0.036 0.012 0.000 0.016 0.356 0.580
#> GSM877157     1  0.2915     0.7469 0.848 0.008 0.000 0.000 0.024 0.120
#> GSM877160     1  0.4224     0.7051 0.752 0.020 0.172 0.000 0.056 0.000
#> GSM877161     1  0.1003     0.7997 0.964 0.016 0.000 0.000 0.020 0.000
#> GSM877163     1  0.5324     0.2498 0.540 0.120 0.000 0.000 0.000 0.340
#> GSM877166     1  0.1003     0.7997 0.964 0.016 0.000 0.000 0.020 0.000
#> GSM877167     6  0.4465     0.0964 0.000 0.028 0.000 0.000 0.460 0.512
#> GSM877175     1  0.1700     0.7939 0.936 0.024 0.012 0.000 0.000 0.028
#> GSM877177     1  0.2768     0.7521 0.832 0.000 0.000 0.000 0.156 0.012
#> GSM877184     1  0.2066     0.7780 0.904 0.024 0.000 0.000 0.000 0.072
#> GSM877187     5  0.4004     0.5729 0.100 0.016 0.000 0.000 0.784 0.100
#> GSM877188     1  0.0935     0.7996 0.964 0.000 0.032 0.000 0.000 0.004
#> GSM877150     1  0.0692     0.8002 0.976 0.000 0.020 0.000 0.000 0.004
#> GSM877165     6  0.1745     0.4851 0.000 0.020 0.000 0.000 0.056 0.924
#> GSM877183     5  0.6453     0.2234 0.000 0.052 0.064 0.044 0.548 0.292
#> GSM877178     3  0.0692     0.8811 0.000 0.020 0.976 0.004 0.000 0.000
#> GSM877182     6  0.4557     0.4122 0.020 0.076 0.000 0.180 0.000 0.724

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-NMF-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) genotype/variation(p) other(p) k
#> MAD:NMF 62            0.425              0.539890 8.26e-08 2
#> MAD:NMF 59            0.100              0.314032 4.69e-12 3
#> MAD:NMF 58            0.341              0.000869 2.06e-13 4
#> MAD:NMF 51            0.332              0.160058 1.47e-15 5
#> MAD:NMF 43            0.458              0.508849 5.34e-19 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC: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 62 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-hclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.474           0.701       0.873         0.4089 0.545   0.545
#> 3 3 0.553           0.782       0.838         0.4299 0.729   0.557
#> 4 4 0.589           0.564       0.782         0.1897 0.869   0.679
#> 5 5 0.618           0.622       0.758         0.0720 0.852   0.561
#> 6 6 0.661           0.603       0.769         0.0513 0.896   0.622

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
#> GSM877144     1  0.0000     0.8733 1.000 0.000
#> GSM877128     1  0.0000     0.8733 1.000 0.000
#> GSM877164     1  0.0000     0.8733 1.000 0.000
#> GSM877162     2  0.7139     0.7648 0.196 0.804
#> GSM877127     1  0.0000     0.8733 1.000 0.000
#> GSM877138     1  0.0000     0.8733 1.000 0.000
#> GSM877140     1  0.0000     0.8733 1.000 0.000
#> GSM877156     2  0.8861     0.7327 0.304 0.696
#> GSM877130     2  0.0000     0.7345 0.000 1.000
#> GSM877141     1  0.9850    -0.0148 0.572 0.428
#> GSM877142     2  0.0000     0.7345 0.000 1.000
#> GSM877145     2  0.8713     0.7427 0.292 0.708
#> GSM877151     2  0.6048     0.7657 0.148 0.852
#> GSM877158     2  0.0000     0.7345 0.000 1.000
#> GSM877173     2  0.8555     0.7488 0.280 0.720
#> GSM877176     1  0.9996    -0.2586 0.512 0.488
#> GSM877179     2  0.0000     0.7345 0.000 1.000
#> GSM877181     2  0.8608     0.7471 0.284 0.716
#> GSM877185     2  0.0000     0.7345 0.000 1.000
#> GSM877131     2  0.6247     0.7665 0.156 0.844
#> GSM877147     1  0.0376     0.8713 0.996 0.004
#> GSM877155     2  0.0000     0.7345 0.000 1.000
#> GSM877159     1  0.8499     0.4785 0.724 0.276
#> GSM877170     1  0.9850    -0.0148 0.572 0.428
#> GSM877186     1  0.0000     0.8733 1.000 0.000
#> GSM877132     2  0.8713     0.7427 0.292 0.708
#> GSM877143     1  0.9866    -0.0378 0.568 0.432
#> GSM877146     1  0.9866    -0.0378 0.568 0.432
#> GSM877148     2  0.9833     0.5229 0.424 0.576
#> GSM877152     2  0.9248     0.6865 0.340 0.660
#> GSM877168     2  0.9833     0.5229 0.424 0.576
#> GSM877180     2  0.9833     0.5229 0.424 0.576
#> GSM877126     1  0.0938     0.8666 0.988 0.012
#> GSM877129     1  0.1414     0.8609 0.980 0.020
#> GSM877133     1  0.0000     0.8733 1.000 0.000
#> GSM877153     1  0.0000     0.8733 1.000 0.000
#> GSM877169     1  0.0000     0.8733 1.000 0.000
#> GSM877171     1  0.0000     0.8733 1.000 0.000
#> GSM877174     1  0.0000     0.8733 1.000 0.000
#> GSM877134     1  0.1414     0.8608 0.980 0.020
#> GSM877135     1  0.0000     0.8733 1.000 0.000
#> GSM877136     1  0.0000     0.8733 1.000 0.000
#> GSM877137     1  0.1184     0.8640 0.984 0.016
#> GSM877139     1  0.0672     0.8692 0.992 0.008
#> GSM877149     1  0.0000     0.8733 1.000 0.000
#> GSM877154     2  0.9248     0.6865 0.340 0.660
#> GSM877157     1  0.0000     0.8733 1.000 0.000
#> GSM877160     1  0.0000     0.8733 1.000 0.000
#> GSM877161     1  0.0000     0.8733 1.000 0.000
#> GSM877163     1  0.1184     0.8640 0.984 0.016
#> GSM877166     1  0.0000     0.8733 1.000 0.000
#> GSM877167     2  0.8861     0.7327 0.304 0.696
#> GSM877175     1  0.0000     0.8733 1.000 0.000
#> GSM877177     1  0.0000     0.8733 1.000 0.000
#> GSM877184     1  0.0672     0.8692 0.992 0.008
#> GSM877187     1  0.9963    -0.1762 0.536 0.464
#> GSM877188     1  0.0000     0.8733 1.000 0.000
#> GSM877150     1  0.0000     0.8733 1.000 0.000
#> GSM877165     2  0.0000     0.7345 0.000 1.000
#> GSM877183     1  0.8555     0.4694 0.720 0.280
#> GSM877178     1  0.0000     0.8733 1.000 0.000
#> GSM877182     1  0.9129     0.3460 0.672 0.328

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     1  0.2772     0.8830 0.916 0.080 0.004
#> GSM877128     1  0.1529     0.8976 0.960 0.040 0.000
#> GSM877164     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877162     2  0.4346     0.6362 0.000 0.816 0.184
#> GSM877127     1  0.4178     0.8007 0.828 0.172 0.000
#> GSM877138     1  0.1860     0.8938 0.948 0.052 0.000
#> GSM877140     1  0.1289     0.8987 0.968 0.032 0.000
#> GSM877156     2  0.3043     0.7366 0.008 0.908 0.084
#> GSM877130     3  0.2165     0.9532 0.000 0.064 0.936
#> GSM877141     2  0.4555     0.7180 0.200 0.800 0.000
#> GSM877142     3  0.0237     0.9645 0.000 0.004 0.996
#> GSM877145     2  0.2537     0.7319 0.000 0.920 0.080
#> GSM877151     2  0.6204     0.2117 0.000 0.576 0.424
#> GSM877158     3  0.0237     0.9645 0.000 0.004 0.996
#> GSM877173     2  0.2796     0.7236 0.000 0.908 0.092
#> GSM877176     2  0.5053     0.7403 0.164 0.812 0.024
#> GSM877179     3  0.0237     0.9645 0.000 0.004 0.996
#> GSM877181     2  0.3038     0.7172 0.000 0.896 0.104
#> GSM877185     3  0.0424     0.9649 0.000 0.008 0.992
#> GSM877131     2  0.5650     0.4681 0.000 0.688 0.312
#> GSM877147     1  0.3030     0.8775 0.904 0.092 0.004
#> GSM877155     3  0.2711     0.9319 0.000 0.088 0.912
#> GSM877159     2  0.6305     0.0769 0.484 0.516 0.000
#> GSM877170     2  0.4555     0.7180 0.200 0.800 0.000
#> GSM877186     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877132     2  0.2537     0.7319 0.000 0.920 0.080
#> GSM877143     2  0.4504     0.7232 0.196 0.804 0.000
#> GSM877146     2  0.4504     0.7232 0.196 0.804 0.000
#> GSM877148     2  0.1860     0.7619 0.052 0.948 0.000
#> GSM877152     2  0.1289     0.7484 0.000 0.968 0.032
#> GSM877168     2  0.1860     0.7619 0.052 0.948 0.000
#> GSM877180     2  0.1860     0.7619 0.052 0.948 0.000
#> GSM877126     1  0.4062     0.8235 0.836 0.164 0.000
#> GSM877129     1  0.4002     0.8266 0.840 0.160 0.000
#> GSM877133     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877153     1  0.0237     0.9020 0.996 0.004 0.000
#> GSM877169     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877171     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877174     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877134     1  0.5650     0.6304 0.688 0.312 0.000
#> GSM877135     1  0.1163     0.8991 0.972 0.028 0.000
#> GSM877136     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877137     1  0.5529     0.6546 0.704 0.296 0.000
#> GSM877139     1  0.2959     0.8716 0.900 0.100 0.000
#> GSM877149     1  0.5291     0.6987 0.732 0.268 0.000
#> GSM877154     2  0.1289     0.7484 0.000 0.968 0.032
#> GSM877157     1  0.5254     0.7027 0.736 0.264 0.000
#> GSM877160     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877161     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877163     1  0.5591     0.6441 0.696 0.304 0.000
#> GSM877166     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877167     2  0.3043     0.7366 0.008 0.908 0.084
#> GSM877175     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877177     1  0.1753     0.8948 0.952 0.048 0.000
#> GSM877184     1  0.5397     0.6816 0.720 0.280 0.000
#> GSM877187     2  0.4178     0.7361 0.172 0.828 0.000
#> GSM877188     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877150     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877165     3  0.2165     0.9532 0.000 0.064 0.936
#> GSM877183     2  0.6244     0.2247 0.440 0.560 0.000
#> GSM877178     1  0.0000     0.9023 1.000 0.000 0.000
#> GSM877182     2  0.5560     0.5551 0.300 0.700 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.5119     0.3740 0.440 0.004 0.556 0.000
#> GSM877128     3  0.1661     0.3998 0.052 0.004 0.944 0.000
#> GSM877164     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877162     2  0.3157     0.7042 0.004 0.852 0.000 0.144
#> GSM877127     3  0.4834     0.4689 0.096 0.120 0.784 0.000
#> GSM877138     3  0.1510     0.4458 0.028 0.016 0.956 0.000
#> GSM877140     3  0.1022     0.3782 0.032 0.000 0.968 0.000
#> GSM877156     2  0.1822     0.7964 0.004 0.944 0.008 0.044
#> GSM877130     4  0.1824     0.9498 0.004 0.060 0.000 0.936
#> GSM877141     2  0.4916     0.7463 0.184 0.760 0.056 0.000
#> GSM877142     4  0.0000     0.9606 0.000 0.000 0.000 1.000
#> GSM877145     2  0.1398     0.7949 0.004 0.956 0.000 0.040
#> GSM877151     2  0.5028     0.3031 0.004 0.596 0.000 0.400
#> GSM877158     4  0.0000     0.9606 0.000 0.000 0.000 1.000
#> GSM877173     2  0.1661     0.7902 0.004 0.944 0.000 0.052
#> GSM877176     2  0.5006     0.7727 0.160 0.780 0.040 0.020
#> GSM877179     4  0.0000     0.9606 0.000 0.000 0.000 1.000
#> GSM877181     2  0.1902     0.7840 0.004 0.932 0.000 0.064
#> GSM877185     4  0.0188     0.9612 0.000 0.004 0.000 0.996
#> GSM877131     2  0.4509     0.5443 0.004 0.708 0.000 0.288
#> GSM877147     3  0.5126     0.3664 0.444 0.004 0.552 0.000
#> GSM877155     4  0.2334     0.9255 0.004 0.088 0.000 0.908
#> GSM877159     2  0.7408     0.3264 0.172 0.464 0.364 0.000
#> GSM877170     2  0.4916     0.7463 0.184 0.760 0.056 0.000
#> GSM877186     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877132     2  0.1398     0.7949 0.004 0.956 0.000 0.040
#> GSM877143     2  0.4669     0.7544 0.200 0.764 0.036 0.000
#> GSM877146     2  0.4669     0.7544 0.200 0.764 0.036 0.000
#> GSM877148     2  0.2489     0.8056 0.068 0.912 0.020 0.000
#> GSM877152     2  0.0188     0.8038 0.000 0.996 0.004 0.000
#> GSM877168     2  0.2489     0.8056 0.068 0.912 0.020 0.000
#> GSM877180     2  0.2489     0.8056 0.068 0.912 0.020 0.000
#> GSM877126     3  0.5512     0.4601 0.172 0.100 0.728 0.000
#> GSM877129     3  0.5383     0.4652 0.160 0.100 0.740 0.000
#> GSM877133     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877153     3  0.3219     0.1903 0.164 0.000 0.836 0.000
#> GSM877169     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877171     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877174     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877134     1  0.7761    -0.2176 0.416 0.244 0.340 0.000
#> GSM877135     3  0.4933    -0.5361 0.432 0.000 0.568 0.000
#> GSM877136     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877137     1  0.7747    -0.2079 0.388 0.232 0.380 0.000
#> GSM877139     1  0.5931     0.1242 0.504 0.036 0.460 0.000
#> GSM877149     1  0.7602    -0.2116 0.420 0.200 0.380 0.000
#> GSM877154     2  0.0188     0.8038 0.000 0.996 0.004 0.000
#> GSM877157     3  0.7608     0.0944 0.392 0.200 0.408 0.000
#> GSM877160     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877161     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877163     1  0.7740    -0.2149 0.416 0.236 0.348 0.000
#> GSM877166     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877167     2  0.1822     0.7964 0.004 0.944 0.008 0.044
#> GSM877175     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877177     3  0.4989    -0.3889 0.472 0.000 0.528 0.000
#> GSM877184     3  0.7681     0.0956 0.380 0.216 0.404 0.000
#> GSM877187     2  0.4578     0.7665 0.160 0.788 0.052 0.000
#> GSM877188     1  0.4948     0.7035 0.560 0.000 0.440 0.000
#> GSM877150     1  0.4961     0.7146 0.552 0.000 0.448 0.000
#> GSM877165     4  0.1824     0.9498 0.004 0.060 0.000 0.936
#> GSM877183     2  0.7282     0.4179 0.172 0.512 0.316 0.000
#> GSM877178     1  0.4977     0.6956 0.540 0.000 0.460 0.000
#> GSM877182     2  0.6157     0.6101 0.232 0.660 0.108 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
#> GSM877144     4  0.3388     0.9786 0.008 0.000 0.200 0.792 0.000
#> GSM877128     3  0.6282     0.1783 0.368 0.000 0.476 0.156 0.000
#> GSM877164     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877162     5  0.3264     0.6129 0.000 0.000 0.016 0.164 0.820
#> GSM877127     3  0.5244     0.2024 0.196 0.000 0.688 0.112 0.004
#> GSM877138     3  0.6177     0.1673 0.304 0.000 0.532 0.164 0.000
#> GSM877140     3  0.6424     0.1317 0.380 0.000 0.444 0.176 0.000
#> GSM877156     5  0.1549     0.7218 0.000 0.000 0.016 0.040 0.944
#> GSM877130     2  0.3481     0.8667 0.000 0.840 0.004 0.100 0.056
#> GSM877141     5  0.4878     0.4869 0.000 0.000 0.440 0.024 0.536
#> GSM877142     2  0.0000     0.8977 0.000 1.000 0.000 0.000 0.000
#> GSM877145     5  0.0865     0.7228 0.000 0.000 0.004 0.024 0.972
#> GSM877151     5  0.6471     0.2548 0.000 0.236 0.016 0.184 0.564
#> GSM877158     2  0.0000     0.8977 0.000 1.000 0.000 0.000 0.000
#> GSM877173     5  0.1124     0.7197 0.000 0.000 0.004 0.036 0.960
#> GSM877176     5  0.4288     0.5481 0.000 0.000 0.384 0.004 0.612
#> GSM877179     2  0.0000     0.8977 0.000 1.000 0.000 0.000 0.000
#> GSM877181     5  0.1492     0.7146 0.000 0.008 0.004 0.040 0.948
#> GSM877185     2  0.0324     0.8984 0.000 0.992 0.000 0.004 0.004
#> GSM877131     5  0.5599     0.4818 0.000 0.124 0.016 0.184 0.676
#> GSM877147     4  0.3074     0.9786 0.000 0.000 0.196 0.804 0.000
#> GSM877155     2  0.4455     0.8001 0.000 0.768 0.004 0.132 0.096
#> GSM877159     3  0.5554     0.0262 0.000 0.000 0.628 0.120 0.252
#> GSM877170     5  0.4878     0.4869 0.000 0.000 0.440 0.024 0.536
#> GSM877186     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877132     5  0.0771     0.7237 0.000 0.000 0.004 0.020 0.976
#> GSM877143     5  0.4627     0.5072 0.000 0.000 0.444 0.012 0.544
#> GSM877146     5  0.4627     0.5072 0.000 0.000 0.444 0.012 0.544
#> GSM877148     5  0.3690     0.6803 0.000 0.000 0.224 0.012 0.764
#> GSM877152     5  0.1597     0.7252 0.000 0.000 0.048 0.012 0.940
#> GSM877168     5  0.3690     0.6803 0.000 0.000 0.224 0.012 0.764
#> GSM877180     5  0.3690     0.6803 0.000 0.000 0.224 0.012 0.764
#> GSM877126     3  0.5037     0.3591 0.180 0.000 0.724 0.080 0.016
#> GSM877129     3  0.5027     0.3476 0.184 0.000 0.720 0.084 0.012
#> GSM877133     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877153     1  0.6422    -0.0411 0.492 0.000 0.308 0.200 0.000
#> GSM877169     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877171     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877174     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877134     3  0.5700     0.5324 0.280 0.000 0.600 0.000 0.120
#> GSM877135     1  0.2516     0.7297 0.860 0.000 0.140 0.000 0.000
#> GSM877136     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877137     3  0.5811     0.5269 0.316 0.000 0.568 0.000 0.116
#> GSM877139     1  0.3966     0.3340 0.664 0.000 0.336 0.000 0.000
#> GSM877149     3  0.5825     0.5217 0.320 0.000 0.564 0.000 0.116
#> GSM877154     5  0.1364     0.7258 0.000 0.000 0.036 0.012 0.952
#> GSM877157     3  0.5912     0.4973 0.348 0.000 0.536 0.000 0.116
#> GSM877160     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877163     3  0.5678     0.5353 0.284 0.000 0.600 0.000 0.116
#> GSM877166     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.1549     0.7218 0.000 0.000 0.016 0.040 0.944
#> GSM877175     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.3366     0.5792 0.768 0.000 0.232 0.000 0.000
#> GSM877184     3  0.5889     0.5064 0.340 0.000 0.544 0.000 0.116
#> GSM877187     5  0.5159     0.5403 0.000 0.000 0.400 0.044 0.556
#> GSM877188     1  0.0963     0.8643 0.964 0.000 0.036 0.000 0.000
#> GSM877150     1  0.0000     0.8961 1.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.3481     0.8667 0.000 0.840 0.004 0.100 0.056
#> GSM877183     3  0.5594    -0.0615 0.000 0.000 0.608 0.108 0.284
#> GSM877178     1  0.0510     0.8823 0.984 0.000 0.016 0.000 0.000
#> GSM877182     3  0.4610    -0.3323 0.000 0.000 0.556 0.012 0.432

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.1251     0.9757 0.008 0.000 0.024 0.956 0.000 0.012
#> GSM877128     3  0.2165     0.7238 0.108 0.000 0.884 0.000 0.000 0.008
#> GSM877164     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877162     5  0.4213     0.5385 0.000 0.000 0.036 0.016 0.724 0.224
#> GSM877127     3  0.4518     0.6321 0.052 0.000 0.708 0.020 0.000 0.220
#> GSM877138     3  0.2799     0.7305 0.076 0.000 0.860 0.000 0.000 0.064
#> GSM877140     3  0.2400     0.7108 0.116 0.000 0.872 0.004 0.000 0.008
#> GSM877156     5  0.1204     0.6888 0.000 0.000 0.000 0.000 0.944 0.056
#> GSM877130     2  0.3348     0.8641 0.000 0.840 0.004 0.016 0.048 0.092
#> GSM877141     6  0.4153     0.2147 0.000 0.000 0.024 0.000 0.340 0.636
#> GSM877142     2  0.0000     0.8963 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877145     5  0.0458     0.6921 0.000 0.000 0.000 0.000 0.984 0.016
#> GSM877151     5  0.6605     0.2058 0.000 0.236 0.036 0.016 0.520 0.192
#> GSM877158     2  0.0000     0.8963 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877173     5  0.0363     0.6903 0.000 0.000 0.000 0.000 0.988 0.012
#> GSM877176     5  0.4185    -0.0478 0.000 0.000 0.012 0.000 0.496 0.492
#> GSM877179     2  0.0000     0.8963 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877181     5  0.0260     0.6861 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM877185     2  0.0291     0.8968 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM877131     5  0.5895     0.4034 0.000 0.124 0.036 0.016 0.628 0.196
#> GSM877147     4  0.0603     0.9758 0.000 0.000 0.016 0.980 0.000 0.004
#> GSM877155     2  0.4269     0.7959 0.000 0.768 0.004 0.016 0.120 0.092
#> GSM877159     6  0.5421     0.0402 0.000 0.000 0.356 0.020 0.076 0.548
#> GSM877170     6  0.4153     0.2147 0.000 0.000 0.024 0.000 0.340 0.636
#> GSM877186     1  0.0146     0.9061 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM877132     5  0.0632     0.6924 0.000 0.000 0.000 0.000 0.976 0.024
#> GSM877143     6  0.3699     0.1902 0.000 0.000 0.004 0.000 0.336 0.660
#> GSM877146     6  0.3699     0.1902 0.000 0.000 0.004 0.000 0.336 0.660
#> GSM877148     5  0.3756     0.4080 0.000 0.000 0.000 0.000 0.600 0.400
#> GSM877152     5  0.2854     0.6162 0.000 0.000 0.000 0.000 0.792 0.208
#> GSM877168     5  0.3756     0.4080 0.000 0.000 0.000 0.000 0.600 0.400
#> GSM877180     5  0.3756     0.4080 0.000 0.000 0.000 0.000 0.600 0.400
#> GSM877126     3  0.4170     0.5919 0.032 0.000 0.724 0.000 0.016 0.228
#> GSM877129     3  0.4029     0.6149 0.032 0.000 0.736 0.000 0.012 0.220
#> GSM877133     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877153     3  0.4097     0.4452 0.284 0.000 0.688 0.012 0.000 0.016
#> GSM877169     1  0.0146     0.9067 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM877171     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877174     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877134     6  0.7295     0.3403 0.256 0.000 0.228 0.000 0.120 0.396
#> GSM877135     1  0.3952     0.4980 0.672 0.000 0.308 0.000 0.000 0.020
#> GSM877136     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877137     6  0.7388     0.3112 0.256 0.000 0.268 0.000 0.120 0.356
#> GSM877139     1  0.5305     0.3144 0.576 0.000 0.284 0.000 0.000 0.140
#> GSM877149     6  0.7394     0.3085 0.272 0.000 0.256 0.000 0.120 0.352
#> GSM877154     5  0.2762     0.6260 0.000 0.000 0.000 0.000 0.804 0.196
#> GSM877157     6  0.7430     0.2805 0.272 0.000 0.284 0.000 0.120 0.324
#> GSM877160     1  0.0260     0.9048 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877163     6  0.7319     0.3360 0.256 0.000 0.236 0.000 0.120 0.388
#> GSM877166     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877167     5  0.1204     0.6888 0.000 0.000 0.000 0.000 0.944 0.056
#> GSM877175     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.4687     0.4143 0.624 0.000 0.308 0.000 0.000 0.068
#> GSM877184     6  0.7423     0.2896 0.272 0.000 0.276 0.000 0.120 0.332
#> GSM877187     6  0.4594     0.0575 0.000 0.000 0.052 0.000 0.340 0.608
#> GSM877188     1  0.1074     0.8780 0.960 0.000 0.012 0.000 0.000 0.028
#> GSM877150     1  0.0000     0.9084 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.3348     0.8641 0.000 0.840 0.004 0.016 0.048 0.092
#> GSM877183     6  0.5486     0.1704 0.000 0.000 0.296 0.020 0.100 0.584
#> GSM877178     1  0.0547     0.8913 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM877182     6  0.3695     0.3298 0.000 0.000 0.024 0.000 0.244 0.732

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-hclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-hclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-hclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) genotype/variation(p) other(p) k
#> ATC:hclust 53           0.3754                 0.716 3.81e-07 2
#> ATC:hclust 58           0.2426                 0.806 1.17e-08 3
#> ATC:hclust 41           0.2748                 0.395 2.03e-05 4
#> ATC:hclust 46           0.0102                 0.675 3.08e-08 5
#> ATC:hclust 38           0.2672                 0.120 2.35e-06 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC: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 62 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 0.914           0.961       0.981         0.5048 0.492   0.492
#> 3 3 0.670           0.773       0.902         0.2733 0.708   0.494
#> 4 4 0.645           0.686       0.836         0.1368 0.813   0.537
#> 5 5 0.712           0.657       0.811         0.0732 0.912   0.682
#> 6 6 0.708           0.541       0.692         0.0410 0.903   0.603

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
#> GSM877144     1  0.0000      0.986 1.000 0.000
#> GSM877128     1  0.0000      0.986 1.000 0.000
#> GSM877164     1  0.0000      0.986 1.000 0.000
#> GSM877162     2  0.0000      0.972 0.000 1.000
#> GSM877127     1  0.0000      0.986 1.000 0.000
#> GSM877138     1  0.0000      0.986 1.000 0.000
#> GSM877140     1  0.0000      0.986 1.000 0.000
#> GSM877156     2  0.0000      0.972 0.000 1.000
#> GSM877130     2  0.0000      0.972 0.000 1.000
#> GSM877141     2  0.0672      0.969 0.008 0.992
#> GSM877142     2  0.0000      0.972 0.000 1.000
#> GSM877145     2  0.0000      0.972 0.000 1.000
#> GSM877151     2  0.0000      0.972 0.000 1.000
#> GSM877158     2  0.0000      0.972 0.000 1.000
#> GSM877173     2  0.0000      0.972 0.000 1.000
#> GSM877176     2  0.0000      0.972 0.000 1.000
#> GSM877179     2  0.0000      0.972 0.000 1.000
#> GSM877181     2  0.0000      0.972 0.000 1.000
#> GSM877185     2  0.0000      0.972 0.000 1.000
#> GSM877131     2  0.0000      0.972 0.000 1.000
#> GSM877147     1  0.9129      0.481 0.672 0.328
#> GSM877155     2  0.0000      0.972 0.000 1.000
#> GSM877159     2  0.4690      0.907 0.100 0.900
#> GSM877170     2  0.4161      0.922 0.084 0.916
#> GSM877186     1  0.0000      0.986 1.000 0.000
#> GSM877132     2  0.0000      0.972 0.000 1.000
#> GSM877143     2  0.3274      0.940 0.060 0.940
#> GSM877146     2  0.3274      0.940 0.060 0.940
#> GSM877148     2  0.0672      0.969 0.008 0.992
#> GSM877152     2  0.0376      0.971 0.004 0.996
#> GSM877168     2  0.0000      0.972 0.000 1.000
#> GSM877180     2  0.3274      0.940 0.060 0.940
#> GSM877126     1  0.0000      0.986 1.000 0.000
#> GSM877129     1  0.0000      0.986 1.000 0.000
#> GSM877133     1  0.0000      0.986 1.000 0.000
#> GSM877153     1  0.0000      0.986 1.000 0.000
#> GSM877169     1  0.0000      0.986 1.000 0.000
#> GSM877171     1  0.0000      0.986 1.000 0.000
#> GSM877174     1  0.0000      0.986 1.000 0.000
#> GSM877134     1  0.4161      0.897 0.916 0.084
#> GSM877135     1  0.0000      0.986 1.000 0.000
#> GSM877136     1  0.0000      0.986 1.000 0.000
#> GSM877137     1  0.0000      0.986 1.000 0.000
#> GSM877139     1  0.0000      0.986 1.000 0.000
#> GSM877149     1  0.0000      0.986 1.000 0.000
#> GSM877154     2  0.0000      0.972 0.000 1.000
#> GSM877157     1  0.0000      0.986 1.000 0.000
#> GSM877160     1  0.0000      0.986 1.000 0.000
#> GSM877161     1  0.0000      0.986 1.000 0.000
#> GSM877163     1  0.0000      0.986 1.000 0.000
#> GSM877166     1  0.0000      0.986 1.000 0.000
#> GSM877167     2  0.0000      0.972 0.000 1.000
#> GSM877175     1  0.0000      0.986 1.000 0.000
#> GSM877177     1  0.0000      0.986 1.000 0.000
#> GSM877184     1  0.0000      0.986 1.000 0.000
#> GSM877187     2  0.4690      0.907 0.100 0.900
#> GSM877188     1  0.0000      0.986 1.000 0.000
#> GSM877150     1  0.0000      0.986 1.000 0.000
#> GSM877165     2  0.0000      0.972 0.000 1.000
#> GSM877183     2  0.7376      0.768 0.208 0.792
#> GSM877178     1  0.0000      0.986 1.000 0.000
#> GSM877182     2  0.4690      0.907 0.100 0.900

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     1   0.435     0.7772 0.816 0.000 0.184
#> GSM877128     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877164     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877162     3   0.595     0.4412 0.000 0.360 0.640
#> GSM877127     3   0.631    -0.0891 0.496 0.000 0.504
#> GSM877138     1   0.603     0.4426 0.624 0.000 0.376
#> GSM877140     1   0.435     0.7772 0.816 0.000 0.184
#> GSM877156     3   0.603     0.4026 0.000 0.376 0.624
#> GSM877130     2   0.000     0.9872 0.000 1.000 0.000
#> GSM877141     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877142     2   0.000     0.9872 0.000 1.000 0.000
#> GSM877145     3   0.573     0.5028 0.000 0.324 0.676
#> GSM877151     2   0.103     0.9678 0.000 0.976 0.024
#> GSM877158     2   0.000     0.9872 0.000 1.000 0.000
#> GSM877173     3   0.628     0.1951 0.000 0.460 0.540
#> GSM877176     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877179     2   0.000     0.9872 0.000 1.000 0.000
#> GSM877181     2   0.000     0.9872 0.000 1.000 0.000
#> GSM877185     2   0.000     0.9872 0.000 1.000 0.000
#> GSM877131     2   0.245     0.9091 0.000 0.924 0.076
#> GSM877147     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877155     2   0.000     0.9872 0.000 1.000 0.000
#> GSM877159     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877170     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877186     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877132     3   0.493     0.6181 0.000 0.232 0.768
#> GSM877143     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877146     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877148     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877152     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877168     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877180     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877126     3   0.553     0.5024 0.296 0.000 0.704
#> GSM877129     3   0.553     0.5024 0.296 0.000 0.704
#> GSM877133     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877153     1   0.435     0.7772 0.816 0.000 0.184
#> GSM877169     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877171     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877174     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877134     3   0.196     0.7699 0.056 0.000 0.944
#> GSM877135     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877136     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877137     3   0.599     0.4017 0.368 0.000 0.632
#> GSM877139     1   0.445     0.7392 0.808 0.000 0.192
#> GSM877149     1   0.312     0.8504 0.892 0.000 0.108
#> GSM877154     3   0.435     0.6661 0.000 0.184 0.816
#> GSM877157     1   0.312     0.8504 0.892 0.000 0.108
#> GSM877160     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877161     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877163     3   0.622     0.3063 0.432 0.000 0.568
#> GSM877166     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877167     3   0.603     0.4026 0.000 0.376 0.624
#> GSM877175     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877177     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877184     3   0.611     0.3342 0.396 0.000 0.604
#> GSM877187     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877188     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877150     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877165     2   0.000     0.9872 0.000 1.000 0.000
#> GSM877183     3   0.000     0.7929 0.000 0.000 1.000
#> GSM877178     1   0.000     0.9332 1.000 0.000 0.000
#> GSM877182     3   0.000     0.7929 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.4137     0.5164 0.208 0.012 0.780 0.000
#> GSM877128     3  0.4907     0.2367 0.420 0.000 0.580 0.000
#> GSM877164     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877162     2  0.4932     0.5620 0.000 0.728 0.032 0.240
#> GSM877127     3  0.3392     0.6155 0.072 0.056 0.872 0.000
#> GSM877138     3  0.4237     0.5842 0.152 0.040 0.808 0.000
#> GSM877140     3  0.4453     0.4961 0.244 0.012 0.744 0.000
#> GSM877156     2  0.1767     0.8353 0.000 0.944 0.012 0.044
#> GSM877130     4  0.0000     0.9013 0.000 0.000 0.000 1.000
#> GSM877141     2  0.2704     0.8322 0.000 0.876 0.124 0.000
#> GSM877142     4  0.0592     0.9002 0.000 0.000 0.016 0.984
#> GSM877145     2  0.1624     0.8471 0.000 0.952 0.020 0.028
#> GSM877151     4  0.4012     0.7844 0.000 0.184 0.016 0.800
#> GSM877158     4  0.0592     0.9002 0.000 0.000 0.016 0.984
#> GSM877173     2  0.2222     0.8272 0.000 0.924 0.016 0.060
#> GSM877176     2  0.1118     0.8589 0.000 0.964 0.036 0.000
#> GSM877179     4  0.0592     0.9002 0.000 0.000 0.016 0.984
#> GSM877181     4  0.3300     0.8223 0.000 0.144 0.008 0.848
#> GSM877185     4  0.0469     0.9010 0.000 0.000 0.012 0.988
#> GSM877131     4  0.5417     0.3589 0.000 0.412 0.016 0.572
#> GSM877147     3  0.2149     0.5738 0.000 0.088 0.912 0.000
#> GSM877155     4  0.0000     0.9013 0.000 0.000 0.000 1.000
#> GSM877159     3  0.4981    -0.2084 0.000 0.464 0.536 0.000
#> GSM877170     2  0.2868     0.8168 0.000 0.864 0.136 0.000
#> GSM877186     1  0.0188     0.8923 0.996 0.000 0.004 0.000
#> GSM877132     2  0.1297     0.8510 0.000 0.964 0.020 0.016
#> GSM877143     2  0.3123     0.8140 0.000 0.844 0.156 0.000
#> GSM877146     2  0.3123     0.8140 0.000 0.844 0.156 0.000
#> GSM877148     2  0.1940     0.8553 0.000 0.924 0.076 0.000
#> GSM877152     2  0.1022     0.8578 0.000 0.968 0.032 0.000
#> GSM877168     2  0.0817     0.8565 0.000 0.976 0.024 0.000
#> GSM877180     2  0.1940     0.8553 0.000 0.924 0.076 0.000
#> GSM877126     3  0.5636     0.4602 0.044 0.308 0.648 0.000
#> GSM877129     3  0.3071     0.6198 0.044 0.068 0.888 0.000
#> GSM877133     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877153     3  0.5268     0.2472 0.396 0.012 0.592 0.000
#> GSM877169     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877171     1  0.0469     0.8855 0.988 0.000 0.012 0.000
#> GSM877174     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877134     3  0.5158     0.1153 0.004 0.472 0.524 0.000
#> GSM877135     1  0.3649     0.6308 0.796 0.000 0.204 0.000
#> GSM877136     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877137     3  0.7118     0.4693 0.156 0.308 0.536 0.000
#> GSM877139     1  0.5744    -0.0461 0.536 0.028 0.436 0.000
#> GSM877149     3  0.6504     0.1839 0.452 0.072 0.476 0.000
#> GSM877154     2  0.1297     0.8513 0.000 0.964 0.020 0.016
#> GSM877157     3  0.6504     0.1839 0.452 0.072 0.476 0.000
#> GSM877160     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877163     3  0.7191     0.4498 0.156 0.328 0.516 0.000
#> GSM877166     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877167     2  0.1767     0.8369 0.000 0.944 0.012 0.044
#> GSM877175     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877177     1  0.4746     0.2692 0.632 0.000 0.368 0.000
#> GSM877184     3  0.7028     0.5030 0.160 0.280 0.560 0.000
#> GSM877187     2  0.3074     0.8144 0.000 0.848 0.152 0.000
#> GSM877188     1  0.1118     0.8669 0.964 0.000 0.036 0.000
#> GSM877150     1  0.0000     0.8945 1.000 0.000 0.000 0.000
#> GSM877165     4  0.0000     0.9013 0.000 0.000 0.000 1.000
#> GSM877183     2  0.4888     0.4351 0.000 0.588 0.412 0.000
#> GSM877178     1  0.2868     0.7312 0.864 0.000 0.136 0.000
#> GSM877182     2  0.4250     0.6023 0.000 0.724 0.276 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
#> GSM877144     4  0.2843     0.6293 0.076 0.000 0.048 0.876 0.000
#> GSM877128     4  0.6288     0.2518 0.372 0.000 0.156 0.472 0.000
#> GSM877164     1  0.0566     0.8844 0.984 0.000 0.012 0.004 0.000
#> GSM877162     5  0.2917     0.6972 0.000 0.052 0.028 0.032 0.888
#> GSM877127     4  0.3160     0.5613 0.004 0.000 0.188 0.808 0.000
#> GSM877138     4  0.3841     0.5774 0.032 0.000 0.188 0.780 0.000
#> GSM877140     4  0.4127     0.6056 0.080 0.000 0.136 0.784 0.000
#> GSM877156     5  0.0290     0.7390 0.000 0.000 0.008 0.000 0.992
#> GSM877130     2  0.0000     0.9022 0.000 1.000 0.000 0.000 0.000
#> GSM877141     5  0.5066     0.6493 0.000 0.000 0.344 0.048 0.608
#> GSM877142     2  0.1493     0.9016 0.000 0.948 0.028 0.024 0.000
#> GSM877145     5  0.1608     0.7305 0.000 0.000 0.072 0.000 0.928
#> GSM877151     5  0.4855    -0.0539 0.000 0.436 0.004 0.016 0.544
#> GSM877158     2  0.1750     0.9002 0.000 0.936 0.028 0.036 0.000
#> GSM877173     5  0.0963     0.7398 0.000 0.000 0.036 0.000 0.964
#> GSM877176     5  0.2843     0.7497 0.000 0.000 0.144 0.008 0.848
#> GSM877179     2  0.1750     0.9002 0.000 0.936 0.028 0.036 0.000
#> GSM877181     2  0.4637     0.3370 0.000 0.568 0.004 0.008 0.420
#> GSM877185     2  0.1117     0.9042 0.000 0.964 0.016 0.020 0.000
#> GSM877131     5  0.4570     0.2811 0.000 0.332 0.004 0.016 0.648
#> GSM877147     4  0.2806     0.5596 0.000 0.000 0.152 0.844 0.004
#> GSM877155     2  0.0566     0.8957 0.000 0.984 0.004 0.012 0.000
#> GSM877159     4  0.6292     0.1252 0.000 0.000 0.208 0.532 0.260
#> GSM877170     5  0.4617     0.5389 0.000 0.000 0.436 0.012 0.552
#> GSM877186     1  0.1357     0.8636 0.948 0.000 0.048 0.004 0.000
#> GSM877132     5  0.1608     0.7305 0.000 0.000 0.072 0.000 0.928
#> GSM877143     5  0.5143     0.6254 0.000 0.000 0.368 0.048 0.584
#> GSM877146     5  0.5143     0.6254 0.000 0.000 0.368 0.048 0.584
#> GSM877148     5  0.3991     0.7405 0.000 0.000 0.172 0.048 0.780
#> GSM877152     5  0.3794     0.7464 0.000 0.000 0.152 0.048 0.800
#> GSM877168     5  0.3752     0.7470 0.000 0.000 0.148 0.048 0.804
#> GSM877180     5  0.4028     0.7403 0.000 0.000 0.176 0.048 0.776
#> GSM877126     3  0.4362     0.7043 0.008 0.000 0.748 0.208 0.036
#> GSM877129     3  0.4645     0.3499 0.008 0.000 0.564 0.424 0.004
#> GSM877133     1  0.0451     0.8857 0.988 0.000 0.008 0.004 0.000
#> GSM877153     4  0.4169     0.5592 0.240 0.000 0.028 0.732 0.000
#> GSM877169     1  0.0693     0.8838 0.980 0.000 0.012 0.008 0.000
#> GSM877171     1  0.0798     0.8831 0.976 0.000 0.016 0.008 0.000
#> GSM877174     1  0.0693     0.8838 0.980 0.000 0.012 0.008 0.000
#> GSM877134     3  0.2597     0.5868 0.000 0.000 0.884 0.024 0.092
#> GSM877135     1  0.5673     0.4042 0.632 0.000 0.184 0.184 0.000
#> GSM877136     1  0.0290     0.8891 0.992 0.000 0.008 0.000 0.000
#> GSM877137     3  0.4517     0.7244 0.012 0.000 0.756 0.180 0.052
#> GSM877139     3  0.6148     0.4291 0.268 0.000 0.552 0.180 0.000
#> GSM877149     3  0.5068     0.6705 0.108 0.000 0.708 0.180 0.004
#> GSM877154     5  0.0510     0.7443 0.000 0.000 0.016 0.000 0.984
#> GSM877157     3  0.4994     0.6644 0.112 0.000 0.704 0.184 0.000
#> GSM877160     1  0.0290     0.8891 0.992 0.000 0.008 0.000 0.000
#> GSM877161     1  0.0290     0.8891 0.992 0.000 0.008 0.000 0.000
#> GSM877163     3  0.4421     0.7174 0.012 0.000 0.772 0.156 0.060
#> GSM877166     1  0.0290     0.8891 0.992 0.000 0.008 0.000 0.000
#> GSM877167     5  0.0162     0.7402 0.000 0.000 0.004 0.000 0.996
#> GSM877175     1  0.0290     0.8891 0.992 0.000 0.008 0.000 0.000
#> GSM877177     1  0.6571    -0.2790 0.400 0.000 0.396 0.204 0.000
#> GSM877184     3  0.4616     0.7250 0.016 0.000 0.752 0.180 0.052
#> GSM877187     5  0.5176     0.5690 0.000 0.000 0.380 0.048 0.572
#> GSM877188     1  0.2674     0.7821 0.856 0.000 0.140 0.004 0.000
#> GSM877150     1  0.0290     0.8891 0.992 0.000 0.008 0.000 0.000
#> GSM877165     2  0.0000     0.9022 0.000 1.000 0.000 0.000 0.000
#> GSM877183     5  0.6647     0.1815 0.000 0.000 0.224 0.388 0.388
#> GSM877178     1  0.2361     0.7936 0.892 0.000 0.012 0.096 0.000
#> GSM877182     3  0.4108     0.0728 0.000 0.000 0.684 0.008 0.308

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.2581     0.6541 0.128 0.000 0.016 0.856 0.000 0.000
#> GSM877128     1  0.7609    -0.3243 0.324 0.000 0.236 0.176 0.000 0.264
#> GSM877164     3  0.1625     0.9038 0.012 0.000 0.928 0.000 0.000 0.060
#> GSM877162     5  0.4549     0.4284 0.000 0.032 0.000 0.068 0.736 0.164
#> GSM877127     4  0.5714     0.6856 0.320 0.000 0.000 0.496 0.000 0.184
#> GSM877138     4  0.5962     0.6880 0.320 0.000 0.012 0.496 0.000 0.172
#> GSM877140     4  0.6350     0.6925 0.280 0.000 0.028 0.480 0.000 0.212
#> GSM877156     5  0.0622     0.5100 0.000 0.000 0.000 0.008 0.980 0.012
#> GSM877130     2  0.0717     0.9523 0.000 0.976 0.000 0.016 0.000 0.008
#> GSM877141     6  0.6468     0.5187 0.112 0.000 0.000 0.068 0.400 0.420
#> GSM877142     2  0.1124     0.9521 0.008 0.956 0.000 0.000 0.000 0.036
#> GSM877145     5  0.1944     0.5008 0.024 0.000 0.000 0.016 0.924 0.036
#> GSM877151     5  0.5683     0.3748 0.000 0.260 0.000 0.056 0.604 0.080
#> GSM877158     2  0.1124     0.9521 0.008 0.956 0.000 0.000 0.000 0.036
#> GSM877173     5  0.1010     0.5082 0.004 0.000 0.000 0.000 0.960 0.036
#> GSM877176     5  0.5019     0.0574 0.048 0.000 0.000 0.052 0.676 0.224
#> GSM877179     2  0.1124     0.9521 0.008 0.956 0.000 0.000 0.000 0.036
#> GSM877181     5  0.5034     0.1614 0.000 0.352 0.000 0.032 0.584 0.032
#> GSM877185     2  0.0000     0.9558 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877131     5  0.5480     0.4012 0.000 0.220 0.000 0.064 0.644 0.072
#> GSM877147     4  0.2860     0.5903 0.048 0.000 0.000 0.852 0.000 0.100
#> GSM877155     2  0.2471     0.8907 0.000 0.888 0.000 0.052 0.004 0.056
#> GSM877159     6  0.5771     0.1368 0.008 0.000 0.000 0.372 0.140 0.480
#> GSM877170     5  0.6983    -0.4847 0.208 0.000 0.000 0.072 0.372 0.348
#> GSM877186     3  0.3438     0.8048 0.068 0.000 0.816 0.004 0.000 0.112
#> GSM877132     5  0.2415     0.4881 0.024 0.000 0.000 0.040 0.900 0.036
#> GSM877143     6  0.6251     0.6059 0.120 0.000 0.000 0.048 0.352 0.480
#> GSM877146     6  0.6251     0.6059 0.120 0.000 0.000 0.048 0.352 0.480
#> GSM877148     6  0.4705     0.3858 0.044 0.000 0.000 0.000 0.476 0.480
#> GSM877152     5  0.4700    -0.4486 0.044 0.000 0.000 0.000 0.500 0.456
#> GSM877168     5  0.4700    -0.4486 0.044 0.000 0.000 0.000 0.500 0.456
#> GSM877180     5  0.4757    -0.4855 0.048 0.000 0.000 0.000 0.484 0.468
#> GSM877126     1  0.1964     0.5936 0.920 0.000 0.008 0.004 0.012 0.056
#> GSM877129     1  0.4949     0.2255 0.664 0.000 0.008 0.112 0.000 0.216
#> GSM877133     3  0.1219     0.9095 0.004 0.000 0.948 0.000 0.000 0.048
#> GSM877153     4  0.6717     0.6187 0.108 0.000 0.164 0.520 0.000 0.208
#> GSM877169     3  0.1949     0.9016 0.004 0.000 0.904 0.004 0.000 0.088
#> GSM877171     3  0.1732     0.9039 0.004 0.000 0.920 0.004 0.000 0.072
#> GSM877174     3  0.1732     0.9039 0.004 0.000 0.920 0.004 0.000 0.072
#> GSM877134     1  0.4881     0.4901 0.732 0.000 0.008 0.068 0.048 0.144
#> GSM877135     1  0.5939     0.1387 0.432 0.000 0.408 0.012 0.000 0.148
#> GSM877136     3  0.0717     0.9121 0.008 0.000 0.976 0.000 0.000 0.016
#> GSM877137     1  0.1382     0.6160 0.948 0.000 0.008 0.000 0.008 0.036
#> GSM877139     1  0.3200     0.5388 0.788 0.000 0.196 0.000 0.000 0.016
#> GSM877149     1  0.1644     0.6121 0.920 0.000 0.076 0.000 0.000 0.004
#> GSM877154     5  0.2500     0.4334 0.004 0.000 0.000 0.012 0.868 0.116
#> GSM877157     1  0.1757     0.6114 0.916 0.000 0.076 0.000 0.000 0.008
#> GSM877160     3  0.1116     0.9102 0.008 0.000 0.960 0.004 0.000 0.028
#> GSM877161     3  0.0717     0.9121 0.008 0.000 0.976 0.000 0.000 0.016
#> GSM877163     1  0.2783     0.6000 0.884 0.000 0.008 0.056 0.024 0.028
#> GSM877166     3  0.0717     0.9121 0.008 0.000 0.976 0.000 0.000 0.016
#> GSM877167     5  0.0291     0.5103 0.004 0.000 0.000 0.000 0.992 0.004
#> GSM877175     3  0.0260     0.9134 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM877177     1  0.4455     0.4372 0.680 0.000 0.264 0.008 0.000 0.048
#> GSM877184     1  0.1382     0.6160 0.948 0.000 0.008 0.000 0.008 0.036
#> GSM877187     6  0.5793     0.5905 0.148 0.000 0.000 0.008 0.352 0.492
#> GSM877188     3  0.3781     0.7100 0.204 0.000 0.756 0.004 0.000 0.036
#> GSM877150     3  0.0717     0.9121 0.008 0.000 0.976 0.000 0.000 0.016
#> GSM877165     2  0.0717     0.9523 0.000 0.976 0.000 0.016 0.000 0.008
#> GSM877183     6  0.5990     0.4638 0.040 0.000 0.000 0.168 0.212 0.580
#> GSM877178     3  0.4192     0.7340 0.028 0.000 0.748 0.036 0.000 0.188
#> GSM877182     1  0.6933    -0.2369 0.428 0.000 0.000 0.072 0.220 0.280

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)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-ATC-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-kmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-kmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) genotype/variation(p) other(p) k
#> ATC:kmeans 61            0.222                0.5482 1.14e-07 2
#> ATC:kmeans 53            0.539                0.6073 6.61e-08 3
#> ATC:kmeans 48            0.291                0.1547 1.09e-06 4
#> ATC:kmeans 51            0.250                0.0347 1.71e-07 5
#> ATC:kmeans 42            0.763                0.0590 2.10e-06 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC: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 62 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-skmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.982       0.992         0.5086 0.492   0.492
#> 3 3 0.763           0.740       0.875         0.2312 0.903   0.802
#> 4 4 0.744           0.760       0.868         0.1161 0.884   0.714
#> 5 5 0.737           0.697       0.859         0.0602 0.956   0.856
#> 6 6 0.787           0.640       0.832         0.0370 0.946   0.810

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM877144     1   0.000      0.994 1.000 0.000
#> GSM877128     1   0.000      0.994 1.000 0.000
#> GSM877164     1   0.000      0.994 1.000 0.000
#> GSM877162     2   0.000      0.990 0.000 1.000
#> GSM877127     1   0.000      0.994 1.000 0.000
#> GSM877138     1   0.000      0.994 1.000 0.000
#> GSM877140     1   0.000      0.994 1.000 0.000
#> GSM877156     2   0.000      0.990 0.000 1.000
#> GSM877130     2   0.000      0.990 0.000 1.000
#> GSM877141     2   0.000      0.990 0.000 1.000
#> GSM877142     2   0.000      0.990 0.000 1.000
#> GSM877145     2   0.000      0.990 0.000 1.000
#> GSM877151     2   0.000      0.990 0.000 1.000
#> GSM877158     2   0.000      0.990 0.000 1.000
#> GSM877173     2   0.000      0.990 0.000 1.000
#> GSM877176     2   0.000      0.990 0.000 1.000
#> GSM877179     2   0.000      0.990 0.000 1.000
#> GSM877181     2   0.000      0.990 0.000 1.000
#> GSM877185     2   0.000      0.990 0.000 1.000
#> GSM877131     2   0.000      0.990 0.000 1.000
#> GSM877147     2   0.891      0.555 0.308 0.692
#> GSM877155     2   0.000      0.990 0.000 1.000
#> GSM877159     2   0.000      0.990 0.000 1.000
#> GSM877170     2   0.000      0.990 0.000 1.000
#> GSM877186     1   0.000      0.994 1.000 0.000
#> GSM877132     2   0.000      0.990 0.000 1.000
#> GSM877143     2   0.000      0.990 0.000 1.000
#> GSM877146     2   0.000      0.990 0.000 1.000
#> GSM877148     2   0.000      0.990 0.000 1.000
#> GSM877152     2   0.000      0.990 0.000 1.000
#> GSM877168     2   0.000      0.990 0.000 1.000
#> GSM877180     2   0.000      0.990 0.000 1.000
#> GSM877126     1   0.000      0.994 1.000 0.000
#> GSM877129     1   0.000      0.994 1.000 0.000
#> GSM877133     1   0.000      0.994 1.000 0.000
#> GSM877153     1   0.000      0.994 1.000 0.000
#> GSM877169     1   0.000      0.994 1.000 0.000
#> GSM877171     1   0.000      0.994 1.000 0.000
#> GSM877174     1   0.000      0.994 1.000 0.000
#> GSM877134     1   0.662      0.789 0.828 0.172
#> GSM877135     1   0.000      0.994 1.000 0.000
#> GSM877136     1   0.000      0.994 1.000 0.000
#> GSM877137     1   0.000      0.994 1.000 0.000
#> GSM877139     1   0.000      0.994 1.000 0.000
#> GSM877149     1   0.000      0.994 1.000 0.000
#> GSM877154     2   0.000      0.990 0.000 1.000
#> GSM877157     1   0.000      0.994 1.000 0.000
#> GSM877160     1   0.000      0.994 1.000 0.000
#> GSM877161     1   0.000      0.994 1.000 0.000
#> GSM877163     1   0.000      0.994 1.000 0.000
#> GSM877166     1   0.000      0.994 1.000 0.000
#> GSM877167     2   0.000      0.990 0.000 1.000
#> GSM877175     1   0.000      0.994 1.000 0.000
#> GSM877177     1   0.000      0.994 1.000 0.000
#> GSM877184     1   0.000      0.994 1.000 0.000
#> GSM877187     2   0.000      0.990 0.000 1.000
#> GSM877188     1   0.000      0.994 1.000 0.000
#> GSM877150     1   0.000      0.994 1.000 0.000
#> GSM877165     2   0.000      0.990 0.000 1.000
#> GSM877183     2   0.000      0.990 0.000 1.000
#> GSM877178     1   0.000      0.994 1.000 0.000
#> GSM877182     2   0.000      0.990 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     1  0.6267      0.539 0.548 0.000 0.452
#> GSM877128     1  0.6008      0.617 0.628 0.000 0.372
#> GSM877164     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877162     2  0.5882      0.166 0.000 0.652 0.348
#> GSM877127     1  0.6267      0.539 0.548 0.000 0.452
#> GSM877138     1  0.6267      0.539 0.548 0.000 0.452
#> GSM877140     1  0.6260      0.543 0.552 0.000 0.448
#> GSM877156     2  0.3752      0.706 0.000 0.856 0.144
#> GSM877130     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877141     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877142     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877145     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877151     2  0.0237      0.896 0.000 0.996 0.004
#> GSM877158     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877173     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877176     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877179     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877181     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877185     2  0.0000      0.898 0.000 1.000 0.000
#> GSM877131     2  0.0237      0.896 0.000 0.996 0.004
#> GSM877147     3  0.4235      0.271 0.176 0.000 0.824
#> GSM877155     2  0.0237      0.896 0.000 0.996 0.004
#> GSM877159     3  0.1163      0.518 0.000 0.028 0.972
#> GSM877170     2  0.1163      0.871 0.000 0.972 0.028
#> GSM877186     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877132     2  0.0237      0.895 0.000 0.996 0.004
#> GSM877143     2  0.5678      0.256 0.000 0.684 0.316
#> GSM877146     2  0.5678      0.256 0.000 0.684 0.316
#> GSM877148     3  0.6302      0.447 0.000 0.480 0.520
#> GSM877152     3  0.6302      0.447 0.000 0.480 0.520
#> GSM877168     3  0.6302      0.447 0.000 0.480 0.520
#> GSM877180     3  0.6302      0.447 0.000 0.480 0.520
#> GSM877126     1  0.0237      0.873 0.996 0.000 0.004
#> GSM877129     1  0.6235      0.556 0.564 0.000 0.436
#> GSM877133     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877153     1  0.6260      0.543 0.552 0.000 0.448
#> GSM877169     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877171     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877174     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877134     1  0.5348      0.650 0.796 0.176 0.028
#> GSM877135     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877136     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877137     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877139     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877149     1  0.0237      0.873 0.996 0.000 0.004
#> GSM877154     2  0.5178      0.472 0.000 0.744 0.256
#> GSM877157     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877160     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877161     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877163     1  0.1031      0.859 0.976 0.000 0.024
#> GSM877166     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877167     2  0.0237      0.896 0.000 0.996 0.004
#> GSM877175     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877177     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877184     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877187     3  0.6291      0.456 0.000 0.468 0.532
#> GSM877188     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877150     1  0.0000      0.875 1.000 0.000 0.000
#> GSM877165     2  0.0237      0.896 0.000 0.996 0.004
#> GSM877183     3  0.1163      0.518 0.000 0.028 0.972
#> GSM877178     1  0.6026      0.613 0.624 0.000 0.376
#> GSM877182     2  0.1163      0.871 0.000 0.972 0.028

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.4697      0.908 0.356 0.000 0.644 0.000
#> GSM877128     1  0.4888     -0.411 0.588 0.000 0.412 0.000
#> GSM877164     1  0.0469      0.840 0.988 0.000 0.012 0.000
#> GSM877162     2  0.4624      0.495 0.000 0.660 0.000 0.340
#> GSM877127     3  0.4713      0.911 0.360 0.000 0.640 0.000
#> GSM877138     3  0.4730      0.912 0.364 0.000 0.636 0.000
#> GSM877140     3  0.4730      0.912 0.364 0.000 0.636 0.000
#> GSM877156     2  0.3444      0.752 0.000 0.816 0.000 0.184
#> GSM877130     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877141     2  0.0817      0.918 0.000 0.976 0.000 0.024
#> GSM877142     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877145     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877151     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877158     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877173     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877176     2  0.0707      0.921 0.000 0.980 0.000 0.020
#> GSM877179     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877181     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877185     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877131     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877147     3  0.6086      0.505 0.132 0.000 0.680 0.188
#> GSM877155     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877159     4  0.5000      0.220 0.000 0.000 0.496 0.504
#> GSM877170     2  0.2494      0.877 0.000 0.916 0.048 0.036
#> GSM877186     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877132     2  0.0188      0.930 0.000 0.996 0.000 0.004
#> GSM877143     4  0.5137      0.571 0.000 0.296 0.024 0.680
#> GSM877146     4  0.5137      0.571 0.000 0.296 0.024 0.680
#> GSM877148     4  0.1389      0.782 0.000 0.048 0.000 0.952
#> GSM877152     4  0.1474      0.781 0.000 0.052 0.000 0.948
#> GSM877168     4  0.1389      0.782 0.000 0.048 0.000 0.952
#> GSM877180     4  0.1389      0.782 0.000 0.048 0.000 0.952
#> GSM877126     1  0.3852      0.714 0.800 0.000 0.192 0.008
#> GSM877129     3  0.4916      0.819 0.424 0.000 0.576 0.000
#> GSM877133     1  0.0188      0.848 0.996 0.000 0.004 0.000
#> GSM877153     3  0.4746      0.908 0.368 0.000 0.632 0.000
#> GSM877169     1  0.0188      0.848 0.996 0.000 0.004 0.000
#> GSM877171     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877174     1  0.0188      0.848 0.996 0.000 0.004 0.000
#> GSM877134     1  0.6122      0.463 0.608 0.024 0.344 0.024
#> GSM877135     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877136     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877137     1  0.3401      0.747 0.840 0.000 0.152 0.008
#> GSM877139     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877149     1  0.3672      0.732 0.824 0.000 0.164 0.012
#> GSM877154     2  0.4406      0.573 0.000 0.700 0.000 0.300
#> GSM877157     1  0.2918      0.778 0.876 0.000 0.116 0.008
#> GSM877160     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877161     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877163     1  0.5047      0.544 0.668 0.000 0.316 0.016
#> GSM877166     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877167     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877175     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877177     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877184     1  0.2799      0.784 0.884 0.000 0.108 0.008
#> GSM877187     4  0.0707      0.767 0.000 0.020 0.000 0.980
#> GSM877188     1  0.1637      0.819 0.940 0.000 0.060 0.000
#> GSM877150     1  0.0000      0.850 1.000 0.000 0.000 0.000
#> GSM877165     2  0.0000      0.932 0.000 1.000 0.000 0.000
#> GSM877183     4  0.4925      0.337 0.000 0.000 0.428 0.572
#> GSM877178     1  0.4955     -0.519 0.556 0.000 0.444 0.000
#> GSM877182     2  0.4900      0.694 0.000 0.732 0.236 0.032

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.1851     0.6924 0.088 0.000 0.000 0.912 0.000
#> GSM877128     1  0.3911     0.6580 0.796 0.000 0.060 0.144 0.000
#> GSM877164     1  0.1628     0.8242 0.936 0.000 0.056 0.008 0.000
#> GSM877162     2  0.4838     0.4452 0.000 0.632 0.028 0.004 0.336
#> GSM877127     4  0.2516     0.7282 0.140 0.000 0.000 0.860 0.000
#> GSM877138     4  0.3336     0.7329 0.228 0.000 0.000 0.772 0.000
#> GSM877140     4  0.4354     0.7156 0.256 0.000 0.032 0.712 0.000
#> GSM877156     2  0.2249     0.8291 0.000 0.896 0.008 0.000 0.096
#> GSM877130     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877141     2  0.2507     0.8349 0.000 0.900 0.072 0.012 0.016
#> GSM877142     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877145     2  0.0671     0.9081 0.000 0.980 0.016 0.000 0.004
#> GSM877151     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877158     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877173     2  0.0162     0.9140 0.000 0.996 0.004 0.000 0.000
#> GSM877176     2  0.1153     0.8975 0.000 0.964 0.024 0.008 0.004
#> GSM877179     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877181     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877185     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877131     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877147     4  0.1442     0.5703 0.004 0.000 0.032 0.952 0.012
#> GSM877155     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877159     4  0.4909     0.0849 0.000 0.000 0.032 0.588 0.380
#> GSM877170     2  0.4613     0.5323 0.000 0.692 0.276 0.016 0.016
#> GSM877186     1  0.0000     0.8458 1.000 0.000 0.000 0.000 0.000
#> GSM877132     2  0.0771     0.9065 0.000 0.976 0.020 0.000 0.004
#> GSM877143     5  0.6771     0.5066 0.000 0.216 0.108 0.084 0.592
#> GSM877146     5  0.6771     0.5066 0.000 0.216 0.108 0.084 0.592
#> GSM877148     5  0.0609     0.7760 0.000 0.020 0.000 0.000 0.980
#> GSM877152     5  0.0865     0.7733 0.000 0.024 0.004 0.000 0.972
#> GSM877168     5  0.0510     0.7764 0.000 0.016 0.000 0.000 0.984
#> GSM877180     5  0.0510     0.7764 0.000 0.016 0.000 0.000 0.984
#> GSM877126     1  0.6021     0.3345 0.524 0.000 0.348 0.128 0.000
#> GSM877129     4  0.5767     0.3741 0.416 0.000 0.076 0.504 0.004
#> GSM877133     1  0.1043     0.8361 0.960 0.000 0.040 0.000 0.000
#> GSM877153     4  0.4655     0.7089 0.248 0.000 0.052 0.700 0.000
#> GSM877169     1  0.1270     0.8312 0.948 0.000 0.052 0.000 0.000
#> GSM877171     1  0.1341     0.8316 0.944 0.000 0.056 0.000 0.000
#> GSM877174     1  0.1270     0.8312 0.948 0.000 0.052 0.000 0.000
#> GSM877134     3  0.3491     0.4344 0.228 0.000 0.768 0.004 0.000
#> GSM877135     1  0.0000     0.8458 1.000 0.000 0.000 0.000 0.000
#> GSM877136     1  0.0000     0.8458 1.000 0.000 0.000 0.000 0.000
#> GSM877137     1  0.4201     0.2897 0.592 0.000 0.408 0.000 0.000
#> GSM877139     1  0.0162     0.8441 0.996 0.000 0.004 0.000 0.000
#> GSM877149     1  0.4262     0.1957 0.560 0.000 0.440 0.000 0.000
#> GSM877154     2  0.4418     0.5002 0.000 0.652 0.016 0.000 0.332
#> GSM877157     1  0.3932     0.4792 0.672 0.000 0.328 0.000 0.000
#> GSM877160     1  0.0290     0.8451 0.992 0.000 0.008 0.000 0.000
#> GSM877161     1  0.0000     0.8458 1.000 0.000 0.000 0.000 0.000
#> GSM877163     3  0.3983     0.3041 0.340 0.000 0.660 0.000 0.000
#> GSM877166     1  0.0000     0.8458 1.000 0.000 0.000 0.000 0.000
#> GSM877167     2  0.0912     0.9050 0.000 0.972 0.016 0.000 0.012
#> GSM877175     1  0.0290     0.8451 0.992 0.000 0.008 0.000 0.000
#> GSM877177     1  0.0000     0.8458 1.000 0.000 0.000 0.000 0.000
#> GSM877184     1  0.3837     0.5145 0.692 0.000 0.308 0.000 0.000
#> GSM877187     5  0.1605     0.7586 0.000 0.004 0.040 0.012 0.944
#> GSM877188     1  0.1908     0.7852 0.908 0.000 0.092 0.000 0.000
#> GSM877150     1  0.0000     0.8458 1.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.0000     0.9153 0.000 1.000 0.000 0.000 0.000
#> GSM877183     5  0.4977    -0.0364 0.000 0.000 0.028 0.472 0.500
#> GSM877178     1  0.4190     0.6021 0.768 0.000 0.060 0.172 0.000
#> GSM877182     3  0.5417    -0.2924 0.000 0.472 0.484 0.028 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
#> GSM877144     4  0.1391     0.6306 0.040 0.000 0.000 0.944 0.000 0.016
#> GSM877128     1  0.4471     0.6155 0.756 0.000 0.036 0.144 0.004 0.060
#> GSM877164     1  0.1922     0.7777 0.924 0.000 0.024 0.012 0.000 0.040
#> GSM877162     2  0.5048     0.3991 0.000 0.620 0.008 0.008 0.304 0.060
#> GSM877127     4  0.1806     0.6542 0.088 0.000 0.000 0.908 0.000 0.004
#> GSM877138     4  0.3479     0.6211 0.212 0.000 0.008 0.768 0.000 0.012
#> GSM877140     4  0.4876     0.5343 0.276 0.000 0.028 0.656 0.004 0.036
#> GSM877156     2  0.2277     0.8095 0.000 0.892 0.000 0.000 0.076 0.032
#> GSM877130     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877141     2  0.4079     0.5893 0.000 0.728 0.028 0.008 0.004 0.232
#> GSM877142     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877145     2  0.1080     0.8686 0.000 0.960 0.004 0.000 0.004 0.032
#> GSM877151     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877158     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877173     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877176     2  0.1858     0.8270 0.000 0.904 0.000 0.004 0.000 0.092
#> GSM877179     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877181     2  0.0260     0.8815 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM877185     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877131     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877147     4  0.2056     0.5694 0.000 0.000 0.012 0.904 0.004 0.080
#> GSM877155     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877159     4  0.5897     0.2829 0.000 0.000 0.016 0.536 0.280 0.168
#> GSM877170     2  0.5970    -0.0571 0.000 0.468 0.180 0.008 0.000 0.344
#> GSM877186     1  0.0520     0.7988 0.984 0.000 0.008 0.000 0.000 0.008
#> GSM877132     2  0.1268     0.8655 0.000 0.952 0.008 0.000 0.004 0.036
#> GSM877143     6  0.5230     0.3394 0.000 0.060 0.004 0.008 0.416 0.512
#> GSM877146     6  0.5230     0.3394 0.000 0.060 0.004 0.008 0.416 0.512
#> GSM877148     5  0.0665     0.9081 0.000 0.008 0.004 0.000 0.980 0.008
#> GSM877152     5  0.1218     0.8801 0.000 0.012 0.004 0.000 0.956 0.028
#> GSM877168     5  0.0146     0.9116 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM877180     5  0.0146     0.9116 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM877126     1  0.7131    -0.1068 0.428 0.000 0.308 0.140 0.004 0.120
#> GSM877129     1  0.6775    -0.1389 0.412 0.000 0.064 0.372 0.004 0.148
#> GSM877133     1  0.1088     0.7933 0.960 0.000 0.024 0.000 0.000 0.016
#> GSM877153     4  0.5263     0.5518 0.240 0.000 0.032 0.652 0.004 0.072
#> GSM877169     1  0.1176     0.7923 0.956 0.000 0.024 0.000 0.000 0.020
#> GSM877171     1  0.1867     0.7810 0.924 0.000 0.036 0.000 0.004 0.036
#> GSM877174     1  0.1633     0.7830 0.932 0.000 0.024 0.000 0.000 0.044
#> GSM877134     3  0.2680     0.4384 0.076 0.000 0.868 0.000 0.000 0.056
#> GSM877135     1  0.0520     0.7988 0.984 0.000 0.008 0.000 0.000 0.008
#> GSM877136     1  0.0260     0.7998 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM877137     3  0.4072     0.4743 0.448 0.000 0.544 0.000 0.000 0.008
#> GSM877139     1  0.1225     0.7812 0.952 0.000 0.036 0.000 0.000 0.012
#> GSM877149     3  0.3672     0.6380 0.368 0.000 0.632 0.000 0.000 0.000
#> GSM877154     2  0.4646     0.4143 0.000 0.616 0.004 0.000 0.332 0.048
#> GSM877157     1  0.3997    -0.4407 0.508 0.000 0.488 0.000 0.000 0.004
#> GSM877160     1  0.0363     0.8006 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM877161     1  0.0405     0.7995 0.988 0.000 0.008 0.000 0.000 0.004
#> GSM877163     3  0.2697     0.6482 0.188 0.000 0.812 0.000 0.000 0.000
#> GSM877166     1  0.0405     0.7995 0.988 0.000 0.008 0.000 0.000 0.004
#> GSM877167     2  0.1003     0.8713 0.000 0.964 0.004 0.000 0.004 0.028
#> GSM877175     1  0.0260     0.8003 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM877177     1  0.0622     0.7978 0.980 0.000 0.012 0.000 0.000 0.008
#> GSM877184     1  0.3852    -0.0421 0.612 0.000 0.384 0.000 0.000 0.004
#> GSM877187     5  0.3487     0.6907 0.000 0.000 0.012 0.012 0.776 0.200
#> GSM877188     1  0.2048     0.6905 0.880 0.000 0.120 0.000 0.000 0.000
#> GSM877150     1  0.0260     0.7998 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM877165     2  0.0000     0.8841 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877183     4  0.5813     0.0418 0.000 0.000 0.012 0.444 0.416 0.128
#> GSM877178     1  0.4395     0.6266 0.764 0.000 0.036 0.136 0.004 0.060
#> GSM877182     6  0.6471     0.1928 0.000 0.256 0.356 0.012 0.004 0.372

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-skmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-skmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-skmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>              n disease.state(p) genotype/variation(p) other(p) k
#> ATC:skmeans 62           0.2193               0.52956 7.89e-08 2
#> ATC:skmeans 52           0.0712               0.87261 2.33e-06 3
#> ATC:skmeans 56           0.4253               0.00833 1.26e-13 4
#> ATC:skmeans 51           0.7140               0.00467 2.17e-11 5
#> ATC:skmeans 48           0.9245               0.02449 1.34e-09 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC: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 62 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-pam-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.971       0.982         0.4357 0.568   0.568
#> 3 3 0.829           0.828       0.935         0.4545 0.668   0.474
#> 4 4 0.797           0.783       0.897         0.1541 0.821   0.559
#> 5 5 0.818           0.704       0.841         0.0531 0.877   0.591
#> 6 6 0.757           0.607       0.788         0.0340 0.934   0.718

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
#> GSM877144     1  0.0000      0.978 1.000 0.000
#> GSM877128     1  0.0000      0.978 1.000 0.000
#> GSM877164     1  0.0000      0.978 1.000 0.000
#> GSM877162     2  0.0000      0.989 0.000 1.000
#> GSM877127     1  0.0000      0.978 1.000 0.000
#> GSM877138     1  0.0000      0.978 1.000 0.000
#> GSM877140     1  0.0000      0.978 1.000 0.000
#> GSM877156     2  0.0000      0.989 0.000 1.000
#> GSM877130     2  0.0000      0.989 0.000 1.000
#> GSM877141     1  0.4562      0.919 0.904 0.096
#> GSM877142     2  0.0000      0.989 0.000 1.000
#> GSM877145     2  0.0672      0.986 0.008 0.992
#> GSM877151     2  0.0000      0.989 0.000 1.000
#> GSM877158     2  0.0000      0.989 0.000 1.000
#> GSM877173     2  0.0672      0.986 0.008 0.992
#> GSM877176     2  0.0672      0.986 0.008 0.992
#> GSM877179     2  0.0000      0.989 0.000 1.000
#> GSM877181     2  0.0000      0.989 0.000 1.000
#> GSM877185     2  0.0000      0.989 0.000 1.000
#> GSM877131     2  0.0000      0.989 0.000 1.000
#> GSM877147     1  0.3114      0.955 0.944 0.056
#> GSM877155     2  0.0000      0.989 0.000 1.000
#> GSM877159     1  0.3114      0.955 0.944 0.056
#> GSM877170     1  0.3274      0.952 0.940 0.060
#> GSM877186     1  0.0000      0.978 1.000 0.000
#> GSM877132     2  0.0672      0.986 0.008 0.992
#> GSM877143     1  0.3114      0.955 0.944 0.056
#> GSM877146     1  0.3114      0.955 0.944 0.056
#> GSM877148     1  0.6048      0.858 0.852 0.148
#> GSM877152     1  0.3114      0.955 0.944 0.056
#> GSM877168     2  0.5946      0.828 0.144 0.856
#> GSM877180     1  0.3114      0.955 0.944 0.056
#> GSM877126     1  0.0000      0.978 1.000 0.000
#> GSM877129     1  0.0000      0.978 1.000 0.000
#> GSM877133     1  0.0000      0.978 1.000 0.000
#> GSM877153     1  0.0000      0.978 1.000 0.000
#> GSM877169     1  0.0000      0.978 1.000 0.000
#> GSM877171     1  0.0000      0.978 1.000 0.000
#> GSM877174     1  0.0000      0.978 1.000 0.000
#> GSM877134     1  0.3114      0.955 0.944 0.056
#> GSM877135     1  0.0000      0.978 1.000 0.000
#> GSM877136     1  0.0000      0.978 1.000 0.000
#> GSM877137     1  0.0000      0.978 1.000 0.000
#> GSM877139     1  0.0000      0.978 1.000 0.000
#> GSM877149     1  0.0000      0.978 1.000 0.000
#> GSM877154     2  0.0672      0.986 0.008 0.992
#> GSM877157     1  0.0000      0.978 1.000 0.000
#> GSM877160     1  0.0000      0.978 1.000 0.000
#> GSM877161     1  0.0000      0.978 1.000 0.000
#> GSM877163     1  0.2948      0.957 0.948 0.052
#> GSM877166     1  0.0000      0.978 1.000 0.000
#> GSM877167     2  0.0672      0.986 0.008 0.992
#> GSM877175     1  0.0000      0.978 1.000 0.000
#> GSM877177     1  0.0000      0.978 1.000 0.000
#> GSM877184     1  0.0000      0.978 1.000 0.000
#> GSM877187     1  0.3114      0.955 0.944 0.056
#> GSM877188     1  0.0000      0.978 1.000 0.000
#> GSM877150     1  0.0000      0.978 1.000 0.000
#> GSM877165     2  0.0000      0.989 0.000 1.000
#> GSM877183     1  0.3114      0.955 0.944 0.056
#> GSM877178     1  0.0000      0.978 1.000 0.000
#> GSM877182     1  0.3114      0.955 0.944 0.056

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877128     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877164     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877162     3  0.4702     0.7154 0.000 0.212 0.788
#> GSM877127     1  0.3551     0.8232 0.868 0.000 0.132
#> GSM877138     1  0.0747     0.9436 0.984 0.000 0.016
#> GSM877140     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877156     3  0.4702     0.7147 0.000 0.212 0.788
#> GSM877130     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877141     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877142     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877145     2  0.6140     0.2020 0.000 0.596 0.404
#> GSM877151     2  0.6274     0.1065 0.000 0.544 0.456
#> GSM877158     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877173     3  0.4504     0.7326 0.000 0.196 0.804
#> GSM877176     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877179     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877181     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877185     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877131     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877147     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877155     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877159     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877170     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877186     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877132     3  0.4504     0.7326 0.000 0.196 0.804
#> GSM877143     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877146     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877148     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877152     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877168     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877180     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877126     1  0.1411     0.9269 0.964 0.000 0.036
#> GSM877129     3  0.6291     0.0434 0.468 0.000 0.532
#> GSM877133     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877153     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877169     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877171     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877174     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877134     3  0.1411     0.8418 0.036 0.000 0.964
#> GSM877135     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877136     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877137     1  0.6140     0.3030 0.596 0.000 0.404
#> GSM877139     1  0.1753     0.9156 0.952 0.000 0.048
#> GSM877149     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877154     3  0.4452     0.7365 0.000 0.192 0.808
#> GSM877157     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877160     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877161     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877163     1  0.6126     0.3116 0.600 0.000 0.400
#> GSM877166     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877167     3  0.4654     0.7195 0.000 0.208 0.792
#> GSM877175     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877177     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877184     3  0.6140     0.2502 0.404 0.000 0.596
#> GSM877187     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877188     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877150     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877165     2  0.0000     0.9005 0.000 1.000 0.000
#> GSM877183     3  0.0000     0.8723 0.000 0.000 1.000
#> GSM877178     1  0.0000     0.9556 1.000 0.000 0.000
#> GSM877182     3  0.0000     0.8723 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.0188     0.9033 0.004 0.000 0.996 0.000
#> GSM877128     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877164     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877162     2  0.4100     0.8204 0.048 0.824 0.000 0.128
#> GSM877127     3  0.4933     0.2690 0.432 0.000 0.568 0.000
#> GSM877138     3  0.4855     0.3416 0.400 0.000 0.600 0.000
#> GSM877140     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877156     2  0.4153     0.8176 0.048 0.820 0.000 0.132
#> GSM877130     4  0.0000     0.9640 0.000 0.000 0.000 1.000
#> GSM877141     2  0.0707     0.8940 0.020 0.980 0.000 0.000
#> GSM877142     4  0.1474     0.9607 0.052 0.000 0.000 0.948
#> GSM877145     1  0.6991     0.2631 0.524 0.348 0.000 0.128
#> GSM877151     2  0.4948     0.3251 0.000 0.560 0.000 0.440
#> GSM877158     4  0.1474     0.9607 0.052 0.000 0.000 0.948
#> GSM877173     2  0.4181     0.8189 0.052 0.820 0.000 0.128
#> GSM877176     2  0.0817     0.8964 0.024 0.976 0.000 0.000
#> GSM877179     4  0.1474     0.9607 0.052 0.000 0.000 0.948
#> GSM877181     4  0.1151     0.9469 0.024 0.008 0.000 0.968
#> GSM877185     4  0.1474     0.9607 0.052 0.000 0.000 0.948
#> GSM877131     4  0.1305     0.9342 0.004 0.036 0.000 0.960
#> GSM877147     2  0.0817     0.8916 0.024 0.976 0.000 0.000
#> GSM877155     4  0.0000     0.9640 0.000 0.000 0.000 1.000
#> GSM877159     2  0.0336     0.8994 0.008 0.992 0.000 0.000
#> GSM877170     1  0.4961     0.3470 0.552 0.448 0.000 0.000
#> GSM877186     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877132     1  0.6979     0.2719 0.528 0.344 0.000 0.128
#> GSM877143     2  0.0336     0.8996 0.008 0.992 0.000 0.000
#> GSM877146     2  0.0336     0.8996 0.008 0.992 0.000 0.000
#> GSM877148     2  0.0000     0.9002 0.000 1.000 0.000 0.000
#> GSM877152     2  0.0000     0.9002 0.000 1.000 0.000 0.000
#> GSM877168     2  0.0000     0.9002 0.000 1.000 0.000 0.000
#> GSM877180     2  0.0188     0.9001 0.004 0.996 0.000 0.000
#> GSM877126     1  0.2345     0.7377 0.900 0.000 0.100 0.000
#> GSM877129     3  0.6702     0.0675 0.436 0.088 0.476 0.000
#> GSM877133     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877153     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877169     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877171     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877174     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877134     1  0.2345     0.7135 0.900 0.100 0.000 0.000
#> GSM877135     3  0.0469     0.8971 0.012 0.000 0.988 0.000
#> GSM877136     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877137     1  0.2466     0.7389 0.900 0.004 0.096 0.000
#> GSM877139     1  0.4830     0.2087 0.608 0.000 0.392 0.000
#> GSM877149     1  0.2345     0.7377 0.900 0.000 0.100 0.000
#> GSM877154     2  0.4046     0.8229 0.048 0.828 0.000 0.124
#> GSM877157     1  0.2345     0.7377 0.900 0.000 0.100 0.000
#> GSM877160     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877161     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877163     1  0.2466     0.7389 0.900 0.004 0.096 0.000
#> GSM877166     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877167     2  0.4100     0.8204 0.048 0.824 0.000 0.128
#> GSM877175     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877177     3  0.4941     0.1209 0.436 0.000 0.564 0.000
#> GSM877184     1  0.2345     0.7135 0.900 0.100 0.000 0.000
#> GSM877187     2  0.0469     0.8981 0.012 0.988 0.000 0.000
#> GSM877188     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877150     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877165     4  0.0000     0.9640 0.000 0.000 0.000 1.000
#> GSM877183     2  0.0707     0.8939 0.020 0.980 0.000 0.000
#> GSM877178     3  0.0000     0.9064 0.000 0.000 1.000 0.000
#> GSM877182     1  0.4643     0.5316 0.656 0.344 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     1  0.0162     0.9651 0.996 0.000 0.004 0.000 0.000
#> GSM877128     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877164     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877162     4  0.1965     0.4802 0.000 0.000 0.000 0.904 0.096
#> GSM877127     3  0.4300     0.1332 0.476 0.000 0.524 0.000 0.000
#> GSM877138     1  0.4201     0.1686 0.592 0.000 0.408 0.000 0.000
#> GSM877140     1  0.0290     0.9613 0.992 0.000 0.000 0.000 0.008
#> GSM877156     4  0.1270     0.5314 0.000 0.000 0.000 0.948 0.052
#> GSM877130     2  0.6409     0.6536 0.000 0.468 0.000 0.180 0.352
#> GSM877141     5  0.4298     0.9724 0.000 0.000 0.008 0.352 0.640
#> GSM877142     2  0.0000     0.6880 0.000 1.000 0.000 0.000 0.000
#> GSM877145     4  0.4497     0.3160 0.000 0.000 0.352 0.632 0.016
#> GSM877151     4  0.4852     0.3835 0.000 0.184 0.000 0.716 0.100
#> GSM877158     2  0.0000     0.6880 0.000 1.000 0.000 0.000 0.000
#> GSM877173     4  0.0290     0.5730 0.000 0.000 0.000 0.992 0.008
#> GSM877176     5  0.4242     0.8782 0.000 0.000 0.000 0.428 0.572
#> GSM877179     2  0.0000     0.6880 0.000 1.000 0.000 0.000 0.000
#> GSM877181     4  0.5960    -0.0529 0.000 0.120 0.000 0.528 0.352
#> GSM877185     2  0.4030     0.7003 0.000 0.648 0.000 0.000 0.352
#> GSM877131     4  0.6405    -0.1709 0.000 0.176 0.000 0.460 0.364
#> GSM877147     5  0.4298     0.9724 0.000 0.000 0.008 0.352 0.640
#> GSM877155     2  0.6409     0.6536 0.000 0.468 0.000 0.180 0.352
#> GSM877159     5  0.4030     0.9772 0.000 0.000 0.000 0.352 0.648
#> GSM877170     3  0.4273     0.1848 0.000 0.000 0.552 0.000 0.448
#> GSM877186     1  0.0404     0.9577 0.988 0.000 0.012 0.000 0.000
#> GSM877132     4  0.4963     0.3084 0.000 0.000 0.352 0.608 0.040
#> GSM877143     5  0.4030     0.9772 0.000 0.000 0.000 0.352 0.648
#> GSM877146     5  0.4030     0.9772 0.000 0.000 0.000 0.352 0.648
#> GSM877148     5  0.4088     0.9713 0.000 0.000 0.000 0.368 0.632
#> GSM877152     5  0.4088     0.9713 0.000 0.000 0.000 0.368 0.632
#> GSM877168     4  0.4278    -0.6277 0.000 0.000 0.000 0.548 0.452
#> GSM877180     5  0.4088     0.9713 0.000 0.000 0.000 0.368 0.632
#> GSM877126     3  0.0000     0.7244 0.000 0.000 1.000 0.000 0.000
#> GSM877129     3  0.4030     0.4277 0.352 0.000 0.648 0.000 0.000
#> GSM877133     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877153     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877169     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877171     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877174     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877134     3  0.0000     0.7244 0.000 0.000 1.000 0.000 0.000
#> GSM877135     1  0.1544     0.8956 0.932 0.000 0.068 0.000 0.000
#> GSM877136     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877137     3  0.0000     0.7244 0.000 0.000 1.000 0.000 0.000
#> GSM877139     3  0.3534     0.5654 0.256 0.000 0.744 0.000 0.000
#> GSM877149     3  0.0000     0.7244 0.000 0.000 1.000 0.000 0.000
#> GSM877154     4  0.0510     0.5642 0.000 0.000 0.000 0.984 0.016
#> GSM877157     3  0.0000     0.7244 0.000 0.000 1.000 0.000 0.000
#> GSM877160     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877161     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877163     3  0.0000     0.7244 0.000 0.000 1.000 0.000 0.000
#> GSM877166     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877167     4  0.0000     0.5740 0.000 0.000 0.000 1.000 0.000
#> GSM877175     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877177     3  0.4278     0.2036 0.452 0.000 0.548 0.000 0.000
#> GSM877184     3  0.0000     0.7244 0.000 0.000 1.000 0.000 0.000
#> GSM877187     5  0.4045     0.9769 0.000 0.000 0.000 0.356 0.644
#> GSM877188     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877165     2  0.6409     0.6536 0.000 0.468 0.000 0.180 0.352
#> GSM877183     5  0.4196     0.9761 0.000 0.000 0.004 0.356 0.640
#> GSM877178     1  0.0000     0.9682 1.000 0.000 0.000 0.000 0.000
#> GSM877182     3  0.4921     0.3712 0.000 0.000 0.620 0.040 0.340

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     1  0.2320    0.81912 0.864 0.000 0.000 0.132 0.000 0.004
#> GSM877128     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877164     1  0.1196    0.91031 0.952 0.000 0.040 0.008 0.000 0.000
#> GSM877162     5  0.5749    0.27556 0.000 0.260 0.228 0.000 0.512 0.000
#> GSM877127     6  0.3862    0.17944 0.476 0.000 0.000 0.000 0.000 0.524
#> GSM877138     1  0.3774    0.12573 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM877140     1  0.0291    0.91639 0.992 0.000 0.000 0.004 0.004 0.000
#> GSM877156     5  0.5648    0.26278 0.000 0.156 0.372 0.000 0.472 0.000
#> GSM877130     2  0.0000    0.71232 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877141     4  0.3847    0.92462 0.000 0.000 0.000 0.544 0.456 0.000
#> GSM877142     3  0.5845    0.13663 0.000 0.212 0.472 0.316 0.000 0.000
#> GSM877145     3  0.5992   -0.01598 0.000 0.340 0.420 0.000 0.000 0.240
#> GSM877151     5  0.5823    0.19875 0.000 0.372 0.188 0.000 0.440 0.000
#> GSM877158     3  0.5845    0.13663 0.000 0.212 0.472 0.316 0.000 0.000
#> GSM877173     3  0.5992    0.03902 0.000 0.340 0.420 0.000 0.240 0.000
#> GSM877176     4  0.4603    0.87233 0.000 0.000 0.040 0.544 0.416 0.000
#> GSM877179     3  0.5845    0.13663 0.000 0.212 0.472 0.316 0.000 0.000
#> GSM877181     2  0.3390    0.45670 0.000 0.704 0.296 0.000 0.000 0.000
#> GSM877185     2  0.3578    0.25343 0.000 0.660 0.340 0.000 0.000 0.000
#> GSM877131     2  0.2883    0.55191 0.000 0.788 0.212 0.000 0.000 0.000
#> GSM877147     4  0.3515    0.73317 0.000 0.000 0.000 0.676 0.324 0.000
#> GSM877155     2  0.0000    0.71232 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877159     4  0.3847    0.92462 0.000 0.000 0.000 0.544 0.456 0.000
#> GSM877170     6  0.4697    0.16925 0.000 0.000 0.000 0.404 0.048 0.548
#> GSM877186     1  0.2520    0.88061 0.872 0.000 0.108 0.008 0.000 0.012
#> GSM877132     3  0.6825   -0.00478 0.000 0.340 0.372 0.048 0.000 0.240
#> GSM877143     4  0.3847    0.92462 0.000 0.000 0.000 0.544 0.456 0.000
#> GSM877146     4  0.3847    0.92462 0.000 0.000 0.000 0.544 0.456 0.000
#> GSM877148     5  0.0000    0.57871 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877152     5  0.0000    0.57871 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877168     5  0.0000    0.57871 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877180     5  0.0000    0.57871 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877126     6  0.0000    0.72376 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM877129     6  0.3620    0.46225 0.352 0.000 0.000 0.000 0.000 0.648
#> GSM877133     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877153     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877169     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877171     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877174     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877134     6  0.0000    0.72376 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM877135     1  0.1387    0.87308 0.932 0.000 0.000 0.000 0.000 0.068
#> GSM877136     1  0.2165    0.88719 0.884 0.000 0.108 0.008 0.000 0.000
#> GSM877137     6  0.0000    0.72376 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM877139     6  0.3175    0.57336 0.256 0.000 0.000 0.000 0.000 0.744
#> GSM877149     6  0.0000    0.72376 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM877154     5  0.3349    0.45946 0.000 0.008 0.244 0.000 0.748 0.000
#> GSM877157     6  0.0000    0.72376 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM877160     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877161     1  0.2165    0.88719 0.884 0.000 0.108 0.008 0.000 0.000
#> GSM877163     6  0.0000    0.72376 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM877166     1  0.2165    0.88719 0.884 0.000 0.108 0.008 0.000 0.000
#> GSM877167     3  0.5992    0.03902 0.000 0.340 0.420 0.000 0.240 0.000
#> GSM877175     1  0.2165    0.88719 0.884 0.000 0.108 0.008 0.000 0.000
#> GSM877177     6  0.3843    0.14241 0.452 0.000 0.000 0.000 0.000 0.548
#> GSM877184     6  0.0000    0.72376 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM877187     5  0.2697    0.14909 0.000 0.000 0.000 0.188 0.812 0.000
#> GSM877188     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877150     1  0.2165    0.88719 0.884 0.000 0.108 0.008 0.000 0.000
#> GSM877165     2  0.0000    0.71232 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877183     5  0.0000    0.57871 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877178     1  0.0000    0.91967 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877182     6  0.4737    0.36297 0.000 0.000 0.040 0.336 0.012 0.612

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-pam-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-pam-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) genotype/variation(p) other(p) k
#> ATC:pam 62            0.750                 0.723 8.81e-06 2
#> ATC:pam 56            0.554                 0.672 1.96e-08 3
#> ATC:pam 53            0.414                 0.672 4.77e-07 4
#> ATC:pam 49            0.843                 0.506 5.74e-07 5
#> ATC:pam 42            0.687                 0.960 5.64e-07 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC: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 62 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-mclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.331           0.669       0.829         0.3786 0.645   0.645
#> 3 3 0.230           0.643       0.769         0.4685 0.685   0.548
#> 4 4 0.560           0.600       0.796         0.2160 0.701   0.451
#> 5 5 0.615           0.465       0.739         0.1018 0.843   0.589
#> 6 6 0.684           0.625       0.791         0.0689 0.846   0.481

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
#> GSM877144     2   0.821     0.7390 0.256 0.744
#> GSM877128     2   0.891     0.6761 0.308 0.692
#> GSM877164     1   0.980     0.0792 0.584 0.416
#> GSM877162     2   0.821     0.7390 0.256 0.744
#> GSM877127     2   0.821     0.7390 0.256 0.744
#> GSM877138     2   0.821     0.7390 0.256 0.744
#> GSM877140     2   0.821     0.7390 0.256 0.744
#> GSM877156     2   0.000     0.7861 0.000 1.000
#> GSM877130     2   0.000     0.7861 0.000 1.000
#> GSM877141     2   0.689     0.7641 0.184 0.816
#> GSM877142     2   0.730     0.7530 0.204 0.796
#> GSM877145     2   0.000     0.7861 0.000 1.000
#> GSM877151     2   0.689     0.7641 0.184 0.816
#> GSM877158     2   0.730     0.7530 0.204 0.796
#> GSM877173     2   0.000     0.7861 0.000 1.000
#> GSM877176     2   0.000     0.7861 0.000 1.000
#> GSM877179     2   0.730     0.7530 0.204 0.796
#> GSM877181     2   0.000     0.7861 0.000 1.000
#> GSM877185     2   0.000     0.7861 0.000 1.000
#> GSM877131     2   0.689     0.7641 0.184 0.816
#> GSM877147     2   0.821     0.7390 0.256 0.744
#> GSM877155     2   0.689     0.7641 0.184 0.816
#> GSM877159     2   0.821     0.7390 0.256 0.744
#> GSM877170     2   0.689     0.7641 0.184 0.816
#> GSM877186     1   0.929     0.6539 0.656 0.344
#> GSM877132     2   0.000     0.7861 0.000 1.000
#> GSM877143     2   0.000     0.7861 0.000 1.000
#> GSM877146     2   0.000     0.7861 0.000 1.000
#> GSM877148     2   0.000     0.7861 0.000 1.000
#> GSM877152     2   0.000     0.7861 0.000 1.000
#> GSM877168     2   0.000     0.7861 0.000 1.000
#> GSM877180     2   0.000     0.7861 0.000 1.000
#> GSM877126     2   0.821     0.7390 0.256 0.744
#> GSM877129     2   0.827     0.7367 0.260 0.740
#> GSM877133     1   0.753     0.5164 0.784 0.216
#> GSM877153     2   0.827     0.7367 0.260 0.740
#> GSM877169     1   0.680     0.5616 0.820 0.180
#> GSM877171     1   0.978     0.0852 0.588 0.412
#> GSM877174     1   0.955     0.2075 0.624 0.376
#> GSM877134     2   0.000     0.7861 0.000 1.000
#> GSM877135     2   0.605     0.6498 0.148 0.852
#> GSM877136     1   0.730     0.7347 0.796 0.204
#> GSM877137     2   0.788     0.3801 0.236 0.764
#> GSM877139     2   1.000    -0.3732 0.500 0.500
#> GSM877149     2   0.866     0.3370 0.288 0.712
#> GSM877154     2   0.000     0.7861 0.000 1.000
#> GSM877157     2   0.574     0.6683 0.136 0.864
#> GSM877160     1   0.730     0.7347 0.796 0.204
#> GSM877161     1   0.730     0.7347 0.796 0.204
#> GSM877163     2   0.000     0.7861 0.000 1.000
#> GSM877166     1   0.900     0.6754 0.684 0.316
#> GSM877167     2   0.000     0.7861 0.000 1.000
#> GSM877175     1   0.730     0.7347 0.796 0.204
#> GSM877177     1   0.943     0.6246 0.640 0.360
#> GSM877184     2   0.981    -0.1457 0.420 0.580
#> GSM877187     2   0.000     0.7861 0.000 1.000
#> GSM877188     1   0.760     0.7326 0.780 0.220
#> GSM877150     1   0.730     0.7347 0.796 0.204
#> GSM877165     2   0.000     0.7861 0.000 1.000
#> GSM877183     2   0.689     0.7641 0.184 0.816
#> GSM877178     2   0.827     0.7367 0.260 0.740
#> GSM877182     2   0.689     0.7641 0.184 0.816

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     2  0.8029      0.663 0.172 0.656 0.172
#> GSM877128     1  0.5363      0.394 0.724 0.276 0.000
#> GSM877164     1  0.5216      0.415 0.740 0.260 0.000
#> GSM877162     2  0.4178      0.663 0.000 0.828 0.172
#> GSM877127     2  0.8029      0.663 0.172 0.656 0.172
#> GSM877138     2  0.8029      0.663 0.172 0.656 0.172
#> GSM877140     2  0.8029      0.663 0.172 0.656 0.172
#> GSM877156     2  0.6229     -0.304 0.008 0.652 0.340
#> GSM877130     2  0.2774      0.691 0.008 0.920 0.072
#> GSM877141     2  0.4399      0.679 0.188 0.812 0.000
#> GSM877142     2  0.8125      0.634 0.172 0.648 0.180
#> GSM877145     2  0.0661      0.679 0.008 0.988 0.004
#> GSM877151     2  0.0000      0.683 0.000 1.000 0.000
#> GSM877158     2  0.8125      0.634 0.172 0.648 0.180
#> GSM877173     2  0.0661      0.679 0.008 0.988 0.004
#> GSM877176     2  0.1585      0.657 0.008 0.964 0.028
#> GSM877179     2  0.8125      0.634 0.172 0.648 0.180
#> GSM877181     2  0.2774      0.691 0.008 0.920 0.072
#> GSM877185     2  0.2774      0.691 0.008 0.920 0.072
#> GSM877131     2  0.4842      0.664 0.000 0.776 0.224
#> GSM877147     2  0.7027      0.688 0.104 0.724 0.172
#> GSM877155     2  0.2261      0.696 0.000 0.932 0.068
#> GSM877159     2  0.4409      0.665 0.004 0.824 0.172
#> GSM877170     2  0.5327      0.685 0.272 0.728 0.000
#> GSM877186     1  0.6008      0.564 0.628 0.372 0.000
#> GSM877132     2  0.0661      0.679 0.008 0.988 0.004
#> GSM877143     2  0.1950      0.644 0.008 0.952 0.040
#> GSM877146     2  0.2063      0.639 0.008 0.948 0.044
#> GSM877148     3  0.6553      0.880 0.008 0.412 0.580
#> GSM877152     3  0.6252      0.929 0.008 0.344 0.648
#> GSM877168     3  0.6275      0.930 0.008 0.348 0.644
#> GSM877180     3  0.6318      0.926 0.008 0.356 0.636
#> GSM877126     1  0.6225     -0.119 0.568 0.432 0.000
#> GSM877129     2  0.5678      0.660 0.316 0.684 0.000
#> GSM877133     1  0.5497      0.714 0.708 0.292 0.000
#> GSM877153     2  0.5859      0.633 0.344 0.656 0.000
#> GSM877169     1  0.5098      0.750 0.752 0.248 0.000
#> GSM877171     1  0.5216      0.415 0.740 0.260 0.000
#> GSM877174     1  0.5216      0.415 0.740 0.260 0.000
#> GSM877134     2  0.5733      0.309 0.324 0.676 0.000
#> GSM877135     1  0.4702      0.768 0.788 0.212 0.000
#> GSM877136     1  0.4178      0.774 0.828 0.172 0.000
#> GSM877137     1  0.5098      0.740 0.752 0.248 0.000
#> GSM877139     1  0.4399      0.778 0.812 0.188 0.000
#> GSM877149     1  0.5138      0.738 0.748 0.252 0.000
#> GSM877154     3  0.6252      0.929 0.008 0.344 0.648
#> GSM877157     2  0.6079      0.188 0.388 0.612 0.000
#> GSM877160     1  0.4178      0.774 0.828 0.172 0.000
#> GSM877161     1  0.4178      0.774 0.828 0.172 0.000
#> GSM877163     2  0.4235      0.624 0.176 0.824 0.000
#> GSM877166     1  0.4399      0.778 0.812 0.188 0.000
#> GSM877167     2  0.3965      0.489 0.008 0.860 0.132
#> GSM877175     1  0.4178      0.774 0.828 0.172 0.000
#> GSM877177     1  0.4399      0.778 0.812 0.188 0.000
#> GSM877184     1  0.4504      0.775 0.804 0.196 0.000
#> GSM877187     3  0.6676      0.770 0.008 0.476 0.516
#> GSM877188     1  0.4235      0.775 0.824 0.176 0.000
#> GSM877150     1  0.4178      0.774 0.828 0.172 0.000
#> GSM877165     2  0.2774      0.691 0.008 0.920 0.072
#> GSM877183     2  0.5810      0.346 0.000 0.664 0.336
#> GSM877178     2  0.5859      0.633 0.344 0.656 0.000
#> GSM877182     2  0.5327      0.685 0.272 0.728 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.2179     0.8217 0.012 0.064 0.924 0.000
#> GSM877128     1  0.2456     0.8655 0.916 0.068 0.008 0.008
#> GSM877164     1  0.1114     0.8623 0.972 0.016 0.004 0.008
#> GSM877162     2  0.4533     0.5024 0.004 0.752 0.232 0.012
#> GSM877127     3  0.5544     0.8158 0.076 0.168 0.744 0.012
#> GSM877138     3  0.5674     0.7864 0.132 0.148 0.720 0.000
#> GSM877140     3  0.4948     0.8231 0.100 0.124 0.776 0.000
#> GSM877156     2  0.3873     0.5860 0.000 0.844 0.060 0.096
#> GSM877130     2  0.5771    -0.5113 0.000 0.512 0.028 0.460
#> GSM877141     2  0.1890     0.5692 0.056 0.936 0.000 0.008
#> GSM877142     4  0.5624     1.0000 0.000 0.280 0.052 0.668
#> GSM877145     2  0.1486     0.5845 0.008 0.960 0.008 0.024
#> GSM877151     2  0.1209     0.5785 0.000 0.964 0.032 0.004
#> GSM877158     4  0.5624     1.0000 0.000 0.280 0.052 0.668
#> GSM877173     2  0.1617     0.5837 0.008 0.956 0.012 0.024
#> GSM877176     2  0.0000     0.5918 0.000 1.000 0.000 0.000
#> GSM877179     4  0.5624     1.0000 0.000 0.280 0.052 0.668
#> GSM877181     2  0.4374     0.3781 0.008 0.800 0.024 0.168
#> GSM877185     2  0.6301    -0.5452 0.008 0.492 0.040 0.460
#> GSM877131     2  0.6302    -0.3229 0.000 0.564 0.068 0.368
#> GSM877147     3  0.2124     0.8199 0.008 0.068 0.924 0.000
#> GSM877155     2  0.5738    -0.4351 0.000 0.540 0.028 0.432
#> GSM877159     3  0.4318     0.7384 0.004 0.208 0.776 0.012
#> GSM877170     2  0.3498     0.4752 0.160 0.832 0.000 0.008
#> GSM877186     1  0.3679     0.8586 0.856 0.084 0.060 0.000
#> GSM877132     2  0.1486     0.5845 0.008 0.960 0.008 0.024
#> GSM877143     2  0.0469     0.5944 0.012 0.988 0.000 0.000
#> GSM877146     2  0.0592     0.5938 0.016 0.984 0.000 0.000
#> GSM877148     2  0.5921     0.5304 0.004 0.652 0.056 0.288
#> GSM877152     2  0.6129     0.5075 0.004 0.612 0.056 0.328
#> GSM877168     2  0.6129     0.5075 0.004 0.612 0.056 0.328
#> GSM877180     2  0.6129     0.5075 0.004 0.612 0.056 0.328
#> GSM877126     1  0.5378     0.4169 0.612 0.372 0.008 0.008
#> GSM877129     1  0.8020    -0.1625 0.412 0.236 0.344 0.008
#> GSM877133     1  0.1004     0.8769 0.972 0.024 0.004 0.000
#> GSM877153     3  0.3558     0.8142 0.048 0.072 0.872 0.008
#> GSM877169     1  0.0895     0.8719 0.976 0.020 0.004 0.000
#> GSM877171     1  0.1114     0.8623 0.972 0.016 0.004 0.008
#> GSM877174     1  0.1114     0.8623 0.972 0.016 0.004 0.008
#> GSM877134     2  0.5281    -0.0876 0.464 0.528 0.008 0.000
#> GSM877135     1  0.2530     0.8779 0.896 0.100 0.004 0.000
#> GSM877136     1  0.1209     0.8781 0.964 0.032 0.004 0.000
#> GSM877137     1  0.3450     0.8323 0.836 0.156 0.008 0.000
#> GSM877139     1  0.2611     0.8773 0.896 0.096 0.008 0.000
#> GSM877149     1  0.2546     0.8775 0.900 0.092 0.008 0.000
#> GSM877154     2  0.6129     0.5075 0.004 0.612 0.056 0.328
#> GSM877157     1  0.2928     0.8675 0.880 0.108 0.012 0.000
#> GSM877160     1  0.1661     0.8820 0.944 0.052 0.004 0.000
#> GSM877161     1  0.1209     0.8781 0.964 0.032 0.004 0.000
#> GSM877163     1  0.4936     0.5051 0.624 0.372 0.004 0.000
#> GSM877166     1  0.1716     0.8826 0.936 0.064 0.000 0.000
#> GSM877167     2  0.2830     0.5889 0.000 0.900 0.060 0.040
#> GSM877175     1  0.1209     0.8781 0.964 0.032 0.004 0.000
#> GSM877177     1  0.2412     0.8794 0.908 0.084 0.008 0.000
#> GSM877184     1  0.2675     0.8772 0.892 0.100 0.008 0.000
#> GSM877187     2  0.5796     0.5392 0.004 0.672 0.056 0.268
#> GSM877188     1  0.1209     0.8781 0.964 0.032 0.004 0.000
#> GSM877150     1  0.1209     0.8781 0.964 0.032 0.004 0.000
#> GSM877165     2  0.5682    -0.4992 0.000 0.520 0.024 0.456
#> GSM877183     2  0.7346     0.4360 0.004 0.552 0.224 0.220
#> GSM877178     1  0.4990     0.7407 0.788 0.096 0.108 0.008
#> GSM877182     2  0.4034     0.4408 0.192 0.796 0.004 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.0703    0.62168 0.000 0.000 0.024 0.976 0.000
#> GSM877128     1  0.4941    0.50721 0.640 0.016 0.324 0.020 0.000
#> GSM877164     1  0.4775    0.52379 0.660 0.032 0.304 0.004 0.000
#> GSM877162     5  0.6489   -0.00144 0.000 0.032 0.100 0.340 0.528
#> GSM877127     4  0.6666    0.48561 0.072 0.016 0.044 0.572 0.296
#> GSM877138     4  0.5736    0.32444 0.364 0.016 0.048 0.568 0.004
#> GSM877140     4  0.5707    0.54901 0.160 0.000 0.216 0.624 0.000
#> GSM877156     5  0.1800    0.58889 0.000 0.020 0.048 0.000 0.932
#> GSM877130     3  0.7284   -0.15005 0.000 0.256 0.384 0.024 0.336
#> GSM877141     3  0.4748    0.07333 0.000 0.020 0.680 0.016 0.284
#> GSM877142     2  0.1197    0.71176 0.000 0.952 0.048 0.000 0.000
#> GSM877145     5  0.4974    0.48218 0.000 0.032 0.408 0.000 0.560
#> GSM877151     5  0.5611    0.47460 0.000 0.036 0.384 0.024 0.556
#> GSM877158     2  0.1197    0.71176 0.000 0.952 0.048 0.000 0.000
#> GSM877173     5  0.4974    0.48218 0.000 0.032 0.408 0.000 0.560
#> GSM877176     5  0.4736    0.48923 0.000 0.020 0.404 0.000 0.576
#> GSM877179     2  0.1197    0.71176 0.000 0.952 0.048 0.000 0.000
#> GSM877181     5  0.5461    0.44867 0.000 0.064 0.408 0.000 0.528
#> GSM877185     2  0.7274   -0.17276 0.000 0.388 0.252 0.024 0.336
#> GSM877131     5  0.6020    0.44473 0.000 0.064 0.380 0.024 0.532
#> GSM877147     4  0.1357    0.61646 0.000 0.000 0.048 0.948 0.004
#> GSM877155     3  0.7284   -0.15005 0.000 0.256 0.384 0.024 0.336
#> GSM877159     4  0.5957    0.59676 0.092 0.016 0.104 0.712 0.076
#> GSM877170     3  0.5658    0.20391 0.060 0.020 0.680 0.016 0.224
#> GSM877186     1  0.2338    0.74045 0.884 0.000 0.004 0.112 0.000
#> GSM877132     5  0.4974    0.48218 0.000 0.032 0.408 0.000 0.560
#> GSM877143     5  0.4481    0.48383 0.000 0.008 0.416 0.000 0.576
#> GSM877146     5  0.4481    0.48383 0.000 0.008 0.416 0.000 0.576
#> GSM877148     5  0.0000    0.58842 0.000 0.000 0.000 0.000 1.000
#> GSM877152     5  0.0000    0.58842 0.000 0.000 0.000 0.000 1.000
#> GSM877168     5  0.0000    0.58842 0.000 0.000 0.000 0.000 1.000
#> GSM877180     5  0.0000    0.58842 0.000 0.000 0.000 0.000 1.000
#> GSM877126     3  0.5897   -0.39495 0.424 0.016 0.512 0.016 0.032
#> GSM877129     3  0.4113    0.05479 0.076 0.000 0.784 0.140 0.000
#> GSM877133     1  0.1168    0.78253 0.960 0.032 0.008 0.000 0.000
#> GSM877153     4  0.4074    0.44657 0.000 0.000 0.364 0.636 0.000
#> GSM877169     1  0.2377    0.72250 0.872 0.000 0.128 0.000 0.000
#> GSM877171     1  0.4735    0.53375 0.668 0.032 0.296 0.004 0.000
#> GSM877174     1  0.4735    0.53375 0.668 0.032 0.296 0.004 0.000
#> GSM877134     1  0.5411    0.42746 0.576 0.012 0.376 0.004 0.032
#> GSM877135     1  0.1117    0.77828 0.964 0.016 0.020 0.000 0.000
#> GSM877136     1  0.0880    0.78439 0.968 0.032 0.000 0.000 0.000
#> GSM877137     1  0.4774    0.64932 0.716 0.016 0.236 0.004 0.028
#> GSM877139     1  0.3972    0.68298 0.764 0.016 0.212 0.008 0.000
#> GSM877149     1  0.3944    0.67727 0.756 0.016 0.224 0.004 0.000
#> GSM877154     5  0.0000    0.58842 0.000 0.000 0.000 0.000 1.000
#> GSM877157     1  0.6232    0.51500 0.612 0.016 0.224 0.004 0.144
#> GSM877160     1  0.0880    0.78439 0.968 0.032 0.000 0.000 0.000
#> GSM877161     1  0.0880    0.78439 0.968 0.032 0.000 0.000 0.000
#> GSM877163     3  0.5089   -0.12656 0.432 0.000 0.536 0.004 0.028
#> GSM877166     1  0.1012    0.77911 0.968 0.012 0.020 0.000 0.000
#> GSM877167     5  0.2067    0.58645 0.000 0.032 0.048 0.000 0.920
#> GSM877175     1  0.0880    0.78439 0.968 0.032 0.000 0.000 0.000
#> GSM877177     1  0.1774    0.77130 0.932 0.016 0.052 0.000 0.000
#> GSM877184     1  0.4243    0.66569 0.732 0.016 0.244 0.004 0.004
#> GSM877187     5  0.0290    0.58844 0.000 0.000 0.008 0.000 0.992
#> GSM877188     1  0.0880    0.78439 0.968 0.032 0.000 0.000 0.000
#> GSM877150     1  0.0880    0.78439 0.968 0.032 0.000 0.000 0.000
#> GSM877165     3  0.7284   -0.15005 0.000 0.256 0.384 0.024 0.336
#> GSM877183     5  0.4126   -0.09454 0.000 0.000 0.000 0.380 0.620
#> GSM877178     3  0.6790   -0.32964 0.284 0.000 0.364 0.352 0.000
#> GSM877182     3  0.4327    0.33126 0.064 0.008 0.804 0.016 0.108

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.0865     0.5917 0.000 0.000 0.036 0.964 0.000 0.000
#> GSM877128     3  0.4937     0.2259 0.460 0.000 0.492 0.028 0.000 0.020
#> GSM877164     3  0.3789     0.5485 0.332 0.008 0.660 0.000 0.000 0.000
#> GSM877162     4  0.4607     0.4309 0.000 0.056 0.000 0.616 0.328 0.000
#> GSM877127     4  0.5827     0.5895 0.040 0.000 0.080 0.624 0.236 0.020
#> GSM877138     4  0.5307     0.4382 0.272 0.000 0.080 0.624 0.004 0.020
#> GSM877140     4  0.5466     0.2330 0.164 0.000 0.280 0.556 0.000 0.000
#> GSM877156     5  0.2883     0.6269 0.000 0.212 0.000 0.000 0.788 0.000
#> GSM877130     2  0.0937     0.8346 0.000 0.960 0.000 0.000 0.000 0.040
#> GSM877141     3  0.4616     0.1369 0.000 0.360 0.596 0.000 0.040 0.004
#> GSM877142     6  0.1141     1.0000 0.000 0.052 0.000 0.000 0.000 0.948
#> GSM877145     2  0.3460     0.7746 0.000 0.796 0.164 0.000 0.036 0.004
#> GSM877151     2  0.1572     0.8439 0.000 0.936 0.000 0.000 0.028 0.036
#> GSM877158     6  0.1141     1.0000 0.000 0.052 0.000 0.000 0.000 0.948
#> GSM877173     2  0.3134     0.7910 0.000 0.820 0.144 0.000 0.036 0.000
#> GSM877176     2  0.6097     0.5126 0.036 0.576 0.180 0.000 0.204 0.004
#> GSM877179     6  0.1141     1.0000 0.000 0.052 0.000 0.000 0.000 0.948
#> GSM877181     2  0.1498     0.8447 0.000 0.940 0.000 0.000 0.028 0.032
#> GSM877185     2  0.2491     0.7645 0.000 0.836 0.000 0.000 0.000 0.164
#> GSM877131     2  0.1327     0.8304 0.000 0.936 0.000 0.000 0.064 0.000
#> GSM877147     4  0.1572     0.5888 0.000 0.000 0.036 0.936 0.000 0.028
#> GSM877155     2  0.0937     0.8346 0.000 0.960 0.000 0.000 0.000 0.040
#> GSM877159     4  0.4918     0.6247 0.024 0.028 0.016 0.736 0.168 0.028
#> GSM877170     3  0.4593     0.1522 0.000 0.352 0.604 0.000 0.040 0.004
#> GSM877186     1  0.4042     0.6181 0.760 0.000 0.020 0.040 0.180 0.000
#> GSM877132     2  0.3596     0.7657 0.000 0.784 0.172 0.000 0.040 0.004
#> GSM877143     5  0.7201     0.1079 0.112 0.260 0.184 0.000 0.440 0.004
#> GSM877146     5  0.6526    -0.0412 0.032 0.344 0.180 0.000 0.440 0.004
#> GSM877148     5  0.0405     0.7506 0.000 0.004 0.000 0.008 0.988 0.000
#> GSM877152     5  0.0000     0.7514 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877168     5  0.0146     0.7511 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM877180     5  0.0260     0.7500 0.000 0.000 0.000 0.008 0.992 0.000
#> GSM877126     3  0.4318     0.1453 0.448 0.000 0.532 0.000 0.000 0.020
#> GSM877129     3  0.4339     0.4917 0.080 0.076 0.776 0.068 0.000 0.000
#> GSM877133     1  0.0260     0.8128 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM877153     3  0.4100     0.2489 0.004 0.008 0.600 0.388 0.000 0.000
#> GSM877169     1  0.1327     0.7785 0.936 0.000 0.064 0.000 0.000 0.000
#> GSM877171     3  0.3774     0.5485 0.328 0.008 0.664 0.000 0.000 0.000
#> GSM877174     3  0.3847     0.5424 0.348 0.008 0.644 0.000 0.000 0.000
#> GSM877134     1  0.4587     0.5281 0.640 0.040 0.312 0.000 0.004 0.004
#> GSM877135     1  0.5375     0.3432 0.536 0.000 0.068 0.000 0.376 0.020
#> GSM877136     1  0.0146     0.8138 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM877137     1  0.2907     0.7753 0.828 0.000 0.152 0.000 0.000 0.020
#> GSM877139     1  0.2624     0.7820 0.856 0.000 0.124 0.000 0.000 0.020
#> GSM877149     1  0.2624     0.7820 0.856 0.000 0.124 0.000 0.000 0.020
#> GSM877154     5  0.0000     0.7514 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM877157     1  0.4206     0.7306 0.768 0.000 0.124 0.000 0.088 0.020
#> GSM877160     1  0.0363     0.8117 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM877161     1  0.0146     0.8138 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM877163     1  0.6007     0.1800 0.464 0.224 0.308 0.000 0.000 0.004
#> GSM877166     1  0.0547     0.8142 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM877167     5  0.3076     0.6016 0.000 0.240 0.000 0.000 0.760 0.000
#> GSM877175     1  0.0000     0.8132 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM877177     1  0.2199     0.7951 0.892 0.000 0.088 0.000 0.000 0.020
#> GSM877184     1  0.3485     0.7444 0.772 0.004 0.204 0.000 0.000 0.020
#> GSM877187     5  0.0146     0.7519 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM877188     1  0.1265     0.7919 0.948 0.008 0.044 0.000 0.000 0.000
#> GSM877150     1  0.0146     0.8138 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM877165     2  0.0937     0.8346 0.000 0.960 0.000 0.000 0.000 0.040
#> GSM877183     5  0.2994     0.5129 0.000 0.000 0.000 0.208 0.788 0.004
#> GSM877178     3  0.5091     0.4790 0.188 0.008 0.656 0.148 0.000 0.000
#> GSM877182     3  0.3805     0.2400 0.000 0.328 0.664 0.000 0.004 0.004

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-mclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n disease.state(p) genotype/variation(p) other(p) k
#> ATC:mclust 55           0.7937                0.0723 3.46e-03 2
#> ATC:mclust 52           0.9227                0.2569 4.98e-08 3
#> ATC:mclust 50           0.8130                0.0547 2.56e-08 4
#> ATC:mclust 36           0.6389                0.4632 2.90e-10 5
#> ATC:mclust 47           0.0178                0.5806 2.56e-10 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC: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 62 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-NMF-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.771           0.831       0.933         0.4922 0.497   0.497
#> 3 3 0.719           0.793       0.902         0.2776 0.835   0.679
#> 4 4 0.577           0.677       0.821         0.1735 0.847   0.606
#> 5 5 0.561           0.531       0.721         0.0562 0.905   0.658
#> 6 6 0.590           0.531       0.740         0.0355 0.918   0.656

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
#> GSM877144     1  0.0000      0.906 1.000 0.000
#> GSM877128     1  0.0000      0.906 1.000 0.000
#> GSM877164     1  0.0000      0.906 1.000 0.000
#> GSM877162     2  0.0000      0.933 0.000 1.000
#> GSM877127     1  0.2043      0.886 0.968 0.032
#> GSM877138     1  0.0376      0.905 0.996 0.004
#> GSM877140     1  0.0000      0.906 1.000 0.000
#> GSM877156     2  0.0000      0.933 0.000 1.000
#> GSM877130     2  0.0000      0.933 0.000 1.000
#> GSM877141     2  0.0000      0.933 0.000 1.000
#> GSM877142     2  0.0000      0.933 0.000 1.000
#> GSM877145     2  0.0000      0.933 0.000 1.000
#> GSM877151     2  0.0000      0.933 0.000 1.000
#> GSM877158     2  0.0000      0.933 0.000 1.000
#> GSM877173     2  0.0000      0.933 0.000 1.000
#> GSM877176     2  0.0000      0.933 0.000 1.000
#> GSM877179     2  0.0000      0.933 0.000 1.000
#> GSM877181     2  0.0000      0.933 0.000 1.000
#> GSM877185     2  0.0000      0.933 0.000 1.000
#> GSM877131     2  0.0000      0.933 0.000 1.000
#> GSM877147     1  0.9000      0.526 0.684 0.316
#> GSM877155     2  0.0000      0.933 0.000 1.000
#> GSM877159     2  0.4022      0.865 0.080 0.920
#> GSM877170     2  0.0376      0.930 0.004 0.996
#> GSM877186     1  0.0000      0.906 1.000 0.000
#> GSM877132     2  0.0000      0.933 0.000 1.000
#> GSM877143     2  0.0376      0.930 0.004 0.996
#> GSM877146     2  0.0000      0.933 0.000 1.000
#> GSM877148     2  0.0000      0.933 0.000 1.000
#> GSM877152     2  0.0000      0.933 0.000 1.000
#> GSM877168     2  0.0000      0.933 0.000 1.000
#> GSM877180     2  0.0000      0.933 0.000 1.000
#> GSM877126     2  0.9635      0.347 0.388 0.612
#> GSM877129     2  0.9393      0.434 0.356 0.644
#> GSM877133     1  0.0000      0.906 1.000 0.000
#> GSM877153     1  0.0000      0.906 1.000 0.000
#> GSM877169     1  0.0000      0.906 1.000 0.000
#> GSM877171     1  0.0000      0.906 1.000 0.000
#> GSM877174     1  0.0000      0.906 1.000 0.000
#> GSM877134     2  0.9427      0.425 0.360 0.640
#> GSM877135     1  0.0000      0.906 1.000 0.000
#> GSM877136     1  0.0000      0.906 1.000 0.000
#> GSM877137     1  0.9954      0.165 0.540 0.460
#> GSM877139     1  0.7219      0.714 0.800 0.200
#> GSM877149     1  0.9661      0.371 0.608 0.392
#> GSM877154     2  0.0000      0.933 0.000 1.000
#> GSM877157     1  0.9608      0.391 0.616 0.384
#> GSM877160     1  0.0000      0.906 1.000 0.000
#> GSM877161     1  0.0000      0.906 1.000 0.000
#> GSM877163     2  0.9286      0.462 0.344 0.656
#> GSM877166     1  0.0376      0.905 0.996 0.004
#> GSM877167     2  0.0000      0.933 0.000 1.000
#> GSM877175     1  0.0000      0.906 1.000 0.000
#> GSM877177     1  0.1633      0.892 0.976 0.024
#> GSM877184     1  0.9815      0.295 0.580 0.420
#> GSM877187     2  0.4562      0.848 0.096 0.904
#> GSM877188     1  0.0000      0.906 1.000 0.000
#> GSM877150     1  0.0000      0.906 1.000 0.000
#> GSM877165     2  0.0000      0.933 0.000 1.000
#> GSM877183     2  0.8386      0.611 0.268 0.732
#> GSM877178     1  0.0000      0.906 1.000 0.000
#> GSM877182     2  0.0000      0.933 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM877144     3  0.1411     0.8919 0.036 0.000 0.964
#> GSM877128     3  0.5431     0.6972 0.284 0.000 0.716
#> GSM877164     1  0.2261     0.7783 0.932 0.000 0.068
#> GSM877162     3  0.2356     0.8560 0.000 0.072 0.928
#> GSM877127     3  0.0237     0.8914 0.000 0.004 0.996
#> GSM877138     3  0.2301     0.8830 0.060 0.004 0.936
#> GSM877140     3  0.0892     0.8956 0.020 0.000 0.980
#> GSM877156     2  0.1964     0.9047 0.000 0.944 0.056
#> GSM877130     2  0.0000     0.9079 0.000 1.000 0.000
#> GSM877141     2  0.0424     0.9078 0.000 0.992 0.008
#> GSM877142     2  0.0237     0.9073 0.000 0.996 0.004
#> GSM877145     2  0.0000     0.9079 0.000 1.000 0.000
#> GSM877151     2  0.1964     0.9050 0.000 0.944 0.056
#> GSM877158     2  0.0237     0.9073 0.000 0.996 0.004
#> GSM877173     2  0.0237     0.9073 0.000 0.996 0.004
#> GSM877176     2  0.0000     0.9079 0.000 1.000 0.000
#> GSM877179     2  0.0237     0.9073 0.000 0.996 0.004
#> GSM877181     2  0.0747     0.9088 0.000 0.984 0.016
#> GSM877185     2  0.0237     0.9073 0.000 0.996 0.004
#> GSM877131     2  0.3482     0.8643 0.000 0.872 0.128
#> GSM877147     3  0.0892     0.8955 0.020 0.000 0.980
#> GSM877155     2  0.2261     0.9012 0.000 0.932 0.068
#> GSM877159     3  0.0424     0.8910 0.000 0.008 0.992
#> GSM877170     2  0.0237     0.9073 0.000 0.996 0.004
#> GSM877186     1  0.2711     0.7820 0.912 0.000 0.088
#> GSM877132     2  0.0237     0.9073 0.000 0.996 0.004
#> GSM877143     2  0.2165     0.9030 0.000 0.936 0.064
#> GSM877146     2  0.1643     0.9078 0.000 0.956 0.044
#> GSM877148     2  0.2959     0.8847 0.000 0.900 0.100
#> GSM877152     2  0.3192     0.8772 0.000 0.888 0.112
#> GSM877168     2  0.3412     0.8679 0.000 0.876 0.124
#> GSM877180     2  0.3192     0.8772 0.000 0.888 0.112
#> GSM877126     2  0.8440     0.5476 0.196 0.620 0.184
#> GSM877129     3  0.4605     0.7473 0.000 0.204 0.796
#> GSM877133     1  0.0424     0.8253 0.992 0.000 0.008
#> GSM877153     3  0.2448     0.8718 0.076 0.000 0.924
#> GSM877169     1  0.0747     0.8210 0.984 0.000 0.016
#> GSM877171     1  0.0000     0.8282 1.000 0.000 0.000
#> GSM877174     1  0.0237     0.8281 0.996 0.004 0.000
#> GSM877134     2  0.6483    -0.0582 0.452 0.544 0.004
#> GSM877135     1  0.4605     0.6814 0.796 0.000 0.204
#> GSM877136     1  0.0000     0.8282 1.000 0.000 0.000
#> GSM877137     1  0.6500     0.2759 0.532 0.464 0.004
#> GSM877139     1  0.5741     0.6943 0.776 0.188 0.036
#> GSM877149     1  0.6282     0.4760 0.612 0.384 0.004
#> GSM877154     2  0.3192     0.8772 0.000 0.888 0.112
#> GSM877157     1  0.7514     0.4885 0.616 0.328 0.056
#> GSM877160     1  0.0000     0.8282 1.000 0.000 0.000
#> GSM877161     1  0.0000     0.8282 1.000 0.000 0.000
#> GSM877163     2  0.6483    -0.0582 0.452 0.544 0.004
#> GSM877166     1  0.0424     0.8281 0.992 0.008 0.000
#> GSM877167     2  0.1643     0.9071 0.000 0.956 0.044
#> GSM877175     1  0.0000     0.8282 1.000 0.000 0.000
#> GSM877177     1  0.4544     0.7598 0.860 0.056 0.084
#> GSM877184     1  0.6280     0.2998 0.540 0.460 0.000
#> GSM877187     2  0.2955     0.8949 0.008 0.912 0.080
#> GSM877188     1  0.1411     0.8185 0.964 0.036 0.000
#> GSM877150     1  0.0000     0.8282 1.000 0.000 0.000
#> GSM877165     2  0.1529     0.9076 0.000 0.960 0.040
#> GSM877183     3  0.2537     0.8468 0.000 0.080 0.920
#> GSM877178     3  0.5058     0.7441 0.244 0.000 0.756
#> GSM877182     2  0.0237     0.9073 0.000 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM877144     3  0.0336     0.7923 0.000 0.000 0.992 0.008
#> GSM877128     3  0.7113     0.3927 0.316 0.000 0.532 0.152
#> GSM877164     1  0.6215     0.4601 0.668 0.000 0.192 0.140
#> GSM877162     4  0.4837     0.5235 0.000 0.004 0.348 0.648
#> GSM877127     3  0.3311     0.6826 0.000 0.000 0.828 0.172
#> GSM877138     3  0.3895     0.6577 0.012 0.000 0.804 0.184
#> GSM877140     3  0.0336     0.7923 0.000 0.000 0.992 0.008
#> GSM877156     4  0.3400     0.7942 0.000 0.180 0.000 0.820
#> GSM877130     2  0.2081     0.8200 0.000 0.916 0.000 0.084
#> GSM877141     2  0.1118     0.8253 0.000 0.964 0.000 0.036
#> GSM877142     2  0.0000     0.8433 0.000 1.000 0.000 0.000
#> GSM877145     2  0.2530     0.7946 0.000 0.888 0.000 0.112
#> GSM877151     2  0.2216     0.8157 0.000 0.908 0.000 0.092
#> GSM877158     2  0.0000     0.8433 0.000 1.000 0.000 0.000
#> GSM877173     2  0.0336     0.8428 0.000 0.992 0.000 0.008
#> GSM877176     2  0.1940     0.8243 0.000 0.924 0.000 0.076
#> GSM877179     2  0.0000     0.8433 0.000 1.000 0.000 0.000
#> GSM877181     2  0.3074     0.7580 0.000 0.848 0.000 0.152
#> GSM877185     2  0.0000     0.8433 0.000 1.000 0.000 0.000
#> GSM877131     4  0.5533     0.7416 0.000 0.220 0.072 0.708
#> GSM877147     3  0.0469     0.7907 0.000 0.000 0.988 0.012
#> GSM877155     4  0.4746     0.4886 0.000 0.368 0.000 0.632
#> GSM877159     3  0.1940     0.7651 0.000 0.000 0.924 0.076
#> GSM877170     2  0.3464     0.7320 0.016 0.856 0.004 0.124
#> GSM877186     1  0.4868     0.5998 0.720 0.000 0.256 0.024
#> GSM877132     2  0.0000     0.8433 0.000 1.000 0.000 0.000
#> GSM877143     2  0.7539     0.3846 0.040 0.552 0.096 0.312
#> GSM877146     2  0.5785     0.6463 0.024 0.712 0.044 0.220
#> GSM877148     4  0.4163     0.8035 0.000 0.076 0.096 0.828
#> GSM877152     4  0.3814     0.8149 0.008 0.092 0.044 0.856
#> GSM877168     4  0.3833     0.8109 0.000 0.080 0.072 0.848
#> GSM877180     4  0.3432     0.7445 0.120 0.012 0.008 0.860
#> GSM877126     4  0.5574     0.4013 0.084 0.004 0.184 0.728
#> GSM877129     3  0.7980     0.3052 0.032 0.352 0.476 0.140
#> GSM877133     1  0.4605     0.6484 0.796 0.000 0.072 0.132
#> GSM877153     3  0.0469     0.7922 0.000 0.000 0.988 0.012
#> GSM877169     1  0.4992     0.6227 0.772 0.000 0.096 0.132
#> GSM877171     1  0.3907     0.6818 0.828 0.000 0.032 0.140
#> GSM877174     1  0.3606     0.6874 0.840 0.000 0.020 0.140
#> GSM877134     1  0.6855     0.4378 0.580 0.276 0.000 0.144
#> GSM877135     1  0.4057     0.7102 0.816 0.000 0.032 0.152
#> GSM877136     1  0.0336     0.7472 0.992 0.000 0.000 0.008
#> GSM877137     1  0.5972     0.5230 0.632 0.064 0.000 0.304
#> GSM877139     1  0.4008     0.6523 0.756 0.000 0.000 0.244
#> GSM877149     1  0.4769     0.5771 0.684 0.008 0.000 0.308
#> GSM877154     4  0.3311     0.7982 0.000 0.172 0.000 0.828
#> GSM877157     1  0.4985     0.2724 0.532 0.000 0.000 0.468
#> GSM877160     1  0.1174     0.7483 0.968 0.000 0.012 0.020
#> GSM877161     1  0.0592     0.7474 0.984 0.000 0.000 0.016
#> GSM877163     2  0.5137     0.4956 0.296 0.680 0.000 0.024
#> GSM877166     1  0.0592     0.7474 0.984 0.000 0.000 0.016
#> GSM877167     4  0.3528     0.7866 0.000 0.192 0.000 0.808
#> GSM877175     1  0.3047     0.7050 0.872 0.000 0.012 0.116
#> GSM877177     1  0.4072     0.6471 0.748 0.000 0.000 0.252
#> GSM877184     1  0.7035     0.4592 0.572 0.244 0.000 0.184
#> GSM877187     4  0.3974     0.7759 0.092 0.040 0.016 0.852
#> GSM877188     1  0.1209     0.7440 0.964 0.004 0.000 0.032
#> GSM877150     1  0.0188     0.7479 0.996 0.000 0.000 0.004
#> GSM877165     2  0.4994    -0.0721 0.000 0.520 0.000 0.480
#> GSM877183     4  0.3610     0.7172 0.000 0.000 0.200 0.800
#> GSM877178     3  0.4869     0.6938 0.088 0.000 0.780 0.132
#> GSM877182     2  0.0000     0.8433 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM877144     4  0.4190     0.6235 0.140 0.000 0.056 0.792 0.012
#> GSM877128     3  0.5718     0.2280 0.036 0.000 0.652 0.248 0.064
#> GSM877164     3  0.2079     0.5822 0.020 0.000 0.916 0.064 0.000
#> GSM877162     5  0.3336     0.6299 0.000 0.000 0.000 0.228 0.772
#> GSM877127     4  0.6962     0.3770 0.016 0.000 0.260 0.468 0.256
#> GSM877138     3  0.6814    -0.1293 0.016 0.000 0.480 0.316 0.188
#> GSM877140     4  0.4138     0.6291 0.080 0.000 0.104 0.804 0.012
#> GSM877156     5  0.2438     0.7983 0.044 0.040 0.000 0.008 0.908
#> GSM877130     2  0.2172     0.8183 0.016 0.908 0.000 0.000 0.076
#> GSM877141     2  0.2956     0.7991 0.024 0.888 0.064 0.008 0.016
#> GSM877142     2  0.0290     0.8295 0.008 0.992 0.000 0.000 0.000
#> GSM877145     2  0.3512     0.8081 0.064 0.860 0.028 0.004 0.044
#> GSM877151     2  0.4732     0.6955 0.108 0.744 0.000 0.004 0.144
#> GSM877158     2  0.0609     0.8271 0.020 0.980 0.000 0.000 0.000
#> GSM877173     2  0.0451     0.8315 0.008 0.988 0.000 0.000 0.004
#> GSM877176     2  0.2798     0.8181 0.044 0.888 0.000 0.008 0.060
#> GSM877179     2  0.0609     0.8271 0.020 0.980 0.000 0.000 0.000
#> GSM877181     2  0.2632     0.8151 0.040 0.888 0.000 0.000 0.072
#> GSM877185     2  0.0000     0.8299 0.000 1.000 0.000 0.000 0.000
#> GSM877131     5  0.2869     0.7894 0.016 0.040 0.000 0.056 0.888
#> GSM877147     4  0.3694     0.6204 0.140 0.000 0.020 0.820 0.020
#> GSM877155     5  0.3628     0.6386 0.012 0.216 0.000 0.000 0.772
#> GSM877159     4  0.5404     0.5825 0.012 0.000 0.112 0.688 0.188
#> GSM877170     2  0.3630     0.6778 0.016 0.780 0.204 0.000 0.000
#> GSM877186     1  0.5714     0.2965 0.616 0.004 0.092 0.284 0.004
#> GSM877132     2  0.1605     0.8289 0.040 0.944 0.012 0.000 0.004
#> GSM877143     2  0.8398     0.1116 0.140 0.380 0.008 0.288 0.184
#> GSM877146     2  0.7397     0.4933 0.188 0.552 0.004 0.132 0.124
#> GSM877148     5  0.1372     0.8123 0.024 0.016 0.000 0.004 0.956
#> GSM877152     5  0.0693     0.8109 0.008 0.000 0.000 0.012 0.980
#> GSM877168     5  0.1211     0.8052 0.024 0.000 0.000 0.016 0.960
#> GSM877180     5  0.1444     0.8051 0.040 0.000 0.000 0.012 0.948
#> GSM877126     5  0.6697     0.1391 0.048 0.004 0.404 0.072 0.472
#> GSM877129     4  0.8842     0.2019 0.184 0.264 0.264 0.276 0.012
#> GSM877133     3  0.2653     0.5347 0.096 0.000 0.880 0.024 0.000
#> GSM877153     4  0.3218     0.6362 0.024 0.000 0.128 0.844 0.004
#> GSM877169     3  0.2666     0.5845 0.020 0.000 0.892 0.076 0.012
#> GSM877171     3  0.2813     0.5632 0.048 0.000 0.884 0.064 0.004
#> GSM877174     3  0.1525     0.5634 0.036 0.004 0.948 0.012 0.000
#> GSM877134     1  0.6161     0.0135 0.476 0.436 0.064 0.004 0.020
#> GSM877135     1  0.6700     0.5431 0.572 0.000 0.248 0.048 0.132
#> GSM877136     3  0.4294    -0.3635 0.468 0.000 0.532 0.000 0.000
#> GSM877137     1  0.6691     0.5120 0.500 0.020 0.152 0.000 0.328
#> GSM877139     1  0.6319     0.5324 0.520 0.000 0.196 0.000 0.284
#> GSM877149     1  0.7037     0.5321 0.580 0.072 0.180 0.004 0.164
#> GSM877154     5  0.1799     0.8098 0.028 0.020 0.000 0.012 0.940
#> GSM877157     1  0.6035     0.3183 0.464 0.000 0.100 0.004 0.432
#> GSM877160     1  0.4740     0.3769 0.516 0.000 0.468 0.016 0.000
#> GSM877161     1  0.4287     0.3992 0.540 0.000 0.460 0.000 0.000
#> GSM877163     2  0.5657     0.3089 0.356 0.568 0.068 0.000 0.008
#> GSM877166     1  0.4420     0.4112 0.548 0.004 0.448 0.000 0.000
#> GSM877167     5  0.3012     0.7805 0.060 0.056 0.000 0.008 0.876
#> GSM877175     3  0.3336     0.3271 0.228 0.000 0.772 0.000 0.000
#> GSM877177     1  0.6128     0.5576 0.580 0.000 0.240 0.004 0.176
#> GSM877184     1  0.7194     0.4574 0.564 0.164 0.160 0.000 0.112
#> GSM877187     5  0.0968     0.8144 0.012 0.012 0.000 0.004 0.972
#> GSM877188     3  0.4481    -0.3030 0.416 0.000 0.576 0.000 0.008
#> GSM877150     1  0.4306     0.3421 0.508 0.000 0.492 0.000 0.000
#> GSM877165     5  0.5161    -0.0770 0.024 0.484 0.000 0.008 0.484
#> GSM877183     5  0.2178     0.7923 0.008 0.000 0.024 0.048 0.920
#> GSM877178     3  0.6640    -0.1509 0.176 0.004 0.480 0.336 0.004
#> GSM877182     2  0.1121     0.8287 0.044 0.956 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM877144     4  0.2002    0.50640 0.004 0.000 0.076 0.908 0.000 0.012
#> GSM877128     3  0.3085    0.59584 0.028 0.000 0.868 0.008 0.052 0.044
#> GSM877164     3  0.3017    0.62356 0.164 0.000 0.816 0.000 0.000 0.020
#> GSM877162     5  0.3800    0.67238 0.000 0.000 0.008 0.192 0.764 0.036
#> GSM877127     3  0.5682    0.30949 0.000 0.000 0.564 0.136 0.284 0.016
#> GSM877138     3  0.6068    0.41012 0.060 0.000 0.624 0.024 0.208 0.084
#> GSM877140     6  0.6326   -0.31155 0.012 0.000 0.292 0.236 0.004 0.456
#> GSM877156     5  0.2737    0.73587 0.004 0.004 0.000 0.000 0.832 0.160
#> GSM877130     2  0.0820    0.75453 0.000 0.972 0.000 0.000 0.012 0.016
#> GSM877141     2  0.3187    0.63904 0.000 0.796 0.188 0.000 0.004 0.012
#> GSM877142     2  0.0993    0.74577 0.000 0.964 0.012 0.000 0.000 0.024
#> GSM877145     2  0.4677    0.62255 0.004 0.692 0.004 0.000 0.084 0.216
#> GSM877151     2  0.5707    0.42027 0.004 0.636 0.040 0.000 0.140 0.180
#> GSM877158     2  0.0717    0.74926 0.000 0.976 0.008 0.000 0.000 0.016
#> GSM877173     2  0.0405    0.75322 0.000 0.988 0.000 0.000 0.004 0.008
#> GSM877176     2  0.2683    0.74220 0.004 0.868 0.004 0.000 0.020 0.104
#> GSM877179     2  0.0520    0.75170 0.000 0.984 0.008 0.000 0.000 0.008
#> GSM877181     2  0.3405    0.71397 0.004 0.828 0.000 0.004 0.088 0.076
#> GSM877185     2  0.0000    0.75288 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM877131     5  0.2638    0.77705 0.004 0.012 0.004 0.036 0.892 0.052
#> GSM877147     4  0.1152    0.50240 0.000 0.000 0.044 0.952 0.000 0.004
#> GSM877155     5  0.3996    0.63701 0.004 0.160 0.004 0.000 0.768 0.064
#> GSM877159     4  0.7385    0.08400 0.012 0.000 0.176 0.424 0.276 0.112
#> GSM877170     2  0.3943    0.63817 0.004 0.756 0.184 0.000 0.000 0.056
#> GSM877186     4  0.4940    0.26323 0.268 0.000 0.008 0.640 0.000 0.084
#> GSM877132     2  0.2306    0.74634 0.016 0.888 0.004 0.000 0.000 0.092
#> GSM877143     6  0.8539   -0.00855 0.284 0.164 0.012 0.052 0.176 0.312
#> GSM877146     2  0.8269   -0.38091 0.276 0.316 0.008 0.036 0.128 0.236
#> GSM877148     5  0.2402    0.76422 0.020 0.000 0.000 0.008 0.888 0.084
#> GSM877152     5  0.1642    0.78159 0.028 0.000 0.000 0.004 0.936 0.032
#> GSM877168     5  0.2691    0.75597 0.032 0.000 0.000 0.008 0.872 0.088
#> GSM877180     5  0.3047    0.73350 0.080 0.000 0.000 0.008 0.852 0.060
#> GSM877126     3  0.6837    0.21583 0.004 0.000 0.420 0.048 0.316 0.212
#> GSM877129     3  0.5522    0.22551 0.004 0.104 0.620 0.016 0.004 0.252
#> GSM877133     3  0.4107    0.57013 0.280 0.000 0.688 0.004 0.000 0.028
#> GSM877153     4  0.6023    0.03447 0.000 0.000 0.320 0.420 0.000 0.260
#> GSM877169     3  0.3012    0.61799 0.196 0.000 0.796 0.000 0.000 0.008
#> GSM877171     3  0.3279    0.59568 0.060 0.000 0.828 0.004 0.000 0.108
#> GSM877174     3  0.4234    0.61654 0.120 0.024 0.776 0.004 0.000 0.076
#> GSM877134     2  0.6397    0.19834 0.356 0.440 0.004 0.000 0.024 0.176
#> GSM877135     1  0.3794    0.62936 0.812 0.000 0.008 0.044 0.112 0.024
#> GSM877136     1  0.4158    0.49199 0.720 0.000 0.236 0.024 0.000 0.020
#> GSM877137     1  0.4847    0.55811 0.704 0.040 0.004 0.004 0.212 0.036
#> GSM877139     1  0.4365    0.59844 0.744 0.008 0.024 0.000 0.188 0.036
#> GSM877149     1  0.6893    0.34875 0.516 0.072 0.008 0.004 0.192 0.208
#> GSM877154     5  0.2100    0.76431 0.004 0.000 0.000 0.000 0.884 0.112
#> GSM877157     1  0.5654    0.38027 0.532 0.000 0.000 0.004 0.304 0.160
#> GSM877160     1  0.2698    0.65684 0.872 0.000 0.092 0.016 0.000 0.020
#> GSM877161     1  0.2146    0.65390 0.880 0.000 0.116 0.000 0.000 0.004
#> GSM877163     2  0.6150    0.30016 0.316 0.484 0.012 0.004 0.000 0.184
#> GSM877166     1  0.1610    0.66333 0.916 0.000 0.084 0.000 0.000 0.000
#> GSM877167     5  0.3457    0.69576 0.012 0.012 0.000 0.000 0.780 0.196
#> GSM877175     3  0.4450    0.28043 0.448 0.000 0.528 0.004 0.000 0.020
#> GSM877177     1  0.3963    0.63585 0.784 0.000 0.012 0.016 0.156 0.032
#> GSM877184     1  0.6474    0.40917 0.624 0.064 0.044 0.004 0.108 0.156
#> GSM877187     5  0.1760    0.78182 0.020 0.000 0.000 0.004 0.928 0.048
#> GSM877188     1  0.4005    0.63496 0.788 0.016 0.124 0.004 0.000 0.068
#> GSM877150     1  0.3078    0.60613 0.796 0.000 0.192 0.000 0.000 0.012
#> GSM877165     5  0.5205    0.28321 0.004 0.376 0.004 0.000 0.544 0.072
#> GSM877183     5  0.2134    0.77013 0.000 0.000 0.052 0.000 0.904 0.044
#> GSM877178     3  0.3062    0.50388 0.000 0.000 0.824 0.032 0.000 0.144
#> GSM877182     2  0.2798    0.73762 0.008 0.856 0.004 0.012 0.000 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-ATC-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-NMF-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n disease.state(p) genotype/variation(p) other(p) k
#> ATC:NMF 54           0.1881               0.38868 5.63e-06 2
#> ATC:NMF 56           0.0839               0.00826 6.86e-08 3
#> ATC:NMF 51           0.1437               0.04090 3.08e-09 4
#> ATC:NMF 41           0.2724               0.32770 1.49e-09 5
#> ATC:NMF 43           0.1028               0.32593 1.66e-12 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.

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