cola Report for GDS4358

Date: 2019-12-25 21:31:38 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 72 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    72

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
CV:pam 6 1.000 0.972 0.984 ** 2,3,4,5
MAD:kmeans 2 1.000 0.996 0.998 **
MAD:mclust 6 1.000 0.976 0.989 ** 3,4,5
ATC:kmeans 2 1.000 1.000 1.000 **
SD:mclust 6 0.998 0.965 0.976 ** 2,4,5
MAD:pam 6 0.996 0.965 0.978 ** 2,3,5
CV:NMF 3 0.994 0.955 0.973 ** 2
MAD:NMF 4 0.993 0.960 0.973 ** 2
CV:mclust 6 0.992 0.958 0.976 ** 2,3,4,5
CV:skmeans 6 0.991 0.940 0.973 ** 2,4,5
SD:skmeans 6 0.989 0.926 0.969 ** 2,4,5
ATC:mclust 2 0.982 0.946 0.967 **
MAD:skmeans 6 0.979 0.941 0.961 ** 2,4,5
ATC:hclust 2 0.964 0.968 0.977 **
SD:kmeans 4 0.957 0.955 0.963 ** 2
SD:NMF 4 0.956 0.938 0.955 ** 2
CV:hclust 6 0.956 0.902 0.943 ** 5
ATC:NMF 3 0.931 0.913 0.964 * 2
ATC:skmeans 6 0.928 0.849 0.924 * 2,5
CV:kmeans 4 0.926 0.933 0.948 * 2
SD:pam 6 0.910 0.920 0.954 * 2,3,5
ATC:pam 5 0.910 0.865 0.946 * 2,3
SD:hclust 6 0.909 0.886 0.942 * 2,3
MAD:hclust 2 0.719 0.852 0.934

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 1.000           0.981       0.991          0.484 0.512   0.512
#> CV:NMF      2 0.971           0.951       0.979          0.478 0.512   0.512
#> MAD:NMF     2 1.000           0.975       0.991          0.490 0.512   0.512
#> ATC:NMF     2 0.914           0.931       0.971          0.449 0.559   0.559
#> SD:skmeans  2 1.000           1.000       1.000          0.501 0.499   0.499
#> CV:skmeans  2 1.000           0.981       0.992          0.500 0.499   0.499
#> MAD:skmeans 2 1.000           0.993       0.997          0.502 0.499   0.499
#> ATC:skmeans 2 1.000           0.995       0.998          0.481 0.518   0.518
#> SD:mclust   2 1.000           0.948       0.965          0.418 0.593   0.593
#> CV:mclust   2 1.000           0.949       0.978          0.434 0.549   0.549
#> MAD:mclust  2 0.519           0.921       0.934          0.422 0.593   0.593
#> ATC:mclust  2 0.982           0.946       0.967          0.479 0.507   0.507
#> SD:kmeans   2 1.000           0.984       0.990          0.492 0.507   0.507
#> CV:kmeans   2 0.942           0.946       0.978          0.483 0.518   0.518
#> MAD:kmeans  2 1.000           0.996       0.998          0.498 0.503   0.503
#> ATC:kmeans  2 1.000           1.000       1.000          0.351 0.649   0.649
#> SD:pam      2 1.000           0.978       0.990          0.499 0.499   0.499
#> CV:pam      2 1.000           0.965       0.987          0.497 0.503   0.503
#> MAD:pam     2 1.000           0.974       0.990          0.505 0.495   0.495
#> ATC:pam     2 1.000           0.983       0.992          0.310 0.700   0.700
#> SD:hclust   2 1.000           0.964       0.983          0.490 0.512   0.512
#> CV:hclust   2 0.862           0.925       0.966          0.488 0.512   0.512
#> MAD:hclust  2 0.719           0.852       0.934          0.498 0.499   0.499
#> ATC:hclust  2 0.964           0.968       0.977          0.366 0.634   0.634
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.825           0.865       0.926          0.378 0.750   0.539
#> CV:NMF      3 0.994           0.955       0.973          0.409 0.753   0.544
#> MAD:NMF     3 0.744           0.791       0.903          0.331 0.806   0.633
#> ATC:NMF     3 0.931           0.913       0.964          0.474 0.766   0.587
#> SD:skmeans  3 0.781           0.873       0.922          0.315 0.814   0.636
#> CV:skmeans  3 0.766           0.855       0.927          0.329 0.797   0.608
#> MAD:skmeans 3 0.780           0.645       0.845          0.303 0.892   0.790
#> ATC:skmeans 3 0.758           0.910       0.946          0.315 0.803   0.632
#> SD:mclust   3 0.864           0.929       0.962          0.590 0.745   0.571
#> CV:mclust   3 0.927           0.960       0.981          0.554 0.775   0.590
#> MAD:mclust  3 0.906           0.875       0.948          0.585 0.745   0.571
#> ATC:mclust  3 0.485           0.758       0.844          0.283 0.583   0.377
#> SD:kmeans   3 0.676           0.552       0.779          0.317 0.836   0.700
#> CV:kmeans   3 0.699           0.840       0.876          0.343 0.737   0.527
#> MAD:kmeans  3 0.679           0.769       0.857          0.292 0.775   0.579
#> ATC:kmeans  3 0.886           0.877       0.953          0.782 0.649   0.490
#> SD:pam      3 1.000           0.968       0.987          0.344 0.706   0.476
#> CV:pam      3 1.000           0.973       0.989          0.347 0.712   0.487
#> MAD:pam     3 0.981           0.938       0.976          0.334 0.712   0.481
#> ATC:pam     3 1.000           0.975       0.990          0.949 0.695   0.564
#> SD:hclust   3 0.968           0.938       0.966          0.143 0.934   0.872
#> CV:hclust   3 0.883           0.906       0.955          0.156 0.934   0.872
#> MAD:hclust  3 0.788           0.854       0.919          0.249 0.844   0.687
#> ATC:hclust  3 0.694           0.932       0.949          0.158 0.972   0.956
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.956           0.938       0.955         0.0834 0.937   0.808
#> CV:NMF      4 0.843           0.518       0.874         0.0645 0.944   0.834
#> MAD:NMF     4 0.993           0.960       0.973         0.1161 0.815   0.542
#> ATC:NMF     4 0.628           0.679       0.823         0.1280 0.865   0.625
#> SD:skmeans  4 1.000           0.962       0.984         0.1087 0.921   0.770
#> CV:skmeans  4 0.932           0.941       0.943         0.1015 0.906   0.732
#> MAD:skmeans 4 1.000           0.945       0.977         0.1173 0.785   0.523
#> ATC:skmeans 4 0.816           0.756       0.885         0.1185 0.884   0.693
#> SD:mclust   4 0.998           0.961       0.981         0.1282 0.886   0.675
#> CV:mclust   4 0.968           0.930       0.966         0.1073 0.868   0.626
#> MAD:mclust  4 0.946           0.927       0.966         0.1206 0.881   0.661
#> ATC:mclust  4 0.625           0.726       0.810         0.1734 0.685   0.368
#> SD:kmeans   4 0.957           0.955       0.963         0.1278 0.813   0.572
#> CV:kmeans   4 0.926           0.933       0.948         0.1292 0.924   0.775
#> MAD:kmeans  4 0.814           0.860       0.909         0.1293 0.813   0.529
#> ATC:kmeans  4 0.719           0.679       0.864         0.1701 0.822   0.559
#> SD:pam      4 0.873           0.903       0.935         0.0989 0.924   0.775
#> CV:pam      4 0.900           0.908       0.947         0.1024 0.924   0.775
#> MAD:pam     4 0.884           0.832       0.914         0.0958 0.907   0.724
#> ATC:pam     4 0.816           0.881       0.924         0.1903 0.851   0.632
#> SD:hclust   4 0.787           0.773       0.885         0.2794 0.770   0.510
#> CV:hclust   4 0.823           0.895       0.924         0.2794 0.819   0.595
#> MAD:hclust  4 0.771           0.792       0.862         0.1349 0.949   0.854
#> ATC:hclust  4 0.663           0.803       0.898         0.5468 0.716   0.531
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.855           0.855       0.911         0.0755 0.914   0.699
#> CV:NMF      5 0.832           0.781       0.887         0.0786 0.887   0.646
#> MAD:NMF     5 0.861           0.833       0.892         0.0717 0.905   0.670
#> ATC:NMF     5 0.698           0.675       0.819         0.0642 0.869   0.547
#> SD:skmeans  5 1.000           0.951       0.980         0.0596 0.946   0.805
#> CV:skmeans  5 1.000           0.951       0.979         0.0573 0.946   0.805
#> MAD:skmeans 5 0.989           0.946       0.976         0.0601 0.924   0.730
#> ATC:skmeans 5 0.949           0.903       0.963         0.0795 0.905   0.689
#> SD:mclust   5 1.000           0.961       0.984         0.0323 0.976   0.905
#> CV:mclust   5 0.997           0.964       0.977         0.0360 0.976   0.905
#> MAD:mclust  5 1.000           0.963       0.985         0.0339 0.963   0.856
#> ATC:mclust  5 0.739           0.868       0.898         0.0894 0.910   0.679
#> SD:kmeans   5 0.853           0.784       0.876         0.0585 0.984   0.938
#> CV:kmeans   5 0.840           0.800       0.858         0.0597 1.000   1.000
#> MAD:kmeans  5 0.789           0.878       0.841         0.0623 0.948   0.806
#> ATC:kmeans  5 0.765           0.727       0.847         0.0661 0.875   0.581
#> SD:pam      5 1.000           0.972       0.988         0.0658 0.948   0.806
#> CV:pam      5 0.937           0.925       0.961         0.0617 0.937   0.766
#> MAD:pam     5 1.000           0.957       0.984         0.0636 0.933   0.751
#> ATC:pam     5 0.910           0.865       0.946         0.0655 0.931   0.754
#> SD:hclust   5 0.835           0.862       0.861         0.0384 0.951   0.830
#> CV:hclust   5 0.911           0.901       0.940         0.0409 0.978   0.918
#> MAD:hclust  5 0.798           0.755       0.871         0.0250 0.984   0.947
#> ATC:hclust  5 0.716           0.792       0.889         0.0381 0.994   0.982
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.834           0.762       0.875         0.0191 0.963   0.845
#> CV:NMF      6 0.801           0.741       0.857         0.0261 0.982   0.923
#> MAD:NMF     6 0.799           0.725       0.837         0.0229 0.962   0.839
#> ATC:NMF     6 0.697           0.610       0.737         0.0361 0.978   0.899
#> SD:skmeans  6 0.989           0.926       0.969         0.0363 0.964   0.844
#> CV:skmeans  6 0.991           0.940       0.973         0.0378 0.967   0.854
#> MAD:skmeans 6 0.979           0.941       0.961         0.0341 0.965   0.845
#> ATC:skmeans 6 0.928           0.849       0.924         0.0300 0.959   0.833
#> SD:mclust   6 0.998           0.965       0.976         0.0432 0.965   0.846
#> CV:mclust   6 0.992           0.958       0.976         0.0481 0.957   0.812
#> MAD:mclust  6 1.000           0.976       0.989         0.0433 0.965   0.846
#> ATC:mclust  6 0.860           0.780       0.902         0.0434 0.932   0.696
#> SD:kmeans   6 0.857           0.817       0.830         0.0406 0.941   0.767
#> CV:kmeans   6 0.831           0.795       0.813         0.0392 0.917   0.694
#> MAD:kmeans  6 0.859           0.826       0.853         0.0434 0.961   0.825
#> ATC:kmeans  6 0.771           0.701       0.823         0.0469 0.937   0.724
#> SD:pam      6 0.910           0.920       0.954         0.0301 0.951   0.786
#> CV:pam      6 1.000           0.972       0.984         0.0293 0.950   0.781
#> MAD:pam     6 0.996           0.965       0.978         0.0270 0.940   0.744
#> ATC:pam     6 0.882           0.856       0.933         0.0229 0.985   0.934
#> SD:hclust   6 0.909           0.886       0.942         0.0604 0.952   0.819
#> CV:hclust   6 0.956           0.902       0.943         0.0505 0.958   0.829
#> MAD:hclust  6 0.842           0.845       0.902         0.0831 0.897   0.654
#> ATC:hclust  6 0.686           0.774       0.867         0.1318 0.836   0.523

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) tissue(p) k
#> SD:NMF      72           0.8526  4.67e-11 2
#> CV:NMF      70           0.9468  8.53e-12 2
#> MAD:NMF     71           0.8090  6.63e-11 2
#> ATC:NMF     69           0.7600  6.14e-05 2
#> SD:skmeans  72           0.7433  5.51e-10 2
#> CV:skmeans  72           0.7433  5.51e-10 2
#> MAD:skmeans 72           0.7433  5.51e-10 2
#> ATC:skmeans 72           0.2536  1.95e-01 2
#> SD:mclust   70           0.8058  3.77e-12 2
#> CV:mclust   68           0.8755  1.70e-13 2
#> MAD:mclust  72           0.7222  4.87e-11 2
#> ATC:mclust  70           0.8192  3.13e-11 2
#> SD:kmeans   72           0.7308  1.25e-10 2
#> CV:kmeans   71           0.9068  2.13e-11 2
#> MAD:kmeans  72           0.7703  2.85e-10 2
#> ATC:kmeans  72           0.0545  2.17e-01 2
#> SD:pam      72           0.7433  5.51e-10 2
#> CV:pam      70           0.7686  2.34e-10 2
#> MAD:pam     71           0.5743  1.09e-09 2
#> ATC:pam     72           0.0319  1.68e-01 2
#> SD:hclust   72           0.4844  9.33e-11 2
#> CV:hclust   72           0.4844  9.33e-11 2
#> MAD:hclust  67           0.2518  6.18e-07 2
#> ATC:hclust  72           0.0430  2.32e-01 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) tissue(p) k
#> SD:NMF      70          0.99523  1.25e-25 3
#> CV:NMF      71          0.99922  4.63e-26 3
#> MAD:NMF     66          0.87126  1.59e-13 3
#> ATC:NMF     69          0.57541  1.69e-11 3
#> SD:skmeans  71          0.93150  2.52e-21 3
#> CV:skmeans  70          0.91536  1.37e-22 3
#> MAD:skmeans 51          0.91735  2.24e-17 3
#> ATC:skmeans 69          0.60660  1.67e-08 3
#> SD:mclust   71          0.80874  8.57e-21 3
#> CV:mclust   71          0.99998  2.81e-27 3
#> MAD:mclust  64          0.99472  3.61e-24 3
#> ATC:mclust  66          0.12089  1.85e-09 3
#> SD:kmeans   59          0.31137  3.16e-11 3
#> CV:kmeans   69          0.97494  4.15e-22 3
#> MAD:kmeans  68          0.43507  8.84e-14 3
#> ATC:kmeans  67          0.09589  2.74e-04 3
#> SD:pam      71          0.96376  6.89e-23 3
#> CV:pam      71          0.87069  8.22e-23 3
#> MAD:pam     70          0.76458  3.88e-20 3
#> ATC:pam     71          0.12855  3.14e-06 3
#> SD:hclust   72          0.05286  3.04e-11 3
#> CV:hclust   70          0.06070  7.31e-11 3
#> MAD:hclust  68          0.18973  6.32e-14 3
#> ATC:hclust  72          0.00445  4.62e-01 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) tissue(p) k
#> SD:NMF      71          0.14493  2.99e-22 4
#> CV:NMF      50          0.95086  5.03e-16 4
#> MAD:NMF     72          0.06882  4.07e-22 4
#> ATC:NMF     60          0.06287  1.91e-08 4
#> SD:skmeans  70          0.12178  4.52e-18 4
#> CV:skmeans  70          0.12178  4.52e-18 4
#> MAD:skmeans 70          0.12178  4.52e-18 4
#> ATC:skmeans 56          0.30532  7.65e-08 4
#> SD:mclust   71          0.69059  7.53e-21 4
#> CV:mclust   69          0.34512  8.64e-21 4
#> MAD:mclust  70          0.54776  1.29e-20 4
#> ATC:mclust  66          0.00108  5.09e-11 4
#> SD:kmeans   72          0.12061  1.48e-20 4
#> CV:kmeans   72          0.12061  1.48e-20 4
#> MAD:kmeans  71          0.04851  1.41e-20 4
#> ATC:kmeans  58          0.12565  2.37e-07 4
#> SD:pam      72          0.12061  1.48e-20 4
#> CV:pam      71          0.04851  1.41e-20 4
#> MAD:pam     58          0.46908  3.64e-19 4
#> ATC:pam     70          0.02010  1.32e-11 4
#> SD:hclust   64          0.73873  1.23e-22 4
#> CV:hclust   70          0.17966  5.57e-22 4
#> MAD:hclust  70          0.06494  1.96e-13 4
#> ATC:hclust  63          0.04100  1.36e-04 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) tissue(p) k
#> SD:NMF      69         0.000564  3.70e-19 5
#> CV:NMF      64         0.026153  6.73e-20 5
#> MAD:NMF     67         0.000606  4.91e-19 5
#> ATC:NMF     61         0.260422  8.91e-16 5
#> SD:skmeans  69         0.013355  1.10e-20 5
#> CV:skmeans  69         0.013355  1.10e-20 5
#> MAD:skmeans 70         0.035126  1.07e-20 5
#> ATC:skmeans 67         0.122189  9.69e-11 5
#> SD:mclust   71         0.118440  3.49e-21 5
#> CV:mclust   71         0.118440  3.49e-21 5
#> MAD:mclust  70         0.134326  9.11e-21 5
#> ATC:mclust  71         0.003400  8.72e-13 5
#> SD:kmeans   64         0.030348  2.26e-18 5
#> CV:kmeans   70         0.179661  5.57e-22 5
#> MAD:kmeans  71         0.025696  1.63e-19 5
#> ATC:kmeans  63         0.137660  1.83e-10 5
#> SD:pam      71         0.020610  4.24e-19 5
#> CV:pam      70         0.007995  4.07e-19 5
#> MAD:pam     70         0.029267  1.05e-18 5
#> ATC:pam     66         0.047779  3.59e-10 5
#> SD:hclust   70         0.179661  5.57e-22 5
#> CV:hclust   70         0.213399  3.92e-22 5
#> MAD:hclust  65         0.467855  2.58e-14 5
#> ATC:hclust  63         0.094149  1.94e-05 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) tissue(p) k
#> SD:NMF      64         3.79e-04  1.79e-18 6
#> CV:NMF      62         3.50e-03  2.39e-19 6
#> MAD:NMF     62         8.36e-05  1.24e-18 6
#> ATC:NMF     54         2.87e-01  1.57e-17 6
#> SD:skmeans  69         5.50e-02  1.47e-20 6
#> CV:skmeans  70         2.70e-02  3.72e-20 6
#> MAD:skmeans 70         5.07e-02  5.87e-21 6
#> ATC:skmeans 67         1.92e-01  2.38e-10 6
#> SD:mclust   71         7.39e-02  4.84e-20 6
#> CV:mclust   72         1.20e-01  2.01e-20 6
#> MAD:mclust  71         7.39e-02  4.84e-20 6
#> ATC:mclust  65         2.21e-03  7.83e-11 6
#> SD:kmeans   64         2.03e-01  5.30e-20 6
#> CV:kmeans   66         1.62e-01  2.33e-19 6
#> MAD:kmeans  66         3.12e-01  2.35e-19 6
#> ATC:kmeans  62         3.56e-01  3.48e-11 6
#> SD:pam      71         1.20e-01  2.31e-21 6
#> CV:pam      72         1.41e-01  9.23e-22 6
#> MAD:pam     72         1.41e-01  9.23e-22 6
#> ATC:pam     67         5.20e-02  4.40e-11 6
#> SD:hclust   70         1.89e-01  3.05e-21 6
#> CV:hclust   70         1.43e-01  5.96e-21 6
#> MAD:hclust  66         2.30e-01  8.09e-21 6
#> ATC:hclust  66         1.05e-01  2.79e-08 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 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.964       0.983         0.4895 0.512   0.512
#> 3 3 0.968           0.938       0.966         0.1430 0.934   0.872
#> 4 4 0.787           0.773       0.885         0.2794 0.770   0.510
#> 5 5 0.835           0.862       0.861         0.0384 0.951   0.830
#> 6 6 0.909           0.886       0.942         0.0604 0.952   0.819

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1   0.000      0.977 1.000 0.000
#> GSM876887     1   0.000      0.977 1.000 0.000
#> GSM876888     1   0.000      0.977 1.000 0.000
#> GSM876889     1   0.163      0.965 0.976 0.024
#> GSM876890     1   0.000      0.977 1.000 0.000
#> GSM876891     1   0.184      0.963 0.972 0.028
#> GSM876862     1   0.000      0.977 1.000 0.000
#> GSM876863     1   0.000      0.977 1.000 0.000
#> GSM876864     1   0.000      0.977 1.000 0.000
#> GSM876865     1   0.000      0.977 1.000 0.000
#> GSM876866     1   0.000      0.977 1.000 0.000
#> GSM876867     1   0.000      0.977 1.000 0.000
#> GSM876838     2   0.000      0.989 0.000 1.000
#> GSM876839     2   0.000      0.989 0.000 1.000
#> GSM876840     2   0.000      0.989 0.000 1.000
#> GSM876841     2   0.000      0.989 0.000 1.000
#> GSM876842     2   0.000      0.989 0.000 1.000
#> GSM876843     2   0.000      0.989 0.000 1.000
#> GSM876892     1   0.000      0.977 1.000 0.000
#> GSM876893     1   0.000      0.977 1.000 0.000
#> GSM876894     1   0.184      0.963 0.972 0.028
#> GSM876895     1   0.260      0.951 0.956 0.044
#> GSM876896     2   0.000      0.989 0.000 1.000
#> GSM876897     2   0.000      0.989 0.000 1.000
#> GSM876868     1   0.000      0.977 1.000 0.000
#> GSM876869     1   0.000      0.977 1.000 0.000
#> GSM876870     1   0.000      0.977 1.000 0.000
#> GSM876871     1   0.000      0.977 1.000 0.000
#> GSM876872     2   0.563      0.849 0.132 0.868
#> GSM876873     2   0.563      0.849 0.132 0.868
#> GSM876844     2   0.000      0.989 0.000 1.000
#> GSM876845     2   0.000      0.989 0.000 1.000
#> GSM876846     2   0.000      0.989 0.000 1.000
#> GSM876847     2   0.000      0.989 0.000 1.000
#> GSM876848     2   0.000      0.989 0.000 1.000
#> GSM876849     2   0.000      0.989 0.000 1.000
#> GSM876898     1   0.000      0.977 1.000 0.000
#> GSM876899     1   0.260      0.951 0.956 0.044
#> GSM876900     1   0.000      0.977 1.000 0.000
#> GSM876901     1   0.000      0.977 1.000 0.000
#> GSM876902     2   0.242      0.952 0.040 0.960
#> GSM876903     1   0.260      0.951 0.956 0.044
#> GSM876904     1   0.000      0.977 1.000 0.000
#> GSM876874     1   0.000      0.977 1.000 0.000
#> GSM876875     1   0.000      0.977 1.000 0.000
#> GSM876876     1   0.000      0.977 1.000 0.000
#> GSM876877     1   0.000      0.977 1.000 0.000
#> GSM876878     1   0.000      0.977 1.000 0.000
#> GSM876879     1   0.000      0.977 1.000 0.000
#> GSM876880     1   0.000      0.977 1.000 0.000
#> GSM876850     2   0.000      0.989 0.000 1.000
#> GSM876851     2   0.000      0.989 0.000 1.000
#> GSM876852     2   0.000      0.989 0.000 1.000
#> GSM876853     2   0.000      0.989 0.000 1.000
#> GSM876854     2   0.000      0.989 0.000 1.000
#> GSM876855     2   0.000      0.989 0.000 1.000
#> GSM876856     2   0.000      0.989 0.000 1.000
#> GSM876905     1   0.000      0.977 1.000 0.000
#> GSM876906     1   0.184      0.963 0.972 0.028
#> GSM876907     1   0.260      0.951 0.956 0.044
#> GSM876908     1   0.184      0.963 0.972 0.028
#> GSM876909     1   0.260      0.951 0.956 0.044
#> GSM876881     2   0.000      0.989 0.000 1.000
#> GSM876882     1   0.000      0.977 1.000 0.000
#> GSM876883     1   0.876      0.596 0.704 0.296
#> GSM876884     1   0.000      0.977 1.000 0.000
#> GSM876885     1   0.876      0.596 0.704 0.296
#> GSM876857     1   0.000      0.977 1.000 0.000
#> GSM876858     2   0.000      0.989 0.000 1.000
#> GSM876859     2   0.000      0.989 0.000 1.000
#> GSM876860     2   0.000      0.989 0.000 1.000
#> GSM876861     2   0.000      0.989 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM876886     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876887     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876888     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876889     1  0.1031      0.957 0.976 0.000 0.024
#> GSM876890     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876891     1  0.1964      0.940 0.944 0.000 0.056
#> GSM876862     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876866     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876867     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876843     3  0.5760      0.645 0.000 0.328 0.672
#> GSM876892     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876893     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876894     1  0.1964      0.940 0.944 0.000 0.056
#> GSM876895     1  0.2537      0.923 0.920 0.000 0.080
#> GSM876896     3  0.1411      0.817 0.000 0.036 0.964
#> GSM876897     3  0.1411      0.817 0.000 0.036 0.964
#> GSM876868     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876872     3  0.2878      0.779 0.096 0.000 0.904
#> GSM876873     3  0.2878      0.779 0.096 0.000 0.904
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876848     3  0.5650      0.671 0.000 0.312 0.688
#> GSM876849     3  0.5650      0.671 0.000 0.312 0.688
#> GSM876898     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876899     1  0.2537      0.923 0.920 0.000 0.080
#> GSM876900     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876901     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876902     3  0.0237      0.808 0.004 0.000 0.996
#> GSM876903     1  0.2537      0.923 0.920 0.000 0.080
#> GSM876904     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876874     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876875     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876876     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876879     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876880     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876905     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876906     1  0.1964      0.940 0.944 0.000 0.056
#> GSM876907     1  0.2537      0.923 0.920 0.000 0.080
#> GSM876908     1  0.1964      0.940 0.944 0.000 0.056
#> GSM876909     1  0.2537      0.923 0.920 0.000 0.080
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876882     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876883     1  0.5529      0.589 0.704 0.000 0.296
#> GSM876884     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876885     1  0.5529      0.589 0.704 0.000 0.296
#> GSM876857     1  0.0000      0.970 1.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876861     2  0.0000      1.000 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
#> GSM876886     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876887     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876888     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876889     3  0.3528      0.840 0.000 0.000 0.808 0.192
#> GSM876890     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876891     3  0.0707      0.808 0.000 0.000 0.980 0.020
#> GSM876862     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876863     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876864     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876865     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876866     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876867     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876843     4  0.7412      0.416 0.200 0.296 0.000 0.504
#> GSM876892     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876893     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876894     3  0.0707      0.808 0.000 0.000 0.980 0.020
#> GSM876895     3  0.0188      0.793 0.004 0.000 0.996 0.000
#> GSM876896     4  0.5688      0.566 0.464 0.000 0.024 0.512
#> GSM876897     4  0.5688      0.566 0.464 0.000 0.024 0.512
#> GSM876868     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876869     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876870     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876871     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876872     1  0.6957     -0.586 0.472 0.000 0.112 0.416
#> GSM876873     1  0.6957     -0.586 0.472 0.000 0.112 0.416
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876848     4  0.7479      0.474 0.244 0.252 0.000 0.504
#> GSM876849     4  0.7479      0.474 0.244 0.252 0.000 0.504
#> GSM876898     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876899     3  0.0188      0.793 0.004 0.000 0.996 0.000
#> GSM876900     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876901     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876902     4  0.6527      0.553 0.416 0.000 0.076 0.508
#> GSM876903     3  0.0188      0.793 0.004 0.000 0.996 0.000
#> GSM876904     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876874     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876875     1  0.5295      0.866 0.504 0.000 0.008 0.488
#> GSM876876     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876877     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876878     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876879     1  0.5295      0.866 0.504 0.000 0.008 0.488
#> GSM876880     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876905     3  0.4008      0.849 0.000 0.000 0.756 0.244
#> GSM876906     3  0.0707      0.808 0.000 0.000 0.980 0.020
#> GSM876907     3  0.0188      0.793 0.004 0.000 0.996 0.000
#> GSM876908     3  0.0707      0.808 0.000 0.000 0.980 0.020
#> GSM876909     3  0.0188      0.793 0.004 0.000 0.996 0.000
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876882     4  0.5781     -0.859 0.484 0.000 0.028 0.488
#> GSM876883     4  0.5812     -0.193 0.136 0.000 0.156 0.708
#> GSM876884     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876885     4  0.5812     -0.193 0.136 0.000 0.156 0.708
#> GSM876857     1  0.4998      0.877 0.512 0.000 0.000 0.488
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      1.000 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
#> GSM876886     3  0.2719      0.823 0.144 0.000 0.852 0.000 NA
#> GSM876887     3  0.2719      0.823 0.144 0.000 0.852 0.000 NA
#> GSM876888     3  0.2605      0.823 0.148 0.000 0.852 0.000 NA
#> GSM876889     3  0.2068      0.810 0.092 0.000 0.904 0.000 NA
#> GSM876890     3  0.2719      0.823 0.144 0.000 0.852 0.000 NA
#> GSM876891     3  0.2813      0.756 0.000 0.000 0.832 0.000 NA
#> GSM876862     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876863     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876864     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876865     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876866     1  0.1282      0.908 0.952 0.000 0.044 0.000 NA
#> GSM876867     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876843     4  0.6495      0.628 0.000 0.188 0.000 0.424 NA
#> GSM876892     3  0.2719      0.823 0.144 0.000 0.852 0.000 NA
#> GSM876893     3  0.2605      0.823 0.148 0.000 0.852 0.000 NA
#> GSM876894     3  0.2813      0.756 0.000 0.000 0.832 0.000 NA
#> GSM876895     3  0.3424      0.721 0.000 0.000 0.760 0.000 NA
#> GSM876896     4  0.0000      0.744 0.000 0.000 0.000 1.000 NA
#> GSM876897     4  0.0000      0.744 0.000 0.000 0.000 1.000 NA
#> GSM876868     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876869     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876870     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876871     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876872     4  0.4227      0.641 0.000 0.000 0.000 0.580 NA
#> GSM876873     4  0.4227      0.641 0.000 0.000 0.000 0.580 NA
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876846     2  0.0162      0.996 0.000 0.996 0.000 0.000 NA
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876848     4  0.6224      0.668 0.000 0.144 0.000 0.468 NA
#> GSM876849     4  0.6224      0.668 0.000 0.144 0.000 0.468 NA
#> GSM876898     3  0.2605      0.823 0.148 0.000 0.852 0.000 NA
#> GSM876899     3  0.3395      0.724 0.000 0.000 0.764 0.000 NA
#> GSM876900     3  0.2605      0.823 0.148 0.000 0.852 0.000 NA
#> GSM876901     3  0.2605      0.823 0.148 0.000 0.852 0.000 NA
#> GSM876902     4  0.1851      0.732 0.000 0.000 0.000 0.912 NA
#> GSM876903     3  0.3424      0.721 0.000 0.000 0.760 0.000 NA
#> GSM876904     3  0.2605      0.823 0.148 0.000 0.852 0.000 NA
#> GSM876874     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876875     1  0.1430      0.902 0.944 0.000 0.052 0.000 NA
#> GSM876876     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876877     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876878     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876879     1  0.1430      0.902 0.944 0.000 0.052 0.000 NA
#> GSM876880     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876905     3  0.2605      0.823 0.148 0.000 0.852 0.000 NA
#> GSM876906     3  0.2813      0.756 0.000 0.000 0.832 0.000 NA
#> GSM876907     3  0.3424      0.721 0.000 0.000 0.760 0.000 NA
#> GSM876908     3  0.2813      0.756 0.000 0.000 0.832 0.000 NA
#> GSM876909     3  0.3424      0.721 0.000 0.000 0.760 0.000 NA
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876882     1  0.2221      0.881 0.912 0.000 0.052 0.000 NA
#> GSM876883     1  0.6272      0.267 0.468 0.000 0.152 0.000 NA
#> GSM876884     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876885     1  0.6272      0.267 0.468 0.000 0.152 0.000 NA
#> GSM876857     1  0.0000      0.938 1.000 0.000 0.000 0.000 NA
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA
#> GSM876861     2  0.0000      1.000 0.000 1.000 0.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0000     0.9790 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876887     3  0.0000     0.9790 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876888     3  0.0458     0.9848 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM876889     3  0.1141     0.9278 0.000 0.000 0.948 0.000 0.052 0.000
#> GSM876890     3  0.0000     0.9790 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876891     5  0.2793     0.8290 0.000 0.000 0.200 0.000 0.800 0.000
#> GSM876862     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.2260     0.8134 0.860 0.000 0.140 0.000 0.000 0.000
#> GSM876867     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876841     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876843     6  0.1007     0.8854 0.000 0.044 0.000 0.000 0.000 0.956
#> GSM876892     3  0.0000     0.9790 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0458     0.9848 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM876894     5  0.2793     0.8290 0.000 0.000 0.200 0.000 0.800 0.000
#> GSM876895     5  0.0000     0.8610 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876896     4  0.3797     0.5903 0.000 0.000 0.000 0.580 0.000 0.420
#> GSM876897     4  0.3797     0.5903 0.000 0.000 0.000 0.580 0.000 0.420
#> GSM876868     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000     0.6197 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876873     4  0.0000     0.6197 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876844     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876845     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.2300     0.8306 0.000 0.856 0.000 0.000 0.000 0.144
#> GSM876847     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     6  0.0000     0.9422 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876849     6  0.0000     0.9422 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876898     3  0.0458     0.9848 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM876899     5  0.0146     0.8615 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM876900     3  0.0458     0.9848 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM876901     3  0.0458     0.9848 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM876902     4  0.3547     0.6362 0.000 0.000 0.000 0.668 0.000 0.332
#> GSM876903     5  0.0000     0.8610 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.0458     0.9848 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM876874     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.2340     0.8066 0.852 0.000 0.148 0.000 0.000 0.000
#> GSM876876     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.2340     0.8066 0.852 0.000 0.148 0.000 0.000 0.000
#> GSM876880     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876853     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876855     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876856     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876905     3  0.0458     0.9848 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM876906     5  0.2793     0.8290 0.000 0.000 0.200 0.000 0.800 0.000
#> GSM876907     5  0.0000     0.8610 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.2793     0.8290 0.000 0.000 0.200 0.000 0.800 0.000
#> GSM876909     5  0.0000     0.8610 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876882     1  0.3101     0.7834 0.820 0.000 0.148 0.032 0.000 0.000
#> GSM876883     1  0.7025     0.0771 0.376 0.000 0.148 0.368 0.108 0.000
#> GSM876884     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     1  0.7025     0.0771 0.376 0.000 0.148 0.368 0.108 0.000
#> GSM876857     1  0.0000     0.9095 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876859     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876860     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876861     2  0.0000     0.9927 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) tissue(p) k
#> SD:hclust 72           0.4844  9.33e-11 2
#> SD:hclust 72           0.0529  3.04e-11 3
#> SD:hclust 64           0.7387  1.23e-22 4
#> SD:hclust 70           0.1797  5.57e-22 5
#> SD:hclust 70           0.1886  3.05e-21 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 72 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-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.984       0.990         0.4923 0.507   0.507
#> 3 3 0.676           0.552       0.779         0.3172 0.836   0.700
#> 4 4 0.957           0.955       0.963         0.1278 0.813   0.572
#> 5 5 0.853           0.784       0.876         0.0585 0.984   0.938
#> 6 6 0.857           0.817       0.830         0.0406 0.941   0.767

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1  0.0000      0.990 1.000 0.000
#> GSM876887     1  0.0000      0.990 1.000 0.000
#> GSM876888     1  0.0672      0.993 0.992 0.008
#> GSM876889     1  0.0000      0.990 1.000 0.000
#> GSM876890     1  0.0000      0.990 1.000 0.000
#> GSM876891     1  0.0672      0.993 0.992 0.008
#> GSM876862     1  0.0672      0.993 0.992 0.008
#> GSM876863     1  0.0672      0.993 0.992 0.008
#> GSM876864     1  0.0672      0.993 0.992 0.008
#> GSM876865     1  0.0672      0.993 0.992 0.008
#> GSM876866     1  0.0000      0.990 1.000 0.000
#> GSM876867     1  0.0672      0.993 0.992 0.008
#> GSM876838     2  0.0000      0.990 0.000 1.000
#> GSM876839     2  0.0000      0.990 0.000 1.000
#> GSM876840     2  0.0000      0.990 0.000 1.000
#> GSM876841     2  0.0000      0.990 0.000 1.000
#> GSM876842     2  0.0000      0.990 0.000 1.000
#> GSM876843     2  0.0672      0.986 0.008 0.992
#> GSM876892     1  0.0672      0.993 0.992 0.008
#> GSM876893     1  0.0672      0.993 0.992 0.008
#> GSM876894     1  0.0672      0.993 0.992 0.008
#> GSM876895     2  0.7219      0.750 0.200 0.800
#> GSM876896     2  0.0672      0.986 0.008 0.992
#> GSM876897     2  0.0672      0.986 0.008 0.992
#> GSM876868     1  0.0672      0.993 0.992 0.008
#> GSM876869     1  0.0672      0.993 0.992 0.008
#> GSM876870     1  0.0672      0.993 0.992 0.008
#> GSM876871     1  0.0672      0.993 0.992 0.008
#> GSM876872     1  0.0000      0.990 1.000 0.000
#> GSM876873     1  0.0000      0.990 1.000 0.000
#> GSM876844     2  0.0000      0.990 0.000 1.000
#> GSM876845     2  0.0000      0.990 0.000 1.000
#> GSM876846     2  0.0000      0.990 0.000 1.000
#> GSM876847     2  0.0000      0.990 0.000 1.000
#> GSM876848     2  0.0672      0.986 0.008 0.992
#> GSM876849     2  0.0672      0.986 0.008 0.992
#> GSM876898     1  0.0672      0.993 0.992 0.008
#> GSM876899     1  0.0672      0.993 0.992 0.008
#> GSM876900     1  0.0672      0.993 0.992 0.008
#> GSM876901     1  0.0672      0.993 0.992 0.008
#> GSM876902     1  0.6801      0.776 0.820 0.180
#> GSM876903     2  0.0938      0.982 0.012 0.988
#> GSM876904     1  0.0672      0.993 0.992 0.008
#> GSM876874     1  0.0672      0.993 0.992 0.008
#> GSM876875     1  0.0000      0.990 1.000 0.000
#> GSM876876     1  0.0672      0.993 0.992 0.008
#> GSM876877     1  0.0672      0.993 0.992 0.008
#> GSM876878     1  0.0672      0.993 0.992 0.008
#> GSM876879     1  0.0000      0.990 1.000 0.000
#> GSM876880     1  0.0672      0.993 0.992 0.008
#> GSM876850     2  0.0000      0.990 0.000 1.000
#> GSM876851     2  0.0000      0.990 0.000 1.000
#> GSM876852     2  0.0000      0.990 0.000 1.000
#> GSM876853     2  0.0000      0.990 0.000 1.000
#> GSM876854     2  0.0000      0.990 0.000 1.000
#> GSM876855     2  0.0000      0.990 0.000 1.000
#> GSM876856     2  0.0000      0.990 0.000 1.000
#> GSM876905     1  0.0672      0.993 0.992 0.008
#> GSM876906     1  0.0672      0.993 0.992 0.008
#> GSM876907     2  0.0938      0.982 0.012 0.988
#> GSM876908     1  0.0672      0.993 0.992 0.008
#> GSM876909     2  0.0938      0.982 0.012 0.988
#> GSM876881     2  0.0000      0.990 0.000 1.000
#> GSM876882     1  0.0000      0.990 1.000 0.000
#> GSM876883     1  0.0000      0.990 1.000 0.000
#> GSM876884     1  0.0672      0.993 0.992 0.008
#> GSM876885     1  0.0000      0.990 1.000 0.000
#> GSM876857     1  0.0672      0.993 0.992 0.008
#> GSM876858     2  0.0000      0.990 0.000 1.000
#> GSM876859     2  0.0000      0.990 0.000 1.000
#> GSM876860     2  0.0000      0.990 0.000 1.000
#> GSM876861     2  0.0000      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
#> GSM876886     1  0.0000     0.5244 1.000 0.000 0.000
#> GSM876887     1  0.0747     0.5102 0.984 0.000 0.016
#> GSM876888     1  0.0000     0.5244 1.000 0.000 0.000
#> GSM876889     1  0.6140    -0.2014 0.596 0.000 0.404
#> GSM876890     1  0.0747     0.5102 0.984 0.000 0.016
#> GSM876891     1  0.6140    -0.2014 0.596 0.000 0.404
#> GSM876862     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876863     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876864     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876865     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876866     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876867     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876838     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876839     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876840     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876841     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876842     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876843     3  0.6140    -0.7127 0.000 0.404 0.596
#> GSM876892     1  0.0237     0.5214 0.996 0.000 0.004
#> GSM876893     1  0.0000     0.5244 1.000 0.000 0.000
#> GSM876894     1  0.6140    -0.2014 0.596 0.000 0.404
#> GSM876895     1  0.9550    -0.5733 0.404 0.192 0.404
#> GSM876896     3  0.5397     0.5792 0.280 0.000 0.720
#> GSM876897     3  0.4861     0.5774 0.192 0.008 0.800
#> GSM876868     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876869     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876870     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876871     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876872     3  0.6111     0.5263 0.396 0.000 0.604
#> GSM876873     3  0.6111     0.5263 0.396 0.000 0.604
#> GSM876844     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876845     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876846     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876847     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876848     3  0.4931    -0.3463 0.000 0.232 0.768
#> GSM876849     3  0.2711     0.0949 0.000 0.088 0.912
#> GSM876898     1  0.0000     0.5244 1.000 0.000 0.000
#> GSM876899     1  0.6140    -0.2014 0.596 0.000 0.404
#> GSM876900     1  0.0237     0.5214 0.996 0.000 0.004
#> GSM876901     1  0.0237     0.5214 0.996 0.000 0.004
#> GSM876902     3  0.6111     0.5263 0.396 0.000 0.604
#> GSM876903     3  0.9577     0.5193 0.400 0.196 0.404
#> GSM876904     1  0.0000     0.5244 1.000 0.000 0.000
#> GSM876874     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876875     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876876     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876877     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876878     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876879     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876880     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876850     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876851     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876852     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876853     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876854     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876855     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876856     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876905     1  0.0000     0.5244 1.000 0.000 0.000
#> GSM876906     1  0.6140    -0.2014 0.596 0.000 0.404
#> GSM876907     1  0.9550    -0.5733 0.404 0.192 0.404
#> GSM876908     1  0.6140    -0.2014 0.596 0.000 0.404
#> GSM876909     3  0.9577     0.5193 0.400 0.196 0.404
#> GSM876881     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876882     1  0.5859     0.6352 0.656 0.344 0.000
#> GSM876883     1  0.6140    -0.2014 0.596 0.000 0.404
#> GSM876884     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876885     1  0.6140    -0.2014 0.596 0.000 0.404
#> GSM876857     1  0.6111     0.6478 0.604 0.396 0.000
#> GSM876858     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876859     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876860     2  0.6111     1.0000 0.000 0.604 0.396
#> GSM876861     2  0.6111     1.0000 0.000 0.604 0.396

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876887     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876888     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876889     3  0.1624      0.929 0.028 0.000 0.952 0.020
#> GSM876890     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876891     3  0.1624      0.929 0.028 0.000 0.952 0.020
#> GSM876862     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.983 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876840     2  0.0336      0.980 0.000 0.992 0.000 0.008
#> GSM876841     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876842     2  0.0000      0.983 0.000 1.000 0.000 0.000
#> GSM876843     4  0.4193      0.653 0.000 0.268 0.000 0.732
#> GSM876892     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876893     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876894     3  0.0921      0.930 0.028 0.000 0.972 0.000
#> GSM876895     3  0.2530      0.868 0.000 0.000 0.888 0.112
#> GSM876896     4  0.0336      0.940 0.000 0.000 0.008 0.992
#> GSM876897     4  0.0336      0.940 0.000 0.000 0.008 0.992
#> GSM876868     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0336      0.940 0.000 0.000 0.008 0.992
#> GSM876873     4  0.0336      0.940 0.000 0.000 0.008 0.992
#> GSM876844     2  0.0000      0.983 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876846     2  0.0336      0.980 0.000 0.992 0.000 0.008
#> GSM876847     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876848     4  0.2011      0.885 0.000 0.080 0.000 0.920
#> GSM876849     4  0.0707      0.930 0.000 0.020 0.000 0.980
#> GSM876898     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876899     3  0.3182      0.895 0.028 0.000 0.876 0.096
#> GSM876900     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876901     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876902     4  0.0336      0.940 0.000 0.000 0.008 0.992
#> GSM876903     3  0.2530      0.868 0.000 0.000 0.888 0.112
#> GSM876904     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876874     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876876     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876880     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876851     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876852     2  0.0000      0.983 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      0.983 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0336      0.980 0.000 0.992 0.000 0.008
#> GSM876855     2  0.0336      0.980 0.000 0.992 0.000 0.008
#> GSM876856     2  0.0336      0.980 0.000 0.992 0.000 0.008
#> GSM876905     3  0.1637      0.936 0.060 0.000 0.940 0.000
#> GSM876906     3  0.1624      0.929 0.028 0.000 0.952 0.020
#> GSM876907     3  0.2530      0.868 0.000 0.000 0.888 0.112
#> GSM876908     3  0.1624      0.929 0.028 0.000 0.952 0.020
#> GSM876909     3  0.2530      0.868 0.000 0.000 0.888 0.112
#> GSM876881     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876882     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876883     3  0.5119      0.806 0.124 0.000 0.764 0.112
#> GSM876884     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876885     3  0.5066      0.810 0.120 0.000 0.768 0.112
#> GSM876857     1  0.0000      1.000 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876859     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876860     2  0.0921      0.985 0.000 0.972 0.028 0.000
#> GSM876861     2  0.0921      0.985 0.000 0.972 0.028 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
#> GSM876886     3  0.0912      0.686 0.016 0.000 0.972 0.000 0.012
#> GSM876887     3  0.0912      0.686 0.016 0.000 0.972 0.000 0.012
#> GSM876888     3  0.0671      0.693 0.016 0.000 0.980 0.000 0.004
#> GSM876889     3  0.3636      0.538 0.000 0.000 0.728 0.000 0.272
#> GSM876890     3  0.0671      0.693 0.016 0.000 0.980 0.000 0.004
#> GSM876891     3  0.4029      0.492 0.000 0.000 0.680 0.004 0.316
#> GSM876862     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.1792      0.892 0.000 0.916 0.000 0.000 0.084
#> GSM876839     2  0.0162      0.899 0.000 0.996 0.000 0.000 0.004
#> GSM876840     2  0.3689      0.826 0.000 0.740 0.000 0.004 0.256
#> GSM876841     2  0.0162      0.899 0.000 0.996 0.000 0.000 0.004
#> GSM876842     2  0.2471      0.880 0.000 0.864 0.000 0.000 0.136
#> GSM876843     4  0.5500      0.581 0.000 0.124 0.000 0.640 0.236
#> GSM876892     3  0.0510      0.695 0.016 0.000 0.984 0.000 0.000
#> GSM876893     3  0.0510      0.695 0.016 0.000 0.984 0.000 0.000
#> GSM876894     3  0.3684      0.531 0.000 0.000 0.720 0.000 0.280
#> GSM876895     3  0.5330      0.245 0.000 0.000 0.548 0.056 0.396
#> GSM876896     4  0.0162      0.829 0.000 0.000 0.000 0.996 0.004
#> GSM876897     4  0.0162      0.829 0.000 0.000 0.000 0.996 0.004
#> GSM876868     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.3774      0.685 0.000 0.000 0.000 0.704 0.296
#> GSM876873     4  0.3774      0.685 0.000 0.000 0.000 0.704 0.296
#> GSM876844     2  0.2471      0.880 0.000 0.864 0.000 0.000 0.136
#> GSM876845     2  0.0000      0.898 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2  0.3662      0.826 0.000 0.744 0.000 0.004 0.252
#> GSM876847     2  0.0290      0.897 0.000 0.992 0.000 0.000 0.008
#> GSM876848     4  0.2632      0.798 0.000 0.040 0.000 0.888 0.072
#> GSM876849     4  0.1251      0.824 0.000 0.008 0.000 0.956 0.036
#> GSM876898     3  0.0510      0.695 0.016 0.000 0.984 0.000 0.000
#> GSM876899     3  0.5188      0.367 0.000 0.000 0.600 0.056 0.344
#> GSM876900     3  0.0510      0.695 0.016 0.000 0.984 0.000 0.000
#> GSM876901     3  0.0510      0.695 0.016 0.000 0.984 0.000 0.000
#> GSM876902     4  0.1341      0.809 0.000 0.000 0.000 0.944 0.056
#> GSM876903     3  0.5274      0.325 0.000 0.000 0.572 0.056 0.372
#> GSM876904     3  0.0510      0.695 0.016 0.000 0.984 0.000 0.000
#> GSM876874     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.2074      0.874 0.896 0.000 0.000 0.000 0.104
#> GSM876876     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.3895      0.609 0.680 0.000 0.000 0.000 0.320
#> GSM876880     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0290      0.897 0.000 0.992 0.000 0.000 0.008
#> GSM876851     2  0.0000      0.898 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.3424      0.838 0.000 0.760 0.000 0.000 0.240
#> GSM876853     2  0.1792      0.892 0.000 0.916 0.000 0.000 0.084
#> GSM876854     2  0.3508      0.831 0.000 0.748 0.000 0.000 0.252
#> GSM876855     2  0.3689      0.826 0.000 0.740 0.000 0.004 0.256
#> GSM876856     2  0.3689      0.826 0.000 0.740 0.000 0.004 0.256
#> GSM876905     3  0.0510      0.695 0.016 0.000 0.984 0.000 0.000
#> GSM876906     3  0.4251      0.484 0.000 0.000 0.672 0.012 0.316
#> GSM876907     3  0.5274      0.325 0.000 0.000 0.572 0.056 0.372
#> GSM876908     3  0.4251      0.484 0.000 0.000 0.672 0.012 0.316
#> GSM876909     3  0.5274      0.325 0.000 0.000 0.572 0.056 0.372
#> GSM876881     2  0.1043      0.886 0.000 0.960 0.000 0.000 0.040
#> GSM876882     1  0.3983      0.576 0.660 0.000 0.000 0.000 0.340
#> GSM876883     5  0.5001      0.989 0.040 0.000 0.260 0.016 0.684
#> GSM876884     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5  0.4953      0.989 0.036 0.000 0.264 0.016 0.684
#> GSM876857     1  0.0000      0.960 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.1197      0.888 0.000 0.952 0.000 0.000 0.048
#> GSM876859     2  0.1197      0.888 0.000 0.952 0.000 0.000 0.048
#> GSM876860     2  0.1197      0.888 0.000 0.952 0.000 0.000 0.048
#> GSM876861     2  0.1197      0.888 0.000 0.952 0.000 0.000 0.048

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.3898      0.969 0.000 0.000 0.684 0.000 0.296 0.020
#> GSM876887     3  0.4047      0.963 0.000 0.000 0.676 0.000 0.296 0.028
#> GSM876888     3  0.3428      0.986 0.000 0.000 0.696 0.000 0.304 0.000
#> GSM876889     5  0.4384      0.022 0.000 0.000 0.348 0.000 0.616 0.036
#> GSM876890     3  0.3853      0.977 0.000 0.000 0.680 0.000 0.304 0.016
#> GSM876891     5  0.1049      0.902 0.000 0.000 0.032 0.000 0.960 0.008
#> GSM876862     1  0.0000      0.954 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0146      0.953 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.954 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0972      0.944 0.964 0.000 0.028 0.008 0.000 0.000
#> GSM876866     1  0.0146      0.953 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM876867     1  0.0260      0.954 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM876838     2  0.2969      0.822 0.000 0.776 0.000 0.000 0.000 0.224
#> GSM876839     2  0.3728      0.831 0.000 0.652 0.000 0.000 0.004 0.344
#> GSM876840     2  0.1010      0.720 0.000 0.960 0.036 0.004 0.000 0.000
#> GSM876841     2  0.3728      0.831 0.000 0.652 0.000 0.000 0.004 0.344
#> GSM876842     2  0.2491      0.808 0.000 0.836 0.000 0.000 0.000 0.164
#> GSM876843     4  0.5487      0.443 0.000 0.364 0.096 0.528 0.000 0.012
#> GSM876892     3  0.3446      0.989 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM876893     3  0.3446      0.989 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM876894     5  0.1918      0.834 0.000 0.000 0.088 0.000 0.904 0.008
#> GSM876895     5  0.0405      0.893 0.000 0.000 0.004 0.000 0.988 0.008
#> GSM876896     4  0.0653      0.764 0.000 0.000 0.004 0.980 0.012 0.004
#> GSM876897     4  0.0508      0.765 0.000 0.000 0.000 0.984 0.012 0.004
#> GSM876868     1  0.0000      0.954 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0146      0.954 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM876870     1  0.1802      0.926 0.916 0.000 0.072 0.012 0.000 0.000
#> GSM876871     1  0.1643      0.931 0.924 0.000 0.068 0.008 0.000 0.000
#> GSM876872     4  0.5113      0.452 0.000 0.000 0.040 0.572 0.028 0.360
#> GSM876873     4  0.5113      0.452 0.000 0.000 0.040 0.572 0.028 0.360
#> GSM876844     2  0.2491      0.808 0.000 0.836 0.000 0.000 0.000 0.164
#> GSM876845     2  0.3742      0.831 0.000 0.648 0.000 0.000 0.004 0.348
#> GSM876846     2  0.2333      0.712 0.000 0.896 0.060 0.004 0.000 0.040
#> GSM876847     2  0.3942      0.826 0.000 0.624 0.004 0.000 0.004 0.368
#> GSM876848     4  0.2739      0.737 0.000 0.048 0.064 0.876 0.000 0.012
#> GSM876849     4  0.2026      0.753 0.000 0.004 0.060 0.916 0.008 0.012
#> GSM876898     3  0.3446      0.989 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM876899     5  0.0632      0.908 0.000 0.000 0.024 0.000 0.976 0.000
#> GSM876900     3  0.3446      0.989 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM876901     3  0.3446      0.989 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM876902     4  0.1922      0.749 0.000 0.000 0.012 0.924 0.040 0.024
#> GSM876903     5  0.0000      0.905 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.3446      0.989 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM876874     1  0.0972      0.944 0.964 0.000 0.028 0.008 0.000 0.000
#> GSM876875     1  0.3861      0.576 0.744 0.000 0.028 0.008 0.000 0.220
#> GSM876876     1  0.0632      0.951 0.976 0.000 0.024 0.000 0.000 0.000
#> GSM876877     1  0.0713      0.951 0.972 0.000 0.028 0.000 0.000 0.000
#> GSM876878     1  0.1285      0.938 0.944 0.000 0.052 0.004 0.000 0.000
#> GSM876879     6  0.4945      0.394 0.412 0.000 0.056 0.004 0.000 0.528
#> GSM876880     1  0.0713      0.951 0.972 0.000 0.028 0.000 0.000 0.000
#> GSM876850     2  0.3942      0.826 0.000 0.624 0.004 0.000 0.004 0.368
#> GSM876851     2  0.3728      0.831 0.000 0.652 0.000 0.000 0.004 0.344
#> GSM876852     2  0.0790      0.724 0.000 0.968 0.032 0.000 0.000 0.000
#> GSM876853     2  0.2969      0.822 0.000 0.776 0.000 0.000 0.000 0.224
#> GSM876854     2  0.0865      0.722 0.000 0.964 0.036 0.000 0.000 0.000
#> GSM876855     2  0.1010      0.720 0.000 0.960 0.036 0.004 0.000 0.000
#> GSM876856     2  0.1010      0.720 0.000 0.960 0.036 0.004 0.000 0.000
#> GSM876905     3  0.3446      0.989 0.000 0.000 0.692 0.000 0.308 0.000
#> GSM876906     5  0.0713      0.907 0.000 0.000 0.028 0.000 0.972 0.000
#> GSM876907     5  0.0000      0.905 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.0713      0.907 0.000 0.000 0.028 0.000 0.972 0.000
#> GSM876909     5  0.0000      0.905 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.4378      0.814 0.000 0.588 0.008 0.000 0.016 0.388
#> GSM876882     6  0.4736      0.428 0.396 0.000 0.052 0.000 0.000 0.552
#> GSM876883     6  0.4808      0.388 0.000 0.000 0.052 0.004 0.368 0.576
#> GSM876884     1  0.1802      0.926 0.916 0.000 0.072 0.012 0.000 0.000
#> GSM876885     6  0.4808      0.388 0.000 0.000 0.052 0.004 0.368 0.576
#> GSM876857     1  0.0000      0.954 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.5331      0.799 0.000 0.588 0.072 0.000 0.024 0.316
#> GSM876859     2  0.5331      0.799 0.000 0.588 0.072 0.000 0.024 0.316
#> GSM876860     2  0.5331      0.799 0.000 0.588 0.072 0.000 0.024 0.316
#> GSM876861     2  0.5331      0.799 0.000 0.588 0.072 0.000 0.024 0.316

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) tissue(p) k
#> SD:kmeans 72           0.7308  1.25e-10 2
#> SD:kmeans 59           0.3114  3.16e-11 3
#> SD:kmeans 72           0.1206  1.48e-20 4
#> SD:kmeans 64           0.0303  2.26e-18 5
#> SD:kmeans 64           0.2032  5.30e-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.


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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5013 0.499   0.499
#> 3 3 0.781           0.873       0.922         0.3147 0.814   0.636
#> 4 4 1.000           0.962       0.984         0.1087 0.921   0.770
#> 5 5 1.000           0.951       0.980         0.0596 0.946   0.805
#> 6 6 0.989           0.926       0.969         0.0363 0.964   0.844

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette p1 p2
#> GSM876886     1       0          1  1  0
#> GSM876887     1       0          1  1  0
#> GSM876888     1       0          1  1  0
#> GSM876889     1       0          1  1  0
#> GSM876890     1       0          1  1  0
#> GSM876891     1       0          1  1  0
#> GSM876862     1       0          1  1  0
#> GSM876863     1       0          1  1  0
#> GSM876864     1       0          1  1  0
#> GSM876865     1       0          1  1  0
#> GSM876866     1       0          1  1  0
#> GSM876867     1       0          1  1  0
#> GSM876838     2       0          1  0  1
#> GSM876839     2       0          1  0  1
#> GSM876840     2       0          1  0  1
#> GSM876841     2       0          1  0  1
#> GSM876842     2       0          1  0  1
#> GSM876843     2       0          1  0  1
#> GSM876892     1       0          1  1  0
#> GSM876893     1       0          1  1  0
#> GSM876894     1       0          1  1  0
#> GSM876895     2       0          1  0  1
#> GSM876896     2       0          1  0  1
#> GSM876897     2       0          1  0  1
#> GSM876868     1       0          1  1  0
#> GSM876869     1       0          1  1  0
#> GSM876870     1       0          1  1  0
#> GSM876871     1       0          1  1  0
#> GSM876872     1       0          1  1  0
#> GSM876873     1       0          1  1  0
#> GSM876844     2       0          1  0  1
#> GSM876845     2       0          1  0  1
#> GSM876846     2       0          1  0  1
#> GSM876847     2       0          1  0  1
#> GSM876848     2       0          1  0  1
#> GSM876849     2       0          1  0  1
#> GSM876898     1       0          1  1  0
#> GSM876899     2       0          1  0  1
#> GSM876900     1       0          1  1  0
#> GSM876901     1       0          1  1  0
#> GSM876902     2       0          1  0  1
#> GSM876903     2       0          1  0  1
#> GSM876904     1       0          1  1  0
#> GSM876874     1       0          1  1  0
#> GSM876875     1       0          1  1  0
#> GSM876876     1       0          1  1  0
#> GSM876877     1       0          1  1  0
#> GSM876878     1       0          1  1  0
#> GSM876879     1       0          1  1  0
#> GSM876880     1       0          1  1  0
#> GSM876850     2       0          1  0  1
#> GSM876851     2       0          1  0  1
#> GSM876852     2       0          1  0  1
#> GSM876853     2       0          1  0  1
#> GSM876854     2       0          1  0  1
#> GSM876855     2       0          1  0  1
#> GSM876856     2       0          1  0  1
#> GSM876905     1       0          1  1  0
#> GSM876906     1       0          1  1  0
#> GSM876907     2       0          1  0  1
#> GSM876908     1       0          1  1  0
#> GSM876909     2       0          1  0  1
#> GSM876881     2       0          1  0  1
#> GSM876882     1       0          1  1  0
#> GSM876883     1       0          1  1  0
#> GSM876884     1       0          1  1  0
#> GSM876885     1       0          1  1  0
#> GSM876857     1       0          1  1  0
#> GSM876858     2       0          1  0  1
#> GSM876859     2       0          1  0  1
#> GSM876860     2       0          1  0  1
#> GSM876861     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM876886     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876887     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876888     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876889     3  0.0000      0.766 0.000 0.000 1.000
#> GSM876890     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876891     3  0.0000      0.766 0.000 0.000 1.000
#> GSM876862     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876866     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876867     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876838     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876839     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876840     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876841     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876842     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876843     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876892     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876893     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876894     3  0.0000      0.766 0.000 0.000 1.000
#> GSM876895     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876896     2  0.5178      0.750 0.000 0.744 0.256
#> GSM876897     2  0.5178      0.750 0.000 0.744 0.256
#> GSM876868     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876872     1  0.5178      0.671 0.744 0.000 0.256
#> GSM876873     1  0.5178      0.671 0.744 0.000 0.256
#> GSM876844     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876845     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876846     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876847     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876848     2  0.0424      0.943 0.000 0.992 0.008
#> GSM876849     2  0.4842      0.780 0.000 0.776 0.224
#> GSM876898     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876899     3  0.0000      0.766 0.000 0.000 1.000
#> GSM876900     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876901     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876902     3  0.5678      0.281 0.000 0.316 0.684
#> GSM876903     2  0.5178      0.750 0.000 0.744 0.256
#> GSM876904     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876874     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876875     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876876     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876879     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876880     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876850     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876851     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876852     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876853     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876854     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876855     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876856     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876905     3  0.5178      0.831 0.256 0.000 0.744
#> GSM876906     3  0.0000      0.766 0.000 0.000 1.000
#> GSM876907     2  0.5138      0.754 0.000 0.748 0.252
#> GSM876908     3  0.0000      0.766 0.000 0.000 1.000
#> GSM876909     2  0.5016      0.765 0.000 0.760 0.240
#> GSM876881     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876882     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876883     1  0.4974      0.695 0.764 0.000 0.236
#> GSM876884     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876885     1  0.5016      0.691 0.760 0.000 0.240
#> GSM876857     1  0.0000      0.942 1.000 0.000 0.000
#> GSM876858     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876859     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876860     2  0.0000      0.948 0.000 1.000 0.000
#> GSM876861     2  0.0000      0.948 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
#> GSM876886     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876887     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876888     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876889     3  0.0188      0.995 0.000 0.000 0.996 0.004
#> GSM876890     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876891     3  0.0000      0.996 0.000 0.000 1.000 0.000
#> GSM876862     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876843     4  0.3649      0.750 0.000 0.204 0.000 0.796
#> GSM876892     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876893     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876894     3  0.0000      0.996 0.000 0.000 1.000 0.000
#> GSM876895     2  0.0376      0.993 0.000 0.992 0.004 0.004
#> GSM876896     4  0.0188      0.965 0.000 0.004 0.000 0.996
#> GSM876897     4  0.0188      0.965 0.000 0.004 0.000 0.996
#> GSM876868     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0188      0.963 0.004 0.000 0.000 0.996
#> GSM876873     4  0.0188      0.963 0.004 0.000 0.000 0.996
#> GSM876844     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876848     4  0.0188      0.965 0.000 0.004 0.000 0.996
#> GSM876849     4  0.0188      0.965 0.000 0.004 0.000 0.996
#> GSM876898     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876899     3  0.0188      0.994 0.000 0.000 0.996 0.004
#> GSM876900     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876901     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876902     4  0.0000      0.963 0.000 0.000 0.000 1.000
#> GSM876903     2  0.0376      0.993 0.000 0.992 0.004 0.004
#> GSM876904     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876874     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876876     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876880     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876905     3  0.0188      0.998 0.004 0.000 0.996 0.000
#> GSM876906     3  0.0188      0.994 0.000 0.000 0.996 0.004
#> GSM876907     2  0.0376      0.993 0.000 0.992 0.004 0.004
#> GSM876908     3  0.0188      0.994 0.000 0.000 0.996 0.004
#> GSM876909     2  0.0376      0.993 0.000 0.992 0.004 0.004
#> GSM876881     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876882     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876883     1  0.4866      0.346 0.596 0.000 0.000 0.404
#> GSM876884     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876885     1  0.4866      0.346 0.596 0.000 0.000 0.404
#> GSM876857     1  0.0000      0.960 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      0.999 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
#> GSM876886     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876887     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876888     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876889     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876890     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876891     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876862     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876843     4  0.4138      0.385 0.000 0.384 0.000 0.616 0.000
#> GSM876892     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876893     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876894     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876895     5  0.0703      0.979 0.000 0.024 0.000 0.000 0.976
#> GSM876896     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0290      0.917 0.000 0.000 0.000 0.992 0.008
#> GSM876873     4  0.0290      0.917 0.000 0.000 0.000 0.992 0.008
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000
#> GSM876849     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000
#> GSM876898     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876899     5  0.0703      0.973 0.000 0.000 0.024 0.000 0.976
#> GSM876900     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876901     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876902     4  0.0000      0.920 0.000 0.000 0.000 1.000 0.000
#> GSM876903     5  0.0703      0.979 0.000 0.024 0.000 0.000 0.976
#> GSM876904     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876874     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.0510      0.948 0.984 0.000 0.000 0.000 0.016
#> GSM876876     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.0703      0.943 0.976 0.000 0.000 0.000 0.024
#> GSM876880     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876905     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM876906     5  0.0703      0.973 0.000 0.000 0.024 0.000 0.976
#> GSM876907     5  0.0703      0.979 0.000 0.024 0.000 0.000 0.976
#> GSM876908     5  0.0703      0.973 0.000 0.000 0.024 0.000 0.976
#> GSM876909     5  0.0703      0.979 0.000 0.024 0.000 0.000 0.976
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876882     1  0.0703      0.943 0.976 0.000 0.000 0.000 0.024
#> GSM876883     1  0.4779      0.356 0.588 0.000 0.000 0.388 0.024
#> GSM876884     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876885     1  0.4779      0.356 0.588 0.000 0.000 0.388 0.024
#> GSM876857     1  0.0000      0.957 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0260      0.993 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM876887     3  0.0260      0.993 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM876888     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876889     3  0.0790      0.976 0.000 0.000 0.968 0.000 0.000 0.032
#> GSM876890     3  0.0260      0.993 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM876891     3  0.0458      0.989 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM876862     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.0713      0.978 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM876841     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876843     4  0.2697      0.608 0.000 0.188 0.000 0.812 0.000 0.000
#> GSM876892     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876894     3  0.0260      0.991 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM876895     5  0.0405      0.987 0.000 0.004 0.000 0.000 0.988 0.008
#> GSM876896     4  0.0713      0.903 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM876897     4  0.0632      0.905 0.000 0.000 0.000 0.976 0.000 0.024
#> GSM876868     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     6  0.3866      0.131 0.000 0.000 0.000 0.484 0.000 0.516
#> GSM876873     6  0.3833      0.226 0.000 0.000 0.000 0.444 0.000 0.556
#> GSM876844     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.0713      0.978 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM876847     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876848     4  0.0000      0.900 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876849     4  0.0146      0.902 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM876898     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876899     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876900     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876901     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876902     4  0.0713      0.903 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM876903     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876874     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.3765      0.312 0.596 0.000 0.000 0.000 0.000 0.404
#> GSM876876     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876879     6  0.2854      0.569 0.208 0.000 0.000 0.000 0.000 0.792
#> GSM876880     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876851     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0260      0.989 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM876853     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.0713      0.978 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM876855     2  0.0713      0.978 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM876856     2  0.0713      0.978 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM876905     3  0.0000      0.995 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876906     5  0.0260      0.993 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM876907     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.0260      0.993 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM876909     5  0.0000      0.995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876882     6  0.0937      0.707 0.040 0.000 0.000 0.000 0.000 0.960
#> GSM876883     6  0.0717      0.712 0.016 0.000 0.000 0.008 0.000 0.976
#> GSM876884     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.0717      0.712 0.016 0.000 0.000 0.008 0.000 0.976
#> GSM876857     1  0.0000      0.975 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876859     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876860     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876861     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) tissue(p) k
#> SD:skmeans 72           0.7433  5.51e-10 2
#> SD:skmeans 71           0.9315  2.52e-21 3
#> SD:skmeans 70           0.1218  4.52e-18 4
#> SD:skmeans 69           0.0134  1.10e-20 5
#> SD:skmeans 69           0.0550  1.47e-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.


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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.978       0.990         0.4987 0.499   0.499
#> 3 3 1.000           0.968       0.987         0.3438 0.706   0.476
#> 4 4 0.873           0.903       0.935         0.0989 0.924   0.775
#> 5 5 1.000           0.972       0.988         0.0658 0.948   0.806
#> 6 6 0.910           0.920       0.954         0.0301 0.951   0.786

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1   0.000      1.000 1.000 0.000
#> GSM876887     1   0.000      1.000 1.000 0.000
#> GSM876888     1   0.000      1.000 1.000 0.000
#> GSM876889     1   0.000      1.000 1.000 0.000
#> GSM876890     1   0.000      1.000 1.000 0.000
#> GSM876891     1   0.000      1.000 1.000 0.000
#> GSM876862     1   0.000      1.000 1.000 0.000
#> GSM876863     1   0.000      1.000 1.000 0.000
#> GSM876864     1   0.000      1.000 1.000 0.000
#> GSM876865     1   0.000      1.000 1.000 0.000
#> GSM876866     1   0.000      1.000 1.000 0.000
#> GSM876867     1   0.000      1.000 1.000 0.000
#> GSM876838     2   0.000      0.977 0.000 1.000
#> GSM876839     2   0.000      0.977 0.000 1.000
#> GSM876840     2   0.000      0.977 0.000 1.000
#> GSM876841     2   0.000      0.977 0.000 1.000
#> GSM876842     2   0.000      0.977 0.000 1.000
#> GSM876843     2   0.000      0.977 0.000 1.000
#> GSM876892     1   0.000      1.000 1.000 0.000
#> GSM876893     1   0.000      1.000 1.000 0.000
#> GSM876894     1   0.000      1.000 1.000 0.000
#> GSM876895     2   0.456      0.885 0.096 0.904
#> GSM876896     2   0.000      0.977 0.000 1.000
#> GSM876897     2   0.000      0.977 0.000 1.000
#> GSM876868     1   0.000      1.000 1.000 0.000
#> GSM876869     1   0.000      1.000 1.000 0.000
#> GSM876870     1   0.000      1.000 1.000 0.000
#> GSM876871     1   0.000      1.000 1.000 0.000
#> GSM876872     1   0.000      1.000 1.000 0.000
#> GSM876873     1   0.000      1.000 1.000 0.000
#> GSM876844     2   0.000      0.977 0.000 1.000
#> GSM876845     2   0.000      0.977 0.000 1.000
#> GSM876846     2   0.000      0.977 0.000 1.000
#> GSM876847     2   0.000      0.977 0.000 1.000
#> GSM876848     2   0.000      0.977 0.000 1.000
#> GSM876849     2   0.000      0.977 0.000 1.000
#> GSM876898     1   0.000      1.000 1.000 0.000
#> GSM876899     2   0.855      0.626 0.280 0.720
#> GSM876900     1   0.000      1.000 1.000 0.000
#> GSM876901     1   0.000      1.000 1.000 0.000
#> GSM876902     2   0.904      0.542 0.320 0.680
#> GSM876903     2   0.000      0.977 0.000 1.000
#> GSM876904     1   0.000      1.000 1.000 0.000
#> GSM876874     1   0.000      1.000 1.000 0.000
#> GSM876875     1   0.000      1.000 1.000 0.000
#> GSM876876     1   0.000      1.000 1.000 0.000
#> GSM876877     1   0.000      1.000 1.000 0.000
#> GSM876878     1   0.000      1.000 1.000 0.000
#> GSM876879     1   0.000      1.000 1.000 0.000
#> GSM876880     1   0.000      1.000 1.000 0.000
#> GSM876850     2   0.000      0.977 0.000 1.000
#> GSM876851     2   0.000      0.977 0.000 1.000
#> GSM876852     2   0.000      0.977 0.000 1.000
#> GSM876853     2   0.000      0.977 0.000 1.000
#> GSM876854     2   0.000      0.977 0.000 1.000
#> GSM876855     2   0.000      0.977 0.000 1.000
#> GSM876856     2   0.000      0.977 0.000 1.000
#> GSM876905     1   0.000      1.000 1.000 0.000
#> GSM876906     1   0.000      1.000 1.000 0.000
#> GSM876907     2   0.000      0.977 0.000 1.000
#> GSM876908     1   0.000      1.000 1.000 0.000
#> GSM876909     2   0.000      0.977 0.000 1.000
#> GSM876881     2   0.000      0.977 0.000 1.000
#> GSM876882     1   0.000      1.000 1.000 0.000
#> GSM876883     1   0.000      1.000 1.000 0.000
#> GSM876884     1   0.000      1.000 1.000 0.000
#> GSM876885     1   0.000      1.000 1.000 0.000
#> GSM876857     1   0.000      1.000 1.000 0.000
#> GSM876858     2   0.000      0.977 0.000 1.000
#> GSM876859     2   0.000      0.977 0.000 1.000
#> GSM876860     2   0.000      0.977 0.000 1.000
#> GSM876861     2   0.000      0.977 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
#> GSM876886     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876887     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876888     3  0.2448      0.897 0.076 0.000 0.924
#> GSM876889     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876890     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876891     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876862     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876866     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876867     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876843     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876892     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876893     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876894     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876895     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876896     3  0.4887      0.706 0.000 0.228 0.772
#> GSM876897     3  0.6154      0.334 0.000 0.408 0.592
#> GSM876868     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876872     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876873     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876848     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876849     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876898     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876899     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876900     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876901     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876902     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876903     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876904     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876874     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876875     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876876     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876879     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876880     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876905     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876906     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876907     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876908     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876909     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876882     1  0.4887      0.699 0.772 0.000 0.228
#> GSM876883     3  0.0747      0.958 0.016 0.000 0.984
#> GSM876884     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876885     3  0.0000      0.971 0.000 0.000 1.000
#> GSM876857     1  0.0000      0.988 1.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876861     2  0.0000      1.000 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
#> GSM876886     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876887     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876888     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876889     3  0.0817      0.856 0.000 0.000 0.976 0.024
#> GSM876890     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876891     3  0.3400      0.821 0.000 0.000 0.820 0.180
#> GSM876862     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876843     4  0.4817      0.557 0.000 0.388 0.000 0.612
#> GSM876892     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876893     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876894     3  0.1867      0.849 0.000 0.000 0.928 0.072
#> GSM876895     3  0.6428      0.687 0.000 0.112 0.624 0.264
#> GSM876896     4  0.3219      0.814 0.000 0.164 0.000 0.836
#> GSM876897     4  0.3528      0.809 0.000 0.192 0.000 0.808
#> GSM876868     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.739 0.000 0.000 0.000 1.000
#> GSM876873     4  0.0000      0.739 0.000 0.000 0.000 1.000
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876848     4  0.4164      0.762 0.000 0.264 0.000 0.736
#> GSM876849     4  0.4164      0.762 0.000 0.264 0.000 0.736
#> GSM876898     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876899     3  0.4164      0.788 0.000 0.000 0.736 0.264
#> GSM876900     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876901     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876902     4  0.0000      0.739 0.000 0.000 0.000 1.000
#> GSM876903     3  0.4817      0.677 0.000 0.000 0.612 0.388
#> GSM876904     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876874     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876876     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876880     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876905     3  0.0000      0.858 0.000 0.000 1.000 0.000
#> GSM876906     3  0.4164      0.788 0.000 0.000 0.736 0.264
#> GSM876907     3  0.4164      0.788 0.000 0.000 0.736 0.264
#> GSM876908     3  0.4164      0.788 0.000 0.000 0.736 0.264
#> GSM876909     3  0.6273      0.702 0.000 0.100 0.636 0.264
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876882     1  0.3172      0.778 0.840 0.000 0.160 0.000
#> GSM876883     3  0.4936      0.692 0.004 0.000 0.624 0.372
#> GSM876884     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876885     3  0.4817      0.677 0.000 0.000 0.612 0.388
#> GSM876857     1  0.0000      0.990 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      1.000 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
#> GSM876886     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876887     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876888     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876889     3  0.1341      0.937 0.0 0.000 0.944 0.000 0.056
#> GSM876890     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876891     5  0.1043      0.960 0.0 0.000 0.040 0.000 0.960
#> GSM876862     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876843     4  0.2561      0.842 0.0 0.144 0.000 0.856 0.000
#> GSM876892     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876893     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876894     5  0.1043      0.960 0.0 0.000 0.040 0.000 0.960
#> GSM876895     5  0.0000      0.990 0.0 0.000 0.000 0.000 1.000
#> GSM876896     4  0.0000      0.949 0.0 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000      0.949 0.0 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.949 0.0 0.000 0.000 1.000 0.000
#> GSM876873     4  0.0000      0.949 0.0 0.000 0.000 1.000 0.000
#> GSM876844     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876848     4  0.2516      0.846 0.0 0.140 0.000 0.860 0.000
#> GSM876849     4  0.0000      0.949 0.0 0.000 0.000 1.000 0.000
#> GSM876898     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876899     5  0.0000      0.990 0.0 0.000 0.000 0.000 1.000
#> GSM876900     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876901     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876902     4  0.0000      0.949 0.0 0.000 0.000 1.000 0.000
#> GSM876903     5  0.0000      0.990 0.0 0.000 0.000 0.000 1.000
#> GSM876904     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876874     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876875     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876876     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876879     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876880     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876905     3  0.0000      0.994 0.0 0.000 1.000 0.000 0.000
#> GSM876906     5  0.0000      0.990 0.0 0.000 0.000 0.000 1.000
#> GSM876907     5  0.0000      0.990 0.0 0.000 0.000 0.000 1.000
#> GSM876908     5  0.0000      0.990 0.0 0.000 0.000 0.000 1.000
#> GSM876909     5  0.0000      0.990 0.0 0.000 0.000 0.000 1.000
#> GSM876881     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876882     1  0.4182      0.328 0.6 0.000 0.000 0.000 0.400
#> GSM876883     5  0.0000      0.990 0.0 0.000 0.000 0.000 1.000
#> GSM876884     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876885     5  0.0404      0.983 0.0 0.000 0.000 0.012 0.988
#> GSM876857     1  0.0000      0.977 1.0 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      1.000 0.0 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876887     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876888     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876889     3  0.0937     0.9433 0.000 0.000 0.960 0.000 0.040 0.000
#> GSM876890     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876891     3  0.2300     0.8439 0.000 0.000 0.856 0.000 0.144 0.000
#> GSM876862     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876841     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876843     4  0.2491     0.7472 0.000 0.164 0.000 0.836 0.000 0.000
#> GSM876892     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876894     3  0.2300     0.8439 0.000 0.000 0.856 0.000 0.144 0.000
#> GSM876895     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876896     4  0.0000     0.8350 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876897     4  0.0000     0.8350 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876868     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.3843     0.0453 0.000 0.000 0.000 0.548 0.000 0.452
#> GSM876873     6  0.2527     0.7007 0.000 0.000 0.000 0.168 0.000 0.832
#> GSM876844     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876845     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.1556     0.9190 0.000 0.920 0.000 0.000 0.000 0.080
#> GSM876847     2  0.2378     0.8929 0.000 0.848 0.000 0.000 0.000 0.152
#> GSM876848     4  0.2491     0.7472 0.000 0.164 0.000 0.836 0.000 0.000
#> GSM876849     4  0.0000     0.8350 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876898     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876899     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876900     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876901     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876902     4  0.0000     0.8350 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876903     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876874     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     6  0.2793     0.7788 0.200 0.000 0.000 0.000 0.000 0.800
#> GSM876876     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0146     0.9956 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM876879     6  0.2491     0.8152 0.164 0.000 0.000 0.000 0.000 0.836
#> GSM876880     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.2300     0.8963 0.000 0.856 0.000 0.000 0.000 0.144
#> GSM876851     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876853     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876855     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876856     2  0.0000     0.9414 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876905     3  0.0000     0.9723 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876906     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876907     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876909     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.2491     0.8871 0.000 0.836 0.000 0.000 0.000 0.164
#> GSM876882     6  0.2491     0.8152 0.164 0.000 0.000 0.000 0.000 0.836
#> GSM876883     6  0.2491     0.7625 0.000 0.000 0.000 0.000 0.164 0.836
#> GSM876884     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.2595     0.7638 0.000 0.000 0.000 0.004 0.160 0.836
#> GSM876857     1  0.0000     0.9997 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.2491     0.8871 0.000 0.836 0.000 0.000 0.000 0.164
#> GSM876859     2  0.2491     0.8871 0.000 0.836 0.000 0.000 0.000 0.164
#> GSM876860     2  0.2491     0.8871 0.000 0.836 0.000 0.000 0.000 0.164
#> GSM876861     2  0.2491     0.8871 0.000 0.836 0.000 0.000 0.000 0.164

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) tissue(p) k
#> SD:pam 72           0.7433  5.51e-10 2
#> SD:pam 71           0.9638  6.89e-23 3
#> SD:pam 72           0.1206  1.48e-20 4
#> SD:pam 71           0.0206  4.24e-19 5
#> SD:pam 71           0.1200  2.31e-21 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 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.948       0.965         0.4182 0.593   0.593
#> 3 3 0.864           0.929       0.962         0.5904 0.745   0.571
#> 4 4 0.998           0.961       0.981         0.1282 0.886   0.675
#> 5 5 1.000           0.961       0.984         0.0323 0.976   0.905
#> 6 6 0.998           0.965       0.976         0.0432 0.965   0.846

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     2   0.311      0.957 0.056 0.944
#> GSM876887     2   0.311      0.957 0.056 0.944
#> GSM876888     2   0.311      0.957 0.056 0.944
#> GSM876889     2   0.311      0.957 0.056 0.944
#> GSM876890     2   0.311      0.957 0.056 0.944
#> GSM876891     2   0.311      0.957 0.056 0.944
#> GSM876862     1   0.000      1.000 1.000 0.000
#> GSM876863     1   0.000      1.000 1.000 0.000
#> GSM876864     1   0.000      1.000 1.000 0.000
#> GSM876865     1   0.000      1.000 1.000 0.000
#> GSM876866     1   0.000      1.000 1.000 0.000
#> GSM876867     1   0.000      1.000 1.000 0.000
#> GSM876838     2   0.000      0.950 0.000 1.000
#> GSM876839     2   0.000      0.950 0.000 1.000
#> GSM876840     2   0.000      0.950 0.000 1.000
#> GSM876841     2   0.000      0.950 0.000 1.000
#> GSM876842     2   0.000      0.950 0.000 1.000
#> GSM876843     2   0.000      0.950 0.000 1.000
#> GSM876892     2   0.311      0.957 0.056 0.944
#> GSM876893     2   0.311      0.957 0.056 0.944
#> GSM876894     2   0.311      0.957 0.056 0.944
#> GSM876895     2   0.311      0.957 0.056 0.944
#> GSM876896     2   0.311      0.957 0.056 0.944
#> GSM876897     2   0.311      0.957 0.056 0.944
#> GSM876868     1   0.000      1.000 1.000 0.000
#> GSM876869     1   0.000      1.000 1.000 0.000
#> GSM876870     1   0.000      1.000 1.000 0.000
#> GSM876871     1   0.000      1.000 1.000 0.000
#> GSM876872     2   0.327      0.954 0.060 0.940
#> GSM876873     2   0.327      0.954 0.060 0.940
#> GSM876844     2   0.000      0.950 0.000 1.000
#> GSM876845     2   0.000      0.950 0.000 1.000
#> GSM876846     2   0.000      0.950 0.000 1.000
#> GSM876847     2   0.000      0.950 0.000 1.000
#> GSM876848     2   0.311      0.957 0.056 0.944
#> GSM876849     2   0.311      0.957 0.056 0.944
#> GSM876898     2   0.311      0.957 0.056 0.944
#> GSM876899     2   0.311      0.957 0.056 0.944
#> GSM876900     2   0.311      0.957 0.056 0.944
#> GSM876901     2   0.311      0.957 0.056 0.944
#> GSM876902     2   0.311      0.957 0.056 0.944
#> GSM876903     2   0.311      0.957 0.056 0.944
#> GSM876904     2   0.311      0.957 0.056 0.944
#> GSM876874     1   0.000      1.000 1.000 0.000
#> GSM876875     1   0.000      1.000 1.000 0.000
#> GSM876876     1   0.000      1.000 1.000 0.000
#> GSM876877     1   0.000      1.000 1.000 0.000
#> GSM876878     1   0.000      1.000 1.000 0.000
#> GSM876879     1   0.000      1.000 1.000 0.000
#> GSM876880     1   0.000      1.000 1.000 0.000
#> GSM876850     2   0.000      0.950 0.000 1.000
#> GSM876851     2   0.000      0.950 0.000 1.000
#> GSM876852     2   0.000      0.950 0.000 1.000
#> GSM876853     2   0.000      0.950 0.000 1.000
#> GSM876854     2   0.000      0.950 0.000 1.000
#> GSM876855     2   0.000      0.950 0.000 1.000
#> GSM876856     2   0.000      0.950 0.000 1.000
#> GSM876905     2   0.311      0.957 0.056 0.944
#> GSM876906     2   0.311      0.957 0.056 0.944
#> GSM876907     2   0.311      0.957 0.056 0.944
#> GSM876908     2   0.311      0.957 0.056 0.944
#> GSM876909     2   0.311      0.957 0.056 0.944
#> GSM876881     2   0.000      0.950 0.000 1.000
#> GSM876882     1   0.000      1.000 1.000 0.000
#> GSM876883     2   0.994      0.267 0.456 0.544
#> GSM876884     1   0.000      1.000 1.000 0.000
#> GSM876885     2   0.994      0.267 0.456 0.544
#> GSM876857     1   0.000      1.000 1.000 0.000
#> GSM876858     2   0.000      0.950 0.000 1.000
#> GSM876859     2   0.000      0.950 0.000 1.000
#> GSM876860     2   0.000      0.950 0.000 1.000
#> GSM876861     2   0.000      0.950 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
#> GSM876886     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876887     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876888     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876889     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876890     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876891     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876862     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876866     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876867     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876838     2  0.0237      0.996 0.000 0.996 0.004
#> GSM876839     2  0.0237      0.996 0.000 0.996 0.004
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876843     3  0.6244      0.319 0.000 0.440 0.560
#> GSM876892     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876893     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876894     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876895     3  0.6438      0.764 0.188 0.064 0.748
#> GSM876896     3  0.4178      0.811 0.172 0.000 0.828
#> GSM876897     3  0.4178      0.811 0.172 0.000 0.828
#> GSM876868     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876872     3  0.5178      0.729 0.256 0.000 0.744
#> GSM876873     3  0.5178      0.729 0.256 0.000 0.744
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876848     3  0.5178      0.694 0.000 0.256 0.744
#> GSM876849     3  0.5178      0.694 0.000 0.256 0.744
#> GSM876898     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876899     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876900     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876901     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876902     3  0.4178      0.811 0.172 0.000 0.828
#> GSM876903     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876904     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876874     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876875     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876876     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876879     1  0.0237      0.995 0.996 0.000 0.004
#> GSM876880     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876905     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876906     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876907     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876908     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876909     3  0.0000      0.908 0.000 0.000 1.000
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876882     1  0.0424      0.991 0.992 0.000 0.008
#> GSM876883     3  0.5216      0.724 0.260 0.000 0.740
#> GSM876884     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876885     3  0.5216      0.724 0.260 0.000 0.740
#> GSM876857     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876861     2  0.0000      1.000 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
#> GSM876886     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876887     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876888     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876889     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876890     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876891     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876862     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876863     1  0.0188      0.992 0.996 0.00 0.000 0.004
#> GSM876864     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876865     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876866     4  0.4222      0.685 0.272 0.00 0.000 0.728
#> GSM876867     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876843     4  0.3801      0.713 0.000 0.22 0.000 0.780
#> GSM876892     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876893     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876894     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876895     3  0.5884      0.335 0.044 0.00 0.592 0.364
#> GSM876896     4  0.0000      0.922 0.000 0.00 0.000 1.000
#> GSM876897     4  0.0000      0.922 0.000 0.00 0.000 1.000
#> GSM876868     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876869     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876870     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876871     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876872     4  0.0000      0.922 0.000 0.00 0.000 1.000
#> GSM876873     4  0.0000      0.922 0.000 0.00 0.000 1.000
#> GSM876844     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876848     4  0.0000      0.922 0.000 0.00 0.000 1.000
#> GSM876849     4  0.0000      0.922 0.000 0.00 0.000 1.000
#> GSM876898     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876899     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876900     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876901     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876902     4  0.0000      0.922 0.000 0.00 0.000 1.000
#> GSM876903     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876904     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876874     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876875     1  0.1474      0.940 0.948 0.00 0.000 0.052
#> GSM876876     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876877     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876878     1  0.0336      0.989 0.992 0.00 0.000 0.008
#> GSM876879     4  0.3024      0.850 0.148 0.00 0.000 0.852
#> GSM876880     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876905     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876906     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876907     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876908     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876909     3  0.0000      0.980 0.000 0.00 1.000 0.000
#> GSM876881     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876882     4  0.2216      0.895 0.092 0.00 0.000 0.908
#> GSM876883     4  0.2149      0.897 0.088 0.00 0.000 0.912
#> GSM876884     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876885     4  0.2149      0.897 0.088 0.00 0.000 0.912
#> GSM876857     1  0.0000      0.996 1.000 0.00 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.00 0.000 0.000
#> GSM876861     2  0.0000      1.000 0.000 1.00 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
#> GSM876886     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876887     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876888     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876889     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876890     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876891     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876862     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876863     1  0.3636      0.613 0.728 0.000 0.0 0.000 0.272
#> GSM876864     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876865     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876866     5  0.0000      0.927 0.000 0.000 0.0 0.000 1.000
#> GSM876867     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876843     4  0.0162      0.994 0.000 0.004 0.0 0.996 0.000
#> GSM876892     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876893     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876894     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876895     3  0.4949      0.353 0.000 0.028 0.6 0.368 0.004
#> GSM876896     4  0.0000      0.999 0.000 0.000 0.0 1.000 0.000
#> GSM876897     4  0.0000      0.999 0.000 0.000 0.0 1.000 0.000
#> GSM876868     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876869     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876870     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876871     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876872     4  0.0000      0.999 0.000 0.000 0.0 1.000 0.000
#> GSM876873     4  0.0000      0.999 0.000 0.000 0.0 1.000 0.000
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876848     4  0.0000      0.999 0.000 0.000 0.0 1.000 0.000
#> GSM876849     4  0.0000      0.999 0.000 0.000 0.0 1.000 0.000
#> GSM876898     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876899     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876900     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876901     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876902     4  0.0000      0.999 0.000 0.000 0.0 1.000 0.000
#> GSM876903     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876904     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876874     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876875     5  0.1732      0.862 0.080 0.000 0.0 0.000 0.920
#> GSM876876     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876877     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876878     1  0.2424      0.839 0.868 0.000 0.0 0.000 0.132
#> GSM876879     5  0.0000      0.927 0.000 0.000 0.0 0.000 1.000
#> GSM876880     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876905     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876906     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876907     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876908     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876909     3  0.0000      0.979 0.000 0.000 1.0 0.000 0.000
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876882     5  0.0000      0.927 0.000 0.000 0.0 0.000 1.000
#> GSM876883     5  0.0162      0.926 0.000 0.000 0.0 0.004 0.996
#> GSM876884     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876885     5  0.3424      0.668 0.000 0.000 0.0 0.240 0.760
#> GSM876857     1  0.0000      0.972 1.000 0.000 0.0 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.0 0.000 0.000
#> GSM876861     2  0.0000      1.000 0.000 1.000 0.0 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
#> GSM876886     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876887     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876888     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876889     3  0.0713      0.962 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876890     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876891     3  0.0713      0.962 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876862     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     6  0.0458      0.952 0.016 0.000 0.000 0.000 0.000 0.984
#> GSM876867     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0363      0.982 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM876839     2  0.0363      0.982 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM876840     5  0.1444      0.968 0.000 0.072 0.000 0.000 0.928 0.000
#> GSM876841     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876843     4  0.0363      0.983 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM876892     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876894     3  0.0713      0.962 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876895     3  0.5557      0.466 0.000 0.200 0.600 0.188 0.012 0.000
#> GSM876896     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876897     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876868     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876873     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876844     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     5  0.1444      0.968 0.000 0.072 0.000 0.000 0.928 0.000
#> GSM876847     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876849     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876898     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876899     3  0.1267      0.949 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM876900     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876901     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876902     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876903     3  0.1267      0.949 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM876904     3  0.0713      0.962 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876874     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     6  0.0146      0.961 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM876876     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.2003      0.871 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM876879     6  0.0000      0.961 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876880     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     5  0.2730      0.838 0.000 0.192 0.000 0.000 0.808 0.000
#> GSM876853     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     5  0.1444      0.968 0.000 0.072 0.000 0.000 0.928 0.000
#> GSM876855     5  0.1444      0.968 0.000 0.072 0.000 0.000 0.928 0.000
#> GSM876856     5  0.1444      0.968 0.000 0.072 0.000 0.000 0.928 0.000
#> GSM876905     3  0.0000      0.964 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876906     3  0.0713      0.962 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876907     3  0.1267      0.949 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM876908     3  0.0713      0.962 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876909     3  0.1267      0.949 0.000 0.000 0.940 0.000 0.060 0.000
#> GSM876881     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876882     6  0.0000      0.961 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876883     6  0.0458      0.956 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM876884     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.2135      0.849 0.000 0.000 0.000 0.128 0.000 0.872
#> GSM876857     1  0.0000      0.992 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      0.992 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876861     2  0.1444      0.915 0.000 0.928 0.000 0.000 0.072 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) tissue(p) k
#> SD:mclust 70           0.8058  3.77e-12 2
#> SD:mclust 71           0.8087  8.57e-21 3
#> SD:mclust 71           0.6906  7.53e-21 4
#> SD:mclust 71           0.1184  3.49e-21 5
#> SD:mclust 71           0.0739  4.84e-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.


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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.981       0.991         0.4839 0.512   0.512
#> 3 3 0.825           0.865       0.926         0.3785 0.750   0.539
#> 4 4 0.956           0.938       0.955         0.0834 0.937   0.808
#> 5 5 0.855           0.855       0.911         0.0755 0.914   0.699
#> 6 6 0.834           0.762       0.875         0.0191 0.963   0.845

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1   0.000      1.000 1.000 0.000
#> GSM876887     1   0.000      1.000 1.000 0.000
#> GSM876888     1   0.000      1.000 1.000 0.000
#> GSM876889     1   0.000      1.000 1.000 0.000
#> GSM876890     1   0.000      1.000 1.000 0.000
#> GSM876891     1   0.000      1.000 1.000 0.000
#> GSM876862     1   0.000      1.000 1.000 0.000
#> GSM876863     1   0.000      1.000 1.000 0.000
#> GSM876864     1   0.000      1.000 1.000 0.000
#> GSM876865     1   0.000      1.000 1.000 0.000
#> GSM876866     1   0.000      1.000 1.000 0.000
#> GSM876867     1   0.000      1.000 1.000 0.000
#> GSM876838     2   0.000      0.976 0.000 1.000
#> GSM876839     2   0.000      0.976 0.000 1.000
#> GSM876840     2   0.000      0.976 0.000 1.000
#> GSM876841     2   0.000      0.976 0.000 1.000
#> GSM876842     2   0.000      0.976 0.000 1.000
#> GSM876843     2   0.000      0.976 0.000 1.000
#> GSM876892     1   0.000      1.000 1.000 0.000
#> GSM876893     1   0.000      1.000 1.000 0.000
#> GSM876894     1   0.000      1.000 1.000 0.000
#> GSM876895     2   0.802      0.702 0.244 0.756
#> GSM876896     1   0.000      1.000 1.000 0.000
#> GSM876897     2   0.000      0.976 0.000 1.000
#> GSM876868     1   0.000      1.000 1.000 0.000
#> GSM876869     1   0.000      1.000 1.000 0.000
#> GSM876870     1   0.000      1.000 1.000 0.000
#> GSM876871     1   0.000      1.000 1.000 0.000
#> GSM876872     1   0.000      1.000 1.000 0.000
#> GSM876873     1   0.000      1.000 1.000 0.000
#> GSM876844     2   0.000      0.976 0.000 1.000
#> GSM876845     2   0.000      0.976 0.000 1.000
#> GSM876846     2   0.000      0.976 0.000 1.000
#> GSM876847     2   0.000      0.976 0.000 1.000
#> GSM876848     2   0.000      0.976 0.000 1.000
#> GSM876849     2   0.000      0.976 0.000 1.000
#> GSM876898     1   0.000      1.000 1.000 0.000
#> GSM876899     1   0.000      1.000 1.000 0.000
#> GSM876900     1   0.000      1.000 1.000 0.000
#> GSM876901     1   0.000      1.000 1.000 0.000
#> GSM876902     1   0.000      1.000 1.000 0.000
#> GSM876903     2   0.584      0.845 0.140 0.860
#> GSM876904     1   0.000      1.000 1.000 0.000
#> GSM876874     1   0.000      1.000 1.000 0.000
#> GSM876875     1   0.000      1.000 1.000 0.000
#> GSM876876     1   0.000      1.000 1.000 0.000
#> GSM876877     1   0.000      1.000 1.000 0.000
#> GSM876878     1   0.000      1.000 1.000 0.000
#> GSM876879     1   0.000      1.000 1.000 0.000
#> GSM876880     1   0.000      1.000 1.000 0.000
#> GSM876850     2   0.000      0.976 0.000 1.000
#> GSM876851     2   0.000      0.976 0.000 1.000
#> GSM876852     2   0.000      0.976 0.000 1.000
#> GSM876853     2   0.000      0.976 0.000 1.000
#> GSM876854     2   0.000      0.976 0.000 1.000
#> GSM876855     2   0.000      0.976 0.000 1.000
#> GSM876856     2   0.000      0.976 0.000 1.000
#> GSM876905     1   0.000      1.000 1.000 0.000
#> GSM876906     1   0.000      1.000 1.000 0.000
#> GSM876907     2   0.753      0.746 0.216 0.784
#> GSM876908     1   0.000      1.000 1.000 0.000
#> GSM876909     2   0.388      0.911 0.076 0.924
#> GSM876881     2   0.000      0.976 0.000 1.000
#> GSM876882     1   0.000      1.000 1.000 0.000
#> GSM876883     1   0.000      1.000 1.000 0.000
#> GSM876884     1   0.000      1.000 1.000 0.000
#> GSM876885     1   0.000      1.000 1.000 0.000
#> GSM876857     1   0.000      1.000 1.000 0.000
#> GSM876858     2   0.000      0.976 0.000 1.000
#> GSM876859     2   0.000      0.976 0.000 1.000
#> GSM876860     2   0.000      0.976 0.000 1.000
#> GSM876861     2   0.000      0.976 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
#> GSM876886     3  0.5882      0.654 0.348 0.000 0.652
#> GSM876887     3  0.4555      0.756 0.200 0.000 0.800
#> GSM876888     3  0.5968      0.639 0.364 0.000 0.636
#> GSM876889     3  0.0237      0.797 0.004 0.000 0.996
#> GSM876890     3  0.2537      0.791 0.080 0.000 0.920
#> GSM876891     3  0.0424      0.797 0.008 0.000 0.992
#> GSM876862     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876863     1  0.0237      0.962 0.996 0.000 0.004
#> GSM876864     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876866     1  0.0747      0.955 0.984 0.000 0.016
#> GSM876867     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876838     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876839     2  0.0237      0.981 0.000 0.996 0.004
#> GSM876840     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876841     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876842     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876843     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876892     3  0.5465      0.711 0.288 0.000 0.712
#> GSM876893     3  0.5835      0.669 0.340 0.000 0.660
#> GSM876894     3  0.0892      0.798 0.020 0.000 0.980
#> GSM876895     2  0.2496      0.910 0.068 0.928 0.004
#> GSM876896     3  0.0237      0.795 0.000 0.004 0.996
#> GSM876897     3  0.0747      0.791 0.000 0.016 0.984
#> GSM876868     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876872     1  0.6252      0.231 0.556 0.000 0.444
#> GSM876873     3  0.6235      0.101 0.436 0.000 0.564
#> GSM876844     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876845     2  0.0237      0.981 0.000 0.996 0.004
#> GSM876846     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876847     2  0.0237      0.981 0.000 0.996 0.004
#> GSM876848     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876849     2  0.5810      0.552 0.000 0.664 0.336
#> GSM876898     3  0.6008      0.631 0.372 0.000 0.628
#> GSM876899     3  0.0237      0.797 0.004 0.000 0.996
#> GSM876900     3  0.5497      0.708 0.292 0.000 0.708
#> GSM876901     3  0.5621      0.697 0.308 0.000 0.692
#> GSM876902     3  0.0237      0.797 0.004 0.000 0.996
#> GSM876903     3  0.1411      0.785 0.000 0.036 0.964
#> GSM876904     3  0.5988      0.635 0.368 0.000 0.632
#> GSM876874     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876875     1  0.0892      0.953 0.980 0.000 0.020
#> GSM876876     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876878     1  0.0237      0.962 0.996 0.000 0.004
#> GSM876879     1  0.0892      0.953 0.980 0.000 0.020
#> GSM876880     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876850     2  0.0237      0.981 0.000 0.996 0.004
#> GSM876851     2  0.0237      0.981 0.000 0.996 0.004
#> GSM876852     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876853     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876854     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876855     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876856     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876905     3  0.5905      0.653 0.352 0.000 0.648
#> GSM876906     3  0.0237      0.797 0.004 0.000 0.996
#> GSM876907     3  0.3192      0.755 0.000 0.112 0.888
#> GSM876908     3  0.0237      0.797 0.004 0.000 0.996
#> GSM876909     3  0.4931      0.645 0.000 0.232 0.768
#> GSM876881     2  0.0237      0.981 0.000 0.996 0.004
#> GSM876882     1  0.1163      0.947 0.972 0.000 0.028
#> GSM876883     1  0.2165      0.912 0.936 0.000 0.064
#> GSM876884     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876885     1  0.2537      0.895 0.920 0.000 0.080
#> GSM876857     1  0.0000      0.964 1.000 0.000 0.000
#> GSM876858     2  0.0237      0.981 0.000 0.996 0.004
#> GSM876859     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876860     2  0.0000      0.982 0.000 1.000 0.000
#> GSM876861     2  0.0000      0.982 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
#> GSM876886     3  0.0921     0.9495 0.000 0.000 0.972 0.028
#> GSM876887     3  0.1474     0.9478 0.000 0.000 0.948 0.052
#> GSM876888     3  0.1302     0.9299 0.000 0.000 0.956 0.044
#> GSM876889     3  0.2149     0.9279 0.000 0.000 0.912 0.088
#> GSM876890     3  0.1389     0.9488 0.000 0.000 0.952 0.048
#> GSM876891     3  0.1389     0.9486 0.000 0.000 0.952 0.048
#> GSM876862     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0469     0.9776 0.000 0.988 0.000 0.012
#> GSM876839     2  0.0000     0.9781 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0592     0.9764 0.000 0.984 0.000 0.016
#> GSM876841     2  0.0336     0.9774 0.000 0.992 0.000 0.008
#> GSM876842     2  0.0469     0.9776 0.000 0.988 0.000 0.012
#> GSM876843     2  0.1302     0.9549 0.000 0.956 0.000 0.044
#> GSM876892     3  0.0469     0.9487 0.000 0.000 0.988 0.012
#> GSM876893     3  0.1118     0.9344 0.000 0.000 0.964 0.036
#> GSM876894     3  0.1302     0.9494 0.000 0.000 0.956 0.044
#> GSM876895     2  0.2466     0.9043 0.056 0.916 0.000 0.028
#> GSM876896     4  0.3528     0.7507 0.000 0.000 0.192 0.808
#> GSM876897     4  0.3591     0.7640 0.000 0.008 0.168 0.824
#> GSM876868     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876872     4  0.4894     0.7467 0.120 0.000 0.100 0.780
#> GSM876873     4  0.4827     0.7615 0.092 0.000 0.124 0.784
#> GSM876844     2  0.0469     0.9776 0.000 0.988 0.000 0.012
#> GSM876845     2  0.0592     0.9758 0.000 0.984 0.000 0.016
#> GSM876846     2  0.0469     0.9776 0.000 0.988 0.000 0.012
#> GSM876847     2  0.0817     0.9727 0.000 0.976 0.000 0.024
#> GSM876848     4  0.4998     0.0648 0.000 0.488 0.000 0.512
#> GSM876849     4  0.4294     0.6731 0.008 0.204 0.008 0.780
#> GSM876898     3  0.1940     0.9065 0.000 0.000 0.924 0.076
#> GSM876899     3  0.1557     0.9466 0.000 0.000 0.944 0.056
#> GSM876900     3  0.0188     0.9469 0.000 0.000 0.996 0.004
#> GSM876901     3  0.0000     0.9479 0.000 0.000 1.000 0.000
#> GSM876902     4  0.3569     0.7470 0.000 0.000 0.196 0.804
#> GSM876903     3  0.2973     0.8701 0.000 0.000 0.856 0.144
#> GSM876904     3  0.1716     0.9160 0.000 0.000 0.936 0.064
#> GSM876874     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876876     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876880     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876850     2  0.1211     0.9629 0.000 0.960 0.000 0.040
#> GSM876851     2  0.0336     0.9774 0.000 0.992 0.000 0.008
#> GSM876852     2  0.0592     0.9764 0.000 0.984 0.000 0.016
#> GSM876853     2  0.0188     0.9782 0.000 0.996 0.000 0.004
#> GSM876854     2  0.0469     0.9776 0.000 0.988 0.000 0.012
#> GSM876855     2  0.0592     0.9764 0.000 0.984 0.000 0.016
#> GSM876856     2  0.0592     0.9764 0.000 0.984 0.000 0.016
#> GSM876905     3  0.1118     0.9344 0.000 0.000 0.964 0.036
#> GSM876906     3  0.1867     0.9388 0.000 0.000 0.928 0.072
#> GSM876907     3  0.1557     0.9456 0.000 0.000 0.944 0.056
#> GSM876908     3  0.1716     0.9431 0.000 0.000 0.936 0.064
#> GSM876909     3  0.2053     0.9380 0.000 0.004 0.924 0.072
#> GSM876881     2  0.1637     0.9473 0.000 0.940 0.000 0.060
#> GSM876882     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876883     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876884     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876885     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876857     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0707     0.9745 0.000 0.980 0.000 0.020
#> GSM876859     2  0.0592     0.9758 0.000 0.984 0.000 0.016
#> GSM876860     2  0.0707     0.9745 0.000 0.980 0.000 0.020
#> GSM876861     2  0.0707     0.9745 0.000 0.980 0.000 0.020

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM876886     3  0.0955      0.931 0.000 0.000 0.968 0.004 0.028
#> GSM876887     3  0.0703      0.934 0.000 0.000 0.976 0.024 0.000
#> GSM876888     3  0.2450      0.884 0.000 0.000 0.896 0.028 0.076
#> GSM876889     3  0.1341      0.924 0.000 0.000 0.944 0.056 0.000
#> GSM876890     3  0.0290      0.936 0.000 0.000 0.992 0.008 0.000
#> GSM876891     3  0.0880      0.933 0.000 0.000 0.968 0.032 0.000
#> GSM876862     1  0.0579      0.966 0.984 0.000 0.000 0.008 0.008
#> GSM876863     1  0.0000      0.970 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0898      0.959 0.972 0.000 0.000 0.008 0.020
#> GSM876865     1  0.0000      0.970 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0324      0.967 0.992 0.000 0.000 0.004 0.004
#> GSM876867     1  0.0162      0.970 0.996 0.000 0.000 0.000 0.004
#> GSM876838     2  0.1197      0.897 0.000 0.952 0.000 0.000 0.048
#> GSM876839     2  0.1671      0.882 0.000 0.924 0.000 0.000 0.076
#> GSM876840     2  0.0451      0.888 0.000 0.988 0.000 0.004 0.008
#> GSM876841     2  0.3395      0.684 0.000 0.764 0.000 0.000 0.236
#> GSM876842     2  0.1043      0.899 0.000 0.960 0.000 0.000 0.040
#> GSM876843     2  0.2249      0.809 0.000 0.896 0.000 0.096 0.008
#> GSM876892     3  0.0865      0.932 0.000 0.000 0.972 0.004 0.024
#> GSM876893     3  0.1251      0.926 0.000 0.000 0.956 0.008 0.036
#> GSM876894     3  0.1043      0.930 0.000 0.000 0.960 0.040 0.000
#> GSM876895     5  0.4139      0.786 0.084 0.132 0.000 0.000 0.784
#> GSM876896     4  0.1638      0.745 0.000 0.000 0.064 0.932 0.004
#> GSM876897     4  0.1772      0.746 0.000 0.020 0.032 0.940 0.008
#> GSM876868     1  0.1267      0.949 0.960 0.000 0.004 0.012 0.024
#> GSM876869     1  0.0771      0.961 0.976 0.000 0.000 0.004 0.020
#> GSM876870     1  0.0000      0.970 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.970 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.3010      0.750 0.172 0.000 0.000 0.824 0.004
#> GSM876873     4  0.2930      0.755 0.164 0.000 0.000 0.832 0.004
#> GSM876844     2  0.1043      0.899 0.000 0.960 0.000 0.000 0.040
#> GSM876845     2  0.3684      0.596 0.000 0.720 0.000 0.000 0.280
#> GSM876846     2  0.1043      0.899 0.000 0.960 0.000 0.000 0.040
#> GSM876847     5  0.3932      0.652 0.000 0.328 0.000 0.000 0.672
#> GSM876848     2  0.2462      0.792 0.000 0.880 0.000 0.112 0.008
#> GSM876849     4  0.3768      0.613 0.004 0.228 0.000 0.760 0.008
#> GSM876898     3  0.1082      0.930 0.000 0.000 0.964 0.008 0.028
#> GSM876899     3  0.1410      0.922 0.000 0.000 0.940 0.060 0.000
#> GSM876900     3  0.0000      0.936 0.000 0.000 1.000 0.000 0.000
#> GSM876901     3  0.0162      0.936 0.000 0.000 0.996 0.000 0.004
#> GSM876902     4  0.2674      0.703 0.000 0.000 0.140 0.856 0.004
#> GSM876903     3  0.6006      0.442 0.000 0.000 0.584 0.220 0.196
#> GSM876904     3  0.1740      0.912 0.000 0.000 0.932 0.012 0.056
#> GSM876874     1  0.0451      0.968 0.988 0.000 0.000 0.004 0.008
#> GSM876875     1  0.0324      0.967 0.992 0.000 0.000 0.004 0.004
#> GSM876876     1  0.0324      0.969 0.992 0.000 0.000 0.004 0.004
#> GSM876877     1  0.0324      0.969 0.992 0.000 0.000 0.004 0.004
#> GSM876878     1  0.0324      0.967 0.992 0.000 0.000 0.004 0.004
#> GSM876879     1  0.0693      0.960 0.980 0.000 0.000 0.008 0.012
#> GSM876880     1  0.0162      0.970 0.996 0.000 0.000 0.000 0.004
#> GSM876850     5  0.3913      0.659 0.000 0.324 0.000 0.000 0.676
#> GSM876851     2  0.2773      0.794 0.000 0.836 0.000 0.000 0.164
#> GSM876852     2  0.0290      0.897 0.000 0.992 0.000 0.000 0.008
#> GSM876853     2  0.1851      0.874 0.000 0.912 0.000 0.000 0.088
#> GSM876854     2  0.0404      0.898 0.000 0.988 0.000 0.000 0.012
#> GSM876855     2  0.0510      0.886 0.000 0.984 0.000 0.016 0.000
#> GSM876856     2  0.0324      0.894 0.000 0.992 0.000 0.004 0.004
#> GSM876905     3  0.0566      0.935 0.000 0.000 0.984 0.004 0.012
#> GSM876906     3  0.1831      0.910 0.000 0.000 0.920 0.076 0.004
#> GSM876907     5  0.4726      0.543 0.000 0.004 0.256 0.044 0.696
#> GSM876908     3  0.1831      0.910 0.000 0.000 0.920 0.076 0.004
#> GSM876909     5  0.3795      0.641 0.000 0.004 0.184 0.024 0.788
#> GSM876881     5  0.2732      0.842 0.000 0.160 0.000 0.000 0.840
#> GSM876882     1  0.0693      0.960 0.980 0.000 0.000 0.008 0.012
#> GSM876883     1  0.4193      0.452 0.684 0.000 0.000 0.304 0.012
#> GSM876884     1  0.0000      0.970 1.000 0.000 0.000 0.000 0.000
#> GSM876885     4  0.4489      0.343 0.420 0.000 0.000 0.572 0.008
#> GSM876857     1  0.0898      0.959 0.972 0.000 0.000 0.008 0.020
#> GSM876858     5  0.2605      0.846 0.000 0.148 0.000 0.000 0.852
#> GSM876859     5  0.2648      0.846 0.000 0.152 0.000 0.000 0.848
#> GSM876860     5  0.2605      0.846 0.000 0.148 0.000 0.000 0.852
#> GSM876861     5  0.2605      0.846 0.000 0.148 0.000 0.000 0.852

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM876886     3  0.0146     0.9584 0.000 0.000 0.996 0.000 0.000 NA
#> GSM876887     3  0.0436     0.9571 0.000 0.000 0.988 0.004 0.004 NA
#> GSM876888     3  0.0458     0.9548 0.000 0.000 0.984 0.000 0.000 NA
#> GSM876889     3  0.0922     0.9499 0.000 0.000 0.968 0.024 0.004 NA
#> GSM876890     3  0.0000     0.9588 0.000 0.000 1.000 0.000 0.000 NA
#> GSM876891     3  0.0551     0.9560 0.000 0.000 0.984 0.008 0.004 NA
#> GSM876862     1  0.1267     0.8742 0.940 0.000 0.000 0.000 0.000 NA
#> GSM876863     1  0.0363     0.8889 0.988 0.000 0.000 0.000 0.000 NA
#> GSM876864     1  0.1700     0.8636 0.916 0.000 0.004 0.000 0.000 NA
#> GSM876865     1  0.0146     0.8899 0.996 0.000 0.000 0.000 0.000 NA
#> GSM876866     1  0.0508     0.8888 0.984 0.000 0.000 0.000 0.004 NA
#> GSM876867     1  0.0547     0.8869 0.980 0.000 0.000 0.000 0.000 NA
#> GSM876838     2  0.0508     0.8256 0.000 0.984 0.000 0.000 0.012 NA
#> GSM876839     2  0.1594     0.8113 0.000 0.932 0.000 0.000 0.016 NA
#> GSM876840     2  0.2263     0.7887 0.000 0.884 0.000 0.016 0.000 NA
#> GSM876841     2  0.3078     0.7464 0.000 0.836 0.000 0.000 0.108 NA
#> GSM876842     2  0.0520     0.8255 0.000 0.984 0.000 0.000 0.008 NA
#> GSM876843     2  0.3921     0.6699 0.000 0.768 0.000 0.116 0.000 NA
#> GSM876892     3  0.0000     0.9588 0.000 0.000 1.000 0.000 0.000 NA
#> GSM876893     3  0.0363     0.9568 0.000 0.000 0.988 0.000 0.000 NA
#> GSM876894     3  0.0748     0.9531 0.000 0.000 0.976 0.016 0.004 NA
#> GSM876895     5  0.6027     0.6414 0.064 0.168 0.000 0.020 0.640 NA
#> GSM876896     4  0.1262     0.6198 0.000 0.000 0.016 0.956 0.020 NA
#> GSM876897     4  0.0717     0.6225 0.000 0.000 0.016 0.976 0.000 NA
#> GSM876868     1  0.2948     0.7769 0.804 0.000 0.008 0.000 0.000 NA
#> GSM876869     1  0.2260     0.8251 0.860 0.000 0.000 0.000 0.000 NA
#> GSM876870     1  0.0146     0.8899 0.996 0.000 0.000 0.000 0.000 NA
#> GSM876871     1  0.0000     0.8898 1.000 0.000 0.000 0.000 0.000 NA
#> GSM876872     4  0.5093     0.5119 0.176 0.000 0.000 0.632 0.000 NA
#> GSM876873     4  0.6054     0.1646 0.348 0.000 0.000 0.392 0.000 NA
#> GSM876844     2  0.0291     0.8252 0.000 0.992 0.000 0.004 0.004 NA
#> GSM876845     2  0.3416     0.7115 0.000 0.804 0.000 0.000 0.140 NA
#> GSM876846     2  0.3095     0.7631 0.000 0.840 0.000 0.036 0.008 NA
#> GSM876847     2  0.5211     0.1053 0.000 0.516 0.000 0.000 0.388 NA
#> GSM876848     4  0.5396     0.0801 0.000 0.396 0.000 0.488 0.000 NA
#> GSM876849     4  0.4323     0.5381 0.004 0.120 0.000 0.748 0.004 NA
#> GSM876898     3  0.0363     0.9564 0.000 0.000 0.988 0.000 0.000 NA
#> GSM876899     3  0.1116     0.9457 0.000 0.000 0.960 0.028 0.008 NA
#> GSM876900     3  0.0146     0.9585 0.000 0.000 0.996 0.000 0.000 NA
#> GSM876901     3  0.0000     0.9588 0.000 0.000 1.000 0.000 0.000 NA
#> GSM876902     4  0.3047     0.5792 0.000 0.000 0.084 0.848 0.004 NA
#> GSM876903     3  0.6396     0.4490 0.000 0.012 0.596 0.180 0.108 NA
#> GSM876904     3  0.0363     0.9564 0.000 0.000 0.988 0.000 0.000 NA
#> GSM876874     1  0.1501     0.8675 0.924 0.000 0.000 0.000 0.000 NA
#> GSM876875     1  0.0935     0.8818 0.964 0.000 0.000 0.000 0.004 NA
#> GSM876876     1  0.0146     0.8901 0.996 0.000 0.004 0.000 0.000 NA
#> GSM876877     1  0.0458     0.8877 0.984 0.000 0.000 0.000 0.000 NA
#> GSM876878     1  0.0777     0.8850 0.972 0.000 0.000 0.000 0.004 NA
#> GSM876879     1  0.2664     0.7655 0.816 0.000 0.000 0.000 0.000 NA
#> GSM876880     1  0.0000     0.8898 1.000 0.000 0.000 0.000 0.000 NA
#> GSM876850     2  0.5414    -0.0573 0.000 0.468 0.000 0.000 0.416 NA
#> GSM876851     2  0.2685     0.7748 0.000 0.868 0.000 0.000 0.072 NA
#> GSM876852     2  0.1606     0.8178 0.000 0.932 0.000 0.004 0.008 NA
#> GSM876853     2  0.1633     0.8114 0.000 0.932 0.000 0.000 0.024 NA
#> GSM876854     2  0.1285     0.8167 0.000 0.944 0.000 0.004 0.000 NA
#> GSM876855     2  0.2019     0.7989 0.000 0.900 0.000 0.012 0.000 NA
#> GSM876856     2  0.2070     0.7942 0.000 0.892 0.000 0.008 0.000 NA
#> GSM876905     3  0.0260     0.9576 0.000 0.000 0.992 0.000 0.000 NA
#> GSM876906     3  0.1642     0.9300 0.000 0.000 0.936 0.032 0.004 NA
#> GSM876907     5  0.4672     0.4214 0.000 0.000 0.340 0.048 0.608 NA
#> GSM876908     3  0.1755     0.9286 0.000 0.000 0.932 0.028 0.008 NA
#> GSM876909     5  0.3542     0.6394 0.000 0.004 0.168 0.020 0.796 NA
#> GSM876881     5  0.4503     0.6594 0.000 0.204 0.000 0.000 0.696 NA
#> GSM876882     1  0.3373     0.6838 0.744 0.000 0.000 0.008 0.000 NA
#> GSM876883     1  0.5471     0.3499 0.560 0.000 0.000 0.172 0.000 NA
#> GSM876884     1  0.0632     0.8859 0.976 0.000 0.000 0.000 0.000 NA
#> GSM876885     1  0.5610     0.2894 0.536 0.000 0.000 0.192 0.000 NA
#> GSM876857     1  0.2260     0.8251 0.860 0.000 0.000 0.000 0.000 NA
#> GSM876858     5  0.1327     0.7843 0.000 0.064 0.000 0.000 0.936 NA
#> GSM876859     5  0.1910     0.7763 0.000 0.108 0.000 0.000 0.892 NA
#> GSM876860     5  0.1327     0.7848 0.000 0.064 0.000 0.000 0.936 NA
#> GSM876861     5  0.1141     0.7776 0.000 0.052 0.000 0.000 0.948 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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) tissue(p) k
#> SD:NMF 72         0.852599  4.67e-11 2
#> SD:NMF 70         0.995235  1.25e-25 3
#> SD:NMF 71         0.144927  2.99e-22 4
#> SD:NMF 69         0.000564  3.70e-19 5
#> SD:NMF 64         0.000379  1.79e-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: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 72 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-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.862           0.925       0.966         0.4885 0.512   0.512
#> 3 3 0.883           0.906       0.955         0.1561 0.934   0.872
#> 4 4 0.823           0.895       0.924         0.2794 0.819   0.595
#> 5 5 0.911           0.901       0.940         0.0409 0.978   0.918
#> 6 6 0.956           0.902       0.943         0.0505 0.958   0.829

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1  0.0000      0.960 1.000 0.000
#> GSM876887     1  0.0000      0.960 1.000 0.000
#> GSM876888     1  0.0000      0.960 1.000 0.000
#> GSM876889     1  0.0376      0.958 0.996 0.004
#> GSM876890     1  0.0000      0.960 1.000 0.000
#> GSM876891     1  0.0672      0.956 0.992 0.008
#> GSM876862     1  0.0000      0.960 1.000 0.000
#> GSM876863     1  0.0000      0.960 1.000 0.000
#> GSM876864     1  0.0000      0.960 1.000 0.000
#> GSM876865     1  0.0000      0.960 1.000 0.000
#> GSM876866     1  0.0000      0.960 1.000 0.000
#> GSM876867     1  0.0000      0.960 1.000 0.000
#> GSM876838     2  0.0376      0.968 0.004 0.996
#> GSM876839     2  0.0376      0.968 0.004 0.996
#> GSM876840     2  0.0000      0.966 0.000 1.000
#> GSM876841     2  0.0376      0.968 0.004 0.996
#> GSM876842     2  0.0376      0.968 0.004 0.996
#> GSM876843     2  0.0000      0.966 0.000 1.000
#> GSM876892     1  0.0000      0.960 1.000 0.000
#> GSM876893     1  0.0000      0.960 1.000 0.000
#> GSM876894     1  0.0672      0.956 0.992 0.008
#> GSM876895     1  0.6887      0.781 0.816 0.184
#> GSM876896     2  0.3431      0.917 0.064 0.936
#> GSM876897     2  0.3431      0.917 0.064 0.936
#> GSM876868     1  0.0000      0.960 1.000 0.000
#> GSM876869     1  0.0000      0.960 1.000 0.000
#> GSM876870     1  0.0000      0.960 1.000 0.000
#> GSM876871     1  0.0000      0.960 1.000 0.000
#> GSM876872     2  0.8909      0.546 0.308 0.692
#> GSM876873     2  0.8909      0.546 0.308 0.692
#> GSM876844     2  0.0376      0.968 0.004 0.996
#> GSM876845     2  0.0376      0.968 0.004 0.996
#> GSM876846     2  0.0000      0.966 0.000 1.000
#> GSM876847     2  0.0376      0.968 0.004 0.996
#> GSM876848     2  0.0000      0.966 0.000 1.000
#> GSM876849     2  0.0000      0.966 0.000 1.000
#> GSM876898     1  0.0000      0.960 1.000 0.000
#> GSM876899     1  0.5408      0.850 0.876 0.124
#> GSM876900     1  0.0000      0.960 1.000 0.000
#> GSM876901     1  0.0000      0.960 1.000 0.000
#> GSM876902     2  0.3431      0.917 0.064 0.936
#> GSM876903     1  0.6887      0.781 0.816 0.184
#> GSM876904     1  0.0000      0.960 1.000 0.000
#> GSM876874     1  0.0000      0.960 1.000 0.000
#> GSM876875     1  0.0000      0.960 1.000 0.000
#> GSM876876     1  0.0000      0.960 1.000 0.000
#> GSM876877     1  0.0000      0.960 1.000 0.000
#> GSM876878     1  0.0000      0.960 1.000 0.000
#> GSM876879     1  0.0000      0.960 1.000 0.000
#> GSM876880     1  0.0000      0.960 1.000 0.000
#> GSM876850     2  0.0376      0.968 0.004 0.996
#> GSM876851     2  0.0376      0.968 0.004 0.996
#> GSM876852     2  0.0376      0.968 0.004 0.996
#> GSM876853     2  0.0376      0.968 0.004 0.996
#> GSM876854     2  0.0000      0.966 0.000 1.000
#> GSM876855     2  0.0000      0.966 0.000 1.000
#> GSM876856     2  0.0000      0.966 0.000 1.000
#> GSM876905     1  0.0000      0.960 1.000 0.000
#> GSM876906     1  0.0672      0.956 0.992 0.008
#> GSM876907     1  0.6887      0.781 0.816 0.184
#> GSM876908     1  0.0672      0.956 0.992 0.008
#> GSM876909     1  0.6887      0.781 0.816 0.184
#> GSM876881     2  0.0376      0.968 0.004 0.996
#> GSM876882     1  0.0000      0.960 1.000 0.000
#> GSM876883     1  0.9087      0.507 0.676 0.324
#> GSM876884     1  0.0000      0.960 1.000 0.000
#> GSM876885     1  0.9087      0.507 0.676 0.324
#> GSM876857     1  0.0000      0.960 1.000 0.000
#> GSM876858     2  0.0376      0.968 0.004 0.996
#> GSM876859     2  0.0376      0.968 0.004 0.996
#> GSM876860     2  0.0376      0.968 0.004 0.996
#> GSM876861     2  0.0376      0.968 0.004 0.996

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM876886     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876887     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876888     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876889     1  0.0424      0.951 0.992 0.000 0.008
#> GSM876890     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876891     1  0.0661      0.949 0.988 0.004 0.008
#> GSM876862     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876863     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876864     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876865     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876866     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876867     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876838     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876839     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876840     2  0.0747      0.981 0.000 0.984 0.016
#> GSM876841     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876842     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876843     3  0.5254      0.656 0.000 0.264 0.736
#> GSM876892     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876893     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876894     1  0.0661      0.949 0.988 0.004 0.008
#> GSM876895     1  0.4575      0.777 0.812 0.004 0.184
#> GSM876896     3  0.0237      0.777 0.000 0.004 0.996
#> GSM876897     3  0.0237      0.777 0.000 0.004 0.996
#> GSM876868     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876869     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876870     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876871     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876872     3  0.5058      0.623 0.244 0.000 0.756
#> GSM876873     3  0.5058      0.623 0.244 0.000 0.756
#> GSM876844     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876845     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876846     2  0.2448      0.911 0.000 0.924 0.076
#> GSM876847     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876848     3  0.5254      0.656 0.000 0.264 0.736
#> GSM876849     3  0.5254      0.656 0.000 0.264 0.736
#> GSM876898     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876899     1  0.3644      0.845 0.872 0.004 0.124
#> GSM876900     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876901     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876902     3  0.0237      0.777 0.000 0.004 0.996
#> GSM876903     1  0.4575      0.777 0.812 0.004 0.184
#> GSM876904     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876874     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876875     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876876     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876877     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876878     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876879     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876880     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876850     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876851     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876852     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876853     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876854     2  0.0747      0.981 0.000 0.984 0.016
#> GSM876855     2  0.0747      0.981 0.000 0.984 0.016
#> GSM876856     2  0.0747      0.981 0.000 0.984 0.016
#> GSM876905     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876906     1  0.0661      0.949 0.988 0.004 0.008
#> GSM876907     1  0.4575      0.777 0.812 0.004 0.184
#> GSM876908     1  0.0661      0.949 0.988 0.004 0.008
#> GSM876909     1  0.4575      0.777 0.812 0.004 0.184
#> GSM876881     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876882     1  0.0747      0.943 0.984 0.000 0.016
#> GSM876883     1  0.5988      0.358 0.632 0.000 0.368
#> GSM876884     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876885     1  0.5988      0.358 0.632 0.000 0.368
#> GSM876857     1  0.0237      0.953 0.996 0.000 0.004
#> GSM876858     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876859     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876860     2  0.0000      0.992 0.000 1.000 0.000
#> GSM876861     2  0.0000      0.992 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
#> GSM876886     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876887     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876888     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876889     3   0.228     0.9484 0.096 0.000 0.904 0.000
#> GSM876890     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876891     3   0.208     0.9434 0.084 0.000 0.916 0.000
#> GSM876862     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876863     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876864     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876865     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876866     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876867     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876838     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876839     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876840     2   0.172     0.9404 0.000 0.936 0.064 0.000
#> GSM876841     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876842     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876843     4   0.539     0.7209 0.000 0.204 0.072 0.724
#> GSM876892     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876893     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876894     3   0.208     0.9434 0.084 0.000 0.916 0.000
#> GSM876895     3   0.531     0.8213 0.084 0.000 0.740 0.176
#> GSM876896     4   0.000     0.8120 0.000 0.000 0.000 1.000
#> GSM876897     4   0.000     0.8120 0.000 0.000 0.000 1.000
#> GSM876868     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876869     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876870     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876871     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876872     4   0.512     0.6768 0.080 0.000 0.164 0.756
#> GSM876873     4   0.512     0.6768 0.080 0.000 0.164 0.756
#> GSM876844     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876845     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876846     2   0.347     0.8657 0.000 0.868 0.072 0.060
#> GSM876847     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876848     4   0.539     0.7209 0.000 0.204 0.072 0.724
#> GSM876849     4   0.539     0.7209 0.000 0.204 0.072 0.724
#> GSM876898     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876899     3   0.459     0.8713 0.084 0.000 0.800 0.116
#> GSM876900     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876901     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876902     4   0.000     0.8120 0.000 0.000 0.000 1.000
#> GSM876903     3   0.531     0.8213 0.084 0.000 0.740 0.176
#> GSM876904     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876874     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876875     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876876     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876877     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876878     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876879     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876880     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876850     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876851     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876852     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876853     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876854     2   0.172     0.9404 0.000 0.936 0.064 0.000
#> GSM876855     2   0.172     0.9404 0.000 0.936 0.064 0.000
#> GSM876856     2   0.172     0.9404 0.000 0.936 0.064 0.000
#> GSM876905     3   0.234     0.9495 0.100 0.000 0.900 0.000
#> GSM876906     3   0.208     0.9434 0.084 0.000 0.916 0.000
#> GSM876907     3   0.531     0.8213 0.084 0.000 0.740 0.176
#> GSM876908     3   0.208     0.9434 0.084 0.000 0.916 0.000
#> GSM876909     3   0.531     0.8213 0.084 0.000 0.740 0.176
#> GSM876881     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876882     1   0.198     0.8892 0.936 0.000 0.048 0.016
#> GSM876883     1   0.736     0.0226 0.468 0.000 0.164 0.368
#> GSM876884     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876885     1   0.736     0.0226 0.468 0.000 0.164 0.368
#> GSM876857     1   0.000     0.9440 1.000 0.000 0.000 0.000
#> GSM876858     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876859     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876860     2   0.000     0.9801 0.000 1.000 0.000 0.000
#> GSM876861     2   0.000     0.9801 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
#> GSM876886     3  0.0451      0.949 0.004 0.000 0.988 0.000 0.008
#> GSM876887     3  0.0451      0.949 0.004 0.000 0.988 0.000 0.008
#> GSM876888     3  0.0404      0.950 0.012 0.000 0.988 0.000 0.000
#> GSM876889     3  0.0290      0.949 0.000 0.000 0.992 0.000 0.008
#> GSM876890     3  0.0451      0.949 0.004 0.000 0.988 0.000 0.008
#> GSM876891     3  0.0404      0.947 0.000 0.000 0.988 0.000 0.012
#> GSM876862     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0451      0.982 0.988 0.000 0.004 0.000 0.008
#> GSM876867     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2  0.1478      0.937 0.000 0.936 0.000 0.000 0.064
#> GSM876841     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876843     4  0.6298      0.651 0.000 0.188 0.000 0.520 0.292
#> GSM876892     3  0.0451      0.949 0.004 0.000 0.988 0.000 0.008
#> GSM876893     3  0.0404      0.950 0.012 0.000 0.988 0.000 0.000
#> GSM876894     3  0.0404      0.947 0.000 0.000 0.988 0.000 0.012
#> GSM876895     3  0.3196      0.839 0.000 0.000 0.804 0.004 0.192
#> GSM876896     4  0.0000      0.544 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000      0.544 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876872     5  0.4306      0.367 0.000 0.000 0.000 0.492 0.508
#> GSM876873     5  0.4306      0.367 0.000 0.000 0.000 0.492 0.508
#> GSM876844     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2  0.2516      0.854 0.000 0.860 0.000 0.000 0.140
#> GSM876847     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4  0.6298      0.651 0.000 0.188 0.000 0.520 0.292
#> GSM876849     4  0.6298      0.651 0.000 0.188 0.000 0.520 0.292
#> GSM876898     3  0.0404      0.950 0.012 0.000 0.988 0.000 0.000
#> GSM876899     3  0.2536      0.883 0.000 0.000 0.868 0.004 0.128
#> GSM876900     3  0.0404      0.950 0.012 0.000 0.988 0.000 0.000
#> GSM876901     3  0.0404      0.950 0.012 0.000 0.988 0.000 0.000
#> GSM876902     4  0.0000      0.544 0.000 0.000 0.000 1.000 0.000
#> GSM876903     3  0.3196      0.839 0.000 0.000 0.804 0.004 0.192
#> GSM876904     3  0.0404      0.950 0.012 0.000 0.988 0.000 0.000
#> GSM876874     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.0451      0.982 0.988 0.000 0.004 0.000 0.008
#> GSM876876     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.0451      0.982 0.988 0.000 0.004 0.000 0.008
#> GSM876880     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876853     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2  0.1478      0.937 0.000 0.936 0.000 0.000 0.064
#> GSM876855     2  0.1478      0.937 0.000 0.936 0.000 0.000 0.064
#> GSM876856     2  0.1478      0.937 0.000 0.936 0.000 0.000 0.064
#> GSM876905     3  0.0404      0.950 0.012 0.000 0.988 0.000 0.000
#> GSM876906     3  0.0404      0.947 0.000 0.000 0.988 0.000 0.012
#> GSM876907     3  0.3196      0.839 0.000 0.000 0.804 0.004 0.192
#> GSM876908     3  0.0404      0.947 0.000 0.000 0.988 0.000 0.012
#> GSM876909     3  0.3196      0.839 0.000 0.000 0.804 0.004 0.192
#> GSM876881     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876882     1  0.2005      0.902 0.924 0.000 0.004 0.016 0.056
#> GSM876883     5  0.6006      0.557 0.376 0.000 0.004 0.104 0.516
#> GSM876884     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5  0.6006      0.557 0.376 0.000 0.004 0.104 0.516
#> GSM876857     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876887     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876888     3  0.0260      0.994 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM876889     3  0.0146      0.989 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM876890     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876891     5  0.3151      0.819 0.000 0.000 0.252 0.000 0.748 0.000
#> GSM876862     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0363      0.982 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.1444      0.935 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM876841     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0260      0.972 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM876843     4  0.0000      0.691 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876892     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0260      0.994 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM876894     5  0.3151      0.819 0.000 0.000 0.252 0.000 0.748 0.000
#> GSM876895     5  0.0547      0.834 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM876896     4  0.4335      0.622 0.000 0.000 0.000 0.508 0.020 0.472
#> GSM876897     4  0.4335      0.622 0.000 0.000 0.000 0.508 0.020 0.472
#> GSM876868     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     6  0.0000      0.351 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876873     6  0.0000      0.351 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876844     2  0.0260      0.972 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM876845     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.2854      0.787 0.000 0.792 0.000 0.208 0.000 0.000
#> GSM876847     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     4  0.0000      0.691 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876849     4  0.0000      0.691 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876898     3  0.0260      0.994 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM876899     5  0.1610      0.843 0.000 0.000 0.084 0.000 0.916 0.000
#> GSM876900     3  0.0260      0.994 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM876901     3  0.0260      0.994 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM876902     4  0.4335      0.622 0.000 0.000 0.000 0.508 0.020 0.472
#> GSM876903     5  0.0547      0.834 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM876904     3  0.0260      0.994 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM876874     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.0363      0.982 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM876876     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.0363      0.982 0.988 0.000 0.012 0.000 0.000 0.000
#> GSM876880     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0260      0.972 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM876853     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.1444      0.935 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM876855     2  0.1444      0.935 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM876856     2  0.1444      0.935 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM876905     3  0.0260      0.994 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM876906     5  0.3151      0.819 0.000 0.000 0.252 0.000 0.748 0.000
#> GSM876907     5  0.0547      0.834 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM876908     5  0.3151      0.819 0.000 0.000 0.252 0.000 0.748 0.000
#> GSM876909     5  0.0547      0.834 0.000 0.000 0.020 0.000 0.980 0.000
#> GSM876881     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876882     1  0.1686      0.902 0.924 0.000 0.012 0.000 0.000 0.064
#> GSM876883     6  0.4026      0.550 0.376 0.000 0.012 0.000 0.000 0.612
#> GSM876884     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.4026      0.550 0.376 0.000 0.012 0.000 0.000 0.612
#> GSM876857     1  0.0000      0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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) tissue(p) k
#> CV:hclust 72           0.4844  9.33e-11 2
#> CV:hclust 70           0.0607  7.31e-11 3
#> CV:hclust 70           0.1797  5.57e-22 4
#> CV:hclust 70           0.2134  3.92e-22 5
#> CV:hclust 70           0.1429  5.96e-21 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 72 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.942           0.946       0.978         0.4830 0.518   0.518
#> 3 3 0.699           0.840       0.876         0.3434 0.737   0.527
#> 4 4 0.926           0.933       0.948         0.1292 0.924   0.775
#> 5 5 0.840           0.800       0.858         0.0597 1.000   1.000
#> 6 6 0.831           0.795       0.813         0.0392 0.917   0.694

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1  0.0000     0.9756 1.000 0.000
#> GSM876887     1  0.0000     0.9756 1.000 0.000
#> GSM876888     1  0.0376     0.9767 0.996 0.004
#> GSM876889     1  0.0000     0.9756 1.000 0.000
#> GSM876890     1  0.0000     0.9756 1.000 0.000
#> GSM876891     1  0.0000     0.9756 1.000 0.000
#> GSM876862     1  0.0376     0.9767 0.996 0.004
#> GSM876863     1  0.0000     0.9756 1.000 0.000
#> GSM876864     1  0.0376     0.9767 0.996 0.004
#> GSM876865     1  0.0376     0.9767 0.996 0.004
#> GSM876866     1  0.0000     0.9756 1.000 0.000
#> GSM876867     1  0.0376     0.9767 0.996 0.004
#> GSM876838     2  0.0000     0.9766 0.000 1.000
#> GSM876839     2  0.0000     0.9766 0.000 1.000
#> GSM876840     2  0.0000     0.9766 0.000 1.000
#> GSM876841     2  0.0000     0.9766 0.000 1.000
#> GSM876842     2  0.0000     0.9766 0.000 1.000
#> GSM876843     2  0.0376     0.9739 0.004 0.996
#> GSM876892     1  0.0000     0.9756 1.000 0.000
#> GSM876893     1  0.0376     0.9767 0.996 0.004
#> GSM876894     1  0.0376     0.9767 0.996 0.004
#> GSM876895     1  0.8207     0.6463 0.744 0.256
#> GSM876896     2  0.7745     0.7165 0.228 0.772
#> GSM876897     2  0.0376     0.9739 0.004 0.996
#> GSM876868     1  0.0376     0.9767 0.996 0.004
#> GSM876869     1  0.0376     0.9767 0.996 0.004
#> GSM876870     1  0.0376     0.9767 0.996 0.004
#> GSM876871     1  0.0376     0.9767 0.996 0.004
#> GSM876872     1  0.0000     0.9756 1.000 0.000
#> GSM876873     1  0.0000     0.9756 1.000 0.000
#> GSM876844     2  0.0000     0.9766 0.000 1.000
#> GSM876845     2  0.0000     0.9766 0.000 1.000
#> GSM876846     2  0.0000     0.9766 0.000 1.000
#> GSM876847     2  0.0000     0.9766 0.000 1.000
#> GSM876848     2  0.0376     0.9739 0.004 0.996
#> GSM876849     2  0.0376     0.9739 0.004 0.996
#> GSM876898     1  0.0376     0.9767 0.996 0.004
#> GSM876899     1  0.0376     0.9767 0.996 0.004
#> GSM876900     1  0.0376     0.9767 0.996 0.004
#> GSM876901     1  0.0376     0.9767 0.996 0.004
#> GSM876902     1  0.6048     0.8114 0.852 0.148
#> GSM876903     2  0.6887     0.7794 0.184 0.816
#> GSM876904     1  0.0376     0.9767 0.996 0.004
#> GSM876874     1  0.0376     0.9767 0.996 0.004
#> GSM876875     1  0.0000     0.9756 1.000 0.000
#> GSM876876     1  0.0376     0.9767 0.996 0.004
#> GSM876877     1  0.0376     0.9767 0.996 0.004
#> GSM876878     1  0.0376     0.9767 0.996 0.004
#> GSM876879     1  0.0000     0.9756 1.000 0.000
#> GSM876880     1  0.0376     0.9767 0.996 0.004
#> GSM876850     2  0.0000     0.9766 0.000 1.000
#> GSM876851     2  0.0000     0.9766 0.000 1.000
#> GSM876852     2  0.0000     0.9766 0.000 1.000
#> GSM876853     2  0.0000     0.9766 0.000 1.000
#> GSM876854     2  0.0000     0.9766 0.000 1.000
#> GSM876855     2  0.0000     0.9766 0.000 1.000
#> GSM876856     2  0.0000     0.9766 0.000 1.000
#> GSM876905     1  0.0376     0.9767 0.996 0.004
#> GSM876906     1  0.0376     0.9767 0.996 0.004
#> GSM876907     1  1.0000    -0.0227 0.500 0.500
#> GSM876908     1  0.0376     0.9767 0.996 0.004
#> GSM876909     2  0.6801     0.7849 0.180 0.820
#> GSM876881     2  0.0000     0.9766 0.000 1.000
#> GSM876882     1  0.0000     0.9756 1.000 0.000
#> GSM876883     1  0.0000     0.9756 1.000 0.000
#> GSM876884     1  0.0376     0.9767 0.996 0.004
#> GSM876885     1  0.0000     0.9756 1.000 0.000
#> GSM876857     1  0.0376     0.9767 0.996 0.004
#> GSM876858     2  0.0000     0.9766 0.000 1.000
#> GSM876859     2  0.0000     0.9766 0.000 1.000
#> GSM876860     2  0.0000     0.9766 0.000 1.000
#> GSM876861     2  0.0000     0.9766 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
#> GSM876886     3   0.630      0.536 0.480 0.000 0.520
#> GSM876887     3   0.497      0.767 0.236 0.000 0.764
#> GSM876888     3   0.631      0.519 0.488 0.000 0.512
#> GSM876889     3   0.440      0.787 0.188 0.000 0.812
#> GSM876890     3   0.497      0.767 0.236 0.000 0.764
#> GSM876891     3   0.440      0.787 0.188 0.000 0.812
#> GSM876862     1   0.000      0.994 1.000 0.000 0.000
#> GSM876863     1   0.000      0.994 1.000 0.000 0.000
#> GSM876864     1   0.000      0.994 1.000 0.000 0.000
#> GSM876865     1   0.000      0.994 1.000 0.000 0.000
#> GSM876866     1   0.000      0.994 1.000 0.000 0.000
#> GSM876867     1   0.000      0.994 1.000 0.000 0.000
#> GSM876838     2   0.000      0.961 0.000 1.000 0.000
#> GSM876839     2   0.000      0.961 0.000 1.000 0.000
#> GSM876840     2   0.000      0.961 0.000 1.000 0.000
#> GSM876841     2   0.000      0.961 0.000 1.000 0.000
#> GSM876842     2   0.000      0.961 0.000 1.000 0.000
#> GSM876843     2   0.440      0.816 0.000 0.812 0.188
#> GSM876892     3   0.630      0.543 0.476 0.000 0.524
#> GSM876893     3   0.630      0.536 0.480 0.000 0.520
#> GSM876894     3   0.440      0.787 0.188 0.000 0.812
#> GSM876895     3   0.458      0.786 0.184 0.004 0.812
#> GSM876896     3   0.445      0.466 0.000 0.192 0.808
#> GSM876897     3   0.445      0.466 0.000 0.192 0.808
#> GSM876868     1   0.000      0.994 1.000 0.000 0.000
#> GSM876869     1   0.000      0.994 1.000 0.000 0.000
#> GSM876870     1   0.000      0.994 1.000 0.000 0.000
#> GSM876871     1   0.000      0.994 1.000 0.000 0.000
#> GSM876872     3   0.000      0.680 0.000 0.000 1.000
#> GSM876873     3   0.000      0.680 0.000 0.000 1.000
#> GSM876844     2   0.000      0.961 0.000 1.000 0.000
#> GSM876845     2   0.000      0.961 0.000 1.000 0.000
#> GSM876846     2   0.000      0.961 0.000 1.000 0.000
#> GSM876847     2   0.000      0.961 0.000 1.000 0.000
#> GSM876848     2   0.590      0.623 0.000 0.648 0.352
#> GSM876849     2   0.630      0.389 0.000 0.516 0.484
#> GSM876898     3   0.630      0.536 0.480 0.000 0.520
#> GSM876899     3   0.440      0.787 0.188 0.000 0.812
#> GSM876900     3   0.630      0.543 0.476 0.000 0.524
#> GSM876901     3   0.630      0.543 0.476 0.000 0.524
#> GSM876902     3   0.000      0.680 0.000 0.000 1.000
#> GSM876903     3   0.557      0.744 0.108 0.080 0.812
#> GSM876904     3   0.630      0.536 0.480 0.000 0.520
#> GSM876874     1   0.000      0.994 1.000 0.000 0.000
#> GSM876875     1   0.000      0.994 1.000 0.000 0.000
#> GSM876876     1   0.000      0.994 1.000 0.000 0.000
#> GSM876877     1   0.000      0.994 1.000 0.000 0.000
#> GSM876878     1   0.000      0.994 1.000 0.000 0.000
#> GSM876879     1   0.000      0.994 1.000 0.000 0.000
#> GSM876880     1   0.000      0.994 1.000 0.000 0.000
#> GSM876850     2   0.000      0.961 0.000 1.000 0.000
#> GSM876851     2   0.000      0.961 0.000 1.000 0.000
#> GSM876852     2   0.000      0.961 0.000 1.000 0.000
#> GSM876853     2   0.000      0.961 0.000 1.000 0.000
#> GSM876854     2   0.000      0.961 0.000 1.000 0.000
#> GSM876855     2   0.000      0.961 0.000 1.000 0.000
#> GSM876856     2   0.000      0.961 0.000 1.000 0.000
#> GSM876905     3   0.630      0.536 0.480 0.000 0.520
#> GSM876906     3   0.440      0.787 0.188 0.000 0.812
#> GSM876907     3   0.458      0.786 0.184 0.004 0.812
#> GSM876908     3   0.440      0.787 0.188 0.000 0.812
#> GSM876909     3   0.557      0.744 0.108 0.080 0.812
#> GSM876881     2   0.000      0.961 0.000 1.000 0.000
#> GSM876882     1   0.236      0.881 0.928 0.000 0.072
#> GSM876883     3   0.440      0.787 0.188 0.000 0.812
#> GSM876884     1   0.000      0.994 1.000 0.000 0.000
#> GSM876885     3   0.440      0.787 0.188 0.000 0.812
#> GSM876857     1   0.000      0.994 1.000 0.000 0.000
#> GSM876858     2   0.000      0.961 0.000 1.000 0.000
#> GSM876859     2   0.000      0.961 0.000 1.000 0.000
#> GSM876860     2   0.000      0.961 0.000 1.000 0.000
#> GSM876861     2   0.000      0.961 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
#> GSM876886     3  0.2081      0.890 0.084 0.000 0.916 0.000
#> GSM876887     3  0.0707      0.896 0.020 0.000 0.980 0.000
#> GSM876888     3  0.2149      0.889 0.088 0.000 0.912 0.000
#> GSM876889     3  0.2198      0.887 0.008 0.000 0.920 0.072
#> GSM876890     3  0.0707      0.896 0.020 0.000 0.980 0.000
#> GSM876891     3  0.2256      0.893 0.020 0.000 0.924 0.056
#> GSM876862     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.976 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0469      0.978 0.000 0.988 0.012 0.000
#> GSM876840     2  0.1824      0.943 0.000 0.936 0.004 0.060
#> GSM876841     2  0.0469      0.978 0.000 0.988 0.012 0.000
#> GSM876842     2  0.0000      0.976 0.000 1.000 0.000 0.000
#> GSM876843     4  0.4360      0.649 0.000 0.248 0.008 0.744
#> GSM876892     3  0.2081      0.890 0.084 0.000 0.916 0.000
#> GSM876893     3  0.2149      0.889 0.088 0.000 0.912 0.000
#> GSM876894     3  0.0895      0.896 0.020 0.000 0.976 0.004
#> GSM876895     3  0.3585      0.835 0.004 0.004 0.828 0.164
#> GSM876896     4  0.1716      0.896 0.000 0.000 0.064 0.936
#> GSM876897     4  0.1716      0.896 0.000 0.000 0.064 0.936
#> GSM876868     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876872     4  0.1792      0.896 0.000 0.000 0.068 0.932
#> GSM876873     4  0.1792      0.896 0.000 0.000 0.068 0.932
#> GSM876844     2  0.0000      0.976 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0469      0.978 0.000 0.988 0.012 0.000
#> GSM876846     2  0.1970      0.940 0.000 0.932 0.008 0.060
#> GSM876847     2  0.0469      0.978 0.000 0.988 0.012 0.000
#> GSM876848     4  0.3351      0.778 0.000 0.148 0.008 0.844
#> GSM876849     4  0.1722      0.862 0.000 0.048 0.008 0.944
#> GSM876898     3  0.2149      0.889 0.088 0.000 0.912 0.000
#> GSM876899     3  0.3606      0.858 0.020 0.000 0.840 0.140
#> GSM876900     3  0.2081      0.890 0.084 0.000 0.916 0.000
#> GSM876901     3  0.2149      0.889 0.088 0.000 0.912 0.000
#> GSM876902     4  0.1716      0.896 0.000 0.000 0.064 0.936
#> GSM876903     3  0.3300      0.844 0.000 0.008 0.848 0.144
#> GSM876904     3  0.2149      0.889 0.088 0.000 0.912 0.000
#> GSM876874     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0188      0.994 0.996 0.000 0.004 0.000
#> GSM876876     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0188      0.994 0.996 0.000 0.004 0.000
#> GSM876880     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0469      0.978 0.000 0.988 0.012 0.000
#> GSM876851     2  0.0469      0.978 0.000 0.988 0.012 0.000
#> GSM876852     2  0.0188      0.975 0.000 0.996 0.004 0.000
#> GSM876853     2  0.0000      0.976 0.000 1.000 0.000 0.000
#> GSM876854     2  0.1824      0.943 0.000 0.936 0.004 0.060
#> GSM876855     2  0.1824      0.943 0.000 0.936 0.004 0.060
#> GSM876856     2  0.1824      0.943 0.000 0.936 0.004 0.060
#> GSM876905     3  0.2149      0.889 0.088 0.000 0.912 0.000
#> GSM876906     3  0.2413      0.892 0.020 0.000 0.916 0.064
#> GSM876907     3  0.3391      0.847 0.004 0.004 0.844 0.148
#> GSM876908     3  0.2413      0.892 0.020 0.000 0.916 0.064
#> GSM876909     3  0.3351      0.844 0.000 0.008 0.844 0.148
#> GSM876881     2  0.0657      0.977 0.000 0.984 0.012 0.004
#> GSM876882     1  0.0817      0.970 0.976 0.000 0.024 0.000
#> GSM876883     3  0.5077      0.793 0.080 0.000 0.760 0.160
#> GSM876884     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876885     3  0.4417      0.827 0.044 0.000 0.796 0.160
#> GSM876857     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0657      0.977 0.000 0.984 0.012 0.004
#> GSM876859     2  0.0657      0.977 0.000 0.984 0.012 0.004
#> GSM876860     2  0.0657      0.977 0.000 0.984 0.012 0.004
#> GSM876861     2  0.0657      0.977 0.000 0.984 0.012 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM876886     3  0.4482     0.7376 0.012 0.000 0.612 0.000 0.376
#> GSM876887     3  0.4114     0.7397 0.000 0.000 0.624 0.000 0.376
#> GSM876888     3  0.4444     0.7427 0.012 0.000 0.624 0.000 0.364
#> GSM876889     3  0.0609     0.7037 0.000 0.000 0.980 0.000 0.020
#> GSM876890     3  0.4088     0.7414 0.000 0.000 0.632 0.000 0.368
#> GSM876891     3  0.0000     0.7093 0.000 0.000 1.000 0.000 0.000
#> GSM876862     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.1410     0.9130 0.940 0.000 0.000 0.000 0.060
#> GSM876867     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.1478     0.8857 0.000 0.936 0.000 0.000 0.064
#> GSM876839     2  0.0404     0.8895 0.000 0.988 0.000 0.000 0.012
#> GSM876840     2  0.4761     0.7823 0.000 0.732 0.000 0.124 0.144
#> GSM876841     2  0.0404     0.8895 0.000 0.988 0.000 0.000 0.012
#> GSM876842     2  0.1544     0.8850 0.000 0.932 0.000 0.000 0.068
#> GSM876843     4  0.4317     0.6496 0.000 0.116 0.000 0.772 0.112
#> GSM876892     3  0.4444     0.7427 0.012 0.000 0.624 0.000 0.364
#> GSM876893     3  0.4444     0.7427 0.012 0.000 0.624 0.000 0.364
#> GSM876894     3  0.2179     0.7278 0.000 0.000 0.888 0.000 0.112
#> GSM876895     3  0.2653     0.6339 0.000 0.000 0.880 0.024 0.096
#> GSM876896     4  0.3416     0.8245 0.000 0.000 0.088 0.840 0.072
#> GSM876897     4  0.3416     0.8245 0.000 0.000 0.088 0.840 0.072
#> GSM876868     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.5672     0.7284 0.000 0.000 0.104 0.584 0.312
#> GSM876873     4  0.5672     0.7284 0.000 0.000 0.104 0.584 0.312
#> GSM876844     2  0.1544     0.8850 0.000 0.932 0.000 0.000 0.068
#> GSM876845     2  0.0609     0.8885 0.000 0.980 0.000 0.000 0.020
#> GSM876846     2  0.4889     0.7713 0.000 0.720 0.000 0.136 0.144
#> GSM876847     2  0.0609     0.8885 0.000 0.980 0.000 0.000 0.020
#> GSM876848     4  0.1981     0.7805 0.000 0.048 0.000 0.924 0.028
#> GSM876849     4  0.0771     0.8037 0.000 0.020 0.004 0.976 0.000
#> GSM876898     3  0.4444     0.7427 0.012 0.000 0.624 0.000 0.364
#> GSM876899     3  0.1310     0.6879 0.000 0.000 0.956 0.020 0.024
#> GSM876900     3  0.4444     0.7427 0.012 0.000 0.624 0.000 0.364
#> GSM876901     3  0.4444     0.7427 0.012 0.000 0.624 0.000 0.364
#> GSM876902     4  0.3980     0.8097 0.000 0.000 0.128 0.796 0.076
#> GSM876903     3  0.1872     0.6745 0.000 0.000 0.928 0.020 0.052
#> GSM876904     3  0.4444     0.7427 0.012 0.000 0.624 0.000 0.364
#> GSM876874     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.2929     0.8098 0.820 0.000 0.000 0.000 0.180
#> GSM876876     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.4484     0.6319 0.668 0.000 0.000 0.024 0.308
#> GSM876880     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0609     0.8885 0.000 0.980 0.000 0.000 0.020
#> GSM876851     2  0.0510     0.8891 0.000 0.984 0.000 0.000 0.016
#> GSM876852     2  0.2763     0.8540 0.000 0.848 0.000 0.004 0.148
#> GSM876853     2  0.1608     0.8857 0.000 0.928 0.000 0.000 0.072
#> GSM876854     2  0.4761     0.7823 0.000 0.732 0.000 0.124 0.144
#> GSM876855     2  0.4761     0.7823 0.000 0.732 0.000 0.124 0.144
#> GSM876856     2  0.4761     0.7823 0.000 0.732 0.000 0.124 0.144
#> GSM876905     3  0.4444     0.7427 0.012 0.000 0.624 0.000 0.364
#> GSM876906     3  0.0000     0.7093 0.000 0.000 1.000 0.000 0.000
#> GSM876907     3  0.1872     0.6745 0.000 0.000 0.928 0.020 0.052
#> GSM876908     3  0.0000     0.7093 0.000 0.000 1.000 0.000 0.000
#> GSM876909     3  0.1872     0.6745 0.000 0.000 0.928 0.020 0.052
#> GSM876881     2  0.2074     0.8589 0.000 0.896 0.000 0.000 0.104
#> GSM876882     1  0.4858     0.6137 0.656 0.000 0.012 0.024 0.308
#> GSM876883     3  0.6024     0.0908 0.040 0.000 0.532 0.044 0.384
#> GSM876884     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876885     3  0.5840     0.1013 0.020 0.000 0.540 0.056 0.384
#> GSM876857     1  0.0000     0.9537 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.2020     0.8626 0.000 0.900 0.000 0.000 0.100
#> GSM876859     2  0.2020     0.8626 0.000 0.900 0.000 0.000 0.100
#> GSM876860     2  0.2020     0.8626 0.000 0.900 0.000 0.000 0.100
#> GSM876861     2  0.2020     0.8626 0.000 0.900 0.000 0.000 0.100

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.4482      0.951 0.000 0.000 0.600 0.000 0.360 0.040
#> GSM876887     3  0.4482      0.951 0.000 0.000 0.600 0.000 0.360 0.040
#> GSM876888     3  0.3684      0.984 0.000 0.000 0.628 0.000 0.372 0.000
#> GSM876889     5  0.4447      0.443 0.000 0.000 0.224 0.008 0.704 0.064
#> GSM876890     3  0.4322      0.963 0.000 0.000 0.600 0.000 0.372 0.028
#> GSM876891     5  0.1556      0.870 0.000 0.000 0.080 0.000 0.920 0.000
#> GSM876862     1  0.0000      0.936 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0858      0.932 0.968 0.000 0.028 0.004 0.000 0.000
#> GSM876864     1  0.0260      0.935 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM876865     1  0.0713      0.932 0.972 0.000 0.028 0.000 0.000 0.000
#> GSM876866     1  0.2554      0.850 0.876 0.000 0.028 0.004 0.000 0.092
#> GSM876867     1  0.0146      0.936 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM876838     2  0.2532      0.806 0.000 0.884 0.060 0.004 0.000 0.052
#> GSM876839     2  0.0291      0.813 0.000 0.992 0.000 0.004 0.000 0.004
#> GSM876840     2  0.6324      0.648 0.000 0.580 0.144 0.104 0.000 0.172
#> GSM876841     2  0.0146      0.813 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876842     2  0.2591      0.805 0.000 0.880 0.064 0.004 0.000 0.052
#> GSM876843     4  0.5926      0.501 0.000 0.080 0.148 0.624 0.000 0.148
#> GSM876892     3  0.3684      0.984 0.000 0.000 0.628 0.000 0.372 0.000
#> GSM876893     3  0.3684      0.984 0.000 0.000 0.628 0.000 0.372 0.000
#> GSM876894     5  0.2003      0.817 0.000 0.000 0.116 0.000 0.884 0.000
#> GSM876895     5  0.0547      0.858 0.000 0.000 0.000 0.000 0.980 0.020
#> GSM876896     4  0.2826      0.752 0.000 0.000 0.000 0.856 0.092 0.052
#> GSM876897     4  0.2826      0.752 0.000 0.000 0.000 0.856 0.092 0.052
#> GSM876868     1  0.0547      0.933 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM876869     1  0.0547      0.933 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM876870     1  0.1367      0.930 0.944 0.000 0.044 0.012 0.000 0.000
#> GSM876871     1  0.1265      0.931 0.948 0.000 0.044 0.008 0.000 0.000
#> GSM876872     6  0.4721      0.167 0.000 0.000 0.004 0.464 0.036 0.496
#> GSM876873     6  0.4721      0.167 0.000 0.000 0.004 0.464 0.036 0.496
#> GSM876844     2  0.2591      0.805 0.000 0.880 0.064 0.004 0.000 0.052
#> GSM876845     2  0.0436      0.812 0.000 0.988 0.004 0.004 0.000 0.004
#> GSM876846     2  0.6694      0.579 0.000 0.528 0.188 0.112 0.000 0.172
#> GSM876847     2  0.0436      0.812 0.000 0.988 0.004 0.004 0.000 0.004
#> GSM876848     4  0.3212      0.720 0.000 0.028 0.068 0.856 0.004 0.044
#> GSM876849     4  0.2495      0.747 0.000 0.000 0.060 0.892 0.032 0.016
#> GSM876898     3  0.3684      0.984 0.000 0.000 0.628 0.000 0.372 0.000
#> GSM876899     5  0.0935      0.879 0.000 0.000 0.032 0.000 0.964 0.004
#> GSM876900     3  0.3684      0.984 0.000 0.000 0.628 0.000 0.372 0.000
#> GSM876901     3  0.3684      0.984 0.000 0.000 0.628 0.000 0.372 0.000
#> GSM876902     4  0.3065      0.742 0.000 0.000 0.004 0.844 0.100 0.052
#> GSM876903     5  0.0146      0.876 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM876904     3  0.3684      0.984 0.000 0.000 0.628 0.000 0.372 0.000
#> GSM876874     1  0.0000      0.936 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.4226      0.250 0.580 0.000 0.012 0.004 0.000 0.404
#> GSM876876     1  0.1367      0.930 0.944 0.000 0.044 0.012 0.000 0.000
#> GSM876877     1  0.1196      0.931 0.952 0.000 0.040 0.008 0.000 0.000
#> GSM876878     1  0.1820      0.923 0.928 0.000 0.044 0.012 0.000 0.016
#> GSM876879     6  0.3684      0.434 0.332 0.000 0.000 0.004 0.000 0.664
#> GSM876880     1  0.1196      0.931 0.952 0.000 0.040 0.008 0.000 0.000
#> GSM876850     2  0.0436      0.812 0.000 0.988 0.004 0.004 0.000 0.004
#> GSM876851     2  0.0146      0.813 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876852     2  0.4741      0.723 0.000 0.692 0.148 0.004 0.000 0.156
#> GSM876853     2  0.2533      0.805 0.000 0.884 0.056 0.004 0.000 0.056
#> GSM876854     2  0.6269      0.656 0.000 0.588 0.144 0.104 0.000 0.164
#> GSM876855     2  0.6269      0.656 0.000 0.588 0.144 0.104 0.000 0.164
#> GSM876856     2  0.6351      0.646 0.000 0.576 0.144 0.104 0.000 0.176
#> GSM876905     3  0.3684      0.984 0.000 0.000 0.628 0.000 0.372 0.000
#> GSM876906     5  0.1556      0.870 0.000 0.000 0.080 0.000 0.920 0.000
#> GSM876907     5  0.0146      0.876 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM876908     5  0.1556      0.870 0.000 0.000 0.080 0.000 0.920 0.000
#> GSM876909     5  0.0146      0.876 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM876881     2  0.3275      0.765 0.000 0.848 0.068 0.004 0.016 0.064
#> GSM876882     6  0.3482      0.469 0.316 0.000 0.000 0.000 0.000 0.684
#> GSM876883     6  0.4065      0.516 0.004 0.000 0.004 0.024 0.260 0.708
#> GSM876884     1  0.1367      0.930 0.944 0.000 0.044 0.012 0.000 0.000
#> GSM876885     6  0.4065      0.516 0.004 0.000 0.004 0.024 0.260 0.708
#> GSM876857     1  0.0547      0.933 0.980 0.000 0.020 0.000 0.000 0.000
#> GSM876858     2  0.4010      0.752 0.000 0.800 0.096 0.004 0.032 0.068
#> GSM876859     2  0.4010      0.752 0.000 0.800 0.096 0.004 0.032 0.068
#> GSM876860     2  0.4010      0.752 0.000 0.800 0.096 0.004 0.032 0.068
#> GSM876861     2  0.4010      0.752 0.000 0.800 0.096 0.004 0.032 0.068

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) tissue(p) k
#> CV:kmeans 71            0.907  2.13e-11 2
#> CV:kmeans 69            0.975  4.15e-22 3
#> CV:kmeans 72            0.121  1.48e-20 4
#> CV:kmeans 70            0.180  5.57e-22 5
#> CV:kmeans 66            0.162  2.33e-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: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 72 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-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.981       0.992         0.5000 0.499   0.499
#> 3 3 0.766           0.855       0.927         0.3294 0.797   0.608
#> 4 4 0.932           0.941       0.943         0.1015 0.906   0.732
#> 5 5 1.000           0.951       0.979         0.0573 0.946   0.805
#> 6 6 0.991           0.940       0.973         0.0378 0.967   0.854

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1   0.000      0.996 1.000 0.000
#> GSM876887     1   0.000      0.996 1.000 0.000
#> GSM876888     1   0.000      0.996 1.000 0.000
#> GSM876889     1   0.000      0.996 1.000 0.000
#> GSM876890     1   0.000      0.996 1.000 0.000
#> GSM876891     1   0.000      0.996 1.000 0.000
#> GSM876862     1   0.000      0.996 1.000 0.000
#> GSM876863     1   0.000      0.996 1.000 0.000
#> GSM876864     1   0.000      0.996 1.000 0.000
#> GSM876865     1   0.000      0.996 1.000 0.000
#> GSM876866     1   0.000      0.996 1.000 0.000
#> GSM876867     1   0.000      0.996 1.000 0.000
#> GSM876838     2   0.000      0.985 0.000 1.000
#> GSM876839     2   0.000      0.985 0.000 1.000
#> GSM876840     2   0.000      0.985 0.000 1.000
#> GSM876841     2   0.000      0.985 0.000 1.000
#> GSM876842     2   0.000      0.985 0.000 1.000
#> GSM876843     2   0.000      0.985 0.000 1.000
#> GSM876892     1   0.000      0.996 1.000 0.000
#> GSM876893     1   0.000      0.996 1.000 0.000
#> GSM876894     1   0.000      0.996 1.000 0.000
#> GSM876895     2   0.000      0.985 0.000 1.000
#> GSM876896     2   0.000      0.985 0.000 1.000
#> GSM876897     2   0.000      0.985 0.000 1.000
#> GSM876868     1   0.000      0.996 1.000 0.000
#> GSM876869     1   0.000      0.996 1.000 0.000
#> GSM876870     1   0.000      0.996 1.000 0.000
#> GSM876871     1   0.000      0.996 1.000 0.000
#> GSM876872     1   0.595      0.827 0.856 0.144
#> GSM876873     1   0.000      0.996 1.000 0.000
#> GSM876844     2   0.000      0.985 0.000 1.000
#> GSM876845     2   0.000      0.985 0.000 1.000
#> GSM876846     2   0.000      0.985 0.000 1.000
#> GSM876847     2   0.000      0.985 0.000 1.000
#> GSM876848     2   0.000      0.985 0.000 1.000
#> GSM876849     2   0.000      0.985 0.000 1.000
#> GSM876898     1   0.000      0.996 1.000 0.000
#> GSM876899     2   0.839      0.641 0.268 0.732
#> GSM876900     1   0.000      0.996 1.000 0.000
#> GSM876901     1   0.000      0.996 1.000 0.000
#> GSM876902     2   0.680      0.782 0.180 0.820
#> GSM876903     2   0.000      0.985 0.000 1.000
#> GSM876904     1   0.000      0.996 1.000 0.000
#> GSM876874     1   0.000      0.996 1.000 0.000
#> GSM876875     1   0.000      0.996 1.000 0.000
#> GSM876876     1   0.000      0.996 1.000 0.000
#> GSM876877     1   0.000      0.996 1.000 0.000
#> GSM876878     1   0.000      0.996 1.000 0.000
#> GSM876879     1   0.000      0.996 1.000 0.000
#> GSM876880     1   0.000      0.996 1.000 0.000
#> GSM876850     2   0.000      0.985 0.000 1.000
#> GSM876851     2   0.000      0.985 0.000 1.000
#> GSM876852     2   0.000      0.985 0.000 1.000
#> GSM876853     2   0.000      0.985 0.000 1.000
#> GSM876854     2   0.000      0.985 0.000 1.000
#> GSM876855     2   0.000      0.985 0.000 1.000
#> GSM876856     2   0.000      0.985 0.000 1.000
#> GSM876905     1   0.000      0.996 1.000 0.000
#> GSM876906     1   0.000      0.996 1.000 0.000
#> GSM876907     2   0.000      0.985 0.000 1.000
#> GSM876908     1   0.000      0.996 1.000 0.000
#> GSM876909     2   0.000      0.985 0.000 1.000
#> GSM876881     2   0.000      0.985 0.000 1.000
#> GSM876882     1   0.000      0.996 1.000 0.000
#> GSM876883     1   0.000      0.996 1.000 0.000
#> GSM876884     1   0.000      0.996 1.000 0.000
#> GSM876885     1   0.000      0.996 1.000 0.000
#> GSM876857     1   0.000      0.996 1.000 0.000
#> GSM876858     2   0.000      0.985 0.000 1.000
#> GSM876859     2   0.000      0.985 0.000 1.000
#> GSM876860     2   0.000      0.985 0.000 1.000
#> GSM876861     2   0.000      0.985 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM876886     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876887     3  0.1753      0.817 0.048 0.000 0.952
#> GSM876888     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876889     3  0.0000      0.811 0.000 0.000 1.000
#> GSM876890     3  0.1529      0.816 0.040 0.000 0.960
#> GSM876891     3  0.0000      0.811 0.000 0.000 1.000
#> GSM876862     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876866     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876867     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876838     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876839     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876840     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876841     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876842     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876843     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876892     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876893     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876894     3  0.0000      0.811 0.000 0.000 1.000
#> GSM876895     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876896     2  0.5926      0.524 0.000 0.644 0.356
#> GSM876897     2  0.4842      0.737 0.000 0.776 0.224
#> GSM876868     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876872     1  0.5926      0.535 0.644 0.000 0.356
#> GSM876873     1  0.5926      0.535 0.644 0.000 0.356
#> GSM876844     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876845     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876846     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876847     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876848     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876849     2  0.4291      0.784 0.000 0.820 0.180
#> GSM876898     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876899     3  0.0000      0.811 0.000 0.000 1.000
#> GSM876900     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876901     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876902     3  0.4452      0.636 0.000 0.192 0.808
#> GSM876903     2  0.6111      0.457 0.000 0.604 0.396
#> GSM876904     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876874     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876875     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876876     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876879     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876880     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876850     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876851     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876852     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876853     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876854     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876855     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876856     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876905     3  0.4842      0.800 0.224 0.000 0.776
#> GSM876906     3  0.0000      0.811 0.000 0.000 1.000
#> GSM876907     3  0.6309     -0.218 0.000 0.496 0.504
#> GSM876908     3  0.0000      0.811 0.000 0.000 1.000
#> GSM876909     2  0.4796      0.715 0.000 0.780 0.220
#> GSM876881     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876882     1  0.0237      0.941 0.996 0.000 0.004
#> GSM876883     1  0.4555      0.736 0.800 0.000 0.200
#> GSM876884     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876885     1  0.4605      0.732 0.796 0.000 0.204
#> GSM876857     1  0.0000      0.944 1.000 0.000 0.000
#> GSM876858     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876859     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876860     2  0.0000      0.950 0.000 1.000 0.000
#> GSM876861     2  0.0000      0.950 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
#> GSM876886     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876887     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876888     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876889     3  0.0188      0.989 0.000 0.000 0.996 0.004
#> GSM876890     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876891     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM876862     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876843     4  0.3688      0.786 0.000 0.208 0.000 0.792
#> GSM876892     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876893     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876894     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM876895     2  0.0188      0.970 0.000 0.996 0.004 0.000
#> GSM876896     4  0.0000      0.933 0.000 0.000 0.000 1.000
#> GSM876897     4  0.0000      0.933 0.000 0.000 0.000 1.000
#> GSM876868     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.933 0.000 0.000 0.000 1.000
#> GSM876873     4  0.0000      0.933 0.000 0.000 0.000 1.000
#> GSM876844     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876848     4  0.2345      0.898 0.000 0.100 0.000 0.900
#> GSM876849     4  0.2345      0.898 0.000 0.100 0.000 0.900
#> GSM876898     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876899     3  0.2345      0.888 0.000 0.000 0.900 0.100
#> GSM876900     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876901     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876902     4  0.0000      0.933 0.000 0.000 0.000 1.000
#> GSM876903     2  0.4549      0.780 0.000 0.804 0.096 0.100
#> GSM876904     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876874     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876876     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876880     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876905     3  0.0188      0.992 0.004 0.000 0.996 0.000
#> GSM876906     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM876907     2  0.4669      0.770 0.000 0.796 0.104 0.100
#> GSM876908     3  0.0000      0.990 0.000 0.000 1.000 0.000
#> GSM876909     2  0.4549      0.780 0.000 0.804 0.096 0.100
#> GSM876881     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876882     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876883     1  0.4790      0.406 0.620 0.000 0.000 0.380
#> GSM876884     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876885     1  0.4790      0.406 0.620 0.000 0.000 0.380
#> GSM876857     1  0.0000      0.962 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      0.973 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
#> GSM876886     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876887     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876888     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876889     3  0.0609      0.979 0.000 0.000 0.980 0.020 0.000
#> GSM876890     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876891     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876862     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2  0.0162      0.997 0.000 0.996 0.000 0.000 0.004
#> GSM876841     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876843     4  0.4288      0.380 0.000 0.384 0.000 0.612 0.004
#> GSM876892     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876893     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876894     3  0.0162      0.995 0.000 0.000 0.996 0.000 0.004
#> GSM876895     5  0.0794      0.977 0.000 0.028 0.000 0.000 0.972
#> GSM876896     4  0.0000      0.919 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000      0.919 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0290      0.916 0.000 0.000 0.000 0.992 0.008
#> GSM876873     4  0.0290      0.916 0.000 0.000 0.000 0.992 0.008
#> GSM876844     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2  0.0162      0.997 0.000 0.996 0.000 0.000 0.004
#> GSM876847     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4  0.0162      0.917 0.000 0.000 0.000 0.996 0.004
#> GSM876849     4  0.0162      0.917 0.000 0.000 0.000 0.996 0.004
#> GSM876898     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876899     5  0.0794      0.969 0.000 0.000 0.028 0.000 0.972
#> GSM876900     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876901     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876902     4  0.0000      0.919 0.000 0.000 0.000 1.000 0.000
#> GSM876903     5  0.0794      0.977 0.000 0.028 0.000 0.000 0.972
#> GSM876904     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876874     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.0510      0.949 0.984 0.000 0.000 0.000 0.016
#> GSM876876     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.0703      0.944 0.976 0.000 0.000 0.000 0.024
#> GSM876880     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.0162      0.997 0.000 0.996 0.000 0.000 0.004
#> GSM876853     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2  0.0162      0.997 0.000 0.996 0.000 0.000 0.004
#> GSM876855     2  0.0162      0.997 0.000 0.996 0.000 0.000 0.004
#> GSM876856     2  0.0162      0.997 0.000 0.996 0.000 0.000 0.004
#> GSM876905     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> GSM876906     5  0.0794      0.969 0.000 0.000 0.028 0.000 0.972
#> GSM876907     5  0.0794      0.977 0.000 0.028 0.000 0.000 0.972
#> GSM876908     5  0.0794      0.969 0.000 0.000 0.028 0.000 0.972
#> GSM876909     5  0.0794      0.977 0.000 0.028 0.000 0.000 0.972
#> GSM876881     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876882     1  0.0865      0.942 0.972 0.000 0.000 0.004 0.024
#> GSM876883     1  0.4734      0.399 0.604 0.000 0.000 0.372 0.024
#> GSM876884     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876885     1  0.4734      0.399 0.604 0.000 0.000 0.372 0.024
#> GSM876857     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0260      0.992 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM876887     3  0.0260      0.992 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM876888     3  0.0000      0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876889     3  0.0937      0.966 0.000 0.000 0.960 0.000 0.000 0.040
#> GSM876890     3  0.0260      0.992 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM876891     3  0.0363      0.990 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM876862     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.0777      0.979 0.000 0.972 0.000 0.024 0.000 0.004
#> GSM876841     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876843     4  0.2668      0.659 0.000 0.168 0.000 0.828 0.000 0.004
#> GSM876892     3  0.0000      0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0000      0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876894     3  0.0405      0.987 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM876895     5  0.0405      0.987 0.000 0.008 0.000 0.000 0.988 0.004
#> GSM876896     4  0.0632      0.844 0.000 0.000 0.000 0.976 0.000 0.024
#> GSM876897     4  0.0632      0.844 0.000 0.000 0.000 0.976 0.000 0.024
#> GSM876868     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.3515      0.613 0.000 0.000 0.000 0.676 0.000 0.324
#> GSM876873     4  0.3810      0.468 0.000 0.000 0.000 0.572 0.000 0.428
#> GSM876844     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876845     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.0858      0.976 0.000 0.968 0.000 0.028 0.000 0.004
#> GSM876847     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     4  0.0146      0.837 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM876849     4  0.0000      0.839 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876898     3  0.0000      0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876899     5  0.0000      0.997 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876900     3  0.0000      0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876901     3  0.0000      0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876902     4  0.0713      0.843 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM876903     5  0.0000      0.997 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.0000      0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876874     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     6  0.3860      0.174 0.472 0.000 0.000 0.000 0.000 0.528
#> GSM876876     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876879     6  0.2135      0.714 0.128 0.000 0.000 0.000 0.000 0.872
#> GSM876880     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0146      0.991 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876853     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.0777      0.979 0.000 0.972 0.000 0.024 0.000 0.004
#> GSM876855     2  0.0777      0.979 0.000 0.972 0.000 0.024 0.000 0.004
#> GSM876856     2  0.0777      0.979 0.000 0.972 0.000 0.024 0.000 0.004
#> GSM876905     3  0.0000      0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876906     5  0.0146      0.995 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM876907     5  0.0000      0.997 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.0146      0.995 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM876909     5  0.0000      0.997 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876882     6  0.0632      0.755 0.024 0.000 0.000 0.000 0.000 0.976
#> GSM876883     6  0.0622      0.748 0.012 0.000 0.000 0.008 0.000 0.980
#> GSM876884     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.0622      0.743 0.008 0.000 0.000 0.012 0.000 0.980
#> GSM876857     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      0.993 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-skmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) tissue(p) k
#> CV:skmeans 72           0.7433  5.51e-10 2
#> CV:skmeans 70           0.9154  1.37e-22 3
#> CV:skmeans 70           0.1218  4.52e-18 4
#> CV:skmeans 69           0.0134  1.10e-20 5
#> CV:skmeans 70           0.0270  3.72e-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.


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

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.965       0.987         0.4972 0.503   0.503
#> 3 3 1.000           0.973       0.989         0.3465 0.712   0.487
#> 4 4 0.900           0.908       0.947         0.1024 0.924   0.775
#> 5 5 0.937           0.925       0.961         0.0617 0.937   0.766
#> 6 6 1.000           0.972       0.984         0.0293 0.950   0.781

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1   0.000      0.989 1.000 0.000
#> GSM876887     1   0.000      0.989 1.000 0.000
#> GSM876888     1   0.000      0.989 1.000 0.000
#> GSM876889     1   0.000      0.989 1.000 0.000
#> GSM876890     1   0.000      0.989 1.000 0.000
#> GSM876891     1   0.000      0.989 1.000 0.000
#> GSM876862     1   0.000      0.989 1.000 0.000
#> GSM876863     1   0.000      0.989 1.000 0.000
#> GSM876864     1   0.000      0.989 1.000 0.000
#> GSM876865     1   0.000      0.989 1.000 0.000
#> GSM876866     1   0.000      0.989 1.000 0.000
#> GSM876867     1   0.000      0.989 1.000 0.000
#> GSM876838     2   0.000      0.982 0.000 1.000
#> GSM876839     2   0.000      0.982 0.000 1.000
#> GSM876840     2   0.000      0.982 0.000 1.000
#> GSM876841     2   0.000      0.982 0.000 1.000
#> GSM876842     2   0.000      0.982 0.000 1.000
#> GSM876843     2   0.000      0.982 0.000 1.000
#> GSM876892     1   0.000      0.989 1.000 0.000
#> GSM876893     1   0.000      0.989 1.000 0.000
#> GSM876894     1   0.000      0.989 1.000 0.000
#> GSM876895     2   0.529      0.857 0.120 0.880
#> GSM876896     2   0.260      0.941 0.044 0.956
#> GSM876897     2   0.000      0.982 0.000 1.000
#> GSM876868     1   0.000      0.989 1.000 0.000
#> GSM876869     1   0.000      0.989 1.000 0.000
#> GSM876870     1   0.000      0.989 1.000 0.000
#> GSM876871     1   0.000      0.989 1.000 0.000
#> GSM876872     1   0.000      0.989 1.000 0.000
#> GSM876873     1   0.000      0.989 1.000 0.000
#> GSM876844     2   0.000      0.982 0.000 1.000
#> GSM876845     2   0.000      0.982 0.000 1.000
#> GSM876846     2   0.000      0.982 0.000 1.000
#> GSM876847     2   0.000      0.982 0.000 1.000
#> GSM876848     2   0.000      0.982 0.000 1.000
#> GSM876849     2   0.000      0.982 0.000 1.000
#> GSM876898     1   0.000      0.989 1.000 0.000
#> GSM876899     2   0.955      0.401 0.376 0.624
#> GSM876900     1   0.000      0.989 1.000 0.000
#> GSM876901     1   0.000      0.989 1.000 0.000
#> GSM876902     1   0.983      0.248 0.576 0.424
#> GSM876903     2   0.000      0.982 0.000 1.000
#> GSM876904     1   0.000      0.989 1.000 0.000
#> GSM876874     1   0.000      0.989 1.000 0.000
#> GSM876875     1   0.000      0.989 1.000 0.000
#> GSM876876     1   0.000      0.989 1.000 0.000
#> GSM876877     1   0.000      0.989 1.000 0.000
#> GSM876878     1   0.000      0.989 1.000 0.000
#> GSM876879     1   0.000      0.989 1.000 0.000
#> GSM876880     1   0.000      0.989 1.000 0.000
#> GSM876850     2   0.000      0.982 0.000 1.000
#> GSM876851     2   0.000      0.982 0.000 1.000
#> GSM876852     2   0.000      0.982 0.000 1.000
#> GSM876853     2   0.000      0.982 0.000 1.000
#> GSM876854     2   0.000      0.982 0.000 1.000
#> GSM876855     2   0.000      0.982 0.000 1.000
#> GSM876856     2   0.000      0.982 0.000 1.000
#> GSM876905     1   0.000      0.989 1.000 0.000
#> GSM876906     1   0.000      0.989 1.000 0.000
#> GSM876907     2   0.000      0.982 0.000 1.000
#> GSM876908     1   0.000      0.989 1.000 0.000
#> GSM876909     2   0.000      0.982 0.000 1.000
#> GSM876881     2   0.000      0.982 0.000 1.000
#> GSM876882     1   0.000      0.989 1.000 0.000
#> GSM876883     1   0.000      0.989 1.000 0.000
#> GSM876884     1   0.000      0.989 1.000 0.000
#> GSM876885     1   0.000      0.989 1.000 0.000
#> GSM876857     1   0.000      0.989 1.000 0.000
#> GSM876858     2   0.000      0.982 0.000 1.000
#> GSM876859     2   0.000      0.982 0.000 1.000
#> GSM876860     2   0.000      0.982 0.000 1.000
#> GSM876861     2   0.000      0.982 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
#> GSM876886     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876887     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876888     3  0.0237      0.977 0.004 0.0 0.996
#> GSM876889     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876890     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876891     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876862     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876863     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876864     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876865     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876866     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876867     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876843     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876892     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876893     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876894     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876895     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876896     3  0.4555      0.763 0.000 0.2 0.800
#> GSM876897     3  0.4555      0.763 0.000 0.2 0.800
#> GSM876868     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876869     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876870     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876871     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876872     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876873     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876844     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876848     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876849     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876898     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876899     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876900     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876901     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876902     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876903     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876904     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876874     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876875     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876876     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876877     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876878     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876879     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876880     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876905     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876906     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876907     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876908     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876909     3  0.0000      0.981 0.000 0.0 1.000
#> GSM876881     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876882     1  0.5760      0.498 0.672 0.0 0.328
#> GSM876883     3  0.2261      0.918 0.068 0.0 0.932
#> GSM876884     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876885     3  0.1031      0.961 0.024 0.0 0.976
#> GSM876857     1  0.0000      0.982 1.000 0.0 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.0 0.000
#> GSM876861     2  0.0000      1.000 0.000 1.0 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876887     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876888     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876889     3   0.322      0.842 0.000 0.000 0.836 0.164
#> GSM876890     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876891     3   0.357      0.834 0.000 0.000 0.804 0.196
#> GSM876862     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876863     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876864     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876865     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876866     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876867     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876838     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876839     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876840     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876841     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876842     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876843     4   0.493      0.312 0.000 0.432 0.000 0.568
#> GSM876892     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876893     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876894     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876895     3   0.361      0.832 0.000 0.000 0.800 0.200
#> GSM876896     4   0.000      0.837 0.000 0.000 0.000 1.000
#> GSM876897     4   0.000      0.837 0.000 0.000 0.000 1.000
#> GSM876868     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876869     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876870     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876871     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876872     4   0.000      0.837 0.000 0.000 0.000 1.000
#> GSM876873     4   0.000      0.837 0.000 0.000 0.000 1.000
#> GSM876844     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876845     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876846     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876847     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876848     4   0.361      0.745 0.000 0.200 0.000 0.800
#> GSM876849     4   0.361      0.745 0.000 0.200 0.000 0.800
#> GSM876898     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876899     3   0.361      0.832 0.000 0.000 0.800 0.200
#> GSM876900     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876901     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876902     4   0.000      0.837 0.000 0.000 0.000 1.000
#> GSM876903     3   0.485      0.604 0.000 0.000 0.600 0.400
#> GSM876904     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876874     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876875     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876876     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876877     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876878     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876879     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876880     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876850     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876851     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876852     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876853     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876854     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876855     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876856     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876905     3   0.000      0.868 0.000 0.000 1.000 0.000
#> GSM876906     3   0.361      0.832 0.000 0.000 0.800 0.200
#> GSM876907     3   0.361      0.832 0.000 0.000 0.800 0.200
#> GSM876908     3   0.361      0.832 0.000 0.000 0.800 0.200
#> GSM876909     3   0.361      0.832 0.000 0.000 0.800 0.200
#> GSM876881     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876882     1   0.312      0.781 0.844 0.000 0.156 0.000
#> GSM876883     3   0.510      0.551 0.004 0.000 0.568 0.428
#> GSM876884     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876885     3   0.493      0.550 0.000 0.000 0.568 0.432
#> GSM876857     1   0.000      0.990 1.000 0.000 0.000 0.000
#> GSM876858     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876859     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876860     2   0.000      1.000 0.000 1.000 0.000 0.000
#> GSM876861     2   0.000      1.000 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
#> GSM876886     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876887     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876888     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876889     3   0.300      0.738 0.000 0.000 0.812 0.000 0.188
#> GSM876890     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876891     5   0.340      0.698 0.000 0.000 0.236 0.000 0.764
#> GSM876862     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876867     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876841     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876843     4   0.415      0.458 0.000 0.388 0.000 0.612 0.000
#> GSM876892     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876893     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876894     5   0.340      0.698 0.000 0.000 0.236 0.000 0.764
#> GSM876895     5   0.000      0.863 0.000 0.000 0.000 0.000 1.000
#> GSM876896     4   0.223      0.815 0.000 0.000 0.000 0.884 0.116
#> GSM876897     4   0.223      0.815 0.000 0.000 0.000 0.884 0.116
#> GSM876868     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4   0.000      0.806 0.000 0.000 0.000 1.000 0.000
#> GSM876873     4   0.000      0.806 0.000 0.000 0.000 1.000 0.000
#> GSM876844     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876847     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4   0.307      0.752 0.000 0.196 0.000 0.804 0.000
#> GSM876849     4   0.223      0.807 0.000 0.116 0.000 0.884 0.000
#> GSM876898     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876899     5   0.000      0.863 0.000 0.000 0.000 0.000 1.000
#> GSM876900     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876901     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876902     4   0.218      0.816 0.000 0.000 0.000 0.888 0.112
#> GSM876903     5   0.000      0.863 0.000 0.000 0.000 0.000 1.000
#> GSM876904     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876874     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1   0.154      0.932 0.932 0.000 0.000 0.068 0.000
#> GSM876876     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1   0.223      0.884 0.884 0.000 0.000 0.116 0.000
#> GSM876880     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876853     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876855     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876856     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876905     3   0.000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876906     5   0.000      0.863 0.000 0.000 0.000 0.000 1.000
#> GSM876907     5   0.000      0.863 0.000 0.000 0.000 0.000 1.000
#> GSM876908     5   0.000      0.863 0.000 0.000 0.000 0.000 1.000
#> GSM876909     5   0.000      0.863 0.000 0.000 0.000 0.000 1.000
#> GSM876881     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876882     5   0.612      0.354 0.360 0.000 0.000 0.136 0.504
#> GSM876883     5   0.340      0.787 0.036 0.000 0.000 0.136 0.828
#> GSM876884     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5   0.331      0.750 0.000 0.000 0.000 0.224 0.776
#> GSM876857     1   0.000      0.990 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876887     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876888     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876889     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876890     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876891     3  0.0146      0.996 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM876862     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.2378      0.812 0.848 0.000 0.000 0.000 0.000 0.152
#> GSM876867     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876841     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876843     4  0.2823      0.718 0.000 0.204 0.000 0.796 0.000 0.000
#> GSM876892     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876894     3  0.0146      0.996 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM876895     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876896     4  0.0260      0.923 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM876897     4  0.0260      0.923 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM876868     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     6  0.1957      0.889 0.000 0.000 0.000 0.112 0.000 0.888
#> GSM876873     6  0.1141      0.931 0.000 0.000 0.000 0.052 0.000 0.948
#> GSM876844     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.0632      0.978 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM876847     2  0.0520      0.982 0.000 0.984 0.000 0.008 0.000 0.008
#> GSM876848     4  0.1204      0.894 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM876849     4  0.0260      0.921 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM876898     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876899     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876900     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876901     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876902     4  0.0260      0.923 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM876903     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876874     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     6  0.1610      0.904 0.084 0.000 0.000 0.000 0.000 0.916
#> GSM876876     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0363      0.979 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM876879     6  0.0937      0.949 0.040 0.000 0.000 0.000 0.000 0.960
#> GSM876880     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0622      0.980 0.000 0.980 0.000 0.008 0.000 0.012
#> GSM876851     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876853     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876855     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876856     2  0.0000      0.986 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876905     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876906     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876907     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876909     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.1196      0.967 0.000 0.952 0.000 0.008 0.000 0.040
#> GSM876882     6  0.0937      0.949 0.040 0.000 0.000 0.000 0.000 0.960
#> GSM876883     6  0.1010      0.949 0.036 0.000 0.000 0.000 0.004 0.960
#> GSM876884     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.1074      0.935 0.000 0.000 0.000 0.028 0.012 0.960
#> GSM876857     1  0.0000      0.989 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.1196      0.967 0.000 0.952 0.000 0.008 0.000 0.040
#> GSM876859     2  0.1196      0.967 0.000 0.952 0.000 0.008 0.000 0.040
#> GSM876860     2  0.1196      0.967 0.000 0.952 0.000 0.008 0.000 0.040
#> GSM876861     2  0.1196      0.967 0.000 0.952 0.000 0.008 0.000 0.040

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) tissue(p) k
#> CV:pam 70          0.76865  2.34e-10 2
#> CV:pam 71          0.87069  8.22e-23 3
#> CV:pam 71          0.04851  1.41e-20 4
#> CV:pam 70          0.00799  4.07e-19 5
#> CV:pam 72          0.14097  9.23e-22 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 72 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 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.949       0.978         0.4339 0.549   0.549
#> 3 3 0.927           0.960       0.981         0.5540 0.775   0.590
#> 4 4 0.968           0.930       0.966         0.1073 0.868   0.626
#> 5 5 0.997           0.964       0.977         0.0360 0.976   0.905
#> 6 6 0.992           0.958       0.976         0.0481 0.957   0.812

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     2   0.000      1.000 0.000 1.000
#> GSM876887     2   0.000      1.000 0.000 1.000
#> GSM876888     2   0.000      1.000 0.000 1.000
#> GSM876889     2   0.000      1.000 0.000 1.000
#> GSM876890     2   0.000      1.000 0.000 1.000
#> GSM876891     2   0.000      1.000 0.000 1.000
#> GSM876862     1   0.000      0.929 1.000 0.000
#> GSM876863     1   0.000      0.929 1.000 0.000
#> GSM876864     1   0.000      0.929 1.000 0.000
#> GSM876865     1   0.000      0.929 1.000 0.000
#> GSM876866     1   0.000      0.929 1.000 0.000
#> GSM876867     1   0.000      0.929 1.000 0.000
#> GSM876838     2   0.000      1.000 0.000 1.000
#> GSM876839     2   0.000      1.000 0.000 1.000
#> GSM876840     2   0.000      1.000 0.000 1.000
#> GSM876841     2   0.000      1.000 0.000 1.000
#> GSM876842     2   0.000      1.000 0.000 1.000
#> GSM876843     2   0.000      1.000 0.000 1.000
#> GSM876892     2   0.000      1.000 0.000 1.000
#> GSM876893     2   0.000      1.000 0.000 1.000
#> GSM876894     2   0.000      1.000 0.000 1.000
#> GSM876895     2   0.000      1.000 0.000 1.000
#> GSM876896     2   0.000      1.000 0.000 1.000
#> GSM876897     2   0.000      1.000 0.000 1.000
#> GSM876868     1   0.000      0.929 1.000 0.000
#> GSM876869     1   0.000      0.929 1.000 0.000
#> GSM876870     1   0.000      0.929 1.000 0.000
#> GSM876871     1   0.000      0.929 1.000 0.000
#> GSM876872     1   0.969      0.430 0.604 0.396
#> GSM876873     1   0.969      0.430 0.604 0.396
#> GSM876844     2   0.000      1.000 0.000 1.000
#> GSM876845     2   0.000      1.000 0.000 1.000
#> GSM876846     2   0.000      1.000 0.000 1.000
#> GSM876847     2   0.000      1.000 0.000 1.000
#> GSM876848     2   0.000      1.000 0.000 1.000
#> GSM876849     2   0.000      1.000 0.000 1.000
#> GSM876898     2   0.000      1.000 0.000 1.000
#> GSM876899     2   0.000      1.000 0.000 1.000
#> GSM876900     2   0.000      1.000 0.000 1.000
#> GSM876901     2   0.000      1.000 0.000 1.000
#> GSM876902     2   0.000      1.000 0.000 1.000
#> GSM876903     2   0.000      1.000 0.000 1.000
#> GSM876904     2   0.000      1.000 0.000 1.000
#> GSM876874     1   0.000      0.929 1.000 0.000
#> GSM876875     1   0.000      0.929 1.000 0.000
#> GSM876876     1   0.000      0.929 1.000 0.000
#> GSM876877     1   0.000      0.929 1.000 0.000
#> GSM876878     1   0.000      0.929 1.000 0.000
#> GSM876879     1   0.000      0.929 1.000 0.000
#> GSM876880     1   0.000      0.929 1.000 0.000
#> GSM876850     2   0.000      1.000 0.000 1.000
#> GSM876851     2   0.000      1.000 0.000 1.000
#> GSM876852     2   0.000      1.000 0.000 1.000
#> GSM876853     2   0.000      1.000 0.000 1.000
#> GSM876854     2   0.000      1.000 0.000 1.000
#> GSM876855     2   0.000      1.000 0.000 1.000
#> GSM876856     2   0.000      1.000 0.000 1.000
#> GSM876905     2   0.000      1.000 0.000 1.000
#> GSM876906     2   0.000      1.000 0.000 1.000
#> GSM876907     2   0.000      1.000 0.000 1.000
#> GSM876908     2   0.000      1.000 0.000 1.000
#> GSM876909     2   0.000      1.000 0.000 1.000
#> GSM876881     2   0.000      1.000 0.000 1.000
#> GSM876882     1   0.000      0.929 1.000 0.000
#> GSM876883     1   0.969      0.430 0.604 0.396
#> GSM876884     1   0.000      0.929 1.000 0.000
#> GSM876885     1   0.969      0.430 0.604 0.396
#> GSM876857     1   0.000      0.929 1.000 0.000
#> GSM876858     2   0.000      1.000 0.000 1.000
#> GSM876859     2   0.000      1.000 0.000 1.000
#> GSM876860     2   0.000      1.000 0.000 1.000
#> GSM876861     2   0.000      1.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2   p3
#> GSM876886     3   0.000      1.000 0.000 0.000 1.00
#> GSM876887     3   0.000      1.000 0.000 0.000 1.00
#> GSM876888     3   0.000      1.000 0.000 0.000 1.00
#> GSM876889     3   0.000      1.000 0.000 0.000 1.00
#> GSM876890     3   0.000      1.000 0.000 0.000 1.00
#> GSM876891     3   0.000      1.000 0.000 0.000 1.00
#> GSM876862     1   0.000      0.971 1.000 0.000 0.00
#> GSM876863     1   0.000      0.971 1.000 0.000 0.00
#> GSM876864     1   0.000      0.971 1.000 0.000 0.00
#> GSM876865     1   0.000      0.971 1.000 0.000 0.00
#> GSM876866     1   0.000      0.971 1.000 0.000 0.00
#> GSM876867     1   0.000      0.971 1.000 0.000 0.00
#> GSM876838     2   0.000      0.970 0.000 1.000 0.00
#> GSM876839     2   0.000      0.970 0.000 1.000 0.00
#> GSM876840     2   0.000      0.970 0.000 1.000 0.00
#> GSM876841     2   0.000      0.970 0.000 1.000 0.00
#> GSM876842     2   0.000      0.970 0.000 1.000 0.00
#> GSM876843     2   0.000      0.970 0.000 1.000 0.00
#> GSM876892     3   0.000      1.000 0.000 0.000 1.00
#> GSM876893     3   0.000      1.000 0.000 0.000 1.00
#> GSM876894     3   0.000      1.000 0.000 0.000 1.00
#> GSM876895     2   0.867      0.459 0.252 0.588 0.16
#> GSM876896     3   0.000      1.000 0.000 0.000 1.00
#> GSM876897     3   0.000      1.000 0.000 0.000 1.00
#> GSM876868     1   0.000      0.971 1.000 0.000 0.00
#> GSM876869     1   0.000      0.971 1.000 0.000 0.00
#> GSM876870     1   0.000      0.971 1.000 0.000 0.00
#> GSM876871     1   0.000      0.971 1.000 0.000 0.00
#> GSM876872     1   0.400      0.829 0.840 0.000 0.16
#> GSM876873     1   0.400      0.829 0.840 0.000 0.16
#> GSM876844     2   0.000      0.970 0.000 1.000 0.00
#> GSM876845     2   0.000      0.970 0.000 1.000 0.00
#> GSM876846     2   0.000      0.970 0.000 1.000 0.00
#> GSM876847     2   0.000      0.970 0.000 1.000 0.00
#> GSM876848     2   0.400      0.805 0.000 0.840 0.16
#> GSM876849     2   0.400      0.805 0.000 0.840 0.16
#> GSM876898     3   0.000      1.000 0.000 0.000 1.00
#> GSM876899     3   0.000      1.000 0.000 0.000 1.00
#> GSM876900     3   0.000      1.000 0.000 0.000 1.00
#> GSM876901     3   0.000      1.000 0.000 0.000 1.00
#> GSM876902     3   0.000      1.000 0.000 0.000 1.00
#> GSM876903     3   0.000      1.000 0.000 0.000 1.00
#> GSM876904     3   0.000      1.000 0.000 0.000 1.00
#> GSM876874     1   0.000      0.971 1.000 0.000 0.00
#> GSM876875     1   0.000      0.971 1.000 0.000 0.00
#> GSM876876     1   0.000      0.971 1.000 0.000 0.00
#> GSM876877     1   0.000      0.971 1.000 0.000 0.00
#> GSM876878     1   0.000      0.971 1.000 0.000 0.00
#> GSM876879     1   0.000      0.971 1.000 0.000 0.00
#> GSM876880     1   0.000      0.971 1.000 0.000 0.00
#> GSM876850     2   0.000      0.970 0.000 1.000 0.00
#> GSM876851     2   0.000      0.970 0.000 1.000 0.00
#> GSM876852     2   0.000      0.970 0.000 1.000 0.00
#> GSM876853     2   0.000      0.970 0.000 1.000 0.00
#> GSM876854     2   0.000      0.970 0.000 1.000 0.00
#> GSM876855     2   0.000      0.970 0.000 1.000 0.00
#> GSM876856     2   0.000      0.970 0.000 1.000 0.00
#> GSM876905     3   0.000      1.000 0.000 0.000 1.00
#> GSM876906     3   0.000      1.000 0.000 0.000 1.00
#> GSM876907     3   0.000      1.000 0.000 0.000 1.00
#> GSM876908     3   0.000      1.000 0.000 0.000 1.00
#> GSM876909     3   0.000      1.000 0.000 0.000 1.00
#> GSM876881     2   0.000      0.970 0.000 1.000 0.00
#> GSM876882     1   0.000      0.971 1.000 0.000 0.00
#> GSM876883     1   0.400      0.829 0.840 0.000 0.16
#> GSM876884     1   0.000      0.971 1.000 0.000 0.00
#> GSM876885     1   0.400      0.829 0.840 0.000 0.16
#> GSM876857     1   0.000      0.971 1.000 0.000 0.00
#> GSM876858     2   0.000      0.970 0.000 1.000 0.00
#> GSM876859     2   0.000      0.970 0.000 1.000 0.00
#> GSM876860     2   0.000      0.970 0.000 1.000 0.00
#> GSM876861     2   0.000      0.970 0.000 1.000 0.00

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876887     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876888     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876889     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876890     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876891     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876862     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0188      0.991 0.996 0.000 0.000 0.004
#> GSM876864     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876866     4  0.4933      0.432 0.432 0.000 0.000 0.568
#> GSM876867     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876843     4  0.4477      0.467 0.000 0.312 0.000 0.688
#> GSM876892     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876893     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876894     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876895     3  0.6352      0.306 0.016 0.040 0.576 0.368
#> GSM876896     4  0.0000      0.821 0.000 0.000 0.000 1.000
#> GSM876897     4  0.0000      0.821 0.000 0.000 0.000 1.000
#> GSM876868     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.821 0.000 0.000 0.000 1.000
#> GSM876873     4  0.0000      0.821 0.000 0.000 0.000 1.000
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876848     4  0.0336      0.818 0.000 0.008 0.000 0.992
#> GSM876849     4  0.0000      0.821 0.000 0.000 0.000 1.000
#> GSM876898     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876899     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876900     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876901     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876902     4  0.0000      0.821 0.000 0.000 0.000 1.000
#> GSM876903     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876904     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876874     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876875     1  0.1637      0.920 0.940 0.000 0.000 0.060
#> GSM876876     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876879     4  0.4817      0.526 0.388 0.000 0.000 0.612
#> GSM876880     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876905     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876906     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876907     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876908     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876909     3  0.0000      0.979 0.000 0.000 1.000 0.000
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876882     4  0.4277      0.684 0.280 0.000 0.000 0.720
#> GSM876883     4  0.4277      0.684 0.280 0.000 0.000 0.720
#> GSM876884     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876885     4  0.4277      0.684 0.280 0.000 0.000 0.720
#> GSM876857     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      1.000 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
#> GSM876886     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876887     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876888     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876889     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876890     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876891     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876862     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0963      0.967 0.964 0.000 0.000 0.000 0.036
#> GSM876864     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0404      0.986 0.988 0.000 0.000 0.000 0.012
#> GSM876866     5  0.3291      0.886 0.088 0.000 0.000 0.064 0.848
#> GSM876867     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2  0.1478      0.956 0.000 0.936 0.000 0.000 0.064
#> GSM876841     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876843     4  0.2471      0.769 0.000 0.136 0.000 0.864 0.000
#> GSM876892     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876893     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876894     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876895     3  0.5642      0.466 0.000 0.000 0.624 0.240 0.136
#> GSM876896     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM876873     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM876844     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2  0.1478      0.956 0.000 0.936 0.000 0.000 0.064
#> GSM876847     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM876849     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM876898     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876899     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876900     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876901     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876902     4  0.0000      0.968 0.000 0.000 0.000 1.000 0.000
#> GSM876903     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876904     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876874     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876875     5  0.3454      0.874 0.100 0.000 0.000 0.064 0.836
#> GSM876876     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.1043      0.963 0.960 0.000 0.000 0.000 0.040
#> GSM876879     5  0.1478      0.924 0.000 0.000 0.000 0.064 0.936
#> GSM876880     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.1478      0.956 0.000 0.936 0.000 0.000 0.064
#> GSM876853     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2  0.1478      0.956 0.000 0.936 0.000 0.000 0.064
#> GSM876855     2  0.1478      0.956 0.000 0.936 0.000 0.000 0.064
#> GSM876856     2  0.1478      0.956 0.000 0.936 0.000 0.000 0.064
#> GSM876905     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876906     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876907     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876908     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876909     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000
#> GSM876881     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876882     5  0.1608      0.926 0.000 0.000 0.000 0.072 0.928
#> GSM876883     5  0.1851      0.922 0.000 0.000 0.000 0.088 0.912
#> GSM876884     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5  0.2377      0.892 0.000 0.000 0.000 0.128 0.872
#> GSM876857     1  0.0000      0.994 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876887     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876888     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876889     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876890     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876891     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876862     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     6  0.2941      0.709 0.220 0.000 0.000 0.000 0.000 0.780
#> GSM876864     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0363      0.980 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM876866     6  0.0632      0.903 0.024 0.000 0.000 0.000 0.000 0.976
#> GSM876867     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     5  0.0937      0.965 0.000 0.040 0.000 0.000 0.960 0.000
#> GSM876841     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0713      0.979 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM876843     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876892     3  0.0363      0.972 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM876893     3  0.0363      0.972 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM876894     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876895     3  0.4101      0.522 0.000 0.000 0.664 0.308 0.000 0.028
#> GSM876896     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876897     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876868     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876873     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876844     2  0.0713      0.979 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM876845     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     5  0.0937      0.965 0.000 0.040 0.000 0.000 0.960 0.000
#> GSM876847     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876849     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876898     3  0.0363      0.972 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM876899     3  0.0713      0.963 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876900     3  0.0363      0.972 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM876901     3  0.0363      0.972 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM876902     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876903     3  0.0713      0.963 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876904     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876874     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     6  0.0713      0.902 0.028 0.000 0.000 0.000 0.000 0.972
#> GSM876876     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.2092      0.856 0.876 0.000 0.000 0.000 0.000 0.124
#> GSM876879     6  0.0547      0.903 0.020 0.000 0.000 0.000 0.000 0.980
#> GSM876880     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     5  0.2562      0.821 0.000 0.172 0.000 0.000 0.828 0.000
#> GSM876853     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     5  0.0937      0.965 0.000 0.040 0.000 0.000 0.960 0.000
#> GSM876855     5  0.0937      0.965 0.000 0.040 0.000 0.000 0.960 0.000
#> GSM876856     5  0.0937      0.965 0.000 0.040 0.000 0.000 0.960 0.000
#> GSM876905     3  0.0363      0.972 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM876906     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876907     3  0.0713      0.963 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876908     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876909     3  0.0713      0.963 0.000 0.000 0.972 0.000 0.028 0.000
#> GSM876881     2  0.0713      0.979 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM876882     6  0.0291      0.897 0.004 0.000 0.000 0.004 0.000 0.992
#> GSM876883     6  0.1075      0.881 0.000 0.000 0.000 0.048 0.000 0.952
#> GSM876884     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.2562      0.766 0.000 0.000 0.000 0.172 0.000 0.828
#> GSM876857     1  0.0000      0.990 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0713      0.979 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM876859     2  0.0260      0.984 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM876860     2  0.0713      0.979 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM876861     2  0.1075      0.963 0.000 0.952 0.000 0.000 0.048 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-mclust-collect-classes

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

test_to_known_factors(res)
#>            n disease.state(p) tissue(p) k
#> CV:mclust 68            0.876  1.70e-13 2
#> CV:mclust 71            1.000  2.81e-27 3
#> CV:mclust 69            0.345  8.64e-21 4
#> CV:mclust 71            0.118  3.49e-21 5
#> CV:mclust 72            0.120  2.01e-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.


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

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.971           0.951       0.979         0.4779 0.512   0.512
#> 3 3 0.994           0.955       0.973         0.4094 0.753   0.544
#> 4 4 0.843           0.518       0.874         0.0645 0.944   0.834
#> 5 5 0.832           0.781       0.887         0.0786 0.887   0.646
#> 6 6 0.801           0.741       0.857         0.0261 0.982   0.923

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
#> GSM876886     1   0.000      1.000 1.000 0.000
#> GSM876887     1   0.000      1.000 1.000 0.000
#> GSM876888     1   0.000      1.000 1.000 0.000
#> GSM876889     1   0.000      1.000 1.000 0.000
#> GSM876890     1   0.000      1.000 1.000 0.000
#> GSM876891     1   0.000      1.000 1.000 0.000
#> GSM876862     1   0.000      1.000 1.000 0.000
#> GSM876863     1   0.000      1.000 1.000 0.000
#> GSM876864     1   0.000      1.000 1.000 0.000
#> GSM876865     1   0.000      1.000 1.000 0.000
#> GSM876866     1   0.000      1.000 1.000 0.000
#> GSM876867     1   0.000      1.000 1.000 0.000
#> GSM876838     2   0.000      0.945 0.000 1.000
#> GSM876839     2   0.000      0.945 0.000 1.000
#> GSM876840     2   0.000      0.945 0.000 1.000
#> GSM876841     2   0.000      0.945 0.000 1.000
#> GSM876842     2   0.000      0.945 0.000 1.000
#> GSM876843     2   0.000      0.945 0.000 1.000
#> GSM876892     1   0.000      1.000 1.000 0.000
#> GSM876893     1   0.000      1.000 1.000 0.000
#> GSM876894     1   0.000      1.000 1.000 0.000
#> GSM876895     2   0.998      0.194 0.472 0.528
#> GSM876896     1   0.000      1.000 1.000 0.000
#> GSM876897     2   0.760      0.732 0.220 0.780
#> GSM876868     1   0.000      1.000 1.000 0.000
#> GSM876869     1   0.000      1.000 1.000 0.000
#> GSM876870     1   0.000      1.000 1.000 0.000
#> GSM876871     1   0.000      1.000 1.000 0.000
#> GSM876872     1   0.000      1.000 1.000 0.000
#> GSM876873     1   0.000      1.000 1.000 0.000
#> GSM876844     2   0.000      0.945 0.000 1.000
#> GSM876845     2   0.000      0.945 0.000 1.000
#> GSM876846     2   0.000      0.945 0.000 1.000
#> GSM876847     2   0.000      0.945 0.000 1.000
#> GSM876848     2   0.000      0.945 0.000 1.000
#> GSM876849     2   0.000      0.945 0.000 1.000
#> GSM876898     1   0.000      1.000 1.000 0.000
#> GSM876899     1   0.000      1.000 1.000 0.000
#> GSM876900     1   0.000      1.000 1.000 0.000
#> GSM876901     1   0.000      1.000 1.000 0.000
#> GSM876902     1   0.000      1.000 1.000 0.000
#> GSM876903     2   0.781      0.716 0.232 0.768
#> GSM876904     1   0.000      1.000 1.000 0.000
#> GSM876874     1   0.000      1.000 1.000 0.000
#> GSM876875     1   0.000      1.000 1.000 0.000
#> GSM876876     1   0.000      1.000 1.000 0.000
#> GSM876877     1   0.000      1.000 1.000 0.000
#> GSM876878     1   0.000      1.000 1.000 0.000
#> GSM876879     1   0.000      1.000 1.000 0.000
#> GSM876880     1   0.000      1.000 1.000 0.000
#> GSM876850     2   0.000      0.945 0.000 1.000
#> GSM876851     2   0.000      0.945 0.000 1.000
#> GSM876852     2   0.000      0.945 0.000 1.000
#> GSM876853     2   0.000      0.945 0.000 1.000
#> GSM876854     2   0.000      0.945 0.000 1.000
#> GSM876855     2   0.000      0.945 0.000 1.000
#> GSM876856     2   0.000      0.945 0.000 1.000
#> GSM876905     1   0.000      1.000 1.000 0.000
#> GSM876906     1   0.000      1.000 1.000 0.000
#> GSM876907     2   0.985      0.326 0.428 0.572
#> GSM876908     1   0.000      1.000 1.000 0.000
#> GSM876909     2   0.625      0.808 0.156 0.844
#> GSM876881     2   0.000      0.945 0.000 1.000
#> GSM876882     1   0.000      1.000 1.000 0.000
#> GSM876883     1   0.000      1.000 1.000 0.000
#> GSM876884     1   0.000      1.000 1.000 0.000
#> GSM876885     1   0.000      1.000 1.000 0.000
#> GSM876857     1   0.000      1.000 1.000 0.000
#> GSM876858     2   0.000      0.945 0.000 1.000
#> GSM876859     2   0.000      0.945 0.000 1.000
#> GSM876860     2   0.000      0.945 0.000 1.000
#> GSM876861     2   0.000      0.945 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
#> GSM876886     3  0.2356      0.945 0.072 0.000 0.928
#> GSM876887     3  0.1289      0.966 0.032 0.000 0.968
#> GSM876888     3  0.3816      0.865 0.148 0.000 0.852
#> GSM876889     3  0.0592      0.968 0.012 0.000 0.988
#> GSM876890     3  0.0592      0.968 0.012 0.000 0.988
#> GSM876891     3  0.0592      0.968 0.012 0.000 0.988
#> GSM876862     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876866     1  0.0592      0.963 0.988 0.000 0.012
#> GSM876867     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876838     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876839     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876840     2  0.0592      0.985 0.000 0.988 0.012
#> GSM876841     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876842     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876843     2  0.0592      0.985 0.000 0.988 0.012
#> GSM876892     3  0.1411      0.965 0.036 0.000 0.964
#> GSM876893     3  0.1860      0.958 0.052 0.000 0.948
#> GSM876894     3  0.0592      0.968 0.012 0.000 0.988
#> GSM876895     2  0.4228      0.817 0.148 0.844 0.008
#> GSM876896     3  0.0000      0.962 0.000 0.000 1.000
#> GSM876897     3  0.0424      0.959 0.000 0.008 0.992
#> GSM876868     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876872     1  0.5254      0.671 0.736 0.000 0.264
#> GSM876873     1  0.6026      0.441 0.624 0.000 0.376
#> GSM876844     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876845     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876846     2  0.0592      0.985 0.000 0.988 0.012
#> GSM876847     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876848     2  0.0592      0.985 0.000 0.988 0.012
#> GSM876849     2  0.2448      0.930 0.000 0.924 0.076
#> GSM876898     3  0.2878      0.927 0.096 0.000 0.904
#> GSM876899     3  0.0592      0.968 0.012 0.000 0.988
#> GSM876900     3  0.1411      0.965 0.036 0.000 0.964
#> GSM876901     3  0.1753      0.960 0.048 0.000 0.952
#> GSM876902     3  0.0592      0.968 0.012 0.000 0.988
#> GSM876903     3  0.1129      0.959 0.004 0.020 0.976
#> GSM876904     3  0.2711      0.932 0.088 0.000 0.912
#> GSM876874     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876875     1  0.0592      0.963 0.988 0.000 0.012
#> GSM876876     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876879     1  0.0592      0.963 0.988 0.000 0.012
#> GSM876880     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876850     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876851     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876852     2  0.0592      0.985 0.000 0.988 0.012
#> GSM876853     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876854     2  0.0592      0.985 0.000 0.988 0.012
#> GSM876855     2  0.0592      0.985 0.000 0.988 0.012
#> GSM876856     2  0.0592      0.985 0.000 0.988 0.012
#> GSM876905     3  0.2165      0.951 0.064 0.000 0.936
#> GSM876906     3  0.0592      0.968 0.012 0.000 0.988
#> GSM876907     3  0.0983      0.961 0.004 0.016 0.980
#> GSM876908     3  0.0592      0.968 0.012 0.000 0.988
#> GSM876909     3  0.2066      0.932 0.000 0.060 0.940
#> GSM876881     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876882     1  0.0747      0.960 0.984 0.000 0.016
#> GSM876883     1  0.1031      0.955 0.976 0.000 0.024
#> GSM876884     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876885     1  0.1031      0.955 0.976 0.000 0.024
#> GSM876857     1  0.0000      0.968 1.000 0.000 0.000
#> GSM876858     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876859     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876860     2  0.0000      0.988 0.000 1.000 0.000
#> GSM876861     2  0.0000      0.988 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
#> GSM876886     3  0.4941   -0.46024 0.000 0.000 0.564 0.436
#> GSM876887     3  0.4877   -0.37000 0.000 0.000 0.592 0.408
#> GSM876888     4  0.4977    0.69078 0.000 0.000 0.460 0.540
#> GSM876889     3  0.4830   -0.38216 0.000 0.000 0.608 0.392
#> GSM876890     3  0.4877   -0.37000 0.000 0.000 0.592 0.408
#> GSM876891     3  0.4866   -0.36680 0.000 0.000 0.596 0.404
#> GSM876862     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876863     1  0.0336    0.99329 0.992 0.000 0.000 0.008
#> GSM876864     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876865     1  0.0000    0.99437 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0336    0.99329 0.992 0.000 0.000 0.008
#> GSM876867     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876838     2  0.0000    0.90778 0.000 1.000 0.000 0.000
#> GSM876839     2  0.1118    0.90735 0.000 0.964 0.000 0.036
#> GSM876840     2  0.1022    0.90208 0.000 0.968 0.000 0.032
#> GSM876841     2  0.1389    0.90610 0.000 0.952 0.000 0.048
#> GSM876842     2  0.0000    0.90778 0.000 1.000 0.000 0.000
#> GSM876843     2  0.2131    0.88769 0.000 0.932 0.032 0.036
#> GSM876892     3  0.4933   -0.44325 0.000 0.000 0.568 0.432
#> GSM876893     3  0.4981   -0.58318 0.000 0.000 0.536 0.464
#> GSM876894     3  0.4877   -0.37000 0.000 0.000 0.592 0.408
#> GSM876895     2  0.6511    0.69929 0.084 0.596 0.004 0.316
#> GSM876896     3  0.0469   -0.00707 0.000 0.000 0.988 0.012
#> GSM876897     3  0.1211   -0.00155 0.000 0.000 0.960 0.040
#> GSM876868     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876869     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876870     1  0.0188    0.99399 0.996 0.000 0.000 0.004
#> GSM876871     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876872     3  0.5406   -0.36012 0.480 0.000 0.508 0.012
#> GSM876873     3  0.5217   -0.10973 0.380 0.000 0.608 0.012
#> GSM876844     2  0.0000    0.90778 0.000 1.000 0.000 0.000
#> GSM876845     2  0.1474    0.90555 0.000 0.948 0.000 0.052
#> GSM876846     2  0.0469    0.90648 0.000 0.988 0.000 0.012
#> GSM876847     2  0.3356    0.87027 0.000 0.824 0.000 0.176
#> GSM876848     2  0.5200    0.70235 0.000 0.700 0.264 0.036
#> GSM876849     2  0.6387    0.50859 0.008 0.532 0.412 0.048
#> GSM876898     4  0.4998    0.68303 0.000 0.000 0.488 0.512
#> GSM876899     3  0.4877   -0.37000 0.000 0.000 0.592 0.408
#> GSM876900     3  0.4925   -0.42926 0.000 0.000 0.572 0.428
#> GSM876901     3  0.4948   -0.48238 0.000 0.000 0.560 0.440
#> GSM876902     3  0.0000   -0.01319 0.000 0.000 1.000 0.000
#> GSM876903     3  0.4804   -0.39615 0.000 0.000 0.616 0.384
#> GSM876904     3  0.5000   -0.72668 0.000 0.000 0.504 0.496
#> GSM876874     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876875     1  0.0336    0.99329 0.992 0.000 0.000 0.008
#> GSM876876     1  0.0000    0.99437 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876878     1  0.0336    0.99329 0.992 0.000 0.000 0.008
#> GSM876879     1  0.0469    0.99165 0.988 0.000 0.000 0.012
#> GSM876880     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876850     2  0.4008    0.83171 0.000 0.756 0.000 0.244
#> GSM876851     2  0.1389    0.90610 0.000 0.952 0.000 0.048
#> GSM876852     2  0.0707    0.90523 0.000 0.980 0.000 0.020
#> GSM876853     2  0.0592    0.90828 0.000 0.984 0.000 0.016
#> GSM876854     2  0.0592    0.90584 0.000 0.984 0.000 0.016
#> GSM876855     2  0.1022    0.90208 0.000 0.968 0.000 0.032
#> GSM876856     2  0.0707    0.90524 0.000 0.980 0.000 0.020
#> GSM876905     3  0.4977   -0.56701 0.000 0.000 0.540 0.460
#> GSM876906     3  0.4855   -0.36972 0.000 0.000 0.600 0.400
#> GSM876907     3  0.4925   -0.50671 0.000 0.000 0.572 0.428
#> GSM876908     3  0.4866   -0.36680 0.000 0.000 0.596 0.404
#> GSM876909     4  0.4992    0.61596 0.000 0.000 0.476 0.524
#> GSM876881     2  0.4564    0.77762 0.000 0.672 0.000 0.328
#> GSM876882     1  0.0469    0.99165 0.988 0.000 0.000 0.012
#> GSM876883     1  0.0804    0.98689 0.980 0.000 0.008 0.012
#> GSM876884     1  0.0336    0.99329 0.992 0.000 0.000 0.008
#> GSM876885     1  0.0804    0.98689 0.980 0.000 0.008 0.012
#> GSM876857     1  0.0188    0.99433 0.996 0.000 0.000 0.004
#> GSM876858     2  0.3266    0.87459 0.000 0.832 0.000 0.168
#> GSM876859     2  0.2760    0.88876 0.000 0.872 0.000 0.128
#> GSM876860     2  0.3074    0.88079 0.000 0.848 0.000 0.152
#> GSM876861     2  0.3024    0.88221 0.000 0.852 0.000 0.148

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM876886     3  0.1731     0.8725 0.004 0.000 0.932 0.060 0.004
#> GSM876887     3  0.0963     0.8873 0.000 0.000 0.964 0.036 0.000
#> GSM876888     3  0.4017     0.6640 0.004 0.000 0.736 0.248 0.012
#> GSM876889     3  0.1608     0.8769 0.000 0.000 0.928 0.072 0.000
#> GSM876890     3  0.0880     0.8879 0.000 0.000 0.968 0.032 0.000
#> GSM876891     3  0.1410     0.8815 0.000 0.000 0.940 0.060 0.000
#> GSM876862     1  0.1195     0.9203 0.960 0.000 0.000 0.028 0.012
#> GSM876863     1  0.0162     0.9309 0.996 0.000 0.000 0.004 0.000
#> GSM876864     1  0.1597     0.9089 0.940 0.000 0.000 0.048 0.012
#> GSM876865     1  0.0324     0.9310 0.992 0.000 0.000 0.004 0.004
#> GSM876866     1  0.0162     0.9309 0.996 0.000 0.000 0.004 0.000
#> GSM876867     1  0.0510     0.9291 0.984 0.000 0.000 0.016 0.000
#> GSM876838     2  0.0880     0.8667 0.000 0.968 0.000 0.000 0.032
#> GSM876839     2  0.1792     0.8374 0.000 0.916 0.000 0.000 0.084
#> GSM876840     2  0.0162     0.8653 0.000 0.996 0.000 0.004 0.000
#> GSM876841     2  0.4210     0.3242 0.000 0.588 0.000 0.000 0.412
#> GSM876842     2  0.0880     0.8667 0.000 0.968 0.000 0.000 0.032
#> GSM876843     2  0.0510     0.8585 0.000 0.984 0.000 0.016 0.000
#> GSM876892     3  0.0963     0.8828 0.000 0.000 0.964 0.036 0.000
#> GSM876893     3  0.2068     0.8563 0.004 0.000 0.904 0.092 0.000
#> GSM876894     3  0.1608     0.8769 0.000 0.000 0.928 0.072 0.000
#> GSM876895     5  0.3801     0.7135 0.112 0.032 0.000 0.028 0.828
#> GSM876896     4  0.3999     0.5645 0.000 0.000 0.344 0.656 0.000
#> GSM876897     4  0.4118     0.5700 0.000 0.004 0.336 0.660 0.000
#> GSM876868     1  0.2727     0.8614 0.888 0.000 0.012 0.080 0.020
#> GSM876869     1  0.1648     0.9097 0.940 0.000 0.000 0.040 0.020
#> GSM876870     1  0.0162     0.9309 0.996 0.000 0.000 0.004 0.000
#> GSM876871     1  0.0324     0.9310 0.992 0.000 0.000 0.004 0.004
#> GSM876872     4  0.4192     0.3060 0.404 0.000 0.000 0.596 0.000
#> GSM876873     4  0.4639     0.4006 0.368 0.000 0.020 0.612 0.000
#> GSM876844     2  0.0794     0.8677 0.000 0.972 0.000 0.000 0.028
#> GSM876845     2  0.4201     0.3375 0.000 0.592 0.000 0.000 0.408
#> GSM876846     2  0.0404     0.8694 0.000 0.988 0.000 0.000 0.012
#> GSM876847     5  0.3561     0.6125 0.000 0.260 0.000 0.000 0.740
#> GSM876848     2  0.0703     0.8530 0.000 0.976 0.000 0.024 0.000
#> GSM876849     2  0.4415     0.3586 0.008 0.604 0.000 0.388 0.000
#> GSM876898     3  0.2179     0.8443 0.000 0.000 0.888 0.112 0.000
#> GSM876899     3  0.1608     0.8769 0.000 0.000 0.928 0.072 0.000
#> GSM876900     3  0.0162     0.8884 0.000 0.000 0.996 0.004 0.000
#> GSM876901     3  0.0404     0.8879 0.000 0.000 0.988 0.012 0.000
#> GSM876902     4  0.4045     0.5481 0.000 0.000 0.356 0.644 0.000
#> GSM876903     3  0.5290     0.5102 0.000 0.000 0.676 0.140 0.184
#> GSM876904     3  0.1965     0.8564 0.000 0.000 0.904 0.096 0.000
#> GSM876874     1  0.1701     0.9073 0.936 0.000 0.000 0.048 0.016
#> GSM876875     1  0.0290     0.9300 0.992 0.000 0.000 0.008 0.000
#> GSM876876     1  0.0404     0.9300 0.988 0.000 0.000 0.012 0.000
#> GSM876877     1  0.0771     0.9273 0.976 0.000 0.000 0.020 0.004
#> GSM876878     1  0.0290     0.9300 0.992 0.000 0.000 0.008 0.000
#> GSM876879     1  0.0290     0.9300 0.992 0.000 0.000 0.008 0.000
#> GSM876880     1  0.0290     0.9306 0.992 0.000 0.000 0.008 0.000
#> GSM876850     5  0.3586     0.6045 0.000 0.264 0.000 0.000 0.736
#> GSM876851     2  0.3586     0.6348 0.000 0.736 0.000 0.000 0.264
#> GSM876852     2  0.0510     0.8694 0.000 0.984 0.000 0.000 0.016
#> GSM876853     2  0.2329     0.8053 0.000 0.876 0.000 0.000 0.124
#> GSM876854     2  0.0290     0.8690 0.000 0.992 0.000 0.000 0.008
#> GSM876855     2  0.0000     0.8669 0.000 1.000 0.000 0.000 0.000
#> GSM876856     2  0.0162     0.8682 0.000 0.996 0.000 0.000 0.004
#> GSM876905     3  0.1704     0.8702 0.004 0.000 0.928 0.068 0.000
#> GSM876906     3  0.1792     0.8688 0.000 0.000 0.916 0.084 0.000
#> GSM876907     5  0.4630     0.3023 0.000 0.000 0.396 0.016 0.588
#> GSM876908     3  0.1732     0.8719 0.000 0.000 0.920 0.080 0.000
#> GSM876909     5  0.3612     0.5903 0.000 0.000 0.228 0.008 0.764
#> GSM876881     5  0.1270     0.8132 0.000 0.052 0.000 0.000 0.948
#> GSM876882     1  0.0290     0.9300 0.992 0.000 0.000 0.008 0.000
#> GSM876883     1  0.3876     0.4413 0.684 0.000 0.000 0.316 0.000
#> GSM876884     1  0.0162     0.9309 0.996 0.000 0.000 0.004 0.000
#> GSM876885     1  0.4262     0.0448 0.560 0.000 0.000 0.440 0.000
#> GSM876857     1  0.1364     0.9158 0.952 0.000 0.000 0.036 0.012
#> GSM876858     5  0.0963     0.8167 0.000 0.036 0.000 0.000 0.964
#> GSM876859     5  0.0963     0.8167 0.000 0.036 0.000 0.000 0.964
#> GSM876860     5  0.0963     0.8167 0.000 0.036 0.000 0.000 0.964
#> GSM876861     5  0.1041     0.8145 0.000 0.032 0.000 0.004 0.964

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM876886     3  0.1364     0.9225 0.020 0.000 0.952 0.012 0.000 NA
#> GSM876887     3  0.0603     0.9323 0.004 0.000 0.980 0.016 0.000 NA
#> GSM876888     3  0.2365     0.8802 0.024 0.000 0.896 0.012 0.000 NA
#> GSM876889     3  0.1075     0.9221 0.000 0.000 0.952 0.048 0.000 NA
#> GSM876890     3  0.0547     0.9309 0.000 0.000 0.980 0.020 0.000 NA
#> GSM876891     3  0.0632     0.9301 0.000 0.000 0.976 0.024 0.000 NA
#> GSM876862     1  0.1910     0.8124 0.892 0.000 0.000 0.000 0.000 NA
#> GSM876863     1  0.0603     0.8420 0.980 0.000 0.000 0.004 0.000 NA
#> GSM876864     1  0.2300     0.7947 0.856 0.000 0.000 0.000 0.000 NA
#> GSM876865     1  0.0790     0.8424 0.968 0.000 0.000 0.000 0.000 NA
#> GSM876866     1  0.0508     0.8432 0.984 0.000 0.000 0.004 0.000 NA
#> GSM876867     1  0.1141     0.8332 0.948 0.000 0.000 0.000 0.000 NA
#> GSM876838     2  0.1549     0.8581 0.000 0.936 0.000 0.000 0.020 NA
#> GSM876839     2  0.2384     0.8372 0.000 0.884 0.000 0.000 0.032 NA
#> GSM876840     2  0.1644     0.8382 0.000 0.932 0.000 0.028 0.000 NA
#> GSM876841     2  0.3893     0.7234 0.000 0.768 0.000 0.000 0.140 NA
#> GSM876842     2  0.1594     0.8571 0.000 0.932 0.000 0.000 0.016 NA
#> GSM876843     2  0.3409     0.7273 0.000 0.808 0.000 0.144 0.004 NA
#> GSM876892     3  0.0767     0.9306 0.004 0.000 0.976 0.012 0.000 NA
#> GSM876893     3  0.0964     0.9290 0.004 0.000 0.968 0.012 0.000 NA
#> GSM876894     3  0.1124     0.9242 0.000 0.000 0.956 0.036 0.000 NA
#> GSM876895     5  0.6098     0.5538 0.100 0.068 0.000 0.084 0.668 NA
#> GSM876896     4  0.2135     0.6283 0.000 0.000 0.128 0.872 0.000 NA
#> GSM876897     4  0.2275     0.6250 0.000 0.000 0.096 0.888 0.008 NA
#> GSM876868     1  0.3646     0.6584 0.700 0.000 0.004 0.004 0.000 NA
#> GSM876869     1  0.3101     0.7183 0.756 0.000 0.000 0.000 0.000 NA
#> GSM876870     1  0.0777     0.8407 0.972 0.000 0.000 0.004 0.000 NA
#> GSM876871     1  0.0363     0.8426 0.988 0.000 0.000 0.000 0.000 NA
#> GSM876872     4  0.5501     0.1235 0.336 0.000 0.000 0.520 0.000 NA
#> GSM876873     1  0.5763     0.0957 0.464 0.000 0.000 0.356 0.000 NA
#> GSM876844     2  0.1168     0.8608 0.000 0.956 0.000 0.000 0.016 NA
#> GSM876845     2  0.3977     0.7139 0.000 0.760 0.000 0.000 0.144 NA
#> GSM876846     2  0.2401     0.8171 0.000 0.892 0.000 0.060 0.004 NA
#> GSM876847     5  0.5592     0.2929 0.000 0.368 0.000 0.000 0.484 NA
#> GSM876848     2  0.4628     0.3865 0.000 0.608 0.000 0.344 0.004 NA
#> GSM876849     4  0.4480     0.3034 0.000 0.304 0.000 0.648 0.004 NA
#> GSM876898     3  0.1167     0.9272 0.008 0.000 0.960 0.012 0.000 NA
#> GSM876899     3  0.1471     0.9103 0.000 0.000 0.932 0.064 0.000 NA
#> GSM876900     3  0.0260     0.9333 0.008 0.000 0.992 0.000 0.000 NA
#> GSM876901     3  0.0405     0.9334 0.008 0.000 0.988 0.004 0.000 NA
#> GSM876902     4  0.4136     0.5348 0.000 0.000 0.248 0.708 0.004 NA
#> GSM876903     3  0.6164     0.4220 0.000 0.004 0.600 0.192 0.128 NA
#> GSM876904     3  0.1452     0.9205 0.020 0.000 0.948 0.012 0.000 NA
#> GSM876874     1  0.2178     0.8011 0.868 0.000 0.000 0.000 0.000 NA
#> GSM876875     1  0.1461     0.8305 0.940 0.000 0.000 0.016 0.000 NA
#> GSM876876     1  0.0405     0.8426 0.988 0.000 0.004 0.000 0.000 NA
#> GSM876877     1  0.1075     0.8343 0.952 0.000 0.000 0.000 0.000 NA
#> GSM876878     1  0.0972     0.8388 0.964 0.000 0.000 0.008 0.000 NA
#> GSM876879     1  0.3608     0.7180 0.788 0.000 0.000 0.064 0.000 NA
#> GSM876880     1  0.0363     0.8411 0.988 0.000 0.000 0.000 0.000 NA
#> GSM876850     5  0.5683     0.3380 0.000 0.348 0.000 0.000 0.484 NA
#> GSM876851     2  0.3167     0.7982 0.000 0.832 0.000 0.000 0.072 NA
#> GSM876852     2  0.0405     0.8613 0.000 0.988 0.000 0.004 0.008 NA
#> GSM876853     2  0.2331     0.8392 0.000 0.888 0.000 0.000 0.032 NA
#> GSM876854     2  0.0146     0.8606 0.000 0.996 0.000 0.004 0.000 NA
#> GSM876855     2  0.1401     0.8494 0.000 0.948 0.000 0.020 0.004 NA
#> GSM876856     2  0.1572     0.8404 0.000 0.936 0.000 0.028 0.000 NA
#> GSM876905     3  0.0984     0.9289 0.008 0.000 0.968 0.012 0.000 NA
#> GSM876906     3  0.2106     0.8949 0.000 0.000 0.904 0.064 0.000 NA
#> GSM876907     5  0.4868     0.2196 0.000 0.000 0.396 0.052 0.548 NA
#> GSM876908     3  0.1845     0.9056 0.000 0.000 0.920 0.052 0.000 NA
#> GSM876909     5  0.3232     0.5846 0.000 0.000 0.160 0.008 0.812 NA
#> GSM876881     5  0.3727     0.6594 0.000 0.088 0.000 0.000 0.784 NA
#> GSM876882     1  0.3860     0.6950 0.764 0.000 0.000 0.072 0.000 NA
#> GSM876883     1  0.5437     0.4134 0.576 0.000 0.000 0.228 0.000 NA
#> GSM876884     1  0.1049     0.8378 0.960 0.000 0.000 0.008 0.000 NA
#> GSM876885     1  0.5539     0.3716 0.556 0.000 0.000 0.244 0.000 NA
#> GSM876857     1  0.2730     0.7609 0.808 0.000 0.000 0.000 0.000 NA
#> GSM876858     5  0.0748     0.7030 0.000 0.016 0.000 0.004 0.976 NA
#> GSM876859     5  0.0632     0.7055 0.000 0.024 0.000 0.000 0.976 NA
#> GSM876860     5  0.0603     0.7040 0.000 0.016 0.000 0.000 0.980 NA
#> GSM876861     5  0.0881     0.6967 0.000 0.012 0.000 0.008 0.972 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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) tissue(p) k
#> CV:NMF 70           0.9468  8.53e-12 2
#> CV:NMF 71           0.9992  4.63e-26 3
#> CV:NMF 50           0.9509  5.03e-16 4
#> CV:NMF 64           0.0262  6.73e-20 5
#> CV:NMF 62           0.0035  2.39e-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.


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 72 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.719           0.852       0.934         0.4985 0.499   0.499
#> 3 3 0.788           0.854       0.919         0.2489 0.844   0.687
#> 4 4 0.771           0.792       0.862         0.1349 0.949   0.854
#> 5 5 0.798           0.755       0.871         0.0250 0.984   0.947
#> 6 6 0.842           0.845       0.902         0.0831 0.897   0.654

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
#> GSM876886     1   0.000      0.985 1.000 0.000
#> GSM876887     1   0.000      0.985 1.000 0.000
#> GSM876888     1   0.000      0.985 1.000 0.000
#> GSM876889     1   0.971      0.139 0.600 0.400
#> GSM876890     1   0.000      0.985 1.000 0.000
#> GSM876891     2   0.994      0.341 0.456 0.544
#> GSM876862     1   0.000      0.985 1.000 0.000
#> GSM876863     1   0.000      0.985 1.000 0.000
#> GSM876864     1   0.000      0.985 1.000 0.000
#> GSM876865     1   0.000      0.985 1.000 0.000
#> GSM876866     1   0.000      0.985 1.000 0.000
#> GSM876867     1   0.000      0.985 1.000 0.000
#> GSM876838     2   0.000      0.881 0.000 1.000
#> GSM876839     2   0.000      0.881 0.000 1.000
#> GSM876840     2   0.000      0.881 0.000 1.000
#> GSM876841     2   0.000      0.881 0.000 1.000
#> GSM876842     2   0.000      0.881 0.000 1.000
#> GSM876843     2   0.000      0.881 0.000 1.000
#> GSM876892     1   0.000      0.985 1.000 0.000
#> GSM876893     1   0.000      0.985 1.000 0.000
#> GSM876894     2   0.994      0.341 0.456 0.544
#> GSM876895     2   0.929      0.566 0.344 0.656
#> GSM876896     2   0.000      0.881 0.000 1.000
#> GSM876897     2   0.000      0.881 0.000 1.000
#> GSM876868     1   0.000      0.985 1.000 0.000
#> GSM876869     1   0.000      0.985 1.000 0.000
#> GSM876870     1   0.000      0.985 1.000 0.000
#> GSM876871     1   0.000      0.985 1.000 0.000
#> GSM876872     2   0.260      0.858 0.044 0.956
#> GSM876873     2   0.260      0.858 0.044 0.956
#> GSM876844     2   0.000      0.881 0.000 1.000
#> GSM876845     2   0.000      0.881 0.000 1.000
#> GSM876846     2   0.000      0.881 0.000 1.000
#> GSM876847     2   0.000      0.881 0.000 1.000
#> GSM876848     2   0.000      0.881 0.000 1.000
#> GSM876849     2   0.000      0.881 0.000 1.000
#> GSM876898     1   0.000      0.985 1.000 0.000
#> GSM876899     2   0.929      0.566 0.344 0.656
#> GSM876900     1   0.000      0.985 1.000 0.000
#> GSM876901     1   0.000      0.985 1.000 0.000
#> GSM876902     2   0.118      0.873 0.016 0.984
#> GSM876903     2   0.929      0.566 0.344 0.656
#> GSM876904     1   0.000      0.985 1.000 0.000
#> GSM876874     1   0.000      0.985 1.000 0.000
#> GSM876875     1   0.000      0.985 1.000 0.000
#> GSM876876     1   0.000      0.985 1.000 0.000
#> GSM876877     1   0.000      0.985 1.000 0.000
#> GSM876878     1   0.000      0.985 1.000 0.000
#> GSM876879     1   0.000      0.985 1.000 0.000
#> GSM876880     1   0.000      0.985 1.000 0.000
#> GSM876850     2   0.000      0.881 0.000 1.000
#> GSM876851     2   0.000      0.881 0.000 1.000
#> GSM876852     2   0.000      0.881 0.000 1.000
#> GSM876853     2   0.000      0.881 0.000 1.000
#> GSM876854     2   0.000      0.881 0.000 1.000
#> GSM876855     2   0.000      0.881 0.000 1.000
#> GSM876856     2   0.000      0.881 0.000 1.000
#> GSM876905     1   0.000      0.985 1.000 0.000
#> GSM876906     2   0.994      0.341 0.456 0.544
#> GSM876907     2   0.929      0.566 0.344 0.656
#> GSM876908     2   0.994      0.341 0.456 0.544
#> GSM876909     2   0.929      0.566 0.344 0.656
#> GSM876881     2   0.000      0.881 0.000 1.000
#> GSM876882     1   0.000      0.985 1.000 0.000
#> GSM876883     2   0.943      0.509 0.360 0.640
#> GSM876884     1   0.000      0.985 1.000 0.000
#> GSM876885     2   0.943      0.509 0.360 0.640
#> GSM876857     1   0.000      0.985 1.000 0.000
#> GSM876858     2   0.000      0.881 0.000 1.000
#> GSM876859     2   0.000      0.881 0.000 1.000
#> GSM876860     2   0.000      0.881 0.000 1.000
#> GSM876861     2   0.000      0.881 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
#> GSM876886     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876887     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876888     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876889     1  0.6180    -0.0831 0.584 0.000 0.416
#> GSM876890     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876891     3  0.6215     0.5153 0.428 0.000 0.572
#> GSM876862     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876863     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876864     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876865     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876866     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876867     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876838     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876839     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876840     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876841     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876842     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876843     3  0.6111     0.2088 0.000 0.396 0.604
#> GSM876892     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876893     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876894     3  0.6215     0.5153 0.428 0.000 0.572
#> GSM876895     3  0.5621     0.6488 0.308 0.000 0.692
#> GSM876896     3  0.3412     0.5935 0.000 0.124 0.876
#> GSM876897     3  0.3412     0.5935 0.000 0.124 0.876
#> GSM876868     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876869     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876870     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876871     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876872     3  0.0424     0.6514 0.008 0.000 0.992
#> GSM876873     3  0.0424     0.6514 0.008 0.000 0.992
#> GSM876844     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876845     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876846     2  0.0892     0.9793 0.000 0.980 0.020
#> GSM876847     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876848     3  0.6095     0.2175 0.000 0.392 0.608
#> GSM876849     3  0.6095     0.2175 0.000 0.392 0.608
#> GSM876898     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876899     3  0.5621     0.6488 0.308 0.000 0.692
#> GSM876900     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876901     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876902     3  0.0892     0.6410 0.000 0.020 0.980
#> GSM876903     3  0.5621     0.6488 0.308 0.000 0.692
#> GSM876904     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876874     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876875     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876876     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876877     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876878     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876879     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876880     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876850     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876851     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876852     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876853     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876854     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876855     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876856     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876905     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876906     3  0.6215     0.5153 0.428 0.000 0.572
#> GSM876907     3  0.5621     0.6488 0.308 0.000 0.692
#> GSM876908     3  0.6215     0.5153 0.428 0.000 0.572
#> GSM876909     3  0.5621     0.6488 0.308 0.000 0.692
#> GSM876881     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876882     1  0.0747     0.9626 0.984 0.000 0.016
#> GSM876883     3  0.5760     0.5615 0.328 0.000 0.672
#> GSM876884     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876885     3  0.5760     0.5615 0.328 0.000 0.672
#> GSM876857     1  0.0000     0.9814 1.000 0.000 0.000
#> GSM876858     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876859     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876860     2  0.0000     0.9990 0.000 1.000 0.000
#> GSM876861     2  0.0000     0.9990 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
#> GSM876886     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876887     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876888     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876889     3  0.3219      0.637 0.164 0.000 0.836 0.000
#> GSM876890     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876891     3  0.0336      0.817 0.008 0.000 0.992 0.000
#> GSM876862     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876843     4  0.4697      0.582 0.000 0.356 0.000 0.644
#> GSM876892     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876893     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876894     3  0.0336      0.817 0.008 0.000 0.992 0.000
#> GSM876895     3  0.2530      0.806 0.000 0.000 0.888 0.112
#> GSM876896     4  0.1474      0.715 0.000 0.052 0.000 0.948
#> GSM876897     4  0.1474      0.715 0.000 0.052 0.000 0.948
#> GSM876868     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876872     4  0.3837      0.542 0.000 0.000 0.224 0.776
#> GSM876873     4  0.3837      0.542 0.000 0.000 0.224 0.776
#> GSM876844     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0707      0.975 0.000 0.980 0.000 0.020
#> GSM876847     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876848     4  0.4522      0.636 0.000 0.320 0.000 0.680
#> GSM876849     4  0.4522      0.636 0.000 0.320 0.000 0.680
#> GSM876898     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876899     3  0.2530      0.806 0.000 0.000 0.888 0.112
#> GSM876900     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876901     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876902     4  0.2053      0.664 0.000 0.004 0.072 0.924
#> GSM876903     3  0.2530      0.806 0.000 0.000 0.888 0.112
#> GSM876904     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876874     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876875     1  0.3074      0.751 0.848 0.000 0.152 0.000
#> GSM876876     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0817      0.795 0.976 0.000 0.024 0.000
#> GSM876879     1  0.3074      0.751 0.848 0.000 0.152 0.000
#> GSM876880     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876905     1  0.4888      0.578 0.588 0.000 0.412 0.000
#> GSM876906     3  0.0336      0.817 0.008 0.000 0.992 0.000
#> GSM876907     3  0.2530      0.806 0.000 0.000 0.888 0.112
#> GSM876908     3  0.0336      0.817 0.008 0.000 0.992 0.000
#> GSM876909     3  0.2530      0.806 0.000 0.000 0.888 0.112
#> GSM876881     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876882     1  0.3494      0.740 0.824 0.000 0.172 0.004
#> GSM876883     3  0.6810      0.438 0.156 0.000 0.596 0.248
#> GSM876884     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876885     3  0.6810      0.438 0.156 0.000 0.596 0.248
#> GSM876857     1  0.0000      0.800 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      0.999 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
#> GSM876886     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876887     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876888     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876889     5   0.328      0.557 0.156 0.000 0.020 0.000 0.824
#> GSM876890     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876891     5   0.000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM876862     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876867     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876841     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876843     4   0.242      0.618 0.000 0.132 0.000 0.868 0.000
#> GSM876892     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876893     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876894     5   0.000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM876895     5   0.279      0.850 0.000 0.000 0.064 0.056 0.880
#> GSM876896     4   0.430      0.419 0.000 0.000 0.472 0.528 0.000
#> GSM876897     4   0.430      0.419 0.000 0.000 0.472 0.528 0.000
#> GSM876868     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876872     3   0.121      0.298 0.000 0.000 0.960 0.016 0.024
#> GSM876873     3   0.121      0.298 0.000 0.000 0.960 0.016 0.024
#> GSM876844     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2   0.112      0.952 0.000 0.956 0.000 0.044 0.000
#> GSM876847     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4   0.141      0.679 0.000 0.060 0.000 0.940 0.000
#> GSM876849     4   0.141      0.679 0.000 0.060 0.000 0.940 0.000
#> GSM876898     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876899     5   0.279      0.850 0.000 0.000 0.064 0.056 0.880
#> GSM876900     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876901     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876902     3   0.481     -0.434 0.000 0.000 0.576 0.400 0.024
#> GSM876903     5   0.279      0.850 0.000 0.000 0.064 0.056 0.880
#> GSM876904     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876874     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1   0.365      0.729 0.816 0.000 0.036 0.004 0.144
#> GSM876876     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1   0.120      0.773 0.960 0.000 0.012 0.000 0.028
#> GSM876879     1   0.365      0.729 0.816 0.000 0.036 0.004 0.144
#> GSM876880     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876853     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876855     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876856     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876905     1   0.465      0.583 0.580 0.000 0.016 0.000 0.404
#> GSM876906     5   0.000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM876907     5   0.279      0.850 0.000 0.000 0.064 0.056 0.880
#> GSM876908     5   0.000      0.847 0.000 0.000 0.000 0.000 1.000
#> GSM876909     5   0.279      0.850 0.000 0.000 0.064 0.056 0.880
#> GSM876881     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876882     1   0.407      0.715 0.792 0.000 0.060 0.004 0.144
#> GSM876883     3   0.624      0.183 0.124 0.000 0.452 0.004 0.420
#> GSM876884     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876885     3   0.624      0.183 0.124 0.000 0.452 0.004 0.420
#> GSM876857     1   0.000      0.784 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2   0.000      0.998 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876887     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876888     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876889     3  0.3930     0.1130 0.000 0.000 0.576 0.000 0.420 0.004
#> GSM876890     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876891     5  0.2048     0.8717 0.000 0.000 0.120 0.000 0.880 0.000
#> GSM876862     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876841     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876843     6  0.4996     0.1527 0.000 0.072 0.000 0.408 0.000 0.520
#> GSM876892     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876893     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876894     5  0.2048     0.8717 0.000 0.000 0.120 0.000 0.880 0.000
#> GSM876895     5  0.0000     0.8996 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876896     4  0.1863     0.5697 0.000 0.000 0.000 0.896 0.000 0.104
#> GSM876897     4  0.1863     0.5697 0.000 0.000 0.000 0.896 0.000 0.104
#> GSM876868     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.3774     0.5203 0.000 0.000 0.000 0.592 0.000 0.408
#> GSM876873     4  0.3774     0.5203 0.000 0.000 0.000 0.592 0.000 0.408
#> GSM876844     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876845     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.1501     0.9184 0.000 0.924 0.000 0.000 0.000 0.076
#> GSM876847     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     6  0.3774     0.1781 0.000 0.000 0.000 0.408 0.000 0.592
#> GSM876849     6  0.3774     0.1781 0.000 0.000 0.000 0.408 0.000 0.592
#> GSM876898     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876899     5  0.0000     0.8996 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876900     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876901     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876902     4  0.0632     0.6052 0.000 0.000 0.000 0.976 0.000 0.024
#> GSM876903     5  0.0000     0.8996 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876874     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.3390     0.6685 0.704 0.000 0.296 0.000 0.000 0.000
#> GSM876876     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.1387     0.8970 0.932 0.000 0.068 0.000 0.000 0.000
#> GSM876879     1  0.3390     0.6685 0.704 0.000 0.296 0.000 0.000 0.000
#> GSM876880     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876853     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876855     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876856     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876905     3  0.2340     0.9488 0.148 0.000 0.852 0.000 0.000 0.000
#> GSM876906     5  0.2048     0.8717 0.000 0.000 0.120 0.000 0.880 0.000
#> GSM876907     5  0.0000     0.8996 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.2048     0.8717 0.000 0.000 0.120 0.000 0.880 0.000
#> GSM876909     5  0.0000     0.8996 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876882     1  0.4028     0.6199 0.668 0.000 0.308 0.000 0.000 0.024
#> GSM876883     6  0.6347     0.0901 0.000 0.000 0.308 0.012 0.276 0.404
#> GSM876884     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.6347     0.0901 0.000 0.000 0.308 0.012 0.276 0.404
#> GSM876857     1  0.0000     0.9472 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876859     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876860     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876861     2  0.0000     0.9962 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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) tissue(p) k
#> MAD:hclust 67           0.2518  6.18e-07 2
#> MAD:hclust 68           0.1897  6.32e-14 3
#> MAD:hclust 70           0.0649  1.96e-13 4
#> MAD:hclust 65           0.4679  2.58e-14 5
#> MAD:hclust 66           0.2298  8.09e-21 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 72 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.996       0.998         0.4981 0.503   0.503
#> 3 3 0.679           0.769       0.857         0.2918 0.775   0.579
#> 4 4 0.814           0.860       0.909         0.1293 0.813   0.529
#> 5 5 0.789           0.878       0.841         0.0623 0.948   0.806
#> 6 6 0.859           0.826       0.853         0.0434 0.961   0.825

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
#> GSM876886     1  0.0000      0.997 1.000 0.000
#> GSM876887     1  0.0000      0.997 1.000 0.000
#> GSM876888     1  0.0000      0.997 1.000 0.000
#> GSM876889     1  0.0000      0.997 1.000 0.000
#> GSM876890     1  0.0000      0.997 1.000 0.000
#> GSM876891     1  0.0000      0.997 1.000 0.000
#> GSM876862     1  0.0000      0.997 1.000 0.000
#> GSM876863     1  0.0000      0.997 1.000 0.000
#> GSM876864     1  0.0000      0.997 1.000 0.000
#> GSM876865     1  0.0000      0.997 1.000 0.000
#> GSM876866     1  0.0000      0.997 1.000 0.000
#> GSM876867     1  0.0000      0.997 1.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000
#> GSM876839     2  0.0000      1.000 0.000 1.000
#> GSM876840     2  0.0000      1.000 0.000 1.000
#> GSM876841     2  0.0000      1.000 0.000 1.000
#> GSM876842     2  0.0000      1.000 0.000 1.000
#> GSM876843     2  0.0000      1.000 0.000 1.000
#> GSM876892     1  0.0000      0.997 1.000 0.000
#> GSM876893     1  0.0000      0.997 1.000 0.000
#> GSM876894     1  0.0000      0.997 1.000 0.000
#> GSM876895     2  0.0000      1.000 0.000 1.000
#> GSM876896     2  0.0000      1.000 0.000 1.000
#> GSM876897     2  0.0000      1.000 0.000 1.000
#> GSM876868     1  0.0000      0.997 1.000 0.000
#> GSM876869     1  0.0000      0.997 1.000 0.000
#> GSM876870     1  0.0000      0.997 1.000 0.000
#> GSM876871     1  0.0000      0.997 1.000 0.000
#> GSM876872     1  0.0672      0.989 0.992 0.008
#> GSM876873     1  0.0000      0.997 1.000 0.000
#> GSM876844     2  0.0000      1.000 0.000 1.000
#> GSM876845     2  0.0000      1.000 0.000 1.000
#> GSM876846     2  0.0000      1.000 0.000 1.000
#> GSM876847     2  0.0000      1.000 0.000 1.000
#> GSM876848     2  0.0000      1.000 0.000 1.000
#> GSM876849     2  0.0000      1.000 0.000 1.000
#> GSM876898     1  0.0000      0.997 1.000 0.000
#> GSM876899     1  0.5059      0.874 0.888 0.112
#> GSM876900     1  0.0000      0.997 1.000 0.000
#> GSM876901     1  0.0000      0.997 1.000 0.000
#> GSM876902     2  0.0938      0.988 0.012 0.988
#> GSM876903     2  0.0000      1.000 0.000 1.000
#> GSM876904     1  0.0000      0.997 1.000 0.000
#> GSM876874     1  0.0000      0.997 1.000 0.000
#> GSM876875     1  0.0000      0.997 1.000 0.000
#> GSM876876     1  0.0000      0.997 1.000 0.000
#> GSM876877     1  0.0000      0.997 1.000 0.000
#> GSM876878     1  0.0000      0.997 1.000 0.000
#> GSM876879     1  0.0000      0.997 1.000 0.000
#> GSM876880     1  0.0000      0.997 1.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000
#> GSM876851     2  0.0000      1.000 0.000 1.000
#> GSM876852     2  0.0000      1.000 0.000 1.000
#> GSM876853     2  0.0000      1.000 0.000 1.000
#> GSM876854     2  0.0000      1.000 0.000 1.000
#> GSM876855     2  0.0000      1.000 0.000 1.000
#> GSM876856     2  0.0000      1.000 0.000 1.000
#> GSM876905     1  0.0000      0.997 1.000 0.000
#> GSM876906     1  0.0000      0.997 1.000 0.000
#> GSM876907     2  0.0000      1.000 0.000 1.000
#> GSM876908     1  0.0000      0.997 1.000 0.000
#> GSM876909     2  0.0000      1.000 0.000 1.000
#> GSM876881     2  0.0000      1.000 0.000 1.000
#> GSM876882     1  0.0000      0.997 1.000 0.000
#> GSM876883     1  0.0000      0.997 1.000 0.000
#> GSM876884     1  0.0000      0.997 1.000 0.000
#> GSM876885     1  0.0000      0.997 1.000 0.000
#> GSM876857     1  0.0000      0.997 1.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000
#> GSM876859     2  0.0000      1.000 0.000 1.000
#> GSM876860     2  0.0000      1.000 0.000 1.000
#> GSM876861     2  0.0000      1.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM876886     1   0.579      0.597 0.668 0.000 0.332
#> GSM876887     1   0.588      0.567 0.652 0.000 0.348
#> GSM876888     1   0.418      0.739 0.828 0.000 0.172
#> GSM876889     3   0.518      0.644 0.256 0.000 0.744
#> GSM876890     1   0.583      0.582 0.660 0.000 0.340
#> GSM876891     3   0.518      0.644 0.256 0.000 0.744
#> GSM876862     1   0.000      0.842 1.000 0.000 0.000
#> GSM876863     1   0.000      0.842 1.000 0.000 0.000
#> GSM876864     1   0.000      0.842 1.000 0.000 0.000
#> GSM876865     1   0.000      0.842 1.000 0.000 0.000
#> GSM876866     1   0.000      0.842 1.000 0.000 0.000
#> GSM876867     1   0.000      0.842 1.000 0.000 0.000
#> GSM876838     2   0.000      0.968 0.000 1.000 0.000
#> GSM876839     2   0.000      0.968 0.000 1.000 0.000
#> GSM876840     2   0.000      0.968 0.000 1.000 0.000
#> GSM876841     2   0.000      0.968 0.000 1.000 0.000
#> GSM876842     2   0.000      0.968 0.000 1.000 0.000
#> GSM876843     2   0.518      0.680 0.000 0.744 0.256
#> GSM876892     1   0.579      0.597 0.668 0.000 0.332
#> GSM876893     1   0.579      0.597 0.668 0.000 0.332
#> GSM876894     3   0.518      0.644 0.256 0.000 0.744
#> GSM876895     3   0.518      0.651 0.000 0.256 0.744
#> GSM876896     3   0.480      0.497 0.000 0.220 0.780
#> GSM876897     3   0.586      0.251 0.000 0.344 0.656
#> GSM876868     1   0.000      0.842 1.000 0.000 0.000
#> GSM876869     1   0.000      0.842 1.000 0.000 0.000
#> GSM876870     1   0.000      0.842 1.000 0.000 0.000
#> GSM876871     1   0.000      0.842 1.000 0.000 0.000
#> GSM876872     3   0.000      0.686 0.000 0.000 1.000
#> GSM876873     3   0.000      0.686 0.000 0.000 1.000
#> GSM876844     2   0.000      0.968 0.000 1.000 0.000
#> GSM876845     2   0.000      0.968 0.000 1.000 0.000
#> GSM876846     2   0.000      0.968 0.000 1.000 0.000
#> GSM876847     2   0.000      0.968 0.000 1.000 0.000
#> GSM876848     2   0.618      0.404 0.000 0.584 0.416
#> GSM876849     3   0.624     -0.074 0.000 0.440 0.560
#> GSM876898     1   0.579      0.597 0.668 0.000 0.332
#> GSM876899     3   0.537      0.646 0.252 0.004 0.744
#> GSM876900     1   0.579      0.597 0.668 0.000 0.332
#> GSM876901     1   0.579      0.597 0.668 0.000 0.332
#> GSM876902     3   0.000      0.686 0.000 0.000 1.000
#> GSM876903     3   0.518      0.651 0.000 0.256 0.744
#> GSM876904     1   0.579      0.597 0.668 0.000 0.332
#> GSM876874     1   0.000      0.842 1.000 0.000 0.000
#> GSM876875     1   0.000      0.842 1.000 0.000 0.000
#> GSM876876     1   0.000      0.842 1.000 0.000 0.000
#> GSM876877     1   0.000      0.842 1.000 0.000 0.000
#> GSM876878     1   0.000      0.842 1.000 0.000 0.000
#> GSM876879     1   0.000      0.842 1.000 0.000 0.000
#> GSM876880     1   0.000      0.842 1.000 0.000 0.000
#> GSM876850     2   0.000      0.968 0.000 1.000 0.000
#> GSM876851     2   0.000      0.968 0.000 1.000 0.000
#> GSM876852     2   0.000      0.968 0.000 1.000 0.000
#> GSM876853     2   0.000      0.968 0.000 1.000 0.000
#> GSM876854     2   0.000      0.968 0.000 1.000 0.000
#> GSM876855     2   0.000      0.968 0.000 1.000 0.000
#> GSM876856     2   0.000      0.968 0.000 1.000 0.000
#> GSM876905     1   0.579      0.597 0.668 0.000 0.332
#> GSM876906     3   0.518      0.644 0.256 0.000 0.744
#> GSM876907     3   0.518      0.651 0.000 0.256 0.744
#> GSM876908     3   0.518      0.644 0.256 0.000 0.744
#> GSM876909     3   0.518      0.651 0.000 0.256 0.744
#> GSM876881     2   0.000      0.968 0.000 1.000 0.000
#> GSM876882     1   0.280      0.791 0.908 0.000 0.092
#> GSM876883     3   0.518      0.644 0.256 0.000 0.744
#> GSM876884     1   0.000      0.842 1.000 0.000 0.000
#> GSM876885     3   0.518      0.644 0.256 0.000 0.744
#> GSM876857     1   0.000      0.842 1.000 0.000 0.000
#> GSM876858     2   0.000      0.968 0.000 1.000 0.000
#> GSM876859     2   0.000      0.968 0.000 1.000 0.000
#> GSM876860     2   0.000      0.968 0.000 1.000 0.000
#> GSM876861     2   0.000      0.968 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
#> GSM876886     3  0.4356      0.660 0.292 0.000 0.708 0.000
#> GSM876887     3  0.4456      0.665 0.280 0.000 0.716 0.004
#> GSM876888     3  0.4356      0.660 0.292 0.000 0.708 0.000
#> GSM876889     3  0.3893      0.627 0.008 0.000 0.796 0.196
#> GSM876890     3  0.4483      0.663 0.284 0.000 0.712 0.004
#> GSM876891     3  0.3725      0.629 0.008 0.000 0.812 0.180
#> GSM876862     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876840     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876842     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876843     4  0.4790      0.426 0.000 0.380 0.000 0.620
#> GSM876892     3  0.4356      0.660 0.292 0.000 0.708 0.000
#> GSM876893     3  0.4356      0.660 0.292 0.000 0.708 0.000
#> GSM876894     3  0.0524      0.634 0.008 0.000 0.988 0.004
#> GSM876895     3  0.4103      0.589 0.000 0.000 0.744 0.256
#> GSM876896     4  0.0376      0.875 0.000 0.004 0.004 0.992
#> GSM876897     4  0.1576      0.875 0.000 0.048 0.004 0.948
#> GSM876868     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM876873     4  0.0000      0.873 0.000 0.000 0.000 1.000
#> GSM876844     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876846     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876848     4  0.3024      0.799 0.000 0.148 0.000 0.852
#> GSM876849     4  0.1576      0.875 0.000 0.048 0.004 0.948
#> GSM876898     3  0.4356      0.660 0.292 0.000 0.708 0.000
#> GSM876899     3  0.4283      0.593 0.004 0.000 0.740 0.256
#> GSM876900     3  0.4356      0.660 0.292 0.000 0.708 0.000
#> GSM876901     3  0.4331      0.662 0.288 0.000 0.712 0.000
#> GSM876902     4  0.0188      0.872 0.000 0.000 0.004 0.996
#> GSM876903     3  0.4103      0.589 0.000 0.000 0.744 0.256
#> GSM876904     3  0.4356      0.660 0.292 0.000 0.708 0.000
#> GSM876874     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876876     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM876880     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876851     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876852     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> GSM876905     3  0.4356      0.660 0.292 0.000 0.708 0.000
#> GSM876906     3  0.3972      0.623 0.008 0.000 0.788 0.204
#> GSM876907     3  0.4103      0.589 0.000 0.000 0.744 0.256
#> GSM876908     3  0.3972      0.623 0.008 0.000 0.788 0.204
#> GSM876909     3  0.4103      0.589 0.000 0.000 0.744 0.256
#> GSM876881     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876882     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> GSM876883     3  0.4452      0.596 0.008 0.000 0.732 0.260
#> GSM876884     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876885     3  0.4452      0.596 0.008 0.000 0.732 0.260
#> GSM876857     1  0.0000      0.999 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876859     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876860     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> GSM876861     2  0.0336      0.996 0.000 0.992 0.008 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
#> GSM876886     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876887     3  0.2471      0.965 0.136 0.000 0.864 0.000 0.000
#> GSM876888     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876889     5  0.4937      0.788 0.000 0.000 0.428 0.028 0.544
#> GSM876890     3  0.2516      0.972 0.140 0.000 0.860 0.000 0.000
#> GSM876891     5  0.5086      0.808 0.000 0.000 0.396 0.040 0.564
#> GSM876862     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0771      0.915 0.000 0.976 0.020 0.000 0.004
#> GSM876839     2  0.0609      0.917 0.000 0.980 0.000 0.000 0.020
#> GSM876840     2  0.3758      0.867 0.000 0.824 0.112 0.008 0.056
#> GSM876841     2  0.0609      0.917 0.000 0.980 0.000 0.000 0.020
#> GSM876842     2  0.2331      0.898 0.000 0.900 0.080 0.000 0.020
#> GSM876843     4  0.6648      0.440 0.000 0.252 0.112 0.580 0.056
#> GSM876892     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876893     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876894     5  0.4256      0.758 0.000 0.000 0.436 0.000 0.564
#> GSM876895     5  0.5726      0.826 0.000 0.008 0.284 0.096 0.612
#> GSM876896     4  0.0404      0.826 0.000 0.000 0.000 0.988 0.012
#> GSM876897     4  0.0404      0.826 0.000 0.000 0.000 0.988 0.012
#> GSM876868     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.4437      0.693 0.000 0.000 0.020 0.664 0.316
#> GSM876873     4  0.4437      0.693 0.000 0.000 0.020 0.664 0.316
#> GSM876844     2  0.2331      0.898 0.000 0.900 0.080 0.000 0.020
#> GSM876845     2  0.0609      0.917 0.000 0.980 0.000 0.000 0.020
#> GSM876846     2  0.3807      0.866 0.000 0.820 0.116 0.008 0.056
#> GSM876847     2  0.0703      0.917 0.000 0.976 0.000 0.000 0.024
#> GSM876848     4  0.2653      0.792 0.000 0.052 0.020 0.900 0.028
#> GSM876849     4  0.0324      0.824 0.000 0.004 0.000 0.992 0.004
#> GSM876898     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876899     5  0.5652      0.827 0.000 0.000 0.344 0.092 0.564
#> GSM876900     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876901     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876902     4  0.0404      0.826 0.000 0.000 0.000 0.988 0.012
#> GSM876903     5  0.5726      0.826 0.000 0.008 0.284 0.096 0.612
#> GSM876904     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876874     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.1942      0.894 0.920 0.000 0.012 0.000 0.068
#> GSM876876     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.4571      0.605 0.664 0.000 0.020 0.004 0.312
#> GSM876880     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0703      0.917 0.000 0.976 0.000 0.000 0.024
#> GSM876851     2  0.0609      0.917 0.000 0.980 0.000 0.000 0.020
#> GSM876852     2  0.3477      0.871 0.000 0.832 0.112 0.000 0.056
#> GSM876853     2  0.0898      0.915 0.000 0.972 0.020 0.000 0.008
#> GSM876854     2  0.3758      0.867 0.000 0.824 0.112 0.008 0.056
#> GSM876855     2  0.3758      0.867 0.000 0.824 0.112 0.008 0.056
#> GSM876856     2  0.3758      0.867 0.000 0.824 0.112 0.008 0.056
#> GSM876905     3  0.2690      0.993 0.156 0.000 0.844 0.000 0.000
#> GSM876906     5  0.5294      0.820 0.000 0.000 0.380 0.056 0.564
#> GSM876907     5  0.5726      0.826 0.000 0.008 0.284 0.096 0.612
#> GSM876908     5  0.5294      0.820 0.000 0.000 0.380 0.056 0.564
#> GSM876909     5  0.5726      0.826 0.000 0.008 0.284 0.096 0.612
#> GSM876881     2  0.1670      0.903 0.000 0.936 0.012 0.000 0.052
#> GSM876882     1  0.4589      0.599 0.660 0.000 0.020 0.004 0.316
#> GSM876883     5  0.2932      0.519 0.000 0.000 0.104 0.032 0.864
#> GSM876884     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5  0.2932      0.519 0.000 0.000 0.104 0.032 0.864
#> GSM876857     1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.1774      0.903 0.000 0.932 0.016 0.000 0.052
#> GSM876859     2  0.1774      0.903 0.000 0.932 0.016 0.000 0.052
#> GSM876860     2  0.1774      0.903 0.000 0.932 0.016 0.000 0.052
#> GSM876861     2  0.1774      0.903 0.000 0.932 0.016 0.000 0.052

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.2200      0.924 0.080 0.000 0.900 0.004 0.004 0.012
#> GSM876887     3  0.2352      0.897 0.052 0.000 0.900 0.004 0.004 0.040
#> GSM876888     3  0.1556      0.933 0.080 0.000 0.920 0.000 0.000 0.000
#> GSM876889     3  0.5088     -0.209 0.000 0.000 0.516 0.004 0.412 0.068
#> GSM876890     3  0.2173      0.914 0.064 0.000 0.904 0.004 0.000 0.028
#> GSM876891     5  0.3190      0.927 0.000 0.000 0.220 0.000 0.772 0.008
#> GSM876862     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0146      0.972 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM876864     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0146      0.972 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM876866     1  0.0146      0.972 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM876867     1  0.0405      0.971 0.988 0.000 0.000 0.004 0.008 0.000
#> GSM876838     2  0.2115      0.835 0.000 0.916 0.032 0.032 0.020 0.000
#> GSM876839     2  0.0000      0.840 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.4900      0.720 0.000 0.624 0.032 0.312 0.032 0.000
#> GSM876841     2  0.0000      0.840 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.3117      0.821 0.000 0.848 0.032 0.100 0.020 0.000
#> GSM876843     4  0.1692      0.510 0.000 0.048 0.000 0.932 0.012 0.008
#> GSM876892     3  0.1700      0.935 0.080 0.000 0.916 0.000 0.004 0.000
#> GSM876893     3  0.1700      0.935 0.080 0.000 0.916 0.000 0.004 0.000
#> GSM876894     5  0.3217      0.924 0.000 0.000 0.224 0.000 0.768 0.008
#> GSM876895     5  0.2765      0.915 0.000 0.016 0.132 0.004 0.848 0.000
#> GSM876896     4  0.4015      0.856 0.000 0.000 0.000 0.616 0.012 0.372
#> GSM876897     4  0.4015      0.856 0.000 0.000 0.000 0.616 0.012 0.372
#> GSM876868     1  0.0146      0.972 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM876869     1  0.0146      0.972 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM876870     1  0.0993      0.965 0.964 0.000 0.000 0.012 0.024 0.000
#> GSM876871     1  0.0820      0.968 0.972 0.000 0.000 0.012 0.016 0.000
#> GSM876872     6  0.1075      0.316 0.000 0.000 0.000 0.048 0.000 0.952
#> GSM876873     6  0.1075      0.316 0.000 0.000 0.000 0.048 0.000 0.952
#> GSM876844     2  0.3117      0.821 0.000 0.848 0.032 0.100 0.020 0.000
#> GSM876845     2  0.0146      0.840 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM876846     2  0.4601      0.704 0.000 0.612 0.020 0.348 0.020 0.000
#> GSM876847     2  0.0146      0.840 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM876848     4  0.3586      0.829 0.000 0.000 0.000 0.720 0.012 0.268
#> GSM876849     4  0.3819      0.851 0.000 0.000 0.000 0.672 0.012 0.316
#> GSM876898     3  0.1700      0.935 0.080 0.000 0.916 0.000 0.004 0.000
#> GSM876899     5  0.3023      0.930 0.000 0.000 0.212 0.000 0.784 0.004
#> GSM876900     3  0.1700      0.935 0.080 0.000 0.916 0.000 0.004 0.000
#> GSM876901     3  0.1700      0.935 0.080 0.000 0.916 0.000 0.004 0.000
#> GSM876902     4  0.4057      0.847 0.000 0.000 0.000 0.600 0.012 0.388
#> GSM876903     5  0.2765      0.915 0.000 0.016 0.132 0.004 0.848 0.000
#> GSM876904     3  0.1700      0.935 0.080 0.000 0.916 0.000 0.004 0.000
#> GSM876874     1  0.0000      0.972 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.3649      0.721 0.800 0.000 0.004 0.000 0.084 0.112
#> GSM876876     1  0.0820      0.968 0.972 0.000 0.000 0.012 0.016 0.000
#> GSM876877     1  0.0820      0.968 0.972 0.000 0.000 0.012 0.016 0.000
#> GSM876878     1  0.0993      0.965 0.964 0.000 0.000 0.012 0.024 0.000
#> GSM876879     6  0.5125      0.444 0.360 0.000 0.004 0.000 0.080 0.556
#> GSM876880     1  0.0820      0.968 0.972 0.000 0.000 0.012 0.016 0.000
#> GSM876850     2  0.0146      0.840 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.840 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.4852      0.728 0.000 0.636 0.032 0.300 0.032 0.000
#> GSM876853     2  0.2188      0.835 0.000 0.912 0.032 0.036 0.020 0.000
#> GSM876854     2  0.4900      0.720 0.000 0.624 0.032 0.312 0.032 0.000
#> GSM876855     2  0.4900      0.720 0.000 0.624 0.032 0.312 0.032 0.000
#> GSM876856     2  0.4900      0.720 0.000 0.624 0.032 0.312 0.032 0.000
#> GSM876905     3  0.1700      0.935 0.080 0.000 0.916 0.000 0.004 0.000
#> GSM876906     5  0.3161      0.930 0.000 0.000 0.216 0.000 0.776 0.008
#> GSM876907     5  0.2765      0.915 0.000 0.016 0.132 0.004 0.848 0.000
#> GSM876908     5  0.3161      0.930 0.000 0.000 0.216 0.000 0.776 0.008
#> GSM876909     5  0.2765      0.915 0.000 0.016 0.132 0.004 0.848 0.000
#> GSM876881     2  0.1842      0.817 0.000 0.932 0.012 0.008 0.036 0.012
#> GSM876882     6  0.5032      0.513 0.324 0.000 0.008 0.000 0.072 0.596
#> GSM876883     6  0.4551      0.463 0.000 0.000 0.048 0.000 0.344 0.608
#> GSM876884     1  0.0993      0.965 0.964 0.000 0.000 0.012 0.024 0.000
#> GSM876885     6  0.4551      0.463 0.000 0.000 0.048 0.000 0.344 0.608
#> GSM876857     1  0.0146      0.972 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM876858     2  0.3366      0.796 0.000 0.844 0.048 0.012 0.084 0.012
#> GSM876859     2  0.3366      0.796 0.000 0.844 0.048 0.012 0.084 0.012
#> GSM876860     2  0.3366      0.796 0.000 0.844 0.048 0.012 0.084 0.012
#> GSM876861     2  0.3366      0.796 0.000 0.844 0.048 0.012 0.084 0.012

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) tissue(p) k
#> MAD:kmeans 72           0.7703  2.85e-10 2
#> MAD:kmeans 68           0.4351  8.84e-14 3
#> MAD:kmeans 71           0.0485  1.41e-20 4
#> MAD:kmeans 71           0.0257  1.63e-19 5
#> MAD:kmeans 66           0.3125  2.35e-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.


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

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

collect_plots(res)

plot of chunk MAD-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.993       0.997         0.5018 0.499   0.499
#> 3 3 0.780           0.645       0.845         0.3032 0.892   0.790
#> 4 4 1.000           0.945       0.977         0.1173 0.785   0.523
#> 5 5 0.989           0.946       0.976         0.0601 0.924   0.730
#> 6 6 0.979           0.941       0.961         0.0341 0.965   0.845

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1  0.0000      0.995 1.000 0.000
#> GSM876887     1  0.0000      0.995 1.000 0.000
#> GSM876888     1  0.0000      0.995 1.000 0.000
#> GSM876889     1  0.0000      0.995 1.000 0.000
#> GSM876890     1  0.0000      0.995 1.000 0.000
#> GSM876891     1  0.0000      0.995 1.000 0.000
#> GSM876862     1  0.0000      0.995 1.000 0.000
#> GSM876863     1  0.0000      0.995 1.000 0.000
#> GSM876864     1  0.0000      0.995 1.000 0.000
#> GSM876865     1  0.0000      0.995 1.000 0.000
#> GSM876866     1  0.0000      0.995 1.000 0.000
#> GSM876867     1  0.0000      0.995 1.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000
#> GSM876839     2  0.0000      1.000 0.000 1.000
#> GSM876840     2  0.0000      1.000 0.000 1.000
#> GSM876841     2  0.0000      1.000 0.000 1.000
#> GSM876842     2  0.0000      1.000 0.000 1.000
#> GSM876843     2  0.0000      1.000 0.000 1.000
#> GSM876892     1  0.0000      0.995 1.000 0.000
#> GSM876893     1  0.0000      0.995 1.000 0.000
#> GSM876894     1  0.0000      0.995 1.000 0.000
#> GSM876895     2  0.0000      1.000 0.000 1.000
#> GSM876896     2  0.0000      1.000 0.000 1.000
#> GSM876897     2  0.0000      1.000 0.000 1.000
#> GSM876868     1  0.0000      0.995 1.000 0.000
#> GSM876869     1  0.0000      0.995 1.000 0.000
#> GSM876870     1  0.0000      0.995 1.000 0.000
#> GSM876871     1  0.0000      0.995 1.000 0.000
#> GSM876872     1  0.7219      0.751 0.800 0.200
#> GSM876873     1  0.0938      0.983 0.988 0.012
#> GSM876844     2  0.0000      1.000 0.000 1.000
#> GSM876845     2  0.0000      1.000 0.000 1.000
#> GSM876846     2  0.0000      1.000 0.000 1.000
#> GSM876847     2  0.0000      1.000 0.000 1.000
#> GSM876848     2  0.0000      1.000 0.000 1.000
#> GSM876849     2  0.0000      1.000 0.000 1.000
#> GSM876898     1  0.0000      0.995 1.000 0.000
#> GSM876899     2  0.0000      1.000 0.000 1.000
#> GSM876900     1  0.0000      0.995 1.000 0.000
#> GSM876901     1  0.0000      0.995 1.000 0.000
#> GSM876902     2  0.0000      1.000 0.000 1.000
#> GSM876903     2  0.0000      1.000 0.000 1.000
#> GSM876904     1  0.0000      0.995 1.000 0.000
#> GSM876874     1  0.0000      0.995 1.000 0.000
#> GSM876875     1  0.0000      0.995 1.000 0.000
#> GSM876876     1  0.0000      0.995 1.000 0.000
#> GSM876877     1  0.0000      0.995 1.000 0.000
#> GSM876878     1  0.0000      0.995 1.000 0.000
#> GSM876879     1  0.0000      0.995 1.000 0.000
#> GSM876880     1  0.0000      0.995 1.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000
#> GSM876851     2  0.0000      1.000 0.000 1.000
#> GSM876852     2  0.0000      1.000 0.000 1.000
#> GSM876853     2  0.0000      1.000 0.000 1.000
#> GSM876854     2  0.0000      1.000 0.000 1.000
#> GSM876855     2  0.0000      1.000 0.000 1.000
#> GSM876856     2  0.0000      1.000 0.000 1.000
#> GSM876905     1  0.0000      0.995 1.000 0.000
#> GSM876906     1  0.0000      0.995 1.000 0.000
#> GSM876907     2  0.0000      1.000 0.000 1.000
#> GSM876908     1  0.0000      0.995 1.000 0.000
#> GSM876909     2  0.0000      1.000 0.000 1.000
#> GSM876881     2  0.0000      1.000 0.000 1.000
#> GSM876882     1  0.0000      0.995 1.000 0.000
#> GSM876883     1  0.0000      0.995 1.000 0.000
#> GSM876884     1  0.0000      0.995 1.000 0.000
#> GSM876885     1  0.0000      0.995 1.000 0.000
#> GSM876857     1  0.0000      0.995 1.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000
#> GSM876859     2  0.0000      1.000 0.000 1.000
#> GSM876860     2  0.0000      1.000 0.000 1.000
#> GSM876861     2  0.0000      1.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM876886     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876887     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876888     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876889     3  0.6682     0.9617 0.008 0.488 0.504
#> GSM876890     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876891     3  0.7289     0.9769 0.028 0.468 0.504
#> GSM876862     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876863     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876864     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876865     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876866     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876867     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876838     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876839     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876840     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876841     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876842     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876843     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876892     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876893     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876894     3  0.7289     0.9769 0.028 0.468 0.504
#> GSM876895     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876896     2  0.0424     0.2807 0.000 0.992 0.008
#> GSM876897     2  0.0424     0.2807 0.000 0.992 0.008
#> GSM876868     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876869     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876870     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876871     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876872     2  0.6291    -0.4081 0.468 0.532 0.000
#> GSM876873     1  0.6309    -0.0545 0.504 0.496 0.000
#> GSM876844     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876845     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876846     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876847     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876848     2  0.6291     0.8425 0.000 0.532 0.468
#> GSM876849     2  0.5678     0.7197 0.000 0.684 0.316
#> GSM876898     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876899     3  0.6308     0.9205 0.000 0.492 0.508
#> GSM876900     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876901     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876902     2  0.0000     0.2633 0.000 1.000 0.000
#> GSM876903     2  0.1411     0.2906 0.000 0.964 0.036
#> GSM876904     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876874     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876875     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876876     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876877     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876878     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876879     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876880     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876850     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876851     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876852     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876853     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876854     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876855     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876856     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876905     1  0.6309     0.3075 0.504 0.000 0.496
#> GSM876906     3  0.7289     0.9769 0.028 0.468 0.504
#> GSM876907     2  0.1411     0.2906 0.000 0.964 0.036
#> GSM876908     3  0.7289     0.9769 0.028 0.468 0.504
#> GSM876909     2  0.1860     0.3204 0.000 0.948 0.052
#> GSM876881     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876882     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876883     1  0.6302    -0.0282 0.520 0.480 0.000
#> GSM876884     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876885     1  0.6307    -0.0379 0.512 0.488 0.000
#> GSM876857     1  0.0000     0.7348 1.000 0.000 0.000
#> GSM876858     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876859     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876860     2  0.6309     0.8611 0.000 0.504 0.496
#> GSM876861     2  0.6309     0.8611 0.000 0.504 0.496

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876887     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876888     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876889     3  0.0707     0.9734 0.000 0.000 0.980 0.020
#> GSM876890     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876891     3  0.0000     0.9771 0.000 0.000 1.000 0.000
#> GSM876862     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876843     4  0.3649     0.7105 0.000 0.204 0.000 0.796
#> GSM876892     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876893     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876894     3  0.0000     0.9771 0.000 0.000 1.000 0.000
#> GSM876895     2  0.1042     0.9757 0.000 0.972 0.020 0.008
#> GSM876896     4  0.0336     0.9020 0.000 0.008 0.000 0.992
#> GSM876897     4  0.0336     0.9020 0.000 0.008 0.000 0.992
#> GSM876868     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0376     0.8999 0.004 0.004 0.000 0.992
#> GSM876873     4  0.0336     0.8965 0.008 0.000 0.000 0.992
#> GSM876844     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876848     4  0.0336     0.9020 0.000 0.008 0.000 0.992
#> GSM876849     4  0.0336     0.9020 0.000 0.008 0.000 0.992
#> GSM876898     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876899     3  0.1452     0.9375 0.000 0.036 0.956 0.008
#> GSM876900     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876901     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876902     4  0.0336     0.9020 0.000 0.008 0.000 0.992
#> GSM876903     2  0.1042     0.9757 0.000 0.972 0.020 0.008
#> GSM876904     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876874     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876876     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876880     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876905     3  0.0707     0.9873 0.020 0.000 0.980 0.000
#> GSM876906     3  0.0336     0.9738 0.000 0.000 0.992 0.008
#> GSM876907     2  0.1042     0.9757 0.000 0.972 0.020 0.008
#> GSM876908     3  0.0336     0.9738 0.000 0.000 0.992 0.008
#> GSM876909     2  0.1042     0.9757 0.000 0.972 0.020 0.008
#> GSM876881     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876882     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876883     1  0.4977     0.0413 0.540 0.000 0.000 0.460
#> GSM876884     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876885     4  0.4999    -0.0125 0.492 0.000 0.000 0.508
#> GSM876857     1  0.0000     0.9747 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000     0.9954 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000     0.9954 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
#> GSM876886     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876887     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876888     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876889     3  0.0162      0.985 0.000 0.000 0.996 0.004 0.000
#> GSM876890     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876891     3  0.0162      0.985 0.000 0.000 0.996 0.000 0.004
#> GSM876862     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876841     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876843     2  0.3999      0.475 0.000 0.656 0.000 0.344 0.000
#> GSM876892     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876893     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876894     3  0.2424      0.845 0.000 0.000 0.868 0.000 0.132
#> GSM876895     5  0.2329      0.846 0.000 0.124 0.000 0.000 0.876
#> GSM876896     4  0.0000      0.866 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000      0.866 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0703      0.860 0.000 0.000 0.000 0.976 0.024
#> GSM876873     4  0.0703      0.860 0.000 0.000 0.000 0.976 0.024
#> GSM876844     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876847     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4  0.0290      0.861 0.000 0.008 0.000 0.992 0.000
#> GSM876849     4  0.0000      0.866 0.000 0.000 0.000 1.000 0.000
#> GSM876898     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876899     5  0.0880      0.944 0.000 0.000 0.032 0.000 0.968
#> GSM876900     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876901     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876902     4  0.0000      0.866 0.000 0.000 0.000 1.000 0.000
#> GSM876903     5  0.0880      0.951 0.000 0.032 0.000 0.000 0.968
#> GSM876904     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876874     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.0451      0.987 0.988 0.000 0.004 0.000 0.008
#> GSM876876     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1  0.1041      0.966 0.964 0.000 0.004 0.000 0.032
#> GSM876880     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876853     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876855     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876856     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876905     3  0.0162      0.989 0.004 0.000 0.996 0.000 0.000
#> GSM876906     5  0.0880      0.944 0.000 0.000 0.032 0.000 0.968
#> GSM876907     5  0.0880      0.951 0.000 0.032 0.000 0.000 0.968
#> GSM876908     5  0.0880      0.944 0.000 0.000 0.032 0.000 0.968
#> GSM876909     5  0.0880      0.951 0.000 0.032 0.000 0.000 0.968
#> GSM876881     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876882     1  0.1041      0.966 0.964 0.000 0.004 0.000 0.032
#> GSM876883     4  0.5137      0.330 0.416 0.000 0.004 0.548 0.032
#> GSM876884     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876885     4  0.4672      0.597 0.284 0.000 0.004 0.680 0.032
#> GSM876857     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      0.982 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876887     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876888     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876889     3  0.0260      0.981 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM876890     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876891     3  0.0363      0.978 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM876862     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876843     4  0.0547      0.964 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM876892     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876894     3  0.2653      0.820 0.000 0.000 0.844 0.000 0.144 0.012
#> GSM876895     5  0.2340      0.755 0.000 0.148 0.000 0.000 0.852 0.000
#> GSM876896     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876897     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876868     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     6  0.3578      0.471 0.000 0.000 0.000 0.340 0.000 0.660
#> GSM876873     6  0.3499      0.501 0.000 0.000 0.000 0.320 0.000 0.680
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     4  0.0146      0.988 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM876849     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876898     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876899     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876900     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876901     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876902     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876903     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876874     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     1  0.3409      0.545 0.700 0.000 0.000 0.000 0.000 0.300
#> GSM876876     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876879     6  0.3684      0.315 0.372 0.000 0.000 0.000 0.000 0.628
#> GSM876880     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876905     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876906     5  0.0260      0.956 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM876907     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.0260      0.956 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM876909     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876882     6  0.0458      0.730 0.016 0.000 0.000 0.000 0.000 0.984
#> GSM876883     6  0.0405      0.732 0.008 0.000 0.000 0.004 0.000 0.988
#> GSM876884     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.0405      0.730 0.004 0.000 0.000 0.008 0.000 0.988
#> GSM876857     1  0.0000      0.981 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-skmeans-collect-classes

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

test_to_known_factors(res)
#>              n disease.state(p) tissue(p) k
#> MAD:skmeans 72           0.7433  5.51e-10 2
#> MAD:skmeans 51           0.9173  2.24e-17 3
#> MAD:skmeans 70           0.1218  4.52e-18 4
#> MAD:skmeans 70           0.0351  1.07e-20 5
#> MAD:skmeans 70           0.0507  5.87e-21 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 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.974       0.990         0.5050 0.495   0.495
#> 3 3 0.981           0.938       0.976         0.3343 0.712   0.481
#> 4 4 0.884           0.832       0.914         0.0958 0.907   0.724
#> 5 5 1.000           0.957       0.984         0.0636 0.933   0.751
#> 6 6 0.996           0.965       0.978         0.0270 0.940   0.744

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1   0.000      0.996 1.000 0.000
#> GSM876887     1   0.000      0.996 1.000 0.000
#> GSM876888     1   0.000      0.996 1.000 0.000
#> GSM876889     1   0.000      0.996 1.000 0.000
#> GSM876890     1   0.000      0.996 1.000 0.000
#> GSM876891     1   0.163      0.972 0.976 0.024
#> GSM876862     1   0.000      0.996 1.000 0.000
#> GSM876863     1   0.000      0.996 1.000 0.000
#> GSM876864     1   0.000      0.996 1.000 0.000
#> GSM876865     1   0.000      0.996 1.000 0.000
#> GSM876866     1   0.000      0.996 1.000 0.000
#> GSM876867     1   0.000      0.996 1.000 0.000
#> GSM876838     2   0.000      0.981 0.000 1.000
#> GSM876839     2   0.000      0.981 0.000 1.000
#> GSM876840     2   0.000      0.981 0.000 1.000
#> GSM876841     2   0.000      0.981 0.000 1.000
#> GSM876842     2   0.000      0.981 0.000 1.000
#> GSM876843     2   0.000      0.981 0.000 1.000
#> GSM876892     1   0.000      0.996 1.000 0.000
#> GSM876893     1   0.000      0.996 1.000 0.000
#> GSM876894     1   0.000      0.996 1.000 0.000
#> GSM876895     2   0.000      0.981 0.000 1.000
#> GSM876896     2   0.000      0.981 0.000 1.000
#> GSM876897     2   0.000      0.981 0.000 1.000
#> GSM876868     1   0.000      0.996 1.000 0.000
#> GSM876869     1   0.000      0.996 1.000 0.000
#> GSM876870     1   0.000      0.996 1.000 0.000
#> GSM876871     1   0.000      0.996 1.000 0.000
#> GSM876872     1   0.529      0.860 0.880 0.120
#> GSM876873     1   0.000      0.996 1.000 0.000
#> GSM876844     2   0.000      0.981 0.000 1.000
#> GSM876845     2   0.000      0.981 0.000 1.000
#> GSM876846     2   0.000      0.981 0.000 1.000
#> GSM876847     2   0.000      0.981 0.000 1.000
#> GSM876848     2   0.000      0.981 0.000 1.000
#> GSM876849     2   0.000      0.981 0.000 1.000
#> GSM876898     1   0.000      0.996 1.000 0.000
#> GSM876899     2   0.000      0.981 0.000 1.000
#> GSM876900     1   0.000      0.996 1.000 0.000
#> GSM876901     1   0.000      0.996 1.000 0.000
#> GSM876902     2   0.000      0.981 0.000 1.000
#> GSM876903     2   0.000      0.981 0.000 1.000
#> GSM876904     1   0.000      0.996 1.000 0.000
#> GSM876874     1   0.000      0.996 1.000 0.000
#> GSM876875     1   0.000      0.996 1.000 0.000
#> GSM876876     1   0.000      0.996 1.000 0.000
#> GSM876877     1   0.000      0.996 1.000 0.000
#> GSM876878     1   0.000      0.996 1.000 0.000
#> GSM876879     1   0.000      0.996 1.000 0.000
#> GSM876880     1   0.000      0.996 1.000 0.000
#> GSM876850     2   0.000      0.981 0.000 1.000
#> GSM876851     2   0.000      0.981 0.000 1.000
#> GSM876852     2   0.000      0.981 0.000 1.000
#> GSM876853     2   0.000      0.981 0.000 1.000
#> GSM876854     2   0.000      0.981 0.000 1.000
#> GSM876855     2   0.000      0.981 0.000 1.000
#> GSM876856     2   0.000      0.981 0.000 1.000
#> GSM876905     1   0.000      0.996 1.000 0.000
#> GSM876906     2   0.975      0.325 0.408 0.592
#> GSM876907     2   0.000      0.981 0.000 1.000
#> GSM876908     2   0.730      0.743 0.204 0.796
#> GSM876909     2   0.000      0.981 0.000 1.000
#> GSM876881     2   0.000      0.981 0.000 1.000
#> GSM876882     1   0.000      0.996 1.000 0.000
#> GSM876883     1   0.000      0.996 1.000 0.000
#> GSM876884     1   0.000      0.996 1.000 0.000
#> GSM876885     1   0.000      0.996 1.000 0.000
#> GSM876857     1   0.000      0.996 1.000 0.000
#> GSM876858     2   0.000      0.981 0.000 1.000
#> GSM876859     2   0.000      0.981 0.000 1.000
#> GSM876860     2   0.000      0.981 0.000 1.000
#> GSM876861     2   0.000      0.981 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
#> GSM876886     3   0.559      0.564 0.304 0.000 0.696
#> GSM876887     3   0.000      0.955 0.000 0.000 1.000
#> GSM876888     1   0.000      0.980 1.000 0.000 0.000
#> GSM876889     3   0.000      0.955 0.000 0.000 1.000
#> GSM876890     3   0.000      0.955 0.000 0.000 1.000
#> GSM876891     3   0.000      0.955 0.000 0.000 1.000
#> GSM876862     1   0.000      0.980 1.000 0.000 0.000
#> GSM876863     1   0.000      0.980 1.000 0.000 0.000
#> GSM876864     1   0.000      0.980 1.000 0.000 0.000
#> GSM876865     1   0.000      0.980 1.000 0.000 0.000
#> GSM876866     1   0.000      0.980 1.000 0.000 0.000
#> GSM876867     1   0.000      0.980 1.000 0.000 0.000
#> GSM876838     2   0.000      0.986 0.000 1.000 0.000
#> GSM876839     2   0.000      0.986 0.000 1.000 0.000
#> GSM876840     2   0.000      0.986 0.000 1.000 0.000
#> GSM876841     2   0.000      0.986 0.000 1.000 0.000
#> GSM876842     2   0.000      0.986 0.000 1.000 0.000
#> GSM876843     2   0.000      0.986 0.000 1.000 0.000
#> GSM876892     3   0.000      0.955 0.000 0.000 1.000
#> GSM876893     3   0.245      0.886 0.076 0.000 0.924
#> GSM876894     3   0.000      0.955 0.000 0.000 1.000
#> GSM876895     3   0.000      0.955 0.000 0.000 1.000
#> GSM876896     3   0.613      0.307 0.000 0.400 0.600
#> GSM876897     2   0.562      0.543 0.000 0.692 0.308
#> GSM876868     1   0.000      0.980 1.000 0.000 0.000
#> GSM876869     1   0.000      0.980 1.000 0.000 0.000
#> GSM876870     1   0.000      0.980 1.000 0.000 0.000
#> GSM876871     1   0.000      0.980 1.000 0.000 0.000
#> GSM876872     3   0.000      0.955 0.000 0.000 1.000
#> GSM876873     3   0.000      0.955 0.000 0.000 1.000
#> GSM876844     2   0.000      0.986 0.000 1.000 0.000
#> GSM876845     2   0.000      0.986 0.000 1.000 0.000
#> GSM876846     2   0.000      0.986 0.000 1.000 0.000
#> GSM876847     2   0.000      0.986 0.000 1.000 0.000
#> GSM876848     2   0.000      0.986 0.000 1.000 0.000
#> GSM876849     2   0.000      0.986 0.000 1.000 0.000
#> GSM876898     3   0.000      0.955 0.000 0.000 1.000
#> GSM876899     3   0.000      0.955 0.000 0.000 1.000
#> GSM876900     3   0.000      0.955 0.000 0.000 1.000
#> GSM876901     3   0.000      0.955 0.000 0.000 1.000
#> GSM876902     3   0.000      0.955 0.000 0.000 1.000
#> GSM876903     3   0.000      0.955 0.000 0.000 1.000
#> GSM876904     3   0.000      0.955 0.000 0.000 1.000
#> GSM876874     1   0.000      0.980 1.000 0.000 0.000
#> GSM876875     1   0.000      0.980 1.000 0.000 0.000
#> GSM876876     1   0.000      0.980 1.000 0.000 0.000
#> GSM876877     1   0.000      0.980 1.000 0.000 0.000
#> GSM876878     1   0.000      0.980 1.000 0.000 0.000
#> GSM876879     1   0.000      0.980 1.000 0.000 0.000
#> GSM876880     1   0.000      0.980 1.000 0.000 0.000
#> GSM876850     2   0.000      0.986 0.000 1.000 0.000
#> GSM876851     2   0.000      0.986 0.000 1.000 0.000
#> GSM876852     2   0.000      0.986 0.000 1.000 0.000
#> GSM876853     2   0.000      0.986 0.000 1.000 0.000
#> GSM876854     2   0.000      0.986 0.000 1.000 0.000
#> GSM876855     2   0.000      0.986 0.000 1.000 0.000
#> GSM876856     2   0.000      0.986 0.000 1.000 0.000
#> GSM876905     3   0.529      0.629 0.268 0.000 0.732
#> GSM876906     3   0.000      0.955 0.000 0.000 1.000
#> GSM876907     3   0.000      0.955 0.000 0.000 1.000
#> GSM876908     3   0.000      0.955 0.000 0.000 1.000
#> GSM876909     3   0.000      0.955 0.000 0.000 1.000
#> GSM876881     2   0.000      0.986 0.000 1.000 0.000
#> GSM876882     1   0.608      0.347 0.612 0.000 0.388
#> GSM876883     3   0.000      0.955 0.000 0.000 1.000
#> GSM876884     1   0.000      0.980 1.000 0.000 0.000
#> GSM876885     3   0.000      0.955 0.000 0.000 1.000
#> GSM876857     1   0.000      0.980 1.000 0.000 0.000
#> GSM876858     2   0.000      0.986 0.000 1.000 0.000
#> GSM876859     2   0.000      0.986 0.000 1.000 0.000
#> GSM876860     2   0.000      0.986 0.000 1.000 0.000
#> GSM876861     2   0.000      0.986 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
#> GSM876886     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876887     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876888     3  0.0188      0.987 0.004 0.000 0.996 0.000
#> GSM876889     3  0.0592      0.976 0.000 0.000 0.984 0.016
#> GSM876890     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876891     4  0.4933      0.426 0.000 0.000 0.432 0.568
#> GSM876862     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876843     2  0.4933      0.379 0.000 0.568 0.000 0.432
#> GSM876892     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876893     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876894     3  0.1474      0.930 0.000 0.000 0.948 0.052
#> GSM876895     4  0.5097      0.398 0.000 0.428 0.004 0.568
#> GSM876896     4  0.1940      0.570 0.000 0.076 0.000 0.924
#> GSM876897     4  0.3942      0.393 0.000 0.236 0.000 0.764
#> GSM876868     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.586 0.000 0.000 0.000 1.000
#> GSM876873     4  0.0000      0.586 0.000 0.000 0.000 1.000
#> GSM876844     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876848     2  0.4933      0.379 0.000 0.568 0.000 0.432
#> GSM876849     2  0.4933      0.379 0.000 0.568 0.000 0.432
#> GSM876898     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876899     4  0.4933      0.426 0.000 0.000 0.432 0.568
#> GSM876900     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876901     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876902     4  0.0000      0.586 0.000 0.000 0.000 1.000
#> GSM876903     4  0.5097      0.398 0.000 0.428 0.004 0.568
#> GSM876904     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876874     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876875     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876876     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876879     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876880     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876905     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> GSM876906     4  0.4933      0.426 0.000 0.000 0.432 0.568
#> GSM876907     4  0.5602      0.428 0.000 0.408 0.024 0.568
#> GSM876908     4  0.4933      0.426 0.000 0.000 0.432 0.568
#> GSM876909     4  0.5097      0.398 0.000 0.428 0.004 0.568
#> GSM876881     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876882     1  0.3764      0.701 0.784 0.000 0.216 0.000
#> GSM876883     4  0.4933      0.426 0.000 0.000 0.432 0.568
#> GSM876884     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876885     4  0.4933      0.426 0.000 0.000 0.432 0.568
#> GSM876857     1  0.0000      0.987 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      0.933 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      0.933 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
#> GSM876886     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876887     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876888     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876889     5   0.416     0.3592 0.000 0.000 0.392 0.000 0.608
#> GSM876890     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876891     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876862     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876866     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876867     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876841     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876843     4   0.238     0.8610 0.000 0.128 0.000 0.872 0.000
#> GSM876892     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876893     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876894     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876895     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876896     4   0.000     0.9544 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4   0.000     0.9544 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4   0.000     0.9544 0.000 0.000 0.000 1.000 0.000
#> GSM876873     4   0.000     0.9544 0.000 0.000 0.000 1.000 0.000
#> GSM876844     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876847     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4   0.238     0.8610 0.000 0.128 0.000 0.872 0.000
#> GSM876849     4   0.000     0.9544 0.000 0.000 0.000 1.000 0.000
#> GSM876898     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876899     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876900     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876901     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876902     4   0.000     0.9544 0.000 0.000 0.000 1.000 0.000
#> GSM876903     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876904     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876874     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876875     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876876     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876879     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876880     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876853     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876855     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876856     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876905     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM876906     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876907     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876908     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876909     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876881     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876882     1   0.430     0.0385 0.512 0.000 0.000 0.000 0.488
#> GSM876883     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876884     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5   0.000     0.9607 0.000 0.000 0.000 0.000 1.000
#> GSM876857     1   0.000     0.9720 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2   0.000     1.0000 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876887     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876888     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876889     3  0.1075      0.950 0.000 0.000 0.952 0.000 0.048 0.000
#> GSM876890     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876891     3  0.1663      0.915 0.000 0.000 0.912 0.000 0.088 0.000
#> GSM876862     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876867     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876839     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876841     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876843     4  0.2358      0.849 0.000 0.108 0.000 0.876 0.000 0.016
#> GSM876892     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876894     3  0.1501      0.927 0.000 0.000 0.924 0.000 0.076 0.000
#> GSM876895     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876896     4  0.0000      0.924 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876897     4  0.0000      0.924 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876868     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     6  0.2491      0.829 0.000 0.000 0.000 0.164 0.000 0.836
#> GSM876873     6  0.2219      0.851 0.000 0.000 0.000 0.136 0.000 0.864
#> GSM876844     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876845     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     2  0.0713      0.982 0.000 0.972 0.000 0.000 0.000 0.028
#> GSM876847     2  0.0363      0.980 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM876848     4  0.2358      0.849 0.000 0.108 0.000 0.876 0.000 0.016
#> GSM876849     4  0.0000      0.924 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876898     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876899     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876900     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876901     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876902     4  0.0000      0.924 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876903     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876874     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     6  0.2300      0.804 0.144 0.000 0.000 0.000 0.000 0.856
#> GSM876876     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.1556      0.912 0.920 0.000 0.000 0.000 0.000 0.080
#> GSM876879     6  0.1141      0.896 0.052 0.000 0.000 0.000 0.000 0.948
#> GSM876880     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0458      0.979 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876851     2  0.0000      0.983 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876853     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876854     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876855     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876856     2  0.0458      0.983 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM876905     3  0.0000      0.983 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876906     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876907     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876909     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876881     2  0.0865      0.970 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM876882     6  0.1141      0.896 0.052 0.000 0.000 0.000 0.000 0.948
#> GSM876883     6  0.1141      0.889 0.000 0.000 0.000 0.000 0.052 0.948
#> GSM876884     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.1141      0.889 0.000 0.000 0.000 0.000 0.052 0.948
#> GSM876857     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0865      0.970 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM876859     2  0.0865      0.970 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM876860     2  0.0865      0.970 0.000 0.964 0.000 0.000 0.000 0.036
#> GSM876861     2  0.0865      0.970 0.000 0.964 0.000 0.000 0.000 0.036

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) tissue(p) k
#> MAD:pam 71           0.5743  1.09e-09 2
#> MAD:pam 70           0.7646  3.88e-20 3
#> MAD:pam 58           0.4691  3.64e-19 4
#> MAD:pam 70           0.0293  1.05e-18 5
#> MAD:pam 72           0.1410  9.23e-22 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 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.519           0.921       0.934         0.4219 0.593   0.593
#> 3 3 0.906           0.875       0.948         0.5846 0.745   0.571
#> 4 4 0.946           0.927       0.966         0.1206 0.881   0.661
#> 5 5 1.000           0.963       0.985         0.0339 0.963   0.856
#> 6 6 1.000           0.976       0.989         0.0433 0.965   0.846

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     2   0.541      0.914 0.124 0.876
#> GSM876887     2   0.541      0.914 0.124 0.876
#> GSM876888     2   0.541      0.914 0.124 0.876
#> GSM876889     2   0.518      0.916 0.116 0.884
#> GSM876890     2   0.541      0.914 0.124 0.876
#> GSM876891     2   0.518      0.916 0.116 0.884
#> GSM876862     1   0.000      1.000 1.000 0.000
#> GSM876863     1   0.000      1.000 1.000 0.000
#> GSM876864     1   0.000      1.000 1.000 0.000
#> GSM876865     1   0.000      1.000 1.000 0.000
#> GSM876866     1   0.000      1.000 1.000 0.000
#> GSM876867     1   0.000      1.000 1.000 0.000
#> GSM876838     2   0.000      0.905 0.000 1.000
#> GSM876839     2   0.000      0.905 0.000 1.000
#> GSM876840     2   0.000      0.905 0.000 1.000
#> GSM876841     2   0.000      0.905 0.000 1.000
#> GSM876842     2   0.000      0.905 0.000 1.000
#> GSM876843     2   0.242      0.910 0.040 0.960
#> GSM876892     2   0.541      0.914 0.124 0.876
#> GSM876893     2   0.541      0.914 0.124 0.876
#> GSM876894     2   0.518      0.916 0.116 0.884
#> GSM876895     2   0.671      0.875 0.176 0.824
#> GSM876896     2   0.574      0.907 0.136 0.864
#> GSM876897     2   0.574      0.907 0.136 0.864
#> GSM876868     1   0.000      1.000 1.000 0.000
#> GSM876869     1   0.000      1.000 1.000 0.000
#> GSM876870     1   0.000      1.000 1.000 0.000
#> GSM876871     1   0.000      1.000 1.000 0.000
#> GSM876872     2   0.895      0.713 0.312 0.688
#> GSM876873     2   0.895      0.713 0.312 0.688
#> GSM876844     2   0.000      0.905 0.000 1.000
#> GSM876845     2   0.000      0.905 0.000 1.000
#> GSM876846     2   0.000      0.905 0.000 1.000
#> GSM876847     2   0.000      0.905 0.000 1.000
#> GSM876848     2   0.634      0.884 0.160 0.840
#> GSM876849     2   0.871      0.739 0.292 0.708
#> GSM876898     2   0.541      0.914 0.124 0.876
#> GSM876899     2   0.518      0.916 0.116 0.884
#> GSM876900     2   0.541      0.914 0.124 0.876
#> GSM876901     2   0.541      0.914 0.124 0.876
#> GSM876902     2   0.574      0.907 0.136 0.864
#> GSM876903     2   0.518      0.916 0.116 0.884
#> GSM876904     2   0.541      0.914 0.124 0.876
#> GSM876874     1   0.000      1.000 1.000 0.000
#> GSM876875     1   0.000      1.000 1.000 0.000
#> GSM876876     1   0.000      1.000 1.000 0.000
#> GSM876877     1   0.000      1.000 1.000 0.000
#> GSM876878     1   0.000      1.000 1.000 0.000
#> GSM876879     1   0.000      1.000 1.000 0.000
#> GSM876880     1   0.000      1.000 1.000 0.000
#> GSM876850     2   0.000      0.905 0.000 1.000
#> GSM876851     2   0.000      0.905 0.000 1.000
#> GSM876852     2   0.000      0.905 0.000 1.000
#> GSM876853     2   0.000      0.905 0.000 1.000
#> GSM876854     2   0.000      0.905 0.000 1.000
#> GSM876855     2   0.000      0.905 0.000 1.000
#> GSM876856     2   0.000      0.905 0.000 1.000
#> GSM876905     2   0.541      0.914 0.124 0.876
#> GSM876906     2   0.518      0.916 0.116 0.884
#> GSM876907     2   0.518      0.916 0.116 0.884
#> GSM876908     2   0.518      0.916 0.116 0.884
#> GSM876909     2   0.518      0.916 0.116 0.884
#> GSM876881     2   0.000      0.905 0.000 1.000
#> GSM876882     1   0.000      1.000 1.000 0.000
#> GSM876883     2   0.895      0.713 0.312 0.688
#> GSM876884     1   0.000      1.000 1.000 0.000
#> GSM876885     2   0.895      0.713 0.312 0.688
#> GSM876857     1   0.000      1.000 1.000 0.000
#> GSM876858     2   0.000      0.905 0.000 1.000
#> GSM876859     2   0.000      0.905 0.000 1.000
#> GSM876860     2   0.000      0.905 0.000 1.000
#> GSM876861     2   0.000      0.905 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
#> GSM876886     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876887     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876888     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876889     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876890     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876891     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876862     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876866     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876867     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876843     3  0.6307      0.177 0.000 0.488 0.512
#> GSM876892     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876893     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876894     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876895     3  0.7346      0.291 0.032 0.432 0.536
#> GSM876896     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876897     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876868     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876872     3  0.6286      0.249 0.464 0.000 0.536
#> GSM876873     3  0.6286      0.249 0.464 0.000 0.536
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876848     3  0.6286      0.247 0.000 0.464 0.536
#> GSM876849     3  0.6286      0.247 0.000 0.464 0.536
#> GSM876898     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876899     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876900     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876901     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876902     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876903     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876904     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876874     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876875     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876876     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876879     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876880     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876905     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876906     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876907     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876908     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876909     3  0.0000      0.871 0.000 0.000 1.000
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876882     1  0.0592      0.986 0.988 0.000 0.012
#> GSM876883     3  0.6286      0.249 0.464 0.000 0.536
#> GSM876884     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876885     3  0.6286      0.249 0.464 0.000 0.536
#> GSM876857     1  0.0000      0.999 1.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876861     2  0.0000      1.000 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
#> GSM876886     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876887     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876888     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876889     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876890     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876891     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876862     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876863     1  0.2868      0.817 0.864 0.000 0.000 0.136
#> GSM876864     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0592      0.955 0.984 0.000 0.000 0.016
#> GSM876866     4  0.4746      0.495 0.368 0.000 0.000 0.632
#> GSM876867     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876843     4  0.3726      0.679 0.000 0.212 0.000 0.788
#> GSM876892     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876893     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876894     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876895     4  0.4948      0.201 0.000 0.000 0.440 0.560
#> GSM876896     4  0.0000      0.830 0.000 0.000 0.000 1.000
#> GSM876897     4  0.0000      0.830 0.000 0.000 0.000 1.000
#> GSM876868     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.830 0.000 0.000 0.000 1.000
#> GSM876873     4  0.0000      0.830 0.000 0.000 0.000 1.000
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876846     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876848     4  0.2149      0.789 0.000 0.088 0.000 0.912
#> GSM876849     4  0.0000      0.830 0.000 0.000 0.000 1.000
#> GSM876898     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876899     3  0.0336      0.993 0.000 0.000 0.992 0.008
#> GSM876900     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876901     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876902     4  0.0000      0.830 0.000 0.000 0.000 1.000
#> GSM876903     3  0.0336      0.993 0.000 0.000 0.992 0.008
#> GSM876904     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876874     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876875     1  0.4331      0.536 0.712 0.000 0.000 0.288
#> GSM876876     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0707      0.951 0.980 0.000 0.000 0.020
#> GSM876879     4  0.4661      0.536 0.348 0.000 0.000 0.652
#> GSM876880     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876855     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876905     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876906     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876907     3  0.0336      0.993 0.000 0.000 0.992 0.008
#> GSM876908     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> GSM876909     3  0.0336      0.993 0.000 0.000 0.992 0.008
#> GSM876881     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876882     4  0.3569      0.742 0.196 0.000 0.000 0.804
#> GSM876883     4  0.3266      0.766 0.168 0.000 0.000 0.832
#> GSM876884     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876885     4  0.3266      0.766 0.168 0.000 0.000 0.832
#> GSM876857     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      1.000 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
#> GSM876886     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876887     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876888     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876889     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876890     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876891     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876862     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.4294      0.118 0.532 0.000 0.000 0.000 0.468
#> GSM876864     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876866     5  0.0404      0.996 0.000 0.000 0.000 0.012 0.988
#> GSM876867     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2  0.0404      0.992 0.000 0.988 0.000 0.000 0.012
#> GSM876841     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876843     4  0.0162      0.994 0.000 0.004 0.000 0.996 0.000
#> GSM876892     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876893     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876894     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876895     3  0.6183      0.329 0.000 0.308 0.544 0.144 0.004
#> GSM876896     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM876873     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM876844     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2  0.0404      0.992 0.000 0.988 0.000 0.000 0.012
#> GSM876847     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM876849     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM876898     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876899     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876900     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876901     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876902     4  0.0000      0.999 0.000 0.000 0.000 1.000 0.000
#> GSM876903     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876904     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876874     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876875     5  0.0566      0.993 0.004 0.000 0.000 0.012 0.984
#> GSM876876     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0162      0.964 0.996 0.000 0.000 0.000 0.004
#> GSM876879     5  0.0404      0.996 0.000 0.000 0.000 0.012 0.988
#> GSM876880     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.0404      0.992 0.000 0.988 0.000 0.000 0.012
#> GSM876853     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2  0.0404      0.992 0.000 0.988 0.000 0.000 0.012
#> GSM876855     2  0.0404      0.992 0.000 0.988 0.000 0.000 0.012
#> GSM876856     2  0.0404      0.992 0.000 0.988 0.000 0.000 0.012
#> GSM876905     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876906     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876907     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876908     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876909     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> GSM876881     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876882     5  0.0404      0.996 0.000 0.000 0.000 0.012 0.988
#> GSM876883     5  0.0404      0.996 0.000 0.000 0.000 0.012 0.988
#> GSM876884     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5  0.0703      0.987 0.000 0.000 0.000 0.024 0.976
#> GSM876857     1  0.0000      0.968 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876859     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876860     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000
#> GSM876861     2  0.0000      0.997 0.000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3   p4    p5    p6
#> GSM876886     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876887     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876888     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876889     3  0.0260      0.974 0.000 0.000 0.992 0.00 0.008 0.000
#> GSM876890     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876891     3  0.0260      0.974 0.000 0.000 0.992 0.00 0.008 0.000
#> GSM876862     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876863     1  0.1007      0.954 0.956 0.000 0.000 0.00 0.000 0.044
#> GSM876864     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876865     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876866     6  0.0000      1.000 0.000 0.000 0.000 0.00 0.000 1.000
#> GSM876867     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876838     2  0.0000      0.993 0.000 1.000 0.000 0.00 0.000 0.000
#> GSM876839     2  0.0000      0.993 0.000 1.000 0.000 0.00 0.000 0.000
#> GSM876840     5  0.0260      0.964 0.000 0.008 0.000 0.00 0.992 0.000
#> GSM876841     2  0.0146      0.993 0.000 0.996 0.000 0.00 0.004 0.000
#> GSM876842     2  0.0260      0.992 0.000 0.992 0.000 0.00 0.008 0.000
#> GSM876843     4  0.0000      1.000 0.000 0.000 0.000 1.00 0.000 0.000
#> GSM876892     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876893     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876894     3  0.0146      0.975 0.000 0.000 0.996 0.00 0.004 0.000
#> GSM876895     3  0.4834      0.395 0.000 0.340 0.596 0.06 0.000 0.004
#> GSM876896     4  0.0000      1.000 0.000 0.000 0.000 1.00 0.000 0.000
#> GSM876897     4  0.0000      1.000 0.000 0.000 0.000 1.00 0.000 0.000
#> GSM876868     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876869     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876870     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876871     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876872     4  0.0000      1.000 0.000 0.000 0.000 1.00 0.000 0.000
#> GSM876873     4  0.0000      1.000 0.000 0.000 0.000 1.00 0.000 0.000
#> GSM876844     2  0.0260      0.992 0.000 0.992 0.000 0.00 0.008 0.000
#> GSM876845     2  0.0000      0.993 0.000 1.000 0.000 0.00 0.000 0.000
#> GSM876846     5  0.0260      0.964 0.000 0.008 0.000 0.00 0.992 0.000
#> GSM876847     2  0.0000      0.993 0.000 1.000 0.000 0.00 0.000 0.000
#> GSM876848     4  0.0000      1.000 0.000 0.000 0.000 1.00 0.000 0.000
#> GSM876849     4  0.0000      1.000 0.000 0.000 0.000 1.00 0.000 0.000
#> GSM876898     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876899     3  0.0260      0.974 0.000 0.000 0.992 0.00 0.008 0.000
#> GSM876900     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876901     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876902     4  0.0000      1.000 0.000 0.000 0.000 1.00 0.000 0.000
#> GSM876903     3  0.0260      0.974 0.000 0.000 0.992 0.00 0.008 0.000
#> GSM876904     3  0.0146      0.975 0.000 0.000 0.996 0.00 0.004 0.000
#> GSM876874     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876875     6  0.0000      1.000 0.000 0.000 0.000 0.00 0.000 1.000
#> GSM876876     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876877     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876878     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876879     6  0.0000      1.000 0.000 0.000 0.000 0.00 0.000 1.000
#> GSM876880     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876850     2  0.0000      0.993 0.000 1.000 0.000 0.00 0.000 0.000
#> GSM876851     2  0.0000      0.993 0.000 1.000 0.000 0.00 0.000 0.000
#> GSM876852     5  0.2260      0.817 0.000 0.140 0.000 0.00 0.860 0.000
#> GSM876853     2  0.0146      0.993 0.000 0.996 0.000 0.00 0.004 0.000
#> GSM876854     5  0.0260      0.964 0.000 0.008 0.000 0.00 0.992 0.000
#> GSM876855     5  0.0260      0.964 0.000 0.008 0.000 0.00 0.992 0.000
#> GSM876856     5  0.0260      0.964 0.000 0.008 0.000 0.00 0.992 0.000
#> GSM876905     3  0.0000      0.975 0.000 0.000 1.000 0.00 0.000 0.000
#> GSM876906     3  0.0260      0.974 0.000 0.000 0.992 0.00 0.008 0.000
#> GSM876907     3  0.0260      0.974 0.000 0.000 0.992 0.00 0.008 0.000
#> GSM876908     3  0.0260      0.974 0.000 0.000 0.992 0.00 0.008 0.000
#> GSM876909     3  0.0260      0.974 0.000 0.000 0.992 0.00 0.008 0.000
#> GSM876881     2  0.0000      0.993 0.000 1.000 0.000 0.00 0.000 0.000
#> GSM876882     6  0.0000      1.000 0.000 0.000 0.000 0.00 0.000 1.000
#> GSM876883     6  0.0000      1.000 0.000 0.000 0.000 0.00 0.000 1.000
#> GSM876884     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876885     6  0.0000      1.000 0.000 0.000 0.000 0.00 0.000 1.000
#> GSM876857     1  0.0000      0.997 1.000 0.000 0.000 0.00 0.000 0.000
#> GSM876858     2  0.0260      0.992 0.000 0.992 0.000 0.00 0.008 0.000
#> GSM876859     2  0.0260      0.992 0.000 0.992 0.000 0.00 0.008 0.000
#> GSM876860     2  0.0260      0.992 0.000 0.992 0.000 0.00 0.008 0.000
#> GSM876861     2  0.1141      0.950 0.000 0.948 0.000 0.00 0.052 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-mclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) tissue(p) k
#> MAD:mclust 72           0.7222  4.87e-11 2
#> MAD:mclust 64           0.9947  3.61e-24 3
#> MAD:mclust 70           0.5478  1.29e-20 4
#> MAD:mclust 70           0.1343  9.11e-21 5
#> MAD:mclust 71           0.0739  4.84e-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: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 72 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.975       0.991         0.4901 0.512   0.512
#> 3 3 0.744           0.791       0.903         0.3308 0.806   0.633
#> 4 4 0.993           0.960       0.973         0.1161 0.815   0.542
#> 5 5 0.861           0.833       0.892         0.0717 0.905   0.670
#> 6 6 0.799           0.725       0.837         0.0229 0.962   0.839

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1   0.000      0.988 1.000 0.000
#> GSM876887     1   0.000      0.988 1.000 0.000
#> GSM876888     1   0.000      0.988 1.000 0.000
#> GSM876889     1   0.000      0.988 1.000 0.000
#> GSM876890     1   0.000      0.988 1.000 0.000
#> GSM876891     1   0.000      0.988 1.000 0.000
#> GSM876862     1   0.000      0.988 1.000 0.000
#> GSM876863     1   0.000      0.988 1.000 0.000
#> GSM876864     1   0.000      0.988 1.000 0.000
#> GSM876865     1   0.000      0.988 1.000 0.000
#> GSM876866     1   0.000      0.988 1.000 0.000
#> GSM876867     1   0.000      0.988 1.000 0.000
#> GSM876838     2   0.000      0.995 0.000 1.000
#> GSM876839     2   0.000      0.995 0.000 1.000
#> GSM876840     2   0.000      0.995 0.000 1.000
#> GSM876841     2   0.000      0.995 0.000 1.000
#> GSM876842     2   0.000      0.995 0.000 1.000
#> GSM876843     2   0.000      0.995 0.000 1.000
#> GSM876892     1   0.000      0.988 1.000 0.000
#> GSM876893     1   0.000      0.988 1.000 0.000
#> GSM876894     1   0.000      0.988 1.000 0.000
#> GSM876895     2   0.482      0.885 0.104 0.896
#> GSM876896     1   0.999      0.066 0.520 0.480
#> GSM876897     2   0.000      0.995 0.000 1.000
#> GSM876868     1   0.000      0.988 1.000 0.000
#> GSM876869     1   0.000      0.988 1.000 0.000
#> GSM876870     1   0.000      0.988 1.000 0.000
#> GSM876871     1   0.000      0.988 1.000 0.000
#> GSM876872     1   0.000      0.988 1.000 0.000
#> GSM876873     1   0.000      0.988 1.000 0.000
#> GSM876844     2   0.000      0.995 0.000 1.000
#> GSM876845     2   0.000      0.995 0.000 1.000
#> GSM876846     2   0.000      0.995 0.000 1.000
#> GSM876847     2   0.000      0.995 0.000 1.000
#> GSM876848     2   0.000      0.995 0.000 1.000
#> GSM876849     2   0.000      0.995 0.000 1.000
#> GSM876898     1   0.000      0.988 1.000 0.000
#> GSM876899     1   0.163      0.964 0.976 0.024
#> GSM876900     1   0.000      0.988 1.000 0.000
#> GSM876901     1   0.000      0.988 1.000 0.000
#> GSM876902     1   0.000      0.988 1.000 0.000
#> GSM876903     2   0.118      0.981 0.016 0.984
#> GSM876904     1   0.000      0.988 1.000 0.000
#> GSM876874     1   0.000      0.988 1.000 0.000
#> GSM876875     1   0.000      0.988 1.000 0.000
#> GSM876876     1   0.000      0.988 1.000 0.000
#> GSM876877     1   0.000      0.988 1.000 0.000
#> GSM876878     1   0.000      0.988 1.000 0.000
#> GSM876879     1   0.000      0.988 1.000 0.000
#> GSM876880     1   0.000      0.988 1.000 0.000
#> GSM876850     2   0.000      0.995 0.000 1.000
#> GSM876851     2   0.000      0.995 0.000 1.000
#> GSM876852     2   0.000      0.995 0.000 1.000
#> GSM876853     2   0.000      0.995 0.000 1.000
#> GSM876854     2   0.000      0.995 0.000 1.000
#> GSM876855     2   0.000      0.995 0.000 1.000
#> GSM876856     2   0.000      0.995 0.000 1.000
#> GSM876905     1   0.000      0.988 1.000 0.000
#> GSM876906     1   0.000      0.988 1.000 0.000
#> GSM876907     2   0.163      0.974 0.024 0.976
#> GSM876908     1   0.000      0.988 1.000 0.000
#> GSM876909     2   0.000      0.995 0.000 1.000
#> GSM876881     2   0.000      0.995 0.000 1.000
#> GSM876882     1   0.000      0.988 1.000 0.000
#> GSM876883     1   0.000      0.988 1.000 0.000
#> GSM876884     1   0.000      0.988 1.000 0.000
#> GSM876885     1   0.000      0.988 1.000 0.000
#> GSM876857     1   0.000      0.988 1.000 0.000
#> GSM876858     2   0.000      0.995 0.000 1.000
#> GSM876859     2   0.000      0.995 0.000 1.000
#> GSM876860     2   0.000      0.995 0.000 1.000
#> GSM876861     2   0.000      0.995 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
#> GSM876886     1  0.5560      0.663 0.700 0.000 0.300
#> GSM876887     1  0.5785      0.617 0.668 0.000 0.332
#> GSM876888     1  0.5397      0.679 0.720 0.000 0.280
#> GSM876889     3  0.1163      0.806 0.028 0.000 0.972
#> GSM876890     1  0.6286      0.326 0.536 0.000 0.464
#> GSM876891     3  0.4121      0.685 0.168 0.000 0.832
#> GSM876862     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876866     1  0.0424      0.837 0.992 0.000 0.008
#> GSM876867     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876838     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876839     2  0.0237      0.967 0.000 0.996 0.004
#> GSM876840     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876841     2  0.0237      0.967 0.000 0.996 0.004
#> GSM876842     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876843     2  0.0424      0.964 0.000 0.992 0.008
#> GSM876892     1  0.5560      0.663 0.700 0.000 0.300
#> GSM876893     1  0.5560      0.663 0.700 0.000 0.300
#> GSM876894     3  0.5465      0.464 0.288 0.000 0.712
#> GSM876895     2  0.2261      0.894 0.068 0.932 0.000
#> GSM876896     3  0.0829      0.802 0.004 0.012 0.984
#> GSM876897     3  0.3686      0.744 0.000 0.140 0.860
#> GSM876868     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876872     3  0.4842      0.675 0.224 0.000 0.776
#> GSM876873     3  0.4887      0.672 0.228 0.000 0.772
#> GSM876844     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876845     2  0.0237      0.967 0.000 0.996 0.004
#> GSM876846     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876847     2  0.0424      0.966 0.000 0.992 0.008
#> GSM876848     2  0.3482      0.834 0.000 0.872 0.128
#> GSM876849     3  0.5591      0.495 0.000 0.304 0.696
#> GSM876898     1  0.5465      0.670 0.712 0.000 0.288
#> GSM876899     3  0.1163      0.806 0.028 0.000 0.972
#> GSM876900     1  0.5560      0.663 0.700 0.000 0.300
#> GSM876901     1  0.5560      0.663 0.700 0.000 0.300
#> GSM876902     3  0.0747      0.804 0.016 0.000 0.984
#> GSM876903     3  0.2356      0.789 0.000 0.072 0.928
#> GSM876904     1  0.5465      0.672 0.712 0.000 0.288
#> GSM876874     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876875     1  0.0592      0.836 0.988 0.000 0.012
#> GSM876876     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876879     1  0.0747      0.834 0.984 0.000 0.016
#> GSM876880     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876850     2  0.0592      0.963 0.000 0.988 0.012
#> GSM876851     2  0.0237      0.967 0.000 0.996 0.004
#> GSM876852     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876853     2  0.0237      0.967 0.000 0.996 0.004
#> GSM876854     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876855     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876856     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876905     1  0.5560      0.663 0.700 0.000 0.300
#> GSM876906     3  0.1289      0.805 0.032 0.000 0.968
#> GSM876907     3  0.5529      0.551 0.000 0.296 0.704
#> GSM876908     3  0.1289      0.805 0.032 0.000 0.968
#> GSM876909     2  0.6215      0.168 0.000 0.572 0.428
#> GSM876881     2  0.0592      0.963 0.000 0.988 0.012
#> GSM876882     1  0.0747      0.834 0.984 0.000 0.016
#> GSM876883     1  0.6274     -0.111 0.544 0.000 0.456
#> GSM876884     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876885     3  0.6299      0.245 0.476 0.000 0.524
#> GSM876857     1  0.0000      0.839 1.000 0.000 0.000
#> GSM876858     2  0.0237      0.967 0.000 0.996 0.004
#> GSM876859     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876860     2  0.0000      0.968 0.000 1.000 0.000
#> GSM876861     2  0.0000      0.968 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
#> GSM876886     3  0.0804      0.967 0.008 0.000 0.980 0.012
#> GSM876887     3  0.1211      0.967 0.000 0.000 0.960 0.040
#> GSM876888     3  0.0524      0.962 0.004 0.000 0.988 0.008
#> GSM876889     3  0.1940      0.946 0.000 0.000 0.924 0.076
#> GSM876890     3  0.1211      0.967 0.000 0.000 0.960 0.040
#> GSM876891     3  0.1211      0.967 0.000 0.000 0.960 0.040
#> GSM876862     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0188      0.986 0.996 0.000 0.000 0.004
#> GSM876864     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM876866     1  0.0188      0.986 0.996 0.000 0.000 0.004
#> GSM876867     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876840     2  0.0592      0.985 0.000 0.984 0.000 0.016
#> GSM876841     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876842     2  0.0188      0.990 0.000 0.996 0.000 0.004
#> GSM876843     2  0.1867      0.931 0.000 0.928 0.000 0.072
#> GSM876892     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM876893     3  0.0336      0.964 0.000 0.000 0.992 0.008
#> GSM876894     3  0.1022      0.968 0.000 0.000 0.968 0.032
#> GSM876895     2  0.0524      0.984 0.008 0.988 0.000 0.004
#> GSM876896     4  0.1557      0.887 0.000 0.000 0.056 0.944
#> GSM876897     4  0.1452      0.892 0.000 0.008 0.036 0.956
#> GSM876868     1  0.0188      0.985 0.996 0.000 0.004 0.000
#> GSM876869     1  0.0188      0.985 0.996 0.000 0.004 0.000
#> GSM876870     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM876872     4  0.2521      0.881 0.064 0.000 0.024 0.912
#> GSM876873     4  0.2596      0.878 0.068 0.000 0.024 0.908
#> GSM876844     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876845     2  0.0188      0.989 0.000 0.996 0.000 0.004
#> GSM876846     2  0.0469      0.987 0.000 0.988 0.000 0.012
#> GSM876847     2  0.0469      0.985 0.000 0.988 0.000 0.012
#> GSM876848     4  0.4431      0.556 0.000 0.304 0.000 0.696
#> GSM876849     4  0.1743      0.876 0.000 0.056 0.004 0.940
#> GSM876898     3  0.0469      0.962 0.000 0.000 0.988 0.012
#> GSM876899     3  0.1302      0.966 0.000 0.000 0.956 0.044
#> GSM876900     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM876901     3  0.0000      0.967 0.000 0.000 1.000 0.000
#> GSM876902     4  0.1867      0.877 0.000 0.000 0.072 0.928
#> GSM876903     3  0.3306      0.857 0.000 0.004 0.840 0.156
#> GSM876904     3  0.0336      0.964 0.000 0.000 0.992 0.008
#> GSM876874     1  0.0188      0.985 0.996 0.000 0.004 0.000
#> GSM876875     1  0.0188      0.986 0.996 0.000 0.000 0.004
#> GSM876876     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0188      0.985 0.996 0.000 0.004 0.000
#> GSM876878     1  0.0188      0.986 0.996 0.000 0.000 0.004
#> GSM876879     1  0.0188      0.986 0.996 0.000 0.000 0.004
#> GSM876880     1  0.0000      0.986 1.000 0.000 0.000 0.000
#> GSM876850     2  0.0469      0.985 0.000 0.988 0.000 0.012
#> GSM876851     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876852     2  0.0592      0.985 0.000 0.984 0.000 0.016
#> GSM876853     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876854     2  0.0469      0.987 0.000 0.988 0.000 0.012
#> GSM876855     2  0.0707      0.982 0.000 0.980 0.000 0.020
#> GSM876856     2  0.0592      0.985 0.000 0.984 0.000 0.016
#> GSM876905     3  0.0336      0.964 0.000 0.000 0.992 0.008
#> GSM876906     3  0.1716      0.955 0.000 0.000 0.936 0.064
#> GSM876907     3  0.1211      0.967 0.000 0.000 0.960 0.040
#> GSM876908     3  0.1474      0.962 0.000 0.000 0.948 0.052
#> GSM876909     3  0.1356      0.964 0.000 0.008 0.960 0.032
#> GSM876881     2  0.0469      0.985 0.000 0.988 0.000 0.012
#> GSM876882     1  0.0188      0.986 0.996 0.000 0.000 0.004
#> GSM876883     1  0.2216      0.900 0.908 0.000 0.000 0.092
#> GSM876884     1  0.0188      0.986 0.996 0.000 0.000 0.004
#> GSM876885     1  0.2921      0.843 0.860 0.000 0.000 0.140
#> GSM876857     1  0.0188      0.985 0.996 0.000 0.004 0.000
#> GSM876858     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876859     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876860     2  0.0000      0.990 0.000 1.000 0.000 0.000
#> GSM876861     2  0.0000      0.990 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
#> GSM876886     3  0.0794     0.9445 0.000 0.000 0.972 0.000 0.028
#> GSM876887     3  0.1168     0.9483 0.000 0.000 0.960 0.008 0.032
#> GSM876888     3  0.1282     0.9307 0.000 0.000 0.952 0.004 0.044
#> GSM876889     3  0.2077     0.9324 0.000 0.000 0.920 0.040 0.040
#> GSM876890     3  0.0324     0.9541 0.000 0.000 0.992 0.004 0.004
#> GSM876891     3  0.1469     0.9446 0.000 0.000 0.948 0.016 0.036
#> GSM876862     1  0.0898     0.9481 0.972 0.000 0.008 0.000 0.020
#> GSM876863     1  0.0290     0.9500 0.992 0.000 0.000 0.000 0.008
#> GSM876864     1  0.1251     0.9408 0.956 0.000 0.008 0.000 0.036
#> GSM876865     1  0.0290     0.9509 0.992 0.000 0.000 0.000 0.008
#> GSM876866     1  0.0566     0.9500 0.984 0.000 0.004 0.000 0.012
#> GSM876867     1  0.0693     0.9500 0.980 0.000 0.008 0.000 0.012
#> GSM876838     2  0.0794     0.8759 0.000 0.972 0.000 0.000 0.028
#> GSM876839     2  0.1544     0.8511 0.000 0.932 0.000 0.000 0.068
#> GSM876840     2  0.0693     0.8688 0.000 0.980 0.000 0.008 0.012
#> GSM876841     2  0.2690     0.7477 0.000 0.844 0.000 0.000 0.156
#> GSM876842     2  0.0609     0.8782 0.000 0.980 0.000 0.000 0.020
#> GSM876843     2  0.3563     0.6440 0.000 0.780 0.000 0.208 0.012
#> GSM876892     3  0.0404     0.9520 0.000 0.000 0.988 0.000 0.012
#> GSM876893     3  0.0566     0.9506 0.000 0.000 0.984 0.004 0.012
#> GSM876894     3  0.1915     0.9365 0.000 0.000 0.928 0.032 0.040
#> GSM876895     5  0.5435     0.6739 0.072 0.352 0.000 0.000 0.576
#> GSM876896     4  0.0451     0.7696 0.000 0.000 0.004 0.988 0.008
#> GSM876897     4  0.0613     0.7664 0.000 0.004 0.004 0.984 0.008
#> GSM876868     1  0.1626     0.9292 0.940 0.000 0.016 0.000 0.044
#> GSM876869     1  0.1331     0.9386 0.952 0.000 0.008 0.000 0.040
#> GSM876870     1  0.0162     0.9504 0.996 0.000 0.000 0.000 0.004
#> GSM876871     1  0.0290     0.9509 0.992 0.000 0.000 0.000 0.008
#> GSM876872     4  0.3688     0.7515 0.124 0.000 0.000 0.816 0.060
#> GSM876873     4  0.4221     0.7471 0.112 0.000 0.000 0.780 0.108
#> GSM876844     2  0.0703     0.8774 0.000 0.976 0.000 0.000 0.024
#> GSM876845     2  0.2852     0.7192 0.000 0.828 0.000 0.000 0.172
#> GSM876846     2  0.0510     0.8788 0.000 0.984 0.000 0.000 0.016
#> GSM876847     5  0.4304     0.4839 0.000 0.484 0.000 0.000 0.516
#> GSM876848     2  0.3628     0.6341 0.000 0.772 0.000 0.216 0.012
#> GSM876849     4  0.3174     0.6870 0.004 0.132 0.000 0.844 0.020
#> GSM876898     3  0.0324     0.9530 0.000 0.000 0.992 0.004 0.004
#> GSM876899     3  0.2300     0.9258 0.000 0.000 0.908 0.040 0.052
#> GSM876900     3  0.0404     0.9538 0.000 0.000 0.988 0.000 0.012
#> GSM876901     3  0.0000     0.9537 0.000 0.000 1.000 0.000 0.000
#> GSM876902     4  0.1195     0.7679 0.000 0.000 0.028 0.960 0.012
#> GSM876903     4  0.6748     0.3470 0.000 0.004 0.288 0.456 0.252
#> GSM876904     3  0.0771     0.9476 0.000 0.000 0.976 0.004 0.020
#> GSM876874     1  0.0992     0.9476 0.968 0.000 0.008 0.000 0.024
#> GSM876875     1  0.0510     0.9471 0.984 0.000 0.000 0.000 0.016
#> GSM876876     1  0.0451     0.9511 0.988 0.000 0.008 0.000 0.004
#> GSM876877     1  0.0898     0.9481 0.972 0.000 0.008 0.000 0.020
#> GSM876878     1  0.0510     0.9471 0.984 0.000 0.000 0.000 0.016
#> GSM876879     1  0.0880     0.9384 0.968 0.000 0.000 0.000 0.032
#> GSM876880     1  0.0451     0.9511 0.988 0.000 0.008 0.000 0.004
#> GSM876850     5  0.4262     0.5881 0.000 0.440 0.000 0.000 0.560
#> GSM876851     2  0.2471     0.7781 0.000 0.864 0.000 0.000 0.136
#> GSM876852     2  0.0162     0.8761 0.000 0.996 0.000 0.004 0.000
#> GSM876853     2  0.1965     0.8260 0.000 0.904 0.000 0.000 0.096
#> GSM876854     2  0.0000     0.8770 0.000 1.000 0.000 0.000 0.000
#> GSM876855     2  0.0693     0.8688 0.000 0.980 0.000 0.008 0.012
#> GSM876856     2  0.0566     0.8710 0.000 0.984 0.000 0.004 0.012
#> GSM876905     3  0.0324     0.9530 0.000 0.000 0.992 0.004 0.004
#> GSM876906     3  0.3116     0.8878 0.000 0.000 0.860 0.064 0.076
#> GSM876907     5  0.3850     0.4472 0.000 0.004 0.172 0.032 0.792
#> GSM876908     3  0.3201     0.8822 0.000 0.000 0.852 0.052 0.096
#> GSM876909     5  0.3309     0.5371 0.000 0.024 0.108 0.016 0.852
#> GSM876881     5  0.3707     0.7871 0.000 0.284 0.000 0.000 0.716
#> GSM876882     1  0.1430     0.9194 0.944 0.000 0.000 0.004 0.052
#> GSM876883     1  0.5484     0.0538 0.540 0.000 0.000 0.392 0.068
#> GSM876884     1  0.0290     0.9497 0.992 0.000 0.000 0.000 0.008
#> GSM876885     4  0.5593     0.4615 0.340 0.000 0.000 0.572 0.088
#> GSM876857     1  0.1331     0.9386 0.952 0.000 0.008 0.000 0.040
#> GSM876858     5  0.3612     0.7948 0.000 0.268 0.000 0.000 0.732
#> GSM876859     5  0.3636     0.7940 0.000 0.272 0.000 0.000 0.728
#> GSM876860     5  0.3561     0.7943 0.000 0.260 0.000 0.000 0.740
#> GSM876861     5  0.3534     0.7931 0.000 0.256 0.000 0.000 0.744

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM876886     3  0.0806     0.9282 0.008 0.000 0.972 0.000 0.000 NA
#> GSM876887     3  0.0291     0.9347 0.000 0.000 0.992 0.004 0.000 NA
#> GSM876888     3  0.1563     0.9015 0.012 0.000 0.932 0.000 0.000 NA
#> GSM876889     3  0.1237     0.9246 0.000 0.000 0.956 0.020 0.004 NA
#> GSM876890     3  0.0000     0.9357 0.000 0.000 1.000 0.000 0.000 NA
#> GSM876891     3  0.0551     0.9332 0.000 0.000 0.984 0.004 0.004 NA
#> GSM876862     1  0.2964     0.7611 0.792 0.000 0.004 0.000 0.000 NA
#> GSM876863     1  0.0000     0.8281 1.000 0.000 0.000 0.000 0.000 NA
#> GSM876864     1  0.3405     0.7199 0.724 0.000 0.004 0.000 0.000 NA
#> GSM876865     1  0.0291     0.8275 0.992 0.000 0.000 0.000 0.004 NA
#> GSM876866     1  0.0000     0.8281 1.000 0.000 0.000 0.000 0.000 NA
#> GSM876867     1  0.1644     0.8168 0.920 0.000 0.004 0.000 0.000 NA
#> GSM876838     2  0.0777     0.8288 0.000 0.972 0.000 0.000 0.024 NA
#> GSM876839     2  0.2066     0.8031 0.000 0.908 0.000 0.000 0.040 NA
#> GSM876840     2  0.1341     0.8137 0.000 0.948 0.000 0.024 0.000 NA
#> GSM876841     2  0.3522     0.7017 0.000 0.800 0.000 0.000 0.128 NA
#> GSM876842     2  0.0547     0.8305 0.000 0.980 0.000 0.000 0.020 NA
#> GSM876843     2  0.4201     0.4083 0.000 0.664 0.000 0.300 0.000 NA
#> GSM876892     3  0.0405     0.9346 0.004 0.000 0.988 0.000 0.000 NA
#> GSM876893     3  0.0603     0.9323 0.004 0.000 0.980 0.000 0.000 NA
#> GSM876894     3  0.1194     0.9248 0.000 0.000 0.956 0.008 0.004 NA
#> GSM876895     5  0.5711     0.4056 0.052 0.416 0.000 0.016 0.492 NA
#> GSM876896     4  0.0858     0.7209 0.000 0.000 0.004 0.968 0.000 NA
#> GSM876897     4  0.0436     0.7194 0.000 0.004 0.004 0.988 0.000 NA
#> GSM876868     1  0.3819     0.6329 0.624 0.000 0.004 0.000 0.000 NA
#> GSM876869     1  0.3742     0.6575 0.648 0.000 0.004 0.000 0.000 NA
#> GSM876870     1  0.0508     0.8261 0.984 0.000 0.000 0.000 0.004 NA
#> GSM876871     1  0.0146     0.8278 0.996 0.000 0.000 0.000 0.000 NA
#> GSM876872     4  0.4521     0.6224 0.108 0.000 0.000 0.712 0.004 NA
#> GSM876873     4  0.6327     0.2197 0.324 0.000 0.000 0.364 0.008 NA
#> GSM876844     2  0.0547     0.8305 0.000 0.980 0.000 0.000 0.020 NA
#> GSM876845     2  0.3770     0.6664 0.000 0.776 0.000 0.000 0.148 NA
#> GSM876846     2  0.2138     0.7810 0.000 0.908 0.000 0.052 0.004 NA
#> GSM876847     2  0.5164     0.1874 0.000 0.584 0.000 0.000 0.300 NA
#> GSM876848     4  0.4146     0.5091 0.000 0.288 0.000 0.676 0.000 NA
#> GSM876849     4  0.3172     0.6472 0.000 0.148 0.000 0.816 0.000 NA
#> GSM876898     3  0.0405     0.9346 0.004 0.000 0.988 0.000 0.000 NA
#> GSM876899     3  0.1957     0.9049 0.000 0.000 0.920 0.024 0.008 NA
#> GSM876900     3  0.0146     0.9355 0.000 0.000 0.996 0.000 0.000 NA
#> GSM876901     3  0.0000     0.9357 0.000 0.000 1.000 0.000 0.000 NA
#> GSM876902     4  0.1829     0.7103 0.000 0.000 0.024 0.920 0.000 NA
#> GSM876903     3  0.6444     0.3492 0.000 0.000 0.516 0.132 0.072 NA
#> GSM876904     3  0.0508     0.9339 0.004 0.000 0.984 0.000 0.000 NA
#> GSM876874     1  0.3290     0.7336 0.744 0.000 0.004 0.000 0.000 NA
#> GSM876875     1  0.0692     0.8232 0.976 0.000 0.000 0.000 0.004 NA
#> GSM876876     1  0.0777     0.8269 0.972 0.000 0.004 0.000 0.000 NA
#> GSM876877     1  0.1806     0.8130 0.908 0.000 0.004 0.000 0.000 NA
#> GSM876878     1  0.0508     0.8260 0.984 0.000 0.000 0.000 0.004 NA
#> GSM876879     1  0.2482     0.7377 0.848 0.000 0.000 0.000 0.004 NA
#> GSM876880     1  0.0858     0.8266 0.968 0.000 0.004 0.000 0.000 NA
#> GSM876850     5  0.5634     0.2483 0.000 0.416 0.000 0.000 0.436 NA
#> GSM876851     2  0.3277     0.7371 0.000 0.824 0.000 0.000 0.092 NA
#> GSM876852     2  0.0603     0.8287 0.000 0.980 0.000 0.000 0.004 NA
#> GSM876853     2  0.2511     0.7846 0.000 0.880 0.000 0.000 0.056 NA
#> GSM876854     2  0.0632     0.8264 0.000 0.976 0.000 0.000 0.000 NA
#> GSM876855     2  0.0858     0.8236 0.000 0.968 0.000 0.004 0.000 NA
#> GSM876856     2  0.1334     0.8135 0.000 0.948 0.000 0.020 0.000 NA
#> GSM876905     3  0.0291     0.9353 0.004 0.000 0.992 0.000 0.000 NA
#> GSM876906     3  0.3036     0.8418 0.000 0.000 0.840 0.028 0.008 NA
#> GSM876907     5  0.6645     0.0446 0.000 0.008 0.396 0.056 0.416 NA
#> GSM876908     3  0.2887     0.8558 0.000 0.000 0.856 0.032 0.008 NA
#> GSM876909     5  0.4123     0.4658 0.000 0.008 0.136 0.016 0.780 NA
#> GSM876881     5  0.5156     0.5747 0.000 0.272 0.000 0.000 0.600 NA
#> GSM876882     1  0.3380     0.6330 0.748 0.000 0.000 0.004 0.004 NA
#> GSM876883     1  0.5369     0.3514 0.584 0.000 0.000 0.116 0.008 NA
#> GSM876884     1  0.0508     0.8261 0.984 0.000 0.000 0.000 0.004 NA
#> GSM876885     1  0.6028     0.1938 0.516 0.000 0.000 0.152 0.024 NA
#> GSM876857     1  0.3714     0.6650 0.656 0.000 0.004 0.000 0.000 NA
#> GSM876858     5  0.2793     0.6819 0.000 0.200 0.000 0.000 0.800 NA
#> GSM876859     5  0.3330     0.6367 0.000 0.284 0.000 0.000 0.716 NA
#> GSM876860     5  0.2730     0.6828 0.000 0.192 0.000 0.000 0.808 NA
#> GSM876861     5  0.2378     0.6761 0.000 0.152 0.000 0.000 0.848 NA

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) tissue(p) k
#> MAD:NMF 71         8.09e-01  6.63e-11 2
#> MAD:NMF 66         8.71e-01  1.59e-13 3
#> MAD:NMF 72         6.88e-02  4.07e-22 4
#> MAD:NMF 67         6.06e-04  4.91e-19 5
#> MAD:NMF 62         8.36e-05  1.24e-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.


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 72 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 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-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.964           0.968       0.977         0.3657 0.634   0.634
#> 3 3 0.694           0.932       0.949         0.1576 0.972   0.956
#> 4 4 0.663           0.803       0.898         0.5468 0.716   0.531
#> 5 5 0.716           0.792       0.889         0.0381 0.994   0.982
#> 6 6 0.686           0.774       0.867         0.1318 0.836   0.523

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
#> GSM876886     1   0.311      0.961 0.944 0.056
#> GSM876887     1   0.311      0.961 0.944 0.056
#> GSM876888     1   0.000      0.978 1.000 0.000
#> GSM876889     2   0.000      0.968 0.000 1.000
#> GSM876890     2   0.443      0.924 0.092 0.908
#> GSM876891     2   0.469      0.915 0.100 0.900
#> GSM876862     1   0.000      0.978 1.000 0.000
#> GSM876863     1   0.000      0.978 1.000 0.000
#> GSM876864     1   0.000      0.978 1.000 0.000
#> GSM876865     1   0.000      0.978 1.000 0.000
#> GSM876866     2   0.443      0.924 0.092 0.908
#> GSM876867     1   0.000      0.978 1.000 0.000
#> GSM876838     1   0.000      0.978 1.000 0.000
#> GSM876839     1   0.000      0.978 1.000 0.000
#> GSM876840     2   0.295      0.955 0.052 0.948
#> GSM876841     1   0.000      0.978 1.000 0.000
#> GSM876842     1   0.311      0.961 0.944 0.056
#> GSM876843     2   0.000      0.968 0.000 1.000
#> GSM876892     1   0.311      0.961 0.944 0.056
#> GSM876893     1   0.311      0.961 0.944 0.056
#> GSM876894     1   0.311      0.961 0.944 0.056
#> GSM876895     1   0.278      0.964 0.952 0.048
#> GSM876896     2   0.000      0.968 0.000 1.000
#> GSM876897     2   0.000      0.968 0.000 1.000
#> GSM876868     1   0.000      0.978 1.000 0.000
#> GSM876869     1   0.000      0.978 1.000 0.000
#> GSM876870     1   0.000      0.978 1.000 0.000
#> GSM876871     1   0.000      0.978 1.000 0.000
#> GSM876872     2   0.000      0.968 0.000 1.000
#> GSM876873     2   0.000      0.968 0.000 1.000
#> GSM876844     1   0.311      0.961 0.944 0.056
#> GSM876845     1   0.000      0.978 1.000 0.000
#> GSM876846     2   0.000      0.968 0.000 1.000
#> GSM876847     1   0.000      0.978 1.000 0.000
#> GSM876848     2   0.000      0.968 0.000 1.000
#> GSM876849     2   0.000      0.968 0.000 1.000
#> GSM876898     1   0.000      0.978 1.000 0.000
#> GSM876899     1   0.278      0.964 0.952 0.048
#> GSM876900     1   0.311      0.961 0.944 0.056
#> GSM876901     1   0.000      0.978 1.000 0.000
#> GSM876902     2   0.000      0.968 0.000 1.000
#> GSM876903     1   0.278      0.964 0.952 0.048
#> GSM876904     1   0.000      0.978 1.000 0.000
#> GSM876874     1   0.000      0.978 1.000 0.000
#> GSM876875     1   0.311      0.961 0.944 0.056
#> GSM876876     1   0.000      0.978 1.000 0.000
#> GSM876877     1   0.000      0.978 1.000 0.000
#> GSM876878     1   0.000      0.978 1.000 0.000
#> GSM876879     1   0.311      0.961 0.944 0.056
#> GSM876880     1   0.000      0.978 1.000 0.000
#> GSM876850     1   0.000      0.978 1.000 0.000
#> GSM876851     1   0.000      0.978 1.000 0.000
#> GSM876852     1   0.311      0.961 0.944 0.056
#> GSM876853     1   0.000      0.978 1.000 0.000
#> GSM876854     2   0.295      0.955 0.052 0.948
#> GSM876855     2   0.295      0.955 0.052 0.948
#> GSM876856     2   0.295      0.955 0.052 0.948
#> GSM876905     1   0.000      0.978 1.000 0.000
#> GSM876906     1   0.311      0.961 0.944 0.056
#> GSM876907     1   0.278      0.964 0.952 0.048
#> GSM876908     1   0.278      0.964 0.952 0.048
#> GSM876909     1   0.000      0.978 1.000 0.000
#> GSM876881     1   0.000      0.978 1.000 0.000
#> GSM876882     1   0.311      0.961 0.944 0.056
#> GSM876883     1   0.311      0.961 0.944 0.056
#> GSM876884     1   0.000      0.978 1.000 0.000
#> GSM876885     1   0.311      0.961 0.944 0.056
#> GSM876857     1   0.000      0.978 1.000 0.000
#> GSM876858     1   0.000      0.978 1.000 0.000
#> GSM876859     1   0.000      0.978 1.000 0.000
#> GSM876860     1   0.000      0.978 1.000 0.000
#> GSM876861     1   0.311      0.961 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
#> GSM876886     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876887     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876888     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876889     2  0.2796      0.900 0.000 0.908 0.092
#> GSM876890     2  0.0000      0.932 0.000 1.000 0.000
#> GSM876891     2  0.0424      0.922 0.008 0.992 0.000
#> GSM876862     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876863     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876864     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876866     2  0.0000      0.932 0.000 1.000 0.000
#> GSM876867     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876838     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876839     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876840     2  0.1529      0.953 0.000 0.960 0.040
#> GSM876841     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876842     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876843     3  0.0000      0.914 0.000 0.000 1.000
#> GSM876892     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876893     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876894     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876895     1  0.1964      0.932 0.944 0.056 0.000
#> GSM876896     3  0.3116      0.945 0.000 0.108 0.892
#> GSM876897     3  0.3116      0.945 0.000 0.108 0.892
#> GSM876868     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876872     3  0.3116      0.945 0.000 0.108 0.892
#> GSM876873     3  0.3116      0.945 0.000 0.108 0.892
#> GSM876844     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876845     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876846     2  0.2796      0.900 0.000 0.908 0.092
#> GSM876847     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876848     3  0.0000      0.914 0.000 0.000 1.000
#> GSM876849     3  0.0000      0.914 0.000 0.000 1.000
#> GSM876898     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876899     1  0.1753      0.935 0.952 0.048 0.000
#> GSM876900     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876901     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876902     3  0.3116      0.945 0.000 0.108 0.892
#> GSM876903     1  0.1753      0.935 0.952 0.048 0.000
#> GSM876904     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876874     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876875     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876876     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876879     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876880     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876850     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876851     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876852     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876853     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876854     2  0.1529      0.953 0.000 0.960 0.040
#> GSM876855     2  0.1529      0.953 0.000 0.960 0.040
#> GSM876856     2  0.1529      0.953 0.000 0.960 0.040
#> GSM876905     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876906     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876907     1  0.1753      0.935 0.952 0.048 0.000
#> GSM876908     1  0.1753      0.935 0.952 0.048 0.000
#> GSM876909     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876881     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876882     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876883     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876884     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876885     1  0.3816      0.889 0.852 0.148 0.000
#> GSM876857     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876858     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876859     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876860     1  0.0000      0.951 1.000 0.000 0.000
#> GSM876861     1  0.3816      0.889 0.852 0.148 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3  p4
#> GSM876886     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876887     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876888     1   0.476      0.454 0.628 0.372 0.000 0.0
#> GSM876889     3   0.000      0.905 0.000 0.000 1.000 0.0
#> GSM876890     3   0.222      0.934 0.000 0.092 0.908 0.0
#> GSM876891     3   0.234      0.924 0.000 0.100 0.900 0.0
#> GSM876862     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876863     1   0.476      0.454 0.628 0.372 0.000 0.0
#> GSM876864     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876865     1   0.476      0.454 0.628 0.372 0.000 0.0
#> GSM876866     3   0.222      0.934 0.000 0.092 0.908 0.0
#> GSM876867     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876838     2   0.302      0.835 0.148 0.852 0.000 0.0
#> GSM876839     2   0.302      0.835 0.148 0.852 0.000 0.0
#> GSM876840     3   0.147      0.955 0.000 0.052 0.948 0.0
#> GSM876841     2   0.302      0.835 0.148 0.852 0.000 0.0
#> GSM876842     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876843     4   0.000      0.860 0.000 0.000 0.000 1.0
#> GSM876892     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876893     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876894     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876895     2   0.222      0.860 0.092 0.908 0.000 0.0
#> GSM876896     4   0.361      0.909 0.000 0.000 0.200 0.8
#> GSM876897     4   0.361      0.909 0.000 0.000 0.200 0.8
#> GSM876868     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876869     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876870     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876871     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876872     4   0.361      0.909 0.000 0.000 0.200 0.8
#> GSM876873     4   0.361      0.909 0.000 0.000 0.200 0.8
#> GSM876844     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876845     2   0.302      0.835 0.148 0.852 0.000 0.0
#> GSM876846     3   0.000      0.905 0.000 0.000 1.000 0.0
#> GSM876847     2   0.302      0.835 0.148 0.852 0.000 0.0
#> GSM876848     4   0.000      0.860 0.000 0.000 0.000 1.0
#> GSM876849     4   0.000      0.860 0.000 0.000 0.000 1.0
#> GSM876898     1   0.102      0.831 0.968 0.032 0.000 0.0
#> GSM876899     2   0.234      0.858 0.100 0.900 0.000 0.0
#> GSM876900     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876901     1   0.476      0.454 0.628 0.372 0.000 0.0
#> GSM876902     4   0.361      0.909 0.000 0.000 0.200 0.8
#> GSM876903     2   0.234      0.858 0.100 0.900 0.000 0.0
#> GSM876904     1   0.476      0.454 0.628 0.372 0.000 0.0
#> GSM876874     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876875     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876876     1   0.112      0.830 0.964 0.036 0.000 0.0
#> GSM876877     1   0.000      0.824 1.000 0.000 0.000 0.0
#> GSM876878     1   0.112      0.830 0.964 0.036 0.000 0.0
#> GSM876879     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876880     1   0.102      0.831 0.968 0.032 0.000 0.0
#> GSM876850     2   0.302      0.835 0.148 0.852 0.000 0.0
#> GSM876851     2   0.302      0.835 0.148 0.852 0.000 0.0
#> GSM876852     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876853     2   0.302      0.835 0.148 0.852 0.000 0.0
#> GSM876854     3   0.147      0.955 0.000 0.052 0.948 0.0
#> GSM876855     3   0.147      0.955 0.000 0.052 0.948 0.0
#> GSM876856     3   0.147      0.955 0.000 0.052 0.948 0.0
#> GSM876905     1   0.476      0.454 0.628 0.372 0.000 0.0
#> GSM876906     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876907     2   0.234      0.858 0.100 0.900 0.000 0.0
#> GSM876908     2   0.234      0.858 0.100 0.900 0.000 0.0
#> GSM876909     2   0.443      0.597 0.304 0.696 0.000 0.0
#> GSM876881     1   0.208      0.802 0.916 0.084 0.000 0.0
#> GSM876882     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876883     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876884     1   0.102      0.831 0.968 0.032 0.000 0.0
#> GSM876885     2   0.000      0.872 0.000 1.000 0.000 0.0
#> GSM876857     1   0.215      0.806 0.912 0.088 0.000 0.0
#> GSM876858     2   0.492      0.270 0.428 0.572 0.000 0.0
#> GSM876859     2   0.492      0.270 0.428 0.572 0.000 0.0
#> GSM876860     2   0.492      0.270 0.428 0.572 0.000 0.0
#> GSM876861     2   0.000      0.872 0.000 1.000 0.000 0.0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM876886     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876887     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876888     1  0.4074      0.411 0.636 0.364 0.000 0.000 0.000
#> GSM876889     3  0.3039      0.822 0.000 0.000 0.808 0.192 0.000
#> GSM876890     3  0.0510      0.914 0.000 0.016 0.984 0.000 0.000
#> GSM876891     3  0.0703      0.906 0.000 0.024 0.976 0.000 0.000
#> GSM876862     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876863     1  0.4074      0.411 0.636 0.364 0.000 0.000 0.000
#> GSM876864     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876865     1  0.4074      0.411 0.636 0.364 0.000 0.000 0.000
#> GSM876866     3  0.0510      0.914 0.000 0.016 0.984 0.000 0.000
#> GSM876867     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876838     2  0.2690      0.825 0.156 0.844 0.000 0.000 0.000
#> GSM876839     2  0.2690      0.825 0.156 0.844 0.000 0.000 0.000
#> GSM876840     3  0.1043      0.931 0.000 0.000 0.960 0.040 0.000
#> GSM876841     2  0.2690      0.825 0.156 0.844 0.000 0.000 0.000
#> GSM876842     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876843     5  0.1792      1.000 0.000 0.000 0.000 0.084 0.916
#> GSM876892     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876893     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876894     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876895     2  0.1544      0.861 0.068 0.932 0.000 0.000 0.000
#> GSM876896     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876869     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876870     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876871     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876872     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM876873     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM876844     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876845     2  0.2690      0.825 0.156 0.844 0.000 0.000 0.000
#> GSM876846     3  0.3109      0.814 0.000 0.000 0.800 0.200 0.000
#> GSM876847     2  0.2690      0.825 0.156 0.844 0.000 0.000 0.000
#> GSM876848     5  0.1792      1.000 0.000 0.000 0.000 0.084 0.916
#> GSM876849     5  0.1792      1.000 0.000 0.000 0.000 0.084 0.916
#> GSM876898     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM876899     2  0.1671      0.859 0.076 0.924 0.000 0.000 0.000
#> GSM876900     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876901     1  0.4074      0.411 0.636 0.364 0.000 0.000 0.000
#> GSM876902     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000
#> GSM876903     2  0.1671      0.859 0.076 0.924 0.000 0.000 0.000
#> GSM876904     1  0.4074      0.411 0.636 0.364 0.000 0.000 0.000
#> GSM876874     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876875     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876876     1  0.0162      0.769 0.996 0.004 0.000 0.000 0.000
#> GSM876877     1  0.2293      0.758 0.900 0.000 0.016 0.000 0.084
#> GSM876878     1  0.0162      0.769 0.996 0.004 0.000 0.000 0.000
#> GSM876879     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876880     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.2690      0.825 0.156 0.844 0.000 0.000 0.000
#> GSM876851     2  0.2690      0.825 0.156 0.844 0.000 0.000 0.000
#> GSM876852     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876853     2  0.2690      0.825 0.156 0.844 0.000 0.000 0.000
#> GSM876854     3  0.1043      0.931 0.000 0.000 0.960 0.040 0.000
#> GSM876855     3  0.1043      0.931 0.000 0.000 0.960 0.040 0.000
#> GSM876856     3  0.1043      0.931 0.000 0.000 0.960 0.040 0.000
#> GSM876905     1  0.4074      0.411 0.636 0.364 0.000 0.000 0.000
#> GSM876906     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876907     2  0.1671      0.859 0.076 0.924 0.000 0.000 0.000
#> GSM876908     2  0.1671      0.859 0.076 0.924 0.000 0.000 0.000
#> GSM876909     2  0.3857      0.599 0.312 0.688 0.000 0.000 0.000
#> GSM876881     1  0.1270      0.745 0.948 0.052 0.000 0.000 0.000
#> GSM876882     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876883     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876884     1  0.0000      0.769 1.000 0.000 0.000 0.000 0.000
#> GSM876885     2  0.0703      0.870 0.000 0.976 0.024 0.000 0.000
#> GSM876857     1  0.1410      0.746 0.940 0.060 0.000 0.000 0.000
#> GSM876858     2  0.4256      0.290 0.436 0.564 0.000 0.000 0.000
#> GSM876859     2  0.4256      0.290 0.436 0.564 0.000 0.000 0.000
#> GSM876860     2  0.4256      0.290 0.436 0.564 0.000 0.000 0.000
#> GSM876861     2  0.0703      0.870 0.000 0.976 0.024 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
#> GSM876886     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876887     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876888     2   0.386      0.332 0.480 0.520 0.000 0.000 0.000  0
#> GSM876889     3   0.460      0.773 0.000 0.152 0.696 0.152 0.000  0
#> GSM876890     3   0.328      0.849 0.000 0.152 0.808 0.000 0.040  0
#> GSM876891     3   0.341      0.843 0.000 0.152 0.800 0.000 0.048  0
#> GSM876862     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876863     2   0.386      0.332 0.480 0.520 0.000 0.000 0.000  0
#> GSM876864     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876865     2   0.386      0.332 0.480 0.520 0.000 0.000 0.000  0
#> GSM876866     3   0.328      0.849 0.000 0.152 0.808 0.000 0.040  0
#> GSM876867     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876838     2   0.238      0.658 0.000 0.848 0.000 0.000 0.152  0
#> GSM876839     2   0.238      0.658 0.000 0.848 0.000 0.000 0.152  0
#> GSM876840     3   0.000      0.878 0.000 0.000 1.000 0.000 0.000  0
#> GSM876841     2   0.238      0.658 0.000 0.848 0.000 0.000 0.152  0
#> GSM876842     5   0.313      0.715 0.000 0.248 0.000 0.000 0.752  0
#> GSM876843     6   0.000      1.000 0.000 0.000 0.000 0.000 0.000  1
#> GSM876892     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876893     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876894     5   0.026      0.866 0.000 0.008 0.000 0.000 0.992  0
#> GSM876895     5   0.279      0.741 0.000 0.200 0.000 0.000 0.800  0
#> GSM876896     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000  0
#> GSM876897     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000  0
#> GSM876868     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876869     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876870     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876871     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876872     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000  0
#> GSM876873     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000  0
#> GSM876844     5   0.313      0.715 0.000 0.248 0.000 0.000 0.752  0
#> GSM876845     2   0.238      0.658 0.000 0.848 0.000 0.000 0.152  0
#> GSM876846     3   0.245      0.779 0.000 0.000 0.840 0.160 0.000  0
#> GSM876847     2   0.238      0.658 0.000 0.848 0.000 0.000 0.152  0
#> GSM876848     6   0.000      1.000 0.000 0.000 0.000 0.000 0.000  1
#> GSM876849     6   0.000      1.000 0.000 0.000 0.000 0.000 0.000  1
#> GSM876898     1   0.242      0.819 0.844 0.156 0.000 0.000 0.000  0
#> GSM876899     5   0.291      0.723 0.000 0.216 0.000 0.000 0.784  0
#> GSM876900     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876901     2   0.386      0.332 0.480 0.520 0.000 0.000 0.000  0
#> GSM876902     4   0.000      1.000 0.000 0.000 0.000 1.000 0.000  0
#> GSM876903     5   0.291      0.723 0.000 0.216 0.000 0.000 0.784  0
#> GSM876904     2   0.386      0.332 0.480 0.520 0.000 0.000 0.000  0
#> GSM876874     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876875     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876876     1   0.245      0.815 0.840 0.160 0.000 0.000 0.000  0
#> GSM876877     1   0.000      0.881 1.000 0.000 0.000 0.000 0.000  0
#> GSM876878     1   0.245      0.815 0.840 0.160 0.000 0.000 0.000  0
#> GSM876879     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876880     1   0.242      0.819 0.844 0.156 0.000 0.000 0.000  0
#> GSM876850     2   0.238      0.658 0.000 0.848 0.000 0.000 0.152  0
#> GSM876851     2   0.238      0.658 0.000 0.848 0.000 0.000 0.152  0
#> GSM876852     5   0.313      0.715 0.000 0.248 0.000 0.000 0.752  0
#> GSM876853     2   0.238      0.658 0.000 0.848 0.000 0.000 0.152  0
#> GSM876854     3   0.000      0.878 0.000 0.000 1.000 0.000 0.000  0
#> GSM876855     3   0.000      0.878 0.000 0.000 1.000 0.000 0.000  0
#> GSM876856     3   0.000      0.878 0.000 0.000 1.000 0.000 0.000  0
#> GSM876905     2   0.386      0.332 0.480 0.520 0.000 0.000 0.000  0
#> GSM876906     5   0.026      0.866 0.000 0.008 0.000 0.000 0.992  0
#> GSM876907     5   0.291      0.723 0.000 0.216 0.000 0.000 0.784  0
#> GSM876908     5   0.291      0.723 0.000 0.216 0.000 0.000 0.784  0
#> GSM876909     2   0.430      0.662 0.156 0.728 0.000 0.000 0.116  0
#> GSM876881     1   0.282      0.763 0.796 0.204 0.000 0.000 0.000  0
#> GSM876882     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876883     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876884     1   0.242      0.819 0.844 0.156 0.000 0.000 0.000  0
#> GSM876885     5   0.000      0.867 0.000 0.000 0.000 0.000 1.000  0
#> GSM876857     1   0.291      0.715 0.784 0.216 0.000 0.000 0.000  0
#> GSM876858     2   0.331      0.596 0.280 0.720 0.000 0.000 0.000  0
#> GSM876859     2   0.331      0.596 0.280 0.720 0.000 0.000 0.000  0
#> GSM876860     2   0.331      0.596 0.280 0.720 0.000 0.000 0.000  0
#> GSM876861     5   0.313      0.715 0.000 0.248 0.000 0.000 0.752  0

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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) tissue(p) k
#> ATC:hclust 72          0.04298  2.32e-01 2
#> ATC:hclust 72          0.00445  4.62e-01 3
#> ATC:hclust 63          0.04100  1.36e-04 4
#> ATC:hclust 63          0.09415  1.94e-05 5
#> ATC:hclust 66          0.10482  2.79e-08 6

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


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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.3512 0.649   0.649
#> 3 3 0.886           0.877       0.953         0.7817 0.649   0.490
#> 4 4 0.719           0.679       0.864         0.1701 0.822   0.559
#> 5 5 0.765           0.727       0.847         0.0661 0.875   0.581
#> 6 6 0.771           0.701       0.823         0.0469 0.937   0.724

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
#> GSM876886     1       0          1  1  0
#> GSM876887     1       0          1  1  0
#> GSM876888     1       0          1  1  0
#> GSM876889     2       0          1  0  1
#> GSM876890     2       0          1  0  1
#> GSM876891     1       0          1  1  0
#> GSM876862     1       0          1  1  0
#> GSM876863     1       0          1  1  0
#> GSM876864     1       0          1  1  0
#> GSM876865     1       0          1  1  0
#> GSM876866     2       0          1  0  1
#> GSM876867     1       0          1  1  0
#> GSM876838     1       0          1  1  0
#> GSM876839     1       0          1  1  0
#> GSM876840     2       0          1  0  1
#> GSM876841     1       0          1  1  0
#> GSM876842     1       0          1  1  0
#> GSM876843     2       0          1  0  1
#> GSM876892     1       0          1  1  0
#> GSM876893     1       0          1  1  0
#> GSM876894     1       0          1  1  0
#> GSM876895     1       0          1  1  0
#> GSM876896     2       0          1  0  1
#> GSM876897     2       0          1  0  1
#> GSM876868     1       0          1  1  0
#> GSM876869     1       0          1  1  0
#> GSM876870     1       0          1  1  0
#> GSM876871     1       0          1  1  0
#> GSM876872     2       0          1  0  1
#> GSM876873     2       0          1  0  1
#> GSM876844     1       0          1  1  0
#> GSM876845     1       0          1  1  0
#> GSM876846     2       0          1  0  1
#> GSM876847     1       0          1  1  0
#> GSM876848     2       0          1  0  1
#> GSM876849     2       0          1  0  1
#> GSM876898     1       0          1  1  0
#> GSM876899     1       0          1  1  0
#> GSM876900     1       0          1  1  0
#> GSM876901     1       0          1  1  0
#> GSM876902     2       0          1  0  1
#> GSM876903     1       0          1  1  0
#> GSM876904     1       0          1  1  0
#> GSM876874     1       0          1  1  0
#> GSM876875     1       0          1  1  0
#> GSM876876     1       0          1  1  0
#> GSM876877     1       0          1  1  0
#> GSM876878     1       0          1  1  0
#> GSM876879     1       0          1  1  0
#> GSM876880     1       0          1  1  0
#> GSM876850     1       0          1  1  0
#> GSM876851     1       0          1  1  0
#> GSM876852     1       0          1  1  0
#> GSM876853     1       0          1  1  0
#> GSM876854     2       0          1  0  1
#> GSM876855     2       0          1  0  1
#> GSM876856     2       0          1  0  1
#> GSM876905     1       0          1  1  0
#> GSM876906     1       0          1  1  0
#> GSM876907     1       0          1  1  0
#> GSM876908     1       0          1  1  0
#> GSM876909     1       0          1  1  0
#> GSM876881     1       0          1  1  0
#> GSM876882     1       0          1  1  0
#> GSM876883     1       0          1  1  0
#> GSM876884     1       0          1  1  0
#> GSM876885     1       0          1  1  0
#> GSM876857     1       0          1  1  0
#> GSM876858     1       0          1  1  0
#> GSM876859     1       0          1  1  0
#> GSM876860     1       0          1  1  0
#> GSM876861     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1   p2    p3
#> GSM876886     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876887     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876888     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876889     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876890     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876891     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876862     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876863     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876864     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876865     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876866     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876867     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876838     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876839     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876840     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876841     3  0.5216      0.669 0.260 0.00 0.740
#> GSM876842     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876843     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876892     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876893     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876894     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876895     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876896     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876897     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876868     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876869     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876870     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876871     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876872     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876873     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876844     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876845     3  0.5291      0.657 0.268 0.00 0.732
#> GSM876846     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876847     3  0.6302      0.184 0.480 0.00 0.520
#> GSM876848     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876849     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876898     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876899     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876900     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876901     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876902     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876903     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876904     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876874     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876875     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876876     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876877     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876878     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876879     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876880     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876850     3  0.6302      0.184 0.480 0.00 0.520
#> GSM876851     3  0.5216      0.669 0.260 0.00 0.740
#> GSM876852     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876853     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876854     2  0.0000      0.956 0.000 1.00 0.000
#> GSM876855     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876856     2  0.6302      0.140 0.000 0.52 0.480
#> GSM876905     1  0.0592      0.966 0.988 0.00 0.012
#> GSM876906     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876907     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876908     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876909     3  0.6302      0.184 0.480 0.00 0.520
#> GSM876881     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876882     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876883     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876884     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876885     3  0.0000      0.913 0.000 0.00 1.000
#> GSM876857     1  0.0000      0.979 1.000 0.00 0.000
#> GSM876858     3  0.5216      0.669 0.260 0.00 0.740
#> GSM876859     1  0.5859      0.382 0.656 0.00 0.344
#> GSM876860     3  0.2537      0.852 0.080 0.00 0.920
#> GSM876861     3  0.0000      0.913 0.000 0.00 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     3  0.3837     0.6961 0.000 0.224 0.776 0.000
#> GSM876887     3  0.1118     0.6696 0.000 0.036 0.964 0.000
#> GSM876888     1  0.3123     0.7814 0.844 0.156 0.000 0.000
#> GSM876889     4  0.4134     0.7718 0.000 0.000 0.260 0.740
#> GSM876890     3  0.0000     0.6535 0.000 0.000 1.000 0.000
#> GSM876891     3  0.1118     0.6696 0.000 0.036 0.964 0.000
#> GSM876862     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876863     1  0.3123     0.7814 0.844 0.156 0.000 0.000
#> GSM876864     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876866     3  0.0000     0.6535 0.000 0.000 1.000 0.000
#> GSM876867     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0000     0.7316 0.000 1.000 0.000 0.000
#> GSM876839     2  0.0000     0.7316 0.000 1.000 0.000 0.000
#> GSM876840     4  0.3837     0.8092 0.000 0.000 0.224 0.776
#> GSM876841     2  0.0000     0.7316 0.000 1.000 0.000 0.000
#> GSM876842     2  0.3266     0.5545 0.000 0.832 0.168 0.000
#> GSM876843     4  0.0000     0.9493 0.000 0.000 0.000 1.000
#> GSM876892     3  0.3837     0.6961 0.000 0.224 0.776 0.000
#> GSM876893     2  0.4916     0.2039 0.000 0.576 0.424 0.000
#> GSM876894     3  0.4356     0.6243 0.000 0.292 0.708 0.000
#> GSM876895     2  0.4877     0.2498 0.000 0.592 0.408 0.000
#> GSM876896     4  0.0000     0.9493 0.000 0.000 0.000 1.000
#> GSM876897     4  0.0000     0.9493 0.000 0.000 0.000 1.000
#> GSM876868     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0921     0.9473 0.000 0.000 0.028 0.972
#> GSM876873     4  0.0921     0.9473 0.000 0.000 0.028 0.972
#> GSM876844     2  0.4164     0.3744 0.000 0.736 0.264 0.000
#> GSM876845     2  0.0000     0.7316 0.000 1.000 0.000 0.000
#> GSM876846     4  0.1118     0.9444 0.000 0.000 0.036 0.964
#> GSM876847     2  0.1637     0.7042 0.060 0.940 0.000 0.000
#> GSM876848     4  0.0000     0.9493 0.000 0.000 0.000 1.000
#> GSM876849     4  0.0000     0.9493 0.000 0.000 0.000 1.000
#> GSM876898     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876899     2  0.4877     0.2498 0.000 0.592 0.408 0.000
#> GSM876900     3  0.4804     0.4217 0.000 0.384 0.616 0.000
#> GSM876901     1  0.4992     0.0848 0.524 0.476 0.000 0.000
#> GSM876902     4  0.0592     0.9490 0.000 0.000 0.016 0.984
#> GSM876903     2  0.4866     0.2591 0.000 0.596 0.404 0.000
#> GSM876904     1  0.4981     0.1295 0.536 0.464 0.000 0.000
#> GSM876874     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876875     3  0.4222     0.6529 0.000 0.272 0.728 0.000
#> GSM876876     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876879     3  0.4222     0.6529 0.000 0.272 0.728 0.000
#> GSM876880     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876850     2  0.1637     0.7042 0.060 0.940 0.000 0.000
#> GSM876851     2  0.0000     0.7316 0.000 1.000 0.000 0.000
#> GSM876852     3  0.4977     0.1975 0.000 0.460 0.540 0.000
#> GSM876853     2  0.0000     0.7316 0.000 1.000 0.000 0.000
#> GSM876854     3  0.4967    -0.2471 0.000 0.000 0.548 0.452
#> GSM876855     3  0.3311     0.5326 0.000 0.172 0.828 0.000
#> GSM876856     3  0.4543     0.1573 0.000 0.000 0.676 0.324
#> GSM876905     2  0.4985     0.0382 0.468 0.532 0.000 0.000
#> GSM876906     3  0.4356     0.6243 0.000 0.292 0.708 0.000
#> GSM876907     2  0.3311     0.6071 0.000 0.828 0.172 0.000
#> GSM876908     2  0.4866     0.2591 0.000 0.596 0.404 0.000
#> GSM876909     2  0.1637     0.7042 0.060 0.940 0.000 0.000
#> GSM876881     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876882     3  0.3837     0.6961 0.000 0.224 0.776 0.000
#> GSM876883     3  0.3837     0.6961 0.000 0.224 0.776 0.000
#> GSM876884     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876885     3  0.3873     0.6934 0.000 0.228 0.772 0.000
#> GSM876857     1  0.0000     0.9265 1.000 0.000 0.000 0.000
#> GSM876858     2  0.0000     0.7316 0.000 1.000 0.000 0.000
#> GSM876859     2  0.2216     0.6749 0.092 0.908 0.000 0.000
#> GSM876860     2  0.0000     0.7316 0.000 1.000 0.000 0.000
#> GSM876861     2  0.4776     0.0949 0.000 0.624 0.376 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
#> GSM876886     5  0.1341   0.825080 0.000 0.000 0.056 0.000 0.944
#> GSM876887     5  0.3305   0.627660 0.000 0.000 0.224 0.000 0.776
#> GSM876888     1  0.6507   0.637060 0.620 0.168 0.156 0.000 0.056
#> GSM876889     3  0.3336   0.595450 0.000 0.000 0.772 0.228 0.000
#> GSM876890     3  0.4060   0.477851 0.000 0.000 0.640 0.000 0.360
#> GSM876891     5  0.3305   0.627660 0.000 0.000 0.224 0.000 0.776
#> GSM876862     1  0.0510   0.863984 0.984 0.000 0.016 0.000 0.000
#> GSM876863     1  0.6539   0.632959 0.616 0.172 0.156 0.000 0.056
#> GSM876864     1  0.0404   0.864573 0.988 0.000 0.012 0.000 0.000
#> GSM876865     1  0.2439   0.841871 0.876 0.000 0.120 0.000 0.004
#> GSM876866     3  0.4088   0.461077 0.000 0.000 0.632 0.000 0.368
#> GSM876867     1  0.0000   0.865925 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0880   0.854993 0.000 0.968 0.000 0.000 0.032
#> GSM876839     2  0.0880   0.854993 0.000 0.968 0.000 0.000 0.032
#> GSM876840     3  0.3366   0.589880 0.000 0.000 0.768 0.232 0.000
#> GSM876841     2  0.0880   0.854993 0.000 0.968 0.000 0.000 0.032
#> GSM876842     2  0.3837   0.579460 0.000 0.692 0.000 0.000 0.308
#> GSM876843     4  0.0880   0.828859 0.000 0.032 0.000 0.968 0.000
#> GSM876892     5  0.1341   0.825080 0.000 0.000 0.056 0.000 0.944
#> GSM876893     5  0.1701   0.815056 0.000 0.048 0.016 0.000 0.936
#> GSM876894     5  0.0510   0.830318 0.000 0.016 0.000 0.000 0.984
#> GSM876895     5  0.1965   0.801986 0.000 0.096 0.000 0.000 0.904
#> GSM876896     4  0.1410   0.841995 0.000 0.000 0.060 0.940 0.000
#> GSM876897     4  0.1410   0.841995 0.000 0.000 0.060 0.940 0.000
#> GSM876868     1  0.0000   0.865925 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0404   0.864573 0.988 0.000 0.012 0.000 0.000
#> GSM876870     1  0.0000   0.865925 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0510   0.863984 0.984 0.000 0.016 0.000 0.000
#> GSM876872     4  0.3508   0.725872 0.000 0.000 0.252 0.748 0.000
#> GSM876873     4  0.3508   0.725872 0.000 0.000 0.252 0.748 0.000
#> GSM876844     2  0.4101   0.546654 0.000 0.664 0.004 0.000 0.332
#> GSM876845     2  0.0880   0.854993 0.000 0.968 0.000 0.000 0.032
#> GSM876846     3  0.4114   0.274128 0.000 0.000 0.624 0.376 0.000
#> GSM876847     2  0.0992   0.850614 0.008 0.968 0.000 0.000 0.024
#> GSM876848     4  0.0880   0.828859 0.000 0.032 0.000 0.968 0.000
#> GSM876849     4  0.0880   0.828859 0.000 0.032 0.000 0.968 0.000
#> GSM876898     1  0.2020   0.849606 0.900 0.000 0.100 0.000 0.000
#> GSM876899     5  0.1965   0.801986 0.000 0.096 0.000 0.000 0.904
#> GSM876900     5  0.0794   0.828469 0.000 0.028 0.000 0.000 0.972
#> GSM876901     1  0.8352   0.175723 0.344 0.288 0.156 0.000 0.212
#> GSM876902     4  0.3366   0.747447 0.000 0.000 0.232 0.768 0.000
#> GSM876903     5  0.1965   0.801986 0.000 0.096 0.000 0.000 0.904
#> GSM876904     1  0.8277   0.227146 0.368 0.284 0.156 0.000 0.192
#> GSM876874     1  0.0510   0.863984 0.984 0.000 0.016 0.000 0.000
#> GSM876875     5  0.1484   0.829253 0.000 0.008 0.048 0.000 0.944
#> GSM876876     1  0.2280   0.843317 0.880 0.000 0.120 0.000 0.000
#> GSM876877     1  0.0510   0.863984 0.984 0.000 0.016 0.000 0.000
#> GSM876878     1  0.2439   0.841871 0.876 0.000 0.120 0.000 0.004
#> GSM876879     5  0.1484   0.829253 0.000 0.008 0.048 0.000 0.944
#> GSM876880     1  0.0000   0.865925 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0992   0.850614 0.008 0.968 0.000 0.000 0.024
#> GSM876851     2  0.0880   0.854993 0.000 0.968 0.000 0.000 0.032
#> GSM876852     2  0.5252   0.422614 0.000 0.580 0.056 0.000 0.364
#> GSM876853     2  0.0880   0.854993 0.000 0.968 0.000 0.000 0.032
#> GSM876854     3  0.3841   0.631797 0.000 0.000 0.780 0.188 0.032
#> GSM876855     3  0.4444   0.625769 0.000 0.088 0.756 0.000 0.156
#> GSM876856     3  0.4691   0.659229 0.000 0.024 0.772 0.100 0.104
#> GSM876905     5  0.8173   0.000622 0.168 0.288 0.156 0.000 0.388
#> GSM876906     5  0.0510   0.830318 0.000 0.016 0.000 0.000 0.984
#> GSM876907     5  0.5111  -0.020885 0.000 0.464 0.036 0.000 0.500
#> GSM876908     5  0.2519   0.788219 0.000 0.100 0.016 0.000 0.884
#> GSM876909     2  0.3482   0.791388 0.008 0.844 0.052 0.000 0.096
#> GSM876881     1  0.2074   0.847513 0.896 0.000 0.104 0.000 0.000
#> GSM876882     5  0.1341   0.825080 0.000 0.000 0.056 0.000 0.944
#> GSM876883     5  0.1341   0.825080 0.000 0.000 0.056 0.000 0.944
#> GSM876884     1  0.0000   0.865925 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5  0.1341   0.825080 0.000 0.000 0.056 0.000 0.944
#> GSM876857     1  0.2179   0.846220 0.888 0.000 0.112 0.000 0.000
#> GSM876858     2  0.2278   0.834920 0.000 0.908 0.032 0.000 0.060
#> GSM876859     2  0.3138   0.814462 0.024 0.876 0.048 0.000 0.052
#> GSM876860     2  0.2278   0.834920 0.000 0.908 0.032 0.000 0.060
#> GSM876861     2  0.4449   0.237686 0.000 0.512 0.004 0.000 0.484

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     6  0.0508     0.7771 0.000 0.004 0.000 0.000 0.012 0.984
#> GSM876887     6  0.2888     0.6591 0.000 0.004 0.068 0.000 0.068 0.860
#> GSM876888     5  0.4617     0.3290 0.328 0.040 0.008 0.000 0.624 0.000
#> GSM876889     3  0.3557     0.7009 0.000 0.000 0.800 0.140 0.056 0.004
#> GSM876890     3  0.5116     0.4680 0.000 0.004 0.524 0.000 0.072 0.400
#> GSM876891     6  0.3155     0.6328 0.000 0.004 0.088 0.000 0.068 0.840
#> GSM876862     1  0.0725     0.8344 0.976 0.000 0.012 0.000 0.012 0.000
#> GSM876863     5  0.4541     0.3273 0.336 0.040 0.004 0.000 0.620 0.000
#> GSM876864     1  0.0000     0.8419 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.3881     0.4634 0.600 0.000 0.004 0.000 0.396 0.000
#> GSM876866     3  0.5132     0.4467 0.000 0.004 0.512 0.000 0.072 0.412
#> GSM876867     1  0.0000     0.8419 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0146     0.8446 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM876839     2  0.0291     0.8438 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM876840     3  0.1714     0.7356 0.000 0.000 0.908 0.092 0.000 0.000
#> GSM876841     2  0.1152     0.8496 0.000 0.952 0.000 0.000 0.044 0.004
#> GSM876842     2  0.2912     0.7198 0.000 0.816 0.000 0.000 0.012 0.172
#> GSM876843     4  0.2234     0.8012 0.000 0.000 0.004 0.872 0.124 0.000
#> GSM876892     6  0.0922     0.7830 0.000 0.004 0.004 0.000 0.024 0.968
#> GSM876893     6  0.3679     0.7356 0.000 0.004 0.012 0.000 0.260 0.724
#> GSM876894     6  0.3593     0.7635 0.000 0.004 0.024 0.000 0.208 0.764
#> GSM876895     6  0.4430     0.7316 0.000 0.032 0.028 0.000 0.232 0.708
#> GSM876896     4  0.1204     0.8290 0.000 0.000 0.056 0.944 0.000 0.000
#> GSM876897     4  0.1204     0.8290 0.000 0.000 0.056 0.944 0.000 0.000
#> GSM876868     1  0.0000     0.8419 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.8419 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.8419 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0725     0.8344 0.976 0.000 0.012 0.000 0.012 0.000
#> GSM876872     4  0.3081     0.7527 0.000 0.000 0.220 0.776 0.004 0.000
#> GSM876873     4  0.3081     0.7527 0.000 0.000 0.220 0.776 0.004 0.000
#> GSM876844     2  0.2980     0.7135 0.000 0.808 0.000 0.000 0.012 0.180
#> GSM876845     2  0.1152     0.8496 0.000 0.952 0.000 0.000 0.044 0.004
#> GSM876846     3  0.2340     0.6827 0.000 0.000 0.852 0.148 0.000 0.000
#> GSM876847     2  0.1285     0.8457 0.004 0.944 0.000 0.000 0.052 0.000
#> GSM876848     4  0.2234     0.8012 0.000 0.000 0.004 0.872 0.124 0.000
#> GSM876849     4  0.2234     0.8012 0.000 0.000 0.004 0.872 0.124 0.000
#> GSM876898     1  0.3748     0.6203 0.688 0.000 0.012 0.000 0.300 0.000
#> GSM876899     6  0.4479     0.7249 0.000 0.032 0.028 0.000 0.240 0.700
#> GSM876900     6  0.3341     0.7668 0.000 0.004 0.012 0.000 0.208 0.776
#> GSM876901     5  0.4534     0.6732 0.096 0.072 0.000 0.000 0.760 0.072
#> GSM876902     4  0.2994     0.7631 0.000 0.000 0.208 0.788 0.004 0.000
#> GSM876903     6  0.4454     0.7287 0.000 0.032 0.028 0.000 0.236 0.704
#> GSM876904     5  0.4647     0.6661 0.108 0.068 0.004 0.000 0.756 0.064
#> GSM876874     1  0.1003     0.8347 0.964 0.000 0.020 0.000 0.016 0.000
#> GSM876875     6  0.1349     0.7887 0.000 0.004 0.000 0.000 0.056 0.940
#> GSM876876     1  0.3784     0.6118 0.680 0.000 0.012 0.000 0.308 0.000
#> GSM876877     1  0.0914     0.8346 0.968 0.000 0.016 0.000 0.016 0.000
#> GSM876878     1  0.4084     0.4566 0.588 0.000 0.012 0.000 0.400 0.000
#> GSM876879     6  0.1349     0.7887 0.000 0.004 0.000 0.000 0.056 0.940
#> GSM876880     1  0.0405     0.8405 0.988 0.000 0.008 0.000 0.004 0.000
#> GSM876850     2  0.1285     0.8457 0.004 0.944 0.000 0.000 0.052 0.000
#> GSM876851     2  0.1152     0.8496 0.000 0.952 0.000 0.000 0.044 0.004
#> GSM876852     2  0.4051     0.6789 0.000 0.760 0.056 0.000 0.012 0.172
#> GSM876853     2  0.0291     0.8438 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM876854     3  0.1434     0.7540 0.000 0.000 0.940 0.048 0.000 0.012
#> GSM876855     3  0.1856     0.7316 0.000 0.048 0.920 0.000 0.000 0.032
#> GSM876856     3  0.1633     0.7552 0.000 0.000 0.932 0.044 0.000 0.024
#> GSM876905     5  0.4444     0.6458 0.044 0.076 0.000 0.000 0.760 0.120
#> GSM876906     6  0.3613     0.7663 0.000 0.008 0.024 0.000 0.196 0.772
#> GSM876907     5  0.6416    -0.1511 0.000 0.176 0.032 0.000 0.400 0.392
#> GSM876908     6  0.4525     0.7167 0.000 0.032 0.028 0.000 0.248 0.692
#> GSM876909     5  0.5167     0.2338 0.004 0.352 0.032 0.000 0.580 0.032
#> GSM876881     1  0.3905     0.5928 0.668 0.000 0.016 0.000 0.316 0.000
#> GSM876882     6  0.0146     0.7831 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM876883     6  0.0146     0.7831 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM876884     1  0.0405     0.8405 0.988 0.000 0.008 0.000 0.004 0.000
#> GSM876885     6  0.0146     0.7831 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM876857     1  0.3050     0.6900 0.764 0.000 0.000 0.000 0.236 0.000
#> GSM876858     2  0.3580     0.7218 0.000 0.772 0.028 0.000 0.196 0.004
#> GSM876859     2  0.4560     0.3984 0.008 0.592 0.028 0.000 0.372 0.000
#> GSM876860     2  0.3580     0.7218 0.000 0.772 0.028 0.000 0.196 0.004
#> GSM876861     6  0.5449     0.0103 0.000 0.444 0.028 0.000 0.056 0.472

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-kmeans-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) tissue(p) k
#> ATC:kmeans 72           0.0545  2.17e-01 2
#> ATC:kmeans 67           0.0959  2.74e-04 3
#> ATC:kmeans 58           0.1257  2.37e-07 4
#> ATC:kmeans 63           0.1377  1.83e-10 5
#> ATC:kmeans 62           0.3559  3.48e-11 6

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


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

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

collect_plots(res)

plot of chunk 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.995       0.998         0.4815 0.518   0.518
#> 3 3 0.758           0.910       0.946         0.3150 0.803   0.632
#> 4 4 0.816           0.756       0.885         0.1185 0.884   0.693
#> 5 5 0.949           0.903       0.963         0.0795 0.905   0.689
#> 6 6 0.928           0.849       0.924         0.0300 0.959   0.833

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette   p1   p2
#> GSM876886     2   0.000      0.994 0.00 1.00
#> GSM876887     2   0.000      0.994 0.00 1.00
#> GSM876888     1   0.000      1.000 1.00 0.00
#> GSM876889     2   0.000      0.994 0.00 1.00
#> GSM876890     2   0.000      0.994 0.00 1.00
#> GSM876891     2   0.000      0.994 0.00 1.00
#> GSM876862     1   0.000      1.000 1.00 0.00
#> GSM876863     1   0.000      1.000 1.00 0.00
#> GSM876864     1   0.000      1.000 1.00 0.00
#> GSM876865     1   0.000      1.000 1.00 0.00
#> GSM876866     2   0.000      0.994 0.00 1.00
#> GSM876867     1   0.000      1.000 1.00 0.00
#> GSM876838     1   0.000      1.000 1.00 0.00
#> GSM876839     1   0.000      1.000 1.00 0.00
#> GSM876840     2   0.000      0.994 0.00 1.00
#> GSM876841     1   0.000      1.000 1.00 0.00
#> GSM876842     2   0.000      0.994 0.00 1.00
#> GSM876843     2   0.000      0.994 0.00 1.00
#> GSM876892     2   0.000      0.994 0.00 1.00
#> GSM876893     1   0.000      1.000 1.00 0.00
#> GSM876894     1   0.000      1.000 1.00 0.00
#> GSM876895     1   0.000      1.000 1.00 0.00
#> GSM876896     2   0.000      0.994 0.00 1.00
#> GSM876897     2   0.000      0.994 0.00 1.00
#> GSM876868     1   0.000      1.000 1.00 0.00
#> GSM876869     1   0.000      1.000 1.00 0.00
#> GSM876870     1   0.000      1.000 1.00 0.00
#> GSM876871     1   0.000      1.000 1.00 0.00
#> GSM876872     2   0.000      0.994 0.00 1.00
#> GSM876873     2   0.000      0.994 0.00 1.00
#> GSM876844     2   0.000      0.994 0.00 1.00
#> GSM876845     1   0.000      1.000 1.00 0.00
#> GSM876846     2   0.000      0.994 0.00 1.00
#> GSM876847     1   0.000      1.000 1.00 0.00
#> GSM876848     2   0.000      0.994 0.00 1.00
#> GSM876849     2   0.000      0.994 0.00 1.00
#> GSM876898     1   0.000      1.000 1.00 0.00
#> GSM876899     1   0.000      1.000 1.00 0.00
#> GSM876900     1   0.000      1.000 1.00 0.00
#> GSM876901     1   0.000      1.000 1.00 0.00
#> GSM876902     2   0.000      0.994 0.00 1.00
#> GSM876903     1   0.000      1.000 1.00 0.00
#> GSM876904     1   0.000      1.000 1.00 0.00
#> GSM876874     1   0.000      1.000 1.00 0.00
#> GSM876875     1   0.000      1.000 1.00 0.00
#> GSM876876     1   0.000      1.000 1.00 0.00
#> GSM876877     1   0.000      1.000 1.00 0.00
#> GSM876878     1   0.000      1.000 1.00 0.00
#> GSM876879     1   0.000      1.000 1.00 0.00
#> GSM876880     1   0.000      1.000 1.00 0.00
#> GSM876850     1   0.000      1.000 1.00 0.00
#> GSM876851     1   0.000      1.000 1.00 0.00
#> GSM876852     2   0.000      0.994 0.00 1.00
#> GSM876853     1   0.000      1.000 1.00 0.00
#> GSM876854     2   0.000      0.994 0.00 1.00
#> GSM876855     2   0.000      0.994 0.00 1.00
#> GSM876856     2   0.000      0.994 0.00 1.00
#> GSM876905     1   0.000      1.000 1.00 0.00
#> GSM876906     2   0.634      0.810 0.16 0.84
#> GSM876907     1   0.000      1.000 1.00 0.00
#> GSM876908     1   0.000      1.000 1.00 0.00
#> GSM876909     1   0.000      1.000 1.00 0.00
#> GSM876881     1   0.000      1.000 1.00 0.00
#> GSM876882     2   0.000      0.994 0.00 1.00
#> GSM876883     2   0.000      0.994 0.00 1.00
#> GSM876884     1   0.000      1.000 1.00 0.00
#> GSM876885     2   0.000      0.994 0.00 1.00
#> GSM876857     1   0.000      1.000 1.00 0.00
#> GSM876858     1   0.000      1.000 1.00 0.00
#> GSM876859     1   0.000      1.000 1.00 0.00
#> GSM876860     1   0.000      1.000 1.00 0.00
#> GSM876861     2   0.000      0.994 0.00 1.00

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM876886     3  0.3267     0.8962 0.000 0.116 0.884
#> GSM876887     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876888     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876889     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876890     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876891     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876862     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876863     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876864     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876865     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876866     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876867     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876838     2  0.3267     0.9007 0.116 0.884 0.000
#> GSM876839     2  0.3267     0.9007 0.116 0.884 0.000
#> GSM876840     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876841     2  0.3267     0.9007 0.116 0.884 0.000
#> GSM876842     2  0.3267     0.8084 0.000 0.884 0.116
#> GSM876843     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876892     3  0.0237     0.9691 0.000 0.004 0.996
#> GSM876893     1  0.0237     0.9682 0.996 0.004 0.000
#> GSM876894     1  0.3267     0.8563 0.884 0.116 0.000
#> GSM876895     1  0.0237     0.9682 0.996 0.004 0.000
#> GSM876896     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876897     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876868     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876869     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876870     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876871     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876872     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876873     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876844     2  0.3267     0.8084 0.000 0.884 0.116
#> GSM876845     2  0.3267     0.9007 0.116 0.884 0.000
#> GSM876846     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876847     2  0.3267     0.9007 0.116 0.884 0.000
#> GSM876848     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876849     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876898     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876899     1  0.0237     0.9682 0.996 0.004 0.000
#> GSM876900     1  0.0237     0.9682 0.996 0.004 0.000
#> GSM876901     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876902     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876903     2  0.6309     0.1731 0.496 0.504 0.000
#> GSM876904     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876874     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876875     1  0.3267     0.8563 0.884 0.116 0.000
#> GSM876876     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876877     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876878     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876879     1  0.3267     0.8563 0.884 0.116 0.000
#> GSM876880     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876850     2  0.3267     0.9007 0.116 0.884 0.000
#> GSM876851     2  0.3267     0.9007 0.116 0.884 0.000
#> GSM876852     2  0.6126     0.3781 0.000 0.600 0.400
#> GSM876853     2  0.3267     0.9007 0.116 0.884 0.000
#> GSM876854     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876855     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876856     3  0.0000     0.9716 0.000 0.000 1.000
#> GSM876905     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876906     3  0.4110     0.7770 0.152 0.004 0.844
#> GSM876907     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876908     1  0.0237     0.9682 0.996 0.004 0.000
#> GSM876909     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876881     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876882     3  0.3267     0.8962 0.000 0.116 0.884
#> GSM876883     3  0.3267     0.8962 0.000 0.116 0.884
#> GSM876884     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876885     3  0.3267     0.8962 0.000 0.116 0.884
#> GSM876857     1  0.0000     0.9707 1.000 0.000 0.000
#> GSM876858     2  0.3686     0.8841 0.140 0.860 0.000
#> GSM876859     1  0.6215     0.0337 0.572 0.428 0.000
#> GSM876860     2  0.3686     0.8841 0.140 0.860 0.000
#> GSM876861     2  0.3412     0.8032 0.000 0.876 0.124

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     3   0.494    0.33048 0.000 0.000 0.564 0.436
#> GSM876887     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876888     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876889     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876890     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876891     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876862     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876863     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876864     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876865     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876866     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876867     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876838     2   0.112    0.87549 0.036 0.964 0.000 0.000
#> GSM876839     2   0.112    0.87549 0.036 0.964 0.000 0.000
#> GSM876840     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876841     2   0.112    0.87549 0.036 0.964 0.000 0.000
#> GSM876842     2   0.112    0.84089 0.000 0.964 0.000 0.036
#> GSM876843     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876892     4   0.112    0.91215 0.000 0.000 0.036 0.964
#> GSM876893     1   0.367    0.75286 0.848 0.036 0.116 0.000
#> GSM876894     3   0.158    0.41015 0.012 0.036 0.952 0.000
#> GSM876895     1   0.591    0.37482 0.528 0.036 0.436 0.000
#> GSM876896     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876897     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876868     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876869     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876870     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876871     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876872     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876873     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876844     2   0.112    0.84089 0.000 0.964 0.000 0.036
#> GSM876845     2   0.112    0.87549 0.036 0.964 0.000 0.000
#> GSM876846     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876847     2   0.112    0.87549 0.036 0.964 0.000 0.000
#> GSM876848     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876849     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876898     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876899     1   0.591    0.37482 0.528 0.036 0.436 0.000
#> GSM876900     1   0.581    0.44451 0.576 0.036 0.388 0.000
#> GSM876901     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876902     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876903     3   0.759   -0.15453 0.364 0.200 0.436 0.000
#> GSM876904     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876874     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876875     3   0.482    0.31243 0.388 0.000 0.612 0.000
#> GSM876876     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876877     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876878     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876879     3   0.482    0.31243 0.388 0.000 0.612 0.000
#> GSM876880     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876850     2   0.112    0.87549 0.036 0.964 0.000 0.000
#> GSM876851     2   0.112    0.87549 0.036 0.964 0.000 0.000
#> GSM876852     4   0.499   -0.00714 0.000 0.480 0.000 0.520
#> GSM876853     2   0.112    0.87549 0.036 0.964 0.000 0.000
#> GSM876854     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876855     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876856     4   0.000    0.95914 0.000 0.000 0.000 1.000
#> GSM876905     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876906     3   0.791    0.10918 0.116 0.036 0.436 0.412
#> GSM876907     1   0.591    0.37482 0.528 0.036 0.436 0.000
#> GSM876908     1   0.591    0.37482 0.528 0.036 0.436 0.000
#> GSM876909     1   0.422    0.62642 0.728 0.000 0.272 0.000
#> GSM876881     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876882     3   0.482    0.42098 0.000 0.000 0.612 0.388
#> GSM876883     3   0.482    0.42098 0.000 0.000 0.612 0.388
#> GSM876884     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876885     3   0.482    0.42098 0.000 0.000 0.612 0.388
#> GSM876857     1   0.000    0.88490 1.000 0.000 0.000 0.000
#> GSM876858     2   0.398    0.67446 0.240 0.760 0.000 0.000
#> GSM876859     2   0.499    0.16105 0.480 0.520 0.000 0.000
#> GSM876860     2   0.394    0.67912 0.236 0.764 0.000 0.000
#> GSM876861     2   0.353    0.67914 0.000 0.808 0.000 0.192

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM876886     3  0.0162     0.9972 0.000 0.000 0.996 0.004 0.000
#> GSM876887     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876888     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876889     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876890     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876891     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876862     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876866     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876867     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000     0.8374 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000     0.8374 0.000 1.000 0.000 0.000 0.000
#> GSM876840     4  0.0162     0.9907 0.000 0.000 0.004 0.996 0.000
#> GSM876841     2  0.0000     0.8374 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0451     0.8326 0.000 0.988 0.004 0.000 0.008
#> GSM876843     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876892     4  0.2127     0.8772 0.000 0.000 0.000 0.892 0.108
#> GSM876893     5  0.3949     0.4964 0.332 0.000 0.000 0.000 0.668
#> GSM876894     5  0.0290     0.9282 0.000 0.000 0.008 0.000 0.992
#> GSM876895     5  0.0290     0.9379 0.008 0.000 0.000 0.000 0.992
#> GSM876896     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876873     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876844     2  0.0451     0.8326 0.000 0.988 0.004 0.000 0.008
#> GSM876845     2  0.0000     0.8374 0.000 1.000 0.000 0.000 0.000
#> GSM876846     4  0.0162     0.9907 0.000 0.000 0.004 0.996 0.000
#> GSM876847     2  0.0000     0.8374 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876849     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876898     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876899     5  0.0290     0.9379 0.008 0.000 0.000 0.000 0.992
#> GSM876900     5  0.0290     0.9379 0.008 0.000 0.000 0.000 0.992
#> GSM876901     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876902     4  0.0000     0.9925 0.000 0.000 0.000 1.000 0.000
#> GSM876903     5  0.0290     0.9379 0.008 0.000 0.000 0.000 0.992
#> GSM876904     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876874     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876875     3  0.0162     0.9944 0.004 0.000 0.996 0.000 0.000
#> GSM876876     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876879     3  0.0162     0.9944 0.004 0.000 0.996 0.000 0.000
#> GSM876880     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000     0.8374 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000     0.8374 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.4706     0.0767 0.000 0.500 0.004 0.488 0.008
#> GSM876853     2  0.0000     0.8374 0.000 1.000 0.000 0.000 0.000
#> GSM876854     4  0.0162     0.9907 0.000 0.000 0.004 0.996 0.000
#> GSM876855     4  0.0162     0.9907 0.000 0.000 0.004 0.996 0.000
#> GSM876856     4  0.0162     0.9907 0.000 0.000 0.004 0.996 0.000
#> GSM876905     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876906     5  0.0324     0.9331 0.004 0.000 0.000 0.004 0.992
#> GSM876907     5  0.0290     0.9379 0.008 0.000 0.000 0.000 0.992
#> GSM876908     5  0.0290     0.9379 0.008 0.000 0.000 0.000 0.992
#> GSM876909     1  0.3607     0.6601 0.752 0.004 0.000 0.000 0.244
#> GSM876881     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876882     3  0.0162     0.9972 0.000 0.000 0.996 0.004 0.000
#> GSM876883     3  0.0162     0.9972 0.000 0.000 0.996 0.004 0.000
#> GSM876884     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876885     3  0.0162     0.9972 0.000 0.000 0.996 0.004 0.000
#> GSM876857     1  0.0000     0.9727 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.4201     0.3278 0.408 0.592 0.000 0.000 0.000
#> GSM876859     1  0.3895     0.4700 0.680 0.320 0.000 0.000 0.000
#> GSM876860     2  0.4150     0.3775 0.388 0.612 0.000 0.000 0.000
#> GSM876861     2  0.3768     0.6225 0.000 0.760 0.004 0.228 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
#> GSM876886     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876887     4  0.0260      0.957 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM876888     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876889     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876890     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876891     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876862     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876867     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0547      0.680 0.000 0.980 0.020 0.000 0.000 0.000
#> GSM876839     2  0.0547      0.680 0.000 0.980 0.020 0.000 0.000 0.000
#> GSM876840     4  0.0547      0.950 0.000 0.000 0.020 0.980 0.000 0.000
#> GSM876841     2  0.0000      0.697 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     3  0.3866      0.709 0.000 0.484 0.516 0.000 0.000 0.000
#> GSM876843     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876892     4  0.3925      0.657 0.000 0.000 0.236 0.724 0.040 0.000
#> GSM876893     1  0.5998     -0.183 0.404 0.000 0.236 0.000 0.360 0.000
#> GSM876894     5  0.0260      0.952 0.000 0.000 0.008 0.000 0.992 0.000
#> GSM876895     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876896     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876897     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876868     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876873     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876844     3  0.3866      0.709 0.000 0.484 0.516 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.697 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876847     2  0.0000      0.697 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876849     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876898     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876899     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876900     5  0.3050      0.791 0.000 0.000 0.236 0.000 0.764 0.000
#> GSM876901     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876902     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876903     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876904     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876874     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876876     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876879     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876880     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000      0.697 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.697 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     3  0.5403      0.666 0.000 0.360 0.516 0.124 0.000 0.000
#> GSM876853     2  0.0547      0.680 0.000 0.980 0.020 0.000 0.000 0.000
#> GSM876854     4  0.0547      0.950 0.000 0.000 0.020 0.980 0.000 0.000
#> GSM876855     4  0.2562      0.800 0.000 0.000 0.172 0.828 0.000 0.000
#> GSM876856     4  0.2491      0.810 0.000 0.000 0.164 0.836 0.000 0.000
#> GSM876905     1  0.0146      0.950 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM876906     5  0.1957      0.894 0.000 0.000 0.112 0.000 0.888 0.000
#> GSM876907     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876908     5  0.0000      0.955 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876909     1  0.5733      0.361 0.568 0.124 0.024 0.000 0.284 0.000
#> GSM876881     1  0.0547      0.935 0.980 0.020 0.000 0.000 0.000 0.000
#> GSM876882     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876883     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876884     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM876857     1  0.0000      0.953 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.5579      0.286 0.204 0.548 0.248 0.000 0.000 0.000
#> GSM876859     2  0.5949      0.175 0.320 0.444 0.236 0.000 0.000 0.000
#> GSM876860     2  0.5579      0.286 0.204 0.548 0.248 0.000 0.000 0.000
#> GSM876861     3  0.3572      0.567 0.000 0.204 0.764 0.032 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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) tissue(p) k
#> ATC:skmeans 72            0.254  1.95e-01 2
#> ATC:skmeans 69            0.607  1.67e-08 3
#> ATC:skmeans 56            0.305  7.65e-08 4
#> ATC:skmeans 67            0.122  9.69e-11 5
#> ATC:skmeans 67            0.192  2.38e-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: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 72 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 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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.983       0.992         0.3103 0.700   0.700
#> 3 3 1.000           0.975       0.990         0.9485 0.695   0.564
#> 4 4 0.816           0.881       0.924         0.1903 0.851   0.632
#> 5 5 0.910           0.865       0.946         0.0655 0.931   0.754
#> 6 6 0.882           0.856       0.933         0.0229 0.985   0.934

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM876886     1   0.000      0.990 1.000 0.000
#> GSM876887     1   0.000      0.990 1.000 0.000
#> GSM876888     1   0.000      0.990 1.000 0.000
#> GSM876889     2   0.000      1.000 0.000 1.000
#> GSM876890     1   0.781      0.709 0.768 0.232
#> GSM876891     1   0.000      0.990 1.000 0.000
#> GSM876862     1   0.000      0.990 1.000 0.000
#> GSM876863     1   0.000      0.990 1.000 0.000
#> GSM876864     1   0.000      0.990 1.000 0.000
#> GSM876865     1   0.000      0.990 1.000 0.000
#> GSM876866     1   0.662      0.798 0.828 0.172
#> GSM876867     1   0.000      0.990 1.000 0.000
#> GSM876838     1   0.000      0.990 1.000 0.000
#> GSM876839     1   0.000      0.990 1.000 0.000
#> GSM876840     2   0.000      1.000 0.000 1.000
#> GSM876841     1   0.000      0.990 1.000 0.000
#> GSM876842     1   0.000      0.990 1.000 0.000
#> GSM876843     2   0.000      1.000 0.000 1.000
#> GSM876892     1   0.000      0.990 1.000 0.000
#> GSM876893     1   0.000      0.990 1.000 0.000
#> GSM876894     1   0.000      0.990 1.000 0.000
#> GSM876895     1   0.000      0.990 1.000 0.000
#> GSM876896     2   0.000      1.000 0.000 1.000
#> GSM876897     2   0.000      1.000 0.000 1.000
#> GSM876868     1   0.000      0.990 1.000 0.000
#> GSM876869     1   0.000      0.990 1.000 0.000
#> GSM876870     1   0.000      0.990 1.000 0.000
#> GSM876871     1   0.000      0.990 1.000 0.000
#> GSM876872     2   0.000      1.000 0.000 1.000
#> GSM876873     2   0.000      1.000 0.000 1.000
#> GSM876844     1   0.000      0.990 1.000 0.000
#> GSM876845     1   0.000      0.990 1.000 0.000
#> GSM876846     2   0.000      1.000 0.000 1.000
#> GSM876847     1   0.000      0.990 1.000 0.000
#> GSM876848     2   0.000      1.000 0.000 1.000
#> GSM876849     2   0.000      1.000 0.000 1.000
#> GSM876898     1   0.000      0.990 1.000 0.000
#> GSM876899     1   0.000      0.990 1.000 0.000
#> GSM876900     1   0.000      0.990 1.000 0.000
#> GSM876901     1   0.000      0.990 1.000 0.000
#> GSM876902     2   0.000      1.000 0.000 1.000
#> GSM876903     1   0.000      0.990 1.000 0.000
#> GSM876904     1   0.000      0.990 1.000 0.000
#> GSM876874     1   0.000      0.990 1.000 0.000
#> GSM876875     1   0.000      0.990 1.000 0.000
#> GSM876876     1   0.000      0.990 1.000 0.000
#> GSM876877     1   0.000      0.990 1.000 0.000
#> GSM876878     1   0.000      0.990 1.000 0.000
#> GSM876879     1   0.000      0.990 1.000 0.000
#> GSM876880     1   0.000      0.990 1.000 0.000
#> GSM876850     1   0.000      0.990 1.000 0.000
#> GSM876851     1   0.000      0.990 1.000 0.000
#> GSM876852     1   0.000      0.990 1.000 0.000
#> GSM876853     1   0.000      0.990 1.000 0.000
#> GSM876854     2   0.000      1.000 0.000 1.000
#> GSM876855     1   0.644      0.809 0.836 0.164
#> GSM876856     2   0.000      1.000 0.000 1.000
#> GSM876905     1   0.000      0.990 1.000 0.000
#> GSM876906     1   0.000      0.990 1.000 0.000
#> GSM876907     1   0.000      0.990 1.000 0.000
#> GSM876908     1   0.000      0.990 1.000 0.000
#> GSM876909     1   0.000      0.990 1.000 0.000
#> GSM876881     1   0.000      0.990 1.000 0.000
#> GSM876882     1   0.000      0.990 1.000 0.000
#> GSM876883     1   0.000      0.990 1.000 0.000
#> GSM876884     1   0.000      0.990 1.000 0.000
#> GSM876885     1   0.000      0.990 1.000 0.000
#> GSM876857     1   0.000      0.990 1.000 0.000
#> GSM876858     1   0.000      0.990 1.000 0.000
#> GSM876859     1   0.000      0.990 1.000 0.000
#> GSM876860     1   0.000      0.990 1.000 0.000
#> GSM876861     1   0.000      0.990 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1 p2    p3
#> GSM876886     3  0.0000      0.991 0.000  0 1.000
#> GSM876887     3  0.0000      0.991 0.000  0 1.000
#> GSM876888     1  0.1753      0.916 0.952  0 0.048
#> GSM876889     2  0.0000      1.000 0.000  1 0.000
#> GSM876890     3  0.0000      0.991 0.000  0 1.000
#> GSM876891     3  0.0000      0.991 0.000  0 1.000
#> GSM876862     1  0.0000      0.972 1.000  0 0.000
#> GSM876863     1  0.0000      0.972 1.000  0 0.000
#> GSM876864     1  0.0000      0.972 1.000  0 0.000
#> GSM876865     1  0.0000      0.972 1.000  0 0.000
#> GSM876866     3  0.0000      0.991 0.000  0 1.000
#> GSM876867     1  0.0000      0.972 1.000  0 0.000
#> GSM876838     3  0.0000      0.991 0.000  0 1.000
#> GSM876839     3  0.0000      0.991 0.000  0 1.000
#> GSM876840     2  0.0000      1.000 0.000  1 0.000
#> GSM876841     3  0.0000      0.991 0.000  0 1.000
#> GSM876842     3  0.0000      0.991 0.000  0 1.000
#> GSM876843     2  0.0000      1.000 0.000  1 0.000
#> GSM876892     3  0.0000      0.991 0.000  0 1.000
#> GSM876893     3  0.0000      0.991 0.000  0 1.000
#> GSM876894     3  0.0000      0.991 0.000  0 1.000
#> GSM876895     3  0.0000      0.991 0.000  0 1.000
#> GSM876896     2  0.0000      1.000 0.000  1 0.000
#> GSM876897     2  0.0000      1.000 0.000  1 0.000
#> GSM876868     1  0.0000      0.972 1.000  0 0.000
#> GSM876869     1  0.0000      0.972 1.000  0 0.000
#> GSM876870     1  0.0000      0.972 1.000  0 0.000
#> GSM876871     1  0.0000      0.972 1.000  0 0.000
#> GSM876872     2  0.0000      1.000 0.000  1 0.000
#> GSM876873     2  0.0000      1.000 0.000  1 0.000
#> GSM876844     3  0.0000      0.991 0.000  0 1.000
#> GSM876845     3  0.0000      0.991 0.000  0 1.000
#> GSM876846     2  0.0000      1.000 0.000  1 0.000
#> GSM876847     3  0.3619      0.843 0.136  0 0.864
#> GSM876848     2  0.0000      1.000 0.000  1 0.000
#> GSM876849     2  0.0000      1.000 0.000  1 0.000
#> GSM876898     1  0.0000      0.972 1.000  0 0.000
#> GSM876899     3  0.0000      0.991 0.000  0 1.000
#> GSM876900     3  0.0000      0.991 0.000  0 1.000
#> GSM876901     3  0.0000      0.991 0.000  0 1.000
#> GSM876902     2  0.0000      1.000 0.000  1 0.000
#> GSM876903     3  0.0000      0.991 0.000  0 1.000
#> GSM876904     3  0.0592      0.980 0.012  0 0.988
#> GSM876874     1  0.0000      0.972 1.000  0 0.000
#> GSM876875     3  0.0000      0.991 0.000  0 1.000
#> GSM876876     1  0.0000      0.972 1.000  0 0.000
#> GSM876877     1  0.0000      0.972 1.000  0 0.000
#> GSM876878     1  0.0000      0.972 1.000  0 0.000
#> GSM876879     3  0.0000      0.991 0.000  0 1.000
#> GSM876880     1  0.0000      0.972 1.000  0 0.000
#> GSM876850     3  0.4062      0.805 0.164  0 0.836
#> GSM876851     3  0.0000      0.991 0.000  0 1.000
#> GSM876852     3  0.0000      0.991 0.000  0 1.000
#> GSM876853     3  0.0000      0.991 0.000  0 1.000
#> GSM876854     2  0.0000      1.000 0.000  1 0.000
#> GSM876855     3  0.0000      0.991 0.000  0 1.000
#> GSM876856     2  0.0000      1.000 0.000  1 0.000
#> GSM876905     3  0.0000      0.991 0.000  0 1.000
#> GSM876906     3  0.0000      0.991 0.000  0 1.000
#> GSM876907     3  0.0000      0.991 0.000  0 1.000
#> GSM876908     3  0.0000      0.991 0.000  0 1.000
#> GSM876909     3  0.0000      0.991 0.000  0 1.000
#> GSM876881     1  0.0000      0.972 1.000  0 0.000
#> GSM876882     3  0.0000      0.991 0.000  0 1.000
#> GSM876883     3  0.0000      0.991 0.000  0 1.000
#> GSM876884     1  0.0000      0.972 1.000  0 0.000
#> GSM876885     3  0.0000      0.991 0.000  0 1.000
#> GSM876857     1  0.0000      0.972 1.000  0 0.000
#> GSM876858     3  0.0000      0.991 0.000  0 1.000
#> GSM876859     1  0.5835      0.474 0.660  0 0.340
#> GSM876860     3  0.0000      0.991 0.000  0 1.000
#> GSM876861     3  0.0000      0.991 0.000  0 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876887     3  0.0469     0.9368 0.000 0.012 0.988 0.000
#> GSM876888     1  0.1389     0.9280 0.952 0.000 0.048 0.000
#> GSM876889     4  0.3024     0.8909 0.000 0.148 0.000 0.852
#> GSM876890     3  0.3569     0.7208 0.000 0.196 0.804 0.000
#> GSM876891     3  0.1302     0.9075 0.000 0.044 0.956 0.000
#> GSM876862     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876866     3  0.3569     0.7208 0.000 0.196 0.804 0.000
#> GSM876867     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876838     2  0.3569     0.8050 0.000 0.804 0.196 0.000
#> GSM876839     2  0.3569     0.8050 0.000 0.804 0.196 0.000
#> GSM876840     4  0.3569     0.8613 0.000 0.196 0.000 0.804
#> GSM876841     2  0.3569     0.8050 0.000 0.804 0.196 0.000
#> GSM876842     2  0.4522     0.7088 0.000 0.680 0.320 0.000
#> GSM876843     4  0.0000     0.9451 0.000 0.000 0.000 1.000
#> GSM876892     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876893     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876894     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876895     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876896     4  0.0000     0.9451 0.000 0.000 0.000 1.000
#> GSM876897     4  0.0000     0.9451 0.000 0.000 0.000 1.000
#> GSM876868     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876872     4  0.0000     0.9451 0.000 0.000 0.000 1.000
#> GSM876873     4  0.0000     0.9451 0.000 0.000 0.000 1.000
#> GSM876844     2  0.4830     0.6244 0.000 0.608 0.392 0.000
#> GSM876845     2  0.3569     0.8050 0.000 0.804 0.196 0.000
#> GSM876846     4  0.3024     0.8909 0.000 0.148 0.000 0.852
#> GSM876847     2  0.4462     0.7120 0.132 0.804 0.064 0.000
#> GSM876848     4  0.0000     0.9451 0.000 0.000 0.000 1.000
#> GSM876849     4  0.0000     0.9451 0.000 0.000 0.000 1.000
#> GSM876898     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876899     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876900     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876901     3  0.1792     0.8856 0.000 0.068 0.932 0.000
#> GSM876902     4  0.0000     0.9451 0.000 0.000 0.000 1.000
#> GSM876903     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876904     3  0.2053     0.8704 0.072 0.004 0.924 0.000
#> GSM876874     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876875     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876876     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876879     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876880     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876850     2  0.4244     0.6811 0.160 0.804 0.036 0.000
#> GSM876851     2  0.3569     0.8050 0.000 0.804 0.196 0.000
#> GSM876852     2  0.4697     0.6362 0.000 0.644 0.356 0.000
#> GSM876853     2  0.3569     0.8050 0.000 0.804 0.196 0.000
#> GSM876854     4  0.3569     0.8613 0.000 0.196 0.000 0.804
#> GSM876855     2  0.3688     0.6251 0.000 0.792 0.208 0.000
#> GSM876856     2  0.5649     0.0527 0.000 0.620 0.036 0.344
#> GSM876905     3  0.0188     0.9431 0.000 0.004 0.996 0.000
#> GSM876906     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876907     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876908     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876909     3  0.3569     0.7073 0.000 0.196 0.804 0.000
#> GSM876881     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876882     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876883     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876884     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876885     3  0.0000     0.9458 0.000 0.000 1.000 0.000
#> GSM876857     1  0.0000     0.9962 1.000 0.000 0.000 0.000
#> GSM876858     3  0.3610     0.7007 0.000 0.200 0.800 0.000
#> GSM876859     2  0.6483     0.2904 0.392 0.532 0.076 0.000
#> GSM876860     3  0.1792     0.8856 0.000 0.068 0.932 0.000
#> GSM876861     3  0.0000     0.9458 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM876886     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876887     5  0.0404     0.9461 0.000 0.000 0.012 0.000 0.988
#> GSM876888     1  0.1197     0.9299 0.952 0.000 0.000 0.000 0.048
#> GSM876889     3  0.3774     0.5169 0.000 0.000 0.704 0.296 0.000
#> GSM876890     3  0.2074     0.7244 0.000 0.000 0.896 0.000 0.104
#> GSM876891     5  0.1121     0.9188 0.000 0.000 0.044 0.000 0.956
#> GSM876862     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876866     3  0.3932     0.4995 0.000 0.000 0.672 0.000 0.328
#> GSM876867     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000     0.8306 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000     0.8306 0.000 1.000 0.000 0.000 0.000
#> GSM876840     3  0.0000     0.7611 0.000 0.000 1.000 0.000 0.000
#> GSM876841     2  0.0000     0.8306 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.4114     0.4476 0.000 0.624 0.000 0.000 0.376
#> GSM876843     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM876892     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876893     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876894     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876895     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876896     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM876897     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM876868     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM876873     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM876844     2  0.4182     0.4073 0.000 0.600 0.000 0.000 0.400
#> GSM876845     2  0.0000     0.8306 0.000 1.000 0.000 0.000 0.000
#> GSM876846     3  0.3774     0.5169 0.000 0.000 0.704 0.296 0.000
#> GSM876847     2  0.0000     0.8306 0.000 1.000 0.000 0.000 0.000
#> GSM876848     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM876849     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM876898     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876899     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876900     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876901     5  0.3109     0.7288 0.000 0.200 0.000 0.000 0.800
#> GSM876902     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM876903     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876904     5  0.1892     0.8813 0.004 0.080 0.000 0.000 0.916
#> GSM876874     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876875     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876876     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876879     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876880     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000     0.8306 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000     0.8306 0.000 1.000 0.000 0.000 0.000
#> GSM876852     3  0.5988     0.3308 0.000 0.120 0.516 0.000 0.364
#> GSM876853     2  0.0000     0.8306 0.000 1.000 0.000 0.000 0.000
#> GSM876854     3  0.0000     0.7611 0.000 0.000 1.000 0.000 0.000
#> GSM876855     3  0.0000     0.7611 0.000 0.000 1.000 0.000 0.000
#> GSM876856     3  0.0000     0.7611 0.000 0.000 1.000 0.000 0.000
#> GSM876905     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876906     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876907     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876908     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876909     5  0.4171     0.3130 0.000 0.396 0.000 0.000 0.604
#> GSM876881     1  0.2773     0.7994 0.836 0.164 0.000 0.000 0.000
#> GSM876882     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876883     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876884     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876885     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000
#> GSM876857     1  0.0000     0.9865 1.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.4291     0.0753 0.000 0.536 0.000 0.000 0.464
#> GSM876859     2  0.0703     0.8115 0.000 0.976 0.000 0.000 0.024
#> GSM876860     5  0.2516     0.8140 0.000 0.140 0.000 0.000 0.860
#> GSM876861     5  0.0000     0.9547 0.000 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     3  0.2300     0.8464 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM876887     3  0.3570     0.8002 0.000 0.000 0.792 0.000 0.064 0.144
#> GSM876888     1  0.1075     0.9264 0.952 0.000 0.048 0.000 0.000 0.000
#> GSM876889     4  0.1714     0.8901 0.000 0.000 0.000 0.908 0.092 0.000
#> GSM876890     5  0.3680     0.6939 0.000 0.000 0.072 0.000 0.784 0.144
#> GSM876891     3  0.2664     0.7433 0.000 0.000 0.816 0.000 0.184 0.000
#> GSM876862     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876863     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876864     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876865     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876866     5  0.5196     0.4531 0.000 0.000 0.252 0.000 0.604 0.144
#> GSM876867     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876838     2  0.0000     0.8214 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000     0.8214 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     5  0.0000     0.8410 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876841     2  0.0000     0.8214 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.3695     0.4270 0.000 0.624 0.376 0.000 0.000 0.000
#> GSM876843     6  0.2300     1.0000 0.000 0.000 0.000 0.144 0.000 0.856
#> GSM876892     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876893     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876894     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876895     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876896     4  0.0000     0.9546 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876897     4  0.0000     0.9546 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876868     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876871     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876872     4  0.0000     0.9546 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876873     4  0.0000     0.9546 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876844     2  0.3756     0.3734 0.000 0.600 0.400 0.000 0.000 0.000
#> GSM876845     2  0.0000     0.8214 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     4  0.1910     0.8770 0.000 0.000 0.000 0.892 0.108 0.000
#> GSM876847     2  0.0000     0.8214 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     6  0.2300     1.0000 0.000 0.000 0.000 0.144 0.000 0.856
#> GSM876849     6  0.2300     1.0000 0.000 0.000 0.000 0.144 0.000 0.856
#> GSM876898     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876899     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876900     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876901     3  0.2793     0.7138 0.000 0.200 0.800 0.000 0.000 0.000
#> GSM876902     4  0.0000     0.9546 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876903     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876904     3  0.1700     0.8480 0.004 0.080 0.916 0.000 0.000 0.000
#> GSM876874     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876875     3  0.2300     0.8464 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM876876     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876877     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876878     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876879     3  0.2300     0.8464 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM876880     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876850     2  0.0000     0.8214 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000     0.8214 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     5  0.1204     0.8019 0.000 0.056 0.000 0.000 0.944 0.000
#> GSM876853     2  0.0000     0.8214 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     5  0.0000     0.8410 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876855     5  0.0000     0.8410 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876856     5  0.0000     0.8410 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM876905     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876906     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876907     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876908     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM876909     3  0.3747     0.2992 0.000 0.396 0.604 0.000 0.000 0.000
#> GSM876881     1  0.2491     0.7827 0.836 0.164 0.000 0.000 0.000 0.000
#> GSM876882     3  0.2300     0.8464 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM876883     3  0.2300     0.8464 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM876884     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876885     3  0.2300     0.8464 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM876857     1  0.0000     0.9857 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM876858     2  0.3854     0.0828 0.000 0.536 0.464 0.000 0.000 0.000
#> GSM876859     2  0.0632     0.8026 0.000 0.976 0.024 0.000 0.000 0.000
#> GSM876860     3  0.2260     0.7912 0.000 0.140 0.860 0.000 0.000 0.000
#> GSM876861     3  0.0000     0.8996 0.000 0.000 1.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) tissue(p) k
#> ATC:pam 72           0.0319  1.68e-01 2
#> ATC:pam 71           0.1286  3.14e-06 3
#> ATC:pam 70           0.0201  1.32e-11 4
#> ATC:pam 66           0.0478  3.59e-10 5
#> ATC:pam 67           0.0520  4.40e-11 6

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


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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.982           0.946       0.967         0.4791 0.507   0.507
#> 3 3 0.485           0.758       0.844         0.2827 0.583   0.377
#> 4 4 0.625           0.726       0.810         0.1734 0.685   0.368
#> 5 5 0.739           0.868       0.898         0.0894 0.910   0.679
#> 6 6 0.860           0.780       0.902         0.0434 0.932   0.696

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
#> GSM876886     1  0.1414      0.987 0.980 0.020
#> GSM876887     1  0.1843      0.984 0.972 0.028
#> GSM876888     1  0.1414      0.987 0.980 0.020
#> GSM876889     1  0.1414      0.987 0.980 0.020
#> GSM876890     1  0.1414      0.987 0.980 0.020
#> GSM876891     1  0.1414      0.987 0.980 0.020
#> GSM876862     1  0.0000      0.978 1.000 0.000
#> GSM876863     1  0.1414      0.987 0.980 0.020
#> GSM876864     1  0.0000      0.978 1.000 0.000
#> GSM876865     1  0.1414      0.987 0.980 0.020
#> GSM876866     1  0.1414      0.987 0.980 0.020
#> GSM876867     1  0.0000      0.978 1.000 0.000
#> GSM876838     2  0.0000      0.947 0.000 1.000
#> GSM876839     2  0.0000      0.947 0.000 1.000
#> GSM876840     2  0.0000      0.947 0.000 1.000
#> GSM876841     2  0.0000      0.947 0.000 1.000
#> GSM876842     2  0.0000      0.947 0.000 1.000
#> GSM876843     2  0.0000      0.947 0.000 1.000
#> GSM876892     1  0.1414      0.987 0.980 0.020
#> GSM876893     1  0.0000      0.978 1.000 0.000
#> GSM876894     1  0.1633      0.986 0.976 0.024
#> GSM876895     2  0.5946      0.846 0.144 0.856
#> GSM876896     1  0.1843      0.984 0.972 0.028
#> GSM876897     1  0.1843      0.984 0.972 0.028
#> GSM876868     1  0.0000      0.978 1.000 0.000
#> GSM876869     1  0.0000      0.978 1.000 0.000
#> GSM876870     1  0.0000      0.978 1.000 0.000
#> GSM876871     1  0.1414      0.987 0.980 0.020
#> GSM876872     1  0.1843      0.984 0.972 0.028
#> GSM876873     1  0.1843      0.984 0.972 0.028
#> GSM876844     2  0.0000      0.947 0.000 1.000
#> GSM876845     2  0.0000      0.947 0.000 1.000
#> GSM876846     2  0.0000      0.947 0.000 1.000
#> GSM876847     2  0.0000      0.947 0.000 1.000
#> GSM876848     2  0.0000      0.947 0.000 1.000
#> GSM876849     2  0.0000      0.947 0.000 1.000
#> GSM876898     1  0.1414      0.987 0.980 0.020
#> GSM876899     2  0.9732      0.375 0.404 0.596
#> GSM876900     1  0.1414      0.987 0.980 0.020
#> GSM876901     1  0.0000      0.978 1.000 0.000
#> GSM876902     1  0.1843      0.984 0.972 0.028
#> GSM876903     2  0.3879      0.915 0.076 0.924
#> GSM876904     1  0.0000      0.978 1.000 0.000
#> GSM876874     1  0.1414      0.987 0.980 0.020
#> GSM876875     1  0.1843      0.984 0.972 0.028
#> GSM876876     1  0.1414      0.987 0.980 0.020
#> GSM876877     1  0.1414      0.987 0.980 0.020
#> GSM876878     1  0.1414      0.987 0.980 0.020
#> GSM876879     1  0.1843      0.984 0.972 0.028
#> GSM876880     1  0.0672      0.982 0.992 0.008
#> GSM876850     2  0.0000      0.947 0.000 1.000
#> GSM876851     2  0.0000      0.947 0.000 1.000
#> GSM876852     2  0.0000      0.947 0.000 1.000
#> GSM876853     2  0.0000      0.947 0.000 1.000
#> GSM876854     2  0.0000      0.947 0.000 1.000
#> GSM876855     2  0.0000      0.947 0.000 1.000
#> GSM876856     2  0.0000      0.947 0.000 1.000
#> GSM876905     1  0.0000      0.978 1.000 0.000
#> GSM876906     1  0.6973      0.774 0.812 0.188
#> GSM876907     2  0.4298      0.905 0.088 0.912
#> GSM876908     2  0.9552      0.454 0.376 0.624
#> GSM876909     2  0.3584      0.921 0.068 0.932
#> GSM876881     2  0.3584      0.921 0.068 0.932
#> GSM876882     1  0.1843      0.984 0.972 0.028
#> GSM876883     1  0.1843      0.984 0.972 0.028
#> GSM876884     1  0.1414      0.987 0.980 0.020
#> GSM876885     1  0.1843      0.984 0.972 0.028
#> GSM876857     1  0.0000      0.978 1.000 0.000
#> GSM876858     2  0.3584      0.921 0.068 0.932
#> GSM876859     2  0.3584      0.921 0.068 0.932
#> GSM876860     2  0.3584      0.921 0.068 0.932
#> GSM876861     2  0.3584      0.921 0.068 0.932

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM876886     3  0.5016      0.734 0.240 0.000 0.760
#> GSM876887     3  0.5016      0.734 0.240 0.000 0.760
#> GSM876888     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876889     3  0.4121      0.760 0.168 0.000 0.832
#> GSM876890     3  0.2711      0.768 0.088 0.000 0.912
#> GSM876891     3  0.2165      0.762 0.064 0.000 0.936
#> GSM876862     1  0.1031      0.887 0.976 0.000 0.024
#> GSM876863     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876864     1  0.0747      0.888 0.984 0.000 0.016
#> GSM876865     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876866     3  0.2066      0.763 0.060 0.000 0.940
#> GSM876867     1  0.2959      0.859 0.900 0.000 0.100
#> GSM876838     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876839     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876840     3  0.6307      0.394 0.000 0.488 0.512
#> GSM876841     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876842     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876843     3  0.4346      0.711 0.000 0.184 0.816
#> GSM876892     3  0.2448      0.762 0.076 0.000 0.924
#> GSM876893     3  0.5591      0.528 0.304 0.000 0.696
#> GSM876894     3  0.3030      0.762 0.092 0.004 0.904
#> GSM876895     3  0.2599      0.771 0.016 0.052 0.932
#> GSM876896     3  0.4235      0.742 0.176 0.000 0.824
#> GSM876897     3  0.4235      0.742 0.176 0.000 0.824
#> GSM876868     1  0.1860      0.880 0.948 0.000 0.052
#> GSM876869     1  0.3038      0.857 0.896 0.000 0.104
#> GSM876870     1  0.2878      0.862 0.904 0.000 0.096
#> GSM876871     1  0.3752      0.831 0.856 0.000 0.144
#> GSM876872     3  0.4235      0.742 0.176 0.000 0.824
#> GSM876873     3  0.4235      0.742 0.176 0.000 0.824
#> GSM876844     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876845     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876846     3  0.4887      0.704 0.000 0.228 0.772
#> GSM876847     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876848     3  0.4346      0.711 0.000 0.184 0.816
#> GSM876849     3  0.4346      0.711 0.000 0.184 0.816
#> GSM876898     1  0.4062      0.807 0.836 0.000 0.164
#> GSM876899     3  0.2743      0.771 0.020 0.052 0.928
#> GSM876900     3  0.5216      0.586 0.260 0.000 0.740
#> GSM876901     1  0.6291      0.246 0.532 0.000 0.468
#> GSM876902     3  0.4235      0.742 0.176 0.000 0.824
#> GSM876903     3  0.2599      0.771 0.016 0.052 0.932
#> GSM876904     1  0.5968      0.540 0.636 0.000 0.364
#> GSM876874     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876875     3  0.4931      0.735 0.232 0.000 0.768
#> GSM876876     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876878     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876879     3  0.4931      0.735 0.232 0.000 0.768
#> GSM876880     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876850     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876851     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876852     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876853     2  0.0000      1.000 0.000 1.000 0.000
#> GSM876854     3  0.6307      0.394 0.000 0.488 0.512
#> GSM876855     3  0.6307      0.394 0.000 0.488 0.512
#> GSM876856     3  0.6307      0.394 0.000 0.488 0.512
#> GSM876905     3  0.6204      0.241 0.424 0.000 0.576
#> GSM876906     3  0.2681      0.768 0.040 0.028 0.932
#> GSM876907     3  0.2599      0.771 0.016 0.052 0.932
#> GSM876908     3  0.2599      0.771 0.016 0.052 0.932
#> GSM876909     3  0.6113      0.594 0.012 0.300 0.688
#> GSM876881     3  0.5988      0.590 0.008 0.304 0.688
#> GSM876882     3  0.4931      0.735 0.232 0.000 0.768
#> GSM876883     3  0.4931      0.735 0.232 0.000 0.768
#> GSM876884     1  0.0000      0.888 1.000 0.000 0.000
#> GSM876885     3  0.4931      0.735 0.232 0.000 0.768
#> GSM876857     1  0.5760      0.572 0.672 0.000 0.328
#> GSM876858     3  0.5988      0.590 0.008 0.304 0.688
#> GSM876859     3  0.5988      0.590 0.008 0.304 0.688
#> GSM876860     3  0.5988      0.590 0.008 0.304 0.688
#> GSM876861     3  0.5988      0.590 0.008 0.304 0.688

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     1  0.1584     0.8423 0.952 0.000 0.012 0.036
#> GSM876887     1  0.6404     0.2119 0.608 0.000 0.296 0.096
#> GSM876888     1  0.0469     0.8542 0.988 0.000 0.000 0.012
#> GSM876889     3  0.7191     0.2014 0.148 0.000 0.500 0.352
#> GSM876890     3  0.6808     0.2897 0.120 0.000 0.560 0.320
#> GSM876891     3  0.3074     0.5910 0.152 0.000 0.848 0.000
#> GSM876862     1  0.0336     0.8591 0.992 0.000 0.008 0.000
#> GSM876863     1  0.0469     0.8542 0.988 0.000 0.000 0.012
#> GSM876864     1  0.0336     0.8591 0.992 0.000 0.008 0.000
#> GSM876865     1  0.0336     0.8555 0.992 0.000 0.000 0.008
#> GSM876866     3  0.5716    -0.0293 0.420 0.000 0.552 0.028
#> GSM876867     1  0.0336     0.8591 0.992 0.000 0.008 0.000
#> GSM876838     2  0.1211     0.8788 0.000 0.960 0.040 0.000
#> GSM876839     2  0.1211     0.8788 0.000 0.960 0.040 0.000
#> GSM876840     2  0.3400     0.7901 0.000 0.820 0.180 0.000
#> GSM876841     2  0.1211     0.8788 0.000 0.960 0.040 0.000
#> GSM876842     2  0.0000     0.8808 0.000 1.000 0.000 0.000
#> GSM876843     2  0.6148     0.6762 0.000 0.636 0.280 0.084
#> GSM876892     1  0.4331     0.6962 0.712 0.000 0.288 0.000
#> GSM876893     1  0.4331     0.6962 0.712 0.000 0.288 0.000
#> GSM876894     3  0.5339     0.7489 0.100 0.000 0.744 0.156
#> GSM876895     3  0.5427     0.7507 0.100 0.000 0.736 0.164
#> GSM876896     4  0.0336     0.6541 0.000 0.000 0.008 0.992
#> GSM876897     4  0.0336     0.6541 0.000 0.000 0.008 0.992
#> GSM876868     1  0.0336     0.8591 0.992 0.000 0.008 0.000
#> GSM876869     1  0.0336     0.8591 0.992 0.000 0.008 0.000
#> GSM876870     1  0.0336     0.8591 0.992 0.000 0.008 0.000
#> GSM876871     1  0.2589     0.8179 0.884 0.000 0.116 0.000
#> GSM876872     4  0.0817     0.6600 0.024 0.000 0.000 0.976
#> GSM876873     4  0.0817     0.6600 0.024 0.000 0.000 0.976
#> GSM876844     2  0.0000     0.8808 0.000 1.000 0.000 0.000
#> GSM876845     2  0.1211     0.8788 0.000 0.960 0.040 0.000
#> GSM876846     2  0.4594     0.7341 0.000 0.712 0.280 0.008
#> GSM876847     2  0.1211     0.8788 0.000 0.960 0.040 0.000
#> GSM876848     2  0.6422     0.6568 0.000 0.616 0.280 0.104
#> GSM876849     2  0.6422     0.6568 0.000 0.616 0.280 0.104
#> GSM876898     1  0.4277     0.7039 0.720 0.000 0.280 0.000
#> GSM876899     3  0.5470     0.7486 0.100 0.000 0.732 0.168
#> GSM876900     1  0.4331     0.6962 0.712 0.000 0.288 0.000
#> GSM876901     1  0.4331     0.6962 0.712 0.000 0.288 0.000
#> GSM876902     4  0.0336     0.6541 0.000 0.000 0.008 0.992
#> GSM876903     3  0.5427     0.7507 0.100 0.000 0.736 0.164
#> GSM876904     1  0.4331     0.6962 0.712 0.000 0.288 0.000
#> GSM876874     1  0.0524     0.8568 0.988 0.000 0.004 0.008
#> GSM876875     4  0.7847     0.5081 0.276 0.000 0.328 0.396
#> GSM876876     1  0.0469     0.8542 0.988 0.000 0.000 0.012
#> GSM876877     1  0.0927     0.8567 0.976 0.000 0.016 0.008
#> GSM876878     1  0.0469     0.8542 0.988 0.000 0.000 0.012
#> GSM876879     4  0.7841     0.5090 0.272 0.000 0.332 0.396
#> GSM876880     1  0.0524     0.8571 0.988 0.000 0.004 0.008
#> GSM876850     2  0.1211     0.8788 0.000 0.960 0.040 0.000
#> GSM876851     2  0.1211     0.8788 0.000 0.960 0.040 0.000
#> GSM876852     2  0.0000     0.8808 0.000 1.000 0.000 0.000
#> GSM876853     2  0.0336     0.8812 0.000 0.992 0.008 0.000
#> GSM876854     2  0.3400     0.7901 0.000 0.820 0.180 0.000
#> GSM876855     2  0.0000     0.8808 0.000 1.000 0.000 0.000
#> GSM876856     2  0.0000     0.8808 0.000 1.000 0.000 0.000
#> GSM876905     1  0.4331     0.6962 0.712 0.000 0.288 0.000
#> GSM876906     3  0.2345     0.6367 0.100 0.000 0.900 0.000
#> GSM876907     3  0.5427     0.7507 0.100 0.000 0.736 0.164
#> GSM876908     3  0.5427     0.7507 0.100 0.000 0.736 0.164
#> GSM876909     3  0.5913     0.7375 0.060 0.040 0.736 0.164
#> GSM876881     3  0.5913     0.7375 0.060 0.040 0.736 0.164
#> GSM876882     4  0.7830     0.5113 0.268 0.000 0.332 0.400
#> GSM876883     4  0.6717     0.4716 0.108 0.000 0.332 0.560
#> GSM876884     1  0.0336     0.8555 0.992 0.000 0.000 0.008
#> GSM876885     4  0.6717     0.4716 0.108 0.000 0.332 0.560
#> GSM876857     1  0.3400     0.7788 0.820 0.000 0.180 0.000
#> GSM876858     3  0.5788     0.6929 0.020 0.080 0.736 0.164
#> GSM876859     3  0.5548     0.6668 0.004 0.096 0.736 0.164
#> GSM876860     3  0.5628     0.6742 0.008 0.092 0.736 0.164
#> GSM876861     3  0.5922     0.7226 0.044 0.056 0.736 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
#> GSM876886     1  0.3533     0.8389 0.840 0.000 0.108 0.012 0.040
#> GSM876887     1  0.3338     0.8053 0.852 0.000 0.076 0.068 0.004
#> GSM876888     1  0.4720     0.8708 0.736 0.000 0.124 0.000 0.140
#> GSM876889     5  0.4634     0.7638 0.120 0.000 0.136 0.000 0.744
#> GSM876890     5  0.4519     0.7688 0.100 0.000 0.148 0.000 0.752
#> GSM876891     5  0.3336     0.7340 0.000 0.000 0.228 0.000 0.772
#> GSM876862     1  0.3612     0.7825 0.732 0.000 0.268 0.000 0.000
#> GSM876863     1  0.4720     0.8708 0.736 0.000 0.124 0.000 0.140
#> GSM876864     1  0.3612     0.7825 0.732 0.000 0.268 0.000 0.000
#> GSM876865     1  0.4720     0.8708 0.736 0.000 0.124 0.000 0.140
#> GSM876866     5  0.4637     0.7586 0.100 0.000 0.160 0.000 0.740
#> GSM876867     3  0.0290     0.9438 0.008 0.000 0.992 0.000 0.000
#> GSM876838     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876839     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876840     2  0.0290     0.9464 0.000 0.992 0.008 0.000 0.000
#> GSM876841     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876842     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876843     2  0.5031     0.7489 0.148 0.724 0.008 0.120 0.000
#> GSM876892     3  0.0162     0.9469 0.000 0.000 0.996 0.000 0.004
#> GSM876893     3  0.0162     0.9469 0.000 0.000 0.996 0.000 0.004
#> GSM876894     5  0.1282     0.8779 0.000 0.000 0.044 0.004 0.952
#> GSM876895     5  0.0000     0.8987 0.000 0.000 0.000 0.000 1.000
#> GSM876896     4  0.0162     0.9615 0.004 0.000 0.000 0.996 0.000
#> GSM876897     4  0.0162     0.9615 0.004 0.000 0.000 0.996 0.000
#> GSM876868     1  0.3612     0.7825 0.732 0.000 0.268 0.000 0.000
#> GSM876869     3  0.0404     0.9404 0.012 0.000 0.988 0.000 0.000
#> GSM876870     3  0.4235    -0.0572 0.424 0.000 0.576 0.000 0.000
#> GSM876871     3  0.0290     0.9438 0.008 0.000 0.992 0.000 0.000
#> GSM876872     4  0.0162     0.9615 0.004 0.000 0.000 0.996 0.000
#> GSM876873     4  0.0162     0.9615 0.004 0.000 0.000 0.996 0.000
#> GSM876844     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876845     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876846     2  0.3001     0.8538 0.144 0.844 0.008 0.004 0.000
#> GSM876847     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876848     2  0.5137     0.7454 0.148 0.720 0.012 0.120 0.000
#> GSM876849     2  0.5137     0.7454 0.148 0.720 0.012 0.120 0.000
#> GSM876898     3  0.0290     0.9437 0.000 0.000 0.992 0.000 0.008
#> GSM876899     5  0.3636     0.5885 0.000 0.000 0.000 0.272 0.728
#> GSM876900     3  0.0162     0.9469 0.000 0.000 0.996 0.000 0.004
#> GSM876901     3  0.0162     0.9469 0.000 0.000 0.996 0.000 0.004
#> GSM876902     4  0.0162     0.9615 0.004 0.000 0.000 0.996 0.000
#> GSM876903     5  0.0000     0.8987 0.000 0.000 0.000 0.000 1.000
#> GSM876904     3  0.0162     0.9469 0.000 0.000 0.996 0.000 0.004
#> GSM876874     1  0.4720     0.8708 0.736 0.000 0.124 0.000 0.140
#> GSM876875     1  0.2648     0.7194 0.848 0.000 0.000 0.152 0.000
#> GSM876876     1  0.4720     0.8708 0.736 0.000 0.124 0.000 0.140
#> GSM876877     1  0.4720     0.8708 0.736 0.000 0.124 0.000 0.140
#> GSM876878     1  0.4720     0.8708 0.736 0.000 0.124 0.000 0.140
#> GSM876879     1  0.2648     0.7194 0.848 0.000 0.000 0.152 0.000
#> GSM876880     1  0.3988     0.7983 0.732 0.000 0.252 0.000 0.016
#> GSM876850     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876851     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876852     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876853     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876854     2  0.0290     0.9464 0.000 0.992 0.008 0.000 0.000
#> GSM876855     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876856     2  0.0000     0.9501 0.000 1.000 0.000 0.000 0.000
#> GSM876905     3  0.0162     0.9469 0.000 0.000 0.996 0.000 0.004
#> GSM876906     5  0.2280     0.8237 0.000 0.000 0.120 0.000 0.880
#> GSM876907     5  0.0000     0.8987 0.000 0.000 0.000 0.000 1.000
#> GSM876908     5  0.0162     0.8982 0.000 0.000 0.004 0.000 0.996
#> GSM876909     5  0.0703     0.8908 0.000 0.000 0.024 0.000 0.976
#> GSM876881     5  0.0000     0.8987 0.000 0.000 0.000 0.000 1.000
#> GSM876882     1  0.2648     0.7194 0.848 0.000 0.000 0.152 0.000
#> GSM876883     4  0.2329     0.9011 0.124 0.000 0.000 0.876 0.000
#> GSM876884     1  0.4720     0.8708 0.736 0.000 0.124 0.000 0.140
#> GSM876885     4  0.2329     0.9011 0.124 0.000 0.000 0.876 0.000
#> GSM876857     3  0.0162     0.9453 0.004 0.000 0.996 0.000 0.000
#> GSM876858     5  0.0162     0.8975 0.000 0.004 0.000 0.000 0.996
#> GSM876859     5  0.0000     0.8987 0.000 0.000 0.000 0.000 1.000
#> GSM876860     5  0.0162     0.8975 0.000 0.004 0.000 0.000 0.996
#> GSM876861     5  0.0162     0.8975 0.000 0.004 0.000 0.000 0.996

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM876886     1  0.0551      0.870 0.984 0.000 0.008 0.004 0.000 0.004
#> GSM876887     1  0.1606      0.840 0.932 0.000 0.008 0.004 0.000 0.056
#> GSM876888     1  0.0458      0.886 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM876889     5  0.5000      0.571 0.012 0.000 0.296 0.008 0.632 0.052
#> GSM876890     5  0.3967      0.599 0.008 0.000 0.316 0.008 0.668 0.000
#> GSM876891     5  0.3615      0.634 0.000 0.000 0.292 0.008 0.700 0.000
#> GSM876862     1  0.3109      0.724 0.772 0.000 0.224 0.000 0.000 0.004
#> GSM876863     1  0.0458      0.886 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM876864     1  0.3109      0.725 0.772 0.000 0.224 0.000 0.000 0.004
#> GSM876865     1  0.0458      0.886 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM876866     3  0.0984      0.807 0.012 0.000 0.968 0.008 0.012 0.000
#> GSM876867     3  0.3565      0.562 0.304 0.000 0.692 0.000 0.000 0.004
#> GSM876838     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876839     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876840     2  0.3847      0.203 0.000 0.544 0.000 0.456 0.000 0.000
#> GSM876841     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876842     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876843     4  0.0000      0.972 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM876892     3  0.0436      0.830 0.004 0.000 0.988 0.004 0.004 0.000
#> GSM876893     3  0.0291      0.832 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM876894     5  0.0806      0.914 0.020 0.000 0.008 0.000 0.972 0.000
#> GSM876895     5  0.0520      0.918 0.008 0.000 0.008 0.000 0.984 0.000
#> GSM876896     6  0.1364      0.681 0.000 0.000 0.004 0.048 0.004 0.944
#> GSM876897     6  0.1364      0.681 0.000 0.000 0.004 0.048 0.004 0.944
#> GSM876868     1  0.3189      0.709 0.760 0.000 0.236 0.000 0.000 0.004
#> GSM876869     3  0.3872      0.382 0.392 0.000 0.604 0.000 0.000 0.004
#> GSM876870     1  0.3668      0.543 0.668 0.000 0.328 0.000 0.000 0.004
#> GSM876871     3  0.3354      0.650 0.240 0.000 0.752 0.000 0.004 0.004
#> GSM876872     6  0.1219      0.683 0.004 0.000 0.000 0.048 0.000 0.948
#> GSM876873     6  0.1219      0.683 0.004 0.000 0.000 0.048 0.000 0.948
#> GSM876844     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876845     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876846     4  0.1075      0.927 0.000 0.048 0.000 0.952 0.000 0.000
#> GSM876847     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876848     4  0.0146      0.972 0.000 0.000 0.000 0.996 0.000 0.004
#> GSM876849     4  0.0260      0.971 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM876898     3  0.2581      0.773 0.128 0.000 0.856 0.000 0.016 0.000
#> GSM876899     5  0.0806      0.914 0.020 0.000 0.008 0.000 0.972 0.000
#> GSM876900     3  0.0291      0.832 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM876901     3  0.0260      0.831 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM876902     6  0.4226      0.458 0.000 0.000 0.008 0.052 0.216 0.724
#> GSM876903     5  0.0260      0.917 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM876904     3  0.0291      0.832 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM876874     1  0.0458      0.886 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM876875     6  0.4326      0.153 0.492 0.000 0.008 0.000 0.008 0.492
#> GSM876876     1  0.0458      0.886 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM876877     1  0.0458      0.886 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM876878     1  0.0458      0.886 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM876879     6  0.4326      0.153 0.492 0.000 0.008 0.000 0.008 0.492
#> GSM876880     1  0.2100      0.830 0.884 0.000 0.112 0.000 0.000 0.004
#> GSM876850     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876851     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876852     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876853     2  0.0000      0.930 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM876854     2  0.3843      0.215 0.000 0.548 0.000 0.452 0.000 0.000
#> GSM876855     2  0.0146      0.927 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM876856     2  0.0146      0.927 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM876905     3  0.0291      0.832 0.004 0.000 0.992 0.000 0.004 0.000
#> GSM876906     5  0.0622      0.917 0.008 0.000 0.012 0.000 0.980 0.000
#> GSM876907     5  0.0520      0.918 0.008 0.000 0.008 0.000 0.984 0.000
#> GSM876908     5  0.0622      0.917 0.012 0.000 0.008 0.000 0.980 0.000
#> GSM876909     5  0.0520      0.916 0.008 0.000 0.008 0.000 0.984 0.000
#> GSM876881     5  0.0260      0.917 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM876882     6  0.4326      0.153 0.492 0.000 0.008 0.000 0.008 0.492
#> GSM876883     6  0.1065      0.678 0.020 0.000 0.008 0.000 0.008 0.964
#> GSM876884     1  0.0458      0.886 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM876885     6  0.1065      0.678 0.020 0.000 0.008 0.000 0.008 0.964
#> GSM876857     3  0.3521      0.612 0.268 0.000 0.724 0.000 0.004 0.004
#> GSM876858     5  0.0260      0.915 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM876859     5  0.0260      0.915 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM876860     5  0.0363      0.913 0.000 0.012 0.000 0.000 0.988 0.000
#> GSM876861     5  0.0291      0.917 0.004 0.004 0.000 0.000 0.992 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-mclust-collect-classes

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

test_to_known_factors(res)
#>             n disease.state(p) tissue(p) k
#> ATC:mclust 70          0.81917  3.13e-11 2
#> ATC:mclust 66          0.12089  1.85e-09 3
#> ATC:mclust 66          0.00108  5.09e-11 4
#> ATC:mclust 71          0.00340  8.72e-13 5
#> ATC:mclust 65          0.00221  7.83e-11 6

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


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 72 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 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-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.914           0.931       0.971         0.4489 0.559   0.559
#> 3 3 0.931           0.913       0.964         0.4736 0.766   0.587
#> 4 4 0.628           0.679       0.823         0.1280 0.865   0.625
#> 5 5 0.698           0.675       0.819         0.0642 0.869   0.547
#> 6 6 0.697           0.610       0.737         0.0361 0.978   0.899

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
#> GSM876886     2  0.0000      0.966 0.000 1.000
#> GSM876887     2  0.0000      0.966 0.000 1.000
#> GSM876888     1  0.1414      0.963 0.980 0.020
#> GSM876889     2  0.0000      0.966 0.000 1.000
#> GSM876890     2  0.0000      0.966 0.000 1.000
#> GSM876891     2  0.0000      0.966 0.000 1.000
#> GSM876862     1  0.0000      0.975 1.000 0.000
#> GSM876863     1  0.2236      0.951 0.964 0.036
#> GSM876864     1  0.0000      0.975 1.000 0.000
#> GSM876865     1  0.0000      0.975 1.000 0.000
#> GSM876866     2  0.0000      0.966 0.000 1.000
#> GSM876867     1  0.0000      0.975 1.000 0.000
#> GSM876838     2  0.0000      0.966 0.000 1.000
#> GSM876839     2  0.0000      0.966 0.000 1.000
#> GSM876840     2  0.0000      0.966 0.000 1.000
#> GSM876841     2  0.0000      0.966 0.000 1.000
#> GSM876842     2  0.0000      0.966 0.000 1.000
#> GSM876843     2  0.0000      0.966 0.000 1.000
#> GSM876892     2  0.0000      0.966 0.000 1.000
#> GSM876893     2  0.9393      0.464 0.356 0.644
#> GSM876894     2  0.0000      0.966 0.000 1.000
#> GSM876895     2  0.0000      0.966 0.000 1.000
#> GSM876896     2  0.0000      0.966 0.000 1.000
#> GSM876897     2  0.0000      0.966 0.000 1.000
#> GSM876868     1  0.0000      0.975 1.000 0.000
#> GSM876869     1  0.0000      0.975 1.000 0.000
#> GSM876870     1  0.0000      0.975 1.000 0.000
#> GSM876871     1  0.0000      0.975 1.000 0.000
#> GSM876872     2  0.0000      0.966 0.000 1.000
#> GSM876873     2  0.0000      0.966 0.000 1.000
#> GSM876844     2  0.0000      0.966 0.000 1.000
#> GSM876845     2  0.0000      0.966 0.000 1.000
#> GSM876846     2  0.0000      0.966 0.000 1.000
#> GSM876847     2  0.5737      0.831 0.136 0.864
#> GSM876848     2  0.0000      0.966 0.000 1.000
#> GSM876849     2  0.0000      0.966 0.000 1.000
#> GSM876898     1  0.0000      0.975 1.000 0.000
#> GSM876899     2  0.0000      0.966 0.000 1.000
#> GSM876900     2  0.1184      0.953 0.016 0.984
#> GSM876901     1  0.3431      0.925 0.936 0.064
#> GSM876902     2  0.0000      0.966 0.000 1.000
#> GSM876903     2  0.0000      0.966 0.000 1.000
#> GSM876904     1  0.1414      0.963 0.980 0.020
#> GSM876874     1  0.0000      0.975 1.000 0.000
#> GSM876875     2  0.7376      0.735 0.208 0.792
#> GSM876876     1  0.0000      0.975 1.000 0.000
#> GSM876877     1  0.0000      0.975 1.000 0.000
#> GSM876878     1  0.0000      0.975 1.000 0.000
#> GSM876879     2  0.3584      0.905 0.068 0.932
#> GSM876880     1  0.0000      0.975 1.000 0.000
#> GSM876850     2  0.9427      0.455 0.360 0.640
#> GSM876851     2  0.0000      0.966 0.000 1.000
#> GSM876852     2  0.0000      0.966 0.000 1.000
#> GSM876853     2  0.0000      0.966 0.000 1.000
#> GSM876854     2  0.0000      0.966 0.000 1.000
#> GSM876855     2  0.0000      0.966 0.000 1.000
#> GSM876856     2  0.0000      0.966 0.000 1.000
#> GSM876905     1  0.5059      0.872 0.888 0.112
#> GSM876906     2  0.0000      0.966 0.000 1.000
#> GSM876907     2  0.0376      0.963 0.004 0.996
#> GSM876908     2  0.0000      0.966 0.000 1.000
#> GSM876909     2  0.9850      0.272 0.428 0.572
#> GSM876881     1  0.0000      0.975 1.000 0.000
#> GSM876882     2  0.0000      0.966 0.000 1.000
#> GSM876883     2  0.0000      0.966 0.000 1.000
#> GSM876884     1  0.0000      0.975 1.000 0.000
#> GSM876885     2  0.0000      0.966 0.000 1.000
#> GSM876857     1  0.0000      0.975 1.000 0.000
#> GSM876858     2  0.0376      0.963 0.004 0.996
#> GSM876859     1  0.8386      0.627 0.732 0.268
#> GSM876860     2  0.0000      0.966 0.000 1.000
#> GSM876861     2  0.0000      0.966 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
#> GSM876886     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876887     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876888     1  0.4605      0.736 0.796 0.000 0.204
#> GSM876889     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876890     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876891     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876862     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876863     1  0.4702      0.723 0.788 0.000 0.212
#> GSM876864     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876865     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876866     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876867     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876838     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876839     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876840     3  0.6225      0.245 0.000 0.432 0.568
#> GSM876841     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876842     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876843     3  0.1031      0.944 0.000 0.024 0.976
#> GSM876892     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876893     3  0.5733      0.520 0.324 0.000 0.676
#> GSM876894     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876895     3  0.0747      0.950 0.000 0.016 0.984
#> GSM876896     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876897     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876868     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876869     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876870     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876871     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876872     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876873     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876844     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876845     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876846     3  0.4452      0.754 0.000 0.192 0.808
#> GSM876847     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876848     3  0.0424      0.954 0.000 0.008 0.992
#> GSM876849     3  0.0424      0.954 0.000 0.008 0.992
#> GSM876898     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876899     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876900     3  0.1163      0.941 0.028 0.000 0.972
#> GSM876901     1  0.0424      0.950 0.992 0.008 0.000
#> GSM876902     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876903     3  0.0892      0.947 0.000 0.020 0.980
#> GSM876904     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876874     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876875     3  0.2261      0.906 0.068 0.000 0.932
#> GSM876876     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876877     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876878     1  0.0592      0.947 0.988 0.000 0.012
#> GSM876879     3  0.0747      0.949 0.016 0.000 0.984
#> GSM876880     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876850     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876851     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876852     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876853     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876854     2  0.1643      0.932 0.000 0.956 0.044
#> GSM876855     2  0.0237      0.969 0.000 0.996 0.004
#> GSM876856     2  0.1163      0.948 0.000 0.972 0.028
#> GSM876905     1  0.0592      0.947 0.988 0.000 0.012
#> GSM876906     3  0.0592      0.952 0.000 0.012 0.988
#> GSM876907     3  0.3669      0.890 0.064 0.040 0.896
#> GSM876908     3  0.0892      0.947 0.020 0.000 0.980
#> GSM876909     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876881     1  0.6180      0.270 0.584 0.416 0.000
#> GSM876882     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876883     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876884     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876885     3  0.0000      0.957 0.000 0.000 1.000
#> GSM876857     1  0.0000      0.955 1.000 0.000 0.000
#> GSM876858     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876859     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876860     2  0.0000      0.972 0.000 1.000 0.000
#> GSM876861     2  0.6008      0.379 0.000 0.628 0.372

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM876886     4  0.5755     0.1057 0.028 0.000 0.444 0.528
#> GSM876887     4  0.4933     0.2001 0.000 0.000 0.432 0.568
#> GSM876888     1  0.5070     0.4634 0.580 0.000 0.416 0.004
#> GSM876889     4  0.3266     0.6678 0.000 0.000 0.168 0.832
#> GSM876890     4  0.4331     0.5248 0.000 0.000 0.288 0.712
#> GSM876891     4  0.4989    -0.0407 0.000 0.000 0.472 0.528
#> GSM876862     1  0.0000     0.8672 1.000 0.000 0.000 0.000
#> GSM876863     1  0.2999     0.7841 0.864 0.000 0.004 0.132
#> GSM876864     1  0.0000     0.8672 1.000 0.000 0.000 0.000
#> GSM876865     1  0.0188     0.8663 0.996 0.000 0.000 0.004
#> GSM876866     4  0.1792     0.6891 0.000 0.000 0.068 0.932
#> GSM876867     1  0.0000     0.8672 1.000 0.000 0.000 0.000
#> GSM876838     2  0.0188     0.8941 0.000 0.996 0.000 0.004
#> GSM876839     2  0.0524     0.8944 0.000 0.988 0.008 0.004
#> GSM876840     4  0.4464     0.5141 0.000 0.208 0.024 0.768
#> GSM876841     2  0.0336     0.8937 0.000 0.992 0.008 0.000
#> GSM876842     2  0.0336     0.8939 0.000 0.992 0.000 0.008
#> GSM876843     4  0.1022     0.6801 0.000 0.000 0.032 0.968
#> GSM876892     4  0.5427     0.1384 0.016 0.000 0.416 0.568
#> GSM876893     3  0.6637     0.5478 0.132 0.000 0.608 0.260
#> GSM876894     3  0.3668     0.7324 0.004 0.000 0.808 0.188
#> GSM876895     3  0.4375     0.7268 0.008 0.036 0.812 0.144
#> GSM876896     4  0.3172     0.6758 0.000 0.000 0.160 0.840
#> GSM876897     4  0.3024     0.6802 0.000 0.000 0.148 0.852
#> GSM876868     1  0.0000     0.8672 1.000 0.000 0.000 0.000
#> GSM876869     1  0.0000     0.8672 1.000 0.000 0.000 0.000
#> GSM876870     1  0.0000     0.8672 1.000 0.000 0.000 0.000
#> GSM876871     1  0.0188     0.8669 0.996 0.000 0.004 0.000
#> GSM876872     4  0.3172     0.6725 0.000 0.000 0.160 0.840
#> GSM876873     4  0.4331     0.5417 0.000 0.000 0.288 0.712
#> GSM876844     2  0.1151     0.8877 0.000 0.968 0.008 0.024
#> GSM876845     2  0.0592     0.8923 0.000 0.984 0.016 0.000
#> GSM876846     4  0.2411     0.6368 0.000 0.040 0.040 0.920
#> GSM876847     2  0.0817     0.8897 0.000 0.976 0.024 0.000
#> GSM876848     4  0.1302     0.6848 0.000 0.000 0.044 0.956
#> GSM876849     4  0.1302     0.6862 0.000 0.000 0.044 0.956
#> GSM876898     1  0.4010     0.8014 0.816 0.028 0.156 0.000
#> GSM876899     3  0.3113     0.7344 0.004 0.012 0.876 0.108
#> GSM876900     3  0.5708     0.3246 0.028 0.000 0.556 0.416
#> GSM876901     1  0.7344     0.2480 0.476 0.112 0.400 0.012
#> GSM876902     4  0.2868     0.6827 0.000 0.000 0.136 0.864
#> GSM876903     3  0.5770     0.6543 0.000 0.140 0.712 0.148
#> GSM876904     1  0.6198     0.4313 0.560 0.040 0.392 0.008
#> GSM876874     1  0.2408     0.8455 0.896 0.000 0.104 0.000
#> GSM876875     3  0.3900     0.7029 0.020 0.000 0.816 0.164
#> GSM876876     1  0.3024     0.8224 0.852 0.000 0.148 0.000
#> GSM876877     1  0.1637     0.8588 0.940 0.000 0.060 0.000
#> GSM876878     1  0.4277     0.7061 0.720 0.000 0.280 0.000
#> GSM876879     3  0.3681     0.7031 0.008 0.000 0.816 0.176
#> GSM876880     1  0.1389     0.8611 0.952 0.000 0.048 0.000
#> GSM876850     2  0.0921     0.8879 0.000 0.972 0.028 0.000
#> GSM876851     2  0.0336     0.8937 0.000 0.992 0.008 0.000
#> GSM876852     2  0.1820     0.8786 0.000 0.944 0.020 0.036
#> GSM876853     2  0.0336     0.8939 0.000 0.992 0.000 0.008
#> GSM876854     4  0.5723     0.1210 0.000 0.388 0.032 0.580
#> GSM876855     2  0.5010     0.6359 0.000 0.700 0.024 0.276
#> GSM876856     2  0.5466     0.3019 0.000 0.548 0.016 0.436
#> GSM876905     1  0.5672     0.5499 0.648 0.004 0.312 0.036
#> GSM876906     3  0.5206     0.5770 0.000 0.024 0.668 0.308
#> GSM876907     3  0.6215     0.4939 0.024 0.256 0.668 0.052
#> GSM876908     3  0.4060     0.7295 0.020 0.012 0.828 0.140
#> GSM876909     2  0.3443     0.7947 0.016 0.848 0.136 0.000
#> GSM876881     2  0.5653     0.6256 0.192 0.712 0.096 0.000
#> GSM876882     3  0.3873     0.6851 0.000 0.000 0.772 0.228
#> GSM876883     3  0.4277     0.6230 0.000 0.000 0.720 0.280
#> GSM876884     1  0.1940     0.8555 0.924 0.000 0.076 0.000
#> GSM876885     3  0.4040     0.6569 0.000 0.000 0.752 0.248
#> GSM876857     1  0.0188     0.8664 0.996 0.000 0.000 0.004
#> GSM876858     2  0.3820     0.8265 0.028 0.856 0.016 0.100
#> GSM876859     2  0.1584     0.8813 0.036 0.952 0.012 0.000
#> GSM876860     2  0.4928     0.7371 0.028 0.768 0.016 0.188
#> GSM876861     4  0.5005     0.4797 0.004 0.264 0.020 0.712

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM876886     3  0.5547     0.5931 0.068 0.000 0.676 0.224 0.032
#> GSM876887     3  0.5185     0.1394 0.000 0.000 0.568 0.384 0.048
#> GSM876888     3  0.5496    -0.2299 0.468 0.000 0.476 0.004 0.052
#> GSM876889     4  0.4803     0.2442 0.000 0.000 0.020 0.536 0.444
#> GSM876890     5  0.4477     0.5166 0.000 0.000 0.040 0.252 0.708
#> GSM876891     5  0.3772     0.6547 0.000 0.000 0.036 0.172 0.792
#> GSM876862     1  0.0290     0.8608 0.992 0.000 0.008 0.000 0.000
#> GSM876863     1  0.3370     0.7494 0.824 0.000 0.028 0.148 0.000
#> GSM876864     1  0.0324     0.8614 0.992 0.000 0.000 0.004 0.004
#> GSM876865     1  0.0912     0.8562 0.972 0.000 0.016 0.012 0.000
#> GSM876866     4  0.3002     0.7093 0.008 0.000 0.048 0.876 0.068
#> GSM876867     1  0.0613     0.8602 0.984 0.000 0.008 0.004 0.004
#> GSM876838     2  0.0703     0.8713 0.000 0.976 0.000 0.000 0.024
#> GSM876839     2  0.1251     0.8713 0.000 0.956 0.000 0.008 0.036
#> GSM876840     4  0.4754     0.3933 0.000 0.304 0.012 0.664 0.020
#> GSM876841     2  0.1043     0.8696 0.000 0.960 0.000 0.000 0.040
#> GSM876842     2  0.0609     0.8649 0.000 0.980 0.000 0.020 0.000
#> GSM876843     4  0.2208     0.7105 0.000 0.000 0.020 0.908 0.072
#> GSM876892     5  0.2462     0.7119 0.000 0.000 0.008 0.112 0.880
#> GSM876893     5  0.3022     0.7622 0.064 0.000 0.020 0.036 0.880
#> GSM876894     5  0.4402     0.5744 0.000 0.000 0.352 0.012 0.636
#> GSM876895     5  0.4184     0.7395 0.000 0.048 0.176 0.004 0.772
#> GSM876896     4  0.4168     0.6510 0.000 0.000 0.200 0.756 0.044
#> GSM876897     4  0.4395     0.6626 0.000 0.000 0.188 0.748 0.064
#> GSM876868     1  0.0324     0.8614 0.992 0.000 0.000 0.004 0.004
#> GSM876869     1  0.0613     0.8602 0.984 0.000 0.008 0.004 0.004
#> GSM876870     1  0.0290     0.8610 0.992 0.000 0.000 0.008 0.000
#> GSM876871     1  0.0404     0.8599 0.988 0.000 0.012 0.000 0.000
#> GSM876872     4  0.3807     0.5991 0.000 0.000 0.240 0.748 0.012
#> GSM876873     4  0.4848     0.2697 0.000 0.000 0.420 0.556 0.024
#> GSM876844     2  0.0963     0.8615 0.000 0.964 0.000 0.036 0.000
#> GSM876845     2  0.1197     0.8672 0.000 0.952 0.000 0.000 0.048
#> GSM876846     4  0.3285     0.6699 0.000 0.044 0.008 0.856 0.092
#> GSM876847     2  0.1430     0.8647 0.000 0.944 0.004 0.000 0.052
#> GSM876848     4  0.2769     0.7124 0.000 0.000 0.032 0.876 0.092
#> GSM876849     4  0.2903     0.7141 0.000 0.000 0.048 0.872 0.080
#> GSM876898     1  0.5956     0.1715 0.544 0.028 0.044 0.004 0.380
#> GSM876899     5  0.4688     0.6279 0.000 0.020 0.312 0.008 0.660
#> GSM876900     5  0.2069     0.7580 0.012 0.000 0.012 0.052 0.924
#> GSM876901     5  0.3783     0.7179 0.152 0.020 0.012 0.004 0.812
#> GSM876902     4  0.4720     0.6792 0.000 0.000 0.124 0.736 0.140
#> GSM876903     5  0.3849     0.7607 0.000 0.052 0.116 0.012 0.820
#> GSM876904     5  0.4724     0.6348 0.236 0.008 0.036 0.004 0.716
#> GSM876874     1  0.3421     0.7735 0.816 0.000 0.164 0.004 0.016
#> GSM876875     3  0.2599     0.7255 0.028 0.000 0.904 0.024 0.044
#> GSM876876     1  0.4468     0.6241 0.696 0.000 0.276 0.004 0.024
#> GSM876877     1  0.2511     0.8276 0.892 0.000 0.088 0.004 0.016
#> GSM876878     1  0.5246     0.2182 0.512 0.000 0.448 0.004 0.036
#> GSM876879     3  0.2362     0.7338 0.024 0.000 0.916 0.028 0.032
#> GSM876880     1  0.2102     0.8371 0.916 0.000 0.068 0.004 0.012
#> GSM876850     2  0.1571     0.8605 0.000 0.936 0.004 0.000 0.060
#> GSM876851     2  0.1121     0.8686 0.000 0.956 0.000 0.000 0.044
#> GSM876852     2  0.1205     0.8588 0.000 0.956 0.000 0.040 0.004
#> GSM876853     2  0.0794     0.8711 0.000 0.972 0.000 0.000 0.028
#> GSM876854     4  0.4899    -0.0484 0.000 0.456 0.008 0.524 0.012
#> GSM876855     2  0.3875     0.6865 0.000 0.756 0.004 0.228 0.012
#> GSM876856     2  0.4919     0.4060 0.000 0.604 0.016 0.368 0.012
#> GSM876905     5  0.3449     0.7140 0.164 0.000 0.000 0.024 0.812
#> GSM876906     5  0.2060     0.7681 0.000 0.008 0.052 0.016 0.924
#> GSM876907     5  0.4179     0.7362 0.000 0.072 0.152 0.000 0.776
#> GSM876908     5  0.3773     0.7509 0.000 0.032 0.164 0.004 0.800
#> GSM876909     5  0.5335     0.2685 0.004 0.416 0.044 0.000 0.536
#> GSM876881     2  0.6007     0.5353 0.188 0.648 0.136 0.000 0.028
#> GSM876882     3  0.2189     0.7427 0.000 0.000 0.904 0.084 0.012
#> GSM876883     3  0.2448     0.7371 0.000 0.000 0.892 0.088 0.020
#> GSM876884     1  0.2984     0.8051 0.856 0.000 0.124 0.004 0.016
#> GSM876885     3  0.2189     0.7427 0.000 0.000 0.904 0.084 0.012
#> GSM876857     1  0.0451     0.8613 0.988 0.000 0.000 0.008 0.004
#> GSM876858     2  0.3003     0.8405 0.016 0.884 0.032 0.064 0.004
#> GSM876859     2  0.2680     0.8480 0.040 0.904 0.036 0.012 0.008
#> GSM876860     2  0.3436     0.8264 0.020 0.856 0.028 0.092 0.004
#> GSM876861     2  0.5856     0.3105 0.004 0.544 0.068 0.376 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
#> GSM876886     6  0.6713     0.4667 0.064 0.000 0.036 0.252 NA 0.548
#> GSM876887     6  0.6225     0.0880 0.000 0.000 0.060 0.408 NA 0.440
#> GSM876888     1  0.5995     0.5037 0.500 0.000 0.024 0.000 NA 0.340
#> GSM876889     4  0.5801     0.2234 0.000 0.000 0.416 0.472 NA 0.044
#> GSM876890     3  0.4222     0.4894 0.000 0.000 0.692 0.268 NA 0.008
#> GSM876891     3  0.2739     0.7488 0.000 0.000 0.872 0.084 NA 0.012
#> GSM876862     1  0.0146     0.8053 0.996 0.000 0.000 0.000 NA 0.000
#> GSM876863     1  0.4844     0.6164 0.692 0.000 0.004 0.032 NA 0.048
#> GSM876864     1  0.0363     0.8062 0.988 0.000 0.000 0.000 NA 0.000
#> GSM876865     1  0.3274     0.7088 0.804 0.000 0.004 0.000 NA 0.024
#> GSM876866     4  0.5338     0.4885 0.024 0.000 0.080 0.676 NA 0.020
#> GSM876867     1  0.0260     0.8056 0.992 0.000 0.000 0.000 NA 0.000
#> GSM876838     2  0.2375     0.7062 0.000 0.896 0.016 0.020 NA 0.000
#> GSM876839     2  0.3997     0.6563 0.000 0.784 0.008 0.092 NA 0.004
#> GSM876840     4  0.5231     0.3091 0.000 0.216 0.004 0.624 NA 0.000
#> GSM876841     2  0.2369     0.7083 0.000 0.900 0.028 0.004 NA 0.008
#> GSM876842     2  0.2647     0.6924 0.000 0.868 0.000 0.044 NA 0.000
#> GSM876843     4  0.1743     0.5487 0.000 0.024 0.008 0.936 NA 0.004
#> GSM876892     3  0.2864     0.7392 0.000 0.000 0.860 0.100 NA 0.012
#> GSM876893     3  0.2454     0.7881 0.032 0.000 0.904 0.032 NA 0.008
#> GSM876894     3  0.4282     0.6865 0.000 0.000 0.720 0.000 NA 0.192
#> GSM876895     3  0.4026     0.7789 0.000 0.112 0.792 0.000 NA 0.048
#> GSM876896     4  0.5671     0.4265 0.000 0.000 0.052 0.636 NA 0.184
#> GSM876897     4  0.5905     0.4320 0.000 0.000 0.080 0.624 NA 0.172
#> GSM876868     1  0.0790     0.8030 0.968 0.000 0.000 0.000 NA 0.000
#> GSM876869     1  0.0790     0.8025 0.968 0.000 0.000 0.000 NA 0.000
#> GSM876870     1  0.0937     0.8002 0.960 0.000 0.000 0.000 NA 0.000
#> GSM876871     1  0.0458     0.8040 0.984 0.000 0.000 0.000 NA 0.000
#> GSM876872     4  0.6404     0.1518 0.000 0.000 0.024 0.456 NA 0.248
#> GSM876873     4  0.5861    -0.0423 0.000 0.000 0.016 0.448 NA 0.412
#> GSM876844     2  0.4343     0.6190 0.000 0.736 0.000 0.128 NA 0.004
#> GSM876845     2  0.1937     0.7128 0.000 0.924 0.032 0.004 NA 0.004
#> GSM876846     4  0.4301     0.4610 0.000 0.136 0.004 0.740 NA 0.000
#> GSM876847     2  0.2209     0.7084 0.000 0.904 0.040 0.000 NA 0.004
#> GSM876848     4  0.2024     0.5601 0.000 0.008 0.036 0.924 NA 0.012
#> GSM876849     4  0.1923     0.5603 0.000 0.008 0.036 0.928 NA 0.020
#> GSM876898     3  0.6831     0.3730 0.308 0.028 0.504 0.004 NA 0.060
#> GSM876899     3  0.4324     0.7414 0.000 0.036 0.756 0.000 NA 0.156
#> GSM876900     3  0.1963     0.7767 0.004 0.000 0.924 0.044 NA 0.012
#> GSM876901     3  0.3547     0.7961 0.060 0.040 0.844 0.000 NA 0.016
#> GSM876902     4  0.5730     0.4700 0.000 0.000 0.128 0.652 NA 0.120
#> GSM876903     3  0.4064     0.7681 0.000 0.128 0.776 0.000 NA 0.016
#> GSM876904     3  0.3929     0.7794 0.076 0.028 0.816 0.000 NA 0.016
#> GSM876874     1  0.4836     0.6951 0.664 0.000 0.000 0.000 NA 0.196
#> GSM876875     6  0.2681     0.7213 0.004 0.000 0.020 0.040 NA 0.888
#> GSM876876     1  0.5224     0.6554 0.616 0.000 0.004 0.000 NA 0.244
#> GSM876877     1  0.4354     0.7368 0.724 0.000 0.000 0.000 NA 0.132
#> GSM876878     1  0.5555     0.5713 0.548 0.000 0.008 0.000 NA 0.316
#> GSM876879     6  0.1881     0.7423 0.004 0.000 0.008 0.040 NA 0.928
#> GSM876880     1  0.4125     0.7458 0.748 0.000 0.000 0.000 NA 0.124
#> GSM876850     2  0.2583     0.7025 0.000 0.884 0.052 0.000 NA 0.008
#> GSM876851     2  0.1476     0.7148 0.000 0.948 0.028 0.008 NA 0.004
#> GSM876852     2  0.4381     0.6172 0.000 0.732 0.000 0.132 NA 0.004
#> GSM876853     2  0.2136     0.7078 0.000 0.908 0.012 0.016 NA 0.000
#> GSM876854     4  0.5403     0.2461 0.000 0.248 0.004 0.592 NA 0.000
#> GSM876855     2  0.5900     0.2812 0.000 0.480 0.004 0.352 NA 0.004
#> GSM876856     2  0.5828     0.1543 0.000 0.428 0.004 0.408 NA 0.000
#> GSM876905     3  0.3348     0.7666 0.112 0.000 0.836 0.016 NA 0.008
#> GSM876906     3  0.1307     0.7987 0.000 0.032 0.952 0.000 NA 0.008
#> GSM876907     3  0.4176     0.7601 0.000 0.136 0.768 0.000 NA 0.020
#> GSM876908     3  0.3649     0.7898 0.000 0.068 0.824 0.000 NA 0.068
#> GSM876909     3  0.5816     0.5275 0.012 0.284 0.580 0.004 NA 0.012
#> GSM876881     2  0.7247     0.3164 0.096 0.484 0.016 0.004 NA 0.156
#> GSM876882     6  0.2213     0.7492 0.000 0.000 0.004 0.100 NA 0.888
#> GSM876883     6  0.3726     0.7247 0.000 0.000 0.024 0.092 NA 0.812
#> GSM876884     1  0.4387     0.7323 0.720 0.000 0.000 0.000 NA 0.152
#> GSM876885     6  0.3469     0.7226 0.000 0.000 0.012 0.072 NA 0.824
#> GSM876857     1  0.0935     0.8028 0.964 0.000 0.000 0.004 NA 0.000
#> GSM876858     2  0.5336     0.5575 0.020 0.584 0.004 0.000 NA 0.064
#> GSM876859     2  0.5412     0.5756 0.036 0.620 0.000 0.000 NA 0.080
#> GSM876860     2  0.5432     0.5426 0.020 0.564 0.004 0.000 NA 0.068
#> GSM876861     2  0.6214     0.4040 0.016 0.444 0.000 0.016 NA 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) tissue(p) k
#> ATC:NMF 69           0.7600  6.14e-05 2
#> ATC:NMF 69           0.5754  1.69e-11 3
#> ATC:NMF 60           0.0629  1.91e-08 4
#> ATC:NMF 61           0.2604  8.91e-16 5
#> ATC:NMF 54           0.2872  1.57e-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.

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